Пример #1
0
 /**
  * Get the slides pertaining to a specified slider.
  * @since  1.0.0
  * @param  int $id   The ID of the slider in question.
  * @param  array  $args Optional arguments pertaining to this slider.
  * @return array       An array of slides pertaining to the specified slider.
  */
 public function get_slides($type, $args = array(), $settings = array())
 {
     $slides = array();
     $supported_types = WooSlider_Utils::get_slider_types();
     if (in_array($type, array_keys($supported_types))) {
         if (method_exists($this, 'slideshow_type_' . esc_attr($type))) {
             $slides = call_user_func(array($this, 'slideshow_type_' . esc_attr($type)), $args, $settings);
         } else {
             if (isset($supported_types[$type]['callback']) && $supported_types[$type]['callback'] != 'method') {
                 if (is_callable($supported_types[$type]['callback'])) {
                     $slides = call_user_func($supported_types[$type]['callback'], $args, $settings);
                 }
             }
         }
     }
     /**
      * Action filter wooslider_get_slides.
      *
      * @param $slides
      * @param $type 
      * @param $args 
      * @param $settings
      */
     return (array) apply_filters('wooslider_get_slides', $slides, $type, $args, $settings);
 }
Пример #2
0
    /**
     * Fields specific to the "Add Media" popup.
     * @since  1.0.0
     * @return void
     */
    public function popup_fields()
    {
        $types = WooSlider_Utils::get_slider_types();
        $slider_types = array();
        foreach ((array) $types as $k => $v) {
            $slider_types[$k] = $v['name'];
        }
        ?>
	<table class="form-table">
		<tbody>
			<tr valign="top">
				<th scope="row"><?php 
        _e('Slideshow Type', 'wooslider');
        ?>
</th>
				<td><select id="slider_type" name="wooslider-settings[slider_type]">
					<?php 
        foreach ((array) $slider_types as $k => $v) {
            echo '<option value="' . esc_attr($k) . '">' . $v . '</option>' . "\n";
        }
        ?>
					</select>
					<p><span class="description"><?php 
        _e('The type of slideshow to insert', 'wooslider');
        ?>
</span></p>
				</td>
			</tr>
			<?php 
        // Theming engine integration.
        $themes = WooSlider_Utils::get_slider_themes();
        if (is_array($themes) && 1 < count($themes)) {
            ?>
			<tr valign="top">
				<th scope="row"><?php 
            _e('Slideshow Theme', 'wooslider');
            ?>
</th>
				<td><select id="theme" name="wooslider-settings[theme]">
					<?php 
            foreach ((array) $themes as $k => $v) {
                echo '<option value="' . esc_attr($k) . '">' . $v['name'] . '</option>' . "\n";
            }
            ?>
					</select>
					<p><span class="description"><?php 
            _e('The desired slideshow theme', 'wooslider');
            ?>
</span></p>
				</td>
			</tr>
			<?php 
        }
        ?>
			<tr valign="top">
				<th scope="row"><?php 
        _e('Slideshow ID', 'wooslider');
        ?>
</th>
				<td><input type="text" name="wooslider-settings[id]" id="id" value="" />
					<p><span class="description"><?php 
        _e('Give this slideshow a specific ID (optional)', 'wooslider');
        ?>
</span></p>
				</td>
			</tr>
		</tbody>
	</table>
<?php 
        // Allow themes/plugins to act here.
        do_action('wooslider_popup_conditional_fields', $types);
    }