Version Description
- Fixed: Query filters will no longer alter the output of the slideshow.
- Fixed: Images not always showing in image inserter popup.
- Compatibility with WordPress 3.5 confirmed.
- First back-end increment towards version 2.2.0, introducing a more efficient way to store and retrieve the slideshow's settings and slides.
Download this release
Release Info
Developer | stefanboonstra |
Plugin | Slideshow |
Version | 2.1.20 |
Comparing to | |
See all releases |
Code changes from version 2.1.19 to 2.1.20
- classes/SlideshowPlugin.php +21 -54
- classes/SlideshowPluginPostType.php +10 -358
- classes/SlideshowPluginSettingsHandler.php +459 -0
- classes/SlideshowPluginShortcode.php +3 -3
- classes/SlideshowPluginSlideInserter.php +10 -2
- classes/SlideshowPluginUpdater.php +282 -0
- js/SlideshowPluginSlideInserter/slide-inserter.js +34 -15
- readme.txt +15 -9
- slideshow.php +9 -89
- views/SlideshowPluginPostType/settings.php +4 -4
- views/SlideshowPluginPostType/slides.php +33 -22
- views/SlideshowPluginPostType/style-settings.php +4 -4
classes/SlideshowPlugin.php
CHANGED
@@ -3,9 +3,8 @@
|
|
3 |
* Class SlideslowPlugin is called whenever a slideshow do_action tag is come across.
|
4 |
* Responsible for outputting the slideshow's HTML, CSS and Javascript.
|
5 |
*
|
6 |
-
* TODO Create a variable in which all slideshow html can be stored <- Rethink this, slideshow containers have random ids.
|
7 |
* @author: Stefan Boonstra
|
8 |
-
* @version:
|
9 |
*/
|
10 |
class SlideshowPlugin {
|
11 |
|
@@ -32,15 +31,18 @@ class SlideshowPlugin {
|
|
32 |
* @return String $output
|
33 |
*/
|
34 |
static function prepare($postId = null){
|
35 |
-
// Get post by its ID,
|
36 |
-
if(is_numeric($postId))
|
37 |
$post = wp_get_single_post($postId);
|
38 |
-
|
|
|
|
|
39 |
$query = new WP_Query(array(
|
40 |
'post_type' => SlideshowPluginPostType::$postType,
|
41 |
'name' => $postId,
|
42 |
'orderby' => 'post_date',
|
43 |
-
'order' => 'DESC'
|
|
|
44 |
));
|
45 |
|
46 |
if($query->have_posts())
|
@@ -51,6 +53,7 @@ class SlideshowPlugin {
|
|
51 |
if(empty($post)){
|
52 |
$post = get_posts(array(
|
53 |
'numberposts' => 1,
|
|
|
54 |
'orderby' => 'rand',
|
55 |
'post_type' => SlideshowPluginPostType::$postType
|
56 |
));
|
@@ -60,47 +63,18 @@ class SlideshowPlugin {
|
|
60 |
}
|
61 |
|
62 |
// Exit on error
|
63 |
-
if(empty($post))
|
64 |
return '<!-- Wordpress Slideshow - No slideshows available -->';
|
65 |
-
}
|
66 |
-
|
67 |
-
// Get settings
|
68 |
-
$allSettings = SlideshowPluginPostType::getSimpleSettings($post->ID, null, false);
|
69 |
-
|
70 |
-
// Get stored slide settings and convert them to array([slide-key] => array([setting-name] => [value]));
|
71 |
-
$slidesPreOrder = array();
|
72 |
-
$slideSettings = SlideshowPluginPostType::getSettings($post->ID, SlideshowPluginPostType::$prefixes['slide-list'], false);
|
73 |
-
if(is_array($slideSettings) && count($slideSettings) > 0)
|
74 |
-
foreach($slideSettings as $key => $value){
|
75 |
-
$key = explode('_', $key);
|
76 |
-
if(is_numeric($key[1]))
|
77 |
-
$slidesPreOrder[$key[1]][$key[2]] = $value;
|
78 |
-
}
|
79 |
-
|
80 |
-
// Create array ordered by the 'order' key of the slides array: array([order-key] => [slide-key]);
|
81 |
-
$slidesOrder = array();
|
82 |
-
if(count($slidesPreOrder) > 0){
|
83 |
-
foreach($slidesPreOrder as $key => $value)
|
84 |
-
if(isset($value['order']) && is_numeric($value['order']) && $value['order'] > 0)
|
85 |
-
$slidesOrder[$value['order']][] = $key;
|
86 |
-
}
|
87 |
-
ksort($slidesOrder);
|
88 |
|
89 |
-
//
|
90 |
-
$slides =
|
91 |
-
if(count($slidesOrder) > 0)
|
92 |
-
foreach($slidesOrder as $value)
|
93 |
-
if(is_array($value))
|
94 |
-
foreach($value as $slideId){
|
95 |
-
$slides[] = $slidesPreOrder[$slideId];
|
96 |
-
unset($slidesPreOrder[$slideId]);
|
97 |
-
}
|
98 |
|
99 |
-
//
|
100 |
-
$
|
|
|
101 |
|
102 |
// Randomize if setting is true.
|
103 |
-
if(isset($
|
104 |
shuffle($slides);
|
105 |
|
106 |
// Enqueue functional sheet
|
@@ -114,11 +88,11 @@ class SlideshowPlugin {
|
|
114 |
|
115 |
// Get stylesheet for printing
|
116 |
$style = '';
|
117 |
-
if($
|
118 |
-
$style = str_replace('%plugin-url%', SlideshowPluginMain::getPluginUrl(), $
|
119 |
}else{ // Set style
|
120 |
-
$filePath = SlideshowPluginMain::getPluginPath() . '/style/' . __CLASS__ . '/style-' . $
|
121 |
-
if(file_exists(SlideshowPluginMain::getPluginPath() . '/style/' . __CLASS__ . '/style-' . $
|
122 |
ob_start();
|
123 |
include($filePath);
|
124 |
$style = str_replace('%plugin-url%', SlideshowPluginMain::getPluginUrl(), ob_get_clean());
|
@@ -129,14 +103,7 @@ class SlideshowPlugin {
|
|
129 |
if(!empty($style))
|
130 |
$style = str_replace('.slideshow_container', '.slideshow_container_' . $sessionID, $style);
|
131 |
|
132 |
-
//
|
133 |
-
$settings = array();
|
134 |
-
if(is_array($allSettings) && count($allSettings) > 0)
|
135 |
-
foreach($allSettings as $key => $value)
|
136 |
-
if(SlideshowPluginPostType::$prefixes['settings'] == substr($key, 0, strlen(SlideshowPluginPostType::$prefixes['settings'])))
|
137 |
-
$settings[substr($key, strlen(SlideshowPluginPostType::$prefixes['settings']))] = $value;
|
138 |
-
|
139 |
-
// Include output file that stores output in $output.
|
140 |
$output = '';
|
141 |
ob_start();
|
142 |
include(SlideshowPluginMain::getPluginPath() . '/views/' . __CLASS__ . '/slideshow.php');
|
3 |
* Class SlideslowPlugin is called whenever a slideshow do_action tag is come across.
|
4 |
* Responsible for outputting the slideshow's HTML, CSS and Javascript.
|
5 |
*
|
|
|
6 |
* @author: Stefan Boonstra
|
7 |
+
* @version: 06-12-12
|
8 |
*/
|
9 |
class SlideshowPlugin {
|
10 |
|
31 |
* @return String $output
|
32 |
*/
|
33 |
static function prepare($postId = null){
|
34 |
+
// Get post by its ID, if the ID is not a negative value
|
35 |
+
if(is_numeric($postId) && $postId >= 0)
|
36 |
$post = wp_get_single_post($postId);
|
37 |
+
|
38 |
+
// Get slideshow by slug when it's a non-empty string
|
39 |
+
if(is_string($postId) && !is_numeric($postId) && !empty($postId)){
|
40 |
$query = new WP_Query(array(
|
41 |
'post_type' => SlideshowPluginPostType::$postType,
|
42 |
'name' => $postId,
|
43 |
'orderby' => 'post_date',
|
44 |
+
'order' => 'DESC',
|
45 |
+
'suppress_filters' => true
|
46 |
));
|
47 |
|
48 |
if($query->have_posts())
|
53 |
if(empty($post)){
|
54 |
$post = get_posts(array(
|
55 |
'numberposts' => 1,
|
56 |
+
'offset' => 0,
|
57 |
'orderby' => 'rand',
|
58 |
'post_type' => SlideshowPluginPostType::$postType
|
59 |
));
|
63 |
}
|
64 |
|
65 |
// Exit on error
|
66 |
+
if(empty($post))
|
67 |
return '<!-- Wordpress Slideshow - No slideshows available -->';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
|
69 |
+
// Get slides
|
70 |
+
$slides = SlideshowPluginSettingsHandler::getSlides($post->ID);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
+
// Get settings
|
73 |
+
$settings = SlideshowPluginSettingsHandler::getSettings($post->ID);
|
74 |
+
$styleSettings = SlideshowPluginSettingsHandler::getStyleSettings($post->ID);
|
75 |
|
76 |
// Randomize if setting is true.
|
77 |
+
if(isset($settings['random']) && $settings['random'] == 'true')
|
78 |
shuffle($slides);
|
79 |
|
80 |
// Enqueue functional sheet
|
88 |
|
89 |
// Get stylesheet for printing
|
90 |
$style = '';
|
91 |
+
if($styleSettings['style'] == 'custom' && isset($styleSettings['custom']) && !empty($styleSettings['custom'])){ // Custom style
|
92 |
+
$style = str_replace('%plugin-url%', SlideshowPluginMain::getPluginUrl(), $styleSettings['custom']);
|
93 |
}else{ // Set style
|
94 |
+
$filePath = SlideshowPluginMain::getPluginPath() . '/style/' . __CLASS__ . '/style-' . $styleSettings['style'] . '.css';
|
95 |
+
if(file_exists(SlideshowPluginMain::getPluginPath() . '/style/' . __CLASS__ . '/style-' . $styleSettings['style'] . '.css')){
|
96 |
ob_start();
|
97 |
include($filePath);
|
98 |
$style = str_replace('%plugin-url%', SlideshowPluginMain::getPluginUrl(), ob_get_clean());
|
103 |
if(!empty($style))
|
104 |
$style = str_replace('.slideshow_container', '.slideshow_container_' . $sessionID, $style);
|
105 |
|
106 |
+
// Include output file to store output in $output.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
$output = '';
|
108 |
ob_start();
|
109 |
include(SlideshowPluginMain::getPluginPath() . '/views/' . __CLASS__ . '/slideshow.php');
|
classes/SlideshowPluginPostType.php
CHANGED
@@ -4,20 +4,12 @@
|
|
4 |
* slideshows and their individual settings
|
5 |
*
|
6 |
* @author: Stefan Boonstra
|
7 |
-
* @version:
|
8 |
*/
|
9 |
class SlideshowPluginPostType {
|
10 |
|
11 |
/** Variables */
|
12 |
static $postType = 'slideshow';
|
13 |
-
static $settingsMetaKey = 'settings';
|
14 |
-
static $prefixes = array(
|
15 |
-
'slide-list' => 'slide_',
|
16 |
-
'style' => 'style_',
|
17 |
-
'settings' => 'setting_',
|
18 |
-
);
|
19 |
-
static $settings = null;
|
20 |
-
static $inputFields = null;
|
21 |
|
22 |
/**
|
23 |
* Initialize Slideshow post type.
|
@@ -26,7 +18,7 @@ class SlideshowPluginPostType {
|
|
26 |
static function initialize(){
|
27 |
add_action('init', array(__CLASS__, 'registerSlideshowPostType'));
|
28 |
add_action('admin_enqueue_scripts', array(__CLASS__, 'enqueue'));
|
29 |
-
add_action('save_post', array(
|
30 |
}
|
31 |
|
32 |
/**
|
@@ -164,50 +156,11 @@ class SlideshowPluginPostType {
|
|
164 |
static function slidesMetaBox(){
|
165 |
global $post;
|
166 |
|
167 |
-
//
|
168 |
-
$
|
169 |
-
|
170 |
-
// Get stored slide settings and convert them to array([slide-key] => array([setting-name] => [value]));
|
171 |
-
$slidesPreOrder = array();
|
172 |
-
$settings = self::getSettings($post->ID, self::$prefixes['slide-list']);
|
173 |
-
if(is_array($settings) && count($settings) > 0)
|
174 |
-
foreach($settings as $key => $value){
|
175 |
-
$key = explode('_', $key);
|
176 |
-
if(is_numeric($key[1]))
|
177 |
-
$slidesPreOrder[$key[1]][$key[2]] = $value;
|
178 |
-
}
|
179 |
-
|
180 |
-
// Save slide keys from the $slidePreOrder array in the array itself for later use
|
181 |
-
if(count($slidesPreOrder) > 0)
|
182 |
-
foreach($slidesPreOrder as $key => $value){
|
183 |
-
$slidesPreOrder[$key]['id'] = $key;
|
184 |
|
185 |
-
|
186 |
-
|
187 |
-
$highestSlideId = $key;
|
188 |
-
}
|
189 |
-
|
190 |
-
// Create array ordered by the 'order' key of the slides array: array([order-key] => [slide-key]);
|
191 |
-
$slidesOrder = array();
|
192 |
-
if(count($slidesPreOrder) > 0){
|
193 |
-
foreach($slidesPreOrder as $key => $value)
|
194 |
-
if(isset($value['order']) && is_numeric($value['order']) && $value['order'] > 0)
|
195 |
-
$slidesOrder[$value['order']][] = $key;
|
196 |
-
}
|
197 |
-
ksort($slidesOrder);
|
198 |
-
|
199 |
-
// Order slides by the order key.
|
200 |
-
$slides = array();
|
201 |
-
if(count($slidesOrder) > 0)
|
202 |
-
foreach($slidesOrder as $value)
|
203 |
-
if(is_array($value))
|
204 |
-
foreach($value as $slideId){
|
205 |
-
$slides[] = $slidesPreOrder[$slideId];
|
206 |
-
unset($slidesPreOrder[$slideId]);
|
207 |
-
}
|
208 |
-
|
209 |
-
// Add remaining (unordered) slides to the end of the array.
|
210 |
-
$slides = array_merge($slides, $slidesPreOrder);
|
211 |
|
212 |
// Set url from which a substitute icon can be fetched
|
213 |
$noPreviewIcon = SlideshowPluginMain::getPluginUrl() . '/images/' . __CLASS__ . '/no-img.png';
|
@@ -223,18 +176,16 @@ class SlideshowPluginPostType {
|
|
223 |
global $post;
|
224 |
|
225 |
// Get settings
|
226 |
-
$settings =
|
|
|
227 |
|
228 |
// Fill custom style with default css if empty
|
229 |
-
if(isset($settings['
|
230 |
ob_start();
|
231 |
include(SlideshowPluginMain::getPluginPath() . '/style/SlideshowPlugin/style-custom.css');
|
232 |
$settings['style_custom'][1] = ob_get_clean();
|
233 |
}
|
234 |
|
235 |
-
// Build fields
|
236 |
-
$inputFields = self::getInputFields($settings, false);
|
237 |
-
|
238 |
// Include style settings file
|
239 |
include(SlideshowPluginMain::getPluginPath() . '/views/' . __CLASS__ . '/style-settings.php');
|
240 |
}
|
@@ -246,308 +197,9 @@ class SlideshowPluginPostType {
|
|
246 |
global $post;
|
247 |
|
248 |
// Get settings
|
249 |
-
$settings =
|
250 |
-
$inputFields = self::getInputFields($post->ID);
|
251 |
|
252 |
// Include
|
253 |
include(SlideshowPluginMain::getPluginPath() . '/views/' . __CLASS__ . '/settings.php');
|
254 |
}
|
255 |
-
|
256 |
-
/**
|
257 |
-
* Called for saving metaboxes
|
258 |
-
*
|
259 |
-
* @param int $postId
|
260 |
-
* @return int $postId On failure
|
261 |
-
*/
|
262 |
-
static function save($postId){
|
263 |
-
// Return on unverified nonce, insufficient rights, on auto-save and when the postId doesn't represent a slideshow.
|
264 |
-
if( get_post_type($postId) != self::$postType ||
|
265 |
-
(isset($_POST['nonce']) && !wp_verify_nonce($_POST['nonce'], plugin_basename(__FILE__))) ||
|
266 |
-
!current_user_can('edit_post', $postId) ||
|
267 |
-
defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
|
268 |
-
return $postId;
|
269 |
-
|
270 |
-
// Get defaults
|
271 |
-
$defaultData = self::getDefaultData(false);
|
272 |
-
|
273 |
-
// Get old data
|
274 |
-
$oldData = get_post_meta($postId, self::$settingsMetaKey, true);
|
275 |
-
if(!is_array(($oldData)))
|
276 |
-
$oldData = array();
|
277 |
-
|
278 |
-
// Filter new data from $_POST
|
279 |
-
$newData = array();
|
280 |
-
if(is_array($_POST) && count($_POST) > 0)
|
281 |
-
foreach($_POST as $key => $value)
|
282 |
-
if(is_array(self::$prefixes) && count(self::$prefixes) > 0)
|
283 |
-
foreach(self::$prefixes as $prefix)
|
284 |
-
if($prefix == substr($key, 0, strlen($prefix)))
|
285 |
-
$newData[$key] = htmlspecialchars($value);
|
286 |
-
|
287 |
-
// Save settings
|
288 |
-
update_post_meta(
|
289 |
-
$postId,
|
290 |
-
self::$settingsMetaKey,
|
291 |
-
array_merge(
|
292 |
-
$defaultData,
|
293 |
-
$oldData,
|
294 |
-
$newData
|
295 |
-
));
|
296 |
-
|
297 |
-
return $postId;
|
298 |
-
}
|
299 |
-
|
300 |
-
/**
|
301 |
-
* Restores some HTML in a string after using the htmlspecialchars() function on it.
|
302 |
-
* Therefore, to be able to show the allowed HTML tags in a string, use this function.
|
303 |
-
*
|
304 |
-
* @param string $string The htmlspecialchars() string
|
305 |
-
* @return string $string The exceptionized string.
|
306 |
-
*/
|
307 |
-
static function htmlspecialchars_decodeOnlyAllowed($string){
|
308 |
-
|
309 |
-
|
310 |
-
return $string;
|
311 |
-
}
|
312 |
-
|
313 |
-
/**
|
314 |
-
* Get simplified settings. This means there won't be an array full of
|
315 |
-
* field information and data. There will simply be a key => value pair
|
316 |
-
* with the retrieved settings or, if that value is empty, the default setting
|
317 |
-
*
|
318 |
-
* @param int $postId
|
319 |
-
* @param string $prefix (optional, defaults to null)
|
320 |
-
* @param bool $cacheEnabled (optional, defaults to true)
|
321 |
-
* @return mixed $simpleSettings
|
322 |
-
*/
|
323 |
-
static function getSimpleSettings($postId, $prefix = null, $cacheEnabled = true){
|
324 |
-
$settings = self::getSettings($postId, $prefix, $cacheEnabled);
|
325 |
-
|
326 |
-
$simpleSettings = array();
|
327 |
-
if(is_array($settings) && count($settings) > 0)
|
328 |
-
foreach($settings as $key => $value){
|
329 |
-
if(!is_array($value))
|
330 |
-
continue;
|
331 |
-
|
332 |
-
if(empty($value[1]) && !is_numeric($value[1]))
|
333 |
-
$simpleSettings[$key] = $value[2];
|
334 |
-
else $simpleSettings[$key] = $value[1];
|
335 |
-
}
|
336 |
-
|
337 |
-
return $simpleSettings;
|
338 |
-
}
|
339 |
-
|
340 |
-
/**
|
341 |
-
* Gets settings for the slideshow with the parsed post id.
|
342 |
-
* When only the data with a particular prefix needs to be returned, pass the prefix as $prefix
|
343 |
-
*
|
344 |
-
* @param int $postId
|
345 |
-
* @param string $prefix (optional, defaults to null)
|
346 |
-
* @param bool $cacheEnabled (optional, defaults to true)
|
347 |
-
* @return mixed $settings
|
348 |
-
*/
|
349 |
-
static function getSettings($postId, $prefix = null, $cacheEnabled = true){
|
350 |
-
if(!is_numeric($postId) || empty($postId))
|
351 |
-
return array();
|
352 |
-
|
353 |
-
if(!isset(self::$settings) || !$cacheEnabled){
|
354 |
-
// Get default data
|
355 |
-
$data = self::getDefaultData();
|
356 |
-
|
357 |
-
// Get settings
|
358 |
-
$currentSettings = get_post_meta(
|
359 |
-
$postId,
|
360 |
-
self::$settingsMetaKey,
|
361 |
-
true
|
362 |
-
);
|
363 |
-
|
364 |
-
// Fill data with settings
|
365 |
-
if(is_array($data) && count($data) > 0)
|
366 |
-
foreach($data as $key => $value)
|
367 |
-
if(isset($currentSettings[$key])){
|
368 |
-
$data[$key][1] = $currentSettings[$key];
|
369 |
-
unset($currentSettings[$key]);
|
370 |
-
}
|
371 |
-
|
372 |
-
// Load settings that are not there by default into data (slides in particular)
|
373 |
-
if(is_array($currentSettings) && count($currentSettings) > 0)
|
374 |
-
foreach($currentSettings as $key => $value)
|
375 |
-
if(!isset($data[$key]))
|
376 |
-
$data[$key] = $value;
|
377 |
-
|
378 |
-
$settings = $data;
|
379 |
-
if($cacheEnabled)
|
380 |
-
self::$settings = $data;
|
381 |
-
}else{
|
382 |
-
$settings = self::$settings;
|
383 |
-
}
|
384 |
-
|
385 |
-
if(isset($prefix))
|
386 |
-
if(is_array($settings) && count($settings) > 0)
|
387 |
-
foreach($settings as $key => $value)
|
388 |
-
if($prefix != substr($key, 0, strlen($prefix)))
|
389 |
-
unset($settings[$key]);
|
390 |
-
|
391 |
-
return $settings;
|
392 |
-
}
|
393 |
-
|
394 |
-
/**
|
395 |
-
* Gets defdault data. If only default data (without field information) is needed, set fullDefinition to false.
|
396 |
-
*
|
397 |
-
* @param boolean $fullDefinition (optional, defaults to true)
|
398 |
-
* @return mixed $defaultData
|
399 |
-
*/
|
400 |
-
static function getDefaultData($fullDefinition = true){
|
401 |
-
$data = array(
|
402 |
-
'style_style' => __('light', 'slideshow-plugin'),
|
403 |
-
'style_custom' => '',
|
404 |
-
'setting_animation' => __('slide', 'slideshow=plugin'),
|
405 |
-
'setting_slideSpeed' => '1',
|
406 |
-
'setting_descriptionSpeed' => '0.4',
|
407 |
-
'setting_intervalSpeed' => '5',
|
408 |
-
'setting_play' => 'true',
|
409 |
-
'setting_loop' => 'true',
|
410 |
-
'setting_slidesPerView' => '1',
|
411 |
-
'setting_width' => '0',
|
412 |
-
'setting_height' => '200',
|
413 |
-
'setting_descriptionHeight' => '50',
|
414 |
-
'setting_stretchImages' => 'true',
|
415 |
-
'setting_controllable' => 'true',
|
416 |
-
'setting_controlPanel' => 'false',
|
417 |
-
'setting_showDescription' => 'true',
|
418 |
-
'setting_hideDescription' => 'true',
|
419 |
-
'setting_random' => 'false',
|
420 |
-
//'setting_cssInHeader' => 'false',
|
421 |
-
'setting_avoidFilter' => 'true'
|
422 |
-
);
|
423 |
-
|
424 |
-
if($fullDefinition){
|
425 |
-
$yes = __('Yes', 'slideshow-plugin');
|
426 |
-
$no = __('No', 'slideshow-plugin');
|
427 |
-
$data = array( // $data : array([prefix_settingName] => array([inputType], [value], [default], [description], array([options]), array([dependsOn], [onValue]), 'group' => [groupName]))
|
428 |
-
'style_style' => array('select', '', $data['style_style'], __('The style used for this slideshow', 'slideshow-plugin'), array('light' => __('Light', 'slideshow-plugin'), 'dark' => __('Dark', 'slideshow-plugin'), 'custom' => __('Custom', 'slideshow-plugin'))),
|
429 |
-
'style_custom' => array('textarea', '', $data['style_custom'], __('Custom style editor', 'slideshow-plugin'), null, array('style_style', 'custom')),
|
430 |
-
'setting_animation' => array('select', '', $data['setting_animation'], __('Animation used for transition between slides', 'slideshow-plugin'), array('slide' => __('Slide', 'slideshow-plugin'), 'fade' => __('Fade', 'slideshow-plugin')), 'group' => __('Animation', 'slideshow-plugin')),
|
431 |
-
'setting_slideSpeed' => array('text', '', $data['setting_slideSpeed'], __('Number of seconds the slide takes to slide in', 'slideshow-plugin'), 'group' => __('Animation', 'slideshow-plugin')),
|
432 |
-
'setting_descriptionSpeed' => array('text', '', $data['setting_descriptionSpeed'], __('Number of seconds the description takes to slide in', 'slideshow-plugin'), 'group' => __('Animation', 'slideshow-plugin')),
|
433 |
-
'setting_intervalSpeed' => array('text', '', $data['setting_intervalSpeed'], __('Seconds between changing slides', 'slideshow-plugin'), 'group' => __('Animation', 'slideshow-plugin')),
|
434 |
-
'setting_slidesPerView' => array('text', '', $data['setting_slidesPerView'], __('Number of slides to fit into one slide', 'slideshow-plugin'), 'group' => __('Display', 'slideshow-plugin')),
|
435 |
-
'setting_width' => array('text', '', $data['setting_width'], __('Width of the slideshow, set to parent's width on 0', 'slideshow-plugin'), 'group' => __('Display', 'slideshow-plugin')),
|
436 |
-
'setting_height' => array('text', '', $data['setting_height'], __('Height of the slideshow', 'slideshow-plugin'), 'group' => __('Display', 'slideshow-plugin')),
|
437 |
-
'setting_descriptionHeight' => array('text', '', $data['setting_descriptionHeight'], __('Height of the description boxes', 'slideshow-plugin'), 'group' => __('Display', 'slideshow-plugin')),
|
438 |
-
'setting_stretchImages' => array('radio', '', $data['setting_stretchImages'], __('Fit image into slide (stretching it)', 'slideshow-plugin'), array('true' => $yes, 'false' => $no), 'group' => __('Display', 'slideshow-plugin')),
|
439 |
-
'setting_showDescription' => array('radio', '', $data['setting_showDescription'], __('Show title and description', 'slideshow-plugin'), array('true' => $yes, 'false' => $no), 'group' => __('Display', 'slideshow-plugin')),
|
440 |
-
'setting_hideDescription' => array('radio', '', $data['setting_hideDescription'], __('Hide description box, it will pop up when a mouse hovers over the slide', 'slideshow-plugin'), array('true' => $yes, 'false' => $no), array('setting_showDescription', 'true'), 'group' => __('Display', 'slideshow-plugin')),
|
441 |
-
'setting_play' => array('radio', '', $data['setting_play'], __('Automatically slide to the next slide', 'slideshow-plugin'), array('true' => $yes, 'false' => $no), 'group' => __('Control', 'slideshow-plugin')),
|
442 |
-
'setting_loop' => array('radio', '', $data['setting_loop'], __('Return to the beginning of the slideshow after last slide', 'slideshow-plugin'), array('true' => $yes, 'false' => $no), 'group' => __('Control', 'slideshow-plugin')),
|
443 |
-
'setting_controllable' => array('radio', '', $data['setting_controllable'], __('Activate buttons (so the user can scroll through the slides)', 'slideshow-plugin'), array('true' => $yes, 'false' => $no), 'group' => __('Control', 'slideshow-plugin')),
|
444 |
-
'setting_controlPanel' => array('radio', '', $data['setting_controlPanel'], __('Show control panel (play and pause button)', 'slideshow-plugin'), array('true' => $yes, 'false' => $no), 'group' => __('Control', 'slideshow-plugin')),
|
445 |
-
'setting_random' => array('radio', '', $data['setting_random'], __('Randomize slides', 'slideshow-plugin'), array('true' => $yes, 'false' => $no), 'group' => __('Miscellaneous', 'slideshow-plugin')),
|
446 |
-
//'setting_cssInHeader' => array('radio', '', $data['setting_cssInHeader'], __('Load all CSS in the \'<head>\' area', 'slideshow-plugin'), array('true' => $yes, 'false' => $no), 'group' => __('Miscellaneous', 'slideshow-plugin')),
|
447 |
-
'setting_avoidFilter' => array('radio', '', $data['setting_avoidFilter'], sprintf(__('Avoid content filter (disable if \'%s\' is shown)', 'slideshow-plugin'), SlideshowPluginShortcode::$bookmark), array('true' => $yes, 'false' => $no), 'group' => __('Miscellaneous', 'slideshow-plugin'))
|
448 |
-
);
|
449 |
-
}
|
450 |
-
|
451 |
-
return $data;
|
452 |
-
}
|
453 |
-
|
454 |
-
/**
|
455 |
-
* Get all attachments attached to the parsed postId
|
456 |
-
*
|
457 |
-
* @param int $postId
|
458 |
-
* @return mixed $attachments
|
459 |
-
*/
|
460 |
-
static function getAttachments($postId){
|
461 |
-
if(!is_numeric($postId))
|
462 |
-
return array();
|
463 |
-
|
464 |
-
return get_posts(array(
|
465 |
-
'post_type' => 'attachment',
|
466 |
-
'numberposts' => -1,
|
467 |
-
'post_status' => null,
|
468 |
-
'post_parent' => $postId
|
469 |
-
));
|
470 |
-
}
|
471 |
-
|
472 |
-
/**
|
473 |
-
* Gets all input fields based on the list of obtained settings
|
474 |
-
*
|
475 |
-
* @param mixed|int $settings
|
476 |
-
* @param bool $cacheEnabled (optional, defaults to true)
|
477 |
-
* @return mixed $inputFields
|
478 |
-
*/
|
479 |
-
private static function getInputFields($settings, $cacheEnabled = true){
|
480 |
-
if(is_numeric($settings))
|
481 |
-
$settings = self::getSettings($settings);
|
482 |
-
elseif(empty($settings))
|
483 |
-
return array();
|
484 |
-
|
485 |
-
if(!isset(self::$inputFields) || !$cacheEnabled){
|
486 |
-
$inputFields = array();
|
487 |
-
if(is_array($settings) && count($settings) > 0){
|
488 |
-
foreach($settings as $key => $value){
|
489 |
-
if(!is_array($value))
|
490 |
-
continue;
|
491 |
-
|
492 |
-
$inputField = '';
|
493 |
-
$displayValue = (empty($value[1]) && !is_numeric($value[1]) ? $value[2] : $value[1]);
|
494 |
-
$class = ((isset($value[5]))? 'depends-on-field-value ' . $value[5][0] . ' ' . $value[5][1] . ' ': '') . $key;
|
495 |
-
switch($value[0]){
|
496 |
-
case 'text':
|
497 |
-
$inputField .= '<input
|
498 |
-
type="text"
|
499 |
-
name="' . $key . '"
|
500 |
-
class="' . $class . '"
|
501 |
-
value="' . $displayValue . '"
|
502 |
-
/>';
|
503 |
-
break;
|
504 |
-
case 'textarea':
|
505 |
-
$inputField .= '<textarea
|
506 |
-
name="' . $key . '"
|
507 |
-
class="' . $class . '"
|
508 |
-
rows="20"
|
509 |
-
cols="60"
|
510 |
-
>' . $displayValue . '</textarea>';
|
511 |
-
break;
|
512 |
-
case 'select':
|
513 |
-
$inputField .= '<select name="' . $key . '" class="' . $class . '">';
|
514 |
-
if(is_array($value[4]) && count($value[4]) > 0){
|
515 |
-
foreach($value[4] as $optionKey => $optionValue){
|
516 |
-
$inputField .= '<option value="' . $optionKey . '" ' . selected($displayValue, $optionKey, false) . '>
|
517 |
-
' . $optionValue . '
|
518 |
-
</option>';
|
519 |
-
}
|
520 |
-
}
|
521 |
-
$inputField .= '</select>';
|
522 |
-
break;
|
523 |
-
case 'radio':
|
524 |
-
if(is_array($value[4]) && count($value[4]) > 0){
|
525 |
-
foreach($value[4] as $radioKey => $radioValue){
|
526 |
-
$inputField .= '<label><input
|
527 |
-
type="radio"
|
528 |
-
name="' . $key . '"
|
529 |
-
class="' . $class . '"
|
530 |
-
value="' . $radioKey . '" ' .
|
531 |
-
checked($displayValue, $radioKey, false) .
|
532 |
-
' />' . $radioValue . '</label><br />';
|
533 |
-
}
|
534 |
-
}
|
535 |
-
break;
|
536 |
-
default:
|
537 |
-
$inputField = null;
|
538 |
-
break;
|
539 |
-
};
|
540 |
-
|
541 |
-
$inputFields[$key] = $inputField;
|
542 |
-
}
|
543 |
-
}
|
544 |
-
|
545 |
-
if($cacheEnabled)
|
546 |
-
self::$inputFields = $inputFields;
|
547 |
-
}else{
|
548 |
-
$inputFields = self::$inputFields;
|
549 |
-
}
|
550 |
-
|
551 |
-
return $inputFields;
|
552 |
-
}
|
553 |
}
|
4 |
* slideshows and their individual settings
|
5 |
*
|
6 |
* @author: Stefan Boonstra
|
7 |
+
* @version: 06-12-12
|
8 |
*/
|
9 |
class SlideshowPluginPostType {
|
10 |
|
11 |
/** Variables */
|
12 |
static $postType = 'slideshow';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* Initialize Slideshow post type.
|
18 |
static function initialize(){
|
19 |
add_action('init', array(__CLASS__, 'registerSlideshowPostType'));
|
20 |
add_action('admin_enqueue_scripts', array(__CLASS__, 'enqueue'));
|
21 |
+
add_action('save_post', array('SlideshowPluginSettingsHandler', 'save'));
|
22 |
}
|
23 |
|
24 |
/**
|
156 |
static function slidesMetaBox(){
|
157 |
global $post;
|
158 |
|
159 |
+
// Get slides
|
160 |
+
$slides = SlideshowPluginSettingsHandler::getSlides($post->ID);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
|
162 |
+
// Stores highest slide id.
|
163 |
+
$highestSlideId = count($slides) - 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
|
165 |
// Set url from which a substitute icon can be fetched
|
166 |
$noPreviewIcon = SlideshowPluginMain::getPluginUrl() . '/images/' . __CLASS__ . '/no-img.png';
|
176 |
global $post;
|
177 |
|
178 |
// Get settings
|
179 |
+
$settings = SlideshowPluginSettingsHandler::getStyleSettings($post->ID, true);
|
180 |
+
//var_dump($settings);
|
181 |
|
182 |
// Fill custom style with default css if empty
|
183 |
+
if(isset($settings['custom']) && isset($settings['custom']['value']) && empty($settings['custom']['value'])){
|
184 |
ob_start();
|
185 |
include(SlideshowPluginMain::getPluginPath() . '/style/SlideshowPlugin/style-custom.css');
|
186 |
$settings['style_custom'][1] = ob_get_clean();
|
187 |
}
|
188 |
|
|
|
|
|
|
|
189 |
// Include style settings file
|
190 |
include(SlideshowPluginMain::getPluginPath() . '/views/' . __CLASS__ . '/style-settings.php');
|
191 |
}
|
197 |
global $post;
|
198 |
|
199 |
// Get settings
|
200 |
+
$settings = SlideshowPluginSettingsHandler::getSettings($post->ID, true);
|
|
|
201 |
|
202 |
// Include
|
203 |
include(SlideshowPluginMain::getPluginPath() . '/views/' . __CLASS__ . '/settings.php');
|
204 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
}
|
classes/SlideshowPluginSettingsHandler.php
ADDED
@@ -0,0 +1,459 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class SlideshowPluginSettingsHandler handles all database/settings interactions.
|
4 |
+
*
|
5 |
+
* @since 2.1.20
|
6 |
+
* @author Stefan Boonstra
|
7 |
+
* @version 06-12-12
|
8 |
+
*/
|
9 |
+
class SlideshowPluginSettingsHandler {
|
10 |
+
|
11 |
+
/** Setting keys */
|
12 |
+
static $settingsKey = 'settings';
|
13 |
+
static $styleSettingsKey = 'styleSettings';
|
14 |
+
static $slidesKey = 'slides';
|
15 |
+
|
16 |
+
/** Cached settings stored by slideshow ID */
|
17 |
+
static $settings = array();
|
18 |
+
static $styleSettings = array();
|
19 |
+
static $slides = array();
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Returns all settings that belong to the passed post ID retrieved from
|
23 |
+
* database, merged with default values from getDefaults(). Does not merge
|
24 |
+
* if mergeDefaults is false.
|
25 |
+
*
|
26 |
+
* If all data (including field information and description) is needed,
|
27 |
+
* set fullDefinition to true. See getDefaults() documentation for returned
|
28 |
+
* values. mergeDefaults must be true for this option to have any effect.
|
29 |
+
*
|
30 |
+
* If enableCache is set to true, results are saved into local storage for
|
31 |
+
* more efficient use. If data was already stored, cached data will be
|
32 |
+
* returned, unless $enableCache is set to false. Settings will not be
|
33 |
+
* cached.
|
34 |
+
*
|
35 |
+
* @since 2.1.20
|
36 |
+
* @param int $slideshowId
|
37 |
+
* @param boolean $fullDefinition (optional, defaults to false)
|
38 |
+
* @param boolean $enableCache (optional, defaults to true)
|
39 |
+
* @param boolean $mergeDefaults (optional, defaults to true)
|
40 |
+
* @return mixed $settings
|
41 |
+
*/
|
42 |
+
static function getAllSettings($slideshowId, $fullDefinition = false, $enableCache = true, $mergeDefaults = true){
|
43 |
+
$settings = array();
|
44 |
+
$settings[self::$settingsKey] = self::getSettings($slideshowId, $fullDefinition, $enableCache, $mergeDefaults);
|
45 |
+
$settings[self::$styleSettingsKey] = self::getStyleSettings($slideshowId, $fullDefinition, $enableCache, $mergeDefaults);
|
46 |
+
$settings[self::$slidesKey] = self::getSlides($slideshowId, $enableCache);
|
47 |
+
|
48 |
+
return $settings;
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Returns settings retrieved from database.
|
53 |
+
*
|
54 |
+
* For a full description of the parameters, see getAllSettings().
|
55 |
+
*
|
56 |
+
* @since 2.1.20
|
57 |
+
* @param int $slideshowId
|
58 |
+
* @param boolean $fullDefinition (optional, defaults to false)
|
59 |
+
* @param boolean $enableCache (optional, defaults to true)
|
60 |
+
* @param boolean $mergeDefaults (optional, defaults to true)
|
61 |
+
* @return mixed $settings
|
62 |
+
*/
|
63 |
+
static function getSettings($slideshowId, $fullDefinition = false, $enableCache = true, $mergeDefaults = true){
|
64 |
+
if(!is_numeric($slideshowId) || empty($slideshowId))
|
65 |
+
return array();
|
66 |
+
|
67 |
+
// Set caching to false and merging defaults to true when $fullDefinition is set to true
|
68 |
+
if($fullDefinition){
|
69 |
+
$enableCache = false;
|
70 |
+
$mergeDefaults = true;
|
71 |
+
}
|
72 |
+
|
73 |
+
// If no cache is set, or cache is disabled
|
74 |
+
if(!isset(self::$settings[$slideshowId]) || empty(self::$settings[$slideshowId]) || !$enableCache){
|
75 |
+
// Meta data
|
76 |
+
$settingsMeta = get_post_meta(
|
77 |
+
$slideshowId,
|
78 |
+
self::$settingsKey,
|
79 |
+
true
|
80 |
+
);
|
81 |
+
if(!$settingsMeta || !is_array($settingsMeta))
|
82 |
+
$settingsMeta = array();
|
83 |
+
|
84 |
+
// If the settings should be merged with the defaults as a full definition, place each setting in an array referenced by 'value'.
|
85 |
+
if($fullDefinition)
|
86 |
+
foreach($settingsMeta as $key => $value)
|
87 |
+
$settingsMeta[$key] = array('value' => $value);
|
88 |
+
|
89 |
+
// Get defaults
|
90 |
+
$defaults = array();
|
91 |
+
if($mergeDefaults)
|
92 |
+
$defaults = self::getDefaultSettings($fullDefinition);
|
93 |
+
|
94 |
+
// Merge with defaults, recursively if a the full definition is required
|
95 |
+
if($fullDefinition)
|
96 |
+
$settings = array_merge_recursive(
|
97 |
+
$defaults,
|
98 |
+
$settingsMeta
|
99 |
+
);
|
100 |
+
else
|
101 |
+
$settings = array_merge(
|
102 |
+
$defaults,
|
103 |
+
$settingsMeta
|
104 |
+
);
|
105 |
+
|
106 |
+
// Cache if cache is enabled
|
107 |
+
if($enableCache){
|
108 |
+
self::$settings[$slideshowId] = $settings;
|
109 |
+
}
|
110 |
+
}else{
|
111 |
+
// Get cached settings
|
112 |
+
$settings = self::$settings[$slideshowId];
|
113 |
+
}
|
114 |
+
|
115 |
+
// Return
|
116 |
+
return $settings;
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Returns style settings retrieved from database.
|
121 |
+
*
|
122 |
+
* For a full description of the parameters, see getAllSettings().
|
123 |
+
*
|
124 |
+
* @since 2.1.20
|
125 |
+
* @param int $slideshowId
|
126 |
+
* @param boolean $fullDefinition (optional, defaults to false)
|
127 |
+
* @param boolean $enableCache (optional, defaults to true)
|
128 |
+
* @param boolean $mergeDefaults (optional, defaults to true)
|
129 |
+
* @return mixed $settings
|
130 |
+
*/
|
131 |
+
static function getStyleSettings($slideshowId, $fullDefinition = false, $enableCache = true, $mergeDefaults = true){
|
132 |
+
if(!is_numeric($slideshowId) || empty($slideshowId))
|
133 |
+
return array();
|
134 |
+
|
135 |
+
// Set caching to false and merging defaults to true when $fullDefinition is set to true
|
136 |
+
if($fullDefinition){
|
137 |
+
$enableCache = false;
|
138 |
+
$mergeDefaults = true;
|
139 |
+
}
|
140 |
+
|
141 |
+
// If no cache is set, or cache is disabled
|
142 |
+
if(!isset(self::$styleSettings[$slideshowId]) || empty(self::$styleSettings[$slideshowId]) || !$enableCache){
|
143 |
+
// Meta data
|
144 |
+
$styleSettingsMeta = get_post_meta(
|
145 |
+
$slideshowId,
|
146 |
+
self::$styleSettingsKey,
|
147 |
+
true
|
148 |
+
);
|
149 |
+
if(!$styleSettingsMeta || !is_array($styleSettingsMeta))
|
150 |
+
$styleSettingsMeta = array();
|
151 |
+
|
152 |
+
// If the settings should be merged with the defaults as a full definition, place each setting in an array referenced by 'value'.
|
153 |
+
if($fullDefinition)
|
154 |
+
foreach($styleSettingsMeta as $key => $value)
|
155 |
+
$styleSettingsMeta[$key] = array('value' => $value);
|
156 |
+
|
157 |
+
// Get defaults
|
158 |
+
$defaults = array();
|
159 |
+
if($mergeDefaults)
|
160 |
+
$defaults = self::getDefaultStyleSettings($fullDefinition);
|
161 |
+
|
162 |
+
// Merge with defaults, recursively if a the full definition is required
|
163 |
+
if($fullDefinition)
|
164 |
+
$styleSettings = array_merge_recursive(
|
165 |
+
$defaults,
|
166 |
+
$styleSettingsMeta
|
167 |
+
);
|
168 |
+
else
|
169 |
+
$styleSettings = array_merge(
|
170 |
+
$defaults,
|
171 |
+
$styleSettingsMeta
|
172 |
+
);
|
173 |
+
|
174 |
+
// Cache if cache is enabled
|
175 |
+
if($enableCache){
|
176 |
+
self::$styleSettings[$slideshowId] = $styleSettings;
|
177 |
+
}
|
178 |
+
}else{
|
179 |
+
// Get cached settings
|
180 |
+
$styleSettings = self::$styleSettings[$slideshowId];
|
181 |
+
}
|
182 |
+
|
183 |
+
// Return
|
184 |
+
return $styleSettings;
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Returns slides retrieved from database.
|
189 |
+
*
|
190 |
+
* For a full description of the parameters, see getAllSettings().
|
191 |
+
*
|
192 |
+
* @since 2.1.20
|
193 |
+
* @param int $slideshowId
|
194 |
+
* @param boolean $enableCache (optional, defaults to true)
|
195 |
+
* @return mixed $settings
|
196 |
+
*/
|
197 |
+
static function getSlides($slideshowId, $enableCache = true){
|
198 |
+
if(!is_numeric($slideshowId) || empty($slideshowId))
|
199 |
+
return array();
|
200 |
+
|
201 |
+
// If no cache is set, or cache is disabled
|
202 |
+
if(!isset(self::$slides[$slideshowId]) || empty(self::$slides[$slideshowId]) || !$enableCache){
|
203 |
+
// Meta data
|
204 |
+
$slides = get_post_meta(
|
205 |
+
$slideshowId,
|
206 |
+
self::$slidesKey,
|
207 |
+
true
|
208 |
+
);
|
209 |
+
}else{
|
210 |
+
// Get cached settings
|
211 |
+
$slides = self::$slides[$slideshowId];
|
212 |
+
}
|
213 |
+
|
214 |
+
// Sort slides by order ID
|
215 |
+
if(is_array($slides))
|
216 |
+
ksort($slides);
|
217 |
+
else
|
218 |
+
$slides = array();
|
219 |
+
|
220 |
+
// Return
|
221 |
+
return $slides;
|
222 |
+
}
|
223 |
+
|
224 |
+
/**
|
225 |
+
* Get new settings from $_POST variable and merge them with
|
226 |
+
* the old and default settings.
|
227 |
+
*
|
228 |
+
* @since 2.1.20
|
229 |
+
* @param int $postId
|
230 |
+
* @return int $postId
|
231 |
+
*/
|
232 |
+
static function save($postId){
|
233 |
+
// Verify nonce, check if user has sufficient rights and return on auto-save.
|
234 |
+
if(get_post_type($postId) != SlideshowPluginPostType::$postType ||
|
235 |
+
(isset($_POST['nonce']) && !wp_verify_nonce($_POST['nonce'], plugin_basename(__FILE__))) ||
|
236 |
+
!current_user_can('edit_post', $postId) ||
|
237 |
+
defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
|
238 |
+
return $postId;
|
239 |
+
|
240 |
+
// Old settings
|
241 |
+
$oldSettings = self::getSettings($postId);
|
242 |
+
$oldStyleSettings = self::getStyleSettings($postId);
|
243 |
+
$oldSlides = self::getSlides($postId);
|
244 |
+
|
245 |
+
// Get new settings from $_POST, making sure they're arrays
|
246 |
+
$newPostSettings = $newPostStyleSettings = $newPostSlides = array();
|
247 |
+
if(isset($_POST[self::$settingsKey]) && is_array($_POST[self::$settingsKey]))
|
248 |
+
$newPostSettings = $_POST[self::$settingsKey];
|
249 |
+
if(isset($_POST[self::$styleSettingsKey]) && is_array($_POST[self::$styleSettingsKey]))
|
250 |
+
$newPostStyleSettings = $_POST[self::$styleSettingsKey];
|
251 |
+
if(isset($_POST[self::$slidesKey]) && is_array($_POST[self::$slidesKey]))
|
252 |
+
$newPostSlides = $_POST[self::$slidesKey];
|
253 |
+
|
254 |
+
// Merge new settings with its old values
|
255 |
+
$newSettings = array_merge(
|
256 |
+
$oldSettings,
|
257 |
+
$newPostSettings
|
258 |
+
);
|
259 |
+
|
260 |
+
// Merge new style settings with its old values
|
261 |
+
$newStyleSettings = array_merge(
|
262 |
+
$oldStyleSettings,
|
263 |
+
$newPostStyleSettings
|
264 |
+
);
|
265 |
+
|
266 |
+
// Save settings
|
267 |
+
update_post_meta($postId, self::$settingsKey, $newSettings);
|
268 |
+
update_post_meta($postId, self::$styleSettingsKey, $newStyleSettings);
|
269 |
+
update_post_meta($postId, self::$slidesKey, $newPostSlides);
|
270 |
+
|
271 |
+
// Return
|
272 |
+
return $postId;
|
273 |
+
}
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Returns an array of all defaults. The array will be returned
|
277 |
+
* like this:
|
278 |
+
* array([settingsKey] => array([settingName] => [settingValue]))
|
279 |
+
*
|
280 |
+
* If all default data (including field information and description)
|
281 |
+
* is needed, set fullDefinition to true. Data in the full definition is
|
282 |
+
* build up as follows:
|
283 |
+
* array([settingsKey] => array([settingName] => array('type' => [inputType], 'value' => [value], 'default' => [default], 'description' => [description], 'options' => array([options]), 'dependsOn' => array([dependsOn], [onValue]), 'group' => [groupName])))
|
284 |
+
*
|
285 |
+
* @since 2.1.20
|
286 |
+
* @param mixed $key (optional, defaults to null, getting all keys)
|
287 |
+
* @param boolean $fullDefinition (optional, defaults to false)
|
288 |
+
* @return mixed $data
|
289 |
+
*/
|
290 |
+
static function getAllDefaults($key = null, $fullDefinition = false){
|
291 |
+
$data = array();
|
292 |
+
$data[self::$settingsKey] = self::getDefaultSettings($fullDefinition);
|
293 |
+
$data[self::$styleSettingsKey] = self::getDefaultStyleSettings($fullDefinition);
|
294 |
+
|
295 |
+
return $data;
|
296 |
+
}
|
297 |
+
|
298 |
+
/**
|
299 |
+
* Returns an array of setting defaults.
|
300 |
+
*
|
301 |
+
* For a full description of the parameters, see getAllDefaults().
|
302 |
+
*
|
303 |
+
* @since 2.1.20
|
304 |
+
* @param boolean $fullDefinition (optional, defaults to false)
|
305 |
+
* @return mixed $data
|
306 |
+
*/
|
307 |
+
static function getDefaultSettings($fullDefinition = false){
|
308 |
+
// Much used data for translation
|
309 |
+
$yes = __('Yes', 'slideshow-plugin');
|
310 |
+
$no = __('No', 'slideshow-plugin');
|
311 |
+
|
312 |
+
// Default values
|
313 |
+
$data = array(
|
314 |
+
'animation' => array('default' => 'slide'),
|
315 |
+
'slideSpeed' => array('default' => '1'),
|
316 |
+
'descriptionSpeed' => array('default' => '0.4'),
|
317 |
+
'intervalSpeed' => array('default' => '5'),
|
318 |
+
'play' => array('default' => 'true'),
|
319 |
+
'loop' => array('default' => 'true'),
|
320 |
+
'slidesPerView' => array('default' => '1'),
|
321 |
+
'width' => array('default' => '0'),
|
322 |
+
'height' => array('default' => '200'),
|
323 |
+
'descriptionHeight' => array('default' => '50'),
|
324 |
+
'stretchImages' => array('default' => 'true'),
|
325 |
+
'controllable' => array('default' => 'true'),
|
326 |
+
'controlPanel' => array('default' => 'false'),
|
327 |
+
'showDescription' => array('default' => 'true'),
|
328 |
+
'hideDescription' => array('default' => 'true'),
|
329 |
+
'random' => array('default' => 'false'),
|
330 |
+
'avoidFilter' => array('default' => 'true')
|
331 |
+
);
|
332 |
+
|
333 |
+
// Full definition
|
334 |
+
if($fullDefinition){
|
335 |
+
$data = array_merge_recursive(
|
336 |
+
array(
|
337 |
+
'animation' => array('type' => 'select', 'description' => __('Animation used for transition between slides', 'slideshow-plugin'), 'options' => array('slide' => __('Slide', 'slideshow-plugin'), 'fade' => __('Fade', 'slideshow-plugin')), 'group' => __('Animation', 'slideshow-plugin')),
|
338 |
+
'slideSpeed' => array('type' => 'text', 'description' => __('Number of seconds the slide takes to slide in', 'slideshow-plugin'), 'group' => __('Animation', 'slideshow-plugin')),
|
339 |
+
'descriptionSpeed' => array('type' => 'text', 'description' => __('Number of seconds the description takes to slide in', 'slideshow-plugin'), 'group' => __('Animation', 'slideshow-plugin')),
|
340 |
+
'intervalSpeed' => array('type' => 'text', 'description' => __('Seconds between changing slides', 'slideshow-plugin'), 'group' => __('Animation', 'slideshow-plugin')),
|
341 |
+
'slidesPerView' => array('type' => 'text', 'description' => __('Number of slides to fit into one slide', 'slideshow-plugin'), 'group' => __('Display', 'slideshow-plugin')),
|
342 |
+
'width' => array('type' => 'text', 'description' => __('Width of the slideshow, set to parent's width on 0', 'slideshow-plugin'), 'group' => __('Display', 'slideshow-plugin')),
|
343 |
+
'height' => array('type' => 'text', 'description' => __('Height of the slideshow', 'slideshow-plugin'), 'group' => __('Display', 'slideshow-plugin')),
|
344 |
+
'descriptionHeight' => array('type' => 'text', 'description' => __('Height of the description boxes', 'slideshow-plugin'), 'group' => __('Display', 'slideshow-plugin')),
|
345 |
+
'stretchImages' => array('type' => 'radio', 'description' => __('Fit image into slide (stretching it)', 'slideshow-plugin'), 'options' => array('true' => $yes, 'false' => $no), 'group' => __('Display', 'slideshow-plugin')),
|
346 |
+
'showDescription' => array('type' => 'radio', 'description' => __('Show title and description', 'slideshow-plugin'), 'options' => array('true' => $yes, 'false' => $no), 'group' => __('Display', 'slideshow-plugin')),
|
347 |
+
'hideDescription' => array('type' => 'radio', 'description' => __('Hide description box, it will pop up when a mouse hovers over the slide', 'slideshow-plugin'), 'options' => array('true' => $yes, 'false' => $no), 'dependsOn' => array('settings[showDescription]', 'true'), 'group' => __('Display', 'slideshow-plugin')),
|
348 |
+
'play' => array('type' => 'radio', 'description' => __('Automatically slide to the next slide', 'slideshow-plugin'), 'options' => array('true' => $yes, 'false' => $no), 'group' => __('Control', 'slideshow-plugin')),
|
349 |
+
'loop' => array('type' => 'radio', 'description' => __('Return to the beginning of the slideshow after last slide', 'slideshow-plugin'), 'options' => array('true' => $yes, 'false' => $no), 'group' => __('Control', 'slideshow-plugin')),
|
350 |
+
'controllable' => array('type' => 'radio', 'description' => __('Activate buttons (so the user can scroll through the slides)', 'slideshow-plugin'), 'options' => array('true' => $yes, 'false' => $no), 'group' => __('Control', 'slideshow-plugin')),
|
351 |
+
'controlPanel' => array('type' => 'radio', 'description' => __('Show control panel (play and pause button)', 'slideshow-plugin'), 'options' => array('true' => $yes, 'false' => $no), 'group' => __('Control', 'slideshow-plugin')),
|
352 |
+
'random' => array('type' => 'radio', 'description' => __('Randomize slides', 'slideshow-plugin'), 'options' => array('true' => $yes, 'false' => $no), 'group' => __('Miscellaneous', 'slideshow-plugin')),
|
353 |
+
'avoidFilter' => array('type' => 'radio', 'description' => sprintf(__('Avoid content filter (disable if \'%s\' is shown)', 'slideshow-plugin'), SlideshowPluginShortcode::$bookmark), 'options' => array('true' => $yes, 'false' => $no), 'group' => __('Miscellaneous', 'slideshow-plugin'))
|
354 |
+
),
|
355 |
+
$data
|
356 |
+
);
|
357 |
+
}
|
358 |
+
|
359 |
+
// Return
|
360 |
+
return $data;
|
361 |
+
}
|
362 |
+
|
363 |
+
/**
|
364 |
+
* Returns an array of style setting defaults.
|
365 |
+
*
|
366 |
+
* For a full description of the parameters, see getAllDefaults().
|
367 |
+
*
|
368 |
+
* @since 2.1.20
|
369 |
+
* @param boolean $fullDefinition (optional, defaults to false)
|
370 |
+
* @return mixed $data
|
371 |
+
*/
|
372 |
+
static function getDefaultStyleSettings($fullDefinition = false){
|
373 |
+
// Much used data for translation
|
374 |
+
$yes = __('Yes', 'slideshow-plugin');
|
375 |
+
$no = __('No', 'slideshow-plugin');
|
376 |
+
|
377 |
+
// Default style settings
|
378 |
+
$data = array(
|
379 |
+
'style' => 'light',
|
380 |
+
'custom' => ''
|
381 |
+
);
|
382 |
+
|
383 |
+
// Full definition
|
384 |
+
if($fullDefinition){
|
385 |
+
$data = array(
|
386 |
+
'style' => array('type' => 'select', 'default' => $data['style'], 'description' => __('The style used for this slideshow', 'slideshow-plugin'), 'options' => array('light' => __('Light', 'slideshow-plugin'), 'dark' => __('Dark', 'slideshow-plugin'), 'custom' => __('Custom', 'slideshow-plugin'))),
|
387 |
+
'custom' => array('type' => 'textarea', 'default' => $data['custom'], 'description' => __('Custom style editor', 'slideshow-plugin'), 'dependsOn' => array('styleSettings[style]', 'custom'))
|
388 |
+
);
|
389 |
+
}
|
390 |
+
|
391 |
+
// Return
|
392 |
+
return $data;
|
393 |
+
}
|
394 |
+
|
395 |
+
/**
|
396 |
+
* Returns an HTML inputField of the input setting.
|
397 |
+
*
|
398 |
+
* This function expects the setting to be in the 'fullDefinition'
|
399 |
+
* format that the getDefaults() and getSettings() methods both
|
400 |
+
* return.
|
401 |
+
*
|
402 |
+
* @since 2.1.20
|
403 |
+
* @param string $settingsKey
|
404 |
+
* @param string $settingsName
|
405 |
+
* @param mixed $settings
|
406 |
+
* @return mixed $inputField
|
407 |
+
*/
|
408 |
+
static function getInputField($settingsKey, $settingsName, $settings){
|
409 |
+
if(!is_array($settings) || empty($settings) || empty($settingsName))
|
410 |
+
return null;
|
411 |
+
|
412 |
+
$inputField = '';
|
413 |
+
$name = $settingsKey . '[' . $settingsName . ']';
|
414 |
+
$displayValue = (!isset($settings['value']) || (empty($settings['value']) && !is_numeric($settings['value'])) ? $settings['default'] : $settings['value']);
|
415 |
+
$class = ((isset($settings['dependsOn']))? 'depends-on-field-value ' . $settings['dependsOn'][0] . ' ' . $settings['dependsOn'][1] . ' ': '') . $settingsKey . '-' . $settingsName;
|
416 |
+
switch($settings['type']){
|
417 |
+
case 'text':
|
418 |
+
$inputField .= '<input
|
419 |
+
type="text"
|
420 |
+
name="' . $name . '"
|
421 |
+
class="' . $class . '"
|
422 |
+
value="' . $displayValue . '"
|
423 |
+
/>';
|
424 |
+
break;
|
425 |
+
case 'textarea':
|
426 |
+
$inputField .= '<textarea
|
427 |
+
name="' . $name . '"
|
428 |
+
class="' . $class . '"
|
429 |
+
rows="20"
|
430 |
+
cols="60"
|
431 |
+
>' . $displayValue . '</textarea>';
|
432 |
+
break;
|
433 |
+
case 'select':
|
434 |
+
$inputField .= '<select name="' . $name . '" class="' . $class . '">';
|
435 |
+
foreach($settings['options'] as $optionKey => $optionValue)
|
436 |
+
$inputField .= '<option value="' . $optionKey . '" ' . selected($displayValue, $optionKey, false) . '>
|
437 |
+
' . $optionValue . '
|
438 |
+
</option>';
|
439 |
+
$inputField .= '</select>';
|
440 |
+
break;
|
441 |
+
case 'radio':
|
442 |
+
foreach($settings['options'] as $radioKey => $radioValue)
|
443 |
+
$inputField .= '<label><input
|
444 |
+
type="radio"
|
445 |
+
name="' . $name . '"
|
446 |
+
class="' . $class . '"
|
447 |
+
value="' . $radioKey . '" ' .
|
448 |
+
checked($displayValue, $radioKey, false) .
|
449 |
+
' />' . $radioValue . '</label><br />';
|
450 |
+
break;
|
451 |
+
default:
|
452 |
+
$inputField = null;
|
453 |
+
break;
|
454 |
+
};
|
455 |
+
|
456 |
+
// Return
|
457 |
+
return $inputField;
|
458 |
+
}
|
459 |
+
}
|
classes/SlideshowPluginShortcode.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
*
|
8 |
* @since 1.2.0
|
9 |
* @author: Stefan Boonstra
|
10 |
-
* @version:
|
11 |
*/
|
12 |
class SlideshowPluginShortcode {
|
13 |
|
@@ -51,8 +51,8 @@ class SlideshowPluginShortcode {
|
|
51 |
$postId = $atts['id'];
|
52 |
|
53 |
$output = '';
|
54 |
-
$settings =
|
55 |
-
if($settings['
|
56 |
// Filter content after all Wordpress HTML parsers are done, then replace bookmarks with raw HTML
|
57 |
add_filter('the_content', array(__CLASS__, 'insertSlideshow'), 999);
|
58 |
add_filter('the_excerpt', array(__CLASS__, 'insertSlideshow'), 999);
|
7 |
*
|
8 |
* @since 1.2.0
|
9 |
* @author: Stefan Boonstra
|
10 |
+
* @version: 06-12-12
|
11 |
*/
|
12 |
class SlideshowPluginShortcode {
|
13 |
|
51 |
$postId = $atts['id'];
|
52 |
|
53 |
$output = '';
|
54 |
+
$settings = SlideshowPluginSettingsHandler::getSettings($postId);
|
55 |
+
if($settings['avoidFilter'] == 'true'){
|
56 |
// Filter content after all Wordpress HTML parsers are done, then replace bookmarks with raw HTML
|
57 |
add_filter('the_content', array(__CLASS__, 'insertSlideshow'), 999);
|
58 |
add_filter('the_excerpt', array(__CLASS__, 'insertSlideshow'), 999);
|
classes/SlideshowPluginSlideInserter.php
CHANGED
@@ -121,10 +121,18 @@ class SlideshowPluginSlideInserter {
|
|
121 |
if(count($attachments) > 0){
|
122 |
foreach($attachments as $attachment){
|
123 |
$image = wp_get_attachment_image_src($attachment->ID);
|
124 |
-
if(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
echo '<tr valign="top">
|
126 |
<td class="image">
|
127 |
-
<img width="60" height="60" src="' . $
|
128 |
</td>
|
129 |
<td class="column-title">
|
130 |
<strong class="title">
|
121 |
if(count($attachments) > 0){
|
122 |
foreach($attachments as $attachment){
|
123 |
$image = wp_get_attachment_image_src($attachment->ID);
|
124 |
+
if(!is_array($image) || !$image){
|
125 |
+
if(!empty($attachment->guid))
|
126 |
+
$imageSrc = $attachment->guid;
|
127 |
+
else
|
128 |
+
continue;
|
129 |
+
}else{
|
130 |
+
$imageSrc = $image[0];
|
131 |
+
}
|
132 |
+
if(!$imageSrc || empty($imageSrc)) $imageSrc = SlideshowPluginMain::getPluginUrl() . '/images/SlideshowPluginPostType/no-img.png';
|
133 |
echo '<tr valign="top">
|
134 |
<td class="image">
|
135 |
+
<img width="60" height="60" src="' . $imageSrc . '" class="attachment" alt="' . $attachment->post_title . '" title="' . $attachment->post_title . '">
|
136 |
</td>
|
137 |
<td class="column-title">
|
138 |
<strong class="title">
|
classes/SlideshowPluginUpdater.php
ADDED
@@ -0,0 +1,282 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* SlideshowPluginVersionConverter helps users transfer from version
|
4 |
+
* to version without losing any data.
|
5 |
+
*
|
6 |
+
* @author Stefan Boonstra
|
7 |
+
* @version 06-12-12
|
8 |
+
*/
|
9 |
+
class SlideshowPluginUpdater {
|
10 |
+
|
11 |
+
/** Version option key */
|
12 |
+
private static $versionKey = 'slideshow-jquery-image-gallery-plugin-version';
|
13 |
+
|
14 |
+
/**
|
15 |
+
* The init function checks
|
16 |
+
*/
|
17 |
+
static function init(){
|
18 |
+
if(!is_admin())
|
19 |
+
return;
|
20 |
+
|
21 |
+
// Transfer if no version number is set, or the current version number is greater than the on saved in the database
|
22 |
+
$oldVersion = get_option(self::$versionKey, null);
|
23 |
+
if($oldVersion == null || SlideshowPluginMain::$version > $oldVersion)
|
24 |
+
self::update($oldVersion);
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Updates user to correct version
|
29 |
+
*
|
30 |
+
* @since 2.1.20
|
31 |
+
* @param string $oldVersion
|
32 |
+
*/
|
33 |
+
private static function update($oldVersion){
|
34 |
+
// Version numbers are registered after version 2.1.20
|
35 |
+
if($oldVersion == null){
|
36 |
+
self::updateV1toV2();
|
37 |
+
self::updateV2toV2_1_20();
|
38 |
+
}
|
39 |
+
|
40 |
+
// This gives better performance to the update, since lower version updates can be skipped.
|
41 |
+
// if('1.33.7' > $oldVersion || $oldVersion == null)
|
42 |
+
// update();
|
43 |
+
|
44 |
+
// Set new version
|
45 |
+
update_option(self::$versionKey, SlideshowPluginMain::$version);
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Updates v2 to the 2.1.20 settings storage system,
|
50 |
+
* which uses three post-meta values instead of one.
|
51 |
+
*
|
52 |
+
* @since 2.1.20
|
53 |
+
*/
|
54 |
+
private static function updateV2toV2_1_20(){
|
55 |
+
// Check if this has already been done
|
56 |
+
if(get_option('slideshow-plugin-updated-from-v2-to-v2-1-20') !== false)
|
57 |
+
return;
|
58 |
+
|
59 |
+
// Get slideshows
|
60 |
+
$slideshows = get_posts(array(
|
61 |
+
'numberposts' => -1,
|
62 |
+
'offset' => 0,
|
63 |
+
'post_type' => 'slideshow'
|
64 |
+
));
|
65 |
+
|
66 |
+
// Loop through slideshow
|
67 |
+
foreach($slideshows as $slideshow){
|
68 |
+
// Get settings
|
69 |
+
$settings = get_post_meta(
|
70 |
+
$slideshow->ID,
|
71 |
+
'settings',
|
72 |
+
true
|
73 |
+
);
|
74 |
+
|
75 |
+
// Old prefixes
|
76 |
+
$settingsPrefix = 'setting_';
|
77 |
+
$stylePrefix = 'style_';
|
78 |
+
$slidePrefix = 'slide_';
|
79 |
+
|
80 |
+
// Meta keys
|
81 |
+
$settingsKey = 'settings';
|
82 |
+
$styleSettingsKey = 'styleSettings';
|
83 |
+
$slidesKey = 'slides';
|
84 |
+
|
85 |
+
// Extract key => value into new arrays
|
86 |
+
$newSettings = array();
|
87 |
+
$styleSettings = array();
|
88 |
+
$slides = array();
|
89 |
+
foreach($settings as $key => $value){
|
90 |
+
if($settingsPrefix == substr($key, 0, strlen($settingsPrefix)))
|
91 |
+
$newSettings[substr($key, strlen($settingsPrefix))] = $value;
|
92 |
+
elseif($stylePrefix == substr($key, 0, strlen($stylePrefix)))
|
93 |
+
$styleSettings[substr($key, strlen($stylePrefix))] = $value;
|
94 |
+
elseif($slidePrefix == substr($key, 0, strlen($slidePrefix)))
|
95 |
+
$slides[substr($key, strlen($slidePrefix))] = $value;
|
96 |
+
}
|
97 |
+
|
98 |
+
// Slides are prefixed with another prefix, their order ID. All settings of one slide should go into an
|
99 |
+
// array referenced by their order ID. Create order lookup array below, then order slides accordingly
|
100 |
+
$slidesOrderLookup = array();
|
101 |
+
foreach($slides as $key => $value){
|
102 |
+
$key = explode('_', $key);
|
103 |
+
|
104 |
+
if($key[1] == 'order')
|
105 |
+
$slidesOrderLookup[$value] = $key[0];
|
106 |
+
}
|
107 |
+
|
108 |
+
// Order slides with order lookup array
|
109 |
+
$orderedSlides = array();
|
110 |
+
foreach($slides as $key => $value){
|
111 |
+
$key = explode('_', $key);
|
112 |
+
|
113 |
+
foreach($slidesOrderLookup as $order => $id){
|
114 |
+
if($key[0] == $id){
|
115 |
+
|
116 |
+
// Create array if slot is empty
|
117 |
+
if(!isset($orderedSlides[$order]) || !is_array($orderedSlides[$order]))
|
118 |
+
$orderedSlides[$order] = array();
|
119 |
+
|
120 |
+
// Add slide value to array
|
121 |
+
$orderedSlides[$order][$key[1]] = $value;
|
122 |
+
|
123 |
+
// Slide ID found and value placed in correct order slot, break to next $value
|
124 |
+
break;
|
125 |
+
}
|
126 |
+
}
|
127 |
+
}
|
128 |
+
|
129 |
+
// Update post meta
|
130 |
+
update_post_meta($slideshow->ID, $settingsKey, $newSettings);
|
131 |
+
update_post_meta($slideshow->ID, $styleSettingsKey, $styleSettings);
|
132 |
+
update_post_meta($slideshow->ID, $slidesKey, $orderedSlides);
|
133 |
+
}
|
134 |
+
|
135 |
+
update_option('slideshow-plugin-updated-from-v2-to-v2-1-20', 'updated');
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Updates v1 slides to the V2 slide format
|
140 |
+
* Slides are no longer attachments, convert attachments to post-meta.
|
141 |
+
*
|
142 |
+
* @since 2.0.1
|
143 |
+
*/
|
144 |
+
private static function updateV1toV2(){
|
145 |
+
// Check if this has already been done
|
146 |
+
if(get_option('slideshow-plugin-updated-from-v1-x-x-to-v2-0-1') !== false)
|
147 |
+
return;
|
148 |
+
|
149 |
+
// Get posts
|
150 |
+
$posts = get_posts(array(
|
151 |
+
'numberposts' => -1,
|
152 |
+
'offset' => 0,
|
153 |
+
'post_type' => 'slideshow'
|
154 |
+
));
|
155 |
+
|
156 |
+
// Loop through posts
|
157 |
+
foreach($posts as $post){
|
158 |
+
|
159 |
+
// Stores highest slide id.
|
160 |
+
$highestSlideId = -1;
|
161 |
+
|
162 |
+
// Defaults
|
163 |
+
$defaultData = $data = array(
|
164 |
+
'style_style' => 'light',
|
165 |
+
'style_custom' => '',
|
166 |
+
'setting_animation' => 'slide',
|
167 |
+
'setting_slideSpeed' => '1',
|
168 |
+
'setting_descriptionSpeed' => '0.4',
|
169 |
+
'setting_intervalSpeed' => '5',
|
170 |
+
'setting_play' => 'true',
|
171 |
+
'setting_loop' => 'true',
|
172 |
+
'setting_slidesPerView' => '1',
|
173 |
+
'setting_width' => '0',
|
174 |
+
'setting_height' => '200',
|
175 |
+
'setting_descriptionHeight' => '50',
|
176 |
+
'setting_stretchImages' => 'true',
|
177 |
+
'setting_controllable' => 'true',
|
178 |
+
'setting_controlPanel' => 'false',
|
179 |
+
'setting_showDescription' => 'true',
|
180 |
+
'setting_hideDescription' => 'true'
|
181 |
+
);
|
182 |
+
|
183 |
+
$yes = __('Yes', 'slideshow-plugin');
|
184 |
+
$no = __('No', 'slideshow-plugin');
|
185 |
+
$data = array( // $data : array([prefix_settingName] => array([inputType], [value], [default], [description], array([options]), array([dependsOn], [onValue]), 'group' => [groupName]))
|
186 |
+
'style_style' => array('select', '', $defaultData['style_style'], __('The style used for this slideshow', 'slideshow-plugin'), array('light' => __('Light', 'slideshow-plugin'), 'dark' => __('Dark', 'slideshow-plugin'), 'custom' => __('Custom', 'slideshow-plugin'))),
|
187 |
+
'style_custom' => array('textarea', '', $defaultData['style_custom'], __('Custom style editor', 'slideshow-plugin'), null, array('style_style', 'custom')),
|
188 |
+
'setting_animation' => array('select', '', $defaultData['setting_animation'], __('Animation used for transition between slides', 'slideshow-plugin'), array('slide' => __('Slide', 'slideshow-plugin'), 'fade' => __('Fade', 'slideshow-plugin')), 'group' => __('Animation', 'slideshow-plugin')),
|
189 |
+
'setting_slideSpeed' => array('text', '', $defaultData['setting_slideSpeed'], __('Number of seconds the slide takes to slide in', 'slideshow-plugin'), 'group' => __('Animation', 'slideshow-plugin')),
|
190 |
+
'setting_descriptionSpeed' => array('text', '', $defaultData['setting_descriptionSpeed'], __('Number of seconds the description takes to slide in', 'slideshow-plugin'), 'group' => __('Animation', 'slideshow-plugin')),
|
191 |
+
'setting_intervalSpeed' => array('text', '', $defaultData['setting_intervalSpeed'], __('Seconds between changing slides', 'slideshow-plugin'), 'group' => __('Animation', 'slideshow-plugin')),
|
192 |
+
'setting_slidesPerView' => array('text', '', $defaultData['setting_slidesPerView'], __('Number of slides to fit into one slide', 'slideshow-plugin'), 'group' => __('Display', 'slideshow-plugin')),
|
193 |
+
'setting_width' => array('text', '', $defaultData['setting_width'], __('Width of the slideshow, set to parent's width on 0', 'slideshow-plugin'), 'group' => __('Display', 'slideshow-plugin')),
|
194 |
+
'setting_height' => array('text', '', $defaultData['setting_height'], __('Height of the slideshow', 'slideshow-plugin'), 'group' => __('Display', 'slideshow-plugin')),
|
195 |
+
'setting_descriptionHeight' => array('text', '', $defaultData['setting_descriptionHeight'], __('Height of the description boxes', 'slideshow-plugin'), 'group' => __('Display', 'slideshow-plugin')),
|
196 |
+
'setting_stretchImages' => array('radio', '', $defaultData['setting_stretchImages'], __('Fit image into slide (stretching it)', 'slideshow-plugin'), array('true' => $yes, 'false' => $no), 'group' => __('Display', 'slideshow-plugin')),
|
197 |
+
'setting_showDescription' => array('radio', '', $defaultData['setting_showDescription'], __('Show title and description', 'slideshow-plugin'), array('true' => $yes, 'false' => $no), 'group' => __('Display', 'slideshow-plugin')),
|
198 |
+
'setting_hideDescription' => array('radio', '', $defaultData['setting_hideDescription'], __('Hide description box, it will pop up when a mouse hovers over the slide', 'slideshow-plugin'), array('true' => $yes, 'false' => $no), array('setting_showDescription', 'true'), 'group' => __('Display', 'slideshow-plugin')),
|
199 |
+
'setting_play' => array('radio', '', $defaultData['setting_play'], __('Automatically slide to the next slide', 'slideshow-plugin'), array('true' => $yes, 'false' => $no), 'group' => __('Control', 'slideshow-plugin')),
|
200 |
+
'setting_loop' => array('radio', '', $defaultData['setting_loop'], __('Return to the beginning of the slideshow after last slide', 'slideshow-plugin'), array('true' => $yes, 'false' => $no), 'group' => __('Control', 'slideshow-plugin')),
|
201 |
+
'setting_controllable' => array('radio', '', $defaultData['setting_controllable'], __('Activate buttons (so the user can scroll through the slides)', 'slideshow-plugin'), array('true' => $yes, 'false' => $no), 'group' => __('Control', 'slideshow-plugin')),
|
202 |
+
'setting_controlPanel' => array('radio', '', $defaultData['setting_controlPanel'], __('Show control panel (play and pause button)', 'slideshow-plugin'), array('true' => $yes, 'false' => $no), 'group' => __('Control', 'slideshow-plugin')),
|
203 |
+
);
|
204 |
+
|
205 |
+
// Get settings
|
206 |
+
$currentSettings = get_post_meta(
|
207 |
+
$post->ID,
|
208 |
+
'settings',
|
209 |
+
true
|
210 |
+
);
|
211 |
+
|
212 |
+
// Fill data with settings
|
213 |
+
foreach($data as $key => $value)
|
214 |
+
if(isset($currentSettings[$key])){
|
215 |
+
$data[$key][1] = $currentSettings[$key];
|
216 |
+
unset($currentSettings[$key]);
|
217 |
+
}
|
218 |
+
|
219 |
+
// Load settings that are not there by default into data (slides in particular)
|
220 |
+
foreach($currentSettings as $key => $value)
|
221 |
+
if(!isset($data[$key]))
|
222 |
+
$data[$key] = $value;
|
223 |
+
|
224 |
+
// Settings
|
225 |
+
$settings = $data;
|
226 |
+
|
227 |
+
// Filter slides
|
228 |
+
$prefix = 'slide_';
|
229 |
+
foreach($settings as $key => $value)
|
230 |
+
if($prefix != substr($key, 0, strlen($prefix)))
|
231 |
+
unset($settings[$key]);
|
232 |
+
|
233 |
+
// Convert slide settings to array([slide-key] => array([setting-name] => [value]));
|
234 |
+
$slidesPreOrder = array();
|
235 |
+
foreach($settings as $key => $value){
|
236 |
+
$key = explode('_', $key);
|
237 |
+
if(is_numeric($key[1]))
|
238 |
+
$slidesPreOrder[$key[1]][$key[2]] = $value;
|
239 |
+
}
|
240 |
+
|
241 |
+
// Save slide keys from the $slidePreOrder array in the array itself for later use
|
242 |
+
foreach($slidesPreOrder as $key => $value){
|
243 |
+
// Save highest slide id
|
244 |
+
if($key > $highestSlideId)
|
245 |
+
$highestSlideId = $key;
|
246 |
+
}
|
247 |
+
|
248 |
+
// Get old data
|
249 |
+
$oldData = get_post_meta($post->ID, 'settings', true);
|
250 |
+
if(!is_array(($oldData)))
|
251 |
+
$oldData = array();
|
252 |
+
|
253 |
+
// Get attachments
|
254 |
+
$attachments = get_posts(array(
|
255 |
+
'numberposts' => -1,
|
256 |
+
'offset' => 0,
|
257 |
+
'post_type' => 'attachment',
|
258 |
+
'post_parent' => $post->ID
|
259 |
+
));
|
260 |
+
|
261 |
+
// Get data from attachments
|
262 |
+
$newData = array();
|
263 |
+
foreach($attachments as $attachment){
|
264 |
+
$highestSlideId++;
|
265 |
+
$newData['slide_' . $highestSlideId . '_postId'] = $attachment->ID;
|
266 |
+
$newData['slide_' . $highestSlideId . '_type'] = 'attachment';
|
267 |
+
}
|
268 |
+
|
269 |
+
// Save settings
|
270 |
+
update_post_meta(
|
271 |
+
$post->ID,
|
272 |
+
'settings',
|
273 |
+
array_merge(
|
274 |
+
$defaultData,
|
275 |
+
$oldData,
|
276 |
+
$newData
|
277 |
+
));
|
278 |
+
}
|
279 |
+
|
280 |
+
update_option('slideshow-plugin-updated-from-v1-x-x-to-v2-0-1', 'updated');
|
281 |
+
}
|
282 |
+
}
|
js/SlideshowPluginSlideInserter/slide-inserter.js
CHANGED
@@ -120,11 +120,28 @@ jQuery(document).ready(function(){
|
|
120 |
});
|
121 |
|
122 |
/**
|
123 |
-
* Loop through list items,
|
124 |
*/
|
125 |
function slideshowSlideInserterIndexSlidesOrder(){
|
|
|
126 |
jQuery.each(jQuery('.sortable-slides-list').find('li'), function(key, value){
|
127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
});
|
129 |
}
|
130 |
|
@@ -205,10 +222,11 @@ jQuery(document).ready(function(){
|
|
205 |
imageSlide.find('.postId').attr('value', id);
|
206 |
|
207 |
// Set names to be saved to the database
|
208 |
-
imageSlide.find('.url').attr('name', '
|
209 |
-
imageSlide.find('.
|
210 |
-
imageSlide.find('.
|
211 |
-
imageSlide.find('.
|
|
|
212 |
|
213 |
// Register delete link (only needs to delete from DOM)
|
214 |
imageSlide.find('.slideshow-delete-new-slide').click(function(){
|
@@ -237,12 +255,13 @@ jQuery(document).ready(function(){
|
|
237 |
var textSlide = jQuery('.text-slide-template').find('li').clone();
|
238 |
|
239 |
// Set names to be saved to the database
|
240 |
-
textSlide.find('.title').attr('name', '
|
241 |
-
textSlide.find('.description').attr('name', '
|
242 |
-
textSlide.find('.color').attr('name', '
|
243 |
-
textSlide.find('.url').attr('name', '
|
244 |
-
textSlide.find('.
|
245 |
-
textSlide.find('.
|
|
|
246 |
|
247 |
// Register delete link (only needs to delete from DOM)
|
248 |
textSlide.find('.slideshow-delete-new-slide').click(function(){
|
@@ -271,9 +290,9 @@ jQuery(document).ready(function(){
|
|
271 |
var videoSlide = jQuery('.video-slide-template').find('li').clone();
|
272 |
|
273 |
// Set names to be saved to the database
|
274 |
-
videoSlide.find('.videoId').attr('name', '
|
275 |
-
videoSlide.find('.type').attr('name', '
|
276 |
-
videoSlide.find('.slide_order').attr('name', '
|
277 |
|
278 |
// Register delete link (only needs to delete from DOM)
|
279 |
videoSlide.find('.slideshow-delete-new-slide').click(function(){
|
120 |
});
|
121 |
|
122 |
/**
|
123 |
+
* Loop through list items, setting slide orders
|
124 |
*/
|
125 |
function slideshowSlideInserterIndexSlidesOrder(){
|
126 |
+
// Loop through sortables
|
127 |
jQuery.each(jQuery('.sortable-slides-list').find('li'), function(key, value){
|
128 |
+
|
129 |
+
// Loop through all input, select and text area boxes
|
130 |
+
jQuery.each(jQuery(this).find('input, select, textarea'), function(key2, input){
|
131 |
+
|
132 |
+
// Remove brackets
|
133 |
+
var name = jQuery(input).attr('name');
|
134 |
+
|
135 |
+
// No name found, skip
|
136 |
+
if(name == undefined)
|
137 |
+
return;
|
138 |
+
|
139 |
+
// Divide name parts
|
140 |
+
name = name.replace(/[\[\]']+/g, ' ').split(' ');
|
141 |
+
|
142 |
+
// Put name with new order ID back on the page
|
143 |
+
jQuery(input).attr('name', name[0] + '[' + (key + 1) + '][' + name[2] + ']');
|
144 |
+
});
|
145 |
});
|
146 |
}
|
147 |
|
222 |
imageSlide.find('.postId').attr('value', id);
|
223 |
|
224 |
// Set names to be saved to the database
|
225 |
+
imageSlide.find('.url').attr('name', 'slides[0][url]');
|
226 |
+
imageSlide.find('.urlTarget').attr('name', 'slides[0][urlTarget]');
|
227 |
+
imageSlide.find('.type').attr('name', 'slides[0][type]');
|
228 |
+
imageSlide.find('.postId').attr('name', 'slides[0][postId]');
|
229 |
+
imageSlide.find('.slide_order').attr('name', 'slides[0][order]');
|
230 |
|
231 |
// Register delete link (only needs to delete from DOM)
|
232 |
imageSlide.find('.slideshow-delete-new-slide').click(function(){
|
255 |
var textSlide = jQuery('.text-slide-template').find('li').clone();
|
256 |
|
257 |
// Set names to be saved to the database
|
258 |
+
textSlide.find('.title').attr('name', 'slides[0][title]');
|
259 |
+
textSlide.find('.description').attr('name', 'slides[0][description]');
|
260 |
+
textSlide.find('.color').attr('name', 'slides[0][color]');
|
261 |
+
textSlide.find('.url').attr('name', 'slides[0][url]');
|
262 |
+
textSlide.find('.urlTarget').attr('name', 'slides[0][urlTarget]');
|
263 |
+
textSlide.find('.type').attr('name', 'slides[0][type]');
|
264 |
+
textSlide.find('.slide_order').attr('name', 'slides[0][order]');
|
265 |
|
266 |
// Register delete link (only needs to delete from DOM)
|
267 |
textSlide.find('.slideshow-delete-new-slide').click(function(){
|
290 |
var videoSlide = jQuery('.video-slide-template').find('li').clone();
|
291 |
|
292 |
// Set names to be saved to the database
|
293 |
+
videoSlide.find('.videoId').attr('name', 'slides[0][videoId]');
|
294 |
+
videoSlide.find('.type').attr('name', 'slides[0][type]');
|
295 |
+
videoSlide.find('.slide_order').attr('name', 'slides[0][order]');
|
296 |
|
297 |
// Register delete link (only needs to delete from DOM)
|
298 |
videoSlide.find('.slideshow-delete-new-slide').click(function(){
|
readme.txt
CHANGED
@@ -4,8 +4,8 @@ Contributors: stefanboonstra
|
|
4 |
Donate link: http://stefanboonstra.com/donate-to-slideshow/
|
5 |
Tags: slideshow, slider, slide, slides, show, images, image, photo, gallery, galleries, jquery, javascript, video, text
|
6 |
Requires at least: 3.3
|
7 |
-
Tested up to: 3.
|
8 |
-
Stable tag: 2.1.
|
9 |
License: GPLv2
|
10 |
|
11 |
Integrate a fancy slideshow in just five steps. - Rainbows. Rainbows everywhere.
|
@@ -92,13 +92,13 @@ slideshow may not be styled.
|
|
92 |
|
93 |
== Screenshots ==
|
94 |
|
95 |
-
1. Here's what
|
96 |
|
97 |
-
2. Create a new slideshow. A shortcode and a code snippet of how to call it
|
98 |
|
99 |
3. If you haven't uploaded any images yet, you can do so on the Wordpress media page. Don't forget to insert the images into the slideshow after uploading!
|
100 |
|
101 |
-
4. Click the 'Insert Image Slide' button in the Slides List to search and pick images from the
|
102 |
|
103 |
5. The images you selected are directly visible in your Slides List, don't forget to save!
|
104 |
|
@@ -107,6 +107,12 @@ slideshow may not be styled.
|
|
107 |
|
108 |
== Changelog ==
|
109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
= 2.1.19 =
|
111 |
* Fixed: Slides are now always floated, despite any parent CSS settings.
|
112 |
* Fixed: Slideshow settings will no longer cloud any other posts with their post-meta.
|
@@ -122,7 +128,7 @@ slideshow may not be styled.
|
|
122 |
* Widget title's HTML tags are now discarded when no widget title is set.
|
123 |
|
124 |
= 2.1.17 =
|
125 |
-
* Fixed: Invalid argument being supplied for the foreach loop in SlideshowPluginPostType on line 352
|
126 |
* Fixed: Undefined index being thrown by URL target setting on slideshow creation.
|
127 |
* Video slide now accepts YouTube URLs as well.
|
128 |
|
@@ -138,7 +144,7 @@ slideshow may not be styled.
|
|
138 |
* Added Chinese translation.
|
139 |
|
140 |
= 2.1.14 =
|
141 |
-
* Fixed: Text slide descriptions allow HTML again
|
142 |
|
143 |
= 2.1.13 =
|
144 |
* Fixed: PHP security issues.
|
@@ -211,7 +217,7 @@ slideshow may not be styled.
|
|
211 |
* Play and pause buttons are now available, as is the option not to auto-play and/or loop the slideshow.
|
212 |
* Stylesheets no longer partially depend on the website's stylesheet, except for the fonts.
|
213 |
* The script and its functional stylesheet are now compressed to save loading time.
|
214 |
-
* Added jQuery sortables script to sort slides
|
215 |
* Images you've already uploaded and attached to other posts can now be loaded into the slideshow, saving disk space (and time).
|
216 |
|
217 |
= 1.3.5 =
|
@@ -248,7 +254,7 @@ slideshow may not be styled.
|
|
248 |
= 1.2.0 =
|
249 |
* Slideshows can now be placed in posts as well, using shortcode [slideshow id=*SlideshowPostId*].
|
250 |
* Added a widget that can be loaded with an existing slideshow of choice.
|
251 |
-
* Tested up to version 3.4
|
252 |
|
253 |
= 1.1.0 =
|
254 |
* Added jQuery library as Wordpress websites don't seem to load them by default.
|
4 |
Donate link: http://stefanboonstra.com/donate-to-slideshow/
|
5 |
Tags: slideshow, slider, slide, slides, show, images, image, photo, gallery, galleries, jquery, javascript, video, text
|
6 |
Requires at least: 3.3
|
7 |
+
Tested up to: 3.5
|
8 |
+
Stable tag: 2.1.20
|
9 |
License: GPLv2
|
10 |
|
11 |
Integrate a fancy slideshow in just five steps. - Rainbows. Rainbows everywhere.
|
92 |
|
93 |
== Screenshots ==
|
94 |
|
95 |
+
1. Here's what a default slideshow can look like. Sit back, grab a beer, enjoy.
|
96 |
|
97 |
+
2. Create a new slideshow. A shortcode and a code snippet of how to call it are already visible.
|
98 |
|
99 |
3. If you haven't uploaded any images yet, you can do so on the Wordpress media page. Don't forget to insert the images into the slideshow after uploading!
|
100 |
|
101 |
+
4. Click the 'Insert Image Slide' button in the Slides List to search and pick images from the WordPress media page.
|
102 |
|
103 |
5. The images you selected are directly visible in your Slides List, don't forget to save!
|
104 |
|
107 |
|
108 |
== Changelog ==
|
109 |
|
110 |
+
= 2.1.20 =
|
111 |
+
* Fixed: Query filters will no longer alter the output of the slideshow.
|
112 |
+
* Fixed: Images not always showing in image inserter popup.
|
113 |
+
* Compatibility with WordPress 3.5 confirmed.
|
114 |
+
* First back-end increment towards version 2.2.0, introducing a more efficient way to store and retrieve the slideshow's settings and slides.
|
115 |
+
|
116 |
= 2.1.19 =
|
117 |
* Fixed: Slides are now always floated, despite any parent CSS settings.
|
118 |
* Fixed: Slideshow settings will no longer cloud any other posts with their post-meta.
|
128 |
* Widget title's HTML tags are now discarded when no widget title is set.
|
129 |
|
130 |
= 2.1.17 =
|
131 |
+
* Fixed: Invalid argument being supplied for the foreach loop in SlideshowPluginPostType on line 352.
|
132 |
* Fixed: Undefined index being thrown by URL target setting on slideshow creation.
|
133 |
* Video slide now accepts YouTube URLs as well.
|
134 |
|
144 |
* Added Chinese translation.
|
145 |
|
146 |
= 2.1.14 =
|
147 |
+
* Fixed: Text slide descriptions allow HTML again.
|
148 |
|
149 |
= 2.1.13 =
|
150 |
* Fixed: PHP security issues.
|
217 |
* Play and pause buttons are now available, as is the option not to auto-play and/or loop the slideshow.
|
218 |
* Stylesheets no longer partially depend on the website's stylesheet, except for the fonts.
|
219 |
* The script and its functional stylesheet are now compressed to save loading time.
|
220 |
+
* Added jQuery sortables script to sort slides.
|
221 |
* Images you've already uploaded and attached to other posts can now be loaded into the slideshow, saving disk space (and time).
|
222 |
|
223 |
= 1.3.5 =
|
254 |
= 1.2.0 =
|
255 |
* Slideshows can now be placed in posts as well, using shortcode [slideshow id=*SlideshowPostId*].
|
256 |
* Added a widget that can be loaded with an existing slideshow of choice.
|
257 |
+
* Tested up to version 3.4.
|
258 |
|
259 |
= 1.1.0 =
|
260 |
* Added jQuery library as Wordpress websites don't seem to load them by default.
|
slideshow.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
/*
|
3 |
Plugin Name: Slideshow
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/slideshow-jquery-image-gallery/
|
5 |
-
Description:
|
6 |
-
Version: 2.1.
|
7 |
Requires at least: 3.3
|
8 |
Author: StefanBoonstra
|
9 |
Author URI: http://stefanboonstra.com
|
@@ -16,12 +16,12 @@
|
|
16 |
* base path/url returning method.
|
17 |
*
|
18 |
* @author Stefan Boonstra
|
19 |
-
* @version
|
20 |
*/
|
21 |
class SlideshowPluginMain {
|
22 |
|
23 |
/** Variables */
|
24 |
-
static $version = '2.1.
|
25 |
|
26 |
/**
|
27 |
* Bootstraps the application by assigning the right functions to
|
@@ -48,88 +48,8 @@ class SlideshowPluginMain {
|
|
48 |
// Register slideshow post type
|
49 |
SlideshowPluginPostType::initialize();
|
50 |
|
51 |
-
//
|
52 |
-
|
53 |
-
}
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Transfers v1.x.x slides to the new slide format
|
57 |
-
*/
|
58 |
-
static function transferV1toV2(){
|
59 |
-
// Check if this has already been done
|
60 |
-
if(get_option('slideshow-plugin-updated-from-v1-x-x-to-v2-0-1') !== false)
|
61 |
-
return;
|
62 |
-
|
63 |
-
// Get posts
|
64 |
-
$posts = get_posts(array(
|
65 |
-
'numberposts' => -1,
|
66 |
-
'offset' => 0,
|
67 |
-
'post_type' => SlideshowPluginPostType::$postType
|
68 |
-
));
|
69 |
-
|
70 |
-
// Loop through posts
|
71 |
-
if(is_array($posts) && count($posts) > 0){
|
72 |
-
foreach($posts as $post){
|
73 |
-
|
74 |
-
// Stores highest slide id.
|
75 |
-
$highestSlideId = -1;
|
76 |
-
|
77 |
-
// Get stored slide settings and convert them to array([slide-key] => array([setting-name] => [value]));
|
78 |
-
$slidesPreOrder = array();
|
79 |
-
$settings = SlideshowPluginPostType::getSettings($post->ID, SlideshowPluginPostType::$prefixes['slide-list'], true);
|
80 |
-
if(is_array($settings) && count($settings) > 0)
|
81 |
-
foreach($settings as $key => $value){
|
82 |
-
$key = explode('_', $key);
|
83 |
-
if(is_numeric($key[1]))
|
84 |
-
$slidesPreOrder[$key[1]][$key[2]] = $value;
|
85 |
-
}
|
86 |
-
|
87 |
-
// Save slide keys from the $slidePreOrder array in the array itself for later use
|
88 |
-
if(count($slidesPreOrder) > 0)
|
89 |
-
foreach($slidesPreOrder as $key => $value){
|
90 |
-
// Save highest slide id
|
91 |
-
if($key > $highestSlideId)
|
92 |
-
$highestSlideId = $key;
|
93 |
-
}
|
94 |
-
|
95 |
-
// Get defaults
|
96 |
-
$defaultData = SlideshowPluginPostType::getDefaultData(false);
|
97 |
-
|
98 |
-
// Get old data
|
99 |
-
$oldData = get_post_meta($post->ID, SlideshowPluginPostType::$settingsMetaKey, true);
|
100 |
-
if(!is_array(($oldData)))
|
101 |
-
$oldData = array();
|
102 |
-
|
103 |
-
// Get attachments
|
104 |
-
$attachments = get_posts(array(
|
105 |
-
'numberposts' => -1,
|
106 |
-
'offset' => 0,
|
107 |
-
'post_type' => 'attachment',
|
108 |
-
'post_parent' => $post->ID
|
109 |
-
));
|
110 |
-
|
111 |
-
// Get data from attachments
|
112 |
-
$newData = array();
|
113 |
-
if(is_array($attachments) && count($attachments) > 0)
|
114 |
-
foreach($attachments as $attachment){
|
115 |
-
$highestSlideId++;
|
116 |
-
$newData['slide_' . $highestSlideId . '_postId'] = $attachment->ID;
|
117 |
-
$newData['slide_' . $highestSlideId . '_type'] = 'attachment';
|
118 |
-
}
|
119 |
-
|
120 |
-
// Save settings
|
121 |
-
update_post_meta(
|
122 |
-
$post->ID,
|
123 |
-
SlideshowPluginPostType::$settingsMetaKey,
|
124 |
-
array_merge(
|
125 |
-
$defaultData,
|
126 |
-
$oldData,
|
127 |
-
$newData
|
128 |
-
));
|
129 |
-
}
|
130 |
-
}
|
131 |
-
|
132 |
-
update_option('slideshow-plugin-updated-from-v1-x-x-to-v2-0-1', 'updated');
|
133 |
}
|
134 |
|
135 |
/**
|
@@ -168,15 +88,15 @@ class SlideshowPluginMain {
|
|
168 |
if(!function_exists('spl_autoload_register'))
|
169 |
return;
|
170 |
|
171 |
-
function
|
172 |
$name = str_replace('\\', DIRECTORY_SEPARATOR, $name);
|
173 |
$file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . $name . '.php';
|
174 |
|
175 |
if(is_file($file))
|
176 |
-
require_once
|
177 |
}
|
178 |
|
179 |
-
spl_autoload_register('
|
180 |
}
|
181 |
}
|
182 |
|
2 |
/*
|
3 |
Plugin Name: Slideshow
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/slideshow-jquery-image-gallery/
|
5 |
+
Description: The slideshow plugin is easily deployable on your website. Add any image that has already been uploaded to add to your slideshow, add text slides, or even add a video. Options and styles are customizable for every single slideshow on your website.
|
6 |
+
Version: 2.1.20
|
7 |
Requires at least: 3.3
|
8 |
Author: StefanBoonstra
|
9 |
Author URI: http://stefanboonstra.com
|
16 |
* base path/url returning method.
|
17 |
*
|
18 |
* @author Stefan Boonstra
|
19 |
+
* @version 06-12-12
|
20 |
*/
|
21 |
class SlideshowPluginMain {
|
22 |
|
23 |
/** Variables */
|
24 |
+
static $version = '2.1.20';
|
25 |
|
26 |
/**
|
27 |
* Bootstraps the application by assigning the right functions to
|
48 |
// Register slideshow post type
|
49 |
SlideshowPluginPostType::initialize();
|
50 |
|
51 |
+
// Initialize plugin updater
|
52 |
+
SlideshowPluginUpdater::init();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
}
|
54 |
|
55 |
/**
|
88 |
if(!function_exists('spl_autoload_register'))
|
89 |
return;
|
90 |
|
91 |
+
function slideshowPluginAutoLoader($name) {
|
92 |
$name = str_replace('\\', DIRECTORY_SEPARATOR, $name);
|
93 |
$file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . $name . '.php';
|
94 |
|
95 |
if(is_file($file))
|
96 |
+
require_once($file);
|
97 |
}
|
98 |
|
99 |
+
spl_autoload_register('slideshowPluginAutoLoader');
|
100 |
}
|
101 |
}
|
102 |
|
views/SlideshowPluginPostType/settings.php
CHANGED
@@ -19,11 +19,11 @@
|
|
19 |
<?php endif; ?>
|
20 |
<tr
|
21 |
<?php echo !empty($value['group'])? 'class="group-' . strtolower(str_replace(' ', '-', $value['group'])) . '"': ''; ?>
|
22 |
-
<?php echo !empty($value[
|
23 |
>
|
24 |
-
<td><?php echo $value[
|
25 |
-
<td><?php echo $
|
26 |
-
<td><?php _e('Default', 'slideshow-plugin'); ?>: '<?php echo (isset($value[
|
27 |
</tr>
|
28 |
|
29 |
<?php endforeach; ?>
|
19 |
<?php endif; ?>
|
20 |
<tr
|
21 |
<?php echo !empty($value['group'])? 'class="group-' . strtolower(str_replace(' ', '-', $value['group'])) . '"': ''; ?>
|
22 |
+
<?php echo !empty($value['dependsOn'])? 'style="display:none;"': ''; ?>
|
23 |
>
|
24 |
+
<td><?php echo $value['description']; ?></td>
|
25 |
+
<td><?php echo SlideshowPluginSettingsHandler::getInputField(SlideshowPluginSettingsHandler::$settingsKey, htmlspecialchars($key), $value); ?></td>
|
26 |
+
<td><?php _e('Default', 'slideshow-plugin'); ?>: '<?php echo (isset($value['options']))? $value['options'][$value['default']]: $value['default']; ?>'</td>
|
27 |
</tr>
|
28 |
|
29 |
<?php endforeach; ?>
|
views/SlideshowPluginPostType/slides.php
CHANGED
@@ -22,16 +22,17 @@
|
|
22 |
<?php if(count($slides) > 0): ?>
|
23 |
<?php foreach($slides as $key => $slide):
|
24 |
// General values
|
25 |
-
$
|
26 |
-
if(isset($slide['id']))
|
27 |
-
$id = $slide['id'];
|
28 |
if(isset($slide['url']))
|
29 |
$url = $slide['url'];
|
30 |
if(isset($slide['urlTarget']))
|
31 |
$target = $slide['urlTarget'];
|
32 |
if(isset($slide['order']))
|
33 |
$order = $slide['order'];
|
34 |
-
|
|
|
|
|
|
|
35 |
|
36 |
<li class="widefat sortable-slides-list-item">
|
37 |
<?php if($slide['type'] == 'text'):
|
@@ -47,14 +48,14 @@
|
|
47 |
?>
|
48 |
|
49 |
<p style="padding: 0 15px 0 5px;">
|
50 |
-
<input type="text" name="
|
51 |
-
<i><?php _e('Description', 'slideshow-plugin'); ?></i><textarea name="
|
52 |
-
<input type="text" name="
|
53 |
</p>
|
54 |
|
55 |
<p style="float: left; padding: 0 5px;">
|
56 |
-
<input type="text" name="
|
57 |
-
<select name="
|
58 |
<option value="_self" <?php selected('_self', $target); ?>><?php _e('Same window', 'slideshow-plugin'); ?></option>
|
59 |
<option value="_blank" <?php selected('_blank', $target); ?>><?php _e('New window', 'slideshow-plugin'); ?></option>
|
60 |
</select>
|
@@ -64,8 +65,8 @@
|
|
64 |
</p>
|
65 |
<p style="clear: both;"></p>
|
66 |
|
67 |
-
<input type="hidden" name="
|
68 |
-
<input type="hidden" name="
|
69 |
|
70 |
<?php elseif($slide['type'] == 'video'):
|
71 |
|
@@ -76,11 +77,11 @@
|
|
76 |
?>
|
77 |
|
78 |
<p style="padding: 0 5px;">
|
79 |
-
<input type="text" name="
|
80 |
</p>
|
81 |
|
82 |
-
<input type="hidden" name="
|
83 |
-
<input type="hidden" name="
|
84 |
|
85 |
<?php elseif($slide['type'] == 'attachment'):
|
86 |
|
@@ -89,13 +90,23 @@
|
|
89 |
if(!isset($attachment))
|
90 |
continue;
|
91 |
|
92 |
-
$editUrl = admin_url() . '/media.php?attachment_id=' . $attachment->ID . '&action=edit';
|
93 |
$image = wp_get_attachment_image_src($attachment->ID);
|
94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
|
96 |
<p style="float: left; padding: 0 5px;">
|
97 |
<a href="<?php echo $editUrl; ?>" title="<?php _e('Edit', 'slideshow-plugin'); ?> "<?php echo $attachment->post_title; ?>"">
|
98 |
-
<img width="80" height="60" src="<?php echo $
|
99 |
</a>
|
100 |
</p>
|
101 |
|
@@ -108,8 +119,8 @@
|
|
108 |
<p style="clear: both"></p>
|
109 |
|
110 |
<p style="float: left; padding: 0 5px;">
|
111 |
-
<input type="text" name="
|
112 |
-
<select name="
|
113 |
<option value="_self" <?php selected('_self', $target); ?>><?php _e('Same window', 'slideshow-plugin'); ?></option>
|
114 |
<option value="_blank" <?php selected('_blank', $target); ?>><?php _e('New window', 'slideshow-plugin'); ?></option>
|
115 |
</select>
|
@@ -119,9 +130,9 @@
|
|
119 |
</p>
|
120 |
<p style="clear: both;"></p>
|
121 |
|
122 |
-
<input type="hidden" name="
|
123 |
-
<input type="hidden" name="
|
124 |
-
<input type="hidden" name="
|
125 |
|
126 |
<?php else: ?>
|
127 |
|
22 |
<?php if(count($slides) > 0): ?>
|
23 |
<?php foreach($slides as $key => $slide):
|
24 |
// General values
|
25 |
+
$url = $target = $order = '';
|
|
|
|
|
26 |
if(isset($slide['url']))
|
27 |
$url = $slide['url'];
|
28 |
if(isset($slide['urlTarget']))
|
29 |
$target = $slide['urlTarget'];
|
30 |
if(isset($slide['order']))
|
31 |
$order = $slide['order'];
|
32 |
+
|
33 |
+
// The name is used to prefix a setting name with
|
34 |
+
$name = SlideshowPluginSettingsHandler::$slidesKey . '[' . $key . ']';
|
35 |
+
?>
|
36 |
|
37 |
<li class="widefat sortable-slides-list-item">
|
38 |
<?php if($slide['type'] == 'text'):
|
48 |
?>
|
49 |
|
50 |
<p style="padding: 0 15px 0 5px;">
|
51 |
+
<input type="text" name="<?php echo $name; ?>[title]" value="<?php echo $title; ?>" /><i><?php _e('Title', 'slideshow-plugin'); ?></i><br />
|
52 |
+
<i><?php _e('Description', 'slideshow-plugin'); ?></i><textarea name="<?php echo $name; ?>[description]" rows="7" cols="" style="width: 100%;"><?php echo $description; ?></textarea><br />
|
53 |
+
<input type="text" name="<?php echo $name; ?>[color]" value="<?php echo $color; ?>" class="color {required:false}" /><i><?php _e('Background color', 'slideshow-plugin'); ?></i><br />
|
54 |
</p>
|
55 |
|
56 |
<p style="float: left; padding: 0 5px;">
|
57 |
+
<input type="text" name="<?php echo $name; ?>[url]" value="<?php echo $url; ?>" /><br />
|
58 |
+
<select name="<?php echo $name; ?>[urlTarget]">
|
59 |
<option value="_self" <?php selected('_self', $target); ?>><?php _e('Same window', 'slideshow-plugin'); ?></option>
|
60 |
<option value="_blank" <?php selected('_blank', $target); ?>><?php _e('New window', 'slideshow-plugin'); ?></option>
|
61 |
</select>
|
65 |
</p>
|
66 |
<p style="clear: both;"></p>
|
67 |
|
68 |
+
<input type="hidden" name="<?php echo $name; ?>[type]" value="text" />
|
69 |
+
<input type="hidden" name="<?php echo $name; ?>[order]" value="<?php echo $order; ?>" class="slide_order" />
|
70 |
|
71 |
<?php elseif($slide['type'] == 'video'):
|
72 |
|
77 |
?>
|
78 |
|
79 |
<p style="padding: 0 5px;">
|
80 |
+
<input type="text" name="<?php echo $name; ?>[videoId]" value="<?php echo $videoId; ?>" /><i><?php _e('Youtube Video ID', 'slideshow-plugin'); ?></i>
|
81 |
</p>
|
82 |
|
83 |
+
<input type="hidden" name="<?php echo $name; ?>[type]" value="video" />
|
84 |
+
<input type="hidden" name="<?php echo $name; ?>[order]" value="<?php echo $order; ?>" class="slide_order" />
|
85 |
|
86 |
<?php elseif($slide['type'] == 'attachment'):
|
87 |
|
90 |
if(!isset($attachment))
|
91 |
continue;
|
92 |
|
|
|
93 |
$image = wp_get_attachment_image_src($attachment->ID);
|
94 |
+
$imageSrc = '';
|
95 |
+
if(!is_array($image) || !$image){
|
96 |
+
if(!empty($attachment->guid))
|
97 |
+
$imageSrc = $attachment->guid;
|
98 |
+
else
|
99 |
+
continue;
|
100 |
+
}else{
|
101 |
+
$imageSrc = $image[0];
|
102 |
+
}
|
103 |
+
if(!$imageSrc || empty($imageSrc)) $imageSrc = $noPreviewIcon;
|
104 |
+
|
105 |
+
$editUrl = admin_url() . '/media.php?attachment_id=' . $attachment->ID . '&action=edit'; ?>
|
106 |
|
107 |
<p style="float: left; padding: 0 5px;">
|
108 |
<a href="<?php echo $editUrl; ?>" title="<?php _e('Edit', 'slideshow-plugin'); ?> "<?php echo $attachment->post_title; ?>"">
|
109 |
+
<img width="80" height="60" src="<?php echo $imageSrc; ?>" class="attachment-80x60" alt="<?php echo $attachment->post_title; ?>" title="<?php echo $attachment->post_title; ?>" />
|
110 |
</a>
|
111 |
</p>
|
112 |
|
119 |
<p style="clear: both"></p>
|
120 |
|
121 |
<p style="float: left; padding: 0 5px;">
|
122 |
+
<input type="text" name="<?php echo $name; ?>[url]" value="<?php echo $url; ?>" /><br />
|
123 |
+
<select name="<?php echo $name; ?>[urlTarget]">
|
124 |
<option value="_self" <?php selected('_self', $target); ?>><?php _e('Same window', 'slideshow-plugin'); ?></option>
|
125 |
<option value="_blank" <?php selected('_blank', $target); ?>><?php _e('New window', 'slideshow-plugin'); ?></option>
|
126 |
</select>
|
130 |
</p>
|
131 |
<p style="clear: both;"></p>
|
132 |
|
133 |
+
<input type="hidden" name="<?php echo $name; ?>[type]" value="attachment" />
|
134 |
+
<input type="hidden" name="<?php echo $name; ?>[postId]" value="<?php echo $attachment->ID; ?>" />
|
135 |
+
<input type="hidden" name="<?php echo $name; ?>[order]" value="<?php echo $order; ?>" class="slide_order" />
|
136 |
|
137 |
<?php else: ?>
|
138 |
|
views/SlideshowPluginPostType/style-settings.php
CHANGED
@@ -2,10 +2,10 @@
|
|
2 |
<?php if(count($settings) > 0): ?>
|
3 |
<?php foreach($settings as $key => $value): ?>
|
4 |
|
5 |
-
<tr <?php if(
|
6 |
-
<td><?php echo $value[
|
7 |
-
<td><?php echo $
|
8 |
-
<td><?php _e('Default', 'slideshow-plugin'); ?>: '<?php echo $value[
|
9 |
</tr>
|
10 |
|
11 |
<?php endforeach; ?>
|
2 |
<?php if(count($settings) > 0): ?>
|
3 |
<?php foreach($settings as $key => $value): ?>
|
4 |
|
5 |
+
<tr <?php if(isset($value['dependsOn'])) echo 'style="display:none;"'; ?>>
|
6 |
+
<td><?php echo $value['description']; ?></td>
|
7 |
+
<td><?php echo SlideshowPluginSettingsHandler::getInputField(htmlspecialchars(SlideshowPluginSettingsHandler::$styleSettingsKey), $key, $value); ?></td>
|
8 |
+
<td><?php _e('Default', 'slideshow-plugin'); ?>: '<?php echo $value['default']; ?>'</td>
|
9 |
</tr>
|
10 |
|
11 |
<?php endforeach; ?>
|