예제 #1
0
 function render()
 {
     require_once plugin_dir_path(__DIR__) . '/admin/includes/class-files-view-page.php';
     $files = Log_Viewer_Admin::getFiles();
     $showEditSection = true;
     if (empty($files)) {
         $showEditSection = false;
     }
     $realfile = Log_Viewer_Admin::transformFilePath($this->getCurrentFile());
     $writeable = is_writeable($realfile);
     if (isset($file)) {
         var_dump(array($realfile, $writeable));
         die;
     }
     if (!$writeable) {
         $action = false;
     }
     include $this->_view_file;
 }
예제 #2
0
 /**
  * Handles page view with post actions and output
  * Respects user options
  *
  * TODO - FUTURE :
  *  - splitting functionality / event based
  *
  */
 public function view_page()
 {
     if (array_key_exists(self::$_KEYS_FILEACTION_SUBMIT, $_POST) && check_admin_referer('actions_nonce', 'actions_nonce')) {
         $file = $_POST[self::$_KEYS_FILEACTION_FILE];
         $fileaction = $_POST[self::$_KEYS_FILEACTION_ACTION];
         $result = $this->_handle_fileaction($fileaction, $file);
         // Bug: Workaround for wp_redirect not working
         unset($file, $fileaction);
     }
     if (array_key_exists(self::$_KEYS_VIEWFIELDS_SUBMIT, $_POST) && check_admin_referer('viewoptions_nonce', 'viewoptions_nonce')) {
         $viewoptions = array(User_Options::KEYS_AUTOREFRESH => array_key_exists(User_Options::KEYS_AUTOREFRESH, $_POST) ? 1 : 0);
         if (array_key_exists(User_Options::KEYS_LINEOUTPUTORDER, $_POST)) {
             $viewoptions[User_Options::KEYS_LINEOUTPUTORDER] = (int) $_POST[User_Options::KEYS_LINEOUTPUTORDER];
         }
         do_action(self::$ACTIONS_VIEWOPTIONS_CHANGED, $viewoptions);
     }
     $files = Log_Viewer_Admin::getFiles();
     $showEditSection = true;
     if (empty($files)) {
         $showEditSection = false;
     }
     $realfile = Log_Viewer_Admin::transformFilePath($this->getCurrentFile());
     $writeable = is_writeable($realfile);
     if (isset($file)) {
         var_dump(array($realfile, $writeable));
         die;
     }
     if (!$writeable) {
         $action = false;
     }
     include_once $this->_view_file;
 }
예제 #3
0
 /**
  * Return an instance of this class or false on error.
  *
  * @since    13.11.10
  *
  * @return    bool|Log_Viewer_Admin    A single instance of this class.
  */
 public static function get_instance()
 {
     if (!is_super_admin()) {
         return false;
     }
     // If the single instance hasn't been set, set it now.
     if (null == self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }