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

Version Description

  • Discontinued the Slide Anything PRO plugin addon. All of the 'Pro' features will now be available within the 'Free' version of the plgin offered on WordPress.org. As ongoing developent and support for the Owl Carousel jQuery library (the engine on which Slide Anything is built) is now discontinued, there is a possibility that at some point in the future the Owl Carousel code will no longer work with the later versions of jQuery that may be bundled with WordPress. But I will endevour to keep the Slide Anything plugin running with WordPress as long as possible.
Download this release

Release Info

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

Code changes from version 2.4.1 to 2.4.2

php/slide-anything-admin.php CHANGED
@@ -14,8 +14,6 @@
14
  * ##### PLUGIN REGISTRATION HOOK - RUN WHEN THE PLUGIN IS ACTIVATED #####
15
  */
16
  function cpt_slider_plugin_activation() {
17
- $sa_pro_version = cpt_slider_validate_sa_pro_registration();
18
-
19
  // INSERT A 'SAMPLE SLIDER' CUSTOM POST INTO THE DATABASE.
20
  $sample_post_title = 'Sample Slider';
21
 
@@ -146,79 +144,6 @@ function cpt_slider_plugin_activation() {
146
  }
147
  }
148
 
149
- /**
150
- * ##### SLIDE ANYTHING PRO NOTICE #####
151
- */
152
- function cpt_slider_version_20_upgrade_notice() {
153
- global $current_user;
154
- $user_id = $current_user->ID;
155
- $sa_pro_version = cpt_slider_validate_sa_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 cpt_slider_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
  */
@@ -275,11 +200,10 @@ function cpt_slider_writing_settings_field1_callback() {
275
  * ##### ACTION HOOK - REGISTER SCRIPTS (JS AND CSS) FOR WordPress DASHBOARD ONLY #####
276
  */
277
  function cpt_slider_register_admin_scripts() {
278
- $sa_pro_version = cpt_slider_validate_sa_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.
@@ -310,13 +234,11 @@ function cpt_slider_register_admin_scripts() {
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
  }
@@ -548,15 +470,7 @@ function cpt_slider_add_meta_boxes() {
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 = cpt_slider_validate_sa_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
 
@@ -603,8 +517,7 @@ function cpt_slide_moved_content() {
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 = cpt_slider_validate_sa_pro_registration();
608
  echo "<div id='sa_slider_settings'>\n";
609
 
610
  // NONCE TO PREVENT CSRF SECURITY ATTACKS.
@@ -632,11 +545,7 @@ function cpt_slider_settings_content( $post ) {
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 ) {
@@ -850,9 +759,8 @@ function cpt_slider_settings_content( $post ) {
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 = cpt_slider_validate_sa_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 ) {
@@ -884,141 +792,134 @@ function cpt_slider_slides_content( $post ) {
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
  /**
@@ -1111,31 +1012,28 @@ function cpt_slider_slides_content( $post ) {
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.
@@ -1317,286 +1215,263 @@ function cpt_slider_slides_content( $post ) {
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
  /**
@@ -1741,13 +1616,12 @@ function cpt_slider_shortcode_content( $post ) {
1741
  * @param array $post Custom Post 'sa_slider'.
1742
  */
1743
  function cpt_slider_items_content( $post ) {
1744
- $sa_pro_version = cpt_slider_validate_sa_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 ) {
@@ -1868,34 +1742,23 @@ function cpt_slider_items_content( $post ) {
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.
@@ -1910,85 +1773,71 @@ function cpt_slider_items_content( $post ) {
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
  }
@@ -2466,202 +2315,161 @@ function cpt_slider_style_content( $post ) {
2466
  * @param array $post Custom Post 'sa_slider'.
2467
  */
2468
  function cpt_slider_thumbs_content( $post ) {
2469
- $sa_pro_version = cpt_slider_validate_sa_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
 
@@ -2671,7 +2479,6 @@ function cpt_slide_any_post_content() {
2671
  */
2672
  function cpt_slider_save_postdata() {
2673
  global $post;
2674
- $sa_pro_version = cpt_slider_validate_sa_pro_registration();
2675
 
2676
  // ### REMOVE XSS ATTACK VULNERABILITY FROM SLIDER POST TITLES ###
2677
  global $wpdb;
@@ -2714,26 +2521,24 @@ function cpt_slider_save_postdata() {
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 = '';
@@ -2766,47 +2571,45 @@ function cpt_slider_save_postdata() {
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';
@@ -2820,11 +2623,42 @@ function cpt_slider_save_postdata() {
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';
@@ -2835,13 +2669,11 @@ function cpt_slider_save_postdata() {
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 );
@@ -2853,43 +2685,6 @@ function cpt_slider_save_postdata() {
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
 
@@ -2929,47 +2724,45 @@ function cpt_slider_save_postdata() {
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;
@@ -3003,82 +2796,76 @@ function cpt_slider_save_postdata() {
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.
@@ -3362,58 +3149,45 @@ function cpt_slider_save_postdata() {
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 cpt_slider_validate_sa_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
  /**
@@ -3436,7 +3210,6 @@ function cpt_slider_extra_sa_menu_pages() {
3436
  * ### FUNCTION CONTAINING THE 'RE-ORDER' SLIDES FUNCTIONALITY ###
3437
  */
3438
  function cpt_slider_sa_reorder_slides_page() {
3439
- $sa_pro_version = cpt_slider_validate_sa_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
 
@@ -3572,13 +3345,11 @@ function cpt_slider_sa_reorder_slides_page() {
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 ) ) {
14
  * ##### PLUGIN REGISTRATION HOOK - RUN WHEN THE PLUGIN IS ACTIVATED #####
15
  */
16
  function cpt_slider_plugin_activation() {
 
 
17
  // INSERT A 'SAMPLE SLIDER' CUSTOM POST INTO THE DATABASE.
18
  $sample_post_title = 'Sample Slider';
19
 
144
  }
145
  }
146
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  /**
148
  * ##### ADD CHECKBOX OPTION UNDER "Settings -> Writing" CALLED "Disable TinyMCE Button" #####
149
  */
200
  * ##### ACTION HOOK - REGISTER SCRIPTS (JS AND CSS) FOR WordPress DASHBOARD ONLY #####
201
  */
202
  function cpt_slider_register_admin_scripts() {
203
+ $screen = get_current_screen();
204
+ $plugin_path = dirname( __FILE__ ) . '/../slide-anything.php';
205
+ $plugin_data = get_plugin_data( $plugin_path, false, false );
206
+ $plugin_ver = $plugin_data['Version'];
 
207
  if ( 'sa_slider' === $screen->post_type ) {
208
  // ONLY LOAD SCRIPTS (JS & CSS) WITHIN 'Slide Anything' SCREENS IN WordPress DASHBOARD.
209
  // enqueues all scripts, styles & settings required in order to use the WordPress Media JS APIs.
234
  wp_enqueue_script( 'sa-slider-admin-script' );
235
  wp_register_style( 'sa-slider-admin-css', SA_PLUGIN_PATH . 'css/slide-anything-admin.css', array(), $plugin_ver );
236
  wp_enqueue_style( 'sa-slider-admin-css' );
237
+ // load 'magnific popup' script and css.
238
+ wp_register_script( 'magnific-popup_js', SA_PLUGIN_PATH . 'magnific-popup/jquery.magnific-popup.min.js', array( 'jquery' ), '1.1.0', true );
239
+ wp_enqueue_script( 'magnific-popup_js' );
240
+ wp_register_style( 'magnific-popup_css', SA_PLUGIN_PATH . 'magnific-popup/magnific-popup.css', array(), '1.1.0' );
241
+ wp_enqueue_style( 'magnific-popup_css' );
 
 
242
  // DISABLE AUTOSAVE FOR THIS CUSTOM POST TYPE (causes issues with preview modal popup).
243
  wp_dequeue_script( 'autosave' );
244
  }
470
  add_meta_box( 'cpt_slider_items', __( 'Items Displayed' ), 'cpt_slider_items_content', 'sa_slider', 'side', 'default' );
471
  add_meta_box( 'cpt_slider_style', __( 'Slider Style' ), 'cpt_slider_style_content', 'sa_slider', 'side', 'default' );
472
  add_meta_box( 'cpt_slider_thumbs', __( 'Thumbnail Pagination' ), 'cpt_slider_thumbs_content', 'sa_slider', 'side', 'default' );
473
+ remove_meta_box( 'mymetabox_revslider_0', 'sa_slider', 'normal' ); // remove revolution slider meta box.
 
 
 
 
 
 
 
 
474
  }
475
 
476
 
517
  * @param array $post Custom Post 'sa_slider'.
518
  */
519
  function cpt_slider_settings_content( $post ) {
520
+ $num_slides = get_post_meta( $post->ID, 'sa_num_slides', true );
 
521
  echo "<div id='sa_slider_settings'>\n";
522
 
523
  // NONCE TO PREVENT CSRF SECURITY ATTACKS.
545
  // HIDDEN FIELD - MOVE SLIDE UP (SLIDE NUMBER).
546
  echo "<input type='hidden' id='sa_move_slide_up' name='sa_move_slide_up' value='0'/>\n";
547
  // HIDDEN FIELD - PRO VERSION.
548
+ echo "<input type='hidden' id='sa_pro_version' name='sa_pro_version' value='1'/>\n";
 
 
 
 
549
  // SLIDE DURATION.
550
  $slide_duration = get_post_meta( $post->ID, 'sa_slide_duration', true );
551
  if ( '' === $slide_duration ) {
759
  * @param array $post Custom Post 'sa_slider'.
760
  */
761
  function cpt_slider_slides_content( $post ) {
762
+ $num_slides = get_post_meta( $post->ID, 'sa_num_slides', true );
763
+ $slider_css_id = get_post_meta( $post->ID, 'sa_css_id', true );
 
764
  // DISABLE VISUAL EDITOR CHECKBOX.
765
  $disable_visual_editor = get_post_meta( $post->ID, 'sa_disable_visual_editor', true );
766
  if ( '' === $disable_visual_editor ) {
792
  }
793
  if ( '' === $num_slides ) {
794
  // A NEW SLIDER IS BEING CREATED - ADD 3 INITIAL SLIDES.
795
+ $num_slides = 3;
796
+ $slide_data[0]['edit_id'] = 'sa_slide1_content';
797
+ $slide_data[0]['content'] = 'Slide content';
798
+ $slide_data[0]['del_id'] = 'sa_slide1_delete';
799
+ $slide_data[0]['image_data'] = 'sa_slide1_image_data';
800
+ $slide_data[0]['image_id'] = 'sa_slide1_image_id';
801
+ $slide_data[0]['thumb'] = 'slide1_thumb';
802
+ $slide_data[0]['image_del'] = 'slide1_image_del';
803
+ $slide_data[0]['image_pos'] = 'sa_slide1_image_pos';
804
+ $slide_data[0]['image_size'] = 'sa_slide1_image_size';
805
+ $slide_data[0]['image_repeat'] = 'sa_slide1_image_repeat';
806
+ $slide_data[0]['image_color'] = 'sa_slide1_image_color';
807
+ $slide_data[0]['link_url'] = 'sa_slide1_link_url';
808
+ $slide_data[0]['link_target'] = 'sa_slide1_link_target';
809
+ $slide_data[0]['slide_no'] = 1;
810
+ $slide_data[1]['edit_id'] = 'sa_slide2_content';
811
+ $slide_data[1]['content'] = 'Slide content';
812
+ $slide_data[1]['del_id'] = 'sa_slide2_delete';
813
+ $slide_data[1]['image_data'] = 'sa_slide2_image_data';
814
+ $slide_data[1]['image_id'] = 'sa_slide2_image_id';
815
+ $slide_data[1]['thumb'] = 'slide2_thumb';
816
+ $slide_data[1]['image_del'] = 'slide2_image_del';
817
+ $slide_data[1]['image_pos'] = 'sa_slide2_image_pos';
818
+ $slide_data[1]['image_size'] = 'sa_slide2_image_size';
819
+ $slide_data[1]['image_repeat'] = 'sa_slide2_image_repeat';
820
+ $slide_data[1]['image_color'] = 'sa_slide2_image_color';
821
+ $slide_data[1]['link_url'] = 'sa_slide2_link_url';
822
+ $slide_data[1]['link_target'] = 'sa_slide2_link_target';
823
+ $slide_data[1]['slide_no'] = 2;
824
+ $slide_data[2]['edit_id'] = 'sa_slide3_content';
825
+ $slide_data[2]['content'] = 'Slide content';
826
+ $slide_data[2]['del_id'] = 'sa_slide3_delete';
827
+ $slide_data[2]['image_data'] = 'sa_slide3_image_data';
828
+ $slide_data[2]['image_id'] = 'sa_slide3_image_id';
829
+ $slide_data[2]['thumb'] = 'slide3_thumb';
830
+ $slide_data[2]['image_del'] = 'slide3_image_del';
831
+ $slide_data[2]['image_pos'] = 'sa_slide3_image_pos';
832
+ $slide_data[2]['image_size'] = 'sa_slide3_image_size';
833
+ $slide_data[2]['image_repeat'] = 'sa_slide3_image_repeat';
834
+ $slide_data[2]['image_color'] = 'sa_slide3_image_color';
835
+ $slide_data[2]['link_url'] = 'sa_slide3_link_url';
836
+ $slide_data[2]['link_target'] = 'sa_slide3_link_target';
837
+ $slide_data[2]['slide_no'] = 3;
838
+ $slide_data[0]['popup_type'] = 'sa_slide1_popup_type';
839
+ $slide_data[0]['popup_imageid'] = 'sa_slide1_popup_imageid';
840
+ $slide_data[0]['popup_imagetitle'] = 'sa_slide1_popup_imagetitle';
841
+ $slide_data[0]['popup_video_id'] = 'sa_slide1_popup_video_id';
842
+ $slide_data[0]['popup_video_type'] = 'sa_slide1_popup_video_type';
843
+ $slide_data[0]['popup_background'] = 'sa_slide1_popup_background';
844
+ $slide_data[0]['popup_html'] = 'sa_slide1_popup_html';
845
+ $slide_data[0]['popup_shortcode'] = 'sa_slide1_popup_shortcode';
846
+ $slide_data[0]['popup_bgcol'] = 'sa_slide1_popup_bgcol';
847
+ $slide_data[0]['popup_width'] = 'sa_slide1_popup_width';
848
+ $slide_data[1]['popup_type'] = 'sa_slide2_popup_type';
849
+ $slide_data[1]['popup_imageid'] = 'sa_slide2_popup_imageid';
850
+ $slide_data[1]['popup_imagetitle'] = 'sa_slide2_popup_imagetitle';
851
+ $slide_data[1]['popup_video_id'] = 'sa_slide2_popup_video_id';
852
+ $slide_data[1]['popup_video_type'] = 'sa_slide2_popup_video_type';
853
+ $slide_data[1]['popup_background'] = 'sa_slide2_popup_background';
854
+ $slide_data[1]['popup_html'] = 'sa_slide2_popup_html';
855
+ $slide_data[1]['popup_shortcode'] = 'sa_slide2_popup_shortcode';
856
+ $slide_data[1]['popup_bgcol'] = 'sa_slide2_popup_bgcol';
857
+ $slide_data[1]['popup_width'] = 'sa_slide2_popup_width';
858
+ $slide_data[2]['popup_type'] = 'sa_slide3_popup_type';
859
+ $slide_data[2]['popup_imageid'] = 'sa_slide3_popup_imageid';
860
+ $slide_data[2]['popup_imagetitle'] = 'sa_slide3_popup_imagetitle';
861
+ $slide_data[2]['popup_video_id'] = 'sa_slide3_popup_video_id';
862
+ $slide_data[2]['popup_video_type'] = 'sa_slide3_popup_video_type';
863
+ $slide_data[2]['popup_background'] = 'sa_slide3_popup_background';
864
+ $slide_data[2]['popup_html'] = 'sa_slide3_popup_html';
865
+ $slide_data[2]['popup_shortcode'] = 'sa_slide3_popup_shortcode';
866
+ $slide_data[2]['popup_bgcol'] = 'sa_slide3_popup_bgcol';
867
+ $slide_data[2]['popup_width'] = 'sa_slide3_popup_width';
 
 
868
  } else {
869
  // AN EXISTING SLIDER - GET SLIDE DATA FROM THE DATABASE AND SAVE WITHIN AN ARRAY.
870
  $num_slides = intval( $num_slides );
871
  $slide_data = array();
872
  $count = 0;
873
  for ( $i = 1; $i <= $num_slides; $i++ ) {
874
+ $slide_edit_id = 'sa_slide' . $i . '_content';
875
+ $slide_char_count = 'sa_slide' . $i . '_char_count';
876
+ $slide_data[ $count ]['edit_id'] = $slide_edit_id;
877
+ $slide_data[ $count ]['content'] = get_post_meta( $post->ID, $slide_edit_id, true );
878
+ $slide_data[ $count ]['char_count'] = get_post_meta( $post->ID, $slide_char_count, true );
879
+ $slide_data[ $count ]['del_id'] = 'sa_slide' . $i . '_delete';
880
+ $slide_data[ $count ]['thumb'] = 'slide' . $i . '_thumb';
881
+ $slide_data[ $count ]['image_del'] = 'slide' . $i . '_image_del';
882
+ $slide_data[ $count ]['image_data'] = 'sa_slide' . $i . '_image_data';
883
+ $slide_data[ $count ]['image_id'] = 'sa_slide' . $i . '_image_id';
884
+ $slide_data[ $count ]['image_pos'] = 'sa_slide' . $i . '_image_pos';
885
+ $slide_data[ $count ]['image_size'] = 'sa_slide' . $i . '_image_size';
886
+ $slide_data[ $count ]['image_repeat'] = 'sa_slide' . $i . '_image_repeat';
887
+ $slide_data[ $count ]['image_color'] = 'sa_slide' . $i . '_image_color';
888
+ $slide_data[ $count ]['image_data'] = 'sa_slide' . $i . '_image_data';
889
+ $slide_data[ $count ]['link_url'] = 'sa_slide' . $i . '_link_url';
890
+ $slide_data[ $count ]['link_target'] = 'sa_slide' . $i . '_link_target';
891
+ $slide_data[ $count ]['popup_type'] = 'sa_slide' . $i . '_popup_type';
892
+ $slide_data[ $count ]['popup_imageid'] = 'sa_slide' . $i . '_popup_imageid';
893
+ $slide_data[ $count ]['popup_imagetitle'] = 'sa_slide' . $i . '_popup_imagetitle';
894
+ $slide_data[ $count ]['popup_video_id'] = 'sa_slide' . $i . '_popup_video_id';
895
+ $slide_data[ $count ]['popup_video_type'] = 'sa_slide' . $i . '_popup_video_type';
896
+ $slide_data[ $count ]['popup_background'] = 'sa_slide' . $i . '_popup_background';
897
+ $slide_data[ $count ]['popup_html'] = 'sa_slide' . $i . '_popup_html';
898
+ $slide_data[ $count ]['popup_shortcode'] = 'sa_slide' . $i . '_popup_shortcode';
899
+ $slide_data[ $count ]['popup_bgcol'] = 'sa_slide' . $i . '_popup_bgcol';
900
+ $slide_data[ $count ]['popup_width'] = 'sa_slide' . $i . '_popup_width';
901
+ $slide_data[ $count ]['slide_no'] = $i;
 
 
902
  $count++;
903
  }
904
  }
905
  // GET AVAILABLE WordPress IMAGE SIZES AND SAVE WITHIN AN ARRAY.
906
+ global $_wp_additional_image_sizes;
907
+ $image_size_arr = array();
908
+ $image_size_arr[0]['value'] = 'no';
909
+ $image_size_arr[0]['desc'] = 'NO';
910
+ $count = 1;
911
+ foreach ( get_intermediate_image_sizes() as $image_size ) {
912
+ if ( in_array( $image_size, array( 'thumbnail', 'medium', 'medium_large', 'large' ), true ) ) {
913
+ $width = get_option( "{$image_size}_size_w" );
914
+ $height = get_option( "{$image_size}_size_h" );
915
+ } elseif ( isset( $_wp_additional_image_sizes[ $image_size ] ) ) {
916
+ $width = $_wp_additional_image_sizes[ $image_size ]['width'];
917
+ $height = $_wp_additional_image_sizes[ $image_size ]['height'];
918
+ }
919
+ if ( ( 0 !== $width ) && ( 0 !== $height ) ) {
920
+ $image_size_arr[ $count ]['value'] = $image_size;
921
+ $image_size_arr[ $count ]['desc'] = $image_size . ' (' . $width . '&times;' . $height . ')';
922
+ $count++;
 
 
 
923
  }
924
  }
925
  /**
1012
  /**
1013
  * ### 'USE POPUP IMAGE AS SLIDE BACKGROUND' SETTING ###
1014
  */
1015
+ $slide_popup_background = get_post_meta( $post->ID, $slide_data[ $i ]['popup_background'], true );
1016
+ if ( '' === $slide_popup_background ) {
1017
+ $slide_popup_background = 'no';
1018
+ }
1019
+ echo "<div class='popup_background_wrapper'>\n";
1020
+ echo '<div>Use Popup Image as Slide Background:';
1021
+ $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.';
1022
+ echo "<em class='sa_tooltip' href='' title='" . esc_attr( $tooltip ) . "'></em></div>\n";
1023
+ echo "<select id='" . esc_attr( $slide_data[ $i ]['popup_background'] ) . "' name='" . esc_attr( $slide_data[ $i ]['popup_background'] ) . "' ";
1024
+ echo "onChange='change_slide_popup_background(" . esc_attr( $slide_data[ $i ]['slide_no'] ) . ");'>";
1025
+ $tot_loop = count( $image_size_arr );
1026
+ for ( $j = 0; $j < $tot_loop; $j++ ) {
1027
+ if ( $slide_popup_background === $image_size_arr[ $j ]['value'] ) {
1028
+ echo "<option value='" . esc_attr( $image_size_arr[ $j ]['value'] ) . "' selected>" . esc_html( $image_size_arr[ $j ]['desc'] ) . '</option>';
1029
+ } else {
1030
+ echo "<option value='" . esc_attr( $image_size_arr[ $j ]['value'] ) . "'>" . esc_html( $image_size_arr[ $j ]['desc'] ) . '</option>';
 
 
 
1031
  }
 
 
 
 
1032
  }
1033
+ echo '</select>';
1034
+ echo "</div>\n"; // .popup_background_wrapper
1035
+ echo "<div style='clear:both; float:none; width:100%; height:1px;'></div>\n";
1036
+ echo "<div id='slide" . esc_attr( $slide_data[ $i ]['slide_no'] ) . "_imagebg_popup' class='sa_slide_bg_popup'><div></div></div>\n";
1037
 
1038
  // SLIDE BACKGROUND IMAGE - THUMBNAIL AND 'SET IMAGE' BUTTON.
1039
  // get WordPress media upload frame url.
1215
  */
1216
  echo "<div id='slide" . esc_attr( $tabs_num ) . "_popup_tab' class='sa_slide_tab'>\n";
1217
 
1218
+ // GET SLIDE POPUP DATA FOR THIS SLIDE FROM THE DATABASE.
1219
+ $slide_popup_type = get_post_meta( $post->ID, $slide_data[ $i ]['popup_type'], true );
1220
+ if ( '' === $slide_popup_type ) {
1221
+ $slide_popup_type = 'NONE';
1222
+ }
1223
+ $popup_imageid = intval( get_post_meta( $post->ID, $slide_data[ $i ]['popup_imageid'], true ) );
1224
+ $popup_video_id = get_post_meta( $post->ID, $slide_data[ $i ]['popup_video_id'], true );
1225
+ $popup_video_type = get_post_meta( $post->ID, $slide_data[ $i ]['popup_video_type'], true );
1226
+ $popup_imagetitle = get_post_meta( $post->ID, $slide_data[ $i ]['popup_imagetitle'], true );
1227
+ $popup_html = get_post_meta( $post->ID, $slide_data[ $i ]['popup_html'], true );
1228
+ $popup_shortcode = get_post_meta( $post->ID, $slide_data[ $i ]['popup_shortcode'], true );
1229
+ $popup_bgcol = get_post_meta( $post->ID, $slide_data[ $i ]['popup_bgcol'], true );
1230
+ $popup_width = intval( get_post_meta( $post->ID, $slide_data[ $i ]['popup_width'], true ) );
1231
+ $css_id = get_post_meta( $post->ID, 'sa_css_id', true );
1232
+
1233
+ // POPUP TYPE.
1234
+ echo "<div class='slide_popup_settings_line'>";
1235
+ echo '<span>SA Popup Type:</span>';
1236
+ $option_arr = array();
1237
+ $option_arr[0] = 'NONE';
1238
+ $option_arr[1] = 'IMAGE';
1239
+ $option_arr[2] = 'VIDEO';
1240
+ $option_arr[3] = 'HTML';
1241
+ echo "<select id='" . esc_attr( $slide_data[ $i ]['popup_type'] ) . "' name='" . esc_attr( $slide_data[ $i ]['popup_type'] ) . "' ";
1242
+ echo "onChange='change_slide_popup_type(" . esc_attr( $slide_data[ $i ]['slide_no'] ) . ");'>";
1243
+ $tot_loop = count( $option_arr );
1244
+ for ( $j = 0; $j < $tot_loop; $j++ ) {
1245
+ if ( $slide_popup_type === $option_arr[ $j ] ) {
1246
+ echo "<option value='" . esc_attr( $option_arr[ $j ] ) . "' selected>" . esc_html( $option_arr[ $j ] ) . '</option>';
1247
+ } else {
1248
+ echo "<option value='" . esc_attr( $option_arr[ $j ] ) . "'>" . esc_html( $option_arr[ $j ] ) . '</option>';
 
 
 
 
 
 
1249
  }
1250
+ }
1251
+ echo '</select>';
1252
+ echo "</div>\n";
1253
 
1254
+ // A) IMAGE POPUP SETTINGS.
1255
+ $sl_num = ( $i + 1 );
1256
+ if ( 'IMAGE' === $slide_popup_type ) {
1257
+ echo "<div id='slide" . esc_attr( $sl_num ) . "_image_popup_wrapper' class='image_popup_wrapper'>\n";
1258
+ } else {
1259
+ echo "<div id='slide" . esc_attr( $sl_num ) . "_image_popup_wrapper' class='image_popup_wrapper' style='display:none;'>\n";
1260
+ }
1261
+ // get WordPress media upload frame url.
1262
+ $upload_popup_frame_url = esc_url( get_upload_iframe_src( 'image', $post->ID ) . '&popup=' . $slide_data[ $i ]['slide_no'] );
1263
+ // Get image src for slide popup image.
1264
+ $popup_image_src = wp_get_attachment_image_src( $popup_imageid, 'medium' );
1265
+ // check if the slide background image id already exists.
1266
+ $image_exists = is_array( $popup_image_src );
1267
+ echo "<div id='slide" . esc_attr( $sl_num ) . "_popup_thumb' class='slide_popup_thumb'>\n";
1268
+ $placeholder = SA_PLUGIN_PATH . 'images/image_placeholder.jpg';
1269
+ if ( $image_exists ) {
1270
+ // media library image id exists - display thumbnail image.
1271
+ echo "<div><img src='" . esc_attr( $popup_image_src[0] ) . "'/></div>";
1272
+ // display image delete button.
1273
+ echo "<span onClick='remove_popup_image(\"" . esc_attr( $slide_data[ $i ]['slide_no'] ) . '", "' . esc_attr( $placeholder ) . "\");' ";
1274
+ echo "id='slide" . esc_attr( $slide_data[ $i ]['slide_no'] ) . "_popup_image_del' title='Delete the popup image for this slide'>X</span>\n";
1275
+ // get popup image info (size & dimensions).
1276
+ $popup_image_meta = wp_get_attachment_metadata( $popup_imageid );
1277
+ $image_width = $popup_image_meta['width'];
1278
+ $image_height = $popup_image_meta['height'];
1279
+ $info_dim = $image_width . ' x ' . $image_height . ' pixels';
1280
+ $popup_image_full = wp_get_attachment_image_src( $popup_imageid, 'full' );
1281
+ $img_headers = get_headers( $popup_image_full[0], 1 );
1282
+ $info_size = $img_headers['Content-Length'];
1283
+ if ( '' !== $info_size ) {
1284
+ $size_unit = 'bytes';
1285
+ if ( $info_size > 1048576 ) {
1286
+ if ( ! is_array( $info_size ) ) {
1287
+ $info_size = round( $info_size / 1048576 ) . ' MB';
1288
+ } else {
1289
+ $info_size = '';
1290
+ }
1291
+ } elseif ( $info_size > 1024 ) {
1292
+ if ( ! is_array( $info_size ) ) {
1293
+ $info_size = round( $info_size / 1024 ) . ' kb';
1294
+ } else {
1295
+ $info_size = '';
 
1296
  }
1297
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1298
  }
1299
+ } else {
1300
+ // no image selected yet - display placeholder image.
1301
+ $popup_image_id = 0;
1302
+ echo "<div><img src='" . esc_attr( $placeholder ) . "'/></div>";
1303
+ // display image delete button (hidden state).
1304
+ echo "<span class='sa_hidden' onClick='remove_popup_image(\"" . esc_attr( $slide_data[ $i ]['slide_no'] ) . '", "' . esc_attr( $placeholder ) . "\");' ";
1305
+ echo "id='slide" . esc_attr( $slide_data[ $i ]['slide_no'] ) . "_popup_image_del' title='Delete the popup image for this slide'>X</span>\n";
1306
+ // reset popup image info (size & dimensions).
1307
+ $info_dim = '';
1308
+ $info_size = '';
1309
+ }
1310
+ echo "</div>\n";
1311
+ // slide popup image - 'set image' button.
1312
+ echo "<a class='button button-secondary popup_image_add' href='" . esc_attr( $upload_popup_frame_url ) . "' ";
1313
+ echo "title='Set the background image for this slide'>Set Image</a>\n";
1314
+ // slide popup image - 'preview' button.
1315
+ $preview_button = 'slide' . esc_attr( $slide_data[ $i ]['slide_no'] ) . '_popup_image_preview';
1316
+ echo "<div id='" . esc_attr( $preview_button ) . "' class='slide_popup_image_preview'>";
1317
+ if ( $image_exists ) {
1318
+ echo "<a class='button button-secondary' href='" . esc_attr( $popup_image_full[0] ) . "' title='" . esc_attr( $popup_imagetitle ) . "'>Preview</a>";
1319
+ } else {
1320
+ echo "<a class='button button-secondary' href='" . esc_attr( $placeholder ) . "' title='" . esc_attr( $popup_imagetitle ) . "'>Preview</a>";
1321
+ }
1322
+ echo "</div>\n";
1323
+ // slide popup image - jquery code to generate 'magnific popup' preview.
1324
+ echo "<script type='text/javascript'>\n";
1325
+ echo "jQuery(document).ready(function() {\n";
1326
+ echo " jQuery('#" . esc_attr( $preview_button ) . " a').magnificPopup({\n";
1327
+ echo " mainClass: 'sa_popup',\n";
1328
+ echo " closeBtnInside: true,\n";
1329
+ echo " type: 'image'\n";
1330
+ echo " });\n";
1331
+ echo "});\n";
1332
+ echo "</script>\n";
1333
+ // slide popup image - popup image id hidden field.
1334
+ echo "<input type='hidden' id='" . esc_attr( $slide_data[ $i ]['popup_imageid'] ) . "' name='" . esc_attr( $slide_data[ $i ]['popup_imageid'] );
1335
+ echo "' value='" . esc_attr( $popup_imageid ) . "' />\n";
1336
+ // slide popup image - popup image info (title, dimensions & size).
1337
+ echo "<div class='slide_popup_info'>\n";
1338
+ // popup image title.
1339
+ echo "<input class='sa_slide_popup_imagetitle' type='text' id='" . esc_attr( $slide_data[ $i ]['popup_imagetitle'] ) . "' ";
1340
+ echo "name='" . esc_attr( $slide_data[ $i ]['popup_imagetitle'] ) . "' value='" . esc_attr( $popup_imagetitle ) . "' ";
1341
+ echo "onChange='change_popup_image_title(this.value, \"" . esc_attr( $preview_button ) . "\")' placeholder='Enter popup title'/>\n";
1342
+ // popup dimensions.
1343
+ echo "<div id='slide" . esc_attr( $slide_data[ $i ]['slide_no'] ) . "_popup_info_dim' class='slide_popup_info_dim'>";
1344
+ echo '<strong>Dimensions:</strong> ' . esc_html( $info_dim ) . "</div>\n";
1345
+ // popup file size.
1346
+ echo "<div id='slide" . esc_attr( $slide_data[ $i ]['slide_no'] ) . "_popup_info_size' class='slide_popup_info_size'>";
1347
+ if ( '' !== $info_size ) {
1348
+ echo '<strong>File Size:</strong> ' . esc_html( $info_size );
1349
+ }
1350
+ echo "</div>\n";
1351
+ echo "</div>\n";
1352
+ echo "<div style='clear:both; float:none; width:100%; height:1px;'></div>\n";
1353
+ echo "</div>\n";
1354
 
1355
+ // B) VIDEO POPUP SETTINGS.
1356
+ $sl_num = ( $i + 1 );
1357
+ if ( 'VIDEO' === $slide_popup_type ) {
1358
+ echo "<div id='slide" . esc_attr( $sl_num ) . "_video_popup_wrapper' class='video_popup_wrapper'>\n";
1359
+ } else {
1360
+ echo "<div id='slide" . esc_attr( $sl_num ) . "_video_popup_wrapper' class='video_popup_wrapper' style='display:none;'>\n";
1361
+ }
1362
+ // set default video values.
1363
+ if ( ( 'youtube' !== $popup_video_type ) && ( 'vimeo' !== $popup_video_type ) ) {
1364
+ $popup_video_type = '';
1365
+ $popup_video_id = '';
1366
+ }
1367
+ if ( '' === $popup_video_id ) {
1368
+ $popup_video_type = '';
1369
+ }
1370
+ // video preview.
1371
+ echo "<div id='slide" . esc_attr( $sl_num ) . "_video_thumb' class='slide_video_thumb'>\n";
1372
+ if ( '' !== $popup_video_id ) {
1373
+ if ( 'youtube' === $popup_video_type ) {
1374
+ echo "<iframe src='https://www.youtube.com/embed/" . esc_attr( $popup_video_id ) . "' frameborder='0' allowfullscreen></iframe>\n";
1375
+ } elseif ( 'vimeo' === $popup_video_type ) {
1376
+ echo "<iframe src='https://player.vimeo.com/video/" . esc_attr( $popup_video_id ) . "' frameborder='0' webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>";
 
 
 
1377
  } else {
1378
  echo "<img src='" . esc_attr( SA_PLUGIN_PATH ) . "images/video_placeholder.jpg'/>";
1379
  }
1380
+ } else {
1381
+ echo "<img src='" . esc_attr( SA_PLUGIN_PATH ) . "images/video_placeholder.jpg'/>";
1382
+ }
1383
+ echo "<div style='float:none; clear:both; width:100%; height:1px;'></div>\n";
1384
+ echo "</div>\n";
1385
+ // video url (youtube/vimeo) input text box.
1386
+ echo "<div class='sa_slide_video_url'>";
1387
+ echo "<input type='text' id='sa_slide" . esc_attr( $sl_num ) . "_video_url' name='sa_slide" . esc_attr( $sl_num ) . "_video_url' ";
1388
+ echo "placeholder='Enter YouTube or Vimeo URL'/></div>\n";
1389
+ // 'update video' button.
1390
+ echo "<a class='button button-secondary' title='Update popup video using the above video URL' ";
1391
+ echo "onClick='update_popup_video(" . esc_attr( $sl_num ) . ");'>Set Video</a>\n";
1392
+
1393
+ // slide popup video - 'preview' button.
1394
+ $video_preview_url = SA_PLUGIN_PATH . 'images/video_placeholder_admin.jpg';
1395
+ if ( '' !== $popup_video_id ) {
1396
+ if ( 'youtube' === $popup_video_type ) {
1397
+ $video_preview_url = 'http://www.youtube.com/watch?v=' . $popup_video_id;
1398
+ } elseif ( 'vimeo' === $popup_video_type ) {
1399
+ $video_preview_url = 'http://vimeo.com/' . $popup_video_id;
1400
+ }
1401
+ }
1402
+ $preview_button = 'slide' . esc_attr( $slide_data[ $i ]['slide_no'] ) . '_popup_video_preview';
1403
+ echo "<div id='" . esc_attr( $preview_button ) . "' class='slide_popup_video_preview'>";
1404
+ echo "<a class='button button-secondary' href='" . esc_attr( $video_preview_url ) . "'>Preview</a>";
1405
+ echo "</div>\n";
1406
+ // slide popup image - jquery code to generate 'magnific popup' preview.
1407
+ echo "<script type='text/javascript'>\n";
1408
+ echo "jQuery(document).ready(function() {\n";
1409
+ echo " jQuery('#" . esc_attr( $preview_button ) . " a').magnificPopup({\n";
1410
+ echo " mainClass: 'sa_popup',\n";
1411
+ echo " closeBtnInside: true,\n";
1412
+ echo " type: 'iframe'\n";
1413
+ echo " });\n";
1414
+ echo "});\n";
1415
+ echo "</script>\n";
1416
+ // invalid url error message.
1417
+ echo "<div id='sa_slide" . esc_attr( $sl_num ) . "_video_invalid_url' class='sa_popup_video_invalid_url'>";
1418
+ echo "URL entered is NOT a valid YouTube or Vimeo URL!</div>\n";
1419
+ // hidden video id text field.
1420
+ echo "<input type='hidden' id='" . esc_attr( $slide_data[ $i ]['popup_video_id'] ) . "' name='" . esc_attr( $slide_data[ $i ]['popup_video_id'] ) . "' ";
1421
+ echo "value='" . esc_attr( $popup_video_id ) . "'/>\n";
1422
+ // hidden video type (youtube/vimeo) text field.
1423
+ echo "<input type='hidden' id='" . esc_attr( $slide_data[ $i ]['popup_video_type'] ) . "' name='" . esc_attr( $slide_data[ $i ]['popup_video_type'] ) . "' ";
1424
+ echo "value='" . esc_attr( $popup_video_type ) . "'/>\n";
1425
+ echo "<div style='float:none; clear:both; width:100%; height:1px;'></div>\n";
1426
+ echo "</div>\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1427
 
1428
+ // C) CONTENT POPUP SETTINGS.
1429
+ $sl_num = ( $i + 1 );
1430
+ if ( 'HTML' === $slide_popup_type ) {
1431
+ echo "<div id='slide" . esc_attr( $sl_num ) . "_html_popup_wrapper' class='html_popup_wrapper'>\n";
1432
  } else {
1433
+ echo "<div id='slide" . esc_attr( $sl_num ) . "_html_popup_wrapper' class='html_popup_wrapper' style='display:none;'>\n";
1434
+ }
1435
+ // content popup - html.
1436
+ echo "<textarea id='" . esc_attr( $slide_data[ $i ]['popup_html'] ) . "' name='" . esc_attr( $slide_data[ $i ]['popup_html'] ) . "' ";
1437
+ echo "placeholder='Enter HTML Code or WordPress Shortcode'>" . esc_attr( $popup_html ) . "</textarea>\n";
1438
+ // content popup - shortcode.
1439
+ if ( '' === $popup_shortcode ) {
1440
+ $popup_shortcode = '0';
1441
+ }
1442
+ echo "<div class='slide_popup_settings_line' style='margin:3px 0px 15px;'><span>Shortcode Content:</span>";
1443
+ if ( '1' === $popup_shortcode ) {
1444
+ echo "<input type='checkbox' id='" . esc_attr( $slide_data[ $i ]['popup_shortcode'] ) . "' name='" . esc_attr( $slide_data[ $i ]['popup_shortcode'] ) . "' value='1' checked/>";
1445
+ } else {
1446
+ echo "<input type='checkbox' id='" . esc_attr( $slide_data[ $i ]['popup_shortcode'] ) . "' name='" . esc_attr( $slide_data[ $i ]['popup_shortcode'] ) . "' value='1'/>";
 
 
1447
  }
1448
+ echo "<em class='sa_tooltip' href='' title='Use a WordPress shortcode instead of HTML as your popup content'></em>\n";
1449
+ echo "</div>\n";
1450
+ // content popup - css id.
1451
+ $popup_id = $css_id . '_popup' . ( $i + 1 );
1452
+ echo "<div class='slide_popup_settings_line'>";
1453
+ 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>';
1454
+ echo '<strong>(click to copy to clipboard)</strong></div>';
1455
+ // content popup - background color.
1456
+ if ( '' === $popup_bgcol ) {
1457
+ $popup_bgcol = '#ffffff';
1458
+ }
1459
+ echo "<div class='slide_popup_settings_line'>";
1460
+ echo '<span>Background Color:</span>';
1461
+ echo "<input type='text' id='" . esc_attr( $slide_data[ $i ]['popup_bgcol'] ) . "' name='" . esc_attr( $slide_data[ $i ]['popup_bgcol'] ) . "' ";
1462
+ echo "value='" . esc_attr( $popup_bgcol ) . "'>";
1463
+ echo "</div>\n";
1464
+ // content popup - width.
1465
+ if ( ( '' === $popup_width ) || ( 0 === $popup_width ) ) {
1466
+ $popup_width = '600';
1467
+ }
1468
+ echo "<div class='slide_popup_settings_line'>";
1469
+ echo '<span>Popup Width:</span>';
1470
+ echo "<input type='text' id='" . esc_attr( $slide_data[ $i ]['popup_width'] ) . "' name='" . esc_attr( $slide_data[ $i ]['popup_width'] ) . "' ";
1471
+ echo "value='" . esc_attr( $popup_width ) . "'><em>px</em>";
1472
+ echo "</div>\n";
1473
+
1474
+ echo "</div>\n";
1475
  echo "</div>\n";
1476
 
1477
  /**
1616
  * @param array $post Custom Post 'sa_slider'.
1617
  */
1618
  function cpt_slider_items_content( $post ) {
1619
+ $items_width1 = intval( get_post_meta( $post->ID, 'sa_items_width1', true ) );
1620
+ $items_width2 = intval( get_post_meta( $post->ID, 'sa_items_width2', true ) );
1621
+ $items_width3 = intval( get_post_meta( $post->ID, 'sa_items_width3', true ) );
1622
+ $items_width4 = intval( get_post_meta( $post->ID, 'sa_items_width4', true ) );
1623
+ $items_width5 = intval( get_post_meta( $post->ID, 'sa_items_width5', true ) );
1624
+ $items_width6 = intval( get_post_meta( $post->ID, 'sa_items_width6', true ) );
 
1625
  if ( 0 === $items_width1 ) {
1626
  $items_width1 = 1; }
1627
  if ( 0 === $items_width2 ) {
1742
  echo "<div id='sa_hero_slider_wrapper' class='sa_items_all_one' style='display:none;'>";
1743
  }
1744
  echo '<span>Hero Slider</span>';
1745
+ // hero slider checkbox.
1746
+ if ( '1' === $hero_slider ) {
1747
+ echo "<input type='checkbox' id='sa_hero_slider' name='sa_hero_slider' value='1' checked/>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1748
  } else {
1749
+ echo "<input type='checkbox' id='sa_hero_slider' name='sa_hero_slider' value='1'/>";
 
 
 
 
 
 
 
1750
  }
1751
+ $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.';
1752
+ $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.';
1753
+ if ( '1' === $hero_slider ) {
1754
+ echo "<div id='sa_hero_slider_note' style='display:block;'>";
1755
+ } else {
1756
+ echo "<div id='sa_hero_slider_note' style='display:none;'>";
1757
+ }
1758
+ echo '<strong>Please Note:</strong>';
1759
+ echo "<ol><li>Shortcode should be inserted into a full-width section<em class='sa_tooltip' title='" . esc_attr( $hs_note1 ) . "'></em></li>";
1760
+ echo "<li>Only works on browsers that support Viewport units - see <a href='https://caniuse.com/#feat=viewport-units' target='_blank'>here</a>";
1761
+ echo "<em class='sa_tooltip' title='" . esc_attr( $hs_note2 ) . "'></em></li></ol></div>";
1762
  echo "</div>\n";
1763
 
1764
  // SHOWCASE SLIDER.
1773
  $showcase_slider = '0';
1774
  }
1775
  echo "<div class='sa_ss_line'><span><strong>Showcase Carousel</strong></span>";
1776
+ echo "<input type='checkbox' id='sa_showcase_slider' name='sa_showcase_slider' value='1'";
1777
+ if ( '1' === $showcase_slider ) {
1778
+ echo ' checked'; }
1779
+ echo ' />';
 
 
1780
  echo '</div>';
1781
+ if ( '1' === $showcase_slider ) {
1782
+ echo "<div id='sa_showcase_slider_pro' style='display:block;'>";
1783
+ } else {
1784
+ echo "<div id='sa_showcase_slider_pro' style='display:none;'>";
1785
+ }
1786
+ // showcase slider - desktop width.
1787
+ $showcase_width = get_post_meta( $post->ID, 'sa_showcase_width', true );
1788
+ if ( '' === $showcase_width ) {
1789
+ $showcase_width = '120';
1790
+ }
1791
+ echo "<div class='sa_ss_line'><span>Desktop Width</span>";
1792
+ echo "<input type='text' id='sa_showcase_width' name='sa_showcase_width' value='" . esc_attr( $showcase_width ) . "'>";
1793
+ echo "<em>%</em></div>\n";
1794
+ // showcase slider - use on tablets.
1795
+ $showcase_tablet = get_post_meta( $post->ID, 'sa_showcase_tablet', true );
1796
+ if ( ( '0' !== $showcase_tablet ) && ( '1' !== $showcase_tablet ) ) {
1797
+ $showcase_tablet = '1';
1798
+ }
1799
+ echo "<div class='sa_ss_line'><span>Use on Tablets</span>";
1800
+ if ( '1' === $showcase_tablet ) {
1801
+ echo "<input type='checkbox' id='sa_showcase_tablet' name='sa_showcase_tablet' value='1' checked />";
1802
+ } else {
1803
+ echo "<input type='checkbox' id='sa_showcase_tablet' name='sa_showcase_tablet' value='1' />";
1804
+ }
1805
+ echo "</div>\n";
1806
+ // showcase slider - tablet width.
1807
+ $showcase_width_tab = get_post_meta( $post->ID, 'sa_showcase_width_tab', true );
1808
+ if ( '' === $showcase_width_tab ) {
1809
+ $showcase_width_tab = '130';
1810
+ }
1811
+ echo "<div class='sa_ss_line'><span>Tablet Width</span>";
1812
+ echo "<input type='text' id='sa_showcase_width_tab' name='sa_showcase_width_tab' value='" . esc_attr( $showcase_width_tab ) . "'>";
1813
+ echo "<em>%</em></div>\n";
1814
+ // showcase slider - use on mobiles.
1815
+ $showcase_mobile = get_post_meta( $post->ID, 'sa_showcase_mobile', true );
1816
+ if ( '1' !== $showcase_mobile ) {
1817
+ $showcase_mobile = '0';
1818
+ }
1819
+ echo "<div class='sa_ss_line'><span>Use on Mobiles</span>";
1820
+ if ( '1' === $showcase_mobile ) {
1821
+ echo "<input type='checkbox' id='sa_showcase_mobile' name='sa_showcase_mobile' value='1' checked />";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1822
  } else {
1823
+ echo "<input type='checkbox' id='sa_showcase_mobile' name='sa_showcase_mobile' value='1' />";
 
 
 
 
 
 
 
1824
  }
1825
  echo "</div>\n";
1826
+ // showcase slider - mobile width.
1827
+ $showcase_width_mob = get_post_meta( $post->ID, 'sa_showcase_width_mob', true );
1828
+ if ( '' === $showcase_width_mob ) {
1829
+ $showcase_width_mob = '140';
1830
+ }
1831
+ echo "<div class='sa_ss_line'><span>Mobile Width</span>";
1832
+ echo "<input type='text' id='sa_showcase_width_mob' name='sa_showcase_width_mob' value='" . esc_attr( $showcase_width_mob ) . "'>";
1833
+ echo "<em>%</em></div>\n";
1834
+ // showcase slider - css to style left/rightmost slides.
1835
+ $css_id = get_post_meta( $post->ID, 'sa_css_id', true );
1836
+ echo "<div class='sa_ss_css_line'>CSS to target left+right partial slides:";
1837
+ echo "<div id='ss_css_value'>#" . esc_html( $css_id ) . ' .sc_partial</div>';
1838
+ echo "</div>\n";
1839
+ echo '</div>'; // #sa_showcase_slider_pro
1840
+ echo "</div>\n";
1841
 
1842
  echo "</div>\n";
1843
  }
2315
  * @param array $post Custom Post 'sa_slider'.
2316
  */
2317
  function cpt_slider_thumbs_content( $post ) {
2318
+ // get WordPress image size data and save into and array.
2319
+ global $_wp_additional_image_sizes;
2320
+ $image_size_arr = array();
2321
+ $count = 0;
2322
+ foreach ( get_intermediate_image_sizes() as $image_size ) {
2323
+ if ( in_array( $image_size, array( 'thumbnail', 'medium', 'medium_large', 'large' ), true ) ) {
2324
+ $width = get_option( "{$image_size}_size_w" );
2325
+ $height = get_option( "{$image_size}_size_h" );
2326
+ } elseif ( isset( $_wp_additional_image_sizes[ $image_size ] ) ) {
2327
+ $width = $_wp_additional_image_sizes[ $image_size ]['width'];
2328
+ $height = $_wp_additional_image_sizes[ $image_size ]['height'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2329
  }
2330
+ if ( ( 0 !== $width ) && ( 0 !== $height ) ) {
2331
+ $image_size_arr[ $count ]['value'] = $image_size;
2332
+ $image_size_arr[ $count ]['desc'] = $image_size . ' (' . $width . '&times;' . $height . ')';
2333
+ $count++;
 
 
 
 
 
2334
  }
2335
+ }
2336
 
2337
+ // Use thumbnail pagination (checkbox).
2338
+ $thumbs_active = get_post_meta( $post->ID, 'sa_thumbs_active', true );
2339
+ if ( '' === $thumbs_active ) {
2340
+ $thumbs_active = '0';
2341
+ }
2342
+ echo "<div class='sa_thumbs_line'><span>Use Thumbnail Pagination:</span>";
2343
+ if ( '1' === $thumbs_active ) {
2344
+ echo "<input type='checkbox' id='sa_thumbs_active' name='sa_thumbs_active' value='1' checked/>";
2345
+ } else {
2346
+ echo "<input type='checkbox' id='sa_thumbs_active' name='sa_thumbs_active' value='1'/>";
2347
+ }
2348
+ echo "</div>\n";
2349
 
2350
+ if ( '1' === $thumbs_active ) {
2351
+ echo "<div id='sa_thumbs_settings' style='display:block;'>\n";
2352
+ } else {
2353
+ echo "<div id='sa_thumbs_settings' style='display:none;'>\n";
2354
+ }
 
 
 
2355
 
2356
+ // Thumbs Location (dropdown).
2357
+ $thumbs_location = get_post_meta( $post->ID, 'sa_thumbs_location', true );
2358
+ if ( '' === $thumbs_location ) {
2359
+ $thumbs_location = 'inside_bottom';
2360
+ }
2361
+ echo "<div class='sa_thumbs_line'><span>Thumbs Location:</span>";
2362
+ echo "<select id='sa_thumbs_location' name='sa_thumbs_location'>";
2363
+ $option_arr = array();
2364
+ $option_arr[0] = 'Inside Bottom';
2365
+ $option_arr[1] = 'Inside Top';
2366
+ $option_arr[2] = 'Inside Left';
2367
+ $option_arr[3] = 'Inside Right';
2368
+ $option_arr[4] = 'Outside Bottom';
2369
+ $tot_opt = count( $option_arr );
2370
+ for ( $i = 0; $i < $tot_opt; $i++ ) {
2371
+ $value = strtolower( str_replace( ' ', '_', $option_arr[ $i ] ) );
2372
+ if ( $value === $thumbs_location ) {
2373
+ echo "<option value='" . esc_attr( $value ) . "' selected>" . esc_html( $option_arr[ $i ] ) . '</option>';
2374
+ } else {
2375
+ echo "<option value='" . esc_attr( $value ) . "'>" . esc_html( $option_arr[ $i ] ) . '</option>';
2376
  }
2377
+ }
2378
+ echo "</select></div>\n";
 
2379
 
2380
+ // Thumbnail Image Size (dropdown).
2381
+ $thumbs_image_size = get_post_meta( $post->ID, 'sa_thumbs_image_size', true );
2382
+ if ( '' === $thumbs_image_size ) {
2383
+ $thumbs_image_size = 'thumbnail';
2384
+ }
2385
+ echo "<div class='sa_thumbs_line'><span>Thumbnail Image Size:</span>";
2386
+ echo "<select id='sa_thumbs_image_size' name='sa_thumbs_image_size'>";
2387
+ $tot_img_arr = count( $image_size_arr );
2388
+ for ( $i = 0; $i < $tot_img_arr; $i++ ) {
2389
+ if ( $image_size_arr[ $i ]['value'] === $thumbs_image_size ) {
2390
+ echo "<option value='" . esc_attr( $image_size_arr[ $i ]['value'] ) . "' selected>" . esc_html( $image_size_arr[ $i ]['desc'] ) . '</option>';
2391
+ } else {
2392
+ echo "<option value='" . esc_attr( $image_size_arr[ $i ]['value'] ) . "'>" . esc_html( $image_size_arr[ $i ]['desc'] ) . '</option>';
2393
  }
2394
+ }
2395
+ echo "</select></div>\n";
 
2396
 
2397
+ // Container Padding.
2398
+ $thumbs_padding = get_post_meta( $post->ID, 'sa_thumbs_padding', true );
2399
+ if ( '' === $thumbs_padding ) {
2400
+ $thumbs_padding = '3';
2401
+ }
2402
+ echo "<div class='sa_thumbs_line'><span>Container Padding:</span>";
2403
+ echo "<input type='text' id='sa_thumbs_padding' name='sa_thumbs_padding' value='" . esc_attr( $thumbs_padding ) . "'><em>%</em>";
2404
+ echo "</div>\n";
2405
 
2406
+ // Thumbs Width.
2407
+ $thumbs_width = get_post_meta( $post->ID, 'sa_thumbs_width', true );
2408
+ if ( '' === $thumbs_width ) {
2409
+ $thumbs_width = '150';
2410
+ }
2411
+ echo "<div class='sa_thumbs_line'><span>Thumbs Width:</span>";
2412
+ echo "<input type='text' id='sa_thumbs_width' name='sa_thumbs_width' value='" . esc_attr( $thumbs_width ) . "'><em>px</em>";
2413
+ echo "</div>\n";
2414
 
2415
+ // Thumbs Height.
2416
+ $thumbs_height = get_post_meta( $post->ID, 'sa_thumbs_height', true );
2417
+ if ( '' === $thumbs_height ) {
2418
+ $thumbs_height = '85';
2419
+ }
2420
+ echo "<div class='sa_thumbs_line'><span>Thumbs Height:</span>";
2421
+ echo "<input type='text' id='sa_thumbs_height' name='sa_thumbs_height' value='" . esc_attr( $thumbs_height ) . "'><em>px</em>";
2422
+ echo "</div>\n";
2423
 
2424
+ // Thumbs Opacity.
2425
+ $thumbs_opacity = get_post_meta( $post->ID, 'sa_thumbs_opacity', true );
2426
+ if ( '' === $thumbs_opacity ) {
2427
+ $thumbs_opacity = '50';
2428
+ }
2429
+ echo "<div class='sa_thumbs_line'><span>Thumbs Opacity:</span>";
2430
+ echo "<input type='text' id='sa_thumbs_opacity' name='sa_thumbs_opacity' value='" . esc_attr( $thumbs_opacity ) . "'><em>%</em>";
2431
+ echo "</div>\n";
2432
 
2433
+ echo '<h4>Active Thumb Border Style</h4>';
 
 
 
 
 
 
 
2434
 
2435
+ // Border Width.
2436
+ $thumbs_border_width = get_post_meta( $post->ID, 'sa_thumbs_border_width', true );
2437
+ if ( '' === $thumbs_border_width ) {
2438
+ $thumbs_border_width = '0';
2439
+ }
2440
+ echo "<div class='sa_thumbs_line'><span>Border Width:</span>";
2441
+ echo "<input type='text' id='sa_thumbs_border_width' name='sa_thumbs_border_width' value='" . esc_attr( $thumbs_border_width ) . "'><em>px</em>";
2442
+ echo "</div>\n";
2443
 
2444
+ // Border Color.
2445
+ $thumbs_border_color = get_post_meta( $post->ID, 'sa_thumbs_border_color', true );
2446
+ if ( '' === $thumbs_border_color ) {
2447
+ $thumbs_border_color = '#ffffff';
2448
+ }
2449
+ echo "<div class='sa_thumbs_line'><span>Border Color:</span>";
2450
+ echo "<input type='text' id='sa_thumbs_border_color' name='sa_thumbs_border_color' value='" . esc_attr( $thumbs_border_color ) . "'></div>\n";
2451
 
2452
+ echo '<h4>Responsive Thumb Sizes</h4>';
2453
 
2454
+ // Tablet Thumb Size.
2455
+ $thumbs_resp_tablet = get_post_meta( $post->ID, 'sa_thumbs_resp_tablet', true );
2456
+ if ( '' === $thumbs_resp_tablet ) {
2457
+ $thumbs_resp_tablet = '75';
 
 
 
2458
  }
2459
+ echo "<div class='sa_thumbs_line'><span>Tablet Thumb Size:</span>";
2460
+ echo "<input type='text' id='sa_thumbs_resp_tablet' name='sa_thumbs_resp_tablet' value='" . esc_attr( $thumbs_resp_tablet ) . "'><em>%</em>";
2461
+ echo "</div>\n";
2462
 
2463
+ // Mobile Thumb Size.
2464
+ $thumbs_resp_mobile = get_post_meta( $post->ID, 'sa_thumbs_resp_mobile', true );
2465
+ if ( '' === $thumbs_resp_mobile ) {
2466
+ $thumbs_resp_mobile = '50';
2467
+ }
2468
+ echo "<div class='sa_thumbs_line'><span>Mobile Thumb Size:</span>";
2469
+ echo "<input type='text' id='sa_thumbs_resp_mobile' name='sa_thumbs_resp_mobile' value='" . esc_attr( $thumbs_resp_mobile ) . "'><em>%</em>";
2470
+ echo "</div>\n";
2471
 
2472
+ echo "</div>\n"; // #sa_thumbs_settings
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2473
  }
2474
 
2475
 
2479
  */
2480
  function cpt_slider_save_postdata() {
2481
  global $post;
 
2482
 
2483
  // ### REMOVE XSS ATTACK VULNERABILITY FROM SLIDER POST TITLES ###
2484
  global $wpdb;
2521
  // UPDATE CONTENT FOR EACH SLIDE.
2522
  $slides_saved = 0;
2523
  for ( $i = 1; $i <= $total_slides; $i++ ) {
2524
+ $slide_edit_id = 'sa_slide' . $i . '_content';
2525
+ $slide_image_id = 'sa_slide' . $i . '_image_id';
2526
+ $slide_image_pos = 'sa_slide' . $i . '_image_pos';
2527
+ $slide_image_size = 'sa_slide' . $i . '_image_size';
2528
+ $slide_image_repeat = 'sa_slide' . $i . '_image_repeat';
2529
+ $slide_image_color = 'sa_slide' . $i . '_image_color';
2530
+ $slide_link_url = 'sa_slide' . $i . '_link_url';
2531
+ $slide_link_target = 'sa_slide' . $i . '_link_target';
2532
+ $slide_popup_type = 'sa_slide' . $i . '_popup_type';
2533
+ $slide_popup_imageid = 'sa_slide' . $i . '_popup_imageid';
2534
+ $slide_popup_imagetitle = 'sa_slide' . $i . '_popup_imagetitle';
2535
+ $slide_popup_video_id = 'sa_slide' . $i . '_popup_video_id';
2536
+ $slide_popup_video_type = 'sa_slide' . $i . '_popup_video_type';
2537
+ $slide_popup_background = 'sa_slide' . $i . '_popup_background';
2538
+ $slide_popup_html = 'sa_slide' . $i . '_popup_html';
2539
+ $slide_popup_shortcode = 'sa_slide' . $i . '_popup_shortcode';
2540
+ $slide_popup_bgcol = 'sa_slide' . $i . '_popup_bgcol';
2541
+ $slide_popup_width = 'sa_slide' . $i . '_popup_width';
 
 
2542
  $slide_content = '';
2543
  $slide_image_id_val = 0;
2544
  $slide_image_pos_val = '';
2571
  if ( isset( $_POST[ $slide_link_target ] ) ) {
2572
  $slide_link_target_val = sanitize_text_field( wp_unslash( $_POST[ $slide_link_target ] ) );
2573
  }
2574
+ $slide_popup_type_val = '';
2575
+ $slide_popup_imageid_val = 0;
2576
+ $slide_popup_imagetitle_val = '';
2577
+ $slide_popup_video_id_val = '';
2578
+ $slide_popup_video_type_val = '';
2579
+ $slide_popup_background_val = '';
2580
+ $slide_popup_html_val = '';
2581
+ $slide_popup_shortcode_val = '';
2582
+ $slide_popup_bgcol_val = '';
2583
+ $slide_popup_width_val = 0;
2584
+ if ( isset( $_POST[ $slide_popup_type ] ) ) {
2585
+ $slide_popup_type_val = sanitize_text_field( wp_unslash( $_POST[ $slide_popup_type ] ) );
2586
+ }
2587
+ if ( isset( $_POST[ $slide_popup_imageid ] ) ) {
2588
+ $slide_popup_imageid_val = sanitize_text_field( wp_unslash( $_POST[ $slide_popup_imageid ] ) );
2589
+ }
2590
+ if ( isset( $_POST[ $slide_popup_imagetitle ] ) ) {
2591
+ $slide_popup_imagetitle_val = sanitize_text_field( wp_unslash( $_POST[ $slide_popup_imagetitle ] ) );
2592
+ }
2593
+ if ( isset( $_POST[ $slide_popup_video_id ] ) ) {
2594
+ $slide_popup_video_id_val = sanitize_text_field( wp_unslash( $_POST[ $slide_popup_video_id ] ) );
2595
+ }
2596
+ if ( isset( $_POST[ $slide_popup_video_type ] ) ) {
2597
+ $slide_popup_video_type_val = sanitize_text_field( wp_unslash( $_POST[ $slide_popup_video_type ] ) );
2598
+ }
2599
+ if ( isset( $_POST[ $slide_popup_background ] ) ) {
2600
+ $slide_popup_background_val = sanitize_text_field( wp_unslash( $_POST[ $slide_popup_background ] ) );
2601
+ }
2602
+ if ( isset( $_POST[ $slide_popup_html ] ) ) {
2603
+ $slide_popup_html_val = balanceTags( wp_kses_post( wp_unslash( $_POST[ $slide_popup_html ] ) ), true );
2604
+ }
2605
+ if ( isset( $_POST[ $slide_popup_shortcode ] ) ) {
2606
+ $slide_popup_shortcode_val = sanitize_text_field( wp_unslash( $_POST[ $slide_popup_shortcode ] ) );
2607
+ }
2608
+ if ( isset( $_POST[ $slide_popup_bgcol ] ) ) {
2609
+ $slide_popup_bgcol_val = sanitize_text_field( wp_unslash( $_POST[ $slide_popup_bgcol ] ) );
2610
+ }
2611
+ if ( isset( $_POST[ $slide_popup_width ] ) ) {
2612
+ $slide_popup_width_val = abs( intval( $_POST[ $slide_popup_width ] ) );
 
 
2613
  }
2614
  // check delete status for slide.
2615
  $del_status_id = 'sa_slide' . $i . '_delete';
2623
  if ( '1' === $del_status ) {
2624
  // save slide content only if slide has not been marked for deletion.
2625
  $slides_saved++;
2626
+ $slide_edit_id_save = 'sa_slide' . $slides_saved . '_content';
2627
+ $slide_image_data_saved = 'sa_slide' . $slides_saved . '_image_data';
2628
+ $slide_link_url_saved = 'sa_slide' . $slides_saved . '_link_url';
2629
+ $slide_link_target_saved = 'sa_slide' . $slides_saved . '_link_target';
2630
+ $slide_popup_type_saved = 'sa_slide' . $slides_saved . '_popup_type';
2631
+ $slide_popup_imageid_saved = 'sa_slide' . $slides_saved . '_popup_imageid';
2632
+ $slide_popup_imagetitle_saved = 'sa_slide' . $slides_saved . '_popup_imagetitle';
2633
+ $slide_popup_video_id_saved = 'sa_slide' . $slides_saved . '_popup_video_id';
2634
+ $slide_popup_video_type_saved = 'sa_slide' . $slides_saved . '_popup_video_type';
2635
+ $slide_popup_background_saved = 'sa_slide' . $slides_saved . '_popup_background';
2636
+ $slide_popup_html_saved = 'sa_slide' . $slides_saved . '_popup_html';
2637
+ $slide_popup_shortcode_saved = 'sa_slide' . $slides_saved . '_popup_shortcode';
2638
+ $slide_popup_bgcol_saved = 'sa_slide' . $slides_saved . '_popup_bgcol';
2639
+ $slide_popup_width_saved = 'sa_slide' . $slides_saved . '_popup_width';
2640
+ update_post_meta( $post->ID, $slide_edit_id_save, $slide_content );
2641
+ $slide_image_data_val = $slide_image_id_val . '~' . $slide_image_pos_val . '~' . $slide_image_size_val . '~' . $slide_image_repeat_val . '~' . $slide_image_color_val;
2642
+ update_post_meta( $post->ID, $slide_image_data_saved, $slide_image_data_val );
2643
+ update_post_meta( $post->ID, $slide_link_url_saved, $slide_link_url_val );
2644
+ update_post_meta( $post->ID, $slide_link_target_saved, $slide_link_target_val );
2645
+ update_post_meta( $post->ID, $slide_popup_type_saved, $slide_popup_type_val );
2646
+ update_post_meta( $post->ID, $slide_popup_imageid_saved, $slide_popup_imageid_val );
2647
+ update_post_meta( $post->ID, $slide_popup_imagetitle_saved, $slide_popup_imagetitle_val );
2648
+ update_post_meta( $post->ID, $slide_popup_video_id_saved, $slide_popup_video_id_val );
2649
+ update_post_meta( $post->ID, $slide_popup_video_type_saved, $slide_popup_video_type_val );
2650
+ update_post_meta( $post->ID, $slide_popup_background_saved, $slide_popup_background_val );
2651
+ update_post_meta( $post->ID, $slide_popup_html_saved, $slide_popup_html_val );
2652
+ update_post_meta( $post->ID, $slide_popup_shortcode_saved, $slide_popup_shortcode_val );
2653
+ update_post_meta( $post->ID, $slide_popup_bgcol_saved, $slide_popup_bgcol_val );
2654
+ update_post_meta( $post->ID, $slide_popup_width_saved, $slide_popup_width_val );
2655
+ if ( $i === $duplicate_slide ) {
2656
+ // the 'duplicate slide' button has been click for this slide - create a new slide that is an exact copy of previous slide.
2657
+ $slides_saved++;
2658
+ $slide_edit_id_save = 'sa_slide' . $slides_saved . '_content';
2659
+ $slide_image_data_saved = 'sa_slide' . $slides_saved . '_image_data';
2660
+ $slide_link_url_saved = 'sa_slide' . $slides_saved . '_link_url';
2661
+ $slide_link_target_saved = 'sa_slide' . $slides_saved . '_link_target';
2662
  $slide_popup_type_saved = 'sa_slide' . $slides_saved . '_popup_type';
2663
  $slide_popup_imageid_saved = 'sa_slide' . $slides_saved . '_popup_imageid';
2664
  $slide_popup_imagetitle_saved = 'sa_slide' . $slides_saved . '_popup_imagetitle';
2669
  $slide_popup_shortcode_saved = 'sa_slide' . $slides_saved . '_popup_shortcode';
2670
  $slide_popup_bgcol_saved = 'sa_slide' . $slides_saved . '_popup_bgcol';
2671
  $slide_popup_width_saved = 'sa_slide' . $slides_saved . '_popup_width';
2672
+ update_post_meta( $post->ID, $slide_edit_id_save, $slide_content );
2673
+ $slide_image_data_val = $slide_image_id_val . '~' . $slide_image_pos_val . '~' . $slide_image_size_val . '~' . $slide_image_repeat_val . '~' . $slide_image_color_val;
2674
+ update_post_meta( $post->ID, $slide_image_data_saved, $slide_image_data_val );
2675
+ update_post_meta( $post->ID, $slide_link_url_saved, $slide_link_url_val );
2676
+ update_post_meta( $post->ID, $slide_link_target_saved, $slide_link_target_val );
 
 
2677
  update_post_meta( $post->ID, $slide_popup_type_saved, $slide_popup_type_val );
2678
  update_post_meta( $post->ID, $slide_popup_imageid_saved, $slide_popup_imageid_val );
2679
  update_post_meta( $post->ID, $slide_popup_imagetitle_saved, $slide_popup_imagetitle_val );
2685
  update_post_meta( $post->ID, $slide_popup_bgcol_saved, $slide_popup_bgcol_val );
2686
  update_post_meta( $post->ID, $slide_popup_width_saved, $slide_popup_width_val );
2687
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2688
  }
2689
  }
2690
 
2724
  if ( isset( $_POST[ 'sa_slide' . $slide1 . '_link_target' ] ) ) {
2725
  $slide1_link_target = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide1 . '_link_target' ] ) );
2726
  }
2727
+ $slide1_popup_type = '';
2728
+ $slide1_popup_imageid = '';
2729
+ $slide1_popup_imagetitle = '';
2730
+ $slide1_popup_video_id = '';
2731
+ $slide1_popup_video_type = '';
2732
+ $slide1_popup_background = '';
2733
+ $slide1_popup_html = '';
2734
+ $slide1_popup_shortcode = '';
2735
+ $slide1_popup_bgcol = '';
2736
+ $slide1_popup_width = 0;
2737
+ if ( isset( $_POST[ 'sa_slide' . $slide1 . '_popup_type' ] ) ) {
2738
+ $slide1_popup_type = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide1 . '_popup_type' ] ) );
2739
+ }
2740
+ if ( isset( $_POST[ 'sa_slide' . $slide1 . '_popup_imageid' ] ) ) {
2741
+ $slide1_popup_imageid = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide1 . '_popup_imageid' ] ) );
2742
+ }
2743
+ if ( isset( $_POST[ 'sa_slide' . $slide1 . '_popup_imagetitle' ] ) ) {
2744
+ $slide1_popup_imagetitle = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide1 . '_popup_imagetitle' ] ) );
2745
+ }
2746
+ if ( isset( $_POST[ 'sa_slide' . $slide1 . '_popup_video_id' ] ) ) {
2747
+ $slide1_popup_video_id = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide1 . '_popup_video_id' ] ) );
2748
+ }
2749
+ if ( isset( $_POST[ 'sa_slide' . $slide1 . '_popup_video_type' ] ) ) {
2750
+ $slide1_popup_video_type = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide1 . '_popup_video_type' ] ) );
2751
+ }
2752
+ if ( isset( $_POST[ 'sa_slide' . $slide1 . '_popup_background' ] ) ) {
2753
+ $slide1_popup_background = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide1 . '_popup_background' ] ) );
2754
+ }
2755
+ if ( isset( $_POST[ 'sa_slide' . $slide1 . '_popup_html' ] ) ) {
2756
+ $slide1_popup_html = balanceTags( wp_kses_post( wp_unslash( $_POST[ 'sa_slide' . $slide1 . '_popup_html' ] ) ), true );
2757
+ }
2758
+ if ( isset( $_POST[ 'sa_slide' . $slide1 . '_popup_shortcode' ] ) ) {
2759
+ $slide1_popup_shortcode = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide1 . '_popup_shortcode' ] ) );
2760
+ }
2761
+ if ( isset( $_POST[ 'sa_slide' . $slide1 . '_popup_bgcol' ] ) ) {
2762
+ $slide1_popup_bgcol = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide1 . '_popup_bgcol' ] ) );
2763
+ }
2764
+ if ( isset( $_POST[ 'sa_slide' . $slide1 . '_popup_width' ] ) ) {
2765
+ $slide1_popup_width = abs( intval( $_POST[ 'sa_slide' . $slide1 . '_popup_width' ] ) );
 
 
2766
  }
2767
  $slide2_content = '';
2768
  $slide2_image_id = 0;
2796
  if ( isset( $_POST[ 'sa_slide' . $slide2 . '_link_target' ] ) ) {
2797
  $slide2_link_target = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide2 . '_link_target' ] ) );
2798
  }
2799
+ $slide2_popup_type = '';
2800
+ $slide2_popup_imageid = '';
2801
+ $slide2_popup_imagetitle = '';
2802
+ $slide2_popup_video_id = '';
2803
+ $slide2_popup_video_type = '';
2804
+ $slide2_popup_background = '';
2805
+ $slide2_popup_html = '';
2806
+ $slide2_popup_shortcode = '';
2807
+ $slide2_popup_bgcol = '';
2808
+ $slide2_popup_width = 0;
2809
+ if ( isset( $_POST[ 'sa_slide' . $slide2 . '_popup_type' ] ) ) {
2810
+ $slide2_popup_type = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide2 . '_popup_type' ] ) );
2811
+ }
2812
+ if ( isset( $_POST[ 'sa_slide' . $slide2 . '_popup_imageid' ] ) ) {
2813
+ $slide2_popup_imageid = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide2 . '_popup_imageid' ] ) );
2814
+ }
2815
+ if ( isset( $_POST[ 'sa_slide' . $slide2 . '_popup_imagetitle' ] ) ) {
2816
+ $slide2_popup_imagetitle = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide2 . '_popup_imagetitle' ] ) );
2817
+ }
2818
+ if ( isset( $_POST[ 'sa_slide' . $slide2 . '_popup_video_id' ] ) ) {
2819
+ $slide2_popup_video_id = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide2 . '_popup_video_id' ] ) );
2820
+ }
2821
+ if ( isset( $_POST[ 'sa_slide' . $slide2 . '_popup_video_type' ] ) ) {
2822
+ $slide2_popup_video_type = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide2 . '_popup_video_type' ] ) );
2823
+ }
2824
+ if ( isset( $_POST[ 'sa_slide' . $slide2 . '_popup_background' ] ) ) {
2825
+ $slide2_popup_background = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide2 . '_popup_background' ] ) );
2826
+ }
2827
+ if ( isset( $_POST[ 'sa_slide' . $slide2 . '_popup_html' ] ) ) {
2828
+ $slide2_popup_html = balanceTags( wp_kses_post( wp_unslash( $_POST[ 'sa_slide' . $slide2 . '_popup_html' ] ) ), true );
2829
+ }
2830
+ if ( isset( $_POST[ 'sa_slide' . $slide2 . '_popup_shortcode' ] ) ) {
2831
+ $slide2_popup_shortcode = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide2 . '_popup_shortcode' ] ) );
2832
+ }
2833
+ if ( isset( $_POST[ 'sa_slide' . $slide2 . '_popup_bgcol' ] ) ) {
2834
+ $slide2_popup_bgcol = sanitize_text_field( wp_unslash( $_POST[ 'sa_slide' . $slide2 . '_popup_bgcol' ] ) );
2835
+ }
2836
+ if ( isset( $_POST[ 'sa_slide' . $slide2 . '_popup_width' ] ) ) {
2837
+ $slide2_popup_width = abs( intval( $_POST[ 'sa_slide' . $slide2 . '_popup_width' ] ) );
 
 
2838
  }
2839
  update_post_meta( $post->ID, 'sa_slide' . $slide2 . '_content', $slide1_content );
2840
  $slide1_image_data = $slide1_image_id . '~' . $slide1_image_pos . '~' . $slide1_image_size . '~' . $slide1_image_repeat . '~' . $slide1_image_color;
2841
  update_post_meta( $post->ID, 'sa_slide' . $slide2 . '_image_data', $slide1_image_data );
2842
  update_post_meta( $post->ID, 'sa_slide' . $slide2 . '_link_url', $slide1_link_url );
2843
  update_post_meta( $post->ID, 'sa_slide' . $slide2 . '_link_target', $slide1_link_target );
2844
+ update_post_meta( $post->ID, 'sa_slide' . $slide2 . '_popup_type', $slide1_popup_type );
2845
+ update_post_meta( $post->ID, 'sa_slide' . $slide2 . '_popup_imageid', $slide1_popup_imageid );
2846
+ update_post_meta( $post->ID, 'sa_slide' . $slide2 . '_popup_imagetitle', $slide1_popup_imagetitle );
2847
+ update_post_meta( $post->ID, 'sa_slide' . $slide2 . '_popup_video_id', $slide1_popup_video_id );
2848
+ update_post_meta( $post->ID, 'sa_slide' . $slide2 . '_popup_video_type', $slide1_popup_video_type );
2849
+ update_post_meta( $post->ID, 'sa_slide' . $slide2 . '_popup_background', $slide1_popup_background );
2850
+ update_post_meta( $post->ID, 'sa_slide' . $slide2 . '_popup_html', $slide1_popup_html );
2851
+ update_post_meta( $post->ID, 'sa_slide' . $slide2 . '_popup_shortcode', $slide1_popup_shortcode );
2852
+ update_post_meta( $post->ID, 'sa_slide' . $slide2 . '_popup_bgcol', $slide1_popup_bgcol );
2853
+ update_post_meta( $post->ID, 'sa_slide' . $slide2 . '_popup_width', $slide1_popup_width );
 
 
2854
  update_post_meta( $post->ID, 'sa_slide' . $slide1 . '_content', $slide2_content );
2855
  $slide2_image_data = $slide2_image_id . '~' . $slide2_image_pos . '~' . $slide2_image_size . '~' . $slide2_image_repeat . '~' . $slide2_image_color;
2856
  update_post_meta( $post->ID, 'sa_slide' . $slide1 . '_image_data', $slide2_image_data );
2857
  update_post_meta( $post->ID, 'sa_slide' . $slide1 . '_link_url', $slide2_link_url );
2858
  update_post_meta( $post->ID, 'sa_slide' . $slide1 . '_link_target', $slide2_link_target );
2859
+ update_post_meta( $post->ID, 'sa_slide' . $slide1 . '_popup_type', $slide2_popup_type );
2860
+ update_post_meta( $post->ID, 'sa_slide' . $slide1 . '_popup_imageid', $slide2_popup_imageid );
2861
+ update_post_meta( $post->ID, 'sa_slide' . $slide1 . '_popup_imagetitle', $slide2_popup_imagetitle );
2862
+ update_post_meta( $post->ID, 'sa_slide' . $slide1 . '_popup_video_id', $slide2_popup_video_id );
2863
+ update_post_meta( $post->ID, 'sa_slide' . $slide1 . '_popup_video_type', $slide2_popup_video_type );
2864
+ update_post_meta( $post->ID, 'sa_slide' . $slide1 . '_popup_background', $slide2_popup_background );
2865
+ update_post_meta( $post->ID, 'sa_slide' . $slide1 . '_popup_html', $slide2_popup_html );
2866
+ update_post_meta( $post->ID, 'sa_slide' . $slide1 . '_popup_shortcode', $slide2_popup_shortcode );
2867
+ update_post_meta( $post->ID, 'sa_slide' . $slide1 . '_popup_bgcol', $slide2_popup_bgcol );
2868
+ update_post_meta( $post->ID, 'sa_slide' . $slide1 . '_popup_width', $slide2_popup_width );
 
 
2869
  }
2870
 
2871
  // UPDATE SLIDE CONTENT CHARACTER COUNT.
3149
  update_post_meta( $post->ID, 'sa_start_pos', abs( intval( $_POST['sa_start_pos'] ) ) );
3150
  }
3151
 
3152
+ // THUMBNAIL PAGINATION.
3153
+ if ( isset( $_POST['sa_thumbs_active'] ) && ( '1' === $_POST['sa_thumbs_active'] ) ) {
3154
+ update_post_meta( $post->ID, 'sa_thumbs_active', '1' );
3155
+ } else {
3156
+ update_post_meta( $post->ID, 'sa_thumbs_active', '0' );
3157
+ }
3158
+ if ( isset( $_POST['sa_thumbs_location'] ) ) {
3159
+ update_post_meta( $post->ID, 'sa_thumbs_location', sanitize_text_field( wp_unslash( $_POST['sa_thumbs_location'] ) ) );
3160
+ }
3161
+ if ( isset( $_POST['sa_thumbs_image_size'] ) ) {
3162
+ update_post_meta( $post->ID, 'sa_thumbs_image_size', sanitize_text_field( wp_unslash( $_POST['sa_thumbs_image_size'] ) ) );
3163
+ }
3164
+ if ( isset( $_POST['sa_thumbs_padding'] ) ) {
3165
+ update_post_meta( $post->ID, 'sa_thumbs_padding', abs( floatval( $_POST['sa_thumbs_padding'] ) ) );
3166
+ }
3167
+ if ( isset( $_POST['sa_thumbs_width'] ) ) {
3168
+ update_post_meta( $post->ID, 'sa_thumbs_width', abs( intval( $_POST['sa_thumbs_width'] ) ) );
3169
+ }
3170
+ if ( isset( $_POST['sa_thumbs_height'] ) ) {
3171
+ update_post_meta( $post->ID, 'sa_thumbs_height', abs( intval( $_POST['sa_thumbs_height'] ) ) );
3172
+ }
3173
+ if ( isset( $_POST['sa_thumbs_opacity'] ) ) {
3174
+ update_post_meta( $post->ID, 'sa_thumbs_opacity', abs( intval( $_POST['sa_thumbs_opacity'] ) ) );
3175
+ }
3176
+ if ( isset( $_POST['sa_thumbs_border_width'] ) ) {
3177
+ update_post_meta( $post->ID, 'sa_thumbs_border_width', abs( intval( $_POST['sa_thumbs_border_width'] ) ) );
3178
+ }
3179
+ if ( isset( $_POST['sa_thumbs_border_color'] ) ) {
3180
+ update_post_meta( $post->ID, 'sa_thumbs_border_color', sanitize_text_field( wp_unslash( $_POST['sa_thumbs_border_color'] ) ) );
3181
+ }
3182
+ if ( isset( $_POST['sa_thumbs_resp_tablet'] ) ) {
3183
+ update_post_meta( $post->ID, 'sa_thumbs_resp_tablet', abs( intval( $_POST['sa_thumbs_resp_tablet'] ) ) );
3184
+ }
3185
+ if ( isset( $_POST['sa_thumbs_resp_mobile'] ) ) {
3186
+ update_post_meta( $post->ID, 'sa_thumbs_resp_mobile', abs( intval( $_POST['sa_thumbs_resp_mobile'] ) ) );
 
 
3187
  }
3188
  }
3189
  }
3190
 
 
 
 
 
 
 
 
 
 
 
 
3191
 
3192
 
3193
  /**
3210
  * ### FUNCTION CONTAINING THE 'RE-ORDER' SLIDES FUNCTIONALITY ###
3211
  */
3212
  function cpt_slider_sa_reorder_slides_page() {
 
3213
  $page_url = get_admin_url() . 'edit.php?post_type=sa_slider&page=reorderslides';
3214
  $placeholder_image = get_site_url() . '/wp-content/plugins/slide-anything/images/bg_placeholder.png';
3215
 
3345
  // cater for popup images used as the slide background.
3346
  $popup_type = '';
3347
  $popup_background = '';
3348
+ if ( isset( $metadata[ 'sa_slide' . $i . '_popup_type' ][0] ) ) {
3349
+ $popup_type = $metadata[ 'sa_slide' . $i . '_popup_type' ][0];
3350
+ }
3351
+ if ( isset( $metadata[ 'sa_slide' . $i . '_popup_background' ][0] ) ) {
3352
+ $popup_background = $metadata[ 'sa_slide' . $i . '_popup_background' ][0];
 
 
3353
  }
3354
  if ( 'IMAGE' === $popup_type ) {
3355
  if ( ( '' !== $popup_background ) && ( 'no' !== $popup_background ) ) {
php/slide-anything-frontend.php CHANGED
@@ -18,7 +18,6 @@ add_shortcode( 'slide-anything', 'slide_anything_shortcode' );
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' );
@@ -30,15 +29,13 @@ function slide_anything_shortcode( $atts ) {
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 );
@@ -99,61 +96,59 @@ function slide_anything_shortcode( $atts ) {
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;
@@ -392,116 +387,112 @@ function slide_anything_shortcode( $atts ) {
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
@@ -509,29 +500,27 @@ function slide_anything_shortcode( $atts ) {
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.
@@ -542,29 +531,27 @@ function slide_anything_shortcode( $atts ) {
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
 
@@ -621,12 +608,10 @@ function slide_anything_shortcode( $atts ) {
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'] ) {
@@ -636,12 +621,12 @@ function slide_anything_shortcode( $atts ) {
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();
@@ -678,21 +663,19 @@ function slide_anything_shortcode( $atts ) {
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.
@@ -778,8 +761,8 @@ function slide_anything_shortcode( $atts ) {
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.
@@ -813,7 +796,11 @@ function slide_anything_shortcode( $atts ) {
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';
@@ -844,22 +831,20 @@ function slide_anything_shortcode( $atts ) {
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
 
@@ -963,7 +948,7 @@ function slide_anything_shortcode( $atts ) {
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
  }
@@ -1086,8 +1071,8 @@ function slide_anything_shortcode( $atts ) {
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 ) {
@@ -1155,7 +1140,7 @@ function slide_anything_shortcode( $atts ) {
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";
18
  * @param array $atts Shortcode attributes.
19
  */
20
  function slide_anything_shortcode( $atts ) {
 
21
  wp_enqueue_script( 'jquery' );
22
  wp_register_script( 'owl_carousel_js', SA_PLUGIN_PATH . 'owl-carousel/owl.carousel.min.js', array( 'jquery' ), '2.2.1', true );
23
  wp_enqueue_script( 'owl_carousel_js' );
29
  wp_enqueue_style( 'owl_animate_css' );
30
  wp_register_script( 'mousewheel_js', SA_PLUGIN_PATH . 'js/jquery.mousewheel.min.js', array( 'jquery' ), '3.1.13', true );
31
  wp_enqueue_script( 'mousewheel_js' );
32
+ // JAVASCRIPT/CSS FOR MAGNIFIC POPUP.
33
+ wp_register_script( 'magnific-popup_js', SA_PLUGIN_PATH . 'magnific-popup/jquery.magnific-popup.min.js', array( 'jquery' ), '1.1.0', true );
34
+ wp_enqueue_script( 'magnific-popup_js' );
35
+ wp_register_style( 'magnific-popup_css', SA_PLUGIN_PATH . 'magnific-popup/magnific-popup.css', array(), '1.1.0', 'all' );
36
+ wp_enqueue_style( 'magnific-popup_css' );
37
+ wp_register_script( 'owl_thumbs_js', SA_PLUGIN_PATH . 'owl-carousel/owl.carousel2.thumbs.min.js', array( 'jquery' ), '0.1.8', true );
38
+ wp_enqueue_script( 'owl_thumbs_js' );
 
 
39
 
40
  // EXTRACT SHORTCODE ATTRIBUTES.
41
  $args = shortcode_atts( array( 'id' => '0' ), $atts );
96
  if ( '' === $slide_data[ 'slide' . $i . '_link_target' ] ) {
97
  $slide_data[ 'slide' . $i . '_link_target' ] = '_self';
98
  }
99
+ // ### GET POPUP DATA ###
100
+ $slide_data[ 'slide' . $i . '_popup_type' ] = 'NONE';
101
+ $slide_data[ 'slide' . $i . '_popup_imageid' ] = '';
102
+ $slide_data[ 'slide' . $i . '_popup_imagetitle' ] = '';
103
+ $slide_data[ 'slide' . $i . '_popup_video_id' ] = '';
104
+ $slide_data[ 'slide' . $i . '_popup_video_type' ] = '';
105
+ $slide_data[ 'slide' . $i . '_popup_html' ] = '';
106
+ $slide_data[ 'slide' . $i . '_popup_shortcode' ] = '';
107
+ $slide_data[ 'slide' . $i . '_popup_bgcol' ] = '#ffffff';
108
+ $slide_data[ 'slide' . $i . '_popup_width' ] = '600';
109
+ if ( isset( $metadata[ 'sa_slide' . $i . '_popup_type' ] ) ) {
110
+ $slide_data[ 'slide' . $i . '_popup_type' ] = $metadata[ 'sa_slide' . $i . '_popup_type' ][0];
111
+ }
112
+ if ( isset( $metadata[ 'sa_slide' . $i . '_popup_imageid' ] ) ) {
113
+ $slide_data[ 'slide' . $i . '_popup_imageid' ] = $metadata[ 'sa_slide' . $i . '_popup_imageid' ][0];
114
+ }
115
+ if ( isset( $metadata[ 'sa_slide' . $i . '_popup_imagetitle' ] ) ) {
116
+ $slide_data[ 'slide' . $i . '_popup_imagetitle' ] = $metadata[ 'sa_slide' . $i . '_popup_imagetitle' ][0];
117
+ }
118
+ $slide_data[ 'slide' . $i . '_popup_image' ] = '';
119
+ $slide_data[ 'slide' . $i . '_popup_background' ] = 'no';
120
+ if ( 'IMAGE' === $slide_data[ 'slide' . $i . '_popup_type' ] ) {
121
+ if ( ( '' !== $slide_data[ 'slide' . $i . '_popup_imageid' ] ) && ( 0 !== $slide_data[ 'slide' . $i . '_popup_imageid' ] ) ) {
122
+ $popup_full_images = wp_get_attachment_image_src( $slide_data[ 'slide' . $i . '_popup_imageid' ], 'full' );
123
+ $slide_data[ 'slide' . $i . '_popup_image' ] = $popup_full_images[0];
124
+ $slide_data[ 'slide' . $i . '_popup_background' ] = $metadata[ 'sa_slide' . $i . '_popup_background' ][0];
125
+ if ( '' === $slide_data[ 'slide' . $i . '_popup_background' ] ) {
126
+ $slide_data[ 'slide' . $i . '_popup_background' ] = 'no';
 
 
127
  }
128
  }
129
+ }
130
+ if ( isset( $metadata[ 'sa_slide' . $i . '_popup_video_id' ] ) ) {
131
+ $slide_data[ 'slide' . $i . '_popup_video_id' ] = $metadata[ 'sa_slide' . $i . '_popup_video_id' ][0];
132
+ }
133
+ if ( isset( $metadata[ 'sa_slide' . $i . '_popup_video_type' ] ) ) {
134
+ $slide_data[ 'slide' . $i . '_popup_video_type' ] = $metadata[ 'sa_slide' . $i . '_popup_video_type' ][0];
135
+ }
136
+ if ( isset( $metadata[ 'sa_slide' . $i . '_popup_html' ] ) ) {
137
+ $slide_data[ 'slide' . $i . '_popup_html' ] = $metadata[ 'sa_slide' . $i . '_popup_html' ][0];
138
+ }
139
+ if ( isset( $metadata[ 'sa_slide' . $i . '_popup_shortcode' ] ) ) {
140
+ $slide_data[ 'slide' . $i . '_popup_shortcode' ] = $metadata[ 'sa_slide' . $i . '_popup_shortcode' ][0];
141
+ }
142
+ if ( isset( $metadata[ 'sa_slide' . $i . '_popup_bgcol' ] ) ) {
143
+ $slide_data[ 'slide' . $i . '_popup_bgcol' ] = $metadata[ 'sa_slide' . $i . '_popup_bgcol' ][0];
144
+ }
145
+ if ( isset( $metadata[ 'sa_slide' . $i . '_popup_width' ] ) ) {
146
+ $slide_data[ 'slide' . $i . '_popup_width' ] = $metadata[ 'sa_slide' . $i . '_popup_width' ][0];
147
+ }
148
+ if ( 'HTML' === $slide_data[ 'slide' . $i . '_popup_type' ] ) {
149
+ $slide_data[ 'slide' . $i . '_popup_css_id' ] = $slide_data['css_id'] . '_popup' . $i;
150
+ } else {
151
+ $slide_data[ 'slide' . $i . '_popup_css_id' ] = '';
152
  }
153
  }
154
  $slide_data['slide_duration'] = floatval( $metadata['sa_slide_duration'][0] ) * 1000;
387
  // hero slider and slider thumbnails.
388
  $slide_data['hero_slider'] = '0';
389
  $slide_data['thumbs_active'] = '0';
390
+ if ( isset( $metadata['sa_hero_slider'] ) ) {
391
+ $slide_data['hero_slider'] = $metadata['sa_hero_slider'][0];
392
+ if ( '1' !== $slide_data['hero_slider'] ) {
 
 
 
 
393
  $slide_data['hero_slider'] = '0';
394
  }
395
+ } else {
396
+ $slide_data['hero_slider'] = '0';
397
+ }
398
+ if ( isset( $metadata['sa_thumbs_active'] ) ) {
399
+ $slide_data['thumbs_active'] = $metadata['sa_thumbs_active'][0];
400
+ if ( '1' !== $slide_data['thumbs_active'] ) {
401
  $slide_data['thumbs_active'] = '0';
402
  }
403
+ } else {
404
+ $slide_data['thumbs_active'] = '0';
405
+ }
406
+ if ( isset( $metadata['sa_thumbs_location'] ) ) {
407
+ $slide_data['thumbs_location'] = $metadata['sa_thumbs_location'][0];
408
+ } else {
409
+ $slide_data['thumbs_location'] = 'inside_bottom';
410
+ }
411
+ if ( isset( $metadata['sa_thumbs_image_size'] ) ) {
412
+ $slide_data['thumbs_image_size'] = $metadata['sa_thumbs_image_size'][0];
413
+ } else {
414
+ $slide_data['thumbs_image_size'] = 'thumbnail';
415
+ }
416
+ if ( isset( $metadata['sa_thumbs_padding'] ) ) {
417
+ $slide_data['thumbs_padding'] = $metadata['sa_thumbs_padding'][0];
418
+ } else {
419
+ $slide_data['thumbs_padding'] = '3';
420
+ }
421
+ if ( isset( $metadata['sa_thumbs_width'] ) ) {
422
+ $slide_data['thumbs_width'] = $metadata['sa_thumbs_width'][0];
423
+ } else {
424
+ $slide_data['thumbs_width'] = '150';
425
+ }
426
+ if ( isset( $metadata['sa_thumbs_height'] ) ) {
427
+ $slide_data['thumbs_height'] = $metadata['sa_thumbs_height'][0];
428
+ } else {
429
+ $slide_data['thumbs_height'] = '85';
430
+ }
431
+ if ( isset( $metadata['sa_thumbs_opacity'] ) ) {
432
+ $slide_data['thumbs_opacity'] = $metadata['sa_thumbs_opacity'][0];
433
+ } else {
434
+ $slide_data['thumbs_opacity'] = '50';
435
+ }
436
+ if ( isset( $metadata['sa_thumbs_border_width'] ) ) {
437
+ $slide_data['thumbs_border_width'] = $metadata['sa_thumbs_border_width'][0];
438
+ } else {
439
+ $slide_data['thumbs_border_width'] = '0';
440
+ }
441
+ if ( isset( $metadata['sa_thumbs_border_color'] ) ) {
442
+ $slide_data['thumbs_border_color'] = $metadata['sa_thumbs_border_color'][0];
443
+ } else {
444
+ $slide_data['thumbs_border_color'] = '#ffffff';
445
+ }
446
+ if ( isset( $metadata['sa_thumbs_resp_tablet'] ) ) {
447
+ $slide_data['thumbs_resp_tablet'] = $metadata['sa_thumbs_resp_tablet'][0];
448
+ } else {
449
+ $slide_data['thumbs_resp_tablet'] = '75';
450
+ }
451
+ if ( isset( $metadata['sa_thumbs_resp_mobile'] ) ) {
452
+ $slide_data['thumbs_resp_mobile'] = $metadata['sa_thumbs_resp_mobile'][0];
453
+ } else {
454
+ $slide_data['thumbs_resp_mobile'] = '50';
455
  }
456
  // showcase carousel.
457
  $slide_data['showcase_slider'] = '0';
458
+ if ( isset( $metadata['sa_showcase_slider'] ) ) {
459
+ $slide_data['showcase_slider'] = $metadata['sa_showcase_slider'][0];
460
+ if ( '1' !== $slide_data['showcase_slider'] ) {
 
 
 
 
461
  $slide_data['showcase_slider'] = '0';
462
  }
463
+ } else {
464
+ $slide_data['showcase_slider'] = '0';
465
+ }
466
+ if ( isset( $metadata['sa_showcase_width'] ) ) {
467
+ $slide_data['showcase_width'] = $metadata['sa_showcase_width'][0];
468
+ } else {
469
+ $slide_data['showcase_width'] = '120';
470
+ }
471
+ if ( isset( $metadata['sa_showcase_tablet'] ) ) {
472
+ $slide_data['showcase_tablet'] = $metadata['sa_showcase_tablet'][0];
473
+ if ( '1' !== $slide_data['showcase_tablet'] ) {
474
  $slide_data['showcase_tablet'] = '0';
475
  }
476
+ } else {
477
+ $slide_data['showcase_tablet'] = '0';
478
+ }
479
+ if ( isset( $metadata['sa_showcase_width_tab'] ) ) {
480
+ $slide_data['showcase_width_tab'] = $metadata['sa_showcase_width_tab'][0];
481
+ } else {
482
+ $slide_data['showcase_width_tab'] = '130';
483
+ }
484
+ if ( isset( $metadata['sa_showcase_mobile'] ) ) {
485
+ $slide_data['showcase_mobile'] = $metadata['sa_showcase_mobile'][0];
486
+ if ( '1' !== $slide_data['showcase_mobile'] ) {
487
  $slide_data['showcase_mobile'] = '0';
488
  }
489
+ } else {
490
+ $slide_data['showcase_mobile'] = '0';
491
+ }
492
+ if ( isset( $metadata['sa_showcase_width_mob'] ) ) {
493
+ $slide_data['showcase_width_mob'] = $metadata['sa_showcase_width_mob'][0];
494
+ } else {
495
+ $slide_data['showcase_width_mob'] = '140';
496
  }
497
 
498
  // REVERSE THE ORDER OF THE SLIDES IF 'Random Order' CHECKBOX IS CHECKED OR
500
  if ( ( 'true' === $slide_data['reverse_order'] ) || ( 'true' === $slide_data['random_order'] ) ) {
501
  $reorder_arr = array();
502
  for ( $i = 1; $i <= $slide_data['num_slides']; $i++ ) {
503
+ $reorder_arr[ $i - 1 ]['num'] = $slide_data[ 'slide' . $i . '_num' ];
504
+ $reorder_arr[ $i - 1 ]['content'] = $slide_data[ 'slide' . $i . '_content' ];
505
+ $reorder_arr[ $i - 1 ]['image_id'] = $slide_data[ 'slide' . $i . '_image_id' ];
506
+ $reorder_arr[ $i - 1 ]['image_pos'] = $slide_data[ 'slide' . $i . '_image_pos' ];
507
+ $reorder_arr[ $i - 1 ]['image_size'] = $slide_data[ 'slide' . $i . '_image_size' ];
508
+ $reorder_arr[ $i - 1 ]['image_repeat'] = $slide_data[ 'slide' . $i . '_image_repeat' ];
509
+ $reorder_arr[ $i - 1 ]['image_color'] = $slide_data[ 'slide' . $i . '_image_color' ];
510
+ $reorder_arr[ $i - 1 ]['link_url'] = $slide_data[ 'slide' . $i . '_link_url' ];
511
+ $reorder_arr[ $i - 1 ]['link_target'] = $slide_data[ 'slide' . $i . '_link_target' ];
512
+ $reorder_arr[ $i - 1 ]['popup_type'] = $slide_data[ 'slide' . $i . '_popup_type' ];
513
+ $reorder_arr[ $i - 1 ]['popup_imageid'] = $slide_data[ 'slide' . $i . '_popup_imageid' ];
514
+ $reorder_arr[ $i - 1 ]['popup_imagetitle'] = $slide_data[ 'slide' . $i . '_popup_imagetitle' ];
515
+ $reorder_arr[ $i - 1 ]['popup_image'] = $slide_data[ 'slide' . $i . '_popup_image' ];
516
+ $reorder_arr[ $i - 1 ]['popup_background'] = $slide_data[ 'slide' . $i . '_popup_background' ];
517
+ $reorder_arr[ $i - 1 ]['popup_video_id'] = $slide_data[ 'slide' . $i . '_popup_video_id' ];
518
+ $reorder_arr[ $i - 1 ]['popup_video_type'] = $slide_data[ 'slide' . $i . '_popup_video_type' ];
519
+ $reorder_arr[ $i - 1 ]['popup_html'] = $slide_data[ 'slide' . $i . '_popup_html' ];
520
+ $reorder_arr[ $i - 1 ]['popup_shortcode'] = $slide_data[ 'slide' . $i . '_popup_shortcode' ];
521
+ $reorder_arr[ $i - 1 ]['popup_bgcol'] = $slide_data[ 'slide' . $i . '_popup_bgcol' ];
522
+ $reorder_arr[ $i - 1 ]['popup_width'] = $slide_data[ 'slide' . $i . '_popup_width' ];
523
+ $reorder_arr[ $i - 1 ]['popup_css_id'] = $slide_data[ 'slide' . $i . '_popup_css_id' ];
 
 
524
  }
525
  if ( 'true' === $slide_data['random_order'] ) {
526
  // SORT SLIDE ARRAY DATA IN A RANDOM ORDER.
531
  $reorder_arr = $reverse_arr;
532
  }
533
  for ( $i = 1; $i <= $slide_data['num_slides']; $i++ ) {
534
+ $slide_data[ 'slide' . $i . '_num' ] = $reorder_arr[ $i - 1 ]['num'];
535
+ $slide_data[ 'slide' . $i . '_content' ] = $reorder_arr[ $i - 1 ]['content'];
536
+ $slide_data[ 'slide' . $i . '_image_id' ] = $reorder_arr[ $i - 1 ]['image_id'];
537
+ $slide_data[ 'slide' . $i . '_image_pos' ] = $reorder_arr[ $i - 1 ]['image_pos'];
538
+ $slide_data[ 'slide' . $i . '_image_size' ] = $reorder_arr[ $i - 1 ]['image_size'];
539
+ $slide_data[ 'slide' . $i . '_image_repeat' ] = $reorder_arr[ $i - 1 ]['image_repeat'];
540
+ $slide_data[ 'slide' . $i . '_image_color' ] = $reorder_arr[ $i - 1 ]['image_color'];
541
+ $slide_data[ 'slide' . $i . '_link_url' ] = $reorder_arr[ $i - 1 ]['link_url'];
542
+ $slide_data[ 'slide' . $i . '_link_target' ] = $reorder_arr[ $i - 1 ]['link_target'];
543
+ $slide_data[ 'slide' . $i . '_popup_type' ] = $reorder_arr[ $i - 1 ]['popup_type'];
544
+ $slide_data[ 'slide' . $i . '_popup_imageid' ] = $reorder_arr[ $i - 1 ]['popup_imageid'];
545
+ $slide_data[ 'slide' . $i . '_popup_imagetitle' ] = $reorder_arr[ $i - 1 ]['popup_imagetitle'];
546
+ $slide_data[ 'slide' . $i . '_popup_image' ] = $reorder_arr[ $i - 1 ]['popup_image'];
547
+ $slide_data[ 'slide' . $i . '_popup_background' ] = $reorder_arr[ $i - 1 ]['popup_background'];
548
+ $slide_data[ 'slide' . $i . '_popup_video_id' ] = $reorder_arr[ $i - 1 ]['popup_video_id'];
549
+ $slide_data[ 'slide' . $i . '_popup_video_type' ] = $reorder_arr[ $i - 1 ]['popup_video_type'];
550
+ $slide_data[ 'slide' . $i . '_popup_html' ] = $reorder_arr[ $i - 1 ]['popup_html'];
551
+ $slide_data[ 'slide' . $i . '_popup_shortcode' ] = $reorder_arr[ $i - 1 ]['popup_shortcode'];
552
+ $slide_data[ 'slide' . $i . '_popup_bgcol' ] = $reorder_arr[ $i - 1 ]['popup_bgcol'];
553
+ $slide_data[ 'slide' . $i . '_popup_width' ] = $reorder_arr[ $i - 1 ]['popup_width'];
554
+ $slide_data[ 'slide' . $i . '_popup_css_id' ] = $reorder_arr[ $i - 1 ]['popup_css_id'];
 
 
555
  }
556
  }
557
 
608
  }
609
  $output .= "<div id='" . esc_attr( $slide_data['css_id'] ) . "' class='owl-carousel sa_owl_theme " . $additional_classes . "' ";
610
  $output .= "data-slider-id='" . esc_attr( $slide_data['css_id'] ) . "' style='" . $slider_style . "'>\n";
611
+ // INITIALISE VAIRABLES FOR MAGNIFIC POPUP.
612
+ $lightbox_function = 'open_lightbox_gallery_' . $slide_data['css_id'];
613
+ $lightbox_gallery_id = 'lightbox_button_' . $slide_data['css_id'];
614
+ $lightbox_count = 0;
 
 
615
  for ( $i = 1; $i <= $slide_data['num_slides']; $i++ ) {
616
  $slide_content = $slide_data[ 'slide' . $i . '_content' ];
617
  if ( 'full' !== $slide_data['bg_image_size'] ) {
621
  // use "full" WordPress image size.
622
  $slide_image_src = wp_get_attachment_image_src( $slide_data[ 'slide' . $i . '_image_id' ], 'full' );
623
  }
624
+ // USE POPUP IMAGE AS SLIDE BACKGROUND IMAGE (IF THIS OPTION SELECTED).
625
+ if ( 'IMAGE' === $slide_data[ 'slide' . $i . '_popup_type' ] ) {
626
  if ( ( 'no' !== $slide_data[ 'slide' . $i . '_popup_background' ] ) && ( '' !== $slide_data[ 'slide' . $i . '_popup_image' ] ) ) {
627
  $slide_image_src = wp_get_attachment_image_src( $slide_data[ 'slide' . $i . '_popup_imageid' ], $slide_data[ 'slide' . $i . '_popup_background' ] );
628
  }
629
+ } elseif ( 'VIDEO' === $slide_data[ 'slide' . $i . '_popup_type' ] ) {
630
  if ( 'youtube' === $slide_data[ 'slide' . $i . '_popup_video_type' ] ) {
631
  if ( '99999999' === $slide_data[ 'slide' . $i . '_image_id' ] ) {
632
  $slide_image_src = array();
663
  $link_output .= "title='" . $link_title . "' aria-label='" . $link_title . "'></a>";
664
  }
665
 
666
+ // BUILD POPUP HOVER BUTTON.
667
  $popup_output = '';
668
+ if ( ( 'IMAGE' === $slide_data[ 'slide' . $i . '_popup_type' ] ) && ( '' !== $slide_data[ 'slide' . $i . '_popup_image' ] ) ) {
669
+ $lightbox_count++;
670
+ $popup_output = "<div class='sa_popup_zoom_icon' onClick='" . $lightbox_function . '(' . $lightbox_count . ");'></div>";
671
+ }
672
+ if ( ( 'VIDEO' === $slide_data[ 'slide' . $i . '_popup_type' ] ) && ( '' !== $slide_data[ 'slide' . $i . '_popup_video_id' ] ) ) {
673
+ $lightbox_count++;
674
+ $popup_output = "<div class='sa_popup_video_icon' onClick='" . $lightbox_function . '(' . $lightbox_count . ");'></div>";
675
+ }
676
+ if ( 'HTML' === $slide_data[ 'slide' . $i . '_popup_type' ] ) {
677
+ $lightbox_count++;
678
+ $popup_output = "<div class='sa_popup_zoom_icon' onClick='" . $lightbox_function . '(' . $lightbox_count . ");'></div>";
 
 
679
  }
680
 
681
  // DISPLAY SLIDE OUTPUT.
761
  }
762
  $output .= "</div>\n"; // .owl-carousel
763
 
764
+ // THUMBNAIL PAGINATION.
765
+ if ( '1' === $slide_data['thumbs_active'] ) {
766
  $thumbs_loc = $slide_data['thumbs_location'];
767
  $thumbs_opacity = $slide_data['thumbs_opacity'] / 100;
768
  // thumbnail container - set style.
796
  $thumb_image_src = 'https://img.youtube.com/vi/' . $popup_video_id . '/hqdefault.jpg';
797
  } elseif ( 0 !== $slide_data[ 'slide' . $i . '_image_id' ] ) {
798
  $thumb_image_src = wp_get_attachment_image_src( $slide_data[ 'slide' . $i . '_image_id' ], $slide_data['thumbs_image_size'] );
799
+ if ( $thumb_image_src ) {
800
+ $thumb_image_src = $thumb_image_src[0];
801
+ } else {
802
+ $thumb_image_src = SA_PLUGIN_PATH . 'images/image_placeholder.jpg';
803
+ }
804
  } else {
805
  // use a placeholder image if slide has no background image.
806
  $thumb_image_src = SA_PLUGIN_PATH . 'images/image_placeholder.jpg';
831
 
832
  $output .= "</div>\n"; // .white or .black
833
 
834
+ // CREATE A (HIDDEN) DIV FOR EACH 'HTML' POPUP.
835
+ for ( $i = 1; $i <= $slide_data['num_slides']; $i++ ) {
836
+ if ( 'HTML' === $slide_data[ 'slide' . $i . '_popup_type' ] ) {
837
+ $popup_css_id = $slide_data[ 'slide' . $i . '_popup_css_id' ];
838
+ $popup_bgcol = $slide_data[ 'slide' . $i . '_popup_bgcol' ];
839
+ $popup_width = $slide_data[ 'slide' . $i . '_popup_width' ];
840
+ $output .= "<div id='" . $popup_css_id . "' class='mfp-hide sa_custom_popup' ";
841
+ $output .= "style='background:" . $popup_bgcol . '; max-width:' . $popup_width . "px;'>\n";
842
+ if ( '1' === $slide_data[ 'slide' . $i . '_popup_shortcode' ] ) {
843
+ $output .= do_shortcode( $slide_data[ 'slide' . $i . '_popup_html' ] );
844
+ } else {
845
+ $output .= $slide_data[ 'slide' . $i . '_popup_html' ];
 
 
 
846
  }
847
+ $output .= "</div>\n";
848
  }
849
  }
850
 
948
  $output .= " lazyLoad : true,\n";
949
  $output .= " lazyLoadEager: 1,\n";
950
  }
951
+ if ( '1' === $slide_data['thumbs_active'] ) {
952
  $output .= " thumbs : true,\n";
953
  $output .= " thumbsPrerendered : true,\n";
954
  }
1071
  $output .= " });\n";
1072
  }
1073
 
1074
+ // ### JQUERY/JAVASCRIPT CODE FOR THUMBNAIL PAGINATION ###
1075
+ if ( '1' === $slide_data['thumbs_active'] ) {
1076
 
1077
  // BORDER WIDTH IS SET - SET BORDER COLOUR TO THE ACTIVE THUMB.
1078
  if ( $slide_data['thumbs_border_width'] > 0 ) {
1140
  $output .= "</script>\n";
1141
 
1142
  // ### GENERATE JQUERY CODE FOR THE MAGNIFIC POPUP ###
1143
+ if ( $lightbox_count > 0 ) {
1144
  $output .= "<script type='text/javascript'>\n";
1145
  if ( '1' === $slide_data['sa_window_onload'] ) {
1146
  $output .= "document.addEventListener('DOMContentLoaded', function() {\n";
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: slider, carousel, content slider, responsive slider, html slider, owl carousel
5
  Requires at least: 4.0
6
  Tested up to: 6.0
7
- Stable tag: 2.3.47
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -19,18 +19,10 @@ Slide Anything provides many Owl Carousel 2 features, which include:
19
  * Touch and Drag Support - Designed specially to boost mobile browsing experience. Mouse drag works great on desktop too!
20
  * Fully Responsive - You can define the number of slides to display for various breakpoint settings, e.g. 4 slides on desktop, 3 slides on tablet and 2 slides on mobile.
21
  * Modern Browsers - Owl uses hardware acceleration with CSS3 Translate3d transitions. Its fast and works like a charm! It also supports CSS2 fallbacks to cater for older browsers.
22
- * New Lazy Load Images - with this feature enabled, slide images (<img> tags) are only loaded when the relevant slides are displayed (all of the slider's images are NOT loaded up-front).
23
  * Infinite Looping - introduced with Owl Carousel 2, this feature means that the first slide is now seamlessly displayed after the last slide without any carousel rewind.
24
- * New Transition Effects - New Owl Carousel transitions include Slide, Fade, Zoom In, Zoom Out, Flip Out X/Y, Rotate Left/Right, Bounce Out, Roll Out and Slide Down.
25
  * Slide Link Feature - A feature which allows you to create a hover-over link button for any slide within your carousels.
26
  * Re-Order Slides Facility - Now you can use a 'drag-and-drop' interface to easily re-order your slides within the sliders you create.
27
-
28
- [Usage Examples](https://edgewebpages.com/slide-anything-usage-examples)
29
-
30
- = Slide Anything PRO =
31
-
32
- [SLIDE ANYTHING PRO](https://edgewebpages.com/) adds the following extra features:
33
-
34
  * MODAL POPUPS - Each slide can now open a MODAL POPUP, which can be an IMAGE popup, a VIDEO EMBED popup (YouTube/Vimeo), a HTML CODE popup or a popup displaying a WordPress SHORTCODE.
35
  * HERO SLIDER - A Hero Slider is a slider that always is 100% of the width/height of the device it's being viewed on (or 100% of the window width/height if on a desktop device).
36
  * THUMBNAIL PAGINATION - Allows you to add an area of small clickable thumb images, with each image representing a single slide that can be clicked to navigate to that slide.
@@ -87,7 +79,7 @@ The `Padding (pixels)` settings are used to define the amount of padding space a
87
 
88
  The `SLIDE STYLE` settings are the style settings for each individual slide with the slider/carousel. Here you can define the minimum height each slide and also the padding space around each slide.
89
 
90
- = Using 'Slide Anything' in WordPress 5.0 =
91
 
92
  Adding a SLIDE ANYTHING slider using the WordPress 5.0 'Block Editor' is pretty straight-forward. You can paste a Slide Anything shortcode into a 'Paragraph Block' or use the 'Shortcode Block'.
93
 
@@ -98,6 +90,9 @@ Adding a SLIDE ANYTHING slider using the WordPress 5.0 'Block Editor' is pretty
98
 
99
  == Changelog ==
100
 
 
 
 
101
  = 2.4.1 =
102
  * Updated all PHP code within the plugin to meet the WordPress.org security and coding standards (minor update to ensure PHP function names have a standard prefix).
103
 
@@ -787,4 +782,7 @@ Adding a SLIDE ANYTHING slider using the WordPress 5.0 'Block Editor' is pretty
787
  * Updated all PHP code within the plugin to meet the WordPress.org security and coding standards.
788
 
789
  = 2.4.1 =
790
- * Updated all PHP code within the plugin to meet the WordPress.org security and coding standards (minor update to ensure PHP function names have a standard prefix).
 
 
 
4
  Tags: slider, carousel, content slider, responsive slider, html slider, owl carousel
5
  Requires at least: 4.0
6
  Tested up to: 6.0
7
+ Stable tag: 2.4.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
19
  * Touch and Drag Support - Designed specially to boost mobile browsing experience. Mouse drag works great on desktop too!
20
  * Fully Responsive - You can define the number of slides to display for various breakpoint settings, e.g. 4 slides on desktop, 3 slides on tablet and 2 slides on mobile.
21
  * Modern Browsers - Owl uses hardware acceleration with CSS3 Translate3d transitions. Its fast and works like a charm! It also supports CSS2 fallbacks to cater for older browsers.
 
22
  * Infinite Looping - introduced with Owl Carousel 2, this feature means that the first slide is now seamlessly displayed after the last slide without any carousel rewind.
23
+ * Transition Effects - New Owl Carousel transitions include Slide, Fade, Zoom In, Zoom Out, Flip Out X/Y, Rotate Left/Right, Bounce Out, Roll Out and Slide Down.
24
  * Slide Link Feature - A feature which allows you to create a hover-over link button for any slide within your carousels.
25
  * Re-Order Slides Facility - Now you can use a 'drag-and-drop' interface to easily re-order your slides within the sliders you create.
 
 
 
 
 
 
 
26
  * MODAL POPUPS - Each slide can now open a MODAL POPUP, which can be an IMAGE popup, a VIDEO EMBED popup (YouTube/Vimeo), a HTML CODE popup or a popup displaying a WordPress SHORTCODE.
27
  * HERO SLIDER - A Hero Slider is a slider that always is 100% of the width/height of the device it's being viewed on (or 100% of the window width/height if on a desktop device).
28
  * THUMBNAIL PAGINATION - Allows you to add an area of small clickable thumb images, with each image representing a single slide that can be clicked to navigate to that slide.
79
 
80
  The `SLIDE STYLE` settings are the style settings for each individual slide with the slider/carousel. Here you can define the minimum height each slide and also the padding space around each slide.
81
 
82
+ = Using 'Slide Anything' with the WordPress Block Editor =
83
 
84
  Adding a SLIDE ANYTHING slider using the WordPress 5.0 'Block Editor' is pretty straight-forward. You can paste a Slide Anything shortcode into a 'Paragraph Block' or use the 'Shortcode Block'.
85
 
90
 
91
  == Changelog ==
92
 
93
+ = 2.4.2 =
94
+ * Discontinued the Slide Anything PRO plugin addon. All of the 'Pro' features will now be available within the 'Free' version of the plgin offered on WordPress.org. As ongoing developent and support for the Owl Carousel jQuery library (the engine on which Slide Anything is built) is now discontinued, there is a possibility that at some point in the future the Owl Carousel code will no longer work with the later versions of jQuery that may be bundled with WordPress. But I will endevour to keep the Slide Anything plugin running with WordPress as long as possible.
95
+
96
  = 2.4.1 =
97
  * Updated all PHP code within the plugin to meet the WordPress.org security and coding standards (minor update to ensure PHP function names have a standard prefix).
98
 
782
  * Updated all PHP code within the plugin to meet the WordPress.org security and coding standards.
783
 
784
  = 2.4.1 =
785
+ * Updated all PHP code within the plugin to meet the WordPress.org security and coding standards (minor update to ensure PHP function names have a standard prefix).
786
+
787
+ = 2.4.2 =
788
+ * Discontinued the Slide Anything PRO plugin addon. All of the 'Pro' features will now be available within the 'Free' version of the plgin offered on WordPress.org. As ongoing developent and support for the Owl Carousel jQuery library (the engine on which Slide Anything is built) is now discontinued, there is a possibility that at some point in the future the Owl Carousel code will no longer work with the later versions of jQuery that may be bundled with WordPress. But I will endevour to keep the Slide Anything plugin running with WordPress as long as possible.
slide-anything.php CHANGED
@@ -3,7 +3,7 @@
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.1
7
  *
8
  * @package WordPress_Slide_Anything
9
  * @author Simon Edge
@@ -40,10 +40,6 @@ add_action( 'admin_menu', 'cpt_slider_extra_sa_menu_pages' );
40
  add_filter( 'template_include', 'cpt_slider_sa_preview_page_template' );
41
  add_filter( 'wp_kses_allowed_html', 'cpt_slider_allow_iframes_filter' );
42
 
43
- // SLIDE ANYTHING 2.0 UPGRADE NOTICE.
44
- add_action( 'admin_notices', 'cpt_slider_version_20_upgrade_notice' );
45
- add_action( 'admin_init', 'cpt_slider_slide_anything_notice_ignore' );
46
-
47
  // ADD A CHECKBOX OPTION UNDER 'Settings -> Writing' CALLED 'Disable TinyMCE Button'.
48
  add_action( 'admin_init', 'cpt_slider_disable_tinymce_button_setting' );
49
 
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.2
7
  *
8
  * @package WordPress_Slide_Anything
9
  * @author Simon Edge
40
  add_filter( 'template_include', 'cpt_slider_sa_preview_page_template' );
41
  add_filter( 'wp_kses_allowed_html', 'cpt_slider_allow_iframes_filter' );
42
 
 
 
 
 
43
  // ADD A CHECKBOX OPTION UNDER 'Settings -> Writing' CALLED 'Disable TinyMCE Button'.
44
  add_action( 'admin_init', 'cpt_slider_disable_tinymce_button_setting' );
45