SpamBlocker
Spam Blocker is a CakePHP Behavior that automatically before after a comment is made. Each comment is tested upon a point system to determine if it should be approved, set to pending (high points), or marked as spam / deleted (low points).
Debug
Outputs/Debugs a variable and shows where it was called from.
Function: debug()
Category: PHP
Views: 744
Permalink -
Tinylink
/** * Outputs/Debugs a variable and shows where it was called from * @param mixed $var * @param boolean $dump * @param boolean $backtrace * @return string */ function debug($var, $dump = false, $backtrace = true) { if (error_reporting() > 0) { if ($backtrace) { $calledFrom = debug_backtrace(); echo '<strong>' . trim(str_replace($_SERVER['DOCUMENT_ROOT'], '', $calledFrom[0]['file'])) . '</strong> (line <strong>' . $calledFrom[0]['line'] . '</strong>)'; } echo '<pre class="debug">'; $function = ($dump) ? 'var_dump' : 'print_r'; $function($var); echo '</pre>'; } }