web/wp-content/plugins/slideshow-jquery-image-gallery/classes/SlideshowPlugin.php
author Anthony Ly <anthonyly.com@gmail.com>
Wed, 19 Dec 2012 12:35:13 -0800
changeset 203 f507feede89a
parent 194 32102edaa81b
permissions -rw-r--r--
target blank pour les liens externes du slide
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
194
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     1
<?php
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     2
/**
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     3
 * Class SlideslowPlugin is called whenever a slideshow do_action tag is come across.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     4
 * Responsible for outputting the slideshow's HTML, CSS and Javascript.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     5
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     6
 * TODO Create a variable in which all slideshow html can be stored <- Rethink this, slideshow containers have random ids.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     7
 * @author: Stefan Boonstra
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     8
 * @version: 22-09-12
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     9
 */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    10
class SlideshowPlugin {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    11
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    12
	/**
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    13
	 * Function deploy prints out the prepared html
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    14
	 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    15
	 * @param int $postId
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    16
	 */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    17
	static function deploy($postId = null){
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    18
		echo self::prepare($postId);
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    19
	}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    20
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    21
	/**
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    22
	 * Function prepare returns the required html and enqueues
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    23
	 * the scripts and stylesheets necessary for displaying the slideshow
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    24
	 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    25
	 * Passing this function no parameter or passing it a negative one will
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    26
	 * result in a random pick of slideshow
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    27
	 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    28
	 * @param int $postId
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    29
	 * @return String $output
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    30
	 */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    31
	static function prepare($postId = null){
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    32
		// Get post by its ID, or by its slug
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    33
		if(is_numeric($postId))
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    34
			$post = wp_get_single_post($postId);
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    35
		if(is_string($postId)){
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    36
			$query = new WP_Query(array(
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    37
				'post_type' => SlideshowPluginPostType::$postType,
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    38
				'name' => $postId,
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    39
				'orderby' => 'post_date',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    40
				'order' => 'DESC'
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    41
			));
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    42
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    43
			if($query->have_posts())
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    44
				$post = $query->next_post();
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    45
		}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    46
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    47
		// When no slideshow is found, get one at random
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    48
		if(empty($post)){
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    49
			$post = get_posts(array(
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    50
				'numberposts' => 1,
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    51
				'orderby' => 'rand',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    52
				'post_type' => SlideshowPluginPostType::$postType
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    53
			));
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    54
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    55
			if(is_array($post))
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    56
				$post = $post[0];
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    57
		}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    58
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    59
		// Exit on error
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    60
		if(empty($post)){echo 'dayum';
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    61
			return '<!-- Wordpress Slideshow - No slideshows available -->';
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    62
		}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    63
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    64
		// Get settings
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    65
		$allSettings = SlideshowPluginPostType::getSimpleSettings($post->ID, null, false);
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    66
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    67
		// Get stored slide settings and convert them to array([slide-key] => array([setting-name] => [value]));
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    68
		$slidesPreOrder = array();
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    69
		$slideSettings = SlideshowPluginPostType::getSettings($post->ID, SlideshowPluginPostType::$prefixes['slide-list'], false);
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    70
		if(is_array($slideSettings) && count($slideSettings) > 0)
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    71
			foreach($slideSettings as $key => $value){
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    72
				$key = explode('_', $key);
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    73
				if(is_numeric($key[1]))
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    74
					$slidesPreOrder[$key[1]][$key[2]] = $value;
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    75
			}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    76
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    77
		// Create array ordered by the 'order' key of the slides array: array([order-key] => [slide-key]);
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    78
		$slidesOrder = array();
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    79
		if(count($slidesPreOrder) > 0){
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    80
			foreach($slidesPreOrder as $key => $value)
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    81
				if(isset($value['order']) && is_numeric($value['order']) && $value['order'] > 0)
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    82
					$slidesOrder[$value['order']][] = $key;
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    83
		}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    84
		ksort($slidesOrder);
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    85
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    86
		// Order slides by the order key.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    87
		$slides = array();
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    88
		if(count($slidesOrder) > 0)
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    89
			foreach($slidesOrder as $value)
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    90
				if(is_array($value))
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    91
					foreach($value as $slideId){
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    92
						$slides[] = $slidesPreOrder[$slideId];
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    93
						unset($slidesPreOrder[$slideId]);
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    94
					}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    95
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    96
		// Add remaining (unordered) slides to the end of the array.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    97
		$slides = array_merge($slides, $slidesPreOrder);
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    98
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    99
		// Randomize if setting is true.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   100
		if(isset($allSettings['setting_random']) && $allSettings['setting_random'] == 'true')
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   101
			shuffle($slides);
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   102
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   103
		// Enqueue functional sheet
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   104
		wp_enqueue_style(
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   105
			'slideshow_functional_style',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   106
			SlideshowPluginMain::getPluginUrl() . '/style/' . __CLASS__ . '/functional.css'
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   107
		);
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   108
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   109
		// Create a microtime timestamp to host multiple slideshows with different styles and settings on the same page
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   110
		$randomId = rand();
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   111
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   112
		// Get stylesheet for printing
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   113
		$style = '';
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   114
		if($allSettings['style_style'] == 'custom' && isset($allSettings['style_custom']) && !empty($allSettings['style_custom'])){ // Custom style
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   115
			$style = str_replace('%plugin-url%', SlideshowPluginMain::getPluginUrl(), $allSettings['style_custom']);
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   116
		}else{ // Set style
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   117
			$filePath = SlideshowPluginMain::getPluginPath() . '/style/' . __CLASS__ . '/style-' . $allSettings['style_style'] . '.css';
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   118
			if(file_exists(SlideshowPluginMain::getPluginPath() . '/style/' . __CLASS__ . '/style-' . $allSettings['style_style'] . '.css')){
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   119
				ob_start();
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   120
				include($filePath);
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   121
				$style = str_replace('%plugin-url%', SlideshowPluginMain::getPluginUrl(), ob_get_clean());
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   122
			}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   123
		}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   124
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   125
		// Append the random ID to the slideshow container in the stylesheet, to identify multiple slideshows
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   126
		if(!empty($style))
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   127
			$style = str_replace('.slideshow_container', '.slideshow_container_' . $randomId, $style);
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   128
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   129
		// Filter settings to only contain settings, then remove prefix
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   130
		$settings = array();
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   131
		if(is_array($allSettings) && count($allSettings) > 0)
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   132
			foreach($allSettings as $key => $value)
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   133
				if(SlideshowPluginPostType::$prefixes['settings'] == substr($key, 0, strlen(SlideshowPluginPostType::$prefixes['settings'])))
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   134
					$settings[substr($key, strlen(SlideshowPluginPostType::$prefixes['settings']))] = $value;
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   135
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   136
		// Include output file that stores output in $output.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   137
		$output = '';
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   138
		ob_start();
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   139
		include(SlideshowPluginMain::getPluginPath() . '/views/' . __CLASS__ . '/slideshow.php');
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   140
		$output .= ob_get_clean();
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   141
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   142
		// Enqueue flash object creation script
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   143
		wp_enqueue_script(
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   144
			'swfobject',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   145
			SlideshowPluginMain::getPluginUrl() . '/js/' . __CLASS__ . 'swfobject.js'
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   146
		);
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   147
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   148
		// Enqueue slideshow script
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   149
		wp_enqueue_script(
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   150
			'slideshow_script',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   151
			SlideshowPluginMain::getPluginUrl() . '/js/' . __CLASS__ . '/slideshow.js',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   152
			array('jquery')
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   153
		);
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   154
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   155
		// Return output
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   156
		return $output;
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   157
	}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   158
}