/** * Class initialization. * * Get and set required properties, and add our action hooks, function * calls and file includes to initialize this class. * * @wp-hook void * @uses add_action() * @since 2.0.0 * @return void */ public function init() { // Retrieve required properties from our main plugin class. $this->plugin = NextGEN_Gallery_Optimizer_Basic::get_instance(); $vars = $this->plugin->get_vars(); $this->settings_slug = $vars['settings_slug']; $this->plugin_dir_url = $vars['plugin_dir_url']; $this->prefix = $vars['prefix']; $this->version = $vars['version']; // Retrieve required properties from our main admin class. $this->admin = NGGOBASIC_Admin::get_instance(); $vars = $this->admin->get_vars(); $this->plugin_dir_file = $vars['plugin_dir_file']; // Get our settings instance. $this->settings = NGGOBASIC_Settings::get_instance(); // Reset our class/rel code if accidentally changed. add_action('admin_init', array($this, 'update_modified_fancybox_code')); // Register and enqueue Optimizer's JavaScript file for NextGEN's lightbox settings. add_action('admin_enqueue_scripts', array($this, 'enqueue_nextgen_options_page_js')); // Install our lightbox on initial activation add_action('admin_footer', array($this, 'install_controller')); // Uninstall Fancybox if Optimizer is deactivated. register_deactivation_hook($this->plugin_dir_file, array($this, 'uninstall_controller')); }
/** * Class initialization. * * Get and set required properties, and add our action hooks, function * calls and file includes to initialize this class. * * @wp-hook void * @uses add_action() * @since 2.0.0 * @return void */ public function init() { // Retrieve required properties from our main plugin class. $this->plugin = NextGEN_Gallery_Optimizer_Basic::get_instance(); $vars = $this->plugin->get_vars(); $this->db = $vars['db']; $this->prefix = $vars['prefix']; $this->version = $vars['version']; $this->plugin_dir_url = $vars['plugin_dir_url']; $this->plugin_dir_path = $vars['plugin_dir_path']; $this->fancybox_version = $vars['fancybox_version']; // Access our class methods and properties in NGGOBASIC_Register_Scripts. $this->register_scripts = NGGOBASIC_Register_Scripts::get_instance(); $vars = $this->register_scripts->get_vars(); $this->jquery_version = $vars['jquery_version']; $this->jquery_migrate_version = $vars['jquery_migrate_version']; // Check if we have an active NextGEN widget. add_action('init', array($this, 'is_nextgen_widget_active')); }
/** * Class initialization. * * Get and set required properties, and add our action hooks, function * calls and file includes to initialize this class. * * @wp-hook void * @uses add_action() * @since 2.0.0 * @return void */ public function init() { // Retrieve required properties from our main plugin class. $this->plugin = NextGEN_Gallery_Optimizer_Basic::get_instance(); $vars = $this->plugin->get_vars(); $this->db_name = $vars['db_name']; $this->prefix = $vars['prefix']; $this->version = $vars['version']; $this->plugin_dir_url = $vars['plugin_dir_url']; $this->plugin_dir_path = $vars['plugin_dir_path']; // Retrieve required properties from our main admin class. $this->admin = NGGOBASIC_Admin::get_instance(); $vars = $this->admin->get_vars(); $this->fancybox_interface_slug = $vars['fancybox_interface_slug']; // Get our settings instance. $this->settings = NGGOBASIC_Settings::get_instance(); // Add our action hooks. add_action('admin_menu', array($this, 'add_options_page')); add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts_and_styles')); /** * Remove all admin toolbars, notifications and navigation elements from * the Fancybox settings interface. * * We need to detect the page the PHP way here as get_current_screen() * isn't available in time to access the admin_bar_init hook. */ if (isset($_GET['page']) && $_GET['page'] == $this->fancybox_interface_slug) { // Remove top admin bar. add_filter('init', array($this, 'remove_top_admin_bar')); // Doesn't seem to work on admin_init. // Remove the update nag. add_action('admin_notices', array($this, 'remove_update_nag'), 1); // Priority 1 is important here. // Remove NextGEN's "Gallery" menu item. add_action('admin_init', array($this, 'remove_nextgen_menu_item')); // Doesn't seem to work on admin_menu. // Remove all WordPress menu items. add_action('admin_menu', array($this, 'remove_admin_menu_items')); // Remove the WordPress colophon and version number. add_action('admin_init', array($this, 'remove_footer')); } }
/** * Class initialization. * * Get and set required properties, and add our action hooks, function * calls and file includes to initialize this class. * * @wp-hook void * @uses add_action() * @since 2.0.0 * @return void */ public function init() { // Retrieve required properties from our main plugin class. $this->plugin = NextGEN_Gallery_Optimizer_Basic::get_instance(); $vars = $this->plugin->get_vars(); $this->prefix = $vars['prefix']; $this->db_name = $vars['db_name']; $this->nextgen_v1 = $vars['nextgen_v1']; $this->nextgen_v2 = $vars['nextgen_v2']; $this->settings_slug = $vars['settings_slug']; $this->plugin_dir_path = $vars['plugin_dir_path']; }
/** * Class initialization. * * Get and set required properties, and add our action hooks to initialize * this class. * * @wp-hook void * @uses add_action(), add_filter() * @since 2.1 * @return void */ public function init() { // Retrieve required properties from our main plugin class. $this->plugin = NextGEN_Gallery_Optimizer_Basic::get_instance(); $vars = $this->plugin->get_vars(); $this->db = $vars['db']; $this->prefix = $vars['prefix']; $this->version = $vars['version']; $this->plugin_dir_url = $vars['plugin_dir_url']; $this->plugin_dir_path = $vars['plugin_dir_path']; $this->fancybox_handle = $vars['fancybox_handle']; $this->fancybox_version = $vars['fancybox_version']; $this->nextgen_v207 = $vars['nextgen_v207']; // Hook into the do_action in C_Lightbox_Library_Manager::register_defaults() for in-memory, front-end lightbox registration in NextGEN 2.0.7+. if ($this->nextgen_v207) { add_action('ngg_registered_default_lightboxes', array($this, 'register_fancybox')); } // Update our script dependencies set by NextGEN. add_action('wp_footer', array($this, 'update_fancybox_script_dependencies')); // Ensure a fresh version of our Fancybox script is loaded by the browser (but only if it's been updated). add_filter('script_loader_src', array($this, 'update_fancybox_script_versioning')); // Ensure a fresh version of our Fancybox stylesheet is loaded by the browser (but only after an Optimizer update). add_filter('style_loader_src', array($this, 'update_fancybox_stylesheet_versioning')); }
/** * Class initialization. * * Get and set required properties, and add our action hooks, function * calls and file includes to initialize this class. * * @wp-hook void * @uses add_action() * @since 2.0.0 * @return void */ public function init() { // Retrieve required properties from our main plugin class. $this->plugin = NextGEN_Gallery_Optimizer_Basic::get_instance(); $vars = $this->plugin->get_vars(); $this->db = $vars['db']; $this->prefix = $vars['prefix']; $this->version = $vars['version']; $this->settings_slug = $vars['settings_slug']; $this->plugin_dir_path = $vars['plugin_dir_path']; $this->nextgen_v1 = $vars['nextgen_v1']; $this->nextgen_v2 = $vars['nextgen_v2']; // Define path to main plugin file. $this->plugin_dir_file = $this->plugin_dir_path . $this->main_plugin_slug . '.php'; // Define plugin_basename outside of the main plugin file. $this->plugin_basename = $this->main_plugin_slug . '/' . $this->main_plugin_slug . '.php'; // Add our action hooks. add_action('admin_init', array($this, 'deactivate_premium_version')); add_action('admin_notices', array($this, 'display_thanks_for_downloading_message'), 1); // Priority 1 to top the notification queue. add_action('admin_notices', array($this, 'display_thanks_for_updating_message')); // Default priority to display below the WordPress update nag. add_action('admin_notices', array($this, 'display_view_changelog_message')); // Default priority to display below the WordPress update nag. add_action('admin_notices', array($this, 'nextgen_installed_and_activated_check')); add_action('admin_head', array($this, 'add_plugin_description_formatting')); add_filter('plugin_row_meta', array($this, 'add_plugin_links'), 10, 2); add_filter('plugin_action_links_' . $this->plugin_basename, array($this, 'add_settings_link')); // Load our dependencies. $this->load_dependencies(); }
/** * Class initialization. * * Get and set required properties, and add our action hooks, function * calls and file includes to initialize this class. * * @wp-hook void * @uses add_action() * @since 2.0.0 * @return void */ public function init() { // Retrieve required properties from our main plugin class. $this->plugin = NextGEN_Gallery_Optimizer_Basic::get_instance(); $vars = $this->plugin->get_vars(); $this->prefix = $vars['prefix']; $this->version = $vars['version']; $this->fancybox_version = $vars['fancybox_version']; $this->plugin_dir_url = $vars['plugin_dir_url']; $this->plugin_dir_path = $vars['plugin_dir_path']; $this->settings_slug = $vars['settings_slug']; // Retrieve required properties from our main admin class. $this->admin = NGGOBASIC_Admin::get_instance(); $vars = $this->admin->get_vars(); // Get our settings instance. $this->settings = NGGOBASIC_Settings::get_instance(); // Define our Fancybox CSS filepath. $this->fancybox_css_path = $this->plugin_dir_path . "fancybox/" . $this->prefix . ".jquery.fancybox-" . $this->fancybox_version . ".css"; // Add our action hooks. add_action('admin_notices', array($this, 'check_for_deregister_jquery_regex')); add_action('admin_notices', array($this, 'fancybox_regex_error_message')); }
/** * Class initialization. * * Get and set required properties, and add our action hooks, function * calls and file includes to initialize this class. * * @wp-hook void * @uses add_action() * @since 2.0.0 * @return void */ public function init() { // Retrieve required properties from our main plugin class. $this->plugin = NextGEN_Gallery_Optimizer_Basic::get_instance(); $vars = $this->plugin->get_vars(); $this->db = $vars['db']; $this->prefix = $vars['prefix']; $this->version = $vars['version']; $this->plugin_dir_url = $vars['plugin_dir_url']; $this->fancybox_version = $vars['fancybox_version']; $this->nextgen_v1 = $vars['nextgen_v1']; $this->gallery_version = $vars['gallery_version']; // Get the directory URL for either NextGEN Gallery or the NextCellent Gallery fork. add_action('init', array($this, 'get_nextgen_dir_url')); }
/** * Class initialization. * * Get and set required properties, and add our action hooks, function * calls and file includes to initialize this class. * * @wp-hook void * @uses add_action() * @since 2.0.0 * @return void */ public function init() { // Retrieve required properties from our main plugin class. $this->plugin = NextGEN_Gallery_Optimizer_Basic::get_instance(); $vars = $this->plugin->get_vars(); $this->db = $vars['db']; $this->prefix = $vars['prefix']; $this->plugin_dir_path = $vars['plugin_dir_path']; $this->nextgen_v1 = $vars['nextgen_v1']; $this->gallery_version = $vars['gallery_version']; add_action('init', array($this, 'remove_scripts_nextgen_v1')); add_action('wp_print_styles', array($this, 'remove_styles_nextgen_v1'), 1000); require_once $this->plugin_dir_path . 'public/nextgen-v1/class-' . $this->prefix . '-register-scripts.php'; $this->register_scripts = NGGOBASIC_Register_Scripts::get_instance(); $this->register_scripts->init(); require_once $this->plugin_dir_path . 'public/nextgen-v1/class-' . $this->prefix . '-shortcode-regex.php'; $this->shortcode_regex = NGGOBASIC_Shortcode_Regex::get_instance(); $this->shortcode_regex->init(); require_once $this->plugin_dir_path . 'public/nextgen-v1/class-' . $this->prefix . '-nextgen-widgets.php'; $this->nextgen_widgets = NGGOBASIC_NextGEN_Widgets::get_instance(); $this->nextgen_widgets->init(); }
/** * Class initialization. * * Get and set required properties, and add our action hooks, function * calls and file includes to initialize this class. * * @wp-hook void * @uses add_action() * @since 2.0.0 * @return void */ public function init() { // Retrieve required properties from our main plugin class. $this->plugin = NextGEN_Gallery_Optimizer_Basic::get_instance(); $vars = $this->plugin->get_vars(); $this->db_name = $vars['db_name']; $this->prefix = $vars['prefix']; $this->version = $vars['version']; $this->display_name = $vars['display_name']; $this->settings_slug = $vars['settings_slug']; $this->plugin_dir_url = $vars['plugin_dir_url']; $this->plugin_dir_path = $vars['plugin_dir_path']; $this->fancybox_version = $vars['fancybox_version']; $this->nextgen_v1 = $vars['nextgen_v1']; $this->nextgen_v2 = $vars['nextgen_v2']; // Retrieve required properties from our main admin class. $this->admin = NGGOBASIC_Admin::get_instance(); $vars = $this->admin->get_vars(); $this->fancybox_interface_slug = $vars['fancybox_interface_slug']; // Get our settings instance. $this->settings = NGGOBASIC_Settings::get_instance(); // Add our action hooks. add_action('admin_menu', array($this, 'add_options_page')); add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts_and_styles')); }
/** * Class initialization. * * Get and set required properties, and add our action hooks, function * calls and file includes to initialize this class. * * @wp-hook void * @uses add_action(), register_deactivation_hook() * @since 2.0.0 * @return void */ public function init() { // Retrieve required properties from our main plugin class. $this->plugin = NextGEN_Gallery_Optimizer_Basic::get_instance(); $vars = $this->plugin->get_vars(); $this->prefix = $vars['prefix']; $this->version = $vars['version']; $this->settings_slug = $vars['settings_slug']; $this->plugin_dir_url = $vars['plugin_dir_url']; $this->plugin_dir_path = $vars['plugin_dir_path']; $this->fancybox_handle = $vars['fancybox_handle']; $this->fancybox_version = $vars['fancybox_version']; $this->nextgen_v207 = $vars['nextgen_v207']; // Retrieve required properties from our main admin class. $this->admin = NGGOBASIC_Admin::get_instance(); $vars = $this->admin->get_vars(); $this->plugin_dir_file = $vars['plugin_dir_file']; // Get our settings instance. $this->settings = NGGOBASIC_Settings::get_instance(); // Access NextGEN's settings instance. // Make sure the class exists first, as NextGEN (as of v2.0.7x) no longer initializes when other plugins are activating (see: C_NextGEN_Bootstrap::is_not_activating()). // Without this check, a "Fatal error: Class 'C_NextGen_Settings' not found" error occurs and halts activation. if (class_exists('C_NextGen_Settings')) { $this->ngg_settings = C_NextGen_Settings::get_instance(); } // Define the path to Fancybox's CSS stylesheet. $this->styles = $this->plugin_dir_url . 'fancybox/' . $this->prefix . '.jquery.fancybox-' . $this->fancybox_version . '.css'; // Define the path to Fancybox's script. $this->scripts = $this->plugin_dir_url . 'fancybox/' . $this->prefix . '.jquery.fancybox-' . $this->fancybox_version . '.pack.js'; // Hook into the do_action in C_Lightbox_Library_Manager::register_defaults() for in-memory, front-end lightbox registration in NextGEN 2.0.7+. if ($this->nextgen_v207) { add_action('ngg_registered_default_lightboxes', array($this, 'register_fancybox')); } // Reset our class/rel code and script and stylesheet URLs if accidentally changed. add_action('admin_init', array($this, 'update_modified_fancybox_urls')); // Register and enqueue Optimizer's JavaScript file for NextGEN's lightbox settings. add_action('admin_enqueue_scripts', array($this, 'enqueue_nextgen_options_page_js')); // Install our lightbox on activation, and reinstall on domain change. add_action('admin_footer', array($this, 'install_controller')); // Uninstall our Fancybox menu item if Optimizer is deactivated. register_deactivation_hook($this->plugin_dir_file, array($this, 'uninstall_controller')); }
/** * Class initialization. * * Get and set required properties, and add our action hooks, function * calls and file includes to initialize this class. * * @wp-hook void * @uses void * @since 2.0.0 * @return void */ public function init() { // Retrieve required properties from our main plugin class. $this->plugin = NextGEN_Gallery_Optimizer_Basic::get_instance(); $vars = $this->plugin->get_vars(); $this->db = $vars['db']; $this->db_name = $vars['db_name']; $this->prefix = $vars['prefix']; $this->version = $vars['version']; $this->plugin_dir_url = $vars['plugin_dir_url']; $this->plugin_dir_path = $vars['plugin_dir_path']; $this->nextgen_v1 = $vars['nextgen_v1']; $this->nextgen_v2 = $vars['nextgen_v2']; // Retrieve required properties from our main admin class. $this->admin = NGGOBASIC_Admin::get_instance(); $vars = $this->admin->get_vars(); $this->plugin_dir_file = $vars['plugin_dir_file']; // Run our settings methods. $this->get_validation(); $this->register_setting(); $this->install(); $this->set_settings(); }
/** * Class initialization. * * Get and set required properties, and add our action hooks, function * calls and file includes to initialize this class. * * @wp-hook void * @uses add_action() * @since 2.0.0 * @return void */ public function init() { // Retrieve required properties from our main plugin class. $this->plugin = NextGEN_Gallery_Optimizer_Basic::get_instance(); $vars = $this->plugin->get_vars(); $this->db = $vars['db']; $this->nextgen_v207 = $vars['nextgen_v207']; // Run our shortcode regex. add_action('wp', array($this, 'get_shortcode_regex')); // Detect if the NextGEN Pro lightbox is currently displayed. $this->detect_nextgen_pro_lightbox(); // Priority 1 is important for all three of these calls, in order to be able to remove *all* unnecessary stylesheets in the head. add_action('wp_print_styles', array($this, 'detect_widgets'), 1); add_action('wp_print_styles', array($this, 'detect_related_images'), 1); add_action('wp_print_styles', array($this, 'remove_scripts_and_styles'), 1); // Remove script dependencies set by NextGEN 2.0.71+, to retain granular control of the scripts that load on posts/pages *with* NextGEN Gallery content. add_action('wp_footer', array($this, 'remove_nextgen_v207_script_dependencies')); }
/** * Access this class's working instance. * If the instance hasn't been set, set it now. * * @wp-hook void * @uses void * @since 2.0.0 * @return object of this class */ public static function get_instance() { if (null == self::$instance) { self::$instance = new self(); } return self::$instance; }