Exemplo n.º 1
0
 public function Load_Options_Page()
 {
     # Check if the user trys to delete a template
     if (isset($_GET['delete']) && $this->core->Get_Template_Properties($_GET['delete'])) {
         # You can only delete Fancy Gallery Templates!
         Unlink($_GET['delete']);
         WP_Redirect($this->Get_Options_Page_Url(array('template_deleted' => 'true')));
     } elseif (isset($_GET['delete'])) {
         WP_Die($this->t('Error while deleting: ' . $_GET['delete']));
     }
     # If the Request was redirected from a "Save Options"-Post
     if (isset($_REQUEST['options_saved'])) {
         Flush_Rewrite_Rules();
     }
     # If this is a Post request to save the options
     $options_saved = $this->Save_Options();
     $template_installed = $this->core->Install_Template();
     if ($options_saved && $template_installed) {
         WP_Redirect($this->Get_Options_Page_Url(array('options_saved' => 'true', 'template_installed' => 'true')));
     } elseif ($options_saved) {
         WP_Redirect($this->Get_Options_Page_Url(array('options_saved' => 'true')));
     } elseif ($template_installed) {
         WP_Redirect($this->Get_Options_Page_Url(array('template_installed' => 'true')));
     }
     WP_Enqueue_Script('dashboard');
     WP_Enqueue_Style('dashboard');
     WP_Enqueue_Script('fancy-gallery-options-page', $this->core->base_url . '/options-page/options-page.js', array('jquery'), $this->core->version, True);
     WP_Enqueue_Style('fancy-gallery-options-page', $this->core->base_url . '/options-page/options-page.css');
     # Remove incompatible JS Libs
     WP_Dequeue_Script('post');
 }
Exemplo n.º 2
0
 static function loadOptionsPage()
 {
     # If the Request was redirected from a "Save Options"-Post
     if (isset($_REQUEST['options_saved'])) {
         Flush_Rewrite_Rules();
     }
     # If this is a Post request to save the options
     if (self::saveOptions()) {
         WP_Redirect(self::getOptionsPageUrl(array('options_saved' => 'true')));
     }
     WP_Enqueue_Script('dashboard');
     # Remove incompatible JS Libs
     WP_Dequeue_Script('post');
 }