Slideshow - Version 2.1.22

Version Description

  • Added French translation.
  • Added a "General Settings" page, containing user capability settings.
  • Cleaned up unnecessary settings that were showing on page.
  • Replaced the, in WordPress 3.5, deprecated function 'wp_get_single_post' with the 'get_post' function.
  • Added an on-page error logger to be able to solve back-end issues faster. Nothing is shown when no errors exist, doesn't affect SEO.
Download this release

Release Info

Developer stefanboonstra
Plugin Icon 128x128 Slideshow
Version 2.1.22
Comparing to
See all releases

Code changes from version 2.1.21 to 2.1.22

classes/SlideshowPlugin.php CHANGED
@@ -3,6 +3,7 @@
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
  */
@@ -14,6 +15,7 @@ class SlideshowPlugin {
14
  /**
15
  * Function deploy prints out the prepared html
16
  *
 
17
  * @param int $postId
18
  */
19
  static function deploy($postId = null){
@@ -27,13 +29,14 @@ class SlideshowPlugin {
27
  * Passing this function no parameter or passing it a negative one will
28
  * result in a random pick of slideshow
29
  *
 
30
  * @param int $postId
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)){
@@ -66,12 +69,17 @@ class SlideshowPlugin {
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')
@@ -80,7 +88,9 @@ class SlideshowPlugin {
80
  // Enqueue functional sheet
81
  wp_enqueue_style(
82
  'slideshow_functional_style',
83
- SlideshowPluginMain::getPluginUrl() . '/style/' . __CLASS__ . '/functional.css'
 
 
84
  );
85
 
86
  // The slideshow's session ID, allows JavaScript and CSS to distinguish between multiple slideshows
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
+ * @since 1.0.0
7
  * @author: Stefan Boonstra
8
  * @version: 06-12-12
9
  */
15
  /**
16
  * Function deploy prints out the prepared html
17
  *
18
+ * @since 1.2.0
19
  * @param int $postId
20
  */
21
  static function deploy($postId = null){
29
  * Passing this function no parameter or passing it a negative one will
30
  * result in a random pick of slideshow
31
  *
32
+ * @since 2.1.0
33
  * @param int $postId
34
  * @return String $output
35
  */
36
  static function prepare($postId = null){
37
  // Get post by its ID, if the ID is not a negative value
38
  if(is_numeric($postId) && $postId >= 0)
39
+ $post = get_post($postId);
40
 
41
  // Get slideshow by slug when it's a non-empty string
42
  if(is_string($postId) && !is_numeric($postId) && !empty($postId)){
69
  if(empty($post))
70
  return '<!-- Wordpress Slideshow - No slideshows available -->';
71
 
72
+ // Log slideshow's issues to be able to track them on the page.
73
+ $log = array();
74
+
75
  // Get slides
76
+ $slides = SlideshowPluginSlideshowSettingsHandler::getSlides($post->ID);
77
+ if(!is_array($slides) || count($slides) <= 0)
78
+ $log[] = 'No slides were found';
79
 
80
  // Get settings
81
+ $settings = SlideshowPluginSlideshowSettingsHandler::getSettings($post->ID);
82
+ $styleSettings = SlideshowPluginSlideshowSettingsHandler::getStyleSettings($post->ID);
83
 
84
  // Randomize if setting is true.
85
  if(isset($settings['random']) && $settings['random'] == 'true')
88
  // Enqueue functional sheet
89
  wp_enqueue_style(
90
  'slideshow_functional_style',
91
+ SlideshowPluginMain::getPluginUrl() . '/style/' . __CLASS__ . '/functional.css',
92
+ array(),
93
+ SlideshowPluginMain::$version
94
  );
95
 
96
  // The slideshow's session ID, allows JavaScript and CSS to distinguish between multiple slideshows
classes/SlideshowPluginAjax.php CHANGED
@@ -4,11 +4,18 @@
4
  * before as soon as possible, so ajax functions don't get
5
  * exceedingly large.
6
  *
 
7
  * @author: Stefan Boonstra
8
  * @version: 19-05-12
9
  */
10
  class SlideshowPluginAjax {
11
 
 
 
 
 
 
 
12
  static function init() {
13
  add_action('wp_ajax_slideshow_slide_inserter_search_query', array('SlideshowPluginSlideInserter', 'printSearchResults'));
14
  add_action('wp_ajax_slideshow_delete_slide', array('SlideshowPluginSlideInserter', 'deleteSlide'));
4
  * before as soon as possible, so ajax functions don't get
5
  * exceedingly large.
6
  *
7
+ * @since 2.0.0
8
  * @author: Stefan Boonstra
9
  * @version: 19-05-12
10
  */
11
  class SlideshowPluginAjax {
12
 
13
+ /**
14
+ * Called as early as possible to be able to have as light as possible AJAX requests. Hooks can be added here as to
15
+ * have early execution.
16
+ *
17
+ * @since 2.0.0
18
+ */
19
  static function init() {
20
  add_action('wp_ajax_slideshow_slide_inserter_search_query', array('SlideshowPluginSlideInserter', 'printSearchResults'));
21
  add_action('wp_ajax_slideshow_delete_slide', array('SlideshowPluginSlideInserter', 'deleteSlide'));
classes/SlideshowPluginGeneralSettings.php ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SlideshowPluginGeneralSettings provides a sub menu page for the slideshow post type. The general settings page is
4
+ * the page that holds most of the slideshow's overall settings, such as user capabilities and slideshow defaults.
5
+ *
6
+ * @since 2.1.22
7
+ * @author Stefan Boonstra
8
+ * @version 18-12-12
9
+ */
10
+ class SlideshowPluginGeneralSettings {
11
+
12
+ /** settingsGroup */
13
+ static $settingsGroup = 'slideshow-jquery-image-gallery-general-settings';
14
+
15
+ /** User capability settings */
16
+ static $capabilities = array(
17
+ 'addSlideshows' => 'slideshow-jquery-image-gallery-add-slideshows',
18
+ 'editSlideshows' => 'slideshow-jquery-image-gallery-edit-slideshows',
19
+ 'deleteSlideshows' => 'slideshow-jquery-image-gallery-delete-slideshows'
20
+ );
21
+
22
+ /**
23
+ * Initializes the slideshow post type's general settings.
24
+ *
25
+ * @since 2.1.22
26
+ */
27
+ static function init(){
28
+
29
+ // Only initialize in admin
30
+ if(!is_admin())
31
+ return;
32
+
33
+ // Register settings
34
+ add_action('admin_init', array(__CLASS__, 'registerSettings'));
35
+
36
+ // Add sub menu
37
+ add_action('admin_menu', array(__CLASS__, 'addSubMenuPage'));
38
+
39
+ // Enqueue stylesheet and scripts
40
+ add_action('admin_enqueue_scripts', array(__CLASS__, 'enqueue'));
41
+ }
42
+
43
+ /**
44
+ * Adds a sub menu page to the slideshow post type menu.
45
+ *
46
+ * @since 2.1.22
47
+ */
48
+ static function addSubMenuPage(){
49
+
50
+ // Return if the slideshow post type does not exist
51
+ if(!post_type_exists(SlideshowPluginPostType::$postType))
52
+ return;
53
+
54
+ // Add sub menu
55
+ add_submenu_page(
56
+ 'edit.php?post_type=' . SlideshowPluginPostType::$postType,
57
+ __('General Settings', 'slideshow-plugin'),
58
+ __('General Settings', 'slideshow-plugin'),
59
+ 'manage_options',
60
+ 'general_settings',
61
+ array(__CLASS__, 'generalSettings')
62
+ );
63
+ }
64
+
65
+ /**
66
+ * Registers required settings into the WordPress settings API.
67
+ * Only performed when actually on the general settings page.
68
+ *
69
+ * @since 2.1.22
70
+ */
71
+ static function registerSettings(){
72
+
73
+ // Register settings only when the user is going through the options.php page
74
+ if(array_pop(explode('/', $_SERVER['PHP_SELF'])) != 'options.php')
75
+ return;
76
+
77
+ // Register settings, saving capabilities only has to be called once.
78
+ register_setting(self::$settingsGroup, self::$capabilities['addSlideshows']);
79
+ register_setting(self::$settingsGroup, self::$capabilities['editSlideshows']);
80
+ register_setting(self::$settingsGroup, self::$capabilities['deleteSlideshows'], array(__CLASS__, 'saveCapabilities'));
81
+ }
82
+
83
+ /**
84
+ * Enqueue scripts and stylesheets. Needs to be called on the 'admin_enqueue_scripts' hook.
85
+ *
86
+ * @since 2.1.22
87
+ */
88
+ static function enqueue(){
89
+
90
+ // Enqueue general settings script
91
+ wp_enqueue_script(
92
+ 'slideshow-jquery-image-gallery-general-settings',
93
+ SlideshowPluginMain::getPluginUrl() . '/js/' . __CLASS__ . '/general-settings.js',
94
+ array('jquery'),
95
+ SlideshowPluginMain::$version
96
+ );
97
+ }
98
+
99
+ /**
100
+ * Shows the general settings page.
101
+ *
102
+ * @since 2.1.22
103
+ */
104
+ static function generalSettings(){
105
+
106
+ // Include general settings page
107
+ include SlideshowPluginMain::getPluginPath() . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . __CLASS__ . DIRECTORY_SEPARATOR . 'general-settings.php';
108
+ }
109
+
110
+ /**
111
+ * Saves capabilities, called by a callback from a registered capability setting
112
+ *
113
+ * @param String $capability
114
+ * @return String $capability
115
+ */
116
+ static function saveCapabilities($capability){
117
+
118
+ // Verify nonce
119
+ $nonce = isset($_POST['_wpnonce']) ? $_POST['_wpnonce'] : '';
120
+ if(!wp_verify_nonce($nonce, self::$settingsGroup . '-options'))
121
+ return $capability;
122
+
123
+ // Roles
124
+ global $wp_roles;var_dump($wp_roles);
125
+
126
+ // Loop through available user roles
127
+ foreach($wp_roles->roles as $roleSlug => $roleValues){
128
+
129
+ // Continue when the capabilities are either not set or are no array
130
+ if(!is_array($roleValues) || !isset($roleValues['capabilities']) || !is_array($roleValues['capabilities']))
131
+ continue;
132
+
133
+ // Get role
134
+ $role = get_role($roleSlug);
135
+
136
+ // Continue when role is not set
137
+ if($role == null)
138
+ continue;
139
+
140
+ // Loop through available capabilities
141
+ foreach(self::$capabilities as $capabilitySlug){
142
+
143
+ // If $roleSlug is present in $_POST's capability, add the capability to the role, otherwise remove the capability from the role.
144
+ if( (isset($_POST[$capabilitySlug]) && is_array($_POST[$capabilitySlug]) && array_key_exists($roleSlug, $_POST[$capabilitySlug])) ||
145
+ $roleSlug == 'administrator')
146
+ $role->add_cap($capabilitySlug);
147
+ else
148
+ $role->remove_cap($capabilitySlug);
149
+ }
150
+ }
151
+
152
+ return $capability;
153
+ }
154
+ }
classes/SlideshowPluginInstaller.php ADDED
@@ -0,0 +1,378 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SlideshowPluginInstaller takes care of setting up slideshow setting values and transferring to newer version without
4
+ * losing any settings.
5
+ *
6
+ * @since 2.1.20
7
+ * @author Stefan Boonstra
8
+ * @version 18-12-12
9
+ */
10
+ class SlideshowPluginInstaller {
11
+
12
+ /** Version option key */
13
+ private static $versionKey = 'slideshow-jquery-image-gallery-plugin-version';
14
+
15
+ /**
16
+ * Determines whether or not to perform an update to the plugin.
17
+ * Checks are only performed when on admin pages as not to slow down the website.
18
+ *
19
+ * @since 2.1.20
20
+ */
21
+ static function init(){
22
+
23
+ // Only check versions in admin
24
+ if(!is_admin())
25
+ return;
26
+
27
+ // Transfer if no version number is set, or the new version number is greater than the current one saved in the database
28
+ $currentVersion = get_option(self::$versionKey, null);
29
+ if($currentVersion == null || self::firstVersionGreaterThanSecond(SlideshowPluginMain::$version, $currentVersion))
30
+ self::update($currentVersion);
31
+
32
+ // New installation
33
+ if($currentVersion == null){
34
+
35
+ // Set up capabilities
36
+ self::setCapabilities();
37
+ }
38
+ }
39
+
40
+ /**
41
+ * Updates user to correct version
42
+ *
43
+ * @since 2.1.20
44
+ * @param string $currentVersion
45
+ */
46
+ private static function update($currentVersion){
47
+
48
+ // Version numbers are registered after version 2.1.20
49
+ if($currentVersion == null){
50
+ self::updateV1toV2();
51
+ self::updateV2toV2_1_20();
52
+ }
53
+
54
+ // Update to version 2.1.22
55
+ if(self::firstVersionGreaterThanSecond('2.1.22', $currentVersion) || $currentVersion == null)
56
+ self::setCapabilities();
57
+
58
+ // Set new version
59
+ update_option(self::$versionKey, SlideshowPluginMain::$version);
60
+ }
61
+
62
+ /**
63
+ * Sets capabilities for the default users that have access to creating, updating and deleting slideshows.
64
+ *
65
+ * @since 2.1.22
66
+ */
67
+ private static function setCapabilities(){
68
+
69
+ // Check if update has already been done
70
+ if(get_option('slideshow-jquery-image-gallery-updated-from-v2-1-20-to-v2-1-22') !== false)
71
+ return;
72
+
73
+ // Capabilities
74
+ $addSlideshows = 'slideshow-jquery-image-gallery-add-slideshows';
75
+ $editSlideshows = 'slideshow-jquery-image-gallery-edit-slideshows';
76
+ $deleteSlideshow = 'slideshow-jquery-image-gallery-delete-slideshows';
77
+
78
+ // Add capabilities to roles
79
+ $roles = array('administrator', 'editor', 'author');
80
+ foreach($roles as $roleName){
81
+
82
+ // Get role
83
+ $role = get_role($roleName);
84
+
85
+ // Continue on non-existent role
86
+ if($role == null)
87
+ continue;
88
+
89
+ // Add capability to role
90
+ $role->add_cap($addSlideshows);
91
+ $role->add_cap($editSlideshows);
92
+ $role->add_cap($deleteSlideshow);
93
+ }
94
+
95
+ // Register as updated
96
+ update_option('slideshow-jquery-image-gallery-updated-from-v2-1-20-to-v2-1-22', 'updated');
97
+ }
98
+
99
+ /**
100
+ * Updates v2 to the 2.1.20 settings storage system,
101
+ * which uses three post-meta values instead of one.
102
+ *
103
+ * @since 2.1.20
104
+ */
105
+ private static function updateV2toV2_1_20(){
106
+
107
+ // Check if this has already been done
108
+ if(get_option('slideshow-plugin-updated-from-v2-to-v2-1-20') !== false)
109
+ return;
110
+
111
+ // Get slideshows
112
+ $slideshows = get_posts(array(
113
+ 'numberposts' => -1,
114
+ 'offset' => 0,
115
+ 'post_type' => 'slideshow'
116
+ ));
117
+
118
+ // Loop through slideshows
119
+ if(is_array($slideshows) && count($slideshows > 0)){
120
+ foreach($slideshows as $slideshow){
121
+ // Get settings
122
+ $settings = maybe_unserialize(get_post_meta(
123
+ $slideshow->ID,
124
+ 'settings',
125
+ true
126
+ ));
127
+ if(!is_array($settings) || count($settings) <= 0)
128
+ continue;
129
+
130
+ // Old prefixes
131
+ $settingsPrefix = 'setting_';
132
+ $stylePrefix = 'style_';
133
+ $slidePrefix = 'slide_';
134
+
135
+ // Meta keys
136
+ $settingsKey = 'settings';
137
+ $styleSettingsKey = 'styleSettings';
138
+ $slidesKey = 'slides';
139
+
140
+ // Extract key => value into new arrays
141
+ $newSettings = array();
142
+ $styleSettings = array();
143
+ $slides = array();
144
+ foreach($settings as $key => $value){
145
+ if($settingsPrefix == substr($key, 0, strlen($settingsPrefix)))
146
+ $newSettings[substr($key, strlen($settingsPrefix))] = $value;
147
+ elseif($stylePrefix == substr($key, 0, strlen($stylePrefix)))
148
+ $styleSettings[substr($key, strlen($stylePrefix))] = $value;
149
+ elseif($slidePrefix == substr($key, 0, strlen($slidePrefix)))
150
+ $slides[substr($key, strlen($slidePrefix))] = $value;
151
+ }
152
+
153
+ // Slides are prefixed with another prefix, their order ID. All settings of one slide should go into an
154
+ // array referenced by their order ID. Create order lookup array below, then order slides accordingly
155
+ $slidesOrderLookup = array();
156
+ foreach($slides as $key => $value){
157
+ $key = explode('_', $key);
158
+
159
+ if($key[1] == 'order')
160
+ $slidesOrderLookup[$value] = $key[0];
161
+ }
162
+
163
+ // Order slides with order lookup array
164
+ $orderedSlides = array();
165
+ foreach($slides as $key => $value){
166
+ $key = explode('_', $key);
167
+
168
+ foreach($slidesOrderLookup as $order => $id){
169
+ if($key[0] == $id){
170
+
171
+ // Create array if slot is empty
172
+ if(!isset($orderedSlides[$order]) || !is_array($orderedSlides[$order]))
173
+ $orderedSlides[$order] = array();
174
+
175
+ // Add slide value to array
176
+ $orderedSlides[$order][$key[1]] = $value;
177
+
178
+ // Slide ID found and value placed in correct order slot, break to next $value
179
+ break;
180
+ }
181
+ }
182
+ }
183
+
184
+ // Update post meta
185
+ update_post_meta($slideshow->ID, $settingsKey, $newSettings);
186
+ update_post_meta($slideshow->ID, $styleSettingsKey, $styleSettings);
187
+ update_post_meta($slideshow->ID, $slidesKey, $orderedSlides);
188
+ }
189
+ }
190
+
191
+ update_option('slideshow-plugin-updated-from-v2-to-v2-1-20', 'updated');
192
+ }
193
+
194
+ /**
195
+ * Updates v1 slides to the V2 slide format
196
+ * Slides are no longer attachments, convert attachments to post-meta.
197
+ *
198
+ * @since 2.0.1
199
+ */
200
+ private static function updateV1toV2(){
201
+
202
+ // Check if this has already been done
203
+ if(get_option('slideshow-plugin-updated-from-v1-x-x-to-v2-0-1') !== false)
204
+ return;
205
+
206
+ // Get posts
207
+ $posts = get_posts(array(
208
+ 'numberposts' => -1,
209
+ 'offset' => 0,
210
+ 'post_type' => 'slideshow'
211
+ ));
212
+
213
+ // Loop through posts
214
+ foreach($posts as $post){
215
+
216
+ // Stores highest slide id.
217
+ $highestSlideId = -1;
218
+
219
+ // Defaults
220
+ $defaultData = $data = array(
221
+ 'style_style' => 'light',
222
+ 'style_custom' => '',
223
+ 'setting_animation' => 'slide',
224
+ 'setting_slideSpeed' => '1',
225
+ 'setting_descriptionSpeed' => '0.4',
226
+ 'setting_intervalSpeed' => '5',
227
+ 'setting_play' => 'true',
228
+ 'setting_loop' => 'true',
229
+ 'setting_slidesPerView' => '1',
230
+ 'setting_width' => '0',
231
+ 'setting_height' => '200',
232
+ 'setting_descriptionHeight' => '50',
233
+ 'setting_stretchImages' => 'true',
234
+ 'setting_controllable' => 'true',
235
+ 'setting_controlPanel' => 'false',
236
+ 'setting_showDescription' => 'true',
237
+ 'setting_hideDescription' => 'true'
238
+ );
239
+
240
+ $yes = __('Yes', 'slideshow-plugin');
241
+ $no = __('No', 'slideshow-plugin');
242
+ $data = array( // $data : array([prefix_settingName] => array([inputType], [value], [default], [description], array([options]), array([dependsOn], [onValue]), 'group' => [groupName]))
243
+ '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'))),
244
+ 'style_custom' => array('textarea', '', $defaultData['style_custom'], __('Custom style editor', 'slideshow-plugin'), null, array('style_style', 'custom')),
245
+ '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')),
246
+ 'setting_slideSpeed' => array('text', '', $defaultData['setting_slideSpeed'], __('Number of seconds the slide takes to slide in', 'slideshow-plugin'), 'group' => __('Animation', 'slideshow-plugin')),
247
+ 'setting_descriptionSpeed' => array('text', '', $defaultData['setting_descriptionSpeed'], __('Number of seconds the description takes to slide in', 'slideshow-plugin'), 'group' => __('Animation', 'slideshow-plugin')),
248
+ 'setting_intervalSpeed' => array('text', '', $defaultData['setting_intervalSpeed'], __('Seconds between changing slides', 'slideshow-plugin'), 'group' => __('Animation', 'slideshow-plugin')),
249
+ 'setting_slidesPerView' => array('text', '', $defaultData['setting_slidesPerView'], __('Number of slides to fit into one slide', 'slideshow-plugin'), 'group' => __('Display', 'slideshow-plugin')),
250
+ 'setting_width' => array('text', '', $defaultData['setting_width'], __('Width of the slideshow, set to parent&#39;s width on 0', 'slideshow-plugin'), 'group' => __('Display', 'slideshow-plugin')),
251
+ 'setting_height' => array('text', '', $defaultData['setting_height'], __('Height of the slideshow', 'slideshow-plugin'), 'group' => __('Display', 'slideshow-plugin')),
252
+ 'setting_descriptionHeight' => array('text', '', $defaultData['setting_descriptionHeight'], __('Height of the description boxes', 'slideshow-plugin'), 'group' => __('Display', 'slideshow-plugin')),
253
+ 'setting_stretchImages' => array('radio', '', $defaultData['setting_stretchImages'], __('Fit image into slide (stretching it)', 'slideshow-plugin'), array('true' => $yes, 'false' => $no), 'group' => __('Display', 'slideshow-plugin')),
254
+ 'setting_showDescription' => array('radio', '', $defaultData['setting_showDescription'], __('Show title and description', 'slideshow-plugin'), array('true' => $yes, 'false' => $no), 'group' => __('Display', 'slideshow-plugin')),
255
+ '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')),
256
+ 'setting_play' => array('radio', '', $defaultData['setting_play'], __('Automatically slide to the next slide', 'slideshow-plugin'), array('true' => $yes, 'false' => $no), 'group' => __('Control', 'slideshow-plugin')),
257
+ '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')),
258
+ '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')),
259
+ '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')),
260
+ );
261
+
262
+ // Get settings
263
+ $currentSettings = get_post_meta(
264
+ $post->ID,
265
+ 'settings',
266
+ true
267
+ );
268
+
269
+ // Fill data with settings
270
+ foreach($data as $key => $value)
271
+ if(isset($currentSettings[$key])){
272
+ $data[$key][1] = $currentSettings[$key];
273
+ unset($currentSettings[$key]);
274
+ }
275
+
276
+ // Load settings that are not there by default into data (slides in particular)
277
+ foreach($currentSettings as $key => $value)
278
+ if(!isset($data[$key]))
279
+ $data[$key] = $value;
280
+
281
+ // Settings
282
+ $settings = $data;
283
+
284
+ // Filter slides
285
+ $prefix = 'slide_';
286
+ foreach($settings as $key => $value)
287
+ if($prefix != substr($key, 0, strlen($prefix)))
288
+ unset($settings[$key]);
289
+
290
+ // Convert slide settings to array([slide-key] => array([setting-name] => [value]));
291
+ $slidesPreOrder = array();
292
+ foreach($settings as $key => $value){
293
+ $key = explode('_', $key);
294
+ if(is_numeric($key[1]))
295
+ $slidesPreOrder[$key[1]][$key[2]] = $value;
296
+ }
297
+
298
+ // Save slide keys from the $slidePreOrder array in the array itself for later use
299
+ foreach($slidesPreOrder as $key => $value){
300
+ // Save highest slide id
301
+ if($key > $highestSlideId)
302
+ $highestSlideId = $key;
303
+ }
304
+
305
+ // Get old data
306
+ $oldData = get_post_meta($post->ID, 'settings', true);
307
+ if(!is_array(($oldData)))
308
+ $oldData = array();
309
+
310
+ // Get attachments
311
+ $attachments = get_posts(array(
312
+ 'numberposts' => -1,
313
+ 'offset' => 0,
314
+ 'post_type' => 'attachment',
315
+ 'post_parent' => $post->ID
316
+ ));
317
+
318
+ // Get data from attachments
319
+ $newData = array();
320
+ foreach($attachments as $attachment){
321
+ $highestSlideId++;
322
+ $newData['slide_' . $highestSlideId . '_postId'] = $attachment->ID;
323
+ $newData['slide_' . $highestSlideId . '_type'] = 'attachment';
324
+ }
325
+
326
+ // Save settings
327
+ update_post_meta(
328
+ $post->ID,
329
+ 'settings',
330
+ array_merge(
331
+ $defaultData,
332
+ $oldData,
333
+ $newData
334
+ ));
335
+ }
336
+
337
+ update_option('slideshow-plugin-updated-from-v1-x-x-to-v2-0-1', 'updated');
338
+ }
339
+
340
+ /**
341
+ * Checks if the version input first is greater than the version input second.
342
+ *
343
+ * Version numbers are noted as such: x.x.x
344
+ *
345
+ * @since 2.1.22
346
+ * @param String $firstVersion
347
+ * @param String $secondVersion
348
+ * @return boolean $firstGreaterThanSecond
349
+ */
350
+ private static function firstVersionGreaterThanSecond($firstVersion, $secondVersion){
351
+
352
+ // Return false if $firstVersion is not set
353
+ if(empty($firstVersion) || !is_string($firstVersion))
354
+ return false;
355
+
356
+ // Return true if $secondVersion is not set
357
+ if(empty($secondVersion) || !is_string($secondVersion))
358
+ return true;
359
+
360
+ // Separate main, sub and bug-fix version number from one another.
361
+ $firstVersion = explode('.', $firstVersion);
362
+ $secondVersion = explode('.', $secondVersion);
363
+
364
+ // Compare version numbers per piece
365
+ for($i = 0; $i < count($firstVersion); $i++){
366
+ if(isset($firstVersion[$i], $secondVersion[$i])){
367
+ if($firstVersion[$i] > $secondVersion[$i])
368
+ return true;
369
+ elseif($firstVersion[$i] < $secondVersion[$i])
370
+ return false;
371
+ }
372
+ else return false;
373
+ }
374
+
375
+ // Return false by default
376
+ return false;
377
+ }
378
+ }
classes/SlideshowPluginPostType.php CHANGED
@@ -3,8 +3,9 @@
3
  * SlideshowPluginPostType creates a post type specifically designed for
4
  * slideshows and their individual settings
5
  *
 
6
  * @author: Stefan Boonstra
7
- * @version: 06-12-12
8
  */
9
  class SlideshowPluginPostType {
10
 
@@ -14,15 +15,19 @@ class SlideshowPluginPostType {
14
  /**
15
  * Initialize Slideshow post type.
16
  * Called on load of plugin
 
 
17
  */
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
  /**
25
  * Registers new posttype slideshow
 
 
26
  */
27
  static function registerSlideshowPostType(){
28
  register_post_type(
@@ -30,7 +35,7 @@ class SlideshowPluginPostType {
30
  array(
31
  'labels' => array(
32
  'name' => __('Slideshows', 'slideshow-plugin'),
33
- 'singlular_name' => __('Slideshow', 'slideshow-plugin'),
34
  'add_new_item' => __('Add New Slideshow', 'slideshow-plugin'),
35
  'edit_item' => __('Edit slideshow', 'slideshow-plugin'),
36
  'new_item' => __('New slideshow', 'slideshow-plugin'),
@@ -46,6 +51,23 @@ class SlideshowPluginPostType {
46
  'query_var' => true,
47
  'rewrite' => true,
48
  'capability_type' => 'post',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  'has_archive' => true,
50
  'hierarchical' => false,
51
  'menu_position' => null,
@@ -59,6 +81,8 @@ class SlideshowPluginPostType {
59
  /**
60
  * Enqueues scripts and stylesheets for when the admin page
61
  * is a slideshow edit page.
 
 
62
  */
63
  static function enqueue(){
64
  // Return when not on a slideshow edit page.
@@ -88,6 +112,8 @@ class SlideshowPluginPostType {
88
 
89
  /**
90
  * Adds custom meta boxes to slideshow post type.
 
 
91
  */
92
  static function registerMetaBoxes(){
93
  add_meta_box(
@@ -133,6 +159,8 @@ class SlideshowPluginPostType {
133
 
134
  /**
135
  * Shows the support plugin message
 
 
136
  */
137
  static function supportPluginMessage(){
138
  include(SlideshowPluginMain::getPluginPath() . '/views/' . __CLASS__ . '/support-plugin.php');
@@ -140,6 +168,8 @@ class SlideshowPluginPostType {
140
 
141
  /**
142
  * Shows some information about this slideshow
 
 
143
  */
144
  static function informationMetaBox(){
145
  global $post;
@@ -152,12 +182,14 @@ class SlideshowPluginPostType {
152
 
153
  /**
154
  * Shows slides currently in slideshow
 
 
155
  */
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;
@@ -171,12 +203,14 @@ class SlideshowPluginPostType {
171
 
172
  /**
173
  * Shows style used for slideshow
 
 
174
  */
175
  static function styleMetaBox(){
176
  global $post;
177
 
178
  // Get settings
179
- $settings = SlideshowPluginSettingsHandler::getStyleSettings($post->ID, true);
180
 
181
  // Fill custom style with default css if empty
182
  if(isset($settings['custom']) && isset($settings['custom']['value']) && empty($settings['custom']['value'])){
@@ -191,12 +225,14 @@ class SlideshowPluginPostType {
191
 
192
  /**
193
  * Shows settings for particular slideshow
 
 
194
  */
195
  static function settingsMetaBox(){
196
  global $post;
197
 
198
  // Get settings
199
- $settings = SlideshowPluginSettingsHandler::getSettings($post->ID, true);
200
 
201
  // Include
202
  include(SlideshowPluginMain::getPluginPath() . '/views/' . __CLASS__ . '/settings.php');
3
  * SlideshowPluginPostType creates a post type specifically designed for
4
  * slideshows and their individual settings
5
  *
6
+ * @since 1.0.0
7
  * @author: Stefan Boonstra
8
+ * @version: 18-12-12
9
  */
10
  class SlideshowPluginPostType {
11
 
15
  /**
16
  * Initialize Slideshow post type.
17
  * Called on load of plugin
18
+ *
19
+ * @since 1.3.0
20
  */
21
+ static function init(){
22
  add_action('init', array(__CLASS__, 'registerSlideshowPostType'));
23
  add_action('admin_enqueue_scripts', array(__CLASS__, 'enqueue'));
24
+ add_action('save_post', array('SlideshowPluginSlideshowSettingsHandler', 'save'));
25
  }
26
 
27
  /**
28
  * Registers new posttype slideshow
29
+ *
30
+ * @since 1.0.0
31
  */
32
  static function registerSlideshowPostType(){
33
  register_post_type(
35
  array(
36
  'labels' => array(
37
  'name' => __('Slideshows', 'slideshow-plugin'),
38
+ 'singular_name' => __('Slideshow', 'slideshow-plugin'),
39
  'add_new_item' => __('Add New Slideshow', 'slideshow-plugin'),
40
  'edit_item' => __('Edit slideshow', 'slideshow-plugin'),
41
  'new_item' => __('New slideshow', 'slideshow-plugin'),
51
  'query_var' => true,
52
  'rewrite' => true,
53
  'capability_type' => 'post',
54
+ 'capabilities' => array(
55
+ 'edit_post' => SlideshowPluginGeneralSettings::$capabilities['editSlideshows'],
56
+ 'read_post' => SlideshowPluginGeneralSettings::$capabilities['addSlideshows'],
57
+ 'delete_post' => SlideshowPluginGeneralSettings::$capabilities['deleteSlideshows'],
58
+ 'edit_posts' => SlideshowPluginGeneralSettings::$capabilities['editSlideshows'],
59
+ 'edit_others_posts' => SlideshowPluginGeneralSettings::$capabilities['editSlideshows'],
60
+ 'publish_posts' => SlideshowPluginGeneralSettings::$capabilities['addSlideshows'],
61
+ 'read_private_posts' => SlideshowPluginGeneralSettings::$capabilities['editSlideshows'],
62
+
63
+ 'read' => SlideshowPluginGeneralSettings::$capabilities['addSlideshows'],
64
+ 'delete_posts' => SlideshowPluginGeneralSettings::$capabilities['deleteSlideshows'],
65
+ 'delete_private_posts' => SlideshowPluginGeneralSettings::$capabilities['deleteSlideshows'],
66
+ 'delete_published_posts' => SlideshowPluginGeneralSettings::$capabilities['deleteSlideshows'],
67
+ 'delete_others_posts' => SlideshowPluginGeneralSettings::$capabilities['deleteSlideshows'],
68
+ 'edit_private_posts' => SlideshowPluginGeneralSettings::$capabilities['editSlideshows'],
69
+ 'edit_published_posts' => SlideshowPluginGeneralSettings::$capabilities['editSlideshows'],
70
+ ),
71
  'has_archive' => true,
72
  'hierarchical' => false,
73
  'menu_position' => null,
81
  /**
82
  * Enqueues scripts and stylesheets for when the admin page
83
  * is a slideshow edit page.
84
+ *
85
+ * @since 2.1.11
86
  */
87
  static function enqueue(){
88
  // Return when not on a slideshow edit page.
112
 
113
  /**
114
  * Adds custom meta boxes to slideshow post type.
115
+ *
116
+ * @since 1.0.0
117
  */
118
  static function registerMetaBoxes(){
119
  add_meta_box(
159
 
160
  /**
161
  * Shows the support plugin message
162
+ *
163
+ * @since 2.0.0
164
  */
165
  static function supportPluginMessage(){
166
  include(SlideshowPluginMain::getPluginPath() . '/views/' . __CLASS__ . '/support-plugin.php');
168
 
169
  /**
170
  * Shows some information about this slideshow
171
+ *
172
+ * @since 1.0.0
173
  */
174
  static function informationMetaBox(){
175
  global $post;
182
 
183
  /**
184
  * Shows slides currently in slideshow
185
+ *
186
+ * @since 1.0.0
187
  */
188
  static function slidesMetaBox(){
189
  global $post;
190
 
191
  // Get slides
192
+ $slides = SlideshowPluginSlideshowSettingsHandler::getSlides($post->ID);
193
 
194
  // Stores highest slide id.
195
  $highestSlideId = count($slides) - 1;
203
 
204
  /**
205
  * Shows style used for slideshow
206
+ *
207
+ * @since 1.3.0
208
  */
209
  static function styleMetaBox(){
210
  global $post;
211
 
212
  // Get settings
213
+ $settings = SlideshowPluginSlideshowSettingsHandler::getStyleSettings($post->ID, true);
214
 
215
  // Fill custom style with default css if empty
216
  if(isset($settings['custom']) && isset($settings['custom']['value']) && empty($settings['custom']['value'])){
225
 
226
  /**
227
  * Shows settings for particular slideshow
228
+ *
229
+ * @since 1.0.0
230
  */
231
  static function settingsMetaBox(){
232
  global $post;
233
 
234
  // Get settings
235
+ $settings = SlideshowPluginSlideshowSettingsHandler::getSettings($post->ID, true);
236
 
237
  // Include
238
  include(SlideshowPluginMain::getPluginPath() . '/views/' . __CLASS__ . '/settings.php');
classes/SlideshowPluginSecurity.php CHANGED
@@ -2,9 +2,9 @@
2
  /**
3
  * The SlideshowPluginSecurity class contains functions for sanitizing in- and output.
4
  *
5
- * @author Stefan Boonstra
6
  * @since 2.1.16
7
- * @updated 2.1.16
 
8
  */
9
  class SlideshowPluginSecurity {
10
 
@@ -55,7 +55,6 @@ class SlideshowPluginSecurity {
55
  * allows the exceptions defined in this class.
56
  *
57
  * @since 2.1.16
58
- * @updated 2.1.16
59
  */
60
  static function htmlspecialchars_allow_exceptions($text){
61
  $text = htmlspecialchars(htmlspecialchars_decode($text));
2
  /**
3
  * The SlideshowPluginSecurity class contains functions for sanitizing in- and output.
4
  *
 
5
  * @since 2.1.16
6
+ * @author Stefan Boonstra
7
+ * @version 17-12-12
8
  */
9
  class SlideshowPluginSecurity {
10
 
55
  * allows the exceptions defined in this class.
56
  *
57
  * @since 2.1.16
 
58
  */
59
  static function htmlspecialchars_allow_exceptions($text){
60
  $text = htmlspecialchars(htmlspecialchars_decode($text));
classes/SlideshowPluginShortcode.php CHANGED
@@ -51,7 +51,7 @@ class SlideshowPluginShortcode {
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);
51
  $postId = $atts['id'];
52
 
53
  $output = '';
54
+ $settings = SlideshowPluginSlideshowSettingsHandler::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);
classes/SlideshowPluginSlideInserter.php CHANGED
@@ -4,6 +4,7 @@
4
  *
5
  * TODO This class will probably need to be renamed to SlideshowPluginSlideHandler to explain more functionality
6
  * TODO than just inserting slides. (Show and delete functionality should be applied here as well)
 
7
  * @author Stefan Boonstra
8
  * @version 03-10-2012
9
  */
@@ -16,6 +17,7 @@ class SlideshowPluginSlideInserter {
16
  * Returns the html for showing the image insert button.
17
  * Enqueues scripts unless $enqueueFiles is set to false.
18
  *
 
19
  * @param boolean $enqueueFiles
20
  * @return String $button
21
  */
@@ -36,6 +38,7 @@ class SlideshowPluginSlideInserter {
36
  * Returns the html for showing the text insert button.
37
  * Enqueues scripts unless $enqueueFiles is set to false.
38
  *
 
39
  * @param boolean $enqueueFiles
40
  * @return String $button
41
  */
@@ -53,6 +56,7 @@ class SlideshowPluginSlideInserter {
53
  * Returns the html for showing the video insert button.
54
  * Enqueues scripts unless $enqueueFiles is set to false.
55
  *
 
56
  * @param boolean $enqueueFiles
57
  * @return String $button
58
  */
@@ -68,7 +72,9 @@ class SlideshowPluginSlideInserter {
68
 
69
  /**
70
  * This function is registered in the SlideshowPluginAjax class
71
- * and deletes slides with a particular $_POST['slideId']
 
 
72
  */
73
  static function deleteSlide(){
74
  if((!isset($_POST['slideId']) || !is_numeric($_POST['slideId'])) ||
@@ -89,7 +95,9 @@ class SlideshowPluginSlideInserter {
89
 
90
  /**
91
  * This function is registered in the SlideshowPluginAjax class
92
- * and prints the results from the search query
 
 
93
  */
94
  static function printSearchResults(){
95
  // Numberposts and offset
@@ -175,6 +183,7 @@ class SlideshowPluginSlideInserter {
175
  /**
176
  * Applies a where clause on the get_posts call from self::printSearchResults()
177
  *
 
178
  * @param string $where
179
  * @return string $where
180
  */
@@ -193,6 +202,8 @@ class SlideshowPluginSlideInserter {
193
 
194
  /**
195
  * Include popup, needs to be called in the footer
 
 
196
  */
197
  static function includePopup(){
198
  include(SlideshowPluginMain::getPluginPath() . '/views/' . __CLASS__ . '/search-popup.php');
@@ -200,6 +211,8 @@ class SlideshowPluginSlideInserter {
200
 
201
  /**
202
  * Enqueues styles and scripts necessary for the media upload button.
 
 
203
  */
204
  static function enqueueFiles(){
205
  // Return when not on a slideshow edit page, or files have already been included.
4
  *
5
  * TODO This class will probably need to be renamed to SlideshowPluginSlideHandler to explain more functionality
6
  * TODO than just inserting slides. (Show and delete functionality should be applied here as well)
7
+ * @since 2.0.0
8
  * @author Stefan Boonstra
9
  * @version 03-10-2012
10
  */
17
  * Returns the html for showing the image insert button.
18
  * Enqueues scripts unless $enqueueFiles is set to false.
19
  *
20
+ * @since 2.0.0
21
  * @param boolean $enqueueFiles
22
  * @return String $button
23
  */
38
  * Returns the html for showing the text insert button.
39
  * Enqueues scripts unless $enqueueFiles is set to false.
40
  *
41
+ * @since 2.0.0
42
  * @param boolean $enqueueFiles
43
  * @return String $button
44
  */
56
  * Returns the html for showing the video insert button.
57
  * Enqueues scripts unless $enqueueFiles is set to false.
58
  *
59
+ * @since 2.1.0
60
  * @param boolean $enqueueFiles
61
  * @return String $button
62
  */
72
 
73
  /**
74
  * This function is registered in the SlideshowPluginAjax class
75
+ * and deletes slides with a particular $_POST['slideId'].
76
+ *
77
+ * @since 2.0.0
78
  */
79
  static function deleteSlide(){
80
  if((!isset($_POST['slideId']) || !is_numeric($_POST['slideId'])) ||
95
 
96
  /**
97
  * This function is registered in the SlideshowPluginAjax class
98
+ * and prints the results from the search query.
99
+ *
100
+ * @since 2.0.0
101
  */
102
  static function printSearchResults(){
103
  // Numberposts and offset
183
  /**
184
  * Applies a where clause on the get_posts call from self::printSearchResults()
185
  *
186
+ * @since 2.0.0
187
  * @param string $where
188
  * @return string $where
189
  */
202
 
203
  /**
204
  * Include popup, needs to be called in the footer
205
+ *
206
+ * @since 2.0.0
207
  */
208
  static function includePopup(){
209
  include(SlideshowPluginMain::getPluginPath() . '/views/' . __CLASS__ . '/search-popup.php');
211
 
212
  /**
213
  * Enqueues styles and scripts necessary for the media upload button.
214
+ *
215
+ * @since 2.0.0
216
  */
217
  static function enqueueFiles(){
218
  // Return when not on a slideshow edit page, or files have already been included.
classes/SlideshowPluginSlideshowSettingsHandler.php ADDED
@@ -0,0 +1,456 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class SlideshowPluginSlideshowSettingsHandler handles all database/settings interactions for the slideshows.
4
+ *
5
+ * @since 2.1.20
6
+ * @author Stefan Boonstra
7
+ * @version 06-12-12
8
+ */
9
+ class SlideshowPluginSlideshowSettingsHandler {
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' => 'slide',
315
+ 'slideSpeed' => '1',
316
+ 'descriptionSpeed' => '0.4',
317
+ 'intervalSpeed' => '5',
318
+ 'play' => 'true',
319
+ 'loop' => 'true',
320
+ 'slidesPerView' => '1',
321
+ 'width' => '0',
322
+ 'height' => '200',
323
+ 'descriptionHeight' => '50',
324
+ 'stretchImages' => 'true',
325
+ 'controllable' => 'true',
326
+ 'controlPanel' => 'false',
327
+ 'showDescription' => 'true',
328
+ 'hideDescription' => 'true',
329
+ 'random' => 'false',
330
+ 'avoidFilter' => 'true'
331
+ );
332
+
333
+ // Full definition
334
+ if($fullDefinition){
335
+ $data = array(
336
+ 'animation' => array('type' => 'select', 'default' => $data['animation'], 'description' => __('Animation used for transition between slides', 'slideshow-plugin'), 'options' => array('slide' => __('Slide', 'slideshow-plugin'), 'fade' => __('Fade', 'slideshow-plugin')), 'group' => __('Animation', 'slideshow-plugin')),
337
+ 'slideSpeed' => array('type' => 'text', 'default' => $data['slideSpeed'], 'description' => __('Number of seconds the slide takes to slide in', 'slideshow-plugin'), 'group' => __('Animation', 'slideshow-plugin')),
338
+ 'descriptionSpeed' => array('type' => 'text', 'default' => $data['descriptionSpeed'], 'description' => __('Number of seconds the description takes to slide in', 'slideshow-plugin'), 'group' => __('Animation', 'slideshow-plugin')),
339
+ 'intervalSpeed' => array('type' => 'text', 'default' => $data['intervalSpeed'], 'description' => __('Seconds between changing slides', 'slideshow-plugin'), 'group' => __('Animation', 'slideshow-plugin')),
340
+ 'slidesPerView' => array('type' => 'text', 'default' => $data['slidesPerView'], 'description' => __('Number of slides to fit into one slide', 'slideshow-plugin'), 'group' => __('Display', 'slideshow-plugin')),
341
+ 'width' => array('type' => 'text', 'default' => $data['width'], 'description' => __('Width of the slideshow, set to parent&#39;s width on 0', 'slideshow-plugin'), 'group' => __('Display', 'slideshow-plugin')),
342
+ 'height' => array('type' => 'text', 'default' => $data['height'], 'description' => __('Height of the slideshow', 'slideshow-plugin'), 'group' => __('Display', 'slideshow-plugin')),
343
+ 'descriptionHeight' => array('type' => 'text', 'default' => $data['descriptionHeight'], 'description' => __('Height of the description boxes', 'slideshow-plugin'), 'group' => __('Display', 'slideshow-plugin')),
344
+ 'stretchImages' => array('type' => 'radio', 'default' => $data['stretchImages'], 'description' => __('Fit image into slide (stretching it)', 'slideshow-plugin'), 'options' => array('true' => $yes, 'false' => $no), 'group' => __('Display', 'slideshow-plugin')),
345
+ 'showDescription' => array('type' => 'radio', 'default' => $data['showDescription'], 'description' => __('Show title and description', 'slideshow-plugin'), 'options' => array('true' => $yes, 'false' => $no), 'group' => __('Display', 'slideshow-plugin')),
346
+ 'hideDescription' => array('type' => 'radio', 'default' => $data['hideDescription'], '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')),
347
+ 'play' => array('type' => 'radio', 'default' => $data['play'], 'description' => __('Automatically slide to the next slide', 'slideshow-plugin'), 'options' => array('true' => $yes, 'false' => $no), 'group' => __('Control', 'slideshow-plugin')),
348
+ 'loop' => array('type' => 'radio', 'default' => $data['loop'], 'description' => __('Return to the beginning of the slideshow after last slide', 'slideshow-plugin'), 'options' => array('true' => $yes, 'false' => $no), 'group' => __('Control', 'slideshow-plugin')),
349
+ 'controllable' => array('type' => 'radio', 'default' => $data['controllable'], 'description' => __('Activate buttons (so the user can scroll through the slides)', 'slideshow-plugin'), 'options' => array('true' => $yes, 'false' => $no), 'group' => __('Control', 'slideshow-plugin')),
350
+ 'controlPanel' => array('type' => 'radio', 'default' => $data['controlPanel'], 'description' => __('Show control panel (play and pause button)', 'slideshow-plugin'), 'options' => array('true' => $yes, 'false' => $no), 'group' => __('Control', 'slideshow-plugin')),
351
+ 'random' => array('type' => 'radio', 'default' => $data['random'], 'description' => __('Randomize slides', 'slideshow-plugin'), 'options' => array('true' => $yes, 'false' => $no), 'group' => __('Miscellaneous', 'slideshow-plugin')),
352
+ 'avoidFilter' => array('type' => 'radio', 'default' => $data['avoidFilter'], 'description' => sprintf(__('Avoid content filter (disable if \'%s\' is shown)', 'slideshow-plugin'), SlideshowPluginShortcode::$bookmark), 'options' => array('true' => $yes, 'false' => $no), 'group' => __('Miscellaneous', 'slideshow-plugin'))
353
+ );
354
+ }
355
+
356
+ // Return
357
+ return $data;
358
+ }
359
+
360
+ /**
361
+ * Returns an array of style setting defaults.
362
+ *
363
+ * For a full description of the parameters, see getAllDefaults().
364
+ *
365
+ * @since 2.1.20
366
+ * @param boolean $fullDefinition (optional, defaults to false)
367
+ * @return mixed $data
368
+ */
369
+ static function getDefaultStyleSettings($fullDefinition = false){
370
+ // Much used data for translation
371
+ $yes = __('Yes', 'slideshow-plugin');
372
+ $no = __('No', 'slideshow-plugin');
373
+
374
+ // Default style settings
375
+ $data = array(
376
+ 'style' => 'light',
377
+ 'custom' => ''
378
+ );
379
+
380
+ // Full definition
381
+ if($fullDefinition){
382
+ $data = array(
383
+ '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'))),
384
+ 'custom' => array('type' => 'textarea', 'default' => $data['custom'], 'description' => __('Custom style editor', 'slideshow-plugin'), 'dependsOn' => array('styleSettings[style]', 'custom'))
385
+ );
386
+ }
387
+
388
+ // Return
389
+ return $data;
390
+ }
391
+
392
+ /**
393
+ * Returns an HTML inputField of the input setting.
394
+ *
395
+ * This function expects the setting to be in the 'fullDefinition'
396
+ * format that the getDefaults() and getSettings() methods both
397
+ * return.
398
+ *
399
+ * @since 2.1.20
400
+ * @param string $settingsKey
401
+ * @param string $settingsName
402
+ * @param mixed $settings
403
+ * @return mixed $inputField
404
+ */
405
+ static function getInputField($settingsKey, $settingsName, $settings){
406
+ if(!is_array($settings) || empty($settings) || empty($settingsName))
407
+ return null;
408
+
409
+ $inputField = '';
410
+ $name = $settingsKey . '[' . $settingsName . ']';
411
+ $displayValue = (!isset($settings['value']) || (empty($settings['value']) && !is_numeric($settings['value'])) ? $settings['default'] : $settings['value']);
412
+ $class = ((isset($settings['dependsOn']))? 'depends-on-field-value ' . $settings['dependsOn'][0] . ' ' . $settings['dependsOn'][1] . ' ': '') . $settingsKey . '-' . $settingsName;
413
+ switch($settings['type']){
414
+ case 'text':
415
+ $inputField .= '<input
416
+ type="text"
417
+ name="' . $name . '"
418
+ class="' . $class . '"
419
+ value="' . $displayValue . '"
420
+ />';
421
+ break;
422
+ case 'textarea':
423
+ $inputField .= '<textarea
424
+ name="' . $name . '"
425
+ class="' . $class . '"
426
+ rows="20"
427
+ cols="60"
428
+ >' . $displayValue . '</textarea>';
429
+ break;
430
+ case 'select':
431
+ $inputField .= '<select name="' . $name . '" class="' . $class . '">';
432
+ foreach($settings['options'] as $optionKey => $optionValue)
433
+ $inputField .= '<option value="' . $optionKey . '" ' . selected($displayValue, $optionKey, false) . '>
434
+ ' . $optionValue . '
435
+ </option>';
436
+ $inputField .= '</select>';
437
+ break;
438
+ case 'radio':
439
+ foreach($settings['options'] as $radioKey => $radioValue)
440
+ $inputField .= '<label><input
441
+ type="radio"
442
+ name="' . $name . '"
443
+ class="' . $class . '"
444
+ value="' . $radioKey . '" ' .
445
+ checked($displayValue, $radioKey, false) .
446
+ ' />' . $radioValue . '</label><br />';
447
+ break;
448
+ default:
449
+ $inputField = null;
450
+ break;
451
+ };
452
+
453
+ // Return
454
+ return $inputField;
455
+ }
456
+ }
classes/SlideshowPluginUpload.php DELETED
@@ -1,51 +0,0 @@
1
- <?php
2
- /**
3
- * Class SlideshowPluginUpload provides the code for an upload button that can be used
4
- * anywhere on a website.
5
- *
6
- * @author: Stefan Boonstra
7
- * @version: 15-09-12
8
- */
9
- class SlideshowPluginUpload {
10
-
11
- /**
12
- * Returns the html for showing the upload button.
13
- * Enqueues scripts unless $enqueueFiles is set to false.
14
- *
15
- * @param boolean $enqueueFiles
16
- * @return String $button
17
- */
18
- static function getUploadButton($enqueueFiles = true){
19
- if($enqueueFiles)
20
- self::enqueueFiles();
21
-
22
- // Return button html
23
- ob_start();
24
- include(SlideshowPluginMain::getPluginPath() . '/views/' . __CLASS__ . '/upload-button.php');
25
- return ob_get_clean();
26
- }
27
-
28
- /**
29
- * Enqueues styles and scripts necessary for the media upload button.
30
- */
31
- static function enqueueFiles(){
32
- // Enqueue styles
33
- wp_enqueue_style('thickbox');
34
-
35
- // Enqueue Wordpress scripts
36
- wp_enqueue_script('media-upload', false, array(), false, true);
37
- wp_enqueue_script('thickbox', false, array(), false, true);
38
-
39
- // Enqueue slideshow upload button script
40
- wp_enqueue_script(
41
- 'slideshow-upload-button',
42
- SlideshowPluginMain::getPluginUrl() . '/js/' . __CLASS__ . '/upload-button.js',
43
- array(
44
- 'jquery',
45
- 'media-upload',
46
- 'thickbox'),
47
- false,
48
- true
49
- );
50
- }
51
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/SlideshowPluginWidget.php CHANGED
@@ -2,6 +2,7 @@
2
  /**
3
  * Class SlideshowPluginWidget allows showing one of your slideshows in your widget area.
4
  *
 
5
  * @author: Stefan Boonstra
6
  * @version: 04-10-12
7
  */
@@ -12,6 +13,8 @@ class SlideshowPluginWidget extends WP_Widget {
12
 
13
  /**
14
  * Initializes the widget
 
 
15
  */
16
  function SlideshowPluginWidget(){
17
  // Settings
@@ -31,6 +34,7 @@ class SlideshowPluginWidget extends WP_Widget {
31
  /**
32
  * The widget as shown to the user.
33
  *
 
34
  * @param mixed array $args
35
  * @param mixed array $instance
36
  */
@@ -68,6 +72,7 @@ class SlideshowPluginWidget extends WP_Widget {
68
  /**
69
  * The form shown on the admins widget page. Here settings can be changed.
70
  *
 
71
  * @param mixed array $instance
72
  * @return string
73
  */
@@ -95,6 +100,7 @@ class SlideshowPluginWidget extends WP_Widget {
95
  /**
96
  * Updates widget's settings.
97
  *
 
98
  * @param mixed array $newInstance
99
  * @param mixed array $instance
100
  * @return mixed array $instance
@@ -114,6 +120,8 @@ class SlideshowPluginWidget extends WP_Widget {
114
 
115
  /**
116
  * Registers this widget (should be called upon widget_init action hook)
 
 
117
  */
118
  static function registerWidget(){
119
  register_widget(__CLASS__);
2
  /**
3
  * Class SlideshowPluginWidget allows showing one of your slideshows in your widget area.
4
  *
5
+ * @since 1.2.0
6
  * @author: Stefan Boonstra
7
  * @version: 04-10-12
8
  */
13
 
14
  /**
15
  * Initializes the widget
16
+ *
17
+ * @since 1.2.0
18
  */
19
  function SlideshowPluginWidget(){
20
  // Settings
34
  /**
35
  * The widget as shown to the user.
36
  *
37
+ * @since 1.2.0
38
  * @param mixed array $args
39
  * @param mixed array $instance
40
  */
72
  /**
73
  * The form shown on the admins widget page. Here settings can be changed.
74
  *
75
+ * @since 1.2.0
76
  * @param mixed array $instance
77
  * @return string
78
  */
100
  /**
101
  * Updates widget's settings.
102
  *
103
+ * @since 1.2.0
104
  * @param mixed array $newInstance
105
  * @param mixed array $instance
106
  * @return mixed array $instance
120
 
121
  /**
122
  * Registers this widget (should be called upon widget_init action hook)
123
+ *
124
+ * @since 1.2.0
125
  */
126
  static function registerWidget(){
127
  register_widget(__CLASS__);
images/SlideshowPluginPostType/adminIcon32.png ADDED
Binary file
js/SlideshowPluginGeneralSettings/general-settings.js ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function(){
2
+
3
+ /**
4
+ * On click of navigation tab, show different settings page.
5
+ */
6
+ jQuery('.nav-tab').click(function(){
7
+
8
+ // Tab references
9
+ var activeTab = jQuery('.nav-tab-active');
10
+ var thisTab = jQuery(this);
11
+
12
+ // Set active navigation tab
13
+ activeTab.removeClass('nav-tab-active');
14
+ thisTab.addClass('nav-tab-active');
15
+
16
+ // Hide previously active tab's content
17
+ jQuery(activeTab.attr('href').replace('#', '.')).css('display', 'none');
18
+
19
+ // Show newly activate tab
20
+ jQuery(thisTab.attr('href').replace('#', '.')).css('display', 'table');
21
+ });
22
+
23
+ /**
24
+ * ==== User Capabilities ====
25
+ *
26
+ * On checking either the 'Add slideshows' capability or the 'Delete slideshow' capability, the 'Edit slideshows'
27
+ * checkbox should also be checked. Un-checking the 'Edit slideshows' checkbox needs to do the opposite.
28
+ */
29
+ jQuery('input').change(function(){
30
+
31
+ // Check if the type was a checkbox
32
+ if(jQuery(this).attr('type').toLowerCase() != 'checkbox')
33
+ return;
34
+
35
+ // Capabilities
36
+ var addSlideshows = 'slideshow-jquery-image-gallery-add-slideshows';
37
+ var editSlideshows = 'slideshow-jquery-image-gallery-edit-slideshows';
38
+ var deleteSlideshows = 'slideshow-jquery-image-gallery-delete-slideshows';
39
+
40
+ // Get capability and role
41
+ var idArray = jQuery(this).attr('id').split('_');
42
+ var capability = idArray.shift();
43
+ var role = idArray.join('_');
44
+
45
+ // When 'Edit slideshows' has been un-checked, set 'Add slideshows' and 'Delete slideshows' to un-checked as well
46
+ if(capability == editSlideshows && !jQuery(this).attr('checked')){
47
+
48
+ // Un-check 'Delete slideshows' and 'Add slideshows'
49
+ jQuery('#' + addSlideshows + '_' + role).attr('checked', false);
50
+ jQuery('#' + deleteSlideshows + '_' + role).attr('checked', false);
51
+ }
52
+ // When 'Add slideshows' or 'Delete slideshows' has been checked, 'Edit slideshows' must be checked as well
53
+ else if(capability == addSlideshows || capability == deleteSlideshows){
54
+
55
+ jQuery('#' + editSlideshows + '_' + role).attr('checked', true);
56
+ }
57
+ });
58
+ });
languages/slideshow-plugin-nl_NL.mo CHANGED
Binary file
languages/slideshow-plugin-nl_NL.po CHANGED
@@ -2,8 +2,8 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Slideshow Plugin\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2012-12-06 18:44+0100\n"
6
- "PO-Revision-Date: 2012-12-06 18:44+0100\n"
7
  "Last-Translator: Stefan Boonstra <stefanboonstra@hotmail.com>\n"
8
  "Language-Team: Stefan Boonstra <wordpress@stefanboonstra.com>\n"
9
  "Language: nl_NL\n"
@@ -15,267 +15,292 @@ msgstr ""
15
  "X-Generator: Poedit 1.5.4\n"
16
  "X-Poedit-SearchPath-0: .\n"
17
 
18
- #: classes/SlideshowPluginPostType.php:32
19
- msgid "Slideshows"
20
- msgstr "Slideshows"
21
-
22
- #: classes/SlideshowPluginPostType.php:33
23
- #: views/SlideshowPluginWidget/form.php:7
24
- msgid "Slideshow"
25
- msgstr "Slideshow"
26
-
27
- #: classes/SlideshowPluginPostType.php:34
28
- msgid "Add New Slideshow"
29
- msgstr "Nieuwe Slideshow Toevoegen"
30
-
31
- #: classes/SlideshowPluginPostType.php:35
32
- msgid "Edit slideshow"
33
- msgstr "Slideshow bewerken"
34
-
35
- #: classes/SlideshowPluginPostType.php:36
36
- msgid "New slideshow"
37
- msgstr "Nieuwe slideshow"
38
 
39
- #: classes/SlideshowPluginPostType.php:37
40
- msgid "View slideshow"
41
- msgstr "Slideshow bekijken"
42
-
43
- #: classes/SlideshowPluginPostType.php:38
44
- msgid "Search slideshows"
45
- msgstr "Slideshows zoeken"
46
-
47
- #: classes/SlideshowPluginPostType.php:39
48
- #: classes/SlideshowPluginPostType.php:40
49
- msgid "No slideshows found"
50
- msgstr "Geen slideshows gevonden"
51
 
52
- #: classes/SlideshowPluginPostType.php:95
53
- msgid "Information"
54
- msgstr "Informatie"
 
 
55
 
56
- #: classes/SlideshowPluginPostType.php:104
57
- msgid "Slides List"
58
- msgstr "Slides Lijst"
 
59
 
60
- #: classes/SlideshowPluginPostType.php:113
61
- msgid "Slideshow Style"
62
- msgstr "Slideshow Stijl"
 
63
 
64
- #: classes/SlideshowPluginPostType.php:122
65
- msgid "Slideshow Settings"
66
- msgstr "Slideshow Instellingen"
 
67
 
68
- #: classes/SlideshowPluginSettingsHandler.php:309
69
- #: classes/SlideshowPluginSettingsHandler.php:374
70
- #: classes/SlideshowPluginUpdater.php:183
71
- msgid "Yes"
72
- msgstr "Ja"
73
 
74
- #: classes/SlideshowPluginSettingsHandler.php:310
75
- #: classes/SlideshowPluginSettingsHandler.php:375
76
- #: classes/SlideshowPluginUpdater.php:184
77
- msgid "No"
78
- msgstr "Nee"
79
 
80
- #: classes/SlideshowPluginSettingsHandler.php:337
81
- #: classes/SlideshowPluginUpdater.php:188
82
  msgid "Animation used for transition between slides"
83
  msgstr "Animatie tussen het wisselen van de slides"
84
 
85
- #: classes/SlideshowPluginSettingsHandler.php:337
86
- #: classes/SlideshowPluginUpdater.php:188
87
  msgid "Slide"
88
  msgstr "Slide"
89
 
90
- #: classes/SlideshowPluginSettingsHandler.php:337
91
- #: classes/SlideshowPluginUpdater.php:188
92
  msgid "Fade"
93
  msgstr "Fade"
94
 
95
- #: classes/SlideshowPluginSettingsHandler.php:337
96
- #: classes/SlideshowPluginSettingsHandler.php:338
97
- #: classes/SlideshowPluginSettingsHandler.php:339
98
- #: classes/SlideshowPluginSettingsHandler.php:340
99
- #: classes/SlideshowPluginUpdater.php:188
100
- #: classes/SlideshowPluginUpdater.php:189
101
- #: classes/SlideshowPluginUpdater.php:190
102
- #: classes/SlideshowPluginUpdater.php:191
103
  msgid "Animation"
104
  msgstr "Animatie"
105
 
106
- #: classes/SlideshowPluginSettingsHandler.php:338
107
- #: classes/SlideshowPluginUpdater.php:189
108
  msgid "Number of seconds the slide takes to slide in"
109
  msgstr ""
110
  "Aantal seconden dat de animatie van het inschuiven van de volgende slide "
111
  "duurt"
112
 
113
- #: classes/SlideshowPluginSettingsHandler.php:339
114
- #: classes/SlideshowPluginUpdater.php:190
115
  msgid "Number of seconds the description takes to slide in"
116
  msgstr "Aantal seconden dat het inschuiven van de beschrijving duurt"
117
 
118
- #: classes/SlideshowPluginSettingsHandler.php:340
119
- #: classes/SlideshowPluginUpdater.php:191
120
  msgid "Seconds between changing slides"
121
  msgstr "Seconden tussen het wisselen van de slides"
122
 
123
- #: classes/SlideshowPluginSettingsHandler.php:341
124
- #: classes/SlideshowPluginUpdater.php:192
125
  msgid "Number of slides to fit into one slide"
126
  msgstr "Aantal slides om in een slide te plaatsen"
127
 
128
- #: classes/SlideshowPluginSettingsHandler.php:341
129
- #: classes/SlideshowPluginSettingsHandler.php:342
130
- #: classes/SlideshowPluginSettingsHandler.php:343
131
- #: classes/SlideshowPluginSettingsHandler.php:344
132
- #: classes/SlideshowPluginSettingsHandler.php:345
133
- #: classes/SlideshowPluginSettingsHandler.php:346
134
- #: classes/SlideshowPluginSettingsHandler.php:347
135
- #: classes/SlideshowPluginUpdater.php:192
136
- #: classes/SlideshowPluginUpdater.php:193
137
- #: classes/SlideshowPluginUpdater.php:194
138
- #: classes/SlideshowPluginUpdater.php:195
139
- #: classes/SlideshowPluginUpdater.php:196
140
- #: classes/SlideshowPluginUpdater.php:197
141
- #: classes/SlideshowPluginUpdater.php:198
142
  msgid "Display"
143
  msgstr "Weergave"
144
 
145
- #: classes/SlideshowPluginSettingsHandler.php:342
146
- #: classes/SlideshowPluginUpdater.php:193
147
  msgid "Width of the slideshow, set to parent&#39;s width on 0"
148
  msgstr ""
149
  "Breedte van de slideshow, past zich aan op bovenliggende element wanneer 0"
150
 
151
- #: classes/SlideshowPluginSettingsHandler.php:343
152
- #: classes/SlideshowPluginUpdater.php:194
153
  msgid "Height of the slideshow"
154
  msgstr "Hoogte van de slideshow"
155
 
156
- #: classes/SlideshowPluginSettingsHandler.php:344
157
- #: classes/SlideshowPluginUpdater.php:195
158
  msgid "Height of the description boxes"
159
  msgstr "Hoogte van de beschrijvingen"
160
 
161
- #: classes/SlideshowPluginSettingsHandler.php:345
162
- #: classes/SlideshowPluginUpdater.php:196
163
  msgid "Fit image into slide (stretching it)"
164
  msgstr "Pas afbeelding in de slideshow (oprekken)"
165
 
166
- #: classes/SlideshowPluginSettingsHandler.php:346
167
- #: classes/SlideshowPluginUpdater.php:197
168
  msgid "Show title and description"
169
  msgstr "Toon titel en beschrijving"
170
 
171
- #: classes/SlideshowPluginSettingsHandler.php:347
172
- #: classes/SlideshowPluginUpdater.php:198
173
  msgid "Hide description box, it will pop up when a mouse hovers over the slide"
174
  msgstr ""
175
  "Verbeg beschrijving, toon de slide alleen wanneer de muisaanwijzer boven de "
176
  "slide is"
177
 
178
- #: classes/SlideshowPluginSettingsHandler.php:348
179
- #: classes/SlideshowPluginUpdater.php:199
180
  msgid "Automatically slide to the next slide"
181
  msgstr "Automatisch naar de volgende slide gaan"
182
 
183
- #: classes/SlideshowPluginSettingsHandler.php:348
184
- #: classes/SlideshowPluginSettingsHandler.php:349
185
- #: classes/SlideshowPluginSettingsHandler.php:350
186
- #: classes/SlideshowPluginSettingsHandler.php:351
187
- #: classes/SlideshowPluginUpdater.php:199
188
- #: classes/SlideshowPluginUpdater.php:200
189
- #: classes/SlideshowPluginUpdater.php:201
190
- #: classes/SlideshowPluginUpdater.php:202
191
  msgid "Control"
192
  msgstr "Controle"
193
 
194
- #: classes/SlideshowPluginSettingsHandler.php:349
195
- #: classes/SlideshowPluginUpdater.php:200
196
  msgid "Return to the beginning of the slideshow after last slide"
197
  msgstr "Keer terug naar het begin van de slideshow na de laatste slide."
198
 
199
- #: classes/SlideshowPluginSettingsHandler.php:350
200
- #: classes/SlideshowPluginUpdater.php:201
201
  msgid "Activate buttons (so the user can scroll through the slides)"
202
  msgstr "Knoppen activeren (zodat de gebruiker door de slides kan scrollen)"
203
 
204
- #: classes/SlideshowPluginSettingsHandler.php:351
205
- #: classes/SlideshowPluginUpdater.php:202
206
  msgid "Show control panel (play and pause button)"
207
  msgstr "Toon controlepaneel (speel en pause knop)"
208
 
209
- #: classes/SlideshowPluginSettingsHandler.php:352
210
- msgid "Randomize slides"
211
- msgstr "Toon slides in willekeurige volgorde"
212
 
213
- #: classes/SlideshowPluginSettingsHandler.php:352
214
- #: classes/SlideshowPluginSettingsHandler.php:353
215
- msgid "Miscellaneous"
216
- msgstr "Overige"
217
 
218
- #: classes/SlideshowPluginSettingsHandler.php:353
219
- #, php-format
220
- msgid "Avoid content filter (disable if '%s' is shown)"
221
- msgstr "Content filter omzeilen (uitschakelen als '%s' wordt getoond)"
222
 
223
- #: classes/SlideshowPluginSettingsHandler.php:386
224
- #: classes/SlideshowPluginUpdater.php:186
225
- msgid "The style used for this slideshow"
226
- msgstr "De stijl te gebruiken voor deze slideshow"
227
 
228
- #: classes/SlideshowPluginSettingsHandler.php:386
229
- #: classes/SlideshowPluginUpdater.php:186
230
- msgid "Light"
231
- msgstr "Licht"
232
 
233
- #: classes/SlideshowPluginSettingsHandler.php:386
234
- #: classes/SlideshowPluginUpdater.php:186
235
- msgid "Dark"
236
- msgstr "Donker"
237
 
238
- #: classes/SlideshowPluginSettingsHandler.php:386
239
- #: classes/SlideshowPluginUpdater.php:186
240
- msgid "Custom"
241
- msgstr "Aangepast"
242
 
243
- #: classes/SlideshowPluginSettingsHandler.php:387
244
- #: classes/SlideshowPluginUpdater.php:187
245
- msgid "Custom style editor"
246
- msgstr "Aangepaste stijl bewerker"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
 
248
  #: classes/SlideshowPluginShortcode.php:130
249
  msgid "No slideshow selected."
250
  msgstr "Geen slideshow geselecteerd."
251
 
252
- #: classes/SlideshowPluginSlideInserter.php:148
253
  #: views/SlideshowPluginPostType/slides.php:2
254
  msgid "Insert"
255
  msgstr "Invoegen"
256
 
257
- #: classes/SlideshowPluginSlideInserter.php:157
258
  msgid "Load more results"
259
  msgstr "Meer resultaten laden"
260
 
261
- #: classes/SlideshowPluginSlideInserter.php:166
262
  msgid "No images were found, click here to upload some."
263
  msgstr "Geen afbeeldingen gevonden, klik hier om afbeeldingen te uploaden."
264
 
265
- #: classes/SlideshowPluginSlideInserter.php:227
266
  msgid "Are you sure you want to delete this slide?"
267
  msgstr "Weet je zeker dat je deze slide wilt verwijderen?"
268
 
269
- #: classes/SlideshowPluginWidget.php:20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
270
  msgid "Enables you to show your slideshows in the widget area of your website."
271
  msgstr ""
272
  "Maakt het mogelijk je slideshows te bijken in het widget gebied van je "
273
  "website."
274
 
275
- #: classes/SlideshowPluginWidget.php:26
276
  msgid "Slideshow Widget"
277
  msgstr "Slideshow Widget"
278
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
  #: views/SlideshowPluginPostType/information.php:1
280
  msgid ""
281
  "To use this slideshow in your website either add this piece of shortcode to "
@@ -304,7 +329,7 @@ msgid "settings"
304
  msgstr "instellingen"
305
 
306
  #: views/SlideshowPluginPostType/settings.php:26
307
- #: views/SlideshowPluginPostType/style-settings.php:8
308
  msgid "Default"
309
  msgstr "Standaard"
310
 
2
  msgstr ""
3
  "Project-Id-Version: Slideshow Plugin\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2012-12-18 23:14+0100\n"
6
+ "PO-Revision-Date: 2012-12-18 23:21+0100\n"
7
  "Last-Translator: Stefan Boonstra <stefanboonstra@hotmail.com>\n"
8
  "Language-Team: Stefan Boonstra <wordpress@stefanboonstra.com>\n"
9
  "Language: nl_NL\n"
15
  "X-Generator: Poedit 1.5.4\n"
16
  "X-Poedit-SearchPath-0: .\n"
17
 
18
+ #: classes/SlideshowPluginGeneralSettings.php:57
19
+ #: classes/SlideshowPluginGeneralSettings.php:58
20
+ msgid "General Settings"
21
+ msgstr "Algemene Instellingen"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
+ #: classes/SlideshowPluginInstaller.php:240
24
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:309
25
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:371
26
+ msgid "Yes"
27
+ msgstr "Ja"
 
 
 
 
 
 
 
28
 
29
+ #: classes/SlideshowPluginInstaller.php:241
30
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:310
31
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:372
32
+ msgid "No"
33
+ msgstr "Nee"
34
 
35
+ #: classes/SlideshowPluginInstaller.php:243
36
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:383
37
+ msgid "The style used for this slideshow"
38
+ msgstr "De stijl te gebruiken voor deze slideshow"
39
 
40
+ #: classes/SlideshowPluginInstaller.php:243
41
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:383
42
+ msgid "Light"
43
+ msgstr "Licht"
44
 
45
+ #: classes/SlideshowPluginInstaller.php:243
46
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:383
47
+ msgid "Dark"
48
+ msgstr "Donker"
49
 
50
+ #: classes/SlideshowPluginInstaller.php:243
51
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:383
52
+ msgid "Custom"
53
+ msgstr "Aangepast"
 
54
 
55
+ #: classes/SlideshowPluginInstaller.php:244
56
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:384
57
+ msgid "Custom style editor"
58
+ msgstr "Aangepaste stijl bewerker"
 
59
 
60
+ #: classes/SlideshowPluginInstaller.php:245
61
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:336
62
  msgid "Animation used for transition between slides"
63
  msgstr "Animatie tussen het wisselen van de slides"
64
 
65
+ #: classes/SlideshowPluginInstaller.php:245
66
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:336
67
  msgid "Slide"
68
  msgstr "Slide"
69
 
70
+ #: classes/SlideshowPluginInstaller.php:245
71
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:336
72
  msgid "Fade"
73
  msgstr "Fade"
74
 
75
+ #: classes/SlideshowPluginInstaller.php:245
76
+ #: classes/SlideshowPluginInstaller.php:246
77
+ #: classes/SlideshowPluginInstaller.php:247
78
+ #: classes/SlideshowPluginInstaller.php:248
79
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:336
80
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:337
81
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:338
82
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:339
83
  msgid "Animation"
84
  msgstr "Animatie"
85
 
86
+ #: classes/SlideshowPluginInstaller.php:246
87
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:337
88
  msgid "Number of seconds the slide takes to slide in"
89
  msgstr ""
90
  "Aantal seconden dat de animatie van het inschuiven van de volgende slide "
91
  "duurt"
92
 
93
+ #: classes/SlideshowPluginInstaller.php:247
94
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:338
95
  msgid "Number of seconds the description takes to slide in"
96
  msgstr "Aantal seconden dat het inschuiven van de beschrijving duurt"
97
 
98
+ #: classes/SlideshowPluginInstaller.php:248
99
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:339
100
  msgid "Seconds between changing slides"
101
  msgstr "Seconden tussen het wisselen van de slides"
102
 
103
+ #: classes/SlideshowPluginInstaller.php:249
104
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:340
105
  msgid "Number of slides to fit into one slide"
106
  msgstr "Aantal slides om in een slide te plaatsen"
107
 
108
+ #: classes/SlideshowPluginInstaller.php:249
109
+ #: classes/SlideshowPluginInstaller.php:250
110
+ #: classes/SlideshowPluginInstaller.php:251
111
+ #: classes/SlideshowPluginInstaller.php:252
112
+ #: classes/SlideshowPluginInstaller.php:253
113
+ #: classes/SlideshowPluginInstaller.php:254
114
+ #: classes/SlideshowPluginInstaller.php:255
115
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:340
116
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:341
117
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:342
118
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:343
119
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:344
120
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:345
121
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:346
122
  msgid "Display"
123
  msgstr "Weergave"
124
 
125
+ #: classes/SlideshowPluginInstaller.php:250
126
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:341
127
  msgid "Width of the slideshow, set to parent&#39;s width on 0"
128
  msgstr ""
129
  "Breedte van de slideshow, past zich aan op bovenliggende element wanneer 0"
130
 
131
+ #: classes/SlideshowPluginInstaller.php:251
132
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:342
133
  msgid "Height of the slideshow"
134
  msgstr "Hoogte van de slideshow"
135
 
136
+ #: classes/SlideshowPluginInstaller.php:252
137
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:343
138
  msgid "Height of the description boxes"
139
  msgstr "Hoogte van de beschrijvingen"
140
 
141
+ #: classes/SlideshowPluginInstaller.php:253
142
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:344
143
  msgid "Fit image into slide (stretching it)"
144
  msgstr "Pas afbeelding in de slideshow (oprekken)"
145
 
146
+ #: classes/SlideshowPluginInstaller.php:254
147
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:345
148
  msgid "Show title and description"
149
  msgstr "Toon titel en beschrijving"
150
 
151
+ #: classes/SlideshowPluginInstaller.php:255
152
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:346
153
  msgid "Hide description box, it will pop up when a mouse hovers over the slide"
154
  msgstr ""
155
  "Verbeg beschrijving, toon de slide alleen wanneer de muisaanwijzer boven de "
156
  "slide is"
157
 
158
+ #: classes/SlideshowPluginInstaller.php:256
159
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:347
160
  msgid "Automatically slide to the next slide"
161
  msgstr "Automatisch naar de volgende slide gaan"
162
 
163
+ #: classes/SlideshowPluginInstaller.php:256
164
+ #: classes/SlideshowPluginInstaller.php:257
165
+ #: classes/SlideshowPluginInstaller.php:258
166
+ #: classes/SlideshowPluginInstaller.php:259
167
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:347
168
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:348
169
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:349
170
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:350
171
  msgid "Control"
172
  msgstr "Controle"
173
 
174
+ #: classes/SlideshowPluginInstaller.php:257
175
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:348
176
  msgid "Return to the beginning of the slideshow after last slide"
177
  msgstr "Keer terug naar het begin van de slideshow na de laatste slide."
178
 
179
+ #: classes/SlideshowPluginInstaller.php:258
180
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:349
181
  msgid "Activate buttons (so the user can scroll through the slides)"
182
  msgstr "Knoppen activeren (zodat de gebruiker door de slides kan scrollen)"
183
 
184
+ #: classes/SlideshowPluginInstaller.php:259
185
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:350
186
  msgid "Show control panel (play and pause button)"
187
  msgstr "Toon controlepaneel (speel en pause knop)"
188
 
189
+ #: classes/SlideshowPluginPostType.php:37
190
+ msgid "Slideshows"
191
+ msgstr "Slideshows"
192
 
193
+ #: classes/SlideshowPluginPostType.php:38
194
+ #: views/SlideshowPluginWidget/form.php:7
195
+ msgid "Slideshow"
196
+ msgstr "Slideshow"
197
 
198
+ #: classes/SlideshowPluginPostType.php:39
199
+ msgid "Add New Slideshow"
200
+ msgstr "Nieuwe Slideshow Toevoegen"
 
201
 
202
+ #: classes/SlideshowPluginPostType.php:40
203
+ msgid "Edit slideshow"
204
+ msgstr "Slideshow bewerken"
 
205
 
206
+ #: classes/SlideshowPluginPostType.php:41
207
+ msgid "New slideshow"
208
+ msgstr "Nieuwe slideshow"
 
209
 
210
+ #: classes/SlideshowPluginPostType.php:42
211
+ msgid "View slideshow"
212
+ msgstr "Slideshow bekijken"
 
213
 
214
+ #: classes/SlideshowPluginPostType.php:43
215
+ msgid "Search slideshows"
216
+ msgstr "Slideshows zoeken"
 
217
 
218
+ #: classes/SlideshowPluginPostType.php:44
219
+ #: classes/SlideshowPluginPostType.php:45
220
+ msgid "No slideshows found"
221
+ msgstr "Geen slideshows gevonden"
222
+
223
+ #: classes/SlideshowPluginPostType.php:121
224
+ msgid "Information"
225
+ msgstr "Informatie"
226
+
227
+ #: classes/SlideshowPluginPostType.php:130
228
+ msgid "Slides List"
229
+ msgstr "Slides Lijst"
230
+
231
+ #: classes/SlideshowPluginPostType.php:139
232
+ msgid "Slideshow Style"
233
+ msgstr "Slideshow Stijl"
234
+
235
+ #: classes/SlideshowPluginPostType.php:148
236
+ msgid "Slideshow Settings"
237
+ msgstr "Slideshow Instellingen"
238
 
239
  #: classes/SlideshowPluginShortcode.php:130
240
  msgid "No slideshow selected."
241
  msgstr "Geen slideshow geselecteerd."
242
 
243
+ #: classes/SlideshowPluginSlideInserter.php:156
244
  #: views/SlideshowPluginPostType/slides.php:2
245
  msgid "Insert"
246
  msgstr "Invoegen"
247
 
248
+ #: classes/SlideshowPluginSlideInserter.php:165
249
  msgid "Load more results"
250
  msgstr "Meer resultaten laden"
251
 
252
+ #: classes/SlideshowPluginSlideInserter.php:174
253
  msgid "No images were found, click here to upload some."
254
  msgstr "Geen afbeeldingen gevonden, klik hier om afbeeldingen te uploaden."
255
 
256
+ #: classes/SlideshowPluginSlideInserter.php:240
257
  msgid "Are you sure you want to delete this slide?"
258
  msgstr "Weet je zeker dat je deze slide wilt verwijderen?"
259
 
260
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:351
261
+ msgid "Randomize slides"
262
+ msgstr "Toon slides in willekeurige volgorde"
263
+
264
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:351
265
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:352
266
+ msgid "Miscellaneous"
267
+ msgstr "Overige"
268
+
269
+ #: classes/SlideshowPluginSlideshowSettingsHandler.php:352
270
+ #, php-format
271
+ msgid "Avoid content filter (disable if '%s' is shown)"
272
+ msgstr "Content filter omzeilen (uitschakelen als '%s' wordt getoond)"
273
+
274
+ #: classes/SlideshowPluginWidget.php:23
275
  msgid "Enables you to show your slideshows in the widget area of your website."
276
  msgstr ""
277
  "Maakt het mogelijk je slideshows te bijken in het widget gebied van je "
278
  "website."
279
 
280
+ #: classes/SlideshowPluginWidget.php:29
281
  msgid "Slideshow Widget"
282
  msgstr "Slideshow Widget"
283
 
284
+ #: views/SlideshowPluginGeneralSettings/general-settings.php:8
285
+ msgid "Add slideshows"
286
+ msgstr "Slideshows toevoegen"
287
+
288
+ #: views/SlideshowPluginGeneralSettings/general-settings.php:9
289
+ msgid "Edit slideshows"
290
+ msgstr "Slideshows bewerken"
291
+
292
+ #: views/SlideshowPluginGeneralSettings/general-settings.php:10
293
+ msgid "Delete slideshows"
294
+ msgstr "Slideshows verwijderen"
295
+
296
+ #: views/SlideshowPluginGeneralSettings/general-settings.php:19
297
+ msgid "User Capabilities"
298
+ msgstr "Gebruikersrechten"
299
+
300
+ #: views/SlideshowPluginGeneralSettings/general-settings.php:42
301
+ msgid "Untitled role"
302
+ msgstr "Naamloze gebruikersfunctie"
303
+
304
  #: views/SlideshowPluginPostType/information.php:1
305
  msgid ""
306
  "To use this slideshow in your website either add this piece of shortcode to "
329
  msgstr "instellingen"
330
 
331
  #: views/SlideshowPluginPostType/settings.php:26
332
+ #: views/SlideshowPluginPostType/style-settings.php:11
333
  msgid "Default"
334
  msgstr "Standaard"
335
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ 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.21
9
  License: GPLv2
10
 
11
  Integrate a fancy slideshow in just five steps. - Rainbows. Rainbows everywhere.
@@ -38,7 +38,7 @@ different images, settings and styles for each one of them.
38
  - Chinese (Translated by [Kevin Tell](http://www.ivygg.com/))
39
  - Dutch
40
  - English
41
- - French (Translated by [Wptheme](http://wptheme.fr/)
42
  - Russian (Translated by [Oleg Fritz](http://www.facebook.com/profile.php?id=100001331241069))
43
 
44
  Feel free to send me your own translation of the plugin to my e-mail address: wordpress@stefanboonstra.com. Many
@@ -108,6 +108,13 @@ slideshow may not be styled.
108
 
109
  == Changelog ==
110
 
 
 
 
 
 
 
 
111
  = 2.1.21 =
112
  * Fixed: Adding new slides was made impossible by a faulty setting.
113
  * Fixed: Image tag placed on multiple lines caused some sites to not display images correctly due to an inserted break character.
@@ -117,7 +124,6 @@ slideshow may not be styled.
117
  * Fixed: Images not always showing in image inserter popup.
118
  * Compatibility with WordPress 3.5 confirmed.
119
  * First back-end increment towards version 2.2.0, introducing a more efficient way to store and retrieve the slideshow's settings and slides.
120
- * Added French translation
121
 
122
  = 2.1.19 =
123
  * Fixed: Slides are now always floated, despite any parent CSS settings.
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.22
9
  License: GPLv2
10
 
11
  Integrate a fancy slideshow in just five steps. - Rainbows. Rainbows everywhere.
38
  - Chinese (Translated by [Kevin Tell](http://www.ivygg.com/))
39
  - Dutch
40
  - English
41
+ - French (Translated by [Wptheme](http://wptheme.fr/))
42
  - Russian (Translated by [Oleg Fritz](http://www.facebook.com/profile.php?id=100001331241069))
43
 
44
  Feel free to send me your own translation of the plugin to my e-mail address: wordpress@stefanboonstra.com. Many
108
 
109
  == Changelog ==
110
 
111
+ = 2.1.22 =
112
+ * Added French translation.
113
+ * Added a "General Settings" page, containing user capability settings.
114
+ * Cleaned up unnecessary settings that were showing on page.
115
+ * Replaced the, in WordPress 3.5, deprecated function 'wp_get_single_post' with the 'get_post' function.
116
+ * Added an on-page error logger to be able to solve back-end issues faster. Nothing is shown when no errors exist, doesn't affect SEO.
117
+
118
  = 2.1.21 =
119
  * Fixed: Adding new slides was made impossible by a faulty setting.
120
  * Fixed: Image tag placed on multiple lines caused some sites to not display images correctly due to an inserted break character.
124
  * Fixed: Images not always showing in image inserter popup.
125
  * Compatibility with WordPress 3.5 confirmed.
126
  * First back-end increment towards version 2.2.0, introducing a more efficient way to store and retrieve the slideshow's settings and slides.
 
127
 
128
  = 2.1.19 =
129
  * Fixed: Slides are now always floated, despite any parent CSS settings.
slideshow.php CHANGED
@@ -3,10 +3,10 @@
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.21
7
  Requires at least: 3.3
8
  Author: StefanBoonstra
9
- Author URI: http://stefanboonstra.com
10
  License: GPLv2
11
  */
12
 
@@ -15,13 +15,14 @@
15
  * methods for the other classes to use like the auto-includer and the
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.21';
25
 
26
  /**
27
  * Bootstraps the application by assigning the right functions to
@@ -36,6 +37,12 @@ class SlideshowPluginMain {
36
  // For ajax requests
37
  SlideshowPluginAjax::init();
38
 
 
 
 
 
 
 
39
  // Deploy slideshow on do_action('slideshow_deploy'); hook.
40
  add_action('slideshow_deploy', array('SlideshowPlugin', 'deploy'));
41
 
@@ -45,11 +52,8 @@ class SlideshowPluginMain {
45
  // Register widget
46
  add_action('widgets_init', array('SlideshowPluginWidget', 'registerWidget'));
47
 
48
- // Register slideshow post type
49
- SlideshowPluginPostType::initialize();
50
-
51
  // Initialize plugin updater
52
- SlideshowPluginUpdater::init();
53
  }
54
 
55
  /**
@@ -93,7 +97,7 @@ class SlideshowPluginMain {
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');
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.22
7
  Requires at least: 3.3
8
  Author: StefanBoonstra
9
+ Author URI: http://stefanboonstra.com/
10
  License: GPLv2
11
  */
12
 
15
  * methods for the other classes to use like the auto-includer and the
16
  * base path/url returning method.
17
  *
18
+ * @since 1.0.0
19
  * @author Stefan Boonstra
20
+ * @version 18-12-12
21
  */
22
  class SlideshowPluginMain {
23
 
24
  /** Variables */
25
+ static $version = '2.1.22';
26
 
27
  /**
28
  * Bootstraps the application by assigning the right functions to
37
  // For ajax requests
38
  SlideshowPluginAjax::init();
39
 
40
+ // Register slideshow post type
41
+ SlideshowPluginPostType::init();
42
+
43
+ // Add general settings page
44
+ SlideshowPluginGeneralSettings::init();
45
+
46
  // Deploy slideshow on do_action('slideshow_deploy'); hook.
47
  add_action('slideshow_deploy', array('SlideshowPlugin', 'deploy'));
48
 
52
  // Register widget
53
  add_action('widgets_init', array('SlideshowPluginWidget', 'registerWidget'));
54
 
 
 
 
55
  // Initialize plugin updater
56
+ SlideshowPluginInstaller::init();
57
  }
58
 
59
  /**
97
  $file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . $name . '.php';
98
 
99
  if(is_file($file))
100
+ require_once $file;
101
  }
102
 
103
  spl_autoload_register('slideshowPluginAutoLoader');
style/SlideshowPlugin/functional.css CHANGED
@@ -1 +1 @@
1
- .slideshow_container{position:relative}.slideshow_container .slideshow_overflow{position:relative;overflow:hidden}.slideshow_container .slideshow{height:100%;width:200%;overflow:hidden}.slideshow_container img{margin:0!important;padding:0!important;max-width:100%;max-height:100%;border:0}.slideshow_container .slide{height:100%;float:left!important;overflow:hidden;text-align:center}.slideshow_container .transparent{zoom:1}.slideshow_container .transparent:hover{zoom:1}.slideshow_container .description{position:absolute;bottom:0;display:none;width:inherit}.slideshow_container .controlPanel{position:absolute;top:5px;left:50%;display:none}.slideshow_container .controlPanel ul{list-style:none;margin:0;padding:0}.slideshow_container .controlPanel ul li{float:left}.slideshow_container .controlPanel ul li:hover{cursor:pointer}.slideshow_container .button{padding:0;position:absolute;top:50%;cursor:pointer;display:none}.slideshow_container .previous{left:5px}.slideshow_container .next{right:5px}.slideshow_container .manufacturer{position:absolute!important;height:1px;width:1px;overflow:hidden;clip:rect(1px 1px 1px 1px);clip:rect(1px,1px,1px,1px);}
1
+ .slideshow_container{position:relative}.slideshow_container .slideshow_overflow{position:relative;overflow:hidden}.slideshow_container .slideshow{height:100%;width:200%;overflow:hidden}.slideshow_container img{margin:0!important;padding:0!important;max-width:100%;max-height:100%;border:0}.slideshow_container .slide{height:100%;float:left!important;overflow:hidden;text-align:center}.slideshow_container .transparent{zoom:1}.slideshow_container .transparent:hover{zoom:1}.slideshow_container .description{position:absolute;bottom:0;display:none;width:inherit}.slideshow_container .controlPanel{position:absolute;top:5px;left:50%;display:none}.slideshow_container .controlPanel ul{list-style:none;margin:0;padding:0}.slideshow_container .controlPanel ul li{float:left}.slideshow_container .controlPanel ul li:hover{cursor:pointer}.slideshow_container .button{padding:0;position:absolute;top:50%;cursor:pointer;display:none}.slideshow_container .previous{left:5px}.slideshow_container .next{right:5px}.slideshow_container .slideshow_plugin_manufacturer{position:absolute!important;height:1px;width:1px;overflow:hidden;clip:rect(1px 1px 1px 1px);clip:rect(1px,1px,1px,1px);}
views/SlideshowPlugin/slideshow.php CHANGED
@@ -27,8 +27,8 @@
27
 
28
  <div class="slide slide_<?php echo $i; ?>" <?php if(!empty($color)) echo 'style="background: #' . $color . ';"'; ?> style="height: <?php echo (is_numeric($settings['height']))? $settings['height'] : 0; ?>px;">
29
  <a <?php if(!empty($url)) echo 'href="' . $url . '"';?> <?php if(!empty($target)) echo 'target="' . $target . '"'; ?>>
30
- <h2><?php echo $title; ?></h2>
31
- <p><?php echo $description; ?></p>
32
  </a>
33
  </div>
34
 
@@ -112,15 +112,19 @@
112
  <div class="button next transparent"></div>
113
  </div>
114
 
115
- <!--<div class="settings" style="display: none;"><?php echo json_encode($settings); ?></div>-->
116
-
117
- <div class="manufacturer">
118
  <a href="http://www.stefanboonstra.com/slideshow/">Wordpress Slideshow</a>
119
  </div>
120
 
121
- <div style="display: none;">
122
- <?php echo SlideshowPluginMain::$version; ?>
123
- </div>
 
 
 
 
 
 
124
 
125
  <?php if(!empty($style)): ?>
126
  <style type="text/css">
27
 
28
  <div class="slide slide_<?php echo $i; ?>" <?php if(!empty($color)) echo 'style="background: #' . $color . ';"'; ?> style="height: <?php echo (is_numeric($settings['height']))? $settings['height'] : 0; ?>px;">
29
  <a <?php if(!empty($url)) echo 'href="' . $url . '"';?> <?php if(!empty($target)) echo 'target="' . $target . '"'; ?>>
30
+ <h2><?php echo $title; ?></h2>
31
+ <p><?php echo $description; ?></p>
32
  </a>
33
  </div>
34
 
112
  <div class="button next transparent"></div>
113
  </div>
114
 
115
+ <div class="slideshow_plugin_manufacturer">
 
 
116
  <a href="http://www.stefanboonstra.com/slideshow/">Wordpress Slideshow</a>
117
  </div>
118
 
119
+ <!-- WordPress Slideshow Version <?php echo SlideshowPluginMain::$version; ?> -->
120
+
121
+ <?php if(is_array($log) && count($log) > 0): ?>
122
+ <!-- Error log
123
+ <?php foreach($log as $logMessage): ?>
124
+ - <?php echo htmlspecialchars($logMessage); ?>
125
+ <?php endforeach; ?>
126
+ -->
127
+ <?php endif; ?>
128
 
129
  <?php if(!empty($style)): ?>
130
  <style type="text/css">
views/SlideshowPluginGeneralSettings/general-settings.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Roles
4
+ global $wp_roles;
5
+
6
+ // Capabilities
7
+ $capabilities = array(
8
+ SlideshowPluginGeneralSettings::$capabilities['addSlideshows'] => __('Add slideshows', 'slideshow-plugin'),
9
+ SlideshowPluginGeneralSettings::$capabilities['editSlideshows'] => __('Edit slideshows', 'slideshow-plugin'),
10
+ SlideshowPluginGeneralSettings::$capabilities['deleteSlideshows'] => __('Delete slideshows', 'slideshow-plugin')
11
+ );
12
+
13
+ ?>
14
+
15
+ <div class="wrap">
16
+
17
+ <div class="icon32" style="background: url('<?php echo SlideshowPluginMain::getPluginUrl() . '/images/SlideshowPluginPostType/adminIcon32.png'; ?>');"></div>
18
+ <h2 class="nav-tab-wrapper">
19
+ <a href="#user-capabilities" class="nav-tab nav-tab-active"><?php _e('User Capabilities', 'slideshow-plugin'); ?></a>
20
+ <!-- <a href="#default-slideshow-settings" class="nav-tab">--><?php //_e('Default Slideshow Values', 'slideshow-plugin'); ?><!--</a>-->
21
+ <!-- <a href="#custom-styles" class="nav-tab">--><?php //_e('Custom Styles', 'slideshow-plugin'); ?><!--</a>-->
22
+ </h2>
23
+
24
+ <form method="post" action="options.php">
25
+ <?php settings_fields(SlideshowPluginGeneralSettings::$settingsGroup); ?>
26
+
27
+ <!-- ==== ==== User capabilities ==== ==== -->
28
+ <table class="form-table user-capabilities">
29
+
30
+ <?php foreach($capabilities as $capability => $capabilityName): ?>
31
+
32
+ <tr valign="top">
33
+ <th><?php echo $capabilityName; ?></th>
34
+ <td>
35
+ <?php
36
+
37
+ if(isset($wp_roles->roles) && is_array($wp_roles->roles)):
38
+ foreach($wp_roles->roles as $roleSlug => $values):
39
+
40
+ $disabled = ($roleSlug == 'administrator') ? 'disabled="disabled"' : '';
41
+ $checked = ((isset($values['capabilities']) && array_key_exists($capability, $values['capabilities']) && $values['capabilities'][$capability] == true) || $roleSlug == 'administrator') ? 'checked="checked"' : '';
42
+ $name = (isset($values['name'])) ? htmlspecialchars($values['name']) : __('Untitled role', 'slideshow-plugin');
43
+
44
+ ?>
45
+
46
+ <input
47
+ type="checkbox"
48
+ name="<?php echo htmlspecialchars($capability); ?>[<?php echo htmlspecialchars($roleSlug); ?>]"
49
+ id="<?php echo htmlspecialchars($capability . '_' . $roleSlug); ?>"
50
+ <?php echo $disabled; ?>
51
+ <?php echo $checked; ?>
52
+ />
53
+ <label for="<?php echo htmlspecialchars($capability . '_' . $roleSlug); ?>"><?php echo $name; ?></label>
54
+ <br />
55
+
56
+ <?php endforeach; ?>
57
+ <?php endif; ?>
58
+
59
+ </td>
60
+ </tr>
61
+
62
+ <?php endforeach; ?>
63
+
64
+ </table>
65
+
66
+ <!-- ==== ==== Defaults slideshow settings ==== ==== -->
67
+ <table class="form-table default-slideshow-settings" style="display: none;">
68
+
69
+ </table>
70
+
71
+ <!-- ==== ==== Custom styles ==== ==== -->
72
+ <table class="form-table custom-styles" style="display: none;">
73
+
74
+ </table>
75
+
76
+ <?php submit_button(); ?>
77
+ </form>
78
+ </div>
views/SlideshowPluginPostType/settings.php CHANGED
@@ -22,7 +22,7 @@
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'); ?>: &#39;<?php echo (isset($value['options']))? $value['options'][$value['default']]: $value['default']; ?>&#39;</td>
27
  </tr>
28
 
22
  <?php echo !empty($value['dependsOn'])? 'style="display:none;"': ''; ?>
23
  >
24
  <td><?php echo $value['description']; ?></td>
25
+ <td><?php echo SlideshowPluginSlideshowSettingsHandler::getInputField(SlideshowPluginSlideshowSettingsHandler::$settingsKey, htmlspecialchars($key), $value); ?></td>
26
  <td><?php _e('Default', 'slideshow-plugin'); ?>: &#39;<?php echo (isset($value['options']))? $value['options'][$value['default']]: $value['default']; ?>&#39;</td>
27
  </tr>
28
 
views/SlideshowPluginPostType/slides.php CHANGED
@@ -31,7 +31,7 @@
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">
31
  $order = $slide['order'];
32
 
33
  // The name is used to prefix a setting name with
34
+ $name = SlideshowPluginSlideshowSettingsHandler::$slidesKey . '[' . $key . ']';
35
  ?>
36
 
37
  <li class="widefat sortable-slides-list-item">
views/SlideshowPluginPostType/style-settings.php CHANGED
@@ -7,7 +7,7 @@
7
  <?php //var_dump($value); ?>
8
  <tr <?php if(isset($value['dependsOn'])) echo 'style="display:none;"'; ?>>
9
  <td><?php echo $value['description']; ?></td>
10
- <td><?php echo SlideshowPluginSettingsHandler::getInputField(htmlspecialchars(SlideshowPluginSettingsHandler::$styleSettingsKey), $key, $value); ?></td>
11
  <td><?php _e('Default', 'slideshow-plugin'); ?>: &#39;<?php echo $value['default']; ?>&#39;</td>
12
  </tr>
13
 
7
  <?php //var_dump($value); ?>
8
  <tr <?php if(isset($value['dependsOn'])) echo 'style="display:none;"'; ?>>
9
  <td><?php echo $value['description']; ?></td>
10
+ <td><?php echo SlideshowPluginSlideshowSettingsHandler::getInputField(htmlspecialchars(SlideshowPluginSlideshowSettingsHandler::$styleSettingsKey), $key, $value); ?></td>
11
  <td><?php _e('Default', 'slideshow-plugin'); ?>: &#39;<?php echo $value['default']; ?>&#39;</td>
12
  </tr>
13