const EXCEPTION_DATABASE_UPDATED_NOT_ALLOWED = 0x039;
const EXCEPTION_FILTER_CHAIN_INTERCEPTED = 0x040;
- // Hexadecimal->Decimal translation array
+ /**
+ * Hexadecimal->Decimal translation array
+ */
private static $hexdec = array(
'0' => 0,
'1' => 1,
'f' => 15
);
- // Decimal->hexadecimal translation array
+ /**
+ * Decimal->hexadecimal translation array
+ */
private static $dechex = array(
0 => '0',
1 => '1',
15 => 'f'
);
+ /**
+ * Startup time in miliseconds
+ */
+ private static $startupTime = 0;
+
/**
* Protected super constructor
*
// ... because registries doesn't need to be configured
$this->setConfigInstance(FrameworkConfiguration::getInstance());
} // END - if
+
+ // Is the startup time set? (0 cannot be true anymore)
+ if (self::$startupTime == 0) {
+ // Then set it
+ self::$startupTime = microtime(true);
+ } // END - if
}
/**
- * Destructor reached...
+ * Destructor for all classes
*
* @return void
*/
protected function replaceControlCharacters ($str) {
// Replace them
$str = str_replace(
- "\r", '[r]', str_replace(
- "\n", '[n]', str_replace(
- "\t", '[t]',
+ chr(13), '[r]', str_replace(
+ chr(10), '[n]', str_replace(
+ chr(9) , '[t]',
$str
)));
} else {
// Put directly out
if ($doPrint === true) {
- print($message);
+ // Are debug times enabled?
+ if ($this->getConfigInstance()->getConfigEntry('debug_output_timings') == 'Y') {
+ // Output it first
+ print($this->getPrintableExecutionTime());
+ } // END - if
+
+ // Print message
+ print($message . chr(10));
} else {
// DO NOT REWRITE THIS TO app_die() !!!
die($message);
} // END - if
// Add line number to the code
- foreach (explode("\n", $phpCode) as $lineNo => $code) {
+ foreach (explode(chr(10), $phpCode) as $lineNo => $code) {
// Add line numbers
$markedCode .= sprintf("<span id=\"code_line\">%s</span>: %s\n",
($lineNo + 1),
//* NOISY-DEBUG: */ $this->debugOutput($this->__toString() . ': cacheKey=' . $cacheKey);
return $cacheKey;
}
+
+ /**
+ * Getter for startup time in miliseconds
+ *
+ * @return $startupTime Startup time in miliseconds
+ */
+ protected function getStartupTime () {
+ return self::$startupTime;
+ }
+
+ /**
+ * "Getter" for a printable currently execution time in nice braces
+ *
+ * @return $executionTime Current execution time in nice braces
+ */
+ protected function getPrintableExecutionTime () {
+ // Caculate the execution time
+ $executionTime = microtime(true) - $this->getStartupTime();
+
+ // Pack it in nice braces
+ $executionTime = sprintf('[ %01.4f ] ', $executionTime);
+
+ // And return it
+ return $executionTime;
+ }
}
// [EOF]
// Prepare the output
$output = trim(html_entity_decode(strip_tags(stripslashes($output))));
+ // Are debug times enabled?
+ if ($this->getConfigInstance()->getConfigEntry('debug_output_timings') == 'Y') {
+ // Output it first
+ print($this->getPrintableExecutionTime());
+ } // END - if
+
// And print it out...
- printf("%s\n", $output);
+ printf('%s%s', $output, chr(10));
}
/**
*/
public final function outputStream ($output) {
// Split multiple lines into and array to put them out line-by-line
- $errorLines = explode("\n", $output);
+ $errorLines = explode(chr(10), $output);
+
+ // "Walk" through all lines
foreach ($errorLines as $err) {
+ // Trim any spaces, \n, \r etc. out
$err = trim($err);
+
// Log only none-empty lines
if (!empty($err)) {
// Log this line
error_log(html_entity_decode(strip_tags($err)), 0);
- }
- }
+ } // END - if
+ } // END - foreach
}
/**
} // END - if
// Count it up again
- //* NOISY-DEBUG: */ print __METHOD__.': className=' .$className . "\n";
+ //* NOISY-DEBUG: */ print __METHOD__.': className=' .$className . chr(10);
self::$objectCounters[$className]++;
}
* @return void
*/
protected final function addContent ($newContent) {
- $this->content .= (string) trim($newContent) . "\n";
+ $this->content .= (string) trim($newContent) . chr(10);
}
/**
// Is header content there?
if (isset($this->groups['header'])) {
// Then add it
- $content .= $this->groups['header']['content'] . "\n";
+ $content .= $this->groups['header']['content'] . chr(10);
} // END - if
// Initiate content
// Is footer content there?
if (isset($this->groups['footer'])) {
// Then add it
- $content .= $this->groups['footer']['content'] . "\n";
+ $content .= $this->groups['footer']['content'] . chr(10);
} // END - if
// Return it
$fileInstance->closeFile();
// Convert it into an array
- $inputBuffer = explode("\n", $inputBuffer);
+ $inputBuffer = explode(chr(10), $inputBuffer);
// Now process the read lines and verify it's content
foreach ($inputBuffer as $rawLine) {
$readData .= $data[0];
} else {
// Other raw lines than header/data tagged lines and re-add the new-line char
- $readData .= $rawLine . "\n";
+ $readData .= $rawLine . chr(10);
}
} // END - foreach
* @return void
*/
public final function output ($outStream = false) {
- print trim($outStream) . "\n";
+ print trim($outStream) . chr(10);
}
}
$this->extraNumber = ($this->prime * $this->prime / pow(pi(), 2));
// Seed mt_rand()
- mt_srand((double) sqrt(microtime() * 100000000 * $this->extraNumber));
+ mt_srand((double) sqrt(microtime(true) * 100000000 * $this->extraNumber));
// Set the server IP to cluster
$serverIp = 'cluster';
*/
public function compactContent ($uncompactedContent) {
// First, remove all tab/new-line/revert characters
- $compactedContent = str_replace("\t", '', str_replace("\n", '', str_replace("\r", '', $uncompactedContent)));
+ $compactedContent = str_replace(chr(9), '', str_replace(chr(10), '', str_replace(chr(13), '', $uncompactedContent)));
// Then regex all comments like <!-- //--> away
preg_match_all('/<!--[\w\W]*?(\/\/){0,1}-->/', $compactedContent, $matches);
// CFG: COMPRESSOR-CHANNEL-CLASS
$cfg->setConfigEntry('compressor_channel_class', 'CompressorChannel');
+// CFG: DEBUG-OUTPUT-TIMINGS
+$cfg->setConfigEntry('debug_output_timings', 'N');
+
// [EOF]
?>