/** * Primary class constructor. * * @since 1.0.0 */ public function __construct() { // Load the base class object. $this->base = HW_Gallery_Lite::get_instance(); // Add a custom media button to the editor. add_filter('media_buttons_context', array($this, 'media_button')); }
/** * Primary class constructor. * * @since 1.0.0 */ public function __construct() { // Load the base class object. $this->base = HW_Gallery_Lite::get_instance(); // Delete any gallery association on attachment deletion. Also delete any extra cropped images. add_action('delete_attachment', array($this, 'delete_gallery_association')); add_action('delete_attachment', array($this, 'delete_cropped_image')); // Ensure gallery display is correct when trashing/untrashing galleries. add_action('wp_trash_post', array($this, 'trash_gallery')); add_action('untrash_post', array($this, 'untrash_gallery')); }
/** * Primary class constructor. * * @since 1.0.0 */ public function __construct() { // Load the base class object. $this->base = HW_Gallery_Lite::get_instance(); // Build the labels for the post type. $labels = apply_filters('hw_gallery_post_type_labels', array('name' => __('Envira Gallery', 'hw-gallery'), 'singular_name' => __('Envira Gallery', 'hw-gallery'), 'add_new' => __('Add New', 'hw-gallery'), 'add_new_item' => __('Add New Envira Gallery', 'hw-gallery'), 'edit_item' => __('Edit Envira Gallery', 'hw-gallery'), 'new_item' => __('New Envira Gallery', 'hw-gallery'), 'view_item' => __('View Envira Gallery', 'hw-gallery'), 'search_items' => __('Search Envira Galleries', 'hw-gallery'), 'not_found' => __('No Envira galleries found.', 'hw-gallery'), 'not_found_in_trash' => __('No Envira galleries found in trash.', 'hw-gallery'), 'parent_item_colon' => '', 'menu_name' => __('Envira Gallery', 'hw-gallery'))); // Build out the post type arguments. $args = apply_filters('hw_gallery_post_type_args', array('labels' => $labels, 'public' => false, 'exclude_from_search' => false, 'show_ui' => true, 'show_in_admin_bar' => true, 'rewrite' => false, 'query_var' => false, 'menu_position' => apply_filters('hw_gallery_post_type_menu_position', 247), 'menu_icon' => plugins_url('assets/css/images/menu-icon@2x.png', $this->base->file), 'supports' => array('title'))); // Register the post type with WordPress. register_post_type('hw-gallery', $args); }
/** * init gallery skin */ public function load_gallery() { // Load the metabox class. if (empty($this->gallery) && class_exists('HW_Gallery_Lite')) { $this->gallery = HW_Gallery_Lite::get_instance(); // Load the base class object. } if (empty($this->gallery_metaboxes) && class_exists('HW_Gallery_Metaboxes_Lite')) { $this->gallery_metaboxes = HW_Gallery_Metaboxes_Lite::get_instance(); // Load the base class object. } }
/** * Primary class constructor. * * @since 1.0.0 */ public function __construct() { // Load the base class object. $this->base = HW_Gallery_Lite::get_instance(); // Remove quick editing from the Envira post type row actions. add_filter('post_row_actions', array($this, 'row_actions')); // Manage post type columns. add_filter('manage_edit-hw-gallery_columns', array($this, '_gallery_columns')); add_filter('manage_hw-gallery_posts_custom_column', array($this, '_gallery_custom_columns'), 10, 2); // Update post type messages. add_filter('post_updated_messages', array($this, 'messages')); // Force the menu icon to be scaled to proper size (for Retina displays). add_action('admin_head', array($this, 'menu_icon')); }
/** * Primary class constructor. * * @since 1.0.0 */ public function __construct() { // Load the base class object. $this->base = HW_Gallery_Lite::get_instance(); // Load metabox assets. add_action('admin_enqueue_scripts', array($this, 'meta_box_styles')); add_action('admin_enqueue_scripts', array($this, 'meta_box_scripts')); // Load the metabox hooks and filters. add_action('add_meta_boxes', array($this, 'add_meta_boxes'), 100); // Load all tabs. add_action('hw_gallery_tab_images', array($this, 'images_tab')); add_action('hw_gallery_tab_config', array($this, 'config_tab')); add_action('hw_gallery_tab_lightbox', array($this, 'lightbox_tab')); add_action('hw_gallery_tab_misc', array($this, 'misc_tab')); // Add action to save metabox config options. add_action('save_post', array($this, 'save_meta_boxes'), 10, 2); }
/** * Primary class constructor. * * @since 1.0.0 */ public function __construct() { // Load the base class object. $this->base = HW_Gallery_Lite::get_instance(); /*wp_enqueue_script($this->base->plugin_slug. '-fancybox.js', HW_GALLERY_ENVIRA_PLUGIN_URL . '/assets/js/lib/fancybox.js', array('jquery')); wp_enqueue_script($this->base->plugin_slug. '-isotope.js', HW_GALLERY_ENVIRA_PLUGIN_URL . '/assets/js/lib/isotope.js', array('jquery')); wp_enqueue_script($this->base->plugin_slug. '-touchsupport.js', HW_GALLERY_ENVIRA_PLUGIN_URL . '/assets/js/lib/touchsupport.js', array('jquery'));*/ // Register main gallery style. wp_register_style($this->base->plugin_slug . '-style', plugins_url('assets/css/gallery.css', $this->base->file), array(), $this->base->version); // Register main gallery script. //wp_register_script( $this->base->plugin_slug . '-script', plugins_url( 'assets/js/min/envira-min.js', $this->base->file ), array( 'jquery' ), $this->base->version, true ); /** * assets/js/gallery.js * note: hw-gallery.min.js = js/gallery.js + lib/* */ wp_register_script($this->base->plugin_slug . '-script', plugins_url('assets/js/min/hw-gallery.min.js', $this->base->file), array('jquery'), $this->base->version, true); // Load hooks and filters. add_shortcode('hw-gallery', array($this, 'shortcode')); }
/** * Primary class constructor. * * @since 1.0.0 */ public function __construct() { // Load the base class object. $this->base = HW_Gallery_Lite::get_instance(); }
* * @since 1.0.0 * * @global int $wp_version The version of WordPress for this install. * @param boolean $network_wide True if WPMU superadmin uses "Network Activate" action, false otherwise. */ function hw_gallery_lite_activation_hook($network_wide) { global $wp_version; if (version_compare($wp_version, '3.8', '<') && !defined('ENVIRA_FORCE_ACTIVATION')) { deactivate_plugins(plugin_basename(__FILE__)); wp_die(sprintf(__('Sorry, but your version of WordPress does not meet Envira Gallery\'s required version of <strong>3.8</strong> to run properly. The plugin has been deactivated. <a href="%s">Click here to return to the Dashboard</a>.', 'hw-gallery'), get_admin_url())); } } // Load the main plugin class. $hw_gallery_lite = HW_Gallery_Lite::get_instance(); // Conditionally load the template tag. if (!function_exists('hw_gallery')) { /** * Primary template tag for outputting Envira galleries in templates. * * @since 1.0.0 * * @param int $gallery_id The ID of the gallery to load. * @param string $type The type of field to query. * @param array $args Associative array of args to be passed. * @param bool $return Flag to echo or return the gallery HTML. */ function hw_gallery($id, $type = 'id', $args = array(), $return = false) { // If we have args, build them into a shortcode format.