コード例 #1
0
 /**
  * Check if this is one of our rewrite endpoints (non-existent pages)
  */
 function checkRewrites()
 {
     /**
      * Just return if it's nothing we're interested in
      */
     if (!preg_match('%/easyrecipe-(printstyle|diagnostics|style|print)(?:/((?:.*/)?[^?/]+))?%', $_SERVER['REQUEST_URI'], $regs)) {
         return;
     }
     switch ($regs[1]) {
         case 'print':
             if (preg_match('/^(\\d+)-(\\d+)$/', $regs[2], $regs)) {
                 $this->printRecipe($regs[1], $regs[2]);
             }
             break;
         case 'diagnostics':
             if (current_user_can('administrator')) {
                 $diagnostics = new EasyRecipePlusDiagnostics();
                 $diagnostics->show();
             }
             break;
         case 'style':
             $this->customStyleHandler($regs[2]);
             break;
         case 'printstyle':
             $this->customStyleHandler($regs[2], true);
             break;
     }
 }
コード例 #2
0
 /**
  * Check if this is one of our rewrite endpoints (non-existent pages)
  *
  * @param array $headers
  * @return array
  */
 function checkRewrites($headers)
 {
     /**
      * Just return if it's nothing we're interested in
      */
     if (!preg_match('%/easyrecipe-(printstyle|diagnostics|style|print|debuglogs|log)(?:/((?:.*/)?[^?/]+))?%', $_SERVER['REQUEST_URI'], $regs)) {
         return $headers;
     }
     switch ($regs[1]) {
         //            case 'print' :
         //                if (preg_match('/^(\d+)-(\d+)$/', $regs[2], $regs)) {
         //                    $print = new EasyRecipePlusPrint($this);
         //                    $print->printRecipe($regs[1], $regs[2]);
         //                    exit;
         //                }
         //                break;
         case 'diagnostics':
             if (current_user_can('administrator')) {
                 $diagnostics = new EasyRecipePlusDiagnostics();
                 $diagnostics->show();
             }
             break;
         case 'debuglogs':
             if (current_user_can('administrator')) {
                 $debugLog = new EasyRecipePlusDebugLog();
                 $debugLog->showLogs();
             }
             break;
         case 'log':
             if (current_user_can('administrator')) {
                 $debugLog = new EasyRecipePlusDebugLog();
                 $debugLog->showLog($regs[2]);
             }
             break;
         case 'style':
             $this->customStyleHandler($regs[2]);
             break;
         case 'printstyle':
             $this->customStyleHandler($regs[2], true);
             break;
     }
     return $headers;
 }