コード例 #1
0
ファイル: class-dbug.php プロジェクト: eaglstun/dbug
 public static function setup()
 {
     // set path to logs
     self::$LOG_PATH = get_log_path();
     // set max filesize of logs
     self::$LOG_FILESIZE = get_log_filesize();
     //
     self::$error_handler = set_error_handler();
     // set default error handling to screen to logs
     self::set_error_level();
 }
コード例 #2
0
ファイル: admin.php プロジェクト: eaglstun/dbug
function menu()
{
    $log_path = get_log_path();
    $vars = (object) array('dbug_logging' => (object) array('screen' => '', 'log' => ''), 'dbug_log_path' => $log_path, 'path' => plugins_url('public/', __FILE__));
    // possible values
    $error_levels = array(E_WARNING => '', E_NOTICE => '', E_STRICT => '', E_USER_DEPRECATED => '', E_ALL => '');
    // stored values
    $dbug_error_levels = get_option('dbug_error_level');
    // mereged values
    $dbug_error_levels = is_array($dbug_error_levels) ? $dbug_error_levels + $error_levels : $error_levels;
    foreach ($dbug_error_levels as $k => $v) {
        if ((int) $dbug_error_levels[$k] > 0) {
            $dbug_error_levels[$k] = 'checked="checked"';
        }
    }
    $vars->dbug_error_level = $dbug_error_levels;
    if ($selected = get_option('dbug_logging')) {
        $vars->dbug_logging->{$selected} = 'checked="checked"';
    }
    $log_bytes = get_log_filesize();
    $vars->dbug_log_filesize = $log_bytes / (1024 * 1024);
    // log file viewer
    $log_files = array();
    $excluded = array('.', '..', '.htaccess');
    if ($handle = opendir($log_path)) {
        while (false !== ($entry = readdir($handle))) {
            if (!in_array($entry, $excluded)) {
                $log_files[] = $entry;
            }
        }
        closedir($handle);
    }
    $vars->log_files = $log_files;
    echo render('admin/options-general', $vars);
}