define('SERVER_URL', "http://www.mxchange.org");
// This current patch level
-define('CURR_SVN_REVISION', "311");
+define('CURR_SVN_REVISION', "312");
// Take a prime number which is long (if you know a longer one please try it out!)
define('_PRIME', 591623);
} // END - if
// Take all string elements
- if (("".bigintval($matches[4][$key])."" != $matches[4][$key]) && (!isset($matchesFound[$key."_".$matches[4][$key]]))) {
+ if ((is_string($matches[4][$key])) && (!isset($matchesFound[$key."_".$matches[4][$key]]))) {
// Replace it in the code
$newMatch = str_replace("[".$matches[4][$key]."]", "['".$matches[4][$key]."']", $match);
$code = str_replace($match, $newMatch, $code);
function array_pk_sort(&$array, $a_sort, $primary_key = 0, $order = -1, $nums = false)
{
$dummy = $array;
- while ($primary_key < count($a_sort))
- {
- foreach ($dummy[$a_sort[$primary_key]] as $key => $value)
- {
- foreach ($dummy[$a_sort[$primary_key]] as $key2 => $value2)
- {
+ while ($primary_key < count($a_sort)) {
+ foreach ($dummy[$a_sort[$primary_key]] as $key => $value) {
+ foreach ($dummy[$a_sort[$primary_key]] as $key2 => $value2) {
$match = false;
- if (!$nums)
- {
+ if (!$nums) {
// Sort byte-by-byte (also numbers will be interpreted as chars! E.g.: "9" > "10")
if (($key != $key2) && (strcmp(strtolower($dummy[$a_sort[$primary_key]][$key]), strtolower($dummy[$a_sort[$primary_key]][$key2])) == $order)) $match = true;
- }
- elseif ($key != $key2)
- {
+ } elseif ($key != $key2) {
// Sort numbers (E.g.: 9 < 10)
if (($dummy[$a_sort[$primary_key]][$key] < $dummy[$a_sort[$primary_key]][$key2]) && ($order == -1)) $match = true;
if (($dummy[$a_sort[$primary_key]][$key] > $dummy[$a_sort[$primary_key]][$key2]) && ($order == 1)) $match = true;
}
- if ($match)
- {
+
+ if ($match) {
// We have found two different values, so let's sort whole array
- foreach ($dummy as $sort_key => $sort_val)
- {
+ foreach ($dummy as $sort_key => $sort_val) {
$t = $dummy[$sort_key][$key];
$dummy[$sort_key][$key] = $dummy[$sort_key][$key2];
$dummy[$sort_key][$key2] = $t;
unset($t);
- }
- }
- }
- }
+ } // END - foreach
+ } // END - if
+ } // END - foreach
+ } // END - foreach
// Count one up
$primary_key++;
- }
+ } // END - while
// Write back sorted array
$array = $dummy;
// Filter all numbers out
$ret = preg_replace("/[^0123456789]/", "", $num);
+ // Shall we cast?
+ if ($castValue) $ret = (double)$ret;
+
+ // Has the whole value changed?
+ if ("".$ret."" != "".$num."") {
+ // Log the values
+ DEBUG_LOG(__FUNCTION__.": num={$num},ret={$ret}");
+ } // END - if
+
// Return result
return $ret;
}
$dir = dir($this->_cache_dir);
while($file=$dir->read()) {
// Exclude directories
- if (is_file($dir->path.$file) && substr($file, -6, 6) != ".cache") {
+ if (is_file($dir->path.$file) && substr($file, -6, 6) != ".cache" && substr($file, -4, 4) != ".log") {
if(!@unlink($dir->path.$file)) {
- $this->_throw_exception(
- "Unable to unlink ".$dir->path.$file
- ."<br /><br />Exception at Line: ".__LINE__ );
+ $this->_throw_exception("Unable to unlink ".$dir->path.$file."<br />\n<br />\nException at Line: ".__LINE__ );
return false;
- }
- }
- }
+ } // END - if
+ } // END - if
+ } // END - while
$dir->close();
return true;
} // END clear_cache()
function _cut_string( $string, $str_len = "30" )
{
if(strlen(trim($string))>$str_len) {
- $string = substr( trim($string) , 0, $str_len - 4);
- $string .= " ...";
+ $string = substr( trim($string) , 0, $str_len - 4);
+ $string .= " ...";
}
return $string;
} // END _cut_string()
if (rand(1, 100) <= $this->gc_probability) {
$dir = dir($this->_cache_dir);
while($file=$dir->read()) {
- if (is_file($dir->path.$file) && substr($file, -6, 6) != ".cache" && filemtime($dir->path.$file) <= time() - $this->_refresh ) {
- @unlink($dir->path.$file);
- }
+ if (is_file($dir->path.$file) && substr($file, -6, 6) != ".cache" && substr($file, -4, 4) != ".log" && filemtime($dir->path.$file) <= time() - $this->_refresh ) {
+ @unlink($dir->path.$file);
+ } // END - if
}
$dir->close();
} // END if