Source for file sl_debug.php

Documentation is available at sl_debug.php

  1. <?php
  2.  
  3.     /**
  4.     * Sloodle debug script.
  5.     *
  6.     * Activates or deactivates debug mode, depending on a request parameter.
  7.     *
  8.     * @package sloodle
  9.     * @copyright Copyright (c) 2007-8 Sloodle (various contributors)
  10.     * @license http://www.gnu.org/licenses/gpl-3.0.html GNU GPL v3
  11.     *
  12.     * @contributor Peter R. Bloomfield
  13.     *
  14.     */
  15.  
  16.     // Define the name of the debug mode parameter
  17.     define('SLOODLE_DEBUG_MODE_PARAM_NAME''sloodledebug');
  18.  
  19.     // Get the parameter
  20.     if (isset($_REQUEST[SLOODLE_DEBUG_MODE_PARAM_NAME])) $_dbg strtolower(trim($_REQUEST[SLOODLE_DEBUG_MODE_PARAM_NAME]));
  21.     // Should debug mode be activated? Check for typical values, such as "true", "yes", "ok" and "1"
  22.     if (isset($_dbg&& !empty($_dbg&& ($_dbg[0== 't' || $_dbg == 'ok' || $_dbg == 'on' || $_dbg[0== 'y' || (int)$_dbg != 0)) {
  23.         define('SLOODLE_DEBUG'TRUE);
  24.         // Enable PHP error display and full reporting level
  25.         ini_set('display_errors''1');
  26.         error_reporting(2047);
  27.     else {
  28.         define('SLOODLE_DEBUG'FALSE);
  29.         // Disable PHP error display
  30.         ini_set('display_errors''0');
  31.         // Note that the error reporting level is not changed here -- this is to ensure that the error log is still written to
  32.     }
  33.     
  34.     // Sloodle debug output function
  35.     // Will echo the given string to the HTTP response if Sloodle debug mode is active
  36.     function sloodle_debug_output($str)
  37.     {
  38.         if (SLOODLE_DEBUGecho $str;
  39.     }
  40. ?>

Documentation generated on Tue, 04 Mar 2008 15:08:38 +0000 by phpDocumentor 1.4.0