コード例 #1
0
 /**
  * Primary class constructor.
  *
  * @since 1.0.0
  */
 public function __construct()
 {
     // Load the base class object.
     $this->base = Envira_Gallery_Lite::get_instance();
     // Add a custom media button to the editor.
     add_filter('media_buttons_context', array($this, 'media_button'));
 }
コード例 #2
0
 /**
  * Primary class constructor.
  *
  * @since 1.0.0
  */
 public function __construct()
 {
     // Load the base class object.
     $this->base = Envira_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'));
 }
コード例 #3
0
 /**
  * Primary class constructor.
  *
  * @since 1.0.0
  */
 public function __construct()
 {
     // Load the base class object.
     $this->base = Envira_Gallery_Lite::get_instance();
     // Build the labels for the post type.
     $labels = apply_filters('envira_gallery_post_type_labels', array('name' => __('Envira Gallery', 'envira-gallery-lite'), 'singular_name' => __('Envira Gallery', 'envira-gallery-lite'), 'add_new' => __('Add New', 'envira-gallery-lite'), 'add_new_item' => __('Add New Envira Gallery', 'envira-gallery-lite'), 'edit_item' => __('Edit Envira Gallery', 'envira-gallery-lite'), 'new_item' => __('New Envira Gallery', 'envira-gallery-lite'), 'view_item' => __('View Envira Gallery', 'envira-gallery-lite'), 'search_items' => __('Search Envira Galleries', 'envira-gallery-lite'), 'not_found' => __('No Envira galleries found.', 'envira-gallery-lite'), 'not_found_in_trash' => __('No Envira galleries found in trash.', 'envira-gallery-lite'), 'parent_item_colon' => '', 'menu_name' => __('Envira Gallery', 'envira-gallery-lite')));
     // Build out the post type arguments.
     $args = apply_filters('envira_gallery_post_type_args', array('labels' => $labels, 'public' => false, 'exclude_from_search' => false, 'show_ui' => true, 'show_in_admin_bar' => false, 'rewrite' => false, 'query_var' => false, 'menu_position' => apply_filters('envira_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('envira', $args);
 }
コード例 #4
0
 /**
  * Primary class constructor.
  *
  * @since 1.0.0
  */
 public function __construct()
 {
     // Load the base class object.
     $this->base = Envira_Gallery_Lite::get_instance();
     // Register main gallery style.
     wp_register_style($this->base->plugin_slug . '-style', plugins_url('assets/css/envira.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);
     // Load hooks and filters.
     add_shortcode('envira-gallery', array($this, 'shortcode'));
 }
コード例 #5
0
 /**
  * Primary class constructor.
  *
  * @since 1.0.0
  */
 public function __construct()
 {
     // Load the base class object.
     $this->base = Envira_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-envira_columns', array($this, 'envira_columns'));
     add_filter('manage_envira_posts_custom_column', array($this, 'envira_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'));
 }
コード例 #6
0
 /**
  * Primary class constructor.
  *
  * @since 1.0.0
  */
 public function __construct()
 {
     // Load the base class object.
     $this->base = Envira_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('envira_gallery_tab_images', array($this, 'images_tab'));
     add_action('envira_gallery_tab_config', array($this, 'config_tab'));
     add_action('envira_gallery_tab_lightbox', array($this, 'lightbox_tab'));
     add_action('envira_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);
 }
コード例 #7
0
 /**
  * Primary class constructor.
  *
  * @since 1.0.0
  */
 public function __construct()
 {
     // Load the base class object.
     $this->base = Envira_Gallery_Lite::get_instance();
 }
コード例 #8
0
 *
 * @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 envira_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>.', 'envira-gallery-lite'), get_admin_url()));
    }
}
// Load the main plugin class.
$envira_gallery_lite = Envira_Gallery_Lite::get_instance();
// Conditionally load the template tag.
if (!function_exists('envira_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 envira_gallery($id, $type = 'id', $args = array(), $return = false)
    {
        // If we have args, build them into a shortcode format.
コード例 #9
0
ファイル: media.php プロジェクト: Sprinkle7/PDMA-Emergency
 /**
  * Primary class constructor.
  *
  * @since 1.0.0
  */
 public function __construct()
 {
     // Load the base class object.
     $this->base = Envira_Gallery_Lite::get_instance();
     add_filter('wp_handle_upload', array($this, 'fix_image_orientation'));
 }