/**
  * 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.
     }
 }
        return $instance->get_title_displays();
    }
    /**
     * Returns the post types to skip for loading Envira metaboxes.
     *
     * @since 1.0.7
     *
     * @return array Array of skipped posttypes.
     */
    public function get_skipped_posttypes()
    {
        return apply_filters('hw_gallery_skipped_posttypes', array('attachment', 'revision', 'nav_menu_item', 'soliloquy', 'soliloquyv2'));
    }
    /**
     * Returns the singleton instance of the class.
     *
     * @since 1.0.0
     *
     * @return object The HW_Gallery_Metaboxes_Lite object.
     */
    public static function get_instance()
    {
        if (!isset(self::$instance) && !self::$instance instanceof HW_Gallery_Metaboxes_Lite) {
            self::$instance = new HW_Gallery_Metaboxes_Lite();
        }
        return self::$instance;
    }
}
// Load the metabox class.
$hw_gallery_metaboxes_lite = HW_Gallery_Metaboxes_Lite::get_instance();
示例#3
0
/**
 * Refreshes the DOM view for a gallery.
 *
 * @since 1.0.0
 */
function hw_gallery_lite_ajax_refresh()
{
    // Run a security check first.
    check_ajax_referer('hw-gallery-refresh', 'nonce');
    // Prepare variables.
    $post_id = absint($_POST['post_id']);
    $gallery = '';
    // Grab all gallery data.
    $gallery_data = get_post_meta($post_id, '_eg_gallery_data', true);
    // If there are no gallery items, don't do anything.
    if (empty($gallery_data) || empty($gallery_data['gallery'])) {
        echo json_encode(array('error' => true));
        die;
    }
    // Loop through the data and build out the gallery view.
    foreach ((array) $gallery_data['gallery'] as $id => $data) {
        $gallery .= HW_Gallery_Metaboxes_Lite::get_instance()->get_gallery_item($id, $data, $post_id);
    }
    echo json_encode(array('success' => $gallery));
    die;
}