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'); }
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'); }
function Import_Images() { # Enqueue Scripts and Styles WP_Enqueue_Style('media'); WP_Enqueue_Style('fancy-gallery-import-images', $this->core->base_url . '/meta-boxes/import-images-form.css', Null, $this->core->version); WP_Enqueue_Script('fancy-gallery-import-images', $this->core->base_url . '/meta-boxes/import-images-form.js', array('jquery'), $this->core->version, True); # Check if an attachment should be moved $message = ''; if (isset($_REQUEST['move_attachment']) && isset($_REQUEST['move_to'])) { $attachment_id = IntVal($_REQUEST['move_attachment']); $dst_post_id = IntVal($_REQUEST['move_to']); WP_Update_Post(array('ID' => $attachment_id, 'post_parent' => $dst_post_id)); $message = I18n::t('The Attachment was moved to your gallery.'); } # Generate Output return WP_iFrame(array($this, 'Print_Import_Images_Form'), $message); }
public function Enqueue_Frontend_Scripts() { # Check for HTML5 galleries if (!Current_Theme_Supports('html5', 'gallery')) { $this->Enqueue_Frontend_Stylehseet($this->base_url . '/assets/css/html5-galleries.css'); } # Enqueue Template Stylesheets foreach ($this->Get_Template_Files() as $template_name => $template_properties) { if ($stylesheet_uri = $template_properties['stylesheet_uri']) { $this->Enqueue_Frontend_Stylehseet($stylesheet_uri); } } # Enqueue the Script WP_Enqueue_Script('fancy-gallery', $this->base_url . '/assets/js/fancy-gallery.js', array('jquery'), $this->version, $this->options->Get('script_position') != 'header'); $arr_options = $this->options->Get(); unset($arr_options['disable_update_notification'], $arr_options['update_username'], $arr_options['update_password']); $arr_options['stylesheets'] = $this->arr_stylesheets; WP_Localize_Script('fancy-gallery', 'FANCYGALLERY', $arr_options); }