Slide Anything – Responsive Content / HTML Slider and Carousel - Version 2.4.0

Version Description

  • Updated all PHP code within the plugin to meet the WordPress.org security and coding standards.
Download this release

Release Info

Developer simonpedge
Plugin Icon 128x128 Slide Anything – Responsive Content / HTML Slider and Carousel
Version 2.4.0
Comparing to
See all releases

Code changes from version 2.3.47 to 2.4.0

css/slide-anything-admin.css CHANGED
@@ -63,6 +63,7 @@
63
  #sa_slider_settings .jquery_ui_slider {
64
  margin:0px 5px 5px !important;
65
  background-color:#007fff !important;
 
66
  border-radius:0px !important;
67
  }
68
  #sa_slider_settings .jquery_ui_slider .ui-slider-handle {
@@ -663,6 +664,12 @@ input.sa_slide_popup_imagetitle:-ms-input-placeholder { color:#c0c0c0 !important
663
  font-size:13px !important;
664
  line-height:26px !important;
665
  }
 
 
 
 
 
 
666
  .html_popup_wrapper .slide_popup_settings_line em,
667
  .html_popup_wrapper .slide_popup_settings_line strong {
668
  display: inline-block;
@@ -1339,6 +1346,12 @@ input.sa_slide_popup_imagetitle:-ms-input-placeholder { color:#c0c0c0 !important
1339
  font-weight:600;
1340
  line-height:18px;
1341
  }
 
 
 
 
 
 
1342
  #sa_thumbs_settings .sa_thumbs_line input[type=text] {
1343
  box-sizing:border-box !important;
1344
  height:auto !important;
63
  #sa_slider_settings .jquery_ui_slider {
64
  margin:0px 5px 5px !important;
65
  background-color:#007fff !important;
66
+ border-width:0px !important;
67
  border-radius:0px !important;
68
  }
69
  #sa_slider_settings .jquery_ui_slider .ui-slider-handle {
664
  font-size:13px !important;
665
  line-height:26px !important;
666
  }
667
+ .html_popup_wrapper .slide_popup_settings_line a span {
668
+ position:relative !important;
669
+ top:0px !important;
670
+ left:0px !important;
671
+ margin:-2px 0px 0px !important;
672
+ }
673
  .html_popup_wrapper .slide_popup_settings_line em,
674
  .html_popup_wrapper .slide_popup_settings_line strong {
675
  display: inline-block;
1346
  font-weight:600;
1347
  line-height:18px;
1348
  }
1349
+ #cpt_slider_thumbs .ui-spinner a.ui-button span {
1350
+ position:relative !important;
1351
+ top:0px !important;
1352
+ left:0px !important;
1353
+ margin:-2px 0px 0px !important;
1354
+ }
1355
  #sa_thumbs_settings .sa_thumbs_line input[type=text] {
1356
  box-sizing:border-box !important;
1357
  height:auto !important;
php/single-page.php CHANGED
@@ -1,22 +1,26 @@
1
- <?php
2
- /**
3
- * Template Name: Slide Anything Preview Page
4
- * This template will only display the page content (and no header, footer or sidebar)
5
- */
6
- ?>
7
- <!DOCTYPE html>
8
- <html <?php language_attributes(); ?>>
9
- <head>
10
- <meta charset="<?php bloginfo( 'charset' ); ?>">
 
 
 
11
  <meta name="viewport" content="width=device-width, initial-scale=1">
12
- <?php wp_head(); ?>
13
- </head>
14
- <body class="cleanpage">
15
- <?php
16
- while (have_posts()) : the_post();
17
- the_content();
18
- endwhile;
19
- ?>
20
- <?php wp_footer(); ?>
21
- </body>
22
- </html>
 
1
+ <?php
2
+ /**
3
+ * Template Name: Slide Anything Preview Page
4
+ * This template will only display the page content (and no header, footer or sidebar)
5
+ *
6
+ * @package WordPress_Slide_Anything
7
+ */
8
+
9
+ ?>
10
+ <!DOCTYPE html>
11
+ <html <?php language_attributes(); ?>>
12
+ <head>
13
+ <meta charset="<?php bloginfo( 'charset' ); ?>">
14
  <meta name="viewport" content="width=device-width, initial-scale=1">
15
+ <?php wp_head(); ?>
16
+ </head>
17
+ <body class="cleanpage">
18
+ <?php
19
+ while ( have_posts() ) :
20
+ the_post();
21
+ the_content();
22
+ endwhile;
23
+ ?>
24
+ <?php wp_footer(); ?>
25
+ </body>
26
+ </html>
php/slide-anything-admin.php CHANGED
@@ -1,3381 +1,3721 @@
1
- <?php
2
- // #####################################################################
3
- // ### SLIDE ANYTHING PLUGIN - PHP FUNCTIONS FOR WORDPRESS DASHBOARD ###
4
- // #####################################################################
5
-
6
- // ##### PLUGIN REGISTRATION HOOK - RUN WHEN THE PLUGIN IS ACTIVATED #####
7
- function cpt_slider_plugin_activation() {
8
- $sa_pro_version = validate_slide_anything_pro_registration();
9
-
10
- // INSERT A 'SAMPLE SLIDER' CUSTOM POST INTO THE DATABASE
11
- $sample_post_title = 'Sample Slider';
12
-
13
- // check if the 'sample slider' already exists (plugin has been activated before)
14
- $cpt_post = get_page_by_title($sample_post_title, 'OBJECT', 'sa_slider');
15
-
16
- if (is_null($cpt_post)) {
17
- // create the post object
18
- $sample_post = array(
19
- 'post_title' => $sample_post_title,
20
- 'post_content' => '',
21
- 'post_status' => 'publish',
22
- 'post_type' => 'sa_slider'
23
- );
24
- // insert the post into the database
25
- $cpt_id = wp_insert_post($sample_post);
26
-
27
- // insert meta data for the 'sample slider' slides
28
- for ($i = 1; $i <= 8; $i++) {
29
- if ($i == 1) {
30
- $color = "#f4cccc"; $image = "sample_logo1.png";
31
- } elseif ($i == 2) {
32
- $color = "#d9ead3"; $image = "sample_logo2.png";
33
- } elseif ($i == 3) {
34
- $color = "#fce5cd"; $image = "sample_logo3.png";
35
- } elseif ($i == 4) {
36
- $color = "#d0e0e3"; $image = "sample_logo4.png";
37
- } elseif ($i == 5) {
38
- $color = "#fff2cc"; $image = "sample_logo5.png";
39
- } elseif ($i == 6) {
40
- $color = "#cfe2f3"; $image = "sample_logo6.png";
41
- } elseif ($i == 7) {
42
- $color = "#d9d2e9"; $image = "sample_logo7.png";
43
- } elseif ($i == 8) {
44
- $color = "#ead1dc"; $image = "sample_logo8.png";
45
- }
46
- $content = "<div style='text-align: center; padding-bottom: 10px;'>\n";
47
- $content .= "<div><img src='".plugins_url()."/slide-anything/images/".$image."' alt='Logo ".$i."' /></div>\n";
48
- $content .= "<h3>Company Name</h3>\n";
49
- $content .= "<p>Lorem ipsum dolor sit amet, cu usu cibo vituperata, id ius probo maiestatis inciderint, sit eu vide volutpat.</p>\n";
50
- $content .= "</div>\n";
51
- update_post_meta($cpt_id, "sa_slide".$i."_content", $content);
52
- $image_data = "~left top~contain~no-repeat~".$color;
53
- update_post_meta($cpt_id, "sa_slide".$i."_image_data", $image_data);
54
- update_post_meta($cpt_id, "sa_slide".$i."_link_url", "");
55
- update_post_meta($cpt_id, "sa_slide".$i."_link_target", "_self");
56
- update_post_meta($cpt_id, "sa_slide".$i."_popup_type", "NONE");
57
- update_post_meta($cpt_id, "sa_slide".$i."_popup_imageid", "");
58
- update_post_meta($cpt_id, "sa_slide".$i."_popup_imagetitle", "");
59
- update_post_meta($cpt_id, "sa_slide".$i."_popup_video_id", "");
60
- update_post_meta($cpt_id, "sa_slide".$i."_popup_video_type", "");
61
- update_post_meta($cpt_id, "sa_slide".$i."_popup_background", "no");
62
- update_post_meta($cpt_id, "sa_slide".$i."_popup_html", "");
63
- update_post_meta($cpt_id, "sa_slide".$i."_popup_shortcode", "0");
64
- update_post_meta($cpt_id, "sa_slide".$i."_popup_bgcol", "#ffffff");
65
- update_post_meta($cpt_id, "sa_slide".$i."_popup_width", "600");
66
- }
67
- // insert meta data for the 'sample slider' configuration
68
- update_post_meta($cpt_id, 'sa_disable_visual_editor', '0');
69
- update_post_meta($cpt_id, 'sa_num_slides', 8);
70
- update_post_meta($cpt_id, 'sa_slide_duration', 4);
71
- update_post_meta($cpt_id, 'sa_slide_transition', 0.3);
72
- update_post_meta($cpt_id, 'sa_slide_by', 1);
73
- update_post_meta($cpt_id, 'sa_loop_slider', '1');
74
- update_post_meta($cpt_id, 'sa_stop_hover', '1');
75
- update_post_meta($cpt_id, 'sa_nav_arrows', '1');
76
- update_post_meta($cpt_id, 'sa_pagination', '1');
77
- update_post_meta($cpt_id, 'sa_shortcodes', '0');
78
- update_post_meta($cpt_id, 'sa_random_order', '1');
79
- update_post_meta($cpt_id, 'sa_reverse_order', '0');
80
- update_post_meta($cpt_id, 'sa_mouse_drag', '0');
81
- update_post_meta($cpt_id, 'sa_touch_drag', '1');
82
- update_post_meta($cpt_id, 'sa_mousewheel', '0');
83
- update_post_meta($cpt_id, 'sa_click_advance', '0');
84
- update_post_meta($cpt_id, 'sa_auto_height', '0');
85
- update_post_meta($cpt_id, 'sa_vert_center', '0');
86
- update_post_meta($cpt_id, 'sa_items_width1', 1);
87
- update_post_meta($cpt_id, 'sa_items_width2', 2);
88
- update_post_meta($cpt_id, 'sa_items_width3', 3);
89
- update_post_meta($cpt_id, 'sa_items_width4', 4);
90
- update_post_meta($cpt_id, 'sa_items_width5', 4);
91
- update_post_meta($cpt_id, 'sa_items_width6', 4);
92
- update_post_meta($cpt_id, 'sa_transition', 'fade');
93
- update_post_meta($cpt_id, 'sa_hero_slider', '0');
94
- update_post_meta($cpt_id, 'sa_showcase_slider', '0');
95
- update_post_meta($cpt_id, 'sa_showcase_width', '120');
96
- update_post_meta($cpt_id, 'sa_showcase_tablet', '1');
97
- update_post_meta($cpt_id, 'sa_showcase_width_tab', '130');
98
- update_post_meta($cpt_id, 'sa_showcase_mobile', '0');
99
- update_post_meta($cpt_id, 'sa_showcase_width_mob', '140');
100
- update_post_meta($cpt_id, 'sa_css_id', 'sample_slider');
101
- update_post_meta($cpt_id, 'sa_background_color', '#fafafa');
102
- update_post_meta($cpt_id, 'sa_border_width', 1);
103
- update_post_meta($cpt_id, 'sa_border_color', '#f0f0f0');
104
- update_post_meta($cpt_id, 'sa_border_radius', 5);
105
- update_post_meta($cpt_id, 'sa_wrapper_padd_top', 8);
106
- update_post_meta($cpt_id, 'sa_wrapper_padd_right', 8);
107
- update_post_meta($cpt_id, 'sa_wrapper_padd_bottom', 8);
108
- update_post_meta($cpt_id, 'sa_wrapper_padd_left', 8);
109
- update_post_meta($cpt_id, 'sa_slide_min_height_perc', 50);
110
- update_post_meta($cpt_id, 'sa_slide_padding_tb', 5);
111
- update_post_meta($cpt_id, 'sa_slide_padding_lr', 5);
112
- update_post_meta($cpt_id, 'sa_slide_margin_lr', 0);
113
- update_post_meta($cpt_id, 'sa_autohide_arrows', '1');
114
- update_post_meta($cpt_id, 'sa_dot_per_slide', '0');
115
- update_post_meta($cpt_id, 'sa_slide_icons_location', 'Center Center');
116
- update_post_meta($cpt_id, 'sa_slide_icons_visible', '0');
117
- update_post_meta($cpt_id, 'sa_slide_icons_color', 'white');
118
- update_post_meta($cpt_id, 'sa_thumbs_active', '0');
119
- update_post_meta($cpt_id, 'sa_thumbs_location', 'Inside Bottom');
120
- update_post_meta($cpt_id, 'sa_thumbs_image_size', 'thumbnail');
121
- update_post_meta($cpt_id, 'sa_thumbs_padding', 3);
122
- update_post_meta($cpt_id, 'sa_thumbs_width', 150);
123
- update_post_meta($cpt_id, 'sa_thumbs_height', 85);
124
- update_post_meta($cpt_id, 'sa_thumbs_opacity', 50);
125
- update_post_meta($cpt_id, 'sa_thumbs_border_width', 0);
126
- update_post_meta($cpt_id, 'sa_thumbs_border_color', '#ffffff');
127
- update_post_meta($cpt_id, 'sa_thumbs_resp_tablet', 75);
128
- update_post_meta($cpt_id, 'sa_thumbs_resp_mobile', 50);
129
- }
130
- }
131
-
132
- // SLIDE ANYTHING PRO NOTICE
133
- function version_20_upgrade_notice() {
134
- global $current_user ;
135
- $user_id = $current_user->ID;
136
- $sa_pro_version = validate_slide_anything_pro_registration();
137
-
138
- if (!$sa_pro_version) {
139
- if (current_user_can('administrator')) {
140
- /* Check that the user hasn't already clicked to ignore the message */
141
- if (!get_user_meta($user_id, 'sa_ignore_notice')) {
142
- echo "<div class='notice notice-info' style='padding-top:10px;'>";
143
-
144
- echo "<div style='float:left; width:170px; margin-right:15px;'><a href='https://edgewebpages.com/' target='_blank'>";
145
- echo "<img style='width:100%;' src='".get_site_url()."/wp-content/plugins/slide-anything/images/slide_anything_pro_product_image.png' /></a></div>";
146
- echo "<h3 style='margin:0px !important; padding:10px 0px !important;'>SLIDE ANYTHING PRO</h3>";
147
- echo "<p style='margin:0px 0px 10px !important;'><strong>SLIDE ANYTHING PRO</strong> adds POPUPS into the mix!!";
148
- echo "<br/><strong>SLIDE ANYTHING PRO</strong> also adds Hero Sliders & Thumbnail Pagination!!";
149
- echo "<br/><strong>SLIDE ANYTHING PRO</strong> allows you to create Showcase Carousels!!</p>";
150
-
151
- echo "<p style='margin:0px 0px 10px !important;'>With <a href='https://edgewebpages.com/' target='_blank'>SLIDE ANYTHING PRO</a> ";
152
- echo "each slide can now open a MODAL POPUP, which can be an IMAGE popup, a VIDEO EMBED popup (YouTube/Vimeo), a popup ";
153
- echo "containing HTML CODE or a popup displaying a WordPress SHORTCODE. This can be a very useful addition to ";
154
- echo "Slide Anything, if you are wanting to create Image or Video galleries for your websites.</p>";
155
-
156
- echo "<p style='margin:0px 0px 10px !important;'>With <a href='https://edgewebpages.com/' target='_blank'>SLIDE ANYTHING PRO</a> ";
157
- echo "you can now create a HERO SLIDER, which is a slider that always is 100% of the width/height of the device it's ";
158
- echo "being viewed on. You can now also add THUMBNAIL PAGINATION to your sliders. Thumbnail Pagination are small ";
159
- echo "clickable thumbnail images, with each thumbnail representing a single slide which can be clicked in order to ";
160
- echo "navigate to.</p>";
161
-
162
- echo "<p style='margin:0px 0px 10px !important;'>With <a href='https://edgewebpages.com/' target='_blank'>SLIDE ANYTHING PRO</a> ";
163
- echo "you can also create a SHOWCASE CAROUSEL, which has a container width that exceeds the screen/window width. ";
164
- echo "The leftmost/rightmost visible slides therefore become partially visible.</p>";
165
-
166
- echo "<p style='margin:0px !important;'>For more information, click on the DEMO links below:</p>";
167
- echo "<p style='margin:0px !important;'>";
168
- echo "<a href='https://edgewebpages.com/' target='_blank'>MODAL POPUPS DEMO</a>&nbsp;&nbsp;|&nbsp;&nbsp;";
169
- echo "<a href='https://edgewebpages.com/hero-slider-with-thumbnails/' target='_blank'>HERO SLIDER WITH THUMBNAILS</a>&nbsp;&nbsp;|&nbsp;&nbsp;";
170
- echo "<a href='https://edgewebpages.com/showcase-carousel-demo/' target='_blank'>SHOWCASE CAROUSEL</a></p>";
171
-
172
- echo "<div style='clear:both; float:none; width:100%; height:10px;'></div>";
173
- echo "<a style='display:inline-block; float:right; padding:7px 10px; background:crimson; color:white; text-decoration:none; ";
174
- echo "border-radius:5px; font-size:16px;' href='".get_site_url()."/wp-admin/edit.php?post_type=sa_slider&sa_nag_ignore=0'>Hide this notice</a>";
175
- echo "<div style='clear:both; float:none; width:100%; height:10px;'></div>";
176
-
177
- echo "</div>";
178
- }
179
- }
180
- }
181
- }
182
- function slide_anything_notice_ignore() {
183
- global $current_user;
184
- $user_id = $current_user->ID;
185
- // If user clicks to ignore the Slide Anything PRO notice, add that to their user meta
186
- if (isset($_GET['sa_nag_ignore']) && ($_GET['sa_nag_ignore'] == '0')) {
187
- add_user_meta($user_id, 'sa_ignore_notice', 'true', true);
188
- }
189
- // If user clicks to ignore the Slide Any Post notice, add that to their user meta
190
- if (isset($_GET['sapost_ignore']) && ($_GET['sapost_ignore'] == '0')) {
191
- add_user_meta($user_id, 'sa_ignore_sapost_notice', 'true', true);
192
- }
193
- }
194
-
195
- // ADD A CHECKBOX OPTION UNDER "Settings -> Writing" CALLED "Disable TinyMCE Button"
196
- function slide_anything_disable_tinymce_button_setting() {
197
- // REGISTER WORDPRESS SETTING
198
- register_setting(
199
- 'writing',
200
- 'sa-disable-tinymce-button',
201
- 'sa_settings_sanitize'
202
- );
203
- // CREATE SETTINGS SECTION (within "Settings->Writing")
204
- add_settings_section(
205
- 'sa-writing-settings-section',
206
- 'Slide Anything Settings',
207
- 'sa_writing_settings_section_description',
208
- 'writing'
209
- );
210
- // CREATE SETTINGS INPUT FIELD
211
- add_settings_field(
212
- 'sa-settings-field1',
213
- 'Disable TinyMCE Button',
214
- 'sa_settings_field1_callback',
215
- 'writing',
216
- 'sa-writing-settings-section'
217
- );
218
- }
219
- // SANATIZE SETTINGS CALLBACK FUNCTION
220
- function sa_settings_sanitize($input) {
221
- return isset($input) ? true : false;
222
- }
223
- // SETTING SECTION DESCRIPTION
224
- function sa_writing_settings_section_description(){
225
- echo wpautop("Disable the 'Slide Anything Sliders' button within the toolbar of the WordPress Classic Editor when editing pages and posts.");
226
- }
227
- // SETTINGS INPUT FIELD CALLBACK
228
- function sa_settings_field1_callback(){
229
- ?>
230
- <label for="sa-disable-tinymce-input">
231
- <input id="sa-disable-tinymce-input" type="checkbox" value="1" name="sa-disable-tinymce-button" <?php checked(get_option('sa-disable-tinymce-button', false)); ?>>
232
- </label>
233
- <?php
234
- }
235
-
236
- /* ##### ACTION HOOK - REGISTER SCRIPTS (JS AND CSS) FOR WORDPRESS DASHBOARD ONLY ##### */
237
- function cpt_register_admin_scripts() {
238
- $sa_pro_version = validate_slide_anything_pro_registration();
239
- $screen = get_current_screen();
240
- if ($screen->post_type == 'sa_slider') {
241
- // ONLY LOAD SCRIPTS (JS & CSS) WITHIN 'Slide Anything' SCREENS IN WORDPRESS DASHBOARD
242
- // enqueues all scripts, styles & settings required in order to use the WordPress Media JS APIs
243
- wp_enqueue_media();
244
- // load 'wordpress jquery-ui' scripts
245
- wp_enqueue_script( 'jquery-ui-core' );
246
- wp_enqueue_script( 'jquery-ui-accordion' );
247
- wp_enqueue_script( 'jquery-ui-tabs' );
248
- wp_enqueue_script( 'jquery-ui-slider' );
249
- wp_enqueue_script( 'jquery-ui-sortable' );
250
- wp_enqueue_script( 'jquery-ui-draggable' );
251
- wp_enqueue_script( 'jquery-ui-droppable' );
252
- wp_enqueue_script( 'jquery-ui-resize' );
253
- wp_enqueue_script( 'jquery-ui-dialog' );
254
- wp_enqueue_script( 'jquery-ui-button' );
255
- wp_enqueue_script( 'jquery-ui-tooltip' );
256
- wp_enqueue_script( 'jquery-ui-spinner' );
257
- // load 'spectrum colorpicker' script and css
258
- wp_register_script('spectrum_js', SA_PLUGIN_PATH.'spectrum/spectrum.js', array('jquery'));
259
- wp_enqueue_script('spectrum_js');
260
- wp_register_style('spectrum_css', SA_PLUGIN_PATH.'spectrum/spectrum.css');
261
- wp_enqueue_style('spectrum_css');
262
- // load 'jquery-ui' css
263
- wp_register_style('admin_ui_css', SA_PLUGIN_PATH.'css/admin-user-interface.min.css');
264
- wp_enqueue_style('admin_ui_css');
265
- // load 'slide-anything' custom javasript and css for wordpress admin
266
- wp_register_script('sa-slider-admin-script', SA_PLUGIN_PATH.'js/slide-anything-admin.js', array( 'jquery' ));
267
- wp_enqueue_script('sa-slider-admin-script');
268
- wp_register_style('sa-slider-admin-css', SA_PLUGIN_PATH.'css/slide-anything-admin.css', array(), '2.0', 'all');
269
- wp_enqueue_style('sa-slider-admin-css');
270
- if ($sa_pro_version) {
271
- // load 'magnific popup' script and css
272
- wp_register_script('magnific-popup_js', SA_PLUGIN_PATH.'magnific-popup/jquery.magnific-popup.min.js', array('jquery'));
273
- wp_enqueue_script('magnific-popup_js');
274
- wp_register_style('magnific-popup_css', SA_PLUGIN_PATH.'magnific-popup/magnific-popup.css');
275
- wp_enqueue_style('magnific-popup_css');
276
- }
277
- // DISABLE AUTOSAVE FOR THIS CUSTOM POST TYPE (causes issues with preview modal popup)
278
- wp_dequeue_script('autosave');
279
- }
280
- if ($screen->id == 'settings_page_sa-settings-page') {
281
- // SLIDE ANYTHING SETTINGS PAGE - load custom css script
282
- wp_register_style('sa-slider-admin-css', SA_PLUGIN_PATH.'css/slide-anything-admin.css');
283
- wp_enqueue_style('sa-slider-admin-css');
284
- }
285
- // style for TINYMCE editor 'Slide Anything sliders' button
286
- wp_register_style('tinymce-css', SA_PLUGIN_PATH.'css/tinymce_style.css');
287
- wp_enqueue_style('tinymce-css');
288
- }
289
-
290
-
291
-
292
- // ##### ACTION HOOK - REGISTER THE 'Slide Anything' CUSTOM POST TYPE #####
293
- function cpt_slider_register() {
294
- $labels = array(
295
- 'name' => _x('SA Sliders', 'post type general name', 'sa_slider_textdomain'),
296
- 'singular_name' => _x('Slider', 'post type singular name', 'sa_slider_textdomain'),
297
- 'menu_name' => __('SA Sliders', 'sa_slider_textdomain'),
298
- 'add_new' => __('Add New Slider', 'sa_slider_textdomain'),
299
- 'add_new_item' => __('Add New Slider', 'sa_slider_textdomain'),
300
- 'edit_item' => __('Edit Slider', 'sa_slider_textdomain'),
301
- 'new_item' => __('New Slider', 'sa_slider_textdomain'),
302
- 'view_item' => __('View Slider', 'sa_slider_textdomain'),
303
- 'not_found' => __('No sliders found', 'sa_slider_textdomain'),
304
- 'not_found_in_trash' => __('No sliders found in Trash', 'sa_slider_textdomain'),
305
- );
306
- $args = array(
307
- 'labels' => $labels,
308
- 'description' => __('Slide Anything carousel/slider', 'sa_slider_textdomain'),
309
- 'public' => false,
310
- 'exclude_from_search' => true,
311
- 'publicly_queryable' => false,
312
- 'show_ui' => true,
313
- 'show_in_nav_menus' => false,
314
- 'show_in_menu' => true,
315
- 'menu_position' => 10,
316
- 'menu_icon' => 'dashicons-images-alt2',
317
- 'hierarchical' => false,
318
- 'supports' => array('title'),
319
- 'has_archive' => false,
320
- 'query_var' => false,
321
- 'can_export' => true,
322
- 'rewrite' => true,
323
- 'capability_type' => 'post'
324
- );
325
- register_post_type('sa_slider', $args);
326
- }
327
-
328
-
329
-
330
- // ##### WP DASHBOARD - SLIDER LIST PAGE #####
331
- // ACTION HOOK - ADD/REMOVE (HOVER-OVER) ROW ACTIONS WHEN THIS CUSTOM POST TYPE IS LISTED IN DASHBOARD
332
- function cpt_slider_row_actions($actions, $post) {
333
- if ($post->post_type == 'sa_slider') {
334
- // REMOVE 'Quick Edit' ROW ACTION
335
- unset($actions['inline hide-if-no-js']);
336
- }
337
- return $actions;
338
- }
339
- // FILTER TO ADD/REMOVE COLUMNS DISPLAYED FOR THIS CUSTOM POST TYPE WITHIN THE DASHBOARD
340
- function cpt_slider_modify_columns($columns) {
341
- // new columns to be added
342
- $new_columns = array(
343
- 'slides' => 'Slides',
344
- 'shortcode' => 'Shortcode',
345
- 'css-id' => 'CSS ID'
346
- );
347
- $columns = array_slice($columns, 0, 2, true) + $new_columns + array_slice($columns, 2, NULL, true);
348
- return $columns;
349
- }
350
- // DEFINE OUTPUT FOR EACH CUSTOM COLUMN DISPLAYED FOR THIS CUSTOM POST TYPE WITHIN THE DASHBOARD
351
- function cpt_slider_custom_column_content($column) {
352
- // get post object for this row
353
- global $post;
354
-
355
- // output for the 'Slides' column
356
- if ($column == 'slides') {
357
- $num_slides = get_post_meta($post->ID, 'sa_num_slides', true);
358
- if ($num_slides == '') {
359
- $num_slides = '-';
360
- }
361
- echo esc_html($num_slides);
362
- }
363
-
364
- // output for the 'Shortcode' column
365
- if ($column == 'shortcode') {
366
- $shortcode = "[slide-anything id='".$post->ID."']";
367
- echo esc_html($shortcode);
368
- }
369
-
370
- // output for the 'CSS ID' column
371
- if ($column == 'css-id') {
372
- $css_id = get_post_meta($post->ID, 'sa_css_id', true);
373
- if ($css_id == '') {
374
- $css_id = '-';
375
- } else {
376
- $css_id = "#".$css_id;
377
- }
378
- echo esc_html($css_id);
379
- }
380
- }
381
-
382
-
383
-
384
- // ##### ADD A CUSTOM BUTTON TO WORDPRESS TINYMCE EDITOR (ON PAGES AND POSTS ONLY) #####
385
- function add_tinymce_button() {
386
- global $typenow;
387
- // check user permissions
388
- if (!current_user_can('edit_posts') && !current_user_can('edit_pages')) {
389
- return;
390
- }
391
- // verify the post type - only display button on posts and pages
392
- if (!in_array($typenow, array('post', 'page'))) {
393
- return;
394
- }
395
- // check if WYSIWYG is enabled
396
- if (get_user_option('rich_editing') == 'true') {
397
- add_filter('mce_external_plugins', 'add_tinymce_plugin');
398
- add_filter('mce_buttons', 'register_tinymce_button');
399
- }
400
- }
401
- function add_tinymce_plugin($plugin_array) {
402
- $plugin_array['tinymce_button'] = SA_PLUGIN_PATH.'js/add_tinymce_button.js';
403
- return $plugin_array;
404
- }
405
- function register_tinymce_button($buttons) {
406
- array_push($buttons, 'tinymce_button');
407
- return $buttons;
408
- }
409
- function get_tinymce_shortcode_array() {
410
- $screen = get_current_screen();
411
- if ($screen->post_type != 'envira') { // ### BUG FIX - CLASHING WITH ENVIRA GALLERY (VER 2.0.13) ###
412
- // display 2 javascript arrays (in footer) containing all the slide anything post titles and post ids
413
- // these 2 arrays are used to display the shortcode options by the TinyMCE button
414
- echo "<script type='text/javascript'>\n";
415
- echo "var sa_title_arr = new Array();\n";
416
- echo "var sa_id_arr = new Array();\n";
417
-
418
- $args = array('post_type' => 'sa_slider', 'post_status' => 'publish', 'posts_per_page' => -1);
419
- $sa_slider_query = new WP_Query($args);
420
- $count = 0;
421
- foreach ($sa_slider_query->posts as $sa_post) {
422
- $title = $sa_post->post_title;
423
- echo "sa_title_arr[".$count."] = '".$title."';\n";
424
- echo "sa_id_arr[".$count."] = '".$sa_post->ID."';\n";
425
- $count++;
426
- }
427
- echo "</script>\n";
428
- }
429
- }
430
-
431
-
432
-
433
- // ##### ACTION HOOK - ADD META BOXES TO THE 'Slide Anything' CUSTOM POST TYPE #####
434
- function cpt_slider_add_meta_boxes() {
435
- global $post;
436
- global $current_user;
437
- if (!is_object($post)) {
438
- return;
439
- }
440
-
441
- $info_added = get_post_meta($post->ID, 'sa_info_added', true);
442
- $info_deleted = get_post_meta($post->ID, 'sa_info_deleted', true);
443
- $info_duplicated = get_post_meta($post->ID, 'sa_info_duplicated', true);
444
- $info_moved = get_post_meta($post->ID, 'sa_info_moved', true);
445
- if ($info_added == '1') {
446
- add_meta_box('cpt_slide_added', __('Information'), 'cpt_slide_added_content', 'sa_slider', 'normal', 'high');
447
- update_post_meta($post->ID, 'sa_info_added', '0');
448
- }
449
- if ($info_deleted == '1') {
450
- add_meta_box('cpt_slide_deleted', __('Information'), 'cpt_slide_deleted_content', 'sa_slider', 'normal', 'high');
451
- update_post_meta($post->ID, 'sa_info_deleted', '0');
452
- }
453
- if ($info_duplicated == '1') {
454
- add_meta_box('cpt_slide_duplicated', __('Information'), 'cpt_slide_duplicated_content', 'sa_slider', 'normal', 'high');
455
- update_post_meta($post->ID, 'sa_info_duplicated', '0');
456
- }
457
- if ($info_moved == '1') {
458
- add_meta_box('cpt_slide_moved', __('Information'), 'cpt_slide_moved_content', 'sa_slider', 'normal', 'high');
459
- update_post_meta($post->ID, 'sa_info_moved', '0');
460
- }
461
- add_meta_box('cpt_slider_settings', __('Slider Settings'), 'cpt_slider_settings_content', 'sa_slider', 'normal', 'high');
462
- add_meta_box('cpt_slider_slides', __('Slides'), 'cpt_slider_slides_content', 'sa_slider', 'normal', 'high');
463
- add_meta_box('cpt_slider_shortcode', __('Shortcode / Preview'), 'cpt_slider_shortcode_content', 'sa_slider', 'side', 'high');
464
- add_meta_box('cpt_slider_items', __('Items Displayed'), 'cpt_slider_items_content', 'sa_slider', 'side', 'default');
465
- add_meta_box('cpt_slider_style', __('Slider Style'), 'cpt_slider_style_content', 'sa_slider', 'side', 'default');
466
- add_meta_box('cpt_slider_thumbs', __('Thumbnail Pagination'), 'cpt_slider_thumbs_content', 'sa_slider', 'side', 'default');
467
- remove_meta_box( 'mymetabox_revslider_0', 'sa_slider', 'normal' ); // remove revolution slider meta box
468
- // ### SLIDE ANY POST PROMOTIONAL META BOX ###
469
- $sa_pro_version = validate_slide_anything_pro_registration();
470
- if (!$sa_pro_version) {
471
- $user_id = $current_user->ID;
472
- //delete_user_meta($user_id, 'sa_ignore_sapost_notice', 'true'); // FOR TESTING ONLY!!!
473
- if (!get_user_meta($user_id, 'sa_ignore_sapost_notice')) {
474
- add_meta_box('cpt_slide_any_post', __('Slide Any Post Plugin - Just Launched!'), 'cpt_slide_any_post_content', 'sa_slider', 'normal', 'default');
475
- }
476
- }
477
- }
478
-
479
-
480
-
481
- // ##### META BOX CONTENT - 'Information' (slide added) BOX #####
482
- function cpt_slide_added_content() {
483
- echo "<h3 id='sa_slide_added_mess'>A new slide has been added to this slider.</h3>";
484
- }
485
-
486
-
487
-
488
- // ##### META BOX CONTENT - 'Information' (slide deleted) BOX #####
489
- function cpt_slide_deleted_content() {
490
- echo "<h3 id='sa_slide_deleted_mess'>A slide has been deleted from this slider.</h3>";
491
- }
492
-
493
-
494
-
495
- // ##### META BOX CONTENT - 'Information' (slide duplicated) BOX #####
496
- function cpt_slide_duplicated_content() {
497
- echo "<h3 id='sa_slide_duplicated_mess'>A slide has been duplicated (copied) within this slider.</h3>";
498
- }
499
-
500
-
501
-
502
- // ##### META BOX CONTENT - 'Information' (slide moved) BOX #####
503
- function cpt_slide_moved_content() {
504
- echo "<h3 id='sa_slide_moved_mess'>The slide order of this slider has been has changed.</h3>";
505
- }
506
-
507
-
508
-
509
- // ##### META BOX CONTENT - 'Slider Settings' BOX #####
510
- function cpt_slider_settings_content($post) {
511
- $num_slides = get_post_meta($post->ID, 'sa_num_slides', true);
512
- $sa_pro_version = validate_slide_anything_pro_registration();
513
- echo "<div id='sa_slider_settings'>\n";
514
- // NONCE TO PREVENT CSRF SECURITY ATTACKS
515
- wp_nonce_field(basename(__FILE__), 'nonce_save_slider');
516
-
517
- // HIDDEN FIELD - NUMBER OF SLIDES
518
- if ($num_slides == '') {
519
- // new slider is being created
520
- echo "<input type='hidden' id='num_slides_id' name='sa_num_slides' value='3'/>\n";
521
- } else {
522
- // existing slider
523
- $num_slides = intval($num_slides);
524
- echo "<input type='hidden' id='num_slides_id' name='sa_num_slides' value='".esc_attr($num_slides)."'/>\n";
525
- }
526
- // HIDDEN FIELD - SLIDE ADDED INDICATOR
527
- echo "<input type='hidden' id='sa_info_added' name='sa_info_added' value='0'/>\n";
528
- // HIDDEN FIELD - SLIDE DELETED INDICATOR
529
- echo "<input type='hidden' id='sa_info_deleted' name='sa_info_deleted' value='0'/>\n";
530
- // HIDDEN FIELD - SLIDE DUPLICATED INDICATOR
531
- echo "<input type='hidden' id='sa_info_duplicated' name='sa_info_duplicated' value='0'/>\n";
532
- // HIDDEN FIELD - SLIDE MOVED UP INDICATOR
533
- echo "<input type='hidden' id='sa_info_moved' name='sa_info_moved' value='0'/>\n";
534
- // HIDDEN FIELD - DUPLICATE SLIDE NUMBER
535
- echo "<input type='hidden' id='sa_duplicate_slide' name='sa_duplicate_slide' value='0'/>\n";
536
- // HIDDEN FIELD - MOVE SLIDE UP (SLIDE NUMBER)
537
- echo "<input type='hidden' id='sa_move_slide_up' name='sa_move_slide_up' value='0'/>\n";
538
- // HIDDEN FIELD - PRO VERSION
539
- if ($sa_pro_version) {
540
- echo "<input type='hidden' id='sa_pro_version' name='sa_pro_version' value='1'/>\n";
541
- } else {
542
- echo "<input type='hidden' id='sa_pro_version' name='sa_pro_version' value='0'/>\n";
543
- }
544
- // SLIDE DURATION
545
- $slide_duration = get_post_meta($post->ID, 'sa_slide_duration', true);
546
- if ($slide_duration == '') {
547
- $slide_duration = 5;
548
- }
549
- echo "<div class='sa_slider_value'><span>Slide Duration:</span>";
550
- echo "<input type='text' id='sa_slide_duration' name='sa_slide_duration' readonly value='".esc_attr($slide_duration)."'><em>seconds (0 = manual navigation)</em>";
551
- echo "<em class='sa_tooltip' href='' title='Set to 0 to disable slider autoplay (manual slider navigation only)'></em></div>\n";
552
- echo "<div class='jquery_ui_slider' id='jq_slider_duration'></div><hr/>\n";
553
- // SLIDE TRANSITION
554
- $slide_transition = get_post_meta($post->ID, 'sa_slide_transition', true);
555
- if ($slide_transition == '') {
556
- $slide_transition = 0.2;
557
- }
558
- echo "<div class='sa_slider_value'><span>Slide Transition:</span>";
559
- echo "<input type='text' id='sa_slide_transition' name='sa_slide_transition' readonly value='".esc_attr($slide_transition)."'><em>seconds</em>\n";
560
- echo "<em class='sa_tooltip' href='' title='The time it takes to change from one slide to the next slide'></em></div>\n";
561
- echo "<div class='jquery_ui_slider' id='jq_slider_transition'></div><hr/>\n";
562
- // SLIDE BY
563
- $slide_by = get_post_meta($post->ID, 'sa_slide_by', true);
564
- if ($slide_by == '') {
565
- $slide_by = 1;
566
- }
567
- echo "<div class='sa_slider_value'><span>Slide By:</span>";
568
- echo "<input type='text' id='sa_slide_by' name='sa_slide_by' readonly value='".esc_attr($slide_by)."'><em>slides (0 = slide by page)</em>";
569
- echo "<em class='sa_tooltip' href='' title='The number of slides to slide per transition. Set to 0 to enable the Slide by Page option.'></em></div>\n";
570
- echo "<div class='jquery_ui_slider' id='jq_slider_by'></div><hr/>\n";
571
- echo "<div class='half_width_column'>\n";
572
- // LOOP SLIDER
573
- $loop_slider = get_post_meta($post->ID, 'sa_loop_slider', true);
574
- if ($loop_slider == '') {
575
- $loop_slider = '1';
576
- }
577
- echo "<div class='sa_setting_checkbox'><span>Loop Slider:</span>";
578
- if ($loop_slider == '1') {
579
- echo "<input type='checkbox' id='sa_loop_slider' name='sa_loop_slider' value='1' checked/>";
580
- } else {
581
- echo "<input type='checkbox' id='sa_loop_slider' name='sa_loop_slider' value='1'/>";
582
- }
583
- echo "<em class='sa_tooltip' href='' title='Only applies when slide duration is NOT zero (loops back to first slide after last slide is displayed)'></em>";
584
- echo "</div>\n";
585
- // STOP ON HOVER
586
- $stop_hover = get_post_meta($post->ID, 'sa_stop_hover', true);
587
- if ($stop_hover == '') {
588
- $stop_hover = '1';
589
- }
590
- echo "<div class='sa_setting_checkbox'><span>Stop on Hover:</span>";
591
- if ($stop_hover == '1') {
592
- echo "<input type='checkbox' id='sa_stop_hover' name='sa_stop_hover' value='1' checked/>";
593
- } else {
594
- echo "<input type='checkbox' id='sa_stop_hover' name='sa_stop_hover' value='1'/>";
595
- }
596
- echo "<em class='sa_tooltip' href='' title='Only applies when slide duration is NOT zero (slideshow is paused when hovering over a slide)'></em>";
597
- echo "</div>\n";
598
- // RANDOM ORDER
599
- $random_order = get_post_meta($post->ID, 'sa_random_order', true);
600
- if ($random_order == '') {
601
- $random_order = '0';
602
- }
603
- echo "<div class='sa_setting_checkbox'><span>Random Order:</span>";
604
- if ($random_order == '1') {
605
- echo "<input type='checkbox' id='sa_random_order' name='sa_random_order' value='1' checked/>";
606
- } else {
607
- echo "<input type='checkbox' id='sa_random_order' name='sa_random_order' value='1'/>";
608
- }
609
- echo "<em class='sa_tooltip' title='When checked slides will be randomly re-ordered whenever the slider is displayed'></em>";
610
- echo "</div>\n";
611
- // REVERSE ORDER
612
- $reverse_order = get_post_meta($post->ID, 'sa_reverse_order', true);
613
- if ($reverse_order == '') {
614
- $reverse_order = '0';
615
- }
616
- echo "<div class='sa_setting_checkbox'><span>Reverse Order:</span>";
617
- if ($reverse_order == '1') {
618
- echo "<input type='checkbox' id='sa_reverse_order' name='sa_reverse_order' value='1' checked/>";
619
- } else {
620
- echo "<input type='checkbox' id='sa_reverse_order' name='sa_reverse_order' value='1'/>";
621
- }
622
- echo "<em class='sa_tooltip' title='When checked your slides will be shown in the reverse order (i.e. last slide first)'></em>";
623
- echo "</div>\n";
624
- // ALLOW SHORTCODES
625
- $shortcodes = get_post_meta($post->ID, 'sa_shortcodes', true);
626
- if ($shortcodes == '') {
627
- $shortcodes = '0';
628
- }
629
- echo "<div class='sa_setting_checkbox'><span>Allow Shortcodes:</span>";
630
- if ($shortcodes == '1') {
631
- echo "<input type='checkbox' id='sa_shortcodes' name='sa_shortcodes' value='1' checked/>";
632
- } else {
633
- echo "<input type='checkbox' id='sa_shortcodes' name='sa_shortcodes' value='1'/>";
634
- }
635
- echo "<em class='sa_tooltip' href='' title='Include WordPree shorcodes within slide content. NOTE: Running shortcodes in Slide Anything may cause issues with some Wordpress Page Builders'></em>\n";
636
- echo "</div>\n";
637
- // VERTICAL CENTER
638
- $vert_center = get_post_meta($post->ID, 'sa_vert_center', true);
639
- if ($vert_center == '') {
640
- $vert_center = '0';
641
- }
642
- echo "<div class='sa_setting_checkbox'><span>Vertical Center:</span>";
643
- if ($vert_center == '1') {
644
- echo "<input type='checkbox' id='sa_vert_center' name='sa_vert_center' value='1' checked/>";
645
- } else {
646
- echo "<input type='checkbox' id='sa_vert_center' name='sa_vert_center' value='1'/>";
647
- }
648
- echo "<em class='sa_tooltip' title='Vertically center content within slides. Only use this setting if you have set a Min Height for your slider (which sets a minimum height for each slide).'></em>";
649
- echo "</div>\n";
650
- echo "</div>\n";
651
- echo "<div class='half_width_column'>\n";
652
- // NAVIGATE ARROWS
653
- $nav_arrows = get_post_meta($post->ID, 'sa_nav_arrows', true);
654
- if ($nav_arrows == '') {
655
- $nav_arrows = '1';
656
- }
657
- echo "<div class='sa_setting_checkbox'><span>Navigate Arrows:</span>";
658
- if ($nav_arrows == '1') {
659
- echo "<input type='checkbox' id='sa_nav_arrows' name='sa_nav_arrows' value='1' checked/>";
660
- } else {
661
- echo "<input type='checkbox' id='sa_nav_arrows' name='sa_nav_arrows' value='1'/>";
662
- }
663
- echo "<em class='sa_tooltip' href='' title='Display the \"next slide\" amd \"previous slide\" buttons'></em>\n";
664
- echo "</div>\n";
665
- // SHOW PAGINATION
666
- $pagination = get_post_meta($post->ID, 'sa_pagination', true);
667
- if ($pagination == '') {
668
- $pagination = '1';
669
- }
670
- echo "<div class='sa_setting_checkbox'><span>Show Pagination:</span>";
671
- if ($pagination == '1') {
672
- echo "<input type='checkbox' id='sa_pagination' name='sa_pagination' value='1' checked/>";
673
- } else {
674
- echo "<input type='checkbox' id='sa_pagination' name='sa_pagination' value='1'/>";
675
- }
676
- echo "<em class='sa_tooltip' href='' title='Display slider pagination below the slider'></em>\n";
677
- echo "</div>\n";
678
-
679
- // MOUSE DRAG
680
- $mouse_drag = get_post_meta($post->ID, 'sa_mouse_drag', true);
681
- if ($mouse_drag == '') {
682
- $mouse_drag = '0';
683
- }
684
- echo "<div class='sa_setting_checkbox'><span>Mouse Drag:</span>";
685
- if ($mouse_drag == '1') {
686
- echo "<input type='checkbox' id='sa_mouse_drag' name='sa_mouse_drag' value='1' checked/>";
687
- } else {
688
- echo "<input type='checkbox' id='sa_mouse_drag' name='sa_mouse_drag' value='1'/>";
689
- }
690
- echo "<em class='sa_tooltip' href='' title='Allow navigation to previous/next slides by holding down left mouse button and dragging left/right. (NOTE: Enabling this option will disable vertical touch-drag scrolling on mobile devices)'></em>\n";
691
- echo "</div>\n";
692
- // TOUCH DRAG
693
- $touch_drag = get_post_meta($post->ID, 'sa_touch_drag', true);
694
- if ($touch_drag == '') {
695
- $touch_drag = '1';
696
- }
697
- echo "<div class='sa_setting_checkbox'><span>Touch Drag:</span>";
698
- if ($touch_drag == '1') {
699
- echo "<input type='checkbox' id='sa_touch_drag' name='sa_touch_drag' value='1' checked/>";
700
- } else {
701
- echo "<input type='checkbox' id='sa_touch_drag' name='sa_touch_drag' value='1'/>";
702
- }
703
- echo "<em class='sa_tooltip' href='' title='Allow navigation to previous/next slides on mobile devices by touching screen and dragging left/right'></em>\n";
704
- echo "</div>\n";
705
- // MOUSEWHEEL NAV
706
- $mousewheel = get_post_meta($post->ID, 'sa_mousewheel', true);
707
- if ($mousewheel == '') {
708
- $mousewheel = '0';
709
- }
710
- echo "<div class='sa_setting_checkbox'><span>Mousewheel Nav:</span>";
711
- if ($mousewheel == '1') {
712
- echo "<input type='checkbox' id='sa_mousewheel' name='sa_mousewheel' value='1' checked/>";
713
- } else {
714
- echo "<input type='checkbox' id='sa_mousewheel' name='sa_mousewheel' value='1'/>";
715
- }
716
- echo "<em class='sa_tooltip' href='' title='Allow previous/next slide navigation using the mousewheel (NOTE: does not work well with the Apple Mac touchpad scroll wheel mimic)'></em>\n";
717
- echo "</div>\n";
718
- // CLICK TO ADVANCE
719
- $click_advance = get_post_meta($post->ID, 'sa_click_advance', true);
720
- if ($click_advance == '') {
721
- $click_advance = '0';
722
- }
723
- echo "<div class='sa_setting_checkbox'><span>Click to Advance:</span>";
724
- if ($click_advance == '1') {
725
- echo "<input type='checkbox' id='sa_click_advance' name='sa_click_advance' value='1' checked/>";
726
- } else {
727
- echo "<input type='checkbox' id='sa_click_advance' name='sa_click_advance' value='1'/>";
728
- }
729
- echo "<em class='sa_tooltip' href='' title='Clicking on the slider advances to the next slide. NOTE: Only works when the Mouse Drag and Touch Drag options are NOT checked.'></em>\n";
730
- echo "</div>\n";
731
- // AUTO HEIGHT
732
- $auto_height = get_post_meta($post->ID, 'sa_auto_height', true);
733
- if ($auto_height == '') {
734
- $auto_height = '0';
735
- }
736
- echo "<div class='sa_setting_checkbox'><span>Auto Height:</span>";
737
- if ($auto_height == '1') {
738
- echo "<input type='checkbox' id='sa_auto_height' name='sa_auto_height' value='1' checked/>";
739
- } else {
740
- echo "<input type='checkbox' id='sa_auto_height' name='sa_auto_height' value='1'/>";
741
- }
742
- echo "<em class='sa_tooltip' title='Only works with 1 item on the screen. When checked the height of slider is automatically changed to match the height for each slide.'></em>";
743
- echo "</div>\n";
744
- echo "</div>\n";
745
- echo "<div style='clear:both; float:none; width:100%; height:1px;'></div>\n";
746
- echo "</div>\n";
747
- }
748
-
749
-
750
-
751
- // ##### META BOX CONTENT - 'Slides' BOX #####
752
- function cpt_slider_slides_content($post) {
753
- $num_slides = get_post_meta($post->ID, 'sa_num_slides', true);
754
- $slider_css_id = get_post_meta($post->ID, 'sa_css_id', true);
755
- $sa_pro_version = validate_slide_anything_pro_registration();
756
- // DISABLE VISUAL EDITOR CHECKBOX
757
- $disable_visual_editor = get_post_meta($post->ID, 'sa_disable_visual_editor', true);
758
- if ($disable_visual_editor == '') {
759
- $disable_visual_editor = '0';
760
- }
761
- echo "<div id='sa_visual_editor_checkbox'><span>Disable Visual Editor:</span>";
762
- if ($disable_visual_editor == '1') {
763
- echo "<input type='checkbox' id='sa_disable_visual_editor' name='sa_disable_visual_editor' value='1' checked/></div>\n";
764
- } else {
765
- echo "<input type='checkbox' id='sa_disable_visual_editor' name='sa_disable_visual_editor' value='1'/></div>\n";
766
- }
767
- // SLIDER EDITOR BOX SETTINGS
768
- if ($disable_visual_editor == '1') {
769
- $editor_args = array('tinymce' => false, 'wpautop' => false, 'media_buttons' => true, 'editor_class' => 'sa_slide_content', 'editor_height' => '250');
770
- } else {
771
- $editor_args = array('tinymce' => true, 'wpautop' => false, 'media_buttons' => true, 'editor_class' => 'sa_slide_content', 'editor_height' => '250');
772
- }
773
- if ($num_slides == '') {
774
- // A NEW SLIDER IS BEING CREATED - ADD 3 INITIAL SLIDES
775
- $num_slides = 3;
776
- $slide_data[0]['edit_id'] = "sa_slide1_content";
777
- $slide_data[0]['content'] = "Slide content";
778
- $slide_data[0]['del_id'] = "sa_slide1_delete";
779
- $slide_data[0]['image_data'] = "sa_slide1_image_data";
780
- $slide_data[0]['image_id'] = "sa_slide1_image_id";
781
- $slide_data[0]['thumb'] = "slide1_thumb";
782
- $slide_data[0]['image_del'] = "slide1_image_del";
783
- $slide_data[0]['image_pos'] = "sa_slide1_image_pos";
784
- $slide_data[0]['image_size'] = "sa_slide1_image_size";
785
- $slide_data[0]['image_repeat'] = "sa_slide1_image_repeat";
786
- $slide_data[0]['image_color'] = "sa_slide1_image_color";
787
- $slide_data[0]['link_url'] = "sa_slide1_link_url";
788
- $slide_data[0]['link_target'] = "sa_slide1_link_target";
789
- $slide_data[0]['slide_no'] = 1;
790
- $slide_data[1]['edit_id'] = "sa_slide2_content";
791
- $slide_data[1]['content'] = "Slide content";
792
- $slide_data[1]['del_id'] = "sa_slide2_delete";
793
- $slide_data[1]['image_data'] = "sa_slide2_image_data";
794
- $slide_data[1]['image_id'] = "sa_slide2_image_id";
795
- $slide_data[1]['thumb'] = "slide2_thumb";
796
- $slide_data[1]['image_del'] = "slide2_image_del";
797
- $slide_data[1]['image_pos'] = "sa_slide2_image_pos";
798
- $slide_data[1]['image_size'] = "sa_slide2_image_size";
799
- $slide_data[1]['image_repeat'] = "sa_slide2_image_repeat";
800
- $slide_data[1]['image_color'] = "sa_slide2_image_color";
801
- $slide_data[1]['link_url'] = "sa_slide2_link_url";
802
- $slide_data[1]['link_target'] = "sa_slide2_link_target";
803
- $slide_data[1]['slide_no'] = 2;
804
- $slide_data[2]['edit_id'] = "sa_slide3_content";
805
- $slide_data[2]['content'] = "Slide content";
806
- $slide_data[2]['del_id'] = "sa_slide3_delete";
807
- $slide_data[2]['image_data'] = "sa_slide3_image_data";
808
- $slide_data[2]['image_id'] = "sa_slide3_image_id";
809
- $slide_data[2]['thumb'] = "slide3_thumb";
810
- $slide_data[2]['image_del'] = "slide3_image_del";
811
- $slide_data[2]['image_pos'] = "sa_slide3_image_pos";
812
- $slide_data[2]['image_size'] = "sa_slide3_image_size";
813
- $slide_data[2]['image_repeat'] = "sa_slide3_image_repeat";
814
- $slide_data[2]['image_color'] = "sa_slide3_image_color";
815
- $slide_data[2]['link_url'] = "sa_slide3_link_url";
816
- $slide_data[2]['link_target'] = "sa_slide3_link_target";
817
- $slide_data[2]['slide_no'] = 3;
818
- if ($sa_pro_version) {
819
- $slide_data[0]['popup_type'] = "sa_slide1_popup_type";
820
- $slide_data[0]['popup_imageid'] = "sa_slide1_popup_imageid";
821
- $slide_data[0]['popup_imagetitle'] = "sa_slide1_popup_imagetitle";
822
- $slide_data[0]['popup_video_id'] = "sa_slide1_popup_video_id";
823
- $slide_data[0]['popup_video_type'] = "sa_slide1_popup_video_type";
824
- $slide_data[0]['popup_background'] = "sa_slide1_popup_background";
825
- $slide_data[0]['popup_html'] = "sa_slide1_popup_html";
826
- $slide_data[0]['popup_shortcode'] = "sa_slide1_popup_shortcode";
827
- $slide_data[0]['popup_bgcol'] = "sa_slide1_popup_bgcol";
828
- $slide_data[0]['popup_width'] = "sa_slide1_popup_width";
829
- $slide_data[1]['popup_type'] = "sa_slide2_popup_type";
830
- $slide_data[1]['popup_imageid'] = "sa_slide2_popup_imageid";
831
- $slide_data[1]['popup_imagetitle'] = "sa_slide2_popup_imagetitle";
832
- $slide_data[1]['popup_video_id'] = "sa_slide2_popup_video_id";
833
- $slide_data[1]['popup_video_type'] = "sa_slide2_popup_video_type";
834
- $slide_data[1]['popup_background'] = "sa_slide2_popup_background";
835
- $slide_data[1]['popup_html'] = "sa_slide2_popup_html";
836
- $slide_data[1]['popup_shortcode'] = "sa_slide2_popup_shortcode";
837
- $slide_data[1]['popup_bgcol'] = "sa_slide2_popup_bgcol";
838
- $slide_data[1]['popup_width'] = "sa_slide2_popup_width";
839
- $slide_data[2]['popup_type'] = "sa_slide3_popup_type";
840
- $slide_data[2]['popup_imageid'] = "sa_slide3_popup_imageid";
841
- $slide_data[2]['popup_imagetitle'] = "sa_slide3_popup_imagetitle";
842
- $slide_data[2]['popup_video_id'] = "sa_slide3_popup_video_id";
843
- $slide_data[2]['popup_video_type'] = "sa_slide3_popup_video_type";
844
- $slide_data[2]['popup_background'] = "sa_slide3_popup_background";
845
- $slide_data[2]['popup_html'] = "sa_slide3_popup_html";
846
- $slide_data[2]['popup_shortcode'] = "sa_slide3_popup_shortcode";
847
- $slide_data[2]['popup_bgcol'] = "sa_slide3_popup_bgcol";
848
- $slide_data[2]['popup_width'] = "sa_slide3_popup_width";
849
- }
850
- } else {
851
- // AN EXISTING SLIDER - GET SLIDE DATA FROM THE DATABASE AND SAVE WITHIN AN ARRAY
852
- $num_slides = intval($num_slides);
853
- $slide_data = array();
854
- $count = 0;
855
- for ($i = 1; $i <= $num_slides; $i++) {
856
- $slide_edit_id = "sa_slide".$i."_content";
857
- $slide_char_count = "sa_slide".$i."_char_count";
858
- $slide_data[$count]['edit_id'] = $slide_edit_id;
859
- $slide_data[$count]['content'] = get_post_meta($post->ID, $slide_edit_id, true);
860
- $slide_data[$count]['char_count'] = get_post_meta($post->ID, $slide_char_count, true);
861
- $slide_data[$count]['del_id'] = "sa_slide".$i."_delete";
862
- $slide_data[$count]['thumb'] = "slide".$i."_thumb";
863
- $slide_data[$count]['image_del'] = "slide".$i."_image_del";
864
- $slide_data[$count]['image_data'] = "sa_slide".$i."_image_data";
865
- $slide_data[$count]['image_id'] = "sa_slide".$i."_image_id";
866
- $slide_data[$count]['image_pos'] = "sa_slide".$i."_image_pos";
867
- $slide_data[$count]['image_size'] = "sa_slide".$i."_image_size";
868
- $slide_data[$count]['image_repeat'] = "sa_slide".$i."_image_repeat";
869
- $slide_data[$count]['image_color'] = "sa_slide".$i."_image_color";
870
- $slide_data[$count]['image_data'] = "sa_slide".$i."_image_data";
871
- $slide_data[$count]['link_url'] = "sa_slide".$i."_link_url";
872
- $slide_data[$count]['link_target'] = "sa_slide".$i."_link_target";
873
- if ($sa_pro_version) {
874
- $slide_data[$count]['popup_type'] = "sa_slide".$i."_popup_type";
875
- $slide_data[$count]['popup_imageid'] = "sa_slide".$i."_popup_imageid";
876
- $slide_data[$count]['popup_imagetitle'] = "sa_slide".$i."_popup_imagetitle";
877
- $slide_data[$count]['popup_video_id'] = "sa_slide".$i."_popup_video_id";
878
- $slide_data[$count]['popup_video_type'] = "sa_slide".$i."_popup_video_type";
879
- $slide_data[$count]['popup_background'] = "sa_slide".$i."_popup_background";
880
- $slide_data[$count]['popup_html'] = "sa_slide".$i."_popup_html";
881
- $slide_data[$count]['popup_shortcode'] = "sa_slide".$i."_popup_shortcode";
882
- $slide_data[$count]['popup_bgcol'] = "sa_slide".$i."_popup_bgcol";
883
- $slide_data[$count]['popup_width'] = "sa_slide".$i."_popup_width";
884
- }
885
- $slide_data[$count]['slide_no'] = $i;
886
- $count++;
887
- }
888
- }
889
- // GET AVAILABLE WORDPRESS IMAGE SIZES AND SAVE WITHIN AN ARRAY
890
- if ($sa_pro_version) {
891
- // SLIDE ANYTHING PRO VERSION ONLY
892
- global $_wp_additional_image_sizes;
893
- $image_size_arr = array();
894
- $image_size_arr[0]['value'] = "no";
895
- $image_size_arr[0]['desc'] = "NO";
896
- $count = 1;
897
- foreach (get_intermediate_image_sizes() as $image_size) {
898
- if (in_array($image_size, array('thumbnail', 'medium', 'medium_large', 'large'))) {
899
- $width = get_option("{$image_size}_size_w");
900
- $height = get_option("{$image_size}_size_h");
901
- } elseif (isset($_wp_additional_image_sizes[$image_size])) {
902
- $width = $_wp_additional_image_sizes[$image_size]['width'];
903
- $height = $_wp_additional_image_sizes[$image_size]['height'];
904
- }
905
- if (($width != 0) && ($height != 0)) {
906
- $image_size_arr[$count]['value'] = $image_size;
907
- $image_size_arr[$count]['desc'] = $image_size." (".$width."&times;".$height.")";
908
- $count++;
909
- }
910
- }
911
- }
912
-
913
- // ###### LOOP TO DISPLAY INPUT ELEMENTS FOR EACH SLIDE ######
914
- echo "<div id='slider_accordion'>\n";
915
-
916
- // determine whether to use css classes instead of csss ids
917
- $use_classes = 0;
918
- $other_settings = get_post_meta($post->ID, 'sa_other_settings', true);
919
- if ($other_settings != '') {
920
- $other_settings_arr = explode("|", $other_settings);
921
- }
922
- if (isset($other_settings_arr) && (count($other_settings_arr) > 7)) {
923
- $disable_slide_ids = $other_settings_arr[7];
924
- } else {
925
- $disable_slide_ids = '0';
926
- }
927
- if ($disable_slide_ids == '1') {
928
- $use_classes = 1;
929
- }
930
-
931
- for ($i = 0; $i < count($slide_data); $i++) {
932
- // DISPLAY ACCORDION HEADING
933
- echo "<h3>Slide ".$slide_data[$i]['slide_no'];
934
- $css_id = $slider_css_id."_slide".sprintf('%02d', $slide_data[$i]['slide_no']);
935
- // display CSS ID/CLASS for the current slide
936
- if ($use_classes == 1) {
937
- echo "<span>.".$css_id."</span>";
938
- } else {
939
- echo "<span>#".$css_id."</span>";
940
- }
941
- echo "</h3>\n";
942
- echo "<div>\n";
943
-
944
- // ### DISPLAY THE SLIDE CONTENT EDITOR (textarea field) ###
945
- //wp_editor($slide_data[$i]['content'], wp_kses_post($slide_data[$i]['edit_id']), $editor_args);
946
- wp_editor($slide_data[$i]['content'], $slide_data[$i]['edit_id'], $editor_args);
947
-
948
- // ##############################
949
- // ##### SLIDE TABS - START #####
950
- // ##############################
951
- $tabs_num = $i + 1;
952
- echo "<div id='slide_".$tabs_num."_tabs' class='sa_slide_tabs'>\n";
953
- echo "<ul>\n";
954
- echo "<li><a href='#slide".$tabs_num."_background_tab'>Slide Background</a></li>\n";
955
- echo "<li><a href='#slide".$tabs_num."_link_tab'>Slide Link</a></li>\n";
956
- echo "<li><a href='#slide".$tabs_num."_popup_tab'>Slide Popup</a></li>\n";
957
- echo "<li><a href='#slide".$tabs_num."_goto_tab'>Slide Goto Link</a></li>\n";
958
- echo "</ul>\n";
959
-
960
- // ####### SLIDE TAB 1 - SLIDE BACKGROUND #######
961
- echo "<div id='slide".$tabs_num."_background_tab' class='sa_slide_tab'>\n";
962
-
963
- // GET BACKGROUND IMAGE DATA FOR THIS SLIDE (image id, position, size, repeat and color) FROM DATABASE
964
- $slide_image_data = get_post_meta($post->ID, $slide_data[$i]['image_data'], true);
965
- if (isset($slide_image_data) && ($slide_image_data != '')) {
966
- $data_arr = explode("~", $slide_image_data);
967
- $slide_image_id = $data_arr[0];
968
- $slide_image_pos = $data_arr[1];
969
- $slide_image_size = $data_arr[2];
970
- $slide_image_repeat = $data_arr[3];
971
- $slide_image_color = $data_arr[4];
972
- } else {
973
- $slide_image_id = get_post_meta($post->ID, $slide_data[$i]['image_id'], true);
974
- $slide_image_pos = get_post_meta($post->ID, $slide_data[$i]['image_pos'], true);
975
- $slide_image_size = get_post_meta($post->ID, $slide_data[$i]['image_size'], true);
976
- $slide_image_repeat = get_post_meta($post->ID, $slide_data[$i]['image_repeat'], true);
977
- $slide_image_color = get_post_meta($post->ID, $slide_data[$i]['image_color'], true);
978
- }
979
- if ($slide_image_pos == '') {
980
- $slide_image_pos = 'left top';
981
- }
982
- if ($slide_image_size == '') {
983
- $slide_image_size = 'contain';
984
- }
985
- if ($slide_image_repeat == '') {
986
- $slide_image_repeat = 'no-repeat';
987
- }
988
- if ($slide_image_color == '') {
989
- $slide_image_color = "rgba(0,0,0,0)";
990
- }
991
-
992
- echo "<div class='sa_slide_bg_wrapper'>\n";
993
-
994
- // ### 'USE POPUP IMAGE AS SLIDE BACKGROUND' SETTING ###
995
- if ($sa_pro_version) {
996
- // SLIDE ANYTHING PRO VERSION ONLY
997
- $slide_popup_background = get_post_meta($post->ID, $slide_data[$i]['popup_background'], true);
998
- if ($slide_popup_background == '') {
999
- $slide_popup_background = 'no';
1000
- }
1001
- echo "<div class='popup_background_wrapper'>\n";
1002
- echo "<div>Use Popup Image as Slide Background:";
1003
- $tooltip = "Allows you to use the same image you defined as the popup image as the slide background image. You can use a smaller version of the popup image.";
1004
- echo "<em class='sa_tooltip' href='' title='".$tooltip."'></em></div>\n";
1005
- echo "<select id='".esc_attr($slide_data[$i]['popup_background'])."' name='".esc_attr($slide_data[$i]['popup_background'])."' ";
1006
- echo "onChange='change_slide_popup_background(".esc_attr($slide_data[$i]['slide_no']).");'>";
1007
- for ($j = 0; $j < count($image_size_arr); $j++) {
1008
- if ($slide_popup_background == $image_size_arr[$j]['value']) {
1009
- echo "<option value='".esc_attr($image_size_arr[$j]['value'])."' selected>".esc_html($image_size_arr[$j]['desc'])."</option>";
1010
- } else {
1011
- echo "<option value='".esc_attr($image_size_arr[$j]['value'])."'>".esc_html($image_size_arr[$j]['desc'])."</option>";
1012
- }
1013
- }
1014
- echo "</select>";
1015
- echo "</div>\n"; // .popup_background_wrapper
1016
- echo "<div style='clear:both; float:none; width:100%; height:1px;'></div>\n";
1017
- echo "<div id='slide".esc_attr($slide_data[$i]['slide_no'])."_imagebg_popup' class='sa_slide_bg_popup'><div></div></div>\n";
1018
- }
1019
-
1020
- // SLIDE BACKGROUND IMAGE - THUMBNAIL AND 'SET IMAGE' BUTTON
1021
- // get wordpress media upload frame url
1022
- $upload_frame_url = esc_url(get_upload_iframe_src('image', $post->ID)."&slide=".$slide_data[$i]['slide_no']);
1023
- // Get image src for slide background image
1024
- $slide_image_src = wp_get_attachment_image_src($slide_image_id, 'medium');
1025
- // check if the slide background image id already exists
1026
- $image_exists = is_array($slide_image_src);
1027
- // slide backround image - thumbnail (and delete button)
1028
- echo "<div id='".$slide_data[$i]['thumb']."' class='sa_slide_thumb'>\n";
1029
- if ($image_exists) {
1030
- echo "<div style='background-image:url(\"".esc_attr($slide_image_src[0])."\"); background-size:".esc_attr($slide_image_size)."; ";
1031
- echo "background-repeat:".esc_attr($slide_image_repeat)."; background-color:".esc_attr($slide_image_color)."; ";
1032
- echo "background-position:".esc_attr($slide_image_pos).";'></div>\n";
1033
- echo "<span id='".esc_attr($slide_data[$i]['image_del'])."' onClick='remove_slide_bg_image(\"".esc_attr($slide_data[$i]['slide_no'])."\");' title='Delete the background image for this slide'>X</span>\n";
1034
- echo "</div>\n";
1035
- } else {
1036
- if (isset($slide_data[$i]['popup_type'])) {
1037
- $slide_popup_type = get_post_meta($post->ID, $slide_data[$i]['popup_type'], true);
1038
- $popup_video_type = get_post_meta($post->ID, $slide_data[$i]['popup_video_type'], true);
1039
- $popup_video_id = get_post_meta($post->ID, $slide_data[$i]['popup_video_id'], true);
1040
- } else {
1041
- $slide_popup_type = 'NONE';
1042
- $popup_video_type = '';
1043
- $popup_video_id = '';
1044
- }
1045
- if (($slide_image_id == "99999999") && ($slide_popup_type == "VIDEO") && ($popup_video_type == "youtube")) {
1046
- $youtube_thumb = "https://img.youtube.com/vi/".$popup_video_id."/hqdefault.jpg";
1047
- echo "<div style='background-image:url(\"".$youtube_thumb."\"); background-size:".esc_attr($slide_image_size)."; ";
1048
- echo "background-repeat:".esc_attr($slide_image_repeat)."; background-color:".esc_attr($slide_image_color)."; ";
1049
- echo "background-position:".esc_attr($slide_image_pos).";'></div>\n";
1050
- echo "<span id='".esc_attr($slide_data[$i]['image_del'])."' onClick='remove_slide_bg_image(\"".esc_attr($slide_data[$i]['slide_no'])."\");' title='Delete the background image for this slide'>X</span>\n";
1051
- echo "</div>\n";
1052
- } else {
1053
- echo "<div style='background-color:#ffffff; background-size:".esc_attr($slide_image_size)."; ";
1054
- echo "background-repeat:".esc_attr($slide_image_repeat)."; background-color:".esc_attr($slide_image_color)."; ";
1055
- echo "background-position:".esc_attr($slide_image_pos).";'></div>\n";
1056
- echo "<span id='".esc_attr($slide_data[$i]['image_del'])."' class='sa_hidden' onClick='remove_slide_bg_image(\"".esc_attr($slide_data[$i]['slide_no'])."\");' title='Delete the background image for this slide'>X</span>\n";
1057
- echo "</div>\n";
1058
- }
1059
- }
1060
- // slide background image - 'set image' button
1061
- echo "<a class='button button-secondary slide_image_add' id='slide".esc_attr($slide_data[$i]['slide_no'])."_image_add' ";
1062
- echo "href='".esc_attr($upload_frame_url)."' title='Set the background image for this slide'>Set Image</a>\n";
1063
- // slide background image - image id hidden field
1064
- echo "<input type='hidden' id='".esc_attr($slide_data[$i]['image_id'])."' name='".esc_attr($slide_data[$i]['image_id'])."' value='".esc_attr($slide_image_id)."'/>\n";
1065
-
1066
- // SLIDE BACKGROUND IMAGE - BACKGROUND POSITION (dropdown box)
1067
- echo "<div class='slide_image_settings_line'>";
1068
- echo "<span>Background Position:</span>";
1069
- $option_arr = array();
1070
- $option_arr[0]['desc'] = 'Top Left'; $option_arr[0]['value'] = 'left top';
1071
- $option_arr[1]['desc'] = 'Top Center'; $option_arr[1]['value'] = 'center top';
1072
- $option_arr[2]['desc'] = 'Top Right'; $option_arr[2]['value'] = 'right top';
1073
- $option_arr[3]['desc'] = 'Center Left'; $option_arr[3]['value'] = 'left center';
1074
- $option_arr[4]['desc'] = 'Center'; $option_arr[4]['value'] = 'center center';
1075
- $option_arr[5]['desc'] = 'Center Right'; $option_arr[5]['value'] = 'right center';
1076
- $option_arr[6]['desc'] = 'Bottom Left'; $option_arr[6]['value'] = 'left bottom';
1077
- $option_arr[7]['desc'] = 'Bottom Center'; $option_arr[7]['value'] = 'center bottom';
1078
- $option_arr[8]['desc'] = 'Bottom Right'; $option_arr[8]['value'] = 'right bottom';
1079
- echo "<select id='".esc_attr($slide_data[$i]['image_pos'])."' name='".esc_attr($slide_data[$i]['image_pos'])."' onChange='change_slide_image_pos(".esc_attr($slide_data[$i]['slide_no']).");'>";
1080
- for ($j = 0; $j < count($option_arr); $j++) {
1081
- if ($slide_image_pos == $option_arr[$j]['value']) {
1082
- echo "<option value='".esc_attr($option_arr[$j]['value'])."' selected>".esc_html($option_arr[$j]['desc'])."</option>";
1083
- } else {
1084
- echo "<option value='".esc_attr($option_arr[$j]['value'])."'>".esc_html($option_arr[$j]['desc'])."</option>";
1085
- }
1086
- }
1087
- echo "</select>";
1088
- echo "</div>\n";
1089
-
1090
- // SLIDE BACKGROUND IMAGE - BACKGROUND SIZE (dropdown box)
1091
- echo "<div class='slide_image_settings_line'>";
1092
- echo "<span>Background Size:</span>";
1093
- $option_arr = array();
1094
- $option_arr[0]['value'] = 'auto'; $option_arr[0]['desc'] = 'no resize';
1095
- $option_arr[1]['value'] = 'contain'; $option_arr[1]['desc'] = 'contain';
1096
- $option_arr[2]['value'] = 'cover'; $option_arr[2]['desc'] = 'cover';
1097
- $option_arr[3]['value'] = '100% 100%'; $option_arr[3]['desc'] = '100%';
1098
- $option_arr[4]['value'] = '100% auto'; $option_arr[4]['desc'] = '100% width';
1099
- $option_arr[5]['value'] = 'auto 100%'; $option_arr[5]['desc'] = '100% height';
1100
- echo "<select id='".esc_attr($slide_data[$i]['image_size'])."' name='".esc_attr($slide_data[$i]['image_size'])."' onChange='change_slide_image_size(".esc_attr($slide_data[$i]['slide_no']).");'>";
1101
- for ($j = 0; $j < count($option_arr); $j++) {
1102
- if ($slide_image_size == $option_arr[$j]['value']) {
1103
- echo "<option value='".esc_attr($option_arr[$j]['value'])."' selected>".esc_html($option_arr[$j]['desc'])."</option>";
1104
- } else {
1105
- echo "<option value='".esc_attr($option_arr[$j]['value'])."'>".esc_html($option_arr[$j]['desc'])."</option>";
1106
- }
1107
- }
1108
- echo "</select>";
1109
- echo "</div>\n";
1110
-
1111
- // SLIDER BACKGROUND IMAGE - BACKGROUND REPEAT (dropdown box)
1112
- echo "<div class='slide_image_settings_line'>";
1113
- echo "<span>Background Repeat:</span>";
1114
- $option_arr = array();
1115
- $option_arr[0] = 'no-repeat';
1116
- $option_arr[1] = 'repeat';
1117
- $option_arr[2] = 'repeat-x';
1118
- $option_arr[3] = 'repeat-y';
1119
- echo "<select id='".esc_attr($slide_data[$i]['image_repeat'])."' name='".esc_attr($slide_data[$i]['image_repeat'])."' ";
1120
- echo "onChange='change_slide_image_repeat(".esc_attr($slide_data[$i]['slide_no']).");'>";
1121
- for ($j = 0; $j < count($option_arr); $j++) {
1122
- if ($slide_image_repeat == $option_arr[$j]) {
1123
- echo "<option value='".esc_attr($option_arr[$j])."' selected>".esc_html($option_arr[$j])."</option>";
1124
- } else {
1125
- echo "<option value='".esc_attr($option_arr[$j])."'>".esc_html($option_arr[$j])."</option>";
1126
- }
1127
- }
1128
- echo "</select>";
1129
- echo "</div>\n";
1130
-
1131
- // SLIDER BACKGROUND IMAGE - BACKGROUND COLOR (color picker)
1132
- echo "<div class='slide_image_settings_line'>";
1133
- echo "<span>Background Color:</span>";
1134
- echo "<input type='text' id='".esc_attr($slide_data[$i]['image_color'])."' name='".esc_attr($slide_data[$i]['image_color'])."' value='".esc_attr($slide_image_color)."' ";
1135
- echo "onChange='change_slide_image_color(".esc_attr($slide_data[$i]['slide_no']).");'>";
1136
- echo "</div>\n";
1137
-
1138
- echo "<div style='clear:both; float:none; width:100%; height:1px;'></div>\n";
1139
- echo "</div>\n";
1140
- echo "</div>\n";
1141
-
1142
- // ####### SLIDE TAB 2 - SLIDE LINK #######
1143
- echo "<div id='slide".$tabs_num."_link_tab' class='sa_slide_tab'>\n";
1144
-
1145
- // GET SLIDE LINK DATA FOR THIS SLIDE FROM THE DATABASE
1146
- $slide_link_url = get_post_meta($post->ID, $slide_data[$i]['link_url'], true);
1147
- $slide_link_target = get_post_meta($post->ID, $slide_data[$i]['link_target'], true);
1148
- if ($slide_link_target == '') {
1149
- $slide_link_target = '_self';
1150
- }
1151
-
1152
- // DISPLAY INPUT FIELDS FOR SLIDE LINK SETTINGS
1153
- echo "<div class='slide_link_settings_wrapper'>";
1154
- echo "<p>Specify a link URL that this slide opens</h3>";
1155
- // LINK URL
1156
- echo "<div><span>Link URL:</span>";
1157
- echo "<input type='text' id='".esc_attr($slide_data[$i]['link_url'])."' name='".esc_attr($slide_data[$i]['link_url'])."' ";
1158
- echo "value='".esc_attr($slide_link_url)."'/></div>\n";
1159
- // LINK TARGET
1160
- echo "<div><span>Link Target:</span>";
1161
- echo "<select id='".esc_attr($slide_data[$i]['link_target'])."' name='".esc_attr($slide_data[$i]['link_target'])."'>";
1162
- if ($slide_link_target == '_blank') {
1163
- echo "<option value='_self'>Same Tab/Window</option>";
1164
- echo "<option value='_blank' selected>New Tab/Window</option>";
1165
- } else {
1166
- echo "<option value='_self' selected>Same Tab/Window</option>";
1167
- echo "<option value='_blank'>New Tab/Window</option>";
1168
- }
1169
- echo "</select>";
1170
- echo "</div>\n";
1171
-
1172
- // URL HASH NAVIGATION
1173
- /*
1174
- $css_id = get_post_meta($post->ID, 'sa_css_id', true);
1175
- $data_hash = "#".$css_id."_slide".sprintf('%02d', $slide_data[$i]['slide_no']);
1176
- echo "<p style='padding:20px 0px 0px;'>URL Hash Navigation</h3>";
1177
- echo "<div><span><em>URL Hash Navication</em> is an Owl Carousel 2.0 feature where you can create links or buttons to navigate ";
1178
- echo "to a specific slide within your slider. See this <a href='https://owlcarousel2.github.io/OwlCarousel2/demos/urlhashnav.html' ";
1179
- echo "target='_blank' style='color:blue;'>EXAMPLE</a> to see how this works.<br/>The link for this slide is:</span>";
1180
- echo "<strong style='padding-left:3px; color:firebrick;'>".$data_hash."</strong></div>";
1181
- */
1182
- echo "</div>\n";
1183
- echo "</div>\n";
1184
-
1185
- // ####### SLIDE TAB 3 - SLIDE POPUP #######
1186
- echo "<div id='slide".$tabs_num."_popup_tab' class='sa_slide_tab'>\n";
1187
-
1188
- if ($sa_pro_version) {
1189
- // ### SLIDE ANYTHING PRO VERSION ONLY ###
1190
-
1191
- // GET SLIDE POPUP DATA FOR THIS SLIDE FROM THE DATABASE
1192
- $slide_popup_type = get_post_meta($post->ID, $slide_data[$i]['popup_type'], true);
1193
- if ($slide_popup_type == '') {
1194
- $slide_popup_type = 'NONE';
1195
- }
1196
- $popup_imageid = intval(get_post_meta($post->ID, $slide_data[$i]['popup_imageid'], true));
1197
- $popup_video_id = get_post_meta($post->ID, $slide_data[$i]['popup_video_id'], true);
1198
- $popup_video_type = get_post_meta($post->ID, $slide_data[$i]['popup_video_type'], true);
1199
- $popup_imagetitle = get_post_meta($post->ID, $slide_data[$i]['popup_imagetitle'], true);
1200
- $popup_html = get_post_meta($post->ID, $slide_data[$i]['popup_html'], true);
1201
- $popup_shortcode = get_post_meta($post->ID, $slide_data[$i]['popup_shortcode'], true);
1202
- $popup_bgcol = get_post_meta($post->ID, $slide_data[$i]['popup_bgcol'], true);
1203
- $popup_width = intval(get_post_meta($post->ID, $slide_data[$i]['popup_width'], true));
1204
- $css_id = get_post_meta($post->ID, 'sa_css_id', true);
1205
-
1206
- // POPUP TYPE
1207
- echo "<div class='slide_popup_settings_line'>";
1208
- echo "<span>SA Popup Type:</span>";
1209
- $option_arr = array();
1210
- $option_arr[0] = 'NONE';
1211
- $option_arr[1] = 'IMAGE';
1212
- $option_arr[2] = 'VIDEO';
1213
- $option_arr[3] = 'HTML';
1214
- echo "<select id='".esc_attr($slide_data[$i]['popup_type'])."' name='".esc_attr($slide_data[$i]['popup_type'])."' ";
1215
- echo "onChange='change_slide_popup_type(".esc_attr($slide_data[$i]['slide_no']).");'>";
1216
- for ($j = 0; $j < count($option_arr); $j++) {
1217
- if ($slide_popup_type == $option_arr[$j]) {
1218
- echo "<option value='".esc_attr($option_arr[$j])."' selected>".esc_html($option_arr[$j])."</option>";
1219
- } else {
1220
- echo "<option value='".esc_attr($option_arr[$j])."'>".esc_html($option_arr[$j])."</option>";
1221
- }
1222
- }
1223
- echo "</select>";
1224
- echo "</div>\n";
1225
-
1226
- // A) IMAGE POPUP SETTINGS
1227
- if ($slide_popup_type == 'IMAGE') {
1228
- echo "<div id='slide".($i+1)."_image_popup_wrapper' class='image_popup_wrapper'>\n";
1229
- } else {
1230
- echo "<div id='slide".($i+1)."_image_popup_wrapper' class='image_popup_wrapper' style='display:none;'>\n";
1231
- }
1232
- // get wordpress media upload frame url
1233
- $upload_popup_frame_url = esc_url(get_upload_iframe_src('image', $post->ID)."&popup=".$slide_data[$i]['slide_no']);
1234
- // Get image src for slide popup image
1235
- $popup_image_src = wp_get_attachment_image_src($popup_imageid, 'medium');
1236
- // check if the slide background image id already exists
1237
- $image_exists = is_array($popup_image_src);
1238
- echo "<div id='slide".($i+1)."_popup_thumb' class='slide_popup_thumb'>\n";
1239
- $placeholder = SA_PLUGIN_PATH."images/image_placeholder.jpg";
1240
- if ($image_exists) {
1241
- // media library image id exists - display thumbnail image
1242
- echo "<div><img src='".$popup_image_src[0]."'/></div>";
1243
- // display image delete button
1244
- echo "<span onClick='remove_popup_image(\"".esc_attr($slide_data[$i]['slide_no'])."\", \"".$placeholder."\");' ";
1245
- echo "id='slide".esc_attr($slide_data[$i]['slide_no'])."_popup_image_del' title='Delete the popup image for this slide'>X</span>\n";
1246
- // get popup image info (size & dimensions)
1247
- $popup_image_meta = wp_get_attachment_metadata($popup_imageid);
1248
- $image_width = $popup_image_meta['width'];
1249
- $image_height = $popup_image_meta['height'];
1250
- $info_dim = $image_width." x ".$image_height." pixels";
1251
- $popup_image_full = wp_get_attachment_image_src($popup_imageid, 'full');
1252
- $img_headers = get_headers($popup_image_full[0], 1);
1253
- $info_size = $img_headers["Content-Length"];
1254
- if ($info_size != '') {
1255
- $size_unit = 'bytes';
1256
- if ($info_size > 1048576) {
1257
- if (!is_array($info_size)) {
1258
- $info_size = round($info_size / 1048576)." MB";
1259
- } else {
1260
- $info_size = '';
1261
- }
1262
- } else if ($info_size > 1024) {
1263
- if (!is_array($info_size)) {
1264
- $info_size = round($info_size / 1024)." kb";
1265
- } else {
1266
- $info_size = '';
1267
- }
1268
- }
1269
- }
1270
- } else {
1271
- // no image selected yet - display placeholder image
1272
- $popup_image_id = 0;
1273
- echo "<div><img src='".$placeholder."'/></div>";
1274
- // display image delete button (hidden state)
1275
- echo "<span class='sa_hidden' onClick='remove_popup_image(\"".esc_attr($slide_data[$i]['slide_no'])."\", \"".esc_attr($placeholder)."\");' ";
1276
- echo "id='slide".esc_attr($slide_data[$i]['slide_no'])."_popup_image_del' title='Delete the popup image for this slide'>X</span>\n";
1277
- // reset popup image info (size & dimensions)
1278
- $info_dim = '';
1279
- $info_size = '';
1280
- }
1281
- echo "</div>\n";
1282
- // slide popup image - 'set image' button
1283
- echo "<a class='button button-secondary popup_image_add' href='".esc_attr($upload_popup_frame_url)."' ";
1284
- echo "title='Set the background image for this slide'>Set Image</a>\n";
1285
- // slide popup image - 'preview' button
1286
- $preview_button = "slide".esc_attr($slide_data[$i]['slide_no'])."_popup_image_preview";
1287
- echo "<div id='".esc_attr($preview_button)."' class='slide_popup_image_preview'>";
1288
- if ($image_exists) {
1289
- echo "<a class='button button-secondary' href='".esc_attr($popup_image_full[0])."' title='".esc_attr($popup_imagetitle)."'>Preview</a>";
1290
- } else {
1291
- echo "<a class='button button-secondary' href='".esc_attr($placeholder)."' title='".esc_attr($popup_imagetitle)."'>Preview</a>";
1292
- }
1293
- echo "</div>\n";
1294
- // slide popup image - jquery code to generate 'magnific popup' preview
1295
- echo "<script type='text/javascript'>\n";
1296
- echo "jQuery(document).ready(function() {\n";
1297
- echo " jQuery('#".esc_attr($preview_button)." a').magnificPopup({\n";
1298
- echo " mainClass: 'sa_popup',\n";
1299
- echo " closeBtnInside: true,\n";
1300
- echo " type: 'image'\n";
1301
- echo " });\n";
1302
- echo "});\n";
1303
- echo "</script>\n";
1304
- // slide popup image - popup image id hidden field
1305
- echo "<input type='hidden' id='".esc_attr($slide_data[$i]['popup_imageid'])."' name='".esc_attr($slide_data[$i]['popup_imageid']);
1306
- echo "' value='".esc_attr($popup_imageid)."' />\n";
1307
- // slide popup image - popup image info (title, dimensions & size)
1308
- echo "<div class='slide_popup_info'>\n";
1309
- // popup image title
1310
- echo "<input class='sa_slide_popup_imagetitle' type='text' id='".esc_attr($slide_data[$i]['popup_imagetitle'])."' ";
1311
- echo "name='".esc_attr($slide_data[$i]['popup_imagetitle'])."' value='".esc_attr($popup_imagetitle)."' ";
1312
- echo "onChange='change_popup_image_title(this.value, \"".$preview_button."\")' placeholder='Enter popup title'/>\n";
1313
- // popup dimensions
1314
- echo "<div id='slide".esc_attr($slide_data[$i]['slide_no'])."_popup_info_dim' class='slide_popup_info_dim'>";
1315
- echo "<strong>Dimensions:</strong> ".$info_dim."</div>\n";
1316
- // popup file size
1317
- echo "<div id='slide".esc_attr($slide_data[$i]['slide_no'])."_popup_info_size' class='slide_popup_info_size'>";
1318
- if ($info_size != '') {
1319
- echo "<strong>File Size:</strong> ".$info_size;
1320
- }
1321
- echo "</div>\n";
1322
- echo "</div>\n";
1323
- echo "<div style='clear:both; float:none; width:100%; height:1px;'></div>\n";
1324
- echo "</div>\n";
1325
-
1326
- // B) VIDEO POPUP SETTINGS
1327
- if ($slide_popup_type == 'VIDEO') {
1328
- echo "<div id='slide".($i+1)."_video_popup_wrapper' class='video_popup_wrapper'>\n";
1329
- } else {
1330
- echo "<div id='slide".($i+1)."_video_popup_wrapper' class='video_popup_wrapper' style='display:none;'>\n";
1331
- }
1332
- // set default video values
1333
- if (($popup_video_type != 'youtube') && ($popup_video_type != 'vimeo')) {
1334
- $popup_video_type = '';
1335
- $popup_video_id = '';
1336
- }
1337
- if ($popup_video_id == '') {
1338
- $popup_video_type = '';
1339
- }
1340
- // video preview
1341
- echo "<div id='slide".($i+1)."_video_thumb' class='slide_video_thumb'>\n";
1342
- if ($popup_video_id != '') {
1343
- if ($popup_video_type == 'youtube') {
1344
- echo "<iframe src='https://www.youtube.com/embed/".$popup_video_id."' frameborder='0' allowfullscreen></iframe>\n";
1345
- } elseif ($popup_video_type == 'vimeo') {
1346
- echo "<iframe src='https://player.vimeo.com/video/".$popup_video_id."' frameborder='0' webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>";
1347
- } else {
1348
- echo "<img src='".SA_PLUGIN_PATH."images/video_placeholder.jpg'/>";
1349
- }
1350
- } else {
1351
- echo "<img src='".SA_PLUGIN_PATH."images/video_placeholder.jpg'/>";
1352
- }
1353
- echo "<div style='float:none; clear:both; width:100%; height:1px;'></div>\n";
1354
- echo "</div>\n";
1355
- // video url (youtube/vimeo) input text box
1356
- echo "<div class='sa_slide_video_url'>";
1357
- echo "<input type='text' id='sa_slide".($i+1)."_video_url' name='sa_slide".($i+1)."_video_url' ";
1358
- echo "placeholder='Enter YouTube or Vimeo URL'/></div>\n";
1359
- // 'update video' button
1360
- echo "<a class='button button-secondary' title='Update popup video using the above video URL' ";
1361
- echo "onClick='update_popup_video(".($i+1).");'>Set Video</a>\n";
1362
-
1363
- // slide popup video - 'preview' button
1364
- $video_preview_url = SA_PLUGIN_PATH."images/video_placeholder_admin.jpg";
1365
- if ($popup_video_id != '') {
1366
- if ($popup_video_type == 'youtube') {
1367
- $video_preview_url = "http://www.youtube.com/watch?v=".$popup_video_id;
1368
- } elseif ($popup_video_type == 'vimeo') {
1369
- $video_preview_url = "http://vimeo.com/".$popup_video_id;
1370
- }
1371
- }
1372
- $preview_button = "slide".esc_attr($slide_data[$i]['slide_no'])."_popup_video_preview";
1373
- echo "<div id='".esc_attr($preview_button)."' class='slide_popup_video_preview'>";
1374
- echo "<a class='button button-secondary' href='".$video_preview_url."'>Preview</a>";
1375
- echo "</div>\n";
1376
- // slide popup image - jquery code to generate 'magnific popup' preview
1377
- echo "<script type='text/javascript'>\n";
1378
- echo "jQuery(document).ready(function() {\n";
1379
- echo " jQuery('#".esc_attr($preview_button)." a').magnificPopup({\n";
1380
- echo " mainClass: 'sa_popup',\n";
1381
- echo " closeBtnInside: true,\n";
1382
- echo " type: 'iframe'\n";
1383
- echo " });\n";
1384
- echo "});\n";
1385
- echo "</script>\n";
1386
- // invalid url error message
1387
- echo "<div id='sa_slide".($i+1)."_video_invalid_url' class='sa_popup_video_invalid_url'>";
1388
- echo "URL entered is NOT a valid YouTube or Vimeo URL!</div>\n";
1389
- // hidden video id text field
1390
- echo "<input type='hidden' id='".esc_attr($slide_data[$i]['popup_video_id'])."' name='".esc_attr($slide_data[$i]['popup_video_id'])."' ";
1391
- echo "value='".esc_attr($popup_video_id)."'/>\n";
1392
- // hidden video type (youtube/vimeo) text field
1393
- echo "<input type='hidden' id='".esc_attr($slide_data[$i]['popup_video_type'])."' name='".esc_attr($slide_data[$i]['popup_video_type'])."' ";
1394
- echo "value='".esc_attr($popup_video_type)."'/>\n";
1395
- echo "<div style='float:none; clear:both; width:100%; height:1px;'></div>\n";
1396
- echo "</div>\n";
1397
-
1398
- // C) CONTENT POPUP SETTINGS
1399
- if ($slide_popup_type == 'HTML') {
1400
- echo "<div id='slide".($i+1)."_html_popup_wrapper' class='html_popup_wrapper'>\n";
1401
- } else {
1402
- echo "<div id='slide".($i+1)."_html_popup_wrapper' class='html_popup_wrapper' style='display:none;'>\n";
1403
- }
1404
- // content popup - html
1405
- echo "<textarea id='".esc_attr($slide_data[$i]['popup_html'])."' name='".esc_attr($slide_data[$i]['popup_html'])."' ";
1406
- echo "placeholder='Enter HTML Code or WordPress Shortcode'>".esc_attr($popup_html)."</textarea>\n";
1407
- // content popup - shortcode
1408
- if ($popup_shortcode == '') {
1409
- $popup_shortcode = '0';
1410
- }
1411
- echo "<div class='slide_popup_settings_line' style='margin:3px 0px 15px;'><span>Shortcode Content:</span>";
1412
- if ($popup_shortcode == '1') {
1413
- echo "<input type='checkbox' id='".esc_attr($slide_data[$i]['popup_shortcode'])."' name='".esc_attr($slide_data[$i]['popup_shortcode'])."' value='1' checked/>";
1414
- } else {
1415
- echo "<input type='checkbox' id='".esc_attr($slide_data[$i]['popup_shortcode'])."' name='".esc_attr($slide_data[$i]['popup_shortcode'])."' value='1'/>";
1416
- }
1417
- echo "<em class='sa_tooltip' href='' title='Use a WordPress shortcode instead of HTML as your popup content'></em>\n";
1418
- echo "</div>\n";
1419
- // content popup - css id
1420
- $popup_id = $css_id."_popup".($i+1);
1421
- echo "<div class='slide_popup_settings_line'>";
1422
- echo "<span>Popup CSS ID:</span><div id='sa_slide".($i+1)."_popup_css' class='slide_popup_css'>#".$popup_id."</div>";
1423
- echo "<strong>(click to copy to clipboard)</strong></div>";
1424
- // content popup - background color
1425
- if ($popup_bgcol == '') {
1426
- $popup_bgcol = "#ffffff";
1427
- }
1428
- echo "<div class='slide_popup_settings_line'>";
1429
- echo "<span>Background Color:</span>";
1430
- echo "<input type='text' id='".esc_attr($slide_data[$i]['popup_bgcol'])."' name='".esc_attr($slide_data[$i]['popup_bgcol'])."' ";
1431
- echo "value='".esc_attr($popup_bgcol)."'>";
1432
- echo "</div>\n";
1433
- // content popup - width
1434
- if ($popup_width== '') {
1435
- $popup_width = '600';
1436
- }
1437
- echo "<div class='slide_popup_settings_line'>";
1438
- echo "<span>Popup Width:</span>";
1439
- echo "<input type='text' id='".esc_attr($slide_data[$i]['popup_width'])."' name='".esc_attr($slide_data[$i]['popup_width'])."' ";
1440
- echo "value='".esc_attr($popup_width)."'><em>px</em>";
1441
- echo "</div>\n";
1442
-
1443
- echo "</div>\n";
1444
- } else {
1445
- // ### SLIDE ANYTHING FREE VERSION - DISPLAY PRO INFORMATION ###
1446
- echo "<div class='slide_popup_pro_version'>\n";
1447
- echo "<h4>Available in the PRO VERSION only!</h4>\n";
1448
- echo "<p>With <strong>SLIDE ANYTHING PRO </strong> each slide can now open a <strong>MODAL POPUP</strong>, which may be one ";
1449
- echo "of the following:</p>\n";
1450
- echo "<ul>\n";
1451
- echo "<li>An <strong>IMAGE</strong> popup, and with multiple image popups you can create a lightbox image gallery.</li>\n";
1452
- echo "<li>An embedded <strong>VIDEO</strong> popup or gallery, which can contain <em>YouTube</em> or <em>Vimeo</em> videos.</li>\n";
1453
- echo "<li>Popups containing any custom <strong>HTML</strong> content or WordPress <strong>SHORTCODES</strong> (such as an HTML form).</li>\n";
1454
- echo "<li>Or your Slide Anything sliders can conatin a combination of image, video, HTML and shortcode popups!</li>\n";
1455
- echo "</ul>\n";
1456
- echo "<p>To find out more about <strong>SLIDE ANYTHING PRO</strong>, view demos or get your hands on a copy, click ";
1457
- echo "<a href='https://edgewebpages.com' title='Slide Anything PRO' target='_blank'>HERE</a>.</p>";
1458
- echo "</div>\n";
1459
- }
1460
- echo "</div>\n";
1461
-
1462
- // ####### SLIDE TAB 4 - SLIDE GOTO LINK #######
1463
- $css_id = get_post_meta($post->ID, 'sa_css_id', true);
1464
- $goto_class = $css_id."_goto".($i+1);
1465
- $eg_link = "https://edgewebpages.com/slide-goto-links";
1466
- echo "<div id='slide".$tabs_num."_goto_tab' class='sa_slide_tab'>\n";
1467
- echo "<div class='slide_goto_link_content'>\n";
1468
- echo "<p><strong>Create a link or button to link directly to this slide</strong></p>\n";
1469
- echo "<p>To do this, give your link or button the following <strong>CSS Class:</strong></p>\n";
1470
- echo "<div class='slide_goto_class'><span>".$goto_class."</span></div>\n";
1471
- echo "<p>To see an example of how a '<strong>Slide Goto Link</strong>' works ";
1472
- echo "<a href='".$eg_link."' target='_blank'>CLICK HERE</a></p>\n";
1473
- echo "</div>\n";
1474
- echo "</div>\n";
1475
-
1476
- // ############################
1477
- // ##### SLIDE TABS - END #####
1478
- // ############################
1479
- echo "</div>\n";
1480
-
1481
- // 3. DELETE STATUS FIELD (hidden) AND DELETE SLIDE BUTTON
1482
- echo "<input type='hidden' id='".esc_attr($slide_data[$i]['del_id'])."' name='".esc_attr($slide_data[$i]['del_id'])."' value='1'/>\n";
1483
- echo "<div class='button button-secondary' onClick='delete_sa_slide(\"".esc_attr($slide_data[$i]['del_id'])."\");' title='Delete this slide'>Delete Slide</div>\n";
1484
-
1485
- // 4. DUPLICATE SLIDE BUTTON
1486
- echo "<div class='button button-secondary' onClick='duplicate_slide(\"".esc_attr($slide_data[$i]['slide_no'])."\");' title='Duplicate this slide'>Duplicate Slide</div>\n";
1487
-
1488
- // 5. MOVE SLIDE UP BUTTON
1489
- if ($slide_data[$i]['slide_no'] != 1) {
1490
- echo "<div class='button button-secondary' onClick='move_slide_up(\"".esc_attr($slide_data[$i]['slide_no'])."\");' title='Move this slide up within the slide order'>Move Slide Up</div>\n";
1491
- }
1492
-
1493
- echo "</div>\n";
1494
- }
1495
- echo "</div>\n";
1496
-
1497
- // ADD SLIDE BUTTON
1498
- if ($num_slides < 99) {
1499
- // a maximum of 99 slides allowed
1500
- echo "<div id='sa_add_slide' class='button button-primary button-large' title='Add a new slide'>Add Slide</div>\n";
1501
- }
1502
-
1503
- // JQUERY-UI DIALOG BOX DIV - FOR CONFIRMATION DIALOG BOXES
1504
- echo "<div id='sa_dialog_box'></div>\n";
1505
- }
1506
-
1507
-
1508
-
1509
- // ##### META BOX CONTENT - 'Slider Preview/Shortcode' BOX #####
1510
- function cpt_slider_shortcode_content($post) {
1511
- // ### CHECK IF YOAST SEO PLUGIN IS INSTALLED ###
1512
- $yoast = 0;
1513
- if (is_plugin_active('wordpress-seo/wp-seo.php') || is_plugin_active('wordpress-seo-premium/wp-seo-premium.php')) {
1514
- $yoast = 1;
1515
- }
1516
- $post_status = get_post_status($post->ID);
1517
- $allow_shortcodes = get_post_meta($post->ID, 'sa_shortcodes', true);
1518
- $shortcode = '[slide-anything id="'.$post->ID.'"]';
1519
- echo "<div id='sa_slider_shortcode'>".esc_html($shortcode)."</div>\n";
1520
- echo "<div id='sa_shortcode_copy' class='button button-secondary'>Copy to Clipboard</div>\n";
1521
-
1522
- // get value of 'Disable Preview Feature' checkbox
1523
- $disable_preview = '0';
1524
- $other_settings = get_post_meta($post->ID, 'sa_other_settings', true);
1525
- if ($other_settings != '') {
1526
- $other_settings_arr = explode("|", $other_settings);
1527
- }
1528
- if (isset($other_settings_arr) && ($other_settings_arr[5] != '')) {
1529
- $disable_preview = $other_settings_arr[5];
1530
- }
1531
-
1532
- if (($post_status == 'publish') && ($disable_preview == '0') && ($yoast == 0)) {
1533
- // CHECK IF THE PREVIEW PAGE ALREADY EXISTS
1534
- // DISABLE THE PREVIEW FEATURE IF 'YOAST SEO' PLUGIN IS INSTALLED
1535
- $preview_page_created = 1;
1536
- $preview_page = get_page_by_title('Slide Anything Popup Preview');
1537
- $preview_id = $preview_page->ID;
1538
- if ($preview_id != '') {
1539
- // PREVIEW PAGE EXISTS - UPDATE PAGE CONTENT TO CONTAIN THIS SA SHORTCODE
1540
- wp_untrash_post($preview_id); // remove preview page from trash (if applicable)
1541
- $page_content = "[slide-anything id='".$post->ID."']";
1542
- $page_data = array(
1543
- 'ID' => $preview_id,
1544
- 'post_content' => $page_content
1545
- );
1546
- $page_id = wp_update_post($page_data);
1547
- if (is_wp_error($page_id)) {
1548
- $preview_page_created = 0;
1549
- }
1550
- } else {
1551
- // PREVIEW PAGE DOES NOT EXIST - CREATE PREVIEW PAGE WITH SA SHORTCODE CONTENT
1552
- $page_content = "[slide-anything id='".$post->ID."']";
1553
- $curr_user_id = get_current_user_id();
1554
- $page_data = array(
1555
- 'post_title' => 'Slide Anything Popup Preview',
1556
- 'post_content' => $page_content,
1557
- 'post_status' => 'publish',
1558
- 'post_type' => 'page',
1559
- 'post_author' => $curr_user_id,
1560
- 'menu_order' => 9999
1561
- );
1562
- $page_id = wp_insert_post($page_data);
1563
- if (is_wp_error($page_id)) {
1564
- $preview_page_created = 0;
1565
- }
1566
- }
1567
- if ($preview_page_created == 1) {
1568
- // DISPLAY SLIDER PREVIEW BUTTON
1569
- if ($post_status == 'publish') {
1570
- echo "<div id='sa_preview_slider' class='button button-secondary' ";
1571
- echo "onClick='document.getElementById(\"sa_preview_popup\").style.display = \"block\";'>Preview Slider</div>\n";
1572
- }
1573
- // DISPLAY SLIDER PREVIEW POPUP
1574
- $preview_page_url = get_page_link($page_id);
1575
- echo "<div id='sa_preview_popup' style='display:none;'>\n";
1576
- echo "<div id='sa_preview_wrapper'>\n";
1577
- echo "<div id='sa_preview_close' title='Close Slider Preview' ";
1578
- echo "onClick='document.getElementById(\"sa_preview_popup\").style.display = \"none\";'>X</div>\n";
1579
- echo "<div id='sa_preview_content'>";
1580
- echo "<iframe src='".$preview_page_url."'></iframe>\n";
1581
- echo "</div>\n"; // #sa_preview_content
1582
- echo "</div>\n"; // #sa_preview_wrapper
1583
- echo "</div>\n";
1584
- }
1585
- }
1586
- }
1587
-
1588
-
1589
-
1590
- // ##### META BOX CONTENT - 'Items Displayed' BOX #####
1591
- function cpt_slider_items_content($post) {
1592
- $sa_pro_version = validate_slide_anything_pro_registration();
1593
- $items_width1 = intval(get_post_meta($post->ID, 'sa_items_width1', true));
1594
- $items_width2 = intval(get_post_meta($post->ID, 'sa_items_width2', true));
1595
- $items_width3 = intval(get_post_meta($post->ID, 'sa_items_width3', true));
1596
- $items_width4 = intval(get_post_meta($post->ID, 'sa_items_width4', true));
1597
- $items_width5 = intval(get_post_meta($post->ID, 'sa_items_width5', true));
1598
- $items_width6 = intval(get_post_meta($post->ID, 'sa_items_width6', true));
1599
- if ($items_width1 == 0) { $items_width1 = 1; }
1600
- if ($items_width2 == 0) { $items_width2 = 1; }
1601
- if ($items_width3 == 0) { $items_width3 = 1; }
1602
- if ($items_width4 == 0) { $items_width4 = 1; }
1603
- if ($items_width5 == 0) { $items_width5 = 1; }
1604
- if ($items_width6 == 0) { $items_width6 = $items_width5; }
1605
-
1606
- echo "<div id='items_displayed_metabox'>\n";
1607
- echo "<h4>Browser/Device Width:</h4>\n";
1608
- // items for browser width category 1
1609
- echo "<div><em class='sa_tooltip' href='' title='Up to 479 pixels'></em><span>Mobile Portrait</span><select name='sa_items_width1'>";
1610
- for ($i = 1; $i <= 12; $i++) {
1611
- if ($i == $items_width1) {
1612
- echo "<option value='".esc_attr($i)."' selected>".esc_html($i)."</option>";
1613
- } else {
1614
- echo "<option value='".esc_attr($i)."'>".esc_html($i)."</option>";
1615
- }
1616
- }
1617
- echo "</select></div>\n";
1618
- // items for browser width category 2
1619
- echo "<div><em class='sa_tooltip' href='' title='480 to 767 pixels'></em><span>Mobile Landscape</span><select name='sa_items_width2'>";
1620
- for ($i = 1; $i <= 12; $i++) {
1621
- if ($i == $items_width2) {
1622
- echo "<option value='".esc_attr($i)."' selected>".esc_html($i)."</option>";
1623
- } else {
1624
- echo "<option value='".esc_attr($i)."'>".esc_html($i)."</option>";
1625
- }
1626
- }
1627
- echo "</select></div>\n";
1628
- // items for browser width category 3
1629
- echo "<div><em class='sa_tooltip' href='' title='768 to 979 pixels'></em><span>Tablet Portrait</span><select name='sa_items_width3'>";
1630
- for ($i = 1; $i <= 12; $i++) {
1631
- if ($i == $items_width3) {
1632
- echo "<option value='".esc_attr($i)."' selected>".esc_html($i)."</option>";
1633
- } else {
1634
- echo "<option value='".esc_attr($i)."'>".esc_html($i)."</option>";
1635
- }
1636
- }
1637
- echo "</select></div>\n";
1638
- // items for browser width category 4
1639
- echo "<div><em class='sa_tooltip' href='' title='980 to 1199 pixels'></em><span>Desktop Small</span><select name='sa_items_width4'>";
1640
- for ($i = 1; $i <= 12; $i++) {
1641
- if ($i == $items_width4) {
1642
- echo "<option value='".esc_attr($i)."' selected>".esc_html($i)."</option>";
1643
- } else {
1644
- echo "<option value='".esc_attr($i)."'>".esc_html($i)."</option>";
1645
- }
1646
- }
1647
- echo "</select></div>\n";
1648
- // items for browser width category 5
1649
- echo "<div><em class='sa_tooltip' href='' title='1200 to 1499 pixels'></em><span>Desktop Large</span><select name='sa_items_width5'>";
1650
- for ($i = 1; $i <= 12; $i++) {
1651
- if ($i == $items_width5) {
1652
- echo "<option value='".esc_attr($i)."' selected>".esc_html($i)."</option>";
1653
- } else {
1654
- echo "<option value='".esc_attr($i)."'>".esc_html($i)."</option>";
1655
- }
1656
- }
1657
- echo "</select></div>\n";
1658
- // items for browser width category 6
1659
- echo "<div><em class='sa_tooltip' href='' title='Over 1500 pixels'></em><span>Desktop X-Large</span><select name='sa_items_width6'>";
1660
- for ($i = 1; $i <= 12; $i++) {
1661
- if ($i == $items_width6) {
1662
- echo "<option value='".esc_attr($i)."' selected>".esc_html($i)."</option>";
1663
- } else {
1664
- echo "<option value='".esc_attr($i)."'>".esc_html($i)."</option>";
1665
- }
1666
- }
1667
- echo "</select></div>\n";
1668
- // slide transition effect
1669
- $transition = get_post_meta($post->ID, 'sa_transition', true);
1670
- if ($transition == '') {
1671
- $transition = 'fade';
1672
- }
1673
- $option_arr = array();
1674
- $option_arr[0] = 'Slide';
1675
- $option_arr[1] = 'Fade';
1676
- $option_arr[2] = 'Zoom In';
1677
- $option_arr[3] = 'Zoom Out';
1678
- $option_arr[4] = 'Flip Out X';
1679
- $option_arr[5] = 'Flip Out Y';
1680
- $option_arr[6] = 'Rotate Left';
1681
- $option_arr[7] = 'Rotate Right';
1682
- $option_arr[8] = 'Bounce Out';
1683
- $option_arr[9] = 'Roll Out';
1684
- $option_arr[10] = 'Slide Down';
1685
- if (($items_width1 == 1) && ($items_width2 == 1) && ($items_width3 == 1) && ($items_width4 == 1) && ($items_width5 == 1) && ($items_width6 == 1)) {
1686
- echo "<div class='sa_items_all_one' style='display:block;'>";
1687
- } else {
1688
- echo "<div class='sa_items_all_one' style='display:none;'>";
1689
- }
1690
- echo "<em class='sa_tooltip' href='' title='NOTE: Slide transitions only work when the above items displayed are ALL SET TO 1'></em>";
1691
- echo "<span style='color:firebrick !important;'>Slide Transition</span><select style='max-width:100px !important;' name='sa_transition'>";
1692
- for ($i = 0; $i < count($option_arr); $i++) {
1693
- if ($transition == $option_arr[$i]) {
1694
- echo "<option value='".esc_attr($option_arr[$i])."' selected>".esc_html($option_arr[$i])."</option>";
1695
- } else {
1696
- echo "<option value='".esc_attr($option_arr[$i])."'>".esc_html($option_arr[$i])."</option>";
1697
- }
1698
- }
1699
- echo "</select></div>\n";
1700
-
1701
- // HERO SLIDER
1702
- $hero_slider = get_post_meta($post->ID, 'sa_hero_slider', true);
1703
- if ($hero_slider != '1') {
1704
- $hero_slider = '0';
1705
- }
1706
- if (($items_width1 == 1) && ($items_width2 == 1) && ($items_width3 == 1) && ($items_width4 == 1) && ($items_width5 == 1) && ($items_width6 == 1)) {
1707
- echo "<div id='sa_hero_slider_wrapper' class='sa_items_all_one' style='display:block;'>";
1708
- } else {
1709
- echo "<div id='sa_hero_slider_wrapper' class='sa_items_all_one' style='display:none;'>";
1710
- }
1711
- echo "<span>Hero Slider</span>";
1712
- if ($sa_pro_version) {
1713
- // hero slider checkbox
1714
- if ($hero_slider == '1') {
1715
- echo "<input type='checkbox' id='sa_hero_slider' name='sa_hero_slider' value='1' checked/>";
1716
- } else {
1717
- echo "<input type='checkbox' id='sa_hero_slider' name='sa_hero_slider' value='1'/>";
1718
- }
1719
- $hs_note1 = "Most WP Theme &apos;Page Builders&apos; (Visual Composer, Divi, Elementor, SiteOrigin...) allow you create full-width sections in your content. If you are not using a page builder then you will have to manually create a PHP template file to include a full-width container.";
1720
- $hs_note2 = "The slider height is set to 100% screen/device height using CSS &apos;vh&apos; (viewport height). Just about all browsers now support CSS viewport units, except Opera Mini which was installed on the old &apos;button&apos; phones.";
1721
- if ($hero_slider == '1') {
1722
- echo "<div id='sa_hero_slider_note' style='display:block;'>";
1723
- } else {
1724
- echo "<div id='sa_hero_slider_note' style='display:none;'>";
1725
- }
1726
- echo "<strong>Please Note:</strong>";
1727
- echo "<ol><li>Shortcode should be inserted into a full-width section<em class='sa_tooltip' title='".$hs_note1."'></em></li>";
1728
- echo "<li>Only works on browsers that support Viewport units - see <a href='https://caniuse.com/#feat=viewport-units' target='_blank'>here</a>";
1729
- echo "<em class='sa_tooltip' title='".$hs_note2."'></em></li></ol></div>";
1730
- } else {
1731
- // display slide anything pro promotional text
1732
- echo "<div id='sa_hero_slider_promo'>";
1733
- echo "<h4>Available in the PRO VERSION only!</h4>\n";
1734
- echo "<p>With <strong>Slide Anything PRO </strong> you can create full width/height <strong>Hero Sliders</strong> ";
1735
- echo "which auto-resize depending on device/screen.</p>";
1736
- echo "<p>To view a Hero Slider DEMO click:</p>";
1737
- echo "<p style='padding-top:2px !important;'><a href='https://edgewebpages.com/hero-slider-with-thumbnails' target='_blank'>HERO SLIDER DEMO</a></p>";
1738
- echo "</div>";
1739
- }
1740
- echo "</div>\n";
1741
-
1742
- // SHOWCASE SLIDER
1743
- if (($items_width1 == 1) && ($items_width2 == 1) && ($items_width3 == 1) && ($items_width4 == 1) && ($items_width5 == 1) && ($items_width6 == 1)) {
1744
- echo "<div id='sa_showcase_slider_wrapper' style='display:none;'>";
1745
- } else {
1746
- echo "<div id='sa_showcase_slider_wrapper' style='display:block;'>";
1747
- }
1748
- // showcase slider checkbox
1749
- $showcase_slider = get_post_meta($post->ID, 'sa_showcase_slider', true);
1750
- if ($showcase_slider != '1') {
1751
- $showcase_slider = '0';
1752
- }
1753
- echo "<div class='sa_ss_line'><span><strong>Showcase Carousel</strong></span>";
1754
- if ($sa_pro_version) {
1755
- echo "<input type='checkbox' id='sa_showcase_slider' name='sa_showcase_slider' value='1'";
1756
- if ($showcase_slider == '1') { echo " checked"; }
1757
- echo " />";
1758
- }
1759
- echo "</div>";
1760
- if ($sa_pro_version) {
1761
- if ($showcase_slider == '1') {
1762
- echo "<div id='sa_showcase_slider_pro' style='display:block;'>";
1763
- } else {
1764
- echo "<div id='sa_showcase_slider_pro' style='display:none;'>";
1765
-
1766
- }
1767
- // showcase slider - desktop width
1768
- $showcase_width = get_post_meta($post->ID, 'sa_showcase_width', true);
1769
- if ($showcase_width == '') {
1770
- $showcase_width = '120';
1771
- }
1772
- echo "<div class='sa_ss_line'><span>Desktop Width</span>";
1773
- echo "<input type='text' id='sa_showcase_width' name='sa_showcase_width' value='".esc_attr($showcase_width)."'>";
1774
- echo "<em>%</em></div>\n";
1775
- // showcase slider - use on tablets
1776
- $showcase_tablet = get_post_meta($post->ID, 'sa_showcase_tablet', true);
1777
- if (($showcase_tablet != '0') && ($showcase_tablet != '1')) {
1778
- $showcase_tablet = '1';
1779
- }
1780
- echo "<div class='sa_ss_line'><span>Use on Tablets</span>";
1781
- if ($showcase_tablet == '1') {
1782
- echo "<input type='checkbox' id='sa_showcase_tablet' name='sa_showcase_tablet' value='1' checked />";
1783
- } else {
1784
- echo "<input type='checkbox' id='sa_showcase_tablet' name='sa_showcase_tablet' value='1' />";
1785
- }
1786
- echo "</div>\n";
1787
- // showcase slider - tablet width
1788
- $showcase_width_tab = get_post_meta($post->ID, 'sa_showcase_width_tab', true);
1789
- if ($showcase_width_tab == '') {
1790
- $showcase_width_tab = '130';
1791
- }
1792
- echo "<div class='sa_ss_line'><span>Tablet Width</span>";
1793
- echo "<input type='text' id='sa_showcase_width_tab' name='sa_showcase_width_tab' value='".esc_attr($showcase_width_tab)."'>";
1794
- echo "<em>%</em></div>\n";
1795
- // showcase slider - use on mobiles
1796
- $showcase_mobile = get_post_meta($post->ID, 'sa_showcase_mobile', true);
1797
- if ($showcase_mobile != '1') {
1798
- $showcase_mobile = '0';
1799
- }
1800
- echo "<div class='sa_ss_line'><span>Use on Mobiles</span>";
1801
- if ($showcase_mobile == '1') {
1802
- echo "<input type='checkbox' id='sa_showcase_mobile' name='sa_showcase_mobile' value='1' checked />";
1803
- } else {
1804
- echo "<input type='checkbox' id='sa_showcase_mobile' name='sa_showcase_mobile' value='1' />";
1805
- }
1806
- echo "</div>\n";
1807
- // showcase slider - mobile width
1808
- $showcase_width_mob = get_post_meta($post->ID, 'sa_showcase_width_mob', true);
1809
- if ($showcase_width_mob == '') {
1810
- $showcase_width_mob = '140';
1811
- }
1812
- echo "<div class='sa_ss_line'><span>Mobile Width</span>";
1813
- echo "<input type='text' id='sa_showcase_width_mob' name='sa_showcase_width_mob' value='".esc_attr($showcase_width_mob)."'>";
1814
- echo "<em>%</em></div>\n";
1815
- // showcase slider - css to style left/rightmost slides
1816
- $css_id = get_post_meta($post->ID, 'sa_css_id', true);
1817
- echo "<div class='sa_ss_css_line'>CSS to target left+right partial slides:";
1818
- echo "<div id='ss_css_value'>#".esc_html($css_id)." .sc_partial</div>";
1819
- echo "</div>\n";
1820
- echo "</div>"; // #sa_showcase_slider_pro
1821
- } else {
1822
- // display slide anything pro promotional text
1823
- echo "<div id='sa_showcase_slider_promo'>";
1824
- echo "<h4>Available in the PRO VERSION only!</h4>\n";
1825
- echo "<p>A <strong>Showcase Carousels</strong> has a container width that exceeds the screen/window width. ";
1826
- echo "The leftmost/rightmost visible slides therefore become partially visible.</p>";
1827
- echo "<p>Showcase Carousel DEMO:</p>";
1828
- echo "<p style='padding-top:2px !important;'><a href='https://edgewebpages.com/showcase-carousel-demo/' target='_blank'>SHOWCASE CAROUSEL DEMO</a></p>";
1829
- echo "</div>";
1830
- }
1831
- echo "</div>\n";
1832
-
1833
- echo "</div>\n";
1834
- }
1835
-
1836
-
1837
-
1838
- // ##### META BOX CONTENT - 'Slider Style' BOX #####
1839
- function cpt_slider_style_content($post) {
1840
- // CSS ID
1841
- $css_id = get_post_meta($post->ID, 'sa_css_id', true);
1842
- if ($css_id == '') {
1843
- $css_id = "slider_".$post->ID;
1844
- }
1845
- echo "<div id='slider_style_metabox'>\n";
1846
- echo "<h4>CSS <span>#id</span> for Slider:</h4>\n";
1847
- echo "<div style='padding-bottom:10px; color:#909090;'>Must consist of letters (upper/lowercase) or Underscore '_' characters <span style='color:firebrick;'>ONLY!</span></div>\n";
1848
- echo "<input type='text' id='sa_css_id' name='sa_css_id' value='".esc_attr($css_id)."'/>\n";
1849
- echo "<div id='css_note_text'>To style slides use CSS selector:</div>";
1850
- echo "<div id='css_note_value'>#".esc_html($css_id)." .owl-item</div>";
1851
- echo "<div class='ca_style_hr'></div>\n";
1852
-
1853
- // SLIDER PADDING (TOP, RIGHT, BOTTOM, LEFT)
1854
- $wrapper_padd_top = get_post_meta($post->ID, 'sa_wrapper_padd_top', true);
1855
- if ($wrapper_padd_top == '') { $wrapper_padd_top = '0'; }
1856
- $wrapper_padd_right = get_post_meta($post->ID, 'sa_wrapper_padd_right', true);
1857
- if ($wrapper_padd_right == '') { $wrapper_padd_right = '0'; }
1858
- $wrapper_padd_bottom = get_post_meta($post->ID, 'sa_wrapper_padd_bottom', true);
1859
- if ($wrapper_padd_bottom == '') { $wrapper_padd_bottom = '0'; }
1860
- $wrapper_padd_left = get_post_meta($post->ID, 'sa_wrapper_padd_left', true);
1861
- if ($wrapper_padd_left == '') { $wrapper_padd_left = '0'; }
1862
- $tooltip = "Padding space around the entire carousel/slider";
1863
- echo "<h4>Padding <span>(pixels)</span>:<em class='sa_tooltip' title='".esc_attr($tooltip)."'></em></h4>";
1864
- echo "<div class='ca_style_padding'>";
1865
- echo "<div id='padd_top'>";
1866
- echo "<input type='text' id='sa_wrapper_padd_top' name='sa_wrapper_padd_top' value='".esc_attr($wrapper_padd_top)."'></div>";
1867
- echo "<div id='padd_right'>";
1868
- echo "<input type='text' id='sa_wrapper_padd_right' name='sa_wrapper_padd_right' value='".esc_attr($wrapper_padd_right)."'></div>";
1869
- echo "<div type='text' id='padd_bottom'>";
1870
- echo "<input type='text' id='sa_wrapper_padd_bottom' name='sa_wrapper_padd_bottom' value='".esc_attr($wrapper_padd_bottom)."'></div>";
1871
- echo "<div id='padd_left'>";
1872
- echo "<input type='text' id='sa_wrapper_padd_left' name='sa_wrapper_padd_left' value='".esc_attr($wrapper_padd_left)."'></div>";
1873
- echo "</div>\n";
1874
- echo "<div style='clear:both; float:none; width:100%; height:10px;'></div>";
1875
-
1876
- $tooltip = "Style settings for the slider navigation arrows and slider pagination";
1877
- echo "<h4>Slider Navigation:<em class='sa_tooltip' title='".esc_attr($tooltip)."'></em></h4>";
1878
-
1879
- // AUTOHIDE ARROWS
1880
- $autohide_arrows = get_post_meta($post->ID, 'sa_autohide_arrows', true);
1881
- if ($autohide_arrows == '') {
1882
- $autohide_arrows = '1';
1883
- }
1884
- echo "<div class='ca_style_setting_line'><span style='width:140px;'>Autohide Arrows</span>";
1885
- if ($autohide_arrows == '1') {
1886
- echo "<input type='checkbox' id='sa_autohide_arrows' name='sa_autohide_arrows' value='1' checked/>";
1887
- } else {
1888
- echo "<input type='checkbox' id='sa_autohide_arrows' name='sa_autohide_arrows' value='1'/>";
1889
- }
1890
- echo "</div>\n";
1891
-
1892
- // SHOW DOT PER SLIDE
1893
- $dot_per_slide = get_post_meta($post->ID, 'sa_dot_per_slide', true);
1894
- if ($dot_per_slide == '') {
1895
- $dot_per_slide = '0';
1896
- }
1897
- echo "<div class='ca_style_setting_line'><span style='width:140px;'>Show 1 Dot Per Slide</span>";
1898
- if ($dot_per_slide == '1') {
1899
- echo "<input type='checkbox' id='sa_dot_per_slide' name='sa_dot_per_slide' value='1' checked/>";
1900
- } else {
1901
- echo "<input type='checkbox' id='sa_dot_per_slide' name='sa_dot_per_slide' value='1'/>";
1902
- }
1903
- echo "</div>\n";
1904
-
1905
- $tooltip = "The background color and border around the entire carousel/slider";
1906
- echo "<h4>Background/Border:<em class='sa_tooltip' title='".esc_attr($tooltip)."'></em></h4>";
1907
-
1908
- // SLIDER BACKGROUND COLOR
1909
- $background_color = get_post_meta($post->ID, 'sa_background_color', true);
1910
- if ($background_color == '') {
1911
- $background_color = 'rgba(0,0,0,0)';
1912
- }
1913
- echo "<div class='ca_style_setting_line'><span>Background:</span>";
1914
- echo "<input type='text' id='sa_background_color' name='sa_background_color' value='".esc_attr($background_color)."'></div>\n";
1915
-
1916
- // SLIDER BORDER (WIDTH & COLOR)
1917
- $border_width = get_post_meta($post->ID, 'sa_border_width', true);
1918
- if ($border_width == '') {
1919
- $border_width = '0';
1920
- }
1921
- $border_color = get_post_meta($post->ID, 'sa_border_color', true);
1922
- if ($border_color == '') {
1923
- $border_color = 'rgba(0,0,0,0)';
1924
- }
1925
- echo "<div class='ca_style_setting_line'><span>Border Style:</span>";
1926
- echo "<input type='text' id='sa_border_width' name='sa_border_width' value='".esc_attr($border_width)."'><em>px</em>";
1927
- echo "<input type='text' id='sa_border_color' name='sa_border_color' value='".esc_attr($border_color)."'></div>\n";
1928
-
1929
- // SLIDER BORDER RADIUS
1930
- $border_radius = get_post_meta($post->ID, 'sa_border_radius', true);
1931
- if ($border_radius == '') {
1932
- $border_radius = '0';
1933
- }
1934
- echo "<div class='ca_style_setting_line'><span>Border Radius:</span>";
1935
- echo "<input type='text' id='sa_border_radius' name='sa_border_radius' value='".esc_attr($border_radius)."'></div>\n";
1936
-
1937
- echo "<div class='ca_style_hr' style='margin-top:10px;'></div>\n";
1938
-
1939
- $tooltip = "The style settings for all slides (within the slider/carousel)";
1940
- echo "<h4>Slide Style:<em class='sa_tooltip' title='".esc_attr($tooltip)."'></em></h4>";
1941
-
1942
- // SLIDE - MINIMUM HEIGHT
1943
- $slide_min_height = get_post_meta($post->ID, 'sa_slide_min_height_perc', true);
1944
- if ($slide_min_height == '') {
1945
- $slide_min_height = '50';
1946
- }
1947
- echo "<div style='padding:5px 0px 10px;'>\n";
1948
- $tooltip = "The minimum height of each slide. Can be set to a percentage of the slide width, or for image sliders set to a 4:3 or 16:9 aspect ratio.";
1949
- echo "<div class='ca_style_setting_line' id='ca_style_min_height' style='padding-bottom:7px !important;'>";
1950
- echo "<span class='sa_tooltip' title='".esc_attr($tooltip)."'>Min Height:</span><br/>";
1951
- if ($slide_min_height == 'aspect43') {
1952
- echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='percent' style='margin-left:20px !important;'/><em>%</em>";
1953
- echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='px'/><em>px</em>";
1954
- echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='43' checked/><em>4:3</em>";
1955
- echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='169'/><em>16:9</em>";
1956
- } elseif ($slide_min_height == 'aspect169') {
1957
- echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='percent' style='margin-left:20px !important;'/><em>%</em>";
1958
- echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='px'/><em>px</em>";
1959
- echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='43'/><em>4:3</em>";
1960
- echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='169' checked/><em>16:9</em>";
1961
- } elseif (strpos($slide_min_height, 'px') !== false) {
1962
- echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='percent' style='margin-left:20px !important;'/><em>%</em>";
1963
- echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='px' checked/><em>px</em>";
1964
- echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='43'/><em>4:3</em>";
1965
- echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='169'/><em>16:9</em>";
1966
- } else {
1967
- echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='percent' style='margin-left:20px !important;' checked/><em>%</em>";
1968
- echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='px'/><em>px</em>";
1969
- echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='43'/><em>4:3</em>";
1970
- echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='169'/><em>16:9</em>";
1971
- }
1972
- echo "</div>\n";
1973
- if (($slide_min_height == 'aspect43') || ($slide_min_height == 'aspect169')) {
1974
- $mh_suffix = '';
1975
- echo "<div class='ca_style_setting_line' id='sa_slide_min_height_wrapper' style='display:none;'>";
1976
- echo "<input type='text' id='sa_slide_min_height' name='sa_slide_min_height' value='".esc_attr($slide_min_height)."'/>";
1977
- echo "<em id='mh_suffix'>".$mh_suffix."</em></div>\n";
1978
- echo "<input type='hidden' id='sa_slide_min_height_hidden' name='sa_slide_min_height_hidden' value='0'/>\n";
1979
- } else {
1980
- if (strpos($slide_min_height, 'px') !== false) {
1981
- $mh_value = str_replace('px', '', $slide_min_height);
1982
- $mh_suffix = 'px';
1983
- } else {
1984
- $mh_value = $slide_min_height;
1985
- $mh_suffix = '%';
1986
- }
1987
- echo "<div class='ca_style_setting_line' id='sa_slide_min_height_wrapper'><span style='width:20px;'>&nbsp;</span>";
1988
- echo "<input type='text' id='sa_slide_min_height' name='sa_slide_min_height' value='".esc_attr($mh_value)."'/>";
1989
- echo "<em id='mh_suffix'>".$mh_suffix."</em></div>\n";
1990
- echo "<input type='hidden' id='sa_slide_min_height_hidden' name='sa_slide_min_height_hidden' value='".esc_attr($mh_value)."'/>\n";
1991
- }
1992
- echo "</div>\n";
1993
-
1994
- // SLIDE - PADDING TOP/BOTTOM
1995
- $slide_padding_tb = get_post_meta($post->ID, 'sa_slide_padding_tb', true);
1996
- if ($slide_padding_tb == '') {
1997
- $slide_padding_tb = '5';
1998
- }
1999
- $tooltip = "Padding space top/bottom for each individual slide";
2000
- echo "<div class='ca_style_setting_line' id='ca_style_padding_top_bottom'><span class='sa_tooltip' title='".esc_attr($tooltip)."'>Padding:</span>";
2001
- echo "<input type='text' id='sa_slide_padding_tb' name='sa_slide_padding_tb' value='".esc_attr($slide_padding_tb)."'><em>%</em></div>\n";
2002
-
2003
- // SLIDE - PADDING LEFT/RIGHT
2004
- $slide_padding_lr = get_post_meta($post->ID, 'sa_slide_padding_lr', true);
2005
- if ($slide_padding_lr == '') {
2006
- $slide_padding_lr = '5';
2007
- }
2008
- $tooltip = "Padding space left/right for each individual slide";
2009
- echo "<div class='ca_style_setting_line' id='ca_style_padding_left_right'><span class='sa_tooltip' title='".esc_attr($tooltip)."'>Padding:</span>";
2010
- echo "<input type='text' id='sa_slide_padding_lr' name='sa_slide_padding_lr' value='".esc_attr($slide_padding_lr)."'><em>%</em></div>\n";
2011
-
2012
- // SLIDE - MARGIN LEFT/RIGHT
2013
- $slide_margin_lr = get_post_meta($post->ID, 'sa_slide_margin_lr', true);
2014
- if ($slide_margin_lr == '') {
2015
- $slide_margin_lr = '0';
2016
- }
2017
- $tooltip = "Margin space left and right of each slide";
2018
- echo "<div class='ca_style_setting_line' id='ca_style_margin_left_right'><span class='sa_tooltip' title='".esc_attr($tooltip)."'>Margin:</span>";
2019
- echo "<input type='text' id='sa_slide_margin_lr' name='sa_slide_margin_lr' value='".esc_attr($slide_margin_lr)."'><em>%</em></div>\n";
2020
-
2021
- $tooltip = "The link/popup buttons that appear on a slide";
2022
- echo "<h4>Link/Popup Icons:<em class='sa_tooltip' title='".esc_attr($tooltip)."'></em></h4>";
2023
-
2024
- // LINK/POPUP ICONS - ICON LOCATION
2025
- $slide_icons_location = get_post_meta($post->ID, 'sa_slide_icons_location', true);
2026
- if ($slide_icons_location == '') {
2027
- $slide_icons_location = 'Center Center';
2028
- }
2029
- echo "<div class='ca_style_setting_line'><span>Icon Location</span>";
2030
- echo "<select id='sa_slide_icons_location' name='sa_slide_icons_location'>";
2031
- $option_arr = array();
2032
- $option_arr[0] = 'Center Center';
2033
- $option_arr[1] = 'Top Left';
2034
- $option_arr[2] = 'Top Center';
2035
- $option_arr[3] = 'Top Right';
2036
- $option_arr[4] = 'Bottom Left';
2037
- $option_arr[5] = 'Bottom Center';
2038
- $option_arr[6] = 'Bottom Right';
2039
- for ($i = 0; $i < count($option_arr); $i++) {
2040
- if ($option_arr[$i] == $slide_icons_location) {
2041
- echo "<option value='".$option_arr[$i]."' selected>".$option_arr[$i]."</option>";
2042
- } else {
2043
- echo "<option value='".$option_arr[$i]."'>".$option_arr[$i]."</option>";
2044
- }
2045
- }
2046
- echo "</select></div>\n";
2047
-
2048
- // LINK/POPUP ICONS - ALWAYS VISIBLE
2049
- $slide_icons_visible = get_post_meta($post->ID, 'sa_slide_icons_visible', true);
2050
- if ($slide_icons_visible != '1') {
2051
- $slide_icons_visible = '0';
2052
- }
2053
- echo "<div class='ca_style_setting_line'><span>Always Visible</span>";
2054
- if ($slide_icons_visible == '1') {
2055
- echo "<input type='checkbox' id='sa_slide_icons_visible' name='sa_slide_icons_visible' value='1' checked/>";
2056
- } else {
2057
- echo "<input type='checkbox' id='sa_slide_icons_visible' name='sa_slide_icons_visible' value='1'/>";
2058
- }
2059
- echo "</div>\n";
2060
-
2061
- // LINK/POPUP ICONS - COLOR SCHEME
2062
- $slide_icons_color = get_post_meta($post->ID, 'sa_slide_icons_color', true);
2063
- if ($slide_icons_color == '') {
2064
- $slide_icons_location = 'white';
2065
- }
2066
- echo "<div class='ca_style_setting_line'><span>Color Scheme</span>";
2067
- echo "<select id='sa_slide_icons_color' name='sa_slide_icons_color'>";
2068
- if ($slide_icons_color == 'black') {
2069
- echo "<option value='white'>White</option>";
2070
- echo "<option value='black' selected>Black</option>";
2071
- } else {
2072
- echo "<option value='white selected'>White</option>";
2073
- echo "<option value='black'>Black</option>";
2074
- }
2075
- echo "</select></div>\n";
2076
-
2077
- // LINK/POPUP ICONS - FULL SLIDE LINKS
2078
- $slide_icons_fullslide = get_post_meta($post->ID, 'sa_slide_icons_fullslide', true);
2079
- if ($slide_icons_fullslide != '1') {
2080
- $slide_icons_fullslide = '0';
2081
- }
2082
- echo "<div class='ca_style_setting_line'><span>Full Slide Links</span>";
2083
- if ($slide_icons_fullslide == '1') {
2084
- echo "<input type='checkbox' id='sa_slide_icons_fullslide' name='sa_slide_icons_fullslide' value='1' checked/>";
2085
- } else {
2086
- echo "<input type='checkbox' id='sa_slide_icons_fullslide' name='sa_slide_icons_fullslide' value='1'/>";
2087
- }
2088
- $tooltip = "This makes the entire slide area a clickable link. NOTE: This feature is ";
2089
- $tooltip .= "disabled if you have both a slide link AND a popup link for a slide.";
2090
- $tt_style = "margin:0px 0px -3px 5px; cursor:help;";
2091
- echo "<em class='sa_tooltip' style='".$tt_style."' title='".esc_attr($tooltip)."'></em>";
2092
- echo "</div>\n";
2093
-
2094
-
2095
- // ##### OTHER SETTINGS #####
2096
-
2097
- echo "<h4 style='margin-top:10px !important;'>Other Settings:</h4>";
2098
-
2099
- // FETCH OTHER SETTINGS POST META
2100
- $other_settings = get_post_meta($post->ID, 'sa_other_settings', true);
2101
- if ($other_settings != '') {
2102
- $other_settings_arr = explode("|", $other_settings);
2103
- }
2104
- // setting 1 - sa_window_onload
2105
- if (isset($other_settings_arr) && ($other_settings_arr[0] != '')) {
2106
- $window_onload = $other_settings_arr[0];
2107
- } else {
2108
- $window_onload = get_post_meta($post->ID, 'sa_window_onload', true);
2109
- if ($window_onload == '') {
2110
- $window_onload = '0';
2111
- }
2112
- }
2113
- // setting 2 - sa_strip_javascript
2114
- if (isset($other_settings_arr) && ($other_settings_arr[1] != '')) {
2115
- $strip_javascript = $other_settings_arr[1];
2116
- } else {
2117
- $strip_javascript = get_post_meta($post->ID, 'sa_strip_javascript', true);
2118
- if ($strip_javascript == '') {
2119
- $strip_javascript = '0';
2120
- }
2121
- }
2122
- // setting 3 - sa_lazy_load_images
2123
- if (isset($other_settings_arr) && ($other_settings_arr[2] != '')) {
2124
- $lazy_load_images = $other_settings_arr[2];
2125
- } else {
2126
- $lazy_load_images = get_post_meta($post->ID, 'sa_lazy_load_images', true);
2127
- if ($lazy_load_images == '') {
2128
- $lazy_load_images = '0';
2129
- }
2130
- }
2131
- // setting 4 - sa_ulli_containers
2132
- if (isset($other_settings_arr) && ($other_settings_arr[3] != '')) {
2133
- $ulli_containers = $other_settings_arr[3];
2134
- } else {
2135
- $ulli_containers = get_post_meta($post->ID, 'sa_ulli_containers', true);
2136
- if ($ulli_containers == '') {
2137
- $ulli_containers = '0';
2138
- }
2139
- }
2140
- // setting 5 - sa_rtl_slider
2141
- if (isset($other_settings_arr) && ($other_settings_arr[4] != '')) {
2142
- $rtl_slider = $other_settings_arr[4];
2143
- } else {
2144
- $rtl_slider = '0';
2145
- }
2146
- // setting 6 - sa_disable_preview
2147
- if (isset($other_settings_arr) && ($other_settings_arr[5] != '')) {
2148
- $disable_preview = $other_settings_arr[5];
2149
- } else {
2150
- $disable_preview = '0';
2151
- }
2152
- // setting 7 - bg_image_size
2153
- $bg_image_size = 'full';
2154
- if (isset($other_settings_arr) && (count($other_settings_arr) > 6)) {
2155
- if ($other_settings_arr[6] != '') {
2156
- $bg_image_size = $other_settings_arr[6];
2157
- }
2158
- }
2159
- // setting 8 - sa_disable_slide_ids
2160
- if (isset($other_settings_arr) && (count($other_settings_arr) > 7)) {
2161
- $disable_slide_ids = $other_settings_arr[7];
2162
- } else {
2163
- $disable_slide_ids = '0';
2164
- }
2165
-
2166
- // USE 'DOMContentLoaded' EVENT (checkbox)
2167
- $tooltip = 'Load the Slide Anything JavaScript during the DOMContentLoaded event. Use this option if jQuery ';
2168
- $tooltip .= 'is loading in your theme footer and you are getting the JavaScript error message ';
2169
- $tooltip .= '&quot;Uncaught ReferenceError: jQuery is not defined&quot;.';
2170
- echo "<div class='sa_window_onload_line'>";
2171
- echo "<span class='sa_tooltip' title='".$tooltip."'></span><span style='min-width:160px;'>DOMContentLoaded event:</span>";
2172
- if ($window_onload == '1') {
2173
- echo "<input type='checkbox' id='sa_window_onload' name='sa_window_onload' value='1' checked/>";
2174
- } else {
2175
- echo "<input type='checkbox' id='sa_window_onload' name='sa_window_onload' value='1'/>";
2176
- }
2177
- echo "</div>\n";
2178
-
2179
- // Strip JavaScript from Content
2180
- /*
2181
- $tooltip = 'Remove JavaScript (<script> tags) from slide content for extra security.';
2182
- echo "<div class='sa_window_onload_line'>";
2183
- echo "<span class='sa_tooltip' title='".$tooltip."'></span><span style='min-width:160px;'>Remove JavaScript Content:</span>";
2184
- if ($strip_javascript == '1') {
2185
- echo "<input type='checkbox' id='sa_strip_javascript' name='sa_strip_javascript' value='1' checked/>";
2186
- } else {
2187
- echo "<input type='checkbox' id='sa_strip_javascript' name='sa_strip_javascript' value='1'/>";
2188
- }
2189
- echo "</div>\n";
2190
- */
2191
-
2192
- // Enable Lazy Load Images
2193
- // ##### REMOVE LAZY LOAD IMAGES FEATURE (WHICH IS NOW INCLUDED IN WP 5.5) #####
2194
- /*
2195
- $tooltip = "Enable &quot;Lazy Load&quot; for images added to your slide content (note: does not apply to slide backgrounds).";
2196
- echo "<div class='sa_window_onload_line'>";
2197
- echo "<span class='sa_tooltip' title='".$tooltip."'></span><span style='min-width:160px;'>Enable 'Lazy Load' Images:</span>";
2198
- if ($lazy_load_images == '1') {
2199
- echo "<input type='checkbox' id='sa_lazy_load_images' name='sa_lazy_load_images' value='1' checked/>";
2200
- } else {
2201
- echo "<input type='checkbox' id='sa_lazy_load_images' name='sa_lazy_load_images' value='1'/>";
2202
- }
2203
- echo "</div>\n";
2204
- */
2205
- echo "<div style='display:none !important;'>";
2206
- echo "<input type='checkbox' id='sa_lazy_load_images' name='sa_lazy_load_images' value='0'/>";
2207
- echo "</div>\n";
2208
-
2209
- // Use UL and LI Containers
2210
- $tooltip = "Use &quot;UL&quot; as the DOM element for &quot;owl-stage&quot; and use &quot;LI&quot; as the DOM elements for &quot;owl-item&quot;.";
2211
- echo "<div class='sa_window_onload_line'>";
2212
- echo "<span class='sa_tooltip' title='".$tooltip."'></span><span style='min-width:160px;'>Use UL and LI Containers:</span>";
2213
- if ($ulli_containers == '1') {
2214
- echo "<input type='checkbox' id='sa_ulli_containers' name='sa_ulli_containers' value='1' checked/>";
2215
- } else {
2216
- echo "<input type='checkbox' id='sa_ulli_containers' name='sa_ulli_containers' value='1'/>";
2217
- }
2218
- echo "</div>\n";
2219
-
2220
- // Right to Left Slider
2221
- $tooltip = "Change the direction of the slider to be right to left.";
2222
- echo "<div class='sa_window_onload_line'>";
2223
- echo "<span class='sa_tooltip' title='".$tooltip."'></span><span style='min-width:160px;'>Right to Left Slider:</span>";
2224
- if ($rtl_slider == '1') {
2225
- echo "<input type='checkbox' id='sa_rtl_slider' name='sa_rtl_slider' value='1' checked/>";
2226
- } else {
2227
- echo "<input type='checkbox' id='sa_rtl_slider' name='sa_rtl_slider' value='1'/>";
2228
- }
2229
- echo "</div>\n";
2230
-
2231
- // Disable Preview Feature
2232
- $tooltip = "Disable the &quot;Preview Slider&quot; feature in this settings page - the &quot;Slide Anything Popup Preview&quot; page will no longer be auto generated.";
2233
- echo "<div class='sa_window_onload_line'>";
2234
- echo "<span class='sa_tooltip' title='".$tooltip."'></span><span style='min-width:160px;'>Disable Preview Feature:</span>";
2235
- if ($disable_preview == '1') {
2236
- echo "<input type='checkbox' id='sa_disable_preview' name='sa_disable_preview' value='1' checked/>";
2237
- } else {
2238
- echo "<input type='checkbox' id='sa_disable_preview' name='sa_disable_preview' value='1'/>";
2239
- }
2240
- echo "</div>\n";
2241
-
2242
- // Don't use Slide IDs
2243
- $tooltip = "Do not use a unique CSS ID to identify each slide container - use a unique CSS Class instead.";
2244
- echo "<div class='sa_window_onload_line'>";
2245
- echo "<span class='sa_tooltip' title='".$tooltip."'></span><span style='min-width:160px;'>Don't use CSS IDs for slides:</span>";
2246
- if ($disable_slide_ids == '1') {
2247
- echo "<input type='checkbox' id='sa_disable_slide_ids' name='sa_disable_slide_ids' value='1' checked/>";
2248
- } else {
2249
- echo "<input type='checkbox' id='sa_disable_slide_ids' name='sa_disable_slide_ids' value='1'/>";
2250
- }
2251
- echo "</div>\n";
2252
-
2253
- // Start Position
2254
- $num_slides = intval(get_post_meta($post->ID, 'sa_num_slides', true));
2255
- if ($num_slides == '') {
2256
- $start_pos = 1;
2257
- } else {
2258
- $start_pos = intval(get_post_meta($post->ID, 'sa_start_pos', true));
2259
- if ($start_pos == '') {
2260
- $start_pos = 1;
2261
- }
2262
- $tooltip = "Which slide number to start display first";
2263
- echo "<div class='sa_window_onload_line'>";
2264
- echo "<span class='sa_tooltip' title='".$tooltip."'></span><span style='min-width:160px;'>Starting Slide Number:</span>";
2265
- echo "<select name='sa_start_pos'>";
2266
- for ($i = 1; $i <= $num_slides; $i++) {
2267
- if ($i == $start_pos) {
2268
- echo "<option value='".esc_attr($i)."' selected>".esc_html($i)."</option>";
2269
- } else {
2270
- echo "<option value='".esc_attr($i)."'>".esc_html($i)."</option>";
2271
- }
2272
- }
2273
- echo "</select>";
2274
- echo "</div>\n";
2275
- }
2276
-
2277
- // SLIDE BACKGROUND IMAGE SIZE
2278
- global $_wp_additional_image_sizes;
2279
- $image_size_arr = array();
2280
- // get wordpress image size data and save into and array
2281
- $image_size_arr[0]['value'] = "full";
2282
- $image_size_arr[0]['desc'] = "Full Size";
2283
- $count = 1;
2284
- foreach (get_intermediate_image_sizes() as $image_size) {
2285
- if (in_array($image_size, array('thumbnail', 'medium', 'medium_large', 'large'))) {
2286
- $width = get_option("{$image_size}_size_w");
2287
- $height = get_option("{$image_size}_size_h");
2288
- } elseif (isset($_wp_additional_image_sizes[$image_size])) {
2289
- $width = $_wp_additional_image_sizes[$image_size]['width'];
2290
- $height = $_wp_additional_image_sizes[$image_size]['height'];
2291
- }
2292
- if (($width != 0) && ($height != 0)) {
2293
- $image_size_arr[$count]['value'] = $image_size;
2294
- $image_size_arr[$count]['desc'] = $image_size." (".$width."&times;".$height.")";
2295
- $count++;
2296
- }
2297
- }
2298
- // display the dropdown input box allowing user to select background image size
2299
- $tooltip = "Allows you to set the WordPress image size to use for your slide background images.";
2300
- echo "<div class='bg_image_size_wrapper'>\n<div>\n";
2301
- echo "<em class='sa_tooltip' href='' title='".$tooltip."'></em>";
2302
- echo "<span>Background Image Size:</span>";
2303
- echo "<div style='float:none; clear:both; width:100%; height:1px; padding:0px !important;'></div>\n</div>\n";
2304
- echo "<select name='bg_image_size'>";
2305
- for ($j = 0; $j < count($image_size_arr); $j++) {
2306
- if ($bg_image_size == $image_size_arr[$j]['value']) {
2307
- echo "<option value='".esc_attr($image_size_arr[$j]['value'])."' selected>".esc_html($image_size_arr[$j]['desc'])."</option>";
2308
- } else {
2309
- echo "<option value='".esc_attr($image_size_arr[$j]['value'])."'>".esc_html($image_size_arr[$j]['desc'])."</option>";
2310
- }
2311
- }
2312
- echo "</select>\n";
2313
- echo "</div>\n"; // .bg_image_size_wrapper
2314
-
2315
- echo "</div>\n";
2316
- }
2317
-
2318
-
2319
-
2320
- // ##### META BOX CONTENT - 'Thumbnails (Pagination)' BOX #####
2321
- function cpt_slider_thumbs_content($post) {
2322
- $sa_pro_version = validate_slide_anything_pro_registration();
2323
-
2324
- if ($sa_pro_version) {
2325
- // get wordpress image size data and save into and array
2326
- global $_wp_additional_image_sizes;
2327
- $image_size_arr = array();
2328
- $count = 0;
2329
- foreach (get_intermediate_image_sizes() as $image_size) {
2330
- if (in_array($image_size, array('thumbnail', 'medium', 'medium_large', 'large'))) {
2331
- $width = get_option("{$image_size}_size_w");
2332
- $height = get_option("{$image_size}_size_h");
2333
- } elseif (isset($_wp_additional_image_sizes[$image_size])) {
2334
- $width = $_wp_additional_image_sizes[$image_size]['width'];
2335
- $height = $_wp_additional_image_sizes[$image_size]['height'];
2336
- }
2337
- if (($width != 0) && ($height != 0)) {
2338
- $image_size_arr[$count]['value'] = $image_size;
2339
- $image_size_arr[$count]['desc'] = $image_size." (".$width."&times;".$height.")";
2340
- $count++;
2341
- }
2342
- }
2343
-
2344
- // Use thumbnail pagination (checkbox)
2345
- $thumbs_active = get_post_meta($post->ID, 'sa_thumbs_active', true);
2346
- if ($thumbs_active == '') {
2347
- $thumbs_active = '0';
2348
- }
2349
- echo "<div class='sa_thumbs_line'><span>Use Thumbnail Pagination:</span>";
2350
- if ($thumbs_active == '1') {
2351
- echo "<input type='checkbox' id='sa_thumbs_active' name='sa_thumbs_active' value='1' checked/>";
2352
- } else {
2353
- echo "<input type='checkbox' id='sa_thumbs_active' name='sa_thumbs_active' value='1'/>";
2354
- }
2355
- echo "</div>\n";
2356
-
2357
- if ($thumbs_active == '1') {
2358
- echo "<div id='sa_thumbs_settings' style='display:block;'>\n";
2359
- } else {
2360
- echo "<div id='sa_thumbs_settings' style='display:none;'>\n";
2361
- }
2362
-
2363
- // Thumbs Location (dropdown)
2364
- $thumbs_location = get_post_meta($post->ID, 'sa_thumbs_location', true);
2365
- if ($thumbs_location == '') {
2366
- $thumbs_location = 'inside_bottom';
2367
- }
2368
- echo "<div class='sa_thumbs_line'><span>Thumbs Location:</span>";
2369
- echo "<select id='sa_thumbs_location' name='sa_thumbs_location'>";
2370
- $option_arr = array();
2371
- $option_arr[0] = 'Inside Bottom';
2372
- $option_arr[1] = 'Inside Top';
2373
- $option_arr[2] = 'Inside Left';
2374
- $option_arr[3] = 'Inside Right';
2375
- $option_arr[4] = 'Outside Bottom';
2376
- for ($i = 0; $i < count($option_arr); $i++) {
2377
- $value = strtolower(str_replace(' ', '_', $option_arr[$i]));
2378
- if ($value == $thumbs_location) {
2379
- echo "<option value='".$value."' selected>".$option_arr[$i]."</option>";
2380
- } else {
2381
- echo "<option value='".$value."'>".$option_arr[$i]."</option>";
2382
- }
2383
- }
2384
- echo "</select></div>\n";
2385
-
2386
- // Thumbnail Image Size (dropdown)
2387
- $thumbs_image_size = get_post_meta($post->ID, 'sa_thumbs_image_size', true);
2388
- if ($thumbs_image_size == '') {
2389
- $thumbs_image_size = 'thumbnail';
2390
- }
2391
- echo "<div class='sa_thumbs_line'><span>Thumbnail Image Size:</span>";
2392
- echo "<select id='sa_thumbs_image_size' name='sa_thumbs_image_size'>";
2393
- for ($i = 0; $i < count($image_size_arr); $i++) {
2394
- if ($image_size_arr[$i]['value'] == $thumbs_image_size) {
2395
- echo "<option value='".$image_size_arr[$i]['value']."' selected>".$image_size_arr[$i]['desc']."</option>";
2396
- } else {
2397
- echo "<option value='".$image_size_arr[$i]['value']."'>".$image_size_arr[$i]['desc']."</option>";
2398
- }
2399
- }
2400
- echo "</select></div>\n";
2401
-
2402
- // Container Padding
2403
- $thumbs_padding = get_post_meta($post->ID, 'sa_thumbs_padding', true);
2404
- if ($thumbs_padding == '') {
2405
- $thumbs_padding = '3';
2406
- }
2407
- echo "<div class='sa_thumbs_line'><span>Container Padding:</span>";
2408
- echo "<input type='text' id='sa_thumbs_padding' name='sa_thumbs_padding' value='".esc_attr($thumbs_padding)."'><em>%</em>";
2409
- echo "</div>\n";
2410
-
2411
- // Thumbs Width
2412
- $thumbs_width = get_post_meta($post->ID, 'sa_thumbs_width', true);
2413
- if ($thumbs_width == '') {
2414
- $thumbs_width = '150';
2415
- }
2416
- echo "<div class='sa_thumbs_line'><span>Thumbs Width:</span>";
2417
- echo "<input type='text' id='sa_thumbs_width' name='sa_thumbs_width' value='".esc_attr($thumbs_width)."'><em>px</em>";
2418
- echo "</div>\n";
2419
-
2420
- // Thumbs Height
2421
- $thumbs_height = get_post_meta($post->ID, 'sa_thumbs_height', true);
2422
- if ($thumbs_height == '') {
2423
- $thumbs_height = '85';
2424
- }
2425
- echo "<div class='sa_thumbs_line'><span>Thumbs Height:</span>";
2426
- echo "<input type='text' id='sa_thumbs_height' name='sa_thumbs_height' value='".esc_attr($thumbs_height)."'><em>px</em>";
2427
- echo "</div>\n";
2428
-
2429
- // Thumbs Opacity
2430
- $thumbs_opacity = get_post_meta($post->ID, 'sa_thumbs_opacity', true);
2431
- if ($thumbs_opacity == '') {
2432
- $thumbs_opacity = '50';
2433
- }
2434
- echo "<div class='sa_thumbs_line'><span>Thumbs Opacity:</span>";
2435
- echo "<input type='text' id='sa_thumbs_opacity' name='sa_thumbs_opacity' value='".esc_attr($thumbs_opacity)."'><em>%</em>";
2436
- echo "</div>\n";
2437
-
2438
- echo "<h4>Active Thumb Border Style</h4>";
2439
-
2440
- // Border Width
2441
- $thumbs_border_width = get_post_meta($post->ID, 'sa_thumbs_border_width', true);
2442
- if ($thumbs_border_width == '') {
2443
- $thumbs_border_width = '0';
2444
- }
2445
- echo "<div class='sa_thumbs_line'><span>Border Width:</span>";
2446
- echo "<input type='text' id='sa_thumbs_border_width' name='sa_thumbs_border_width' value='".esc_attr($thumbs_border_width)."'><em>px</em>";
2447
- echo "</div>\n";
2448
-
2449
- // Border Color
2450
- $thumbs_border_color = get_post_meta($post->ID, 'sa_thumbs_border_color', true);
2451
- if ($thumbs_border_color == '') {
2452
- $thumbs_border_color = '#ffffff';
2453
- }
2454
- echo "<div class='sa_thumbs_line'><span>Border Color:</span>";
2455
- echo "<input type='text' id='sa_thumbs_border_color' name='sa_thumbs_border_color' value='".esc_attr($thumbs_border_color)."'></div>\n";
2456
-
2457
- echo "<h4>Responsive Thumb Sizes</h4>";
2458
-
2459
- // Tablet Thumb Size
2460
- $thumbs_resp_tablet = get_post_meta($post->ID, 'sa_thumbs_resp_tablet', true);
2461
- if ($thumbs_resp_tablet == '') {
2462
- $thumbs_resp_tablet = '75';
2463
- }
2464
- echo "<div class='sa_thumbs_line'><span>Tablet Thumb Size:</span>";
2465
- echo "<input type='text' id='sa_thumbs_resp_tablet' name='sa_thumbs_resp_tablet' value='".esc_attr($thumbs_resp_tablet)."'><em>%</em>";
2466
- echo "</div>\n";
2467
-
2468
- // Mobile Thumb Size
2469
- $thumbs_resp_mobile = get_post_meta($post->ID, 'sa_thumbs_resp_mobile', true);
2470
- if ($thumbs_resp_mobile == '') {
2471
- $thumbs_resp_mobile = '50';
2472
- }
2473
- echo "<div class='sa_thumbs_line'><span>Mobile Thumb Size:</span>";
2474
- echo "<input type='text' id='sa_thumbs_resp_mobile' name='sa_thumbs_resp_mobile' value='".esc_attr($thumbs_resp_mobile)."'><em>%</em>";
2475
- echo "</div>\n";
2476
-
2477
- echo "</div>\n"; // #sa_thumbs_settings
2478
-
2479
- } else {
2480
-
2481
- // display slide anything pro promotional text
2482
- echo "<div id='sa_thumbs_promo'>";
2483
- echo "<h4>Available in the PRO VERSION only!</h4>\n";
2484
- echo "<p>With <strong>Slide Anything PRO </strong> you can now add <strong>Thumbnail Pagination</strong>.";
2485
- echo "<p>Wiew a Thumbnail Pagination DEMO here:</p>";
2486
- echo "<p style='padding-top:2px !important;'><a href='https://edgewebpages.com/hero-slider-with-thumbnails' target='_blank'>THUMBNAIL PAGINATION DEMO</a></p>";
2487
- echo "</div>";
2488
- }
2489
- }
2490
-
2491
-
2492
-
2493
- // ##### META BOX CONTENT - 'Slide Any Post' PROMOTION BOX #####
2494
- function cpt_slide_any_post_content() {
2495
- echo "<div id='sa_post_notice'>\n";
2496
- echo "<div id='sapn_image'>\n";
2497
- echo "<a href='https://edgewebpages.com/sap' title='View the Slide Any Post website' target='_blank'>";
2498
- echo "<img src='".get_site_url()."/wp-content/plugins/slide-anything/images/slide_any_post_logo.png' />";
2499
- echo "</a>\n";
2500
- echo "</div>\n"; // #sapn_image
2501
- echo "<div id='sapn_text'>\n";
2502
- echo "<h3>Generate a carousel/slider for ANY WordPress post type!</h3>\n";
2503
- echo "<h5>Filter specific posts, filter by taxonomy, or filter by meta data values</h5>\n";
2504
- echo "<h5>Create custom slide layouts containing post taxonomy data and post meta data</h5>\n";
2505
- echo "<div><a id='sapn_link' href='https://edgewebpages.com/sap' title='View the Slide Any Post website' ";
2506
- echo "target='_blank'>MORE INFORMATION</a>\n";
2507
- echo "<a id='sapn_dismiss' href='".$_SERVER['REQUEST_URI']."&sapost_ignore=0'>DISMISS THIS NOTICE</a></div>";
2508
- echo "</div>\n"; // #sapn_text
2509
- echo "<div style='float:none; clear:both; width:100%; height:1px;'></div>\n";
2510
- echo "</div>\n"; // #sa_post_notice
2511
- }
2512
-
2513
-
2514
-
2515
- // ##### ACTION HOOK - SAVE CUSTOM POST TYPE ('Slide Anything') DATA #####
2516
- function cpt_slider_save_postdata() {
2517
- global $post;
2518
- $sa_pro_version = validate_slide_anything_pro_registration();
2519
-
2520
- // ### REMOVE XSS ATTACK VULNERABILITY FROM SLIDER POST TITLES ###
2521
- global $wpdb;
2522
- if (isset($post->ID) && ($post->ID != '')) {
2523
- $post_title = get_the_title($post->ID);
2524
- $sanitize_title = sanitize_text_field($post_title);
2525
- $where = array('ID' => $post->ID);
2526
- $wpdb->update($wpdb->posts, array('post_title' => $sanitize_title), $where);
2527
- }
2528
-
2529
- // ### VERIFY 1) LOGGED-IN USER IS ADMINISTRATOR AND 2) VALID NONCE TO PREVENT CSRF HACKER ATTACKS ###
2530
- if (current_user_can('edit_pages') &&
2531
- isset($_POST['nonce_save_slider']) && wp_verify_nonce($_POST['nonce_save_slider'], basename(__FILE__))) {
2532
- $total_slides = intval($_POST['sa_num_slides']);
2533
- if (($_POST['sa_duplicate_slide'] == '') || ($_POST['sa_duplicate_slide'] == '0')) {
2534
- $duplicate_slide = 0;
2535
- } else {
2536
- // A SLIDE NEEDS TO BE DUPLICATED
2537
- $duplicate_slide = intval($_POST['sa_duplicate_slide']);
2538
- }
2539
- if (($_POST['sa_move_slide_up'] == '') || ($_POST['sa_move_slide_up'] == '0')) {
2540
- $move_slide_up = 0;
2541
- } else {
2542
- // A SLIDE NEEDS TO BE MOVED
2543
- $move_slide_up = intval($_POST['sa_move_slide_up']);
2544
- }
2545
-
2546
- // UPDATE CONTENT FOR EACH SLIDE
2547
- $slides_saved = 0;
2548
- for ($i = 1; $i <= $total_slides; $i++) {
2549
- $slide_edit_id = "sa_slide".$i."_content";
2550
- $slide_image_id = "sa_slide".$i."_image_id";
2551
- $slide_image_pos = "sa_slide".$i."_image_pos";
2552
- $slide_image_size = "sa_slide".$i."_image_size";
2553
- $slide_image_repeat = "sa_slide".$i."_image_repeat";
2554
- $slide_image_color = "sa_slide".$i."_image_color";
2555
- $slide_link_url = "sa_slide".$i."_link_url";
2556
- $slide_link_target = "sa_slide".$i."_link_target";
2557
- if ($sa_pro_version) {
2558
- $slide_popup_type = "sa_slide".$i."_popup_type";
2559
- $slide_popup_imageid = "sa_slide".$i."_popup_imageid";
2560
- $slide_popup_imagetitle = "sa_slide".$i."_popup_imagetitle";
2561
- $slide_popup_video_id = "sa_slide".$i."_popup_video_id";
2562
- $slide_popup_video_type = "sa_slide".$i."_popup_video_type";
2563
- $slide_popup_background = "sa_slide".$i."_popup_background";
2564
- $slide_popup_html = "sa_slide".$i."_popup_html";
2565
- $slide_popup_shortcode = "sa_slide".$i."_popup_shortcode";
2566
- $slide_popup_bgcol = "sa_slide".$i."_popup_bgcol";
2567
- $slide_popup_width = "sa_slide".$i."_popup_width";
2568
- }
2569
- $slide_content = wp_kses_post($_POST[$slide_edit_id]); // SANATIZE
2570
- $slide_content = $slide_content; // FIX MISSING CLOSING TAGS
2571
- $slide_image_id_val = abs(intval($_POST[$slide_image_id])); // SANATIZE
2572
- $slide_image_pos_val = sanitize_text_field($_POST[$slide_image_pos]); // SANATIZE
2573
- $slide_image_size_val = sanitize_text_field($_POST[$slide_image_size]); // SANATIZE
2574
- $slide_image_repeat_val = sanitize_text_field($_POST[$slide_image_repeat]); // SANATIZE
2575
- $slide_image_color_val = sanitize_text_field($_POST[$slide_image_color]); // SANATIZE
2576
- $slide_link_url_val = sanitize_text_field($_POST[$slide_link_url]); // SANATIZE
2577
- $slide_link_target_val = sanitize_text_field($_POST[$slide_link_target]); // SANATIZE
2578
- if ($sa_pro_version) {
2579
- $slide_popup_type_val = sanitize_text_field($_POST[$slide_popup_type]); // SANATIZE
2580
- $slide_popup_imageid_val = sanitize_text_field($_POST[$slide_popup_imageid]); // SANATIZE
2581
- $slide_popup_imagetitle_val = sanitize_text_field($_POST[$slide_popup_imagetitle]); // SANATIZE
2582
- $slide_popup_video_id_val = sanitize_text_field($_POST[$slide_popup_video_id]); // SANATIZE
2583
- $slide_popup_video_type_val = sanitize_text_field($_POST[$slide_popup_video_type]); // SANATIZE
2584
- $slide_popup_background_val = sanitize_text_field($_POST[$slide_popup_background]); // SANATIZE
2585
- $slide_popup_html_val = balanceTags($_POST[$slide_popup_html], true); // FIX MISSING CLOSING TAGS
2586
- if (isset($_POST[$slide_popup_shortcode])) {
2587
- $slide_popup_shortcode_val = sanitize_text_field($_POST[$slide_popup_shortcode]); // SANATIZE
2588
- } else {
2589
- $slide_popup_shortcode_val = '';
2590
- }
2591
- $slide_popup_bgcol_val = sanitize_text_field($_POST[$slide_popup_bgcol]); // SANATIZE
2592
- $slide_popup_width_val = abs(intval($_POST[$slide_popup_width])); // SANATIZE
2593
- }
2594
- // check delete status for slide
2595
- $del_status_id = "sa_slide".$i."_delete";
2596
- if (isset($_POST[$del_status_id]) && ($_POST[$del_status_id] != '')) {
2597
- $del_status = $_POST[$del_status_id];
2598
- } else {
2599
- // a new slide has been added
2600
- $del_status = '1';
2601
- $slide_content = '';
2602
- }
2603
- if ($del_status == '1') {
2604
- // save slide content only if slide has not been marked for deletion
2605
- $slides_saved++;
2606
- $slide_edit_id_save = "sa_slide".$slides_saved."_content";
2607
- $slide_image_data_saved = "sa_slide".$slides_saved."_image_data";
2608
- $slide_link_url_saved = "sa_slide".$slides_saved."_link_url";
2609
- $slide_link_target_saved = "sa_slide".$slides_saved."_link_target";
2610
- if ($sa_pro_version) {
2611
- $slide_popup_type_saved = "sa_slide".$slides_saved."_popup_type";
2612
- $slide_popup_imageid_saved = "sa_slide".$slides_saved."_popup_imageid";
2613
- $slide_popup_imagetitle_saved = "sa_slide".$slides_saved."_popup_imagetitle";
2614
- $slide_popup_video_id_saved = "sa_slide".$slides_saved."_popup_video_id";
2615
- $slide_popup_video_type_saved = "sa_slide".$slides_saved."_popup_video_type";
2616
- $slide_popup_background_saved = "sa_slide".$slides_saved."_popup_background";
2617
- $slide_popup_html_saved = "sa_slide".$slides_saved."_popup_html";
2618
- $slide_popup_shortcode_saved = "sa_slide".$slides_saved."_popup_shortcode";
2619
- $slide_popup_bgcol_saved = "sa_slide".$slides_saved."_popup_bgcol";
2620
- $slide_popup_width_saved = "sa_slide".$slides_saved."_popup_width";
2621
- }
2622
- update_post_meta($post->ID, $slide_edit_id_save, $slide_content);
2623
- $slide_image_data_val = $slide_image_id_val."~".$slide_image_pos_val."~".$slide_image_size_val."~".$slide_image_repeat_val."~".$slide_image_color_val;
2624
- update_post_meta($post->ID, $slide_image_data_saved, $slide_image_data_val);
2625
- update_post_meta($post->ID, $slide_link_url_saved, $slide_link_url_val);
2626
- update_post_meta($post->ID, $slide_link_target_saved, $slide_link_target_val);
2627
- if ($sa_pro_version) {
2628
- update_post_meta($post->ID, $slide_popup_type_saved, $slide_popup_type_val);
2629
- update_post_meta($post->ID, $slide_popup_imageid_saved, $slide_popup_imageid_val);
2630
- update_post_meta($post->ID, $slide_popup_imagetitle_saved, $slide_popup_imagetitle_val);
2631
- update_post_meta($post->ID, $slide_popup_video_id_saved, $slide_popup_video_id_val);
2632
- update_post_meta($post->ID, $slide_popup_video_type_saved, $slide_popup_video_type_val);
2633
- update_post_meta($post->ID, $slide_popup_background_saved, $slide_popup_background_val);
2634
- update_post_meta($post->ID, $slide_popup_html_saved, $slide_popup_html_val);
2635
- update_post_meta($post->ID, $slide_popup_shortcode_saved, $slide_popup_shortcode_val);
2636
- update_post_meta($post->ID, $slide_popup_bgcol_saved, $slide_popup_bgcol_val);
2637
- update_post_meta($post->ID, $slide_popup_width_saved, $slide_popup_width_val);
2638
- }
2639
- if ($i == $duplicate_slide) {
2640
- // the 'duplicate slide' button has been click for this slide - create a new slide that is an exact copy of previous slide
2641
- // (REPEAT THE CODE ABOVE HERE!!!)
2642
- $slides_saved++;
2643
- $slide_edit_id_save = "sa_slide".$slides_saved."_content";
2644
- $slide_image_data_saved = "sa_slide".$slides_saved."_image_data";
2645
- $slide_link_url_saved = "sa_slide".$slides_saved."_link_url";
2646
- $slide_link_target_saved = "sa_slide".$slides_saved."_link_target";
2647
- if ($sa_pro_version) {
2648
- $slide_popup_type_saved = "sa_slide".$slides_saved."_popup_type";
2649
- $slide_popup_imageid_saved = "sa_slide".$slides_saved."_popup_imageid";
2650
- $slide_popup_imagetitle_saved = "sa_slide".$slides_saved."_popup_imagetitle";
2651
- $slide_popup_video_id_saved = "sa_slide".$slides_saved."_popup_video_id";
2652
- $slide_popup_video_type_saved = "sa_slide".$slides_saved."_popup_video_type";
2653
- $slide_popup_background_saved = "sa_slide".$slides_saved."_popup_background";
2654
- $slide_popup_html_saved = "sa_slide".$slides_saved."_popup_html";
2655
- $slide_popup_shortcode_saved = "sa_slide".$slides_saved."_popup_shortcode";
2656
- $slide_popup_bgcol_saved = "sa_slide".$slides_saved."_popup_bgcol";
2657
- $slide_popup_width_saved = "sa_slide".$slides_saved."_popup_width";
2658
- }
2659
- update_post_meta($post->ID, $slide_edit_id_save, $slide_content);
2660
- $slide_image_data_val = $slide_image_id_val."~".$slide_image_pos_val."~".$slide_image_size_val."~".$slide_image_repeat_val."~".$slide_image_color_val;
2661
- update_post_meta($post->ID, $slide_image_data_saved, $slide_image_data_val);
2662
- update_post_meta($post->ID, $slide_link_url_saved, $slide_link_url_val);
2663
- update_post_meta($post->ID, $slide_link_target_saved, $slide_link_target_val);
2664
- if ($sa_pro_version) {
2665
- update_post_meta($post->ID, $slide_popup_type_saved, $slide_popup_type_val);
2666
- update_post_meta($post->ID, $slide_popup_imageid_saved, $slide_popup_imageid_val);
2667
- update_post_meta($post->ID, $slide_popup_imagetitle_saved, $slide_popup_imagetitle_val);
2668
- update_post_meta($post->ID, $slide_popup_video_id_saved, $slide_popup_video_id_val);
2669
- update_post_meta($post->ID, $slide_popup_video_type_saved, $slide_popup_video_type_val);
2670
- update_post_meta($post->ID, $slide_popup_background_saved, $slide_popup_background_val);
2671
- update_post_meta($post->ID, $slide_popup_html_saved, $slide_popup_html_val);
2672
- update_post_meta($post->ID, $slide_popup_shortcode_saved, $slide_popup_shortcode_val);
2673
- update_post_meta($post->ID, $slide_popup_bgcol_saved, $slide_popup_bgcol_val);
2674
- update_post_meta($post->ID, $slide_popup_width_saved, $slide_popup_width_val);
2675
- }
2676
- }
2677
- }
2678
- }
2679
-
2680
- if ($move_slide_up != 0) {
2681
- // A SLIDE NEEDS TO BE MOVED (TWO SLIDES ARE SWAPPED)
2682
- $slide2 = $move_slide_up;
2683
- $slide1 = intval($move_slide_up) - 1;
2684
- //$slide1_content = wp_kses_post($_POST["sa_slide".$slide1."_content"]); // SANATIZE
2685
- $slide1_content = balanceTags($_POST["sa_slide".$slide1."_content"], true); // FIX MISSING CLOSING TAGS
2686
- $slide1_image_id = abs(intval($_POST["sa_slide".$slide1."_image_id"])); // SANATIZE
2687
- $slide1_image_pos = sanitize_text_field($_POST["sa_slide".$slide1."_image_pos"]); // SANATIZE
2688
- $slide1_image_size = sanitize_text_field($_POST["sa_slide".$slide1."_image_size"]); // SANATIZE
2689
- $slide1_image_repeat = sanitize_text_field($_POST["sa_slide".$slide1."_image_repeat"]); // SANATIZE
2690
- $slide1_image_color = sanitize_text_field($_POST["sa_slide".$slide1."_image_color"]); // SANATIZE
2691
- $slide1_link_url = sanitize_text_field($_POST["sa_slide".$slide1."_link_url"]); // SANATIZE
2692
- $slide1_link_target = sanitize_text_field($_POST["sa_slide".$slide1."_link_target"]); // SANATIZE
2693
- if ($sa_pro_version) {
2694
- $slide1_popup_type = sanitize_text_field($_POST["sa_slide".$slide1."_popup_type"]); // SANATIZE
2695
- $slide1_popup_imageid = sanitize_text_field($_POST["sa_slide".$slide1."_popup_imageid"]); // SANATIZE
2696
- $slide1_popup_imagetitle = sanitize_text_field($_POST["sa_slide".$slide1."_popup_imagetitle"]); // SANATIZE
2697
- $slide1_popup_video_id = sanitize_text_field($_POST["sa_slide".$slide1."_popup_video_id"]); // SANATIZE
2698
- $slide1_popup_video_type = sanitize_text_field($_POST["sa_slide".$slide1."_popup_video_type"]); // SANATIZE
2699
- $slide1_popup_background = sanitize_text_field($_POST["sa_slide".$slide1."_popup_background"]); // SANATIZE
2700
- $slide1_popup_html = balanceTags($_POST["sa_slide".$slide1."_popup_html"], true); // FIX MISSING CLOSING TAGS
2701
- $slide1_popup_shortcode = sanitize_text_field($_POST["sa_slide".$slide1."_popup_shortcode"]); // SANATIZE
2702
- $slide1_popup_bgcol = sanitize_text_field($_POST["sa_slide".$slide1."_popup_bgcol"]); // SANATIZE
2703
- $slide1_popup_width = abs(intval($_POST["sa_slide".$slide1."_popup_width"])); // SANATIZE
2704
- }
2705
- //$slide2_content = wp_kses_post($_POST["sa_slide".$slide2."_content"]); // SANATIZE
2706
- $slide2_content = balanceTags($_POST["sa_slide".$slide2."_content"], true); // FIX MISSING CLOSING TAGS
2707
- $slide2_image_id = abs(intval($_POST["sa_slide".$slide2."_image_id"])); // SANATIZE
2708
- $slide2_image_pos = sanitize_text_field($_POST["sa_slide".$slide2."_image_pos"]); // SANATIZE
2709
- $slide2_image_size = sanitize_text_field($_POST["sa_slide".$slide2."_image_size"]); // SANATIZE
2710
- $slide2_image_repeat = sanitize_text_field($_POST["sa_slide".$slide2."_image_repeat"]); // SANATIZE
2711
- $slide2_image_color = sanitize_text_field($_POST["sa_slide".$slide2."_image_color"]); // SANATIZE
2712
- $slide2_link_url = sanitize_text_field($_POST["sa_slide".$slide2."_link_url"]); // SANATIZE
2713
- $slide2_link_target = sanitize_text_field($_POST["sa_slide".$slide2."_link_target"]); // SANATIZE
2714
- if ($sa_pro_version) {
2715
- $slide2_popup_type = sanitize_text_field($_POST["sa_slide".$slide2."_popup_type"]); // SANATIZE
2716
- $slide2_popup_imageid = sanitize_text_field($_POST["sa_slide".$slide2."_popup_imageid"]); // SANATIZE
2717
- $slide2_popup_imagetitle = sanitize_text_field($_POST["sa_slide".$slide2."_popup_imagetitle"]); // SANATIZE
2718
- $slide2_popup_video_id = sanitize_text_field($_POST["sa_slide".$slide2."_popup_video_id"]); // SANATIZE
2719
- $slide2_popup_video_type = sanitize_text_field($_POST["sa_slide".$slide2."_popup_video_type"]); // SANATIZE
2720
- $slide2_popup_background = sanitize_text_field($_POST["sa_slide".$slide2."_popup_background"]); // SANATIZE
2721
- $slide2_popup_html = balanceTags($_POST["sa_slide".$slide2."_popup_html"], true); // FIX MISSING CLOSING TAGS
2722
- $slide2_popup_shortcode = sanitize_text_field($_POST["sa_slide".$slide2."_popup_shortcode"]); // SANATIZE
2723
- $slide2_popup_bgcol = sanitize_text_field($_POST["sa_slide".$slide2."_popup_bgcol"]); // SANATIZE
2724
- $slide2_popup_width = abs(intval($_POST["sa_slide".$slide2."_popup_width"])); // SANATIZE
2725
- }
2726
- update_post_meta($post->ID, "sa_slide".$slide2."_content", $slide1_content);
2727
- $slide1_image_data = $slide1_image_id."~".$slide1_image_pos."~".$slide1_image_size."~".$slide1_image_repeat."~".$slide1_image_color;
2728
- update_post_meta($post->ID, "sa_slide".$slide2."_image_data", $slide1_image_data);
2729
- update_post_meta($post->ID, "sa_slide".$slide2."_link_url", $slide1_link_url);
2730
- update_post_meta($post->ID, "sa_slide".$slide2."_link_target", $slide1_link_target);
2731
- if ($sa_pro_version) {
2732
- update_post_meta($post->ID, "sa_slide".$slide2."_popup_type", $slide1_popup_type);
2733
- update_post_meta($post->ID, "sa_slide".$slide2."_popup_imageid", $slide1_popup_imageid);
2734
- update_post_meta($post->ID, "sa_slide".$slide2."_popup_imagetitle", $slide1_popup_imagetitle);
2735
- update_post_meta($post->ID, "sa_slide".$slide2."_popup_video_id", $slide1_popup_video_id);
2736
- update_post_meta($post->ID, "sa_slide".$slide2."_popup_video_type", $slide1_popup_video_type);
2737
- update_post_meta($post->ID, "sa_slide".$slide2."_popup_background", $slide1_popup_background);
2738
- update_post_meta($post->ID, "sa_slide".$slide2."_popup_html", $slide1_popup_html);
2739
- update_post_meta($post->ID, "sa_slide".$slide2."_popup_shortcode", $slide1_popup_shortcode);
2740
- update_post_meta($post->ID, "sa_slide".$slide2."_popup_bgcol", $slide1_popup_bgcol);
2741
- update_post_meta($post->ID, "sa_slide".$slide2."_popup_width", $slide1_popup_width);
2742
- }
2743
- update_post_meta($post->ID, "sa_slide".$slide1."_content", $slide2_content);
2744
- $slide2_image_data = $slide2_image_id."~".$slide2_image_pos."~".$slide2_image_size."~".$slide2_image_repeat."~".$slide2_image_color;
2745
- update_post_meta($post->ID, "sa_slide".$slide1."_image_data", $slide2_image_data);
2746
- update_post_meta($post->ID, "sa_slide".$slide1."_link_url", $slide2_link_url);
2747
- update_post_meta($post->ID, "sa_slide".$slide1."_link_target", $slide2_link_target);
2748
- if ($sa_pro_version) {
2749
- update_post_meta($post->ID, "sa_slide".$slide1."_popup_type", $slide2_popup_type);
2750
- update_post_meta($post->ID, "sa_slide".$slide1."_popup_imageid", $slide2_popup_imageid);
2751
- update_post_meta($post->ID, "sa_slide".$slide1."_popup_imagetitle", $slide2_popup_imagetitle);
2752
- update_post_meta($post->ID, "sa_slide".$slide1."_popup_video_id", $slide2_popup_video_id);
2753
- update_post_meta($post->ID, "sa_slide".$slide1."_popup_video_type", $slide2_popup_video_type);
2754
- update_post_meta($post->ID, "sa_slide".$slide1."_popup_background", $slide2_popup_background);
2755
- update_post_meta($post->ID, "sa_slide".$slide1."_popup_html", $slide2_popup_html);
2756
- update_post_meta($post->ID, "sa_slide".$slide1."_popup_shortcode", $slide2_popup_shortcode);
2757
- update_post_meta($post->ID, "sa_slide".$slide1."_popup_bgcol", $slide2_popup_bgcol);
2758
- update_post_meta($post->ID, "sa_slide".$slide1."_popup_width", $slide2_popup_width);
2759
- }
2760
- }
2761
-
2762
- // UPDATE SLIDE CONTENT CHARACTER COUNT
2763
- $total_slides = get_post_meta($post->ID, 'sa_num_slides', true);
2764
- for ($i = 1; $i <= $total_slides; $i++) {
2765
- $slide_content = get_post_meta($post->ID, "sa_slide".$i."_content", true);
2766
- $char_count = strlen($slide_content);
2767
- update_post_meta($post->ID, "sa_slide".$i."_char_count", $char_count);
2768
- }
2769
-
2770
- // UPDATE SLIDER SETTINGS
2771
- update_post_meta($post->ID, 'sa_num_slides', abs(intval($slides_saved))); // SANATIZE
2772
- if (isset($_POST['sa_disable_visual_editor']) && ($_POST['sa_disable_visual_editor'] == '1')) {
2773
- update_post_meta($post->ID, 'sa_disable_visual_editor', '1');
2774
- } else {
2775
- update_post_meta($post->ID, 'sa_disable_visual_editor', '0');
2776
- }
2777
- update_post_meta($post->ID, 'sa_info_added', abs(intval($_POST['sa_info_added']))); // SANATIZE
2778
- update_post_meta($post->ID, 'sa_info_deleted', abs(intval($_POST['sa_info_deleted']))); // SANATIZE
2779
- update_post_meta($post->ID, 'sa_duplicate_slide', abs(intval($_POST['sa_duplicate_slide']))); // SANATIZE
2780
- update_post_meta($post->ID, 'sa_info_duplicated', abs(intval($_POST['sa_info_duplicated']))); // SANATIZE
2781
- update_post_meta($post->ID, 'sa_move_slide_up', abs(intval($_POST['sa_move_slide_up']))); // SANATIZE
2782
- update_post_meta($post->ID, 'sa_info_moved', abs(intval($_POST['sa_info_moved']))); // SANATIZE
2783
- update_post_meta($post->ID, 'sa_slide_duration', abs(floatval($_POST['sa_slide_duration']))); // SANATIZE
2784
- update_post_meta($post->ID, 'sa_slide_transition', abs(floatval($_POST['sa_slide_transition']))); // SANATIZE
2785
- update_post_meta($post->ID, 'sa_slide_by', abs(floatval($_POST['sa_slide_by']))); // SANATIZE
2786
- if (isset($_POST['sa_loop_slider']) && ($_POST['sa_loop_slider'] == '1')) {
2787
- update_post_meta($post->ID, 'sa_loop_slider', '1');
2788
- } else {
2789
- update_post_meta($post->ID, 'sa_loop_slider', '0');
2790
- }
2791
- if (isset($_POST['sa_stop_hover']) && ($_POST['sa_stop_hover'] == '1')) {
2792
- update_post_meta($post->ID, 'sa_stop_hover', '1');
2793
- } else {
2794
- update_post_meta($post->ID, 'sa_stop_hover', '0');
2795
- }
2796
- if (isset($_POST['sa_nav_arrows']) && ($_POST['sa_nav_arrows'] == '1')) {
2797
- update_post_meta($post->ID, 'sa_nav_arrows', '1');
2798
- } else {
2799
- update_post_meta($post->ID, 'sa_nav_arrows', '0');
2800
- }
2801
- if (isset($_POST['sa_pagination']) && ($_POST['sa_pagination'] == '1')) {
2802
- update_post_meta($post->ID, 'sa_pagination', '1');
2803
- } else {
2804
- update_post_meta($post->ID, 'sa_pagination', '0');
2805
- }
2806
- if (isset($_POST['sa_random_order']) && ($_POST['sa_random_order'] == '1')) {
2807
- update_post_meta($post->ID, 'sa_random_order', '1');
2808
- } else {
2809
- update_post_meta($post->ID, 'sa_random_order', '0');
2810
- }
2811
- if (isset($_POST['sa_reverse_order']) && ($_POST['sa_reverse_order'] == '1')) {
2812
- update_post_meta($post->ID, 'sa_reverse_order', '1');
2813
- } else {
2814
- update_post_meta($post->ID, 'sa_reverse_order', '0');
2815
- }
2816
- if (isset($_POST['sa_shortcodes']) && ($_POST['sa_shortcodes'] == '1')) {
2817
- update_post_meta($post->ID, 'sa_shortcodes', '1');
2818
- } else {
2819
- update_post_meta($post->ID, 'sa_shortcodes', '0');
2820
- }
2821
- if (isset($_POST['sa_mouse_drag']) && ($_POST['sa_mouse_drag'] == '1')) {
2822
- update_post_meta($post->ID, 'sa_mouse_drag', '1');
2823
- } else {
2824
- update_post_meta($post->ID, 'sa_mouse_drag', '0');
2825
- }
2826
- if (isset($_POST['sa_touch_drag']) && ($_POST['sa_touch_drag'] == '1')) {
2827
- update_post_meta($post->ID, 'sa_touch_drag', '1');
2828
- } else {
2829
- update_post_meta($post->ID, 'sa_touch_drag', '0');
2830
- }
2831
- if (isset($_POST['sa_mousewheel']) && ($_POST['sa_mousewheel'] == '1')) {
2832
- update_post_meta($post->ID, 'sa_mousewheel', '1');
2833
- } else {
2834
- update_post_meta($post->ID, 'sa_mousewheel', '0');
2835
- }
2836
- if (isset($_POST['sa_click_advance']) && ($_POST['sa_click_advance'] == '1')) {
2837
- update_post_meta($post->ID, 'sa_click_advance', '1');
2838
- } else {
2839
- update_post_meta($post->ID, 'sa_click_advance', '0');
2840
- }
2841
- if (isset($_POST['sa_auto_height']) && ($_POST['sa_auto_height'] == '1')) {
2842
- update_post_meta($post->ID, 'sa_auto_height', '1');
2843
- } else {
2844
- update_post_meta($post->ID, 'sa_auto_height', '0');
2845
- }
2846
- if (isset($_POST['sa_vert_center']) && ($_POST['sa_vert_center'] == '1')) {
2847
- update_post_meta($post->ID, 'sa_vert_center', '1');
2848
- } else {
2849
- update_post_meta($post->ID, 'sa_vert_center', '0');
2850
- }
2851
-
2852
- // UPDATE SLIDER ITEMS DISPLAYED
2853
- update_post_meta($post->ID, 'sa_items_width1', abs(intval($_POST['sa_items_width1']))); // SANATIZE
2854
- update_post_meta($post->ID, 'sa_items_width2', abs(intval($_POST['sa_items_width2']))); // SANATIZE
2855
- update_post_meta($post->ID, 'sa_items_width3', abs(intval($_POST['sa_items_width3']))); // SANATIZE
2856
- update_post_meta($post->ID, 'sa_items_width4', abs(intval($_POST['sa_items_width4']))); // SANATIZE
2857
- update_post_meta($post->ID, 'sa_items_width5', abs(intval($_POST['sa_items_width5']))); // SANATIZE
2858
- update_post_meta($post->ID, 'sa_items_width6', abs(intval($_POST['sa_items_width6']))); // SANATIZE
2859
- update_post_meta($post->ID, 'sa_transition', sanitize_text_field($_POST['sa_transition'])); // SANATIZE
2860
- if (isset($_POST['sa_hero_slider']) && ($_POST['sa_hero_slider'] == '1')) {
2861
- update_post_meta($post->ID, 'sa_hero_slider', '1');
2862
- } else {
2863
- update_post_meta($post->ID, 'sa_hero_slider', '0');
2864
- }
2865
- if (isset($_POST['sa_showcase_slider']) && ($_POST['sa_showcase_slider'] == '1')) {
2866
- update_post_meta($post->ID, 'sa_showcase_slider', '1');
2867
- } else {
2868
- update_post_meta($post->ID, 'sa_showcase_slider', '0');
2869
- }
2870
- if (isset($_POST['sa_showcase_width'])) {
2871
- update_post_meta($post->ID, 'sa_showcase_width', abs(intval($_POST['sa_showcase_width']))); // SANATIZE
2872
- }
2873
- if (isset($_POST['sa_showcase_tablet']) && ($_POST['sa_showcase_tablet'] == '1')) {
2874
- update_post_meta($post->ID, 'sa_showcase_tablet', '1');
2875
- } else {
2876
- update_post_meta($post->ID, 'sa_showcase_tablet', '0');
2877
- }
2878
- if (isset($_POST['sa_showcase_width_tab'])) {
2879
- update_post_meta($post->ID, 'sa_showcase_width_tab', abs(intval($_POST['sa_showcase_width_tab']))); // SANATIZE
2880
- }
2881
- if (isset($_POST['sa_showcase_mobile']) && ($_POST['sa_showcase_mobile'] == '1')) {
2882
- update_post_meta($post->ID, 'sa_showcase_mobile', '1');
2883
- } else {
2884
- update_post_meta($post->ID, 'sa_showcase_mobile', '0');
2885
- }
2886
- if (isset($_POST['sa_showcase_width_mob'])) {
2887
- update_post_meta($post->ID, 'sa_showcase_width_mob', abs(intval($_POST['sa_showcase_width_mob']))); // SANATIZE
2888
- }
2889
-
2890
- // UPDATE SLIDER STYLE
2891
- $post_css_id = str_replace("-", "_", $_POST['sa_css_id']);
2892
- update_post_meta($post->ID, 'sa_css_id', sanitize_text_field($post_css_id)); // SANATIZE
2893
- update_post_meta($post->ID, 'sa_background_color', sanitize_text_field($_POST['sa_background_color'])); // SANATIZE
2894
- update_post_meta($post->ID, 'sa_border_width', abs(intval($_POST['sa_border_width']))); // SANATIZE
2895
- update_post_meta($post->ID, 'sa_border_color', sanitize_text_field($_POST['sa_border_color'])); // SANATIZE
2896
- update_post_meta($post->ID, 'sa_border_radius', abs(intval($_POST['sa_border_radius']))); // SANATIZE
2897
- update_post_meta($post->ID, 'sa_wrapper_padd_top', abs(intval($_POST['sa_wrapper_padd_top']))); // SANATIZE
2898
- update_post_meta($post->ID, 'sa_wrapper_padd_right', abs(intval($_POST['sa_wrapper_padd_right']))); // SANATIZE
2899
- update_post_meta($post->ID, 'sa_wrapper_padd_bottom', abs(intval($_POST['sa_wrapper_padd_bottom']))); // SANATIZE
2900
- update_post_meta($post->ID, 'sa_wrapper_padd_left', abs(intval($_POST['sa_wrapper_padd_left']))); // SANATIZE
2901
- if ($_POST['sa_slide_min_height_type'] == 'px') {
2902
- update_post_meta($post->ID, 'sa_slide_min_height_perc', sanitize_text_field($_POST['sa_slide_min_height']).'px'); // SANATIZE
2903
- } else {
2904
- update_post_meta($post->ID, 'sa_slide_min_height_perc', sanitize_text_field($_POST['sa_slide_min_height'])); // SANATIZE
2905
- }
2906
- update_post_meta($post->ID, 'sa_slide_padding_tb', abs(floatval($_POST['sa_slide_padding_tb']))); // SANATIZE
2907
- update_post_meta($post->ID, 'sa_slide_padding_lr', abs(floatval($_POST['sa_slide_padding_lr']))); // SANATIZE
2908
- update_post_meta($post->ID, 'sa_slide_margin_lr', abs(floatval($_POST['sa_slide_margin_lr']))); // SANATIZE
2909
- update_post_meta($post->ID, 'sa_slide_icons_location', sanitize_text_field($_POST['sa_slide_icons_location'])); // SANATIZE
2910
- update_post_meta($post->ID, 'sa_slide_icons_color', sanitize_text_field($_POST['sa_slide_icons_color'])); // SANATIZE
2911
- if (isset($_POST['sa_autohide_arrows']) && ($_POST['sa_autohide_arrows'] == '1')) {
2912
- update_post_meta($post->ID, 'sa_autohide_arrows', '1');
2913
- } else {
2914
- update_post_meta($post->ID, 'sa_autohide_arrows', '0');
2915
- }
2916
- if (isset($_POST['sa_dot_per_slide']) && ($_POST['sa_dot_per_slide'] == '1')) {
2917
- update_post_meta($post->ID, 'sa_dot_per_slide', '1');
2918
- } else {
2919
- update_post_meta($post->ID, 'sa_dot_per_slide', '0');
2920
- }
2921
- if (isset($_POST['sa_slide_icons_visible']) && ($_POST['sa_slide_icons_visible'] == '1')) {
2922
- update_post_meta($post->ID, 'sa_slide_icons_visible', '1');
2923
- } else {
2924
- update_post_meta($post->ID, 'sa_slide_icons_visible', '0');
2925
- }
2926
- if (isset($_POST['sa_slide_icons_fullslide']) && ($_POST['sa_slide_icons_fullslide'] == '1')) {
2927
- update_post_meta($post->ID, 'sa_slide_icons_fullslide', '1');
2928
- } else {
2929
- update_post_meta($post->ID, 'sa_slide_icons_fullslide', '0');
2930
- }
2931
-
2932
- // OTHER SETTINGS
2933
- $other_settings = '';
2934
- if (isset($_POST['sa_window_onload']) && ($_POST['sa_window_onload'] == '1')) {
2935
- $other_settings .= "1";
2936
- } else {
2937
- $other_settings .= "0";
2938
- }
2939
- $_POST['sa_strip_javascript'] = 0;
2940
- if (isset($_POST['sa_strip_javascript']) && ($_POST['sa_strip_javascript'] == '1')) {
2941
- $other_settings .= "|1";
2942
- } else {
2943
- $other_settings .= "|0";
2944
- }
2945
- if (isset($_POST['sa_lazy_load_images']) && ($_POST['sa_lazy_load_images'] == '1')) {
2946
- $other_settings .= "|1";
2947
- } else {
2948
- $other_settings .= "|0";
2949
- }
2950
- if (isset($_POST['sa_ulli_containers']) && ($_POST['sa_ulli_containers'] == '1')) {
2951
- $other_settings .= "|1";
2952
- } else {
2953
- $other_settings .= "|0";
2954
- }
2955
- if (isset($_POST['sa_rtl_slider']) && ($_POST['sa_rtl_slider'] == '1')) {
2956
- $other_settings .= "|1";
2957
- } else {
2958
- $other_settings .= "|0";
2959
- }
2960
- if (isset($_POST['sa_disable_preview']) && ($_POST['sa_disable_preview'] == '1')) {
2961
- $other_settings .= "|1";
2962
- } else {
2963
- $other_settings .= "|0";
2964
- }
2965
- if (isset($_POST['bg_image_size']) && ($_POST['bg_image_size'] != '')) {
2966
- $other_settings .= "|".$_POST['bg_image_size'];
2967
- } else {
2968
- $other_settings .= "|full";
2969
- }
2970
- if (isset($_POST['sa_disable_slide_ids']) && ($_POST['sa_disable_slide_ids'] == '1')) {
2971
- $other_settings .= "|1";
2972
- } else {
2973
- $other_settings .= "|0";
2974
- }
2975
- update_post_meta($post->ID, 'sa_other_settings', $other_settings);
2976
- // starting slide number
2977
- update_post_meta($post->ID, 'sa_start_pos', abs(intval($_POST['sa_start_pos']))); // SANATIZE
2978
-
2979
- if ($sa_pro_version) {
2980
- // THUMBNAIL PAGINATION
2981
- if (isset($_POST['sa_thumbs_active']) && ($_POST['sa_thumbs_active'] == '1')) {
2982
- update_post_meta($post->ID, 'sa_thumbs_active', '1');
2983
- } else {
2984
- update_post_meta($post->ID, 'sa_thumbs_active', '0');
2985
- }
2986
- update_post_meta($post->ID, 'sa_thumbs_location', sanitize_text_field($_POST['sa_thumbs_location'])); // SANATIZE
2987
- update_post_meta($post->ID, 'sa_thumbs_image_size', sanitize_text_field($_POST['sa_thumbs_image_size'])); // SANATIZE
2988
- update_post_meta($post->ID, 'sa_thumbs_padding', abs(floatval($_POST['sa_thumbs_padding']))); // SANATIZE
2989
- update_post_meta($post->ID, 'sa_thumbs_width', abs(intval($_POST['sa_thumbs_width']))); // SANATIZE
2990
- update_post_meta($post->ID, 'sa_thumbs_height', abs(intval($_POST['sa_thumbs_height']))); // SANATIZE
2991
- update_post_meta($post->ID, 'sa_thumbs_opacity', abs(intval($_POST['sa_thumbs_opacity']))); // SANATIZE
2992
- update_post_meta($post->ID, 'sa_thumbs_border_width', abs(intval($_POST['sa_thumbs_border_width']))); // SANATIZE
2993
- update_post_meta($post->ID, 'sa_thumbs_border_color', sanitize_text_field($_POST['sa_thumbs_border_color'])); // SANATIZE
2994
- update_post_meta($post->ID, 'sa_thumbs_resp_tablet', abs(intval($_POST['sa_thumbs_resp_tablet']))); // SANATIZE
2995
- update_post_meta($post->ID, 'sa_thumbs_resp_mobile', abs(intval($_POST['sa_thumbs_resp_mobile']))); // SANATIZE
2996
- }
2997
- }
2998
- }
2999
-
3000
- // ##### FUNCTION CHECKS WHETHER SLIDE ANYTHING PRO IS REGISTERED - RETURNS TRUE OR FALSE #####
3001
- function validate_slide_anything_pro_registration() {
3002
- if (!function_exists('validate_slide_anything_pro_license_key')) {
3003
- return false;
3004
- }
3005
- $valid_key = validate_slide_anything_pro_license_key();
3006
- return $valid_key;
3007
- }
3008
-
3009
-
3010
-
3011
- // ########################################################################
3012
- // ### FUNCTION DUPLICATES A 'SLIDE ANYTHING SLIDER' ('sa_slider') POST ###
3013
- // ########################################################################
3014
- function duplicate_sa_slider_post_as_draft() {
3015
- global $wpdb;
3016
-
3017
- if (!(isset($_GET['post']) || isset($_POST['post']) || (isset($_REQUEST['action']) && 'duplicate_sa_slider_post_as_draft' == $_REQUEST['action']))) {
3018
- wp_die('No post ID parameter has been supplied!');
3019
- }
3020
-
3021
- // NONCE VERIFICATION
3022
- if (!isset($_GET['duplicate_nonce']) || !wp_verify_nonce($_GET['duplicate_nonce'], basename(__FILE__))) {
3023
- return;
3024
- }
3025
-
3026
- // GET THE ORIGINAL POST ID
3027
- $post_id = (isset($_GET['post']) ? absint($_GET['post']) : absint($_POST['post']));
3028
- // GET THE ORIGINAL POST DATA
3029
- $post = get_post($post_id);
3030
-
3031
- // SET THE CURRENT USER AS THE NEW POST AUTHOR
3032
- $current_user = wp_get_current_user();
3033
- $new_post_author = $current_user->ID;
3034
-
3035
- // POST DATA EXISTS - CREATE THE POST DUPLICATE
3036
- if (isset( $post ) && $post != null) {
3037
- // NEW POST DATA ARRAY
3038
- $args = array(
3039
- 'comment_status' => $post->comment_status,
3040
- 'ping_status' => $post->ping_status,
3041
- 'post_author' => $new_post_author,
3042
- 'post_content' => $post->post_content,
3043
- 'post_excerpt' => $post->post_excerpt,
3044
- 'post_name' => $post->post_name,
3045
- 'post_parent' => $post->post_parent,
3046
- 'post_password' => $post->post_password,
3047
- 'post_status' => 'draft',
3048
- 'post_title' => $post->post_title." COPY",
3049
- 'post_type' => $post->post_type,
3050
- 'to_ping' => $post->to_ping,
3051
- 'menu_order' => $post->menu_order
3052
- );
3053
-
3054
- // INSERT THE NEW POST USING THE 'wp_insert_post()' FUNCTION
3055
- $new_post_id = wp_insert_post($args);
3056
-
3057
- // GET ALL THE CURRENT POST'S TERMS AND SET THEM TO THE NEW POST DRAFT
3058
- $taxonomies = get_object_taxonomies($post->post_type); // returns array of taxonomy names for post type
3059
- foreach ($taxonomies as $taxonomy) {
3060
- $post_terms = wp_get_object_terms($post_id, $taxonomy, array('fields' => 'slugs'));
3061
- wp_set_object_terms($new_post_id, $post_terms, $taxonomy, false);
3062
- }
3063
-
3064
- // DUPLICATE ALL POST META USING JUST 2 SQL QUERIES
3065
- $post_meta_infos = $wpdb->get_results("SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id=$post_id");
3066
- if (count($post_meta_infos)!=0) {
3067
- $sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) ";
3068
- foreach ($post_meta_infos as $meta_info) {
3069
- $meta_key = $meta_info->meta_key;
3070
- if ($meta_key == '_wp_old_slug') continue;
3071
- $meta_value = addslashes($meta_info->meta_value);
3072
- $sql_query_sel[] = $wpdb->prepare(
3073
- "SELECT %d, %s, %s",
3074
- $new_post_id,
3075
- $meta_key,
3076
- $meta_value
3077
- );
3078
- }
3079
- $sql_query.= implode(" UNION ALL ", $sql_query_sel);
3080
- $wpdb->query($sql_query);
3081
- }
3082
-
3083
- // REDIRECT TO THE 'SA Sliders' LIST SCREEN
3084
- wp_redirect(admin_url('edit.php?post_type=sa_slider'));
3085
- exit;
3086
-
3087
- } else {
3088
- wp_die('Duplicate post creation failed - could not find original post for ID: ' .$post_id);
3089
- }
3090
- }
3091
- add_action('admin_action_duplicate_sa_slider_post_as_draft', 'duplicate_sa_slider_post_as_draft');
3092
-
3093
- // ##### ADD THE DUPLICATE LINK TO THE ACTION LIST FOR SA SLIDER 'post_row_actions' #####
3094
- function duplicate_sa_slider_post_link($actions, $post) {
3095
- if (($post->post_type == 'sa_slider') && (current_user_can('edit_posts'))) {
3096
- $actions['duplicate'] = '<a href="'.wp_nonce_url('admin.php?action=duplicate_sa_slider_post_as_draft&post='.$post->ID, basename(__FILE__), 'duplicate_nonce').'" title="Duplicate this Slider" rel="permalink">Duplicate Slider</a>';
3097
- }
3098
- return $actions;
3099
- }
3100
- add_filter('post_row_actions', 'duplicate_sa_slider_post_link', 10, 2);
3101
-
3102
-
3103
-
3104
- // ###################################################################################
3105
- // ### FUNCTION DISPLAYS THE 'RE-ORDER SLIDES' SUB-PAGE IN THE WORDPRESS DASHBOARD ###
3106
- // ###################################################################################
3107
- function extra_sa_menu_pages() {
3108
- add_submenu_page(
3109
- 'edit.php?post_type=sa_slider',
3110
- __('Re-Order Slides', 'menu-sa-order'),
3111
- __('Re-Order Slides', 'menu-sa-order'),
3112
- 'manage_options',
3113
- 'reorderslides',
3114
- 'sa_reorder_slides_page'
3115
- );
3116
- }
3117
-
3118
- function sa_reorder_slides_page() {
3119
- $sa_pro_version = validate_slide_anything_pro_registration();
3120
- $page_url = get_admin_url()."edit.php?post_type=sa_slider&page=reorderslides";
3121
- $placeholder_image = get_site_url()."/wp-content/plugins/slide-anything/images/bg_placeholder.png";
3122
-
3123
- echo "<div id='sa_reorder_slides'>\n";
3124
- echo "<h1>Slide Anything - Re-Order Slides</h1>";
3125
-
3126
- if (isset($_POST['sar_slider_id']) && ($_POST['sar_slider_id'] != '')) {
3127
- // ##### A POST VARIABLE FOR 'SLIDER ID' HAS BEEN PASSED #####
3128
- $slider_id = $_POST['sar_slider_id'];
3129
- $slider_title = get_the_title($slider_id);
3130
-
3131
- if (isset($_POST['sar_sort_order']) && ($_POST['sar_sort_order'] != '')) {
3132
- // ### CHANGE THE ORDER OF SLIDE DATA FOR THE SLIDER AND RE-SAVE METADATA ###
3133
- $sort_order = $_POST['sar_sort_order'];
3134
- $data_in_arr = array();
3135
- $data_out_arr = array();
3136
-
3137
- // 1) SAVE SLIDES METADATA TO AN 'IN' ARRAY (ONLY SLIDES MEATDATA AND NO SETTINGS DATA SAVED!)
3138
- $metadata = get_metadata('post', $slider_id);
3139
- $num_slides = $metadata['sa_num_slides'][0];
3140
- foreach ($metadata as $key => $value_arr) {
3141
- $value = $value_arr[0];
3142
- for ($i = 1; $i <= $num_slides; $i++) {
3143
- $key_prefix = "sa_slide".$i."_";
3144
- if (strpos($key, $key_prefix) === 0) {
3145
- // metadata key starts with the key prefix ('sa_slide??')
3146
- $data_in_arr[$key] = $value;
3147
- }
3148
- }
3149
- }
3150
-
3151
- // 2) CREATE THE NEW SLIDES 'OUT' ARRAY (WITH THE NEW SLIDE ORDER)
3152
- $sort_order_arr = explode(",", $sort_order);
3153
- for ($i = 0; $i < count($sort_order_arr); $i++) {
3154
- $loop_prefix = "sa_slide".($i+1)."_"; // ascending loop order (1, 2, 3...)
3155
- $order_prefix = "sa_slide".$sort_order_arr[$i]."_"; // slide number to be stored in this slot
3156
- foreach ($data_in_arr as $key => $value) {
3157
- if (strpos($key, $order_prefix) === 0) {
3158
- // metakey key value starts with the order prefix
3159
- $new_key = str_replace($order_prefix, $loop_prefix, $key);
3160
- $data_out_arr[$new_key] = $value;
3161
- }
3162
- }
3163
- }
3164
-
3165
- // 3) LOOP THROUGH SLIDES 'OUT' ARRAY UPDATING POST METADATA
3166
- foreach ($data_out_arr as $key => $value) {
3167
- update_post_meta($slider_id, $key, $value);
3168
- }
3169
-
3170
- echo "<h3 id='sar_success_message'>SLIDE ORDER HAS BEEN UPDATED</h3>";
3171
- } else {
3172
- if (isset($_POST['sar_del_slides']) && ($_POST['sar_del_slides'] != '')) {
3173
- // ### DELETE ALL SLIDES WITH THE 'DELETE SLIDE' CHECKBOX CHECKED ###
3174
- $del_slides = $_POST['sar_del_slides'];
3175
- $del_slides_arr = explode(",", $del_slides);
3176
- $data_in_arr = array();
3177
- $data_out_arr = array();
3178
-
3179
- // 1) SAVE SLIDES METADATA TO AN 'IN' ARRAY (ONLY SLIDES MEATDATA AND NO SETTINGS DATA SAVED!)
3180
- $metadata = get_metadata('post', $slider_id);
3181
- $num_slides = $metadata['sa_num_slides'][0];
3182
- foreach ($metadata as $key => $value_arr) {
3183
- $value = $value_arr[0];
3184
- for ($i = 1; $i <= $num_slides; $i++) {
3185
- $key_prefix = "sa_slide".$i."_";
3186
- if (strpos($key, $key_prefix) === 0) {
3187
- // metadata key starts with the key prefix ('sa_slide??')
3188
- $data_in_arr[$i][$key] = $value;
3189
- }
3190
- }
3191
- }
3192
-
3193
- // 2) CREATE THE NEW SLIDES 'OUT' ARRAY (WITH THE DELETED SLIDES REMOVED)
3194
- $curr_index = 0;
3195
- $tot_del = 0;
3196
- for ($i = 1; $i <= $num_slides; $i++) {
3197
- $loop_prefix = "sa_slide".$i."_";
3198
- $delete_yn = 0;
3199
- for ($j = 0; $j < count($del_slides_arr); $j++) {
3200
- if ($i == $del_slides_arr[$j]) {
3201
- $delete_yn = 1;
3202
- }
3203
- }
3204
- if ($delete_yn == 0) {
3205
- // current slide is NOT to be deleted - copy to 'out' array
3206
- $curr_index++;
3207
- $curr_prefix = "sa_slide".$curr_index."_";
3208
- foreach ($data_in_arr[$i] as $key => $value) {
3209
- $new_key = str_replace($loop_prefix, $curr_prefix, $key);
3210
- $data_out_arr[$new_key] = $value;
3211
- }
3212
- } else {
3213
- $tot_del++;
3214
- }
3215
- }
3216
-
3217
- // 3) LOOP THROUGH SLIDES 'OUT' ARRAY UPDATING POST METADATA
3218
- update_post_meta($slider_id, 'sa_num_slides', $curr_index);
3219
- foreach ($data_out_arr as $key => $value) {
3220
- update_post_meta($slider_id, $key, $value);
3221
- }
3222
-
3223
- if ($tot_del == 1) {
3224
- echo "<h3 id='sar_success_message'>".$tot_del." SLIDE HAS BEEN DELETED</h3>";
3225
- } else {
3226
- echo "<h3 id='sar_success_message'>".$tot_del." SLIDES HAVE BEEN DELETED</h3>";
3227
- }
3228
- }
3229
- }
3230
-
3231
- // GET REQUIRED SLIDER METADATA AND SAVE WITHIN AN ARRAY
3232
- $num_slides = 0;
3233
- $slide_arr = array();
3234
- $metadata = get_metadata('post', $slider_id);
3235
- if (count($metadata) > 0) {
3236
- $num_slides = $metadata['sa_num_slides'][0];
3237
- }
3238
- if ($num_slides != 0) {
3239
- // SLIDER CONTAINS SLIDES - DISPLAY SORTABLE LIST OF SLIDES
3240
- for ($i = 1; $i <= $num_slides; $i++) {
3241
- $image_data = $metadata["sa_slide".$i."_image_data"][0];
3242
- $image_data_arr = explode("~", $image_data);
3243
- $slide_arr[$i]['image_id'] = $image_data_arr[0];
3244
- $slide_arr[$i]['content'] = $metadata["sa_slide".$i."_content"][0];
3245
- // cater for popup images used as the slide background
3246
- $popup_type = $popup_background = '';
3247
- if (!$sa_pro_version) {
3248
- if (isset($metadata["sa_slide".$i."_popup_type"][0])) {
3249
- $popup_type = $metadata["sa_slide".$i."_popup_type"][0];
3250
- }
3251
- if (isset($metadata["sa_slide".$i."_popup_background"][0])) {
3252
- $popup_background = $metadata["sa_slide".$i."_popup_background"][0];
3253
- }
3254
- }
3255
- if ($popup_type == 'IMAGE') {
3256
- if (($popup_background != '') && ($popup_background != 'no')) {
3257
- $slide_arr[$i]['image_id'] = $metadata["sa_slide".$i."_popup_imageid"][0];
3258
- }
3259
- }
3260
- }
3261
-
3262
- // DISPLAY THE SORTABLE GRID OF SLIDES
3263
- echo "<h2 id='sar_slider_title'>".$slider_title."</h2>\n";
3264
- echo "<h3 id='sar_drag_message'>Drag slides to re-order...</h3>\n";
3265
- echo "<ul id='sar_sortable'>\n";
3266
- for ($i = 1; $i <= $num_slides; $i++) {
3267
- $bg_image = $placeholder_image;
3268
- $slide_image_src = wp_get_attachment_image_src($slide_arr[$i]['image_id'], 'thumbnail');
3269
- if (!empty($slide_image_src[0])) {
3270
- $bg_image = $slide_image_src[0];
3271
- }
3272
- echo "<li id='sar".$i."' class='ui-state-default'>\n";
3273
- echo "<div class='sar_image' style='background-image:url(\"".$bg_image."\");'></div>\n";
3274
- echo "<div class='sar_content'>\n";
3275
- echo "<h4 class='sar_slide_num'>SLIDE ".$i."</h4>\n";
3276
- echo "<div class='sar_del_slide'>DELETE <span>SLIDE</span>";
3277
- echo "<input type='checkbox' id='sar_del".$i."' name='sar_del".$i."' class='sar_del_checkbox'/>";
3278
- echo "</div>\n";
3279
- echo "<div class='sar_slide_html'>".nl2br(htmlentities($slide_arr[$i]['content']))."</div>\n";
3280
- echo "</div>";
3281
- echo "</li>\n";
3282
- }
3283
- echo "</ul>\n"; #sar_sortable
3284
-
3285
- // DISPLAY THE HTML FORM CONTAINING THE SORT ORDER INPUT ELEMENT
3286
- echo "<form method='post' id='sar_order_form'>\n";
3287
- echo "<input type='hidden' name='sar_slider_id' value='".$slider_id."'/>";
3288
- echo "<input type='hidden' id='sar_sort_order' name='sar_sort_order'/>";
3289
- echo "<input type='hidden' id='sar_del_slides' name='sar_del_slides'/>";
3290
- echo "<input type='submit' id='sar_update_but' value='UPDATE ORDER'/>";
3291
- echo "<input type='submit' id='sar_delete_but' value='DELETE SLIDES'/>";
3292
- echo "</form>\n";
3293
-
3294
- } else {
3295
- // SLIDER CONTAINS NO SLIDES - DISPLAY MESSAGE
3296
- echo "<h3 id='sar_no_slides_found'>This slider contains NO slides!</h3>\n";
3297
- echo "<a class='sar_back_button' href='".$page_url."'>BACK</a>";
3298
- }
3299
-
3300
- } else {
3301
- // ##### NO POST VARIABLE FOR 'SLIDER ID' HAS BEEN PASSED #####
3302
- // WP QUERY TO GET ARRAY OF SA SLIDERS (ID & TITLE) THAT EXIST
3303
- $slider_arr = array();
3304
- $count = 0;
3305
- $args = array(
3306
- 'post_type' => 'sa_slider',
3307
- 'post_status' => array('publish','draft'),
3308
- 'orderby' => 'menu_order',
3309
- 'order' => 'ASC',
3310
- 'posts_per_page' => -1,
3311
- );
3312
- $sliders = new WP_Query($args);
3313
- if ($sliders->have_posts()) {
3314
- while ($sliders->have_posts() ) {
3315
- $sliders->the_post();
3316
- $slider_arr[$count]['id'] = get_the_ID();
3317
- $slider_arr[$count]['title'] = get_the_title();
3318
- $count++;
3319
- }
3320
- }
3321
- wp_reset_postdata();
3322
-
3323
- if (count($slider_arr) > 0) {
3324
- // DISPLAY FORM CONTAINING SA SLIDER SELECT DROPDOWN
3325
- echo "<form method='post' id='sar_slider_form'>\n";
3326
- echo "<p>This tool allows you to change the order of slides within a Slide Anything slider.</p>\n";
3327
- echo "<p>Select the slider you would like to re-order, then just drag-and-drop slides for your new slide order.</p>\n";
3328
- echo "<div style='padding-top:10px;'>Select Slider to Re-Order:<br/>";
3329
- echo "<select id='sar_slider_id' name='sar_slider_id'>\n";
3330
- for ($i = 0; $i < count($slider_arr); $i++) {
3331
- echo "<h4>|".$slider_arr[$i]['id']."|".$slider_arr[$i]['title']."|</h4>";
3332
- echo "<option value='".$slider_arr[$i]['id']."'>".$slider_arr[$i]['title']." (#".$slider_arr[$i]['id'].")</option>\n";
3333
- }
3334
- echo "<select></div>\n";
3335
- echo "<div><input type='submit' value='Select Slider'/></div>\n";
3336
- echo "</form>\n";
3337
- } else {
3338
- // NO SA SLIDERS FOUND - DISPLAY MESSAGE
3339
- echo "<h3 id='sar_no_sliders_found'>No Slide Anything sliders found!</h3>\n";
3340
- }
3341
- }
3342
-
3343
- echo "</div>\n"; #sa_reorder_slides
3344
- }
3345
-
3346
-
3347
- // ### FUNCTION CALLED BY 'template_include' FILTER TO USE A CUSTOM PAGE TERMPLATE FOR SA PREVIEW PAGE ###
3348
- function sa_preview_page_template($template) {
3349
- if (is_page('Slide Anything Popup Preview')) {
3350
- $template = dirname( __FILE__ ).'/single-page.php';
3351
- }
3352
- return $template;
3353
- }
3354
-
3355
-
3356
- // ### FILTER TO ALLOW IFRAMES WITHIN SLIDE CONTENT ###
3357
- function slides_allow_iframes_filter($allowedposttags) {
3358
- // Only change for users who can publish posts
3359
- if ( !current_user_can( 'publish_posts' ) ) return $allowedposttags;
3360
-
3361
- // Allow iframes and the following attributes
3362
- $allowedposttags['iframe'] = array(
3363
- 'align' => true,
3364
- 'width' => true,
3365
- 'height' => true,
3366
- 'frameborder' => true,
3367
- 'name' => true,
3368
- 'src' => true,
3369
- 'title' => true,
3370
- 'allow' => true,
3371
- 'allowfullscreen' => true,
3372
- 'id' => true,
3373
- 'class' => true,
3374
- 'style' => true,
3375
- 'scrolling' => true,
3376
- 'marginwidth' => true,
3377
- 'marginheight' => true,
3378
- );
3379
- return $allowedposttags;
3380
- }
3381
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * #####################################################################
4
+ * ### SLIDE ANYTHING PLUGIN - PHP FUNCTIONS FOR WordPress DASHBOARD ###
5
+ * #####################################################################
6
+ *
7
+ * @package WordPress_Slide_Anything
8
+ * @author Simon Edge
9
+ * @copyright EdgeWebPages
10
+ * @license GPLv2 or later
11
+ */
12
+
13
+ /**
14
+ * ##### PLUGIN REGISTRATION HOOK - RUN WHEN THE PLUGIN IS ACTIVATED #####
15
+ */
16
+ function cpt_slider_plugin_activation() {
17
+ $sa_pro_version = validate_slide_anything_pro_registration();
18
+
19
+ // INSERT A 'SAMPLE SLIDER' CUSTOM POST INTO THE DATABASE.
20
+ $sample_post_title = 'Sample Slider';
21
+
22
+ // check if the 'sample slider' already exists (plugin has been activated before).
23
+ $cpt_post = get_page_by_title( $sample_post_title, 'OBJECT', 'sa_slider' );
24
+
25
+ if ( is_null( $cpt_post ) ) {
26
+ // create the post object.
27
+ $sample_post = array(
28
+ 'post_title' => $sample_post_title,
29
+ 'post_content' => '',
30
+ 'post_status' => 'publish',
31
+ 'post_type' => 'sa_slider',
32
+ );
33
+ // insert the post into the database.
34
+ $cpt_id = wp_insert_post( $sample_post );
35
+
36
+ // insert meta data for the 'sample slider' slides.
37
+ for ( $i = 1; $i <= 8; $i++ ) {
38
+ if ( 1 === $i ) {
39
+ $color = '#f4cccc';
40
+ $image = 'sample_logo1.png';
41
+ } elseif ( 2 === $i ) {
42
+ $color = '#d9ead3';
43
+ $image = 'sample_logo2.png';
44
+ } elseif ( 3 === $i ) {
45
+ $color = '#fce5cd';
46
+ $image = 'sample_logo3.png';
47
+ } elseif ( 4 === $i ) {
48
+ $color = '#d0e0e3';
49
+ $image = 'sample_logo4.png';
50
+ } elseif ( 5 === $i ) {
51
+ $color = '#fff2cc';
52
+ $image = 'sample_logo5.png';
53
+ } elseif ( 6 === $i ) {
54
+ $color = '#cfe2f3';
55
+ $image = 'sample_logo6.png';
56
+ } elseif ( 7 === $i ) {
57
+ $color = '#d9d2e9';
58
+ $image = 'sample_logo7.png';
59
+ } elseif ( 8 === $i ) {
60
+ $color = '#ead1dc';
61
+ $image = 'sample_logo8.png';
62
+ }
63
+ $content = "<div style='text-align: center; padding-bottom: 10px;'>\n";
64
+ $content .= "<div><img src='" . plugins_url() . '/slide-anything/images/' . $image . "' alt='Logo " . $i . "' /></div>\n";
65
+ $content .= "<h3>Company Name</h3>\n";
66
+ $content .= "<p>Lorem ipsum dolor sit amet, cu usu cibo vituperata, id ius probo maiestatis inciderint, sit eu vide volutpat.</p>\n";
67
+ $content .= "</div>\n";
68
+ update_post_meta( $cpt_id, 'sa_slide' . $i . '_content', $content );
69
+ $image_data = '~left top~contain~no-repeat~' . $color;
70
+ update_post_meta( $cpt_id, 'sa_slide' . $i . '_image_data', $image_data );
71
+ update_post_meta( $cpt_id, 'sa_slide' . $i . '_link_url', '' );
72
+ update_post_meta( $cpt_id, 'sa_slide' . $i . '_link_target', '_self' );
73
+ update_post_meta( $cpt_id, 'sa_slide' . $i . '_popup_type', 'NONE' );
74
+ update_post_meta( $cpt_id, 'sa_slide' . $i . '_popup_imageid', '' );
75
+ update_post_meta( $cpt_id, 'sa_slide' . $i . '_popup_imagetitle', '' );
76
+ update_post_meta( $cpt_id, 'sa_slide' . $i . '_popup_video_id', '' );
77
+ update_post_meta( $cpt_id, 'sa_slide' . $i . '_popup_video_type', '' );
78
+ update_post_meta( $cpt_id, 'sa_slide' . $i . '_popup_background', 'no' );
79
+ update_post_meta( $cpt_id, 'sa_slide' . $i . '_popup_html', '' );
80
+ update_post_meta( $cpt_id, 'sa_slide' . $i . '_popup_shortcode', '0' );
81
+ update_post_meta( $cpt_id, 'sa_slide' . $i . '_popup_bgcol', '#ffffff' );
82
+ update_post_meta( $cpt_id, 'sa_slide' . $i . '_popup_width', '600' );
83
+ }
84
+ // insert meta data for the 'sample slider' configuration.
85
+ update_post_meta( $cpt_id, 'sa_disable_visual_editor', '0' );
86
+ update_post_meta( $cpt_id, 'sa_num_slides', 8 );
87
+ update_post_meta( $cpt_id, 'sa_slide_duration', 4 );
88
+ update_post_meta( $cpt_id, 'sa_slide_transition', 0.3 );
89
+ update_post_meta( $cpt_id, 'sa_slide_by', 1 );
90
+ update_post_meta( $cpt_id, 'sa_loop_slider', '1' );
91
+ update_post_meta( $cpt_id, 'sa_stop_hover', '1' );
92
+ update_post_meta( $cpt_id, 'sa_nav_arrows', '1' );
93
+ update_post_meta( $cpt_id, 'sa_pagination', '1' );
94
+ update_post_meta( $cpt_id, 'sa_shortcodes', '0' );
95
+ update_post_meta( $cpt_id, 'sa_random_order', '1' );
96
+ update_post_meta( $cpt_id, 'sa_reverse_order', '0' );
97
+ update_post_meta( $cpt_id, 'sa_mouse_drag', '0' );
98
+ update_post_meta( $cpt_id, 'sa_touch_drag', '1' );
99
+ update_post_meta( $cpt_id, 'sa_mousewheel', '0' );
100
+ update_post_meta( $cpt_id, 'sa_click_advance', '0' );
101
+ update_post_meta( $cpt_id, 'sa_auto_height', '0' );
102
+ update_post_meta( $cpt_id, 'sa_vert_center', '0' );
103
+ update_post_meta( $cpt_id, 'sa_items_width1', 1 );
104
+ update_post_meta( $cpt_id, 'sa_items_width2', 2 );
105
+ update_post_meta( $cpt_id, 'sa_items_width3', 3 );
106
+ update_post_meta( $cpt_id, 'sa_items_width4', 4 );
107
+ update_post_meta( $cpt_id, 'sa_items_width5', 4 );
108
+ update_post_meta( $cpt_id, 'sa_items_width6', 4 );
109
+ update_post_meta( $cpt_id, 'sa_transition', 'fade' );
110
+ update_post_meta( $cpt_id, 'sa_hero_slider', '0' );
111
+ update_post_meta( $cpt_id, 'sa_showcase_slider', '0' );
112
+ update_post_meta( $cpt_id, 'sa_showcase_width', '120' );
113
+ update_post_meta( $cpt_id, 'sa_showcase_tablet', '1' );
114
+ update_post_meta( $cpt_id, 'sa_showcase_width_tab', '130' );
115
+ update_post_meta( $cpt_id, 'sa_showcase_mobile', '0' );
116
+ update_post_meta( $cpt_id, 'sa_showcase_width_mob', '140' );
117
+ update_post_meta( $cpt_id, 'sa_css_id', 'sample_slider' );
118
+ update_post_meta( $cpt_id, 'sa_background_color', '#fafafa' );
119
+ update_post_meta( $cpt_id, 'sa_border_width', 1 );
120
+ update_post_meta( $cpt_id, 'sa_border_color', '#f0f0f0' );
121
+ update_post_meta( $cpt_id, 'sa_border_radius', 5 );
122
+ update_post_meta( $cpt_id, 'sa_wrapper_padd_top', 8 );
123
+ update_post_meta( $cpt_id, 'sa_wrapper_padd_right', 8 );
124
+ update_post_meta( $cpt_id, 'sa_wrapper_padd_bottom', 8 );
125
+ update_post_meta( $cpt_id, 'sa_wrapper_padd_left', 8 );
126
+ update_post_meta( $cpt_id, 'sa_slide_min_height_perc', 50 );
127
+ update_post_meta( $cpt_id, 'sa_slide_padding_tb', 5 );
128
+ update_post_meta( $cpt_id, 'sa_slide_padding_lr', 5 );
129
+ update_post_meta( $cpt_id, 'sa_slide_margin_lr', 0 );
130
+ update_post_meta( $cpt_id, 'sa_autohide_arrows', '1' );
131
+ update_post_meta( $cpt_id, 'sa_dot_per_slide', '0' );
132
+ update_post_meta( $cpt_id, 'sa_slide_icons_location', 'Center Center' );
133
+ update_post_meta( $cpt_id, 'sa_slide_icons_visible', '0' );
134
+ update_post_meta( $cpt_id, 'sa_slide_icons_color', 'white' );
135
+ update_post_meta( $cpt_id, 'sa_thumbs_active', '0' );
136
+ update_post_meta( $cpt_id, 'sa_thumbs_location', 'Inside Bottom' );
137
+ update_post_meta( $cpt_id, 'sa_thumbs_image_size', 'thumbnail' );
138
+ update_post_meta( $cpt_id, 'sa_thumbs_padding', 3 );
139
+ update_post_meta( $cpt_id, 'sa_thumbs_width', 150 );
140
+ update_post_meta( $cpt_id, 'sa_thumbs_height', 85 );
141
+ update_post_meta( $cpt_id, 'sa_thumbs_opacity', 50 );
142
+ update_post_meta( $cpt_id, 'sa_thumbs_border_width', 0 );
143
+ update_post_meta( $cpt_id, 'sa_thumbs_border_color', '#ffffff' );
144
+ update_post_meta( $cpt_id, 'sa_thumbs_resp_tablet', 75 );
145
+ update_post_meta( $cpt_id, 'sa_thumbs_resp_mobile', 50 );
146
+ }
147
+ }
148
+
149
+ /**
150
+ * ##### SLIDE ANYTHING PRO NOTICE #####
151
+ */
152
+ function version_20_upgrade_notice() {
153
+ global $current_user;
154
+ $user_id = $current_user->ID;
155
+ $sa_pro_version = validate_slide_anything_pro_registration();
156
+
157
+ if ( ! $sa_pro_version ) {
158
+ if ( current_user_can( 'administrator' ) ) {
159
+ /* Check that the user hasn't already clicked to ignore the message */
160
+ if ( ! get_user_meta( $user_id, 'sa_ignore_notice' ) ) {
161
+ echo "<div class='notice notice-info' style='padding-top:10px;'>";
162
+
163
+ echo "<div style='float:left; width:170px; margin-right:15px;'><a href='https://edgewebpages.com/' target='_blank'>";
164
+ echo "<img style='width:100%;' src='" . esc_url( get_site_url() ) . "/wp-content/plugins/slide-anything/images/slide_anything_pro_product_image.png' /></a></div>";
165
+ echo "<h3 style='margin:0px !important; padding:10px 0px !important;'>SLIDE ANYTHING PRO</h3>";
166
+ echo "<p style='margin:0px 0px 10px !important;'><strong>SLIDE ANYTHING PRO</strong> adds POPUPS into the mix!!";
167
+ echo '<br/><strong>SLIDE ANYTHING PRO</strong> also adds Hero Sliders & Thumbnail Pagination!!';
168
+ echo '<br/><strong>SLIDE ANYTHING PRO</strong> allows you to create Showcase Carousels!!</p>';
169
+
170
+ echo "<p style='margin:0px 0px 10px !important;'>With <a href='https://edgewebpages.com/' target='_blank'>SLIDE ANYTHING PRO</a> ";
171
+ echo 'each slide can now open a MODAL POPUP, which can be an IMAGE popup, a VIDEO EMBED popup (YouTube/Vimeo), a popup ';
172
+ echo 'containing HTML CODE or a popup displaying a WordPress SHORTCODE. This can be a very useful addition to ';
173
+ echo 'Slide Anything, if you are wanting to create Image or Video galleries for your websites.</p>';
174
+
175
+ echo "<p style='margin:0px 0px 10px !important;'>With <a href='https://edgewebpages.com/' target='_blank'>SLIDE ANYTHING PRO</a> ";
176
+ echo "you can now create a HERO SLIDER, which is a slider that always is 100% of the width/height of the device it's ";
177
+ echo 'being viewed on. You can now also add THUMBNAIL PAGINATION to your sliders. Thumbnail Pagination are small ';
178
+ echo 'clickable thumbnail images, with each thumbnail representing a single slide which can be clicked in order to ';
179
+ echo 'navigate to.</p>';
180
+
181
+ echo "<p style='margin:0px 0px 10px !important;'>With <a href='https://edgewebpages.com/' target='_blank'>SLIDE ANYTHING PRO</a> ";
182
+ echo 'you can also create a SHOWCASE CAROUSEL, which has a container width that exceeds the screen/window width. ';
183
+ echo 'The leftmost/rightmost visible slides therefore become partially visible.</p>';
184
+
185
+ echo "<p style='margin:0px !important;'>For more information, click on the DEMO links below:</p>";
186
+ echo "<p style='margin:0px !important;'>";
187
+ echo "<a href='https://edgewebpages.com/' target='_blank'>MODAL POPUPS DEMO</a>&nbsp;&nbsp;|&nbsp;&nbsp;";
188
+ echo "<a href='https://edgewebpages.com/hero-slider-with-thumbnails/' target='_blank'>HERO SLIDER WITH THUMBNAILS</a>&nbsp;&nbsp;|&nbsp;&nbsp;";
189
+ echo "<a href='https://edgewebpages.com/showcase-carousel-demo/' target='_blank'>SHOWCASE CAROUSEL</a></p>";
190
+
191
+ echo "<div style='clear:both; float:none; width:100%; height:10px;'></div>";
192
+ echo "<a style='display:inline-block; float:right; padding:7px 10px; background:crimson; color:white; text-decoration:none; ";
193
+ $button_url = get_site_url() . '/wp-admin/edit.php?post_type=sa_slider&sa_nag_ignore=0';
194
+ $button_url = wp_nonce_url( $button_url );
195
+ echo "border-radius:5px; font-size:16px;' href='" . esc_url( $button_url ) . "'>Hide this notice</a>";
196
+ echo "<div style='clear:both; float:none; width:100%; height:10px;'></div>";
197
+
198
+ echo '</div>';
199
+ }
200
+ }
201
+ }
202
+ }
203
+
204
+ /**
205
+ * ##### SET THE SLIDE ANYTHING PRO NOTICE TO BE IGNORED FOR THIS USER #####
206
+ */
207
+ function slide_anything_notice_ignore() {
208
+ global $current_user;
209
+ $user_id = $current_user->ID;
210
+ if ( isset( $_GET['_wpnonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ) ) ) {
211
+ // If user clicks to ignore the Slide Anything PRO notice, add that to their user meta.
212
+ if ( isset( $_GET['sa_nag_ignore'] ) && ( sanitize_text_field( wp_unslash( $_GET['sa_nag_ignore'] ) ) === '0' ) ) {
213
+ add_user_meta( $user_id, 'sa_ignore_notice', 'true', true );
214
+ }
215
+ // If user clicks to ignore the Slide Any Post notice, add that to their user meta.
216
+ if ( isset( $_GET['sapost_ignore'] ) && ( sanitize_text_field( wp_unslash( $_GET['sapost_ignore'] ) ) === '0' ) ) {
217
+ add_user_meta( $user_id, 'sa_ignore_sapost_notice', 'true', true );
218
+ }
219
+ }
220
+ }
221
+
222
+ /**
223
+ * ##### ADD CHECKBOX OPTION UNDER "Settings -> Writing" CALLED "Disable TinyMCE Button" #####
224
+ */
225
+ function slide_anything_disable_tinymce_button_setting() {
226
+ // REGISTER WordPress SETTING.
227
+ register_setting(
228
+ 'writing',
229
+ 'sa-disable-tinymce-button',
230
+ 'sa_settings_sanitize'
231
+ );
232
+ // CREATE SETTINGS SECTION (within "Settings->Writing").
233
+ add_settings_section(
234
+ 'sa-writing-settings-section',
235
+ 'Slide Anything Settings',
236
+ 'sa_writing_settings_section_description',
237
+ 'writing'
238
+ );
239
+ // CREATE SETTINGS INPUT FIELD.
240
+ add_settings_field(
241
+ 'sa-settings-field1',
242
+ 'Disable TinyMCE Button',
243
+ 'sa_settings_field1_callback',
244
+ 'writing',
245
+ 'sa-writing-settings-section'
246
+ );
247
+ }
248
+
249
+ /**
250
+ * ##### SANATIZE SETTINGS CALLBACK FUNCTION #####
251
+ *
252
+ * @param string $input Disable TinyMCE Button checkbox.
253
+ */
254
+ function sa_settings_sanitize( $input ) {
255
+ return isset( $input ) ? true : false;
256
+ }
257
+ /**
258
+ * ##### SETTING SECTION DESCRIPTION #####
259
+ */
260
+ function sa_writing_settings_section_description() {
261
+ echo esc_html( "Disable the 'Slide Anything Sliders' button within the toolbar of the WordPress Classic Editor when editing pages and posts." );
262
+ }
263
+ /**
264
+ * ##### SETTINGS INPUT FIELD CALLBACK #####
265
+ */
266
+ function sa_settings_field1_callback() {
267
+ ?>
268
+ <label for="sa-disable-tinymce-input">
269
+ <input id="sa-disable-tinymce-input" type="checkbox" value="1" name="sa-disable-tinymce-button" <?php checked( get_option( 'sa-disable-tinymce-button', false ) ); ?>>
270
+ </label>
271
+ <?php
272
+ }
273
+
274
+ /**
275
+ * ##### ACTION HOOK - REGISTER SCRIPTS (JS AND CSS) FOR WordPress DASHBOARD ONLY #####
276
+ */
277
+ function cpt_register_admin_scripts() {
278
+ $sa_pro_version = validate_slide_anything_pro_registration();
279
+ $screen = get_current_screen();
280
+ $plugin_path = dirname( __FILE__ ) . '/../slide-anything.php';
281
+ $plugin_data = get_plugin_data( $plugin_path, false, false );
282
+ $plugin_ver = $plugin_data['Version'];
283
+ if ( 'sa_slider' === $screen->post_type ) {
284
+ // ONLY LOAD SCRIPTS (JS & CSS) WITHIN 'Slide Anything' SCREENS IN WordPress DASHBOARD.
285
+ // enqueues all scripts, styles & settings required in order to use the WordPress Media JS APIs.
286
+ wp_enqueue_media();
287
+ // load 'WordPress jquery-ui' scripts.
288
+ wp_enqueue_script( 'jquery-ui-core' );
289
+ wp_enqueue_script( 'jquery-ui-accordion' );
290
+ wp_enqueue_script( 'jquery-ui-tabs' );
291
+ wp_enqueue_script( 'jquery-ui-slider' );
292
+ wp_enqueue_script( 'jquery-ui-sortable' );
293
+ wp_enqueue_script( 'jquery-ui-draggable' );
294
+ wp_enqueue_script( 'jquery-ui-droppable' );
295
+ wp_enqueue_script( 'jquery-ui-resize' );
296
+ wp_enqueue_script( 'jquery-ui-dialog' );
297
+ wp_enqueue_script( 'jquery-ui-button' );
298
+ wp_enqueue_script( 'jquery-ui-tooltip' );
299
+ wp_enqueue_script( 'jquery-ui-spinner' );
300
+ // load 'spectrum colorpicker' script and css.
301
+ wp_register_script( 'spectrum_js', SA_PLUGIN_PATH . 'spectrum/spectrum.js', array( 'jquery' ), '1.8.0', true );
302
+ wp_enqueue_script( 'spectrum_js' );
303
+ wp_register_style( 'spectrum_css', SA_PLUGIN_PATH . 'spectrum/spectrum.css', array(), '1.8.0' );
304
+ wp_enqueue_style( 'spectrum_css' );
305
+ // load 'jquery-ui' css.
306
+ wp_register_style( 'admin_ui_css', SA_PLUGIN_PATH . 'css/admin-user-interface.min.css', array(), '1.11.4' );
307
+ wp_enqueue_style( 'admin_ui_css' );
308
+ // load 'slide-anything' custom javasript and css for WordPress admin.
309
+ wp_register_script( 'sa-slider-admin-script', SA_PLUGIN_PATH . 'js/slide-anything-admin.js', array( 'jquery' ), $plugin_ver, true );
310
+ wp_enqueue_script( 'sa-slider-admin-script' );
311
+ wp_register_style( 'sa-slider-admin-css', SA_PLUGIN_PATH . 'css/slide-anything-admin.css', array(), $plugin_ver );
312
+ wp_enqueue_style( 'sa-slider-admin-css' );
313
+ if ( $sa_pro_version ) {
314
+ // load 'magnific popup' script and css.
315
+ wp_register_script( 'magnific-popup_js', SA_PLUGIN_PATH . 'magnific-popup/jquery.magnific-popup.min.js', array( 'jquery' ), '1.1.0', true );
316
+ wp_enqueue_script( 'magnific-popup_js' );
317
+ wp_register_style( 'magnific-popup_css', SA_PLUGIN_PATH . 'magnific-popup/magnific-popup.css', array(), '1.1.0' );
318
+ wp_enqueue_style( 'magnific-popup_css' );
319
+ }
320
+ // DISABLE AUTOSAVE FOR THIS CUSTOM POST TYPE (causes issues with preview modal popup).
321
+ wp_dequeue_script( 'autosave' );
322
+ }
323
+ if ( 'settings_page_sa-settings-page' === $screen->id ) {
324
+ // SLIDE ANYTHING SETTINGS PAGE - load custom css script.
325
+ wp_register_style( 'sa-slider-admin-css', SA_PLUGIN_PATH . 'css/slide-anything-admin.css', array(), $plugin_ver );
326
+ wp_enqueue_style( 'sa-slider-admin-css' );
327
+ }
328
+ // style for TINYMCE editor 'Slide Anything sliders' button.
329
+ wp_register_style( 'tinymce-css', SA_PLUGIN_PATH . 'css/tinymce_style.css', array(), $plugin_ver );
330
+ wp_enqueue_style( 'tinymce-css' );
331
+ }
332
+
333
+
334
+
335
+ /**
336
+ * ##### ACTION HOOK - REGISTER THE 'Slide Anything' CUSTOM POST TYPE #####
337
+ */
338
+ function cpt_slider_register() {
339
+ $labels = array(
340
+ 'name' => _x( 'SA Sliders', 'post type general name', 'sa_slider_textdomain' ),
341
+ 'singular_name' => _x( 'Slider', 'post type singular name', 'sa_slider_textdomain' ),
342
+ 'menu_name' => __( 'SA Sliders', 'sa_slider_textdomain' ),
343
+ 'add_new' => __( 'Add New Slider', 'sa_slider_textdomain' ),
344
+ 'add_new_item' => __( 'Add New Slider', 'sa_slider_textdomain' ),
345
+ 'edit_item' => __( 'Edit Slider', 'sa_slider_textdomain' ),
346
+ 'new_item' => __( 'New Slider', 'sa_slider_textdomain' ),
347
+ 'view_item' => __( 'View Slider', 'sa_slider_textdomain' ),
348
+ 'not_found' => __( 'No sliders found', 'sa_slider_textdomain' ),
349
+ 'not_found_in_trash' => __( 'No sliders found in Trash', 'sa_slider_textdomain' ),
350
+ );
351
+ $args = array(
352
+ 'labels' => $labels,
353
+ 'description' => __( 'Slide Anything carousel/slider', 'sa_slider_textdomain' ),
354
+ 'public' => false,
355
+ 'exclude_from_search' => true,
356
+ 'publicly_queryable' => false,
357
+ 'show_ui' => true,
358
+ 'show_in_nav_menus' => false,
359
+ 'show_in_menu' => true,
360
+ 'menu_position' => 10,
361
+ 'menu_icon' => 'dashicons-images-alt2',
362
+ 'hierarchical' => false,
363
+ 'supports' => array( 'title' ),
364
+ 'has_archive' => false,
365
+ 'query_var' => false,
366
+ 'can_export' => true,
367
+ 'rewrite' => true,
368
+ 'capability_type' => 'post',
369
+ );
370
+ register_post_type( 'sa_slider', $args );
371
+ }
372
+
373
+
374
+
375
+ /**
376
+ * ##### WP DASHBOARD - SLIDER LIST PAGE #####
377
+ * ACTION HOOK - ADD/REMOVE (HOVER-OVER) ROW ACTIONS WHEN THIS CUSTOM POST TYPE IS LISTED IN DASHBOARD
378
+ *
379
+ * @param array $actions Row Actions.
380
+ * @param array $post Post Type.
381
+ */
382
+ function cpt_slider_row_actions( $actions, $post ) {
383
+ if ( 'sa_slider' === $post->post_type ) {
384
+ // REMOVE 'Quick Edit' ROW ACTION.
385
+ unset( $actions['inline hide-if-no-js'] );
386
+ }
387
+ return $actions;
388
+ }
389
+
390
+ /**
391
+ * ##### FILTER TO ADD/REMOVE COLUMNS DISPLAYED FOR THIS CUSTOM POST TYPE IN DASHBOARD #####
392
+ *
393
+ * @param array $columns Post List Columns.
394
+ */
395
+ function cpt_slider_modify_columns( $columns ) {
396
+ // new columns to be added.
397
+ $new_columns = array(
398
+ 'slides' => 'Slides',
399
+ 'shortcode' => 'Shortcode',
400
+ 'css-id' => 'CSS ID',
401
+ );
402
+ $columns = array_slice( $columns, 0, 2, true ) + $new_columns + array_slice( $columns, 2, null, true );
403
+ return $columns;
404
+ }
405
+
406
+ /**
407
+ * ##### DEFINE OUTPUT FOR EACH CUSTOM COLUMN DISPLAYED FOR THIS POST TYPE IN THE DASHBOARD #####
408
+ *
409
+ * @param array $column Post List Column.
410
+ */
411
+ function cpt_slider_custom_column_content( $column ) {
412
+ // get post object for this row.
413
+ global $post;
414
+
415
+ // output for the 'Slides' column.
416
+ if ( 'slides' === $column ) {
417
+ $num_slides = get_post_meta( $post->ID, 'sa_num_slides', true );
418
+ if ( '' === $num_slides ) {
419
+ $num_slides = '-';
420
+ }
421
+ echo esc_html( $num_slides );
422
+ }
423
+
424
+ // output for the 'Shortcode' column.
425
+ if ( 'shortcode' === $column ) {
426
+ $shortcode = "[slide-anything id='" . $post->ID . "']";
427
+ echo esc_html( $shortcode );
428
+ }
429
+
430
+ // output for the 'CSS ID' column.
431
+ if ( 'css-id' === $column ) {
432
+ $css_id = get_post_meta( $post->ID, 'sa_css_id', true );
433
+ if ( '' === $css_id ) {
434
+ $css_id = '-';
435
+ } else {
436
+ $css_id = '#' . $css_id;
437
+ }
438
+ echo esc_html( $css_id );
439
+ }
440
+ }
441
+
442
+
443
+
444
+ /**
445
+ * ##### ADD A CUSTOM BUTTON TO WordPress TINYMCE EDITOR (ON PAGES AND POSTS ONLY) #####
446
+ */
447
+ function add_tinymce_button() {
448
+ global $typenow;
449
+ // check user permissions.
450
+ if ( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'edit_pages' ) ) {
451
+ return;
452
+ }
453
+ // verify the post type - only display button on posts and pages.
454
+ if ( ! in_array( $typenow, array( 'post', 'page' ), true ) ) {
455
+ return;
456
+ }
457
+ // check if WYSIWYG is enabled.
458
+ if ( 'true' === get_user_option( 'rich_editing' ) ) {
459
+ add_filter( 'mce_external_plugins', 'add_tinymce_plugin' );
460
+ add_filter( 'mce_buttons', 'register_tinymce_button' );
461
+ }
462
+ }
463
+
464
+ /**
465
+ * ##### FILTER HOOK: mce_external_plugins #####
466
+ *
467
+ * @param array $plugin_array Plugin Array.
468
+ */
469
+ function add_tinymce_plugin( $plugin_array ) {
470
+ $plugin_array['tinymce_button'] = SA_PLUGIN_PATH . 'js/add_tinymce_button.js';
471
+ return $plugin_array;
472
+ }
473
+
474
+ /**
475
+ * ##### FILTER HOOK: mce_buttons #####
476
+ *
477
+ * @param array $buttons TinyMCE buttons.
478
+ */
479
+ function register_tinymce_button( $buttons ) {
480
+ array_push( $buttons, 'tinymce_button' );
481
+ return $buttons;
482
+ }
483
+
484
+ /**
485
+ * ##### ACTION HOOK: admin_footer #####
486
+ */
487
+ function get_tinymce_shortcode_array() {
488
+ $screen = get_current_screen();
489
+ if ( 'envira' !== $screen->post_type ) { // ### BUG FIX - CLASHING WITH ENVIRA GALLERY (VER 2.0.13) ###.
490
+ // display 2 javascript arrays (in footer) containing all the slide anything post titles and post ids.
491
+ // these 2 arrays are used to display the shortcode options by the TinyMCE button.
492
+ echo "<script type='text/javascript'>\n";
493
+ echo "var sa_title_arr = new Array();\n";
494
+ echo "var sa_id_arr = new Array();\n";
495
+
496
+ $args = array(
497
+ 'post_type' => 'sa_slider',
498
+ 'post_status' => 'publish',
499
+ 'posts_per_page' => -1,
500
+ );
501
+ $sa_slider_query = new WP_Query( $args );
502
+ $count = 0;
503
+ foreach ( $sa_slider_query->posts as $sa_post ) {
504
+ $title = $sa_post->post_title;
505
+ echo 'sa_title_arr[' . esc_js( $count ) . "] = '" . esc_js( $title ) . "';\n";
506
+ echo 'sa_id_arr[' . esc_js( $count ) . "] = '" . esc_js( $sa_post->ID ) . "';\n";
507
+ $count++;
508
+ }
509
+ echo "</script>\n";
510
+ }
511
+ }
512
+
513
+
514
+
515
+ /**
516
+ * ##### ACTION HOOK - ADD META BOXES TO THE 'Slide Anything' CUSTOM POST TYPE #####
517
+ */
518
+ function cpt_slider_add_meta_boxes() {
519
+ global $post;
520
+ global $current_user;
521
+ if ( ! is_object( $post ) ) {
522
+ return;
523
+ }
524
+
525
+ $info_added = get_post_meta( $post->ID, 'sa_info_added', true );
526
+ $info_deleted = get_post_meta( $post->ID, 'sa_info_deleted', true );
527
+ $info_duplicated = get_post_meta( $post->ID, 'sa_info_duplicated', true );
528
+ $info_moved = get_post_meta( $post->ID, 'sa_info_moved', true );
529
+ if ( '1' === $info_added ) {
530
+ add_meta_box( 'cpt_slide_added', __( 'Information' ), 'cpt_slide_added_content', 'sa_slider', 'normal', 'high' );
531
+ update_post_meta( $post->ID, 'sa_info_added', '0' );
532
+ }
533
+ if ( '1' === $info_deleted ) {
534
+ add_meta_box( 'cpt_slide_deleted', __( 'Information' ), 'cpt_slide_deleted_content', 'sa_slider', 'normal', 'high' );
535
+ update_post_meta( $post->ID, 'sa_info_deleted', '0' );
536
+ }
537
+ if ( '1' === $info_duplicated ) {
538
+ add_meta_box( 'cpt_slide_duplicated', __( 'Information' ), 'cpt_slide_duplicated_content', 'sa_slider', 'normal', 'high' );
539
+ update_post_meta( $post->ID, 'sa_info_duplicated', '0' );
540
+ }
541
+ if ( '1' === $info_moved ) {
542
+ add_meta_box( 'cpt_slide_moved', __( 'Information' ), 'cpt_slide_moved_content', 'sa_slider', 'normal', 'high' );
543
+ update_post_meta( $post->ID, 'sa_info_moved', '0' );
544
+ }
545
+ add_meta_box( 'cpt_slider_settings', __( 'Slider Settings' ), 'cpt_slider_settings_content', 'sa_slider', 'normal', 'high' );
546
+ add_meta_box( 'cpt_slider_slides', __( 'Slides' ), 'cpt_slider_slides_content', 'sa_slider', 'normal', 'high' );
547
+ add_meta_box( 'cpt_slider_shortcode', __( 'Shortcode / Preview' ), 'cpt_slider_shortcode_content', 'sa_slider', 'side', 'high' );
548
+ add_meta_box( 'cpt_slider_items', __( 'Items Displayed' ), 'cpt_slider_items_content', 'sa_slider', 'side', 'default' );
549
+ add_meta_box( 'cpt_slider_style', __( 'Slider Style' ), 'cpt_slider_style_content', 'sa_slider', 'side', 'default' );
550
+ add_meta_box( 'cpt_slider_thumbs', __( 'Thumbnail Pagination' ), 'cpt_slider_thumbs_content', 'sa_slider', 'side', 'default' );
551
+ remove_meta_box( 'mymetabox_revslider_0', 'sa_slider', 'normal' ); // remove revolution slider meta box
552
+ // SLIDE ANY POST PROMOTIONAL META BOX.
553
+ $sa_pro_version = validate_slide_anything_pro_registration();
554
+ if ( ! $sa_pro_version ) {
555
+ $user_id = $current_user->ID;
556
+ if ( ! get_user_meta( $user_id, 'sa_ignore_sapost_notice' ) ) {
557
+ add_meta_box( 'cpt_slide_any_post', __( 'Slide Any Post Plugin - Just Launched!' ), 'cpt_slide_any_post_content', 'sa_slider', 'normal', 'default' );
558
+ }
559
+ }
560
+ }
561
+
562
+
563
+
564
+ /**
565
+ * ##### META BOX CONTENT - 'Information' (slide added) BOX #####
566
+ */
567
+ function cpt_slide_added_content() {
568
+ echo "<h3 id='sa_slide_added_mess'>A new slide has been added to this slider.</h3>";
569
+ }
570
+
571
+
572
+
573
+ /**
574
+ * ##### META BOX CONTENT - 'Information' (slide deleted) BOX #####
575
+ */
576
+ function cpt_slide_deleted_content() {
577
+ echo "<h3 id='sa_slide_deleted_mess'>A slide has been deleted from this slider.</h3>";
578
+ }
579
+
580
+
581
+
582
+ /**
583
+ * ##### META BOX CONTENT - 'Information' (slide duplicated) BOX #####
584
+ */
585
+ function cpt_slide_duplicated_content() {
586
+ echo "<h3 id='sa_slide_duplicated_mess'>A slide has been duplicated (copied) within this slider.</h3>";
587
+ }
588
+
589
+
590
+
591
+ /**
592
+ * ##### META BOX CONTENT - 'Information' (slide moved) BOX #####
593
+ */
594
+ function cpt_slide_moved_content() {
595
+ echo "<h3 id='sa_slide_moved_mess'>The slide order of this slider has been has changed.</h3>";
596
+ }
597
+
598
+
599
+
600
+ /**
601
+ * // ##### META BOX CONTENT - 'Slider Settings' BOX #####
602
+ *
603
+ * @param array $post Custom Post 'sa_slider'.
604
+ */
605
+ function cpt_slider_settings_content( $post ) {
606
+ $num_slides = get_post_meta( $post->ID, 'sa_num_slides', true );
607
+ $sa_pro_version = validate_slide_anything_pro_registration();
608
+ echo "<div id='sa_slider_settings'>\n";
609
+
610
+ // NONCE TO PREVENT CSRF SECURITY ATTACKS.
611
+ wp_nonce_field( basename( __FILE__ ), 'nonce_save_slider' );
612
+
613
+ // HIDDEN FIELD - NUMBER OF SLIDES.
614
+ if ( '' === $num_slides ) {
615
+ // new slider is being created.
616
+ echo "<input type='hidden' id='num_slides_id' name='sa_num_slides' value='3'/>\n";
617
+ } else {
618
+ // existing slider.
619
+ $num_slides = intval( $num_slides );
620
+ echo "<input type='hidden' id='num_slides_id' name='sa_num_slides' value='" . esc_attr( $num_slides ) . "'/>\n";
621
+ }
622
+ // HIDDEN FIELD - SLIDE ADDED INDICATOR.
623
+ echo "<input type='hidden' id='sa_info_added' name='sa_info_added' value='0'/>\n";
624
+ // HIDDEN FIELD - SLIDE DELETED INDICATOR.
625
+ echo "<input type='hidden' id='sa_info_deleted' name='sa_info_deleted' value='0'/>\n";
626
+ // HIDDEN FIELD - SLIDE DUPLICATED INDICATOR.
627
+ echo "<input type='hidden' id='sa_info_duplicated' name='sa_info_duplicated' value='0'/>\n";
628
+ // HIDDEN FIELD - SLIDE MOVED UP INDICATOR.
629
+ echo "<input type='hidden' id='sa_info_moved' name='sa_info_moved' value='0'/>\n";
630
+ // HIDDEN FIELD - DUPLICATE SLIDE NUMBER.
631
+ echo "<input type='hidden' id='sa_duplicate_slide' name='sa_duplicate_slide' value='0'/>\n";
632
+ // HIDDEN FIELD - MOVE SLIDE UP (SLIDE NUMBER).
633
+ echo "<input type='hidden' id='sa_move_slide_up' name='sa_move_slide_up' value='0'/>\n";
634
+ // HIDDEN FIELD - PRO VERSION.
635
+ if ( $sa_pro_version ) {
636
+ echo "<input type='hidden' id='sa_pro_version' name='sa_pro_version' value='1'/>\n";
637
+ } else {
638
+ echo "<input type='hidden' id='sa_pro_version' name='sa_pro_version' value='0'/>\n";
639
+ }
640
+ // SLIDE DURATION.
641
+ $slide_duration = get_post_meta( $post->ID, 'sa_slide_duration', true );
642
+ if ( '' === $slide_duration ) {
643
+ $slide_duration = 5;
644
+ }
645
+ echo "<div class='sa_slider_value'><span>Slide Duration:</span>";
646
+ echo "<input type='text' id='sa_slide_duration' name='sa_slide_duration' readonly value='" . esc_attr( $slide_duration ) . "'><em>seconds (0 = manual navigation)</em>";
647
+ echo "<em class='sa_tooltip' href='' title='Set to 0 to disable slider autoplay (manual slider navigation only)'></em></div>\n";
648
+ echo "<div class='jquery_ui_slider' id='jq_slider_duration'></div><hr/>\n";
649
+ // SLIDE TRANSITION.
650
+ $slide_transition = get_post_meta( $post->ID, 'sa_slide_transition', true );
651
+ if ( '' === $slide_transition ) {
652
+ $slide_transition = 0.2;
653
+ }
654
+ echo "<div class='sa_slider_value'><span>Slide Transition:</span>";
655
+ echo "<input type='text' id='sa_slide_transition' name='sa_slide_transition' readonly value='" . esc_attr( $slide_transition ) . "'><em>seconds</em>\n";
656
+ echo "<em class='sa_tooltip' href='' title='The time it takes to change from one slide to the next slide'></em></div>\n";
657
+ echo "<div class='jquery_ui_slider' id='jq_slider_transition'></div><hr/>\n";
658
+ // SLIDE BY.
659
+ $slide_by = get_post_meta( $post->ID, 'sa_slide_by', true );
660
+ if ( '' === $slide_by ) {
661
+ $slide_by = 1;
662
+ }
663
+ echo "<div class='sa_slider_value'><span>Slide By:</span>";
664
+ echo "<input type='text' id='sa_slide_by' name='sa_slide_by' readonly value='" . esc_attr( $slide_by ) . "'><em>slides (0 = slide by page)</em>";
665
+ echo "<em class='sa_tooltip' href='' title='The number of slides to slide per transition. Set to 0 to enable the Slide by Page option.'></em></div>\n";
666
+ echo "<div class='jquery_ui_slider' id='jq_slider_by'></div><hr/>\n";
667
+ echo "<div class='half_width_column'>\n";
668
+ // LOOP SLIDER.
669
+ $loop_slider = get_post_meta( $post->ID, 'sa_loop_slider', true );
670
+ if ( '' === $loop_slider ) {
671
+ $loop_slider = '1';
672
+ }
673
+ echo "<div class='sa_setting_checkbox'><span>Loop Slider:</span>";
674
+ if ( '1' === $loop_slider ) {
675
+ echo "<input type='checkbox' id='sa_loop_slider' name='sa_loop_slider' value='1' checked/>";
676
+ } else {
677
+ echo "<input type='checkbox' id='sa_loop_slider' name='sa_loop_slider' value='1'/>";
678
+ }
679
+ echo "<em class='sa_tooltip' href='' title='Only applies when slide duration is NOT zero (loops back to first slide after last slide is displayed)'></em>";
680
+ echo "</div>\n";
681
+ // STOP ON HOVER.
682
+ $stop_hover = get_post_meta( $post->ID, 'sa_stop_hover', true );
683
+ if ( '' === $stop_hover ) {
684
+ $stop_hover = '1';
685
+ }
686
+ echo "<div class='sa_setting_checkbox'><span>Stop on Hover:</span>";
687
+ if ( '1' === $stop_hover ) {
688
+ echo "<input type='checkbox' id='sa_stop_hover' name='sa_stop_hover' value='1' checked/>";
689
+ } else {
690
+ echo "<input type='checkbox' id='sa_stop_hover' name='sa_stop_hover' value='1'/>";
691
+ }
692
+ echo "<em class='sa_tooltip' href='' title='Only applies when slide duration is NOT zero (slideshow is paused when hovering over a slide)'></em>";
693
+ echo "</div>\n";
694
+ // RANDOM ORDER.
695
+ $random_order = get_post_meta( $post->ID, 'sa_random_order', true );
696
+ if ( '' === $random_order ) {
697
+ $random_order = '0';
698
+ }
699
+ echo "<div class='sa_setting_checkbox'><span>Random Order:</span>";
700
+ if ( '1' === $random_order ) {
701
+ echo "<input type='checkbox' id='sa_random_order' name='sa_random_order' value='1' checked/>";
702
+ } else {
703
+ echo "<input type='checkbox' id='sa_random_order' name='sa_random_order' value='1'/>";
704
+ }
705
+ echo "<em class='sa_tooltip' title='When checked slides will be randomly re-ordered whenever the slider is displayed'></em>";
706
+ echo "</div>\n";
707
+ // REVERSE ORDER.
708
+ $reverse_order = get_post_meta( $post->ID, 'sa_reverse_order', true );
709
+ if ( '' === $reverse_order ) {
710
+ $reverse_order = '0';
711
+ }
712
+ echo "<div class='sa_setting_checkbox'><span>Reverse Order:</span>";
713
+ if ( '1' === $reverse_order ) {
714
+ echo "<input type='checkbox' id='sa_reverse_order' name='sa_reverse_order' value='1' checked/>";
715
+ } else {
716
+ echo "<input type='checkbox' id='sa_reverse_order' name='sa_reverse_order' value='1'/>";
717
+ }
718
+ echo "<em class='sa_tooltip' title='When checked your slides will be shown in the reverse order (i.e. last slide first)'></em>";
719
+ echo "</div>\n";
720
+ // ALLOW SHORTCODES.
721
+ $shortcodes = get_post_meta( $post->ID, 'sa_shortcodes', true );
722
+ if ( '' === $shortcodes ) {
723
+ $shortcodes = '0';
724
+ }
725
+ echo "<div class='sa_setting_checkbox'><span>Allow Shortcodes:</span>";
726
+ if ( '1' === $shortcodes ) {
727
+ echo "<input type='checkbox' id='sa_shortcodes' name='sa_shortcodes' value='1' checked/>";
728
+ } else {
729
+ echo "<input type='checkbox' id='sa_shortcodes' name='sa_shortcodes' value='1'/>";
730
+ }
731
+ echo "<em class='sa_tooltip' href='' title='Include WordPree shorcodes within slide content. NOTE: Running shortcodes in Slide Anything may cause issues with some WordPress Page Builders'></em>\n";
732
+ echo "</div>\n";
733
+ // VERTICAL CENTER.
734
+ $vert_center = get_post_meta( $post->ID, 'sa_vert_center', true );
735
+ if ( '' === $vert_center ) {
736
+ $vert_center = '0';
737
+ }
738
+ echo "<div class='sa_setting_checkbox'><span>Vertical Center:</span>";
739
+ if ( '1' === $vert_center ) {
740
+ echo "<input type='checkbox' id='sa_vert_center' name='sa_vert_center' value='1' checked/>";
741
+ } else {
742
+ echo "<input type='checkbox' id='sa_vert_center' name='sa_vert_center' value='1'/>";
743
+ }
744
+ echo "<em class='sa_tooltip' title='Vertically center content within slides. Only use this setting if you have set a Min Height for your slider (which sets a minimum height for each slide).'></em>";
745
+ echo "</div>\n";
746
+ echo "</div>\n";
747
+ echo "<div class='half_width_column'>\n";
748
+ // NAVIGATE ARROWS.
749
+ $nav_arrows = get_post_meta( $post->ID, 'sa_nav_arrows', true );
750
+ if ( '' === $nav_arrows ) {
751
+ $nav_arrows = '1';
752
+ }
753
+ echo "<div class='sa_setting_checkbox'><span>Navigate Arrows:</span>";
754
+ if ( '1' === $nav_arrows ) {
755
+ echo "<input type='checkbox' id='sa_nav_arrows' name='sa_nav_arrows' value='1' checked/>";
756
+ } else {
757
+ echo "<input type='checkbox' id='sa_nav_arrows' name='sa_nav_arrows' value='1'/>";
758
+ }
759
+ echo "<em class='sa_tooltip' href='' title='Display the \"next slide\" amd \"previous slide\" buttons'></em>\n";
760
+ echo "</div>\n";
761
+ // SHOW PAGINATION.
762
+ $pagination = get_post_meta( $post->ID, 'sa_pagination', true );
763
+ if ( '' === $pagination ) {
764
+ $pagination = '1';
765
+ }
766
+ echo "<div class='sa_setting_checkbox'><span>Show Pagination:</span>";
767
+ if ( '1' === $pagination ) {
768
+ echo "<input type='checkbox' id='sa_pagination' name='sa_pagination' value='1' checked/>";
769
+ } else {
770
+ echo "<input type='checkbox' id='sa_pagination' name='sa_pagination' value='1'/>";
771
+ }
772
+ echo "<em class='sa_tooltip' href='' title='Display slider pagination below the slider'></em>\n";
773
+ echo "</div>\n";
774
+
775
+ // MOUSE DRAG.
776
+ $mouse_drag = get_post_meta( $post->ID, 'sa_mouse_drag', true );
777
+ if ( '' === $mouse_drag ) {
778
+ $mouse_drag = '0';
779
+ }
780
+ echo "<div class='sa_setting_checkbox'><span>Mouse Drag:</span>";
781
+ if ( '1' === $mouse_drag ) {
782
+ echo "<input type='checkbox' id='sa_mouse_drag' name='sa_mouse_drag' value='1' checked/>";
783
+ } else {
784
+ echo "<input type='checkbox' id='sa_mouse_drag' name='sa_mouse_drag' value='1'/>";
785
+ }
786
+ echo "<em class='sa_tooltip' href='' title='Allow navigation to previous/next slides by holding down left mouse button and dragging left/right. (NOTE: Enabling this option will disable vertical touch-drag scrolling on mobile devices)'></em>\n";
787
+ echo "</div>\n";
788
+ // TOUCH DRAG.
789
+ $touch_drag = get_post_meta( $post->ID, 'sa_touch_drag', true );
790
+ if ( '' === $touch_drag ) {
791
+ $touch_drag = '1';
792
+ }
793
+ echo "<div class='sa_setting_checkbox'><span>Touch Drag:</span>";
794
+ if ( '1' === $touch_drag ) {
795
+ echo "<input type='checkbox' id='sa_touch_drag' name='sa_touch_drag' value='1' checked/>";
796
+ } else {
797
+ echo "<input type='checkbox' id='sa_touch_drag' name='sa_touch_drag' value='1'/>";
798
+ }
799
+ echo "<em class='sa_tooltip' href='' title='Allow navigation to previous/next slides on mobile devices by touching screen and dragging left/right'></em>\n";
800
+ echo "</div>\n";
801
+ // MOUSEWHEEL NAV.
802
+ $mousewheel = get_post_meta( $post->ID, 'sa_mousewheel', true );
803
+ if ( '' === $mousewheel ) {
804
+ $mousewheel = '0';
805
+ }
806
+ echo "<div class='sa_setting_checkbox'><span>Mousewheel Nav:</span>";
807
+ if ( '1' === $mousewheel ) {
808
+ echo "<input type='checkbox' id='sa_mousewheel' name='sa_mousewheel' value='1' checked/>";
809
+ } else {
810
+ echo "<input type='checkbox' id='sa_mousewheel' name='sa_mousewheel' value='1'/>";
811
+ }
812
+ echo "<em class='sa_tooltip' href='' title='Allow previous/next slide navigation using the mousewheel (NOTE: does not work well with the Apple Mac touchpad scroll wheel mimic)'></em>\n";
813
+ echo "</div>\n";
814
+ // CLICK TO ADVANCE.
815
+ $click_advance = get_post_meta( $post->ID, 'sa_click_advance', true );
816
+ if ( '' === $click_advance ) {
817
+ $click_advance = '0';
818
+ }
819
+ echo "<div class='sa_setting_checkbox'><span>Click to Advance:</span>";
820
+ if ( '1' === $click_advance ) {
821
+ echo "<input type='checkbox' id='sa_click_advance' name='sa_click_advance' value='1' checked/>";
822
+ } else {
823
+ echo "<input type='checkbox' id='sa_click_advance' name='sa_click_advance' value='1'/>";
824
+ }
825
+ echo "<em class='sa_tooltip' href='' title='Clicking on the slider advances to the next slide. NOTE: Only works when the Mouse Drag and Touch Drag options are NOT checked.'></em>\n";
826
+ echo "</div>\n";
827
+ // AUTO HEIGHT.
828
+ $auto_height = get_post_meta( $post->ID, 'sa_auto_height', true );
829
+ if ( '' === $auto_height ) {
830
+ $auto_height = '0';
831
+ }
832
+ echo "<div class='sa_setting_checkbox'><span>Auto Height:</span>";
833
+ if ( '1' === $auto_height ) {
834
+ echo "<input type='checkbox' id='sa_auto_height' name='sa_auto_height' value='1' checked/>";
835
+ } else {
836
+ echo "<input type='checkbox' id='sa_auto_height' name='sa_auto_height' value='1'/>";
837
+ }
838
+ echo "<em class='sa_tooltip' title='Only works with 1 item on the screen. When checked the height of slider is automatically changed to match the height for each slide.'></em>";
839
+ echo "</div>\n";
840
+ echo "</div>\n";
841
+ echo "<div style='clear:both; float:none; width:100%; height:1px;'></div>\n";
842
+ echo "</div>\n";
843
+ }
844
+
845
+
846
+
847
+ /**
848
+ * ##### META BOX CONTENT - 'Slides' BOX #####
849
+ *
850
+ * @param array $post Custom Post 'sa_slider'.
851
+ */
852
+ function cpt_slider_slides_content( $post ) {
853
+ $num_slides = get_post_meta( $post->ID, 'sa_num_slides', true );
854
+ $slider_css_id = get_post_meta( $post->ID, 'sa_css_id', true );
855
+ $sa_pro_version = validate_slide_anything_pro_registration();
856
+ // DISABLE VISUAL EDITOR CHECKBOX.
857
+ $disable_visual_editor = get_post_meta( $post->ID, 'sa_disable_visual_editor', true );
858
+ if ( '' === $disable_visual_editor ) {
859
+ $disable_visual_editor = '0';
860
+ }
861
+ echo "<div id='sa_visual_editor_checkbox'><span>Disable Visual Editor:</span>";
862
+ if ( '1' === $disable_visual_editor ) {
863
+ echo "<input type='checkbox' id='sa_disable_visual_editor' name='sa_disable_visual_editor' value='1' checked/></div>\n";
864
+ } else {
865
+ echo "<input type='checkbox' id='sa_disable_visual_editor' name='sa_disable_visual_editor' value='1'/></div>\n";
866
+ }
867
+ // SLIDER EDITOR BOX SETTINGS.
868
+ if ( '1' === $disable_visual_editor ) {
869
+ $editor_args = array(
870
+ 'tinymce' => false,
871
+ 'wpautop' => false,
872
+ 'media_buttons' => true,
873
+ 'editor_class' => 'sa_slide_content',
874
+ 'editor_height' => '250',
875
+ );
876
+ } else {
877
+ $editor_args = array(
878
+ 'tinymce' => true,
879
+ 'wpautop' => false,
880
+ 'media_buttons' => true,
881
+ 'editor_class' => 'sa_slide_content',
882
+ 'editor_height' => '250',
883
+ );
884
+ }
885
+ if ( '' === $num_slides ) {
886
+ // A NEW SLIDER IS BEING CREATED - ADD 3 INITIAL SLIDES.
887
+ $num_slides = 3;
888
+ $slide_data[0]['edit_id'] = 'sa_slide1_content';
889
+ $slide_data[0]['content'] = 'Slide content';
890
+ $slide_data[0]['del_id'] = 'sa_slide1_delete';
891
+ $slide_data[0]['image_data'] = 'sa_slide1_image_data';
892
+ $slide_data[0]['image_id'] = 'sa_slide1_image_id';
893
+ $slide_data[0]['thumb'] = 'slide1_thumb';
894
+ $slide_data[0]['image_del'] = 'slide1_image_del';
895
+ $slide_data[0]['image_pos'] = 'sa_slide1_image_pos';
896
+ $slide_data[0]['image_size'] = 'sa_slide1_image_size';
897
+ $slide_data[0]['image_repeat'] = 'sa_slide1_image_repeat';
898
+ $slide_data[0]['image_color'] = 'sa_slide1_image_color';
899
+ $slide_data[0]['link_url'] = 'sa_slide1_link_url';
900
+ $slide_data[0]['link_target'] = 'sa_slide1_link_target';
901
+ $slide_data[0]['slide_no'] = 1;
902
+ $slide_data[1]['edit_id'] = 'sa_slide2_content';
903
+ $slide_data[1]['content'] = 'Slide content';
904
+ $slide_data[1]['del_id'] = 'sa_slide2_delete';
905
+ $slide_data[1]['image_data'] = 'sa_slide2_image_data';
906
+ $slide_data[1]['image_id'] = 'sa_slide2_image_id';
907
+ $slide_data[1]['thumb'] = 'slide2_thumb';
908
+ $slide_data[1]['image_del'] = 'slide2_image_del';
909
+ $slide_data[1]['image_pos'] = 'sa_slide2_image_pos';
910
+ $slide_data[1]['image_size'] = 'sa_slide2_image_size';
911
+ $slide_data[1]['image_repeat'] = 'sa_slide2_image_repeat';
912
+ $slide_data[1]['image_color'] = 'sa_slide2_image_color';
913
+ $slide_data[1]['link_url'] = 'sa_slide2_link_url';
914
+ $slide_data[1]['link_target'] = 'sa_slide2_link_target';
915
+ $slide_data[1]['slide_no'] = 2;
916
+ $slide_data[2]['edit_id'] = 'sa_slide3_content';
917
+ $slide_data[2]['content'] = 'Slide content';
918
+ $slide_data[2]['del_id'] = 'sa_slide3_delete';
919
+ $slide_data[2]['image_data'] = 'sa_slide3_image_data';
920
+ $slide_data[2]['image_id'] = 'sa_slide3_image_id';
921
+ $slide_data[2]['thumb'] = 'slide3_thumb';
922
+ $slide_data[2]['image_del'] = 'slide3_image_del';
923
+ $slide_data[2]['image_pos'] = 'sa_slide3_image_pos';
924
+ $slide_data[2]['image_size'] = 'sa_slide3_image_size';
925
+ $slide_data[2]['image_repeat'] = 'sa_slide3_image_repeat';
926
+ $slide_data[2]['image_color'] = 'sa_slide3_image_color';
927
+ $slide_data[2]['link_url'] = 'sa_slide3_link_url';
928
+ $slide_data[2]['link_target'] = 'sa_slide3_link_target';
929
+ $slide_data[2]['slide_no'] = 3;
930
+ if ( $sa_pro_version ) {
931
+ $slide_data[0]['popup_type'] = 'sa_slide1_popup_type';
932
+ $slide_data[0]['popup_imageid'] = 'sa_slide1_popup_imageid';
933
+ $slide_data[0]['popup_imagetitle'] = 'sa_slide1_popup_imagetitle';
934
+ $slide_data[0]['popup_video_id'] = 'sa_slide1_popup_video_id';
935
+ $slide_data[0]['popup_video_type'] = 'sa_slide1_popup_video_type';
936
+ $slide_data[0]['popup_background'] = 'sa_slide1_popup_background';
937
+ $slide_data[0]['popup_html'] = 'sa_slide1_popup_html';
938
+ $slide_data[0]['popup_shortcode'] = 'sa_slide1_popup_shortcode';
939
+ $slide_data[0]['popup_bgcol'] = 'sa_slide1_popup_bgcol';
940
+ $slide_data[0]['popup_width'] = 'sa_slide1_popup_width';
941
+ $slide_data[1]['popup_type'] = 'sa_slide2_popup_type';
942
+ $slide_data[1]['popup_imageid'] = 'sa_slide2_popup_imageid';
943
+ $slide_data[1]['popup_imagetitle'] = 'sa_slide2_popup_imagetitle';
944
+ $slide_data[1]['popup_video_id'] = 'sa_slide2_popup_video_id';
945
+ $slide_data[1]['popup_video_type'] = 'sa_slide2_popup_video_type';
946
+ $slide_data[1]['popup_background'] = 'sa_slide2_popup_background';
947
+ $slide_data[1]['popup_html'] = 'sa_slide2_popup_html';
948
+ $slide_data[1]['popup_shortcode'] = 'sa_slide2_popup_shortcode';
949
+ $slide_data[1]['popup_bgcol'] = 'sa_slide2_popup_bgcol';
950
+ $slide_data[1]['popup_width'] = 'sa_slide2_popup_width';
951
+ $slide_data[2]['popup_type'] = 'sa_slide3_popup_type';
952
+ $slide_data[2]['popup_imageid'] = 'sa_slide3_popup_imageid';
953
+ $slide_data[2]['popup_imagetitle'] = 'sa_slide3_popup_imagetitle';
954
+ $slide_data[2]['popup_video_id'] = 'sa_slide3_popup_video_id';
955
+ $slide_data[2]['popup_video_type'] = 'sa_slide3_popup_video_type';
956
+ $slide_data[2]['popup_background'] = 'sa_slide3_popup_background';
957
+ $slide_data[2]['popup_html'] = 'sa_slide3_popup_html';
958
+ $slide_data[2]['popup_shortcode'] = 'sa_slide3_popup_shortcode';
959
+ $slide_data[2]['popup_bgcol'] = 'sa_slide3_popup_bgcol';
960
+ $slide_data[2]['popup_width'] = 'sa_slide3_popup_width';
961
+ }
962
+ } else {
963
+ // AN EXISTING SLIDER - GET SLIDE DATA FROM THE DATABASE AND SAVE WITHIN AN ARRAY.
964
+ $num_slides = intval( $num_slides );
965
+ $slide_data = array();
966
+ $count = 0;
967
+ for ( $i = 1; $i <= $num_slides; $i++ ) {
968
+ $slide_edit_id = 'sa_slide' . $i . '_content';
969
+ $slide_char_count = 'sa_slide' . $i . '_char_count';
970
+ $slide_data[ $count ]['edit_id'] = $slide_edit_id;
971
+ $slide_data[ $count ]['content'] = get_post_meta( $post->ID, $slide_edit_id, true );
972
+ $slide_data[ $count ]['char_count'] = get_post_meta( $post->ID, $slide_char_count, true );
973
+ $slide_data[ $count ]['del_id'] = 'sa_slide' . $i . '_delete';
974
+ $slide_data[ $count ]['thumb'] = 'slide' . $i . '_thumb';
975
+ $slide_data[ $count ]['image_del'] = 'slide' . $i . '_image_del';
976
+ $slide_data[ $count ]['image_data'] = 'sa_slide' . $i . '_image_data';
977
+ $slide_data[ $count ]['image_id'] = 'sa_slide' . $i . '_image_id';
978
+ $slide_data[ $count ]['image_pos'] = 'sa_slide' . $i . '_image_pos';
979
+ $slide_data[ $count ]['image_size'] = 'sa_slide' . $i . '_image_size';
980
+ $slide_data[ $count ]['image_repeat'] = 'sa_slide' . $i . '_image_repeat';
981
+ $slide_data[ $count ]['image_color'] = 'sa_slide' . $i . '_image_color';
982
+ $slide_data[ $count ]['image_data'] = 'sa_slide' . $i . '_image_data';
983
+ $slide_data[ $count ]['link_url'] = 'sa_slide' . $i . '_link_url';
984
+ $slide_data[ $count ]['link_target'] = 'sa_slide' . $i . '_link_target';
985
+ if ( $sa_pro_version ) {
986
+ $slide_data[ $count ]['popup_type'] = 'sa_slide' . $i . '_popup_type';
987
+ $slide_data[ $count ]['popup_imageid'] = 'sa_slide' . $i . '_popup_imageid';
988
+ $slide_data[ $count ]['popup_imagetitle'] = 'sa_slide' . $i . '_popup_imagetitle';
989
+ $slide_data[ $count ]['popup_video_id'] = 'sa_slide' . $i . '_popup_video_id';
990
+ $slide_data[ $count ]['popup_video_type'] = 'sa_slide' . $i . '_popup_video_type';
991
+ $slide_data[ $count ]['popup_background'] = 'sa_slide' . $i . '_popup_background';
992
+ $slide_data[ $count ]['popup_html'] = 'sa_slide' . $i . '_popup_html';
993
+ $slide_data[ $count ]['popup_shortcode'] = 'sa_slide' . $i . '_popup_shortcode';
994
+ $slide_data[ $count ]['popup_bgcol'] = 'sa_slide' . $i . '_popup_bgcol';
995
+ $slide_data[ $count ]['popup_width'] = 'sa_slide' . $i . '_popup_width';
996
+ }
997
+ $slide_data[ $count ]['slide_no'] = $i;
998
+ $count++;
999
+ }
1000
+ }
1001
+ // GET AVAILABLE WordPress IMAGE SIZES AND SAVE WITHIN AN ARRAY.
1002
+ if ( $sa_pro_version ) {
1003
+ // SLIDE ANYTHING PRO VERSION ONLY.
1004
+ global $_wp_additional_image_sizes;
1005
+ $image_size_arr = array();
1006
+ $image_size_arr[0]['value'] = 'no';
1007
+ $image_size_arr[0]['desc'] = 'NO';
1008
+ $count = 1;
1009
+ foreach ( get_intermediate_image_sizes() as $image_size ) {
1010
+ if ( in_array( $image_size, array( 'thumbnail', 'medium', 'medium_large', 'large' ), true ) ) {
1011
+ $width = get_option( "{$image_size}_size_w" );
1012
+ $height = get_option( "{$image_size}_size_h" );
1013
+ } elseif ( isset( $_wp_additional_image_sizes[ $image_size ] ) ) {
1014
+ $width = $_wp_additional_image_sizes[ $image_size ]['width'];
1015
+ $height = $_wp_additional_image_sizes[ $image_size ]['height'];
1016
+ }
1017
+ if ( ( 0 !== $width ) && ( 0 !== $height ) ) {
1018
+ $image_size_arr[ $count ]['value'] = $image_size;
1019
+ $image_size_arr[ $count ]['desc'] = $image_size . ' (' . $width . '&times;' . $height . ')';
1020
+ $count++;
1021
+ }
1022
+ }
1023
+ }
1024
+ /**
1025
+ * ###### LOOP TO DISPLAY INPUT ELEMENTS FOR EACH SLIDE ######
1026
+ */
1027
+ echo "<div id='slider_accordion'>\n";
1028
+
1029
+ // determine whether to use css classes instead of csss ids.
1030
+ $use_classes = 0;
1031
+ $other_settings = get_post_meta( $post->ID, 'sa_other_settings', true );
1032
+ if ( '' !== $other_settings ) {
1033
+ $other_settings_arr = explode( '|', $other_settings );
1034
+ }
1035
+ if ( isset( $other_settings_arr ) && ( count( $other_settings_arr ) > 7 ) ) {
1036
+ $disable_slide_ids = $other_settings_arr[7];
1037
+ } else {
1038
+ $disable_slide_ids = '0';
1039
+ }
1040
+ if ( '1' === $disable_slide_ids ) {
1041
+ $use_classes = 1;
1042
+ }
1043
+
1044
+ $tot = count( $slide_data );
1045
+ for ( $i = 0; $i < $tot; $i++ ) {
1046
+ // DISPLAY ACCORDION HEADING.
1047
+ echo '<h3>Slide ' . esc_html( $slide_data[ $i ]['slide_no'] );
1048
+ $css_id = $slider_css_id . '_slide' . sprintf( '%02d', $slide_data[ $i ]['slide_no'] );
1049
+ // display CSS ID/CLASS for the current slide.
1050
+ if ( 1 === $use_classes ) {
1051
+ echo '<span>.' . esc_html( $css_id ) . '</span>';
1052
+ } else {
1053
+ echo '<span>#' . esc_html( $css_id ) . '</span>';
1054
+ }
1055
+ echo "</h3>\n";
1056
+ echo "<div>\n";
1057
+
1058
+ // ### DISPLAY THE SLIDE CONTENT EDITOR (textarea field) ###
1059
+ wp_editor( $slide_data[ $i ]['content'], $slide_data[ $i ]['edit_id'], $editor_args );
1060
+
1061
+ /**
1062
+ * ##############################
1063
+ * ##### SLIDE TABS - START #####
1064
+ * ##############################
1065
+ */
1066
+ $tabs_num = $i + 1;
1067
+ echo "<div id='slide_" . esc_html( $tabs_num ) . "_tabs' class='sa_slide_tabs'>\n";
1068
+ echo "<ul>\n";
1069
+ echo "<li><a href='#slide" . esc_html( $tabs_num ) . "_background_tab'>Slide Background</a></li>\n";
1070
+ echo "<li><a href='#slide" . esc_html( $tabs_num ) . "_link_tab'>Slide Link</a></li>\n";
1071
+ echo "<li><a href='#slide" . esc_html( $tabs_num ) . "_popup_tab'>Slide Popup</a></li>\n";
1072
+ echo "<li><a href='#slide" . esc_html( $tabs_num ) . "_goto_tab'>Slide Goto Link</a></li>\n";
1073
+ echo "</ul>\n";
1074
+
1075
+ /**
1076
+ * ####### SLIDE TAB 1 - SLIDE BACKGROUND #######
1077
+ */
1078
+ echo "<div id='slide" . esc_html( $tabs_num ) . "_background_tab' class='sa_slide_tab'>\n";
1079
+
1080
+ // GET BACKGROUND IMAGE DATA FOR THIS SLIDE (image id, position, size, repeat and color) FROM DATABASE.
1081
+ $slide_image_data = get_post_meta( $post->ID, $slide_data[ $i ]['image_data'], true );
1082
+ if ( isset( $slide_image_data ) && ( '' !== $slide_image_data ) ) {
1083
+ $data_arr = explode( '~', $slide_image_data );
1084
+ $slide_image_id = $data_arr[0];
1085
+ $slide_image_pos = $data_arr[1];
1086
+ $slide_image_size = $data_arr[2];
1087
+ $slide_image_repeat = $data_arr[3];
1088
+ $slide_image_color = $data_arr[4];
1089
+ } else {
1090
+ $slide_image_id = get_post_meta( $post->ID, $slide_data[ $i ]['image_id'], true );
1091
+ $slide_image_pos = get_post_meta( $post->ID, $slide_data[ $i ]['image_pos'], true );
1092
+ $slide_image_size = get_post_meta( $post->ID, $slide_data[ $i ]['image_size'], true );
1093
+ $slide_image_repeat = get_post_meta( $post->ID, $slide_data[ $i ]['image_repeat'], true );
1094
+ $slide_image_color = get_post_meta( $post->ID, $slide_data[ $i ]['image_color'], true );
1095
+ }
1096
+ if ( '' === $slide_image_pos ) {
1097
+ $slide_image_pos = 'left top';
1098
+ }
1099
+ if ( '' === $slide_image_size ) {
1100
+ $slide_image_size = 'contain';
1101
+ }
1102
+ if ( '' === $slide_image_repeat ) {
1103
+ $slide_image_repeat = 'no-repeat';
1104
+ }
1105
+ if ( '' === $slide_image_color ) {
1106
+ $slide_image_color = 'rgba(0,0,0,0)';
1107
+ }
1108
+
1109
+ echo "<div class='sa_slide_bg_wrapper'>\n";
1110
+
1111
+ /**
1112
+ * ### 'USE POPUP IMAGE AS SLIDE BACKGROUND' SETTING ###
1113
+ */
1114
+ if ( $sa_pro_version ) {
1115
+ // SLIDE ANYTHING PRO VERSION ONLY.
1116
+ $slide_popup_background = get_post_meta( $post->ID, $slide_data[ $i ]['popup_background'], true );
1117
+ if ( '' === $slide_popup_background ) {
1118
+ $slide_popup_background = 'no';
1119
+ }
1120
+ echo "<div class='popup_background_wrapper'>\n";
1121
+ echo '<div>Use Popup Image as Slide Background:';
1122
+ $tooltip = 'Allows you to use the same image you defined as the popup image as the slide background image. You can use a smaller version of the popup image.';
1123
+ echo "<em class='sa_tooltip' href='' title='" . esc_attr( $tooltip ) . "'></em></div>\n";
1124
+ echo "<select id='" . esc_attr( $slide_data[ $i ]['popup_background'] ) . "' name='" . esc_attr( $slide_data[ $i ]['popup_background'] ) . "' ";
1125
+ echo "onChange='change_slide_popup_background(" . esc_attr( $slide_data[ $i ]['slide_no'] ) . ");'>";
1126
+ $tot_loop = count( $image_size_arr );
1127
+ for ( $j = 0; $j < $tot_loop; $j++ ) {
1128
+ if ( $slide_popup_background === $image_size_arr[ $j ]['value'] ) {
1129
+ echo "<option value='" . esc_attr( $image_size_arr[ $j ]['value'] ) . "' selected>" . esc_html( $image_size_arr[ $j ]['desc'] ) . '</option>';
1130
+ } else {
1131
+ echo "<option value='" . esc_attr( $image_size_arr[ $j ]['value'] ) . "'>" . esc_html( $image_size_arr[ $j ]['desc'] ) . '</option>';
1132
+ }
1133
+ }
1134
+ echo '</select>';
1135
+ echo "</div>\n"; // .popup_background_wrapper
1136
+ echo "<div style='clear:both; float:none; width:100%; height:1px;'></div>\n";
1137
+ echo "<div id='slide" . esc_attr( $slide_data[ $i ]['slide_no'] ) . "_imagebg_popup' class='sa_slide_bg_popup'><div></div></div>\n";
1138
+ }
1139
+
1140
+ // SLIDE BACKGROUND IMAGE - THUMBNAIL AND 'SET IMAGE' BUTTON.
1141
+ // get WordPress media upload frame url.
1142
+ $upload_frame_url = esc_url( get_upload_iframe_src( 'image', $post->ID ) . '&slide=' . $slide_data[ $i ]['slide_no'] );
1143
+ // Get image src for slide background image.
1144
+ $slide_image_src = wp_get_attachment_image_src( $slide_image_id, 'medium' );
1145
+ // check if the slide background image id already exists.
1146
+ $image_exists = is_array( $slide_image_src );
1147
+ // slide backround image - thumbnail (and delete button).
1148
+ echo "<div id='" . esc_attr( $slide_data[ $i ]['thumb'] ) . "' class='sa_slide_thumb'>\n";
1149
+ if ( $image_exists ) {
1150
+ echo "<div style='background-image:url(\"" . esc_attr( $slide_image_src[0] ) . '"); background-size:' . esc_attr( $slide_image_size ) . '; ';
1151
+ echo 'background-repeat:' . esc_attr( $slide_image_repeat ) . '; background-color:' . esc_attr( $slide_image_color ) . '; ';
1152
+ echo 'background-position:' . esc_attr( $slide_image_pos ) . ";'></div>\n";
1153
+ echo "<span id='" . esc_attr( $slide_data[ $i ]['image_del'] ) . "' onClick='remove_slide_bg_image(\"" . esc_attr( $slide_data[ $i ]['slide_no'] ) . "\");' title='Delete the background image for this slide'>X</span>\n";
1154
+ echo "</div>\n";
1155
+ } else {
1156
+ if ( isset( $slide_data[ $i ]['popup_type'] ) ) {
1157
+ $slide_popup_type = get_post_meta( $post->ID, $slide_data[ $i ]['popup_type'], true );
1158
+ $popup_video_type = get_post_meta( $post->ID, $slide_data[ $i ]['popup_video_type'], true );
1159
+ $popup_video_id = get_post_meta( $post->ID, $slide_data[ $i ]['popup_video_id'], true );
1160
+ } else {
1161
+ $slide_popup_type = 'NONE';
1162
+ $popup_video_type = '';
1163
+ $popup_video_id = '';
1164
+ }
1165
+ if ( ( '99999999' === $slide_image_id ) && ( 'VIDEO' === $slide_popup_type ) && ( 'youtube' === $popup_video_type ) ) {
1166
+ $youtube_thumb = 'https://img.youtube.com/vi/' . $popup_video_id . '/hqdefault.jpg';
1167
+ echo "<div style='background-image:url(\"" . esc_attr( $youtube_thumb ) . '"); background-size:' . esc_attr( $slide_image_size ) . '; ';
1168
+ echo 'background-repeat:' . esc_attr( $slide_image_repeat ) . '; background-color:' . esc_attr( $slide_image_color ) . '; ';
1169
+ echo 'background-position:' . esc_attr( $slide_image_pos ) . ";'></div>\n";
1170
+ echo "<span id='" . esc_attr( $slide_data[ $i ]['image_del'] ) . "' onClick='remove_slide_bg_image(\"" . esc_attr( $slide_data[ $i ]['slide_no'] ) . "\");' title='Delete the background image for this slide'>X</span>\n";
1171
+ echo "</div>\n";
1172
+ } else {
1173
+ echo "<div style='background-color:#ffffff; background-size:" . esc_attr( $slide_image_size ) . '; ';
1174
+ echo 'background-repeat:' . esc_attr( $slide_image_repeat ) . '; background-color:' . esc_attr( $slide_image_color ) . '; ';
1175
+ echo 'background-position:' . esc_attr( $slide_image_pos ) . ";'></div>\n";
1176
+ echo "<span id='" . esc_attr( $slide_data[ $i ]['image_del'] ) . "' class='sa_hidden' onClick='remove_slide_bg_image(\"" . esc_attr( $slide_data[ $i ]['slide_no'] ) . "\");' title='Delete the background image for this slide'>X</span>\n";
1177
+ echo "</div>\n";
1178
+ }
1179
+ }
1180
+ // slide background image - 'set image' button.
1181
+ echo "<a class='button button-secondary slide_image_add' id='slide" . esc_attr( $slide_data[ $i ]['slide_no'] ) . "_image_add' ";
1182
+ echo "href='" . esc_attr( $upload_frame_url ) . "' title='Set the background image for this slide'>Set Image</a>\n";
1183
+ // slide background image - image id hidden field.
1184
+ echo "<input type='hidden' id='" . esc_attr( $slide_data[ $i ]['image_id'] ) . "' name='" . esc_attr( $slide_data[ $i ]['image_id'] ) . "' value='" . esc_attr( $slide_image_id ) . "'/>\n";
1185
+
1186
+ // SLIDE BACKGROUND IMAGE - BACKGROUND POSITION (dropdown box).
1187
+ echo "<div class='slide_image_settings_line'>";
1188
+ echo '<span>Background Position:</span>';
1189
+ $option_arr = array();
1190
+ $option_arr[0]['desc'] = 'Top Left';
1191
+ $option_arr[0]['value'] = 'left top';
1192
+ $option_arr[1]['desc'] = 'Top Center';
1193
+ $option_arr[1]['value'] = 'center top';
1194
+ $option_arr[2]['desc'] = 'Top Right';
1195
+ $option_arr[2]['value'] = 'right top';
1196
+ $option_arr[3]['desc'] = 'Center Left';
1197
+ $option_arr[3]['value'] = 'left center';
1198
+ $option_arr[4]['desc'] = 'Center';
1199
+ $option_arr[4]['value'] = 'center center';
1200
+ $option_arr[5]['desc'] = 'Center Right';
1201
+ $option_arr[5]['value'] = 'right center';
1202
+ $option_arr[6]['desc'] = 'Bottom Left';
1203
+ $option_arr[6]['value'] = 'left bottom';
1204
+ $option_arr[7]['desc'] = 'Bottom Center';
1205
+ $option_arr[7]['value'] = 'center bottom';
1206
+ $option_arr[8]['desc'] = 'Bottom Right';
1207
+ $option_arr[8]['value'] = 'right bottom';
1208
+ echo "<select id='" . esc_attr( $slide_data[ $i ]['image_pos'] ) . "' name='" . esc_attr( $slide_data[ $i ]['image_pos'] ) . "' onChange='change_slide_image_pos(" . esc_attr( $slide_data[ $i ]['slide_no'] ) . ");'>";
1209
+ $tot_loop = count( $option_arr );
1210
+ for ( $j = 0; $j < $tot_loop; $j++ ) {
1211
+ if ( $slide_image_pos === $option_arr[ $j ]['value'] ) {
1212
+ echo "<option value='" . esc_attr( $option_arr[ $j ]['value'] ) . "' selected>" . esc_html( $option_arr[ $j ]['desc'] ) . '</option>';
1213
+ } else {
1214
+ echo "<option value='" . esc_attr( $option_arr[ $j ]['value'] ) . "'>" . esc_html( $option_arr[ $j ]['desc'] ) . '</option>';
1215
+ }
1216
+ }
1217
+ echo '</select>';
1218
+ echo "</div>\n";
1219
+
1220
+ // SLIDE BACKGROUND IMAGE - BACKGROUND SIZE (dropdown box).
1221
+ echo "<div class='slide_image_settings_line'>";
1222
+ echo '<span>Background Size:</span>';
1223
+ $option_arr = array();
1224
+ $option_arr[0]['value'] = 'auto';
1225
+ $option_arr[0]['desc'] = 'no resize';
1226
+ $option_arr[1]['value'] = 'contain';
1227
+ $option_arr[1]['desc'] = 'contain';
1228
+ $option_arr[2]['value'] = 'cover';
1229
+ $option_arr[2]['desc'] = 'cover';
1230
+ $option_arr[3]['value'] = '100% 100%';
1231
+ $option_arr[3]['desc'] = '100%';
1232
+ $option_arr[4]['value'] = '100% auto';
1233
+ $option_arr[4]['desc'] = '100% width';
1234
+ $option_arr[5]['value'] = 'auto 100%';
1235
+ $option_arr[5]['desc'] = '100% height';
1236
+ echo "<select id='" . esc_attr( $slide_data[ $i ]['image_size'] ) . "' name='" . esc_attr( $slide_data[ $i ]['image_size'] ) . "' onChange='change_slide_image_size(" . esc_attr( $slide_data[ $i ]['slide_no'] ) . ");'>";
1237
+ $tot_loop = count( $option_arr );
1238
+ for ( $j = 0; $j < $tot_loop; $j++ ) {
1239
+ if ( $slide_image_size === $option_arr[ $j ]['value'] ) {
1240
+ echo "<option value='" . esc_attr( $option_arr[ $j ]['value'] ) . "' selected>" . esc_html( $option_arr[ $j ]['desc'] ) . '</option>';
1241
+ } else {
1242
+ echo "<option value='" . esc_attr( $option_arr[ $j ]['value'] ) . "'>" . esc_html( $option_arr[ $j ]['desc'] ) . '</option>';
1243
+ }
1244
+ }
1245
+ echo '</select>';
1246
+ echo "</div>\n";
1247
+
1248
+ // SLIDER BACKGROUND IMAGE - BACKGROUND REPEAT (dropdown box).
1249
+ echo "<div class='slide_image_settings_line'>";
1250
+ echo '<span>Background Repeat:</span>';
1251
+ $option_arr = array();
1252
+ $option_arr[0] = 'no-repeat';
1253
+ $option_arr[1] = 'repeat';
1254
+ $option_arr[2] = 'repeat-x';
1255
+ $option_arr[3] = 'repeat-y';
1256
+ echo "<select id='" . esc_attr( $slide_data[ $i ]['image_repeat'] ) . "' name='" . esc_attr( $slide_data[ $i ]['image_repeat'] ) . "' ";
1257
+ echo "onChange='change_slide_image_repeat(" . esc_attr( $slide_data[ $i ]['slide_no'] ) . ");'>";
1258
+ $tot_loop = count( $option_arr );
1259
+ for ( $j = 0; $j < $tot_loop; $j++ ) {
1260
+ if ( $slide_image_repeat === $option_arr[ $j ] ) {
1261
+ echo "<option value='" . esc_attr( $option_arr[ $j ] ) . "' selected>" . esc_html( $option_arr[ $j ] ) . '</option>';
1262
+ } else {
1263
+ echo "<option value='" . esc_attr( $option_arr[ $j ] ) . "'>" . esc_html( $option_arr[ $j ] ) . '</option>';
1264
+ }
1265
+ }
1266
+ echo '</select>';
1267
+ echo "</div>\n";
1268
+
1269
+ // SLIDER BACKGROUND IMAGE - BACKGROUND COLOR (color picker).
1270
+ echo "<div class='slide_image_settings_line'>";
1271
+ echo '<span>Background Color:</span>';
1272
+ echo "<input type='text' id='" . esc_attr( $slide_data[ $i ]['image_color'] ) . "' name='" . esc_attr( $slide_data[ $i ]['image_color'] ) . "' value='" . esc_attr( $slide_image_color ) . "' ";
1273
+ echo "onChange='change_slide_image_color(" . esc_attr( $slide_data[ $i ]['slide_no'] ) . ");'>";
1274
+ echo "</div>\n";
1275
+
1276
+ echo "<div style='clear:both; float:none; width:100%; height:1px;'></div>\n";
1277
+ echo "</div>\n";
1278
+ echo "</div>\n";
1279
+
1280
+ /**
1281
+ * ####### SLIDE TAB 2 - SLIDE LINK #######
1282
+ */
1283
+ echo "<div id='slide" . esc_attr( $tabs_num ) . "_link_tab' class='sa_slide_tab'>\n";
1284
+
1285
+ // GET SLIDE LINK DATA FOR THIS SLIDE FROM THE DATABASE.
1286
+ $slide_link_url = get_post_meta( $post->ID, $slide_data[ $i ]['link_url'], true );
1287
+ $slide_link_target = get_post_meta( $post->ID, $slide_data[ $i ]['link_target'], true );
1288
+ if ( '' === $slide_link_target ) {
1289
+ $slide_link_target = '_self';
1290
+ }
1291
+
1292
+ // DISPLAY INPUT FIELDS FOR SLIDE LINK SETTINGS.
1293
+ echo "<div class='slide_link_settings_wrapper'>";
1294
+ echo '<p>Specify a link URL that this slide opens</h3>';
1295
+ // LINK URL.
1296
+ echo '<div><span>Link URL:</span>';
1297
+ echo "<input type='text' id='" . esc_attr( $slide_data[ $i ]['link_url'] ) . "' name='" . esc_attr( $slide_data[ $i ]['link_url'] ) . "' ";
1298
+ echo "value='" . esc_attr( $slide_link_url ) . "'/></div>\n";
1299
+ // LINK TARGET.
1300
+ echo '<div><span>Link Target:</span>';
1301
+ echo "<select id='" . esc_attr( $slide_data[ $i ]['link_target'] ) . "' name='" . esc_attr( $slide_data[ $i ]['link_target'] ) . "'>";
1302
+ if ( '_blank' === $slide_link_target ) {
1303
+ echo "<option value='_self'>Same Tab/Window</option>";
1304
+ echo "<option value='_blank' selected>New Tab/Window</option>";
1305
+ } else {
1306
+ echo "<option value='_self' selected>Same Tab/Window</option>";
1307
+ echo "<option value='_blank'>New Tab/Window</option>";
1308
+ }
1309
+ echo '</select>';
1310
+ echo "</div>\n";
1311
+
1312
+ echo "</div>\n";
1313
+ echo "</div>\n";
1314
+
1315
+ /**
1316
+ * ####### SLIDE TAB 3 - SLIDE POPUP #######
1317
+ */
1318
+ echo "<div id='slide" . esc_attr( $tabs_num ) . "_popup_tab' class='sa_slide_tab'>\n";
1319
+
1320
+ if ( $sa_pro_version ) {
1321
+ /**
1322
+ * ### SLIDE ANYTHING PRO VERSION ONLY ###
1323
+ */
1324
+
1325
+ // GET SLIDE POPUP DATA FOR THIS SLIDE FROM THE DATABASE.
1326
+ $slide_popup_type = get_post_meta( $post->ID, $slide_data[ $i ]['popup_type'], true );
1327
+ if ( '' === $slide_popup_type ) {
1328
+ $slide_popup_type = 'NONE';
1329
+ }
1330
+ $popup_imageid = intval( get_post_meta( $post->ID, $slide_data[ $i ]['popup_imageid'], true ) );
1331
+ $popup_video_id = get_post_meta( $post->ID, $slide_data[ $i ]['popup_video_id'], true );
1332
+ $popup_video_type = get_post_meta( $post->ID, $slide_data[ $i ]['popup_video_type'], true );
1333
+ $popup_imagetitle = get_post_meta( $post->ID, $slide_data[ $i ]['popup_imagetitle'], true );
1334
+ $popup_html = get_post_meta( $post->ID, $slide_data[ $i ]['popup_html'], true );
1335
+ $popup_shortcode = get_post_meta( $post->ID, $slide_data[ $i ]['popup_shortcode'], true );
1336
+ $popup_bgcol = get_post_meta( $post->ID, $slide_data[ $i ]['popup_bgcol'], true );
1337
+ $popup_width = intval( get_post_meta( $post->ID, $slide_data[ $i ]['popup_width'], true ) );
1338
+ $css_id = get_post_meta( $post->ID, 'sa_css_id', true );
1339
+
1340
+ // POPUP TYPE.
1341
+ echo "<div class='slide_popup_settings_line'>";
1342
+ echo '<span>SA Popup Type:</span>';
1343
+ $option_arr = array();
1344
+ $option_arr[0] = 'NONE';
1345
+ $option_arr[1] = 'IMAGE';
1346
+ $option_arr[2] = 'VIDEO';
1347
+ $option_arr[3] = 'HTML';
1348
+ echo "<select id='" . esc_attr( $slide_data[ $i ]['popup_type'] ) . "' name='" . esc_attr( $slide_data[ $i ]['popup_type'] ) . "' ";
1349
+ echo "onChange='change_slide_popup_type(" . esc_attr( $slide_data[ $i ]['slide_no'] ) . ");'>";
1350
+ $tot_loop = count( $option_arr );
1351
+ for ( $j = 0; $j < $tot_loop; $j++ ) {
1352
+ if ( $slide_popup_type === $option_arr[ $j ] ) {
1353
+ echo "<option value='" . esc_attr( $option_arr[ $j ] ) . "' selected>" . esc_html( $option_arr[ $j ] ) . '</option>';
1354
+ } else {
1355
+ echo "<option value='" . esc_attr( $option_arr[ $j ] ) . "'>" . esc_html( $option_arr[ $j ] ) . '</option>';
1356
+ }
1357
+ }
1358
+ echo '</select>';
1359
+ echo "</div>\n";
1360
+
1361
+ // A) IMAGE POPUP SETTINGS.
1362
+ $sl_num = ( $i + 1 );
1363
+ if ( 'IMAGE' === $slide_popup_type ) {
1364
+ echo "<div id='slide" . esc_attr( $sl_num ) . "_image_popup_wrapper' class='image_popup_wrapper'>\n";
1365
+ } else {
1366
+ echo "<div id='slide" . esc_attr( $sl_num ) . "_image_popup_wrapper' class='image_popup_wrapper' style='display:none;'>\n";
1367
+ }
1368
+ // get WordPress media upload frame url.
1369
+ $upload_popup_frame_url = esc_url( get_upload_iframe_src( 'image', $post->ID ) . '&popup=' . $slide_data[ $i ]['slide_no'] );
1370
+ // Get image src for slide popup image.
1371
+ $popup_image_src = wp_get_attachment_image_src( $popup_imageid, 'medium' );
1372
+ // check if the slide background image id already exists.
1373
+ $image_exists = is_array( $popup_image_src );
1374
+ echo "<div id='slide" . esc_attr( $sl_num ) . "_popup_thumb' class='slide_popup_thumb'>\n";
1375
+ $placeholder = SA_PLUGIN_PATH . 'images/image_placeholder.jpg';
1376
+ if ( $image_exists ) {
1377
+ // media library image id exists - display thumbnail image.
1378
+ echo "<div><img src='" . esc_attr( $popup_image_src[0] ) . "'/></div>";
1379
+ // display image delete button.
1380
+ echo "<span onClick='remove_popup_image(\"" . esc_attr( $slide_data[ $i ]['slide_no'] ) . '", "' . esc_attr( $placeholder ) . "\");' ";
1381
+ echo "id='slide" . esc_attr( $slide_data[ $i ]['slide_no'] ) . "_popup_image_del' title='Delete the popup image for this slide'>X</span>\n";
1382
+ // get popup image info (size & dimensions).
1383
+ $popup_image_meta = wp_get_attachment_metadata( $popup_imageid );
1384
+ $image_width = $popup_image_meta['width'];
1385
+ $image_height = $popup_image_meta['height'];
1386
+ $info_dim = $image_width . ' x ' . $image_height . ' pixels';
1387
+ $popup_image_full = wp_get_attachment_image_src( $popup_imageid, 'full' );
1388
+ $img_headers = get_headers( $popup_image_full[0], 1 );
1389
+ $info_size = $img_headers['Content-Length'];
1390
+ if ( '' !== $info_size ) {
1391
+ $size_unit = 'bytes';
1392
+ if ( $info_size > 1048576 ) {
1393
+ if ( ! is_array( $info_size ) ) {
1394
+ $info_size = round( $info_size / 1048576 ) . ' MB';
1395
+ } else {
1396
+ $info_size = '';
1397
+ }
1398
+ } elseif ( $info_size > 1024 ) {
1399
+ if ( ! is_array( $info_size ) ) {
1400
+ $info_size = round( $info_size / 1024 ) . ' kb';
1401
+ } else {
1402
+ $info_size = '';
1403
+ }
1404
+ }
1405
+ }
1406
+ } else {
1407
+ // no image selected yet - display placeholder image.
1408
+ $popup_image_id = 0;
1409
+ echo "<div><img src='" . esc_attr( $placeholder ) . "'/></div>";
1410
+ // display image delete button (hidden state).
1411
+ echo "<span class='sa_hidden' onClick='remove_popup_image(\"" . esc_attr( $slide_data[ $i ]['slide_no'] ) . '", "' . esc_attr( $placeholder ) . "\");' ";
1412
+ echo "id='slide" . esc_attr( $slide_data[ $i ]['slide_no'] ) . "_popup_image_del' title='Delete the popup image for this slide'>X</span>\n";
1413
+ // reset popup image info (size & dimensions).
1414
+ $info_dim = '';
1415
+ $info_size = '';
1416
+ }
1417
+ echo "</div>\n";
1418
+ // slide popup image - 'set image' button.
1419
+ echo "<a class='button button-secondary popup_image_add' href='" . esc_attr( $upload_popup_frame_url ) . "' ";
1420
+ echo "title='Set the background image for this slide'>Set Image</a>\n";
1421
+ // slide popup image - 'preview' button.
1422
+ $preview_button = 'slide' . esc_attr( $slide_data[ $i ]['slide_no'] ) . '_popup_image_preview';
1423
+ echo "<div id='" . esc_attr( $preview_button ) . "' class='slide_popup_image_preview'>";
1424
+ if ( $image_exists ) {
1425
+ echo "<a class='button button-secondary' href='" . esc_attr( $popup_image_full[0] ) . "' title='" . esc_attr( $popup_imagetitle ) . "'>Preview</a>";
1426
+ } else {
1427
+ echo "<a class='button button-secondary' href='" . esc_attr( $placeholder ) . "' title='" . esc_attr( $popup_imagetitle ) . "'>Preview</a>";
1428
+ }
1429
+ echo "</div>\n";
1430
+ // slide popup image - jquery code to generate 'magnific popup' preview.
1431
+ echo "<script type='text/javascript'>\n";
1432
+ echo "jQuery(document).ready(function() {\n";
1433
+ echo " jQuery('#" . esc_attr( $preview_button ) . " a').magnificPopup({\n";
1434
+ echo " mainClass: 'sa_popup',\n";
1435
+ echo " closeBtnInside: true,\n";
1436
+ echo " type: 'image'\n";
1437
+ echo " });\n";
1438
+ echo "});\n";
1439
+ echo "</script>\n";
1440
+ // slide popup image - popup image id hidden field.
1441
+ echo "<input type='hidden' id='" . esc_attr( $slide_data[ $i ]['popup_imageid'] ) . "' name='" . esc_attr( $slide_data[ $i ]['popup_imageid'] );
1442
+ echo "' value='" . esc_attr( $popup_imageid ) . "' />\n";
1443
+ // slide popup image - popup image info (title, dimensions & size).
1444
+ echo "<div class='slide_popup_info'>\n";
1445
+ // popup image title.
1446
+ echo "<input class='sa_slide_popup_imagetitle' type='text' id='" . esc_attr( $slide_data[ $i ]['popup_imagetitle'] ) . "' ";
1447
+ echo "name='" . esc_attr( $slide_data[ $i ]['popup_imagetitle'] ) . "' value='" . esc_attr( $popup_imagetitle ) . "' ";
1448
+ echo "onChange='change_popup_image_title(this.value, \"" . esc_attr( $preview_button ) . "\")' placeholder='Enter popup title'/>\n";
1449
+ // popup dimensions.
1450
+ echo "<div id='slide" . esc_attr( $slide_data[ $i ]['slide_no'] ) . "_popup_info_dim' class='slide_popup_info_dim'>";
1451
+ echo '<strong>Dimensions:</strong> ' . esc_html( $info_dim ) . "</div>\n";
1452
+ // popup file size.
1453
+ echo "<div id='slide" . esc_attr( $slide_data[ $i ]['slide_no'] ) . "_popup_info_size' class='slide_popup_info_size'>";
1454
+ if ( '' !== $info_size ) {
1455
+ echo '<strong>File Size:</strong> ' . esc_html( $info_size );
1456
+ }
1457
+ echo "</div>\n";
1458
+ echo "</div>\n";
1459
+ echo "<div style='clear:both; float:none; width:100%; height:1px;'></div>\n";
1460
+ echo "</div>\n";
1461
+
1462
+ // B) VIDEO POPUP SETTINGS.
1463
+ $sl_num = ( $i + 1 );
1464
+ if ( 'VIDEO' === $slide_popup_type ) {
1465
+ echo "<div id='slide" . esc_attr( $sl_num ) . "_video_popup_wrapper' class='video_popup_wrapper'>\n";
1466
+ } else {
1467
+ echo "<div id='slide" . esc_attr( $sl_num ) . "_video_popup_wrapper' class='video_popup_wrapper' style='display:none;'>\n";
1468
+ }
1469
+ // set default video values.
1470
+ if ( ( 'youtube' !== $popup_video_type ) && ( 'vimeo' !== $popup_video_type ) ) {
1471
+ $popup_video_type = '';
1472
+ $popup_video_id = '';
1473
+ }
1474
+ if ( '' === $popup_video_id ) {
1475
+ $popup_video_type = '';
1476
+ }
1477
+ // video preview.
1478
+ echo "<div id='slide" . esc_attr( $sl_num ) . "_video_thumb' class='slide_video_thumb'>\n";
1479
+ if ( '' !== $popup_video_id ) {
1480
+ if ( 'youtube' === $popup_video_type ) {
1481
+ echo "<iframe src='https://www.youtube.com/embed/" . esc_attr( $popup_video_id ) . "' frameborder='0' allowfullscreen></iframe>\n";
1482
+ } elseif ( 'vimeo' === $popup_video_type ) {
1483
+ echo "<iframe src='https://player.vimeo.com/video/" . esc_attr( $popup_video_id ) . "' frameborder='0' webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>";
1484
+ } else {
1485
+ echo "<img src='" . esc_attr( SA_PLUGIN_PATH ) . "images/video_placeholder.jpg'/>";
1486
+ }
1487
+ } else {
1488
+ echo "<img src='" . esc_attr( SA_PLUGIN_PATH ) . "images/video_placeholder.jpg'/>";
1489
+ }
1490
+ echo "<div style='float:none; clear:both; width:100%; height:1px;'></div>\n";
1491
+ echo "</div>\n";
1492
+ // video url (youtube/vimeo) input text box.
1493
+ echo "<div class='sa_slide_video_url'>";
1494
+ echo "<input type='text' id='sa_slide" . esc_attr( $sl_num ) . "_video_url' name='sa_slide" . esc_attr( $sl_num ) . "_video_url' ";
1495
+ echo "placeholder='Enter YouTube or Vimeo URL'/></div>\n";
1496
+ // 'update video' button.
1497
+ echo "<a class='button button-secondary' title='Update popup video using the above video URL' ";
1498
+ echo "onClick='update_popup_video(" . esc_attr( $sl_num ) . ");'>Set Video</a>\n";
1499
+
1500
+ // slide popup video - 'preview' button.
1501
+ $video_preview_url = SA_PLUGIN_PATH . 'images/video_placeholder_admin.jpg';
1502
+ if ( '' !== $popup_video_id ) {
1503
+ if ( 'youtube' === $popup_video_type ) {
1504
+ $video_preview_url = 'http://www.youtube.com/watch?v=' . $popup_video_id;
1505
+ } elseif ( 'vimeo' === $popup_video_type ) {
1506
+ $video_preview_url = 'http://vimeo.com/' . $popup_video_id;
1507
+ }
1508
+ }
1509
+ $preview_button = 'slide' . esc_attr( $slide_data[ $i ]['slide_no'] ) . '_popup_video_preview';
1510
+ echo "<div id='" . esc_attr( $preview_button ) . "' class='slide_popup_video_preview'>";
1511
+ echo "<a class='button button-secondary' href='" . esc_attr( $video_preview_url ) . "'>Preview</a>";
1512
+ echo "</div>\n";
1513
+ // slide popup image - jquery code to generate 'magnific popup' preview.
1514
+ echo "<script type='text/javascript'>\n";
1515
+ echo "jQuery(document).ready(function() {\n";
1516
+ echo " jQuery('#" . esc_attr( $preview_button ) . " a').magnificPopup({\n";
1517
+ echo " mainClass: 'sa_popup',\n";
1518
+ echo " closeBtnInside: true,\n";
1519
+ echo " type: 'iframe'\n";
1520
+ echo " });\n";
1521
+ echo "});\n";
1522
+ echo "</script>\n";
1523
+ // invalid url error message.
1524
+ echo "<div id='sa_slide" . esc_attr( $sl_num ) . "_video_invalid_url' class='sa_popup_video_invalid_url'>";
1525
+ echo "URL entered is NOT a valid YouTube or Vimeo URL!</div>\n";
1526
+ // hidden video id text field.
1527
+ echo "<input type='hidden' id='" . esc_attr( $slide_data[ $i ]['popup_video_id'] ) . "' name='" . esc_attr( $slide_data[ $i ]['popup_video_id'] ) . "' ";
1528
+ echo "value='" . esc_attr( $popup_video_id ) . "'/>\n";
1529
+ // hidden video type (youtube/vimeo) text field.
1530
+ echo "<input type='hidden' id='" . esc_attr( $slide_data[ $i ]['popup_video_type'] ) . "' name='" . esc_attr( $slide_data[ $i ]['popup_video_type'] ) . "' ";
1531
+ echo "value='" . esc_attr( $popup_video_type ) . "'/>\n";
1532
+ echo "<div style='float:none; clear:both; width:100%; height:1px;'></div>\n";
1533
+ echo "</div>\n";
1534
+
1535
+ // C) CONTENT POPUP SETTINGS.
1536
+ $sl_num = ( $i + 1 );
1537
+ if ( 'HTML' === $slide_popup_type ) {
1538
+ echo "<div id='slide" . esc_attr( $sl_num ) . "_html_popup_wrapper' class='html_popup_wrapper'>\n";
1539
+ } else {
1540
+ echo "<div id='slide" . esc_attr( $sl_num ) . "_html_popup_wrapper' class='html_popup_wrapper' style='display:none;'>\n";
1541
+ }
1542
+ // content popup - html.
1543
+ echo "<textarea id='" . esc_attr( $slide_data[ $i ]['popup_html'] ) . "' name='" . esc_attr( $slide_data[ $i ]['popup_html'] ) . "' ";
1544
+ echo "placeholder='Enter HTML Code or WordPress Shortcode'>" . esc_attr( $popup_html ) . "</textarea>\n";
1545
+ // content popup - shortcode.
1546
+ if ( '' === $popup_shortcode ) {
1547
+ $popup_shortcode = '0';
1548
+ }
1549
+ echo "<div class='slide_popup_settings_line' style='margin:3px 0px 15px;'><span>Shortcode Content:</span>";
1550
+ if ( '1' === $popup_shortcode ) {
1551
+ echo "<input type='checkbox' id='" . esc_attr( $slide_data[ $i ]['popup_shortcode'] ) . "' name='" . esc_attr( $slide_data[ $i ]['popup_shortcode'] ) . "' value='1' checked/>";
1552
+ } else {
1553
+ echo "<input type='checkbox' id='" . esc_attr( $slide_data[ $i ]['popup_shortcode'] ) . "' name='" . esc_attr( $slide_data[ $i ]['popup_shortcode'] ) . "' value='1'/>";
1554
+ }
1555
+ echo "<em class='sa_tooltip' href='' title='Use a WordPress shortcode instead of HTML as your popup content'></em>\n";
1556
+ echo "</div>\n";
1557
+ // content popup - css id.
1558
+ $popup_id = $css_id . '_popup' . ( $i + 1 );
1559
+ echo "<div class='slide_popup_settings_line'>";
1560
+ echo "<span>Popup CSS ID:</span><div id='sa_slide" . esc_attr( $sl_num ) . "_popup_css' class='slide_popup_css'>#" . esc_html( $popup_id ) . '</div>';
1561
+ echo '<strong>(click to copy to clipboard)</strong></div>';
1562
+ // content popup - background color.
1563
+ if ( '' === $popup_bgcol ) {
1564
+ $popup_bgcol = '#ffffff';
1565
+ }
1566
+ echo "<div class='slide_popup_settings_line'>";
1567
+ echo '<span>Background Color:</span>';
1568
+ echo "<input type='text' id='" . esc_attr( $slide_data[ $i ]['popup_bgcol'] ) . "' name='" . esc_attr( $slide_data[ $i ]['popup_bgcol'] ) . "' ";
1569
+ echo "value='" . esc_attr( $popup_bgcol ) . "'>";
1570
+ echo "</div>\n";
1571
+ // content popup - width.
1572
+ if ( ( '' === $popup_width ) || ( 0 === $popup_width ) ) {
1573
+ $popup_width = '600';
1574
+ }
1575
+ echo "<div class='slide_popup_settings_line'>";
1576
+ echo '<span>Popup Width:</span>';
1577
+ echo "<input type='text' id='" . esc_attr( $slide_data[ $i ]['popup_width'] ) . "' name='" . esc_attr( $slide_data[ $i ]['popup_width'] ) . "' ";
1578
+ echo "value='" . esc_attr( $popup_width ) . "'><em>px</em>";
1579
+ echo "</div>\n";
1580
+
1581
+ echo "</div>\n";
1582
+ } else {
1583
+ /**
1584
+ * ### SLIDE ANYTHING FREE VERSION - DISPLAY PRO INFORMATION ###
1585
+ */
1586
+ echo "<div class='slide_popup_pro_version'>\n";
1587
+ echo "<h4>Available in the PRO VERSION only!</h4>\n";
1588
+ echo '<p>With <strong>SLIDE ANYTHING PRO </strong> each slide can now open a <strong>MODAL POPUP</strong>, which may be one ';
1589
+ echo "of the following:</p>\n";
1590
+ echo "<ul>\n";
1591
+ echo "<li>An <strong>IMAGE</strong> popup, and with multiple image popups you can create a lightbox image gallery.</li>\n";
1592
+ echo "<li>An embedded <strong>VIDEO</strong> popup or gallery, which can contain <em>YouTube</em> or <em>Vimeo</em> videos.</li>\n";
1593
+ echo "<li>Popups containing any custom <strong>HTML</strong> content or WordPress <strong>SHORTCODES</strong> (such as an HTML form).</li>\n";
1594
+ echo "<li>Or your Slide Anything sliders can conatin a combination of image, video, HTML and shortcode popups!</li>\n";
1595
+ echo "</ul>\n";
1596
+ echo '<p>To find out more about <strong>SLIDE ANYTHING PRO</strong>, view demos or get your hands on a copy, click ';
1597
+ echo "<a href='https://edgewebpages.com' title='Slide Anything PRO' target='_blank'>HERE</a>.</p>";
1598
+ echo "</div>\n";
1599
+ }
1600
+ echo "</div>\n";
1601
+
1602
+ /**
1603
+ * ####### SLIDE TAB 4 - SLIDE GOTO LINK #######
1604
+ */
1605
+ $css_id = get_post_meta( $post->ID, 'sa_css_id', true );
1606
+ $goto_class = $css_id . '_goto' . ( $i + 1 );
1607
+ $eg_link = 'https://edgewebpages.com/slide-goto-links';
1608
+ echo "<div id='slide" . esc_attr( $tabs_num ) . "_goto_tab' class='sa_slide_tab'>\n";
1609
+ echo "<div class='slide_goto_link_content'>\n";
1610
+ echo "<p><strong>Create a link or button to link directly to this slide</strong></p>\n";
1611
+ echo "<p>To do this, give your link or button the following <strong>CSS Class:</strong></p>\n";
1612
+ echo "<div class='slide_goto_class'><span>" . esc_html( $goto_class ) . "</span></div>\n";
1613
+ echo "<p>To see an example of how a '<strong>Slide Goto Link</strong>' works ";
1614
+ echo "<a href='" . esc_attr( $eg_link ) . "' target='_blank'>CLICK HERE</a></p>\n";
1615
+ echo "</div>\n";
1616
+ echo "</div>\n";
1617
+
1618
+ /**
1619
+ * // ############################
1620
+ * // ##### SLIDE TABS - END #####
1621
+ * // ############################
1622
+ */
1623
+ echo "</div>\n";
1624
+
1625
+ // 3. DELETE STATUS FIELD (hidden) AND DELETE SLIDE BUTTON.
1626
+ echo "<input type='hidden' id='" . esc_attr( $slide_data[ $i ]['del_id'] ) . "' name='" . esc_attr( $slide_data[ $i ]['del_id'] ) . "' value='1'/>\n";
1627
+ echo "<div class='button button-secondary' onClick='delete_sa_slide(\"" . esc_attr( $slide_data[ $i ]['del_id'] ) . "\");' title='Delete this slide'>Delete Slide</div>\n";
1628
+
1629
+ // 4. DUPLICATE SLIDE BUTTON.
1630
+ echo "<div class='button button-secondary' onClick='duplicate_slide(\"" . esc_attr( $slide_data[ $i ]['slide_no'] ) . "\");' title='Duplicate this slide'>Duplicate Slide</div>\n";
1631
+
1632
+ // 5. MOVE SLIDE UP BUTTON.
1633
+ if ( 1 !== $slide_data[ $i ]['slide_no'] ) {
1634
+ echo "<div class='button button-secondary' onClick='move_slide_up(\"" . esc_attr( $slide_data[ $i ]['slide_no'] ) . "\");' title='Move this slide up within the slide order'>Move Slide Up</div>\n";
1635
+ }
1636
+
1637
+ echo "</div>\n";
1638
+ }
1639
+ echo "</div>\n";
1640
+
1641
+ // ADD SLIDE BUTTON.
1642
+ if ( $num_slides < 99 ) {
1643
+ // a maximum of 99 slides allowed.
1644
+ echo "<div id='sa_add_slide' class='button button-primary button-large' title='Add a new slide'>Add Slide</div>\n";
1645
+ }
1646
+
1647
+ // JQUERY-UI DIALOG BOX DIV - FOR CONFIRMATION DIALOG BOXES.
1648
+ echo "<div id='sa_dialog_box'></div>\n";
1649
+ }
1650
+
1651
+
1652
+
1653
+ /**
1654
+ * ##### META BOX CONTENT - 'Slider Preview/Shortcode' BOX #####
1655
+ *
1656
+ * @param array $post Custom Post 'sa_slider'.
1657
+ */
1658
+ function cpt_slider_shortcode_content( $post ) {
1659
+ // CHECK IF YOAST SEO PLUGIN IS INSTALLED.
1660
+ $yoast = 0;
1661
+ if ( is_plugin_active( 'wordpress-seo/wp-seo.php' ) || is_plugin_active( 'wordpress-seo-premium/wp-seo-premium.php' ) ) {
1662
+ $yoast = 1;
1663
+ }
1664
+ $post_status = get_post_status( $post->ID );
1665
+ $allow_shortcodes = get_post_meta( $post->ID, 'sa_shortcodes', true );
1666
+ $shortcode = '[slide-anything id="' . $post->ID . '"]';
1667
+ echo "<div id='sa_slider_shortcode'>" . esc_html( $shortcode ) . "</div>\n";
1668
+ echo "<div id='sa_shortcode_copy' class='button button-secondary'>Copy to Clipboard</div>\n";
1669
+
1670
+ // get value of 'Disable Preview Feature' checkbox.
1671
+ $disable_preview = '0';
1672
+ $other_settings = get_post_meta( $post->ID, 'sa_other_settings', true );
1673
+ if ( '' !== $other_settings ) {
1674
+ $other_settings_arr = explode( '|', $other_settings );
1675
+ }
1676
+ if ( isset( $other_settings_arr ) && ( '' !== $other_settings_arr[5] ) ) {
1677
+ $disable_preview = $other_settings_arr[5];
1678
+ }
1679
+
1680
+ if ( ( 'publish' === $post_status ) && ( '0' === $disable_preview ) && ( 0 === $yoast ) ) {
1681
+ // CHECK IF THE PREVIEW PAGE ALREADY EXISTS.
1682
+ // DISABLE THE PREVIEW FEATURE IF 'YOAST SEO' PLUGIN IS INSTALLED.
1683
+ $preview_page_created = 1;
1684
+ $preview_page = get_page_by_title( 'Slide Anything Popup Preview' );
1685
+ $preview_id = $preview_page->ID;
1686
+ if ( '' !== $preview_id ) {
1687
+ // PREVIEW PAGE EXISTS - UPDATE PAGE CONTENT TO CONTAIN THIS SA SHORTCODE.
1688
+ wp_untrash_post( $preview_id ); // remove preview page from trash (if applicable).
1689
+ $page_content = "[slide-anything id='" . $post->ID . "']";
1690
+ $page_data = array(
1691
+ 'ID' => $preview_id,
1692
+ 'post_content' => $page_content,
1693
+ );
1694
+ $page_id = wp_update_post( $page_data );
1695
+ if ( is_wp_error( $page_id ) ) {
1696
+ $preview_page_created = 0;
1697
+ }
1698
+ } else {
1699
+ // PREVIEW PAGE DOES NOT EXIST - CREATE PREVIEW PAGE WITH SA SHORTCODE CONTENT.
1700
+ $page_content = "[slide-anything id='" . $post->ID . "']";
1701
+ $curr_user_id = get_current_user_id();
1702
+ $page_data = array(
1703
+ 'post_title' => 'Slide Anything Popup Preview',
1704
+ 'post_content' => $page_content,
1705
+ 'post_status' => 'publish',
1706
+ 'post_type' => 'page',
1707
+ 'post_author' => $curr_user_id,
1708
+ 'menu_order' => 9999,
1709
+ );
1710
+ $page_id = wp_insert_post( $page_data );
1711
+ if ( is_wp_error( $page_id ) ) {
1712
+ $preview_page_created = 0;
1713
+ }
1714
+ }
1715
+ if ( 1 === $preview_page_created ) {
1716
+ // DISPLAY SLIDER PREVIEW BUTTON.
1717
+ if ( 'publish' === $post_status ) {
1718
+ echo "<div id='sa_preview_slider' class='button button-secondary' ";
1719
+ echo "onClick='document.getElementById(\"sa_preview_popup\").style.display = \"block\";'>Preview Slider</div>\n";
1720
+ }
1721
+ // DISPLAY SLIDER PREVIEW POPUP.
1722
+ $preview_page_url = get_page_link( $page_id );
1723
+ echo "<div id='sa_preview_popup' style='display:none;'>\n";
1724
+ echo "<div id='sa_preview_wrapper'>\n";
1725
+ echo "<div id='sa_preview_close' title='Close Slider Preview' ";
1726
+ echo "onClick='document.getElementById(\"sa_preview_popup\").style.display = \"none\";'>X</div>\n";
1727
+ echo "<div id='sa_preview_content'>";
1728
+ echo "<iframe src='" . esc_attr( $preview_page_url ) . "'></iframe>\n";
1729
+ echo "</div>\n"; // #sa_preview_content
1730
+ echo "</div>\n"; // #sa_preview_wrapper
1731
+ echo "</div>\n";
1732
+ }
1733
+ }
1734
+ }
1735
+
1736
+
1737
+
1738
+ /**
1739
+ * ##### META BOX CONTENT - 'Items Displayed' BOX #####
1740
+ *
1741
+ * @param array $post Custom Post 'sa_slider'.
1742
+ */
1743
+ function cpt_slider_items_content( $post ) {
1744
+ $sa_pro_version = validate_slide_anything_pro_registration();
1745
+ $items_width1 = intval( get_post_meta( $post->ID, 'sa_items_width1', true ) );
1746
+ $items_width2 = intval( get_post_meta( $post->ID, 'sa_items_width2', true ) );
1747
+ $items_width3 = intval( get_post_meta( $post->ID, 'sa_items_width3', true ) );
1748
+ $items_width4 = intval( get_post_meta( $post->ID, 'sa_items_width4', true ) );
1749
+ $items_width5 = intval( get_post_meta( $post->ID, 'sa_items_width5', true ) );
1750
+ $items_width6 = intval( get_post_meta( $post->ID, 'sa_items_width6', true ) );
1751
+ if ( 0 === $items_width1 ) {
1752
+ $items_width1 = 1; }
1753
+ if ( 0 === $items_width2 ) {
1754
+ $items_width2 = 1; }
1755
+ if ( 0 === $items_width3 ) {
1756
+ $items_width3 = 1; }
1757
+ if ( 0 === $items_width4 ) {
1758
+ $items_width4 = 1; }
1759
+ if ( 0 === $items_width5 ) {
1760
+ $items_width5 = 1; }
1761
+ if ( 0 === $items_width6 ) {
1762
+ $items_width6 = $items_width5; }
1763
+
1764
+ echo "<div id='items_displayed_metabox'>\n";
1765
+ echo "<h4>Browser/Device Width:</h4>\n";
1766
+ // items for browser width category 1.
1767
+ echo "<div><em class='sa_tooltip' href='' title='Up to 479 pixels'></em><span>Mobile Portrait</span><select name='sa_items_width1'>";
1768
+ for ( $i = 1; $i <= 12; $i++ ) {
1769
+ if ( $i === $items_width1 ) {
1770
+ echo "<option value='" . esc_attr( $i ) . "' selected>" . esc_html( $i ) . '</option>';
1771
+ } else {
1772
+ echo "<option value='" . esc_attr( $i ) . "'>" . esc_html( $i ) . '</option>';
1773
+ }
1774
+ }
1775
+ echo "</select></div>\n";
1776
+ // items for browser width category 2.
1777
+ echo "<div><em class='sa_tooltip' href='' title='480 to 767 pixels'></em><span>Mobile Landscape</span><select name='sa_items_width2'>";
1778
+ for ( $i = 1; $i <= 12; $i++ ) {
1779
+ if ( $i === $items_width2 ) {
1780
+ echo "<option value='" . esc_attr( $i ) . "' selected>" . esc_html( $i ) . '</option>';
1781
+ } else {
1782
+ echo "<option value='" . esc_attr( $i ) . "'>" . esc_html( $i ) . '</option>';
1783
+ }
1784
+ }
1785
+ echo "</select></div>\n";
1786
+ // items for browser width category 3.
1787
+ echo "<div><em class='sa_tooltip' href='' title='768 to 979 pixels'></em><span>Tablet Portrait</span><select name='sa_items_width3'>";
1788
+ for ( $i = 1; $i <= 12; $i++ ) {
1789
+ if ( $i === $items_width3 ) {
1790
+ echo "<option value='" . esc_attr( $i ) . "' selected>" . esc_html( $i ) . '</option>';
1791
+ } else {
1792
+ echo "<option value='" . esc_attr( $i ) . "'>" . esc_html( $i ) . '</option>';
1793
+ }
1794
+ }
1795
+ echo "</select></div>\n";
1796
+ // items for browser width category 4.
1797
+ echo "<div><em class='sa_tooltip' href='' title='980 to 1199 pixels'></em><span>Desktop Small</span><select name='sa_items_width4'>";
1798
+ for ( $i = 1; $i <= 12; $i++ ) {
1799
+ if ( $i === $items_width4 ) {
1800
+ echo "<option value='" . esc_attr( $i ) . "' selected>" . esc_html( $i ) . '</option>';
1801
+ } else {
1802
+ echo "<option value='" . esc_attr( $i ) . "'>" . esc_html( $i ) . '</option>';
1803
+ }
1804
+ }
1805
+ echo "</select></div>\n";
1806
+ // items for browser width category 5.
1807
+ echo "<div><em class='sa_tooltip' href='' title='1200 to 1499 pixels'></em><span>Desktop Large</span><select name='sa_items_width5'>";
1808
+ for ( $i = 1; $i <= 12; $i++ ) {
1809
+ if ( $i === $items_width5 ) {
1810
+ echo "<option value='" . esc_attr( $i ) . "' selected>" . esc_html( $i ) . '</option>';
1811
+ } else {
1812
+ echo "<option value='" . esc_attr( $i ) . "'>" . esc_html( $i ) . '</option>';
1813
+ }
1814
+ }
1815
+ echo "</select></div>\n";
1816
+ // items for browser width category 6.
1817
+ echo "<div><em class='sa_tooltip' href='' title='Over 1500 pixels'></em><span>Desktop X-Large</span><select name='sa_items_width6'>";
1818
+ for ( $i = 1; $i <= 12; $i++ ) {
1819
+ if ( $i === $items_width6 ) {
1820
+ echo "<option value='" . esc_attr( $i ) . "' selected>" . esc_html( $i ) . '</option>';
1821
+ } else {
1822
+ echo "<option value='" . esc_attr( $i ) . "'>" . esc_html( $i ) . '</option>';
1823
+ }
1824
+ }
1825
+ echo "</select></div>\n";
1826
+ // slide transition effect.
1827
+ $transition = get_post_meta( $post->ID, 'sa_transition', true );
1828
+ if ( '' === $transition ) {
1829
+ $transition = 'fade';
1830
+ }
1831
+ $option_arr = array();
1832
+ $option_arr[0] = 'Slide';
1833
+ $option_arr[1] = 'Fade';
1834
+ $option_arr[2] = 'Zoom In';
1835
+ $option_arr[3] = 'Zoom Out';
1836
+ $option_arr[4] = 'Flip Out X';
1837
+ $option_arr[5] = 'Flip Out Y';
1838
+ $option_arr[6] = 'Rotate Left';
1839
+ $option_arr[7] = 'Rotate Right';
1840
+ $option_arr[8] = 'Bounce Out';
1841
+ $option_arr[9] = 'Roll Out';
1842
+ $option_arr[10] = 'Slide Down';
1843
+ if ( ( 1 === $items_width1 ) && ( 1 === $items_width2 ) && ( 1 === $items_width3 ) && ( 1 === $items_width4 ) && ( 1 === $items_width5 ) && ( 1 === $items_width6 ) ) {
1844
+ echo "<div class='sa_items_all_one' style='display:block;'>";
1845
+ } else {
1846
+ echo "<div class='sa_items_all_one' style='display:none;'>";
1847
+ }
1848
+ echo "<em class='sa_tooltip' href='' title='NOTE: Slide transitions only work when the above items displayed are ALL SET TO 1'></em>";
1849
+ echo "<span style='color:firebrick !important;'>Slide Transition</span><select style='max-width:100px !important;' name='sa_transition'>";
1850
+ $tot_opt = count( $option_arr );
1851
+ for ( $i = 0; $i < $tot_opt; $i++ ) {
1852
+ if ( $transition === $option_arr[ $i ] ) {
1853
+ echo "<option value='" . esc_attr( $option_arr[ $i ] ) . "' selected>" . esc_html( $option_arr[ $i ] ) . '</option>';
1854
+ } else {
1855
+ echo "<option value='" . esc_attr( $option_arr[ $i ] ) . "'>" . esc_html( $option_arr[ $i ] ) . '</option>';
1856
+ }
1857
+ }
1858
+ echo "</select></div>\n";
1859
+
1860
+ // HERO SLIDER.
1861
+ $hero_slider = get_post_meta( $post->ID, 'sa_hero_slider', true );
1862
+ if ( '1' !== $hero_slider ) {
1863
+ $hero_slider = '0';
1864
+ }
1865
+ if ( ( 1 === $items_width1 ) && ( 1 === $items_width2 ) && ( 1 === $items_width3 ) && ( 1 === $items_width4 ) && ( 1 === $items_width5 ) && ( 1 === $items_width6 ) ) {
1866
+ echo "<div id='sa_hero_slider_wrapper' class='sa_items_all_one' style='display:block;'>";
1867
+ } else {
1868
+ echo "<div id='sa_hero_slider_wrapper' class='sa_items_all_one' style='display:none;'>";
1869
+ }
1870
+ echo '<span>Hero Slider</span>';
1871
+ if ( $sa_pro_version ) {
1872
+ // hero slider checkbox.
1873
+ if ( '1' === $hero_slider ) {
1874
+ echo "<input type='checkbox' id='sa_hero_slider' name='sa_hero_slider' value='1' checked/>";
1875
+ } else {
1876
+ echo "<input type='checkbox' id='sa_hero_slider' name='sa_hero_slider' value='1'/>";
1877
+ }
1878
+ $hs_note1 = 'Most WP Theme &apos;Page Builders&apos; (Visual Composer, Divi, Elementor, SiteOrigin...) allow you create full-width sections in your content. If you are not using a page builder then you will have to manually create a PHP template file to include a full-width container.';
1879
+ $hs_note2 = 'The slider height is set to 100% screen/device height using CSS &apos;vh&apos; (viewport height). Just about all browsers now support CSS viewport units, except Opera Mini which was installed on the old &apos;button&apos; phones.';
1880
+ if ( '1' === $hero_slider ) {
1881
+ echo "<div id='sa_hero_slider_note' style='display:block;'>";
1882
+ } else {
1883
+ echo "<div id='sa_hero_slider_note' style='display:none;'>";
1884
+ }
1885
+ echo '<strong>Please Note:</strong>';
1886
+ echo "<ol><li>Shortcode should be inserted into a full-width section<em class='sa_tooltip' title='" . esc_attr( $hs_note1 ) . "'></em></li>";
1887
+ echo "<li>Only works on browsers that support Viewport units - see <a href='https://caniuse.com/#feat=viewport-units' target='_blank'>here</a>";
1888
+ echo "<em class='sa_tooltip' title='" . esc_attr( $hs_note2 ) . "'></em></li></ol></div>";
1889
+ } else {
1890
+ // display slide anything pro promotional text.
1891
+ echo "<div id='sa_hero_slider_promo'>";
1892
+ echo "<h4>Available in the PRO VERSION only!</h4>\n";
1893
+ echo '<p>With <strong>Slide Anything PRO </strong> you can create full width/height <strong>Hero Sliders</strong> ';
1894
+ echo 'which auto-resize depending on device/screen.</p>';
1895
+ echo '<p>To view a Hero Slider DEMO click:</p>';
1896
+ echo "<p style='padding-top:2px !important;'><a href='https://edgewebpages.com/hero-slider-with-thumbnails' target='_blank'>HERO SLIDER DEMO</a></p>";
1897
+ echo '</div>';
1898
+ }
1899
+ echo "</div>\n";
1900
+
1901
+ // SHOWCASE SLIDER.
1902
+ if ( ( 1 === $items_width1 ) && ( 1 === $items_width2 ) && ( 1 === $items_width3 ) && ( 1 === $items_width4 ) && ( 1 === $items_width5 ) && ( 1 === $items_width6 ) ) {
1903
+ echo "<div id='sa_showcase_slider_wrapper' style='display:none;'>";
1904
+ } else {
1905
+ echo "<div id='sa_showcase_slider_wrapper' style='display:block;'>";
1906
+ }
1907
+ // showcase slider checkbox.
1908
+ $showcase_slider = get_post_meta( $post->ID, 'sa_showcase_slider', true );
1909
+ if ( '1' !== $showcase_slider ) {
1910
+ $showcase_slider = '0';
1911
+ }
1912
+ echo "<div class='sa_ss_line'><span><strong>Showcase Carousel</strong></span>";
1913
+ if ( $sa_pro_version ) {
1914
+ echo "<input type='checkbox' id='sa_showcase_slider' name='sa_showcase_slider' value='1'";
1915
+ if ( '1' === $showcase_slider ) {
1916
+ echo ' checked'; }
1917
+ echo ' />';
1918
+ }
1919
+ echo '</div>';
1920
+ if ( $sa_pro_version ) {
1921
+ if ( '1' === $showcase_slider ) {
1922
+ echo "<div id='sa_showcase_slider_pro' style='display:block;'>";
1923
+ } else {
1924
+ echo "<div id='sa_showcase_slider_pro' style='display:none;'>";
1925
+
1926
+ }
1927
+ // showcase slider - desktop width.
1928
+ $showcase_width = get_post_meta( $post->ID, 'sa_showcase_width', true );
1929
+ if ( '' === $showcase_width ) {
1930
+ $showcase_width = '120';
1931
+ }
1932
+ echo "<div class='sa_ss_line'><span>Desktop Width</span>";
1933
+ echo "<input type='text' id='sa_showcase_width' name='sa_showcase_width' value='" . esc_attr( $showcase_width ) . "'>";
1934
+ echo "<em>%</em></div>\n";
1935
+ // showcase slider - use on tablets.
1936
+ $showcase_tablet = get_post_meta( $post->ID, 'sa_showcase_tablet', true );
1937
+ if ( ( '0' !== $showcase_tablet ) && ( '1' !== $showcase_tablet ) ) {
1938
+ $showcase_tablet = '1';
1939
+ }
1940
+ echo "<div class='sa_ss_line'><span>Use on Tablets</span>";
1941
+ if ( '1' === $showcase_tablet ) {
1942
+ echo "<input type='checkbox' id='sa_showcase_tablet' name='sa_showcase_tablet' value='1' checked />";
1943
+ } else {
1944
+ echo "<input type='checkbox' id='sa_showcase_tablet' name='sa_showcase_tablet' value='1' />";
1945
+ }
1946
+ echo "</div>\n";
1947
+ // showcase slider - tablet width.
1948
+ $showcase_width_tab = get_post_meta( $post->ID, 'sa_showcase_width_tab', true );
1949
+ if ( '' === $showcase_width_tab ) {
1950
+ $showcase_width_tab = '130';
1951
+ }
1952
+ echo "<div class='sa_ss_line'><span>Tablet Width</span>";
1953
+ echo "<input type='text' id='sa_showcase_width_tab' name='sa_showcase_width_tab' value='" . esc_attr( $showcase_width_tab ) . "'>";
1954
+ echo "<em>%</em></div>\n";
1955
+ // showcase slider - use on mobiles.
1956
+ $showcase_mobile = get_post_meta( $post->ID, 'sa_showcase_mobile', true );
1957
+ if ( '1' !== $showcase_mobile ) {
1958
+ $showcase_mobile = '0';
1959
+ }
1960
+ echo "<div class='sa_ss_line'><span>Use on Mobiles</span>";
1961
+ if ( '1' === $showcase_mobile ) {
1962
+ echo "<input type='checkbox' id='sa_showcase_mobile' name='sa_showcase_mobile' value='1' checked />";
1963
+ } else {
1964
+ echo "<input type='checkbox' id='sa_showcase_mobile' name='sa_showcase_mobile' value='1' />";
1965
+ }
1966
+ echo "</div>\n";
1967
+ // showcase slider - mobile width.
1968
+ $showcase_width_mob = get_post_meta( $post->ID, 'sa_showcase_width_mob', true );
1969
+ if ( '' === $showcase_width_mob ) {
1970
+ $showcase_width_mob = '140';
1971
+ }
1972
+ echo "<div class='sa_ss_line'><span>Mobile Width</span>";
1973
+ echo "<input type='text' id='sa_showcase_width_mob' name='sa_showcase_width_mob' value='" . esc_attr( $showcase_width_mob ) . "'>";
1974
+ echo "<em>%</em></div>\n";
1975
+ // showcase slider - css to style left/rightmost slides.
1976
+ $css_id = get_post_meta( $post->ID, 'sa_css_id', true );
1977
+ echo "<div class='sa_ss_css_line'>CSS to target left+right partial slides:";
1978
+ echo "<div id='ss_css_value'>#" . esc_html( $css_id ) . ' .sc_partial</div>';
1979
+ echo "</div>\n";
1980
+ echo '</div>'; // #sa_showcase_slider_pro
1981
+ } else {
1982
+ // display slide anything pro promotional text.
1983
+ echo "<div id='sa_showcase_slider_promo'>";
1984
+ echo "<h4>Available in the PRO VERSION only!</h4>\n";
1985
+ echo '<p>A <strong>Showcase Carousels</strong> has a container width that exceeds the screen/window width. ';
1986
+ echo 'The leftmost/rightmost visible slides therefore become partially visible.</p>';
1987
+ echo '<p>Showcase Carousel DEMO:</p>';
1988
+ echo "<p style='padding-top:2px !important;'><a href='https://edgewebpages.com/showcase-carousel-demo/' target='_blank'>SHOWCASE CAROUSEL DEMO</a></p>";
1989
+ echo '</div>';
1990
+ }
1991
+ echo "</div>\n";
1992
+
1993
+ echo "</div>\n";
1994
+ }
1995
+
1996
+
1997
+
1998
+ /**
1999
+ * ##### META BOX CONTENT - 'Slider Style' BOX #####
2000
+ *
2001
+ * @param array $post Custom Post 'sa_slider'.
2002
+ */
2003
+ function cpt_slider_style_content( $post ) {
2004
+ // CSS ID.
2005
+ $css_id = get_post_meta( $post->ID, 'sa_css_id', true );
2006
+ if ( '' === $css_id ) {
2007
+ $css_id = 'slider_' . $post->ID;
2008
+ }
2009
+ echo "<div id='slider_style_metabox'>\n";
2010
+ echo "<h4>CSS <span>#id</span> for Slider:</h4>\n";
2011
+ echo "<div style='padding-bottom:10px; color:#909090;'>Must consist of letters (upper/lowercase) or Underscore '_' characters <span style='color:firebrick;'>ONLY!</span></div>\n";
2012
+ echo "<input type='text' id='sa_css_id' name='sa_css_id' value='" . esc_attr( $css_id ) . "'/>\n";
2013
+ echo "<div id='css_note_text'>To style slides use CSS selector:</div>";
2014
+ echo "<div id='css_note_value'>#" . esc_html( $css_id ) . ' .owl-item</div>';
2015
+ echo "<div class='ca_style_hr'></div>\n";
2016
+
2017
+ // SLIDER PADDING (TOP, RIGHT, BOTTOM, LEFT).
2018
+ $wrapper_padd_top = get_post_meta( $post->ID, 'sa_wrapper_padd_top', true );
2019
+ if ( '' === $wrapper_padd_top ) {
2020
+ $wrapper_padd_top = '0'; }
2021
+ $wrapper_padd_right = get_post_meta( $post->ID, 'sa_wrapper_padd_right', true );
2022
+ if ( '' === $wrapper_padd_right ) {
2023
+ $wrapper_padd_right = '0'; }
2024
+ $wrapper_padd_bottom = get_post_meta( $post->ID, 'sa_wrapper_padd_bottom', true );
2025
+ if ( '' === $wrapper_padd_bottom ) {
2026
+ $wrapper_padd_bottom = '0'; }
2027
+ $wrapper_padd_left = get_post_meta( $post->ID, 'sa_wrapper_padd_left', true );
2028
+ if ( '' === $wrapper_padd_left ) {
2029
+ $wrapper_padd_left = '0'; }
2030
+ $tooltip = 'Padding space around the entire carousel/slider';
2031
+ echo "<h4>Padding <span>(pixels)</span>:<em class='sa_tooltip' title='" . esc_attr( $tooltip ) . "'></em></h4>";
2032
+ echo "<div class='ca_style_padding'>";
2033
+ echo "<div id='padd_top'>";
2034
+ echo "<input type='text' id='sa_wrapper_padd_top' name='sa_wrapper_padd_top' value='" . esc_attr( $wrapper_padd_top ) . "'></div>";
2035
+ echo "<div id='padd_right'>";
2036
+ echo "<input type='text' id='sa_wrapper_padd_right' name='sa_wrapper_padd_right' value='" . esc_attr( $wrapper_padd_right ) . "'></div>";
2037
+ echo "<div type='text' id='padd_bottom'>";
2038
+ echo "<input type='text' id='sa_wrapper_padd_bottom' name='sa_wrapper_padd_bottom' value='" . esc_attr( $wrapper_padd_bottom ) . "'></div>";
2039
+ echo "<div id='padd_left'>";
2040
+ echo "<input type='text' id='sa_wrapper_padd_left' name='sa_wrapper_padd_left' value='" . esc_attr( $wrapper_padd_left ) . "'></div>";
2041
+ echo "</div>\n";
2042
+ echo "<div style='clear:both; float:none; width:100%; height:10px;'></div>";
2043
+
2044
+ $tooltip = 'Style settings for the slider navigation arrows and slider pagination';
2045
+ echo "<h4>Slider Navigation:<em class='sa_tooltip' title='" . esc_attr( $tooltip ) . "'></em></h4>";
2046
+
2047
+ // AUTOHIDE ARROWS.
2048
+ $autohide_arrows = get_post_meta( $post->ID, 'sa_autohide_arrows', true );
2049
+ if ( '' === $autohide_arrows ) {
2050
+ $autohide_arrows = '1';
2051
+ }
2052
+ echo "<div class='ca_style_setting_line'><span style='width:140px;'>Autohide Arrows</span>";
2053
+ if ( '1' === $autohide_arrows ) {
2054
+ echo "<input type='checkbox' id='sa_autohide_arrows' name='sa_autohide_arrows' value='1' checked/>";
2055
+ } else {
2056
+ echo "<input type='checkbox' id='sa_autohide_arrows' name='sa_autohide_arrows' value='1'/>";
2057
+ }
2058
+ echo "</div>\n";
2059
+
2060
+ // SHOW DOT PER SLIDE.
2061
+ $dot_per_slide = get_post_meta( $post->ID, 'sa_dot_per_slide', true );
2062
+ if ( '' === $dot_per_slide ) {
2063
+ $dot_per_slide = '0';
2064
+ }
2065
+ echo "<div class='ca_style_setting_line'><span style='width:140px;'>Show 1 Dot Per Slide</span>";
2066
+ if ( '1' === $dot_per_slide ) {
2067
+ echo "<input type='checkbox' id='sa_dot_per_slide' name='sa_dot_per_slide' value='1' checked/>";
2068
+ } else {
2069
+ echo "<input type='checkbox' id='sa_dot_per_slide' name='sa_dot_per_slide' value='1'/>";
2070
+ }
2071
+ echo "</div>\n";
2072
+
2073
+ $tooltip = 'The background color and border around the entire carousel/slider';
2074
+ echo "<h4>Background/Border:<em class='sa_tooltip' title='" . esc_attr( $tooltip ) . "'></em></h4>";
2075
+
2076
+ // SLIDER BACKGROUND COLOR.
2077
+ $background_color = get_post_meta( $post->ID, 'sa_background_color', true );
2078
+ if ( '' === $background_color ) {
2079
+ $background_color = 'rgba(0,0,0,0)';
2080
+ }
2081
+ echo "<div class='ca_style_setting_line'><span>Background:</span>";
2082
+ echo "<input type='text' id='sa_background_color' name='sa_background_color' value='" . esc_attr( $background_color ) . "'></div>\n";
2083
+
2084
+ // SLIDER BORDER (WIDTH & COLOR).
2085
+ $border_width = get_post_meta( $post->ID, 'sa_border_width', true );
2086
+ if ( '' === $border_width ) {
2087
+ $border_width = '0';
2088
+ }
2089
+ $border_color = get_post_meta( $post->ID, 'sa_border_color', true );
2090
+ if ( '' === $border_color ) {
2091
+ $border_color = 'rgba(0,0,0,0)';
2092
+ }
2093
+ echo "<div class='ca_style_setting_line'><span>Border Style:</span>";
2094
+ echo "<input type='text' id='sa_border_width' name='sa_border_width' value='" . esc_attr( $border_width ) . "'><em>px</em>";
2095
+ echo "<input type='text' id='sa_border_color' name='sa_border_color' value='" . esc_attr( $border_color ) . "'></div>\n";
2096
+
2097
+ // SLIDER BORDER RADIUS.
2098
+ $border_radius = get_post_meta( $post->ID, 'sa_border_radius', true );
2099
+ if ( '' === $border_radius ) {
2100
+ $border_radius = '0';
2101
+ }
2102
+ echo "<div class='ca_style_setting_line'><span>Border Radius:</span>";
2103
+ echo "<input type='text' id='sa_border_radius' name='sa_border_radius' value='" . esc_attr( $border_radius ) . "'></div>\n";
2104
+
2105
+ echo "<div class='ca_style_hr' style='margin-top:10px;'></div>\n";
2106
+
2107
+ $tooltip = 'The style settings for all slides (within the slider/carousel)';
2108
+ echo "<h4>Slide Style:<em class='sa_tooltip' title='" . esc_attr( $tooltip ) . "'></em></h4>";
2109
+
2110
+ // SLIDE - MINIMUM HEIGHT.
2111
+ $slide_min_height = get_post_meta( $post->ID, 'sa_slide_min_height_perc', true );
2112
+ if ( '' === $slide_min_height ) {
2113
+ $slide_min_height = '50';
2114
+ }
2115
+ echo "<div style='padding:5px 0px 10px;'>\n";
2116
+ $tooltip = 'The minimum height of each slide. Can be set to a percentage of the slide width, or for image sliders set to a 4:3 or 16:9 aspect ratio.';
2117
+ echo "<div class='ca_style_setting_line' id='ca_style_min_height' style='padding-bottom:7px !important;'>";
2118
+ echo "<span class='sa_tooltip' title='" . esc_attr( $tooltip ) . "'>Min Height:</span><br/>";
2119
+ if ( 'aspect43' === $slide_min_height ) {
2120
+ echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='percent' style='margin-left:20px !important;'/><em>%</em>";
2121
+ echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='px'/><em>px</em>";
2122
+ echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='43' checked/><em>4:3</em>";
2123
+ echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='169'/><em>16:9</em>";
2124
+ } elseif ( 'aspect169' === $slide_min_height ) {
2125
+ echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='percent' style='margin-left:20px !important;'/><em>%</em>";
2126
+ echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='px'/><em>px</em>";
2127
+ echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='43'/><em>4:3</em>";
2128
+ echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='169' checked/><em>16:9</em>";
2129
+ } elseif ( strpos( $slide_min_height, 'px' ) !== false ) {
2130
+ echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='percent' style='margin-left:20px !important;'/><em>%</em>";
2131
+ echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='px' checked/><em>px</em>";
2132
+ echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='43'/><em>4:3</em>";
2133
+ echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='169'/><em>16:9</em>";
2134
+ } else {
2135
+ echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='percent' style='margin-left:20px !important;' checked/><em>%</em>";
2136
+ echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='px'/><em>px</em>";
2137
+ echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='43'/><em>4:3</em>";
2138
+ echo "<input type='radio' name='sa_slide_min_height_type' class='sa_slide_min_height_type' value='169'/><em>16:9</em>";
2139
+ }
2140
+ echo "</div>\n";
2141
+ if ( ( 'aspect43' === $slide_min_height ) || ( 'aspect169' === $slide_min_height ) ) {
2142
+ $mh_suffix = '';
2143
+ echo "<div class='ca_style_setting_line' id='sa_slide_min_height_wrapper' style='display:none;'>";
2144
+ echo "<input type='text' id='sa_slide_min_height' name='sa_slide_min_height' value='" . esc_attr( $slide_min_height ) . "'/>";
2145
+ echo "<em id='mh_suffix'>" . esc_html( $mh_suffix ) . "</em></div>\n";
2146
+ echo "<input type='hidden' id='sa_slide_min_height_hidden' name='sa_slide_min_height_hidden' value='0'/>\n";
2147
+ } else {
2148
+ if ( strpos( $slide_min_height, 'px' ) !== false ) {
2149
+ $mh_value = str_replace( 'px', '', $slide_min_height );
2150
+ $mh_suffix = 'px';
2151
+ } else {
2152
+ $mh_value = $slide_min_height;
2153
+ $mh_suffix = '%';
2154
+ }
2155
+ echo "<div class='ca_style_setting_line' id='sa_slide_min_height_wrapper'><span style='width:20px;'>&nbsp;</span>";
2156
+ echo "<input type='text' id='sa_slide_min_height' name='sa_slide_min_height' value='" . esc_attr( $mh_value ) . "'/>";
2157
+ echo "<em id='mh_suffix'>" . esc_html( $mh_suffix ) . "</em></div>\n";
2158
+ echo "<input type='hidden' id='sa_slide_min_height_hidden' name='sa_slide_min_height_hidden' value='" . esc_attr( $mh_value ) . "'/>\n";
2159
+ }
2160
+ echo "</div>\n";
2161
+
2162
+ // SLIDE - PADDING TOP/BOTTOM.
2163
+ $slide_padding_tb = get_post_meta( $post->ID, 'sa_slide_padding_tb', true );
2164
+ if ( '' === $slide_padding_tb ) {
2165
+ $slide_padding_tb = '5';
2166
+ }
2167
+ $tooltip = 'Padding space top/bottom for each individual slide';
2168
+ echo "<div class='ca_style_setting_line' id='ca_style_padding_top_bottom'><span class='sa_tooltip' title='" . esc_attr( $tooltip ) . "'>Padding:</span>";
2169
+ echo "<input type='text' id='sa_slide_padding_tb' name='sa_slide_padding_tb' value='" . esc_attr( $slide_padding_tb ) . "'><em>%</em></div>\n";
2170
+
2171
+ // SLIDE - PADDING LEFT/RIGHT.
2172
+ $slide_padding_lr = get_post_meta( $post->ID, 'sa_slide_padding_lr', true );
2173
+ if ( '' === $slide_padding_lr ) {
2174
+ $slide_padding_lr = '5';
2175
+ }
2176
+ $tooltip = 'Padding space left/right for each individual slide';
2177
+ echo "<div class='ca_style_setting_line' id='ca_style_padding_left_right'><span class='sa_tooltip' title='" . esc_attr( $tooltip ) . "'>Padding:</span>";
2178
+ echo "<input type='text' id='sa_slide_padding_lr' name='sa_slide_padding_lr' value='" . esc_attr( $slide_padding_lr ) . "'><em>%</em></div>\n";
2179
+
2180
+ // SLIDE - MARGIN LEFT/RIGHT.
2181
+ $slide_margin_lr = get_post_meta( $post->ID, 'sa_slide_margin_lr', true );
2182
+ if ( '' === $slide_margin_lr ) {
2183
+ $slide_margin_lr = '0';
2184
+ }
2185
+ $tooltip = 'Margin space left and right of each slide';
2186
+ echo "<div class='ca_style_setting_line' id='ca_style_margin_left_right'><span class='sa_tooltip' title='" . esc_attr( $tooltip ) . "'>Margin:</span>";
2187
+ echo "<input type='text' id='sa_slide_margin_lr' name='sa_slide_margin_lr' value='" . esc_attr( $slide_margin_lr ) . "'><em>%</em></div>\n";
2188
+
2189
+ $tooltip = 'The link/popup buttons that appear on a slide';
2190
+ echo "<h4>Link/Popup Icons:<em class='sa_tooltip' title='" . esc_attr( $tooltip ) . "'></em></h4>";
2191
+
2192
+ // LINK/POPUP ICONS - ICON LOCATION.
2193
+ $slide_icons_location = get_post_meta( $post->ID, 'sa_slide_icons_location', true );
2194
+ if ( '' === $slide_icons_location ) {
2195
+ $slide_icons_location = 'Center Center';
2196
+ }
2197
+ echo "<div class='ca_style_setting_line'><span>Icon Location</span>";
2198
+ echo "<select id='sa_slide_icons_location' name='sa_slide_icons_location'>";
2199
+ $option_arr = array();
2200
+ $option_arr[0] = 'Center Center';
2201
+ $option_arr[1] = 'Top Left';
2202
+ $option_arr[2] = 'Top Center';
2203
+ $option_arr[3] = 'Top Right';
2204
+ $option_arr[4] = 'Bottom Left';
2205
+ $option_arr[5] = 'Bottom Center';
2206
+ $option_arr[6] = 'Bottom Right';
2207
+ $tot_opt = count( $option_arr );
2208
+ for ( $i = 0; $i < $tot_opt; $i++ ) {
2209
+ if ( $option_arr[ $i ] === $slide_icons_location ) {
2210
+ echo "<option value='" . esc_attr( $option_arr[ $i ] ) . "' selected>" . esc_html( $option_arr[ $i ] ) . '</option>';
2211
+ } else {
2212
+ echo "<option value='" . esc_attr( $option_arr[ $i ] ) . "'>" . esc_html( $option_arr[ $i ] ) . '</option>';
2213
+ }
2214
+ }
2215
+ echo "</select></div>\n";
2216
+
2217
+ // LINK/POPUP ICONS - ALWAYS VISIBLE.
2218
+ $slide_icons_visible = get_post_meta( $post->ID, 'sa_slide_icons_visible', true );
2219
+ if ( '1' !== $slide_icons_visible ) {
2220
+ $slide_icons_visible = '0';
2221
+ }
2222
+ echo "<div class='ca_style_setting_line'><span>Always Visible</span>";
2223
+ if ( '1' === $slide_icons_visible ) {
2224
+ echo "<input type='checkbox' id='sa_slide_icons_visible' name='sa_slide_icons_visible' value='1' checked/>";
2225
+ } else {
2226
+ echo "<input type='checkbox' id='sa_slide_icons_visible' name='sa_slide_icons_visible' value='1'/>";
2227
+ }
2228
+ echo "</div>\n";
2229
+
2230
+ // LINK/POPUP ICONS - COLOR SCHEME.
2231
+ $slide_icons_color = get_post_meta( $post->ID, 'sa_slide_icons_color', true );
2232
+ if ( '' === $slide_icons_color ) {
2233
+ $slide_icons_location = 'white';
2234
+ }
2235
+ echo "<div class='ca_style_setting_line'><span>Color Scheme</span>";
2236
+ echo "<select id='sa_slide_icons_color' name='sa_slide_icons_color'>";
2237
+ if ( 'black' === $slide_icons_color ) {
2238
+ echo "<option value='white'>White</option>";
2239
+ echo "<option value='black' selected>Black</option>";
2240
+ } else {
2241
+ echo "<option value='white selected'>White</option>";
2242
+ echo "<option value='black'>Black</option>";
2243
+ }
2244
+ echo "</select></div>\n";
2245
+
2246
+ // LINK/POPUP ICONS - FULL SLIDE LINKS.
2247
+ $slide_icons_fullslide = get_post_meta( $post->ID, 'sa_slide_icons_fullslide', true );
2248
+ if ( '1' !== $slide_icons_fullslide ) {
2249
+ $slide_icons_fullslide = '0';
2250
+ }
2251
+ echo "<div class='ca_style_setting_line'><span>Full Slide Links</span>";
2252
+ if ( '1' === $slide_icons_fullslide ) {
2253
+ echo "<input type='checkbox' id='sa_slide_icons_fullslide' name='sa_slide_icons_fullslide' value='1' checked/>";
2254
+ } else {
2255
+ echo "<input type='checkbox' id='sa_slide_icons_fullslide' name='sa_slide_icons_fullslide' value='1'/>";
2256
+ }
2257
+ $tooltip = 'This makes the entire slide area a clickable link. NOTE: This feature is ';
2258
+ $tooltip .= 'disabled if you have both a slide link AND a popup link for a slide.';
2259
+ $tt_style = 'margin:0px 0px -3px 5px; cursor:help;';
2260
+ echo "<em class='sa_tooltip' style='" . esc_attr( $tt_style ) . "' title='" . esc_attr( $tooltip ) . "'></em>";
2261
+ echo "</div>\n";
2262
+
2263
+ // ##### OTHER SETTINGS #####
2264
+
2265
+ echo "<h4 style='margin-top:10px !important;'>Other Settings:</h4>";
2266
+
2267
+ // FETCH OTHER SETTINGS POST META.
2268
+ $other_settings = get_post_meta( $post->ID, 'sa_other_settings', true );
2269
+ if ( '' !== $other_settings ) {
2270
+ $other_settings_arr = explode( '|', $other_settings );
2271
+ }
2272
+ // setting 1 - sa_window_onload.
2273
+ if ( isset( $other_settings_arr ) && ( '' !== $other_settings_arr[0] ) ) {
2274
+ $window_onload = $other_settings_arr[0];
2275
+ } else {
2276
+ $window_onload = get_post_meta( $post->ID, 'sa_window_onload', true );
2277
+ if ( '' === $window_onload ) {
2278
+ $window_onload = '0';
2279
+ }
2280
+ }
2281
+ // setting 2 - sa_strip_javascript.
2282
+ if ( isset( $other_settings_arr ) && ( '' !== $other_settings_arr[1] ) ) {
2283
+ $strip_javascript = $other_settings_arr[1];
2284
+ } else {
2285
+ $strip_javascript = get_post_meta( $post->ID, 'sa_strip_javascript', true );
2286
+ if ( '' === $strip_javascript ) {
2287
+ $strip_javascript = '0';
2288
+ }
2289
+ }
2290
+ // setting 3 - sa_lazy_load_images.
2291
+ if ( isset( $other_settings_arr ) && ( '' !== $other_settings_arr[2] ) ) {
2292
+ $lazy_load_images = $other_settings_arr[2];
2293
+ } else {
2294
+ $lazy_load_images = get_post_meta( $post->ID, 'sa_lazy_load_images', true );
2295
+ if ( '' === $lazy_load_images ) {
2296
+ $lazy_load_images = '0';
2297
+ }
2298
+ }
2299
+ // setting 4 - sa_ulli_containers.
2300
+ if ( isset( $other_settings_arr ) && ( '' !== $other_settings_arr[3] ) ) {
2301
+ $ulli_containers = $other_settings_arr[3];
2302
+ } else {
2303
+ $ulli_containers = get_post_meta( $post->ID, 'sa_ulli_containers', true );
2304
+ if ( '' === $ulli_containers ) {
2305
+ $ulli_containers = '0';
2306
+ }
2307
+ }
2308
+ // setting 5 - sa_rtl_slider.
2309
+ if ( isset( $other_settings_arr ) && ( '' !== $other_settings_arr[4] ) ) {
2310
+ $rtl_slider = $other_settings_arr[4];
2311
+ } else {
2312
+ $rtl_slider = '0';
2313
+ }
2314
+ // setting 6 - sa_disable_preview.
2315
+ if ( isset( $other_settings_arr ) && ( '' !== $other_settings_arr[5] ) ) {
2316
+ $disable_preview = $other_settings_arr[5];
2317
+ } else {
2318
+ $disable_preview = '0';
2319
+ }
2320
+ // setting 7 - bg_image_size.
2321
+ $bg_image_size = 'full';
2322
+ if ( isset( $other_settings_arr ) && ( count( $other_settings_arr ) > 6 ) ) {
2323
+ if ( '' !== $other_settings_arr[6] ) {
2324
+ $bg_image_size = $other_settings_arr[6];
2325
+ }
2326
+ }
2327
+ // setting 8 - sa_disable_slide_ids.
2328
+ if ( isset( $other_settings_arr ) && ( count( $other_settings_arr ) > 7 ) ) {
2329
+ $disable_slide_ids = $other_settings_arr[7];
2330
+ } else {
2331
+ $disable_slide_ids = '0';
2332
+ }
2333
+
2334
+ // USE 'DOMContentLoaded' EVENT (checkbox).
2335
+ $tooltip = 'Load the Slide Anything JavaScript during the DOMContentLoaded event. Use this option if jQuery ';
2336
+ $tooltip .= 'is loading in your theme footer and you are getting the JavaScript error message ';
2337
+ $tooltip .= '&quot;Uncaught ReferenceError: jQuery is not defined&quot;.';
2338
+ echo "<div class='sa_window_onload_line'>";
2339
+ echo "<span class='sa_tooltip' title='" . esc_attr( $tooltip ) . "'></span><span style='min-width:160px;'>DOMContentLoaded event:</span>";
2340
+ if ( '1' === $window_onload ) {
2341
+ echo "<input type='checkbox' id='sa_window_onload' name='sa_window_onload' value='1' checked/>";
2342
+ } else {
2343
+ echo "<input type='checkbox' id='sa_window_onload' name='sa_window_onload' value='1'/>";
2344
+ }
2345
+ echo "</div>\n";
2346
+
2347
+ echo "<div style='display:none !important;'>";
2348
+ echo "<input type='checkbox' id='sa_lazy_load_images' name='sa_lazy_load_images' value='0'/>";
2349
+ echo "</div>\n";
2350
+
2351
+ // Use UL and LI Containers.
2352
+ $tooltip = 'Use &quot;UL&quot; as the DOM element for &quot;owl-stage&quot; and use &quot;LI&quot; as the DOM elements for &quot;owl-item&quot;.';
2353
+ echo "<div class='sa_window_onload_line'>";
2354
+ echo "<span class='sa_tooltip' title='" . esc_attr( $tooltip ) . "'></span><span style='min-width:160px;'>Use UL and LI Containers:</span>";
2355
+ if ( '1' === $ulli_containers ) {
2356
+ echo "<input type='checkbox' id='sa_ulli_containers' name='sa_ulli_containers' value='1' checked/>";
2357
+ } else {
2358
+ echo "<input type='checkbox' id='sa_ulli_containers' name='sa_ulli_containers' value='1'/>";
2359
+ }
2360
+ echo "</div>\n";
2361
+
2362
+ // Right to Left Slider.
2363
+ $tooltip = 'Change the direction of the slider to be right to left.';
2364
+ echo "<div class='sa_window_onload_line'>";
2365
+ echo "<span class='sa_tooltip' title='" . esc_attr( $tooltip ) . "'></span><span style='min-width:160px;'>Right to Left Slider:</span>";
2366
+ if ( '1' === $rtl_slider ) {
2367
+ echo "<input type='checkbox' id='sa_rtl_slider' name='sa_rtl_slider' value='1' checked/>";
2368
+ } else {
2369
+ echo "<input type='checkbox' id='sa_rtl_slider' name='sa_rtl_slider' value='1'/>";
2370
+ }
2371
+ echo "</div>\n";
2372
+
2373
+ // Disable Preview Feature.
2374
+ $tooltip = 'Disable the &quot;Preview Slider&quot; feature in this settings page - the &quot;Slide Anything Popup Preview&quot; page will no longer be auto generated.';
2375
+ echo "<div class='sa_window_onload_line'>";
2376
+ echo "<span class='sa_tooltip' title='" . esc_attr( $tooltip ) . "'></span><span style='min-width:160px;'>Disable Preview Feature:</span>";
2377
+ if ( '1' === $disable_preview ) {
2378
+ echo "<input type='checkbox' id='sa_disable_preview' name='sa_disable_preview' value='1' checked/>";
2379
+ } else {
2380
+ echo "<input type='checkbox' id='sa_disable_preview' name='sa_disable_preview' value='1'/>";
2381
+ }
2382
+ echo "</div>\n";
2383
+
2384
+ // Don't use Slide IDs.
2385
+ $tooltip = 'Do not use a unique CSS ID to identify each slide container - use a unique CSS Class instead.';
2386
+ echo "<div class='sa_window_onload_line'>";
2387
+ echo "<span class='sa_tooltip' title='" . esc_attr( $tooltip ) . "'></span><span style='min-width:160px;'>Don't use CSS IDs for slides:</span>";
2388
+ if ( '1' === $disable_slide_ids ) {
2389
+ echo "<input type='checkbox' id='sa_disable_slide_ids' name='sa_disable_slide_ids' value='1' checked/>";
2390
+ } else {
2391
+ echo "<input type='checkbox' id='sa_disable_slide_ids' name='sa_disable_slide_ids' value='1'/>";
2392
+ }
2393
+ echo "</div>\n";
2394
+
2395
+ // Start Position.
2396
+ $num_slides = intval( get_post_meta( $post->ID, 'sa_num_slides', true ) );
2397
+ if ( '' === $num_slides ) {
2398
+ $start_pos = 1;
2399
+ } else {
2400
+ $start_pos = intval( get_post_meta( $post->ID, 'sa_start_pos', true ) );
2401
+ if ( '' === $start_pos ) {
2402
+ $start_pos = 1;
2403
+ }
2404
+ $tooltip = 'Which slide number to start display first';
2405
+ echo "<div class='sa_window_onload_line'>";
2406
+ echo "<span class='sa_tooltip' title='" . esc_attr( $tooltip ) . "'></span><span style='min-width:160px;'>Starting Slide Number:</span>";
2407
+ echo "<select name='sa_start_pos'>";
2408
+ for ( $i = 1; $i <= $num_slides; $i++ ) {
2409
+ if ( $i === $start_pos ) {
2410
+ echo "<option value='" . esc_attr( $i ) . "' selected>" . esc_html( $i ) . '</option>';
2411
+ } else {
2412
+ echo "<option value='" . esc_attr( $i ) . "'>" . esc_html( $i ) . '</option>';
2413
+ }
2414
+ }
2415
+ echo '</select>';
2416
+ echo "</div>\n";
2417
+ }
2418
+
2419
+ // SLIDE BACKGROUND IMAGE SIZE.
2420
+ global $_wp_additional_image_sizes;
2421
+ $image_size_arr = array();
2422
+ // get WordPress image size data and save into and array.
2423
+ $image_size_arr[0]['value'] = 'full';
2424
+ $image_size_arr[0]['desc'] = 'Full Size';
2425
+ $count = 1;
2426
+ foreach ( get_intermediate_image_sizes() as $image_size ) {
2427
+ if ( in_array( $image_size, array( 'thumbnail', 'medium', 'medium_large', 'large' ), true ) ) {
2428
+ $width = get_option( "{$image_size}_size_w" );
2429
+ $height = get_option( "{$image_size}_size_h" );
2430
+ } elseif ( isset( $_wp_additional_image_sizes[ $image_size ] ) ) {
2431
+ $width = $_wp_additional_image_sizes[ $image_size ]['width'];
2432
+ $height = $_wp_additional_image_sizes[ $image_size ]['height'];
2433
+ }
2434
+ if ( ( 0 !== $width ) && ( 0 !== $height ) ) {
2435
+ $image_size_arr[ $count ]['value'] = $image_size;
2436
+ $image_size_arr[ $count ]['desc'] = $image_size . ' (' . $width . '&times;' . $height . ')';
2437
+ $count++;
2438
+ }
2439
+ }
2440
+ // display the dropdown input box allowing user to select background image size.
2441
+ $tooltip = 'Allows you to set the WordPress image size to use for your slide background images.';
2442
+ echo "<div class='bg_image_size_wrapper'>\n<div>\n";
2443
+ echo "<em class='sa_tooltip' href='' title='" . esc_attr( $tooltip ) . "'></em>";
2444
+ echo '<span>Background Image Size:</span>';
2445
+ echo "<div style='float:none; clear:both; width:100%; height:1px; padding:0px !important;'></div>\n</div>\n";
2446
+ echo "<select name='bg_image_size'>";
2447
+ $tot_size_arr = count( $image_size_arr );
2448
+ for ( $j = 0; $j < $tot_size_arr; $j++ ) {
2449
+ if ( $bg_image_size === $image_size_arr[ $j ]['value'] ) {
2450
+ echo "<option value='" . esc_attr( $image_size_arr[ $j ]['value'] ) . "' selected>" . esc_html( $image_size_arr[ $j ]['desc'] ) . '</option>';
2451
+ } else {
2452
+ echo "<option value='" . esc_attr( $image_size_arr[ $j ]['value'] ) . "'>" . esc_html( $image_size_arr[ $j ]['desc'] ) . '</option>';
2453
+ }
2454
+ }
2455
+ echo "</select>\n";
2456
+ echo "</div>\n"; // .bg_image_size_wrapper
2457
+
2458
+ echo "</div>\n";
2459
+ }
2460
+
2461
+
2462
+
2463
+ /**
2464
+ * ##### META BOX CONTENT - 'Thumbnails (Pagination)' BOX #####
2465
+ *
2466
+ * @param array $post Custom Post 'sa_slider'.
2467
+ */
2468
+ function cpt_slider_thumbs_content( $post ) {
2469
+ $sa_pro_version = validate_slide_anything_pro_registration();
2470
+
2471
+ if ( $sa_pro_version ) {
2472
+ // get WordPress image size data and save into and array.
2473
+ global $_wp_additional_image_sizes;
2474
+ $image_size_arr = array();
2475
+ $count = 0;
2476
+ foreach ( get_intermediate_image_sizes() as $image_size ) {
2477
+ if ( in_array( $image_size, array( 'thumbnail', 'medium', 'medium_large', 'large' ), true ) ) {
2478
+ $width = get_option( "{$image_size}_size_w" );
2479
+ $height = get_option( "{$image_size}_size_h" );
2480
+ } elseif ( isset( $_wp_additional_image_sizes[ $image_size ] ) ) {
2481
+ $width = $_wp_additional_image_sizes[ $image_size ]['width'];
2482
+ $height = $_wp_additional_image_sizes[ $image_size ]['height'];
2483
+ }
2484
+ if ( ( 0 !== $width ) && ( 0 !== $height ) ) {
2485
+ $image_size_arr[ $count ]['value'] = $image_size;
2486
+ $image_size_arr[ $count ]['desc'] = $image_size . ' (' . $width . '&times;' . $height . ')';
2487
+ $count++;
2488
+ }
2489
+ }
2490
+
2491
+ // Use thumbnail pagination (checkbox).
2492
+ $thumbs_active = get_post_meta( $post->ID, 'sa_thumbs_active', true );
2493
+ if ( '' === $thumbs_active ) {
2494
+ $thumbs_active = '0';
2495
+ }
2496
+ echo "<div class='sa_thumbs_line'><span>Use Thumbnail Pagination:</span>";
2497
+ if ( '1' === $thumbs_active ) {
2498
+ echo "<input type='checkbox' id='sa_thumbs_active' name='sa_thumbs_active' value='1' checked/>";
2499
+ } else {
2500
+ echo "<input type='checkbox' id='sa_thumbs_active' name='sa_thumbs_active' value='1'/>";
2501
+ }
2502
+ echo "</div>\n";
2503
+
2504
+ if ( '1' === $thumbs_active ) {
2505
+ echo "<div id='sa_thumbs_settings' style='display:block;'>\n";
2506
+ } else {
2507
+ echo "<div id='sa_thumbs_settings' style='display:none;'>\n";
2508
+ }
2509
+
2510
+ // Thumbs Location (dropdown).
2511
+ $thumbs_location = get_post_meta( $post->ID, 'sa_thumbs_location', true );
2512
+ if ( '' === $thumbs_location ) {
2513
+ $thumbs_location = 'inside_bottom';
2514
+ }
2515
+ echo "<div class='sa_thumbs_line'><span>Thumbs Location:</span>";
2516
+ echo "<select id='sa_thumbs_location' name='sa_thumbs_location'>";
2517
+ $option_arr = array();
2518
+ $option_arr[0] = 'Inside Bottom';
2519
+ $option_arr[1] = 'Inside Top';
2520
+ $option_arr[2] = 'Inside Left';
2521
+ $option_arr[3] = 'Inside Right';
2522
+ $option_arr[4] = 'Outside Bottom';
2523
+ $tot_opt = count( $option_arr );
2524
+ for ( $i = 0; $i < $tot_opt; $i++ ) {
2525
+ $value = strtolower( str_replace( ' ', '_', $option_arr[ $i ] ) );
2526
+ if ( $value === $thumbs_location ) {
2527
+ echo "<option value='" . esc_attr( $value ) . "' selected>" . esc_html( $option_arr[ $i ] ) . '</option>';
2528
+ } else {
2529
+ echo "<option value='" . esc_attr( $value ) . "'>" . esc_html( $option_arr[ $i ] ) . '</option>';
2530
+ }
2531
+ }
2532
+ echo "</select></div>\n";
2533
+
2534
+ // Thumbnail Image Size (dropdown).
2535
+ $thumbs_image_size = get_post_meta( $post->ID, 'sa_thumbs_image_size', true );
2536
+ if ( '' === $thumbs_image_size ) {
2537
+ $thumbs_image_size = 'thumbnail';
2538
+ }
2539
+ echo "<div class='sa_thumbs_line'><span>Thumbnail Image Size:</span>";
2540
+ echo "<select id='sa_thumbs_image_size' name='sa_thumbs_image_size'>";
2541
+ $tot_img_arr = count( $image_size_arr );
2542
+ for ( $i = 0; $i < $tot_img_arr; $i++ ) {
2543
+ if ( $image_size_arr[ $i ]['value'] === $thumbs_image_size ) {
2544
+ echo "<option value='" . esc_attr( $image_size_arr[ $i ]['value'] ) . "' selected>" . esc_html( $image_size_arr[ $i ]['desc'] ) . '</option>';
2545
+ } else {
2546
+ echo "<option value='" . esc_attr( $image_size_arr[ $i ]['value'] ) . "'>" . esc_html( $image_size_arr[ $i ]['desc'] ) . '</option>';
2547
+ }
2548
+ }
2549
+ echo "</select></div>\n";
2550
+
2551
+ // Container Padding.
2552
+ $thumbs_padding = get_post_meta( $post->ID, 'sa_thumbs_padding', true );
2553
+ if ( '' === $thumbs_padding ) {
2554
+ $thumbs_padding = '3';
2555
+ }
2556
+ echo "<div class='sa_thumbs_line'><span>Container Padding:</span>";
2557
+ echo "<input type='text' id='sa_thumbs_padding' name='sa_thumbs_padding' value='" . esc_attr( $thumbs_padding ) . "'><em>%</em>";
2558
+ echo "</div>\n";
2559
+
2560
+ // Thumbs Width.
2561
+ $thumbs_width = get_post_meta( $post->ID, 'sa_thumbs_width', true );
2562
+ if ( '' === $thumbs_width ) {
2563
+ $thumbs_width = '150';
2564
+ }
2565
+ echo "<div class='sa_thumbs_line'><span>Thumbs Width:</span>";
2566
+ echo "<input type='text' id='sa_thumbs_width' name='sa_thumbs_width' value='" . esc_attr( $thumbs_width ) . "'><em>px</em>";
2567
+ echo "</div>\n";
2568
+
2569
+ // Thumbs Height.
2570
+ $thumbs_height = get_post_meta( $post->ID, 'sa_thumbs_height', true );
2571
+ if ( '' === $thumbs_height ) {
2572
+ $thumbs_height = '85';
2573
+ }
2574
+ echo "<div class='sa_thumbs_line'><span>Thumbs Height:</span>";
2575
+ echo "<input type='text' id='sa_thumbs_height' name='sa_thumbs_height' value='" . esc_attr( $thumbs_height ) . "'><em>px</em>";
2576
+ echo "</div>\n";
2577
+
2578
+ // Thumbs Opacity.
2579
+ $thumbs_opacity = get_post_meta( $post->ID, 'sa_thumbs_opacity', true );
2580
+ if ( '' === $thumbs_opacity ) {
2581
+ $thumbs_opacity = '50';
2582
+ }
2583
+ echo "<div class='sa_thumbs_line'><span>Thumbs Opacity:</span>";
2584
+ echo "<input type='text' id='sa_thumbs_opacity' name='sa_thumbs_opacity' value='" . esc_attr( $thumbs_opacity ) . "'><em>%</em>";
2585
+ echo "</div>\n";
2586
+
2587
+ echo '<h4>Active Thumb Border Style</h4>';
2588
+
2589
+ // Border Width.
2590
+ $thumbs_border_width = get_post_meta( $post->ID, 'sa_thumbs_border_width', true );
2591
+ if ( '' === $thumbs_border_width ) {
2592
+ $thumbs_border_width = '0';
2593
+ }
2594
+ echo "<div class='sa_thumbs_line'><span>Border Width:</span>";
2595
+ echo "<input type='text' id='sa_thumbs_border_width' name='sa_thumbs_border_width' value='" . esc_attr( $thumbs_border_width ) . "'><em>px</em>";
2596
+ echo "</div>\n";
2597
+
2598
+ // Border Color.
2599
+ $thumbs_border_color = get_post_meta( $post->ID, 'sa_thumbs_border_color', true );
2600
+ if ( '' === $thumbs_border_color ) {
2601
+ $thumbs_border_color = '#ffffff';
2602
+ }
2603
+ echo "<div class='sa_thumbs_line'><span>Border Color:</span>";
2604
+ echo "<input type='text' id='sa_thumbs_border_color' name='sa_thumbs_border_color' value='" . esc_attr( $thumbs_border_color ) . "'></div>\n";
2605
+
2606
+ echo '<h4>Responsive Thumb Sizes</h4>';
2607
+
2608
+ // Tablet Thumb Size.
2609
+ $thumbs_resp_tablet = get_post_meta( $post->ID, 'sa_thumbs_resp_tablet', true );
2610
+ if ( '' === $thumbs_resp_tablet ) {
2611
+ $thumbs_resp_tablet = '75';
2612
+ }
2613
+ echo "<div class='sa_thumbs_line'><span>Tablet Thumb Size:</span>";
2614
+ echo "<input type='text' id='sa_thumbs_resp_tablet' name='sa_thumbs_resp_tablet' value='" . esc_attr( $thumbs_resp_tablet ) . "'><em>%</em>";
2615
+ echo "</div>\n";
2616
+
2617
+ // Mobile Thumb Size.
2618
+ $thumbs_resp_mobile = get_post_meta( $post->ID, 'sa_thumbs_resp_mobile', true );
2619
+ if ( '' === $thumbs_resp_mobile ) {
2620
+ $thumbs_resp_mobile = '50';
2621
+ }
2622
+ echo "<div class='sa_thumbs_line'><span>Mobile Thumb Size:</span>";
2623
+ echo "<input type='text' id='sa_thumbs_resp_mobile' name='sa_thumbs_resp_mobile' value='" . esc_attr( $thumbs_resp_mobile ) . "'><em>%</em>";
2624
+ echo "</div>\n";
2625
+
2626
+ echo "</div>\n"; // #sa_thumbs_settings
2627
+
2628
+ } else {
2629
+
2630
+ // display slide anything pro promotional text.
2631
+ echo "<div id='sa_thumbs_promo'>";
2632
+ echo "<h4>Available in the PRO VERSION only!</h4>\n";
2633
+ echo '<p>With <strong>Slide Anything PRO </strong> you can now add <strong>Thumbnail Pagination</strong>.';
2634
+ echo '<p>Wiew a Thumbnail Pagination DEMO here:</p>';
2635
+ echo "<p style='padding-top:2px !important;'><a href='https://edgewebpages.com/hero-slider-with-thumbnails' target='_blank'>THUMBNAIL PAGINATION DEMO</a></p>";
2636
+ echo '</div>';
2637
+ }
2638
+ }
2639
+
2640
+
2641
+
2642
+ /**
2643
+ * // ##### META BOX CONTENT - 'Slide Any Post' PROMOTION BOX #####
2644
+ */
2645
+ function cpt_slide_any_post_content() {
2646
+ echo "<div id='sa_post_notice'>\n";
2647
+ echo "<div id='sapn_image'>\n";
2648
+ echo "<a href='https://edgewebpages.com/sap' title='View the Slide Any Post website' target='_blank'>";
2649
+ echo "<img src='" . esc_url( get_site_url() ) . "/wp-content/plugins/slide-anything/images/slide_any_post_logo.png' />";
2650
+ echo "</a>\n";
2651
+ echo "</div>\n"; // #sapn_image
2652
+ echo "<div id='sapn_text'>\n";
2653
+ echo "<h3>Generate a carousel/slider for ANY WordPress post type!</h3>\n";
2654
+ echo "<h5>Filter specific posts, filter by taxonomy, or filter by meta data values</h5>\n";
2655
+ echo "<h5>Create custom slide layouts containing post taxonomy data and post meta data</h5>\n";
2656
+ echo "<div><a id='sapn_link' href='https://edgewebpages.com/sap' title='View the Slide Any Post website' ";
2657
+ echo "target='_blank'>MORE INFORMATION</a>\n";
2658
+ if ( isset( $_SERVER['REQUEST_URI'] ) && ( '' !== $_SERVER['REQUEST_URI'] ) ) {
2659
+ $dismiss_url = esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) );
2660
+ echo "<a id='sapn_dismiss' href='" . esc_url( $dismiss_url ) . "&sapost_ignore=0'>DISMISS THIS NOTICE</a></div>";
2661
+ }
2662
+ echo "</div>\n"; // #sapn_text
2663
+ echo "<div style='float:none; clear:both; width:100%; height:1px;'></div>\n";
2664
+ echo "</div>\n"; // #sa_post_notice
2665
+ }
2666
+
2667
+
2668
+
2669
+ /**
2670
+ * // ##### ACTION HOOK - SAVE CUSTOM POST TYPE ('Slide Anything') DATA #####
2671
+ */
2672
+ function cpt_slider_save_postdata() {
2673
+ global $post;
2674
+ $sa_pro_version = validate_slide_anything_pro_registration();
2675
+
2676
+ // ### REMOVE XSS ATTACK VULNERABILITY FROM SLIDER POST TITLES ###
2677
+ global $wpdb;
2678
+ if ( isset( $post->ID ) && ( '' !== $post->ID ) ) {
2679
+ $post_title = get_the_title( $post->ID );
2680
+ $sanitize_title = sanitize_text_field( $post_title );
2681
+ $where = array( 'ID' => $post->ID );
2682
+ $wpdb->update( $wpdb->posts, array( 'post_title' => $sanitize_title ), $where ); // db call ok; no-cache ok.
2683
+ }
2684
+
2685
+ // ### VERIFY 1) LOGGED-IN USER IS ADMINISTRATOR AND 2) VALID NONCE TO PREVENT CSRF HACKER ATTACKS ###
2686
+ if ( current_user_can( 'edit_pages' ) &&
2687
+ isset( $_POST['nonce_save_slider'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce_save_slider'] ) ), basename( __FILE__ ) ) ) {
2688
+ if ( isset( $_POST['sa_num_slides'] ) ) {
2689
+ $total_slides = intval( $_POST['sa_num_slides'] );
2690
+ } else {
2691
+ $total_slides = 1;
2692
+ }
2693
+ if ( isset( $_POST['sa_duplicate_slide'] ) ) {
2694
+ if ( ( '' === $_POST['sa_duplicate_slide'] ) || ( '0' === $_POST['sa_duplicate_slide'] ) ) {
2695
+ $duplicate_slide = 0;
2696
+ } else {
2697
+ // A SLIDE NEEDS TO BE DUPLICATED.
2698
+ $duplicate_slide = intval( $_POST['sa_duplicate_slide'] );
2699
+ }
2700
+ } else {
2701
+ $duplicate_slide = 0;
2702
+ }
2703
+ if ( isset( $_POST['sa_move_slide_up'] ) ) {
2704
+ if ( ( '' === $_POST['sa_move_slide_up'] ) || ( '0' === $_POST['sa_move_slide_up'] ) ) {
2705
+ $move_slide_up = 0;
2706
+ } else {
2707
+ // A SLIDE NEEDS TO BE MOVED.
2708
+ $move_slide_up = intval( $_POST['sa_move_slide_up'] );
2709
+ }
2710
+ } else {
2711
+ $move_slide_up = 0;
2712
+ }
2713
+
2714
+ // UPDATE CONTENT FOR EACH SLIDE.
2715
+ $slides_saved = 0;
2716
+ for ( $i = 1; $i <= $total_slides; $i++ ) {
2717
+ $slide_edit_id = 'sa_slide' . $i . '_content';
2718
+ $slide_image_id = 'sa_slide' . $i . '_image_id';
2719
+ $slide_image_pos = 'sa_slide' . $i . '_image_pos';
2720
+ $slide_image_size = 'sa_slide' . $i . '_image_size';
2721
+ $slide_image_repeat = 'sa_slide' . $i . '_image_repeat';
2722
+ $slide_image_color = 'sa_slide' . $i . '_image_color';
2723
+ $slide_link_url = 'sa_slide' . $i . '_link_url';
2724
+ $slide_link_target = 'sa_slide' . $i . '_link_target';
2725
+ if ( $sa_pro_version ) {
2726
+ $slide_popup_type = 'sa_slide' . $i . '_popup_type';
2727
+ $slide_popup_imageid = 'sa_slide' . $i . '_popup_imageid';
2728
+ $slide_popup_imagetitle = 'sa_slide' . $i . '_popup_imagetitle';
2729
+ $slide_popup_video_id = 'sa_slide' . $i . '_popup_video_id';
2730
+ $slide_popup_video_type = 'sa_slide' . $i . '_popup_video_type';
2731
+ $slide_popup_background = 'sa_slide' . $i . '_popup_background';
2732
+ $slide_popup_html = 'sa_slide' . $i . '_popup_html';
2733
+ $slide_popup_shortcode = 'sa_slide' . $i . '_popup_shortcode';
2734
+ $slide_popup_bgcol = 'sa_slide' . $i . '_popup_bgcol';
2735
+ $slide_popup_width = 'sa_slide' . $i . '_popup_width';
2736
+ }
2737
+ $slide_content = '';
2738
+ $slide_image_id_val = 0;
2739
+ $slide_image_pos_val = '';
2740
+ $slide_image_size_val = '';
2741
+ $slide_image_repeat_val = '';
2742
+ $slide_image_color_val = '';
2743
+ $slide_link_url_val = '';
2744
+ $slide_link_target_val = '';
2745
+ if ( isset( $_POST[ $slide_edit_id ] ) && ( '' !== $_POST[ $slide_edit_id ] ) ) {
2746
+ $slide_content = wp_kses_post( wp_unslash( $_POST[ $slide_edit_id ] ) );
2747
+ }
2748
+ if ( isset( $_POST[ $slide_image_id ] ) ) {
2749
+ $slide_image_id_val = abs( intval( $_POST[ $slide_image_id ] ) );
2750
+ }
2751
+ if ( isset( $_POST[ $slide_image_pos ] ) ) {
2752
+ $slide_image_pos_val = sanitize_text_field( wp_unslash( $_POST[ $slide_image_pos ] ) );
2753
+ }
2754
+ if ( isset( $_POST[ $slide_image_size ] ) ) {
2755
+ $slide_image_size_val = sanitize_text_field( wp_unslash( $_POST[ $slide_image_size ] ) );
2756
+ }
2757
+ if ( isset( $_POST[ $slide_image_repeat ] ) ) {
2758
+ $slide_image_repeat_val = sanitize_text_field( wp_unslash( $_POST[ $slide_image_repeat ] ) );
2759
+ }
2760
+ if ( isset( $_POST[ $slide_image_color ] ) ) {
2761
+ $slide_image_color_val = sanitize_text_field( wp_unslash( $_POST[ $slide_image_color ] ) );
2762
+ }
2763
+ if ( isset( $_POST[ $slide_link_url ] ) ) {
2764
+ $slide_link_url_val = sanitize_text_field( wp_unslash( $_POST[ $slide_link_url ] ) );
2765
+ }
2766
+ if ( isset( $_POST[ $slide_link_target ] ) ) {
2767
+ $slide_link_target_val = sanitize_text_field( wp_unslash( $_POST[ $slide_link_target ] ) );
2768
+ }
2769
+ if ( $sa_pro_version ) {
2770
+ $slide_popup_type_val = '';
2771
+ $slide_popup_imageid_val = 0;
2772
+ $slide_popup_imagetitle_val = '';
2773
+ $slide_popup_video_id_val = '';
2774
+ $slide_popup_video_type_val = '';
2775
+ $slide_popup_background_val = '';
2776
+ $slide_popup_html_val = '';
2777
+ $slide_popup_shortcode_val = '';
2778
+ $slide_popup_bgcol_val = '';
2779
+ $slide_popup_width_val = 0;
2780
+ if ( isset( $_POST[ $slide_popup_type ] ) ) {
2781
+ $slide_popup_type_val = sanitize_text_field( wp_unslash( $_POST[ $slide_popup_type ] ) );
2782
+ }
2783
+ if ( isset( $_POST[ $slide_popup_imageid ] ) ) {
2784
+ $slide_popup_imageid_val = sanitize_text_field( wp_unslash( $_POST[ $slide_popup_imageid ] ) );
2785
+ }
2786
+ if ( isset( $_POST[ $slide_popup_imagetitle ] ) ) {
2787
+ $slide_popup_imagetitle_val = sanitize_text_field( wp_unslash( $_POST[ $slide_popup_imagetitle ] ) );
2788
+ }
2789
+ if ( isset( $_POST[ $slide_popup_video_id ] ) ) {
2790
+ $slide_popup_video_id_val = sanitize_text_field( wp_unslash( $_POST[ $slide_popup_video_id ] ) );
2791
+ }
2792
+ if ( isset( $_POST[ $slide_popup_video_type ] ) ) {
2793
+ $slide_popup_video_type_val = sanitize_text_field( wp_unslash( $_POST[ $slide_popup_video_type ] ) );
2794
+ }
2795
+ if ( isset( $_POST[ $slide_popup_background ] ) ) {
2796
+ $slide_popup_background_val = sanitize_text_field( wp_unslash( $_POST[ $slide_popup_background ] ) );
2797
+ }
2798
+ if ( isset( $_POST[ $slide_popup_html ] ) ) {
2799
+ $slide_popup_html_val = balanceTags( wp_kses_post( wp_unslash( $_POST[ $slide_popup_html ] ) ), true );
2800
+ }
2801
+ if ( isset( $_POST[ $slide_popup_shortcode ] ) ) {
2802
+ $slide_popup_shortcode_val = sanitize_text_field( wp_unslash( $_POST[ $slide_popup_shortcode ] ) );
2803
+ }
2804
+ if ( isset( $_POST[ $slide_popup_bgcol ] ) ) {
2805
+ $slide_popup_bgcol_val = sanitize_text_field( wp_unslash( $_POST[ $slide_popup_bgcol ] ) );
2806
+ }
2807
+ if ( isset( $_POST[ $slide_popup_width ] ) ) {
2808
+ $slide_popup_width_val = abs( intval( $_POST[ $slide_popup_width ] ) );
2809
+ }
2810
+ }
2811
+ // check delete status for slide.
2812
+ $del_status_id = 'sa_slide' . $i . '_delete';
2813
+ if ( isset( $_POST[ $del_status_id ] ) && ( '' !== $_POST[ $del_status_id ] ) ) {
2814
+ $del_status = sanitize_text_field( wp_unslash( $_POST[ $del_status_id ] ) );
2815
+ } else {
2816
+ // a new slide has been added.
2817
+ $del_status = '1';
2818
+ $slide_content = '';
2819
+ }
2820
+ if ( '1' === $del_status ) {
2821
+ // save slide content only if slide has not been marked for deletion.
2822
+ $slides_saved++;
2823
+ $slide_edit_id_save = 'sa_slide' . $slides_saved . '_content';
2824
+ $slide_image_data_saved = 'sa_slide' . $slides_saved . '_image_data';
2825
+ $slide_link_url_saved = 'sa_slide' . $slides_saved . '_link_url';
2826
+ $slide_link_target_saved = 'sa_slide' . $slides_saved . '_link_target';
2827
+ if ( $sa_pro_version ) {
2828
+ $slide_popup_type_saved = 'sa_slide' . $slides_saved . '_popup_type';
2829
+ $slide_popup_imageid_saved = 'sa_slide' . $slides_saved . '_popup_imageid';
2830
+ $slide_popup_imagetitle_saved = 'sa_slide' . $slides_saved . '_popup_imagetitle';
2831
+ $slide_popup_video_id_saved = 'sa_slide' . $slides_saved . '_popup_video_id';
2832
+ $slide_popup_video_type_saved = 'sa_slide' . $slides_saved . '_popup_video_type';
2833
+ $slide_popup_background_saved = 'sa_slide' . $slides_saved . '_popup_background';
2834
+ $slide_popup_html_saved = 'sa_slide' . $slides_saved . '_popup_html';
2835
+ $slide_popup_shortcode_saved = 'sa_slide' . $slides_saved . '_popup_shortcode';
2836
+ $slide_popup_bgcol_saved = 'sa_slide' . $slides_saved . '_popup_bgcol';
2837
+ $slide_popup_width_saved = 'sa_slide' . $slides_saved . '_popup_width';
2838
+ }
2839
+ update_post_meta( $post->ID, $slide_edit_id_save, $slide_content );
2840
+ $slide_image_data_val = $slide_image_id_val . '~' . $slide_image_pos_val . '~' . $slide_image_size_val . '~' . $slide_image_repeat_val . '~' . $slide_image_color_val;
2841
+ update_post_meta( $post->ID, $slide_image_data_saved, $slide_image_data_val );
2842
+ update_post_meta( $post->ID, $slide_link_url_saved, $slide_link_url_val );
2843
+ update_post_meta( $post->ID, $slide_link_target_saved, $slide_link_target_val );
2844
+ if ( $sa_pro_version ) {
2845
+ update_post_meta( $post->ID, $slide_popup_type_saved, $slide_popup_type_val );
2846
+ update_post_meta( $post->ID, $slide_popup_imageid_saved, $slide_popup_imageid_val );
2847
+ update_post_meta( $post->ID, $slide_popup_imagetitle_saved, $slide_popup_imagetitle_val );
2848
+ update_post_meta( $post->ID, $slide_popup_video_id_saved, $slide_popup_video_id_val );
2849
+ update_post_meta( $post->ID, $slide_popup_video_type_saved, $slide_popup_video_type_val );
2850
+ update_post_meta( $post->ID, $slide_popup_background_saved, $slide_popup_background_val );
2851
+ update_post_meta( $post->ID, $slide_popup_html_saved, $slide_popup_html_val );
2852
+ update_post_meta( $post->ID, $slide_popup_shortcode_saved, $slide_popup_shortcode_val );
2853
+ update_post_meta( $post->ID, $slide_popup_bgcol_saved, $slide_popup_bgcol_val );
2854
+ update_post_meta( $post->ID, $slide_popup_width_saved, $slide_popup_width_val );
2855
+ }
2856
+ if ( $i === $duplicate_slide ) {
2857
+ // the 'duplicate slide' button has been click for this slide - create a new slide that is an exact copy of previous slide.
2858
+ $slides_saved++;
2859
+ $slide_edit_id_save = 'sa_slide' . $slides_saved . '_content';
2860
+ $slide_image_data_saved = 'sa_slide' . $slides_saved . '_image_data';
2861
+ $slide_link_url_saved = 'sa_slide' . $slides_saved . '_link_url';
2862
+ $slide_link_target_saved = 'sa_slide' . $slides_saved . '_link_target';
2863
+ if ( $sa_pro_version ) {
2864
+ $slide_popup_type_saved = 'sa_slide' . $slides_saved . '_popup_type';
2865
+ $slide_popup_imageid_saved = 'sa_slide' . $slides_saved . '_popup_imageid';
2866
+ $slide_popup_imagetitle_saved = 'sa_slide' . $slides_saved . '_popup_imagetitle';
2867
+ $slide_popup_video_id_saved = 'sa_slide' . $slides_saved . '_popup_video_id';
2868
+ $slide_popup_video_type_saved = 'sa_slide' . $slides_saved . '_popup_video_type';
2869
+ $slide_popup_background_saved = 'sa_slide' . $slides_saved . '_popup_background';
2870
+ $slide_popup_html_saved = 'sa_slide' . $slides_saved . '_popup_html';
2871
+ $slide_popup_shortcode_saved = 'sa_slide' . $slides_saved . '_popup_shortcode';
2872
+ $slide_popup_bgcol_saved = 'sa_slide' . $slides_saved . '_popup_bgcol';
2873
+ $slide_popup_width_saved = 'sa_slide' . $slides_saved . '_popup_width';
2874
+ }
2875
+ update_post_meta( $post->ID, $slide_edit_id_save, $slide_content );
2876
+ $slide_image_data_val = $slide_image_id_val . '~' . $slide_image_pos_val . '~' . $slide_image_size_val . '~' . $slide_image_repeat_val . '~' . $slide_image_color_val;
2877
+ update_post_meta( $post->ID, $slide_image_data_saved, $slide_image_data_val );
2878
+ update_post_meta( $post->ID, $slide_link_url_saved, $slide_link_url_val );
2879
+ update_post_meta( $post->ID, $slide_link_target_saved, $slide_link_target_val );
2880
+ if ( $sa_pro_version ) {
2881
+ update_post_meta( $post->ID, $slide_popup_type_saved, $slide_popup_type_val );
2882
+ update_post_meta( $post->ID, $slide_popup_imageid_saved, $slide_popup_imageid_val );
2883
+ update_post_meta( $post->ID, $slide_popup_imagetitle_saved, $slide_popup_imagetitle_val );
2884
+ update_post_meta( $post->ID, $slide_popup_video_id_saved, $slide_popup_video_id_val );
2885
+ update_post_meta( $post->ID, $slide_popup_video_type_saved, $slide_popup_video_type_val );
2886
+ update_post_meta( $post->ID, $slide_popup_background_saved, $slide_popup_background_val );
2887
+ update_post_meta( $post->ID, $slide_popup_html_saved, $slide_popup_html_val );
2888
+ update_post_meta( $post->ID, $slide_popup_shortcode_saved, $slide_popup_shortcode_val );
2889
+ update_post_meta( $post->ID, $slide_popup_bgcol_saved, $slide_popup_bgcol_val );
2890
+ update_post_meta( $post->ID, $slide_popup_width_saved, $slide_popup_width_val );
2891
+ }
2892
+ }
2893
+ }
2894
+ }
2895
+
2896
+ if ( 0 !== $move_slide_up ) {
2897
+ // A SLIDE NEEDS TO BE MOVED (TWO SLIDES ARE SWAPPED).
2898
+ $slide2 = $move_slide_up;
2899
+ $slide1 = intval( $move_slide_up ) - 1;
2900
+ $slide1_content = '';
2901
+ $slide1_image_id = 0;
2902
+ $slide1_image_pos = '';
2903
+ $slide1_image_size = '';
2904
+ $slide1_image_repeat = '';
2905
+ $slide1_image_color = '';
2906
+ $slide1_link_url = '';
2907
+ $slide1_link_target = '';
2908
+ if ( isset( $_POST[ 'sa_slide' . $slide1 . '_content' ] ) ) {
2909
+ $slide1_content = balanceTags( sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide1 . '_content' ] ) ), true );
2910
+ }
2911
+ if ( isset( $_POST[ 'sa_slide' . $slide1 . '_image_id' ] ) ) {
2912
+ $slide1_image_id = abs( intval( $_POST[ 'sa_slide' . $slide1 . '_image_id' ] ) );
2913
+ }
2914
+ if ( isset( $_POST[ 'sa_slide' . $slide1 . '_image_pos' ] ) ) {
2915
+ $slide1_image_pos = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide1 . '_image_pos' ] ) );
2916
+ }
2917
+ if ( isset( $_POST[ 'sa_slide' . $slide1 . '_image_size' ] ) ) {
2918
+ $slide1_image_size = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide1 . '_image_size' ] ) );
2919
+ }
2920
+ if ( isset( $_POST[ 'sa_slide' . $slide1 . '_image_repeat' ] ) ) {
2921
+ $slide1_image_repeat = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide1 . '_image_repeat' ] ) );
2922
+ }
2923
+ if ( isset( $_POST[ 'sa_slide' . $slide1 . '_image_color' ] ) ) {
2924
+ $slide1_image_color = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide1 . '_image_color' ] ) );
2925
+ }
2926
+ if ( isset( $_POST[ 'sa_slide' . $slide1 . '_link_url' ] ) ) {
2927
+ $slide1_link_url = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide1 . '_link_url' ] ) );
2928
+ }
2929
+ if ( isset( $_POST[ 'sa_slide' . $slide1 . '_link_target' ] ) ) {
2930
+ $slide1_link_target = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide1 . '_link_target' ] ) );
2931
+ }
2932
+ if ( $sa_pro_version ) {
2933
+ $slide1_popup_type = '';
2934
+ $slide1_popup_imageid = '';
2935
+ $slide1_popup_imagetitle = '';
2936
+ $slide1_popup_video_id = '';
2937
+ $slide1_popup_video_type = '';
2938
+ $slide1_popup_background = '';
2939
+ $slide1_popup_html = '';
2940
+ $slide1_popup_shortcode = '';
2941
+ $slide1_popup_bgcol = '';
2942
+ $slide1_popup_width = 0;
2943
+ if ( isset( $_POST[ 'sa_slide' . $slide1 . '_popup_type' ] ) ) {
2944
+ $slide1_popup_type = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide1 . '_popup_type' ] ) );
2945
+ }
2946
+ if ( isset( $_POST[ 'sa_slide' . $slide1 . '_popup_imageid' ] ) ) {
2947
+ $slide1_popup_imageid = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide1 . '_popup_imageid' ] ) );
2948
+ }
2949
+ if ( isset( $_POST[ 'sa_slide' . $slide1 . '_popup_imagetitle' ] ) ) {
2950
+ $slide1_popup_imagetitle = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide1 . '_popup_imagetitle' ] ) );
2951
+ }
2952
+ if ( isset( $_POST[ 'sa_slide' . $slide1 . '_popup_video_id' ] ) ) {
2953
+ $slide1_popup_video_id = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide1 . '_popup_video_id' ] ) );
2954
+ }
2955
+ if ( isset( $_POST[ 'sa_slide' . $slide1 . '_popup_video_type' ] ) ) {
2956
+ $slide1_popup_video_type = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide1 . '_popup_video_type' ] ) );
2957
+ }
2958
+ if ( isset( $_POST[ 'sa_slide' . $slide1 . '_popup_background' ] ) ) {
2959
+ $slide1_popup_background = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide1 . '_popup_background' ] ) );
2960
+ }
2961
+ if ( isset( $_POST[ 'sa_slide' . $slide1 . '_popup_html' ] ) ) {
2962
+ $slide1_popup_html = balanceTags( wp_kses_post( wp_unslash( $_POST[ 'sa_slide' . $slide1 . '_popup_html' ] ) ), true );
2963
+ }
2964
+ if ( isset( $_POST[ 'sa_slide' . $slide1 . '_popup_shortcode' ] ) ) {
2965
+ $slide1_popup_shortcode = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide1 . '_popup_shortcode' ] ) );
2966
+ }
2967
+ if ( isset( $_POST[ 'sa_slide' . $slide1 . '_popup_bgcol' ] ) ) {
2968
+ $slide1_popup_bgcol = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide1 . '_popup_bgcol' ] ) );
2969
+ }
2970
+ if ( isset( $_POST[ 'sa_slide' . $slide1 . '_popup_width' ] ) ) {
2971
+ $slide1_popup_width = abs( intval( $_POST[ 'sa_slide' . $slide1 . '_popup_width' ] ) );
2972
+ }
2973
+ }
2974
+ $slide2_content = '';
2975
+ $slide2_image_id = 0;
2976
+ $slide2_image_pos = '';
2977
+ $slide2_image_size = '';
2978
+ $slide2_image_repeat = '';
2979
+ $slide2_image_color = '';
2980
+ $slide2_link_url = '';
2981
+ $slide2_link_target = '';
2982
+ if ( isset( $_POST[ 'sa_slide' . $slide2 . '_content' ] ) ) {
2983
+ $slide2_content = balanceTags( sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide2 . '_content' ] ) ), true );
2984
+ }
2985
+ if ( isset( $_POST[ 'sa_slide' . $slide2 . '_image_id' ] ) ) {
2986
+ $slide2_image_id = abs( intval( $_POST[ 'sa_slide' . $slide2 . '_image_id' ] ) );
2987
+ }
2988
+ if ( isset( $_POST[ 'sa_slide' . $slide2 . '_image_pos' ] ) ) {
2989
+ $slide2_image_pos = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide2 . '_image_pos' ] ) );
2990
+ }
2991
+ if ( isset( $_POST[ 'sa_slide' . $slide2 . '_image_size' ] ) ) {
2992
+ $slide2_image_size = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide2 . '_image_size' ] ) );
2993
+ }
2994
+ if ( isset( $_POST[ 'sa_slide' . $slide2 . '_image_repeat' ] ) ) {
2995
+ $slide2_image_repeat = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide2 . '_image_repeat' ] ) );
2996
+ }
2997
+ if ( isset( $_POST[ 'sa_slide' . $slide2 . '_image_color' ] ) ) {
2998
+ $slide2_image_color = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide2 . '_image_color' ] ) );
2999
+ }
3000
+ if ( isset( $_POST[ 'sa_slide' . $slide2 . '_link_url' ] ) ) {
3001
+ $slide2_link_url = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide2 . '_link_url' ] ) );
3002
+ }
3003
+ if ( isset( $_POST[ 'sa_slide' . $slide2 . '_link_target' ] ) ) {
3004
+ $slide2_link_target = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide2 . '_link_target' ] ) );
3005
+ }
3006
+ if ( $sa_pro_version ) {
3007
+ $slide2_popup_type = '';
3008
+ $slide2_popup_imageid = '';
3009
+ $slide2_popup_imagetitle = '';
3010
+ $slide2_popup_video_id = '';
3011
+ $slide2_popup_video_type = '';
3012
+ $slide2_popup_background = '';
3013
+ $slide2_popup_html = '';
3014
+ $slide2_popup_shortcode = '';
3015
+ $slide2_popup_bgcol = '';
3016
+ $slide2_popup_width = 0;
3017
+ if ( isset( $_POST[ 'sa_slide' . $slide2 . '_popup_type' ] ) ) {
3018
+ $slide2_popup_type = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide2 . '_popup_type' ] ) );
3019
+ }
3020
+ if ( isset( $_POST[ 'sa_slide' . $slide2 . '_popup_imageid' ] ) ) {
3021
+ $slide2_popup_imageid = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide2 . '_popup_imageid' ] ) );
3022
+ }
3023
+ if ( isset( $_POST[ 'sa_slide' . $slide2 . '_popup_imagetitle' ] ) ) {
3024
+ $slide2_popup_imagetitle = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide2 . '_popup_imagetitle' ] ) );
3025
+ }
3026
+ if ( isset( $_POST[ 'sa_slide' . $slide2 . '_popup_video_id' ] ) ) {
3027
+ $slide2_popup_video_id = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide2 . '_popup_video_id' ] ) );
3028
+ }
3029
+ if ( isset( $_POST[ 'sa_slide' . $slide2 . '_popup_video_type' ] ) ) {
3030
+ $slide2_popup_video_type = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide2 . '_popup_video_type' ] ) );
3031
+ }
3032
+ if ( isset( $_POST[ 'sa_slide' . $slide2 . '_popup_background' ] ) ) {
3033
+ $slide2_popup_background = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide2 . '_popup_background' ] ) );
3034
+ }
3035
+ if ( isset( $_POST[ 'sa_slide' . $slide2 . '_popup_html' ] ) ) {
3036
+ $slide2_popup_html = balanceTags( wp_kses_post( wp_unslash( $_POST[ 'sa_slide' . $slide2 . '_popup_html' ] ) ), true );
3037
+ }
3038
+ if ( isset( $_POST[ 'sa_slide' . $slide2 . '_popup_shortcode' ] ) ) {
3039
+ $slide2_popup_shortcode = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide2 . '_popup_shortcode' ] ) );
3040
+ }
3041
+ if ( isset( $_POST[ 'sa_slide' . $slide2 . '_popup_bgcol' ] ) ) {
3042
+ $slide2_popup_bgcol = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide2 . '_popup_bgcol' ] ) );
3043
+ }
3044
+ if ( isset( $_POST[ 'sa_slide' . $slide2 . '_popup_width' ] ) ) {
3045
+ $slide2_popup_width = abs( intval( $_POST[ 'sa_slide' . $slide2 . '_popup_width' ] ) );
3046
+ }
3047
+ }
3048
+ update_post_meta( $post->ID, 'sa_slide' . $slide2 . '_content', $slide1_content );
3049
+ $slide1_image_data = $slide1_image_id . '~' . $slide1_image_pos . '~' . $slide1_image_size . '~' . $slide1_image_repeat . '~' . $slide1_image_color;
3050
+ update_post_meta( $post->ID, 'sa_slide' . $slide2 . '_image_data', $slide1_image_data );
3051
+ update_post_meta( $post->ID, 'sa_slide' . $slide2 . '_link_url', $slide1_link_url );
3052
+ update_post_meta( $post->ID, 'sa_slide' . $slide2 . '_link_target', $slide1_link_target );
3053
+ if ( $sa_pro_version ) {
3054
+ update_post_meta( $post->ID, 'sa_slide' . $slide2 . '_popup_type', $slide1_popup_type );
3055
+ update_post_meta( $post->ID, 'sa_slide' . $slide2 . '_popup_imageid', $slide1_popup_imageid );
3056
+ update_post_meta( $post->ID, 'sa_slide' . $slide2 . '_popup_imagetitle', $slide1_popup_imagetitle );
3057
+ update_post_meta( $post->ID, 'sa_slide' . $slide2 . '_popup_video_id', $slide1_popup_video_id );
3058
+ update_post_meta( $post->ID, 'sa_slide' . $slide2 . '_popup_video_type', $slide1_popup_video_type );
3059
+ update_post_meta( $post->ID, 'sa_slide' . $slide2 . '_popup_background', $slide1_popup_background );
3060
+ update_post_meta( $post->ID, 'sa_slide' . $slide2 . '_popup_html', $slide1_popup_html );
3061
+ update_post_meta( $post->ID, 'sa_slide' . $slide2 . '_popup_shortcode', $slide1_popup_shortcode );
3062
+ update_post_meta( $post->ID, 'sa_slide' . $slide2 . '_popup_bgcol', $slide1_popup_bgcol );
3063
+ update_post_meta( $post->ID, 'sa_slide' . $slide2 . '_popup_width', $slide1_popup_width );
3064
+ }
3065
+ update_post_meta( $post->ID, 'sa_slide' . $slide1 . '_content', $slide2_content );
3066
+ $slide2_image_data = $slide2_image_id . '~' . $slide2_image_pos . '~' . $slide2_image_size . '~' . $slide2_image_repeat . '~' . $slide2_image_color;
3067
+ update_post_meta( $post->ID, 'sa_slide' . $slide1 . '_image_data', $slide2_image_data );
3068
+ update_post_meta( $post->ID, 'sa_slide' . $slide1 . '_link_url', $slide2_link_url );
3069
+ update_post_meta( $post->ID, 'sa_slide' . $slide1 . '_link_target', $slide2_link_target );
3070
+ if ( $sa_pro_version ) {
3071
+ update_post_meta( $post->ID, 'sa_slide' . $slide1 . '_popup_type', $slide2_popup_type );
3072
+ update_post_meta( $post->ID, 'sa_slide' . $slide1 . '_popup_imageid', $slide2_popup_imageid );
3073
+ update_post_meta( $post->ID, 'sa_slide' . $slide1 . '_popup_imagetitle', $slide2_popup_imagetitle );
3074
+ update_post_meta( $post->ID, 'sa_slide' . $slide1 . '_popup_video_id', $slide2_popup_video_id );
3075
+ update_post_meta( $post->ID, 'sa_slide' . $slide1 . '_popup_video_type', $slide2_popup_video_type );
3076
+ update_post_meta( $post->ID, 'sa_slide' . $slide1 . '_popup_background', $slide2_popup_background );
3077
+ update_post_meta( $post->ID, 'sa_slide' . $slide1 . '_popup_html', $slide2_popup_html );
3078
+ update_post_meta( $post->ID, 'sa_slide' . $slide1 . '_popup_shortcode', $slide2_popup_shortcode );
3079
+ update_post_meta( $post->ID, 'sa_slide' . $slide1 . '_popup_bgcol', $slide2_popup_bgcol );
3080
+ update_post_meta( $post->ID, 'sa_slide' . $slide1 . '_popup_width', $slide2_popup_width );
3081
+ }
3082
+ }
3083
+
3084
+ // UPDATE SLIDE CONTENT CHARACTER COUNT.
3085
+ $total_slides = get_post_meta( $post->ID, 'sa_num_slides', true );
3086
+ for ( $i = 1; $i <= $total_slides; $i++ ) {
3087
+ $slide_content = get_post_meta( $post->ID, 'sa_slide' . $i . '_content', true );
3088
+ $char_count = strlen( $slide_content );
3089
+ update_post_meta( $post->ID, 'sa_slide' . $i . '_char_count', $char_count );
3090
+ }
3091
+
3092
+ // UPDATE SLIDER SETTINGS.
3093
+ update_post_meta( $post->ID, 'sa_num_slides', abs( intval( $slides_saved ) ) );
3094
+ if ( isset( $_POST['sa_disable_visual_editor'] ) && ( '1' === $_POST['sa_disable_visual_editor'] ) ) {
3095
+ update_post_meta( $post->ID, 'sa_disable_visual_editor', '1' );
3096
+ } else {
3097
+ update_post_meta( $post->ID, 'sa_disable_visual_editor', '0' );
3098
+ }
3099
+ if ( isset( $_POST['sa_info_added'] ) ) {
3100
+ update_post_meta( $post->ID, 'sa_info_added', abs( intval( $_POST['sa_info_added'] ) ) );
3101
+ }
3102
+ if ( isset( $_POST['sa_info_deleted'] ) ) {
3103
+ update_post_meta( $post->ID, 'sa_info_deleted', abs( intval( $_POST['sa_info_deleted'] ) ) );
3104
+ }
3105
+ if ( isset( $_POST['sa_duplicate_slide'] ) ) {
3106
+ update_post_meta( $post->ID, 'sa_duplicate_slide', abs( intval( $_POST['sa_duplicate_slide'] ) ) );
3107
+ }
3108
+ if ( isset( $_POST['sa_info_duplicated'] ) ) {
3109
+ update_post_meta( $post->ID, 'sa_info_duplicated', abs( intval( $_POST['sa_info_duplicated'] ) ) );
3110
+ }
3111
+ if ( isset( $_POST['sa_move_slide_up'] ) ) {
3112
+ update_post_meta( $post->ID, 'sa_move_slide_up', abs( intval( $_POST['sa_move_slide_up'] ) ) );
3113
+ }
3114
+ if ( isset( $_POST['sa_info_moved'] ) ) {
3115
+ update_post_meta( $post->ID, 'sa_info_moved', abs( intval( $_POST['sa_info_moved'] ) ) );
3116
+ }
3117
+ if ( isset( $_POST['sa_slide_duration'] ) ) {
3118
+ update_post_meta( $post->ID, 'sa_slide_duration', abs( floatval( $_POST['sa_slide_duration'] ) ) );
3119
+ }
3120
+ if ( isset( $_POST['sa_slide_transition'] ) ) {
3121
+ update_post_meta( $post->ID, 'sa_slide_transition', abs( floatval( $_POST['sa_slide_transition'] ) ) );
3122
+ }
3123
+ if ( isset( $_POST['sa_slide_by'] ) ) {
3124
+ update_post_meta( $post->ID, 'sa_slide_by', abs( floatval( $_POST['sa_slide_by'] ) ) );
3125
+ }
3126
+ if ( isset( $_POST['sa_loop_slider'] ) && ( '1' === $_POST['sa_loop_slider'] ) ) {
3127
+ update_post_meta( $post->ID, 'sa_loop_slider', '1' );
3128
+ } else {
3129
+ update_post_meta( $post->ID, 'sa_loop_slider', '0' );
3130
+ }
3131
+ if ( isset( $_POST['sa_stop_hover'] ) && ( '1' === $_POST['sa_stop_hover'] ) ) {
3132
+ update_post_meta( $post->ID, 'sa_stop_hover', '1' );
3133
+ } else {
3134
+ update_post_meta( $post->ID, 'sa_stop_hover', '0' );
3135
+ }
3136
+ if ( isset( $_POST['sa_nav_arrows'] ) && ( '1' === $_POST['sa_nav_arrows'] ) ) {
3137
+ update_post_meta( $post->ID, 'sa_nav_arrows', '1' );
3138
+ } else {
3139
+ update_post_meta( $post->ID, 'sa_nav_arrows', '0' );
3140
+ }
3141
+ if ( isset( $_POST['sa_pagination'] ) && ( '1' === $_POST['sa_pagination'] ) ) {
3142
+ update_post_meta( $post->ID, 'sa_pagination', '1' );
3143
+ } else {
3144
+ update_post_meta( $post->ID, 'sa_pagination', '0' );
3145
+ }
3146
+ if ( isset( $_POST['sa_random_order'] ) && ( '1' === $_POST['sa_random_order'] ) ) {
3147
+ update_post_meta( $post->ID, 'sa_random_order', '1' );
3148
+ } else {
3149
+ update_post_meta( $post->ID, 'sa_random_order', '0' );
3150
+ }
3151
+ if ( isset( $_POST['sa_reverse_order'] ) && ( '1' === $_POST['sa_reverse_order'] ) ) {
3152
+ update_post_meta( $post->ID, 'sa_reverse_order', '1' );
3153
+ } else {
3154
+ update_post_meta( $post->ID, 'sa_reverse_order', '0' );
3155
+ }
3156
+ if ( isset( $_POST['sa_shortcodes'] ) && ( '1' === $_POST['sa_shortcodes'] ) ) {
3157
+ update_post_meta( $post->ID, 'sa_shortcodes', '1' );
3158
+ } else {
3159
+ update_post_meta( $post->ID, 'sa_shortcodes', '0' );
3160
+ }
3161
+ if ( isset( $_POST['sa_mouse_drag'] ) && ( '1' === $_POST['sa_mouse_drag'] ) ) {
3162
+ update_post_meta( $post->ID, 'sa_mouse_drag', '1' );
3163
+ } else {
3164
+ update_post_meta( $post->ID, 'sa_mouse_drag', '0' );
3165
+ }
3166
+ if ( isset( $_POST['sa_touch_drag'] ) && ( '1' === $_POST['sa_touch_drag'] ) ) {
3167
+ update_post_meta( $post->ID, 'sa_touch_drag', '1' );
3168
+ } else {
3169
+ update_post_meta( $post->ID, 'sa_touch_drag', '0' );
3170
+ }
3171
+ if ( isset( $_POST['sa_mousewheel'] ) && ( '1' === $_POST['sa_mousewheel'] ) ) {
3172
+ update_post_meta( $post->ID, 'sa_mousewheel', '1' );
3173
+ } else {
3174
+ update_post_meta( $post->ID, 'sa_mousewheel', '0' );
3175
+ }
3176
+ if ( isset( $_POST['sa_click_advance'] ) && ( '1' === $_POST['sa_click_advance'] ) ) {
3177
+ update_post_meta( $post->ID, 'sa_click_advance', '1' );
3178
+ } else {
3179
+ update_post_meta( $post->ID, 'sa_click_advance', '0' );
3180
+ }
3181
+ if ( isset( $_POST['sa_auto_height'] ) && ( '1' === $_POST['sa_auto_height'] ) ) {
3182
+ update_post_meta( $post->ID, 'sa_auto_height', '1' );
3183
+ } else {
3184
+ update_post_meta( $post->ID, 'sa_auto_height', '0' );
3185
+ }
3186
+ if ( isset( $_POST['sa_vert_center'] ) && ( '1' === $_POST['sa_vert_center'] ) ) {
3187
+ update_post_meta( $post->ID, 'sa_vert_center', '1' );
3188
+ } else {
3189
+ update_post_meta( $post->ID, 'sa_vert_center', '0' );
3190
+ }
3191
+
3192
+ // UPDATE SLIDER ITEMS DISPLAYED.
3193
+ if ( isset( $_POST['sa_items_width1'] ) ) {
3194
+ update_post_meta( $post->ID, 'sa_items_width1', abs( intval( $_POST['sa_items_width1'] ) ) );
3195
+ }
3196
+ if ( isset( $_POST['sa_items_width2'] ) ) {
3197
+ update_post_meta( $post->ID, 'sa_items_width2', abs( intval( $_POST['sa_items_width2'] ) ) );
3198
+ }
3199
+ if ( isset( $_POST['sa_items_width3'] ) ) {
3200
+ update_post_meta( $post->ID, 'sa_items_width3', abs( intval( $_POST['sa_items_width3'] ) ) );
3201
+ }
3202
+ if ( isset( $_POST['sa_items_width4'] ) ) {
3203
+ update_post_meta( $post->ID, 'sa_items_width4', abs( intval( $_POST['sa_items_width4'] ) ) );
3204
+ }
3205
+ if ( isset( $_POST['sa_items_width5'] ) ) {
3206
+ update_post_meta( $post->ID, 'sa_items_width5', abs( intval( $_POST['sa_items_width5'] ) ) );
3207
+ }
3208
+ if ( isset( $_POST['sa_items_width6'] ) ) {
3209
+ update_post_meta( $post->ID, 'sa_items_width6', abs( intval( $_POST['sa_items_width6'] ) ) );
3210
+ }
3211
+ if ( isset( $_POST['sa_transition'] ) ) {
3212
+ update_post_meta( $post->ID, 'sa_transition', sanitize_text_field( wp_unslash( $_POST['sa_transition'] ) ) );
3213
+ }
3214
+ if ( isset( $_POST['sa_hero_slider'] ) && ( '1' === $_POST['sa_hero_slider'] ) ) {
3215
+ update_post_meta( $post->ID, 'sa_hero_slider', '1' );
3216
+ } else {
3217
+ update_post_meta( $post->ID, 'sa_hero_slider', '0' );
3218
+ }
3219
+ if ( isset( $_POST['sa_showcase_slider'] ) && ( '1' === $_POST['sa_showcase_slider'] ) ) {
3220
+ update_post_meta( $post->ID, 'sa_showcase_slider', '1' );
3221
+ } else {
3222
+ update_post_meta( $post->ID, 'sa_showcase_slider', '0' );
3223
+ }
3224
+ if ( isset( $_POST['sa_showcase_width'] ) ) {
3225
+ update_post_meta( $post->ID, 'sa_showcase_width', abs( intval( $_POST['sa_showcase_width'] ) ) );
3226
+ }
3227
+ if ( isset( $_POST['sa_showcase_tablet'] ) && ( '1' === $_POST['sa_showcase_tablet'] ) ) {
3228
+ update_post_meta( $post->ID, 'sa_showcase_tablet', '1' );
3229
+ } else {
3230
+ update_post_meta( $post->ID, 'sa_showcase_tablet', '0' );
3231
+ }
3232
+ if ( isset( $_POST['sa_showcase_width_tab'] ) ) {
3233
+ update_post_meta( $post->ID, 'sa_showcase_width_tab', abs( intval( $_POST['sa_showcase_width_tab'] ) ) );
3234
+ }
3235
+ if ( isset( $_POST['sa_showcase_mobile'] ) && ( '1' === $_POST['sa_showcase_mobile'] ) ) {
3236
+ update_post_meta( $post->ID, 'sa_showcase_mobile', '1' );
3237
+ } else {
3238
+ update_post_meta( $post->ID, 'sa_showcase_mobile', '0' );
3239
+ }
3240
+ if ( isset( $_POST['sa_showcase_width_mob'] ) ) {
3241
+ update_post_meta( $post->ID, 'sa_showcase_width_mob', abs( intval( $_POST['sa_showcase_width_mob'] ) ) );
3242
+ }
3243
+
3244
+ // UPDATE SLIDER STYLE.
3245
+ if ( isset( $_POST['sa_css_id'] ) ) {
3246
+ $post_css_id = str_replace( '-', '_', sanitize_text_field( wp_unslash( $_POST['sa_css_id'] ) ) );
3247
+ update_post_meta( $post->ID, 'sa_css_id', sanitize_text_field( $post_css_id ) );
3248
+ }
3249
+ if ( isset( $_POST['sa_background_color'] ) ) {
3250
+ update_post_meta( $post->ID, 'sa_background_color', sanitize_text_field( wp_unslash( $_POST['sa_background_color'] ) ) );
3251
+ }
3252
+ if ( isset( $_POST['sa_border_width'] ) ) {
3253
+ update_post_meta( $post->ID, 'sa_border_width', abs( intval( $_POST['sa_border_width'] ) ) );
3254
+ }
3255
+ if ( isset( $_POST['sa_border_color'] ) ) {
3256
+ update_post_meta( $post->ID, 'sa_border_color', sanitize_text_field( wp_unslash( $_POST['sa_border_color'] ) ) );
3257
+ }
3258
+ if ( isset( $_POST['sa_border_radius'] ) ) {
3259
+ update_post_meta( $post->ID, 'sa_border_radius', abs( intval( $_POST['sa_border_radius'] ) ) );
3260
+ }
3261
+ if ( isset( $_POST['sa_wrapper_padd_top'] ) ) {
3262
+ update_post_meta( $post->ID, 'sa_wrapper_padd_top', abs( intval( $_POST['sa_wrapper_padd_top'] ) ) );
3263
+ }
3264
+ if ( isset( $_POST['sa_wrapper_padd_right'] ) ) {
3265
+ update_post_meta( $post->ID, 'sa_wrapper_padd_right', abs( intval( $_POST['sa_wrapper_padd_right'] ) ) );
3266
+ }
3267
+ if ( isset( $_POST['sa_wrapper_padd_bottom'] ) ) {
3268
+ update_post_meta( $post->ID, 'sa_wrapper_padd_bottom', abs( intval( $_POST['sa_wrapper_padd_bottom'] ) ) );
3269
+ }
3270
+ if ( isset( $_POST['sa_wrapper_padd_left'] ) ) {
3271
+ update_post_meta( $post->ID, 'sa_wrapper_padd_left', abs( intval( $_POST['sa_wrapper_padd_left'] ) ) );
3272
+ }
3273
+ if ( isset( $_POST['sa_slide_min_height_type'] ) && isset( $_POST['sa_slide_min_height'] ) ) {
3274
+ if ( 'px' === $_POST['sa_slide_min_height_type'] ) {
3275
+ update_post_meta( $post->ID, 'sa_slide_min_height_perc', sanitize_text_field( wp_unslash( $_POST['sa_slide_min_height'] ) ) . 'px' );
3276
+ } else {
3277
+ update_post_meta( $post->ID, 'sa_slide_min_height_perc', sanitize_text_field( wp_unslash( $_POST['sa_slide_min_height'] ) ) );
3278
+ }
3279
+ }
3280
+ if ( isset( $_POST['sa_slide_padding_tb'] ) ) {
3281
+ update_post_meta( $post->ID, 'sa_slide_padding_tb', abs( floatval( $_POST['sa_slide_padding_tb'] ) ) );
3282
+ }
3283
+ if ( isset( $_POST['sa_slide_padding_lr'] ) ) {
3284
+ update_post_meta( $post->ID, 'sa_slide_padding_lr', abs( floatval( $_POST['sa_slide_padding_lr'] ) ) );
3285
+ }
3286
+ if ( isset( $_POST['sa_slide_margin_lr'] ) ) {
3287
+ update_post_meta( $post->ID, 'sa_slide_margin_lr', abs( floatval( $_POST['sa_slide_margin_lr'] ) ) );
3288
+ }
3289
+ if ( isset( $_POST['sa_slide_icons_location'] ) ) {
3290
+ update_post_meta( $post->ID, 'sa_slide_icons_location', sanitize_text_field( wp_unslash( $_POST['sa_slide_icons_location'] ) ) );
3291
+ }
3292
+ if ( isset( $_POST['sa_slide_icons_color'] ) ) {
3293
+ update_post_meta( $post->ID, 'sa_slide_icons_color', sanitize_text_field( wp_unslash( $_POST['sa_slide_icons_color'] ) ) );
3294
+ }
3295
+ if ( isset( $_POST['sa_autohide_arrows'] ) && ( '1' === $_POST['sa_autohide_arrows'] ) ) {
3296
+ update_post_meta( $post->ID, 'sa_autohide_arrows', '1' );
3297
+ } else {
3298
+ update_post_meta( $post->ID, 'sa_autohide_arrows', '0' );
3299
+ }
3300
+ if ( isset( $_POST['sa_dot_per_slide'] ) && ( '1' === $_POST['sa_dot_per_slide'] ) ) {
3301
+ update_post_meta( $post->ID, 'sa_dot_per_slide', '1' );
3302
+ } else {
3303
+ update_post_meta( $post->ID, 'sa_dot_per_slide', '0' );
3304
+ }
3305
+ if ( isset( $_POST['sa_slide_icons_visible'] ) && ( '1' === $_POST['sa_slide_icons_visible'] ) ) {
3306
+ update_post_meta( $post->ID, 'sa_slide_icons_visible', '1' );
3307
+ } else {
3308
+ update_post_meta( $post->ID, 'sa_slide_icons_visible', '0' );
3309
+ }
3310
+ if ( isset( $_POST['sa_slide_icons_fullslide'] ) && ( '1' === $_POST['sa_slide_icons_fullslide'] ) ) {
3311
+ update_post_meta( $post->ID, 'sa_slide_icons_fullslide', '1' );
3312
+ } else {
3313
+ update_post_meta( $post->ID, 'sa_slide_icons_fullslide', '0' );
3314
+ }
3315
+
3316
+ // OTHER SETTINGS.
3317
+ $other_settings = '';
3318
+ if ( isset( $_POST['sa_window_onload'] ) && ( '1' === $_POST['sa_window_onload'] ) ) {
3319
+ $other_settings .= '1';
3320
+ } else {
3321
+ $other_settings .= '0';
3322
+ }
3323
+ $_POST['sa_strip_javascript'] = 0;
3324
+ if ( isset( $_POST['sa_strip_javascript'] ) && ( '1' === $_POST['sa_strip_javascript'] ) ) {
3325
+ $other_settings .= '|1';
3326
+ } else {
3327
+ $other_settings .= '|0';
3328
+ }
3329
+ if ( isset( $_POST['sa_lazy_load_images'] ) && ( '1' === $_POST['sa_lazy_load_images'] ) ) {
3330
+ $other_settings .= '|1';
3331
+ } else {
3332
+ $other_settings .= '|0';
3333
+ }
3334
+ if ( isset( $_POST['sa_ulli_containers'] ) && ( '1' === $_POST['sa_ulli_containers'] ) ) {
3335
+ $other_settings .= '|1';
3336
+ } else {
3337
+ $other_settings .= '|0';
3338
+ }
3339
+ if ( isset( $_POST['sa_rtl_slider'] ) && ( '1' === $_POST['sa_rtl_slider'] ) ) {
3340
+ $other_settings .= '|1';
3341
+ } else {
3342
+ $other_settings .= '|0';
3343
+ }
3344
+ if ( isset( $_POST['sa_disable_preview'] ) && ( '1' === $_POST['sa_disable_preview'] ) ) {
3345
+ $other_settings .= '|1';
3346
+ } else {
3347
+ $other_settings .= '|0';
3348
+ }
3349
+ if ( isset( $_POST['bg_image_size'] ) && ( '' !== $_POST['bg_image_size'] ) ) {
3350
+ $other_settings .= '|' . sanitize_text_field( wp_unslash( $_POST['bg_image_size'] ) );
3351
+ } else {
3352
+ $other_settings .= '|full';
3353
+ }
3354
+ if ( isset( $_POST['sa_disable_slide_ids'] ) && ( '1' === $_POST['sa_disable_slide_ids'] ) ) {
3355
+ $other_settings .= '|1';
3356
+ } else {
3357
+ $other_settings .= '|0';
3358
+ }
3359
+ update_post_meta( $post->ID, 'sa_other_settings', $other_settings );
3360
+ // starting slide number.
3361
+ if ( isset( $_POST['sa_start_pos'] ) ) {
3362
+ update_post_meta( $post->ID, 'sa_start_pos', abs( intval( $_POST['sa_start_pos'] ) ) );
3363
+ }
3364
+
3365
+ if ( $sa_pro_version ) {
3366
+ // THUMBNAIL PAGINATION.
3367
+ if ( isset( $_POST['sa_thumbs_active'] ) && ( '1' === $_POST['sa_thumbs_active'] ) ) {
3368
+ update_post_meta( $post->ID, 'sa_thumbs_active', '1' );
3369
+ } else {
3370
+ update_post_meta( $post->ID, 'sa_thumbs_active', '0' );
3371
+ }
3372
+ if ( isset( $_POST['sa_thumbs_location'] ) ) {
3373
+ update_post_meta( $post->ID, 'sa_thumbs_location', sanitize_text_field( wp_unslash( $_POST['sa_thumbs_location'] ) ) );
3374
+ }
3375
+ if ( isset( $_POST['sa_thumbs_image_size'] ) ) {
3376
+ update_post_meta( $post->ID, 'sa_thumbs_image_size', sanitize_text_field( wp_unslash( $_POST['sa_thumbs_image_size'] ) ) );
3377
+ }
3378
+ if ( isset( $_POST['sa_thumbs_padding'] ) ) {
3379
+ update_post_meta( $post->ID, 'sa_thumbs_padding', abs( floatval( $_POST['sa_thumbs_padding'] ) ) );
3380
+ }
3381
+ if ( isset( $_POST['sa_thumbs_width'] ) ) {
3382
+ update_post_meta( $post->ID, 'sa_thumbs_width', abs( intval( $_POST['sa_thumbs_width'] ) ) );
3383
+ }
3384
+ if ( isset( $_POST['sa_thumbs_height'] ) ) {
3385
+ update_post_meta( $post->ID, 'sa_thumbs_height', abs( intval( $_POST['sa_thumbs_height'] ) ) );
3386
+ }
3387
+ if ( isset( $_POST['sa_thumbs_opacity'] ) ) {
3388
+ update_post_meta( $post->ID, 'sa_thumbs_opacity', abs( intval( $_POST['sa_thumbs_opacity'] ) ) );
3389
+ }
3390
+ if ( isset( $_POST['sa_thumbs_border_width'] ) ) {
3391
+ update_post_meta( $post->ID, 'sa_thumbs_border_width', abs( intval( $_POST['sa_thumbs_border_width'] ) ) );
3392
+ }
3393
+ if ( isset( $_POST['sa_thumbs_border_color'] ) ) {
3394
+ update_post_meta( $post->ID, 'sa_thumbs_border_color', sanitize_text_field( wp_unslash( $_POST['sa_thumbs_border_color'] ) ) );
3395
+ }
3396
+ if ( isset( $_POST['sa_thumbs_resp_tablet'] ) ) {
3397
+ update_post_meta( $post->ID, 'sa_thumbs_resp_tablet', abs( intval( $_POST['sa_thumbs_resp_tablet'] ) ) );
3398
+ }
3399
+ if ( isset( $_POST['sa_thumbs_resp_mobile'] ) ) {
3400
+ update_post_meta( $post->ID, 'sa_thumbs_resp_mobile', abs( intval( $_POST['sa_thumbs_resp_mobile'] ) ) );
3401
+ }
3402
+ }
3403
+ }
3404
+ }
3405
+
3406
+ /**
3407
+ * ##### FUNCTION CHECKS WHETHER SLIDE ANYTHING PRO IS REGISTERED - RETURNS TRUE OR FALSE #####
3408
+ */
3409
+ function validate_slide_anything_pro_registration() {
3410
+ if ( ! function_exists( 'validate_slide_anything_pro_license_key' ) ) {
3411
+ return false;
3412
+ }
3413
+ $valid_key = validate_slide_anything_pro_license_key();
3414
+ return $valid_key;
3415
+ }
3416
+
3417
+
3418
+
3419
+ /**
3420
+ * ###################################################################################
3421
+ * ### FUNCTION DISPLAYS THE 'RE-ORDER SLIDES' SUB-PAGE IN THE WordPress DASHBOARD ###
3422
+ * ###################################################################################
3423
+ */
3424
+ function extra_sa_menu_pages() {
3425
+ add_submenu_page(
3426
+ 'edit.php?post_type=sa_slider',
3427
+ __( 'Re-Order Slides', 'menu-sa-order' ),
3428
+ __( 'Re-Order Slides', 'menu-sa-order' ),
3429
+ 'manage_options',
3430
+ 'reorderslides',
3431
+ 'sa_reorder_slides_page'
3432
+ );
3433
+ }
3434
+
3435
+ /**
3436
+ * ### FUNCTION CONTAINING THE 'RE-ORDER' SLIDES FUNCTIONALITY ###
3437
+ */
3438
+ function sa_reorder_slides_page() {
3439
+ $sa_pro_version = validate_slide_anything_pro_registration();
3440
+ $page_url = get_admin_url() . 'edit.php?post_type=sa_slider&page=reorderslides';
3441
+ $placeholder_image = get_site_url() . '/wp-content/plugins/slide-anything/images/bg_placeholder.png';
3442
+
3443
+ echo "<div id='sa_reorder_slides'>\n";
3444
+ echo '<h1>Slide Anything - Re-Order Slides</h1>';
3445
+
3446
+ if ( isset( $_SERVER['REQUEST_METHOD'] ) && ( 'POST' === $_SERVER['REQUEST_METHOD'] )
3447
+ && isset( $_POST['reorder_nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['reorder_nonce'] ) ), 'reorder_action' ) ) {
3448
+ // A POST VARIABLE FOR 'SLIDER ID' HAS BEEN PASSED.
3449
+ if ( isset( $_POST['sar_slider_id'] ) ) {
3450
+ $slider_id = sanitize_text_field( wp_unslash( $_POST['sar_slider_id'] ) );
3451
+ $slider_title = get_the_title( $slider_id );
3452
+ } else {
3453
+ exit();
3454
+ }
3455
+
3456
+ if ( isset( $_POST['sar_sort_order'] ) && ( '' !== $_POST['sar_sort_order'] ) ) {
3457
+ // CHANGE THE ORDER OF SLIDE DATA FOR THE SLIDER AND RE-SAVE METADATA.
3458
+ $sort_order = sanitize_text_field( wp_unslash( $_POST['sar_sort_order'] ) );
3459
+ $data_in_arr = array();
3460
+ $data_out_arr = array();
3461
+
3462
+ // 1) SAVE SLIDES METADATA TO AN 'IN' ARRAY (ONLY SLIDES MEATDATA AND NO SETTINGS DATA SAVED!).
3463
+ $metadata = get_metadata( 'post', $slider_id );
3464
+ $num_slides = $metadata['sa_num_slides'][0];
3465
+ foreach ( $metadata as $key => $value_arr ) {
3466
+ $value = $value_arr[0];
3467
+ for ( $i = 1; $i <= $num_slides; $i++ ) {
3468
+ $key_prefix = 'sa_slide' . $i . '_';
3469
+ if ( strpos( $key, $key_prefix ) === 0 ) {
3470
+ // metadata key starts with the key prefix ('sa_slide??').
3471
+ $data_in_arr[ $key ] = $value;
3472
+ }
3473
+ }
3474
+ }
3475
+
3476
+ // 2) CREATE THE NEW SLIDES 'OUT' ARRAY (WITH THE NEW SLIDE ORDER).
3477
+ $sort_order_arr = explode( ',', $sort_order );
3478
+ $count_order_arr = count( $sort_order_arr );
3479
+ for ( $i = 0; $i < $count_order_arr; $i++ ) {
3480
+ $loop_prefix = 'sa_slide' . ( $i + 1 ) . '_'; // ascending loop order (1, 2, 3...).
3481
+ $order_prefix = 'sa_slide' . $sort_order_arr[ $i ] . '_'; // slide number to be stored in this slot.
3482
+ foreach ( $data_in_arr as $key => $value ) {
3483
+ if ( strpos( $key, $order_prefix ) === 0 ) {
3484
+ // metakey key value starts with the order prefix.
3485
+ $new_key = str_replace( $order_prefix, $loop_prefix, $key );
3486
+ $data_out_arr[ $new_key ] = $value;
3487
+ }
3488
+ }
3489
+ }
3490
+
3491
+ // 3) LOOP THROUGH SLIDES 'OUT' ARRAY UPDATING POST METADATA.
3492
+ foreach ( $data_out_arr as $key => $value ) {
3493
+ update_post_meta( $slider_id, $key, $value );
3494
+ }
3495
+
3496
+ echo "<h3 id='sar_success_message'>SLIDE ORDER HAS BEEN UPDATED</h3>";
3497
+ } else {
3498
+ if ( isset( $_POST['sar_del_slides'] ) && ( '' !== $_POST['sar_del_slides'] ) ) {
3499
+ // DELETE ALL SLIDES WITH THE 'DELETE SLIDE' CHECKBOX CHECKED.
3500
+ $del_slides = sanitize_text_field( wp_unslash( $_POST['sar_del_slides'] ) );
3501
+ $del_slides_arr = explode( ',', $del_slides );
3502
+ $data_in_arr = array();
3503
+ $data_out_arr = array();
3504
+
3505
+ // 1) SAVE SLIDES METADATA TO AN 'IN' ARRAY (ONLY SLIDES MEATDATA AND NO SETTINGS DATA SAVED!).
3506
+ $metadata = get_metadata( 'post', $slider_id );
3507
+ $num_slides = $metadata['sa_num_slides'][0];
3508
+ foreach ( $metadata as $key => $value_arr ) {
3509
+ $value = $value_arr[0];
3510
+ for ( $i = 1; $i <= $num_slides; $i++ ) {
3511
+ $key_prefix = 'sa_slide' . $i . '_';
3512
+ if ( strpos( $key, $key_prefix ) === 0 ) {
3513
+ // metadata key starts with the key prefix ('sa_slide??').
3514
+ $data_in_arr[ $i ][ $key ] = $value;
3515
+ }
3516
+ }
3517
+ }
3518
+
3519
+ // 2) CREATE THE NEW SLIDES 'OUT' ARRAY (WITH THE DELETED SLIDES REMOVED)
3520
+ $curr_index = 0;
3521
+ $tot_del = 0;
3522
+ for ( $i = 1; $i <= $num_slides; $i++ ) {
3523
+ $loop_prefix = 'sa_slide' . $i . '_';
3524
+ $delete_yn = 0;
3525
+ $count_del_arr = count( $del_slides_arr );
3526
+ for ( $j = 0; $j < $count_del_arr; $j++ ) {
3527
+ if ( $i === $del_slides_arr[ $j ] ) {
3528
+ $delete_yn = 1;
3529
+ }
3530
+ }
3531
+ if ( 0 === $delete_yn ) {
3532
+ // current slide is NOT to be deleted - copy to 'out' array.
3533
+ $curr_index++;
3534
+ $curr_prefix = 'sa_slide' . $curr_index . '_';
3535
+ foreach ( $data_in_arr[ $i ] as $key => $value ) {
3536
+ $new_key = str_replace( $loop_prefix, $curr_prefix, $key );
3537
+ $data_out_arr[ $new_key ] = $value;
3538
+ }
3539
+ } else {
3540
+ $tot_del++;
3541
+ }
3542
+ }
3543
+
3544
+ // 3) LOOP THROUGH SLIDES 'OUT' ARRAY UPDATING POST METADATA.
3545
+ update_post_meta( $slider_id, 'sa_num_slides', $curr_index );
3546
+ foreach ( $data_out_arr as $key => $value ) {
3547
+ update_post_meta( $slider_id, $key, $value );
3548
+ }
3549
+
3550
+ if ( 1 === $tot_del ) {
3551
+ echo "<h3 id='sar_success_message'>" . esc_html( $tot_del ) . ' SLIDE HAS BEEN DELETED</h3>';
3552
+ } else {
3553
+ echo "<h3 id='sar_success_message'>" . esc_html( $tot_del ) . ' SLIDES HAVE BEEN DELETED</h3>';
3554
+ }
3555
+ }
3556
+ }
3557
+
3558
+ // GET REQUIRED SLIDER METADATA AND SAVE WITHIN AN ARRAY.
3559
+ $num_slides = 0;
3560
+ $slide_arr = array();
3561
+ $metadata = get_metadata( 'post', $slider_id );
3562
+ if ( count( $metadata ) > 0 ) {
3563
+ $num_slides = $metadata['sa_num_slides'][0];
3564
+ }
3565
+ if ( 0 !== $num_slides ) {
3566
+ // SLIDER CONTAINS SLIDES - DISPLAY SORTABLE LIST OF SLIDES.
3567
+ for ( $i = 1; $i <= $num_slides; $i++ ) {
3568
+ $image_data = $metadata[ 'sa_slide' . $i . '_image_data' ][0];
3569
+ $image_data_arr = explode( '~', $image_data );
3570
+ $slide_arr[ $i ]['image_id'] = $image_data_arr[0];
3571
+ $slide_arr[ $i ]['content'] = $metadata[ 'sa_slide' . $i . '_content' ][0];
3572
+ // cater for popup images used as the slide background.
3573
+ $popup_type = '';
3574
+ $popup_background = '';
3575
+ if ( ! $sa_pro_version ) {
3576
+ if ( isset( $metadata[ 'sa_slide' . $i . '_popup_type' ][0] ) ) {
3577
+ $popup_type = $metadata[ 'sa_slide' . $i . '_popup_type' ][0];
3578
+ }
3579
+ if ( isset( $metadata[ 'sa_slide' . $i . '_popup_background' ][0] ) ) {
3580
+ $popup_background = $metadata[ 'sa_slide' . $i . '_popup_background' ][0];
3581
+ }
3582
+ }
3583
+ if ( 'IMAGE' === $popup_type ) {
3584
+ if ( ( '' !== $popup_background ) && ( 'no' !== $popup_background ) ) {
3585
+ $slide_arr[ $i ]['image_id'] = $metadata[ 'sa_slide' . $i . '_popup_imageid' ][0];
3586
+ }
3587
+ }
3588
+ }
3589
+
3590
+ // DISPLAY THE SORTABLE GRID OF SLIDES.
3591
+ echo "<h2 id='sar_slider_title'>" . esc_html( $slider_title ) . "</h2>\n";
3592
+ echo "<h3 id='sar_drag_message'>Drag slides to re-order...</h3>\n";
3593
+ echo "<ul id='sar_sortable'>\n";
3594
+ for ( $i = 1; $i <= $num_slides; $i++ ) {
3595
+ $bg_image = $placeholder_image;
3596
+ $slide_image_src = wp_get_attachment_image_src( $slide_arr[ $i ]['image_id'], 'thumbnail' );
3597
+ if ( ! empty( $slide_image_src[0] ) ) {
3598
+ $bg_image = $slide_image_src[0];
3599
+ }
3600
+ echo "<li id='sar" . esc_attr( $i ) . "' class='ui-state-default'>\n";
3601
+ echo "<div class='sar_image' style='background-image:url(\"" . esc_url( $bg_image ) . "\");'></div>\n";
3602
+ echo "<div class='sar_content'>\n";
3603
+ echo "<h4 class='sar_slide_num'>SLIDE " . esc_html( $i ) . "</h4>\n";
3604
+ echo "<div class='sar_del_slide'>DELETE <span>SLIDE</span>";
3605
+ echo "<input type='checkbox' id='sar_del" . esc_attr( $i ) . "' name='sar_del" . esc_attr( $i ) . "' class='sar_del_checkbox'/>";
3606
+ echo "</div>\n";
3607
+ echo "<div class='sar_slide_html'>" . esc_html( nl2br( htmlentities( $slide_arr[ $i ]['content'] ) ) ) . "</div>\n";
3608
+ echo '</div>';
3609
+ echo "</li>\n";
3610
+ }
3611
+ echo "</ul>\n";
3612
+
3613
+ // DISPLAY THE HTML FORM CONTAINING THE SORT ORDER INPUT ELEMENT.
3614
+ echo "<form method='post' id='sar_order_form'>\n";
3615
+ wp_nonce_field( 'reorder_action', 'reorder_nonce' );
3616
+ echo "<input type='hidden' name='sar_slider_id' value='" . esc_attr( $slider_id ) . "'/>";
3617
+ echo "<input type='hidden' id='sar_sort_order' name='sar_sort_order'/>";
3618
+ echo "<input type='hidden' id='sar_del_slides' name='sar_del_slides'/>";
3619
+ echo "<input type='submit' id='sar_update_but' value='UPDATE ORDER'/>";
3620
+ echo "<input type='submit' id='sar_delete_but' value='DELETE SLIDES'/>";
3621
+ echo "</form>\n";
3622
+
3623
+ } else {
3624
+ // SLIDER CONTAINS NO SLIDES - DISPLAY MESSAGE.
3625
+ echo "<h3 id='sar_no_slides_found'>This slider contains NO slides!</h3>\n";
3626
+ echo "<a class='sar_back_button' href='" . esc_url( $page_url ) . "'>BACK</a>";
3627
+ }
3628
+ } else {
3629
+ // ##### NO POST VARIABLE FOR 'SLIDER ID' HAS BEEN PASSED #####
3630
+ // WP QUERY TO GET ARRAY OF SA SLIDERS (ID & TITLE) THAT EXIST.
3631
+ $slider_arr = array();
3632
+ $count = 0;
3633
+ $args = array(
3634
+ 'post_type' => 'sa_slider',
3635
+ 'post_status' => array( 'publish', 'draft' ),
3636
+ 'orderby' => 'menu_order',
3637
+ 'order' => 'ASC',
3638
+ 'posts_per_page' => -1,
3639
+ );
3640
+ $sliders = new WP_Query( $args );
3641
+ if ( $sliders->have_posts() ) {
3642
+ while ( $sliders->have_posts() ) {
3643
+ $sliders->the_post();
3644
+ $slider_arr[ $count ]['id'] = get_the_ID();
3645
+ $slider_arr[ $count ]['title'] = get_the_title();
3646
+ $count++;
3647
+ }
3648
+ }
3649
+ wp_reset_postdata();
3650
+
3651
+ if ( count( $slider_arr ) > 0 ) {
3652
+ // DISPLAY FORM CONTAINING SA SLIDER SELECT DROPDOWN.
3653
+ echo "<form method='post' id='sar_slider_form'>\n";
3654
+ wp_nonce_field( 'reorder_action', 'reorder_nonce' );
3655
+ echo "<p>This tool allows you to change the order of slides within a Slide Anything slider.</p>\n";
3656
+ echo "<p>Select the slider you would like to re-order, then just drag-and-drop slides for your new slide order.</p>\n";
3657
+ echo "<div style='padding-top:10px;'>Select Slider to Re-Order:<br/>";
3658
+ echo "<select id='sar_slider_id' name='sar_slider_id'>\n";
3659
+ $count_slider_arr = count( $slider_arr );
3660
+ for ( $i = 0; $i < $count_slider_arr; $i++ ) {
3661
+ echo '<h4>|' . esc_html( $slider_arr[ $i ]['id'] ) . '|' . esc_html( $slider_arr[ $i ]['title'] ) . '|</h4>';
3662
+ echo "<option value='" . esc_attr( $slider_arr[ $i ]['id'] ) . "'>" . esc_html( $slider_arr[ $i ]['title'] ) . ' (#' . esc_html( $slider_arr[ $i ]['id'] ) . ")</option>\n";
3663
+ }
3664
+ echo "<select></div>\n";
3665
+ echo "<div><input type='submit' value='Select Slider'/></div>\n";
3666
+ echo "</form>\n";
3667
+ } else {
3668
+ // NO SA SLIDERS FOUND - DISPLAY MESSAGE.
3669
+ echo "<h3 id='sar_no_sliders_found'>No Slide Anything sliders found!</h3>\n";
3670
+ }
3671
+ }
3672
+
3673
+ echo "</div>\n";
3674
+ }
3675
+
3676
+
3677
+ /**
3678
+ * ### FUNCTION CALLED BY 'template_include' FILTER TO USE A CUSTOM PAGE TERMPLATE FOR SA PREVIEW PAGE ###
3679
+ *
3680
+ * @param string $template Page Template.
3681
+ */
3682
+ function sa_preview_page_template( $template ) {
3683
+ if ( is_page( 'Slide Anything Popup Preview' ) ) {
3684
+ $template = dirname( __FILE__ ) . '/single-page.php';
3685
+ }
3686
+ return $template;
3687
+ }
3688
+
3689
+
3690
+ /**
3691
+ * ### FILTER TO ALLOW IFRAMES WITHIN SLIDE CONTENT ###
3692
+ *
3693
+ * @param array $allowedposttags Allowed Post Tags.
3694
+ */
3695
+ function slides_allow_iframes_filter( $allowedposttags ) {
3696
+ // Only change for users who can publish posts.
3697
+ if ( ! current_user_can( 'publish_posts' ) ) {
3698
+ return $allowedposttags;
3699
+ }
3700
+
3701
+ // Allow iframes and the following attributes.
3702
+ $allowedposttags['iframe'] = array(
3703
+ 'align' => true,
3704
+ 'width' => true,
3705
+ 'height' => true,
3706
+ 'frameborder' => true,
3707
+ 'name' => true,
3708
+ 'src' => true,
3709
+ 'title' => true,
3710
+ 'allow' => true,
3711
+ 'allowfullscreen' => true,
3712
+ 'id' => true,
3713
+ 'class' => true,
3714
+ 'style' => true,
3715
+ 'scrolling' => true,
3716
+ 'marginwidth' => true,
3717
+ 'marginheight' => true,
3718
+ );
3719
+ return $allowedposttags;
3720
+ }
3721
+ ?>
php/slide-anything-frontend.php CHANGED
@@ -1,1322 +1,1241 @@
1
- <?php
2
- // #####################################################################
3
- // ### SLIDE ANYTHING PLUGIN - PHP FUNCTIONS FOR WORDPRESS FRONT-END ###
4
- // #####################################################################
5
-
6
- add_shortcode('slide-anything', 'slide_anything_shortcode');
7
-
8
- /* ##### ROOT FUNCTION THAT IS CALLED TO BY THE 'slide-anything' SHORTCODE ##### */
9
- function slide_anything_shortcode($atts) {
10
- $sa_pro_version = esc_attr(get_option('sap_valid_license'));
11
- wp_enqueue_script('jquery');
12
- wp_register_script('owl_carousel_js', SA_PLUGIN_PATH.'owl-carousel/owl.carousel.min.js', array('jquery'), '2.2.1', true);
13
- wp_enqueue_script('owl_carousel_js');
14
- wp_register_style('owl_carousel_css', SA_PLUGIN_PATH.'owl-carousel/owl.carousel.css', array(), '2.2.1.1', 'all');
15
- wp_enqueue_style('owl_carousel_css');
16
- wp_register_style('owl_theme_css', SA_PLUGIN_PATH.'owl-carousel/sa-owl-theme.css', array(), '2.0', 'all');
17
- wp_enqueue_style('owl_theme_css');
18
- wp_register_style('owl_animate_css', SA_PLUGIN_PATH.'owl-carousel/animate.min.css', array(), '2.0', 'all');
19
- wp_enqueue_style('owl_animate_css');
20
- wp_register_script('mousewheel_js', SA_PLUGIN_PATH.'js/jquery.mousewheel.min.js', array('jquery'), '3.1.13', true);
21
- wp_enqueue_script('mousewheel_js');
22
- if ($sa_pro_version) {
23
- // JAVASCRIPT/CSS FOR MAGNIFIC POPUP
24
- wp_register_script('magnific-popup_js', SA_PLUGIN_PATH.'magnific-popup/jquery.magnific-popup.min.js', array('jquery'), '1.1.0', true);
25
- wp_enqueue_script('magnific-popup_js');
26
- wp_register_style('magnific-popup_css', SA_PLUGIN_PATH.'magnific-popup/magnific-popup.css', array(), '1.1.0', 'all');
27
- wp_enqueue_style('magnific-popup_css');
28
- wp_register_script('owl_thumbs_js', SA_PLUGIN_PATH.'owl-carousel/owl.carousel2.thumbs.min.js', array('jquery'), '0.1.8', true);
29
- wp_enqueue_script('owl_thumbs_js');
30
- }
31
-
32
- // EXTRACT SHORTCODE ATTRIBUTES
33
- extract(shortcode_atts(array(
34
- 'id' => 0,
35
- ), $atts));
36
- $output = '';
37
- if ($id == 0) {
38
- // SHORTCODE 'id' PARAMETER PROVIDED IS INVALID
39
- $output .= "<div id='sa_invalid_postid'>Slide Anything shortcode error: A valid ID has not been provided</div>\n";
40
- } else {
41
- $post_status = get_post_status($id);
42
- if ($post_status == 'publish') {
43
- $metadata = get_metadata('post', $id);
44
- $post_type = get_post_type($id);
45
- }
46
- if (($post_status != 'publish') || (count($metadata) == 0) || ($post_type != 'sa_slider')) {
47
- // SHORTCODE 'id' PARAMETER PROVIDED IS INVALID
48
- $output .= "<div id='sa_invalid_postid'>Slide Anything shortcode error: A valid ID has not been provided</div>\n";
49
- } else {
50
- // ### VALID 'id' PROVIDED - PROCESS SHORTCODE ###
51
- // GET SLIDE DATA FROM DATABASE AND SAVE IN ARRAY
52
- $slide_data = array();
53
- $slide_data['num_slides'] = $metadata['sa_num_slides'][0];
54
- $slide_data['shortcodes'] = $metadata['sa_shortcodes'][0];
55
- if ($slide_data['shortcodes'] == '1') {
56
- $slide_data['shortcodes'] = 'true';
57
- } else {
58
- $slide_data['shortcodes'] = 'false';
59
- }
60
- $slide_data['css_id'] = $metadata['sa_css_id'][0];
61
- for ($i = 1; $i <= $slide_data['num_slides']; $i++) {
62
- $slide_data["slide".$i."_num"] = $i;
63
- // apply 'the_content' filter to slide content to process any shortcodes
64
- if ($slide_data['shortcodes'] == 'true') {
65
- $slide_data["slide".$i."_content"] = do_shortcode($metadata["sa_slide".$i."_content"][0]);
66
- } else {
67
- $slide_data["slide".$i."_content"] = $metadata["sa_slide".$i."_content"][0];
68
- }
69
- $slide_image_data = '';
70
- if (isset($metadata["sa_slide".$i."_image_data"])) {
71
- $slide_image_data = $metadata["sa_slide".$i."_image_data"][0];
72
- }
73
- if (isset($slide_image_data) && ($slide_image_data != '')) {
74
- $data_arr = explode("~", $slide_image_data);
75
- $slide_data["slide".$i."_image_id"] = $data_arr[0];
76
- $slide_data["slide".$i."_image_pos"] = $data_arr[1];
77
- $slide_data["slide".$i."_image_size"] = $data_arr[2];
78
- $slide_data["slide".$i."_image_repeat"] = $data_arr[3];
79
- $slide_data["slide".$i."_image_color"] = $data_arr[4];
80
- } else {
81
- $slide_data["slide".$i."_image_id"] = $metadata["sa_slide".$i."_image_id"][0];
82
- $slide_data["slide".$i."_image_pos"] = $metadata["sa_slide".$i."_image_pos"][0];
83
- $slide_data["slide".$i."_image_size"] = $metadata["sa_slide".$i."_image_size"][0];
84
- $slide_data["slide".$i."_image_repeat"] = $metadata["sa_slide".$i."_image_repeat"][0];
85
- $slide_data["slide".$i."_image_color"] = $metadata["sa_slide".$i."_image_color"][0];
86
- }
87
- $slide_data["slide".$i."_link_url"] = $metadata["sa_slide".$i."_link_url"][0];
88
- $slide_data["slide".$i."_link_target"] = $metadata["sa_slide".$i."_link_target"][0];
89
- if ($slide_data["slide".$i."_link_target"] == '') {
90
- $slide_data["slide".$i."_link_target"] = '_self';
91
- }
92
- if ($sa_pro_version) {
93
- // ### PRO VERSION - GET POPUP DATA ###
94
- $slide_data["slide".$i."_popup_type"] = "NONE";
95
- $slide_data["slide".$i."_popup_imageid"] = "";
96
- $slide_data["slide".$i."_popup_imagetitle"] = "";
97
- $slide_data["slide".$i."_popup_video_id"] = "";
98
- $slide_data["slide".$i."_popup_video_type"] = "";
99
- $slide_data["slide".$i."_popup_html"] = "";
100
- $slide_data["slide".$i."_popup_shortcode"] = "";
101
- $slide_data["slide".$i."_popup_bgcol"] = "#ffffff";
102
- $slide_data["slide".$i."_popup_width"] = "600";
103
- if (isset($metadata["sa_slide".$i."_popup_type"])) {
104
- $slide_data["slide".$i."_popup_type"] = $metadata["sa_slide".$i."_popup_type"][0];
105
- }
106
- if (isset($metadata["sa_slide".$i."_popup_imageid"])) {
107
- $slide_data["slide".$i."_popup_imageid"] = $metadata["sa_slide".$i."_popup_imageid"][0];
108
- }
109
- if (isset($metadata["sa_slide".$i."_popup_imagetitle"])) {
110
- $slide_data["slide".$i."_popup_imagetitle"] = $metadata["sa_slide".$i."_popup_imagetitle"][0];
111
- }
112
- $slide_data["slide".$i."_popup_image"] = '';
113
- $slide_data["slide".$i."_popup_background"] = 'no';
114
- if ($slide_data["slide".$i."_popup_type"] == 'IMAGE') {
115
- if (($slide_data["slide".$i."_popup_imageid"] != '') && ($slide_data["slide".$i."_popup_imageid"] != 0)) {
116
- $popup_full_images = wp_get_attachment_image_src($slide_data["slide".$i."_popup_imageid"], 'full');
117
- $slide_data["slide".$i."_popup_image"] = $popup_full_images[0];
118
- $slide_data["slide".$i."_popup_background"] = $metadata["sa_slide".$i."_popup_background"][0];
119
- if ($slide_data["slide".$i."_popup_background"] == '') {
120
- $slide_data["slide".$i."_popup_background"] = 'no';
121
- }
122
- }
123
- }
124
- if (isset($metadata["sa_slide".$i."_popup_video_id"])) {
125
- $slide_data["slide".$i."_popup_video_id"] = $metadata["sa_slide".$i."_popup_video_id"][0];
126
- }
127
- if (isset($metadata["sa_slide".$i."_popup_video_type"])) {
128
- $slide_data["slide".$i."_popup_video_type"] = $metadata["sa_slide".$i."_popup_video_type"][0];
129
- }
130
- if (isset($metadata["sa_slide".$i."_popup_html"])) {
131
- $slide_data["slide".$i."_popup_html"] = $metadata["sa_slide".$i."_popup_html"][0];
132
- }
133
- if (isset($metadata["sa_slide".$i."_popup_shortcode"])) {
134
- $slide_data["slide".$i."_popup_shortcode"] = $metadata["sa_slide".$i."_popup_shortcode"][0];
135
- }
136
- if (isset($metadata["sa_slide".$i."_popup_bgcol"])) {
137
- $slide_data["slide".$i."_popup_bgcol"] = $metadata["sa_slide".$i."_popup_bgcol"][0];
138
- }
139
- if (isset($metadata["sa_slide".$i."_popup_width"])) {
140
- $slide_data["slide".$i."_popup_width"] = $metadata["sa_slide".$i."_popup_width"][0];
141
- }
142
- if ($slide_data["slide".$i."_popup_type"] == 'HTML') {
143
- $slide_data["slide".$i."_popup_css_id"] = $slide_data['css_id']."_popup".$i;
144
- } else {
145
- $slide_data["slide".$i."_popup_css_id"] = '';
146
- }
147
- }
148
- }
149
- $slide_data['slide_duration'] = floatval($metadata['sa_slide_duration'][0]) * 1000;
150
- $slide_data['slide_transition'] = floatval($metadata['sa_slide_transition'][0]) * 1000;
151
- if (isset($metadata['sa_slide_by'][0]) && ($metadata['sa_slide_by'][0] != '')) {
152
- $slide_data['slide_by'] = $metadata['sa_slide_by'][0];
153
- if ($slide_data['slide_by'] == '0') {
154
- $slide_data['slide_by'] = 'page';
155
- }
156
- } else {
157
- $slide_data['slide_by'] = 1;
158
- }
159
- $slide_data['loop_slider'] = $metadata['sa_loop_slider'][0];
160
- if ($slide_data['loop_slider'] == '1') {
161
- $slide_data['loop_slider'] = 'true';
162
- } else {
163
- $slide_data['loop_slider'] = 'false';
164
- }
165
- $slide_data['stop_hover'] = $metadata['sa_stop_hover'][0];
166
- if ($slide_data['stop_hover'] == '1') {
167
- $slide_data['stop_hover'] = 'true';
168
- } else {
169
- $slide_data['stop_hover'] = 'false';
170
- }
171
- $slide_data['random_order'] = $metadata['sa_random_order'][0];
172
- if ($slide_data['random_order'] == '1') {
173
- $slide_data['random_order'] = 'true';
174
- } else {
175
- $slide_data['random_order'] = 'false';
176
- }
177
- $slide_data['reverse_order'] = $metadata['sa_reverse_order'][0];
178
- if ($slide_data['reverse_order'] == '1') {
179
- $slide_data['reverse_order'] = 'true';
180
- } else {
181
- $slide_data['reverse_order'] = 'false';
182
- }
183
- $slide_data['nav_arrows'] = $metadata['sa_nav_arrows'][0];
184
- if ($slide_data['nav_arrows'] == '1') {
185
- $slide_data['nav_arrows'] = 'true';
186
- } else {
187
- $slide_data['nav_arrows'] = 'false';
188
- }
189
- $slide_data['pagination'] = $metadata['sa_pagination'][0];
190
- if ($slide_data['pagination'] == '1') {
191
- $slide_data['pagination'] = 'true';
192
- } else {
193
- $slide_data['pagination'] = 'false';
194
- }
195
- $slide_data['mouse_drag'] = $metadata['sa_mouse_drag'][0];
196
- if ($slide_data['mouse_drag'] == '1') {
197
- $slide_data['mouse_drag'] = 'true';
198
- } else {
199
- $slide_data['mouse_drag'] = 'false';
200
- }
201
- $slide_data['touch_drag'] = $metadata['sa_touch_drag'][0];
202
- if ($slide_data['touch_drag'] == '1') {
203
- $slide_data['touch_drag'] = 'true';
204
- } else {
205
- $slide_data['touch_drag'] = 'false';
206
- }
207
- if (isset($metadata['sa_mousewheel'])) {
208
- $slide_data['mousewheel'] = $metadata['sa_mousewheel'][0];
209
- if ($slide_data['mousewheel'] == '1') {
210
- $slide_data['mousewheel'] = 'true';
211
- } else {
212
- $slide_data['mousewheel'] = 'false';
213
- }
214
- } else {
215
- $slide_data['mousewheel'] = 'false';
216
- }
217
- if (isset($metadata['sa_click_advance'])) {
218
- $slide_data['click_advance'] = $metadata['sa_click_advance'][0];
219
- if ($slide_data['click_advance'] == '1') {
220
- $slide_data['click_advance'] = 'true';
221
- } else {
222
- $slide_data['click_advance'] = 'false';
223
- }
224
- } else {
225
- $slide_data['click_advance'] = 'false';
226
- }
227
- if (isset($metadata['sa_auto_height'])) {
228
- $slide_data['auto_height'] = $metadata['sa_auto_height'][0];
229
- if ($slide_data['auto_height'] == '1') {
230
- $slide_data['auto_height'] = 'true';
231
- } else {
232
- $slide_data['auto_height'] = 'false';
233
- }
234
- } else {
235
- $slide_data['auto_height'] = 'false';
236
- }
237
- if (($metadata['sa_slide_min_height_perc'][0] == '0') || ($metadata['sa_slide_min_height_perc'][0] == '0px')) {
238
- $slide_data['vert_center'] = 'false';
239
- } else {
240
- if (isset($metadata['sa_vert_center'])) {
241
- $slide_data['vert_center'] = $metadata['sa_vert_center'][0];
242
- if ($slide_data['vert_center'] == '1') {
243
- $slide_data['vert_center'] = 'true';
244
- } else {
245
- $slide_data['vert_center'] = 'false';
246
- }
247
- } else {
248
- $slide_data['vert_center'] = 'false';
249
- }
250
- }
251
- $slide_data['items_width1'] = $metadata['sa_items_width1'][0];
252
- $slide_data['items_width2'] = $metadata['sa_items_width2'][0];
253
- $slide_data['items_width3'] = $metadata['sa_items_width3'][0];
254
- $slide_data['items_width4'] = $metadata['sa_items_width4'][0];
255
- $slide_data['items_width5'] = $metadata['sa_items_width5'][0];
256
- $slide_data['items_width6'] = $metadata['sa_items_width6'][0];
257
- if ($slide_data['items_width6'] == '') {
258
- $slide_data['items_width6'] = $slide_data['items_width5'];
259
- }
260
- $slide_data['transition'] = $metadata['sa_transition'][0];
261
- $slide_data['background_color'] = $metadata['sa_background_color'][0];
262
- $slide_data['border_width'] = $metadata['sa_border_width'][0];
263
- $slide_data['border_color'] = $metadata['sa_border_color'][0];
264
- $slide_data['border_radius'] = $metadata['sa_border_radius'][0];
265
- $slide_data['wrapper_padd_top'] = $metadata['sa_wrapper_padd_top'][0];
266
- $slide_data['wrapper_padd_right'] = $metadata['sa_wrapper_padd_right'][0];
267
- $slide_data['wrapper_padd_bottom'] = $metadata['sa_wrapper_padd_bottom'][0];
268
- $slide_data['wrapper_padd_left'] = $metadata['sa_wrapper_padd_left'][0];
269
- $slide_data['slide_min_height_perc'] = $metadata['sa_slide_min_height_perc'][0];
270
- $slide_data['slide_padding_tb'] = $metadata['sa_slide_padding_tb'][0];
271
- $slide_data['slide_padding_lr'] = $metadata['sa_slide_padding_lr'][0];
272
- $slide_data['slide_margin_lr'] = $metadata['sa_slide_margin_lr'][0];
273
- $slide_data['slide_icons_location'] = $metadata['sa_slide_icons_location'][0];
274
- $slide_data['autohide_arrows'] = $metadata['sa_autohide_arrows'][0];
275
- if ($slide_data['autohide_arrows'] == '1') {
276
- $slide_data['autohide_arrows'] = 'true';
277
- } else {
278
- $slide_data['autohide_arrows'] = 'false';
279
- }
280
- $slide_data['dot_per_slide'] = '0';
281
- if (isset($metadata['sa_dot_per_slide'])) {
282
- $slide_data['dot_per_slide'] = $metadata['sa_dot_per_slide'][0];
283
- if ($slide_data['dot_per_slide'] != '1') {
284
- $slide_data['dot_per_slide'] = '0';
285
- }
286
- } else {
287
- $slide_data['dot_per_slide'] = '0';
288
- }
289
- $slide_data['slide_icons_visible'] = $metadata['sa_slide_icons_visible'][0];
290
- if ($slide_data['slide_icons_visible'] == '1') {
291
- $slide_data['slide_icons_visible'] = 'true';
292
- } else {
293
- $slide_data['slide_icons_visible'] = 'false';
294
- }
295
- $slide_data['slide_icons_color'] = $metadata['sa_slide_icons_color'][0];
296
- if ($slide_data['slide_icons_color'] != 'black') {
297
- $slide_data['slide_icons_color'] = 'white';
298
- }
299
- if (isset($metadata['sa_slide_icons_fullslide'][0]) &&
300
- ($metadata['sa_slide_icons_fullslide'][0] == 1)) {
301
- $slide_data['slide_icons_fullslide'] = '1';
302
- } else {
303
- $slide_data['slide_icons_fullslide'] = '0';
304
- }
305
- // FETCH OTHER SETTINGS POST META
306
- $other_settings = '';
307
- if (isset($metadata['sa_other_settings'])) {
308
- $other_settings = $metadata['sa_other_settings'][0];
309
- if (isset($other_settings) && ($other_settings != '')) {
310
- $other_settings_arr = explode("|", $other_settings);
311
- }
312
- }
313
- // setting 1 - sa_window_onload
314
- $slide_data['sa_window_onload'] = '0';
315
- if (isset($other_settings_arr) && ($other_settings_arr[0] != '')) {
316
- $slide_data['sa_window_onload'] = $other_settings_arr[0];
317
- } else {
318
- if (isset($metadata['sa_window_onload'])) {
319
- $slide_data['sa_window_onload'] = $metadata['sa_window_onload'][0];
320
- if ($slide_data['sa_window_onload'] != '1') {
321
- $slide_data['sa_window_onload'] = '0';
322
- }
323
- }
324
- }
325
- // setting 2 - sa_strip_javascript
326
- $slide_data['strip_javascript'] = '0';
327
- if (isset($other_settings_arr) && ($other_settings_arr[1] != '')) {
328
- $slide_data['strip_javascript'] = $other_settings_arr[1];
329
- } else {
330
- if (isset($metadata['sa_strip_javascript'])) {
331
- $slide_data['strip_javascript'] = $metadata['sa_strip_javascript'][0];
332
- if ($slide_data['strip_javascript'] != '1') {
333
- $slide_data['strip_javascript'] = '0';
334
- }
335
- }
336
- }
337
- // setting 3 - sa_lazy_load_images
338
- $slide_data['lazy_load_images'] = '0';
339
- if (isset($other_settings_arr) && ($other_settings_arr[2] != '')) {
340
- $slide_data['lazy_load_images'] = $other_settings_arr[2];
341
- } else {
342
- if (isset($metadata['sa_lazy_load_images'])) {
343
- $slide_data['lazy_load_images'] = $metadata['sa_lazy_load_images'][0];
344
- if ($slide_data['lazy_load_images'] != '1') {
345
- $slide_data['lazy_load_images'] = '0';
346
- }
347
- }
348
- }
349
- // setting 4 - sa_ulli_containers
350
- $slide_data['ulli_containers'] = '0';
351
- if (isset($other_settings_arr) && ($other_settings_arr[3] != '')) {
352
- $slide_data['ulli_containers'] = $other_settings_arr[3];
353
- } else {
354
- if (isset($metadata['sa_ulli_containers'])) {
355
- $slide_data['ulli_containers'] = $metadata['sa_ulli_containers'][0];
356
- if ($slide_data['ulli_containers'] != '1') {
357
- $slide_data['ulli_containers'] = '0';
358
- }
359
- }
360
- }
361
- // setting 5 - sa_rtl_slider
362
- $slide_data['rtl_slider'] = '0';
363
- if (isset($other_settings_arr) && ($other_settings_arr[4] != '')) {
364
- $slide_data['rtl_slider'] = $other_settings_arr[4];
365
- }
366
- // setting 7 - bg_image_size
367
- $slide_data['bg_image_size'] = 'full';
368
- if (isset($other_settings_arr) && (count($other_settings_arr) > 6)) {
369
- if ($other_settings_arr[6] != '') {
370
- $slide_data['bg_image_size'] = $other_settings_arr[6];
371
- }
372
- }
373
- // setting 8 - disable_slide_ids
374
- $slide_data['disable_slide_ids'] = '0';
375
- if (isset($other_settings_arr) && (count($other_settings_arr) > 7)) {
376
- if ($other_settings_arr[7] != '') {
377
- $slide_data['disable_slide_ids'] = $other_settings_arr[7];
378
- }
379
- }
380
- // Start Position
381
- $slide_data['start_pos'] = 0;
382
- if (isset($metadata['sa_start_pos'])) {
383
- $slide_data['start_pos'] = $metadata['sa_start_pos'][0];
384
- if ($slide_data['start_pos'] != '') {
385
- $slide_data['start_pos'] = abs(intval($slide_data['start_pos']));
386
- if ($slide_data['start_pos'] > 0) {
387
- $slide_data['start_pos'] = $slide_data['start_pos'] - 1;
388
- }
389
- }
390
- }
391
-
392
- // hero slider and slider thumbnails
393
- $slide_data['hero_slider'] = '0';
394
- $slide_data['thumbs_active'] = '0';
395
- if ($sa_pro_version) {
396
- if (isset($metadata['sa_hero_slider'])) {
397
- $slide_data['hero_slider'] = $metadata['sa_hero_slider'][0];
398
- if ($slide_data['hero_slider'] != '1') {
399
- $slide_data['hero_slider'] = '0';
400
- }
401
- } else {
402
- $slide_data['hero_slider'] = '0';
403
- }
404
- if (isset($metadata['sa_thumbs_active'])) {
405
- $slide_data['thumbs_active'] = $metadata['sa_thumbs_active'][0];
406
- if ($slide_data['thumbs_active'] != '1') {
407
- $slide_data['thumbs_active'] = '0';
408
- }
409
- } else {
410
- $slide_data['thumbs_active'] = '0';
411
- }
412
- if (isset($metadata['sa_thumbs_location'])) {
413
- $slide_data['thumbs_location'] = $metadata['sa_thumbs_location'][0];
414
- } else {
415
- $slide_data['thumbs_location'] = 'inside_bottom';
416
- }
417
- if (isset($metadata['sa_thumbs_image_size'])) {
418
- $slide_data['thumbs_image_size'] = $metadata['sa_thumbs_image_size'][0];
419
- } else {
420
- $slide_data['thumbs_image_size'] = 'thumbnail';
421
- }
422
- if (isset($metadata['sa_thumbs_padding'])) {
423
- $slide_data['thumbs_padding'] = $metadata['sa_thumbs_padding'][0];
424
- } else {
425
- $slide_data['thumbs_padding'] = '3';
426
- }
427
- if (isset($metadata['sa_thumbs_width'])) {
428
- $slide_data['thumbs_width'] = $metadata['sa_thumbs_width'][0];
429
- } else {
430
- $slide_data['thumbs_width'] = '150';
431
- }
432
- if (isset($metadata['sa_thumbs_height'])) {
433
- $slide_data['thumbs_height'] = $metadata['sa_thumbs_height'][0];
434
- } else {
435
- $slide_data['thumbs_height'] = '85';
436
- }
437
- if (isset($metadata['sa_thumbs_opacity'])) {
438
- $slide_data['thumbs_opacity'] = $metadata['sa_thumbs_opacity'][0];
439
- } else {
440
- $slide_data['thumbs_opacity'] = '50';
441
- }
442
- if (isset($metadata['sa_thumbs_border_width'])) {
443
- $slide_data['thumbs_border_width'] = $metadata['sa_thumbs_border_width'][0];
444
- } else {
445
- $slide_data['thumbs_border_width'] = '0';
446
- }
447
- if (isset($metadata['sa_thumbs_border_color'])) {
448
- $slide_data['thumbs_border_color'] = $metadata['sa_thumbs_border_color'][0];
449
- } else {
450
- $slide_data['thumbs_border_color'] = '#ffffff';
451
- }
452
- if (isset($metadata['sa_thumbs_resp_tablet'])) {
453
- $slide_data['thumbs_resp_tablet'] = $metadata['sa_thumbs_resp_tablet'][0];
454
- } else {
455
- $slide_data['thumbs_resp_tablet'] = '75';
456
- }
457
- if (isset($metadata['sa_thumbs_resp_mobile'])) {
458
- $slide_data['thumbs_resp_mobile'] = $metadata['sa_thumbs_resp_mobile'][0];
459
- } else {
460
- $slide_data['thumbs_resp_mobile'] = '50';
461
- }
462
- }
463
- // showcase carousel
464
- $slide_data['showcase_slider'] = '0';
465
- if ($sa_pro_version) {
466
- if (isset($metadata['sa_showcase_slider'])) {
467
- $slide_data['showcase_slider'] = $metadata['sa_showcase_slider'][0];
468
- if ($slide_data['showcase_slider'] != '1') {
469
- $slide_data['showcase_slider'] = '0';
470
- }
471
- } else {
472
- $slide_data['showcase_slider'] = '0';
473
- }
474
- if (isset($metadata['sa_showcase_width'])) {
475
- $slide_data['showcase_width'] = $metadata['sa_showcase_width'][0];
476
- } else {
477
- $slide_data['showcase_width'] = '120';
478
- }
479
- if (isset($metadata['sa_showcase_tablet'])) {
480
- $slide_data['showcase_tablet'] = $metadata['sa_showcase_tablet'][0];
481
- if ($slide_data['showcase_tablet'] != '1') {
482
- $slide_data['showcase_tablet'] = '0';
483
- }
484
- } else {
485
- $slide_data['showcase_tablet'] = '0';
486
- }
487
- if (isset($metadata['sa_showcase_width_tab'])) {
488
- $slide_data['showcase_width_tab'] = $metadata['sa_showcase_width_tab'][0];
489
- } else {
490
- $slide_data['showcase_width_tab'] = '130';
491
- }
492
- if (isset($metadata['sa_showcase_mobile'])) {
493
- $slide_data['showcase_mobile'] = $metadata['sa_showcase_mobile'][0];
494
- if ($slide_data['showcase_mobile'] != '1') {
495
- $slide_data['showcase_mobile'] = '0';
496
- }
497
- } else {
498
- $slide_data['showcase_mobile'] = '0';
499
- }
500
- if (isset($metadata['sa_showcase_width_mob'])) {
501
- $slide_data['showcase_width_mob'] = $metadata['sa_showcase_width_mob'][0];
502
- } else {
503
- $slide_data['showcase_width_mob'] = '140';
504
- }
505
- }
506
-
507
-
508
-
509
- // REVERSE THE ORDER OF THE SLIDES IF 'Random Order' CHECKBOX IS CHECKED OR
510
- // RE-ORDER SLIDES IN A RANDOM ORDER IF 'Random Order' CHECKBOX IS CHECKED
511
- if (($slide_data['reverse_order'] == 'true') || ($slide_data['random_order'] == 'true')) {
512
- $reorder_arr = array();
513
- for ($i = 1; $i <= $slide_data['num_slides']; $i++) {
514
- $reorder_arr[$i-1]['num'] = $slide_data["slide".$i."_num"];
515
- $reorder_arr[$i-1]['content'] = $slide_data["slide".$i."_content"];
516
- $reorder_arr[$i-1]['image_id'] = $slide_data["slide".$i."_image_id"];
517
- $reorder_arr[$i-1]['image_pos'] = $slide_data["slide".$i."_image_pos"];
518
- $reorder_arr[$i-1]['image_size'] = $slide_data["slide".$i."_image_size"];
519
- $reorder_arr[$i-1]['image_repeat'] = $slide_data["slide".$i."_image_repeat"];
520
- $reorder_arr[$i-1]['image_color'] = $slide_data["slide".$i."_image_color"];
521
- $reorder_arr[$i-1]['link_url'] = $slide_data["slide".$i."_link_url"];
522
- $reorder_arr[$i-1]['link_target'] = $slide_data["slide".$i."_link_target"];
523
- if ($sa_pro_version) {
524
- $reorder_arr[$i-1]['popup_type'] = $slide_data["slide".$i."_popup_type"];
525
- $reorder_arr[$i-1]['popup_imageid'] = $slide_data["slide".$i."_popup_imageid"];
526
- $reorder_arr[$i-1]['popup_imagetitle'] = $slide_data["slide".$i."_popup_imagetitle"];
527
- $reorder_arr[$i-1]['popup_image'] = $slide_data["slide".$i."_popup_image"];
528
- $reorder_arr[$i-1]['popup_background'] = $slide_data["slide".$i."_popup_background"];
529
- $reorder_arr[$i-1]['popup_video_id'] = $slide_data["slide".$i."_popup_video_id"];
530
- $reorder_arr[$i-1]['popup_video_type'] = $slide_data["slide".$i."_popup_video_type"];
531
- $reorder_arr[$i-1]['popup_html'] = $slide_data["slide".$i."_popup_html"];
532
- $reorder_arr[$i-1]['popup_shortcode'] = $slide_data["slide".$i."_popup_shortcode"];
533
- $reorder_arr[$i-1]['popup_bgcol'] = $slide_data["slide".$i."_popup_bgcol"];
534
- $reorder_arr[$i-1]['popup_width'] = $slide_data["slide".$i."_popup_width"];
535
- $reorder_arr[$i-1]['popup_css_id'] = $slide_data["slide".$i."_popup_css_id"];
536
- }
537
- }
538
- if ($slide_data['random_order'] == 'true') {
539
- // SORT SLIDE ARRAY DATA IN A RANDOM ORDER
540
- shuffle($reorder_arr);
541
- } else {
542
- // REVERSE THE ORDER OF THE SLIDE DATA ARRAY
543
- $reverse_arr = array_reverse($reorder_arr);
544
- $reorder_arr = $reverse_arr;
545
- }
546
- for ($i = 1; $i <= $slide_data['num_slides']; $i++) {
547
- $slide_data["slide".$i."_num"] = $reorder_arr[$i-1]['num'];
548
- $slide_data["slide".$i."_content"] = $reorder_arr[$i-1]['content'];
549
- $slide_data["slide".$i."_image_id"] = $reorder_arr[$i-1]['image_id'];
550
- $slide_data["slide".$i."_image_pos"] = $reorder_arr[$i-1]['image_pos'];
551
- $slide_data["slide".$i."_image_size"] = $reorder_arr[$i-1]['image_size'];
552
- $slide_data["slide".$i."_image_repeat"] = $reorder_arr[$i-1]['image_repeat'];
553
- $slide_data["slide".$i."_image_color"] = $reorder_arr[$i-1]['image_color'];
554
- $slide_data["slide".$i."_link_url"] = $reorder_arr[$i-1]['link_url'];
555
- $slide_data["slide".$i."_link_target"] = $reorder_arr[$i-1]['link_target'];
556
- if ($sa_pro_version) {
557
- $slide_data["slide".$i."_popup_type"] = $reorder_arr[$i-1]['popup_type'];
558
- $slide_data["slide".$i."_popup_imageid"] = $reorder_arr[$i-1]['popup_imageid'];
559
- $slide_data["slide".$i."_popup_imagetitle"] = $reorder_arr[$i-1]['popup_imagetitle'];
560
- $slide_data["slide".$i."_popup_image"] = $reorder_arr[$i-1]['popup_image'];
561
- $slide_data["slide".$i."_popup_background"] = $reorder_arr[$i-1]['popup_background'];
562
- $slide_data["slide".$i."_popup_video_id"] = $reorder_arr[$i-1]['popup_video_id'];
563
- $slide_data["slide".$i."_popup_video_type"] = $reorder_arr[$i-1]['popup_video_type'];
564
- $slide_data["slide".$i."_popup_html"] = $reorder_arr[$i-1]['popup_html'];
565
- $slide_data["slide".$i."_popup_shortcode"] = $reorder_arr[$i-1]['popup_shortcode'];
566
- $slide_data["slide".$i."_popup_bgcol"] = $reorder_arr[$i-1]['popup_bgcol'];
567
- $slide_data["slide".$i."_popup_width"] = $reorder_arr[$i-1]['popup_width'];
568
- $slide_data["slide".$i."_popup_css_id"] = $reorder_arr[$i-1]['popup_css_id'];
569
- }
570
- }
571
- }
572
-
573
- // GENERATE HTML CODE FOR THE OWL CAROUSEL SLIDER
574
- $wrapper_style = "background:".$slide_data['background_color']."; ";
575
- $wrapper_style .= "border:solid ".$slide_data['border_width']."px ".$slide_data['border_color']."; ";
576
- $wrapper_style .= "border-radius:".$slide_data['border_radius']."px; ";
577
- $wrapper_style .= "padding:".$slide_data['wrapper_padd_top']."px ";
578
- $wrapper_style .= $slide_data['wrapper_padd_right']."px ";
579
- $wrapper_style .= $slide_data['wrapper_padd_bottom']."px ";
580
- $wrapper_style .= $slide_data['wrapper_padd_left']."px;";
581
- if ($slide_data['showcase_slider'] == '1') {
582
- $wrapper_style .= " overflow:hidden;";
583
- }
584
- $output .= "<div class='".$slide_data['slide_icons_color']."' style='".esc_attr($wrapper_style)."'>\n";
585
- $additional_classes = '';
586
- if ($slide_data['pagination'] == 'true') {
587
- if ($slide_data['autohide_arrows'] == 'true') {
588
- $additional_classes = "owl-pagination-true autohide-arrows";
589
- } else {
590
- $additional_classes = "owl-pagination-true";
591
- }
592
- } else {
593
- if ($slide_data['autohide_arrows'] == 'true') {
594
- $additional_classes = "autohide-arrows";
595
- }
596
- }
597
- // hero slider
598
- if ($slide_data['hero_slider'] == '1') {
599
- $additional_classes .= " sa_hero_slider";
600
- }
601
- $slider_style = "visibility:hidden;";
602
- // showcase slider
603
- if ($slide_data['showcase_slider'] == '1') {
604
- $left_perc = (intval($slide_data['showcase_width']) - 100) / 2;
605
- $slider_style .= " width:".$slide_data['showcase_width']."%;";
606
- $slider_style .= " left:-".$left_perc."%;";
607
- if ($slide_data['showcase_tablet'] == '1') {
608
- $left_perc_tab = (intval($slide_data['showcase_width_tab']) - 100) / 2;
609
- $slider_style .= " --widthtab:".$slide_data['showcase_width_tab']."%;";
610
- $slider_style .= " --lefttab:-".$left_perc_tab."%;";
611
- $additional_classes .= " showcase_tablet";
612
- } else {
613
- $additional_classes .= " showcase_hide_tablet";
614
- }
615
- if ($slide_data['showcase_mobile'] == '1') {
616
- $left_perc_mob = (intval($slide_data['showcase_width_mob']) - 100) / 2;
617
- $slider_style .= " --widthmob:".$slide_data['showcase_width_mob']."%;";
618
- $slider_style .= " --leftmob:-".$left_perc_mob."%;";
619
- $additional_classes .= " showcase_mobile";
620
- } else {
621
- $additional_classes .= " showcase_hide_mobile";
622
- }
623
- }
624
- $output .= "<div id='".esc_attr($slide_data['css_id'])."' class='owl-carousel sa_owl_theme ".$additional_classes."' ";
625
- $output .= "data-slider-id='".esc_attr($slide_data['css_id'])."' style='".$slider_style."'>\n";
626
- if ($sa_pro_version) {
627
- // PRO VERSION - INITIALISE VAIRABLES FOR MAGNIFIC POPUP
628
- $lightbox_function = "open_lightbox_gallery_".$slide_data['css_id'];
629
- $lightbox_gallery_id = "lightbox_button_".$slide_data['css_id'];
630
- $lightbox_count = 0;
631
- }
632
- for ($i = 1; $i <= $slide_data['num_slides']; $i++) {
633
- $slide_content = $slide_data["slide".$i."_content"];
634
- if ($slide_data['bg_image_size'] != 'full') {
635
- // use predefined wordpress image size (from 'other settings')
636
- $slide_image_src = wp_get_attachment_image_src($slide_data["slide".$i."_image_id"], $slide_data['bg_image_size']);
637
- } else {
638
- // use "full" wordpress image size
639
- $slide_image_src = wp_get_attachment_image_src($slide_data["slide".$i."_image_id"], 'full');
640
- }
641
- // SA PRO VERSION - USE POPUP IMAGE AS SLIDE BACKGROUND IMAGE (IF THIS OPTION SELECTED)
642
- if (($sa_pro_version) && ($slide_data["slide".$i."_popup_type"] == 'IMAGE')) {
643
- if (($slide_data["slide".$i."_popup_background"] != 'no') && ($slide_data["slide".$i."_popup_image"] != '')) {
644
- $slide_image_src = wp_get_attachment_image_src($slide_data["slide".$i."_popup_imageid"], $slide_data["slide".$i."_popup_background"]);
645
- }
646
- } elseif (($sa_pro_version) && ($slide_data["slide".$i."_popup_type"] == 'VIDEO')) {
647
- if ($slide_data["slide".$i."_popup_video_type"] == "youtube") {
648
- if ($slide_data["slide".$i."_image_id"] == '99999999') {
649
- $slide_image_src = array();
650
- $popup_video_id = $slide_data["slide".$i."_popup_video_id"];
651
- $slide_image_src[0] = "https://img.youtube.com/vi/".$popup_video_id."/hqdefault.jpg";
652
- }
653
- }
654
- }
655
- $slide_image_size = $slide_data["slide".$i."_image_size"];
656
- $slide_image_pos = $slide_data["slide".$i."_image_pos"];
657
- $slide_image_repeat = $slide_data["slide".$i."_image_repeat"];
658
- $slide_image_color = $slide_data["slide".$i."_image_color"];
659
- $slide_style = "padding:".$slide_data['slide_padding_tb']."% ".$slide_data['slide_padding_lr']."%; ";
660
- $slide_style .= "margin:0px ".$slide_data['slide_margin_lr']."%; ";
661
- if (!empty($slide_image_src[0])) {
662
- $slide_style .= "background-image:url(\"".$slide_image_src[0]."\"); ";
663
- $slide_style .= "background-position:".$slide_image_pos."; ";
664
- $slide_style .= "background-size:".$slide_image_size."; ";
665
- $slide_style .= "background-repeat:".$slide_image_repeat."; ";
666
- }
667
- if (!empty($slide_image_color) && ($slide_image_color != "rgba(0,0,0,0)")) {
668
- $slide_style .= "background-color:".$slide_image_color."; ";
669
- }
670
- if (strpos($slide_data['slide_min_height_perc'], 'px') !== false) {
671
- $slide_style .= "min-height:".$slide_data['slide_min_height_perc']."; ";
672
- }
673
-
674
- // BUILD SLIDE LINK HOVER BUTTON
675
- $link_output = '';
676
- if ($slide_data["slide".$i."_link_url"] != '') {
677
- // $link_title = "slide ".$slide_data["slide".$i."_num"]." link";
678
- $link_title = ""; // SET LINK TITLE TO BLANK - 03/01/2022
679
- $link_output = "<a class='sa_slide_link_icon' href='".$slide_data["slide".$i."_link_url"]."' ";
680
- $link_output .= "target='".$slide_data["slide".$i."_link_target"]."' ";
681
- $link_output .= "title='".$link_title."' aria-label='".$link_title."'></a>";
682
- }
683
-
684
- // BUILD POPUP HOVER BUTTON - PRO VERSION ONLY!
685
- $popup_output = '';
686
- if ($sa_pro_version) {
687
- if (($slide_data["slide".$i."_popup_type"] == 'IMAGE') && ($slide_data["slide".$i."_popup_image"] != '')) {
688
- $lightbox_count++;
689
- $popup_output = "<div class='sa_popup_zoom_icon' onClick='".$lightbox_function."(".$lightbox_count.");'></div>";
690
- }
691
- if (($slide_data["slide".$i."_popup_type"] == 'VIDEO') && ($slide_data["slide".$i."_popup_video_id"] != '')) {
692
- $lightbox_count++;
693
- $popup_output = "<div class='sa_popup_video_icon' onClick='".$lightbox_function."(".$lightbox_count.");'></div>";
694
- }
695
- if ($slide_data["slide".$i."_popup_type"] == 'HTML') {
696
- $lightbox_count++;
697
- $popup_output = "<div class='sa_popup_zoom_icon' onClick='".$lightbox_function."(".$lightbox_count.");'></div>";
698
- }
699
- }
700
-
701
- // DISPLAY SLIDE OUTPUT
702
- //$data_hash = $slide_data['css_id']."_slide".sprintf('%02d', $i);
703
- //$output .= "<div class='sa_hover_container' data-hash='".$data_hash."' style='".esc_attr($slide_style)."'>";
704
- $css_id = $slide_data['css_id']."_slide".sprintf('%02d', $slide_data["slide".$i."_num"]);
705
- if ($slide_data['disable_slide_ids'] == '1') {
706
- if ($slide_data['vert_center'] == 'true') {
707
- $output .= "<div class='".$css_id." sa_hover_container sa_vert_center_wrap' style='".esc_attr($slide_style)."'>";
708
- } else {
709
- $output .= "<div class='".$css_id." sa_hover_container' style='".esc_attr($slide_style)."'>";
710
- }
711
- } else {
712
- if ($slide_data['vert_center'] == 'true') {
713
- $output .= "<div id='".$css_id."' class='sa_hover_container sa_vert_center_wrap' style='".esc_attr($slide_style)."'>";
714
- } else {
715
- $output .= "<div id='".$css_id."' class='sa_hover_container' style='".esc_attr($slide_style)."'>";
716
- }
717
- }
718
- if (($link_output != '') || ($popup_output != '')) {
719
- if ($slide_data['slide_icons_location'] == 'Top Left') {
720
- // icons location - top left
721
- $style = "top:0px; left:0px; margin:0px;";
722
- } elseif ($slide_data['slide_icons_location'] == 'Top Center') {
723
- // icons location - top center
724
- if (($link_output != '') && ($popup_output != '')) { $hov_marginL = '-40px'; }
725
- else { $hov_marginL = '-20px'; }
726
- $style = "top:0px; left:50%; margin-left:".$hov_marginL.";";
727
- } elseif ($slide_data['slide_icons_location'] == 'Top Right') {
728
- // icons location - top right
729
- $style = "top:0px; right:0px; margin:0px;";
730
- } elseif ($slide_data['slide_icons_location'] == 'Bottom Left') {
731
- // icons location - bottom left
732
- $style = "bottom:0px; left:0px; margin:0px;";
733
- } elseif ($slide_data['slide_icons_location'] == 'Bottom Center') {
734
- // icons location - bottom center
735
- if (($link_output != '') && ($popup_output != '')) { $hov_marginL = '-40px'; }
736
- else { $hov_marginL = '-20px'; }
737
- $style = "bottom:0px; left:50%; margin-left:".$hov_marginL.";";
738
- } elseif ($slide_data['slide_icons_location'] == 'Bottom Right') {
739
- // icons location - bottom right
740
- $style = "bottom:0px; right:0px; margin:0px;";
741
- } else {
742
- // icons location - center center (default)
743
- if (($link_output != '') && ($popup_output != '')) { $hov_marginL = '-40px'; }
744
- else { $hov_marginL = '-20px'; }
745
- $style = "top:50%; left:50%; margin-top:-20px; margin-left:".$hov_marginL.";";
746
- }
747
- // check whether to display a 'full slide link' for this slide
748
- $full_slide_link = 0;
749
- if ((($link_output == '') && ($popup_output != '')) ||
750
- (($link_output != '') && ($popup_output == ''))) {
751
- if ($slide_data['slide_icons_fullslide'] == '1') {
752
- $full_slide_link = 1;
753
- }
754
- }
755
- if ($full_slide_link == 1) {
756
- // display full slide link
757
- $output .= "<div class='sa_hover_fullslide'>";
758
- } else {
759
- // display link buttons
760
- if ($slide_data['slide_icons_visible'] == 'true') {
761
- $output .= "<div class='sa_hover_buttons always_visible' style='".$style."'>";
762
- } else {
763
- $output .= "<div class='sa_hover_buttons' style='".$style."'>";
764
- }
765
- }
766
- if ($link_output != '') {
767
- $output .= $link_output;
768
- }
769
- if ($popup_output != '') {
770
- $output .= $popup_output;
771
- }
772
- $output .= "</div>\n"; // .sa_hover_buttons
773
- }
774
- if ($slide_data['strip_javascript'] == '1') {
775
- // strip JavaScript code (<script> tags) from slide content
776
- $slide_content = remove_javascript_from_content($slide_content);
777
- }
778
- // ##### REMOVE LAZY LOAD IMAGES FEATURE (WHICH IS NOW INCLUDED IN WP 5.5) #####
779
- /*
780
- if ($slide_data['lazy_load_images'] == '1') {
781
- // modify images (<img> tag) within slide content to enable owl carousel lazy load
782
- $slide_content = set_slide_images_to_lazy_load($slide_content);
783
- }
784
- */
785
- if ($slide_data['vert_center'] == 'true') {
786
- // vertically center content within each slide
787
- // (we do this by wrapping slide content in a '<div>' wrapper
788
- $slide_content = "<div class='sa_vert_center'>".$slide_content."</div>";
789
- }
790
- $output .= $slide_content."</div>\n"; // .sa_hover_container
791
- }
792
- $output .= "</div>\n"; // .owl-carousel
793
-
794
-
795
-
796
- // PRO VERSION - THUMBNAIL PAGINATION
797
- if (($sa_pro_version) && ($slide_data['thumbs_active'] == '1')) {
798
- $thumbs_loc = $slide_data['thumbs_location'];
799
- $thumbs_opacity = $slide_data['thumbs_opacity'] / 100;
800
- // thumbnail container - set style
801
- $thumbs_style = " padding:".$slide_data['thumbs_padding']."%;";
802
- if ($thumbs_loc == 'inside_left') {
803
- $thumbs_style .= "left:".$slide_data['thumbs_padding']."%; width:".$slide_data['thumbs_width']."px;";
804
- } elseif ($thumbs_loc == 'inside_right') {
805
- $thumbs_style .= "right:".$slide_data['thumbs_padding']."%; width:".$slide_data['thumbs_width']."px;";
806
- } elseif ($thumbs_loc == 'outside_bottom') {
807
- $thumbs_style .= " padding-bottom:0px;";
808
- }
809
- $add_classes = '';
810
- if ($slide_data['thumbs_resp_tablet'] == 0) { $add_classes .= ' sa_thumbs_hide_tablet'; }
811
- if ($slide_data['thumbs_resp_mobile'] == 0) { $add_classes .= ' sa_thumbs_hide_mobile'; }
812
- $output .= "<div id='".esc_attr($slide_data['css_id'])."_thumbs' class='sa_owl_thumbs_wrap sa_thumbs_".$thumbs_loc.$add_classes."' style='".$thumbs_style."'>";
813
- $output .= "<div class='owl-thumbs' data-slider-id='".esc_attr($slide_data['css_id'])."'>";
814
- for ($i = 1; $i <= $slide_data['num_slides']; $i++) {
815
- // get background image for the thumb (slide image background)
816
- if (($slide_data["slide".$i."_popup_type"] == 'IMAGE') &&
817
- ($slide_data["slide".$i."_popup_background"] != 'no') &&
818
- ($slide_data["slide".$i."_popup_image"] != '')) {
819
- $thumb_image_arr = wp_get_attachment_image_src($slide_data["slide".$i."_popup_imageid"], $slide_data["slide".$i."_popup_background"]);
820
- $thumb_image_src = $thumb_image_arr[0];
821
- } elseif (($slide_data["slide".$i."_popup_type"] == 'VIDEO') &&
822
- ($slide_data["slide".$i."_popup_video_type"] == "youtube") &&
823
- ($slide_data["slide".$i."_image_id"] == '99999999')) {
824
- $thumb_image_src = array();
825
- $popup_video_id = $slide_data["slide".$i."_popup_video_id"];
826
- $thumb_image_src = "https://img.youtube.com/vi/".$popup_video_id."/hqdefault.jpg";
827
- } elseif ($slide_data["slide".$i."_image_id"] != 0) {
828
- $thumb_image_src = wp_get_attachment_image_src($slide_data["slide".$i."_image_id"], $slide_data['thumbs_image_size']);
829
- $thumb_image_src = $thumb_image_src[0];
830
- } else {
831
- // use a placeholder image if slide has no background image
832
- $thumb_image_src = SA_PLUGIN_PATH."images/image_placeholder.jpg";
833
- }
834
- // thumbnail - set style
835
- $thumb_style = "background-image:url(\"".$thumb_image_src."\"); ";
836
- $thumb_style .= "width:".$slide_data['thumbs_width']."px; ";
837
- $thumb_style .= "height:".$slide_data['thumbs_height']."px; ";
838
- $thumb_style .= "background-position:".$slide_data["slide".$i."_image_pos"]."; ";
839
- $thumb_style .= "background-size:".$slide_data["slide".$i."_image_size"]."; ";
840
- $thumb_style .= "background-repeat:".$slide_data["slide".$i."_image_repeat"]."; ";
841
- $thumb_style .= "opacity:".$thumbs_opacity."; ";
842
- $thumb_style .= "border:solid ".$slide_data['thumbs_border_width']."px transparent";
843
- $output .= "<div class='owl-thumb-item' style='".$thumb_style."' title='Slide ".$i."'></div>";
844
- }
845
- $output .= "</div>"; // .sa_owl_thumbs
846
- $output .= "</div>\n"; // .sa_owl_thumbs_wrap
847
- }
848
-
849
-
850
-
851
- // SHOWCASE CAROUSEL - NAVIGATION CONTAINER
852
- if ($slide_data['showcase_slider'] == '1') {
853
- if ($slide_data['autohide_arrows'] == 'true') {
854
- $output .= "<div id='showcase_".esc_attr($id)."' class='showcase_nav owl-nav autohide_arrows'></div>\n";
855
- } else {
856
- $output .= "<div id='showcase_".esc_attr($id)."' class='showcase_nav owl-nav'></div>\n";
857
- }
858
- }
859
-
860
-
861
-
862
- $output .= "</div>\n"; // .white or .black
863
-
864
-
865
-
866
- // PRO VERSION - CREATE A (HIDDEN) DIV FOR EACH 'HTML' POPUP
867
- if ($sa_pro_version) {
868
- for ($i = 1; $i <= $slide_data['num_slides']; $i++) {
869
- if ($slide_data["slide".$i."_popup_type"] == 'HTML') {
870
- $popup_css_id = $slide_data["slide".$i."_popup_css_id"];
871
- $popup_bgcol = $slide_data["slide".$i."_popup_bgcol"];
872
- $popup_width = $slide_data["slide".$i."_popup_width"];
873
- $output .= "<div id='".$popup_css_id."' class='mfp-hide sa_custom_popup' ";
874
- $output .= "style='background:".$popup_bgcol."; max-width:".$popup_width."px;'>\n";
875
- if ($slide_data["slide".$i."_popup_shortcode"] == '1') {
876
- $output .= do_shortcode($slide_data["slide".$i."_popup_html"]);
877
- } else {
878
- $output .= $slide_data["slide".$i."_popup_html"];
879
- }
880
- $output .= "</div>\n";
881
- }
882
- }
883
- }
884
-
885
-
886
-
887
- // ### ENQUEUE JQUERY SCRIPT IF IT HAS NOT ALREADY BEEN LOADED ###
888
- if (!wp_script_is('jquery', 'done')) {
889
- wp_enqueue_script('jquery', false, array(), false, false);
890
- }
891
-
892
-
893
-
894
- // ### GENERATE JQUERY CODE FOR THE OWL CAROUSEL SLIDER ###
895
- if (($slide_data['items_width1'] == 1) && ($slide_data['items_width2'] == 1) && ($slide_data['items_width3'] == 1) &&
896
- ($slide_data['items_width4'] == 1) && ($slide_data['items_width5'] == 1) && ($slide_data['items_width6'] == 1)) {
897
- $single_item = 1;
898
- } else {
899
- $single_item = 0;
900
- }
901
-
902
- $output .= "<script type='text/javascript'>\n";
903
- if ($slide_data['sa_window_onload'] == '1') {
904
- $output .= " document.addEventListener('DOMContentLoaded', function() {\n";
905
- } else {
906
- $output .= " jQuery(document).ready(function() {\n";
907
- }
908
-
909
- // JQUERY CODE FOR OWN CAROUSEL
910
- $output .= " jQuery('#".esc_attr($slide_data['css_id'])."').owlCarousel({\n";
911
- if ($single_item == 1) {
912
- $output .= " items : 1,\n";
913
- if (($slide_data['transition'] == 'Fade') || ($slide_data['transition'] == 'fade')) {
914
- $output .= " animateOut : 'fadeOut',\n";
915
- } elseif (($slide_data['transition'] == 'Slide Down') || ($slide_data['transition'] == 'goDown')) {
916
- $output .= " animateOut : 'slideOutDown',\n";
917
- $output .= " animateIn : 'fadeIn',\n";
918
- } elseif ($slide_data['transition'] == 'Zoom In') {
919
- $output .= " animateOut : 'fadeOut',\n";
920
- $output .= " animateIn : 'zoomIn',\n";
921
- } elseif ($slide_data['transition'] == 'Zoom Out') {
922
- $output .= " animateOut : 'zoomOut',\n";
923
- $output .= " animateIn : 'fadeIn',\n";
924
- } elseif ($slide_data['transition'] == 'Flip Out X') {
925
- $output .= " animateOut : 'flipOutX',\n";
926
- $output .= " animateIn : 'fadeIn',\n";
927
- } elseif ($slide_data['transition'] == 'Flip Out Y') {
928
- $output .= " animateOut : 'flipOutY',\n";
929
- $output .= " animateIn : 'fadeIn',\n";
930
- } elseif ($slide_data['transition'] == 'Rotate Left') {
931
- $output .= " animateOut : 'rotateOutDownLeft',\n";
932
- $output .= " animateIn : 'fadeIn',\n";
933
- } elseif ($slide_data['transition'] == 'Rotate Right') {
934
- $output .= " animateOut : 'rotateOutDownRight',\n";
935
- $output .= " animateIn : 'fadeIn',\n";
936
- } elseif ($slide_data['transition'] == 'Bounce Out') {
937
- $output .= " animateOut : 'bounceOut',\n";
938
- $output .= " animateIn : 'fadeIn',\n";
939
- } elseif ($slide_data['transition'] == 'Roll Out') {
940
- $output .= " animateOut : 'rollOut',\n";
941
- $output .= " animateIn : 'fadeIn',\n";
942
- }
943
- $output .= " smartSpeed : ".esc_attr($slide_data['slide_transition']).",\n";
944
- } else {
945
- $output .= " responsive:{\n";
946
- $output .= " 0:{ items:".esc_attr($slide_data['items_width1'])." },\n";
947
- $output .= " 480:{ items:".esc_attr($slide_data['items_width2'])." },\n";
948
- $output .= " 768:{ items:".esc_attr($slide_data['items_width3'])." },\n";
949
- $output .= " 980:{ items:".esc_attr($slide_data['items_width4'])." },\n";
950
- $output .= " 1200:{ items:".esc_attr($slide_data['items_width5'])." },\n";
951
- $output .= " 1500:{ items:".esc_attr($slide_data['items_width6'])." }\n";
952
- $output .= " },\n";
953
- }
954
- if ($slide_data['slide_duration'] == 0) {
955
- $output .= " autoplay : false,\n";
956
- $output .= " autoplayHoverPause : false,\n";
957
- } else {
958
- $output .= " autoplay : true,\n";
959
- $output .= " autoplayTimeout : ".esc_attr($slide_data['slide_duration']).",\n";
960
- $output .= " autoplayHoverPause : ".esc_attr($slide_data['stop_hover']).",\n";
961
- }
962
- $output .= " smartSpeed : ".esc_attr($slide_data['slide_transition']).",\n";
963
- $output .= " fluidSpeed : ".esc_attr($slide_data['slide_transition']).",\n";
964
- $output .= " autoplaySpeed : ".esc_attr($slide_data['slide_transition']).",\n";
965
- $output .= " navSpeed : ".esc_attr($slide_data['slide_transition']).",\n";
966
- $output .= " dotsSpeed : ".esc_attr($slide_data['slide_transition']).",\n";
967
- if ($slide_data['dot_per_slide'] == '1') {
968
- $output .= " dotsEach : 1,\n";
969
- }
970
- $output .= " loop : ".esc_attr($slide_data['loop_slider']).",\n";
971
- $output .= " nav : ".esc_attr($slide_data['nav_arrows']).",\n";
972
- $output .= " navText : ['Previous','Next'],\n";
973
- if ($slide_data['showcase_slider'] == '1') {
974
- $output .= " navContainer : '#showcase_".esc_attr($id)."',\n";
975
- }
976
- $output .= " dots : ".esc_attr($slide_data['pagination']).",\n";
977
- $output .= " responsiveRefreshRate : 200,\n";
978
- if ($slide_data['slide_by'] == 'page') {
979
- $output .= " slideBy : 'page',\n";
980
- } else {
981
- $output .= " slideBy : ".esc_attr($slide_data['slide_by']).",\n";
982
- }
983
- $output .= " mergeFit : true,\n";
984
- $output .= " autoHeight : ".esc_attr($slide_data['auto_height']).",\n";
985
- if ($slide_data['lazy_load_images'] == '1') {
986
- $output .= " lazyLoad : true,\n";
987
- $output .= " lazyLoadEager: 1,\n";
988
- }
989
- if (($sa_pro_version) && ($slide_data['thumbs_active'] == '1')) {
990
- $output .= " thumbs : true,\n";
991
- $output .= " thumbsPrerendered : true,\n";
992
- }
993
- if ($slide_data['ulli_containers'] == '1') {
994
- $output .= " stageElement : 'ul',\n";
995
- $output .= " itemElement : 'li',\n";
996
- }
997
- if ($slide_data['rtl_slider'] == '1') {
998
- $output .= " rtl : true,\n";
999
- }
1000
-
1001
- if ($slide_data['start_pos'] != 0) {
1002
- $output .= " startPosition : ".$slide_data['start_pos'].",\n";
1003
- }
1004
- $output .= " mouseDrag : ".esc_attr($slide_data['mouse_drag']).",\n";
1005
- $output .= " touchDrag : ".esc_attr($slide_data['touch_drag'])."\n";
1006
- $output .= " });\n";
1007
-
1008
- // MAKE SLIDER VISIBLE (AFTER 'WINDOW ONLOAD' OR 'DOCUMENT READY' EVENT)
1009
- $output .= " jQuery('#".esc_attr($slide_data['css_id'])."').css('visibility', 'visible');\n";
1010
-
1011
- // JAVASCRIPT 'WINDOW RESIZE' EVENT TO SET CSS 'min-height' OF SLIDES WITHIN THIS SLIDER
1012
- if ($slide_data['hero_slider'] != '1') {
1013
- $slide_min_height = $slide_data['slide_min_height_perc'];
1014
- if (strpos($slide_min_height, 'px') !== false) {
1015
- $slide_min_height = 0;
1016
- }
1017
- if (($slide_min_height != '') && ($slide_min_height != '0')) {
1018
- $output .= " sa_resize_".esc_attr($slide_data['css_id'])."();\n"; // initial call of resize function
1019
- $output .= " window.addEventListener('resize', sa_resize_".esc_attr($slide_data['css_id']).");\n"; // create resize event
1020
- // RESIZE EVENT FUNCTION (to set slide CSS 'min-heigh')
1021
- $output .= " function sa_resize_".esc_attr($slide_data['css_id'])."() {\n";
1022
- // get slide min height setting
1023
- $output .= " var min_height = '".$slide_min_height."';\n";
1024
- // get window width
1025
- $output .= " var win_width = jQuery(window).width();\n";
1026
- $output .= " var slider_width = jQuery('#".esc_attr($slide_data['css_id'])."').width();\n";
1027
- // calculate slide width according to window width & number of slides
1028
- $output .= " if (win_width < 480) {\n";
1029
- $output .= " var slide_width = slider_width / ".esc_attr($slide_data['items_width1']).";\n";
1030
- $output .= " } else if (win_width < 768) {\n";
1031
- $output .= " var slide_width = slider_width / ".esc_attr($slide_data['items_width2']).";\n";
1032
- $output .= " } else if (win_width < 980) {\n";
1033
- $output .= " var slide_width = slider_width / ".esc_attr($slide_data['items_width3']).";\n";
1034
- $output .= " } else if (win_width < 1200) {\n";
1035
- $output .= " var slide_width = slider_width / ".esc_attr($slide_data['items_width4']).";\n";
1036
- $output .= " } else if (win_width < 1500) {\n";
1037
- $output .= " var slide_width = slider_width / ".esc_attr($slide_data['items_width5']).";\n";
1038
- $output .= " } else {\n";
1039
- $output .= " var slide_width = slider_width / ".esc_attr($slide_data['items_width6']).";\n";
1040
- $output .= " }\n";
1041
- $output .= " slide_width = Math.round(slide_width);\n";
1042
- // calculate CSS 'min-height' using the captured 'min-height' data settings for this slider
1043
- $output .= " var slide_height = '0';\n";
1044
- $output .= " if (min_height == 'aspect43') {\n";
1045
- $output .= " slide_height = (slide_width / 4) * 3;";
1046
- $output .= " slide_height = Math.round(slide_height);\n";
1047
- $output .= " } else if (min_height == 'aspect169') {\n";
1048
- $output .= " slide_height = (slide_width / 16) * 9;";
1049
- $output .= " slide_height = Math.round(slide_height);\n";
1050
- $output .= " } else {\n";
1051
- $output .= " slide_height = (slide_width / 100) * min_height;";
1052
- $output .= " slide_height = Math.round(slide_height);\n";
1053
- $output .= " }\n";
1054
- // set the slide 'min-height' css value
1055
- $output .= " jQuery('#".esc_attr($slide_data['css_id'])." .owl-item .sa_hover_container').css('min-height', slide_height+'px');\n";
1056
- $output .= " }\n";
1057
- }
1058
- }
1059
-
1060
-
1061
-
1062
- // JAVASCRIPT FOR SHOWCASE CAROUSELS ONLY
1063
- // DYNAMICALLY SET CLASS NAMES FOR LEFTMOST (FIRST) AND RIGHTMOST (LAST) ACTIVE (DISPLAYED) SLIDES
1064
- if ($slide_data['showcase_slider'] == '1') {
1065
- $output .= " set_first_last_active_classes('".esc_attr($slide_data['css_id'])."');\n";
1066
- $output .= " jQuery('#".esc_attr($slide_data['css_id'])."').on('translated.owl.carousel resized.owl.carousel', function(event) {\n";
1067
- $output .= " set_first_last_active_classes('".esc_attr($slide_data['css_id'])."');\n";
1068
- $output .= " });\n";
1069
- $output .= " function set_first_last_active_classes(css_id) {\n";
1070
- $output .= " var total = jQuery('#".esc_attr($slide_data['css_id'])." .owl-stage .owl-item.active').length;\n";
1071
- $output .= " jQuery('#".esc_attr($slide_data['css_id'])." .owl-stage .owl-item').removeClass('sc_partial');\n";
1072
- $output .= " jQuery('#".esc_attr($slide_data['css_id'])." .owl-stage .owl-item.active').each(function(index){\n";
1073
- $output .= " if (index === 0) {\n"; // this is the first active slide
1074
- $output .= " jQuery(this).addClass('sc_partial');\n";
1075
- $output .= " }\n";
1076
- $output .= " if (index === total - 1 && total > 1) {\n"; // this is the last active slide
1077
- $output .= " jQuery(this).addClass('sc_partial');\n";
1078
- $output .= " }\n";
1079
- $output .= " });\n";
1080
- $output .= " }\n";
1081
- }
1082
-
1083
-
1084
-
1085
- // JAVASCRIPT FOR 'CLICK TO ADVANCE' OPTION ONLY
1086
- if ($slide_data['click_advance'] == 'true') {
1087
- if (($slide_data['touch_drag'] == 'false') && ($slide_data['mouse_drag'] == 'false')) {
1088
- $output .= " var cta_".$id." = jQuery('#".esc_attr($slide_data['css_id'])."');\n";
1089
- $output .= " jQuery('#".esc_attr($slide_data['css_id'])."').click(function() {\n";
1090
- $output .= " cta_".$id.".trigger('next.owl.carousel');\n";
1091
- $output .= " });\n";
1092
- }
1093
- }
1094
-
1095
-
1096
-
1097
- // JAVASCRIPT FOR 'MOUSEWHEEL NAVIGATION' OPTION ONLY
1098
- if ($slide_data['mousewheel'] == 'true') {
1099
- $output .= " var mw_".$id." = jQuery('#".esc_attr($slide_data['css_id'])."');\n";
1100
- $output .= " mw_".$id.".on('mousewheel', '.owl-stage', function (e) {\n";
1101
- $output .= " if (e.deltaY>0) {\n";
1102
- $output .= " mw_".$id.".trigger('next.owl');\n";
1103
- $output .= " } else {\n";
1104
- $output .= " mw_".$id.".trigger('prev.owl');\n";
1105
- $output .= " }\n";
1106
- $output .= " e.preventDefault();\n";
1107
- $output .= " });\n";
1108
- }
1109
-
1110
-
1111
-
1112
- // JAVASCRIPT FOR 'SLIDE GOTO LINKS"
1113
- $output .= " var owl_goto = jQuery('#".esc_attr($slide_data['css_id'])."');\n";
1114
- for ($i = 1; $i <= $slide_data['num_slides']; $i++) {
1115
- $output .= " jQuery('.".esc_attr($slide_data['css_id'])."_goto".$i."').click(function(event){\n";
1116
- $output .= " owl_goto.trigger('to.owl.carousel', ".($i-1).");\n";
1117
- $output .= " });\n";
1118
- }
1119
-
1120
-
1121
-
1122
- // ### PRO VERSION - JQUERY/JAVASCRIPT CODE FOR THUMBNAIL PAGINATION ###
1123
- if (($sa_pro_version) && ($slide_data['thumbs_active'] == '1')) {
1124
-
1125
- // BORDER WIDTH IS SET - SET BORDER COLOUR TO THE ACTIVE THUMB
1126
- if ($slide_data['thumbs_border_width'] > 0) {
1127
- // set border colour of the active (first) thumb
1128
- $output .= " jQuery('#".esc_attr($slide_data['css_id'])."_thumbs .owl-thumbs .active').css('border-color', '".$slide_data['thumbs_border_color']."');\n";
1129
- $output .= " var owl = jQuery('#".esc_attr($slide_data['css_id'])."');\n";
1130
- // owl carousel change event - set border colour of the active thumb
1131
- $output .= " owl.on('changed.owl.carousel', function(event) {\n";
1132
- $output .= " jQuery('#".esc_attr($slide_data['css_id'])."_thumbs .owl-thumbs .owl-thumb-item').css('border-color', 'transparent');\n";
1133
- $output .= " jQuery('#".esc_attr($slide_data['css_id'])."_thumbs .owl-thumbs .active').css('border-color', '".$slide_data['thumbs_border_color']."');\n";
1134
- $output .= " })\n";
1135
- }
1136
-
1137
- // RESIZE WINDOW EVENT - RESIZE THUMBS WIDTH & HEIGHT DEPENDING ON WINDOW WIDTH BREAKPOINTS
1138
- $output .= " sa_resize_thumbs_".esc_attr($slide_data['css_id'])."();\n"; // initial call of resize function
1139
- $output .= " window.addEventListener('resize', sa_resize_thumbs_".esc_attr($slide_data['css_id']).");\n"; // create resize event
1140
- $output .= " function sa_resize_thumbs_".esc_attr($slide_data['css_id'])."() {\n";
1141
- $output .= " var win_width = jQuery(window).width();\n";
1142
- $output .= " var tablet_perc = parseFloat(".$slide_data['thumbs_resp_tablet']." / 100);\n";
1143
- $output .= " var mobile_perc = parseFloat(".$slide_data['thumbs_resp_mobile']." / 100);\n";
1144
- $output .= " var tablet_width = Math.round(".$slide_data['thumbs_width']." * tablet_perc) + 'px';\n";
1145
- $output .= " var tablet_height = Math.round(".$slide_data['thumbs_height']." * tablet_perc) + 'px';\n";
1146
- $output .= " var mobile_width = Math.round(".$slide_data['thumbs_width']." * mobile_perc) + 'px';\n";
1147
- $output .= " var mobile_height = Math.round(".$slide_data['thumbs_height']." * mobile_perc) + 'px';\n";
1148
- $output .= " if ((mobile_perc != 0) && (win_width < 768)) {\n";
1149
- $output .= " jQuery('#".esc_attr($slide_data['css_id'])."_thumbs .owl-thumbs .owl-thumb-item').css('width', mobile_width);\n";
1150
- $output .= " jQuery('#".esc_attr($slide_data['css_id'])."_thumbs .owl-thumbs .owl-thumb-item').css('height', mobile_height);\n";
1151
- $output .= " } else if ((tablet_perc != 0) && (win_width < 1000)) {\n";
1152
- $output .= " jQuery('#".esc_attr($slide_data['css_id'])."_thumbs .owl-thumbs .owl-thumb-item').css('width', tablet_width);\n";
1153
- $output .= " jQuery('#".esc_attr($slide_data['css_id'])."_thumbs .owl-thumbs .owl-thumb-item').css('height', tablet_height);\n";
1154
- $output .= " } else {\n";
1155
- $output .= " jQuery('#".esc_attr($slide_data['css_id'])."_thumbs .owl-thumbs .owl-thumb-item').css('width', '".$slide_data['thumbs_width']."px');\n";
1156
- $output .= " jQuery('#".esc_attr($slide_data['css_id'])."_thumbs .owl-thumbs .owl-thumb-item').css('height', '".$slide_data['thumbs_height']."px');\n";
1157
- $output .= " }\n";
1158
- // THUMBS POSITION 'Inside Left' or 'Inside Right' - RESIZE CONTAINER WIDTH DEPENDING ON WINDOW WIDTH BREAKPOINTS
1159
- if (($thumbs_loc == 'inside_left') || ($thumbs_loc == 'inside_right')) {
1160
- $output .= " if ((mobile_perc != 0) && (win_width < 768)) {\n";
1161
- $output .= " jQuery('#".esc_attr($slide_data['css_id'])."_thumbs').css('width', mobile_width);\n";
1162
- $output .= " jQuery('#".esc_attr($slide_data['css_id'])."_thumbs').css('height', mobile_height);\n";
1163
- $output .= " } else if ((tablet_perc != 0) && (win_width < 1000)) {\n";
1164
- $output .= " jQuery('#".esc_attr($slide_data['css_id'])."_thumbs').css('width', tablet_width);\n";
1165
- $output .= " jQuery('#".esc_attr($slide_data['css_id'])."_thumbs').css('height', tablet_height);\n";
1166
- $output .= " } else {\n";
1167
- $output .= " jQuery('#".esc_attr($slide_data['css_id'])."_thumbs').css('width', '".$slide_data['thumbs_width']."px');\n";
1168
- $output .= " jQuery('#".esc_attr($slide_data['css_id'])."_thumbs').css('height', '".$slide_data['thumbs_height']."px');\n";
1169
- $output .= " }\n";
1170
- }
1171
- $output .= " }\n";
1172
- }
1173
-
1174
- // CALL THE WINDOW RESIZE EVENT AFTER THE OWL CAROUSEL SLIDER HAS BEEN INITIALIZED
1175
- $output .= " var resize_".$id." = jQuery('.owl-carousel');\n";
1176
- $output .= " resize_".$id.".on('initialized.owl.carousel', function(e) {\n";
1177
- $output .= " if (typeof(Event) === 'function') {\n";
1178
- // modern browsers
1179
- $output .= " window.dispatchEvent(new Event('resize'));\n";
1180
- $output .= " } else {\n";
1181
- // for IE and other old browsers (causes deprecation warning on modern browsers)
1182
- $output .= " var evt = window.document.createEvent('UIEvents');\n";
1183
- $output .= " evt.initUIEvent('resize', true, false, window, 0);\n";
1184
- $output .= " window.dispatchEvent(evt);\n";
1185
- $output .= " }\n";
1186
- $output .= " });\n";
1187
- $output .= " });\n";
1188
- $output .= "</script>\n";
1189
-
1190
-
1191
-
1192
- // ### GENERATE JQUERY CODE FOR THE MAGNIFIC POPUP ###
1193
- if (($sa_pro_version) && ($lightbox_count > 0)) {
1194
- $output .= "<script type='text/javascript'>\n";
1195
- if ($slide_data['sa_window_onload'] == '1') {
1196
- $output .= "document.addEventListener('DOMContentLoaded', function() {\n";
1197
- } else {
1198
- $output .= "jQuery(document).ready(function() {\n";
1199
- }
1200
- $output .= " jQuery('#".$lightbox_gallery_id."').magnificPopup({\n";
1201
- $output .= " items: [\n";
1202
- $count = 0;
1203
- for ($i = 1; $i <= $slide_data['num_slides']; $i++) {
1204
- // LOOP THROUGH EACH SLIDE
1205
- if (($slide_data["slide".$i."_popup_type"] == 'IMAGE') && ($slide_data["slide".$i."_popup_image"] != '')) {
1206
- // SLIDE CONTAINS AN IMAGE POPUP
1207
- $img_url = $slide_data["slide".$i."_popup_image"];
1208
- $img_title = $slide_data["slide".$i."_popup_imagetitle"];
1209
- if ($img_title != '') {
1210
- $output .= " { src: '".esc_attr($img_url)."', title: '".esc_attr($img_title)."' }";
1211
- } else {
1212
- $output .= " { src: '".esc_attr($img_url)."' }";
1213
- }
1214
- $count++;
1215
- if ($count < $lightbox_count) { $output .= ",\n"; }
1216
- else { $output .= "\n"; }
1217
- }
1218
- if (($slide_data["slide".$i."_popup_type"] == 'VIDEO') && ($slide_data["slide".$i."_popup_video_id"] != '')) {
1219
- // SLIDE CONTAINS A VIDEO POPUP
1220
- $video_id = $slide_data["slide".$i."_popup_video_id"];
1221
- $video_type = $slide_data["slide".$i."_popup_video_type"];
1222
- if ($video_type == 'youtube') {
1223
- $video_url = "http://www.youtube.com/watch?v=".$video_id;
1224
- } elseif ($video_type == 'vimeo') {
1225
- $video_url = "http://vimeo.com/".$video_id;
1226
- }
1227
- $output .= " { src: '".esc_attr($video_url)."', type: 'iframe' }";
1228
- $count++;
1229
- if ($count < $lightbox_count) { $output .= ",\n"; }
1230
- else { $output .= "\n"; }
1231
- }
1232
- if ($slide_data["slide".$i."_popup_type"] == 'HTML') {
1233
- // SLIDE CONTAINS A HTML POPUP
1234
- $popup_css_id = "#".$slide_data["slide".$i."_popup_css_id"];
1235
- $output .= " { src: '".esc_attr($popup_css_id)."', type: 'inline' }";
1236
- $count++;
1237
- if ($count < $lightbox_count) { $output .= ",\n"; }
1238
- else { $output .= "\n"; }
1239
- }
1240
- }
1241
- $output .= " ],\n";
1242
- $output .= " gallery: { enabled: true, tCounter: '' },\n";
1243
- $output .= " mainClass: 'sa_popup',\n";
1244
- $output .= " closeBtnInside: true,\n";
1245
- $output .= " fixedContentPos: true,\n";
1246
- if ($slide_data['slide_duration'] != 0) {
1247
- $output .= " callbacks: {\n";
1248
- $output .= " open: function() {\n";
1249
- $output .= " jQuery('#".esc_attr($slide_data['css_id'])."').trigger('stop.owl.autoplay');\n";
1250
- $output .= " },\n";
1251
- $output .= " close: function() {\n";
1252
- $output .= " jQuery('#".esc_attr($slide_data['css_id'])."').trigger('play.owl.autoplay');\n";
1253
- $output .= " }\n";
1254
- $output .= " },\n";
1255
- }
1256
- $output .= " type: 'image'\n";
1257
- $output .= " });\n";
1258
- $output .= "});\n";
1259
-
1260
- // JAVASCRIPT FUNCTION WHICH OPENS THIS MAGNIFIC POPUP ON A SPECIFIED SLIDE
1261
- $output .= "function ".$lightbox_function."(slide) {\n";
1262
- $output .= " jQuery('#".$lightbox_gallery_id."').magnificPopup('open');\n";
1263
- $output .= " jQuery('#".$lightbox_gallery_id."').magnificPopup('goTo', slide-1);\n";
1264
- $output .= "}\n";
1265
- $output .= "</script>\n";
1266
-
1267
- // DIV CONTAINER WHICH HOLDS THIS MAGNIFIC POPUP CONTENT (HIDDEN)
1268
- $output .= "<div id='".$lightbox_gallery_id."' style='display:none;'></div>\n";
1269
- }
1270
- }
1271
- }
1272
- return $output;
1273
- }
1274
-
1275
-
1276
-
1277
- // ### STRIP JAVASCRIPT ('<script>' tags) FROM SUPPLIED STRING ARGUMENT ###
1278
- function remove_javascript_from_content($slide_content) {
1279
- if ($slide_content != '') {
1280
- $dom = new DOMDocument();
1281
- $dom->loadHTML($slide_content);
1282
- //$dom->loadHTML($slide_content, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
1283
- $script = $dom->getElementsByTagName('script');
1284
- $remove = array();
1285
- foreach($script as $item) {
1286
- $item->parentNode->removeChild($item);
1287
- }
1288
- //$slide_content = $dom->saveHTML();
1289
- $slide_content = preg_replace('~<(?:!DOCTYPE|/?(?:html|body))[^>]*>\s*~i', '', $dom->saveHTML());
1290
- }
1291
- return $slide_content;
1292
- }
1293
-
1294
-
1295
-
1296
- // ### MODIFY IMAGES (<img> tag) WITHIN STRING PASSED (SLIDE CONTENT) TO ENABLE OWL CAROUSEL LAZY LOAD ###
1297
- function set_slide_images_to_lazy_load($slide_content) {
1298
- if (trim($slide_content) != '') {
1299
- // 1) REPLACE 'src=' WITH 'data-src=' WITHIN <IMG> TAGS
1300
- $slide_content = preg_replace('~<img[^>]*\K(?=src)~i','data-', $slide_content);
1301
-
1302
- // 2) FOR EACH <IMG> TAG WITHIN THE SLIDE CONTENT, ADD THE 'owl-lazy' CLASS
1303
- $dom = new DOMDocument();
1304
- $dom->loadHTML(mb_convert_encoding($slide_content, 'HTML-ENTITIES', 'UTF-8'));
1305
- //$dom->loadHTML(mb_convert_encoding($slide_content, 'HTML-ENTITIES', 'UTF-8'), LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
1306
- $imgs = $dom->getElementsByTagName('img');
1307
- foreach ($imgs as $img) {
1308
- $curr_class = $img->getAttribute('class');
1309
- if ($curr_class != '') {
1310
- $img->setAttribute('class', $curr_class.' owl-lazy');
1311
- } else {
1312
- $img->setAttribute('class', 'owl-lazy');
1313
- }
1314
- }
1315
-
1316
- //$slide_content = $dom->saveHTML();
1317
- $slide_content = preg_replace('~<(?:!DOCTYPE|/?(?:html|body))[^>]*>\s*~i', '', $dom->saveHTML());
1318
- }
1319
-
1320
- return $slide_content;
1321
- }
1322
- ?>
1
+ <?php
2
+ /**
3
+ * #####################################################################
4
+ * ### SLIDE ANYTHING PLUGIN - PHP FUNCTIONS FOR WordPress FRONT-END ###
5
+ * #####################################################################
6
+ *
7
+ * @package WordPress_Slide_Anything
8
+ * @author Simon Edge
9
+ * @copyright EdgeWebPages
10
+ * @license GPLv2 or later
11
+ */
12
+
13
+ add_shortcode( 'slide-anything', 'slide_anything_shortcode' );
14
+
15
+ /**
16
+ * ##### ROOT FUNCTION THAT IS CALLED TO BY THE 'slide-anything' SHORTCODE #####
17
+ *
18
+ * @param array $atts Shortcode attributes.
19
+ */
20
+ function slide_anything_shortcode( $atts ) {
21
+ $sa_pro_version = esc_attr( get_option( 'sap_valid_license' ) );
22
+ wp_enqueue_script( 'jquery' );
23
+ wp_register_script( 'owl_carousel_js', SA_PLUGIN_PATH . 'owl-carousel/owl.carousel.min.js', array( 'jquery' ), '2.2.1', true );
24
+ wp_enqueue_script( 'owl_carousel_js' );
25
+ wp_register_style( 'owl_carousel_css', SA_PLUGIN_PATH . 'owl-carousel/owl.carousel.css', array(), '2.2.1.1', 'all' );
26
+ wp_enqueue_style( 'owl_carousel_css' );
27
+ wp_register_style( 'owl_theme_css', SA_PLUGIN_PATH . 'owl-carousel/sa-owl-theme.css', array(), '2.0', 'all' );
28
+ wp_enqueue_style( 'owl_theme_css' );
29
+ wp_register_style( 'owl_animate_css', SA_PLUGIN_PATH . 'owl-carousel/animate.min.css', array(), '2.0', 'all' );
30
+ wp_enqueue_style( 'owl_animate_css' );
31
+ wp_register_script( 'mousewheel_js', SA_PLUGIN_PATH . 'js/jquery.mousewheel.min.js', array( 'jquery' ), '3.1.13', true );
32
+ wp_enqueue_script( 'mousewheel_js' );
33
+ if ( $sa_pro_version ) {
34
+ // JAVASCRIPT/CSS FOR MAGNIFIC POPUP.
35
+ wp_register_script( 'magnific-popup_js', SA_PLUGIN_PATH . 'magnific-popup/jquery.magnific-popup.min.js', array( 'jquery' ), '1.1.0', true );
36
+ wp_enqueue_script( 'magnific-popup_js' );
37
+ wp_register_style( 'magnific-popup_css', SA_PLUGIN_PATH . 'magnific-popup/magnific-popup.css', array(), '1.1.0', 'all' );
38
+ wp_enqueue_style( 'magnific-popup_css' );
39
+ wp_register_script( 'owl_thumbs_js', SA_PLUGIN_PATH . 'owl-carousel/owl.carousel2.thumbs.min.js', array( 'jquery' ), '0.1.8', true );
40
+ wp_enqueue_script( 'owl_thumbs_js' );
41
+ }
42
+
43
+ // EXTRACT SHORTCODE ATTRIBUTES.
44
+ $args = shortcode_atts( array( 'id' => '0' ), $atts );
45
+ $id = (int) $args['id'];
46
+ $output = '';
47
+ if ( 0 === $id ) {
48
+ // SHORTCODE 'id' PARAMETER PROVIDED IS INVALID.
49
+ $output .= "<div id='sa_invalid_postid'>Slide Anything shortcode error: A valid ID has not been provided</div>\n";
50
+ } else {
51
+ $post_status = get_post_status( $id );
52
+ if ( 'publish' === $post_status ) {
53
+ $metadata = get_metadata( 'post', $id );
54
+ $post_type = get_post_type( $id );
55
+ }
56
+ if ( ( 'publish' !== $post_status ) || ( 0 === count( $metadata ) ) || ( 'sa_slider' !== $post_type ) ) {
57
+ // SHORTCODE 'id' PARAMETER PROVIDED IS INVALID.
58
+ $output .= "<div id='sa_invalid_postid'>Slide Anything shortcode error: A valid ID has not been provided</div>\n";
59
+ } else {
60
+ // VALID 'id' PROVIDED - PROCESS SHORTCODE.
61
+ // GET SLIDE DATA FROM DATABASE AND SAVE IN ARRAY.
62
+ $slide_data = array();
63
+ $slide_data['num_slides'] = $metadata['sa_num_slides'][0];
64
+ $slide_data['shortcodes'] = $metadata['sa_shortcodes'][0];
65
+ if ( '1' === $slide_data['shortcodes'] ) {
66
+ $slide_data['shortcodes'] = 'true';
67
+ } else {
68
+ $slide_data['shortcodes'] = 'false';
69
+ }
70
+ $slide_data['css_id'] = $metadata['sa_css_id'][0];
71
+ for ( $i = 1; $i <= $slide_data['num_slides']; $i++ ) {
72
+ $slide_data[ 'slide' . $i . '_num' ] = $i;
73
+ // apply 'the_content' filter to slide content to process any shortcodes.
74
+ if ( 'true' === $slide_data['shortcodes'] ) {
75
+ $slide_data[ 'slide' . $i . '_content' ] = do_shortcode( $metadata[ 'sa_slide' . $i . '_content' ][0] );
76
+ } else {
77
+ $slide_data[ 'slide' . $i . '_content' ] = $metadata[ 'sa_slide' . $i . '_content' ][0];
78
+ }
79
+ $slide_image_data = '';
80
+ if ( isset( $metadata[ 'sa_slide' . $i . '_image_data' ] ) ) {
81
+ $slide_image_data = $metadata[ 'sa_slide' . $i . '_image_data' ][0];
82
+ }
83
+ if ( isset( $slide_image_data ) && ( '' !== $slide_image_data ) ) {
84
+ $data_arr = explode( '~', $slide_image_data );
85
+ $slide_data[ 'slide' . $i . '_image_id' ] = $data_arr[0];
86
+ $slide_data[ 'slide' . $i . '_image_pos' ] = $data_arr[1];
87
+ $slide_data[ 'slide' . $i . '_image_size' ] = $data_arr[2];
88
+ $slide_data[ 'slide' . $i . '_image_repeat' ] = $data_arr[3];
89
+ $slide_data[ 'slide' . $i . '_image_color' ] = $data_arr[4];
90
+ } else {
91
+ $slide_data[ 'slide' . $i . '_image_id' ] = $metadata[ 'sa_slide' . $i . '_image_id' ][0];
92
+ $slide_data[ 'slide' . $i . '_image_pos' ] = $metadata[ 'sa_slide' . $i . '_image_pos' ][0];
93
+ $slide_data[ 'slide' . $i . '_image_size' ] = $metadata[ 'sa_slide' . $i . '_image_size' ][0];
94
+ $slide_data[ 'slide' . $i . '_image_repeat' ] = $metadata[ 'sa_slide' . $i . '_image_repeat' ][0];
95
+ $slide_data[ 'slide' . $i . '_image_color' ] = $metadata[ 'sa_slide' . $i . '_image_color' ][0];
96
+ }
97
+ $slide_data[ 'slide' . $i . '_link_url' ] = $metadata[ 'sa_slide' . $i . '_link_url' ][0];
98
+ $slide_data[ 'slide' . $i . '_link_target' ] = $metadata[ 'sa_slide' . $i . '_link_target' ][0];
99
+ if ( '' === $slide_data[ 'slide' . $i . '_link_target' ] ) {
100
+ $slide_data[ 'slide' . $i . '_link_target' ] = '_self';
101
+ }
102
+ if ( $sa_pro_version ) {
103
+ // ### PRO VERSION - GET POPUP DATA ###
104
+ $slide_data[ 'slide' . $i . '_popup_type' ] = 'NONE';
105
+ $slide_data[ 'slide' . $i . '_popup_imageid' ] = '';
106
+ $slide_data[ 'slide' . $i . '_popup_imagetitle' ] = '';
107
+ $slide_data[ 'slide' . $i . '_popup_video_id' ] = '';
108
+ $slide_data[ 'slide' . $i . '_popup_video_type' ] = '';
109
+ $slide_data[ 'slide' . $i . '_popup_html' ] = '';
110
+ $slide_data[ 'slide' . $i . '_popup_shortcode' ] = '';
111
+ $slide_data[ 'slide' . $i . '_popup_bgcol' ] = '#ffffff';
112
+ $slide_data[ 'slide' . $i . '_popup_width' ] = '600';
113
+ if ( isset( $metadata[ 'sa_slide' . $i . '_popup_type' ] ) ) {
114
+ $slide_data[ 'slide' . $i . '_popup_type' ] = $metadata[ 'sa_slide' . $i . '_popup_type' ][0];
115
+ }
116
+ if ( isset( $metadata[ 'sa_slide' . $i . '_popup_imageid' ] ) ) {
117
+ $slide_data[ 'slide' . $i . '_popup_imageid' ] = $metadata[ 'sa_slide' . $i . '_popup_imageid' ][0];
118
+ }
119
+ if ( isset( $metadata[ 'sa_slide' . $i . '_popup_imagetitle' ] ) ) {
120
+ $slide_data[ 'slide' . $i . '_popup_imagetitle' ] = $metadata[ 'sa_slide' . $i . '_popup_imagetitle' ][0];
121
+ }
122
+ $slide_data[ 'slide' . $i . '_popup_image' ] = '';
123
+ $slide_data[ 'slide' . $i . '_popup_background' ] = 'no';
124
+ if ( 'IMAGE' === $slide_data[ 'slide' . $i . '_popup_type' ] ) {
125
+ if ( ( '' !== $slide_data[ 'slide' . $i . '_popup_imageid' ] ) && ( 0 !== $slide_data[ 'slide' . $i . '_popup_imageid' ] ) ) {
126
+ $popup_full_images = wp_get_attachment_image_src( $slide_data[ 'slide' . $i . '_popup_imageid' ], 'full' );
127
+ $slide_data[ 'slide' . $i . '_popup_image' ] = $popup_full_images[0];
128
+ $slide_data[ 'slide' . $i . '_popup_background' ] = $metadata[ 'sa_slide' . $i . '_popup_background' ][0];
129
+ if ( '' === $slide_data[ 'slide' . $i . '_popup_background' ] ) {
130
+ $slide_data[ 'slide' . $i . '_popup_background' ] = 'no';
131
+ }
132
+ }
133
+ }
134
+ if ( isset( $metadata[ 'sa_slide' . $i . '_popup_video_id' ] ) ) {
135
+ $slide_data[ 'slide' . $i . '_popup_video_id' ] = $metadata[ 'sa_slide' . $i . '_popup_video_id' ][0];
136
+ }
137
+ if ( isset( $metadata[ 'sa_slide' . $i . '_popup_video_type' ] ) ) {
138
+ $slide_data[ 'slide' . $i . '_popup_video_type' ] = $metadata[ 'sa_slide' . $i . '_popup_video_type' ][0];
139
+ }
140
+ if ( isset( $metadata[ 'sa_slide' . $i . '_popup_html' ] ) ) {
141
+ $slide_data[ 'slide' . $i . '_popup_html' ] = $metadata[ 'sa_slide' . $i . '_popup_html' ][0];
142
+ }
143
+ if ( isset( $metadata[ 'sa_slide' . $i . '_popup_shortcode' ] ) ) {
144
+ $slide_data[ 'slide' . $i . '_popup_shortcode' ] = $metadata[ 'sa_slide' . $i . '_popup_shortcode' ][0];
145
+ }
146
+ if ( isset( $metadata[ 'sa_slide' . $i . '_popup_bgcol' ] ) ) {
147
+ $slide_data[ 'slide' . $i . '_popup_bgcol' ] = $metadata[ 'sa_slide' . $i . '_popup_bgcol' ][0];
148
+ }
149
+ if ( isset( $metadata[ 'sa_slide' . $i . '_popup_width' ] ) ) {
150
+ $slide_data[ 'slide' . $i . '_popup_width' ] = $metadata[ 'sa_slide' . $i . '_popup_width' ][0];
151
+ }
152
+ if ( 'HTML' === $slide_data[ 'slide' . $i . '_popup_type' ] ) {
153
+ $slide_data[ 'slide' . $i . '_popup_css_id' ] = $slide_data['css_id'] . '_popup' . $i;
154
+ } else {
155
+ $slide_data[ 'slide' . $i . '_popup_css_id' ] = '';
156
+ }
157
+ }
158
+ }
159
+ $slide_data['slide_duration'] = floatval( $metadata['sa_slide_duration'][0] ) * 1000;
160
+ $slide_data['slide_transition'] = floatval( $metadata['sa_slide_transition'][0] ) * 1000;
161
+ if ( isset( $metadata['sa_slide_by'][0] ) && ( '' !== $metadata['sa_slide_by'][0] ) ) {
162
+ $slide_data['slide_by'] = $metadata['sa_slide_by'][0];
163
+ if ( '0' === $slide_data['slide_by'] ) {
164
+ $slide_data['slide_by'] = 'page';
165
+ }
166
+ } else {
167
+ $slide_data['slide_by'] = 1;
168
+ }
169
+ $slide_data['loop_slider'] = $metadata['sa_loop_slider'][0];
170
+ if ( '1' === $slide_data['loop_slider'] ) {
171
+ $slide_data['loop_slider'] = 'true';
172
+ } else {
173
+ $slide_data['loop_slider'] = 'false';
174
+ }
175
+ $slide_data['stop_hover'] = $metadata['sa_stop_hover'][0];
176
+ if ( '1' === $slide_data['stop_hover'] ) {
177
+ $slide_data['stop_hover'] = 'true';
178
+ } else {
179
+ $slide_data['stop_hover'] = 'false';
180
+ }
181
+ $slide_data['random_order'] = $metadata['sa_random_order'][0];
182
+ if ( '1' === $slide_data['random_order'] ) {
183
+ $slide_data['random_order'] = 'true';
184
+ } else {
185
+ $slide_data['random_order'] = 'false';
186
+ }
187
+ $slide_data['reverse_order'] = $metadata['sa_reverse_order'][0];
188
+ if ( '1' === $slide_data['reverse_order'] ) {
189
+ $slide_data['reverse_order'] = 'true';
190
+ } else {
191
+ $slide_data['reverse_order'] = 'false';
192
+ }
193
+ $slide_data['nav_arrows'] = $metadata['sa_nav_arrows'][0];
194
+ if ( '1' === $slide_data['nav_arrows'] ) {
195
+ $slide_data['nav_arrows'] = 'true';
196
+ } else {
197
+ $slide_data['nav_arrows'] = 'false';
198
+ }
199
+ $slide_data['pagination'] = $metadata['sa_pagination'][0];
200
+ if ( '1' === $slide_data['pagination'] ) {
201
+ $slide_data['pagination'] = 'true';
202
+ } else {
203
+ $slide_data['pagination'] = 'false';
204
+ }
205
+ $slide_data['mouse_drag'] = $metadata['sa_mouse_drag'][0];
206
+ if ( '1' === $slide_data['mouse_drag'] ) {
207
+ $slide_data['mouse_drag'] = 'true';
208
+ } else {
209
+ $slide_data['mouse_drag'] = 'false';
210
+ }
211
+ $slide_data['touch_drag'] = $metadata['sa_touch_drag'][0];
212
+ if ( '1' === $slide_data['touch_drag'] ) {
213
+ $slide_data['touch_drag'] = 'true';
214
+ } else {
215
+ $slide_data['touch_drag'] = 'false';
216
+ }
217
+ if ( isset( $metadata['sa_mousewheel'] ) ) {
218
+ $slide_data['mousewheel'] = $metadata['sa_mousewheel'][0];
219
+ if ( '1' === $slide_data['mousewheel'] ) {
220
+ $slide_data['mousewheel'] = 'true';
221
+ } else {
222
+ $slide_data['mousewheel'] = 'false';
223
+ }
224
+ } else {
225
+ $slide_data['mousewheel'] = 'false';
226
+ }
227
+ if ( isset( $metadata['sa_click_advance'] ) ) {
228
+ $slide_data['click_advance'] = $metadata['sa_click_advance'][0];
229
+ if ( '1' === $slide_data['click_advance'] ) {
230
+ $slide_data['click_advance'] = 'true';
231
+ } else {
232
+ $slide_data['click_advance'] = 'false';
233
+ }
234
+ } else {
235
+ $slide_data['click_advance'] = 'false';
236
+ }
237
+ if ( isset( $metadata['sa_auto_height'] ) ) {
238
+ $slide_data['auto_height'] = $metadata['sa_auto_height'][0];
239
+ if ( '1' === $slide_data['auto_height'] ) {
240
+ $slide_data['auto_height'] = 'true';
241
+ } else {
242
+ $slide_data['auto_height'] = 'false';
243
+ }
244
+ } else {
245
+ $slide_data['auto_height'] = 'false';
246
+ }
247
+ if ( ( '0' === $metadata['sa_slide_min_height_perc'][0] ) || ( '0px' === $metadata['sa_slide_min_height_perc'][0] ) ) {
248
+ $slide_data['vert_center'] = 'false';
249
+ } else {
250
+ if ( isset( $metadata['sa_vert_center'] ) ) {
251
+ $slide_data['vert_center'] = $metadata['sa_vert_center'][0];
252
+ if ( '1' === $slide_data['vert_center'] ) {
253
+ $slide_data['vert_center'] = 'true';
254
+ } else {
255
+ $slide_data['vert_center'] = 'false';
256
+ }
257
+ } else {
258
+ $slide_data['vert_center'] = 'false';
259
+ }
260
+ }
261
+ $slide_data['items_width1'] = $metadata['sa_items_width1'][0];
262
+ $slide_data['items_width2'] = $metadata['sa_items_width2'][0];
263
+ $slide_data['items_width3'] = $metadata['sa_items_width3'][0];
264
+ $slide_data['items_width4'] = $metadata['sa_items_width4'][0];
265
+ $slide_data['items_width5'] = $metadata['sa_items_width5'][0];
266
+ $slide_data['items_width6'] = $metadata['sa_items_width6'][0];
267
+ if ( '' === $slide_data['items_width6'] ) {
268
+ $slide_data['items_width6'] = $slide_data['items_width5'];
269
+ }
270
+ $slide_data['transition'] = $metadata['sa_transition'][0];
271
+ $slide_data['background_color'] = $metadata['sa_background_color'][0];
272
+ $slide_data['border_width'] = $metadata['sa_border_width'][0];
273
+ $slide_data['border_color'] = $metadata['sa_border_color'][0];
274
+ $slide_data['border_radius'] = $metadata['sa_border_radius'][0];
275
+ $slide_data['wrapper_padd_top'] = $metadata['sa_wrapper_padd_top'][0];
276
+ $slide_data['wrapper_padd_right'] = $metadata['sa_wrapper_padd_right'][0];
277
+ $slide_data['wrapper_padd_bottom'] = $metadata['sa_wrapper_padd_bottom'][0];
278
+ $slide_data['wrapper_padd_left'] = $metadata['sa_wrapper_padd_left'][0];
279
+ $slide_data['slide_min_height_perc'] = $metadata['sa_slide_min_height_perc'][0];
280
+ $slide_data['slide_padding_tb'] = $metadata['sa_slide_padding_tb'][0];
281
+ $slide_data['slide_padding_lr'] = $metadata['sa_slide_padding_lr'][0];
282
+ $slide_data['slide_margin_lr'] = $metadata['sa_slide_margin_lr'][0];
283
+ $slide_data['slide_icons_location'] = $metadata['sa_slide_icons_location'][0];
284
+ $slide_data['autohide_arrows'] = $metadata['sa_autohide_arrows'][0];
285
+ if ( '1' === $slide_data['autohide_arrows'] ) {
286
+ $slide_data['autohide_arrows'] = 'true';
287
+ } else {
288
+ $slide_data['autohide_arrows'] = 'false';
289
+ }
290
+ $slide_data['dot_per_slide'] = '0';
291
+ if ( isset( $metadata['sa_dot_per_slide'] ) ) {
292
+ $slide_data['dot_per_slide'] = $metadata['sa_dot_per_slide'][0];
293
+ if ( '1' !== $slide_data['dot_per_slide'] ) {
294
+ $slide_data['dot_per_slide'] = '0';
295
+ }
296
+ } else {
297
+ $slide_data['dot_per_slide'] = '0';
298
+ }
299
+ $slide_data['slide_icons_visible'] = $metadata['sa_slide_icons_visible'][0];
300
+ if ( '1' === $slide_data['slide_icons_visible'] ) {
301
+ $slide_data['slide_icons_visible'] = 'true';
302
+ } else {
303
+ $slide_data['slide_icons_visible'] = 'false';
304
+ }
305
+ $slide_data['slide_icons_color'] = $metadata['sa_slide_icons_color'][0];
306
+ if ( 'black' !== $slide_data['slide_icons_color'] ) {
307
+ $slide_data['slide_icons_color'] = 'white';
308
+ }
309
+ if ( isset( $metadata['sa_slide_icons_fullslide'][0] ) &&
310
+ ( 1 === $metadata['sa_slide_icons_fullslide'][0] ) ) {
311
+ $slide_data['slide_icons_fullslide'] = '1';
312
+ } else {
313
+ $slide_data['slide_icons_fullslide'] = '0';
314
+ }
315
+ // FETCH OTHER SETTINGS POST META.
316
+ $other_settings = '';
317
+ if ( isset( $metadata['sa_other_settings'] ) ) {
318
+ $other_settings = $metadata['sa_other_settings'][0];
319
+ if ( isset( $other_settings ) && ( '' !== $other_settings ) ) {
320
+ $other_settings_arr = explode( '|', $other_settings );
321
+ }
322
+ }
323
+ // setting 1 - sa_window_onload.
324
+ $slide_data['sa_window_onload'] = '0';
325
+ if ( isset( $other_settings_arr ) && ( '' !== $other_settings_arr[0] ) ) {
326
+ $slide_data['sa_window_onload'] = $other_settings_arr[0];
327
+ } else {
328
+ if ( isset( $metadata['sa_window_onload'] ) ) {
329
+ $slide_data['sa_window_onload'] = $metadata['sa_window_onload'][0];
330
+ if ( '1' !== $slide_data['sa_window_onload'] ) {
331
+ $slide_data['sa_window_onload'] = '0';
332
+ }
333
+ }
334
+ }
335
+ // setting 2 - sa_strip_javascript.
336
+ $slide_data['strip_javascript'] = '0';
337
+ // setting 3 - sa_lazy_load_images.
338
+ $slide_data['lazy_load_images'] = '0';
339
+ if ( isset( $other_settings_arr ) && ( '' !== $other_settings_arr[2] ) ) {
340
+ $slide_data['lazy_load_images'] = $other_settings_arr[2];
341
+ } else {
342
+ if ( isset( $metadata['sa_lazy_load_images'] ) ) {
343
+ $slide_data['lazy_load_images'] = $metadata['sa_lazy_load_images'][0];
344
+ if ( '1' !== $slide_data['lazy_load_images'] ) {
345
+ $slide_data['lazy_load_images'] = '0';
346
+ }
347
+ }
348
+ }
349
+ // setting 4 - sa_ulli_containers.
350
+ $slide_data['ulli_containers'] = '0';
351
+ if ( isset( $other_settings_arr ) && ( '' !== $other_settings_arr[3] ) ) {
352
+ $slide_data['ulli_containers'] = $other_settings_arr[3];
353
+ } else {
354
+ if ( isset( $metadata['sa_ulli_containers'] ) ) {
355
+ $slide_data['ulli_containers'] = $metadata['sa_ulli_containers'][0];
356
+ if ( '1' !== $slide_data['ulli_containers'] ) {
357
+ $slide_data['ulli_containers'] = '0';
358
+ }
359
+ }
360
+ }
361
+ // setting 5 - sa_rtl_slider.
362
+ $slide_data['rtl_slider'] = '0';
363
+ if ( isset( $other_settings_arr ) && ( '' !== $other_settings_arr[4] ) ) {
364
+ $slide_data['rtl_slider'] = $other_settings_arr[4];
365
+ }
366
+ // setting 7 - bg_image_size.
367
+ $slide_data['bg_image_size'] = 'full';
368
+ if ( isset( $other_settings_arr ) && ( count( $other_settings_arr ) > 6 ) ) {
369
+ if ( '' !== $other_settings_arr[6] ) {
370
+ $slide_data['bg_image_size'] = $other_settings_arr[6];
371
+ }
372
+ }
373
+ // setting 8 - disable_slide_ids.
374
+ $slide_data['disable_slide_ids'] = '0';
375
+ if ( isset( $other_settings_arr ) && ( count( $other_settings_arr ) > 7 ) ) {
376
+ if ( '' !== $other_settings_arr[7] ) {
377
+ $slide_data['disable_slide_ids'] = $other_settings_arr[7];
378
+ }
379
+ }
380
+ // Start Position.
381
+ $slide_data['start_pos'] = 0;
382
+ if ( isset( $metadata['sa_start_pos'] ) ) {
383
+ $slide_data['start_pos'] = $metadata['sa_start_pos'][0];
384
+ if ( '' !== $slide_data['start_pos'] ) {
385
+ $slide_data['start_pos'] = abs( intval( $slide_data['start_pos'] ) );
386
+ if ( $slide_data['start_pos'] > 0 ) {
387
+ $slide_data['start_pos'] = $slide_data['start_pos'] - 1;
388
+ }
389
+ }
390
+ }
391
+
392
+ // hero slider and slider thumbnails.
393
+ $slide_data['hero_slider'] = '0';
394
+ $slide_data['thumbs_active'] = '0';
395
+ if ( $sa_pro_version ) {
396
+ if ( isset( $metadata['sa_hero_slider'] ) ) {
397
+ $slide_data['hero_slider'] = $metadata['sa_hero_slider'][0];
398
+ if ( '1' !== $slide_data['hero_slider'] ) {
399
+ $slide_data['hero_slider'] = '0';
400
+ }
401
+ } else {
402
+ $slide_data['hero_slider'] = '0';
403
+ }
404
+ if ( isset( $metadata['sa_thumbs_active'] ) ) {
405
+ $slide_data['thumbs_active'] = $metadata['sa_thumbs_active'][0];
406
+ if ( '1' !== $slide_data['thumbs_active'] ) {
407
+ $slide_data['thumbs_active'] = '0';
408
+ }
409
+ } else {
410
+ $slide_data['thumbs_active'] = '0';
411
+ }
412
+ if ( isset( $metadata['sa_thumbs_location'] ) ) {
413
+ $slide_data['thumbs_location'] = $metadata['sa_thumbs_location'][0];
414
+ } else {
415
+ $slide_data['thumbs_location'] = 'inside_bottom';
416
+ }
417
+ if ( isset( $metadata['sa_thumbs_image_size'] ) ) {
418
+ $slide_data['thumbs_image_size'] = $metadata['sa_thumbs_image_size'][0];
419
+ } else {
420
+ $slide_data['thumbs_image_size'] = 'thumbnail';
421
+ }
422
+ if ( isset( $metadata['sa_thumbs_padding'] ) ) {
423
+ $slide_data['thumbs_padding'] = $metadata['sa_thumbs_padding'][0];
424
+ } else {
425
+ $slide_data['thumbs_padding'] = '3';
426
+ }
427
+ if ( isset( $metadata['sa_thumbs_width'] ) ) {
428
+ $slide_data['thumbs_width'] = $metadata['sa_thumbs_width'][0];
429
+ } else {
430
+ $slide_data['thumbs_width'] = '150';
431
+ }
432
+ if ( isset( $metadata['sa_thumbs_height'] ) ) {
433
+ $slide_data['thumbs_height'] = $metadata['sa_thumbs_height'][0];
434
+ } else {
435
+ $slide_data['thumbs_height'] = '85';
436
+ }
437
+ if ( isset( $metadata['sa_thumbs_opacity'] ) ) {
438
+ $slide_data['thumbs_opacity'] = $metadata['sa_thumbs_opacity'][0];
439
+ } else {
440
+ $slide_data['thumbs_opacity'] = '50';
441
+ }
442
+ if ( isset( $metadata['sa_thumbs_border_width'] ) ) {
443
+ $slide_data['thumbs_border_width'] = $metadata['sa_thumbs_border_width'][0];
444
+ } else {
445
+ $slide_data['thumbs_border_width'] = '0';
446
+ }
447
+ if ( isset( $metadata['sa_thumbs_border_color'] ) ) {
448
+ $slide_data['thumbs_border_color'] = $metadata['sa_thumbs_border_color'][0];
449
+ } else {
450
+ $slide_data['thumbs_border_color'] = '#ffffff';
451
+ }
452
+ if ( isset( $metadata['sa_thumbs_resp_tablet'] ) ) {
453
+ $slide_data['thumbs_resp_tablet'] = $metadata['sa_thumbs_resp_tablet'][0];
454
+ } else {
455
+ $slide_data['thumbs_resp_tablet'] = '75';
456
+ }
457
+ if ( isset( $metadata['sa_thumbs_resp_mobile'] ) ) {
458
+ $slide_data['thumbs_resp_mobile'] = $metadata['sa_thumbs_resp_mobile'][0];
459
+ } else {
460
+ $slide_data['thumbs_resp_mobile'] = '50';
461
+ }
462
+ }
463
+ // showcase carousel.
464
+ $slide_data['showcase_slider'] = '0';
465
+ if ( $sa_pro_version ) {
466
+ if ( isset( $metadata['sa_showcase_slider'] ) ) {
467
+ $slide_data['showcase_slider'] = $metadata['sa_showcase_slider'][0];
468
+ if ( '1' !== $slide_data['showcase_slider'] ) {
469
+ $slide_data['showcase_slider'] = '0';
470
+ }
471
+ } else {
472
+ $slide_data['showcase_slider'] = '0';
473
+ }
474
+ if ( isset( $metadata['sa_showcase_width'] ) ) {
475
+ $slide_data['showcase_width'] = $metadata['sa_showcase_width'][0];
476
+ } else {
477
+ $slide_data['showcase_width'] = '120';
478
+ }
479
+ if ( isset( $metadata['sa_showcase_tablet'] ) ) {
480
+ $slide_data['showcase_tablet'] = $metadata['sa_showcase_tablet'][0];
481
+ if ( '1' !== $slide_data['showcase_tablet'] ) {
482
+ $slide_data['showcase_tablet'] = '0';
483
+ }
484
+ } else {
485
+ $slide_data['showcase_tablet'] = '0';
486
+ }
487
+ if ( isset( $metadata['sa_showcase_width_tab'] ) ) {
488
+ $slide_data['showcase_width_tab'] = $metadata['sa_showcase_width_tab'][0];
489
+ } else {
490
+ $slide_data['showcase_width_tab'] = '130';
491
+ }
492
+ if ( isset( $metadata['sa_showcase_mobile'] ) ) {
493
+ $slide_data['showcase_mobile'] = $metadata['sa_showcase_mobile'][0];
494
+ if ( '1' !== $slide_data['showcase_mobile'] ) {
495
+ $slide_data['showcase_mobile'] = '0';
496
+ }
497
+ } else {
498
+ $slide_data['showcase_mobile'] = '0';
499
+ }
500
+ if ( isset( $metadata['sa_showcase_width_mob'] ) ) {
501
+ $slide_data['showcase_width_mob'] = $metadata['sa_showcase_width_mob'][0];
502
+ } else {
503
+ $slide_data['showcase_width_mob'] = '140';
504
+ }
505
+ }
506
+
507
+ // REVERSE THE ORDER OF THE SLIDES IF 'Random Order' CHECKBOX IS CHECKED OR
508
+ // RE-ORDER SLIDES IN A RANDOM ORDER IF 'Random Order' CHECKBOX IS CHECKED.
509
+ if ( ( 'true' === $slide_data['reverse_order'] ) || ( 'true' === $slide_data['random_order'] ) ) {
510
+ $reorder_arr = array();
511
+ for ( $i = 1; $i <= $slide_data['num_slides']; $i++ ) {
512
+ $reorder_arr[ $i - 1 ]['num'] = $slide_data[ 'slide' . $i . '_num' ];
513
+ $reorder_arr[ $i - 1 ]['content'] = $slide_data[ 'slide' . $i . '_content' ];
514
+ $reorder_arr[ $i - 1 ]['image_id'] = $slide_data[ 'slide' . $i . '_image_id' ];
515
+ $reorder_arr[ $i - 1 ]['image_pos'] = $slide_data[ 'slide' . $i . '_image_pos' ];
516
+ $reorder_arr[ $i - 1 ]['image_size'] = $slide_data[ 'slide' . $i . '_image_size' ];
517
+ $reorder_arr[ $i - 1 ]['image_repeat'] = $slide_data[ 'slide' . $i . '_image_repeat' ];
518
+ $reorder_arr[ $i - 1 ]['image_color'] = $slide_data[ 'slide' . $i . '_image_color' ];
519
+ $reorder_arr[ $i - 1 ]['link_url'] = $slide_data[ 'slide' . $i . '_link_url' ];
520
+ $reorder_arr[ $i - 1 ]['link_target'] = $slide_data[ 'slide' . $i . '_link_target' ];
521
+ if ( $sa_pro_version ) {
522
+ $reorder_arr[ $i - 1 ]['popup_type'] = $slide_data[ 'slide' . $i . '_popup_type' ];
523
+ $reorder_arr[ $i - 1 ]['popup_imageid'] = $slide_data[ 'slide' . $i . '_popup_imageid' ];
524
+ $reorder_arr[ $i - 1 ]['popup_imagetitle'] = $slide_data[ 'slide' . $i . '_popup_imagetitle' ];
525
+ $reorder_arr[ $i - 1 ]['popup_image'] = $slide_data[ 'slide' . $i . '_popup_image' ];
526
+ $reorder_arr[ $i - 1 ]['popup_background'] = $slide_data[ 'slide' . $i . '_popup_background' ];
527
+ $reorder_arr[ $i - 1 ]['popup_video_id'] = $slide_data[ 'slide' . $i . '_popup_video_id' ];
528
+ $reorder_arr[ $i - 1 ]['popup_video_type'] = $slide_data[ 'slide' . $i . '_popup_video_type' ];
529
+ $reorder_arr[ $i - 1 ]['popup_html'] = $slide_data[ 'slide' . $i . '_popup_html' ];
530
+ $reorder_arr[ $i - 1 ]['popup_shortcode'] = $slide_data[ 'slide' . $i . '_popup_shortcode' ];
531
+ $reorder_arr[ $i - 1 ]['popup_bgcol'] = $slide_data[ 'slide' . $i . '_popup_bgcol' ];
532
+ $reorder_arr[ $i - 1 ]['popup_width'] = $slide_data[ 'slide' . $i . '_popup_width' ];
533
+ $reorder_arr[ $i - 1 ]['popup_css_id'] = $slide_data[ 'slide' . $i . '_popup_css_id' ];
534
+ }
535
+ }
536
+ if ( 'true' === $slide_data['random_order'] ) {
537
+ // SORT SLIDE ARRAY DATA IN A RANDOM ORDER.
538
+ shuffle( $reorder_arr );
539
+ } else {
540
+ // REVERSE THE ORDER OF THE SLIDE DATA ARRAY.
541
+ $reverse_arr = array_reverse( $reorder_arr );
542
+ $reorder_arr = $reverse_arr;
543
+ }
544
+ for ( $i = 1; $i <= $slide_data['num_slides']; $i++ ) {
545
+ $slide_data[ 'slide' . $i . '_num' ] = $reorder_arr[ $i - 1 ]['num'];
546
+ $slide_data[ 'slide' . $i . '_content' ] = $reorder_arr[ $i - 1 ]['content'];
547
+ $slide_data[ 'slide' . $i . '_image_id' ] = $reorder_arr[ $i - 1 ]['image_id'];
548
+ $slide_data[ 'slide' . $i . '_image_pos' ] = $reorder_arr[ $i - 1 ]['image_pos'];
549
+ $slide_data[ 'slide' . $i . '_image_size' ] = $reorder_arr[ $i - 1 ]['image_size'];
550
+ $slide_data[ 'slide' . $i . '_image_repeat' ] = $reorder_arr[ $i - 1 ]['image_repeat'];
551
+ $slide_data[ 'slide' . $i . '_image_color' ] = $reorder_arr[ $i - 1 ]['image_color'];
552
+ $slide_data[ 'slide' . $i . '_link_url' ] = $reorder_arr[ $i - 1 ]['link_url'];
553
+ $slide_data[ 'slide' . $i . '_link_target' ] = $reorder_arr[ $i - 1 ]['link_target'];
554
+ if ( $sa_pro_version ) {
555
+ $slide_data[ 'slide' . $i . '_popup_type' ] = $reorder_arr[ $i - 1 ]['popup_type'];
556
+ $slide_data[ 'slide' . $i . '_popup_imageid' ] = $reorder_arr[ $i - 1 ]['popup_imageid'];
557
+ $slide_data[ 'slide' . $i . '_popup_imagetitle' ] = $reorder_arr[ $i - 1 ]['popup_imagetitle'];
558
+ $slide_data[ 'slide' . $i . '_popup_image' ] = $reorder_arr[ $i - 1 ]['popup_image'];
559
+ $slide_data[ 'slide' . $i . '_popup_background' ] = $reorder_arr[ $i - 1 ]['popup_background'];
560
+ $slide_data[ 'slide' . $i . '_popup_video_id' ] = $reorder_arr[ $i - 1 ]['popup_video_id'];
561
+ $slide_data[ 'slide' . $i . '_popup_video_type' ] = $reorder_arr[ $i - 1 ]['popup_video_type'];
562
+ $slide_data[ 'slide' . $i . '_popup_html' ] = $reorder_arr[ $i - 1 ]['popup_html'];
563
+ $slide_data[ 'slide' . $i . '_popup_shortcode' ] = $reorder_arr[ $i - 1 ]['popup_shortcode'];
564
+ $slide_data[ 'slide' . $i . '_popup_bgcol' ] = $reorder_arr[ $i - 1 ]['popup_bgcol'];
565
+ $slide_data[ 'slide' . $i . '_popup_width' ] = $reorder_arr[ $i - 1 ]['popup_width'];
566
+ $slide_data[ 'slide' . $i . '_popup_css_id' ] = $reorder_arr[ $i - 1 ]['popup_css_id'];
567
+ }
568
+ }
569
+ }
570
+
571
+ // GENERATE HTML CODE FOR THE OWL CAROUSEL SLIDER.
572
+ $wrapper_style = 'background:' . $slide_data['background_color'] . '; ';
573
+ $wrapper_style .= 'border:solid ' . $slide_data['border_width'] . 'px ' . $slide_data['border_color'] . '; ';
574
+ $wrapper_style .= 'border-radius:' . $slide_data['border_radius'] . 'px; ';
575
+ $wrapper_style .= 'padding:' . $slide_data['wrapper_padd_top'] . 'px ';
576
+ $wrapper_style .= $slide_data['wrapper_padd_right'] . 'px ';
577
+ $wrapper_style .= $slide_data['wrapper_padd_bottom'] . 'px ';
578
+ $wrapper_style .= $slide_data['wrapper_padd_left'] . 'px;';
579
+ if ( '1' === $slide_data['showcase_slider'] ) {
580
+ $wrapper_style .= ' overflow:hidden;';
581
+ }
582
+ $output .= "<div class='" . $slide_data['slide_icons_color'] . "' style='" . esc_attr( $wrapper_style ) . "'>\n";
583
+ $additional_classes = '';
584
+ if ( 'true' === $slide_data['pagination'] ) {
585
+ if ( 'true' === $slide_data['autohide_arrows'] ) {
586
+ $additional_classes = 'owl-pagination-true autohide-arrows';
587
+ } else {
588
+ $additional_classes = 'owl-pagination-true';
589
+ }
590
+ } else {
591
+ if ( 'true' === $slide_data['autohide_arrows'] ) {
592
+ $additional_classes = 'autohide-arrows';
593
+ }
594
+ }
595
+ // hero slider.
596
+ if ( '1' === $slide_data['hero_slider'] ) {
597
+ $additional_classes .= ' sa_hero_slider';
598
+ }
599
+ $slider_style = 'visibility:hidden;';
600
+ // showcase slider.
601
+ if ( '1' === $slide_data['showcase_slider'] ) {
602
+ $left_perc = ( intval( $slide_data['showcase_width'] ) - 100 ) / 2;
603
+ $slider_style .= ' width:' . $slide_data['showcase_width'] . '%;';
604
+ $slider_style .= ' left:-' . $left_perc . '%;';
605
+ if ( '1' === $slide_data['showcase_tablet'] ) {
606
+ $left_perc_tab = ( intval( $slide_data['showcase_width_tab'] ) - 100 ) / 2;
607
+ $slider_style .= ' --widthtab:' . $slide_data['showcase_width_tab'] . '%;';
608
+ $slider_style .= ' --lefttab:-' . $left_perc_tab . '%;';
609
+ $additional_classes .= ' showcase_tablet';
610
+ } else {
611
+ $additional_classes .= ' showcase_hide_tablet';
612
+ }
613
+ if ( '1' === $slide_data['showcase_mobile'] ) {
614
+ $left_perc_mob = ( intval( $slide_data['showcase_width_mob'] ) - 100 ) / 2;
615
+ $slider_style .= ' --widthmob:' . $slide_data['showcase_width_mob'] . '%;';
616
+ $slider_style .= ' --leftmob:-' . $left_perc_mob . '%;';
617
+ $additional_classes .= ' showcase_mobile';
618
+ } else {
619
+ $additional_classes .= ' showcase_hide_mobile';
620
+ }
621
+ }
622
+ $output .= "<div id='" . esc_attr( $slide_data['css_id'] ) . "' class='owl-carousel sa_owl_theme " . $additional_classes . "' ";
623
+ $output .= "data-slider-id='" . esc_attr( $slide_data['css_id'] ) . "' style='" . $slider_style . "'>\n";
624
+ if ( $sa_pro_version ) {
625
+ // PRO VERSION - INITIALISE VAIRABLES FOR MAGNIFIC POPUP.
626
+ $lightbox_function = 'open_lightbox_gallery_' . $slide_data['css_id'];
627
+ $lightbox_gallery_id = 'lightbox_button_' . $slide_data['css_id'];
628
+ $lightbox_count = 0;
629
+ }
630
+ for ( $i = 1; $i <= $slide_data['num_slides']; $i++ ) {
631
+ $slide_content = $slide_data[ 'slide' . $i . '_content' ];
632
+ if ( 'full' !== $slide_data['bg_image_size'] ) {
633
+ // use predefined WordPress image size (from 'other settings').
634
+ $slide_image_src = wp_get_attachment_image_src( $slide_data[ 'slide' . $i . '_image_id' ], $slide_data['bg_image_size'] );
635
+ } else {
636
+ // use "full" WordPress image size.
637
+ $slide_image_src = wp_get_attachment_image_src( $slide_data[ 'slide' . $i . '_image_id' ], 'full' );
638
+ }
639
+ // SA PRO VERSION - USE POPUP IMAGE AS SLIDE BACKGROUND IMAGE (IF THIS OPTION SELECTED).
640
+ if ( ( $sa_pro_version ) && ( 'IMAGE' === $slide_data[ 'slide' . $i . '_popup_type' ] ) ) {
641
+ if ( ( 'no' !== $slide_data[ 'slide' . $i . '_popup_background' ] ) && ( '' !== $slide_data[ 'slide' . $i . '_popup_image' ] ) ) {
642
+ $slide_image_src = wp_get_attachment_image_src( $slide_data[ 'slide' . $i . '_popup_imageid' ], $slide_data[ 'slide' . $i . '_popup_background' ] );
643
+ }
644
+ } elseif ( ( $sa_pro_version ) && ( 'VIDEO' === $slide_data[ 'slide' . $i . '_popup_type' ] ) ) {
645
+ if ( 'youtube' === $slide_data[ 'slide' . $i . '_popup_video_type' ] ) {
646
+ if ( '99999999' === $slide_data[ 'slide' . $i . '_image_id' ] ) {
647
+ $slide_image_src = array();
648
+ $popup_video_id = $slide_data[ 'slide' . $i . '_popup_video_id' ];
649
+ $slide_image_src[0] = 'https://img.youtube.com/vi/' . $popup_video_id . '/hqdefault.jpg';
650
+ }
651
+ }
652
+ }
653
+ $slide_image_size = $slide_data[ 'slide' . $i . '_image_size' ];
654
+ $slide_image_pos = $slide_data[ 'slide' . $i . '_image_pos' ];
655
+ $slide_image_repeat = $slide_data[ 'slide' . $i . '_image_repeat' ];
656
+ $slide_image_color = $slide_data[ 'slide' . $i . '_image_color' ];
657
+ $slide_style = 'padding:' . $slide_data['slide_padding_tb'] . '% ' . $slide_data['slide_padding_lr'] . '%; ';
658
+ $slide_style .= 'margin:0px ' . $slide_data['slide_margin_lr'] . '%; ';
659
+ if ( ! empty( $slide_image_src[0] ) ) {
660
+ $slide_style .= 'background-image:url("' . $slide_image_src[0] . '"); ';
661
+ $slide_style .= 'background-position:' . $slide_image_pos . '; ';
662
+ $slide_style .= 'background-size:' . $slide_image_size . '; ';
663
+ $slide_style .= 'background-repeat:' . $slide_image_repeat . '; ';
664
+ }
665
+ if ( ! empty( $slide_image_color ) && ( 'rgba(0,0,0,0)' !== $slide_image_color ) ) {
666
+ $slide_style .= 'background-color:' . $slide_image_color . '; ';
667
+ }
668
+ if ( strpos( $slide_data['slide_min_height_perc'], 'px' ) !== false ) {
669
+ $slide_style .= 'min-height:' . $slide_data['slide_min_height_perc'] . '; ';
670
+ }
671
+
672
+ // BUILD SLIDE LINK HOVER BUTTON.
673
+ $link_output = '';
674
+ if ( '' !== $slide_data[ 'slide' . $i . '_link_url' ] ) {
675
+ $link_title = ''; // SET LINK TITLE TO BLANK - 03/01/2022.
676
+ $link_output = "<a class='sa_slide_link_icon' href='" . $slide_data[ 'slide' . $i . '_link_url' ] . "' ";
677
+ $link_output .= "target='" . $slide_data[ 'slide' . $i . '_link_target' ] . "' ";
678
+ $link_output .= "title='" . $link_title . "' aria-label='" . $link_title . "'></a>";
679
+ }
680
+
681
+ // BUILD POPUP HOVER BUTTON - PRO VERSION ONLY.
682
+ $popup_output = '';
683
+ if ( $sa_pro_version ) {
684
+ if ( ( 'IMAGE' === $slide_data[ 'slide' . $i . '_popup_type' ] ) && ( '' !== $slide_data[ 'slide' . $i . '_popup_image' ] ) ) {
685
+ $lightbox_count++;
686
+ $popup_output = "<div class='sa_popup_zoom_icon' onClick='" . $lightbox_function . '(' . $lightbox_count . ");'></div>";
687
+ }
688
+ if ( ( 'VIDEO' === $slide_data[ 'slide' . $i . '_popup_type' ] ) && ( '' !== $slide_data[ 'slide' . $i . '_popup_video_id' ] ) ) {
689
+ $lightbox_count++;
690
+ $popup_output = "<div class='sa_popup_video_icon' onClick='" . $lightbox_function . '(' . $lightbox_count . ");'></div>";
691
+ }
692
+ if ( 'HTML' === $slide_data[ 'slide' . $i . '_popup_type' ] ) {
693
+ $lightbox_count++;
694
+ $popup_output = "<div class='sa_popup_zoom_icon' onClick='" . $lightbox_function . '(' . $lightbox_count . ");'></div>";
695
+ }
696
+ }
697
+
698
+ // DISPLAY SLIDE OUTPUT.
699
+ $css_id = $slide_data['css_id'] . '_slide' . sprintf( '%02d', $slide_data[ 'slide' . $i . '_num' ] );
700
+ if ( '1' === $slide_data['disable_slide_ids'] ) {
701
+ if ( 'true' === $slide_data['vert_center'] ) {
702
+ $output .= "<div class='" . $css_id . " sa_hover_container sa_vert_center_wrap' style='" . esc_attr( $slide_style ) . "'>";
703
+ } else {
704
+ $output .= "<div class='" . $css_id . " sa_hover_container' style='" . esc_attr( $slide_style ) . "'>";
705
+ }
706
+ } else {
707
+ if ( 'true' === $slide_data['vert_center'] ) {
708
+ $output .= "<div id='" . $css_id . "' class='sa_hover_container sa_vert_center_wrap' style='" . esc_attr( $slide_style ) . "'>";
709
+ } else {
710
+ $output .= "<div id='" . $css_id . "' class='sa_hover_container' style='" . esc_attr( $slide_style ) . "'>";
711
+ }
712
+ }
713
+ if ( ( '' !== $link_output ) || ( '' !== $popup_output ) ) {
714
+ if ( 'Top Left' === $slide_data['slide_icons_location'] ) {
715
+ // icons location - top left.
716
+ $style = 'top:0px; left:0px; margin:0px;';
717
+ } elseif ( 'Top Center' === $slide_data['slide_icons_location'] ) {
718
+ // icons location - top center.
719
+ if ( ( '' !== $link_output ) && ( '' !== $popup_output ) ) {
720
+ $hov_margin_l = '-40px'; } else {
721
+ $hov_margin_l = '-20px'; }
722
+ $style = 'top:0px; left:50%; margin-left:' . $hov_margin_l . ';';
723
+ } elseif ( 'Top Right' === $slide_data['slide_icons_location'] ) {
724
+ // icons location - top right.
725
+ $style = 'top:0px; right:0px; margin:0px;';
726
+ } elseif ( 'Bottom Left' === $slide_data['slide_icons_location'] ) {
727
+ // icons location - bottom left.
728
+ $style = 'bottom:0px; left:0px; margin:0px;';
729
+ } elseif ( 'Bottom Center' === $slide_data['slide_icons_location'] ) {
730
+ // icons location - bottom center.
731
+ if ( ( '' !== $link_output ) && ( '' !== $popup_output ) ) {
732
+ $hov_margin_l = '-40px'; } else {
733
+ $hov_margin_l = '-20px'; }
734
+ $style = 'bottom:0px; left:50%; margin-left:' . $hov_margin_l . ';';
735
+ } elseif ( 'Bottom Right' === $slide_data['slide_icons_location'] ) {
736
+ // icons location - bottom right.
737
+ $style = 'bottom:0px; right:0px; margin:0px;';
738
+ } else {
739
+ // icons location - center center (default).
740
+ if ( ( '' !== $link_output ) && ( '' !== $popup_output ) ) {
741
+ $hov_margin_l = '-40px'; } else {
742
+ $hov_margin_l = '-20px'; }
743
+ $style = 'top:50%; left:50%; margin-top:-20px; margin-left:' . $hov_margin_l . ';';
744
+ }
745
+ // check whether to display a 'full slide link' for this slide.
746
+ $full_slide_link = 0;
747
+ if ( ( ( '' === $link_output ) && ( '' !== $popup_output ) ) ||
748
+ ( ( '' !== $link_output ) && ( '' === $popup_output ) ) ) {
749
+ if ( '1' === $slide_data['slide_icons_fullslide'] ) {
750
+ $full_slide_link = 1;
751
+ }
752
+ }
753
+ if ( 1 === $full_slide_link ) {
754
+ // display full slide link.
755
+ $output .= "<div class='sa_hover_fullslide'>";
756
+ } else {
757
+ // display link buttons.
758
+ if ( 'true' === $slide_data['slide_icons_visible'] ) {
759
+ $output .= "<div class='sa_hover_buttons always_visible' style='" . $style . "'>";
760
+ } else {
761
+ $output .= "<div class='sa_hover_buttons' style='" . $style . "'>";
762
+ }
763
+ }
764
+ if ( '' !== $link_output ) {
765
+ $output .= $link_output;
766
+ }
767
+ if ( '' !== $popup_output ) {
768
+ $output .= $popup_output;
769
+ }
770
+ $output .= "</div>\n"; // .sa_hover_buttons
771
+ }
772
+ if ( 'true' === $slide_data['vert_center'] ) {
773
+ // vertically center content within each slide.
774
+ // (we do this by wrapping slide content in a '<div>' wrapper.
775
+ $slide_content = "<div class='sa_vert_center'>" . $slide_content . '</div>';
776
+ }
777
+ $output .= $slide_content . "</div>\n"; // .sa_hover_container
778
+ }
779
+ $output .= "</div>\n"; // .owl-carousel
780
+
781
+ // PRO VERSION - THUMBNAIL PAGINATION.
782
+ if ( ( $sa_pro_version ) && ( '1' === $slide_data['thumbs_active'] ) ) {
783
+ $thumbs_loc = $slide_data['thumbs_location'];
784
+ $thumbs_opacity = $slide_data['thumbs_opacity'] / 100;
785
+ // thumbnail container - set style.
786
+ $thumbs_style = ' padding:' . $slide_data['thumbs_padding'] . '%;';
787
+ if ( 'inside_left' === $thumbs_loc ) {
788
+ $thumbs_style .= 'left:' . $slide_data['thumbs_padding'] . '%; width:' . $slide_data['thumbs_width'] . 'px;';
789
+ } elseif ( 'inside_right' === $thumbs_loc ) {
790
+ $thumbs_style .= 'right:' . $slide_data['thumbs_padding'] . '%; width:' . $slide_data['thumbs_width'] . 'px;';
791
+ } elseif ( 'outside_bottom' === $thumbs_loc ) {
792
+ $thumbs_style .= ' padding-bottom:0px;';
793
+ }
794
+ $add_classes = '';
795
+ if ( 0 === $slide_data['thumbs_resp_tablet'] ) {
796
+ $add_classes .= ' sa_thumbs_hide_tablet'; }
797
+ if ( 0 === $slide_data['thumbs_resp_mobile'] ) {
798
+ $add_classes .= ' sa_thumbs_hide_mobile'; }
799
+ $output .= "<div id='" . esc_attr( $slide_data['css_id'] ) . "_thumbs' class='sa_owl_thumbs_wrap sa_thumbs_" . $thumbs_loc . $add_classes . "' style='" . $thumbs_style . "'>";
800
+ $output .= "<div class='owl-thumbs' data-slider-id='" . esc_attr( $slide_data['css_id'] ) . "'>";
801
+ for ( $i = 1; $i <= $slide_data['num_slides']; $i++ ) {
802
+ // get background image for the thumb (slide image background).
803
+ if ( ( 'IMAGE' === $slide_data[ 'slide' . $i . '_popup_type' ] ) &&
804
+ ( 'no' !== $slide_data[ 'slide' . $i . '_popup_background' ] ) &&
805
+ ( '' !== $slide_data[ 'slide' . $i . '_popup_image' ] ) ) {
806
+ $thumb_image_arr = wp_get_attachment_image_src( $slide_data[ 'slide' . $i . '_popup_imageid' ], $slide_data[ 'slide' . $i . '_popup_background' ] );
807
+ $thumb_image_src = $thumb_image_arr[0];
808
+ } elseif ( ( 'VIDEO' === $slide_data[ 'slide' . $i . '_popup_type' ] ) &&
809
+ ( 'youtube' === $slide_data[ 'slide' . $i . '_popup_video_type' ] ) &&
810
+ ( '99999999' === $slide_data[ 'slide' . $i . '_image_id' ] ) ) {
811
+ $thumb_image_src = array();
812
+ $popup_video_id = $slide_data[ 'slide' . $i . '_popup_video_id' ];
813
+ $thumb_image_src = 'https://img.youtube.com/vi/' . $popup_video_id . '/hqdefault.jpg';
814
+ } elseif ( 0 !== $slide_data[ 'slide' . $i . '_image_id' ] ) {
815
+ $thumb_image_src = wp_get_attachment_image_src( $slide_data[ 'slide' . $i . '_image_id' ], $slide_data['thumbs_image_size'] );
816
+ $thumb_image_src = $thumb_image_src[0];
817
+ } else {
818
+ // use a placeholder image if slide has no background image.
819
+ $thumb_image_src = SA_PLUGIN_PATH . 'images/image_placeholder.jpg';
820
+ }
821
+ // thumbnail - set style.
822
+ $thumb_style = 'background-image:url("' . $thumb_image_src . '"); ';
823
+ $thumb_style .= 'width:' . $slide_data['thumbs_width'] . 'px; ';
824
+ $thumb_style .= 'height:' . $slide_data['thumbs_height'] . 'px; ';
825
+ $thumb_style .= 'background-position:' . $slide_data[ 'slide' . $i . '_image_pos' ] . '; ';
826
+ $thumb_style .= 'background-size:' . $slide_data[ 'slide' . $i . '_image_size' ] . '; ';
827
+ $thumb_style .= 'background-repeat:' . $slide_data[ 'slide' . $i . '_image_repeat' ] . '; ';
828
+ $thumb_style .= 'opacity:' . $thumbs_opacity . '; ';
829
+ $thumb_style .= 'border:solid ' . $slide_data['thumbs_border_width'] . 'px transparent';
830
+ $output .= "<div class='owl-thumb-item' style='" . $thumb_style . "' title='Slide " . $i . "'></div>";
831
+ }
832
+ $output .= '</div>'; // .sa_owl_thumbs
833
+ $output .= "</div>\n"; // .sa_owl_thumbs_wrap
834
+ }
835
+
836
+ // SHOWCASE CAROUSEL - NAVIGATION CONTAINER.
837
+ if ( '1' === $slide_data['showcase_slider'] ) {
838
+ if ( 'true' === $slide_data['autohide_arrows'] ) {
839
+ $output .= "<div id='showcase_" . esc_attr( $id ) . "' class='showcase_nav owl-nav autohide_arrows'></div>\n";
840
+ } else {
841
+ $output .= "<div id='showcase_" . esc_attr( $id ) . "' class='showcase_nav owl-nav'></div>\n";
842
+ }
843
+ }
844
+
845
+ $output .= "</div>\n"; // .white or .black
846
+
847
+ // PRO VERSION - CREATE A (HIDDEN) DIV FOR EACH 'HTML' POPUP.
848
+ if ( $sa_pro_version ) {
849
+ for ( $i = 1; $i <= $slide_data['num_slides']; $i++ ) {
850
+ if ( 'HTML' === $slide_data[ 'slide' . $i . '_popup_type' ] ) {
851
+ $popup_css_id = $slide_data[ 'slide' . $i . '_popup_css_id' ];
852
+ $popup_bgcol = $slide_data[ 'slide' . $i . '_popup_bgcol' ];
853
+ $popup_width = $slide_data[ 'slide' . $i . '_popup_width' ];
854
+ $output .= "<div id='" . $popup_css_id . "' class='mfp-hide sa_custom_popup' ";
855
+ $output .= "style='background:" . $popup_bgcol . '; max-width:' . $popup_width . "px;'>\n";
856
+ if ( '1' === $slide_data[ 'slide' . $i . '_popup_shortcode' ] ) {
857
+ $output .= do_shortcode( $slide_data[ 'slide' . $i . '_popup_html' ] );
858
+ } else {
859
+ $output .= $slide_data[ 'slide' . $i . '_popup_html' ];
860
+ }
861
+ $output .= "</div>\n";
862
+ }
863
+ }
864
+ }
865
+
866
+ // ### ENQUEUE JQUERY SCRIPT IF IT HAS NOT ALREADY BEEN LOADED ###
867
+ if ( ! wp_script_is( 'jquery', 'done' ) ) {
868
+ wp_enqueue_script( 'jquery' );
869
+ }
870
+
871
+ // ### GENERATE JQUERY CODE FOR THE OWL CAROUSEL SLIDER ###
872
+ if ( ( 1 === $slide_data['items_width1'] ) && ( 1 === $slide_data['items_width2'] ) && ( 1 === $slide_data['items_width3'] ) &&
873
+ ( 1 === $slide_data['items_width4'] ) && ( 1 === $slide_data['items_width5'] ) && ( 1 === $slide_data['items_width6'] ) ) {
874
+ $single_item = 1;
875
+ } else {
876
+ $single_item = 0;
877
+ }
878
+
879
+ $output .= "<script type='text/javascript'>\n";
880
+ if ( '1' === $slide_data['sa_window_onload'] ) {
881
+ $output .= " document.addEventListener('DOMContentLoaded', function() {\n";
882
+ } else {
883
+ $output .= " jQuery(document).ready(function() {\n";
884
+ }
885
+
886
+ // JQUERY CODE FOR OWN CAROUSEL.
887
+ $output .= " jQuery('#" . esc_attr( $slide_data['css_id'] ) . "').owlCarousel({\n";
888
+ if ( 1 === $single_item ) {
889
+ $output .= " items : 1,\n";
890
+ if ( ( 'Fade' === $slide_data['transition'] ) || ( 'fade' === $slide_data['transition'] ) ) {
891
+ $output .= " animateOut : 'fadeOut',\n";
892
+ } elseif ( ( 'Slide Down' === $slide_data['transition'] ) || ( 'goDown' === $slide_data['transition'] ) ) {
893
+ $output .= " animateOut : 'slideOutDown',\n";
894
+ $output .= " animateIn : 'fadeIn',\n";
895
+ } elseif ( 'Zoom In' === $slide_data['transition'] ) {
896
+ $output .= " animateOut : 'fadeOut',\n";
897
+ $output .= " animateIn : 'zoomIn',\n";
898
+ } elseif ( 'Zoom Out' === $slide_data['transition'] ) {
899
+ $output .= " animateOut : 'zoomOut',\n";
900
+ $output .= " animateIn : 'fadeIn',\n";
901
+ } elseif ( 'Flip Out X' === $slide_data['transition'] ) {
902
+ $output .= " animateOut : 'flipOutX',\n";
903
+ $output .= " animateIn : 'fadeIn',\n";
904
+ } elseif ( 'Flip Out Y' === $slide_data['transition'] ) {
905
+ $output .= " animateOut : 'flipOutY',\n";
906
+ $output .= " animateIn : 'fadeIn',\n";
907
+ } elseif ( 'Rotate Left' === $slide_data['transition'] ) {
908
+ $output .= " animateOut : 'rotateOutDownLeft',\n";
909
+ $output .= " animateIn : 'fadeIn',\n";
910
+ } elseif ( 'Rotate Right' === $slide_data['transition'] ) {
911
+ $output .= " animateOut : 'rotateOutDownRight',\n";
912
+ $output .= " animateIn : 'fadeIn',\n";
913
+ } elseif ( 'Bounce Out' === $slide_data['transition'] ) {
914
+ $output .= " animateOut : 'bounceOut',\n";
915
+ $output .= " animateIn : 'fadeIn',\n";
916
+ } elseif ( 'Roll Out' === $slide_data['transition'] ) {
917
+ $output .= " animateOut : 'rollOut',\n";
918
+ $output .= " animateIn : 'fadeIn',\n";
919
+ }
920
+ $output .= ' smartSpeed : ' . esc_attr( $slide_data['slide_transition'] ) . ",\n";
921
+ } else {
922
+ $output .= " responsive:{\n";
923
+ $output .= ' 0:{ items:' . esc_attr( $slide_data['items_width1'] ) . " },\n";
924
+ $output .= ' 480:{ items:' . esc_attr( $slide_data['items_width2'] ) . " },\n";
925
+ $output .= ' 768:{ items:' . esc_attr( $slide_data['items_width3'] ) . " },\n";
926
+ $output .= ' 980:{ items:' . esc_attr( $slide_data['items_width4'] ) . " },\n";
927
+ $output .= ' 1200:{ items:' . esc_attr( $slide_data['items_width5'] ) . " },\n";
928
+ $output .= ' 1500:{ items:' . esc_attr( $slide_data['items_width6'] ) . " }\n";
929
+ $output .= " },\n";
930
+ }
931
+ if ( 0.0 === $slide_data['slide_duration'] ) {
932
+ $output .= " autoplay : false,\n";
933
+ $output .= " autoplayHoverPause : false,\n";
934
+ } else {
935
+ $output .= " autoplay : true,\n";
936
+ $output .= ' autoplayTimeout : ' . esc_attr( $slide_data['slide_duration'] ) . ",\n";
937
+ $output .= ' autoplayHoverPause : ' . esc_attr( $slide_data['stop_hover'] ) . ",\n";
938
+ }
939
+ $output .= ' smartSpeed : ' . esc_attr( $slide_data['slide_transition'] ) . ",\n";
940
+ $output .= ' fluidSpeed : ' . esc_attr( $slide_data['slide_transition'] ) . ",\n";
941
+ $output .= ' autoplaySpeed : ' . esc_attr( $slide_data['slide_transition'] ) . ",\n";
942
+ $output .= ' navSpeed : ' . esc_attr( $slide_data['slide_transition'] ) . ",\n";
943
+ $output .= ' dotsSpeed : ' . esc_attr( $slide_data['slide_transition'] ) . ",\n";
944
+ if ( '1' === $slide_data['dot_per_slide'] ) {
945
+ $output .= " dotsEach : 1,\n";
946
+ }
947
+ $output .= ' loop : ' . esc_attr( $slide_data['loop_slider'] ) . ",\n";
948
+ $output .= ' nav : ' . esc_attr( $slide_data['nav_arrows'] ) . ",\n";
949
+ $output .= " navText : ['Previous','Next'],\n";
950
+ if ( '1' === $slide_data['showcase_slider'] ) {
951
+ $output .= " navContainer : '#showcase_" . esc_attr( $id ) . "',\n";
952
+ }
953
+ $output .= ' dots : ' . esc_attr( $slide_data['pagination'] ) . ",\n";
954
+ $output .= " responsiveRefreshRate : 200,\n";
955
+ if ( 'page' === $slide_data['slide_by'] ) {
956
+ $output .= " slideBy : 'page',\n";
957
+ } else {
958
+ $output .= ' slideBy : ' . esc_attr( $slide_data['slide_by'] ) . ",\n";
959
+ }
960
+ $output .= " mergeFit : true,\n";
961
+ $output .= ' autoHeight : ' . esc_attr( $slide_data['auto_height'] ) . ",\n";
962
+ if ( '1' === $slide_data['lazy_load_images'] ) {
963
+ $output .= " lazyLoad : true,\n";
964
+ $output .= " lazyLoadEager: 1,\n";
965
+ }
966
+ if ( ( $sa_pro_version ) && ( '1' === $slide_data['thumbs_active'] ) ) {
967
+ $output .= " thumbs : true,\n";
968
+ $output .= " thumbsPrerendered : true,\n";
969
+ }
970
+ if ( '1' === $slide_data['ulli_containers'] ) {
971
+ $output .= " stageElement : 'ul',\n";
972
+ $output .= " itemElement : 'li',\n";
973
+ }
974
+ if ( '1' === $slide_data['rtl_slider'] ) {
975
+ $output .= " rtl : true,\n";
976
+ }
977
+
978
+ if ( 0 !== $slide_data['start_pos'] ) {
979
+ $output .= ' startPosition : ' . $slide_data['start_pos'] . ",\n";
980
+ }
981
+ $output .= ' mouseDrag : ' . esc_attr( $slide_data['mouse_drag'] ) . ",\n";
982
+ $output .= ' touchDrag : ' . esc_attr( $slide_data['touch_drag'] ) . "\n";
983
+ $output .= " });\n";
984
+
985
+ // MAKE SLIDER VISIBLE (AFTER 'WINDOW ONLOAD' OR 'DOCUMENT READY' EVENT).
986
+ $output .= " jQuery('#" . esc_attr( $slide_data['css_id'] ) . "').css('visibility', 'visible');\n";
987
+
988
+ // JAVASCRIPT 'WINDOW RESIZE' EVENT TO SET CSS 'min-height' OF SLIDES WITHIN THIS SLIDER.
989
+ if ( '1' !== $slide_data['hero_slider'] ) {
990
+ $slide_min_height = $slide_data['slide_min_height_perc'];
991
+ if ( strpos( $slide_min_height, 'px' ) !== false ) {
992
+ $slide_min_height = 0;
993
+ }
994
+ if ( ( '' !== $slide_min_height ) && ( '0' !== $slide_min_height ) ) {
995
+ $output .= ' sa_resize_' . esc_attr( $slide_data['css_id'] ) . "();\n"; // initial call of resize function.
996
+ $output .= " window.addEventListener('resize', sa_resize_" . esc_attr( $slide_data['css_id'] ) . ");\n"; // create resize event.
997
+ // RESIZE EVENT FUNCTION (to set slide CSS 'min-height').
998
+ $output .= ' function sa_resize_' . esc_attr( $slide_data['css_id'] ) . "() {\n";
999
+ // get slide min height setting.
1000
+ $output .= " var min_height = '" . $slide_min_height . "';\n";
1001
+ // get window width.
1002
+ $output .= " var win_width = jQuery(window).width();\n";
1003
+ $output .= " var slider_width = jQuery('#" . esc_attr( $slide_data['css_id'] ) . "').width();\n";
1004
+ // calculate slide width according to window width & number of slides.
1005
+ $output .= " if (win_width < 480) {\n";
1006
+ $output .= ' var slide_width = slider_width / ' . esc_attr( $slide_data['items_width1'] ) . ";\n";
1007
+ $output .= " } else if (win_width < 768) {\n";
1008
+ $output .= ' var slide_width = slider_width / ' . esc_attr( $slide_data['items_width2'] ) . ";\n";
1009
+ $output .= " } else if (win_width < 980) {\n";
1010
+ $output .= ' var slide_width = slider_width / ' . esc_attr( $slide_data['items_width3'] ) . ";\n";
1011
+ $output .= " } else if (win_width < 1200) {\n";
1012
+ $output .= ' var slide_width = slider_width / ' . esc_attr( $slide_data['items_width4'] ) . ";\n";
1013
+ $output .= " } else if (win_width < 1500) {\n";
1014
+ $output .= ' var slide_width = slider_width / ' . esc_attr( $slide_data['items_width5'] ) . ";\n";
1015
+ $output .= " } else {\n";
1016
+ $output .= ' var slide_width = slider_width / ' . esc_attr( $slide_data['items_width6'] ) . ";\n";
1017
+ $output .= " }\n";
1018
+ $output .= " slide_width = Math.round(slide_width);\n";
1019
+ // calculate CSS 'min-height' using the captured 'min-height' data settings for this slider.
1020
+ $output .= " var slide_height = '0';\n";
1021
+ $output .= " if (min_height == 'aspect43') {\n";
1022
+ $output .= ' slide_height = (slide_width / 4) * 3;';
1023
+ $output .= " slide_height = Math.round(slide_height);\n";
1024
+ $output .= " } else if (min_height == 'aspect169') {\n";
1025
+ $output .= ' slide_height = (slide_width / 16) * 9;';
1026
+ $output .= " slide_height = Math.round(slide_height);\n";
1027
+ $output .= " } else {\n";
1028
+ $output .= ' slide_height = (slide_width / 100) * min_height;';
1029
+ $output .= " slide_height = Math.round(slide_height);\n";
1030
+ $output .= " }\n";
1031
+ // set the slide 'min-height' css value.
1032
+ $output .= " jQuery('#" . esc_attr( $slide_data['css_id'] ) . " .owl-item .sa_hover_container').css('min-height', slide_height+'px');\n";
1033
+ $output .= " }\n";
1034
+ }
1035
+ }
1036
+
1037
+ // JAVASCRIPT FOR SHOWCASE CAROUSELS ONLY.
1038
+ // DYNAMICALLY SET CLASS NAMES FOR LEFTMOST (FIRST) AND RIGHTMOST (LAST) ACTIVE (DISPLAYED) SLIDES.
1039
+ if ( '1' === $slide_data['showcase_slider'] ) {
1040
+ $output .= " set_first_last_active_classes('" . esc_attr( $slide_data['css_id'] ) . "');\n";
1041
+ $output .= " jQuery('#" . esc_attr( $slide_data['css_id'] ) . "').on('translated.owl.carousel resized.owl.carousel', function(event) {\n";
1042
+ $output .= " set_first_last_active_classes('" . esc_attr( $slide_data['css_id'] ) . "');\n";
1043
+ $output .= " });\n";
1044
+ $output .= " function set_first_last_active_classes(css_id) {\n";
1045
+ $output .= " var total = jQuery('#" . esc_attr( $slide_data['css_id'] ) . " .owl-stage .owl-item.active').length;\n";
1046
+ $output .= " jQuery('#" . esc_attr( $slide_data['css_id'] ) . " .owl-stage .owl-item').removeClass('sc_partial');\n";
1047
+ $output .= " jQuery('#" . esc_attr( $slide_data['css_id'] ) . " .owl-stage .owl-item.active').each(function(index){\n";
1048
+ $output .= " if (index === 0) {\n"; // this is the first active slide.
1049
+ $output .= " jQuery(this).addClass('sc_partial');\n";
1050
+ $output .= " }\n";
1051
+ $output .= " if (index === total - 1 && total > 1) {\n"; // this is the last active slide.
1052
+ $output .= " jQuery(this).addClass('sc_partial');\n";
1053
+ $output .= " }\n";
1054
+ $output .= " });\n";
1055
+ $output .= " }\n";
1056
+ }
1057
+
1058
+ // JAVASCRIPT FOR 'CLICK TO ADVANCE' OPTION ONLY.
1059
+ if ( 'true' === $slide_data['click_advance'] ) {
1060
+ if ( ( 'false' === $slide_data['touch_drag'] ) && ( 'false' === $slide_data['mouse_drag'] ) ) {
1061
+ $output .= ' var cta_' . $id . " = jQuery('#" . esc_attr( $slide_data['css_id'] ) . "');\n";
1062
+ $output .= " jQuery('#" . esc_attr( $slide_data['css_id'] ) . "').click(function() {\n";
1063
+ $output .= ' cta_' . $id . ".trigger('next.owl.carousel');\n";
1064
+ $output .= " });\n";
1065
+ }
1066
+ }
1067
+
1068
+ // JAVASCRIPT FOR 'MOUSEWHEEL NAVIGATION' OPTION ONLY.
1069
+ if ( 'true' === $slide_data['mousewheel'] ) {
1070
+ $output .= ' var mw_' . $id . " = jQuery('#" . esc_attr( $slide_data['css_id'] ) . "');\n";
1071
+ $output .= ' mw_' . $id . ".on('mousewheel', '.owl-stage', function (e) {\n";
1072
+ $output .= " if (e.deltaY>0) {\n";
1073
+ $output .= ' mw_' . $id . ".trigger('next.owl');\n";
1074
+ $output .= " } else {\n";
1075
+ $output .= ' mw_' . $id . ".trigger('prev.owl');\n";
1076
+ $output .= " }\n";
1077
+ $output .= " e.preventDefault();\n";
1078
+ $output .= " });\n";
1079
+ }
1080
+
1081
+ // JAVASCRIPT FOR 'SLIDE GOTO LINKS".
1082
+ $output .= " var owl_goto = jQuery('#" . esc_attr( $slide_data['css_id'] ) . "');\n";
1083
+ for ( $i = 1; $i <= $slide_data['num_slides']; $i++ ) {
1084
+ $output .= " jQuery('." . esc_attr( $slide_data['css_id'] ) . '_goto' . $i . "').click(function(event){\n";
1085
+ $output .= " owl_goto.trigger('to.owl.carousel', " . ( $i - 1 ) . ");\n";
1086
+ $output .= " });\n";
1087
+ }
1088
+
1089
+ // ### PRO VERSION - JQUERY/JAVASCRIPT CODE FOR THUMBNAIL PAGINATION ###
1090
+ if ( ( $sa_pro_version ) && ( '1' === $slide_data['thumbs_active'] ) ) {
1091
+
1092
+ // BORDER WIDTH IS SET - SET BORDER COLOUR TO THE ACTIVE THUMB.
1093
+ if ( $slide_data['thumbs_border_width'] > 0 ) {
1094
+ // set border colour of the active (first) thumb.
1095
+ $output .= " jQuery('#" . esc_attr( $slide_data['css_id'] ) . "_thumbs .owl-thumbs .active').css('border-color', '" . $slide_data['thumbs_border_color'] . "');\n";
1096
+ $output .= " var owl = jQuery('#" . esc_attr( $slide_data['css_id'] ) . "');\n";
1097
+ // owl carousel change event - set border colour of the active thumb.
1098
+ $output .= " owl.on('changed.owl.carousel', function(event) {\n";
1099
+ $output .= " jQuery('#" . esc_attr( $slide_data['css_id'] ) . "_thumbs .owl-thumbs .owl-thumb-item').css('border-color', 'transparent');\n";
1100
+ $output .= " jQuery('#" . esc_attr( $slide_data['css_id'] ) . "_thumbs .owl-thumbs .active').css('border-color', '" . $slide_data['thumbs_border_color'] . "');\n";
1101
+ $output .= " })\n";
1102
+ }
1103
+
1104
+ // RESIZE WINDOW EVENT - RESIZE THUMBS WIDTH & HEIGHT DEPENDING ON WINDOW WIDTH BREAKPOINTS.
1105
+ $output .= ' sa_resize_thumbs_' . esc_attr( $slide_data['css_id'] ) . "();\n"; // initial call of resize function.
1106
+ $output .= " window.addEventListener('resize', sa_resize_thumbs_" . esc_attr( $slide_data['css_id'] ) . ");\n"; // create resize event.
1107
+ $output .= ' function sa_resize_thumbs_' . esc_attr( $slide_data['css_id'] ) . "() {\n";
1108
+ $output .= " var win_width = jQuery(window).width();\n";
1109
+ $output .= ' var tablet_perc = parseFloat(' . $slide_data['thumbs_resp_tablet'] . " / 100);\n";
1110
+ $output .= ' var mobile_perc = parseFloat(' . $slide_data['thumbs_resp_mobile'] . " / 100);\n";
1111
+ $output .= ' var tablet_width = Math.round(' . $slide_data['thumbs_width'] . " * tablet_perc) + 'px';\n";
1112
+ $output .= ' var tablet_height = Math.round(' . $slide_data['thumbs_height'] . " * tablet_perc) + 'px';\n";
1113
+ $output .= ' var mobile_width = Math.round(' . $slide_data['thumbs_width'] . " * mobile_perc) + 'px';\n";
1114
+ $output .= ' var mobile_height = Math.round(' . $slide_data['thumbs_height'] . " * mobile_perc) + 'px';\n";
1115
+ $output .= " if ((mobile_perc != 0) && (win_width < 768)) {\n";
1116
+ $output .= " jQuery('#" . esc_attr( $slide_data['css_id'] ) . "_thumbs .owl-thumbs .owl-thumb-item').css('width', mobile_width);\n";
1117
+ $output .= " jQuery('#" . esc_attr( $slide_data['css_id'] ) . "_thumbs .owl-thumbs .owl-thumb-item').css('height', mobile_height);\n";
1118
+ $output .= " } else if ((tablet_perc != 0) && (win_width < 1000)) {\n";
1119
+ $output .= " jQuery('#" . esc_attr( $slide_data['css_id'] ) . "_thumbs .owl-thumbs .owl-thumb-item').css('width', tablet_width);\n";
1120
+ $output .= " jQuery('#" . esc_attr( $slide_data['css_id'] ) . "_thumbs .owl-thumbs .owl-thumb-item').css('height', tablet_height);\n";
1121
+ $output .= " } else {\n";
1122
+ $output .= " jQuery('#" . esc_attr( $slide_data['css_id'] ) . "_thumbs .owl-thumbs .owl-thumb-item').css('width', '" . $slide_data['thumbs_width'] . "px');\n";
1123
+ $output .= " jQuery('#" . esc_attr( $slide_data['css_id'] ) . "_thumbs .owl-thumbs .owl-thumb-item').css('height', '" . $slide_data['thumbs_height'] . "px');\n";
1124
+ $output .= " }\n";
1125
+ // THUMBS POSITION 'Inside Left' or 'Inside Right' - RESIZE CONTAINER WIDTH DEPENDING ON WINDOW WIDTH BREAKPOINTS.
1126
+ if ( ( 'inside_left' === $thumbs_loc ) || ( 'inside_right' === $thumbs_loc ) ) {
1127
+ $output .= " if ((mobile_perc != 0) && (win_width < 768)) {\n";
1128
+ $output .= " jQuery('#" . esc_attr( $slide_data['css_id'] ) . "_thumbs').css('width', mobile_width);\n";
1129
+ $output .= " jQuery('#" . esc_attr( $slide_data['css_id'] ) . "_thumbs').css('height', mobile_height);\n";
1130
+ $output .= " } else if ((tablet_perc != 0) && (win_width < 1000)) {\n";
1131
+ $output .= " jQuery('#" . esc_attr( $slide_data['css_id'] ) . "_thumbs').css('width', tablet_width);\n";
1132
+ $output .= " jQuery('#" . esc_attr( $slide_data['css_id'] ) . "_thumbs').css('height', tablet_height);\n";
1133
+ $output .= " } else {\n";
1134
+ $output .= " jQuery('#" . esc_attr( $slide_data['css_id'] ) . "_thumbs').css('width', '" . $slide_data['thumbs_width'] . "px');\n";
1135
+ $output .= " jQuery('#" . esc_attr( $slide_data['css_id'] ) . "_thumbs').css('height', '" . $slide_data['thumbs_height'] . "px');\n";
1136
+ $output .= " }\n";
1137
+ }
1138
+ $output .= " }\n";
1139
+ }
1140
+
1141
+ // CALL THE WINDOW RESIZE EVENT AFTER THE OWL CAROUSEL SLIDER HAS BEEN INITIALIZED.
1142
+ $output .= ' var resize_' . $id . " = jQuery('.owl-carousel');\n";
1143
+ $output .= ' resize_' . $id . ".on('initialized.owl.carousel', function(e) {\n";
1144
+ $output .= " if (typeof(Event) === 'function') {\n";
1145
+ // modern browsers.
1146
+ $output .= " window.dispatchEvent(new Event('resize'));\n";
1147
+ $output .= " } else {\n";
1148
+ // for IE and other old browsers (causes deprecation warning on modern browsers).
1149
+ $output .= " var evt = window.document.createEvent('UIEvents');\n";
1150
+ $output .= " evt.initUIEvent('resize', true, false, window, 0);\n";
1151
+ $output .= " window.dispatchEvent(evt);\n";
1152
+ $output .= " }\n";
1153
+ $output .= " });\n";
1154
+ $output .= " });\n";
1155
+ $output .= "</script>\n";
1156
+
1157
+ // ### GENERATE JQUERY CODE FOR THE MAGNIFIC POPUP ###
1158
+ if ( ( $sa_pro_version ) && ( $lightbox_count > 0 ) ) {
1159
+ $output .= "<script type='text/javascript'>\n";
1160
+ if ( '1' === $slide_data['sa_window_onload'] ) {
1161
+ $output .= "document.addEventListener('DOMContentLoaded', function() {\n";
1162
+ } else {
1163
+ $output .= "jQuery(document).ready(function() {\n";
1164
+ }
1165
+ $output .= " jQuery('#" . $lightbox_gallery_id . "').magnificPopup({\n";
1166
+ $output .= " items: [\n";
1167
+ $count = 0;
1168
+ for ( $i = 1; $i <= $slide_data['num_slides']; $i++ ) {
1169
+ // LOOP THROUGH EACH SLIDE.
1170
+ if ( ( 'IMAGE' === $slide_data[ 'slide' . $i . '_popup_type' ] ) && ( '' !== $slide_data[ 'slide' . $i . '_popup_image' ] ) ) {
1171
+ // SLIDE CONTAINS AN IMAGE POPUP.
1172
+ $img_url = $slide_data[ 'slide' . $i . '_popup_image' ];
1173
+ $img_title = $slide_data[ 'slide' . $i . '_popup_imagetitle' ];
1174
+ if ( '' !== $img_title ) {
1175
+ $output .= " { src: '" . esc_attr( $img_url ) . "', title: '" . esc_attr( $img_title ) . "' }";
1176
+ } else {
1177
+ $output .= " { src: '" . esc_attr( $img_url ) . "' }";
1178
+ }
1179
+ $count++;
1180
+ if ( $count < $lightbox_count ) {
1181
+ $output .= ",\n"; } else {
1182
+ $output .= "\n"; }
1183
+ }
1184
+ if ( ( 'VIDEO' === $slide_data[ 'slide' . $i . '_popup_type' ] ) && ( '' !== $slide_data[ 'slide' . $i . '_popup_video_id' ] ) ) {
1185
+ // SLIDE CONTAINS A VIDEO POPUP.
1186
+ $video_id = $slide_data[ 'slide' . $i . '_popup_video_id' ];
1187
+ $video_type = $slide_data[ 'slide' . $i . '_popup_video_type' ];
1188
+ if ( 'youtube' === $video_type ) {
1189
+ $video_url = 'http://www.youtube.com/watch?v=' . $video_id;
1190
+ } elseif ( 'vimeo' === $video_type ) {
1191
+ $video_url = 'http://vimeo.com/' . $video_id;
1192
+ }
1193
+ $output .= " { src: '" . esc_attr( $video_url ) . "', type: 'iframe' }";
1194
+ $count++;
1195
+ if ( $count < $lightbox_count ) {
1196
+ $output .= ",\n"; } else {
1197
+ $output .= "\n"; }
1198
+ }
1199
+ if ( 'HTML' === $slide_data[ 'slide' . $i . '_popup_type' ] ) {
1200
+ // SLIDE CONTAINS A HTML POPUP.
1201
+ $popup_css_id = '#' . $slide_data[ 'slide' . $i . '_popup_css_id' ];
1202
+ $output .= " { src: '" . esc_attr( $popup_css_id ) . "', type: 'inline' }";
1203
+ $count++;
1204
+ if ( $count < $lightbox_count ) {
1205
+ $output .= ",\n"; } else {
1206
+ $output .= "\n"; }
1207
+ }
1208
+ }
1209
+ $output .= " ],\n";
1210
+ $output .= " gallery: { enabled: true, tCounter: '' },\n";
1211
+ $output .= " mainClass: 'sa_popup',\n";
1212
+ $output .= " closeBtnInside: true,\n";
1213
+ $output .= " fixedContentPos: true,\n";
1214
+ if ( 0 !== $slide_data['slide_duration'] ) {
1215
+ $output .= " callbacks: {\n";
1216
+ $output .= " open: function() {\n";
1217
+ $output .= " jQuery('#" . esc_attr( $slide_data['css_id'] ) . "').trigger('stop.owl.autoplay');\n";
1218
+ $output .= " },\n";
1219
+ $output .= " close: function() {\n";
1220
+ $output .= " jQuery('#" . esc_attr( $slide_data['css_id'] ) . "').trigger('play.owl.autoplay');\n";
1221
+ $output .= " }\n";
1222
+ $output .= " },\n";
1223
+ }
1224
+ $output .= " type: 'image'\n";
1225
+ $output .= " });\n";
1226
+ $output .= "});\n";
1227
+
1228
+ // JAVASCRIPT FUNCTION WHICH OPENS THIS MAGNIFIC POPUP ON A SPECIFIED SLIDE.
1229
+ $output .= 'function ' . $lightbox_function . "(slide) {\n";
1230
+ $output .= " jQuery('#" . $lightbox_gallery_id . "').magnificPopup('open');\n";
1231
+ $output .= " jQuery('#" . $lightbox_gallery_id . "').magnificPopup('goTo', slide-1);\n";
1232
+ $output .= "}\n";
1233
+ $output .= "</script>\n";
1234
+
1235
+ // DIV CONTAINER WHICH HOLDS THIS MAGNIFIC POPUP CONTENT (HIDDEN).
1236
+ $output .= "<div id='" . $lightbox_gallery_id . "' style='display:none;'></div>\n";
1237
+ }
1238
+ }
1239
+ }
1240
+ return $output;
1241
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -98,6 +98,9 @@ Adding a SLIDE ANYTHING slider using the WordPress 5.0 'Block Editor' is pretty
98
 
99
  == Changelog ==
100
 
 
 
 
101
  = 2.3.47 =
102
  * Fixed a security vulnerability whereby XSS scripts could be inserted within the slider post titles (part 2)
103
 
@@ -776,3 +779,6 @@ Adding a SLIDE ANYTHING slider using the WordPress 5.0 'Block Editor' is pretty
776
 
777
  = 2.3.47 =
778
  * Fixed a security vulnerability whereby XSS scripts could be inserted within the slider post titles (part 2)
 
 
 
98
 
99
  == Changelog ==
100
 
101
+ = 2.4.0 =
102
+ * Updated all PHP code within the plugin to meet the WordPress.org security and coding standards.
103
+
104
  = 2.3.47 =
105
  * Fixed a security vulnerability whereby XSS scripts could be inserted within the slider post titles (part 2)
106
 
779
 
780
  = 2.3.47 =
781
  * Fixed a security vulnerability whereby XSS scripts could be inserted within the slider post titles (part 2)
782
+
783
+ = 2.4.0 =
784
+ * Updated all PHP code within the plugin to meet the WordPress.org security and coding standards.
slide-anything.php CHANGED
@@ -1,44 +1,49 @@
1
- <?php
2
- /**
3
- * Plugin Name: Slide Anything - Responsive Content / HTML Slider and Carousel
4
- * Plugin URI: https://wordpress.org/plugins/slide-anything/
5
- * Description: Slide Anything allows you to create a carousel/slider where the content for each slide can be anything you want - images, text, HTML, and even shortcodes. This plugin uses the Owl Carousel jQuery plugin, and lets you create beautiful, touch enabled, responsive carousels and sliders.
6
- * Author: Simon Edge
7
- * Version: 2.3.47
8
- * License: GPLv2 or later
9
- */
10
-
11
- if (!defined('ABSPATH')) exit; // EXIT IF ACCESSED DIRECTLY
12
-
13
- // SET CONSTANT FOR PLUGIN PATH
14
- define('SA_PLUGIN_PATH', plugins_url('/', __FILE__));
15
-
16
- require 'php/slide-anything-admin.php';
17
- require 'php/slide-anything-frontend.php';
18
-
19
- /* ##### PLUGIN ACTIVATION HOOK ##### */
20
- register_activation_hook(__FILE__, 'cpt_slider_plugin_activation' );
21
-
22
- /* ##### ADD ACTION HOOKS & FILTERS FOR PLUGIN ##### */
23
- add_action('admin_enqueue_scripts', 'cpt_register_admin_scripts', 999999);
24
- add_action('init', 'cpt_slider_register');
25
- add_action('post_row_actions', 'cpt_slider_row_actions', 10, 2);
26
- add_action('add_meta_boxes', 'cpt_slider_add_meta_boxes');
27
- add_action('save_post', 'cpt_slider_save_postdata');
28
- add_filter('manage_sa_slider_posts_columns', 'cpt_slider_modify_columns');
29
- add_filter('manage_sa_slider_posts_custom_column', 'cpt_slider_custom_column_content');
30
- if (!get_option('sa-disable-tinymce-button')) {
31
- add_action('admin_head', 'add_tinymce_button');
32
- add_action('admin_footer', 'get_tinymce_shortcode_array', 9999999);
33
- }
34
- add_action('admin_menu', 'extra_sa_menu_pages');
35
- add_filter('template_include', 'sa_preview_page_template');
36
- add_filter('wp_kses_allowed_html', 'slides_allow_iframes_filter');
37
-
38
- // SLIDE ANYTHING 2.0 UPGRADE NOTICE
39
- add_action('admin_notices', 'version_20_upgrade_notice');
40
- add_action('admin_init', 'slide_anything_notice_ignore');
41
-
42
- // ADD A CHECKBOX OPTION UNDER "Settings -> Writing" CALLED "Disable TinyMCE Button"
43
- add_action('admin_init', 'slide_anything_disable_tinymce_button_setting');
44
- ?>
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin Name: Slide Anything - Responsive Content / HTML Slider and Carousel
4
+ * Plugin URI: https://wordpress.org/plugins/slide-anything/
5
+ * Description: Slide Anything allows you to create a carousel/slider where the content for each slide can be anything you want - images, text, HTML, and even shortcodes. This plugin uses the Owl Carousel jQuery plugin, and lets you create beautiful, touch enabled, responsive carousels and sliders.
6
+ * Version: 2.4.0
7
+ *
8
+ * @package WordPress_Slide_Anything
9
+ * @author Simon Edge
10
+ * @copyright EdgeWebPages
11
+ * @license GPLv2 or later
12
+ */
13
+
14
+ if ( ! defined( 'ABSPATH' ) ) {
15
+ exit; // EXIT IF ACCESSED DIRECTLY.
16
+ }
17
+
18
+ // SET CONSTANT FOR PLUGIN PATH.
19
+ define( 'SA_PLUGIN_PATH', plugins_url( '/', __FILE__ ) );
20
+
21
+ require 'php/slide-anything-admin.php';
22
+ require 'php/slide-anything-frontend.php';
23
+
24
+ /* ##### PLUGIN ACTIVATION HOOK ##### */
25
+ register_activation_hook( __FILE__, 'cpt_slider_plugin_activation' );
26
+
27
+ /* ##### ADD ACTION HOOKS & FILTERS FOR PLUGIN ##### */
28
+ add_action( 'admin_enqueue_scripts', 'cpt_register_admin_scripts', 999999 );
29
+ add_action( 'init', 'cpt_slider_register' );
30
+ add_action( 'post_row_actions', 'cpt_slider_row_actions', 10, 2 );
31
+ add_action( 'add_meta_boxes', 'cpt_slider_add_meta_boxes' );
32
+ add_action( 'save_post', 'cpt_slider_save_postdata' );
33
+ add_filter( 'manage_sa_slider_posts_columns', 'cpt_slider_modify_columns' );
34
+ add_filter( 'manage_sa_slider_posts_custom_column', 'cpt_slider_custom_column_content' );
35
+ if ( ! get_option( 'sa-disable-tinymce-button' ) ) {
36
+ add_action( 'admin_head', 'add_tinymce_button' );
37
+ add_action( 'admin_footer', 'get_tinymce_shortcode_array', 9999999 );
38
+ }
39
+ add_action( 'admin_menu', 'extra_sa_menu_pages' );
40
+ add_filter( 'template_include', 'sa_preview_page_template' );
41
+ add_filter( 'wp_kses_allowed_html', 'slides_allow_iframes_filter' );
42
+
43
+ // SLIDE ANYTHING 2.0 UPGRADE NOTICE.
44
+ add_action( 'admin_notices', 'version_20_upgrade_notice' );
45
+ add_action( 'admin_init', 'slide_anything_notice_ignore' );
46
+
47
+ // ADD A CHECKBOX OPTION UNDER 'Settings -> Writing' CALLED 'Disable TinyMCE Button'.
48
+ add_action( 'admin_init', 'slide_anything_disable_tinymce_button_setting' );
49
+