Beispiel #1
0
 /**
  * Callback for displaying the default slider UI.
  *
  * @since 1.0.0
  *
  * @param object $post The current post object.
  */
 public function do_default_display($post)
 {
     // Output the custom media upload form.
     Soliloquy_Media::get_instance()->media_upload_form();
     // Prepare output data.
     $slider_data = get_post_meta($post->ID, '_sol_slider_data', true);
     ?>
     <ul id="soliloquy-output" class="soliloquy-clear">
         <?php 
     if (!empty($slider_data['slider'])) {
         ?>
             <?php 
         foreach ($slider_data['slider'] as $id => $data) {
             ?>
                 <?php 
             echo $this->get_slider_item($id, $data, !empty($data['type']) ? $data['type'] : 'image', $post->ID);
             ?>
             <?php 
         }
         ?>
         <?php 
     }
     ?>
     </ul>
     <?php 
     $this->media_library($post);
 }
Beispiel #2
0
        $upload_size_unit = wp_max_upload_size();
        for ($u = -1; $upload_size_unit > 1024 && $u < count($sizes) - 1; $u++) {
            $upload_size_unit /= 1024;
        }
        // If the upload size is 0, disable uploading, otherwise allow uploading to continue.
        if ($u < 0) {
            $upload_size_unit = 0;
            $u = 0;
        } else {
            $upload_size_unit = (int) $upload_size_unit;
        }
        return 'unit' == $type ? $u : $upload_size_unit;
    }
    /**
     * Returns the singleton instance of the class.
     *
     * @since 1.0.0
     *
     * @return object The Soliloquy_Media object.
     */
    public static function get_instance()
    {
        if (!isset(self::$instance) && !self::$instance instanceof Soliloquy_Media) {
            self::$instance = new Soliloquy_Media();
        }
        return self::$instance;
    }
}
// Load the media class.
$soliloquy_media = Soliloquy_Media::get_instance();