Example #1
0
 /**
  * Returns the singleton instance of the class.
  *
  * @since 1.0.0
  *
  * @return object The HW_Gallery_Media_Lite object.
  */
 public static function get_instance()
 {
     if (!isset(self::$instance) && !self::$instance instanceof HW_Gallery_Media_Lite) {
         self::$instance = new HW_Gallery_Media_Lite();
     }
     return self::$instance;
 }
    /**
     * Callback for displaying the UI for main images tab.
     *
     * @since 1.0.0
     *
     * @param object $post The current post object.
     */
    public function images_tab($post)
    {
        ?>

        <?php 
        // Output the custom media upload form.
        HW_Gallery_Media_Lite::get_instance()->media_upload_form();
        // Prepare output data.
        $gallery_data = get_post_meta($post->ID, '_eg_gallery_data', true);
        ?>
        <ul id="hw-gallery-output" class="hw-gallery-clear">
            <?php 
        if (!empty($gallery_data['gallery'])) {
            ?>
                <?php 
            foreach ($gallery_data['gallery'] as $id => $data) {
                ?>
                    <?php 
                echo $this->get_gallery_item($id, $data, $post->ID);
                ?>
                <?php 
            }
            ?>
            <?php 
        }
        ?>
        </ul>
        <?php 
        $this->media_library($post);
    }