示例#1
0
 /**
  * IsPointless
  * 
  * Used by the constructor to determine whether we need to load up the full
  * OnePanel environment.
  * 
  * @return boolean
  */
 private function IsPointless()
 {
     if (!OnePanelLib::InAjaxMode()) {
         if (!OnePanelLib::InConsole()) {
             OnePanelDebug::Info('Breaking out of OnePanel, normal admin page.');
             return true;
         }
     } else {
         if (isset($_POST['action'])) {
             // Set some useful variables
             $action_string = $_POST['action'];
             $action_has_op_prefix = substr($_POST['action'], 0, strlen(ONE_PANEL_AJAX_PREFIX)) == ONE_PANEL_AJAX_PREFIX;
             if (!$action_has_op_prefix) {
                 OnePanelDebug::Info('Breaking out of OnePanel, normal admin ajax request.');
                 return true;
             }
         }
     }
     return false;
 }
示例#2
0
 *  TODO consider allowing language terms of One Panel to be editable in future,
 *  the object will need to be started here at that point.
 */
OnePanelLib::RequireFileOnce(ONE_PANEL_DIR . '/language.php');
// Include the config class, and create the OnePanelConfig Object
OnePanelLib::RequireFileOnce(ONE_PANEL_DIR . '/onepanelconfig.php');
OnePanelConfig::Start();
// Include Externals
//OnePanelLib::RequireFileOnce( ONE_PANEL_DIR .'/onepanelexternals.php' );
//OnePanelExternals::AddActions();
// THESE ARE BROKEN
/*
 * Create one of two objects depending on which environment we appear
 * to be using. The OnePanelTheme has methods that should be available to
 * theme developers, but do not need to be present in the backend.
 */
if (is_admin() || OnePanelLib::InAjaxMode()) {
    // Log
    OnePanelDebug::Info('Running non AJAX mode in OnePanel.');
    // Instantiate the OnePanel Object
    OnePanelLib::RequireFileOnce(ONE_PANEL_DIR . '/panel/onepanel.php');
    OnePanel::Start();
} else {
    /*
     * TODO There is no reason to load the OnePanelTheme object if a config file
     * isnt present in the theme folder.
     */
    // Instantiate the OnePanelTheme Object
    OnePanelLib::RequireFileOnce(ONE_PANEL_DIR . '/onepaneltheme.php');
    OnePanelTheme::Start();
}
示例#3
0
 public static function Shutdown()
 {
     /*
      * Break out of this function if we do not need to run it.
      * This is important when we are not in AJAX mode and the 
      * user is not looking at OnePanel
      * 
      */
     if (!OnePanelLib::InConsole()) {
         return true;
     }
     /*
      * TODO
      * Ive got a feeling that printing <script> tags outside the html tags is a bad idea
      * perhaps this function should only be used as a last ditch attempt to scrape data in
      * the case of a fatal php error and another shutdown function should be run after the
      * plugin has completed whatever hook is being called.
      * 
      */
     // Discern whether a fatal error occured TODO handle non fatals
     $last_error = error_get_last();
     if ($last_error['type'] === E_ERROR || $last_error['type'] === E_USER_ERROR || $last_error['type'] === E_COMPILE_ERROR || $last_error['type'] === E_CORE_ERROR || $last_error['type'] === E_RECOVERABLE_ERROR) {
         // Fail the last entry
         self::FailIncompleteTrackers();
         // Store the log if necessary
         // Stop the clock
         self::$finish_time = microtime(true);
         // Record memory usage
         self::$finish_mu = memory_get_usage();
         // Output the apppropriate data depending on running environment (AJAX or normal)
         echo self::GetRawOutput();
     } else {
         // Stop the clock
         self::$finish_time = microtime(true);
         // Record memory usage
         self::$finish_mu = memory_get_usage();
         // Script completed. Send the jacascript to populate the error console
         if (!OnePanelLib::InAjaxMode()) {
             echo self::GetOutput();
             // TODO, devise a strategy to append the return ajax data with the error console data.
         }
     }
     return true;
 }