WD Instagram Feed – Instagram Gallery - Version 1.4.31

Version Description

Fixed: Security issue.

Download this release

Release Info

Developer 10web
Plugin Icon 128x128 WD Instagram Feed – Instagram Gallery
Version 1.4.31
Comparing to
See all releases

Code changes from version 1.4.30 to 1.4.31

Files changed (41) hide show
  1. admin-functions.php +50 -50
  2. admin/controllers/WDIControllerThemes_wdi.php +0 -325
  3. admin/controllers/WDIControllerWidget.php +0 -1
  4. admin/controllers/feeds.php +124 -101
  5. admin/controllers/settings.php +19 -7
  6. admin/controllers/themes.php +17 -0
  7. admin/controllers/uninstall.php +4 -12
  8. admin/models/WDIModelEditorShortcode.php +4 -2
  9. admin/models/WDIModelThemes_wdi.php +0 -585
  10. admin/models/WDIModelWidget.php +2 -2
  11. admin/models/feeds.php +39 -30
  12. admin/models/themes.php +546 -0
  13. admin/views/WDIViewEditorShortcode.php +1 -1
  14. admin/views/WDIViewWidget.php +19 -6
  15. admin/views/feeds.php +23 -26
  16. admin/views/settings.php +3 -4
  17. admin/views/{WDIViewThemes_wdi.php → themes.php} +3 -11
  18. admin/views/uninstall.php +1 -1
  19. config.php +1 -1
  20. css/wdi_backend.css +1 -112
  21. css/wdi_frontend.css +0 -3
  22. elementor/widget.php +5 -2
  23. framework/WDICache.php +9 -5
  24. framework/WDIInstagram.php +24 -12
  25. framework/WDILibrary.php +83 -59
  26. framework/WDILibraryEmbed.php +9 -8
  27. framework/WDI_admin_view.php +71 -109
  28. framework/WDI_form_builder.php +115 -118
  29. framework/WDI_generate_styles.php +1312 -1321
  30. frontend/models/WDIModelGalleryBox.php +22 -9
  31. frontend/models/imagebrowser.php +4 -4
  32. frontend/models/thumbnails.php +4 -4
  33. frontend/shortcode.php +28 -38
  34. frontend/views/WDIViewGalleryBox.php +337 -380
  35. frontend/views/imagebrowser.php +24 -21
  36. frontend/views/thumbnails.php +32 -27
  37. js/gallerybox/wdi_gallery_box.js +0 -2
  38. readme.txt +4 -1
  39. update/wdi_update.php +70 -52
  40. wd-instagram-feed.php +40 -46
  41. wd/includes/subscribe.php +1 -1
admin-functions.php CHANGED
@@ -47,6 +47,7 @@ function wdi_install() {
47
  $current_version = WDI_VERSION;
48
  $saved_version = get_option('wdi_version');
49
  wdi_parse_old_options($current_version, $saved_version);
 
50
  if ( $saved_version ) {
51
  if ( substr($saved_version, 0, 1) == '2' && substr($current_version, 0, 1) == '1' ) {
52
  wdi_set_options_defaults();
@@ -95,7 +96,6 @@ function wdi_install() {
95
  image_browser_preload_number varchar(10) NOT NULL,
96
  image_browser_load_number varchar(10) NOT NULL,
97
  number_of_columns varchar(30) NOT NULL,
98
-
99
  resort_after_load_more varchar(1) NOT NULL,
100
  show_likes varchar(1) NOT NULL,
101
  show_description varchar(1) NOT NULL,
@@ -107,8 +107,6 @@ function wdi_install() {
107
  disable_mobile_layout varchar(1) NOT NULL,
108
  feed_type varchar(30) NOT NULL,
109
  feed_item_onclick varchar(30) NOT NULL,
110
-
111
-
112
  popup_fullscreen varchar(1) NOT NULL,
113
  popup_width varchar(64) NOT NULL,
114
  popup_height varchar(64) NOT NULL,
@@ -135,7 +133,6 @@ function wdi_install() {
135
  show_image_counts varchar(1) NOT NULL,
136
  enable_loop varchar(1) NOT NULL,
137
  popup_image_right_click varchar(1) NOT NULL,
138
-
139
  conditional_filters varchar(10000) NOT NULL,
140
  conditional_filter_type varchar(32) NOT NULL,
141
  show_username_on_thumb varchar(32) NOT NULL,
@@ -145,22 +142,22 @@ function wdi_install() {
145
  redirect_url varchar(255) NOT NULL,
146
  feed_resolution varchar(255) NOT NULL,
147
  hashtag_top_recent varchar(10) NOT NULL,
148
-
149
-
150
  UNIQUE KEY id (id)
151
  ) $charset_collate;";
152
- if ( $wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name ) {
153
- //table is not created. you may create the table here.
154
- $wpdb->query($sql);
 
 
 
 
155
  }
156
- //dbDelta( $sql );
157
  $charset_collate2 = 'COLLATE latin1_general_ci';
158
  $table_name = $wpdb->prefix . WDI_THEME_TABLE;
159
  $sql = "CREATE TABLE $table_name (
160
  id mediumint(9) NOT NULL AUTO_INCREMENT PRIMARY KEY,
161
  theme_name tinytext NOT NULL,
162
  default_theme varchar(1) NOT NULL,
163
-
164
  feed_container_bg_color varchar(32) NOT NULL,
165
  feed_wrapper_width varchar(32) NOT NULL,
166
  feed_container_width varchar(32) NOT NULL,
@@ -188,7 +185,6 @@ function wdi_install() {
188
  follow_btn_border_hover_color varchar(32) NOT NULL,
189
  follow_btn_text_hover_color varchar(32) NOT NULL,
190
  follow_btn_background_hover_color varchar(32) NOT NULL,
191
-
192
  user_horizontal_margin varchar(32) NOT NULL,
193
  user_padding varchar(32) NOT NULL,
194
  user_border_size varchar(32) NOT NULL,
@@ -196,7 +192,6 @@ function wdi_install() {
196
  user_img_width varchar(32) NOT NULL,
197
  user_border_radius varchar(32) NOT NULL,
198
  user_background_color varchar(32) NOT NULL,
199
-
200
  users_border_size varchar(32) NOT NULL,
201
  users_border_color varchar(32) NOT NULL,
202
  users_background_color varchar(32) NOT NULL,
@@ -205,7 +200,6 @@ function wdi_install() {
205
  users_text_font_size varchar(32) NOT NULL,
206
  users_text_font_style varchar(32) NOT NULL,
207
  user_description_font_size varchar(32) NOT NULL,
208
-
209
  lightbox_overlay_bg_color varchar(32) NOT NULL,
210
  lightbox_overlay_bg_transparent varchar(32) NOT NULL,
211
  lightbox_bg_color varchar(32) NOT NULL,
@@ -309,7 +303,6 @@ function wdi_install() {
309
  lightbox_comment_separator_color varchar(32) NOT NULL,
310
  lightbox_comment_load_more_color varchar(32) NOT NULL,
311
  lightbox_comment_load_more_color_hover varchar(32) NOT NULL,
312
-
313
  th_photo_wrap_padding varchar(32) NOT NULL,
314
  th_photo_wrap_border_size varchar(32) NOT NULL,
315
  th_photo_wrap_border_color varchar(32) NOT NULL,
@@ -328,8 +321,7 @@ function wdi_install() {
328
  th_overlay_hover_transparent varchar(32) NOT NULL,
329
  th_overlay_hover_icon_color varchar(32) NOT NULL,
330
  th_overlay_hover_icon_font_size varchar(32) NOT NULL,
331
- th_photo_img_hover_effect varchar(32) NOT NULL,
332
-
333
  mas_photo_wrap_padding varchar(32) NOT NULL,
334
  mas_photo_wrap_border_size varchar(32) NOT NULL,
335
  mas_photo_wrap_border_color varchar(32) NOT NULL,
@@ -349,7 +341,6 @@ function wdi_install() {
349
  mas_overlay_hover_icon_color varchar(32) NOT NULL,
350
  mas_overlay_hover_icon_font_size varchar(32) NOT NULL,
351
  mas_photo_img_hover_effect varchar(32) NOT NULL,
352
-
353
  blog_style_photo_wrap_padding varchar(32) NOT NULL,
354
  blog_style_photo_wrap_border_size varchar(32) NOT NULL,
355
  blog_style_photo_wrap_border_color varchar(32) NOT NULL,
@@ -364,7 +355,6 @@ function wdi_install() {
364
  blog_style_feed_item_margin varchar(32) NOT NULL,
365
  blog_style_photo_caption_hover_color varchar(32) NOT NULL,
366
  blog_style_like_comm_font_size varchar(32) NOT NULL,
367
-
368
  image_browser_photo_wrap_padding varchar(32) NOT NULL,
369
  image_browser_photo_wrap_border_size varchar(32) NOT NULL,
370
  image_browser_photo_wrap_border_color varchar(32) NOT NULL,
@@ -379,7 +369,6 @@ function wdi_install() {
379
  image_browser_feed_item_margin varchar(32) NOT NULL,
380
  image_browser_photo_caption_hover_color varchar(32) NOT NULL,
381
  image_browser_like_comm_font_size varchar(32) NOT NULL,
382
-
383
  load_more_position varchar(32) NOT NULL,
384
  load_more_padding varchar(32) NOT NULL,
385
  load_more_bg_color varchar(32) NOT NULL,
@@ -397,22 +386,23 @@ function wdi_install() {
397
  pagination_ctrl_hover_color varchar(32) NOT NULL,
398
  pagination_position varchar(32) NOT NULL,
399
  pagination_position_vert varchar(32) NOT NULL,
400
-
401
  /* since v1.0.6*/
402
  /* keep order */
403
  th_thumb_user_bg_color varchar(32) NOT NULL,
404
  th_thumb_user_color varchar(32) NOT NULL,
405
  mas_thumb_user_bg_color varchar(32) NOT NULL,
406
  mas_thumb_user_color varchar(32) NOT NULL,
407
-
408
  UNIQUE KEY id (id)
409
  ) $charset_collate2;";
410
- // dbDelta( $sql );
411
- if ( $wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name ) {
412
  //table is not created. you may create the table here.
413
- $wpdb->query($sql);
 
 
414
  wdi_install_default_themes();
415
  }
 
416
  if ( !update_option('wdi_version', WDI_VERSION) ) {
417
  add_option('wdi_version', WDI_VERSION);
418
  }
@@ -432,6 +422,7 @@ function wdi_install() {
432
  // Using this insted of flush_rewrite_rule() for better performance with multisite.
433
  global $wp_rewrite;
434
  $wp_rewrite->init();
 
435
  $wp_rewrite->flush_rules();
436
  }
437
 
@@ -440,10 +431,11 @@ function wdi_deactivate() {
440
  // Using this insted of flush_rewrite_rule() for better performance with multisite.
441
  global $wp_rewrite;
442
  $wp_rewrite->init();
 
443
  $wp_rewrite->flush_rules();
444
  }
445
 
446
- //receives settings element as parameter and checks it's type and displays proper form element
447
  function wdi_field_callback( $element ) {
448
  $setting = $element[0];
449
  $wdi_formBuilder = new WDI_admin_view();
@@ -491,6 +483,7 @@ function wdi_validate_options( $input ) {
491
  global $wdi_options;
492
  foreach ( $input as $key => $value ) {
493
  if ( isset($input[$key]) ) {
 
494
  $wdi_options[$key] = strip_tags(stripslashes($input[$key]));
495
  }
496
  }
@@ -507,6 +500,7 @@ function wdi_sanitize_options( $input ) {
507
  case 'text':
508
  {
509
  if ( isset($input[$key]) ) {
 
510
  $output[$key] = strip_tags(stripslashes($input[$key]));
511
  }
512
  break;
@@ -535,10 +529,7 @@ function wdi_sanitize_options( $input ) {
535
  }
536
 
537
  $option = $input['wdi_authenticated_users_list'];
538
- //$saved_user_list = json_decode($wdi_options['wdi_authenticated_users_list'], true);
539
-
540
  if ( !empty($option['access_token']) ) {
541
-
542
  $user_count = count($option['access_token']);
543
  for ( $i = 0; $i < $user_count; $i++ ) {
544
 
@@ -559,16 +550,18 @@ function wdi_sanitize_options( $input ) {
559
  if ( isset($users_list[$input['wdi_user_name']]) ) {
560
  unset($users_list[$input['wdi_user_name']]);
561
  }
562
- $output[$key] = json_encode($users_list);
563
  break;
564
  }
565
  default:
566
  {
567
  if ( isset($input[$key]) ) {
568
  if ( is_array($input[$key]) ) {
569
- $output[$key] = strip_tags(stripslashes(json_encode($input[$key])));
 
570
  }
571
  else {
 
572
  $output[$key] = strip_tags(stripslashes($input[$key]));
573
  }
574
  }
@@ -686,7 +679,6 @@ function wdi_get_settings() {
686
  'default' => '',
687
  'title' => __('Custom JavaScript', "wd-instagram-feed"),
688
  ),
689
- //'wdi_preserve_settings_when_remove'=>array('name'=>'wdi_preserve_settings_when_remove','field_or_not'=>'field','type'=>'checkbox','default'=>'1', 'section'=>'wdi_configure_section','title'=>__('Preserve Settings When Remove',"wd-instagram-feed")),
690
  'wdi_plugin_uninstalled' => array(
691
  'name' => 'wdi_plugin_uninstalled',
692
  'sanitize_type' => 'bool',
@@ -716,9 +708,7 @@ function wdi_get_settings() {
716
  'section' => 'wdi_customize_section',
717
  'title' => __('Set Maximum Count of Cache Requests', "wd-instagram-feed"),
718
  'default' => '10',
719
- ),
720
- //'wdi_version' => array('name'=>'wdi_version','field_or_not'=>'no_field','default'=>WDI_VERSION),
721
- //'wdi_first_time'=>array('name'=>'wdi_first_time','field_or_not'=>'no_field','default'=>'1')
722
  );
723
 
724
  return $settings;
@@ -735,7 +725,6 @@ function wdi_set_options_defaults() {
735
  }
736
  $options = wp_parse_args($options, $db_options);
737
 
738
-
739
  if ( !isset($options['wdi_cache_request_count']) ) {
740
  $options['wdi_cache_request_count'] = 10;
741
  }
@@ -761,16 +750,27 @@ function wdi_get_options() {
761
  function wdi_install_default_themes() {
762
  global $wdi_options;
763
  global $wpdb;
 
 
 
 
 
 
 
 
764
  require_once WDI_DIR . "/templates/default-themes.php";
765
  $default_themes = wdi_get_default_themes();
766
  foreach ( $default_themes as $theme ) {
767
  $table_name = $wpdb->prefix . WDI_THEME_TABLE;
768
- if ( $wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name ) {
 
 
769
  require_once(WDI_DIR . '/framework/WDILibrary.php');
770
- echo WDILibrary::message(__('Database error, please uninstall the plugin and install again', "wd-instagram-feed"), 'error');
771
  }
772
  else {
773
- $wpdb->insert($table_name, $theme);
 
774
  }
775
  }
776
  }
@@ -794,19 +794,19 @@ function wdi_get_create_feeds_cap() {
794
  }
795
 
796
  function wdi_generate_themes_files() {
797
- require_once WDI_DIR . '/admin/models/WDIModelThemes_wdi.php';
798
  require_once WDI_DIR . '/framework/WDILibrary.php';
799
- $themes = WDIModelThemes_wdi::get_themes();
 
800
  if ( !is_array($themes) || empty($themes) ) {
801
  return;
802
  }
803
- require_once WDI_DIR . '/admin/controllers/WDIControllerThemes_wdi.php';
804
- WDIControllerThemes_wdi::remove_all_themes_files();
805
  require_once WDI_DIR . '/framework/WDI_generate_styles.php';
806
  foreach ( $themes as $id => $theme_title ) {
807
- $theme_row = WDIModelThemes_wdi::get_theme_row($id);
808
- $generator = new WDI_generate_styles($id, (array) $theme_row);
809
- $generator->all_views_styles();
 
 
810
  }
811
  }
812
 
@@ -817,6 +817,7 @@ function wdi_generate_themes_files() {
817
  function wdi_get_auth_urls() {
818
  require_once WDI_DIR . '/framework/WDILibrary.php';
819
  $config = WDILibrary::instagram_app_config();
 
820
  $state = array(
821
  'wp_site_url' => admin_url('admin.php?page=wdi_settings'),
822
  );
@@ -826,7 +827,7 @@ function wdi_get_auth_urls() {
826
  'redirect_uri' => $config['basic_redirect_uri'],
827
  'scope' => $config['basic_scope'],
828
  'response_type' => $config['basic_response_type'],
829
- 'state' => admin_url('admin.php?wdi_settings')
830
  ), $config['basic_authorize_url']);
831
 
832
  $urls['business'] = add_query_arg(array(
@@ -834,7 +835,7 @@ function wdi_get_auth_urls() {
834
  'redirect_uri' => $config['graph_redirect_uri'],
835
  'scope' => $config['graph_scope']
836
  ), $config['graph_authorize_url']);
837
- $urls['business'] .= '&state=' . base64_encode(json_encode($state));
838
 
839
  return $urls;
840
  }
@@ -880,13 +881,12 @@ function wdi_parse_old_options( $new_version, $old_version ) {
880
  'wdi_business_ig_user',
881
  'wdi_business_fb_page',
882
  );
883
- // 'wdi_access_token', 'wdi_user_name', 'wdi_user_id', 'wdi_start_in', 'wdi_expires_in',
884
  foreach ( $unset_options as $key => $val ) {
885
  if ( isset($options[$val]) ) {
886
  unset($options[$val]);
887
  }
888
  }
889
- $options['wdi_authenticated_users_list'] = json_encode($users);
890
  update_option(WDI_OPT, $options, 'yes');
891
  }
892
  }
47
  $current_version = WDI_VERSION;
48
  $saved_version = get_option('wdi_version');
49
  wdi_parse_old_options($current_version, $saved_version);
50
+
51
  if ( $saved_version ) {
52
  if ( substr($saved_version, 0, 1) == '2' && substr($current_version, 0, 1) == '1' ) {
53
  wdi_set_options_defaults();
96
  image_browser_preload_number varchar(10) NOT NULL,
97
  image_browser_load_number varchar(10) NOT NULL,
98
  number_of_columns varchar(30) NOT NULL,
 
99
  resort_after_load_more varchar(1) NOT NULL,
100
  show_likes varchar(1) NOT NULL,
101
  show_description varchar(1) NOT NULL,
107
  disable_mobile_layout varchar(1) NOT NULL,
108
  feed_type varchar(30) NOT NULL,
109
  feed_item_onclick varchar(30) NOT NULL,
 
 
110
  popup_fullscreen varchar(1) NOT NULL,
111
  popup_width varchar(64) NOT NULL,
112
  popup_height varchar(64) NOT NULL,
133
  show_image_counts varchar(1) NOT NULL,
134
  enable_loop varchar(1) NOT NULL,
135
  popup_image_right_click varchar(1) NOT NULL,
 
136
  conditional_filters varchar(10000) NOT NULL,
137
  conditional_filter_type varchar(32) NOT NULL,
138
  show_username_on_thumb varchar(32) NOT NULL,
142
  redirect_url varchar(255) NOT NULL,
143
  feed_resolution varchar(255) NOT NULL,
144
  hashtag_top_recent varchar(10) NOT NULL,
 
 
145
  UNIQUE KEY id (id)
146
  ) $charset_collate;";
147
+ // check table exist
148
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
149
+ if ( $wpdb->get_var("SHOW TABLES LIKE '" . esc_sql($table_name) . "'") != $table_name ) {
150
+ // table is not created. you may create the table here.
151
+ // we are not using $wpdb->prepare() here, since everything here is "esc" done, we're just creating a table.
152
+ /* phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared */
153
+ $wpdb->query($sql); //db call ok
154
  }
 
155
  $charset_collate2 = 'COLLATE latin1_general_ci';
156
  $table_name = $wpdb->prefix . WDI_THEME_TABLE;
157
  $sql = "CREATE TABLE $table_name (
158
  id mediumint(9) NOT NULL AUTO_INCREMENT PRIMARY KEY,
159
  theme_name tinytext NOT NULL,
160
  default_theme varchar(1) NOT NULL,
 
161
  feed_container_bg_color varchar(32) NOT NULL,
162
  feed_wrapper_width varchar(32) NOT NULL,
163
  feed_container_width varchar(32) NOT NULL,
185
  follow_btn_border_hover_color varchar(32) NOT NULL,
186
  follow_btn_text_hover_color varchar(32) NOT NULL,
187
  follow_btn_background_hover_color varchar(32) NOT NULL,
 
188
  user_horizontal_margin varchar(32) NOT NULL,
189
  user_padding varchar(32) NOT NULL,
190
  user_border_size varchar(32) NOT NULL,
192
  user_img_width varchar(32) NOT NULL,
193
  user_border_radius varchar(32) NOT NULL,
194
  user_background_color varchar(32) NOT NULL,
 
195
  users_border_size varchar(32) NOT NULL,
196
  users_border_color varchar(32) NOT NULL,
197
  users_background_color varchar(32) NOT NULL,
200
  users_text_font_size varchar(32) NOT NULL,
201
  users_text_font_style varchar(32) NOT NULL,
202
  user_description_font_size varchar(32) NOT NULL,
 
203
  lightbox_overlay_bg_color varchar(32) NOT NULL,
204
  lightbox_overlay_bg_transparent varchar(32) NOT NULL,
205
  lightbox_bg_color varchar(32) NOT NULL,
303
  lightbox_comment_separator_color varchar(32) NOT NULL,
304
  lightbox_comment_load_more_color varchar(32) NOT NULL,
305
  lightbox_comment_load_more_color_hover varchar(32) NOT NULL,
 
306
  th_photo_wrap_padding varchar(32) NOT NULL,
307
  th_photo_wrap_border_size varchar(32) NOT NULL,
308
  th_photo_wrap_border_color varchar(32) NOT NULL,
321
  th_overlay_hover_transparent varchar(32) NOT NULL,
322
  th_overlay_hover_icon_color varchar(32) NOT NULL,
323
  th_overlay_hover_icon_font_size varchar(32) NOT NULL,
324
+ th_photo_img_hover_effect varchar(32) NOT NULL,
 
325
  mas_photo_wrap_padding varchar(32) NOT NULL,
326
  mas_photo_wrap_border_size varchar(32) NOT NULL,
327
  mas_photo_wrap_border_color varchar(32) NOT NULL,
341
  mas_overlay_hover_icon_color varchar(32) NOT NULL,
342
  mas_overlay_hover_icon_font_size varchar(32) NOT NULL,
343
  mas_photo_img_hover_effect varchar(32) NOT NULL,
 
344
  blog_style_photo_wrap_padding varchar(32) NOT NULL,
345
  blog_style_photo_wrap_border_size varchar(32) NOT NULL,
346
  blog_style_photo_wrap_border_color varchar(32) NOT NULL,
355
  blog_style_feed_item_margin varchar(32) NOT NULL,
356
  blog_style_photo_caption_hover_color varchar(32) NOT NULL,
357
  blog_style_like_comm_font_size varchar(32) NOT NULL,
 
358
  image_browser_photo_wrap_padding varchar(32) NOT NULL,
359
  image_browser_photo_wrap_border_size varchar(32) NOT NULL,
360
  image_browser_photo_wrap_border_color varchar(32) NOT NULL,
369
  image_browser_feed_item_margin varchar(32) NOT NULL,
370
  image_browser_photo_caption_hover_color varchar(32) NOT NULL,
371
  image_browser_like_comm_font_size varchar(32) NOT NULL,
 
372
  load_more_position varchar(32) NOT NULL,
373
  load_more_padding varchar(32) NOT NULL,
374
  load_more_bg_color varchar(32) NOT NULL,
386
  pagination_ctrl_hover_color varchar(32) NOT NULL,
387
  pagination_position varchar(32) NOT NULL,
388
  pagination_position_vert varchar(32) NOT NULL,
 
389
  /* since v1.0.6*/
390
  /* keep order */
391
  th_thumb_user_bg_color varchar(32) NOT NULL,
392
  th_thumb_user_color varchar(32) NOT NULL,
393
  mas_thumb_user_bg_color varchar(32) NOT NULL,
394
  mas_thumb_user_color varchar(32) NOT NULL,
 
395
  UNIQUE KEY id (id)
396
  ) $charset_collate2;";
397
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
398
+ if ( $wpdb->get_var("SHOW TABLES LIKE '" . esc_sql($table_name) . "'") != $table_name ) {
399
  //table is not created. you may create the table here.
400
+ // we are not using $wpdb->prepare() here, since everything here is "esc" done, we're just creating a table.
401
+ /* phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared */
402
+ $wpdb->query( $sql ); //db call ok
403
  wdi_install_default_themes();
404
  }
405
+
406
  if ( !update_option('wdi_version', WDI_VERSION) ) {
407
  add_option('wdi_version', WDI_VERSION);
408
  }
422
  // Using this insted of flush_rewrite_rule() for better performance with multisite.
423
  global $wp_rewrite;
424
  $wp_rewrite->init();
425
+ /* phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.flush_rules_flush_rules */
426
  $wp_rewrite->flush_rules();
427
  }
428
 
431
  // Using this insted of flush_rewrite_rule() for better performance with multisite.
432
  global $wp_rewrite;
433
  $wp_rewrite->init();
434
+ /* phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.flush_rules_flush_rules */
435
  $wp_rewrite->flush_rules();
436
  }
437
 
438
+ // receives settings element as parameter and checks it's type and displays proper form element
439
  function wdi_field_callback( $element ) {
440
  $setting = $element[0];
441
  $wdi_formBuilder = new WDI_admin_view();
483
  global $wdi_options;
484
  foreach ( $input as $key => $value ) {
485
  if ( isset($input[$key]) ) {
486
+ /* phpcs:ignore WordPressVIPMinimum.Functions.StripTags.StripTagsOneParameter */
487
  $wdi_options[$key] = strip_tags(stripslashes($input[$key]));
488
  }
489
  }
500
  case 'text':
501
  {
502
  if ( isset($input[$key]) ) {
503
+ /* phpcs:ignore WordPressVIPMinimum.Functions.StripTags.StripTagsOneParameter */
504
  $output[$key] = strip_tags(stripslashes($input[$key]));
505
  }
506
  break;
529
  }
530
 
531
  $option = $input['wdi_authenticated_users_list'];
 
 
532
  if ( !empty($option['access_token']) ) {
 
533
  $user_count = count($option['access_token']);
534
  for ( $i = 0; $i < $user_count; $i++ ) {
535
 
550
  if ( isset($users_list[$input['wdi_user_name']]) ) {
551
  unset($users_list[$input['wdi_user_name']]);
552
  }
553
+ $output[$key] = wp_json_encode($users_list);
554
  break;
555
  }
556
  default:
557
  {
558
  if ( isset($input[$key]) ) {
559
  if ( is_array($input[$key]) ) {
560
+ /* phpcs:ignore WordPressVIPMinimum.Functions.StripTags.StripTagsOneParameter */
561
+ $output[$key] = strip_tags(stripslashes(wp_json_encode($input[$key])));
562
  }
563
  else {
564
+ /* phpcs:ignore WordPressVIPMinimum.Functions.StripTags.StripTagsOneParameter */
565
  $output[$key] = strip_tags(stripslashes($input[$key]));
566
  }
567
  }
679
  'default' => '',
680
  'title' => __('Custom JavaScript', "wd-instagram-feed"),
681
  ),
 
682
  'wdi_plugin_uninstalled' => array(
683
  'name' => 'wdi_plugin_uninstalled',
684
  'sanitize_type' => 'bool',
708
  'section' => 'wdi_customize_section',
709
  'title' => __('Set Maximum Count of Cache Requests', "wd-instagram-feed"),
710
  'default' => '10',
711
+ )
 
 
712
  );
713
 
714
  return $settings;
725
  }
726
  $options = wp_parse_args($options, $db_options);
727
 
 
728
  if ( !isset($options['wdi_cache_request_count']) ) {
729
  $options['wdi_cache_request_count'] = 10;
730
  }
750
  function wdi_install_default_themes() {
751
  global $wdi_options;
752
  global $wpdb;
753
+ $allowed_message_html = array(
754
+ 'div' => array(
755
+ 'class' => true,
756
+ 'style' => true
757
+ ),
758
+ 'p' => array(),
759
+ 'strong' => array()
760
+ );
761
  require_once WDI_DIR . "/templates/default-themes.php";
762
  $default_themes = wdi_get_default_themes();
763
  foreach ( $default_themes as $theme ) {
764
  $table_name = $wpdb->prefix . WDI_THEME_TABLE;
765
+ // check table exist
766
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching */
767
+ if ( $wpdb->get_var("SHOW TABLES LIKE '". esc_sql($table_name) . "'") != $table_name ) {
768
  require_once(WDI_DIR . '/framework/WDILibrary.php');
769
+ echo wp_kses(WDILibrary::message(__('Database error, please uninstall the plugin and install again', "wd-instagram-feed"), 'error'), $allowed_message_html );
770
  }
771
  else {
772
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
773
+ $wpdb->insert( $table_name, $theme); //db call ok
774
  }
775
  }
776
  }
794
  }
795
 
796
  function wdi_generate_themes_files() {
 
797
  require_once WDI_DIR . '/framework/WDILibrary.php';
798
+ require_once WDI_DIR . '/admin/models/themes.php';
799
+ $themes = Themes_model_wdi::get_themes();
800
  if ( !is_array($themes) || empty($themes) ) {
801
  return;
802
  }
 
 
803
  require_once WDI_DIR . '/framework/WDI_generate_styles.php';
804
  foreach ( $themes as $id => $theme_title ) {
805
+ $theme_row = Themes_model_wdi::get_theme_row($id);
806
+ if ( !empty($theme_row) ) {
807
+ $generator = new WDI_generate_styles($id, (array) $theme_row);
808
+ $generator->all_views_styles();
809
+ }
810
  }
811
  }
812
 
817
  function wdi_get_auth_urls() {
818
  require_once WDI_DIR . '/framework/WDILibrary.php';
819
  $config = WDILibrary::instagram_app_config();
820
+ $wdi_nonce_token = wp_create_nonce('wdi_nonce_token');
821
  $state = array(
822
  'wp_site_url' => admin_url('admin.php?page=wdi_settings'),
823
  );
827
  'redirect_uri' => $config['basic_redirect_uri'],
828
  'scope' => $config['basic_scope'],
829
  'response_type' => $config['basic_response_type'],
830
+ 'state' => admin_url('admin.php?wdi_settings') . '-wdi_nonce_token=' . $wdi_nonce_token
831
  ), $config['basic_authorize_url']);
832
 
833
  $urls['business'] = add_query_arg(array(
835
  'redirect_uri' => $config['graph_redirect_uri'],
836
  'scope' => $config['graph_scope']
837
  ), $config['graph_authorize_url']);
838
+ $urls['business'] .= '&state=' . base64_encode(wp_json_encode($state));
839
 
840
  return $urls;
841
  }
881
  'wdi_business_ig_user',
882
  'wdi_business_fb_page',
883
  );
 
884
  foreach ( $unset_options as $key => $val ) {
885
  if ( isset($options[$val]) ) {
886
  unset($options[$val]);
887
  }
888
  }
889
+ $options['wdi_authenticated_users_list'] = wp_json_encode($users);
890
  update_option(WDI_OPT, $options, 'yes');
891
  }
892
  }
admin/controllers/WDIControllerThemes_wdi.php DELETED
@@ -1,325 +0,0 @@
1
- <?php
2
- class WDIControllerThemes_wdi {
3
-
4
- private $data_format;
5
- private $view,$model;
6
-
7
- public function __construct() {
8
- $this->setDataFormat();
9
- require_once (WDI_DIR . "/admin/models/WDIModelThemes_wdi.php");
10
- $this->model = new WDIModelThemes_wdi();
11
-
12
- require_once (WDI_DIR . "/admin/views/WDIViewThemes_wdi.php");
13
- $this->view = new WDIViewThemes_wdi($this->model);
14
- }
15
-
16
- public function execute() {
17
- $task = WDILibrary::get('task');
18
- $id = WDILibrary::get('current_id', 0);
19
- $message = WDILibrary::get('message');
20
-
21
- if(!empty($message)){
22
- $message = explode(',', $message);
23
- foreach($message as $msg_id){
24
- echo WDILibrary::message_id($msg_id);
25
- }
26
- }
27
-
28
- $get_method_tasks = array(
29
- "add",
30
- "edit",
31
- "display"
32
- );
33
- $get_task = "";
34
- if ( WDILibrary::get('task') != '' ) {
35
- $get_task = WDILibrary::get('task');
36
- }
37
- if (method_exists($this, $task)) {
38
- if(!in_array($get_task , $get_method_tasks)){
39
- check_admin_referer('nonce_wd', 'nonce_wd');
40
- }
41
- $this->$task($id);
42
- }
43
- else {
44
- $search_value = WDILibrary::get('search_value');
45
- if( !empty($search_value) ){
46
- WDILibrary::wdi_spider_redirect(add_query_arg(array(
47
- 'page' => WDILibrary::get('page'),
48
- 'task' => 'display',
49
- 'search' => $search_value,
50
- ), admin_url('admin.php')));
51
- }else{
52
- $this->display();
53
- }
54
- }
55
- }
56
-
57
- public function display() {
58
- require_once (WDI_DIR . "/admin/models/WDIModelThemes_wdi.php");
59
- $model = new WDIModelThemes_wdi();
60
-
61
- require_once (WDI_DIR . "/admin/views/WDIViewThemes_wdi.php");
62
- $view = new WDIViewThemes_wdi($model);
63
- $view->display();
64
- }
65
-
66
-
67
- private function setDataFormat(){
68
- $this->data_format = array(
69
- '%s',/*theme_name*/
70
- '%s',/*default_theme*/
71
- '%s',/*feed_container_bg_color*/
72
- '%s',/*feed_wrapper_width*/
73
- '%s',/*feed_container_width*/
74
- '%s',/*feed_wrapper_bg_color*/
75
- '%s',/*active_filter_bg_color*/
76
- '%s',/*header_margin*/
77
- '%s',/*header_padding*/
78
- '%s',/*header_border_size*/
79
- '%s',/*header_border_color*/
80
- '%s',/*header_position*/
81
- '%s',/*header_img_width*/
82
- '%s',/*header_border_radius*/
83
- '%s',/*header_text_padding*/
84
- '%s',/*header_text_color*/
85
- '%d',/*header_font_weight*/
86
- '%s',/*header_text_font_size*/
87
- '%s',/*header_text_font_style*/
88
- '%s',/*'follow_btn_border_radius'=>'number'*/
89
- '%s',/*'follow_btn_padding'=>'number'*/
90
- '%d',/*'follow_btn_margin'=>'number'*/
91
- '%s',//'follow_btn_bg_color'=>'color',
92
- '%s',//'follow_btn_border_color'=>'color',
93
- '%s',//'follow_btn_text_color'=>'color',
94
- '%d',//'follow_btn_font_size'=>'number',
95
- '%s',//'follow_btn_border_hover_color'=>'color',
96
- '%s',//'follow_btn_text_hover_color'=>'color',
97
- '%s',//'follow_btn_background_hover_color'=>'color',
98
-
99
- '%s',/*user_horizontal_margin*/
100
- '%s',/*user_padding*/
101
- '%s',/*user_border_size*/
102
- '%s',/*user_border_color*/
103
- '%d',//'user_img_width'
104
- '%d',/*user_border_radius*/
105
- '%s',/*user_background_color*/
106
- '%s',/*users_border_size*/
107
- '%s',/*users_border_color*/
108
- '%s',/*users_background_color*/
109
- '%s',//users_text_color
110
- '%d',//users_font_weight
111
- '%s',//users_text_font_size
112
- '%s',//users_text_font_style
113
- '%s',//user_description_font_size
114
- '%s',//'lightbox_overlay_bg_color'=>'color',
115
- '%d',//'lightbox_overlay_bg_transparent'=>'number_max_100',
116
- '%s',//'lightbox_bg_color'=>'color',
117
- '%d',//'lightbox_ctrl_btn_height'=>'number',
118
- '%d',//'lightbox_ctrl_btn_margin_top'=>'number',
119
- '%d',//'lightbox_ctrl_btn_margin_left'=>'number',
120
- '%s',//'lightbox_ctrl_btn_pos'=>'string',
121
- '%s',//'lightbox_ctrl_cont_bg_color'=>'color',
122
- '%d',//'lightbox_ctrl_cont_border_radius'=>'number',
123
- '%d',//'lightbox_ctrl_cont_transparent'=>'number_max_100',
124
- '%s',//'lightbox_ctrl_btn_align'=>'position',
125
- '%s',//'lightbox_ctrl_btn_color'=>'color',
126
- '%d',//'lightbox_ctrl_btn_transparent'=>'number_max_100',
127
- '%d',//'lightbox_toggle_btn_height'=>'number',
128
- '%d',//'lightbox_toggle_btn_width'=>'number',
129
- '%d',//'lightbox_close_btn_border_radius'=>'number',
130
- '%d',//'lightbox_close_btn_border_width'=>'number',
131
- '%s',//'lightbox_close_btn_border_style'=>'string',
132
- '%s',//'lightbox_close_btn_border_color'=>'color',
133
- '%s',//'lightbox_close_btn_box_shadow'=>'css_box_shadow',
134
- '%s',//'lightbox_close_btn_bg_color'=>'color',
135
- '%d',//'lightbox_close_btn_transparent'=>'number_max_100',
136
- '%d',//'lightbox_close_btn_width'=>'number',
137
- '%d',//'lightbox_close_btn_height'=>'number',
138
- '%d',//'lightbox_close_btn_top'=>'number_neg',
139
- '%d',//'lightbox_close_btn_right'=>'number_neg',
140
- '%d',//'lightbox_close_btn_size'=>'number',
141
- '%s',//'lightbox_close_btn_color'=>'color',
142
- '%s',//'lightbox_close_btn_full_color'=>'color',
143
- '%s',//'lightbox_close_btn_hover_color'=>'color'
144
- '%s',//'lightbox_comment_share_button_color'=>'color',
145
- '%s',//'lightbox_rl_btn_style'=>'string',
146
- '%s',//'lightbox_rl_btn_bg_color'=>'color',
147
- '%d',//'lightbox_rl_btn_transparent'=>'number_max_100',
148
- '%s',//'lightbox_rl_btn_box_shadow'=>'css_box_shadow',
149
- '%d',//'lightbox_rl_btn_height'=>'number',
150
- '%d',//'lightbox_rl_btn_width'=>'number',
151
- '%d',//'lightbox_rl_btn_size'=>'number',
152
- '%s',//'lightbox_close_rl_btn_hover_color'=>'color',
153
- '%s',//'lightbox_rl_btn_color'=>'color',
154
- '%d',//'lightbox_rl_btn_border_radius'=>'number',
155
- '%d',//'lightbox_rl_btn_border_width'=>'number',
156
- '%s',//'lightbox_rl_btn_border_style'=>'string',
157
- '%s',//'lightbox_rl_btn_border_color'=>'color',
158
- '%s',//'lightbox_filmstrip_pos'=>'position',
159
- '%s',//'lightbox_filmstrip_thumb_margin'=>'length_multi',
160
- '%d',//'lightbox_filmstrip_thumb_border_width'=>'number',
161
- '%s',//'lightbox_filmstrip_thumb_border_style'=>'string',
162
- '%s',//'lightbox_filmstrip_thumb_border_color'=>'color',
163
- '%d',//'lightbox_filmstrip_thumb_border_radius'=>'number',
164
- '%d',//'lightbox_filmstrip_thumb_active_border_width'=>'number',
165
- '%s',//'lightbox_filmstrip_thumb_active_border_color'=>'color',
166
- '%s',//'lightbox_filmstrip_thumb_deactive_transparent'=>'number_max_100',
167
- '%d',//'lightbox_filmstrip_rl_btn_size'=>'number',
168
- '%s',//'lightbox_filmstrip_rl_btn_color'=>'color',
169
- '%s',//'lightbox_filmstrip_rl_bg_color'=>'color',
170
- '%s',//'lightbox_info_pos'=>'position',
171
- '%s',//'lightbox_info_align'=>'string',
172
- '%s',//'lightbox_info_bg_color'=>'color',
173
- '%d',//'lightbox_info_bg_transparent'=>'number_max_100',
174
- '%d',//'lightbox_info_border_width'=>'number',
175
- '%s',//'lightbox_info_border_style'=>'string',
176
- '%s',//'lightbox_info_border_color'=>'color',
177
- '%d',//'lightbox_info_border_radius'=>'number',
178
- '%s',//'lightbox_info_padding'=>'length_multi',
179
- '%s',//'lightbox_info_margin'=>'length_multi',
180
- '%s',//'lightbox_title_color'=>'color',
181
- '%s',//'lightbox_title_font_style'=>'string',
182
- '%s',//'lightbox_title_font_weight'=>'string',
183
- '%d',//'lightbox_title_font_size'=>'number',
184
- '%s',//'lightbox_description_color'=>'color',
185
- '%s',//'lightbox_description_font_style'=>'string',
186
- '%s',//'lightbox_description_font_weight'=>'string',
187
- '%d',//'lightbox_description_font_size'=>'number',
188
- '%d',//'lightbox_info_height'=>'number_max_100'
189
- '%d',//'lightbox_comment_width'=>'number',
190
- '%s',//'lightbox_comment_pos'=>'string',
191
- '%s',//'lightbox_comment_bg_color'=>'color',
192
- '%d',//'lightbox_comment_font_size'=>'number',
193
- '%s',//'lightbox_comment_font_color'=>'color',
194
- '%s',//'lightbox_comment_font_style'=>'string',
195
- '%d',//'lightbox_comment_author_font_size'=>'number',
196
- '%s',//'lightbox_comment_author_font_color'=>'color',
197
- '%s',//'lightbox_comment_author_font_color_hover'=>'color'
198
- '%d',//'lightbox_comment_date_font_size'=>'number',
199
- '%d',//'lightbox_comment_body_font_size'=>'number',
200
- '%d',//'lightbox_comment_input_border_width'=>'number',
201
- '%s',//'lightbox_comment_input_border_style'=>'string',
202
- '%s',//'lightbox_comment_input_border_color'=>'color',
203
- '%d',//'lightbox_comment_input_border_radius'=>'number',
204
- '%s',//'lightbox_comment_input_padding'=>'length_multi',
205
- '%s',//'lightbox_comment_input_bg_color'=>'color',
206
- '%s',//'lightbox_comment_button_bg_color'=>'color',
207
- '%s',//'lightbox_comment_button_padding'=>'length_multi',
208
- '%d',//'lightbox_comment_button_border_width'=>'number',
209
- '%s',//'lightbox_comment_button_border_style'=>'string',
210
- '%s',//'lightbox_comment_button_border_color'=>'color',
211
- '%d',//'lightbox_comment_button_border_radius'=>'number',
212
- '%d',//'lightbox_comment_separator_width'=>'number',
213
- '%s',//'lightbox_comment_separator_style'=>'string',
214
- '%s',//'lightbox_comment_separator_color'=>'color',
215
- '%s',//'lightbox_comment_load_more_color' =>'color',
216
- '%s',//'lightbox_comment_load_more_color_hover' =>'color',
217
-
218
- '%s',/*th_photo_wrap_padding*/
219
- '%s',/*th_photo_wrap_border_size*/
220
- '%s',/*th_photo_wrap_border_color*/
221
- '%s',/*th_photo_img_border_radius*/
222
- '%s',/*th_photo_wrap_bg_color*/
223
- '%s',/*th_photo_meta_bg_color*/
224
- '%s',/*th_photo_meta_one_line*/
225
- '%s',/*th_like_text_color*/
226
- '%s',/*th_comment_text_color*/
227
- '%s',/*th_photo_caption_font_size*/
228
- '%s',/*th_photo_caption_color*/
229
- '%s',/*th_feed_item_margin*/
230
- '%s',/*th_photo_caption_hover_color*/
231
- '%s',/*th_like_comm_font_size*/
232
- '%s',//'th_overlay_hover_color'=>'color',
233
- '%d',//'th_overlay_hover_transparent'=>'number',
234
- '%s',//'th_overlay_hover_icon_color'=>'color',
235
- '%s',//'th_overlay_hover_icon_font_size'=>'length',
236
-
237
- '%s',//th_photo_img_hover_effect
238
-
239
- '%s',/*mas_photo_wrap_padding*/
240
- '%s',/*mas_photo_wrap_border_size*/
241
- '%s',/*mas_photo_wrap_border_color*/
242
- '%s',/*mas_photo_img_border_radius*/
243
- '%s',/*mas_photo_wrap_bg_color*/
244
- '%s',/*mas_photo_meta_bg_color*/
245
- '%s',/*mas_photo_meta_one_line*/
246
- '%s',/*mas_like_text_color*/
247
- '%s',/*mas_comment_text_color*/
248
- '%s',/*mas_photo_caption_font_size*/
249
- '%s',/*mas_photo_caption_color*/
250
- '%s',/*mas_feed_item_margin*/
251
- '%s',/*mas_photo_caption_hover_color*/
252
- '%s',/*mas_like_comm_font_size*/
253
- '%s',//'mas_overlay_hover_color'=>'color',
254
- '%d',//'mas_overlay_hover_transparent'=>'number',
255
- '%s',//'mas_overlay_hover_icon_color'=>'color',
256
- '%s',//'mas_overlay_hover_icon_font_size'=>'length',
257
- '%s',//mas_photo_img_hover_effect
258
-
259
- '%s',/*blog_style_photo_wrap_padding*/
260
- '%s',/*blog_style_photo_wrap_border_size*/
261
- '%s',/*blog_style_photo_wrap_border_color*/
262
- '%s',/*blog_style_photo_img_border_radius*/
263
- '%s',/*blog_style_photo_wrap_bg_color*/
264
- '%s',/*blog_style_photo_meta_bg_color*/
265
- '%s',/*blog_style_photo_meta_one_line*/
266
- '%s',/*blog_style_like_text_color*/
267
- '%s',/*blog_style_comment_text_color*/
268
- '%s',/*blog_style_photo_caption_font_size*/
269
- '%s',/*blog_style_photo_caption_color*/
270
- '%s',/*blog_style_feed_item_margin*/
271
- '%s',/*blog_style_photo_caption_hover_color*/
272
- '%s',/*blog_style_like_comm_font_size*/
273
-
274
- '%s',/*image_browser_photo_wrap_padding*/
275
- '%s',/*image_browser_photo_wrap_border_size*/
276
- '%s',/*image_browser_photo_wrap_border_color*/
277
- '%s',/*image_browser_photo_img_border_radius*/
278
- '%s',/*image_browser_photo_wrap_bg_color*/
279
- '%s',/*image_browser_photo_meta_bg_color*/
280
- '%s',/*image_browser_photo_meta_one_line*/
281
- '%s',/*image_browser_like_text_color*/
282
- '%s',/*image_browser_comment_text_color*/
283
- '%s',/*image_browser_photo_caption_font_size*/
284
- '%s',/*image_browser_photo_caption_color*/
285
- '%s',/*image_browser_feed_item_margin*/
286
- '%s',/*image_browser_photo_caption_hover_color*/
287
- '%s',/*image_browser_like_comm_font_size*/
288
-
289
- '%s',/*load_more_position*/
290
- '%s',/*load_more_padding*/
291
- '%s',/*load_more_bg_color*/
292
- '%s',/*load_more_border_radius*/
293
- '%s',/*load_more_height*/
294
- '%s',/*load_more_width*/
295
- '%s',/*load_more_border_size*/
296
- '%s',/*load_more_border_color*/
297
- '%s',/*load_more_text_color*/
298
- '%s',/*load_more_text_font_size*/
299
- '%s',/*load_more_wrap_hover_color*/
300
- '%s',// 'pagination_ctrl_color' => 'color',
301
- '%s',// 'pagination_size' => 'length',
302
- '%s',// 'pagination_ctrl_margin' => 'length_multi',
303
- '%s',// 'pagination_ctrl_hover_color' => 'color'
304
- '%s',//'pagination_position'=>'position'
305
- '%s',//'pagination_position_vert'=>'position'
306
-
307
- /* since v1.0.6. keep order, defaults*/
308
-
309
- '%s',//'th_thumb_user_bg_color'=>'color',
310
- '%s',//'th_thumb_user_color'=>'color'
311
- '%s',//'mas_thumb_user_bg_color'=>'color',
312
- '%s',//'mas_thumb_user_color'=>'color'
313
- );
314
- }
315
-
316
- public static function remove_theme_file($theme_id){
317
- return null;
318
- }
319
-
320
- public static function remove_all_themes_files(){
321
- return;
322
- }
323
-
324
- }
325
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/controllers/WDIControllerWidget.php CHANGED
@@ -22,7 +22,6 @@ class WDIControllerWidget extends WP_Widget {
22
  }
23
 
24
  public function widget($args, $instance) {
25
-
26
  $this->view->widget($args, $instance);
27
  }
28
 
22
  }
23
 
24
  public function widget($args, $instance) {
 
25
  $this->view->widget($args, $instance);
26
  }
27
 
admin/controllers/feeds.php CHANGED
@@ -2,8 +2,17 @@
2
 
3
  class Feeds_controller_wdi {
4
  private $dataFormat;
5
-
6
  public function __construct() {
 
 
 
 
 
 
 
 
 
7
  $this->setDataFormat();
8
  }
9
 
@@ -11,17 +20,14 @@ class Feeds_controller_wdi {
11
  $task = WDILibrary::get('task');
12
  $id = WDILibrary::get('current_id', 0);
13
  $message = WDILibrary::get('message');
 
14
  if ( !empty($message) ) {
15
  $message = explode(',', $message);
16
  foreach ( $message as $msg_id ) {
17
- echo WDILibrary::message_id($msg_id);
18
  }
19
  }
20
- $get_method_tasks = array(
21
- "add",
22
- "edit",
23
- "display",
24
- );
25
  $get_task = "";
26
  if ( WDILibrary::get('task') != '' ) {
27
  $get_task = WDILibrary::get('task');
@@ -35,12 +41,12 @@ class Feeds_controller_wdi {
35
  else {
36
  $search_value = WDILibrary::get('search_value');
37
  if ( $search_value != '' ) {
38
-
39
  wp_redirect( add_query_arg( array(
40
  'page' => WDILibrary::get('page'),
41
  'task' => 'display',
42
  'search' => $search_value,
43
  ), admin_url('admin.php')) );
 
44
  }
45
  else {
46
  $this->display();
@@ -60,76 +66,76 @@ class Feeds_controller_wdi {
60
  $settings = $defaults;
61
  }
62
  global $wpdb;
63
- $wpdb->insert($wpdb->prefix . WDI_FEED_TABLE, $settings, $this->dataFormat);
64
 
65
  return $wpdb->insert_id;
66
  }
67
 
68
  private function setDataFormat() {
69
  $this->dataFormat = array(
70
- '%s',/*feed_name*/
71
- '%s',/*feed_thumb*/
72
- '%s',/*thumb_user*/
73
- '%d',/*published*/
74
- '%d',/*theme_id*/
75
- '%s',/*feed_users*/
76
- '%s',/*feed_display_view*/
77
- '%s',/*sort_images_by*/
78
- '%s',/*display_order*/
79
- '%d',/*follow_on_instagram_btn*/
80
- '%d',/*display_header*/
81
- '%d',/*number_of_photos*/
82
- '%d',/*load_more_number*/
83
- '%d',/*'pagination_per_page_number'*/
84
- '%d',/*'pagination_preload_number'*/
85
- '%d',/*image_browser_preload_number*/
86
- '%d',/*image_browser_load_number*/
87
- '%d',/*number_of_columns*/
88
- '%d',/*resort_after_load_more*/
89
- '%d',/*show_likes*/
90
- '%d',/*show_description*/
91
- '%d',/*show_comments*/
92
- '%d',/*show_usernames*/
93
- '%d',/*display_user_info*/
94
- '%d',//'display_user_post_follow_number'
95
- '%d',/*show_full_description*/
96
- '%d',/*disable_mobile_layout*/
97
- '%s',/*feed_type*/
98
- '%s',/*feed_item_onclick*/
99
- '%d',//'popup_fullscreen'=>'bool',
100
- '%d',//'popup_width'=>'number',
101
- '%d',//'popup_height'=>'number',
102
- '%s',//'popup_type'=>'string',
103
- '%d',//'popup_autoplay'=>'bool',
104
- '%d',//'popup_interval'=>'number',
105
- '%d',//'popup_enable_filmstrip'=>'bool',
106
- '%d',//'popup_filmstrip_height'=>'number',
107
- '%d',//'autohide_lightbox_navigation'=>'bool',
108
- '%d',//'popup_enable_ctrl_btn'=>'bool',
109
- '%d',//'popup_enable_fullscreen'=>'bool',
110
- '%d',//'popup_enable_info'=>'bool',
111
- '%d',//'popup_info_always_show'=>'bool',
112
- '%d',//'popup_info_full_width'=>'bool',
113
- '%d',//'popup_enable_comment'=>'bool',
114
- '%d',//'popup_enable_fullsize_image'=>'bool',
115
- '%d',//'popup_enable_download'=>'bool',
116
- '%d',//popup_enable_share_buttons=>'bool',
117
- '%d',//'popup_enable_facebook'=>'bool',
118
- '%d',//'popup_enable_twitter'=>'bool',
119
- '%d',//'popup_enable_google'=>'bool',
120
- '%d',//'popup_enable_pinterest'=>'bool',
121
- '%d',//'popup_enable_tumblr'=>'bool',
122
- '%d',//'show_image_counts'=>'bool',
123
- '%d',//'enable_loop'=>'bool'
124
- '%d',//popup_image_right_click=>'bool'
125
- '%s',//'conditional_filters' => 'string',
126
- '%s',//'conditional_filter_type' => 'string'
127
- '%d',/*show_username_on_thumb*/
128
- '%d',//'conditional_filter_enable'=>'0',
129
- '%s',//'liked_feed' => 'string'
130
- '%d',//'mobile_breakpoint'=>'640',
131
- '%s',//'redirect_url',
132
- '%s',//'feed_resolution',
133
  );
134
  }
135
 
@@ -173,13 +179,14 @@ class Feeds_controller_wdi {
173
  global $wpdb;
174
  $action = WDILibrary::get('add_or_edit');
175
  if ( $action == '' ) {
176
- $wpdb->insert($wpdb->prefix . WDI_FEED_TABLE, $settings, $this->dataFormat);
177
  if ( $wpdb->insert_id == FALSE ) {
178
  $this->message(__('Cannot Write on database. Check database permissions.', 'wd-instagram-feed'), 'error');
179
  }
180
  }
181
  else {
182
- $msg = $wpdb->update($wpdb->prefix . WDI_FEED_TABLE, $settings, array( 'id' => $action ), $this->dataFormat, array( '%d' ));
 
183
  if ( $msg == FALSE ) {
184
  $this->message(__("You have not made new changes", 'wd-instagram-feed'), 'notice');
185
  }
@@ -205,14 +212,15 @@ class Feeds_controller_wdi {
205
  $need_cache = 1;
206
  if ( $action == '' ) {
207
  $settings["feed_name"] = $model->get_unique_title($settings["feed_name"]);
208
- $wpdb->insert($wpdb->prefix . WDI_FEED_TABLE, $settings, $this->dataFormat);
209
  if ( $wpdb->insert_id == FALSE ) {
210
  $message_id = 24;
211
  }
212
  }
213
  else {
214
  $need_cache = $model->check_need_cache( $action, $settings );
215
- $msg = $wpdb->update($wpdb->prefix . WDI_FEED_TABLE, $settings, array( 'id' => $action ), $this->dataFormat, array( '%d' ));
 
216
  if ( $msg == FALSE ) {
217
  $message_id = 24;
218
  }
@@ -237,7 +245,7 @@ class Feeds_controller_wdi {
237
  'current_id' => $wdi_current_id,
238
  'message' => $message_id,
239
  ), admin_url('admin.php'));
240
- echo json_encode($redirect_url);
241
  die();
242
  }
243
 
@@ -248,7 +256,7 @@ class Feeds_controller_wdi {
248
  global $wpdb;
249
  $action = WDILibrary::get('add_or_edit');
250
  if ( $action == '' ) {
251
- $wpdb->insert($wpdb->prefix . WDI_FEED_TABLE, $defaults, $this->dataFormat);
252
  if ( $wpdb->insert_id == FALSE ) {
253
  $this->message(__("Cannot Write on database. Check database permissions.", 'wd-instagram-feed'), 'error');
254
  $this->display();
@@ -258,7 +266,8 @@ class Feeds_controller_wdi {
258
  }
259
  }
260
  else {
261
- $msg = $wpdb->update($wpdb->prefix . WDI_FEED_TABLE, $defaults, array( 'id' => $action ), $this->dataFormat, array( '%d' ));
 
262
  if ( $msg == FALSE ) {
263
  $this->message(__("You have not made new changes", 'wd-instagram-feed'), 'notice');
264
  $this->edit();
@@ -291,7 +300,8 @@ class Feeds_controller_wdi {
291
  global $wpdb;
292
  $message = 19;
293
  $flag = FALSE;
294
- $feed_ids_col = $wpdb->get_col('SELECT id FROM ' . $wpdb->prefix . WDI_FEED_TABLE);
 
295
  foreach ( $feed_ids_col as $slider_id ) {
296
  if ( WDILibrary::get('check_' . $slider_id) != '' ) {
297
  if ( !$flag ) {
@@ -315,14 +325,17 @@ class Feeds_controller_wdi {
315
  global $wpdb;
316
  $model = new Feeds_model_wdi();
317
  if ( $feed_id ) {
318
- $feed_row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . WDI_FEED_TABLE . ' where id="%d"', $feed_id));
 
319
  }
320
  if ( $feed_row ) {
321
  $duplicate_values = WDILibrary::objectToArray($feed_row);
322
  unset($duplicate_values['id']);
323
- $duplicate_values["feed_name"] = $model->get_unique_title($duplicate_values["feed_name"]);
324
- $save = $wpdb->insert($wpdb->prefix . WDI_FEED_TABLE, $duplicate_values, $this->dataFormat);
325
- $new_slider_id = $wpdb->get_var('SELECT MAX(id) FROM ' . $wpdb->prefix . WDI_FEED_TABLE);
 
 
326
  }
327
 
328
  return $new_slider_id;
@@ -330,8 +343,9 @@ class Feeds_controller_wdi {
330
 
331
  private function delete( $id ) {
332
  global $wpdb;
333
- $query = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . WDI_FEED_TABLE . ' WHERE id="%d"', $id);
334
- if ( $wpdb->query($query) ) {
 
335
  $message = 3;
336
  }
337
  else {
@@ -347,12 +361,13 @@ class Feeds_controller_wdi {
347
  private function delete_all() {
348
  global $wpdb;
349
  $flag = FALSE;
350
- $feed_ids_col = $wpdb->get_col('SELECT id FROM ' . $wpdb->prefix . WDI_FEED_TABLE);
 
351
  foreach ( $feed_ids_col as $slider_id ) {
352
  if ( WDILibrary::get('check_' . $slider_id) != '' || WDILibrary::get('check_all_items') != '' ) {
353
  $flag = TRUE;
354
- $query = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . WDI_FEED_TABLE . ' WHERE id="%d"', $slider_id);
355
- $wpdb->query($query);
356
  }
357
  }
358
  if ( $flag ) {
@@ -371,7 +386,8 @@ class Feeds_controller_wdi {
371
  private function publish( $id ) {
372
  global $wpdb;
373
  $message = 20;
374
- $save = $wpdb->update($wpdb->prefix . WDI_FEED_TABLE, array( 'published' => 1 ), array( 'id' => $id ));
 
375
  if ( $save !== FALSE ) {
376
  $message = 9;
377
  }
@@ -386,15 +402,18 @@ class Feeds_controller_wdi {
386
  global $wpdb;
387
  $flag = FALSE;
388
  if ( WDILibrary::get('check_all_items') != '' ) {
389
- $wpdb->query('UPDATE ' . $wpdb->prefix . WDI_FEED_TABLE . ' SET published=1');
 
390
  $flag = TRUE;
391
  }
392
  else {
393
- $feed_ids_col = $wpdb->get_col('SELECT id FROM ' . $wpdb->prefix . WDI_FEED_TABLE);
 
394
  foreach ( $feed_ids_col as $slider_id ) {
395
  if ( WDILibrary::get('check_' . $slider_id) != '' ) {
396
  $flag = TRUE;
397
- $wpdb->update($wpdb->prefix . WDI_FEED_TABLE, array( 'published' => 1 ), array( 'id' => $slider_id ));
 
398
  }
399
  }
400
  }
@@ -414,7 +433,8 @@ class Feeds_controller_wdi {
414
  private function unpublish( $id ) {
415
  global $wpdb;
416
  $message = 20;
417
- $save = $wpdb->update($wpdb->prefix . WDI_FEED_TABLE, array( 'published' => 0 ), array( 'id' => $id ));
 
418
  if ( $save !== FALSE ) {
419
  $message = 11;
420
  }
@@ -429,15 +449,18 @@ class Feeds_controller_wdi {
429
  global $wpdb;
430
  $flag = FALSE;
431
  if ( WDILibrary::get('check_all_items') != '' ) {
432
- $wpdb->query('UPDATE ' . $wpdb->prefix . WDI_FEED_TABLE . ' SET published=0');
 
433
  $flag = TRUE;
434
  }
435
  else {
436
- $feed_ids_col = $wpdb->get_col('SELECT id FROM ' . $wpdb->prefix . WDI_FEED_TABLE);
 
437
  foreach ( $feed_ids_col as $slider_id ) {
438
  if ( WDILibrary::get('check_' . $slider_id) != '' ) {
439
  $flag = TRUE;
440
- $wpdb->update($wpdb->prefix . WDI_FEED_TABLE, array( 'published' => 0 ), array( 'id' => $slider_id ));
 
441
  }
442
  }
443
  }
@@ -526,7 +549,7 @@ class Feeds_controller_wdi {
526
  * @return string
527
  */
528
  private function sanitize_string( $value, $default ) {
529
- $sanitized_val = strip_tags(stripslashes(esc_html($value)));
530
  if ( $sanitized_val == '' ) {
531
  return $default;
532
  }
@@ -586,7 +609,7 @@ class Feeds_controller_wdi {
586
  $data[$index][$key] = sanitize_text_field($val);
587
  }
588
  }
589
- $json = json_encode($data);
590
  }
591
 
592
  return $json;
@@ -594,6 +617,6 @@ class Feeds_controller_wdi {
594
 
595
  private function message( $text, $type ) {
596
  require_once(WDI_DIR . '/framework/WDILibrary.php');
597
- echo WDILibrary::message($text, $type);
598
  }
599
- }
2
 
3
  class Feeds_controller_wdi {
4
  private $dataFormat;
5
+ private $allowed_message_html;
6
  public function __construct() {
7
+ // Format an array of allowed HTML tags and attributes.
8
+ $this->allowed_message_html = array(
9
+ 'div' => array(
10
+ 'class' => true,
11
+ 'style' => true
12
+ ),
13
+ 'p' => array(),
14
+ 'strong' => array()
15
+ );
16
  $this->setDataFormat();
17
  }
18
 
20
  $task = WDILibrary::get('task');
21
  $id = WDILibrary::get('current_id', 0);
22
  $message = WDILibrary::get('message');
23
+
24
  if ( !empty($message) ) {
25
  $message = explode(',', $message);
26
  foreach ( $message as $msg_id ) {
27
+ echo wp_kses(WDILibrary::message_id($msg_id), $this->allowed_message_html);
28
  }
29
  }
30
+ $get_method_tasks = array("add", "edit", "display");
 
 
 
 
31
  $get_task = "";
32
  if ( WDILibrary::get('task') != '' ) {
33
  $get_task = WDILibrary::get('task');
41
  else {
42
  $search_value = WDILibrary::get('search_value');
43
  if ( $search_value != '' ) {
 
44
  wp_redirect( add_query_arg( array(
45
  'page' => WDILibrary::get('page'),
46
  'task' => 'display',
47
  'search' => $search_value,
48
  ), admin_url('admin.php')) );
49
+ exit;
50
  }
51
  else {
52
  $this->display();
66
  $settings = $defaults;
67
  }
68
  global $wpdb;
69
+ $wpdb->insert($wpdb->prefix . WDI_FEED_TABLE, $settings, $this->dataFormat); //db call ok
70
 
71
  return $wpdb->insert_id;
72
  }
73
 
74
  private function setDataFormat() {
75
  $this->dataFormat = array(
76
+ '%s', // feed_name
77
+ '%s', // feed_thumb
78
+ '%s', // thumb_user
79
+ '%d', // published
80
+ '%d', // theme_id
81
+ '%s', // feed_users
82
+ '%s', // feed_display_view
83
+ '%s', // sort_images_by
84
+ '%s', // display_order
85
+ '%d', // follow_on_instagram_btn
86
+ '%d', // display_header
87
+ '%d', // number_of_photos
88
+ '%d', // load_more_number
89
+ '%d', // pagination_per_page_number
90
+ '%d', // pagination_preload_number
91
+ '%d', // image_browser_preload_number
92
+ '%d', // image_browser_load_number
93
+ '%d', // number_of_columns
94
+ '%d', // resort_after_load_more
95
+ '%d', // show_likes
96
+ '%d', // show_description
97
+ '%d', // show_comments
98
+ '%d', // show_usernames
99
+ '%d', // display_user_info
100
+ '%d', // display_user_post_follow_number
101
+ '%d', // show_full_description
102
+ '%d', // disable_mobile_layout
103
+ '%s', // feed_type
104
+ '%s', // feed_item_onclick
105
+ '%d', // popup_fullscreen = bool
106
+ '%d', // popup_width = number
107
+ '%d', // popup_height = number
108
+ '%s', // popup_type = string
109
+ '%d', // popup_autoplay = bool
110
+ '%d', // popup_interval = number
111
+ '%d', // popup_enable_filmstrip = bool
112
+ '%d', // popup_filmstrip_height = number
113
+ '%d', // autohide_lightbox_navigation = bool
114
+ '%d', // popup_enable_ctrl_btn = bool
115
+ '%d', // popup_enable_fullscreen = bool
116
+ '%d', // popup_enable_info = bool
117
+ '%d', // popup_info_always_show = bool
118
+ '%d', // popup_info_full_width = bool
119
+ '%d', // popup_enable_comment = bool
120
+ '%d', // popup_enable_fullsize_image = bool
121
+ '%d', // popup_enable_download = bool
122
+ '%d', // popup_enable_share_buttons = bool
123
+ '%d', // popup_enable_facebook = bool
124
+ '%d', // popup_enable_twitter = bool
125
+ '%d', // popup_enable_google = bool
126
+ '%d', // popup_enable_pinterest = bool
127
+ '%d', // popup_enable_tumblr = bool
128
+ '%d', // show_image_counts = bool
129
+ '%d', // enable_loop = bool
130
+ '%d', // popup_image_right_click = bool
131
+ '%s', // conditional_filters = string
132
+ '%s', // conditional_filter_type = string
133
+ '%d', // show_username_on_thumb
134
+ '%d', // conditional_filter_enable = 0
135
+ '%s', // liked_feed = string
136
+ '%d', // mobile_breakpoint = 640
137
+ '%s', // redirect_url
138
+ '%s', // feed_resolution
139
  );
140
  }
141
 
179
  global $wpdb;
180
  $action = WDILibrary::get('add_or_edit');
181
  if ( $action == '' ) {
182
+ $wpdb->insert($wpdb->prefix . WDI_FEED_TABLE, $settings, $this->dataFormat); //db call ok
183
  if ( $wpdb->insert_id == FALSE ) {
184
  $this->message(__('Cannot Write on database. Check database permissions.', 'wd-instagram-feed'), 'error');
185
  }
186
  }
187
  else {
188
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
189
+ $msg = $wpdb->update( $wpdb->prefix . WDI_FEED_TABLE, $settings, array( 'id' => $action ), $this->dataFormat, array( '%d' )); //db call ok
190
  if ( $msg == FALSE ) {
191
  $this->message(__("You have not made new changes", 'wd-instagram-feed'), 'notice');
192
  }
212
  $need_cache = 1;
213
  if ( $action == '' ) {
214
  $settings["feed_name"] = $model->get_unique_title($settings["feed_name"]);
215
+ $wpdb->insert( esc_sql($wpdb->prefix . WDI_FEED_TABLE), $settings, $this->dataFormat); //db call ok
216
  if ( $wpdb->insert_id == FALSE ) {
217
  $message_id = 24;
218
  }
219
  }
220
  else {
221
  $need_cache = $model->check_need_cache( $action, $settings );
222
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
223
+ $msg = $wpdb->update(esc_sql($wpdb->prefix . WDI_FEED_TABLE), $settings, array( 'id' => $action ), $this->dataFormat, array( '%d' )); //db call ok
224
  if ( $msg == FALSE ) {
225
  $message_id = 24;
226
  }
245
  'current_id' => $wdi_current_id,
246
  'message' => $message_id,
247
  ), admin_url('admin.php'));
248
+ echo wp_json_encode($redirect_url);
249
  die();
250
  }
251
 
256
  global $wpdb;
257
  $action = WDILibrary::get('add_or_edit');
258
  if ( $action == '' ) {
259
+ $wpdb->insert($wpdb->prefix . WDI_FEED_TABLE, $defaults, $this->dataFormat); //db call ok
260
  if ( $wpdb->insert_id == FALSE ) {
261
  $this->message(__("Cannot Write on database. Check database permissions.", 'wd-instagram-feed'), 'error');
262
  $this->display();
266
  }
267
  }
268
  else {
269
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
270
+ $msg = $wpdb->update($wpdb->prefix . WDI_FEED_TABLE, $defaults, array( 'id' => $action ), $this->dataFormat, array( '%d' )); //db call ok
271
  if ( $msg == FALSE ) {
272
  $this->message(__("You have not made new changes", 'wd-instagram-feed'), 'notice');
273
  $this->edit();
300
  global $wpdb;
301
  $message = 19;
302
  $flag = FALSE;
303
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
304
+ $feed_ids_col = $wpdb->get_col('SELECT id FROM ' . esc_sql($wpdb->prefix . WDI_FEED_TABLE) ); //db call ok
305
  foreach ( $feed_ids_col as $slider_id ) {
306
  if ( WDILibrary::get('check_' . $slider_id) != '' ) {
307
  if ( !$flag ) {
325
  global $wpdb;
326
  $model = new Feeds_model_wdi();
327
  if ( $feed_id ) {
328
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
329
+ $feed_row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . esc_sql($wpdb->prefix . WDI_FEED_TABLE) . ' WHERE id="%d"', $feed_id)); //db call ok
330
  }
331
  if ( $feed_row ) {
332
  $duplicate_values = WDILibrary::objectToArray($feed_row);
333
  unset($duplicate_values['id']);
334
+ $duplicate_values["feed_name"] = $model->get_unique_title($duplicate_values["feed_name"]);
335
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
336
+ $save = $wpdb->insert($wpdb->prefix . WDI_FEED_TABLE, $duplicate_values, $this->dataFormat); //db call ok
337
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
338
+ $new_slider_id = $wpdb->get_var( 'SELECT MAX(id) FROM ' . esc_sql($wpdb->prefix . WDI_FEED_TABLE) ); //db call ok
339
  }
340
 
341
  return $new_slider_id;
343
 
344
  private function delete( $id ) {
345
  global $wpdb;
346
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
347
+ $query = $wpdb->query( $wpdb->prepare('DELETE FROM ' . esc_sql($wpdb->prefix . WDI_FEED_TABLE) . ' WHERE id="%d"', $id) ); //db call ok
348
+ if ( $query ) {
349
  $message = 3;
350
  }
351
  else {
361
  private function delete_all() {
362
  global $wpdb;
363
  $flag = FALSE;
364
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
365
+ $feed_ids_col = $wpdb->get_col( 'SELECT id FROM ' . esc_sql($wpdb->prefix . WDI_FEED_TABLE) ); //db call ok
366
  foreach ( $feed_ids_col as $slider_id ) {
367
  if ( WDILibrary::get('check_' . $slider_id) != '' || WDILibrary::get('check_all_items') != '' ) {
368
  $flag = TRUE;
369
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
370
+ $wpdb->query( $wpdb->prepare('DELETE FROM ' . esc_sql($wpdb->prefix . WDI_FEED_TABLE) . ' WHERE id="%d"', $slider_id) ); //db call ok
371
  }
372
  }
373
  if ( $flag ) {
386
  private function publish( $id ) {
387
  global $wpdb;
388
  $message = 20;
389
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
390
+ $save = $wpdb->update($wpdb->prefix . WDI_FEED_TABLE, array( 'published' => 1 ), array( 'id' => $id )); //db call ok
391
  if ( $save !== FALSE ) {
392
  $message = 9;
393
  }
402
  global $wpdb;
403
  $flag = FALSE;
404
  if ( WDILibrary::get('check_all_items') != '' ) {
405
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
406
+ $wpdb->query( $wpdb->prepare('UPDATE ' . esc_sql($wpdb->prefix . WDI_FEED_TABLE) . ' SET published="%d', 1) ); //db call ok
407
  $flag = TRUE;
408
  }
409
  else {
410
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
411
+ $feed_ids_col = $wpdb->get_col('SELECT id FROM ' . esc_sql($wpdb->prefix . WDI_FEED_TABLE)); //db call ok
412
  foreach ( $feed_ids_col as $slider_id ) {
413
  if ( WDILibrary::get('check_' . $slider_id) != '' ) {
414
  $flag = TRUE;
415
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
416
+ $wpdb->update($wpdb->prefix . WDI_FEED_TABLE, array( 'published' => 1 ), array( 'id' => $slider_id )); //db call ok
417
  }
418
  }
419
  }
433
  private function unpublish( $id ) {
434
  global $wpdb;
435
  $message = 20;
436
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
437
+ $save = $wpdb->update($wpdb->prefix . WDI_FEED_TABLE, array( 'published' => 0 ), array( 'id' => $id )); //db call ok
438
  if ( $save !== FALSE ) {
439
  $message = 11;
440
  }
449
  global $wpdb;
450
  $flag = FALSE;
451
  if ( WDILibrary::get('check_all_items') != '' ) {
452
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
453
+ $wpdb->query('UPDATE ' . esc_sql($wpdb->prefix . WDI_FEED_TABLE) . ' SET published=0'); //db call ok
454
  $flag = TRUE;
455
  }
456
  else {
457
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
458
+ $feed_ids_col = $wpdb->get_col('SELECT id FROM ' . esc_sql($wpdb->prefix . WDI_FEED_TABLE) ); //db call ok
459
  foreach ( $feed_ids_col as $slider_id ) {
460
  if ( WDILibrary::get('check_' . $slider_id) != '' ) {
461
  $flag = TRUE;
462
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
463
+ $wpdb->update($wpdb->prefix . WDI_FEED_TABLE, array( 'published' => 0 ), array( 'id' => $slider_id )); //db call ok
464
  }
465
  }
466
  }
549
  * @return string
550
  */
551
  private function sanitize_string( $value, $default ) {
552
+ $sanitized_val = wp_strip_all_tags(stripslashes(esc_html($value)));
553
  if ( $sanitized_val == '' ) {
554
  return $default;
555
  }
609
  $data[$index][$key] = sanitize_text_field($val);
610
  }
611
  }
612
+ $json = wp_json_encode($data);
613
  }
614
 
615
  return $json;
617
 
618
  private function message( $text, $type ) {
619
  require_once(WDI_DIR . '/framework/WDILibrary.php');
620
+ echo wp_kses(WDILibrary::message($text, $type), $this->allowed_message_html);
621
  }
622
+ }
admin/controllers/settings.php CHANGED
@@ -3,10 +3,20 @@
3
  class Settings_controller_wdi {
4
 
5
  private $view;
 
6
 
7
  function __construct() {
8
  require_once(WDI_DIR . '/admin/views/settings.php');
9
  $this->view = new Settings_view_wdi();
 
 
 
 
 
 
 
 
 
10
  }
11
 
12
  public function execute() {
@@ -36,7 +46,7 @@ class Settings_controller_wdi {
36
 
37
  $message = WDILibrary::get('message', '');
38
  if ( !empty($message) ) {
39
- echo WDILibrary::message($message, 'error');
40
  }
41
  $args = array();
42
  $args['options'] = $options;
@@ -73,14 +83,16 @@ class Settings_controller_wdi {
73
  $reset_access_token = WDILibrary::get('wdi_reset_access_token_input', '');
74
  if ( !empty($reset_access_token) && $reset_access_token == '1' ) {
75
  global $wpdb;
76
- $wpdb->query('DELETE FROM ' . $wpdb->prefix . 'options WHERE option_name = "wdi_instagram_options"');
77
- $wpdb->query('DELETE FROM ' . $wpdb->prefix . 'options WHERE option_name = "wdi_first_user_username"');
 
 
78
  WDILibrary::redirect(add_query_arg(array( 'page' => 'wdi_settings' ), admin_url('admin.php')));
79
  }
80
  }
81
 
82
  private function basic_instagram_api_connect() {
83
- if ( !empty($_REQUEST['wdi_access_token']) && !empty($_REQUEST['user_id']) ) {
84
  $wdi_options = wdi_get_options();
85
  $time = time();
86
  /* @ToDo in the next version
@@ -131,7 +143,7 @@ class Settings_controller_wdi {
131
  function account_refresh() {
132
  $user_name = WDILibrary::get('user_name');
133
  $return_data = WDILibrary::refresh_instagram_account($user_name);
134
- echo json_encode($return_data);
135
  exit;
136
  }
137
  /**
@@ -145,7 +157,7 @@ class Settings_controller_wdi {
145
  if ( !empty($wdi_options['wdi_authenticated_users_list']) ) {
146
  $authenticated_users_list = json_decode($wdi_options['wdi_authenticated_users_list'], TRUE);
147
  unset($authenticated_users_list[$user_name]);
148
- $wdi_options['wdi_authenticated_users_list'] = json_encode($authenticated_users_list);
149
  $update = update_option(WDI_OPT, $wdi_options);
150
  $json = array(
151
  'message' => __('Failed.', 'wd-instagram-feed'),
@@ -157,7 +169,7 @@ class Settings_controller_wdi {
157
  'success' => TRUE,
158
  );
159
  }
160
- echo json_encode($json);
161
  exit;
162
  }
163
  }
3
  class Settings_controller_wdi {
4
 
5
  private $view;
6
+ private $allowed_message_html;
7
 
8
  function __construct() {
9
  require_once(WDI_DIR . '/admin/views/settings.php');
10
  $this->view = new Settings_view_wdi();
11
+ // Format an array of allowed HTML tags and attributes.
12
+ $this->allowed_message_html = array(
13
+ 'div' => array(
14
+ 'class' => true,
15
+ 'style' => true
16
+ ),
17
+ 'p' => array(),
18
+ 'strong' => array()
19
+ );
20
  }
21
 
22
  public function execute() {
46
 
47
  $message = WDILibrary::get('message', '');
48
  if ( !empty($message) ) {
49
+ echo wp_kses(WDILibrary::message($message, 'error'), $this->allowed_message_html);
50
  }
51
  $args = array();
52
  $args['options'] = $options;
83
  $reset_access_token = WDILibrary::get('wdi_reset_access_token_input', '');
84
  if ( !empty($reset_access_token) && $reset_access_token == '1' ) {
85
  global $wpdb;
86
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
87
+ $wpdb->query( esc_sql('DELETE FROM ' . $wpdb->prefix . 'options WHERE option_name = "wdi_instagram_options"') ); //db call ok
88
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
89
+ $wpdb->query( esc_sql('DELETE FROM ' . $wpdb->prefix . 'options WHERE option_name = "wdi_first_user_username"') ); //db call ok
90
  WDILibrary::redirect(add_query_arg(array( 'page' => 'wdi_settings' ), admin_url('admin.php')));
91
  }
92
  }
93
 
94
  private function basic_instagram_api_connect() {
95
+ if ( !empty($_REQUEST['wdi_nonce_token']) && wp_verify_nonce(sanitize_key($_REQUEST['wdi_nonce_token']), 'wdi_nonce_token') && !empty($_REQUEST['wdi_access_token']) && !empty($_REQUEST['user_id']) ) {
96
  $wdi_options = wdi_get_options();
97
  $time = time();
98
  /* @ToDo in the next version
143
  function account_refresh() {
144
  $user_name = WDILibrary::get('user_name');
145
  $return_data = WDILibrary::refresh_instagram_account($user_name);
146
+ echo wp_json_encode($return_data);
147
  exit;
148
  }
149
  /**
157
  if ( !empty($wdi_options['wdi_authenticated_users_list']) ) {
158
  $authenticated_users_list = json_decode($wdi_options['wdi_authenticated_users_list'], TRUE);
159
  unset($authenticated_users_list[$user_name]);
160
+ $wdi_options['wdi_authenticated_users_list'] = wp_json_encode($authenticated_users_list);
161
  $update = update_option(WDI_OPT, $wdi_options);
162
  $json = array(
163
  'message' => __('Failed.', 'wd-instagram-feed'),
169
  'success' => TRUE,
170
  );
171
  }
172
+ echo wp_json_encode($json);
173
  exit;
174
  }
175
  }
admin/controllers/themes.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class Themes_controller_wdi
5
+ */
6
+ class Themes_controller_wdi {
7
+ private $view;
8
+
9
+ public function __construct() {
10
+ require_once(WDI_DIR . "/admin/views/themes.php");
11
+ $this->view = new Themes_view_wdi();
12
+ }
13
+
14
+ public function execute() {
15
+ $this->view->display();
16
+ }
17
+ }
admin/controllers/uninstall.php CHANGED
@@ -46,9 +46,11 @@ class Uninstall_controller_wdi {
46
  // remove all tables.
47
  $tables = array( $wpdb->prefix . WDI_FEED_TABLE, $wpdb->prefix . WDI_THEME_TABLE );
48
  foreach ( $tables as $table ) {
49
- $checktable = $wpdb->query('SHOW TABLES LIKE "' . $table . '"');
 
50
  if ( $checktable > 0 ) {
51
- $wpdb->query('DROP TABLE ' . $table);
 
52
  }
53
  }
54
  $sample_post_id = get_option('wdi_sample_feed_post_id');
@@ -80,8 +82,6 @@ class Uninstall_controller_wdi {
80
  delete_option('widget_wdi_instagram_widget');
81
  delete_option('wdi_current_cache_time');
82
 
83
- $this->remove_theme_files();
84
-
85
  // remove all cache.
86
  require_once (WDI_DIR .'/framework/WDICache.php');
87
  $CacheClass = new WDICache();
@@ -94,12 +94,4 @@ class Uninstall_controller_wdi {
94
  $this->display();
95
  }
96
  }
97
-
98
- /**
99
- * Remove theme files.
100
- */
101
- private function remove_theme_files() {
102
- require_once WDI_DIR . '/admin/controllers/WDIControllerThemes_wdi.php';
103
- WDIControllerThemes_wdi::remove_all_themes_files();
104
- }
105
  }
46
  // remove all tables.
47
  $tables = array( $wpdb->prefix . WDI_FEED_TABLE, $wpdb->prefix . WDI_THEME_TABLE );
48
  foreach ( $tables as $table ) {
49
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
50
+ $checktable = $wpdb->query( $wpdb->prepare('SHOW TABLES LIKE "%s"', $table) ); //db call ok
51
  if ( $checktable > 0 ) {
52
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.DirectDatabaseQuery.NoCaching */
53
+ $wpdb->query( 'DROP TABLE IF EXISTS ' . esc_sql($table) ); //db call ok
54
  }
55
  }
56
  $sample_post_id = get_option('wdi_sample_feed_post_id');
82
  delete_option('widget_wdi_instagram_widget');
83
  delete_option('wdi_current_cache_time');
84
 
 
 
85
  // remove all cache.
86
  require_once (WDI_DIR .'/framework/WDICache.php');
87
  $CacheClass = new WDICache();
94
  $this->display();
95
  }
96
  }
 
 
 
 
 
 
 
 
97
  }
admin/models/WDIModelEditorShortcode.php CHANGED
@@ -7,13 +7,15 @@ class WDIModelEditorShortcode {
7
 
8
  public function get_row_data() {
9
  global $wpdb;
10
- $row = $wpdb->get_results("SELECT id, feed_name, feed_thumb FROM " . $wpdb->prefix . WDI_FEED_TABLE." WHERE published=1 ORDER BY `feed_name` ASC");
 
11
  return $row;
12
  }
13
 
14
  public function get_first_feed_id(){
15
  global $wpdb;
16
- $min_id = $wpdb->get_var('SELECT MIN(id) FROM ' . $wpdb->prefix . WDI_FEED_TABLE.' WHERE published=1');
 
17
  return $min_id;
18
  }
19
  }
7
 
8
  public function get_row_data() {
9
  global $wpdb;
10
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
11
+ $row = $wpdb->get_results( $wpdb->prepare("SELECT id, feed_name, feed_thumb FROM " . esc_sql($wpdb->prefix . WDI_FEED_TABLE) . " WHERE published = '%d' ORDER BY feed_name ASC", 1) ); //db call ok
12
  return $row;
13
  }
14
 
15
  public function get_first_feed_id(){
16
  global $wpdb;
17
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
18
+ $min_id = $wpdb->get_var( $wpdb->prepare("SELECT MIN(id) FROM " . esc_sql($wpdb->prefix . WDI_FEED_TABLE) ." WHERE published = '%d'", 1) ); //db call ok
19
  return $min_id;
20
  }
21
  }
admin/models/WDIModelThemes_wdi.php DELETED
@@ -1,585 +0,0 @@
1
- <?php
2
-
3
- class WDIModelThemes_wdi {
4
-
5
- private $page_number = null;
6
- private $search_text = "";
7
- public function __construct() {
8
- if ( WDILibrary::get('paged', 0, 'intval') != 0 ) {
9
- $this->page_number = WDILibrary::get('paged', 0, 'intval');
10
- } elseif ( WDILibrary::get('page_number', 0, 'intval') != 0 ) {
11
- $this->page_number = WDILibrary::get('page_number', 0, 'intval');
12
- }
13
- if ( WDILibrary::get('search_value') != '' ) {
14
- $this->search_text = WDILibrary::get('search_value');
15
- } elseif ( WDILibrary::get('search') != '' ) {
16
- $this->search_text = WDILibrary::get('search');
17
- }
18
- }
19
-
20
- public function get_rows_data() {
21
- global $wpdb;
22
- $where = ((!empty($this->search_text)) ? 'WHERE theme_name LIKE "%' . esc_html(stripslashes($this->search_text)) . '%"' : '');
23
- $asc_or_desc = WDILibrary::get('order') == 'asc' ? 'asc' : 'desc';
24
- $order_by_arr = array('id', 'theme_name', 'default_theme');
25
- $order_by = WDILibrary::get('order_by');
26
- $order_by = (in_array($order_by, $order_by_arr)) ? $order_by : 'id';
27
- $order_by = ' ORDER BY `' . $order_by . '` ' . $asc_or_desc;
28
- if (isset($this->page_number) && $this->page_number) {
29
- $limit = ((int) $this->page_number - 1) * 20;
30
- }
31
- else {
32
- $limit = 0;
33
- }
34
- $query_limit = " LIMIT " . $limit . ",20";
35
- $query = "SELECT * FROM " . $wpdb->prefix . WDI_THEME_TABLE .' '. $where . $order_by . $query_limit;
36
-
37
- $rows = $wpdb->get_results($query);
38
- return $rows;
39
- }
40
-
41
-
42
- public function page_nav() {
43
- global $wpdb;
44
- $where = ((isset($this->search_text) && !empty($this->search_text) && (esc_html(stripslashes($this->search_text)) != '')) ? 'WHERE theme_name LIKE "%' . esc_html(stripslashes($this->search_text)) . '%"' : '');
45
- $total = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . WDI_THEME_TABLE. ' ' . $where);
46
- $page_nav['total'] = $total;
47
- if (isset($this->page_number) && $this->page_number) {
48
- $limit = ((int) $this->page_number - 1) * 20;
49
- }
50
- else {
51
- $limit = 0;
52
- }
53
- $page_nav['limit'] = (int) ($limit / 20 + 1);
54
- return $page_nav;
55
- }
56
-
57
- public static function get_theme_defaults(){
58
- global $wdi_options;
59
- $settings = array(
60
- 'theme_name' => 'Instagram Design',
61
- 'default_theme'=> '0',
62
- 'feed_container_bg_color' => '#FFFFFF',
63
- 'feed_wrapper_width' => '100%',
64
- 'feed_container_width' => '100%',
65
- 'feed_wrapper_bg_color' => '#FFFFFF',
66
- 'active_filter_bg_color' => '#429fff',
67
- 'header_margin' => '0px',
68
- 'header_padding' => '5px',
69
- 'header_border_size' => '0px',
70
- 'header_border_color' => '#DDDDDD',
71
- 'header_position' => 'left',
72
- 'header_img_width' => '40',
73
- 'header_border_radius' => 0,
74
- 'header_text_padding' => '5px',
75
- 'header_text_color' => '#0f4973',
76
- 'header_font_weight' => '400',
77
- 'header_text_font_size' => '18px',
78
- 'header_text_font_style' => 'normal',
79
- 'follow_btn_border_radius'=>'3',
80
- 'follow_btn_padding'=>'25',
81
- 'follow_btn_margin'=>'10',
82
- 'follow_btn_bg_color'=>'#ffffff',
83
- 'follow_btn_border_color'=>'#0f4973',
84
- 'follow_btn_text_color'=>'#0f4973',
85
- 'follow_btn_font_size'=>'18',
86
- 'follow_btn_border_hover_color'=>'#0f4973',
87
- 'follow_btn_text_hover_color'=>'#0f4973',
88
- 'follow_btn_background_hover_color'=>'#ffffff',
89
-
90
- 'user_padding' => '5px',
91
- /////////////////////////disabled////////////////////////
92
- 'user_horizontal_margin' => '',//*
93
- 'user_border_size' => '0px',//*
94
- 'user_border_color' => '',//*
95
- 'user_img_width' => '40px',//enabled
96
- 'user_border_radius' => '0px',//enabled
97
- 'user_background_color' => '',//*
98
- 'users_border_size' => '0px',//*
99
- 'users_border_color' => '',//*
100
- 'users_background_color' => '',//*
101
- //////////////////////////////////////////////////////////
102
- //////////////////////lightbox////////////////////////////
103
- 'users_text_color' => '#0f4973',
104
- 'users_font_weight' => '400',
105
- 'users_text_font_size' => '18px',
106
- 'users_text_font_style' => 'normal',
107
- 'user_description_font_size' => '18px',
108
-
109
- 'lightbox_overlay_bg_color'=>'#25292c',
110
- 'lightbox_overlay_bg_transparent'=>'90',
111
- 'lightbox_bg_color'=>'#ffffff',
112
- 'lightbox_ctrl_btn_height'=>'20',
113
- 'lightbox_ctrl_btn_margin_top'=>'10',
114
- 'lightbox_ctrl_btn_margin_left'=>'7',
115
- 'lightbox_ctrl_btn_pos'=>'bottom',
116
- 'lightbox_ctrl_cont_bg_color'=>'#2a5b83',
117
- 'lightbox_ctrl_cont_border_radius'=>'4',
118
- 'lightbox_ctrl_cont_transparent'=>'80',
119
- 'lightbox_ctrl_btn_align'=>'center',
120
- 'lightbox_ctrl_btn_color'=>'#FFFFFF',
121
- 'lightbox_ctrl_btn_transparent'=>'100',
122
- 'lightbox_toggle_btn_height'=>'14',
123
- 'lightbox_toggle_btn_width'=>'100',
124
- 'lightbox_close_btn_border_radius'=>'16',
125
- 'lightbox_close_btn_border_width'=>'2',
126
- 'lightbox_close_btn_border_style'=>'none',
127
- 'lightbox_close_btn_border_color'=>'#FFFFFF',
128
- 'lightbox_close_btn_box_shadow'=>'none',
129
- 'lightbox_close_btn_bg_color'=>'#2a5b83',
130
- 'lightbox_close_btn_transparent'=>'100',
131
- 'lightbox_close_btn_width'=>'20',
132
- 'lightbox_close_btn_height'=>'20',
133
- 'lightbox_close_btn_top'=>'-10',
134
- 'lightbox_close_btn_right'=>'-10',
135
- 'lightbox_close_btn_size'=>'15',
136
- 'lightbox_close_btn_color'=>'#FFFFFF',
137
- 'lightbox_close_btn_full_color'=>'#000000',
138
- 'lightbox_close_btn_hover_color'=>'#000000',
139
- 'lightbox_comment_share_button_color'=>'#ffffff',
140
- 'lightbox_rl_btn_style'=>'tenweb-i-chevron',
141
- 'lightbox_rl_btn_bg_color'=>'#2a5b83',
142
- 'lightbox_rl_btn_transparent'=>'80',
143
- 'lightbox_rl_btn_box_shadow'=>'none',
144
- 'lightbox_rl_btn_height'=>'40',
145
- 'lightbox_rl_btn_width'=>'40',
146
- 'lightbox_rl_btn_size'=>'20',
147
- 'lightbox_close_rl_btn_hover_color'=>'#25292c',
148
- 'lightbox_rl_btn_color'=>'#FFFFFF',
149
- 'lightbox_rl_btn_border_radius'=>'20',
150
- 'lightbox_rl_btn_border_width'=>'0',
151
- 'lightbox_rl_btn_border_style'=>'none',
152
- 'lightbox_rl_btn_border_color'=>'#FFFFFF',
153
- 'lightbox_filmstrip_pos'=>'top',
154
- 'lightbox_filmstrip_thumb_margin'=>'0 1px',
155
- 'lightbox_filmstrip_thumb_border_width'=>'1',
156
- 'lightbox_filmstrip_thumb_border_style'=>'solid',
157
- 'lightbox_filmstrip_thumb_border_color'=>'#25292c',
158
- 'lightbox_filmstrip_thumb_border_radius'=>'0',
159
- 'lightbox_filmstrip_thumb_active_border_width'=>'0',
160
- 'lightbox_filmstrip_thumb_active_border_color'=>'#FFFFFF',
161
- 'lightbox_filmstrip_thumb_deactive_transparent'=>'70',
162
- 'lightbox_filmstrip_rl_btn_size'=>'20',
163
- 'lightbox_filmstrip_rl_btn_color'=>'#FFFFFF',
164
- 'lightbox_filmstrip_rl_bg_color'=>'#3B3B3B',
165
- 'lightbox_info_pos'=>'top',
166
- 'lightbox_info_align'=>'right',
167
- 'lightbox_info_bg_color'=>'#3b3b3b',
168
- 'lightbox_info_bg_transparent'=>'80',
169
- 'lightbox_info_border_width'=>'1',
170
- 'lightbox_info_border_style'=>'none',
171
- 'lightbox_info_border_color'=>'#3b3b3b',
172
- 'lightbox_info_border_radius'=>'5',
173
- 'lightbox_info_padding'=>'5px',
174
- 'lightbox_info_margin'=>'15px',
175
- 'lightbox_title_color'=>'#FFFFFF',
176
- 'lightbox_title_font_style'=>'segoe ui',
177
- 'lightbox_title_font_weight'=>'bold',
178
- 'lightbox_title_font_size'=>'13',
179
- 'lightbox_description_color'=>'#FFFFFF',
180
- 'lightbox_description_font_style'=>'segoe ui',
181
- 'lightbox_description_font_weight'=>'normal',
182
- 'lightbox_description_font_size'=>'14',
183
- 'lightbox_info_height'=>'30',
184
- 'lightbox_comment_width'=>'250',
185
- 'lightbox_comment_pos'=>'right',
186
- 'lightbox_comment_bg_color'=>'#ffffff',
187
- 'lightbox_comment_font_size'=>'12',
188
- 'lightbox_comment_font_color'=>'#000000',
189
- 'lightbox_comment_font_style'=>'segoe ui',
190
- 'lightbox_comment_author_font_size'=>'14',
191
- 'lightbox_comment_author_font_color'=>'#125688',
192
- 'lightbox_comment_author_font_color_hover'=>'#002160',
193
- 'lightbox_comment_date_font_size'=>'10',
194
- 'lightbox_comment_body_font_size'=>'12',
195
- 'lightbox_comment_input_border_width'=>'1',
196
- 'lightbox_comment_input_border_style'=>'none',
197
- 'lightbox_comment_input_border_color'=>'#666666',
198
- 'lightbox_comment_input_border_radius'=>'0',
199
- 'lightbox_comment_input_padding'=>'2px',
200
- 'lightbox_comment_input_bg_color'=>'#333333',
201
- 'lightbox_comment_button_bg_color'=>'#616161',
202
- 'lightbox_comment_button_padding'=>'3px 10px',
203
- 'lightbox_comment_button_border_width'=>'1',
204
- 'lightbox_comment_button_border_style'=>'none',
205
- 'lightbox_comment_button_border_color'=>'#666666',
206
- 'lightbox_comment_button_border_radius'=>'3',
207
- 'lightbox_comment_separator_width'=>'1',
208
- 'lightbox_comment_separator_style'=>'solid',
209
- 'lightbox_comment_separator_color'=>'#125688',
210
- 'lightbox_comment_load_more_color' =>"#125688",
211
- 'lightbox_comment_load_more_color_hover' =>"#000000",
212
- //////////////////////////////////////////////////////////
213
- 'th_photo_wrap_padding' => '10px',
214
- 'th_photo_wrap_border_size' => '10px',
215
- 'th_photo_wrap_border_color' => '#ffffff',
216
- 'th_photo_img_border_radius' => '0px',
217
- 'th_photo_wrap_bg_color' => '#FFFFFF',
218
- 'th_photo_meta_bg_color' => '#FFFFFF',
219
- 'th_photo_meta_one_line' => '1',
220
- 'th_like_text_color' => '#8a8d8e',
221
- 'th_comment_text_color' => '#8a8d8e',
222
- 'th_photo_caption_font_size' => '14px',
223
- 'th_photo_caption_color' => '#125688',
224
- 'th_feed_item_margin' => '0',
225
- 'th_photo_caption_hover_color' =>'#8e8e8e',
226
- 'th_like_comm_font_size' => '13px',
227
- 'th_overlay_hover_color'=>'#125688',
228
- 'th_overlay_hover_transparent'=>'50',
229
- 'th_overlay_hover_icon_color'=>'#FFFFFF',
230
- 'th_overlay_hover_icon_font_size'=>'25px',
231
- 'th_photo_img_hover_effect' => 'none',
232
- //////////////////////////////////////////////////////////
233
- 'mas_photo_wrap_padding' => '10px',
234
- 'mas_photo_wrap_border_size' => '0px',
235
- 'mas_photo_wrap_border_color' => 'gray',
236
- 'mas_photo_img_border_radius' => '0px',
237
- 'mas_photo_wrap_bg_color' => '#FFFFFF',
238
- 'mas_photo_meta_bg_color' => '#FFFFFF',
239
- 'mas_photo_meta_one_line' => '1',
240
- 'mas_like_text_color' => '#8a8d8e',
241
- 'mas_comment_text_color' => '#8a8d8e',
242
- 'mas_photo_caption_font_size' => '14px',
243
- 'mas_photo_caption_color' => '#125688',
244
- 'mas_feed_item_margin' => '0',
245
- 'mas_photo_caption_hover_color' =>'#8e8e8e',
246
- 'mas_like_comm_font_size' => '13px',
247
- 'mas_overlay_hover_color'=>'#125688',
248
- 'mas_overlay_hover_transparent'=>'50',
249
- 'mas_overlay_hover_icon_color'=>'#FFFFFF',
250
- 'mas_overlay_hover_icon_font_size'=>'25px',
251
- 'mas_photo_img_hover_effect'=>'none',
252
-
253
- 'blog_style_photo_wrap_padding' => '10px',
254
- 'blog_style_photo_wrap_border_size' => '0px',
255
- 'blog_style_photo_wrap_border_color' => 'gray',
256
- 'blog_style_photo_img_border_radius' => '0px',
257
- 'blog_style_photo_wrap_bg_color' => '#FFFFFF',
258
- 'blog_style_photo_meta_bg_color' => '#FFFFFF',
259
- 'blog_style_photo_meta_one_line' => '1',
260
- 'blog_style_like_text_color' => '#8a8d8e',
261
- 'blog_style_comment_text_color' => '#8a8d8e',
262
- 'blog_style_photo_caption_font_size' => '16px',
263
- 'blog_style_photo_caption_color' => '#125688',
264
- 'blog_style_feed_item_margin' => '0',
265
- 'blog_style_photo_caption_hover_color' =>'#8e8e8e',
266
- 'blog_style_like_comm_font_size' => '20px',
267
-
268
- 'image_browser_photo_wrap_padding' => '10px',
269
- 'image_browser_photo_wrap_border_size' => '0px',
270
- 'image_browser_photo_wrap_border_color' => 'gray',
271
- 'image_browser_photo_img_border_radius' => '0px',
272
- 'image_browser_photo_wrap_bg_color' => '#FFFFFF',
273
- 'image_browser_photo_meta_bg_color' => '#FFFFFF',
274
- 'image_browser_photo_meta_one_line' => '1',
275
- 'image_browser_like_text_color' => '#8a8d8e',
276
- 'image_browser_comment_text_color' => '#8a8d8e',
277
- 'image_browser_photo_caption_font_size' => '16px',
278
- 'image_browser_photo_caption_color' => '#125688',
279
- 'image_browser_feed_item_margin' => '0',
280
- 'image_browser_photo_caption_hover_color' =>'#8e8e8e',
281
- 'image_browser_like_comm_font_size' => '20px',
282
-
283
- 'load_more_position' => 'center',
284
- 'load_more_padding' => '4px',
285
- 'load_more_bg_color' => '#ffffff',
286
- 'load_more_border_radius' => '500px',
287
- 'load_more_height' => '90px',
288
- 'load_more_width' => '90px',
289
- 'load_more_border_size' => '1px',
290
- 'load_more_border_color' => '#0f4973',
291
- 'load_more_text_color' => '#1e73be',
292
- /*load more icon*/
293
- 'load_more_text_font_size' => '14px',
294
- 'load_more_wrap_hover_color' => 'transparent',
295
- 'pagination_ctrl_color' => '#0f4973',
296
- 'pagination_size' => '18px',
297
- 'pagination_ctrl_margin' => '15px',
298
- 'pagination_ctrl_hover_color' => '#25292c',
299
- 'pagination_position' => 'center',
300
- 'pagination_position_vert' => 'top',
301
-
302
- /* since v1.0.6*/
303
- /* keep order */
304
- 'th_thumb_user_bg_color'=>'#429FFF',
305
- 'th_thumb_user_color'=>'#FFFFFF',
306
- 'mas_thumb_user_bg_color'=>'#429FFF',
307
- 'mas_thumb_user_color'=>'#FFFFFF',
308
- );
309
- return $settings;
310
- }
311
-
312
- public function get_sanitize_types(){
313
- $sanitize_types = array(
314
- 'theme_name' => 'string',
315
- 'default_theme'=> 'number',
316
- 'feed_container_bg_color' => 'color',//*
317
- 'feed_wrapper_width' => 'length',//
318
- 'feed_container_width' => 'length',
319
- 'feed_wrapper_bg_color' => 'color',//*
320
- 'active_filter_bg_color' => 'color',
321
- 'header_margin' => 'length_multi',//*
322
- 'header_padding' => 'length_multi',//*
323
- 'header_border_size' => 'length',//*
324
- 'header_border_color' => 'color',//*
325
- 'header_position' => 'position',//*
326
- 'header_img_width' => 'number',//*
327
- 'header_border_radius' => 'number',////////////////////////////*
328
- 'header_text_padding' => 'length',//*
329
- 'header_text_color' => 'color',//*
330
- 'header_font_weight' => 'number',//*
331
- 'header_text_font_size' => 'length',///////////*
332
- 'header_text_font_style' => 'string',///////////////////
333
- 'follow_btn_border_radius'=>'number',
334
- 'follow_btn_padding'=>'number',
335
- 'follow_btn_margin'=>'number',
336
- 'follow_btn_bg_color'=>'color',
337
- 'follow_btn_border_color'=>'color',
338
- 'follow_btn_text_color'=>'color',
339
- 'follow_btn_font_size'=>'number',
340
- 'follow_btn_border_hover_color'=>'color',
341
- 'follow_btn_text_hover_color'=>'color',
342
- 'follow_btn_background_hover_color'=>'color',
343
-
344
- 'user_padding' => 'length_multi',//*
345
- 'user_horizontal_margin' => 'length',//*
346
- 'user_border_size' => 'length',//*
347
- 'user_border_color' => 'color',//*
348
- 'user_img_width' => 'number',
349
- 'user_border_radius' => 'number',
350
- 'user_background_color' => 'color',//*
351
- 'users_border_size' => 'length',//*
352
- 'users_border_color' => 'color',//*
353
- 'users_background_color' => 'color',//*
354
-
355
- /////////////////////////LightBox////////////////////////
356
- 'users_text_color' => 'color',
357
- 'users_font_weight' => 'number',
358
- 'users_text_font_size' => 'length',
359
- 'users_text_font_style' => 'string',
360
- 'user_description_font_size' => 'length',
361
- 'lightbox_overlay_bg_color'=>'color',
362
- 'lightbox_overlay_bg_transparent'=>'number_max_100',
363
- 'lightbox_bg_color'=>'color',
364
- 'lightbox_ctrl_btn_height'=>'number',
365
- 'lightbox_ctrl_btn_margin_top'=>'number',
366
- 'lightbox_ctrl_btn_margin_left'=>'number',
367
- 'lightbox_ctrl_btn_pos'=>'string',
368
- 'lightbox_ctrl_cont_bg_color'=>'color',
369
- 'lightbox_ctrl_cont_border_radius'=>'number',
370
- 'lightbox_ctrl_cont_transparent'=>'number_max_100',
371
- 'lightbox_ctrl_btn_align'=>'position',
372
- 'lightbox_ctrl_btn_color'=>'color',
373
- 'lightbox_ctrl_btn_transparent'=>'number_max_100',
374
- 'lightbox_toggle_btn_height'=>'number',
375
- 'lightbox_toggle_btn_width'=>'number',
376
- 'lightbox_close_btn_border_radius'=>'number',
377
- 'lightbox_close_btn_border_width'=>'number',
378
- 'lightbox_close_btn_border_style'=>'string',
379
- 'lightbox_close_btn_border_color'=>'color',
380
- 'lightbox_close_btn_box_shadow'=>'css_box_shadow',
381
- 'lightbox_close_btn_bg_color'=>'color',
382
- 'lightbox_close_btn_transparent'=>'number_max_100',
383
- 'lightbox_close_btn_width'=>'number',
384
- 'lightbox_close_btn_height'=>'number',
385
- 'lightbox_close_btn_top'=>'number_neg',
386
- 'lightbox_close_btn_right'=>'number_neg',
387
- 'lightbox_close_btn_size'=>'number',
388
- 'lightbox_close_btn_color'=>'color',
389
- 'lightbox_close_btn_full_color'=>'color',
390
- 'lightbox_close_btn_hover_color'=>'color',
391
- 'lightbox_comment_share_button_color'=>'color',
392
- 'lightbox_rl_btn_style'=>'string',
393
- 'lightbox_rl_btn_bg_color'=>'color',
394
- 'lightbox_rl_btn_transparent'=>'number_max_100',
395
- 'lightbox_rl_btn_box_shadow'=>'css_box_shadow',
396
- 'lightbox_rl_btn_height'=>'number',
397
- 'lightbox_rl_btn_width'=>'number',
398
- 'lightbox_rl_btn_size'=>'number',
399
- 'lightbox_close_rl_btn_hover_color'=>'color',
400
- 'lightbox_rl_btn_color'=>'color',
401
- 'lightbox_rl_btn_border_radius'=>'number',
402
- 'lightbox_rl_btn_border_width'=>'number',
403
- 'lightbox_rl_btn_border_style'=>'string',
404
- 'lightbox_rl_btn_border_color'=>'color',
405
- 'lightbox_filmstrip_pos'=>'position',
406
- 'lightbox_filmstrip_thumb_margin'=>'length_multi',
407
- 'lightbox_filmstrip_thumb_border_width'=>'number',
408
- 'lightbox_filmstrip_thumb_border_style'=>'string',
409
- 'lightbox_filmstrip_thumb_border_color'=>'color',
410
- 'lightbox_filmstrip_thumb_border_radius'=>'number',
411
- 'lightbox_filmstrip_thumb_active_border_width'=>'number',
412
- 'lightbox_filmstrip_thumb_active_border_color'=>'color',
413
- 'lightbox_filmstrip_thumb_deactive_transparent'=>'number_max_100',
414
- 'lightbox_filmstrip_rl_btn_size'=>'number',
415
- 'lightbox_filmstrip_rl_btn_color'=>'color',
416
- 'lightbox_filmstrip_rl_bg_color'=>'color',
417
- 'lightbox_info_pos'=>'position',
418
- 'lightbox_info_align'=>'string',
419
- 'lightbox_info_bg_color'=>'color',
420
- 'lightbox_info_bg_transparent'=>'number_max_100',
421
- 'lightbox_info_border_width'=>'number',
422
- 'lightbox_info_border_style'=>'string',
423
- 'lightbox_info_border_color'=>'color',
424
- 'lightbox_info_border_radius'=>'number',
425
- 'lightbox_info_padding'=>'length_multi',
426
- 'lightbox_info_margin'=>'length_multi',
427
- 'lightbox_title_color'=>'color',
428
- 'lightbox_title_font_style'=>'string',
429
- 'lightbox_title_font_weight'=>'string',
430
- 'lightbox_title_font_size'=>'number',
431
- 'lightbox_description_color'=>'color',
432
- 'lightbox_description_font_style'=>'string',
433
- 'lightbox_description_font_weight'=>'string',
434
- 'lightbox_description_font_size'=>'number',
435
- 'lightbox_info_height'=>'number_max_100',
436
- 'lightbox_comment_width'=>'number',
437
- 'lightbox_comment_pos'=>'string',
438
- 'lightbox_comment_bg_color'=>'color',
439
- 'lightbox_comment_font_size'=>'number',
440
- 'lightbox_comment_font_color'=>'color',
441
- 'lightbox_comment_font_style'=>'string',
442
- 'lightbox_comment_author_font_size'=>'number',
443
- 'lightbox_comment_author_font_color'=>'color',
444
- 'lightbox_comment_author_font_color_hover'=>'color',
445
- 'lightbox_comment_date_font_size'=>'number',
446
- 'lightbox_comment_body_font_size'=>'number',
447
- 'lightbox_comment_input_border_width'=>'number',
448
- 'lightbox_comment_input_border_style'=>'string',
449
- 'lightbox_comment_input_border_color'=>'color',
450
- 'lightbox_comment_input_border_radius'=>'number',
451
- 'lightbox_comment_input_padding'=>'length_multi',
452
- 'lightbox_comment_input_bg_color'=>'color',
453
- 'lightbox_comment_button_bg_color'=>'color',
454
- 'lightbox_comment_button_padding'=>'length_multi',
455
- 'lightbox_comment_button_border_width'=>'number',
456
- 'lightbox_comment_button_border_style'=>'string',
457
- 'lightbox_comment_button_border_color'=>'color',
458
- 'lightbox_comment_button_border_radius'=>'number',
459
- 'lightbox_comment_separator_width'=>'number',
460
- 'lightbox_comment_separator_style'=>'string',
461
- 'lightbox_comment_separator_color'=>'color',
462
- 'lightbox_comment_load_more_color' =>'color',
463
- 'lightbox_comment_load_more_color_hover' =>'color',
464
- /////////////////////////////////////////////////////////
465
- 'th_photo_wrap_padding' => 'length',
466
- 'th_photo_wrap_border_size' => 'length',
467
- 'th_photo_wrap_border_color' => 'color',
468
- 'th_photo_img_border_radius' => 'length',
469
- 'th_photo_wrap_bg_color' => 'color',
470
- 'th_photo_meta_bg_color' => 'color',
471
- 'th_photo_meta_one_line' => 'bool',
472
- 'th_like_text_color' => 'color',
473
- 'th_comment_text_color' => 'color',
474
- 'th_photo_caption_font_size' => 'length',
475
- 'th_photo_caption_color' => 'color',
476
- 'th_feed_item_margin' => 'length',
477
- 'th_photo_caption_hover_color' =>'color',
478
- 'th_like_comm_font_size' => 'length',
479
- 'th_overlay_hover_color'=>'color',
480
- 'th_overlay_hover_transparent'=>'number',
481
- 'th_overlay_hover_icon_color'=>'color',
482
- 'th_overlay_hover_icon_font_size'=>'length',
483
- 'th_thumb_user_bg_color'=>'color',
484
- 'th_thumb_user_color'=>'color',
485
- 'th_photo_img_hover_effect' =>'string',
486
-
487
- /////////////////////////////////////////////////////////
488
- 'mas_photo_wrap_padding' => 'length',
489
- 'mas_photo_wrap_border_size' => 'length',
490
- 'mas_photo_wrap_border_color' => 'color',
491
- 'mas_photo_img_border_radius' => 'length',
492
- 'mas_photo_wrap_bg_color' => 'color',
493
- 'mas_photo_meta_bg_color' => 'color',
494
- 'mas_photo_meta_one_line' => 'bool',
495
- 'mas_like_text_color' => 'color',
496
- 'mas_comment_text_color' => 'color',
497
- 'mas_photo_caption_font_size' => 'length',
498
- 'mas_photo_caption_color' => 'color',
499
- 'mas_feed_item_margin' => 'length',
500
- 'mas_photo_caption_hover_color' =>'color',
501
- 'mas_like_comm_font_size' => 'length',
502
- 'mas_overlay_hover_color'=>'color',
503
- 'mas_overlay_hover_transparent'=>'number',
504
- 'mas_overlay_hover_icon_color'=>'color',
505
- 'mas_overlay_hover_icon_font_size'=>'length',
506
- 'mas_thumb_user_bg_color'=>'color',
507
- 'mas_thumb_user_color'=>'color',
508
- 'mas_photo_img_hover_effect' => 'string',
509
-
510
- /////////////////////////////////////////////////
511
- 'blog_style_photo_wrap_padding' => 'length',
512
- 'blog_style_photo_wrap_border_size' => 'length',
513
- 'blog_style_photo_wrap_border_color' => 'color',
514
- 'blog_style_photo_img_border_radius' => 'length',
515
- 'blog_style_photo_wrap_bg_color' => 'color',
516
- 'blog_style_photo_meta_bg_color' => 'color',
517
- 'blog_style_photo_meta_one_line' => 'bool',
518
- 'blog_style_like_text_color' => 'color',
519
- 'blog_style_comment_text_color' => 'color',
520
- 'blog_style_photo_caption_font_size' => 'length',
521
- 'blog_style_photo_caption_color' => 'color',
522
- 'blog_style_feed_item_margin' => 'length',
523
- 'blog_style_photo_caption_hover_color' =>'color',
524
- 'blog_style_like_comm_font_size' => 'length',
525
-
526
- /////////////////////////////////////////////////
527
- 'image_browser_photo_wrap_padding' => 'length',
528
- 'image_browser_photo_wrap_border_size' => 'length',
529
- 'image_browser_photo_wrap_border_color' => 'color',
530
- 'image_browser_photo_img_border_radius' => 'length',
531
- 'image_browser_photo_wrap_bg_color' => 'color',
532
- 'image_browser_photo_meta_bg_color' => 'color',
533
- 'image_browser_photo_meta_one_line' => 'bool',
534
- 'image_browser_like_text_color' => 'color',
535
- 'image_browser_comment_text_color' => 'color',
536
- 'image_browser_photo_caption_font_size' => 'length',
537
- 'image_browser_photo_caption_color' => 'color',
538
- 'image_browser_feed_item_margin' => 'length',
539
- 'image_browser_photo_caption_hover_color' =>'color',
540
- 'image_browser_like_comm_font_size' => 'length',
541
-
542
- //////////////////////////////////////////
543
- 'load_more_position' => 'position',//*
544
- 'load_more_padding' => 'length',//*
545
- 'load_more_bg_color' => 'color',//*
546
- 'load_more_border_radius' => 'length',//*
547
- 'load_more_height' => 'length',//*
548
- 'load_more_width' => 'length',//*
549
- 'load_more_border_size' => 'length',//*
550
- 'load_more_border_color' => 'color',//*
551
- 'load_more_text_color' => 'color',//*
552
- /*load more icon*/
553
- 'load_more_text_font_size' => 'length',//*
554
- 'load_more_wrap_hover_color' => 'color',//*
555
- 'pagination_ctrl_color' => 'color',
556
- 'pagination_size' => 'length',
557
- 'pagination_ctrl_margin' => 'length_multi',
558
- 'pagination_ctrl_hover_color' => 'color',
559
- 'pagination_position' => 'position',
560
- 'pagination_position_vert'=>'position'
561
- );
562
- return $sanitize_types;
563
- }
564
-
565
- public static function get_theme_row($current_id){
566
- global $wpdb;
567
- $theme_row = $wpdb->get_row($wpdb->prepare("SELECT * FROM ". $wpdb->prefix.WDI_THEME_TABLE. " WHERE id ='%d' ",$current_id));
568
- return $theme_row;
569
- }
570
- public static function get_themes(){
571
- global $wpdb;
572
- $themes = WDILibrary::objectToArray($wpdb->get_results("SELECT `id`, `theme_name` FROM " . $wpdb->prefix.WDI_THEME_TABLE));
573
- foreach ($themes as $theme) {
574
- $output[$theme['id']] = $theme['theme_name'];
575
- }
576
- return $output;
577
- }
578
- public function check_default($current_id){
579
- global $wpdb;
580
- $query = $wpdb->prepare("SELECT `default_theme`FROM " . $wpdb->prefix.WDI_THEME_TABLE . " WHERE id='%d'",$current_id);
581
- $row = WDILibrary::objectToArray($wpdb->get_row($query));
582
- return ($row['default_theme']);
583
- }
584
- }
585
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/models/WDIModelWidget.php CHANGED
@@ -7,8 +7,8 @@ class WDIModelWidget {
7
 
8
  public function get_feeds() {
9
  global $wpdb;
10
- $query = "SELECT id,feed_name,feed_type FROM " . $wpdb->prefix . WDI_FEED_TABLE." WHERE published=1";
11
- $rows = $wpdb->get_results($query);
12
  return $rows;
13
  }
14
  }
7
 
8
  public function get_feeds() {
9
  global $wpdb;
10
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
11
+ $rows = $wpdb->get_results( $wpdb->prepare("SELECT id, feed_name, feed_type FROM " . esc_sql($wpdb->prefix . WDI_FEED_TABLE) . " WHERE published='%d'", 1) ); //db call ok
12
  return $rows;
13
  }
14
  }
admin/models/feeds.php CHANGED
@@ -21,56 +21,63 @@ class Feeds_model_wdi {
21
 
22
  public function get_slides_row_data($slider_id) {
23
  global $wpdb;
24
- $row = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . WDI_FEED_TABLE. " WHERE slider_id='%d' ORDER BY `order` ASC", $slider_id));
25
- if ( $row ) {
26
- // $row->image_url = $row->image_url ? $row->image_url : WD_S_URL . '/images/no-image.png';
27
- // $row->thumb_url = $row->thumb_url ? $row->thumb_url : WD_S_URL . '/images/no-image.png';
28
- }
29
  return $row;
30
  }
31
 
32
  public function get_rows_data() {
33
  global $wpdb;
34
-
35
- $where = ((!empty($this->search_text)) ? 'WHERE feed_name LIKE "%' . esc_html(stripslashes($this->search_text)) . '%"' : '');
 
 
 
 
 
 
36
  $asc_or_desc = WDILibrary::get('order') == 'asc' ? 'asc' : 'desc';
37
-
38
  $order_by_arr = array('id', 'feed_name', 'published');
39
  $order_by = WDILibrary::get('order_by');
40
  $order_by = (in_array($order_by, $order_by_arr)) ? $order_by : 'id';
41
- $order_by = ' ORDER BY `' . $order_by . '` ' . $asc_or_desc;
42
  if (isset($this->page_number) && $this->page_number) {
43
  $limit = ((int) $this->page_number - 1) * 20;
44
  }
45
- else {
46
- $limit = 0;
47
- }
 
48
 
49
- $query_limit = " LIMIT " . $limit . ",20";
50
- $query = "SELECT * FROM " . $wpdb->prefix . WDI_FEED_TABLE .' '. $where . $order_by.$query_limit;
51
- $rows = $wpdb->get_results($query);
52
  return $rows;
53
  }
54
 
55
  public function page_nav() {
56
  global $wpdb;
57
- $where = ((isset($this->search_text) && !empty($this->search_text) && (esc_html(stripslashes($this->search_text)) != '')) ? 'WHERE feed_name LIKE "%' . esc_html(stripslashes($this->search_text)) . '%"' : '');
58
- $total = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . WDI_FEED_TABLE. ' ' . $where);
 
 
 
 
 
 
 
 
59
  $page_nav['total'] = $total;
 
60
  if (isset($this->page_number) && $this->page_number) {
61
  $limit = ((int) $this->page_number - 1) * 20;
62
  }
63
- else {
64
- $limit = 0;
65
- }
66
  $page_nav['limit'] = (int) ($limit / 20 + 1);
67
  return $page_nav;
68
  }
69
 
70
  public static function wdi_get_feed_defaults() {
71
  global $wpdb;
72
- $query = $wpdb->prepare("SELECT id FROM " . $wpdb->prefix . WDI_THEME_TABLE . " WHERE default_theme='%d'", 1);
73
- $default_theme = WDILibrary::objectToArray($wpdb->get_results($query));
 
74
  $settings = array(
75
  'thumb_user' => '',
76
  'feed_name' => '',
@@ -159,7 +166,7 @@ class Feeds_model_wdi {
159
  'feed_name' => 'string',
160
  'feed_thumb'=> 'url',
161
  'published' => 'bool',
162
- 'theme_id'=> 'number'/*$options['wdi_default_theme']*/,
163
  'feed_users'=> 'json',
164
  'feed_display_view' =>'string',
165
  'sort_images_by' => 'string',
@@ -185,7 +192,6 @@ class Feeds_model_wdi {
185
  'disable_mobile_layout'=>'bool',
186
  'feed_type' => 'string',
187
  'feed_item_onclick' => 'string',
188
-
189
  //lightbox defaults
190
  'popup_fullscreen'=>'bool',
191
  'popup_width'=>'number',
@@ -213,11 +219,9 @@ class Feeds_model_wdi {
213
  'show_image_counts'=>'bool',
214
  'enable_loop'=>'bool',
215
  'popup_image_right_click'=>'bool',
216
-
217
  'conditional_filters' => 'json',
218
  'conditional_filter_enable'=>'number',
219
  'conditional_filter_type' => 'string',
220
-
221
  'liked_feed' => 'string',
222
  'mobile_breakpoint' => 'number',
223
  'redirect_url' => 'string',
@@ -229,19 +233,22 @@ class Feeds_model_wdi {
229
 
230
  public function get_feed_row($current_id){
231
  global $wpdb;
232
- $feed_row = $wpdb->get_row($wpdb->prepare("SELECT * FROM ". $wpdb->prefix.WDI_FEED_TABLE. " WHERE id ='%d' ", $current_id));
 
233
  return $feed_row;
234
  }
235
 
236
  public function get_unique_title($feed_name){
237
  global $wpdb;
238
- $check_feed_title = $wpdb->get_var($wpdb->prepare("SELECT id FROM ". $wpdb->prefix.WDI_FEED_TABLE. " WHERE feed_name='%s' ", $feed_name));
 
239
  if($check_feed_title){
240
  $num = 1;
241
  do {
242
  $alt_name = $feed_name . "-$num";
243
  $num++;
244
- $slug_check = $wpdb->get_var($wpdb->prepare("SELECT id FROM ". $wpdb->prefix.WDI_FEED_TABLE. " WHERE feed_name='%s' ", $alt_name));
 
245
  }
246
  while ( $slug_check );
247
  $feed_name = $alt_name;
@@ -281,6 +288,7 @@ class Feeds_model_wdi {
281
  );
282
  // Create new post by wdi_preview preview type.
283
  if ( wp_insert_post($post_params) ) {
 
284
  flush_rewrite_rules();
285
 
286
  return get_the_guid($wpdb->insert_id);
@@ -305,7 +313,8 @@ class Feeds_model_wdi {
305
  $conditional_filters = $data['conditional_filters'];
306
  $conditional_filter_type = $data['conditional_filter_type'];
307
  $top_recent = $data['hashtag_top_recent'];
308
- $count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(id) FROM ". $wpdb->prefix.WDI_FEED_TABLE. " WHERE id ='%d' AND feed_users='%s' AND conditional_filters='%s' AND conditional_filter_type='%s' AND hashtag_top_recent='%s'", $feed_id, $users, $conditional_filters, $conditional_filter_type, $top_recent));
 
309
  if ( $count == 0 ) {
310
  return 1;
311
  } else {
21
 
22
  public function get_slides_row_data($slider_id) {
23
  global $wpdb;
24
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
25
+ $row = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . esc_sql($wpdb->prefix . WDI_FEED_TABLE) . " WHERE slider_id='%d' ORDER BY `order` ASC", $slider_id)); //db call ok
 
 
 
26
  return $row;
27
  }
28
 
29
  public function get_rows_data() {
30
  global $wpdb;
31
+ $prepare_args = array();
32
+ $where = '1=%d';
33
+ $prepare_args[] = 1;
34
+ if ( isset($this->search_text) && !empty($this->search_text) && (esc_html(stripslashes($this->search_text)) != '') ) {
35
+ $where .= ' AND feed_name LIKE "%%%s%%" ';
36
+ $prepare_args[] = esc_html(stripslashes($this->search_text));
37
+ }
38
+ // The "WDILibrary::get()" method by default sanitize according to "sanitize_text_field"․ It is described in the "$callback" parameter․
39
  $asc_or_desc = WDILibrary::get('order') == 'asc' ? 'asc' : 'desc';
 
40
  $order_by_arr = array('id', 'feed_name', 'published');
41
  $order_by = WDILibrary::get('order_by');
42
  $order_by = (in_array($order_by, $order_by_arr)) ? $order_by : 'id';
43
+ $limit = 0;
44
  if (isset($this->page_number) && $this->page_number) {
45
  $limit = ((int) $this->page_number - 1) * 20;
46
  }
47
+ $order_by_limit = sprintf(' ORDER BY %s %s LIMIT %d, 20', $order_by, $asc_or_desc, $limit);
48
+ // $wpdb->prepare() not needed (will throw a notice) as there are no parameters (all parts are already sanitised or cast to known-safe types if not sanitised here)
49
+ /* phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.NoCaching */
50
+ $rows = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . esc_sql($wpdb->prefix . WDI_FEED_TABLE) . ' WHERE ' . $where . esc_sql($order_by_limit), $prepare_args)); //db call ok
51
 
 
 
 
52
  return $rows;
53
  }
54
 
55
  public function page_nav() {
56
  global $wpdb;
57
+ $prepare_args = array();
58
+ $where = '1=%d';
59
+ $prepare_args[] = 1;
60
+ if ( isset($this->search_text) && !empty($this->search_text) && (esc_html(stripslashes($this->search_text)) != '') ) {
61
+ $where .= ' AND feed_name LIKE "%%%s%%"';
62
+ $prepare_args[] = esc_html(stripslashes($this->search_text));
63
+ }
64
+ // $wpdb->prepare() not needed (will throw a notice) as there are no parameters (all parts are already sanitised or cast to known-safe types if not sanitised here)
65
+ /* phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.NoCaching */
66
+ $total = $wpdb->get_var( $wpdb->prepare( 'SELECT COUNT(*) FROM ' . esc_sql($wpdb->prefix . WDI_FEED_TABLE) . ' WHERE ' . $where, $prepare_args) ); //db call ok
67
  $page_nav['total'] = $total;
68
+ $limit = 0;
69
  if (isset($this->page_number) && $this->page_number) {
70
  $limit = ((int) $this->page_number - 1) * 20;
71
  }
 
 
 
72
  $page_nav['limit'] = (int) ($limit / 20 + 1);
73
  return $page_nav;
74
  }
75
 
76
  public static function wdi_get_feed_defaults() {
77
  global $wpdb;
78
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
79
+ $results = $wpdb->get_results( $wpdb->prepare("SELECT id FROM " . esc_sql($wpdb->prefix . WDI_THEME_TABLE) . " WHERE default_theme='%d'", 1) ); //db call ok
80
+ $default_theme = WDILibrary::objectToArray($results);
81
  $settings = array(
82
  'thumb_user' => '',
83
  'feed_name' => '',
166
  'feed_name' => 'string',
167
  'feed_thumb'=> 'url',
168
  'published' => 'bool',
169
+ 'theme_id'=> 'number',
170
  'feed_users'=> 'json',
171
  'feed_display_view' =>'string',
172
  'sort_images_by' => 'string',
192
  'disable_mobile_layout'=>'bool',
193
  'feed_type' => 'string',
194
  'feed_item_onclick' => 'string',
 
195
  //lightbox defaults
196
  'popup_fullscreen'=>'bool',
197
  'popup_width'=>'number',
219
  'show_image_counts'=>'bool',
220
  'enable_loop'=>'bool',
221
  'popup_image_right_click'=>'bool',
 
222
  'conditional_filters' => 'json',
223
  'conditional_filter_enable'=>'number',
224
  'conditional_filter_type' => 'string',
 
225
  'liked_feed' => 'string',
226
  'mobile_breakpoint' => 'number',
227
  'redirect_url' => 'string',
233
 
234
  public function get_feed_row($current_id){
235
  global $wpdb;
236
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
237
+ $feed_row = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . esc_sql($wpdb->prefix . WDI_FEED_TABLE) . " WHERE id ='%d' ", $current_id)); //db call ok
238
  return $feed_row;
239
  }
240
 
241
  public function get_unique_title($feed_name){
242
  global $wpdb;
243
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
244
+ $check_feed_title = $wpdb->get_var($wpdb->prepare("SELECT id FROM " . esc_sql($wpdb->prefix . WDI_FEED_TABLE) . " WHERE feed_name='%s' ", $feed_name)); //db call ok
245
  if($check_feed_title){
246
  $num = 1;
247
  do {
248
  $alt_name = $feed_name . "-$num";
249
  $num++;
250
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
251
+ $slug_check = $wpdb->get_var($wpdb->prepare("SELECT id FROM " . esc_sql($wpdb->prefix . WDI_FEED_TABLE) . " WHERE feed_name='%s' ", $alt_name)); //db call ok
252
  }
253
  while ( $slug_check );
254
  $feed_name = $alt_name;
288
  );
289
  // Create new post by wdi_preview preview type.
290
  if ( wp_insert_post($post_params) ) {
291
+ /* phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.flush_rewrite_rules_flush_rewrite_rules */
292
  flush_rewrite_rules();
293
 
294
  return get_the_guid($wpdb->insert_id);
313
  $conditional_filters = $data['conditional_filters'];
314
  $conditional_filter_type = $data['conditional_filter_type'];
315
  $top_recent = $data['hashtag_top_recent'];
316
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
317
+ $count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(id) FROM ". esc_sql($wpdb->prefix . WDI_FEED_TABLE) . " WHERE id ='%d' AND feed_users='%s' AND conditional_filters='%s' AND conditional_filter_type='%s' AND hashtag_top_recent='%s'", $feed_id, $users, $conditional_filters, $conditional_filter_type, $top_recent)); //db call ok
318
  if ( $count == 0 ) {
319
  return 1;
320
  } else {
admin/models/themes.php ADDED
@@ -0,0 +1,546 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Themes_model_wdi {
4
+
5
+ /**
6
+ * Get theme defaults.
7
+ *
8
+ * @return array
9
+ */
10
+ public static function get_theme_defaults() {
11
+ $settings = array(
12
+ 'theme_name' => 'Instagram Design',
13
+ 'default_theme' => '0',
14
+ 'feed_container_bg_color' => '#FFFFFF',
15
+ 'feed_wrapper_width' => '100%',
16
+ 'feed_container_width' => '100%',
17
+ 'feed_wrapper_bg_color' => '#FFFFFF',
18
+ 'active_filter_bg_color' => '#429fff',
19
+ 'header_margin' => '0px',
20
+ 'header_padding' => '5px',
21
+ 'header_border_size' => '0px',
22
+ 'header_border_color' => '#DDDDDD',
23
+ 'header_position' => 'left',
24
+ 'header_img_width' => '40',
25
+ 'header_border_radius' => 0,
26
+ 'header_text_padding' => '5px',
27
+ 'header_text_color' => '#0f4973',
28
+ 'header_font_weight' => '400',
29
+ 'header_text_font_size' => '18px',
30
+ 'header_text_font_style' => 'normal',
31
+ 'follow_btn_border_radius' => '3',
32
+ 'follow_btn_padding' => '25',
33
+ 'follow_btn_margin' => '10',
34
+ 'follow_btn_bg_color' => '#ffffff',
35
+ 'follow_btn_border_color' => '#0f4973',
36
+ 'follow_btn_text_color' => '#0f4973',
37
+ 'follow_btn_font_size' => '18',
38
+ 'follow_btn_border_hover_color' => '#0f4973',
39
+ 'follow_btn_text_hover_color' => '#0f4973',
40
+ 'follow_btn_background_hover_color' => '#ffffff',
41
+ 'user_padding' => '5px',
42
+ /////////////////////////disabled////////////////////////
43
+ 'user_horizontal_margin' => '',
44
+ 'user_border_size' => '0px',
45
+ 'user_border_color' => '',
46
+ 'user_img_width' => '40px', //enabled
47
+ 'user_border_radius' => '0px', //enabled
48
+ 'user_background_color' => '',
49
+ 'users_border_size' => '0px',
50
+ 'users_border_color' => '',
51
+ 'users_background_color' => '',
52
+ //////////////////////lightbox////////////////////////////
53
+ 'users_text_color' => '#0f4973',
54
+ 'users_font_weight' => '400',
55
+ 'users_text_font_size' => '18px',
56
+ 'users_text_font_style' => 'normal',
57
+ 'user_description_font_size' => '18px',
58
+ 'lightbox_overlay_bg_color' => '#25292c',
59
+ 'lightbox_overlay_bg_transparent' => '90',
60
+ 'lightbox_bg_color' => '#ffffff',
61
+ 'lightbox_ctrl_btn_height' => '20',
62
+ 'lightbox_ctrl_btn_margin_top' => '10',
63
+ 'lightbox_ctrl_btn_margin_left' => '7',
64
+ 'lightbox_ctrl_btn_pos' => 'bottom',
65
+ 'lightbox_ctrl_cont_bg_color' => '#2a5b83',
66
+ 'lightbox_ctrl_cont_border_radius' => '4',
67
+ 'lightbox_ctrl_cont_transparent' => '80',
68
+ 'lightbox_ctrl_btn_align' => 'center',
69
+ 'lightbox_ctrl_btn_color' => '#FFFFFF',
70
+ 'lightbox_ctrl_btn_transparent' => '100',
71
+ 'lightbox_toggle_btn_height' => '14',
72
+ 'lightbox_toggle_btn_width' => '100',
73
+ 'lightbox_close_btn_border_radius' => '16',
74
+ 'lightbox_close_btn_border_width' => '2',
75
+ 'lightbox_close_btn_border_style' => 'none',
76
+ 'lightbox_close_btn_border_color' => '#FFFFFF',
77
+ 'lightbox_close_btn_box_shadow' => 'none',
78
+ 'lightbox_close_btn_bg_color' => '#2a5b83',
79
+ 'lightbox_close_btn_transparent' => '100',
80
+ 'lightbox_close_btn_width' => '20',
81
+ 'lightbox_close_btn_height' => '20',
82
+ 'lightbox_close_btn_top' => '-10',
83
+ 'lightbox_close_btn_right' => '-10',
84
+ 'lightbox_close_btn_size' => '15',
85
+ 'lightbox_close_btn_color' => '#FFFFFF',
86
+ 'lightbox_close_btn_full_color' => '#000000',
87
+ 'lightbox_close_btn_hover_color' => '#000000',
88
+ 'lightbox_comment_share_button_color' => '#ffffff',
89
+ 'lightbox_rl_btn_style' => 'tenweb-i-chevron',
90
+ 'lightbox_rl_btn_bg_color' => '#2a5b83',
91
+ 'lightbox_rl_btn_transparent' => '80',
92
+ 'lightbox_rl_btn_box_shadow' => 'none',
93
+ 'lightbox_rl_btn_height' => '40',
94
+ 'lightbox_rl_btn_width' => '40',
95
+ 'lightbox_rl_btn_size' => '20',
96
+ 'lightbox_close_rl_btn_hover_color' => '#25292c',
97
+ 'lightbox_rl_btn_color' => '#FFFFFF',
98
+ 'lightbox_rl_btn_border_radius' => '20',
99
+ 'lightbox_rl_btn_border_width' => '0',
100
+ 'lightbox_rl_btn_border_style' => 'none',
101
+ 'lightbox_rl_btn_border_color' => '#FFFFFF',
102
+ 'lightbox_filmstrip_pos' => 'top',
103
+ 'lightbox_filmstrip_thumb_margin' => '0 1px',
104
+ 'lightbox_filmstrip_thumb_border_width' => '1',
105
+ 'lightbox_filmstrip_thumb_border_style' => 'solid',
106
+ 'lightbox_filmstrip_thumb_border_color' => '#25292c',
107
+ 'lightbox_filmstrip_thumb_border_radius' => '0',
108
+ 'lightbox_filmstrip_thumb_active_border_width' => '0',
109
+ 'lightbox_filmstrip_thumb_active_border_color' => '#FFFFFF',
110
+ 'lightbox_filmstrip_thumb_deactive_transparent' => '70',
111
+ 'lightbox_filmstrip_rl_btn_size' => '20',
112
+ 'lightbox_filmstrip_rl_btn_color' => '#FFFFFF',
113
+ 'lightbox_filmstrip_rl_bg_color' => '#3B3B3B',
114
+ 'lightbox_info_pos' => 'top',
115
+ 'lightbox_info_align' => 'right',
116
+ 'lightbox_info_bg_color' => '#3b3b3b',
117
+ 'lightbox_info_bg_transparent' => '80',
118
+ 'lightbox_info_border_width' => '1',
119
+ 'lightbox_info_border_style' => 'none',
120
+ 'lightbox_info_border_color' => '#3b3b3b',
121
+ 'lightbox_info_border_radius' => '5',
122
+ 'lightbox_info_padding' => '5px',
123
+ 'lightbox_info_margin' => '15px',
124
+ 'lightbox_title_color' => '#FFFFFF',
125
+ 'lightbox_title_font_style' => 'segoe ui',
126
+ 'lightbox_title_font_weight' => 'bold',
127
+ 'lightbox_title_font_size' => '13',
128
+ 'lightbox_description_color' => '#FFFFFF',
129
+ 'lightbox_description_font_style' => 'segoe ui',
130
+ 'lightbox_description_font_weight' => 'normal',
131
+ 'lightbox_description_font_size' => '14',
132
+ 'lightbox_info_height' => '30',
133
+ 'lightbox_comment_width' => '250',
134
+ 'lightbox_comment_pos' => 'right',
135
+ 'lightbox_comment_bg_color' => '#ffffff',
136
+ 'lightbox_comment_font_size' => '12',
137
+ 'lightbox_comment_font_color' => '#000000',
138
+ 'lightbox_comment_font_style' => 'segoe ui',
139
+ 'lightbox_comment_author_font_size' => '14',
140
+ 'lightbox_comment_author_font_color' => '#125688',
141
+ 'lightbox_comment_author_font_color_hover' => '#002160',
142
+ 'lightbox_comment_date_font_size' => '10',
143
+ 'lightbox_comment_body_font_size' => '12',
144
+ 'lightbox_comment_input_border_width' => '1',
145
+ 'lightbox_comment_input_border_style' => 'none',
146
+ 'lightbox_comment_input_border_color' => '#666666',
147
+ 'lightbox_comment_input_border_radius' => '0',
148
+ 'lightbox_comment_input_padding' => '2px',
149
+ 'lightbox_comment_input_bg_color' => '#333333',
150
+ 'lightbox_comment_button_bg_color' => '#616161',
151
+ 'lightbox_comment_button_padding' => '3px 10px',
152
+ 'lightbox_comment_button_border_width' => '1',
153
+ 'lightbox_comment_button_border_style' => 'none',
154
+ 'lightbox_comment_button_border_color' => '#666666',
155
+ 'lightbox_comment_button_border_radius' => '3',
156
+ 'lightbox_comment_separator_width' => '1',
157
+ 'lightbox_comment_separator_style' => 'solid',
158
+ 'lightbox_comment_separator_color' => '#125688',
159
+ 'lightbox_comment_load_more_color' => "#125688",
160
+ 'lightbox_comment_load_more_color_hover' => "#000000",
161
+ //////////////////////////////////////////////////////////
162
+ 'th_photo_wrap_padding' => '10px',
163
+ 'th_photo_wrap_border_size' => '10px',
164
+ 'th_photo_wrap_border_color' => '#ffffff',
165
+ 'th_photo_img_border_radius' => '0px',
166
+ 'th_photo_wrap_bg_color' => '#FFFFFF',
167
+ 'th_photo_meta_bg_color' => '#FFFFFF',
168
+ 'th_photo_meta_one_line' => '1',
169
+ 'th_like_text_color' => '#8a8d8e',
170
+ 'th_comment_text_color' => '#8a8d8e',
171
+ 'th_photo_caption_font_size' => '14px',
172
+ 'th_photo_caption_color' => '#125688',
173
+ 'th_feed_item_margin' => '0',
174
+ 'th_photo_caption_hover_color' => '#8e8e8e',
175
+ 'th_like_comm_font_size' => '13px',
176
+ 'th_overlay_hover_color' => '#125688',
177
+ 'th_overlay_hover_transparent' => '50',
178
+ 'th_overlay_hover_icon_color' => '#FFFFFF',
179
+ 'th_overlay_hover_icon_font_size' => '25px',
180
+ 'th_photo_img_hover_effect' => 'none',
181
+ //////////////////////////////////////////////////////////
182
+ 'mas_photo_wrap_padding' => '10px',
183
+ 'mas_photo_wrap_border_size' => '0px',
184
+ 'mas_photo_wrap_border_color' => 'gray',
185
+ 'mas_photo_img_border_radius' => '0px',
186
+ 'mas_photo_wrap_bg_color' => '#FFFFFF',
187
+ 'mas_photo_meta_bg_color' => '#FFFFFF',
188
+ 'mas_photo_meta_one_line' => '1',
189
+ 'mas_like_text_color' => '#8a8d8e',
190
+ 'mas_comment_text_color' => '#8a8d8e',
191
+ 'mas_photo_caption_font_size' => '14px',
192
+ 'mas_photo_caption_color' => '#125688',
193
+ 'mas_feed_item_margin' => '0',
194
+ 'mas_photo_caption_hover_color' => '#8e8e8e',
195
+ 'mas_like_comm_font_size' => '13px',
196
+ 'mas_overlay_hover_color' => '#125688',
197
+ 'mas_overlay_hover_transparent' => '50',
198
+ 'mas_overlay_hover_icon_color' => '#FFFFFF',
199
+ 'mas_overlay_hover_icon_font_size' => '25px',
200
+ 'mas_photo_img_hover_effect' => 'none',
201
+ 'blog_style_photo_wrap_padding' => '10px',
202
+ 'blog_style_photo_wrap_border_size' => '0px',
203
+ 'blog_style_photo_wrap_border_color' => 'gray',
204
+ 'blog_style_photo_img_border_radius' => '0px',
205
+ 'blog_style_photo_wrap_bg_color' => '#FFFFFF',
206
+ 'blog_style_photo_meta_bg_color' => '#FFFFFF',
207
+ 'blog_style_photo_meta_one_line' => '1',
208
+ 'blog_style_like_text_color' => '#8a8d8e',
209
+ 'blog_style_comment_text_color' => '#8a8d8e',
210
+ 'blog_style_photo_caption_font_size' => '16px',
211
+ 'blog_style_photo_caption_color' => '#125688',
212
+ 'blog_style_feed_item_margin' => '0',
213
+ 'blog_style_photo_caption_hover_color' => '#8e8e8e',
214
+ 'blog_style_like_comm_font_size' => '20px',
215
+ 'image_browser_photo_wrap_padding' => '10px',
216
+ 'image_browser_photo_wrap_border_size' => '0px',
217
+ 'image_browser_photo_wrap_border_color' => 'gray',
218
+ 'image_browser_photo_img_border_radius' => '0px',
219
+ 'image_browser_photo_wrap_bg_color' => '#FFFFFF',
220
+ 'image_browser_photo_meta_bg_color' => '#FFFFFF',
221
+ 'image_browser_photo_meta_one_line' => '1',
222
+ 'image_browser_like_text_color' => '#8a8d8e',
223
+ 'image_browser_comment_text_color' => '#8a8d8e',
224
+ 'image_browser_photo_caption_font_size' => '16px',
225
+ 'image_browser_photo_caption_color' => '#125688',
226
+ 'image_browser_feed_item_margin' => '0',
227
+ 'image_browser_photo_caption_hover_color' => '#8e8e8e',
228
+ 'image_browser_like_comm_font_size' => '20px',
229
+ 'load_more_position' => 'center',
230
+ 'load_more_padding' => '4px',
231
+ 'load_more_bg_color' => '#ffffff',
232
+ 'load_more_border_radius' => '500px',
233
+ 'load_more_height' => '90px',
234
+ 'load_more_width' => '90px',
235
+ 'load_more_border_size' => '1px',
236
+ 'load_more_border_color' => '#0f4973',
237
+ 'load_more_text_color' => '#1e73be',
238
+ /*load more icon*/
239
+ 'load_more_text_font_size' => '14px',
240
+ 'load_more_wrap_hover_color' => 'transparent',
241
+ 'pagination_ctrl_color' => '#0f4973',
242
+ 'pagination_size' => '18px',
243
+ 'pagination_ctrl_margin' => '15px',
244
+ 'pagination_ctrl_hover_color' => '#25292c',
245
+ 'pagination_position' => 'center',
246
+ 'pagination_position_vert' => 'top',
247
+ /* since v1.0.6*/
248
+ /* keep order */
249
+ 'th_thumb_user_bg_color' => '#429FFF',
250
+ 'th_thumb_user_color' => '#FFFFFF',
251
+ 'mas_thumb_user_bg_color' => '#429FFF',
252
+ 'mas_thumb_user_color' => '#FFFFFF',
253
+ );
254
+
255
+ return $settings;
256
+ }
257
+
258
+ /**
259
+ * Get sanitize types.
260
+ *
261
+ * @return array
262
+ */
263
+ public function get_sanitize_types() {
264
+ $sanitize_types = array(
265
+ 'theme_name' => 'string',
266
+ 'default_theme' => 'number',
267
+ 'feed_container_bg_color' => 'color',
268
+ 'feed_wrapper_width' => 'length',
269
+ 'feed_container_width' => 'length',
270
+ 'feed_wrapper_bg_color' => 'color',
271
+ 'active_filter_bg_color' => 'color',
272
+ 'header_margin' => 'length_multi',
273
+ 'header_padding' => 'length_multi',
274
+ 'header_border_size' => 'length',
275
+ 'header_border_color' => 'color',
276
+ 'header_position' => 'position',
277
+ 'header_img_width' => 'number',
278
+ 'header_border_radius' => 'number',
279
+ 'header_text_padding' => 'length',
280
+ 'header_text_color' => 'color',
281
+ 'header_font_weight' => 'number',
282
+ 'header_text_font_size' => 'length',
283
+ 'header_text_font_style' => 'string',
284
+ 'follow_btn_border_radius' => 'number',
285
+ 'follow_btn_padding' => 'number',
286
+ 'follow_btn_margin' => 'number',
287
+ 'follow_btn_bg_color' => 'color',
288
+ 'follow_btn_border_color' => 'color',
289
+ 'follow_btn_text_color' => 'color',
290
+ 'follow_btn_font_size' => 'number',
291
+ 'follow_btn_border_hover_color' => 'color',
292
+ 'follow_btn_text_hover_color' => 'color',
293
+ 'follow_btn_background_hover_color' => 'color',
294
+ 'user_padding' => 'length_multi',
295
+ 'user_horizontal_margin' => 'length',
296
+ 'user_border_size' => 'length',
297
+ 'user_border_color' => 'color',
298
+ 'user_img_width' => 'number',
299
+ 'user_border_radius' => 'number',
300
+ 'user_background_color' => 'color',
301
+ 'users_border_size' => 'length',
302
+ 'users_border_color' => 'color',
303
+ 'users_background_color' => 'color',
304
+ /////////////////////////LightBox////////////////////////
305
+ 'users_text_color' => 'color',
306
+ 'users_font_weight' => 'number',
307
+ 'users_text_font_size' => 'length',
308
+ 'users_text_font_style' => 'string',
309
+ 'user_description_font_size' => 'length',
310
+ 'lightbox_overlay_bg_color' => 'color',
311
+ 'lightbox_overlay_bg_transparent' => 'number_max_100',
312
+ 'lightbox_bg_color' => 'color',
313
+ 'lightbox_ctrl_btn_height' => 'number',
314
+ 'lightbox_ctrl_btn_margin_top' => 'number',
315
+ 'lightbox_ctrl_btn_margin_left' => 'number',
316
+ 'lightbox_ctrl_btn_pos' => 'string',
317
+ 'lightbox_ctrl_cont_bg_color' => 'color',
318
+ 'lightbox_ctrl_cont_border_radius' => 'number',
319
+ 'lightbox_ctrl_cont_transparent' => 'number_max_100',
320
+ 'lightbox_ctrl_btn_align' => 'position',
321
+ 'lightbox_ctrl_btn_color' => 'color',
322
+ 'lightbox_ctrl_btn_transparent' => 'number_max_100',
323
+ 'lightbox_toggle_btn_height' => 'number',
324
+ 'lightbox_toggle_btn_width' => 'number',
325
+ 'lightbox_close_btn_border_radius' => 'number',
326
+ 'lightbox_close_btn_border_width' => 'number',
327
+ 'lightbox_close_btn_border_style' => 'string',
328
+ 'lightbox_close_btn_border_color' => 'color',
329
+ 'lightbox_close_btn_box_shadow' => 'css_box_shadow',
330
+ 'lightbox_close_btn_bg_color' => 'color',
331
+ 'lightbox_close_btn_transparent' => 'number_max_100',
332
+ 'lightbox_close_btn_width' => 'number',
333
+ 'lightbox_close_btn_height' => 'number',
334
+ 'lightbox_close_btn_top' => 'number_neg',
335
+ 'lightbox_close_btn_right' => 'number_neg',
336
+ 'lightbox_close_btn_size' => 'number',
337
+ 'lightbox_close_btn_color' => 'color',
338
+ 'lightbox_close_btn_full_color' => 'color',
339
+ 'lightbox_close_btn_hover_color' => 'color',
340
+ 'lightbox_comment_share_button_color' => 'color',
341
+ 'lightbox_rl_btn_style' => 'string',
342
+ 'lightbox_rl_btn_bg_color' => 'color',
343
+ 'lightbox_rl_btn_transparent' => 'number_max_100',
344
+ 'lightbox_rl_btn_box_shadow' => 'css_box_shadow',
345
+ 'lightbox_rl_btn_height' => 'number',
346
+ 'lightbox_rl_btn_width' => 'number',
347
+ 'lightbox_rl_btn_size' => 'number',
348
+ 'lightbox_close_rl_btn_hover_color' => 'color',
349
+ 'lightbox_rl_btn_color' => 'color',
350
+ 'lightbox_rl_btn_border_radius' => 'number',
351
+ 'lightbox_rl_btn_border_width' => 'number',
352
+ 'lightbox_rl_btn_border_style' => 'string',
353
+ 'lightbox_rl_btn_border_color' => 'color',
354
+ 'lightbox_filmstrip_pos' => 'position',
355
+ 'lightbox_filmstrip_thumb_margin' => 'length_multi',
356
+ 'lightbox_filmstrip_thumb_border_width' => 'number',
357
+ 'lightbox_filmstrip_thumb_border_style' => 'string',
358
+ 'lightbox_filmstrip_thumb_border_color' => 'color',
359
+ 'lightbox_filmstrip_thumb_border_radius' => 'number',
360
+ 'lightbox_filmstrip_thumb_active_border_width' => 'number',
361
+ 'lightbox_filmstrip_thumb_active_border_color' => 'color',
362
+ 'lightbox_filmstrip_thumb_deactive_transparent' => 'number_max_100',
363
+ 'lightbox_filmstrip_rl_btn_size' => 'number',
364
+ 'lightbox_filmstrip_rl_btn_color' => 'color',
365
+ 'lightbox_filmstrip_rl_bg_color' => 'color',
366
+ 'lightbox_info_pos' => 'position',
367
+ 'lightbox_info_align' => 'string',
368
+ 'lightbox_info_bg_color' => 'color',
369
+ 'lightbox_info_bg_transparent' => 'number_max_100',
370
+ 'lightbox_info_border_width' => 'number',
371
+ 'lightbox_info_border_style' => 'string',
372
+ 'lightbox_info_border_color' => 'color',
373
+ 'lightbox_info_border_radius' => 'number',
374
+ 'lightbox_info_padding' => 'length_multi',
375
+ 'lightbox_info_margin' => 'length_multi',
376
+ 'lightbox_title_color' => 'color',
377
+ 'lightbox_title_font_style' => 'string',
378
+ 'lightbox_title_font_weight' => 'string',
379
+ 'lightbox_title_font_size' => 'number',
380
+ 'lightbox_description_color' => 'color',
381
+ 'lightbox_description_font_style' => 'string',
382
+ 'lightbox_description_font_weight' => 'string',
383
+ 'lightbox_description_font_size' => 'number',
384
+ 'lightbox_info_height' => 'number_max_100',
385
+ 'lightbox_comment_width' => 'number',
386
+ 'lightbox_comment_pos' => 'string',
387
+ 'lightbox_comment_bg_color' => 'color',
388
+ 'lightbox_comment_font_size' => 'number',
389
+ 'lightbox_comment_font_color' => 'color',
390
+ 'lightbox_comment_font_style' => 'string',
391
+ 'lightbox_comment_author_font_size' => 'number',
392
+ 'lightbox_comment_author_font_color' => 'color',
393
+ 'lightbox_comment_author_font_color_hover' => 'color',
394
+ 'lightbox_comment_date_font_size' => 'number',
395
+ 'lightbox_comment_body_font_size' => 'number',
396
+ 'lightbox_comment_input_border_width' => 'number',
397
+ 'lightbox_comment_input_border_style' => 'string',
398
+ 'lightbox_comment_input_border_color' => 'color',
399
+ 'lightbox_comment_input_border_radius' => 'number',
400
+ 'lightbox_comment_input_padding' => 'length_multi',
401
+ 'lightbox_comment_input_bg_color' => 'color',
402
+ 'lightbox_comment_button_bg_color' => 'color',
403
+ 'lightbox_comment_button_padding' => 'length_multi',
404
+ 'lightbox_comment_button_border_width' => 'number',
405
+ 'lightbox_comment_button_border_style' => 'string',
406
+ 'lightbox_comment_button_border_color' => 'color',
407
+ 'lightbox_comment_button_border_radius' => 'number',
408
+ 'lightbox_comment_separator_width' => 'number',
409
+ 'lightbox_comment_separator_style' => 'string',
410
+ 'lightbox_comment_separator_color' => 'color',
411
+ 'lightbox_comment_load_more_color' => 'color',
412
+ 'lightbox_comment_load_more_color_hover' => 'color',
413
+ /////////////////////////////////////////////////////////
414
+ 'th_photo_wrap_padding' => 'length',
415
+ 'th_photo_wrap_border_size' => 'length',
416
+ 'th_photo_wrap_border_color' => 'color',
417
+ 'th_photo_img_border_radius' => 'length',
418
+ 'th_photo_wrap_bg_color' => 'color',
419
+ 'th_photo_meta_bg_color' => 'color',
420
+ 'th_photo_meta_one_line' => 'bool',
421
+ 'th_like_text_color' => 'color',
422
+ 'th_comment_text_color' => 'color',
423
+ 'th_photo_caption_font_size' => 'length',
424
+ 'th_photo_caption_color' => 'color',
425
+ 'th_feed_item_margin' => 'length',
426
+ 'th_photo_caption_hover_color' => 'color',
427
+ 'th_like_comm_font_size' => 'length',
428
+ 'th_overlay_hover_color' => 'color',
429
+ 'th_overlay_hover_transparent' => 'number',
430
+ 'th_overlay_hover_icon_color' => 'color',
431
+ 'th_overlay_hover_icon_font_size' => 'length',
432
+ 'th_thumb_user_bg_color' => 'color',
433
+ 'th_thumb_user_color' => 'color',
434
+ 'th_photo_img_hover_effect' => 'string',
435
+ /////////////////////////////////////////////////////////
436
+ 'mas_photo_wrap_padding' => 'length',
437
+ 'mas_photo_wrap_border_size' => 'length',
438
+ 'mas_photo_wrap_border_color' => 'color',
439
+ 'mas_photo_img_border_radius' => 'length',
440
+ 'mas_photo_wrap_bg_color' => 'color',
441
+ 'mas_photo_meta_bg_color' => 'color',
442
+ 'mas_photo_meta_one_line' => 'bool',
443
+ 'mas_like_text_color' => 'color',
444
+ 'mas_comment_text_color' => 'color',
445
+ 'mas_photo_caption_font_size' => 'length',
446
+ 'mas_photo_caption_color' => 'color',
447
+ 'mas_feed_item_margin' => 'length',
448
+ 'mas_photo_caption_hover_color' => 'color',
449
+ 'mas_like_comm_font_size' => 'length',
450
+ 'mas_overlay_hover_color' => 'color',
451
+ 'mas_overlay_hover_transparent' => 'number',
452
+ 'mas_overlay_hover_icon_color' => 'color',
453
+ 'mas_overlay_hover_icon_font_size' => 'length',
454
+ 'mas_thumb_user_bg_color' => 'color',
455
+ 'mas_thumb_user_color' => 'color',
456
+ 'mas_photo_img_hover_effect' => 'string',
457
+ /////////////////////////////////////////////////
458
+ 'blog_style_photo_wrap_padding' => 'length',
459
+ 'blog_style_photo_wrap_border_size' => 'length',
460
+ 'blog_style_photo_wrap_border_color' => 'color',
461
+ 'blog_style_photo_img_border_radius' => 'length',
462
+ 'blog_style_photo_wrap_bg_color' => 'color',
463
+ 'blog_style_photo_meta_bg_color' => 'color',
464
+ 'blog_style_photo_meta_one_line' => 'bool',
465
+ 'blog_style_like_text_color' => 'color',
466
+ 'blog_style_comment_text_color' => 'color',
467
+ 'blog_style_photo_caption_font_size' => 'length',
468
+ 'blog_style_photo_caption_color' => 'color',
469
+ 'blog_style_feed_item_margin' => 'length',
470
+ 'blog_style_photo_caption_hover_color' => 'color',
471
+ 'blog_style_like_comm_font_size' => 'length',
472
+ /////////////////////////////////////////////////
473
+ 'image_browser_photo_wrap_padding' => 'length',
474
+ 'image_browser_photo_wrap_border_size' => 'length',
475
+ 'image_browser_photo_wrap_border_color' => 'color',
476
+ 'image_browser_photo_img_border_radius' => 'length',
477
+ 'image_browser_photo_wrap_bg_color' => 'color',
478
+ 'image_browser_photo_meta_bg_color' => 'color',
479
+ 'image_browser_photo_meta_one_line' => 'bool',
480
+ 'image_browser_like_text_color' => 'color',
481
+ 'image_browser_comment_text_color' => 'color',
482
+ 'image_browser_photo_caption_font_size' => 'length',
483
+ 'image_browser_photo_caption_color' => 'color',
484
+ 'image_browser_feed_item_margin' => 'length',
485
+ 'image_browser_photo_caption_hover_color' => 'color',
486
+ 'image_browser_like_comm_font_size' => 'length',
487
+ //////////////////////////////////////////
488
+ 'load_more_position' => 'position',
489
+ 'load_more_padding' => 'length',
490
+ 'load_more_bg_color' => 'color',
491
+ 'load_more_border_radius' => 'length',
492
+ 'load_more_height' => 'length',
493
+ 'load_more_width' => 'length',
494
+ 'load_more_border_size' => 'length',
495
+ 'load_more_border_color' => 'color',
496
+ 'load_more_text_color' => 'color',
497
+ /*load more icon*/
498
+ 'load_more_text_font_size' => 'length',
499
+ 'load_more_wrap_hover_color' => 'color',
500
+ 'pagination_ctrl_color' => 'color',
501
+ 'pagination_size' => 'length',
502
+ 'pagination_ctrl_margin' => 'length_multi',
503
+ 'pagination_ctrl_hover_color' => 'color',
504
+ 'pagination_position' => 'position',
505
+ 'pagination_position_vert' => 'position',
506
+ );
507
+
508
+ return $sanitize_types;
509
+ }
510
+
511
+ /**
512
+ * Get theme row.
513
+ *
514
+ * @param $id
515
+ *
516
+ * @return array|object|void|null
517
+ */
518
+ public static function get_theme_row( $id ) {
519
+ global $wpdb;
520
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
521
+ $theme_row = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . esc_sql($wpdb->prefix . WDI_THEME_TABLE) . " WHERE id ='%d' ", $id)); //db call ok
522
+
523
+ return $theme_row;
524
+ }
525
+
526
+ /**
527
+ * Get themes.
528
+ *
529
+ * @return mixed
530
+ */
531
+ public static function get_themes() {
532
+ global $wpdb;
533
+ $output = array();
534
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
535
+ $results = $wpdb->get_results("SELECT id, theme_name FROM " . esc_sql($wpdb->prefix . WDI_THEME_TABLE)); //db call ok
536
+ if ( !empty($results) ) {
537
+ $themes = WDILibrary::objectToArray($results);
538
+ if ( !empty($themes) ){
539
+ foreach ( $themes as $theme ) {
540
+ $output[$theme['id']] = $theme['theme_name'];
541
+ }
542
+ }
543
+ }
544
+ return $output;
545
+ }
546
+ }
admin/views/WDIViewEditorShortcode.php CHANGED
@@ -90,7 +90,7 @@ class WDIViewEditorShortcode {
90
  </div>
91
  </div>
92
  <script>
93
- <?php echo 'var wdi_feed_rows =' . json_encode($rows);?>;
94
  jQuery(document).ready(function(){
95
  wdi_selectChange(jQuery('#wdi_feed_select'));
96
  jQuery('#wdi_editor_insert_btn').on('click',wdi_insert_shortcode);
90
  </div>
91
  </div>
92
  <script>
93
+ <?php echo 'var wdi_feed_rows =' . wp_json_encode($rows); ?>;
94
  jQuery(document).ready(function(){
95
  wdi_selectChange(jQuery('#wdi_feed_select'));
96
  jQuery('#wdi_editor_insert_btn').on('click',wdi_insert_shortcode);
admin/views/WDIViewWidget.php CHANGED
@@ -20,11 +20,20 @@ class WDIViewWidget {
20
  $show_likes_comments = (isset($instance['show_likes_comments']) ? $instance['show_likes_comments'] : 0);
21
  $number_of_columns = (isset($instance['number_of_columns']) ? $instance['number_of_columns'] : 1);
22
  $enable_loading_buttons = (isset($instance['enable_loading_buttons']) ? $instance['enable_loading_buttons'] : 0);
 
 
 
 
 
 
 
 
 
23
  // Before widget.
24
- echo $before_widget;
25
  // Title of widget.
26
  if ($title) {
27
- echo $before_title . $title . $after_title;
28
  }
29
  // Widget output.
30
  $widget_params = array(
@@ -35,10 +44,14 @@ class WDIViewWidget {
35
  'number_of_columns'=>$number_of_columns,
36
  'enable_loading_buttons' => $enable_loading_buttons,
37
  );
38
- echo wdi_feed(array('id'=>$feed_id),$widget_params);
39
-
 
 
 
 
40
  // After widget.
41
- echo $after_widget;
42
  }
43
 
44
  // Widget Control Panel.
@@ -114,7 +127,7 @@ class WDIViewWidget {
114
  });
115
 
116
  function wdi_toggle(select){
117
- var feed_list = <?php echo json_encode($feeds);?>;
118
  var id = select.val();
119
  for(var i = 0 ; i < feed_list.length; i++){
120
  if(feed_list[i]['id'] == id){
20
  $show_likes_comments = (isset($instance['show_likes_comments']) ? $instance['show_likes_comments'] : 0);
21
  $number_of_columns = (isset($instance['number_of_columns']) ? $instance['number_of_columns'] : 1);
22
  $enable_loading_buttons = (isset($instance['enable_loading_buttons']) ? $instance['enable_loading_buttons'] : 0);
23
+ // Format an array of allowed HTML tags and attributes.
24
+ $allowed_html = array(
25
+ 'div' => array(
26
+ 'class' => true
27
+ ),
28
+ 'h2' => array(
29
+ 'class' => true
30
+ )
31
+ );
32
  // Before widget.
33
+ echo wp_kses($before_widget, $allowed_html);
34
  // Title of widget.
35
  if ($title) {
36
+ echo wp_kses($before_title, $allowed_html) . esc_html($title) . wp_kses($after_title, $allowed_html);
37
  }
38
  // Widget output.
39
  $widget_params = array(
44
  'number_of_columns'=>$number_of_columns,
45
  'enable_loading_buttons' => $enable_loading_buttons,
46
  );
47
+
48
+ // "wdi_feed" is the function of displaying the news feed, it describes the whole operation. All variables in the function are esc.
49
+ // Prints feed data.
50
+ /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */
51
+ echo wdi_feed( array('id'=>$feed_id), $widget_params );
52
+
53
  // After widget.
54
+ echo wp_kses($after_widget, $allowed_html);
55
  }
56
 
57
  // Widget Control Panel.
127
  });
128
 
129
  function wdi_toggle(select){
130
+ var feed_list = <?php echo wp_json_encode($feeds);?>;
131
  var id = select.val();
132
  for(var i = 0 ; i < feed_list.length; i++){
133
  if(feed_list[i]['id'] == id){
admin/views/feeds.php CHANGED
@@ -97,7 +97,7 @@ class Feeds_view_wdi {
97
  $wdi_order = 'asc';
98
  }
99
  ?>
100
- <a href="<?php echo WDILibrary::get_page_link(array('order_by'=>'feed_name', 'order'=>$wdi_order));?>">
101
  <span><?php _e('Title', 'wd-instagram-feed'); ?></span><span class="sorting-indicator"></span>
102
  </a>
103
  </th>
@@ -130,21 +130,21 @@ class Feeds_view_wdi {
130
  );
131
  $wdi_nonce_wd = wp_create_nonce('nonce_wd');
132
  ?>
133
- <tr id="tr_<?php echo esc_attr($row_data->id); ?>" <?php echo $alternate; ?>>
134
  <th class="table_small_col check-column"><input id="check_<?php echo esc_attr($row_data->id); ?>"
135
  name="check_<?php echo intval($row_data->id); ?>"
136
  onclick="wdi_spider_check_all(this)" type="checkbox"/>
137
  </th>
138
  <td class="column-primary column-title" data-colname="Name">
139
  <strong>
140
- <a href="<?php echo WDILibrary::get_page_link($edit_page_data);?>"
141
  title="Edit">
142
  <span class="media-icon image-icon">
143
- <img title="<?php echo esc_html($row_data->feed_name); ?>"
144
  style="border: 1px solid #CCCCCC; max-width: 70px; max-height: 50px;"
145
  src="<?php echo esc_url($prev_img_url); ?>">
146
  </span>
147
- <?php echo $row_data->feed_name; ?>
148
  </a>
149
  <?php
150
  if ( !$row_data->published ) {
@@ -168,15 +168,15 @@ class Feeds_view_wdi {
168
  |
169
  </span>
170
  <span>
171
- <a href="<?php echo esc_url(WDILibrary::get_page_link(array('task'=>$published,'current_id'=>$row_data->id, 'nonce_wd'=>$wdi_nonce_wd)));?>" ><?php echo ( $row_data->published ? __('Unpublish', 'wd-instagram-feed') : __('Publish', 'wd-instagram-feed')); ?></a>
172
  |
173
  </span>
174
  <span class="trash">
175
- <a onclick="if (!confirm('<?php esc_attr_e('Do you want to delete selected items?', 'wd-instagram-feed'); ?>')){return false;}" href="<?php echo WDILibrary::get_page_link(array('task'=>"delete",'current_id'=>$row_data->id, 'nonce_wd'=>$wdi_nonce_wd));?>">Delete</a>
176
  |
177
  </span>
178
  <span>
179
- <a href="<?php echo add_query_arg( array('feed_id' => $row_data->id), $instagram_preview_post); ?>" target="_blank"><?php _e('Preview', 'wd-instagram-feed'); ?></a>
180
  </span>
181
  </div>
182
  <button class="toggle-row" type="button">
@@ -235,7 +235,7 @@ class Feeds_view_wdi {
235
  ?>
236
  <script>
237
  jQuery(document).ready(function (){
238
- wdi_controller.switchFeedTabs('<?php echo $tab; ?>', '<?php echo $view_id;?>');
239
  });
240
  </script>
241
  <?php
@@ -256,8 +256,8 @@ class Feeds_view_wdi {
256
  }
257
  }
258
  }
259
- require_once(WDI_DIR . '/admin/models/WDIModelThemes_wdi.php');
260
- $themes = WDIModelThemes_wdi::get_themes();
261
  $settings_link = '<a href="'.add_query_arg(array('page' => 'wdi_settings'), admin_url('admin.php')).'">'.__( 'Settings', 'wd-instagram-feed').'</a>';
262
  $tabs = array(
263
  "feed_settings" => array(
@@ -269,7 +269,6 @@ class Feeds_view_wdi {
269
  "section_name"=>"wdi_media",
270
  "elements" => array(
271
  array(
272
- //'feed_name' => array('name' => 'feed_name', 'title' => __('Feed Title', 'wd-instagram-feed'), 'type' => 'input', 'tooltip' => '', 'attr' => array(array('name' => 'tab', 'value' => 'feed_settings'), array('name' => 'section', 'value' => 'thumbnails,masonry,blog_style,image_browser'))),
273
  'liked_feed' => array('disabled_options' => array('liked'), 'name' => 'liked_feed', 'title' => __('Feed Media', 'wd-instagram-feed'), 'type' => 'select', 'valid_options' => array('userhash' => __('Username/Hashtag', 'wd-instagram-feed'), 'liked' => __('Media I liked', 'wd-instagram-feed')), 'break' => 'false', 'hide_ids' => array(), 'tooltip' => __('Display media of User/Hashtag or the media I liked', 'wd-instagram-feed'), 'attr' => array(array('name' => 'tab', 'value' => 'feed_settings'), array('name' => 'section', 'value' => 'thumbnails,masonry,blog_style,image_browser'))),
274
  'user_name' => array(
275
  'name' => 'user_name',
@@ -383,7 +382,6 @@ class Feeds_view_wdi {
383
  'value' => 'thumbnails,masonry,blog_style,image_browser')
384
  )
385
  ),
386
- // 'feed_resolution' => array('name' => 'feed_resolution', 'title' => __('Feed Media Resolution', 'wd-instagram-feed'), 'type' => 'select', 'label' => array('text' => '', 'place' => 'after'), 'valid_options' => array('optimal' => 'Optimal', 'standard' => 'Large (1080 pixels)', 'low' => 'Low (320 pixels)', 'thumbnail' => 'Thumbnail (150 pixels)'), 'tooltip' => 'If set optimal, loaded media size is calculated according to container size. Fast loading and no stretched images.', 'attr' => array(array('name' => 'tab', 'value' => 'feed_settings'), array('name' => 'section', 'value' => 'thumbnails,masonry,blog_style,image_browser'))),
387
  'display_header' => array('name' => 'display_header', 'title' => __('Show Feed Header', 'wd-instagram-feed'), 'type' => 'checkbox', 'tooltip' => __('Header includes feed title', 'wd-instagram-feed'), 'attr' => array(array('name' => 'tab', 'value' => 'feed_settings'), array('name' => 'section', 'value' => 'thumbnails,masonry,blog_style,image_browser'))),
388
  'show_usernames' => array(
389
  'name' => 'show_usernames',
@@ -730,7 +728,7 @@ class Feeds_view_wdi {
730
  <div style="text-align:center;padding:2px;"><input type="radio" id="thumbnails" name="feed_type"
731
  value="thumbnails"><label for="thumbnails">Thumbnails</label>
732
  </div>
733
- <label for="thumbnails"><img src="<?php echo plugins_url('../../images/feed_views/thumbnails.png', __FILE__); ?>"></label>
734
  </div>
735
 
736
  <div class="display_type <?php echo (WDI_IS_FREE)?"wdi_tooltip":""; ?>" <?php echo (WDI_IS_FREE)?"wdi-tooltip='Available In Premium Version'":""; ?> tab="feed_settings">
@@ -738,7 +736,7 @@ class Feeds_view_wdi {
738
  value="masonry">
739
  <label for="masonry" <?php echo (WDI_IS_FREE)?"class='wdi_pro_only'":""; ?>>Masonry</label></div>
740
  <label for="masonry"><img
741
- src="<?php echo plugins_url('../../images/feed_views/masonry.png', __FILE__); ?>"></label>
742
  </div>
743
 
744
  <div class="display_type <?php echo (WDI_IS_FREE)?"wdi_tooltip":""; ?>" <?php echo (WDI_IS_FREE)?"wdi-tooltip='Available In Premium Version'":""; ?> tab="feed_settings">
@@ -746,7 +744,7 @@ class Feeds_view_wdi {
746
  <input type="radio" <?php echo (WDI_IS_FREE)?"disabled":""; ?> id="blog_style" name="feed_type" value="blog_style">
747
  <label for="blog_style" <?php echo (WDI_IS_FREE)?"class='wdi_pro_only'":""; ?>>Blog Style</label>
748
  </div>
749
- <label for="blog_style"><img src="<?php echo plugins_url('../../images/feed_views/blog_style.png', __FILE__); ?>"></label>
750
  </div>
751
 
752
  <div class="display_type" tab="feed_settings">
@@ -754,7 +752,7 @@ class Feeds_view_wdi {
754
  value="image_browser"><label for="image_browser">Image
755
  Browser</label></div>
756
  <label for="image_browser"><img
757
- src="<?php echo plugins_url('../../images/feed_views/image_browser.png', __FILE__); ?>"></label>
758
  </div>
759
  </div>
760
  </div>
@@ -837,17 +835,16 @@ class Feeds_view_wdi {
837
  <h2 class="wdi-h2-message"></h2>
838
  <form method="post" action="admin.php?page=wdi_feeds" id='wdi_save_feed'>
839
  <div class="wdi-page-header">
840
- <h1 class="wp-heading-inline"><?php echo __('Feed Title', 'wd-instagram-feed')?></h1>
841
- <input id="WDI_feed_name" class="WDI_title_input" name="wdi_feed_settings[feed_name]" type="text" value="<?php echo ($edit == TRUE && isset($feed_row['feed_name'])) ? $feed_row['feed_name'] : "";?>">
842
  <div class="wdi_buttons">
843
- <div id="wdi_save_feed_apply" class="button button-primary"><?php echo $save_btn_name;?></div>
844
- <button class="button preview-button button-large"<?php if (!$wdi_preview_btn) echo ' disabled="disabled"' ?> <?php echo ($wdi_preview_btn) ? 'onclick="window.open(\''. add_query_arg( array('feed_id' => $feed_row_id), $wdi_preview_link ) .'\', \'_blank\'); return false;"' : ''; ?>><?php echo __('Preview', 'wd-instagram-feed');?></button>
845
  </div>
846
  </div>
847
  <?php
848
  $this->generateTabs();
849
  $this->genarateFeedViews();
850
- // wp_nonce_field('wdi_nonce', 'wdi_nonce');
851
  wp_nonce_field('nonce_wd', 'nonce_wd');
852
  ?>
853
  <input type="hidden" id="task" name='task'>
@@ -870,7 +867,7 @@ class Feeds_view_wdi {
870
  }
871
  ?>
872
  <div id="<?php echo esc_attr($key); ?>_section" class="wdi_section <?php echo esc_attr($section["type"]); ?> <?php echo esc_attr($section["column"]); ?>">
873
- <h3 data-section_name="<?php echo $section['section_name']?>" class="wdi_section_name <?php echo esc_attr($section_class);?>"><?php echo esc_html($section["title"]); ?></h3>
874
  <div class="wdi_elements wdi_clear_tag">
875
  <?php foreach ($section["elements"] as $elements) { ?>
876
  <div class="section_col">
@@ -882,7 +879,7 @@ class Feeds_view_wdi {
882
  } ?>
883
  <?php if(WDI_IS_FREE && $section['section_name'] == 'wdi_conditional_filters'):?>
884
  <div id="wdi-conditional-filters-ui" class="wdi_demo_img">
885
- <div class="wdi-pro-overlay"><img src="<?php echo WDI_URL . '/demo_images/filters.png'; ?>" alt=""></div>
886
  </div>
887
  <?php continue;?>
888
  <?php endif;?>
@@ -923,7 +920,7 @@ class Feeds_view_wdi {
923
  <?php } ?>
924
  <!-- END FEED USERS -->
925
  <?php if ( $element['tooltip'] && $element['tooltip'] != '' ) {
926
- echo "<p class='wdi_about_filed'>".strip_tags($element['tooltip'],'<a>')."</p>";
927
  }
928
  ?>
929
  </div>
@@ -1049,7 +1046,7 @@ class Feeds_view_wdi {
1049
  ?>
1050
  <div class="wdi_user">
1051
  <a target="_blank" href="https://instagram.com/explore/tags/<?php echo esc_attr($tag_name); ?>">
1052
- <img class="wdi_profile_pic" src="<?php echo WDI_URL ?>/images/hashtag.png">
1053
  <span class="wdi_hashtag"><?php echo esc_html($tag_name); ?></span><i style="display:table-cell;width:25px;"></i>
1054
  </a>
1055
  <img class="wdi_remove_user" onclick="wdi_controller.removeFeedUser(jQuery(this))" src="<?php echo esc_url(WDI_URL) ?>/images/delete_user.png">
97
  $wdi_order = 'asc';
98
  }
99
  ?>
100
+ <a href="<?php echo esc_url(WDILibrary::get_page_link(array('order_by'=>'feed_name', 'order'=>$wdi_order)));?>">
101
  <span><?php _e('Title', 'wd-instagram-feed'); ?></span><span class="sorting-indicator"></span>
102
  </a>
103
  </th>
130
  );
131
  $wdi_nonce_wd = wp_create_nonce('nonce_wd');
132
  ?>
133
+ <tr id="tr_<?php echo esc_attr($row_data->id); ?>" <?php echo esc_html($alternate); ?>>
134
  <th class="table_small_col check-column"><input id="check_<?php echo esc_attr($row_data->id); ?>"
135
  name="check_<?php echo intval($row_data->id); ?>"
136
  onclick="wdi_spider_check_all(this)" type="checkbox"/>
137
  </th>
138
  <td class="column-primary column-title" data-colname="Name">
139
  <strong>
140
+ <a href="<?php echo esc_url(WDILibrary::get_page_link($edit_page_data));?>"
141
  title="Edit">
142
  <span class="media-icon image-icon">
143
+ <img title="<?php echo esc_attr($row_data->feed_name); ?>"
144
  style="border: 1px solid #CCCCCC; max-width: 70px; max-height: 50px;"
145
  src="<?php echo esc_url($prev_img_url); ?>">
146
  </span>
147
+ <?php echo esc_html($row_data->feed_name); ?>
148
  </a>
149
  <?php
150
  if ( !$row_data->published ) {
168
  |
169
  </span>
170
  <span>
171
+ <a href="<?php echo esc_url(WDILibrary::get_page_link(array('task'=>$published,'current_id'=>$row_data->id, 'nonce_wd'=>$wdi_nonce_wd)));?>" ><?php echo esc_html(( $row_data->published ? __('Unpublish', 'wd-instagram-feed') : __('Publish', 'wd-instagram-feed'))); ?></a>
172
  |
173
  </span>
174
  <span class="trash">
175
+ <a onclick="if (!confirm('<?php esc_attr_e('Do you want to delete selected items?', 'wd-instagram-feed'); ?>')){return false;}" href="<?php echo esc_url(WDILibrary::get_page_link(array('task'=>"delete",'current_id'=>$row_data->id, 'nonce_wd'=>$wdi_nonce_wd)));?>">Delete</a>
176
  |
177
  </span>
178
  <span>
179
+ <a href="<?php echo esc_url(add_query_arg( array('feed_id' => $row_data->id), $instagram_preview_post)); ?>" target="_blank"><?php _e('Preview', 'wd-instagram-feed'); ?></a>
180
  </span>
181
  </div>
182
  <button class="toggle-row" type="button">
235
  ?>
236
  <script>
237
  jQuery(document).ready(function (){
238
+ wdi_controller.switchFeedTabs('<?php echo esc_html($tab); ?>', '<?php echo esc_html($view_id);?>');
239
  });
240
  </script>
241
  <?php
256
  }
257
  }
258
  }
259
+ require_once(WDI_DIR . '/admin/models/themes.php');
260
+ $themes = Themes_model_wdi::get_themes();
261
  $settings_link = '<a href="'.add_query_arg(array('page' => 'wdi_settings'), admin_url('admin.php')).'">'.__( 'Settings', 'wd-instagram-feed').'</a>';
262
  $tabs = array(
263
  "feed_settings" => array(
269
  "section_name"=>"wdi_media",
270
  "elements" => array(
271
  array(
 
272
  'liked_feed' => array('disabled_options' => array('liked'), 'name' => 'liked_feed', 'title' => __('Feed Media', 'wd-instagram-feed'), 'type' => 'select', 'valid_options' => array('userhash' => __('Username/Hashtag', 'wd-instagram-feed'), 'liked' => __('Media I liked', 'wd-instagram-feed')), 'break' => 'false', 'hide_ids' => array(), 'tooltip' => __('Display media of User/Hashtag or the media I liked', 'wd-instagram-feed'), 'attr' => array(array('name' => 'tab', 'value' => 'feed_settings'), array('name' => 'section', 'value' => 'thumbnails,masonry,blog_style,image_browser'))),
273
  'user_name' => array(
274
  'name' => 'user_name',
382
  'value' => 'thumbnails,masonry,blog_style,image_browser')
383
  )
384
  ),
 
385
  'display_header' => array('name' => 'display_header', 'title' => __('Show Feed Header', 'wd-instagram-feed'), 'type' => 'checkbox', 'tooltip' => __('Header includes feed title', 'wd-instagram-feed'), 'attr' => array(array('name' => 'tab', 'value' => 'feed_settings'), array('name' => 'section', 'value' => 'thumbnails,masonry,blog_style,image_browser'))),
386
  'show_usernames' => array(
387
  'name' => 'show_usernames',
728
  <div style="text-align:center;padding:2px;"><input type="radio" id="thumbnails" name="feed_type"
729
  value="thumbnails"><label for="thumbnails">Thumbnails</label>
730
  </div>
731
+ <label for="thumbnails"><img src="<?php echo esc_url(plugins_url('../../images/feed_views/thumbnails.png', __FILE__)); ?>"></label>
732
  </div>
733
 
734
  <div class="display_type <?php echo (WDI_IS_FREE)?"wdi_tooltip":""; ?>" <?php echo (WDI_IS_FREE)?"wdi-tooltip='Available In Premium Version'":""; ?> tab="feed_settings">
736
  value="masonry">
737
  <label for="masonry" <?php echo (WDI_IS_FREE)?"class='wdi_pro_only'":""; ?>>Masonry</label></div>
738
  <label for="masonry"><img
739
+ src="<?php echo esc_url(plugins_url('../../images/feed_views/masonry.png', __FILE__)); ?>"></label>
740
  </div>
741
 
742
  <div class="display_type <?php echo (WDI_IS_FREE)?"wdi_tooltip":""; ?>" <?php echo (WDI_IS_FREE)?"wdi-tooltip='Available In Premium Version'":""; ?> tab="feed_settings">
744
  <input type="radio" <?php echo (WDI_IS_FREE)?"disabled":""; ?> id="blog_style" name="feed_type" value="blog_style">
745
  <label for="blog_style" <?php echo (WDI_IS_FREE)?"class='wdi_pro_only'":""; ?>>Blog Style</label>
746
  </div>
747
+ <label for="blog_style"><img src="<?php echo esc_url(plugins_url('../../images/feed_views/blog_style.png', __FILE__)); ?>"></label>
748
  </div>
749
 
750
  <div class="display_type" tab="feed_settings">
752
  value="image_browser"><label for="image_browser">Image
753
  Browser</label></div>
754
  <label for="image_browser"><img
755
+ src="<?php echo esc_url(plugins_url('../../images/feed_views/image_browser.png', __FILE__)); ?>"></label>
756
  </div>
757
  </div>
758
  </div>
835
  <h2 class="wdi-h2-message"></h2>
836
  <form method="post" action="admin.php?page=wdi_feeds" id='wdi_save_feed'>
837
  <div class="wdi-page-header">
838
+ <h1 class="wp-heading-inline"><?php echo esc_html(__('Feed Title', 'wd-instagram-feed'))?></h1>
839
+ <input id="WDI_feed_name" class="WDI_title_input" name="wdi_feed_settings[feed_name]" type="text" value="<?php echo esc_attr(($edit == TRUE && isset($feed_row['feed_name'])) ? $feed_row['feed_name'] : "");?>">
840
  <div class="wdi_buttons">
841
+ <div id="wdi_save_feed_apply" class="button button-primary"><?php echo esc_html($save_btn_name);?></div>
842
+ <button class="button preview-button button-large"<?php if (!$wdi_preview_btn) echo ' disabled="disabled"' ?> <?php echo ($wdi_preview_btn) ? 'onclick="window.open(\''. esc_attr(add_query_arg( array('feed_id' => $feed_row_id), $wdi_preview_link )) .'\', \'_blank\'); return false;"' : ''; ?>><?php echo esc_html(__('Preview', 'wd-instagram-feed'));?></button>
843
  </div>
844
  </div>
845
  <?php
846
  $this->generateTabs();
847
  $this->genarateFeedViews();
 
848
  wp_nonce_field('nonce_wd', 'nonce_wd');
849
  ?>
850
  <input type="hidden" id="task" name='task'>
867
  }
868
  ?>
869
  <div id="<?php echo esc_attr($key); ?>_section" class="wdi_section <?php echo esc_attr($section["type"]); ?> <?php echo esc_attr($section["column"]); ?>">
870
+ <h3 data-section_name="<?php echo esc_attr($section['section_name'])?>" class="wdi_section_name <?php echo esc_attr($section_class);?>"><?php echo esc_html($section["title"]); ?></h3>
871
  <div class="wdi_elements wdi_clear_tag">
872
  <?php foreach ($section["elements"] as $elements) { ?>
873
  <div class="section_col">
879
  } ?>
880
  <?php if(WDI_IS_FREE && $section['section_name'] == 'wdi_conditional_filters'):?>
881
  <div id="wdi-conditional-filters-ui" class="wdi_demo_img">
882
+ <div class="wdi-pro-overlay"><img src="<?php echo esc_url(WDI_URL . '/demo_images/filters.png'); ?>" alt=""></div>
883
  </div>
884
  <?php continue;?>
885
  <?php endif;?>
920
  <?php } ?>
921
  <!-- END FEED USERS -->
922
  <?php if ( $element['tooltip'] && $element['tooltip'] != '' ) {
923
+ echo "<p class='wdi_about_filed'>". wp_kses( $element['tooltip'], array('a' => array('href' => true), 'span') )."</p>";
924
  }
925
  ?>
926
  </div>
1046
  ?>
1047
  <div class="wdi_user">
1048
  <a target="_blank" href="https://instagram.com/explore/tags/<?php echo esc_attr($tag_name); ?>">
1049
+ <img class="wdi_profile_pic" src="<?php echo esc_url(WDI_URL) ?>/images/hashtag.png">
1050
  <span class="wdi_hashtag"><?php echo esc_html($tag_name); ?></span><i style="display:table-cell;width:25px;"></i>
1051
  </a>
1052
  <img class="wdi_remove_user" onclick="wdi_controller.removeFeedUser(jQuery(this))" src="<?php echo esc_url(WDI_URL) ?>/images/delete_user.png">
admin/views/settings.php CHANGED
@@ -44,7 +44,7 @@ class Settings_view_wdi {
44
  <?php }else{
45
  WDILibrary::topbar();
46
  }?>
47
- <form method="post" action="<?php echo add_query_arg(array( 'page' => 'wdi_settings' ), 'admin.php'); ?>" class="wdi_settings_form">
48
  <h2 class="wdi-page-title"><?php _e('Settings', 'wd-instagram-feed'); ?></h2>
49
  <div class="wdi-connect-instagram" onclick="wdi_popup_open()"></div>
50
  <div class="wdi-access-token-missing">
@@ -137,7 +137,7 @@ class Settings_view_wdi {
137
  </p>
138
  <div class="wdi-input-group">
139
  <label><?php _e('Uninstall', 'wd-instagram-feed'); ?></label>
140
- <a href="<?php echo admin_url('admin.php?page=wdi_uninstall'); ?>"
141
  class="button"><?php _e('Uninstall', 'wd-instagram-feed'); ?></a>
142
  <p class="wdi-description"><?php _e('Note, that uninstalling Instagram Feed will completely remove all feeds and other data on the plugin. Please make sure you don\'t have any important information before you proceed.', 'wd-instagram-feed'); ?></p>
143
  </div>
@@ -163,7 +163,6 @@ class Settings_view_wdi {
163
  ?>
164
  </span>
165
  </div>
166
-
167
  <script>
168
  jQuery(document).ready(function () {
169
  jQuery('#wdi-personal-business-popup input[name="wdi-connect-type"]').on('click', function () {
@@ -205,7 +204,7 @@ class Settings_view_wdi {
205
  });
206
  </script>
207
  <?php
208
- echo $this->personal_business_popup();
209
  }
210
 
211
  private function personal_business_popup() {
44
  <?php }else{
45
  WDILibrary::topbar();
46
  }?>
47
+ <form method="post" action="<?php echo esc_url(add_query_arg(array( 'page' => 'wdi_settings' ), 'admin.php')); ?>" class="wdi_settings_form">
48
  <h2 class="wdi-page-title"><?php _e('Settings', 'wd-instagram-feed'); ?></h2>
49
  <div class="wdi-connect-instagram" onclick="wdi_popup_open()"></div>
50
  <div class="wdi-access-token-missing">
137
  </p>
138
  <div class="wdi-input-group">
139
  <label><?php _e('Uninstall', 'wd-instagram-feed'); ?></label>
140
+ <a href="<?php echo esc_url(admin_url('admin.php?page=wdi_uninstall')); ?>"
141
  class="button"><?php _e('Uninstall', 'wd-instagram-feed'); ?></a>
142
  <p class="wdi-description"><?php _e('Note, that uninstalling Instagram Feed will completely remove all feeds and other data on the plugin. Please make sure you don\'t have any important information before you proceed.', 'wd-instagram-feed'); ?></p>
143
  </div>
163
  ?>
164
  </span>
165
  </div>
 
166
  <script>
167
  jQuery(document).ready(function () {
168
  jQuery('#wdi-personal-business-popup input[name="wdi-connect-type"]').on('click', function () {
204
  });
205
  </script>
206
  <?php
207
+ echo esc_html($this->personal_business_popup());
208
  }
209
 
210
  private function personal_business_popup() {
admin/views/{WDIViewThemes_wdi.php → themes.php} RENAMED
@@ -1,14 +1,6 @@
1
  <?php
2
 
3
- class WDIViewThemes_wdi
4
- {
5
-
6
- private $model;
7
-
8
- public function __construct($model)
9
- {
10
- $this->model = $model;
11
- }
12
 
13
  public function display() {
14
  WDILibrary::topbar();
@@ -16,13 +8,13 @@ class WDIViewThemes_wdi
16
  <div class="wrap">
17
  <div class="wdi_pro_notice"> <?php _e("This is free version, Customizing themes is available only in premium version","wd-instagram-feed"); ?> </div>
18
  <?php
19
- $this->buildFreeThemeDemo();
20
  ?>
21
  </div>
22
  <?php
23
  }
24
 
25
- public function buildFreeThemeDemo(){
26
  ?>
27
  <div class="wdi_demo_img" demo-tab="general"><img src="<?php echo esc_url(WDI_URL) . '/demo_images/1.png'; ?>" alt=""></div>
28
  <div class="wdi_demo_img" demo-tab="header"><img src="<?php echo esc_url(WDI_URL) . '/demo_images/2.png'; ?>" alt=""></div>
1
  <?php
2
 
3
+ class Themes_view_wdi {
 
 
 
 
 
 
 
 
4
 
5
  public function display() {
6
  WDILibrary::topbar();
8
  <div class="wrap">
9
  <div class="wdi_pro_notice"> <?php _e("This is free version, Customizing themes is available only in premium version","wd-instagram-feed"); ?> </div>
10
  <?php
11
+ $this->buildFreeThemeDemo();
12
  ?>
13
  </div>
14
  <?php
15
  }
16
 
17
+ private function buildFreeThemeDemo(){
18
  ?>
19
  <div class="wdi_demo_img" demo-tab="general"><img src="<?php echo esc_url(WDI_URL) . '/demo_images/1.png'; ?>" alt=""></div>
20
  <div class="wdi_demo_img" demo-tab="header"><img src="<?php echo esc_url(WDI_URL) . '/demo_images/2.png'; ?>" alt=""></div>
admin/views/uninstall.php CHANGED
@@ -21,7 +21,7 @@ class Uninstall_view_wdi {
21
  <li style="padding-bottom:5px;padding-left:5px;font-weight: bold;margin:0;">
22
  2) <?php echo esc_attr($wpdb->prefix . WDI_THEME_TABLE) ?></li>
23
  <p style="background-color:#F3EFEF;margin: 0;border-top: 1px solid #888888;border-bottom: 1px solid #888888;padding:2px;font-size:20px;">
24
- <?php _e('Options From', 'wd-instagram-feed') ?> <?php echo $wpdb->prefix, 'options' ?></p>
25
  <li style="padding-bottom:5px;padding-left:5px;font-weight: bold;margin:0;">3) wdi_version</li>
26
  <li style="padding-bottom:5px;padding-left:5px;font-weight: bold;margin:0;">4) wdi_custom_js</li>
27
  <li style="padding-bottom:5px;padding-left:5px;font-weight: bold;margin:0;">5) wdi_custom_css</li>
21
  <li style="padding-bottom:5px;padding-left:5px;font-weight: bold;margin:0;">
22
  2) <?php echo esc_attr($wpdb->prefix . WDI_THEME_TABLE) ?></li>
23
  <p style="background-color:#F3EFEF;margin: 0;border-top: 1px solid #888888;border-bottom: 1px solid #888888;padding:2px;font-size:20px;">
24
+ <?php _e('Options From', 'wd-instagram-feed') ?> <?php echo esc_html($wpdb->prefix), 'options' ?></p>
25
  <li style="padding-bottom:5px;padding-left:5px;font-weight: bold;margin:0;">3) wdi_version</li>
26
  <li style="padding-bottom:5px;padding-left:5px;font-weight: bold;margin:0;">4) wdi_custom_js</li>
27
  <li style="padding-bottom:5px;padding-left:5px;font-weight: bold;margin:0;">5) wdi_custom_css</li>
config.php CHANGED
@@ -3,7 +3,7 @@ if ( !defined('ABSPATH') ) {
3
  exit;
4
  }
5
 
6
- define('WDI_VERSION', '1.4.30');
7
  define('WDI_IS_FREE', TRUE);
8
  define('WDI_PREFIX', 'wdi');
9
  define('WDI_DIR', WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__)));
3
  exit;
4
  }
5
 
6
+ define('WDI_VERSION', '1.4.31');
7
  define('WDI_IS_FREE', TRUE);
8
  define('WDI_PREFIX', 'wdi');
9
  define('WDI_DIR', WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__)));
css/wdi_backend.css CHANGED
@@ -94,7 +94,6 @@
94
  #wdi_feed_tabs .wdi_feed_tab_active,
95
  #wdi_feed_tabs .wdi_feed_tabs:hover {
96
  background: none repeat scroll 0 0 #FFFFFF;
97
- /*border: 1px solid #46ACC3;*/
98
  color: #9a2465;
99
  }
100
  #wdi_feed_tabs .wdi_feed_tab_title{
@@ -165,7 +164,7 @@
165
 
166
  .wdi_user .wdi_remove_user:hover {
167
  cursor: pointer;
168
- transform: rotate(180deg); /*top: 6px;*/
169
  }
170
 
171
  .wdi_user .wdi_check_thumb_user:hover {
@@ -187,17 +186,6 @@
187
  padding: 2px;
188
  }
189
 
190
- /*.notice {*/
191
- /*display: inline-block;*/
192
- /*line-height: 19px;*/
193
- /*font-size: 14px;*/
194
- /*text-align: left;*/
195
- /*background-color: #fff;*/
196
- /*border-left: 4px solid #ffba00;*/
197
- /*-webkit-box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1);*/
198
- /*box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1);*/
199
- /*}*/
200
-
201
  .small_input {
202
  width: 60px;
203
  text-align: center;
@@ -217,8 +205,6 @@
217
  }
218
 
219
  .instagram-feed_page_wdi_settings table input
220
- /*.instagram-feed_page_wdi_settings table textarea,*/
221
- /*.instagram-feed_page_wdi_settings table select*/
222
  {
223
  float: right;
224
  }
@@ -233,99 +219,6 @@
233
  padding: 30px 20px;
234
  background: #fff;
235
  }
236
- /*
237
- #login_with_instagram {
238
- height: 43px;
239
- }
240
-
241
- #login_with_instagram .wdi_sign_in_button {
242
- background-image: url('../images/sign_in_with_instagram.png');
243
- background-repeat: no-repeat;
244
- background-position: left top;
245
- width: 234px;
246
- height: 43px;
247
- display:inline-block;
248
- float: left;
249
- text-indent: -999px;
250
- }
251
-
252
- #login_with_instagram .wdi_sign_in_button:hover {
253
- background-image: url('../images/sign_in_with_instagram_hover.png');
254
- }
255
-
256
- #login_with_instagram .wdi_default_feed_button,
257
- #login_with_instagram .wdi_edit_default_feed_button{
258
-
259
- width: 234px;
260
- height: 43px;
261
- background-repeat: no-repeat;
262
- background-position: center top;
263
- display:inline-block;
264
-
265
- }
266
- #login_with_instagram .wdi_default_feed_button{
267
- background-image: url('../images/default_feed_button.png');
268
- float: left;
269
- margin-right: 10px;
270
- }
271
- #login_with_instagram .wdi_edit_default_feed_button{
272
- background-image: url('../images/edit_feed_button.png');
273
- float: left;
274
-
275
- }
276
-
277
- #wdwt_wrap_wdi_authenticated_users_list{
278
- display: inline-block;
279
- width: 100%;
280
- }
281
-
282
- #wdwt_wrap_wdi_authenticated_users_list .wdi_sign_in_button{
283
- background-image: url(../images/multiple_accounts.png);
284
- background-repeat: no-repeat;
285
- background-position: left top;
286
- width: 228px;
287
- height: 36px;
288
- display: inline-block;
289
- float: right;
290
- margin-top: 2px;
291
- padding-bottom: 5px;
292
- }
293
-
294
-
295
- .wdi_multiple_accounts_section tr:not(:first-child) th{
296
- font-style: italic;
297
- }
298
-
299
- .wdi_multiple_accounts_section tr:not(:first-child) th,
300
- .wdi_multiple_accounts_section tr:not(:first-child) td{
301
- padding-top: 2px;
302
- padding-bottom: 0;
303
- font-weight: 400;
304
- }
305
-
306
- .wdi_multiple_accounts_section tr:first-child th{
307
- padding-bottom: 20px;
308
- }
309
-
310
- .wdi_multiple_accounts_section .wdi_username_tr td{
311
- padding-bottom: 5px !important;
312
- }
313
-
314
- .wdi_multiple_accounts_section .wdi_input_wrapper{
315
- width: 100%;
316
- display: inline-block;
317
- }
318
-
319
- .wdi_multiple_accounts_section .wdi_remove_auth_user{
320
- display: inline-block;
321
- float: right;
322
- color: #0075A5;
323
- cursor: pointer;
324
- font-weight: 300;
325
- font-size: 14px;
326
- margin-right: 3px;
327
- }
328
- */
329
 
330
  .wdi_advanced_option_open tr:nth-child(9),
331
  .wdi_advanced_option_open tr:nth-child(10),
@@ -1711,9 +1604,6 @@ label[for=WDI_user_padding] {
1711
  width: 270px;
1712
  }
1713
 
1714
- /*.wdi_element_content .wdi_filter_input #wdi_add_filter{
1715
- width:150px;
1716
- }*/
1717
  .wdi_border_wrapper .wdi_element_content input#wdi_add_user_ajax_input {
1718
  width: calc(100% - 78px);
1719
  }
@@ -1836,7 +1726,6 @@ label[for=WDI_user_padding] {
1836
  display: none;
1837
  }
1838
 
1839
- /*body.toplevel_page_wdi_settings table:nth-of-type(1) tr:nth-of-type(3),*/
1840
  body.toplevel_page_wdi_settings table:nth-of-type(1) tr:nth-of-type(4),
1841
  body.toplevel_page_wdi_settings table:nth-of-type(1) tr:nth-of-type(5){
1842
  display: none;
94
  #wdi_feed_tabs .wdi_feed_tab_active,
95
  #wdi_feed_tabs .wdi_feed_tabs:hover {
96
  background: none repeat scroll 0 0 #FFFFFF;
 
97
  color: #9a2465;
98
  }
99
  #wdi_feed_tabs .wdi_feed_tab_title{
164
 
165
  .wdi_user .wdi_remove_user:hover {
166
  cursor: pointer;
167
+ transform: rotate(180deg);
168
  }
169
 
170
  .wdi_user .wdi_check_thumb_user:hover {
186
  padding: 2px;
187
  }
188
 
 
 
 
 
 
 
 
 
 
 
 
189
  .small_input {
190
  width: 60px;
191
  text-align: center;
205
  }
206
 
207
  .instagram-feed_page_wdi_settings table input
 
 
208
  {
209
  float: right;
210
  }
219
  padding: 30px 20px;
220
  background: #fff;
221
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
222
 
223
  .wdi_advanced_option_open tr:nth-child(9),
224
  .wdi_advanced_option_open tr:nth-child(10),
1604
  width: 270px;
1605
  }
1606
 
 
 
 
1607
  .wdi_border_wrapper .wdi_element_content input#wdi_add_user_ajax_input {
1608
  width: calc(100% - 78px);
1609
  }
1726
  display: none;
1727
  }
1728
 
 
1729
  body.toplevel_page_wdi_settings table:nth-of-type(1) tr:nth-of-type(4),
1730
  body.toplevel_page_wdi_settings table:nth-of-type(1) tr:nth-of-type(5){
1731
  display: none;
css/wdi_frontend.css CHANGED
@@ -172,7 +172,6 @@
172
  */
173
 
174
  .wdi_spider_popup_loading {
175
- /*background: url("../images/ajax_loader.gif") no-repeat scroll 0 0 / 50px 50px rgba(0, 0, 0, 0);*/
176
  background-image: url("../images/ajax_loader.png");
177
  background-color: rgba(0, 0, 0, 0);
178
  background-repeat: no-repeat;
@@ -215,7 +214,6 @@ div[id^="wdi_container"] p {
215
  .wdi_spider_popup_loading,
216
  .footer-list-block .bwp_gallery .wdi_spider_popup_loading,
217
  .footer-list-block .bwp_gallery_tags .wdi_spider_popup_loading {
218
- /*background: url("../images/ajax_loader.gif") no-repeat scroll 0 0 / 50px 50px rgba(0, 0, 0, 0);*/
219
  background-image: url("../images/ajax_loader.png");
220
  background-color: rgba(0, 0, 0, 0);
221
  background-repeat: no-repeat;
@@ -1345,7 +1343,6 @@ div[id^="wdi_container"] p {
1345
  }
1346
  .wdi_carousel_btn_content {
1347
  display: inline-block;
1348
- /*width: 250px;*/
1349
  overflow: hidden;
1350
  white-space: nowrap;
1351
  position:relative;
172
  */
173
 
174
  .wdi_spider_popup_loading {
 
175
  background-image: url("../images/ajax_loader.png");
176
  background-color: rgba(0, 0, 0, 0);
177
  background-repeat: no-repeat;
214
  .wdi_spider_popup_loading,
215
  .footer-list-block .bwp_gallery .wdi_spider_popup_loading,
216
  .footer-list-block .bwp_gallery_tags .wdi_spider_popup_loading {
 
217
  background-image: url("../images/ajax_loader.png");
218
  background-color: rgba(0, 0, 0, 0);
219
  background-repeat: no-repeat;
1343
  }
1344
  .wdi_carousel_btn_content {
1345
  display: inline-block;
 
1346
  overflow: hidden;
1347
  white-space: nowrap;
1348
  position:relative;
elementor/widget.php CHANGED
@@ -92,9 +92,12 @@ class WDIElementorWidget extends \Elementor\Widget_Base {
92
  protected function render(){
93
  $settings = $this->get_settings_for_display();
94
  if(!empty($settings['wdi_feeds'])) {
 
 
95
  echo wdi_feed(array('id' => $settings['wdi_feeds']));
96
- } else {
97
- echo __('No feed. Create and publish a feed to display it.', "wd-instagram-feed");
 
98
  }
99
  }
100
 
92
  protected function render(){
93
  $settings = $this->get_settings_for_display();
94
  if(!empty($settings['wdi_feeds'])) {
95
+ // "wdi_feed" is the function of displaying the news feed, it describes the whole operation. All variables in the function are esc.
96
+ /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */
97
  echo wdi_feed(array('id' => $settings['wdi_feeds']));
98
+ }
99
+ else {
100
+ _e('No feed. Create and publish a feed to display it.', "wd-instagram-feed");
101
  }
102
  }
103
 
framework/WDICache.php CHANGED
@@ -33,7 +33,7 @@ class WDICache {
33
  $wdi_debugging_data = array();
34
  if ( $debug ) {
35
  $wdi_debugging = TRUE;
36
- $current_date = (date('Y-m-d H:i:s'));
37
  $cache_date = $cache_data["wdi_debugging_data"]["cache_date"];
38
  $wdi_transient_time = $cache_data["wdi_debugging_data"]["wdi_transient_time"];
39
  $current_date_strtotime = strtotime($current_date);
@@ -78,7 +78,7 @@ class WDICache {
78
  else {
79
  $wdi_transient_time = WDI_TRANSIENT_DEFAULT_TIME;
80
  }
81
- $cache_date = (date('Y-m-d H:i:s'));
82
  $wdi_cache_response = $response;
83
  $transient_key = "wdi_cache_" . md5($name);
84
  if ( !seems_utf8($wdi_cache_response) ) {
@@ -104,6 +104,7 @@ class WDICache {
104
  */
105
  public function reset_cache() {
106
  global $wpdb;
 
107
  $data = $wpdb->query('DELETE FROM ' . $wpdb->prefix . 'options WHERE option_name LIKE "%wdi_cache_%"');
108
 
109
  return $data;
@@ -123,12 +124,15 @@ class WDICache {
123
  for( $i = 0; $i <= $count; $i++) {
124
  $transient_key = "wdi_cache_" . md5($feed_id."_".$i);
125
  if( $i == $count ) {
126
- $like_query .= 'option_name LIKE "%' . $transient_key . '%"';
 
127
  } else {
128
- $like_query .= 'option_name LIKE "%' . $transient_key . '%" OR ';
 
129
  }
130
  }
131
- $result = $wpdb->query('DELETE FROM ' . $wpdb->prefix . 'options WHERE '.$like_query);
 
132
  delete_option('wdi_cache_success_'.$feed_id);
133
  return $result;
134
  }
33
  $wdi_debugging_data = array();
34
  if ( $debug ) {
35
  $wdi_debugging = TRUE;
36
+ $current_date = (wp_date('Y-m-d H:i:s'));
37
  $cache_date = $cache_data["wdi_debugging_data"]["cache_date"];
38
  $wdi_transient_time = $cache_data["wdi_debugging_data"]["wdi_transient_time"];
39
  $current_date_strtotime = strtotime($current_date);
78
  else {
79
  $wdi_transient_time = WDI_TRANSIENT_DEFAULT_TIME;
80
  }
81
+ $cache_date = (wp_date('Y-m-d H:i:s'));
82
  $wdi_cache_response = $response;
83
  $transient_key = "wdi_cache_" . md5($name);
84
  if ( !seems_utf8($wdi_cache_response) ) {
104
  */
105
  public function reset_cache() {
106
  global $wpdb;
107
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.DirectQuery */
108
  $data = $wpdb->query('DELETE FROM ' . $wpdb->prefix . 'options WHERE option_name LIKE "%wdi_cache_%"');
109
 
110
  return $data;
124
  for( $i = 0; $i <= $count; $i++) {
125
  $transient_key = "wdi_cache_" . md5($feed_id."_".$i);
126
  if( $i == $count ) {
127
+ $transient_key = '%' . $wpdb->esc_like($transient_key) . '%';
128
+ $like_query .= $wpdb->prepare('option_name LIKE %s', $transient_key);
129
  } else {
130
+ $transient_key = '%' . $wpdb->esc_like($transient_key) . '%';
131
+ $like_query .= $wpdb->prepare('option_name LIKE %s OR', $transient_key);
132
  }
133
  }
134
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.DirectQuery */
135
+ $result = $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'options WHERE %s', $like_query)); //db call ok
136
  delete_option('wdi_cache_success_'.$feed_id);
137
  return $result;
138
  }
framework/WDIInstagram.php CHANGED
@@ -32,7 +32,8 @@ class WDIInstagram {
32
  */
33
  public function get_filters( $feed_id ) {
34
  global $wpdb;
35
- $row = $wpdb->get_row("SELECT conditional_filter_enable, conditional_filter_type, conditional_filters FROM " . $wpdb->prefix . WDI_FEED_TABLE . " WHERE id = " . $feed_id, ARRAY_A);
 
36
  if( !empty($row) && $row['conditional_filter_enable'] ) {
37
  $conditional_filters = json_decode($row['conditional_filters'], 1);
38
  if( empty($conditional_filters) ) {
@@ -76,9 +77,9 @@ class WDIInstagram {
76
  if ( isset($cache_data) && $cache_data["success"] && isset($cache_data["cache_data"]) && $wdi_requests_success) {
77
  $return_data = $this->join_feed_cache($feed_id);
78
  $cache_data['data'] = $this->sortData( $feed_id, $return_data);
79
- return json_encode($cache_data);
80
  } else {
81
- return json_encode(array('data'=>''));
82
  }
83
  }
84
  }
@@ -93,8 +94,8 @@ class WDIInstagram {
93
  */
94
  public function sortData( $feed_id, $cache_datas ) {
95
  global $wpdb;
96
- $result = $wpdb->get_row( "SELECT sort_images_by, display_order FROM ".$wpdb->prefix."wdi_feeds WHERE id = ".intval($feed_id), ARRAY_A );
97
-
98
  switch ($result['sort_images_by']) {
99
  case 'date':
100
  if( $result['display_order'] == 'asc' ) {
@@ -135,7 +136,7 @@ class WDIInstagram {
135
  $data['data'] = '';
136
  $data['meta']['code'] = 200;
137
 
138
- return json_encode($data);
139
  }
140
 
141
  /**
@@ -172,9 +173,9 @@ class WDIInstagram {
172
  $wdi_requests_success = intval(get_option('wdi_cache_success_'.$feed_id, 0));
173
  if ( isset($cache_data) && $cache_data["success"] && isset($cache_data["cache_data"]) && $wdi_requests_success ) {
174
  $return_data['data'] = $this->join_feed_cache($feed_id);
175
- return json_encode($return_data);
176
  } else {
177
- return json_encode(array('data'=>''));
178
  }
179
  }
180
 
@@ -182,6 +183,8 @@ class WDIInstagram {
182
  $this->account_data = $this->wdi_authenticated_users_list[$user_name];
183
  $url = 'https://graph.facebook.com/v10.0/ig_hashtag_search/?user_id=' . $this->account_data["user_id"] . '&q=' . $tagname . '&access_token=' . $this->account_data["access_token"];
184
  $args = array();
 
 
185
  $response = wp_remote_get($url, $args);
186
  $hashtag_id = '';
187
  if ( !isset($response->errors) && is_array($response) && isset($response['body']) ) {
@@ -363,6 +366,8 @@ class WDIInstagram {
363
  $api_url .= $media_id . '/children?access_token=' . $this->account_data["access_token"];
364
  $fields = 'id,media_type,media_url,permalink,thumbnail_url,username,timestamp';
365
  $api_url .= '&fields='.$fields;
 
 
366
  $response = wp_remote_get($api_url, array());
367
  if ( is_array($response) && isset($response["body"]) && $this->isJson($response["body"]) ) {
368
  $medias = json_decode($response["body"], TRUE);
@@ -450,11 +455,14 @@ class WDIInstagram {
450
  $baseUrl = $this->wdi_getHashtagData($user_name, $endpoint, $tag_id);
451
  }
452
  }
 
453
  $args = array(
454
- 'timeout' => 60,
455
  'sslverify' => FALSE
456
  );
457
  if (strpos($baseUrl, 'https://graph.facebook.com/') === 0 || strpos($baseUrl, 'https://graph.instagram.com/') === 0 ) {
 
 
458
  $response = wp_remote_get($baseUrl, $args);
459
  } else {
460
  wp_die();
@@ -465,6 +473,8 @@ class WDIInstagram {
465
  foreach ($data['data'] as $key => $ig_object) {
466
  if ($ig_object['media_type'] === "VIDEO") {
467
  $oembedApiUrl = "https://graph.facebook.com/v10.0/instagram_oembed?url=" . $ig_object['permalink'] . "&access_token=" . $this->account_data["access_token"];
 
 
468
  $oembedData = wp_remote_get($oembedApiUrl, $args);
469
  if ( !isset($oembedData->errors) && is_array($oembedData) && isset($oembedData["body"]) ) {
470
  $oembedData = json_decode($oembedData["body"], TRUE);
@@ -483,6 +493,8 @@ class WDIInstagram {
483
  foreach ( $ig_object['children']['data'] as $carousel_key => $carousel_child ) {
484
  if ( $carousel_child['media_type'] === "VIDEO" ) {
485
  $childOembedApiUrl = "https://graph.facebook.com/v10.0/instagram_oembed?url=" . $carousel_child['permalink'] . "&access_token=" . $this->account_data["access_token"];
 
 
486
  $childOembedData = wp_remote_get($childOembedApiUrl, $args);
487
  if ( !isset($childOembedData->errors) && is_array($childOembedData) && isset($childOembedData["body"]) ) {
488
  $childOembedData = json_decode($childOembedData["body"], TRUE);
@@ -520,7 +532,7 @@ class WDIInstagram {
520
  $this->cache->reset_feed_cache( $feed_id );
521
  }
522
 
523
- $current_data = json_encode($current_data);
524
 
525
 
526
  $this->cache->set_cache_data($feed_id.'_'.$iter, base64_encode($current_data));
@@ -537,12 +549,12 @@ class WDIInstagram {
537
  if( $return_data['next_url'] == '' || $iter == ($wdi_cache_request_count-1) ) {
538
  update_option('wdi_cache_success_'.$feed_id, 1, 1);
539
  }
540
- return json_encode($return_data);
541
  }
542
  else {
543
  $return_data['next_url'] = '';
544
  $return_data['iter'] = $iter;
545
- return json_encode($return_data);
546
  }
547
  }
548
  }
32
  */
33
  public function get_filters( $feed_id ) {
34
  global $wpdb;
35
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.DirectQuery */
36
+ $row = $wpdb->get_row($wpdb->prepare("SELECT conditional_filter_enable, conditional_filter_type, conditional_filters FROM " . esc_sql($wpdb->prefix . WDI_FEED_TABLE) . " WHERE id = %d", $feed_id), ARRAY_A);
37
  if( !empty($row) && $row['conditional_filter_enable'] ) {
38
  $conditional_filters = json_decode($row['conditional_filters'], 1);
39
  if( empty($conditional_filters) ) {
77
  if ( isset($cache_data) && $cache_data["success"] && isset($cache_data["cache_data"]) && $wdi_requests_success) {
78
  $return_data = $this->join_feed_cache($feed_id);
79
  $cache_data['data'] = $this->sortData( $feed_id, $return_data);
80
+ return wp_json_encode($cache_data);
81
  } else {
82
+ return wp_json_encode(array('data'=>''));
83
  }
84
  }
85
  }
94
  */
95
  public function sortData( $feed_id, $cache_datas ) {
96
  global $wpdb;
97
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.DirectQuery */
98
+ $result = $wpdb->get_row($wpdb->prepare("SELECT sort_images_by, display_order FROM ". esc_sql($wpdb->prefix . WDI_FEED_TABLE) . " WHERE id = %d", intval($feed_id)), ARRAY_A );
99
  switch ($result['sort_images_by']) {
100
  case 'date':
101
  if( $result['display_order'] == 'asc' ) {
136
  $data['data'] = '';
137
  $data['meta']['code'] = 200;
138
 
139
+ return wp_json_encode($data);
140
  }
141
 
142
  /**
173
  $wdi_requests_success = intval(get_option('wdi_cache_success_'.$feed_id, 0));
174
  if ( isset($cache_data) && $cache_data["success"] && isset($cache_data["cache_data"]) && $wdi_requests_success ) {
175
  $return_data['data'] = $this->join_feed_cache($feed_id);
176
+ return wp_json_encode($return_data);
177
  } else {
178
+ return wp_json_encode(array('data'=>''));
179
  }
180
  }
181
 
183
  $this->account_data = $this->wdi_authenticated_users_list[$user_name];
184
  $url = 'https://graph.facebook.com/v10.0/ig_hashtag_search/?user_id=' . $this->account_data["user_id"] . '&q=' . $tagname . '&access_token=' . $this->account_data["access_token"];
185
  $args = array();
186
+ //wp_remote_get is a native WordPress function
187
+ /* phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get */
188
  $response = wp_remote_get($url, $args);
189
  $hashtag_id = '';
190
  if ( !isset($response->errors) && is_array($response) && isset($response['body']) ) {
366
  $api_url .= $media_id . '/children?access_token=' . $this->account_data["access_token"];
367
  $fields = 'id,media_type,media_url,permalink,thumbnail_url,username,timestamp';
368
  $api_url .= '&fields='.$fields;
369
+ //wp_remote_get is a native WordPress function
370
+ /* phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get */
371
  $response = wp_remote_get($api_url, array());
372
  if ( is_array($response) && isset($response["body"]) && $this->isJson($response["body"]) ) {
373
  $medias = json_decode($response["body"], TRUE);
455
  $baseUrl = $this->wdi_getHashtagData($user_name, $endpoint, $tag_id);
456
  }
457
  }
458
+ //If the internet connection is poor, the standard 5 seconds will not be enough
459
  $args = array(
460
+ 'timeout' => 60,//phpcs:ignore WordPressVIPMinimum.Performance.RemoteRequestTimeout.timeout_timeout
461
  'sslverify' => FALSE
462
  );
463
  if (strpos($baseUrl, 'https://graph.facebook.com/') === 0 || strpos($baseUrl, 'https://graph.instagram.com/') === 0 ) {
464
+ //wp_remote_get is a native WordPress function
465
+ /* phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get */
466
  $response = wp_remote_get($baseUrl, $args);
467
  } else {
468
  wp_die();
473
  foreach ($data['data'] as $key => $ig_object) {
474
  if ($ig_object['media_type'] === "VIDEO") {
475
  $oembedApiUrl = "https://graph.facebook.com/v10.0/instagram_oembed?url=" . $ig_object['permalink'] . "&access_token=" . $this->account_data["access_token"];
476
+ //wp_remote_get is a native WordPress function
477
+ /* phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get */
478
  $oembedData = wp_remote_get($oembedApiUrl, $args);
479
  if ( !isset($oembedData->errors) && is_array($oembedData) && isset($oembedData["body"]) ) {
480
  $oembedData = json_decode($oembedData["body"], TRUE);
493
  foreach ( $ig_object['children']['data'] as $carousel_key => $carousel_child ) {
494
  if ( $carousel_child['media_type'] === "VIDEO" ) {
495
  $childOembedApiUrl = "https://graph.facebook.com/v10.0/instagram_oembed?url=" . $carousel_child['permalink'] . "&access_token=" . $this->account_data["access_token"];
496
+ //wp_remote_get is a native WordPress function
497
+ /* phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get */
498
  $childOembedData = wp_remote_get($childOembedApiUrl, $args);
499
  if ( !isset($childOembedData->errors) && is_array($childOembedData) && isset($childOembedData["body"]) ) {
500
  $childOembedData = json_decode($childOembedData["body"], TRUE);
532
  $this->cache->reset_feed_cache( $feed_id );
533
  }
534
 
535
+ $current_data = wp_json_encode($current_data);
536
 
537
 
538
  $this->cache->set_cache_data($feed_id.'_'.$iter, base64_encode($current_data));
549
  if( $return_data['next_url'] == '' || $iter == ($wdi_cache_request_count-1) ) {
550
  update_option('wdi_cache_success_'.$feed_id, 1, 1);
551
  }
552
+ return wp_json_encode($return_data);
553
  }
554
  else {
555
  $return_data['next_url'] = '';
556
  $return_data['iter'] = $iter;
557
+ return wp_json_encode($return_data);
558
  }
559
  }
560
  }
framework/WDILibrary.php CHANGED
@@ -10,25 +10,33 @@ class WDILibrary {
10
  *
11
  * @param string $key
12
  * @param string $default_value
13
- * @param string $callback
14
  *
15
  * @return string|array
16
  */
17
  public static function get($key, $default_value = '', $callback = 'sanitize_text_field', $type = 'DEFAULT') {
 
 
18
  switch ($type) {
19
  case 'REQUEST' :
 
20
  if (isset($_REQUEST[$key])) {
 
21
  $value = $_REQUEST[$key];
22
  }
23
  break;
24
  case 'DEFAULT' :
25
  case 'POST' :
 
26
  if (isset($_POST[$key])) {
 
27
  $value = $_POST[$key];
28
  }
29
  if ( 'POST' === $type ) break;
30
  case 'GET' :
 
31
  if (isset($_GET[$key])) {
 
32
  $value = $_GET[$key];
33
  }
34
  break;
@@ -303,7 +311,7 @@ class WDILibrary {
303
  }
304
  </script>
305
  <p class="search-box">
306
- <input type="search" id="search_value" name="search_value" class="wdi_spider_search_value" onkeypress="return check_search_key(event, this);" value="<?php echo esc_html($search_value); ?>" style="<?php echo (get_bloginfo('version') > '3.7') ? ' height: 28px;' : ''; ?>" />
307
  <input type="button" value="<?php _e('Search','wd-instagram-feed');?>" onclick="wdi_spider_search()" class="button-secondary action">
308
  </p>
309
  <?php
@@ -415,7 +423,13 @@ class WDILibrary {
415
  ?>
416
  <span class="pagination-links">
417
  <?php if($first_prev_page):?>
 
 
 
418
  <a class="<?php echo esc_attr($first_page); ?>" title="Go to the first page" href="<?php echo WDILibrary::get_pagination_page($items_county , $page_number,-2);?>">«</a>
 
 
 
419
  <a class="<?php echo esc_attr($prev_page); ?>" title="Go to the previous page" href="<?php echo WDILibrary::get_pagination_page($items_county , $page_number,-1);?>">‹</a>
420
  <?php else:?>
421
  <span class="tablenav-pages-navspan" aria-hidden="true">«</span>
@@ -430,7 +444,13 @@ class WDILibrary {
430
  </span>
431
  </span>
432
  <?php if($next_last_page):?>
 
 
 
433
  <a class="<?php echo esc_attr($next_page) ?>" title="Go to the next page" href="<?php echo WDILibrary::get_pagination_page($items_county , $page_number,1);?>">›</a>
 
 
 
434
  <a class="<?php echo esc_attr($last_page) ?>" title="Go to the last page" href="<?php echo WDILibrary::get_pagination_page($items_county , $page_number,2);?>">»</a>
435
  <?php else:?>
436
  <span class="tablenav-pages-navspan" aria-hidden="true">›</span>
@@ -441,8 +461,8 @@ class WDILibrary {
441
  ?>
442
  </span>
443
  </div>
444
- <input type="hidden" id="page_number" name="page_number" value="<?php echo self::get('page_number', 1); ?>" />
445
- <input type="hidden" id="search_or_not" name="search_or_not" value="<?php echo self::get('search_or_not'); ?>"/>
446
  <?php
447
  }
448
 
@@ -520,7 +540,7 @@ class WDILibrary {
520
  </script>
521
  <div class="alignleft actions" style="">
522
  <label for="search_value" style="font-size:14px; width:60px; display:inline-block;"><?php echo esc_html($search_by); ?>:</label>
523
- <input type="text" id="search_value" name="search_value" class="wdi_spider_search_value" onkeypress="return check_search_key(event, this);" value="<?php echo esc_html($search_value); ?>" style="width: 150px;<?php echo (get_bloginfo('version') > '3.7') ? ' height: 28px;' : ''; ?>" />
524
  </div>
525
  <div class="alignleft actions">
526
  <input type="button" value="Search" onclick="wdi_spider_search()" class="button-secondary action">
@@ -639,8 +659,8 @@ class WDILibrary {
639
  </span>
640
  </div>
641
  <?php if (!$pager) { ?>
642
- <input type="hidden" id="page_number" name="page_number" value="<?php echo self::get('page_number', 1); ?>" />
643
- <input type="hidden" id="search_or_not" name="search_or_not" value="<?php echo self::get('search_or_not'); ?>"/>
644
  <?php
645
  }
646
  }
@@ -720,10 +740,10 @@ class WDILibrary {
720
  <div class="wdi_search_container_1" id="wdi_search_container_1_<?php echo esc_attr($current_view); ?>">
721
  <div class="wdi_search_container_2" id="wdi_search_container_2_<?php echo esc_attr($current_view); ?>">
722
  <span class="wdi_search_reset_container" >
723
- <i title="<?php echo __('Reset', 'wd-instagram-feed'); ?>" class="wdi_reset tenweb-i tenweb-i-times" onclick="clear_input_<?php echo esc_attr($current_view); ?>('<?php echo esc_attr($current_view); ?>'),wdi_spider_frontend_ajax('<?php echo esc_attr($form_id); ?>', '<?php echo esc_attr($current_view); ?>', '<?php echo esc_attr($cur_gal_id); ?>', <?php echo esc_attr($album_gallery_id); ?>, '', '<?php echo esc_attr($type); ?>', 1)"></i>
724
  </span>
725
  <span class="wdi_search_loupe_container" >
726
- <i title="<?php echo __('Search', 'wd-instagram-feed'); ?>" class="wdi_search tenweb-i tenweb-i-search" onclick="wdi_spider_frontend_ajax('<?php echo esc_attr($form_id); ?>', '<?php echo esc_attr($current_view); ?>', '<?php echo esc_attr($cur_gal_id); ?>', <?php echo esc_attr($album_gallery_id); ?>, '', '<?php echo esc_attr($type); ?>', 1)"></i>
727
  </span>
728
  <span class="wdi_search_input_container">
729
  <input id="wdi_search_input_<?php echo esc_attr($current_view); ?>" class="wdi_search_input_<?php echo esc_attr($current_view); ?>" type="text" onkeypress="return check_enter_key(event ,this)" name="wdi_search_<?php echo esc_attr($current_view); ?>" value="<?php echo esc_attr($wdi_search); ?>" >
@@ -766,12 +786,12 @@ class WDILibrary {
766
  }
767
  </style>
768
  <div class="wdi_order_cont_<?php echo esc_attr($current_view); ?>">
769
- <span class="wdi_order_label_<?php echo esc_attr($current_view); ?>"><?php echo __('Order by: ', 'wd-instagram-feed'); ?></span>
770
  <select class="wdi_order_<?php echo esc_attr($current_view); ?>" onchange="wdi_spider_frontend_ajax('<?php echo esc_attr($form_id); ?>', '<?php echo esc_attr($current_view); ?>', '<?php echo esc_attr($cur_gal_id); ?>', <?php echo esc_attr($album_gallery_id); ?>, '', '<?php echo esc_attr($type); ?>', 1, '', this.value)">
771
- <option <?php if ($sort_by == 'default') echo 'selected'; ?> value="default"><?php echo __('Default', 'wd-instagram-feed'); ?></option>
772
- <option <?php if ($sort_by == 'filename') echo 'selected'; ?> value="filename"><?php echo __('Filename', 'wd-instagram-feed'); ?></option>
773
- <option <?php if ($sort_by == 'size') echo 'selected'; ?> value="size"><?php echo __('Size', 'wd-instagram-feed'); ?></option>
774
- <option <?php if ($sort_by == 'RAND()') echo 'selected'; ?> value="random"><?php echo __('Random', 'wd-instagram-feed'); ?></option>
775
  </select>
776
  </div>
777
  <?php
@@ -799,7 +819,7 @@ class WDILibrary {
799
  public static function wdi_spider_redirect( $url = '' ) {
800
  ?>
801
  <script>
802
- window.location = "<?php echo esc_url($url); ?>";
803
  </script>
804
  <?php
805
  exit();
@@ -813,7 +833,7 @@ class WDILibrary {
813
  public static function redirect( $url = array() ) {
814
  $url = html_entity_decode($url);
815
  ?>
816
- <script>window.location = "<?php echo esc_url($url); ?>";</script>
817
  <?php
818
  exit();
819
  }
@@ -904,30 +924,31 @@ class WDILibrary {
904
  }
905
  }
906
  $feed_row['nothing_to_display'] = (empty($new_users_list)) ? '1' : '0';
907
- $feed_row['feed_users'] = json_encode($new_users_list);
908
  }
909
  return $feed_row;
910
  }
911
 
912
- /*
913
- * @return color if valid color, otherwise return false
914
- *
915
- */
 
916
 
917
  public static function regexColor($color, $named) {
918
 
919
  if ($named) {
920
-
921
  $named = array('transparent','aliceblue', 'antiquewhite', 'aqua', 'aquamarine', 'azure', 'beige', 'bisque', 'black', 'blanchedalmond', 'blue', 'blueviolet', 'brown', 'burlywood', 'cadetblue', 'chartreuse', 'chocolate', 'coral', 'cornflowerblue', 'cornsilk', 'crimson', 'cyan', 'darkblue', 'darkcyan', 'darkgoldenrod', 'darkgray', 'darkgreen', 'darkkhaki', 'darkmagenta', 'darkolivegreen', 'darkorange', 'darkorchid', 'darkred', 'darksalmon', 'darkseagreen', 'darkslateblue', 'darkslategray', 'darkturquoise', 'darkviolet', 'deeppink', 'deepskyblue', 'dimgray', 'dodgerblue', 'firebrick', 'floralwhite', 'forestgreen', 'fuchsia', 'gainsboro', 'ghostwhite', 'gold', 'goldenrod', 'gray', 'green', 'greenyellow', 'honeydew', 'hotpink', 'indianred', 'indigo', 'ivory', 'khaki', 'lavender', 'lavenderblush', 'lawngreen', 'lemonchiffon', 'lightblue', 'lightcoral', 'lightcyan', 'lightgoldenrodyellow', 'lightgreen', 'lightgrey', 'lightpink', 'lightsalmon', 'lightseagreen', 'lightskyblue', 'lightslategray', 'lightsteelblue', 'lightyellow', 'lime', 'limegreen', 'linen', 'magenta', 'maroon', 'mediumaquamarine', 'mediumblue', 'mediumorchid', 'mediumpurple', 'mediumseagreen', 'mediumslateblue', 'mediumspringgreen', 'mediumturquoise', 'mediumvioletred', 'midnightblue', 'mintcream', 'mistyrose', 'moccasin', 'navajowhite', 'navy', 'oldlace', 'olive', 'olivedrab', 'orange', 'orangered', 'orchid', 'palegoldenrod', 'palegreen', 'paleturquoise', 'palevioletred', 'papayawhip', 'peachpuff', 'peru', 'pink', 'plum', 'powderblue', 'purple', 'red', 'rosybrown', 'royalblue', 'saddlebrown', 'salmon', 'sandybrown', 'seagreen', 'seashell', 'sienna', 'silver', 'skyblue', 'slateblue', 'slategray', 'snow', 'springgreen', 'steelblue', 'tan', 'teal', 'thistle', 'tomato', 'turquoise', 'violet', 'wheat', 'white', 'whitesmoke', 'yellow', 'yellowgreen');
922
  if (in_array(strtolower($color), $named)) {
923
  /* A color name was entered instead of a Hex Value, so just exit function */
924
  return $color;
925
  }
926
  }
927
-
928
  //checking rgb format
929
  if(self::is_rgb($color) == true){
930
- return $color;
931
  }
932
  if(substr($color,0,1) == '#' && strlen($color) === 4){
933
  $color.=substr($color,1,strlen($color));
@@ -991,7 +1012,7 @@ class WDILibrary {
991
 
992
  public static function get_page_link( $data ){
993
  $page = self::get('page');
994
- $url = add_query_arg(array( 'page' => $page, $data ), admin_url('admin.php'));
995
  return $url;
996
  }
997
 
@@ -1010,33 +1031,6 @@ class WDILibrary {
1010
  return $string;
1011
  }
1012
 
1013
- /**
1014
- * @param $dir directory name
1015
- * @return null|boolean return null when directory not exists,
1016
- * true when directory recursively removed and false in failed
1017
- * */
1018
- public static function remove_folder($dir){
1019
-
1020
- if(!is_dir($dir)) {
1021
- return null;
1022
- }
1023
-
1024
- $files = scandir($dir);
1025
-
1026
- if(is_array($files) && !empty($files)) {
1027
-
1028
- foreach($files as $file) {
1029
- if($file === "." || $file === "..") {
1030
- continue;
1031
- }
1032
- unlink($dir . '/' . $file);
1033
- }
1034
-
1035
- }
1036
-
1037
- return rmdir($dir);
1038
- }
1039
-
1040
  /**
1041
  * Get shortcode data.
1042
  *
@@ -1063,7 +1057,7 @@ class WDILibrary {
1063
  'options' => $gb_row,
1064
  );
1065
 
1066
- return json_encode($data);
1067
  }
1068
 
1069
  /**
@@ -1118,7 +1112,7 @@ class WDILibrary {
1118
 
1119
  $script = "var $object_name = " . wp_json_encode( $l10n ) . ';';
1120
  $script = "<script>" . $script . "</script>";
1121
- echo $script;
1122
  }
1123
 
1124
  public static function elementor_is_active(){
@@ -1195,6 +1189,8 @@ class WDILibrary {
1195
  $url = $instagram_app_config["basic_redirect_uri"];
1196
  }
1197
  elseif ($wdi_user_type === "business"){
 
 
1198
  $wdi_user_data = wp_remote_get('https://graph.facebook.com/v9.0/' . $wdi_user_id . '?fields=id,ig_id,username,name,biography,profile_picture_url,followers_count,follows_count,media_count,website&access_token=' . $wdi_user_token);
1199
  if(!is_wp_error( $wdi_user_data ) && isset($wdi_user_data["body"])){
1200
  $wdi_user_data = json_decode($wdi_user_data["body"], TRUE);
@@ -1236,7 +1232,7 @@ class WDILibrary {
1236
  $wdi_authenticated_users_list[$user_name]["website"] = $wdi_user_data["website"];
1237
  }
1238
  }
1239
- $wdi_instagram_options["wdi_authenticated_users_list"] = json_encode($wdi_authenticated_users_list);
1240
  $updated = update_option("wdi_instagram_options" , $wdi_instagram_options);
1241
  if($updated){
1242
  delete_option('wdi_token_error_flag');
@@ -1356,14 +1352,14 @@ class WDILibrary {
1356
  <div class="topbar topbar-content">
1357
  <div class="topbar-content-container">
1358
  <div class="topbar-content-title">
1359
- <?php _e('Instagram Feed by 10Web Premium', WDI_PREFIX); ?>
1360
  </div>
1361
  <div class="topbar-content-body">
1362
  <?php echo esc_html($description); ?>
1363
  </div>
1364
  </div>
1365
  <div class="topbar-content-button-container">
1366
- <a href="<?php echo esc_url($premium_link); ?>" target="_blank" class="topbar-upgrade-button"><?php _e( 'Upgrade',WDI_PREFIX ); ?></a>
1367
  </div>
1368
  </div>
1369
  <?php
@@ -1377,7 +1373,7 @@ class WDILibrary {
1377
  <div class="topbar-links-container">
1378
  <a href="<?php echo esc_url($user_guide_link); ?>" target="_blank" class="topbar_user_guid">
1379
  <div class="topbar-links-item">
1380
- <?php _e('User guide', WDI_PREFIX); ?>
1381
  </div>
1382
  </a>
1383
  </div>
@@ -1391,7 +1387,7 @@ class WDILibrary {
1391
  <a href="<?php echo esc_url($support_forum_link); ?>" target="_blank" class="topbar_support_forum">
1392
  <div class="topbar-links-item">
1393
  <img src="<?php echo esc_url(WDI_URL) . '/images/help.svg'; ?>" class="help_icon" />
1394
- <?php _e('Ask a question', WDI_PREFIX); ?>
1395
  </div>
1396
  </a>
1397
  </div>
@@ -1403,6 +1399,34 @@ class WDILibrary {
1403
  </div>
1404
  </div>
1405
  <?php
 
 
1406
  echo ob_get_clean();
1407
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1408
  }
10
  *
11
  * @param string $key
12
  * @param string $default_value
13
+ * @param string $callback by default sanitize according to "sanitize_text_field"
14
  *
15
  * @return string|array
16
  */
17
  public static function get($key, $default_value = '', $callback = 'sanitize_text_field', $type = 'DEFAULT') {
18
+ //we do nonce verification after get() function call immediately, in part of code, where get() function called
19
+ //we sanitize all input variables in the end of get() function
20
  switch ($type) {
21
  case 'REQUEST' :
22
+ /* phpcs:ignore WordPress.Security.NonceVerification.Recommended */
23
  if (isset($_REQUEST[$key])) {
24
+ /* phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Recommended */
25
  $value = $_REQUEST[$key];
26
  }
27
  break;
28
  case 'DEFAULT' :
29
  case 'POST' :
30
+ /* phpcs:ignore WordPress.Security.NonceVerification.Missing */
31
  if (isset($_POST[$key])) {
32
+ /* phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing */
33
  $value = $_POST[$key];
34
  }
35
  if ( 'POST' === $type ) break;
36
  case 'GET' :
37
+ /* phpcs:ignore WordPress.Security.NonceVerification.Recommended */
38
  if (isset($_GET[$key])) {
39
+ /* phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Recommended */
40
  $value = $_GET[$key];
41
  }
42
  break;
311
  }
312
  </script>
313
  <p class="search-box">
314
+ <input type="search" id="search_value" name="search_value" class="wdi_spider_search_value" onkeypress="return check_search_key(event, this);" value="<?php echo esc_attr($search_value); ?>" style="<?php echo (get_bloginfo('version') > '3.7') ? ' height: 28px;' : ''; ?>" />
315
  <input type="button" value="<?php _e('Search','wd-instagram-feed');?>" onclick="wdi_spider_search()" class="button-secondary action">
316
  </p>
317
  <?php
423
  ?>
424
  <span class="pagination-links">
425
  <?php if($first_prev_page):?>
426
+ <?php
427
+ // WDILibrary::get_pagination_page function returns get_page_link, which in his turn returns escaped data
428
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped?>
429
  <a class="<?php echo esc_attr($first_page); ?>" title="Go to the first page" href="<?php echo WDILibrary::get_pagination_page($items_county , $page_number,-2);?>">«</a>
430
+ <?php
431
+ // WDILibrary::get_pagination_page function returns get_page_link, which in his turn returns escaped data
432
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped?>
433
  <a class="<?php echo esc_attr($prev_page); ?>" title="Go to the previous page" href="<?php echo WDILibrary::get_pagination_page($items_county , $page_number,-1);?>">‹</a>
434
  <?php else:?>
435
  <span class="tablenav-pages-navspan" aria-hidden="true">«</span>
444
  </span>
445
  </span>
446
  <?php if($next_last_page):?>
447
+ <?php
448
+ // WDILibrary::get_pagination_page function returns get_page_link, which in his turn returns escaped data
449
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped?>
450
  <a class="<?php echo esc_attr($next_page) ?>" title="Go to the next page" href="<?php echo WDILibrary::get_pagination_page($items_county , $page_number,1);?>">›</a>
451
+ <?php
452
+ // WDILibrary::get_pagination_page function returns get_page_link, which in his turn returns escaped data
453
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped?>
454
  <a class="<?php echo esc_attr($last_page) ?>" title="Go to the last page" href="<?php echo WDILibrary::get_pagination_page($items_county , $page_number,2);?>">»</a>
455
  <?php else:?>
456
  <span class="tablenav-pages-navspan" aria-hidden="true">›</span>
461
  ?>
462
  </span>
463
  </div>
464
+ <input type="hidden" id="page_number" name="page_number" value="<?php echo esc_attr(self::get('page_number', 1)); ?>" />
465
+ <input type="hidden" id="search_or_not" name="search_or_not" value="<?php echo esc_attr(self::get('search_or_not')); ?>"/>
466
  <?php
467
  }
468
 
540
  </script>
541
  <div class="alignleft actions" style="">
542
  <label for="search_value" style="font-size:14px; width:60px; display:inline-block;"><?php echo esc_html($search_by); ?>:</label>
543
+ <input type="text" id="search_value" name="search_value" class="wdi_spider_search_value" onkeypress="return check_search_key(event, this);" value="<?php echo esc_attr($search_value); ?>" style="width: 150px;<?php echo (get_bloginfo('version') > '3.7') ? ' height: 28px;' : ''; ?>" />
544
  </div>
545
  <div class="alignleft actions">
546
  <input type="button" value="Search" onclick="wdi_spider_search()" class="button-secondary action">
659
  </span>
660
  </div>
661
  <?php if (!$pager) { ?>
662
+ <input type="hidden" id="page_number" name="page_number" value="<?php echo esc_attr(self::get('page_number', 1)); ?>" />
663
+ <input type="hidden" id="search_or_not" name="search_or_not" value="<?php echo esc_attr(self::get('search_or_not')); ?>"/>
664
  <?php
665
  }
666
  }
740
  <div class="wdi_search_container_1" id="wdi_search_container_1_<?php echo esc_attr($current_view); ?>">
741
  <div class="wdi_search_container_2" id="wdi_search_container_2_<?php echo esc_attr($current_view); ?>">
742
  <span class="wdi_search_reset_container" >
743
+ <i title="<?php _e('Reset', 'wd-instagram-feed'); ?>" class="wdi_reset tenweb-i tenweb-i-times" onclick="clear_input_<?php echo esc_attr($current_view); ?>('<?php echo esc_attr($current_view); ?>'),wdi_spider_frontend_ajax('<?php echo esc_attr($form_id); ?>', '<?php echo esc_attr($current_view); ?>', '<?php echo esc_attr($cur_gal_id); ?>', <?php echo esc_attr($album_gallery_id); ?>, '', '<?php echo esc_attr($type); ?>', 1)"></i>
744
  </span>
745
  <span class="wdi_search_loupe_container" >
746
+ <i title="<?php _e('Search', 'wd-instagram-feed'); ?>" class="wdi_search tenweb-i tenweb-i-search" onclick="wdi_spider_frontend_ajax('<?php echo esc_attr($form_id); ?>', '<?php echo esc_attr($current_view); ?>', '<?php echo esc_attr($cur_gal_id); ?>', <?php echo esc_attr($album_gallery_id); ?>, '', '<?php echo esc_attr($type); ?>', 1)"></i>
747
  </span>
748
  <span class="wdi_search_input_container">
749
  <input id="wdi_search_input_<?php echo esc_attr($current_view); ?>" class="wdi_search_input_<?php echo esc_attr($current_view); ?>" type="text" onkeypress="return check_enter_key(event ,this)" name="wdi_search_<?php echo esc_attr($current_view); ?>" value="<?php echo esc_attr($wdi_search); ?>" >
786
  }
787
  </style>
788
  <div class="wdi_order_cont_<?php echo esc_attr($current_view); ?>">
789
+ <span class="wdi_order_label_<?php echo esc_attr($current_view); ?>"><?php _e('Order by: ', 'wd-instagram-feed'); ?></span>
790
  <select class="wdi_order_<?php echo esc_attr($current_view); ?>" onchange="wdi_spider_frontend_ajax('<?php echo esc_attr($form_id); ?>', '<?php echo esc_attr($current_view); ?>', '<?php echo esc_attr($cur_gal_id); ?>', <?php echo esc_attr($album_gallery_id); ?>, '', '<?php echo esc_attr($type); ?>', 1, '', this.value)">
791
+ <option <?php if ($sort_by == 'default') echo 'selected'; ?> value="default"><?php _e('Default', 'wd-instagram-feed'); ?></option>
792
+ <option <?php if ($sort_by == 'filename') echo 'selected'; ?> value="filename"><?php _e('Filename', 'wd-instagram-feed'); ?></option>
793
+ <option <?php if ($sort_by == 'size') echo 'selected'; ?> value="size"><?php _e('Size', 'wd-instagram-feed'); ?></option>
794
+ <option <?php if ($sort_by == 'RAND()') echo 'selected'; ?> value="random"><?php _e('Random', 'wd-instagram-feed'); ?></option>
795
  </select>
796
  </div>
797
  <?php
819
  public static function wdi_spider_redirect( $url = '' ) {
820
  ?>
821
  <script>
822
+ window.location = "<?php echo esc_url_raw($url); ?>";
823
  </script>
824
  <?php
825
  exit();
833
  public static function redirect( $url = array() ) {
834
  $url = html_entity_decode($url);
835
  ?>
836
+ <script>window.location = "<?php echo esc_url_raw($url); ?>";</script>
837
  <?php
838
  exit();
839
  }
924
  }
925
  }
926
  $feed_row['nothing_to_display'] = (empty($new_users_list)) ? '1' : '0';
927
+ $feed_row['feed_users'] = wp_json_encode($new_users_list);
928
  }
929
  return $feed_row;
930
  }
931
 
932
+ /**
933
+ * @param $color
934
+ * @param $named
935
+ * @return false|mixed|string color if valid color, otherwise return false
936
+ */
937
 
938
  public static function regexColor($color, $named) {
939
 
940
  if ($named) {
941
+
942
  $named = array('transparent','aliceblue', 'antiquewhite', 'aqua', 'aquamarine', 'azure', 'beige', 'bisque', 'black', 'blanchedalmond', 'blue', 'blueviolet', 'brown', 'burlywood', 'cadetblue', 'chartreuse', 'chocolate', 'coral', 'cornflowerblue', 'cornsilk', 'crimson', 'cyan', 'darkblue', 'darkcyan', 'darkgoldenrod', 'darkgray', 'darkgreen', 'darkkhaki', 'darkmagenta', 'darkolivegreen', 'darkorange', 'darkorchid', 'darkred', 'darksalmon', 'darkseagreen', 'darkslateblue', 'darkslategray', 'darkturquoise', 'darkviolet', 'deeppink', 'deepskyblue', 'dimgray', 'dodgerblue', 'firebrick', 'floralwhite', 'forestgreen', 'fuchsia', 'gainsboro', 'ghostwhite', 'gold', 'goldenrod', 'gray', 'green', 'greenyellow', 'honeydew', 'hotpink', 'indianred', 'indigo', 'ivory', 'khaki', 'lavender', 'lavenderblush', 'lawngreen', 'lemonchiffon', 'lightblue', 'lightcoral', 'lightcyan', 'lightgoldenrodyellow', 'lightgreen', 'lightgrey', 'lightpink', 'lightsalmon', 'lightseagreen', 'lightskyblue', 'lightslategray', 'lightsteelblue', 'lightyellow', 'lime', 'limegreen', 'linen', 'magenta', 'maroon', 'mediumaquamarine', 'mediumblue', 'mediumorchid', 'mediumpurple', 'mediumseagreen', 'mediumslateblue', 'mediumspringgreen', 'mediumturquoise', 'mediumvioletred', 'midnightblue', 'mintcream', 'mistyrose', 'moccasin', 'navajowhite', 'navy', 'oldlace', 'olive', 'olivedrab', 'orange', 'orangered', 'orchid', 'palegoldenrod', 'palegreen', 'paleturquoise', 'palevioletred', 'papayawhip', 'peachpuff', 'peru', 'pink', 'plum', 'powderblue', 'purple', 'red', 'rosybrown', 'royalblue', 'saddlebrown', 'salmon', 'sandybrown', 'seagreen', 'seashell', 'sienna', 'silver', 'skyblue', 'slateblue', 'slategray', 'snow', 'springgreen', 'steelblue', 'tan', 'teal', 'thistle', 'tomato', 'turquoise', 'violet', 'wheat', 'white', 'whitesmoke', 'yellow', 'yellowgreen');
943
  if (in_array(strtolower($color), $named)) {
944
  /* A color name was entered instead of a Hex Value, so just exit function */
945
  return $color;
946
  }
947
  }
948
+
949
  //checking rgb format
950
  if(self::is_rgb($color) == true){
951
+ return $color;
952
  }
953
  if(substr($color,0,1) == '#' && strlen($color) === 4){
954
  $color.=substr($color,1,strlen($color));
1012
 
1013
  public static function get_page_link( $data ){
1014
  $page = self::get('page');
1015
+ $url = esc_url(add_query_arg(array( 'page' => $page, $data ), admin_url('admin.php')));
1016
  return $url;
1017
  }
1018
 
1031
  return $string;
1032
  }
1033
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1034
  /**
1035
  * Get shortcode data.
1036
  *
1057
  'options' => $gb_row,
1058
  );
1059
 
1060
+ return wp_json_encode($data);
1061
  }
1062
 
1063
  /**
1112
 
1113
  $script = "var $object_name = " . wp_json_encode( $l10n ) . ';';
1114
  $script = "<script>" . $script . "</script>";
1115
+ echo wp_kses($script, array('script' => array()));
1116
  }
1117
 
1118
  public static function elementor_is_active(){
1189
  $url = $instagram_app_config["basic_redirect_uri"];
1190
  }
1191
  elseif ($wdi_user_type === "business"){
1192
+ //wp_remote_get is a native WordPress function
1193
+ /* phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get, WordPress.DB.DirectDatabaseQuery.DirectQuery */
1194
  $wdi_user_data = wp_remote_get('https://graph.facebook.com/v9.0/' . $wdi_user_id . '?fields=id,ig_id,username,name,biography,profile_picture_url,followers_count,follows_count,media_count,website&access_token=' . $wdi_user_token);
1195
  if(!is_wp_error( $wdi_user_data ) && isset($wdi_user_data["body"])){
1196
  $wdi_user_data = json_decode($wdi_user_data["body"], TRUE);
1232
  $wdi_authenticated_users_list[$user_name]["website"] = $wdi_user_data["website"];
1233
  }
1234
  }
1235
+ $wdi_instagram_options["wdi_authenticated_users_list"] = wp_json_encode($wdi_authenticated_users_list);
1236
  $updated = update_option("wdi_instagram_options" , $wdi_instagram_options);
1237
  if($updated){
1238
  delete_option('wdi_token_error_flag');
1352
  <div class="topbar topbar-content">
1353
  <div class="topbar-content-container">
1354
  <div class="topbar-content-title">
1355
+ <?php esc_html_e('Instagram Feed by 10Web Premium', WDI_PREFIX); ?>
1356
  </div>
1357
  <div class="topbar-content-body">
1358
  <?php echo esc_html($description); ?>
1359
  </div>
1360
  </div>
1361
  <div class="topbar-content-button-container">
1362
+ <a href="<?php echo esc_url($premium_link); ?>" target="_blank" class="topbar-upgrade-button"><?php esc_html_e( 'Upgrade',WDI_PREFIX ); ?></a>
1363
  </div>
1364
  </div>
1365
  <?php
1373
  <div class="topbar-links-container">
1374
  <a href="<?php echo esc_url($user_guide_link); ?>" target="_blank" class="topbar_user_guid">
1375
  <div class="topbar-links-item">
1376
+ <?php esc_html_e('User guide', WDI_PREFIX); ?>
1377
  </div>
1378
  </a>
1379
  </div>
1387
  <a href="<?php echo esc_url($support_forum_link); ?>" target="_blank" class="topbar_support_forum">
1388
  <div class="topbar-links-item">
1389
  <img src="<?php echo esc_url(WDI_URL) . '/images/help.svg'; ?>" class="help_icon" />
1390
+ <?php esc_html_e('Ask a question', WDI_PREFIX); ?>
1391
  </div>
1392
  </a>
1393
  </div>
1399
  </div>
1400
  </div>
1401
  <?php
1402
+ // all data already escaped
1403
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1404
  echo ob_get_clean();
1405
  }
1406
+
1407
+ /**
1408
+ * Get user ip.
1409
+ *
1410
+ * @return mixed|void
1411
+ */
1412
+ public static function get_user_ip() {
1413
+ if ( !empty($_SERVER['HTTP_CLIENT_IP']) ) {
1414
+ /* phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized */
1415
+ $ip = sanitize_text_field($_SERVER['HTTP_CLIENT_IP']);
1416
+ }
1417
+ /* phpcs:ignore WordPressVIPMinimum.Variables.ServerVariables.UserControlledHeaders */
1418
+ elseif ( !empty($_SERVER['HTTP_X_FORWARDED_FOR']) ) {
1419
+ /* phpcs:ignore WordPressVIPMinimum.Variables.ServerVariables.UserControlledHeaders */
1420
+ $ip = sanitize_text_field($_SERVER['HTTP_X_FORWARDED_FOR']);
1421
+ }
1422
+ /* phpcs:ignore WordPressVIPMinimum.Variables.ServerVariables.UserControlledHeaders */
1423
+ elseif ( !empty($_SERVER['REMOTE_ADDR']) ) {
1424
+ /* phpcs:ignore WordPressVIPMinimum.Variables.ServerVariables.UserControlledHeaders, WordPressVIPMinimum.Variables.RestrictedVariables.cache_constraints___SERVER__REMOTE_ADDR__ */
1425
+ $ip = sanitize_text_field($_SERVER['REMOTE_ADDR']);
1426
+ } else {
1427
+ $ip = '';
1428
+ }
1429
+
1430
+ return apply_filters('wdi_get_ip', $ip);
1431
+ }
1432
  }
framework/WDILibraryEmbed.php CHANGED
@@ -16,7 +16,6 @@ class WDILibraryEmbed {
16
  * @param attrs: associative array with html attributes and values format e.g. array('width'=>"100px", 'style'=>"display:inline;")
17
  */
18
  public static function display_embed( $embed_type, $embed_id = '', $attrs = array(), $carousel_media = NULL, $url = '' ) {
19
-
20
  $html_to_insert = '';
21
  switch ( $embed_type ) {
22
  case 'EMBED_OEMBED_INSTAGRAM_VIDEO':
@@ -24,14 +23,14 @@ class WDILibraryEmbed {
24
  foreach ( $attrs as $attr => $value ) {
25
  if ( preg_match('/src/i', $attr) === 0 ) {
26
  if ( $attr != '' && $value != '' ) {
27
- $oembed_instagram_html .= ' ' . $attr . '="' . $value . '"';
28
  }
29
  }
30
  }
31
  $oembed_instagram_html .= " >";
32
  if ( $url != '' ) {
33
  $oembed_instagram_html .= '<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls>'.
34
- '<source src="'. $url .
35
  '" type="video/mp4"> Your browser does not support the video tag. </video>';
36
 
37
  }
@@ -43,13 +42,13 @@ class WDILibraryEmbed {
43
  foreach ( $attrs as $attr => $value ) {
44
  if ( preg_match('/src/i', $attr) === 0 ) {
45
  if ( $attr != '' && $value != '' ) {
46
- $oembed_instagram_html .= ' ' . $attr . '="' . $value . '"';
47
  }
48
  }
49
  }
50
  $oembed_instagram_html .= " >";
51
  if ( $url != '' ) {
52
- $oembed_instagram_html .= '<img src="' . $url . '"' . ' style="' . 'max-width:' . '100%' . " !important" . '; max-height:' . '100%' . " !important" . '; width:' . 'auto !important' . '; height:' . 'auto !important' . ';">';
53
  }
54
  $oembed_instagram_html .= "</div>";
55
  $html_to_insert .= $oembed_instagram_html;
@@ -59,17 +58,17 @@ class WDILibraryEmbed {
59
  foreach ( $attrs as $attr => $value ) {
60
  if ( preg_match('/src/i', $attr) === 0 ) {
61
  if ( $attr != '' && $value != '' ) {
62
- $oembed_instagram_html .= ' ' . $attr . '="' . $value . '"';
63
  }
64
  }
65
  }
66
  $oembed_instagram_html .= " >";
67
  foreach ( $carousel_media as $key => $media ) {
68
  if ( $media["type"] == "image" ) {
69
- $oembed_instagram_html .= '<img src="' . $media["images"]["standard_resolution"]["url"] . '"' . ' style="' . 'max-width:' . '100%' . " !important" . '; max-height:' . '100%' . " !important" . '; width:' . 'auto !important' . '; height:' . 'auto !important' . ';" data-id="' . $key . '" class="carousel_media ' . ($key == 0 ? "active" : "") . '">';
70
  }
71
  elseif ( $media["type"] == "video" ) {
72
- $oembed_instagram_html .= '<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls data-id="' . $key . '" class="carousel_media ' . ($key == 0 ? "active" : "") . '">' . '<source src="' . $media["videos"]["standard_resolution"]["url"] . '" type="video/mp4"> Your browser does not support the video tag. </video>';
73
  }
74
  }
75
  $oembed_instagram_html .= "</div>";
@@ -79,6 +78,8 @@ class WDILibraryEmbed {
79
  // code...
80
  break;
81
  }
 
 
82
  echo $html_to_insert;
83
  }
84
  }
16
  * @param attrs: associative array with html attributes and values format e.g. array('width'=>"100px", 'style'=>"display:inline;")
17
  */
18
  public static function display_embed( $embed_type, $embed_id = '', $attrs = array(), $carousel_media = NULL, $url = '' ) {
 
19
  $html_to_insert = '';
20
  switch ( $embed_type ) {
21
  case 'EMBED_OEMBED_INSTAGRAM_VIDEO':
23
  foreach ( $attrs as $attr => $value ) {
24
  if ( preg_match('/src/i', $attr) === 0 ) {
25
  if ( $attr != '' && $value != '' ) {
26
+ $oembed_instagram_html .= ' ' . esc_attr($attr) . '="' . esc_attr($value) . '"';
27
  }
28
  }
29
  }
30
  $oembed_instagram_html .= " >";
31
  if ( $url != '' ) {
32
  $oembed_instagram_html .= '<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls>'.
33
+ '<source src="'. esc_url($url) .
34
  '" type="video/mp4"> Your browser does not support the video tag. </video>';
35
 
36
  }
42
  foreach ( $attrs as $attr => $value ) {
43
  if ( preg_match('/src/i', $attr) === 0 ) {
44
  if ( $attr != '' && $value != '' ) {
45
+ $oembed_instagram_html .= ' ' . esc_attr($attr) . '="' . esc_attr($value) . '"';
46
  }
47
  }
48
  }
49
  $oembed_instagram_html .= " >";
50
  if ( $url != '' ) {
51
+ $oembed_instagram_html .= '<img src="' . esc_url($url) . '"' . ' style="' . 'max-width:' . '100%' . " !important" . '; max-height:' . '100%' . " !important" . '; width:' . 'auto !important' . '; height:' . 'auto !important' . ';">';
52
  }
53
  $oembed_instagram_html .= "</div>";
54
  $html_to_insert .= $oembed_instagram_html;
58
  foreach ( $attrs as $attr => $value ) {
59
  if ( preg_match('/src/i', $attr) === 0 ) {
60
  if ( $attr != '' && $value != '' ) {
61
+ $oembed_instagram_html .= ' ' . esc_attr($attr) . '="' . esc_attr($value) . '"';
62
  }
63
  }
64
  }
65
  $oembed_instagram_html .= " >";
66
  foreach ( $carousel_media as $key => $media ) {
67
  if ( $media["type"] == "image" ) {
68
+ $oembed_instagram_html .= '<img src="' . esc_url($media["images"]["standard_resolution"]["url"]) . '"' . ' style="' . 'max-width:' . '100%' . " !important" . '; max-height:' . '100%' . " !important" . '; width:' . 'auto !important' . '; height:' . 'auto !important' . ';" data-id="' . esc_attr($key) . '" class="carousel_media ' . ($key == 0 ? "active" : "") . '">';
69
  }
70
  elseif ( $media["type"] == "video" ) {
71
+ $oembed_instagram_html .= '<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls data-id="' . esc_attr($key) . '" class="carousel_media ' . ($key == 0 ? "active" : "") . '">' . '<source src="' . esc_url($media["videos"]["standard_resolution"]["url"]) . '" type="video/mp4"> Your browser does not support the video tag. </video>';
72
  }
73
  }
74
  $oembed_instagram_html .= "</div>";
78
  // code...
79
  break;
80
  }
81
+ // We are developing dynamic HTML here where all variables inside output already escaped.
82
+ /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */
83
  echo $html_to_insert;
84
  }
85
  }
framework/WDI_admin_view.php CHANGED
@@ -27,13 +27,19 @@ class WDI_admin_view {
27
  ?>
28
  <div class="wdwt_param" id="wdwt_wrap_<?php echo esc_attr($element['name']); ?>">
29
  <div class="block margin">
30
- <a href="<?php echo esc_url($element['href']); ?>" id="<?php echo esc_attr($element['name']); ?>" class="button" style="text-decoration:none;"><?php echo (isset($element['value']))?esc_html($element['value']):esc_html($element['title']); ?></a>
 
 
 
 
 
 
31
  </div>
32
- <?php if(isset($element['description'])){ ?>
33
- <p style="font-style: italic;"><?php echo $element['description']; ?></p>
34
- <?php } ?>
35
  </div>
36
- <?php
37
  }
38
 
39
  /**
@@ -48,7 +54,7 @@ class WDI_admin_view {
48
  <div class="wdwt_param" id="wdwt_wrap_<?php echo esc_attr($element['name']); ?>">
49
  <div class="block margin">
50
  <div class="optioninput checkbox">
51
- <span id="<?php echo esc_attr($element['name']); ?>" class="button" style="text-decoration:none;"><?php echo esc_html($element['title']); ?></span>
52
  </div>
53
  </div>
54
  <script>
@@ -59,25 +65,23 @@ class WDI_admin_view {
59
  show : [
60
  <?php
61
  foreach ($element['show'] as $element_to_show) :
62
- echo "'". $element_to_show ."', ";
63
  endforeach;
64
  ?>
65
  ],
66
  hide : [
67
  <?php
68
  foreach ($element['hide'] as $element_to_hide) :
69
- echo "'". $element_to_hide ."', ";
70
  endforeach;
71
  ?>
72
  ]
73
  };
74
-
75
  wdwt_elements.button_toggle(element_<?php echo esc_attr($element['name']); ?>);
76
  /*change on click*/
77
  jQuery('#<?php echo esc_attr($element['name']); ?>').on( "click", function() {
78
  wdwt_elements.button_toggle(element_<?php echo esc_attr($element['name']); ?>);
79
  });
80
-
81
  });
82
  </script>
83
  </div>
@@ -148,31 +152,28 @@ class WDI_admin_view {
148
  <script>
149
  jQuery(document).ready(function () {
150
  /*init*/
151
-
152
  var element_<?php echo esc_attr($element['name']); ?> = {
153
  id : "<?php echo esc_attr($element['name']); ?>",
154
  show : [
155
  <?php
156
  foreach ($element['show'] as $element_to_show) :
157
- echo "'". $element_to_show ."', ";
158
- endforeach;
159
  ?>
160
  ],
161
  hide : [
162
  <?php
163
  foreach ($element['hide'] as $element_to_hide) :
164
- echo "'". $element_to_hide ."', ";
165
- endforeach;
166
  ?>
167
  ]
168
  };
169
-
170
  wdwt_elements.checkbox_open(element_<?php echo esc_attr($element['name']); ?>);
171
  /*change on click*/
172
  jQuery('#<?php echo esc_attr($element['name']); ?>').on( "click", function() {
173
  wdwt_elements.checkbox_open(element_<?php echo esc_attr($element['name']); ?>);
174
  });
175
-
176
  });
177
  </script>
178
  <?php
@@ -252,26 +253,22 @@ class WDI_admin_view {
252
  if($opt_val == ''){
253
  $opt_val = isset($element['value']) ? $element['value'] : '';
254
  }
255
-
256
  }
257
-
258
  $input_size = isset($element["input_size"]) ? $element["input_size"] : $this->params["input_size"];
259
-
260
  ?>
261
  <div class="wdwt_param" id="wdwt_wrap_<?php echo esc_attr($element['name']); ?>">
262
  <div class="block">
263
  <div class="optioninput">
264
- <input <?php echo $readonly;?> type=<?php echo isset($element['input_type']) ? esc_attr($element['input_type']) : 'text'?> name="<?php echo esc_attr($optionname); ?>" id="<?php echo esc_attr($element['name']);?>"
265
  <?php echo isset($element['required'])? 'required' : ''; $this->custom_attrs($element); ?>
266
  value="<?php echo esc_attr($opt_val); ?>" size="<?php echo esc_attr($input_size); ?>"
267
- <?php if(isset($element['attr'])) {echo $element['attr']['name'] . '="' .$element["attr"]["value"].'"';} ?>>
268
- <?php
269
  if(isset($element['unit_symbol'])){
270
- echo $element['unit_symbol'];
271
  }
272
- echo isset($element['label']) ? $element['label'] : "";
273
- ?>
274
-
275
  </div>
276
  </div>
277
  </div>
@@ -281,8 +278,9 @@ class WDI_admin_view {
281
  /**
282
  * Displays a group of radio buttons
283
  *
284
- * @param $option['valid options']: ($key => array('title'=>'value', 'description'=>'value'))
285
- * @param $option['default']: one of the keys from 'valid options' as default value
 
286
  */
287
 
288
  public function radio($element, $context = 'option', $opt_val = '', $meta=array()){
@@ -294,7 +292,6 @@ class WDI_admin_view {
294
  $optionname = WDI_OPT.'[' .$element['name']. ']';
295
  $opt_val = $wdi_options[$element['name']];
296
  }
297
-
298
  ?>
299
  <div class="wdwt_param" id="wdwt_wrap_<?php echo esc_attr($element['name']); ?>">
300
  <?php
@@ -302,7 +299,7 @@ class WDI_admin_view {
302
  ?>
303
  <input type="radio" name="<?php echo esc_attr($optionname); ?>" <?php checked( $key, $opt_val ); ?> <?php $this->custom_attrs($element); ?> value="<?php echo esc_attr($key); ?>" /> <?php echo esc_html($option); ?>
304
  <?php
305
- echo isset($element['label']) ? $element['label'] : "";
306
  }
307
  ?>
308
  </div>
@@ -341,18 +338,18 @@ class WDI_admin_view {
341
  jQuery(document).ready(function () {
342
  /*init*/
343
  var element_<?php echo esc_attr($element['name']); ?> = {
344
- name : "<?php echo $optionname; ?>",
345
  show : [
346
  <?php
347
  foreach ($element['show'] as $key => $value) :
348
- echo "{key: '" . $key ."', val: [" ;
349
  if(gettype ($value)=='array'){ /*many items. array of strings of names*/
350
  foreach ($value as $item){
351
- echo "'".$item."',";
352
  }
353
  }
354
  else{/*single item name string */
355
- echo "'".$value."',";
356
  }
357
  echo "]},";
358
  endforeach;
@@ -361,14 +358,14 @@ class WDI_admin_view {
361
  hide : [
362
  <?php
363
  foreach ($element['hide'] as $key => $value) :
364
- echo "{key: '" . $key ."', val: [" ;
365
  if(gettype ($value)=='array'){ /*many items. array of strings of names*/
366
  foreach ($value as $item){
367
- echo "'".$item."',";
368
  }
369
  }
370
  else{/*single item name string */
371
- echo "'".$value."',";
372
  }
373
  echo "]},";
374
  endforeach;
@@ -378,15 +375,13 @@ class WDI_admin_view {
378
 
379
  wdwt_elements.radio_open(element_<?php echo esc_attr($element['name']); ?>);
380
  /*shor or hide on change*/
381
- jQuery('input[type=radio][name="<?php echo $optionname; ?>"]').on( "change", function() {
382
  wdwt_elements.radio_open(element_<?php echo esc_attr($element['name']); ?>);
383
  });
384
 
385
  });
386
  </script>
387
-
388
  <?php
389
-
390
  }
391
 
392
  /**
@@ -456,7 +451,7 @@ class WDI_admin_view {
456
  $img_h = intval($element['img_height']) / sizeof($element['valid_options']);
457
  foreach($element['valid_options'] as $option) { ?>
458
  <div class="sprite_layouts">
459
- <div alt="<?php echo esc_attr($option['title']); ?>" style="width:<?php echo $element['img_width']; ?>px; height:<?php echo $img_h; ?>px; background:url(<?php echo esc_url(WDWT_IMG_INC.$element['img_src']); ?>) no-repeat 0 -<?php echo (intval($option['index'])-1) * $img_h; ?>px;"></div>
460
  <input type="radio" name="<?php echo esc_attr($optionname); ?>" <?php checked( $option['index'], $opt_val ); ?> <?php $this->custom_attrs($element); ?> value="<?php echo intval($option['index']); ?>">
461
  </div>
462
  <?php
@@ -541,8 +536,8 @@ class WDI_admin_view {
541
  ?>
542
  <div class="wdwt_param" id="wdwt_wrap_<?php echo esc_attr($element['name']); ?>">
543
  <div class="block">
544
- <div class="optioninput">
545
- <select name="<?php echo esc_attr($optionname); ?>" id="<?php echo esc_attr($element['name']) ?>" <?php echo $multiple ? 'multiple="multiple"' : ''; ?> <?php $this->custom_attrs($element); ?> style="width:<?php echo $width; ?>px; resize:vertical;">
546
  <?php foreach($element['valid_options'] as $key => $value){ ?>
547
  <option value="<?php echo esc_attr($key) ?>" <?php selected(true, in_array($key, $opt_val)); ?> <?php echo in_array($key, $disabled) ? 'disabled="disabled"' : ''; ?>>
548
  <?php echo esc_html($value); ?>
@@ -578,8 +573,7 @@ class WDI_admin_view {
578
 
579
  ?>
580
  <div class="wdwt_param" id="wdwt_wrap_<?php echo esc_attr($element['name']); ?>">
581
-
582
- <select name="<?php echo esc_attr($optionname); ?>" id="<?php echo esc_attr($element['name']) ?>" <?php echo $multiple ? 'multiple="multiple"' : ''; ?> <?php $this->custom_attrs($element); ?> style="width:<?php echo $width; ?>px; resize:vertical;">
583
  <?php
584
  foreach($element['valid_options'] as $key => $value){ ?>
585
  <option value="<?php echo esc_attr($key); ?>" <?php selected(true, in_array($key, $opt_val)); ?>><?php echo esc_html($value); ?></option>
@@ -598,11 +592,11 @@ class WDI_admin_view {
598
  echo "{key: '" . esc_attr($key) ."', val: [" ;
599
  if(gettype ($value)=='array'){ /*many items. array of strings of names*/
600
  foreach ($value as $item){
601
- echo "'".esc_attr($item)."',";
602
  }
603
  }
604
  else{/*single item name string */
605
- echo "'".esc_attr($value)."',";
606
  }
607
  echo "]},";
608
  endforeach;
@@ -625,9 +619,6 @@ class WDI_admin_view {
625
  ?>
626
  ]
627
  };
628
-
629
-
630
-
631
  wdwt_elements.select_open(element_<?php echo esc_attr($element["name"]); ?>);
632
  /*change on click*/
633
  jQuery('#<?php echo esc_attr($element["name"]); ?>').on( "change", function() {
@@ -674,7 +665,6 @@ class WDI_admin_view {
674
  <script>
675
  jQuery(document).ready(function () {
676
  /*init*/
677
-
678
  var element_<?php echo esc_attr($element["name"]); ?> = {
679
  id : "<?php echo esc_attr($element["name"]); ?>",
680
  text_preview : "<?php echo esc_attr($element['text_preview']); ?>",
@@ -686,22 +676,18 @@ class WDI_admin_view {
686
  jQuery('#<?php echo esc_attr($element["name"]); ?>').on( "change", function() {
687
  wdwt_elements.select_style(element_<?php echo esc_attr($element["name"]); ?>);
688
  });
689
-
690
  });
691
  </script>
692
  <?php
693
  endif;
694
  }
695
 
696
-
697
-
698
  /**
699
  * Displays single textarea field
700
  *
701
  * @param $params["textarea_height"] and $params["textarea_width"]
702
  *
703
  */
704
-
705
  public function textarea($element, $context='option', $opt_val='', $meta=array()){
706
 
707
  if($context== 'meta'){
@@ -724,35 +710,29 @@ class WDI_admin_view {
724
  </div>
725
  </div>
726
  <?php
727
-
728
  }
729
-
730
-
731
-
732
 
733
  /**
734
  * displays a preview text in typography page
735
  * @param $element['modified_by'] = array('home_font_weight' => 'font-weight')
736
  *
737
  */
738
-
739
  public function text_preview($element, $context='option', $opt_val='', $meta=array()){
740
  global $wdi_options;
741
  ?>
742
-
743
  <div class="font_preview_wrap" id="wdwt_wrap_<?php echo esc_attr($element['name']); ?>">
744
- <label class="typagrphy_label" for="" style="font-size:18px;font-size: 20px;font-family: Segoe UI;"><?php echo __('Preview', WDWT_LANG ); ?></label>
745
  <div class="font_preview">
746
- <div class="optioninput-preview" id="<?php echo esc_attr($element['name']); ?>" style="margin-top: 14px; margin-bottom: 23px;" ><?php
 
747
  $theme = wp_get_theme();
748
  echo esc_html($theme->description);
749
- ?></div>
 
750
  </div>
751
  </div>
752
  <?php
753
  }
754
-
755
-
756
 
757
  /**
758
  * Displays an upload with single input field for filename
@@ -803,10 +783,8 @@ class WDI_admin_view {
803
 
804
  /*setup the var*/
805
  jQuery('#uploader_<?php echo esc_attr($element['name']); ?>').on('click', function () {
806
-
807
  window.parent.uploadID = jQuery(this).prev('#<?php echo esc_attr($element['name']); ?>');
808
  /*grab the specific input*/
809
- /*formfield = jQuery('.upload').attr('name');*/
810
  tb_show('', 'media-upload.php?type=<?php echo esc_attr($filetype);?>&amp;TB_iframe=true');
811
  return false;
812
  });
@@ -818,8 +796,6 @@ class WDI_admin_view {
818
  window.parent.uploadID.change();
819
  tb_remove();
820
  };
821
-
822
- /*jQuery(".slide_tab").prev().parent().prev().css("display","none");*/
823
  });
824
  </script>
825
  <div class="wdwt_param" id="wdwt_wrap_<?php echo esc_attr($element['name']); ?>">
@@ -828,8 +804,7 @@ class WDI_admin_view {
828
  <input class="upload-button button" type="button" id="uploader_<?php echo esc_attr($element['name']); ?>" value="<?php esc_attr_e('Upload Image', WDWT_LANG); ?>"/>
829
  </div>
830
  </div>
831
- <?php
832
-
833
  }
834
 
835
 
@@ -845,8 +820,6 @@ class WDI_admin_view {
845
  *
846
  * for the slider!!!
847
  */
848
-
849
-
850
  public function upload_multiple($element, $context='', $opt_val='', $meta=array()){
851
  if($context== 'meta'){
852
  $optionname = WDI_META.'[' .$element['name']. ']';
@@ -997,10 +970,6 @@ class WDI_admin_view {
997
  <?php
998
  }
999
 
1000
-
1001
-
1002
-
1003
-
1004
  /**
1005
  * Displays a select with color theme options which allows to select active theme
1006
  *
@@ -1057,7 +1026,7 @@ class WDI_admin_view {
1057
  <?php
1058
  foreach ($opt_val['colors'][$i] as $color_name => $color){
1059
  ?>
1060
- theme_colors["<?php echo $color_name; ?>"] = { name: "<?php echo esc_attr($color_name); ?>", val: "<?php echo esc_attr($color['value']); ?>", def: "<?php echo esc_attr($color['default']); ?>"};
1061
  <?php
1062
  }
1063
  /*add colors of every theme to variable */
@@ -1106,7 +1075,7 @@ class WDI_admin_view {
1106
  <span class="wdwt_color_title"><?php echo esc_html($element['color_names'][$color_name]); ?></span>
1107
  <div>
1108
  <input type="text" class="hidden_field" id="default_<?php echo esc_attr($element['name'].'_'.$color_name); ?>" hidden='hidden' name="<?php echo esc_attr($optionname.'[colors]['.$color_name.']'.'[default]'); ?>" value="<?php echo esc_attr($color['default']); ?>">
1109
- <input type="text" class='color_input' id="value_<?php echo esc_attr($element['name'].'_'.$color_name); ?>" name="<?php echo esc_attr($optionname.'[colors]['.$color_name.']'.'[value]'); ?>" value="<?php echo esc_attr($color['value']); ?>" data-default-color="<?php echo esc_attr($color['default']); ?>" style="background-color:<?php echo $color['value']; ?>;">
1110
  </div>
1111
  </div>
1112
  <?php endforeach; ?>
@@ -1114,21 +1083,16 @@ class WDI_admin_view {
1114
  <script type="text/javascript">
1115
  jQuery(document).ready(function() {
1116
  jQuery('.color_input').wpColorPicker();
1117
-
1118
-
1119
  });
1120
  </script>
1121
  <?php
1122
  }
1123
 
1124
-
1125
  /**
1126
  * Displays a diagram with
1127
  * input fields for title and percent
1128
  * colors and other options are given separately, type (horizonral, circular etc. ...)
1129
  */
1130
-
1131
-
1132
  public function diagram($element, $context='', $opt_val='', $meta=array()){
1133
  if($context== 'meta'){
1134
  $optionname = WDI_META.'[' .$element['name']. ']';
@@ -1231,7 +1195,7 @@ class WDI_admin_view {
1231
  }
1232
  ?>
1233
  <script type="text/javascript">
1234
- var items_county = <?php echo $items_county; ?>;
1235
  function wdi_spider_page(x, y) {
1236
  switch (y) {
1237
  case 1:
@@ -1259,7 +1223,7 @@ class WDI_admin_view {
1259
  default:
1260
  document.getElementById('page_number').value = 1;
1261
  }
1262
- document.getElementById('<?php echo $form_id; ?>').submit();
1263
  }
1264
  function check_enter_key(e) {
1265
  var key_code = (e.keyCode ? e.keyCode : e.which);
@@ -1270,7 +1234,7 @@ class WDI_admin_view {
1270
  else {
1271
  document.getElementById('page_number').value = jQuery('#current_page').val();
1272
  }
1273
- document.getElementById('<?php echo $form_id; ?>').submit();
1274
  }
1275
  return true;
1276
  }
@@ -1278,8 +1242,8 @@ class WDI_admin_view {
1278
  <div class="tablenav-pages">
1279
  <span class="displaying-num">
1280
  <?php
1281
- if ($count_items != 0) {
1282
- echo $count_items; ?> item<?php echo (($count_items == 1) ? '' : 's');
1283
  }
1284
  ?>
1285
  </span>
@@ -1303,25 +1267,25 @@ class WDI_admin_view {
1303
  }
1304
  ?>
1305
  <span class="pagination-links">
1306
- <a class="<?php echo esc_attr($first_page); ?>" title="Go to the first page" href="javascript:wdi_spider_page(<?php echo $page_number; ?>,-2);">«</a>
1307
- <a class="<?php echo esc_attr($prev_page); ?>" title="Go to the previous page" href="javascript:wdi_spider_page(<?php echo $page_number; ?>,-1);">‹</a>
1308
  <span class="paging-input">
1309
  <span class="total-pages">
1310
- <input class="current_page" id="current_page" name="current_page" value="<?php echo esc_attr($page_number); ?>" onkeypress="return check_enter_key(event)" title="Go to the page" type="text" size="1" />
1311
  </span> of
1312
  <span class="total-pages">
1313
  <?php echo esc_html($items_county); ?>
1314
  </span>
1315
  </span>
1316
- <a class="<?php echo esc_attr($next_page); ?>" title="Go to the next page" href="javascript:wdi_spider_page(<?php echo $page_number; ?>,1);">›</a>
1317
- <a class="<?php echo esc_attr($last_page); ?>" title="Go to the last page" href="javascript:wdi_spider_page(<?php echo $page_number; ?>,2);">»</a>
1318
  <?php
1319
  }
1320
  ?>
1321
  </span>
1322
  </div>
1323
- <input type="hidden" id="page_number" name="page_number" value="<?php echo WDILibrary::get('page_number', 1, 'intval'); ?>" />
1324
- <input type="hidden" id="search_or_not" name="search_or_not" value="<?php echo WDILibrary::get('search_or_not', ''); ?>"/>
1325
  <?php
1326
  }
1327
 
@@ -1349,21 +1313,19 @@ class WDI_admin_view {
1349
  /**
1350
  * get posts and categories createdwith checkboxes
1351
  */
1352
- protected function get_old_posts_cats($val){
1353
-
1354
  $value = $val;
1355
- $val = json_decode( $val , true );
1356
  $result = array();
1357
-
1358
- if( $val == NULL ){
1359
- if(is_string($value)){
1360
  $result = explode(",", $value);
1361
- }
1362
- } else {
 
1363
  $result = $val;
1364
  }
 
1365
  return $result;
1366
-
1367
  }
1368
- }
1369
- ?>
27
  ?>
28
  <div class="wdwt_param" id="wdwt_wrap_<?php echo esc_attr($element['name']); ?>">
29
  <div class="block margin">
30
+ <?php
31
+ $element_title = $element['title'];
32
+ if ( isset($element['value']) && !empty($element['value']) ) {
33
+ $element_title = $element['value'];
34
+ }
35
+ ?>
36
+ <a href="<?php echo esc_url($element['href']); ?>" id="<?php echo esc_attr($element['name']); ?>" class="button" style="text-decoration:none;"><?php echo esc_html($element_title); ?></a>
37
  </div>
38
+ <?php if(isset($element['description'])){ ?>
39
+ <p style="font-style: italic;"><?php echo esc_html($element['description']); ?></p>
40
+ <?php } ?>
41
  </div>
42
+ <?php
43
  }
44
 
45
  /**
54
  <div class="wdwt_param" id="wdwt_wrap_<?php echo esc_attr($element['name']); ?>">
55
  <div class="block margin">
56
  <div class="optioninput checkbox">
57
+ <span id="<?php echo esc_attr($element['name']); ?>" class="button" style="text-decoration:none;"><?php echo esc_html($element['title']); ?></span>
58
  </div>
59
  </div>
60
  <script>
65
  show : [
66
  <?php
67
  foreach ($element['show'] as $element_to_show) :
68
+ echo "'". esc_html($element_to_show) ."', ";
69
  endforeach;
70
  ?>
71
  ],
72
  hide : [
73
  <?php
74
  foreach ($element['hide'] as $element_to_hide) :
75
+ echo "'". esc_html($element_to_hide) ."', ";
76
  endforeach;
77
  ?>
78
  ]
79
  };
 
80
  wdwt_elements.button_toggle(element_<?php echo esc_attr($element['name']); ?>);
81
  /*change on click*/
82
  jQuery('#<?php echo esc_attr($element['name']); ?>').on( "click", function() {
83
  wdwt_elements.button_toggle(element_<?php echo esc_attr($element['name']); ?>);
84
  });
 
85
  });
86
  </script>
87
  </div>
152
  <script>
153
  jQuery(document).ready(function () {
154
  /*init*/
 
155
  var element_<?php echo esc_attr($element['name']); ?> = {
156
  id : "<?php echo esc_attr($element['name']); ?>",
157
  show : [
158
  <?php
159
  foreach ($element['show'] as $element_to_show) :
160
+ echo "'". esc_html($element_to_show) ."', ";
161
+ endforeach;
162
  ?>
163
  ],
164
  hide : [
165
  <?php
166
  foreach ($element['hide'] as $element_to_hide) :
167
+ echo "'". esc_html($element_to_hide) ."', ";
168
+ endforeach;
169
  ?>
170
  ]
171
  };
 
172
  wdwt_elements.checkbox_open(element_<?php echo esc_attr($element['name']); ?>);
173
  /*change on click*/
174
  jQuery('#<?php echo esc_attr($element['name']); ?>').on( "click", function() {
175
  wdwt_elements.checkbox_open(element_<?php echo esc_attr($element['name']); ?>);
176
  });
 
177
  });
178
  </script>
179
  <?php
253
  if($opt_val == ''){
254
  $opt_val = isset($element['value']) ? $element['value'] : '';
255
  }
 
256
  }
 
257
  $input_size = isset($element["input_size"]) ? $element["input_size"] : $this->params["input_size"];
 
258
  ?>
259
  <div class="wdwt_param" id="wdwt_wrap_<?php echo esc_attr($element['name']); ?>">
260
  <div class="block">
261
  <div class="optioninput">
262
+ <input <?php echo esc_attr($readonly);?> type=<?php echo esc_attr(isset($element['input_type']) ? $element['input_type'] : 'text')?> name="<?php echo esc_attr($optionname); ?>" id="<?php echo esc_attr($element['name']);?>"
263
  <?php echo isset($element['required'])? 'required' : ''; $this->custom_attrs($element); ?>
264
  value="<?php echo esc_attr($opt_val); ?>" size="<?php echo esc_attr($input_size); ?>"
265
+ <?php if(isset($element['attr'])) {echo esc_attr($element['attr']['name'] . '="' .$element["attr"]["value"].'"');} ?>>
266
+ <?php
267
  if(isset($element['unit_symbol'])){
268
+ echo esc_html($element['unit_symbol']);
269
  }
270
+ echo esc_html(isset($element['label']) ? $element['label'] : "");
271
+ ?>
 
272
  </div>
273
  </div>
274
  </div>
278
  /**
279
  * Displays a group of radio buttons
280
  *
281
+ * $option arguments
282
+ * @param valid options // ($key => array('title'=>'value', 'description'=>'value'))
283
+ * @param default // one of the keys from 'valid options' as default value
284
  */
285
 
286
  public function radio($element, $context = 'option', $opt_val = '', $meta=array()){
292
  $optionname = WDI_OPT.'[' .$element['name']. ']';
293
  $opt_val = $wdi_options[$element['name']];
294
  }
 
295
  ?>
296
  <div class="wdwt_param" id="wdwt_wrap_<?php echo esc_attr($element['name']); ?>">
297
  <?php
299
  ?>
300
  <input type="radio" name="<?php echo esc_attr($optionname); ?>" <?php checked( $key, $opt_val ); ?> <?php $this->custom_attrs($element); ?> value="<?php echo esc_attr($key); ?>" /> <?php echo esc_html($option); ?>
301
  <?php
302
+ echo esc_html(isset($element['label']) ? $element['label'] : "");
303
  }
304
  ?>
305
  </div>
338
  jQuery(document).ready(function () {
339
  /*init*/
340
  var element_<?php echo esc_attr($element['name']); ?> = {
341
+ name : "<?php echo esc_attr($optionname); ?>",
342
  show : [
343
  <?php
344
  foreach ($element['show'] as $key => $value) :
345
+ echo "{key: '" . esc_attr($key) . "', val: [" ;
346
  if(gettype ($value)=='array'){ /*many items. array of strings of names*/
347
  foreach ($value as $item){
348
+ echo "'". esc_attr($item) ."',";
349
  }
350
  }
351
  else{/*single item name string */
352
+ echo "'". esc_attr($value) . "',";
353
  }
354
  echo "]},";
355
  endforeach;
358
  hide : [
359
  <?php
360
  foreach ($element['hide'] as $key => $value) :
361
+ echo "{key: '" . esc_attr($key) ."', val: [" ;
362
  if(gettype ($value)=='array'){ /*many items. array of strings of names*/
363
  foreach ($value as $item){
364
+ echo "'". esc_attr($item) ."',";
365
  }
366
  }
367
  else{/*single item name string */
368
+ echo "'". esc_attr($value) ."',";
369
  }
370
  echo "]},";
371
  endforeach;
375
 
376
  wdwt_elements.radio_open(element_<?php echo esc_attr($element['name']); ?>);
377
  /*shor or hide on change*/
378
+ jQuery('input[type=radio][name="<?php echo esc_attr($optionname); ?>"]').on( "change", function() {
379
  wdwt_elements.radio_open(element_<?php echo esc_attr($element['name']); ?>);
380
  });
381
 
382
  });
383
  </script>
 
384
  <?php
 
385
  }
386
 
387
  /**
451
  $img_h = intval($element['img_height']) / sizeof($element['valid_options']);
452
  foreach($element['valid_options'] as $option) { ?>
453
  <div class="sprite_layouts">
454
+ <div alt="<?php echo esc_attr($option['title']); ?>" style="width:<?php echo esc_attr($element['img_width']); ?>px; height:<?php echo esc_attr($img_h); ?>px; background:url(<?php echo esc_url(WDWT_IMG_INC.$element['img_src']); ?>) no-repeat 0 -<?php echo (intval($option['index'])-1) * $img_h; ?>px;"></div>
455
  <input type="radio" name="<?php echo esc_attr($optionname); ?>" <?php checked( $option['index'], $opt_val ); ?> <?php $this->custom_attrs($element); ?> value="<?php echo intval($option['index']); ?>">
456
  </div>
457
  <?php
536
  ?>
537
  <div class="wdwt_param" id="wdwt_wrap_<?php echo esc_attr($element['name']); ?>">
538
  <div class="block">
539
+ <div class="optioninput">
540
+ <select name="<?php echo esc_attr($optionname); ?>" id="<?php echo esc_attr($element['name']) ?>" <?php echo esc_attr(($multiple) ? 'multiple="multiple"' : ''); ?> <?php $this->custom_attrs($element); ?> style="width:<?php echo esc_attr($width); ?>px; resize:vertical;">
541
  <?php foreach($element['valid_options'] as $key => $value){ ?>
542
  <option value="<?php echo esc_attr($key) ?>" <?php selected(true, in_array($key, $opt_val)); ?> <?php echo in_array($key, $disabled) ? 'disabled="disabled"' : ''; ?>>
543
  <?php echo esc_html($value); ?>
573
 
574
  ?>
575
  <div class="wdwt_param" id="wdwt_wrap_<?php echo esc_attr($element['name']); ?>">
576
+ <select name="<?php echo esc_attr($optionname); ?>" id="<?php echo esc_attr($element['name']) ?>" <?php echo esc_attr($multiple ? 'multiple="multiple"' : ''); ?> <?php $this->custom_attrs($element); ?> style="width:<?php echo esc_attr($width); ?>px; resize:vertical;">
 
577
  <?php
578
  foreach($element['valid_options'] as $key => $value){ ?>
579
  <option value="<?php echo esc_attr($key); ?>" <?php selected(true, in_array($key, $opt_val)); ?>><?php echo esc_html($value); ?></option>
592
  echo "{key: '" . esc_attr($key) ."', val: [" ;
593
  if(gettype ($value)=='array'){ /*many items. array of strings of names*/
594
  foreach ($value as $item){
595
+ echo "'". esc_attr($item) ."',";
596
  }
597
  }
598
  else{/*single item name string */
599
+ echo "'". esc_attr($value) ."',";
600
  }
601
  echo "]},";
602
  endforeach;
619
  ?>
620
  ]
621
  };
 
 
 
622
  wdwt_elements.select_open(element_<?php echo esc_attr($element["name"]); ?>);
623
  /*change on click*/
624
  jQuery('#<?php echo esc_attr($element["name"]); ?>').on( "change", function() {
665
  <script>
666
  jQuery(document).ready(function () {
667
  /*init*/
 
668
  var element_<?php echo esc_attr($element["name"]); ?> = {
669
  id : "<?php echo esc_attr($element["name"]); ?>",
670
  text_preview : "<?php echo esc_attr($element['text_preview']); ?>",
676
  jQuery('#<?php echo esc_attr($element["name"]); ?>').on( "change", function() {
677
  wdwt_elements.select_style(element_<?php echo esc_attr($element["name"]); ?>);
678
  });
 
679
  });
680
  </script>
681
  <?php
682
  endif;
683
  }
684
 
 
 
685
  /**
686
  * Displays single textarea field
687
  *
688
  * @param $params["textarea_height"] and $params["textarea_width"]
689
  *
690
  */
 
691
  public function textarea($element, $context='option', $opt_val='', $meta=array()){
692
 
693
  if($context== 'meta'){
710
  </div>
711
  </div>
712
  <?php
 
713
  }
 
 
 
714
 
715
  /**
716
  * displays a preview text in typography page
717
  * @param $element['modified_by'] = array('home_font_weight' => 'font-weight')
718
  *
719
  */
 
720
  public function text_preview($element, $context='option', $opt_val='', $meta=array()){
721
  global $wdi_options;
722
  ?>
 
723
  <div class="font_preview_wrap" id="wdwt_wrap_<?php echo esc_attr($element['name']); ?>">
724
+ <label class="typagrphy_label" for="" style="font-size:18px;font-size: 20px;font-family: Segoe UI;"><?php _e('Preview', 'wd-instagram-feed'); ?></label>
725
  <div class="font_preview">
726
+ <div class="optioninput-preview" id="<?php echo esc_attr($element['name']); ?>" style="margin-top: 14px; margin-bottom: 23px;">
727
+ <?php
728
  $theme = wp_get_theme();
729
  echo esc_html($theme->description);
730
+ ?>
731
+ </div>
732
  </div>
733
  </div>
734
  <?php
735
  }
 
 
736
 
737
  /**
738
  * Displays an upload with single input field for filename
783
 
784
  /*setup the var*/
785
  jQuery('#uploader_<?php echo esc_attr($element['name']); ?>').on('click', function () {
 
786
  window.parent.uploadID = jQuery(this).prev('#<?php echo esc_attr($element['name']); ?>');
787
  /*grab the specific input*/
 
788
  tb_show('', 'media-upload.php?type=<?php echo esc_attr($filetype);?>&amp;TB_iframe=true');
789
  return false;
790
  });
796
  window.parent.uploadID.change();
797
  tb_remove();
798
  };
 
 
799
  });
800
  </script>
801
  <div class="wdwt_param" id="wdwt_wrap_<?php echo esc_attr($element['name']); ?>">
804
  <input class="upload-button button" type="button" id="uploader_<?php echo esc_attr($element['name']); ?>" value="<?php esc_attr_e('Upload Image', WDWT_LANG); ?>"/>
805
  </div>
806
  </div>
807
+ <?php
 
808
  }
809
 
810
 
820
  *
821
  * for the slider!!!
822
  */
 
 
823
  public function upload_multiple($element, $context='', $opt_val='', $meta=array()){
824
  if($context== 'meta'){
825
  $optionname = WDI_META.'[' .$element['name']. ']';
970
  <?php
971
  }
972
 
 
 
 
 
973
  /**
974
  * Displays a select with color theme options which allows to select active theme
975
  *
1026
  <?php
1027
  foreach ($opt_val['colors'][$i] as $color_name => $color){
1028
  ?>
1029
+ theme_colors["<?php echo esc_attr($color_name); ?>"] = { name: "<?php echo esc_attr($color_name); ?>", val: "<?php echo esc_attr($color['value']); ?>", def: "<?php echo esc_attr($color['default']); ?>"};
1030
  <?php
1031
  }
1032
  /*add colors of every theme to variable */
1075
  <span class="wdwt_color_title"><?php echo esc_html($element['color_names'][$color_name]); ?></span>
1076
  <div>
1077
  <input type="text" class="hidden_field" id="default_<?php echo esc_attr($element['name'].'_'.$color_name); ?>" hidden='hidden' name="<?php echo esc_attr($optionname.'[colors]['.$color_name.']'.'[default]'); ?>" value="<?php echo esc_attr($color['default']); ?>">
1078
+ <input type="text" class='color_input' id="value_<?php echo esc_attr($element['name'].'_'.$color_name); ?>" name="<?php echo esc_attr($optionname.'[colors]['.$color_name.']'.'[value]'); ?>" value="<?php echo esc_attr($color['value']); ?>" data-default-color="<?php echo esc_attr($color['default']); ?>" style="background-color:<?php echo esc_attr($color['value']); ?>;">
1079
  </div>
1080
  </div>
1081
  <?php endforeach; ?>
1083
  <script type="text/javascript">
1084
  jQuery(document).ready(function() {
1085
  jQuery('.color_input').wpColorPicker();
 
 
1086
  });
1087
  </script>
1088
  <?php
1089
  }
1090
 
 
1091
  /**
1092
  * Displays a diagram with
1093
  * input fields for title and percent
1094
  * colors and other options are given separately, type (horizonral, circular etc. ...)
1095
  */
 
 
1096
  public function diagram($element, $context='', $opt_val='', $meta=array()){
1097
  if($context== 'meta'){
1098
  $optionname = WDI_META.'[' .$element['name']. ']';
1195
  }
1196
  ?>
1197
  <script type="text/javascript">
1198
+ var items_county = <?php echo esc_attr($items_county); ?>;
1199
  function wdi_spider_page(x, y) {
1200
  switch (y) {
1201
  case 1:
1223
  default:
1224
  document.getElementById('page_number').value = 1;
1225
  }
1226
+ document.getElementById('<?php echo esc_attr($form_id); ?>').submit();
1227
  }
1228
  function check_enter_key(e) {
1229
  var key_code = (e.keyCode ? e.keyCode : e.which);
1234
  else {
1235
  document.getElementById('page_number').value = jQuery('#current_page').val();
1236
  }
1237
+ document.getElementById('<?php echo esc_attr($form_id); ?>').submit();
1238
  }
1239
  return true;
1240
  }
1242
  <div class="tablenav-pages">
1243
  <span class="displaying-num">
1244
  <?php
1245
+ if ( $count_items != 0 ) {
1246
+ echo intval($count_items); ?> item<?php echo (($count_items == 1) ? '' : 's');
1247
  }
1248
  ?>
1249
  </span>
1267
  }
1268
  ?>
1269
  <span class="pagination-links">
1270
+ <a class="<?php echo esc_attr($first_page); ?>" title="Go to the first page" href="javascript:wdi_spider_page(<?php echo intval($page_number); ?>,-2);">«</a>
1271
+ <a class="<?php echo esc_attr($prev_page); ?>" title="Go to the previous page" href="javascript:wdi_spider_page(<?php echo intval($page_number); ?>,-1);">‹</a>
1272
  <span class="paging-input">
1273
  <span class="total-pages">
1274
+ <input class="current_page" id="current_page" name="current_page" value="<?php echo intval($page_number); ?>" onkeypress="return check_enter_key(event)" title="Go to the page" type="text" size="1" />
1275
  </span> of
1276
  <span class="total-pages">
1277
  <?php echo esc_html($items_county); ?>
1278
  </span>
1279
  </span>
1280
+ <a class="<?php echo esc_attr($next_page); ?>" title="Go to the next page" href="javascript:wdi_spider_page(<?php echo intval($page_number); ?>,1);">›</a>
1281
+ <a class="<?php echo esc_attr($last_page); ?>" title="Go to the last page" href="javascript:wdi_spider_page(<?php echo intval($page_number); ?>,2);">»</a>
1282
  <?php
1283
  }
1284
  ?>
1285
  </span>
1286
  </div>
1287
+ <input type="hidden" id="page_number" name="page_number" value="<?php echo intval(WDILibrary::get('page_number', 1, 'intval')); ?>" />
1288
+ <input type="hidden" id="search_or_not" name="search_or_not" value="<?php echo esc_attr(WDILibrary::get('search_or_not', '')); ?>"/>
1289
  <?php
1290
  }
1291
 
1313
  /**
1314
  * get posts and categories createdwith checkboxes
1315
  */
1316
+ protected function get_old_posts_cats( $val ) {
 
1317
  $value = $val;
1318
+ $val = json_decode($val, TRUE);
1319
  $result = array();
1320
+ if ( $val == NULL ) {
1321
+ if ( is_string($value) ) {
 
1322
  $result = explode(",", $value);
1323
+ }
1324
+ }
1325
+ else {
1326
  $result = $val;
1327
  }
1328
+
1329
  return $result;
 
1330
  }
1331
+ }
 
framework/WDI_form_builder.php CHANGED
@@ -5,23 +5,23 @@ public function __construct() {
5
  }
6
 
7
  /*
8
- * $element['name']
9
- * $element['id'] //default is WDI_.$element_name
10
- * $element['type'] //text,number ...
11
- * $element['attr'] //custom attribute array(array('name'=>'attr_name','value'=>'attr_value'),...)
12
- * $element['input_size']
13
- * $element['label'] // array('text','place')
14
- * $element['defaults'] //array of default vlaues
15
- * $element['CONST'] //variable to store data in array
 
16
  */
17
  public function input($element,$feed_row=''){
18
  $name = $element['CONST'].'['.(isset($element['name']) ? $element['name'] : 'NOT_SET') . ']';
19
  $id = isset($element['id']) ? $element['id'] : 'WDI_'.$element['name'];
20
  $type = isset($element['input_type']) ? $element['input_type'] : 'text';
21
- //$attrText = $element['attr']['name'] . '=' . $element['attr']['value'];
22
  $attrs = ' ';
23
  foreach ($element['attr'] as $attr) {
24
- $attrs .= $attr['name'] . '="' . $attr['value'] . '" ';
25
  }
26
  $attr = $attrs;
27
 
@@ -33,13 +33,10 @@ public function __construct() {
33
  if($current_settings !=''){
34
  $value = isset($current_settings[$element['name']]) ? $current_settings[$element['name']] : '';
35
  }
36
-
37
-
38
  ?>
39
  <div class="wdwt_param" id="WDI_wrap_<?php echo esc_attr($element['name']); ?>">
40
  <div class="block">
41
  <div class="optioninput">
42
-
43
  <?php
44
  if($label!='' && $label['place']=='before'){
45
  ?>
@@ -48,9 +45,11 @@ public function __construct() {
48
  <?php
49
  }
50
  ?>
51
-
52
  <input type="<?php echo esc_attr($type); ?>" id="<?php echo esc_attr($id); ?>" name="<?php echo esc_attr($name); ?>" value="<?php echo esc_attr($value); ?>"
53
- <?php echo $attr; ?> size="<?php echo esc_attr($input_size); ?>">
 
 
 
54
  <?php
55
  if($label!='' && $label['place']=='after'){
56
  ?>
@@ -58,7 +57,6 @@ public function __construct() {
58
  <label for="<?php echo esc_attr($id); ?>"><?php echo esc_html($label['text']); ?></label>
59
  <?php
60
  }
61
-
62
  ?>
63
  </div>
64
  </div>
@@ -67,22 +65,22 @@ public function __construct() {
67
  }
68
 
69
  /*
70
- * $element['name']
71
- * $element['id'] //default is WDI_.$element_name
72
- * $element['type'] //multiple
73
- * $element['attr'] //custom attribute array(array('name'=>'attr_name','value'=>'attr_value'),...)
74
- * $element['label'] // array('text','place')
75
- * $element['valid_options'] //array('option_value1'=>'option_name1','option_value2'=>'option_name2');
76
- * $element['width']
77
- * $element['selected'] //one of valid options
78
- * $element['defaults'] //array of default vlaues
79
- * $element['CONST'] //variable to store data in array
 
80
  */
81
  public function select($element,$feed_row=''){
82
  $name = $element['CONST'].'['.(isset($element['name']) ? $element['name'] : 'NOT_SET') . ']';
83
  $id = isset($element['id']) ? $element['id'] : 'WDI_'.$element['name'];
84
  $type = isset($element['type']) ? $element['type'] : '';
85
- //$attr = isset($element['attr']) ? $element['attr']['name'] . '="' . $element['attr']['value'].'"' : '';
86
  $label = isset($element['label']) ? $element['label'] : '';
87
  $width = isset($element['width']) ? ($element['width']) : '';
88
  $options = isset($element['valid_options']) ? $element['valid_options'] : '';
@@ -107,36 +105,35 @@ public function __construct() {
107
  <div class="block">
108
  <div class="optioninput">
109
  <?php
110
- if($label!='' && $label['place']=='before'){
111
- ?>
112
- <label for="<?php echo esc_attr($id); ?>"><?php echo esc_html($label['text']); ?></label>
113
- <?php echo isset($label['br']) ? '<br/>' : ''?>
114
- <?php
115
- }
116
- ?>
117
- <select name="<?php echo esc_attr($name); ?>" id="<?php echo esc_attr($id); ?>" <?php echo esc_attr($switched); ?> <?php echo esc_attr($type); ?> style="<?php if($width!='') echo 'width:' .esc_attr($width) . ';';?> resize:vertical;" <?php echo $attr; ?>>
118
-
 
 
119
  <?php foreach($options as $key => $value){ ?>
120
  <option <?php echo (in_array($key, $disabled_options)) ? 'disabled' : '' ?> value="<?php echo esc_attr($key) ?>" <?php if($key==$opt_value){echo 'selected';}?>>
121
  <?php echo esc_html($value); ?>
122
  </option>
123
  <?php } ?>
124
  </select>
125
- <?php
126
-
127
  if($label!='' && $label['place']=='after'){
128
-
129
- ?>
130
- <?php echo isset($label['br'])? '<br/>' : ''?>
131
- <label class="<?php echo isset($label['class']) ? esc_attr($label['class']) : '';?>" for="<?php echo esc_attr($id); ?>"><?php echo esc_html($label['text']); ?></label>
132
- <?php
133
- }
134
  if($disabled_text != ''){ ?>
135
  <span class="wdi_pro_only"><?php echo esc_html($disabled_text); ?></span>
136
  <?php
137
  }
138
  ?>
139
-
140
  </div>
141
  </div>
142
  </div>
@@ -150,7 +147,7 @@ public function __construct() {
150
  </style>
151
  <script>
152
  jQuery(document).ready(function(){
153
- var <?php echo esc_attr($id).'_hide_ids';?> = <?php echo str_replace('&quot;','"', esc_attr(json_encode($hide_ids)));?>;
154
  jQuery("#WDI_wrap_<?php echo esc_attr($element['name']);?> select").on('change',function(){
155
  jQuery('.<?php echo esc_attr($id).'_hide_ids_hidden';?>').each(function(){
156
  jQuery(this).removeClass('<?php echo esc_attr($id).'_hide_ids_hidden';?>');
@@ -174,20 +171,20 @@ public function __construct() {
174
  });
175
  </script>
176
  <?php }
177
-
178
  }
179
 
180
  /*
181
- * $element['name']
182
- * $element['id'] //default is WDI_.$element_name
183
- * $element['type'] //multiple
184
- * $element['attr'] //custom attribute array(array('name'=>'attr_name','value'=>'attr_value'),...)
185
- * $element['label'] // array('text','place')
186
- * $element['valid_options'] //array('option_value1'=>'option_name1','option_value2'=>'option_name2');
187
- * $element['width']
188
- * $element['selected'] //one of valid options
189
- * $element['defaults'] //array of default vlaues
190
- * $element['CONST'] //variable to store data in array
 
191
  */
192
  public function selectgroup( $element, $feed_row='' ) {
193
  $name = $element['CONST'].'['.(isset($element['name']) ? $element['name'] : 'NOT_SET') . ']';
@@ -216,10 +213,13 @@ public function __construct() {
216
  <label for="<?php echo esc_attr($id); ?>"><?php echo esc_html($label['text']); ?></label>
217
  <?php echo isset($label['br']) ? '<br/>' : ''; ?>
218
  <?php } ?>
219
- <select name="<?php echo esc_attr($name); ?>" id="<?php echo esc_attr($id); ?>" <?php echo esc_attr($type); ?> style="<?php if($width!='') echo 'width:' .esc_attr($width) . ';';?> resize:vertical;" <?php echo $attr; ?>>
 
 
 
220
  <option value=""><?php _e('Select', 'wd-instagram-feed'); ?></option>
221
  <?php foreach($options as $label => $values) { ?>
222
- <optgroup label="<?php echo ucfirst(esc_attr($label)) ?>">
223
  <?php foreach ( $values as $key => $value ) {
224
  $selected = ( $key == $opt_value ) ? 'selected' : '';
225
  $data_type = 'data-type="' . esc_attr($label) . '"';
@@ -233,7 +233,7 @@ public function __construct() {
233
  <?php } ?>
234
  </select>
235
  <?php
236
- if ( !empty($label['place']) && $label['place']=='after' ) { ?>
237
  <?php echo isset($label['br'])? '<br/>' : ''?>
238
  <label for="<?php echo esc_attr($id); ?>"><?php echo esc_html($label['text']); ?></label>
239
  <?php
@@ -250,8 +250,8 @@ public function __construct() {
250
  </style>
251
  <script>
252
  jQuery(document).ready(function(){
253
- var <?php echo esc_attr($id).'_hide_ids';?> = <?php echo str_replace('&quot;','"', esc_attr(json_encode($hide_ids)));?>;
254
- var hide_ids = <?php echo str_replace('&quot;','"', esc_attr(json_encode($hide_ids))); ?>;
255
  var hide_class = '<?php echo esc_attr($id).'_hide_ids_hidden'; ?>';
256
 
257
  function iterator(show) {
@@ -262,7 +262,7 @@ public function __construct() {
262
  }
263
 
264
  if( el.length == 0 ) {
265
- continue;
266
  }
267
  (show === true) ? el.removeClass(hide_class) : el.addClass(hide_class);
268
  }
@@ -321,21 +321,21 @@ public function __construct() {
321
  }
322
 
323
  /*
324
- * $element['name']
325
- * $element['id'] //default is WDI_.$element_name
326
- * $element['attr'] //custom attribute array(array('name'=>'attr_name','value'=>'attr_value'),...)
327
- * $element['label'] // array('text','place')
328
- * $element['valid_options'] //array('option_value1'=>'option_name1','option_value2'=>'option_name2');
329
- * $element['width']
330
- * $element['selected'] //one of valid options
331
- * $element['defaults'] //array of default vlaues
332
- * $element['CONST'] //variable to store data in array
 
333
  */
334
  public function radio($element,$feed_row=''){
335
  $option_name = isset($element['name']) ? $element['name'] : 'NOT_SET';
336
  $name = $element['CONST'] . '[' . (isset($element['name']) ? $element['name'] : 'NOT_SET') . ']';
337
  $id = isset($element['id']) ? $element['id'] : 'WDI_'.$element['name'];
338
- //$attr = isset($element['attr']) ? $element['attr']['name'] . '="' . $element['attr']['value'].'"' : '';
339
  $label = isset($element['label']) ? $element['label'] : '';
340
  $width = isset($element['width']) ? ($element['width']) : '';
341
  $options = isset($element['valid_options']) ? $element['valid_options'] : '';
@@ -354,7 +354,6 @@ public function __construct() {
354
  if($current_settings !=''){
355
  $opt_value = isset($current_settings[$element['name']]) ? $current_settings[$element['name']] : '';
356
  }
357
-
358
  ?>
359
  <div class="wdwt_param" id="WDI_wrap_<?php echo esc_attr($element['name']);?>">
360
  <div class="block">
@@ -404,7 +403,7 @@ public function __construct() {
404
  </style>
405
  <script>
406
  jQuery(document).ready(function(){
407
- var <?php echo esc_attr($id).'_hide_ids';?> = <?php echo str_replace('&quot;','"', esc_attr(json_encode($hide_ids)));?>;
408
  jQuery("#WDI_wrap_<?php echo esc_attr($element['name']);?> input").on('click',function(){
409
  jQuery('.<?php echo esc_attr($id).'_hide_ids_hidden';?>').each(function(){
410
  jQuery(this).removeClass('<?php echo esc_attr($id).'_hide_ids_hidden';?>');
@@ -438,7 +437,7 @@ public function __construct() {
438
  </style>
439
  <script>
440
  jQuery(document).ready(function(){
441
- var <?php echo esc_attr($id).'_show_ids';?> = <?php echo str_replace('&quot;','"', esc_attr(json_encode($show_ids)));?>;
442
  jQuery("#WDI_wrap_<?php echo esc_attr($element['name']);?> input").on('click',function(){
443
  jQuery('.<?php echo esc_attr($id).'_show_ids_show';?>').each(function(){
444
  jQuery(this).removeClass('<?php echo esc_attr($id).'_show_ids_show';?>');
@@ -467,19 +466,19 @@ public function __construct() {
467
  }
468
 
469
  /*
470
- * $element['name']
471
- * $element['id'] //default is WDI_.$element_name
472
- * $element['attr'] //custom attribute array(array('name'=>'attr_name','value'=>'attr_value'),...)
473
- * $element['label'] // array('text','place')
474
- * $element['width']
475
- * $element['selected'] //one of valid options
476
- * $element['defaults'] //array of default vlaues
477
- * $element['CONST'] //variable to store data in array
 
478
  */
479
  public function checkbox($element,$feed_row=''){
480
  $name = $element['CONST'].'['.(isset($element['name']) ? $element['name'] : 'NOT_SET').']';
481
  $id = isset($element['id']) ? $element['id'] : 'WDI_'.$element['name'];
482
- //$attr = isset($element['attr']) ? $element['attr']['name'] . '="' . $element['attr']['value'].'"' : '';
483
  $label = isset($element['label']) ? $element['label'] : '';
484
  $width = isset($element['width']) ? ($element['width']) : '';
485
  $break = isset($element['break']) ? '<br/>' : '';
@@ -510,7 +509,13 @@ public function __construct() {
510
  <?php
511
  }
512
  ?>
513
- <input <?php echo esc_attr($disable); ?> type="checkbox" class="checkbox" name="<?php echo esc_attr($name); ?>" id="<?php echo esc_attr($id) ?>" <?php echo $attr;?> <?php checked(1,$opt_value)?> value="1">
 
 
 
 
 
 
514
  <?php
515
  if($label!='' && $label['place']=='after'){
516
  ?>
@@ -524,15 +529,14 @@ public function __construct() {
524
  </div>
525
  <style>
526
  <?php if(!empty($hide_ids)){
527
- echo '.'.esc_attr($id).'_hide_ids_hidden{display:none !important;}';
528
  }
529
- ?>
530
  </style>
531
  <script>
532
  jQuery(document).ready(function(){
533
-
534
  var el = jQuery('#<?php echo ''.esc_attr($id)?>');
535
- var hide_ids = <?php echo str_replace('&quot;','"', esc_attr(json_encode($hide_ids))); ?>;
536
  var hide_class = '<?php echo esc_attr($id).'_hide_ids_hidden'; ?>';
537
 
538
  if(el.prop('checked') != true){
@@ -616,43 +620,40 @@ public function __construct() {
616
 
617
  /**
618
  * Displays a single color control
619
- * $element['name']
620
- * $element['CONST'] //variable to store data in array
 
621
  */
622
-
623
  public function color($element,$feed_row=''){
624
  $name = $element['CONST'].'['.(isset($element['name']) ? $element['name'] : 'NOT_SET').']';
625
  $id = isset($element['id']) ? $element['id'] : 'WDI_'.$element['name'];
626
  $defaults = $element['defaults'];
627
 
628
  $attrs = ' ';
629
- foreach ($element['attr'] as $attr) {
630
- $attrs .= $attr['name'] . '="' . $attr['value'] . '" ';
631
- if($attr['name'] === 'tab'){
632
- $tab = $attr['value'];
633
- }
634
- if($attr['name'] === 'section'){
635
- $section = $attr['value'];
636
- }
637
  }
638
- $attr = $attrs;
639
-
 
 
 
640
  $current_settings = isset($feed_row) ? $feed_row : '';
641
-
642
  $opt_value = isset($defaults[$element['name']]) ? $defaults[$element['name']] : '';
643
- if($current_settings !=''){
644
- if($current_settings[$element['name']] != '')
645
- {
646
- $opt_value = $current_settings[$element['name']];
647
- }
648
  }
 
649
  ?>
650
  <div class="wdwt_param" id="WDI_wrap_<?php echo esc_attr($element['name']);?>">
651
- <div class='wdwt_float' >
652
- <div>
653
- <input type="text" class='color_input' id="<?php echo esc_attr($id) ?>" <?php echo esc_attr($attr);?> name="<?php echo esc_attr($name); ?>" value="<?php echo esc_attr($opt_value); ?>" data-default-color="<?php echo esc_attr($defaults[$element['name']]); ?>" style="background-color:<?php echo esc_attr($opt_value); ?>;">
654
- </div>
655
  </div>
 
656
  </div>
657
  <script type="text/javascript">
658
  jQuery(document).ready(function() {
@@ -663,8 +664,4 @@ public function __construct() {
663
  </script>
664
  <?php
665
  }
666
-
667
- }
668
-
669
-
670
-
5
  }
6
 
7
  /*
8
+ * $elements arguments
9
+ * name
10
+ * id // default is WDI_.$element_name
11
+ * type // text, number...
12
+ * attr // custom attribute array(array('name'=>'attr_name','value'=>'attr_value'),...)
13
+ * input_size
14
+ * label // array('text','place')
15
+ * defaults // array of default vlaues
16
+ * CONST // variable to store data in array
17
  */
18
  public function input($element,$feed_row=''){
19
  $name = $element['CONST'].'['.(isset($element['name']) ? $element['name'] : 'NOT_SET') . ']';
20
  $id = isset($element['id']) ? $element['id'] : 'WDI_'.$element['name'];
21
  $type = isset($element['input_type']) ? $element['input_type'] : 'text';
 
22
  $attrs = ' ';
23
  foreach ($element['attr'] as $attr) {
24
+ $attrs .= esc_attr($attr['name']) . '="' . esc_attr($attr['value']) . '" ';
25
  }
26
  $attr = $attrs;
27
 
33
  if($current_settings !=''){
34
  $value = isset($current_settings[$element['name']]) ? $current_settings[$element['name']] : '';
35
  }
 
 
36
  ?>
37
  <div class="wdwt_param" id="WDI_wrap_<?php echo esc_attr($element['name']); ?>">
38
  <div class="block">
39
  <div class="optioninput">
 
40
  <?php
41
  if($label!='' && $label['place']=='before'){
42
  ?>
45
  <?php
46
  }
47
  ?>
 
48
  <input type="<?php echo esc_attr($type); ?>" id="<?php echo esc_attr($id); ?>" name="<?php echo esc_attr($name); ?>" value="<?php echo esc_attr($value); ?>"
49
+ <?php
50
+ // All arguments in the $attr are esc.
51
+ /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */
52
+ echo $attr; ?> size="<?php echo esc_attr($input_size); ?>">
53
  <?php
54
  if($label!='' && $label['place']=='after'){
55
  ?>
57
  <label for="<?php echo esc_attr($id); ?>"><?php echo esc_html($label['text']); ?></label>
58
  <?php
59
  }
 
60
  ?>
61
  </div>
62
  </div>
65
  }
66
 
67
  /*
68
+ * $elements arguments
69
+ * name
70
+ * id // default is WDI_.$element_name
71
+ * type // multiple
72
+ * attr // custom attribute array(array('name'=>'attr_name','value'=>'attr_value'),...)
73
+ * label // array('text','place')
74
+ * valid_options // array('option_value1'=>'option_name1','option_value2'=>'option_name2');
75
+ * width
76
+ * selected // one of valid options
77
+ * defaults // array of default vlaues
78
+ * CONST // variable to store data in array
79
  */
80
  public function select($element,$feed_row=''){
81
  $name = $element['CONST'].'['.(isset($element['name']) ? $element['name'] : 'NOT_SET') . ']';
82
  $id = isset($element['id']) ? $element['id'] : 'WDI_'.$element['name'];
83
  $type = isset($element['type']) ? $element['type'] : '';
 
84
  $label = isset($element['label']) ? $element['label'] : '';
85
  $width = isset($element['width']) ? ($element['width']) : '';
86
  $options = isset($element['valid_options']) ? $element['valid_options'] : '';
105
  <div class="block">
106
  <div class="optioninput">
107
  <?php
108
+ if($label!='' && $label['place']=='before'){
109
+ ?>
110
+ <label for="<?php echo esc_attr($id); ?>"><?php echo esc_html($label['text']); ?></label>
111
+ <?php echo isset($label['br']) ? '<br/>' : ''?>
112
+ <?php
113
+ }
114
+ ?>
115
+ <select <?php
116
+ // All arguments in the $attr are esc.
117
+ /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */
118
+ echo $attr; ?> name="<?php echo esc_attr($name); ?>" id="<?php echo esc_attr($id); ?>" <?php echo esc_attr($switched); ?> <?php echo esc_attr($type); ?> style="<?php if($width!='') echo 'width:' .esc_attr($width) . ';';?> resize:vertical;">
119
  <?php foreach($options as $key => $value){ ?>
120
  <option <?php echo (in_array($key, $disabled_options)) ? 'disabled' : '' ?> value="<?php echo esc_attr($key) ?>" <?php if($key==$opt_value){echo 'selected';}?>>
121
  <?php echo esc_html($value); ?>
122
  </option>
123
  <?php } ?>
124
  </select>
125
+ <?php
 
126
  if($label!='' && $label['place']=='after'){
127
+ ?>
128
+ <?php echo isset($label['br'])? '<br/>' : ''?>
129
+ <label class="<?php echo isset($label['class']) ? esc_attr($label['class']) : '';?>" for="<?php echo esc_attr($id); ?>"><?php echo esc_html($label['text']); ?></label>
130
+ <?php
131
+ }
 
132
  if($disabled_text != ''){ ?>
133
  <span class="wdi_pro_only"><?php echo esc_html($disabled_text); ?></span>
134
  <?php
135
  }
136
  ?>
 
137
  </div>
138
  </div>
139
  </div>
147
  </style>
148
  <script>
149
  jQuery(document).ready(function(){
150
+ var <?php echo esc_attr($id).'_hide_ids';?> = <?php echo str_replace('&quot;', '"', esc_attr( wp_json_encode($hide_ids)));?>;
151
  jQuery("#WDI_wrap_<?php echo esc_attr($element['name']);?> select").on('change',function(){
152
  jQuery('.<?php echo esc_attr($id).'_hide_ids_hidden';?>').each(function(){
153
  jQuery(this).removeClass('<?php echo esc_attr($id).'_hide_ids_hidden';?>');
171
  });
172
  </script>
173
  <?php }
 
174
  }
175
 
176
  /*
177
+ * $elements arguments
178
+ * name
179
+ * id // default is WDI_.$element_name
180
+ * type // multiple
181
+ * attr //custom attribute array(array('name'=>'attr_name','value'=>'attr_value'),...)
182
+ * label // array('text','place')
183
+ * valid_options // array('option_value1'=>'option_name1','option_value2'=>'option_name2');
184
+ * width
185
+ * selected // one of valid options
186
+ * defaults // array of default vlaues
187
+ * CONST // variable to store data in array
188
  */
189
  public function selectgroup( $element, $feed_row='' ) {
190
  $name = $element['CONST'].'['.(isset($element['name']) ? $element['name'] : 'NOT_SET') . ']';
213
  <label for="<?php echo esc_attr($id); ?>"><?php echo esc_html($label['text']); ?></label>
214
  <?php echo isset($label['br']) ? '<br/>' : ''; ?>
215
  <?php } ?>
216
+ <select <?php
217
+ // All arguments in the $attr are esc.
218
+ /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */
219
+ echo $attr; ?> name="<?php echo esc_attr($name); ?>" id="<?php echo esc_attr($id); ?>" <?php echo esc_attr($type); ?> style="<?php if($width!='') echo 'width:' .esc_attr($width) . ';';?> resize:vertical;">
220
  <option value=""><?php _e('Select', 'wd-instagram-feed'); ?></option>
221
  <?php foreach($options as $label => $values) { ?>
222
+ <optgroup label="<?php echo esc_attr(ucfirst($label)); ?>">
223
  <?php foreach ( $values as $key => $value ) {
224
  $selected = ( $key == $opt_value ) ? 'selected' : '';
225
  $data_type = 'data-type="' . esc_attr($label) . '"';
233
  <?php } ?>
234
  </select>
235
  <?php
236
+ if ( !empty($label['place']) && $label['place'] == 'after' ) { ?>
237
  <?php echo isset($label['br'])? '<br/>' : ''?>
238
  <label for="<?php echo esc_attr($id); ?>"><?php echo esc_html($label['text']); ?></label>
239
  <?php
250
  </style>
251
  <script>
252
  jQuery(document).ready(function(){
253
+ var <?php echo esc_attr($id) . '_hide_ids'; ?> = <?php echo str_replace('&quot;','"', esc_attr(wp_json_encode($hide_ids))); ?>;
254
+ var hide_ids = <?php echo str_replace('&quot;', '"', esc_attr(wp_json_encode($hide_ids))); ?>;
255
  var hide_class = '<?php echo esc_attr($id).'_hide_ids_hidden'; ?>';
256
 
257
  function iterator(show) {
262
  }
263
 
264
  if( el.length == 0 ) {
265
+ continue;
266
  }
267
  (show === true) ? el.removeClass(hide_class) : el.addClass(hide_class);
268
  }
321
  }
322
 
323
  /*
324
+ * $elements arguments
325
+ * name
326
+ * id // default is WDI_.$element_name
327
+ * attr // custom attribute array(array('name'=>'attr_name','value'=>'attr_value'),...)
328
+ * label // array('text','place')
329
+ * valid_options // array('option_value1'=>'option_name1','option_value2'=>'option_name2');
330
+ * width
331
+ * selected // one of valid options
332
+ * defaults // array of default vlaues
333
+ * CONST // variable to store data in array
334
  */
335
  public function radio($element,$feed_row=''){
336
  $option_name = isset($element['name']) ? $element['name'] : 'NOT_SET';
337
  $name = $element['CONST'] . '[' . (isset($element['name']) ? $element['name'] : 'NOT_SET') . ']';
338
  $id = isset($element['id']) ? $element['id'] : 'WDI_'.$element['name'];
 
339
  $label = isset($element['label']) ? $element['label'] : '';
340
  $width = isset($element['width']) ? ($element['width']) : '';
341
  $options = isset($element['valid_options']) ? $element['valid_options'] : '';
354
  if($current_settings !=''){
355
  $opt_value = isset($current_settings[$element['name']]) ? $current_settings[$element['name']] : '';
356
  }
 
357
  ?>
358
  <div class="wdwt_param" id="WDI_wrap_<?php echo esc_attr($element['name']);?>">
359
  <div class="block">
403
  </style>
404
  <script>
405
  jQuery(document).ready(function(){
406
+ var <?php echo esc_attr($id).'_hide_ids';?> = <?php echo str_replace('&quot;','"', esc_attr(wp_json_encode($hide_ids)));?>;
407
  jQuery("#WDI_wrap_<?php echo esc_attr($element['name']);?> input").on('click',function(){
408
  jQuery('.<?php echo esc_attr($id).'_hide_ids_hidden';?>').each(function(){
409
  jQuery(this).removeClass('<?php echo esc_attr($id).'_hide_ids_hidden';?>');
437
  </style>
438
  <script>
439
  jQuery(document).ready(function(){
440
+ var <?php echo esc_attr($id).'_show_ids';?> = <?php echo str_replace('&quot;','"', esc_attr(wp_json_encode($show_ids)));?>;
441
  jQuery("#WDI_wrap_<?php echo esc_attr($element['name']);?> input").on('click',function(){
442
  jQuery('.<?php echo esc_attr($id).'_show_ids_show';?>').each(function(){
443
  jQuery(this).removeClass('<?php echo esc_attr($id).'_show_ids_show';?>');
466
  }
467
 
468
  /*
469
+ * $elements arguments
470
+ * name
471
+ * id // default is WDI_.$element_name
472
+ * attr // custom attribute array(array('name'=>'attr_name','value'=>'attr_value'),...)
473
+ * label // array('text','place')
474
+ * width
475
+ * selected // one of valid options
476
+ * defaults // array of default vlaues
477
+ * CONST // variable to store data in array
478
  */
479
  public function checkbox($element,$feed_row=''){
480
  $name = $element['CONST'].'['.(isset($element['name']) ? $element['name'] : 'NOT_SET').']';
481
  $id = isset($element['id']) ? $element['id'] : 'WDI_'.$element['name'];
 
482
  $label = isset($element['label']) ? $element['label'] : '';
483
  $width = isset($element['width']) ? ($element['width']) : '';
484
  $break = isset($element['break']) ? '<br/>' : '';
509
  <?php
510
  }
511
  ?>
512
+ <input
513
+ <?php
514
+ // All arguments in the $attr are esc.
515
+ /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */
516
+ echo $attr;
517
+ ?>
518
+ <?php echo esc_attr($disable); ?> type="checkbox" class="checkbox" name="<?php echo esc_attr($name); ?>" id="<?php echo esc_attr($id) ?>" <?php checked(1,$opt_value)?> value="1">
519
  <?php
520
  if($label!='' && $label['place']=='after'){
521
  ?>
529
  </div>
530
  <style>
531
  <?php if(!empty($hide_ids)){
532
+ echo '.' . esc_attr($id) . '_hide_ids_hidden{display:none !important;}';
533
  }
534
+ ?>
535
  </style>
536
  <script>
537
  jQuery(document).ready(function(){
 
538
  var el = jQuery('#<?php echo ''.esc_attr($id)?>');
539
+ var hide_ids = <?php echo str_replace('&quot;','"', esc_attr(wp_json_encode($hide_ids))); ?>;
540
  var hide_class = '<?php echo esc_attr($id).'_hide_ids_hidden'; ?>';
541
 
542
  if(el.prop('checked') != true){
620
 
621
  /**
622
  * Displays a single color control
623
+ * $elements arguments
624
+ * name
625
+ * CONST // variable to store data in array
626
  */
 
627
  public function color($element,$feed_row=''){
628
  $name = $element['CONST'].'['.(isset($element['name']) ? $element['name'] : 'NOT_SET').']';
629
  $id = isset($element['id']) ? $element['id'] : 'WDI_'.$element['name'];
630
  $defaults = $element['defaults'];
631
 
632
  $attrs = ' ';
633
+ foreach ($element['attr'] as $attr) {
634
+ $attrs .= $attr['name'] . '="' . $attr['value'] . '" ';
635
+ if($attr['name'] === 'tab'){
636
+ $tab = $attr['value'];
 
 
 
 
637
  }
638
+ if($attr['name'] === 'section'){
639
+ $section = $attr['value'];
640
+ }
641
+ }
642
+ $attr = $attrs;
643
  $current_settings = isset($feed_row) ? $feed_row : '';
 
644
  $opt_value = isset($defaults[$element['name']]) ? $defaults[$element['name']] : '';
645
+ if($current_settings !=''){
646
+ if($current_settings[$element['name']] != '') {
647
+ $opt_value = $current_settings[$element['name']];
 
 
648
  }
649
+ }
650
  ?>
651
  <div class="wdwt_param" id="WDI_wrap_<?php echo esc_attr($element['name']);?>">
652
+ <div class='wdwt_float' >
653
+ <div>
654
+ <input type="text" class='color_input' id="<?php echo esc_attr($id) ?>" <?php echo esc_attr($attr);?> name="<?php echo esc_attr($name); ?>" value="<?php echo esc_attr($opt_value); ?>" data-default-color="<?php echo esc_attr($defaults[$element['name']]); ?>" style="background-color:<?php echo esc_attr($opt_value); ?>;">
 
655
  </div>
656
+ </div>
657
  </div>
658
  <script type="text/javascript">
659
  jQuery(document).ready(function() {
664
  </script>
665
  <?php
666
  }
667
+ }
 
 
 
 
framework/WDI_generate_styles.php CHANGED
@@ -8,19 +8,27 @@
8
 
9
  class WDI_generate_styles {
10
 
11
- private $theme_id;
12
- private $theme_options;
13
- private $folder_name = 'wd-instagram-feed';
14
- private $file_name_format = "wdi_theme_%s.css";//theme_id
15
- private $css = "";
16
- private $file_key = null;
17
-
18
- public function __construct($theme_id, $theme_options){
19
- $this->theme_id = $theme_id;
20
- $this->theme_options = $theme_options;
21
- }
22
 
23
- public function all_views_styles($write_in_file = true, $minify = true){
 
 
 
 
 
 
 
 
24
  $css = "";
25
  $css .= $this->common_styles();
26
  $css .= $this->thumbnail_view_styles();
@@ -28,1392 +36,1375 @@ class WDI_generate_styles {
28
  $css .= $this->blog_view_styles();
29
  $css .= $this->browser_view_styles();
30
  $css .= $this->lightbox_styles();
31
-
32
- if($minify == true) {
33
  require_once(WDI_DIR . '/framework/WDILibrary.php');
34
  $css = WDILibrary::minify_styles($css);
35
  }
36
-
37
  $this->css = $css;
38
-
39
- if($write_in_file === true) {
40
  return $this->update_file($css);
41
  }
42
 
43
  return $css;
44
  }
45
 
46
- public function common_styles(){
47
-
48
- $style = $this->theme_options;
49
- $theme_id = $this->theme_id;
50
-
51
- ob_start();
52
- ?>
53
- <style>
54
-
55
- .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_feed_wrapper {
56
- width: <?php echo esc_html($style['feed_wrapper_width']); ?>; /*feed_wrapper_width,column number * image size*/
57
- background-color: <?php echo esc_html($style['feed_wrapper_bg_color']); ?>; /*feed_wrapper_bg_color*/
58
- text-align: <?php echo esc_html($style['header_position']); ?>; /*header_position*/
59
- }
60
-
61
- .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_feed_header {
62
- margin: <?php echo esc_html($style['header_margin']); ?>; /*header_margin*/
63
- padding: <?php echo esc_html($style['header_padding']); ?>; /*header_padding*/
64
- border: <?php echo esc_html($style['header_border_size']); ?> solid <?php echo esc_html($style['header_border_color']); ?>; /*header_border_size, header_border_color*/
65
- text-align: <?php echo esc_html($style['header_position']); ?>; /*header_position*/
66
- }
67
-
68
- .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_header_text {
69
- font-size: <?php echo esc_html($style['header_text_font_size']); ?>;
70
- font-style: <?php echo esc_html($style['header_text_font_style']); ?>;
71
- padding: <?php echo esc_html($style['header_text_padding']); ?>; /*header_text_padding*/
72
- color: <?php echo esc_html($style['header_text_color']); ?>; /*header_text_color*/
73
- font-weight: <?php echo esc_html($style['header_font_weight']); ?>; /*header_font_weight*/
74
- line-height: <?php echo esc_html($style['header_img_width']); ?>px; /*header_img_width*/
75
- }
76
-
77
- .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_single_user {
78
- padding-top: <?php echo esc_html($style['user_padding']); ?>; /*user_padding*/
79
- padding-bottom: <?php echo esc_html($style['user_padding']); ?>; /*user_padding*/
80
- padding-left: <?php echo esc_html($style['user_padding']); ?>; /*user_padding*/
81
- padding-right: <?php echo esc_html($style['user_padding']); ?>; /*user_padding*/
82
- }
83
-
84
- .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_header_hashtag h3 {
85
- margin-top: <?php echo (intval($style['user_img_width']) - intval($style['users_text_font_size']))/2?>px;
86
- }
87
-
88
- .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_header_user_text h3 {
89
- font-size: <?php echo esc_html($style['users_text_font_size']); ?>;
90
- font-style: <?php echo esc_html($style['users_text_font_style']); ?>;
91
- line-height: <?php echo esc_html($style['users_text_font_size']); ?>;
92
- color: <?php echo esc_html($style['users_text_color']); ?>; /*header_text_color*/;
93
- }
94
-
95
- .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_user_img_wrap img {
96
- height: <?php echo esc_html($style['user_img_width']); ?>px;
97
- width: <?php echo esc_html($style['user_img_width']); ?>px;
98
- border-radius: <?php echo esc_html($style['user_border_radius']); ?>px;
99
- }
100
-
101
- .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_media_info {
102
- /*display: inline-block;*/
103
- margin-left: <?php echo intval($style['user_img_width']) + 10;?>px;
104
- line-height: <?php echo esc_html($style['users_text_font_size']); ?>;
105
- color: <?php echo esc_html($style['users_text_color']); ?>; /*header_text_color !mmm/ seperate*/
106
- }
107
-
108
- .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_bio {
109
- color: <?php echo esc_html($style['users_text_color']); ?>; /*header_text_color*/
110
- font-size: <?php echo esc_html($style['user_description_font_size']); ?>; /*header_text_color*/
111
- }
112
-
113
- .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_follow_btn {
114
- border-radius: <?php echo esc_html($style['follow_btn_border_radius']); ?>px;
115
- font-size: <?php echo esc_html($style['follow_btn_font_size']); ?>px;
116
- background-color: <?php echo esc_html($style['follow_btn_bg_color']); ?>;
117
- border-color: <?php echo esc_html($style['follow_btn_border_color']); ?>;
118
- color: <?php echo esc_html($style['follow_btn_text_color']); ?>;
119
- margin-left: <?php echo esc_html($style['follow_btn_margin']); ?>px;
120
- padding: 0 <?php echo esc_html($style['follow_btn_padding']); ?>px;
121
- }
122
-
123
- .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_follow_btn:hover {
124
- border-color: <?php echo esc_html($style['follow_btn_border_hover_color']); ?>;
125
- color: <?php echo esc_html($style['follow_btn_text_hover_color']); ?>;
126
- background-color: <?php echo esc_html($style['follow_btn_background_hover_color']); ?>;
127
- }
128
-
129
- .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_filter_overlay {
130
- width: <?php echo esc_html($style['user_img_width']); ?>px; /*user_img_width*/
131
- height: <?php echo esc_html($style['user_img_width']); ?>px; /*user_img_width*/
132
- border-radius: <?php echo esc_html($style['user_border_radius']); ?>px; /*user_img_width*/
133
- background-color: <?php echo esc_html($style['th_overlay_hover_color']); ?>;
134
- }
135
-
136
- .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_filter_icon span {
137
- width: <?php echo esc_html($style['user_img_width']); ?>px; /*header_img_width*/
138
- height: <?php echo esc_html($style['user_img_width']); ?>px; /*header_img_width*/
139
- }
140
-
141
- .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_load_more_text {
142
- color: <?php echo esc_html($style['load_more_text_color']); ?>; /*load_more_text_color*/
143
- font-size: <?php echo esc_html($style['load_more_text_font_size']); ?>; /*load_more_text_font_size*/
144
- }
145
-
146
- .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_load_more_text img {
147
- height: <?php echo esc_html($style['load_more_height']); ?>; /*load_more_height*/
148
- width: <?php echo esc_html($style['load_more_height']); ?>; /*load_more_height*/
149
- }
150
-
151
- .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_load_more_wrap:hover {
152
- background-color: <?php echo esc_html($style['load_more_wrap_hover_color']); ?>; /*load_more_wrap_hover_color*/
153
- }
154
-
155
- .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_pagination {
156
-
157
- text-align: <?php echo esc_html($style['pagination_position']); ?>; /*load_more_position*/
158
- color: <?php echo esc_html($style['pagination_ctrl_color']); ?>; /*pagination_ctrl_color*/
159
- font-size: <?php echo esc_html($style['pagination_size']); ?>; /*pagination_size*/
160
- }
161
-
162
- .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_pagination_ctrl {
163
- margin: <?php echo esc_html($style['pagination_ctrl_margin']); ?>;
164
- }
165
-
166
- .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_pagination_ctrl:hover {
167
- color: <?php echo esc_html($style['pagination_ctrl_hover_color']); ?>;
168
- }
169
-
170
- .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_filter_active_col {
171
- color: <?php echo esc_html($style['active_filter_bg_color']);?>;
172
- border-color: <?php echo esc_html($style['active_filter_bg_color']);?>;
173
- }
174
-
175
- </style>
176
- <?php
177
- $css = ob_get_contents();
178
- ob_end_clean();
179
-
180
- $css = strip_tags($css);
181
 
182
- return $css;
183
- }
 
 
 
 
184
 
185
- public function thumbnail_view_styles(){
186
- $style = $this->theme_options;
187
- $theme_id = $this->theme_id;
188
- ob_start();
189
- ?>
190
- <style>
191
- .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_feed_container {
192
- width: <?php echo esc_html($style['feed_container_width']); ?>;
193
- background-color: <?php echo esc_html($style['feed_container_bg_color']); ?>; /*feed_container_bg_color*/
194
- border-bottom: 5px solid <?php echo esc_html($style['feed_container_bg_color']); ?>; /*feed_container_bg_color*/;
195
- }
196
-
197
- .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_header_img_wrap {
198
- height: <?php echo esc_html($style['header_img_width']); ?>px; /*header_img_width*/
199
- width: <?php echo esc_html($style['header_img_width']); ?>px; /*header_img_width*/
200
- border-radius: <?php echo esc_html($style['header_border_radius']); ?>px; /*header_img_width*/
201
- }
202
-
203
- .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_photo_wrap {
204
- padding: <?php echo esc_html($style['th_photo_wrap_padding']); ?>; /*photo_wrap_padding*/
205
- width: calc(100% - 2 *<?php echo esc_html($style['th_photo_wrap_padding']); ?>);
206
- }
207
-
208
- .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_photo_wrap_inner {
209
- border: <?php echo esc_html($style['th_photo_wrap_border_size']); ?> solid <?php echo esc_html($style['th_photo_wrap_border_color']); ?>; /*photo_wrap_border_size,photo_wrap_border_color*/
210
- background-color: <?php echo esc_html($style['th_photo_wrap_bg_color']); ?>; /*photo_wrap_bg_color*/
211
- }
212
-
213
- .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_photo_img {
214
- border-radius: <?php echo esc_html($style['th_photo_img_border_radius']); ?>; /*photo_img_border_radius*/
215
- }
216
-
217
- .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_photo_meta {
218
- background-color: <?php echo esc_html($style['th_photo_meta_bg_color']); ?>; /*photo_meta_bg_color*/
219
- }
220
-
221
- .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_thumb_likes {
222
- width: <?php echo (esc_html($style['th_photo_meta_one_line'])=='1')? '50%' : '100%' ?>; /*photo_meta_one_line==false else 100%*/
223
- float: <?php echo (esc_html($style['th_photo_meta_one_line'])=='1')? 'left' : 'none'?>; /*photo_meta_one_line==true else float none*/
224
- font-size: <?php echo esc_html($style['th_like_comm_font_size']); ?>; /*photo_caption_font_size*/;
225
- color: <?php echo esc_html($style['th_like_text_color']); ?>; /*like_text_color*/
226
-
227
- }
228
-
229
- .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_thumb_comments {
230
- width: <?php echo (esc_html($style['th_photo_meta_one_line'])=='1')? '50%' : '100%' ?>; /*photo_meta_one_line==false else 100%*/
231
- float: <?php echo (esc_html($style['th_photo_meta_one_line'])=='1')? 'left' : 'none'?>; /*photo_meta_one_line==true else float none*/
232
- font-size: <?php echo esc_html($style['th_like_comm_font_size']); ?>; /*photo_caption_font_size*/;
233
- color: <?php echo esc_html($style['th_comment_text_color']); ?>; /*comment_text_color*/
234
-
235
- }
236
-
237
- .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_photo_title {
238
- font-size: <?php echo esc_html($style['th_photo_caption_font_size']); ?>; /*photo_caption_font_size*/
239
- color: <?php echo esc_html($style['th_photo_caption_color']); ?>; /*photo_caption_color*/
240
- }
241
-
242
- .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_photo_title:hover {
243
- color: <?php echo esc_html($style['th_photo_caption_hover_color']); ?>;
244
- }
245
-
246
- .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_load_more_spinner {
247
- color: <?php echo esc_html($style['load_more_text_color']); ?>; /*load_more_text_color*/
248
- font-size: <?php echo intval($style['load_more_text_font_size'])*1.3?>px; /*load_more_text_font_size*/
249
- }
250
-
251
- .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_load_more,
252
- .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_spinner {
253
- background-color: <?php echo esc_html($style['feed_container_bg_color']); ?>; /*feed_container_bg_color*/
254
- text-align: <?php echo esc_html($style['load_more_position']); ?>; /*load_more_position*/
255
- }
256
-
257
- .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_load_more_wrap,
258
- .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_spinner_wrap {
259
- padding: <?php echo esc_html($style['load_more_padding']); ?>; /*load_more_padding*/
260
- background-color: <?php echo esc_html($style['load_more_bg_color']); ?>; /*load_more_bg_color*/
261
- border-radius: <?php echo esc_html($style['load_more_border_radius']); ?>; /*load_more_border_radius*/
262
- height: <?php echo esc_html($style['load_more_height']); ?>; /*load_more_height*/
263
- width: <?php echo esc_html($style['load_more_width']); ?>; /*load_more_width*/
264
- border: <?php echo esc_html($style['load_more_border_size']); ?> solid <?php echo esc_html($style['load_more_border_color']); ?>; /*load_more_border_size, load_more_border_color*/;
265
- }
266
-
267
- <?php
268
- require_once(WDI_DIR . '/framework/WDILibrary.php');
269
- $rgb_overlay = WDILibrary::wdi_spider_hex2rgb(esc_html($style['th_overlay_hover_color']));
270
- $rgba_overlay = 'rgba('. $rgb_overlay['red'] .',' . $rgb_overlay['green'] . ',' . $rgb_overlay['blue'] . ','.((100 - intval($style['th_overlay_hover_transparent']))/100).')';
271
- ?>
272
- .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_photo_overlay:hover {
273
- background-color: <?php echo $rgba_overlay;?>
274
- }
275
-
276
- .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_photo_overlay i {
277
- font-size: <?php echo esc_html($style['th_overlay_hover_icon_font_size']); ?>;
278
- }
279
-
280
- .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_photo_overlay:hover i {
281
- color: <?php echo esc_html($style['th_overlay_hover_icon_color'])?>
282
- }
283
-
284
- <?php
285
- switch(esc_html($style['th_photo_img_hover_effect'])){
286
- case 'rotate': {
287
- $effect = 'rotate(5deg)';
288
- break;
289
- }
290
- case 'scale':{
291
- $effect = 'scale(1.2)';
292
- break;
293
- }
294
- case 'rotate_and_scale':{
295
- $effect = 'scale(1.2) rotate(5deg)';
296
- break;
297
- }
298
- default:{
299
- $effect = 'none';
300
- break;
301
- }
302
  }
303
- ?>
304
- .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_photo_img:hover img {
305
- -webkit-transform: translateX(-50%) translateY(-50%) <?php echo $effect?>;
306
- -moz-transform: translateX(-50%) translateY(-50%) <?php echo $effect?>;
307
- -ms-transform: translateX(-50%) translateY(-50%) <?php echo $effect?>;
308
- -o-transform: translateX(-50%) translateY(-50%) <?php echo $effect?>;
309
- transform: translateX(-50%) translateY(-50%) <?php echo $effect?>;
310
- }
311
 
312
- .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_filter_active_bg {
313
- background-color: <?php echo esc_html($style['active_filter_bg_color']); ?>;
314
- }
 
 
 
315
 
316
- .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_media_user {
317
- color: <?php echo esc_html($style['th_thumb_user_color']); ?>;
318
- background-color: <?php echo esc_html($style['th_thumb_user_bg_color']); ?>;
319
- }
320
 
321
- </style>
322
- <?php
323
- $css = ob_get_contents();
324
- ob_end_clean();
 
 
325
 
326
- $css = strip_tags($css);
 
 
 
 
327
 
328
- return $css;
329
- }
 
 
 
 
330
 
331
- public function masonry_view_styles(){
332
- $style = $this->theme_options;
333
- $theme_id = $this->theme_id;
334
- ob_start();
335
- ?>
336
- <style>
337
- .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_feed_container {
338
- width: <?php echo esc_html($style['feed_container_width']); ?>;
339
- background-color: <?php echo esc_html($style['feed_container_bg_color']); ?>; /*feed_container_bg_color*/
340
- border-bottom: 5px solid <?php echo esc_html($style['feed_container_bg_color']); ?>; /*feed_container_bg_color*/;
341
- }
342
-
343
- .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_header_img_wrap,
344
- .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_users_img_wrap {
345
- height: <?php echo esc_html($style['header_img_width']); ?>px; /*header_img_width*/
346
- width: <?php echo esc_html($style['header_img_width']); ?>px; /*header_img_width*/
347
- border-radius: <?php echo esc_html($style['header_border_radius']); ?>px; /*header_img_width*/
348
- }
349
-
350
- .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_photo_wrap {
351
- padding: <?php echo esc_html($style['mas_photo_wrap_padding']); ?>; /*photo_wrap_padding*/
352
- }
353
-
354
- .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_photo_wrap_inner {
355
- border: <?php echo esc_html($style['mas_photo_wrap_border_size']); ?> solid <?php echo esc_html($style['mas_photo_wrap_border_color']); ?>; /*photo_wrap_border_size,photo_wrap_border_color*/
356
- background-color: <?php echo esc_html($style['mas_photo_wrap_bg_color']); ?>; /*photo_wrap_bg_color*/
357
- }
358
-
359
- .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_photo_img {
360
- border-radius: <?php echo esc_html($style['mas_photo_img_border_radius']); ?>; /*photo_img_border_radius*/
361
- }
362
-
363
- .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_photo_meta {
364
- background-color: <?php echo esc_html($style['mas_photo_meta_bg_color']); ?>; /*photo_meta_bg_color*/
365
- }
366
-
367
- .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_thumb_likes {
368
- width: <?php echo (esc_html($style['mas_photo_meta_one_line'])=='1')? '50%' : '100%' ?>; /*photo_meta_one_line==false else 100%*/
369
- float: <?php echo (esc_html($style['mas_photo_meta_one_line'])=='1')? 'left' : 'none'?>; /*photo_meta_one_line==true else float none*/
370
- font-size: <?php echo esc_html($style['mas_like_comm_font_size']); ?>; /*photo_caption_font_size*/;
371
- color: <?php echo esc_html($style['mas_like_text_color']); ?>; /*like_text_color*/
372
-
373
- }
374
-
375
- .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_thumb_comments {
376
- width: <?php echo (esc_html($style['mas_photo_meta_one_line'])=='1')? '50%' : '100%' ?>; /*photo_meta_one_line==false else 100%*/
377
- float: <?php echo (esc_html($style['mas_photo_meta_one_line'])=='1')? 'left' : 'none'?>; /*photo_meta_one_line==true else float none*/
378
- font-size: <?php echo esc_html($style['mas_like_comm_font_size']); ?>; /*photo_caption_font_size*/;
379
- color: <?php echo esc_html($style['mas_comment_text_color']); ?>; /*comment_text_color*/
380
-
381
- }
382
-
383
- .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_photo_title {
384
- font-size: <?php echo esc_html($style['mas_photo_caption_font_size']); ?>; /*photo_caption_font_size*/
385
- color: <?php echo esc_html($style['mas_photo_caption_color']); ?>; /*photo_caption_color*/
386
- }
387
-
388
- .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_photo_title:hover {
389
- color: <?php echo esc_html($style['mas_photo_caption_hover_color']); ?>;
390
- }
391
-
392
- .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_load_more_spinner {
393
- color: <?php echo esc_html($style['load_more_text_color']); ?>; /*load_more_text_color*/
394
- font-size: <?php echo intval($style['load_more_text_font_size'])*1.5?>px; /*load_more_text_font_size*/
395
- }
396
-
397
- .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_load_more,
398
- .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_spinner {
399
- background-color: <?php echo esc_html($style['feed_container_bg_color']); ?>; /*feed_container_bg_color*/
400
- text-align: <?php echo esc_html($style['load_more_position']); ?>; /*load_more_position*/
401
- }
402
-
403
- .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_load_more_wrap,
404
- .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_spinner_wrap {
405
- padding: <?php echo esc_html($style['load_more_padding']); ?>; /*load_more_padding*/
406
- background-color: <?php echo esc_html($style['load_more_bg_color']); ?>; /*load_more_bg_color*/
407
- border-radius: <?php echo esc_html($style['load_more_border_radius']); ?>; /*load_more_border_radius*/
408
- height: <?php echo esc_html($style['load_more_height']); ?>; /*load_more_height*/
409
- width: <?php echo esc_html($style['load_more_width']); ?>; /*load_more_width*/
410
- border: <?php echo esc_html($style['load_more_border_size']); ?> solid <?php echo esc_html($style['load_more_border_color']); ?>; /*load_more_border_size, load_more_border_color*/;
411
- }
412
-
413
- <?php
414
- require_once(WDI_DIR . '/framework/WDILibrary.php');
415
- $rgb_overlay = WDILibrary::wdi_spider_hex2rgb(esc_html($style['mas_overlay_hover_color']));
416
- $rgba_overlay = 'rgba('. $rgb_overlay['red'] .',' . $rgb_overlay['green'] . ',' . $rgb_overlay['blue'] . ','.((100 - intval($style['mas_overlay_hover_transparent']))/100).')';
417
- ?>
418
-
419
- .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_photo_overlay:hover {
420
- background-color: <?php echo $rgba_overlay;?>
421
- }
422
-
423
- .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_photo_overlay i {
424
- font-size: <?php echo esc_html($style['th_overlay_hover_icon_font_size']); ?>;
425
- }
426
-
427
- .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_photo_overlay:hover i {
428
- color: <?php echo esc_html($style['th_overlay_hover_icon_color']);?>
429
- }
430
-
431
- <?php
432
- switch(esc_html($style['mas_photo_img_hover_effect'])){
433
- case 'rotate': {
434
- $effect = 'rotate(5deg)';
435
- break;
436
- }
437
- case 'scale':{
438
- $effect = 'scale(1.2)';
439
- break;
440
- }
441
- case 'rotate_and_scale':{
442
- $effect = 'scale(1.2) rotate(5deg)';
443
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
444
  }
445
- default:{
446
- $effect = 'none';
447
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
448
  }
 
 
 
449
  }
450
- ?>
451
- .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_photo_img:hover img {
452
- transform: <?php echo $effect?>
453
- }
454
 
455
- .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_filter_active_bg {
456
- background-color: <?php echo esc_html($style['active_filter_bg_color']);?>;
457
- }
458
 
459
- .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_media_user {
460
- color: <?php echo esc_html($style['mas_thumb_user_color']);?>;
461
- background-color: <?php echo esc_html($style['mas_thumb_user_bg_color']);?>;
462
- }
 
 
 
 
 
 
 
 
463
 
464
- </style>
465
- <?php
 
 
 
 
 
 
 
 
466
 
467
- $css = ob_get_contents();
468
- ob_end_clean();
 
 
 
 
469
 
470
- $css = strip_tags($css);
 
 
471
 
472
- return $css;
473
- }
 
 
474
 
475
- public function blog_view_styles(){
476
- $style = $this->theme_options;
477
- $theme_id = $this->theme_id;
478
- ob_start();
479
- ?>
480
- <style>
481
- .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_feed_container {
482
- width: <?php echo esc_html($style['feed_container_width']); ?>;
483
- background-color: <?php echo esc_html($style['feed_container_bg_color']); ?>; /*feed_container_bg_color*/
484
- }
485
-
486
- .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_header_img_wrap,
487
- .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_users_img_wrap {
488
- height: <?php echo esc_html($style['header_img_width']); ?>px; /*header_img_width*/
489
- width: <?php echo esc_html($style['header_img_width']); ?>px; /*header_img_width*/
490
- border-radius: <?php echo esc_html($style['header_border_radius']); ?>px; /*header_img_width*/
491
- }
492
-
493
- .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_photo_wrap {
494
- padding: <?php echo esc_html($style['blog_style_photo_wrap_padding']); ?>; /*photo_wrap_padding*/
495
- }
496
-
497
- .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_photo_wrap_inner {
498
- border: <?php echo esc_html($style['blog_style_photo_wrap_border_size']); ?> solid <?php echo esc_html($style['blog_style_photo_wrap_border_color']); ?>; /*photo_wrap_border_size,photo_wrap_border_color*/
499
- background-color: <?php echo esc_html($style['blog_style_photo_wrap_bg_color']); ?>; /*photo_wrap_bg_color*/
500
- }
501
-
502
- .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_photo_img {
503
- border-radius: <?php echo esc_html($style['blog_style_photo_img_border_radius']); ?>; /*photo_img_border_radius*/
504
- }
505
-
506
- .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_photo_meta {
507
- background-color: <?php echo esc_html($style['blog_style_photo_meta_bg_color']); ?>; /*photo_meta_bg_color*/
508
- }
509
-
510
- .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_thumb_likes {
511
- width: <?php echo (esc_html($style['blog_style_photo_meta_one_line'])=='1')? '50%' : '100%' ?>; /*photo_meta_one_line==false else 100%*/
512
- float: <?php echo (esc_html($style['blog_style_photo_meta_one_line'])=='1')? 'left' : 'none'?>; /*photo_meta_one_line==true else float none*/
513
- font-size: <?php echo esc_html($style['blog_style_like_comm_font_size']); ?>; /*photo_caption_font_size*/;
514
- color: <?php echo esc_html($style['blog_style_like_text_color']); ?>; /*like_text_color*/
515
-
516
- }
517
-
518
- .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_thumb_comments {
519
- width: <?php echo (esc_html($style['blog_style_photo_meta_one_line'])=='1')? '50%' : '100%' ?>; /*photo_meta_one_line==false else 100%*/
520
- float: <?php echo (esc_html($style['blog_style_photo_meta_one_line'])=='1')? 'left' : 'none'?>; /*photo_meta_one_line==true else float none*/
521
- font-size: <?php echo esc_html($style['blog_style_like_comm_font_size']); ?>; /*photo_caption_font_size*/;
522
- color: <?php echo esc_html($style['blog_style_comment_text_color']); ?>; /*comment_text_color*/
523
-
524
- }
525
-
526
- .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_photo_title {
527
- font-size: <?php echo esc_html($style['blog_style_photo_caption_font_size']); ?>; /*photo_caption_font_size*/
528
- color: <?php echo esc_html($style['blog_style_photo_caption_color']); ?>; /*photo_caption_color*/
529
- }
530
-
531
- .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_photo_title:hover {
532
- color: <?php echo esc_html($style['blog_style_photo_caption_hover_color']); ?>;
533
- }
534
-
535
- .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_load_more_spinner {
536
- color: <?php echo esc_html($style['load_more_text_color']); ?>; /*load_more_text_color*/
537
- font-size: <?php echo intval($style['load_more_text_font_size'])*1.5?>px; /*load_more_text_font_size*/
538
- }
539
-
540
- .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_load_more,
541
- .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_spinner {
542
- background-color: <?php echo esc_html($style['feed_container_bg_color']); ?>; /*feed_container_bg_color*/
543
- text-align: <?php echo esc_html($style['load_more_position']); ?>; /*load_more_position*/
544
- }
545
-
546
- .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_load_more_wrap,
547
- .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_spinner_wrap {
548
- padding: <?php echo esc_html($style['load_more_padding']); ?>; /*load_more_padding*/
549
- background-color: <?php echo esc_html($style['load_more_bg_color']); ?>; /*load_more_bg_color*/
550
- border-radius: <?php echo esc_html($style['load_more_border_radius']); ?>; /*load_more_border_radius*/
551
- height: <?php echo esc_html($style['load_more_height']); ?>; /*load_more_height*/
552
- width: <?php echo esc_html($style['load_more_width']); ?>; /*load_more_width*/
553
- border: <?php echo esc_html($style['load_more_border_size']); ?> solid <?php echo esc_html($style['load_more_border_color']); ?>; /*load_more_border_size, load_more_border_color*/;
554
- }
555
-
556
- </style>
557
- <?php
558
- $css = ob_get_contents();
559
- ob_end_clean();
560
-
561
- $css = strip_tags($css);
562
 
563
- return $css;
564
- }
 
565
 
566
- public function browser_view_styles(){
567
- $style = $this->theme_options;
568
- $theme_id = $this->theme_id;
569
- ob_start();
570
- ?>
571
- <style>
572
- .wdi_feed_<?php echo 'browser_' . intval($theme_id); ?> .wdi_feed_container {
573
- width: <?php echo esc_html($style['feed_container_width']); ?>;
574
- background-color: <?php echo esc_html($style['feed_container_bg_color']); ?>; /*feed_container_bg_color*/
575
- border-bottom: 5px solid <?php echo esc_html($style['feed_container_bg_color']); ?>; /*feed_container_bg_color*/;
576
- }
577
-
578
- .wdi_feed_<?php echo 'browser_' . intval($theme_id); ?> .wdi_header_img_wrap,
579
- .wdi_feed_<?php echo 'browser_' . intval($theme_id); ?> .wdi_users_img_wrap {
580
- height: <?php echo esc_html($style['header_img_width']); ?>px; /*header_img_width*/
581
- width: <?php echo esc_html($style['header_img_width']); ?>px; /*header_img_width*/
582
- border-radius: <?php echo esc_html($style['header_border_radius']); ?>px; /*header_img_width*/
583
- }
584
-
585
- .wdi_feed_<?php echo 'browser_' . intval($theme_id); ?> .wdi_photo_wrap {
586
- padding: <?php echo esc_html($style['image_browser_photo_wrap_padding']); ?>; /*photo_wrap_padding*/
587
-
588
- }
589
-
590
- .wdi_feed_<?php echo 'browser_' . intval($theme_id); ?> .wdi_photo_wrap_inner {
591
- border: <?php echo esc_html($style['image_browser_photo_wrap_border_size']); ?> solid <?php echo esc_html($style['image_browser_photo_wrap_border_color']); ?>; /*photo_wrap_border_size,photo_wrap_border_color*/
592
- background-color: <?php echo esc_html($style['image_browser_photo_wrap_bg_color']); ?>; /*photo_wrap_bg_color*/
593
- }
594
-
595
- .wdi_feed_<?php echo 'browser_' . intval($theme_id); ?> .wdi_photo_img {
596
- border-radius: <?php echo esc_html($style['image_browser_photo_img_border_radius']); ?>; /*photo_img_border_radius*/
597
- }
598
-
599
- .wdi_feed_<?php echo 'browser_' . intval($theme_id); ?> .wdi_photo_meta {
600
- background-color: <?php echo esc_html($style['image_browser_photo_meta_bg_color']); ?>; /*photo_meta_bg_color*/
601
- }
602
-
603
- .wdi_feed_<?php echo 'browser_' . intval($theme_id); ?> .wdi_thumb_likes {
604
- width: <?php echo (esc_html($style['image_browser_photo_meta_one_line'])=='1')? '50%' : '100%' ?>; /*photo_meta_one_line==false else 100%*/
605
- float: <?php echo (esc_html($style['image_browser_photo_meta_one_line'])=='1')? 'left' : 'none'?>; /*photo_meta_one_line==true else float none*/
606
- font-size: <?php echo esc_html($style['image_browser_like_comm_font_size']); ?>; /*photo_caption_font_size*/;
607
- color: <?php echo esc_html($style['image_browser_like_text_color']); ?>; /*like_text_color*/
608
-
609
- }
610
-
611
- .wdi_feed_<?php echo 'browser_' . intval($theme_id); ?> .wdi_thumb_comments {
612
- width: <?php echo (esc_html($style['image_browser_photo_meta_one_line'])=='1')? '50%' : '100%' ?>; /*photo_meta_one_line==false else 100%*/
613
- float: <?php echo (esc_html($style['image_browser_photo_meta_one_line'])=='1')? 'left' : 'none'?>; /*photo_meta_one_line==true else float none*/
614
- font-size: <?php echo esc_html($style['image_browser_like_comm_font_size']); ?>; /*photo_caption_font_size*/;
615
- color: <?php echo esc_html($style['image_browser_comment_text_color']); ?>; /*comment_text_color*/
616
-
617
- }
618
-
619
- .wdi_feed_<?php echo 'browser_' . intval($theme_id); ?> .wdi_photo_title {
620
- font-size: <?php echo esc_html($style['image_browser_photo_caption_font_size']); ?>; /*photo_caption_font_size*/
621
- color: <?php echo esc_html($style['image_browser_photo_caption_color']); ?>; /*photo_caption_color*/
622
- }
623
-
624
- .wdi_feed_<?php echo 'browser_' . intval($theme_id); ?> .wdi_photo_title:hover {
625
- color: <?php echo esc_html($style['image_browser_photo_caption_hover_color']); ?>;
626
- }
627
-
628
- .wdi_feed_<?php echo 'browser_' . intval($theme_id); ?> .wdi_load_more {
629
- background-color: <?php echo esc_html($style['feed_container_bg_color']); ?>; /*feed_container_bg_color*/
630
- text-align: <?php echo esc_html($style['load_more_position']); ?>; /*load_more_position*/
631
- }
632
-
633
- .wdi_feed_<?php echo 'browser_' . intval($theme_id); ?> .wdi_load_more_wrap {
634
- padding: <?php echo esc_html($style['load_more_padding']); ?>; /*load_more_padding*/
635
- background-color: <?php echo esc_html($style['load_more_bg_color']); ?>; /*load_more_bg_color*/
636
- border-radius: <?php echo esc_html($style['load_more_border_radius']); ?>; /*load_more_border_radius*/
637
- height: <?php echo esc_html($style['load_more_height']); ?>; /*load_more_height*/
638
- width: <?php echo esc_html($style['load_more_width']); ?>; /*load_more_width*/
639
- border: <?php echo esc_html($style['load_more_border_size']); ?> solid <?php echo esc_html($style['load_more_border_color']); ?>; /*load_more_border_size, load_more_border_color*/;
640
- }
641
-
642
- </style>
643
- <?php
644
- $css = ob_get_contents();
645
- ob_end_clean();
646
-
647
- $css = strip_tags($css);
648
 
649
- return $css;
650
- }
 
 
 
 
 
651
 
652
- public function lightbox_styles(){
653
- $style = $this->theme_options;
654
- $theme_id = $this->theme_id;
655
- $rgb_lightbox_ctrl_cont_bg_color = WDILibrary::wdi_spider_hex2rgb(esc_html($style['lightbox_ctrl_cont_bg_color']));
656
- $rgb_wdi_image_info_bg_color = WDILibrary::wdi_spider_hex2rgb(esc_html($style['lightbox_info_bg_color']));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
657
 
658
- $filmstrip_direction = 'horizontal';
659
- if (esc_html($style['lightbox_filmstrip_pos']) == 'right' || esc_html($style['lightbox_filmstrip_pos']) == 'left') {
660
- $filmstrip_direction = 'vertical';
 
 
 
 
 
 
 
 
 
 
 
 
 
661
  }
662
 
663
- $lb_container = '.wdi_lightbox_theme_' . intval($theme_id);
664
- $feed_conatiner = '.wdi_feed_theme_' . intval($theme_id);
665
- ob_start();
666
- ?>
667
- <style>
668
- /*@import url(https://fonts.googleapis.com/css?family=Maven+Pro:400,500);*/
669
- .wdi_spider_popup_wrap * {
670
- -moz-box-sizing: border-box;
671
- -webkit-box-sizing: border-box;
672
- box-sizing: border-box;
673
- }
674
-
675
- <?php echo $feed_conatiner; ?> .wdi_spider_popup_overlay {
676
- background-color: <?php echo esc_html($style['lightbox_overlay_bg_color']); ?>;
677
- opacity: <?php echo intval(esc_html($style['lightbox_overlay_bg_transparent'])/100); ?>;
678
- }
679
-
680
- <?php echo $lb_container; ?>.wdi_spider_popup_wrap {
681
- background-color: <?php echo esc_html($style['lightbox_bg_color']); ?>;
682
- display: inline-block;
683
- left: 50%;
684
- outline: medium none;
685
- position: fixed;
686
- text-align: center;
687
- top: 50%;
688
- z-index: 100000;
689
- }
690
-
691
- <?php echo $lb_container; ?> .wdi_ctrl_btn {
692
- color: <?php echo esc_html($style['lightbox_ctrl_btn_color']); ?>;
693
- font-size: <?php echo esc_html($style['lightbox_ctrl_btn_height']); ?>px;
694
- margin: <?php echo esc_html($style['lightbox_ctrl_btn_margin_top']); ?>px <?php echo esc_html($style['lightbox_ctrl_btn_margin_left']); ?>px;
695
- opacity: <?php echo number_format(esc_html($style['lightbox_ctrl_btn_transparent']) / 100, 2, ".", ""); ?>;
696
- filter: Alpha(opacity=<?php echo esc_html($style['lightbox_ctrl_btn_transparent']); ?>);
697
- }
698
-
699
- <?php echo $lb_container; ?> .wdi_toggle_btn {
700
- color: <?php echo esc_html($style['lightbox_ctrl_btn_color']); ?>;
701
- font-size: <?php echo esc_html($style['lightbox_toggle_btn_height']); ?>px;
702
- margin: 0;
703
- opacity: <?php echo number_format(esc_html($style['lightbox_ctrl_btn_transparent']) / 100, 2, ".", ""); ?>;
704
- filter: Alpha(opacity=<?php echo esc_html($style['lightbox_ctrl_btn_transparent']); ?>);
705
- padding: 0;
706
- }
707
-
708
- .wdi_btn_container {
709
- bottom: 0;
710
- left: 0;
711
- overflow: hidden;
712
- position: absolute;
713
- right: 0;
714
- top: 0;
715
- }
716
-
717
- <?php echo $lb_container; ?> .wdi_ctrl_btn_container {
718
- background-color: rgba(<?php echo esc_html($rgb_lightbox_ctrl_cont_bg_color['red']); ?>, <?php echo esc_html($rgb_lightbox_ctrl_cont_bg_color['green']); ?>, <?php echo esc_html($rgb_lightbox_ctrl_cont_bg_color['blue']); ?>, <?php echo number_format(esc_html($style['lightbox_ctrl_cont_transparent']) / 100, 2, ".", ""); ?>);
719
- /*background: none repeat scroll 0 0 #
720
- <?php echo esc_html($style['lightbox_ctrl_cont_bg_color']); ?> ;*/
721
- <?php
722
- if (esc_html($style['lightbox_ctrl_btn_pos']) == 'top') { ?> border-bottom-left-radius: <?php echo esc_html($style['lightbox_ctrl_cont_border_radius']); ?>px;
723
- border-bottom-right-radius: <?php echo esc_html($style['lightbox_ctrl_cont_border_radius']); ?>px;
724
- <?php } else { ?> bottom: 0;
725
- border-top-left-radius: <?php echo esc_html($style['lightbox_ctrl_cont_border_radius']); ?>px;
726
- border-top-right-radius: <?php echo esc_html($style['lightbox_ctrl_cont_border_radius']); ?>px;
727
- <?php } ?> height: <?php echo esc_html($style['lightbox_ctrl_btn_height']) + 2 * esc_html($style['lightbox_ctrl_btn_margin_top']); ?>px;
728
- /*opacity:
729
- <?php echo number_format(esc_html($style['lightbox_ctrl_cont_transparent']) / 100, 2, ".", ""); ?> ;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
730
  filter: Alpha(opacity=
731
  <?php echo esc_html($style['lightbox_ctrl_cont_transparent']); ?> );*/
732
- position: absolute;
733
- text-align: <?php echo esc_html($style['lightbox_ctrl_btn_align']); ?>;
734
- width: 100%;
735
- z-index: 10150;
736
- padding: 8px;
737
- }
738
-
739
- <?php echo $lb_container; ?> .wdi_toggle_container {
740
- background: none repeat scroll 0 0 <?php echo esc_html($style['lightbox_ctrl_cont_bg_color']); ?>;
741
- <?php if (esc_html($style['lightbox_ctrl_btn_pos']) == 'top') { ?>
742
- border-bottom-left-radius: <?php echo esc_html($style['lightbox_ctrl_cont_border_radius']); ?>px;
743
- border-bottom-right-radius: <?php echo esc_html($style['lightbox_ctrl_cont_border_radius']); ?>px;
744
- border-radius: <?php echo esc_html($style['lightbox_ctrl_cont_border_radius']); ?>px;
745
- top: <?php echo esc_html($style['lightbox_ctrl_btn_height']) + 2 * esc_html($style['lightbox_ctrl_btn_margin_top']); ?>px;
746
- <?php } else { ?>
747
- border-top-left-radius: <?php echo esc_html($style['lightbox_ctrl_cont_border_radius']); ?>px;
748
- border-top-right-radius: <?php echo esc_html($style['lightbox_ctrl_cont_border_radius']); ?>px;
749
- border-radius: <?php echo esc_html($style['lightbox_ctrl_cont_border_radius']); ?>px;
750
- bottom: <?php echo esc_html($style['lightbox_ctrl_btn_height']) + 2 * esc_html($style['lightbox_ctrl_btn_margin_top']); ?>px;
751
- <?php }?>
752
- cursor: pointer;
753
- left: 50%;
754
- line-height: 0;
755
- margin-left: -<?php echo esc_html($style['lightbox_toggle_btn_width']) / 2; ?>px;
756
- opacity: <?php echo number_format(esc_html($style['lightbox_ctrl_cont_transparent']) / 100, 2, ".", ""); ?>;
757
- filter: Alpha(opacity=<?php echo esc_html($style['lightbox_ctrl_cont_transparent']); ?>);
758
- position: absolute;
759
- text-align: center;
760
- width: <?php echo esc_html($style['lightbox_toggle_btn_width']); ?>px;
761
- z-index: 10149;
762
- }
763
-
764
- <?php echo $lb_container; ?> .wdi_close_btn {
765
- opacity: <?php echo number_format(esc_html($style['lightbox_close_btn_transparent']) / 100, 2, ".", ""); ?>;
766
- filter: Alpha(opacity=<?php echo esc_html($style['lightbox_close_btn_transparent']); ?>);
767
- }
768
-
769
- <?php echo $lb_container; ?> .wdi_spider_popup_close {
770
- background-color: <?php echo esc_html($style['lightbox_close_btn_bg_color']); ?>;
771
- border-radius: <?php echo esc_html($style['lightbox_close_btn_border_radius']); ?>px;
772
- border: <?php echo esc_html($style['lightbox_close_btn_border_width']); ?>px <?php echo esc_html($style['lightbox_close_btn_border_style']); ?> <?php echo esc_html($style['lightbox_close_btn_border_color']); ?>;
773
- box-shadow: <?php echo esc_html($style['lightbox_close_btn_box_shadow']); ?>;
774
- color: <?php echo esc_html($style['lightbox_close_btn_color']); ?>;
775
- height: <?php echo esc_html($style['lightbox_close_btn_height']); ?>px;
776
- font-size: <?php echo esc_html($style['lightbox_close_btn_size']); ?>px;
777
- right: <?php echo esc_html($style['lightbox_close_btn_right']); ?>px;
778
- top: <?php echo esc_html($style['lightbox_close_btn_top']); ?>px;
779
- width: <?php echo esc_html($style['lightbox_close_btn_width']); ?>px;
780
- }
781
-
782
- <?php echo $lb_container; ?> .wdi_spider_popup_close_fullscreen {
783
- color: <?php echo esc_html($style['lightbox_close_btn_full_color']); ?>;
784
- font-size: <?php echo esc_html($style['lightbox_close_btn_size']); ?>px;
785
- right: 15px;
786
- }
787
-
788
- .wdi_spider_popup_close span,
789
- #wdi_spider_popup_left-ico span,
790
- #wdi_spider_popup_right-ico span {
791
- display: table-cell;
792
- text-align: center;
793
- vertical-align: middle;
794
- }
795
-
796
- <?php echo $lb_container; ?> #wdi_spider_popup_left-ico,
797
- <?php echo $lb_container; ?> #wdi_spider_popup_right-ico {
798
- background-color: <?php echo esc_html($style['lightbox_rl_btn_bg_color']); ?>;
799
- /***/
800
- border-radius: <?php echo esc_html($style['lightbox_rl_btn_border_radius']); ?>px;
801
- /***/
802
- border: <?php echo esc_html($style['lightbox_rl_btn_border_width']); ?>px <?php echo esc_html($style['lightbox_rl_btn_border_style']); ?> <?php echo esc_html($style['lightbox_rl_btn_border_color']); ?>;
803
- box-shadow: <?php echo esc_html($style['lightbox_rl_btn_box_shadow']); ?>;
804
- color: <?php echo esc_html($style['lightbox_rl_btn_color']); ?>;
805
- height: <?php echo esc_html($style['lightbox_rl_btn_height']); ?>px;
806
- font-size: <?php echo esc_html($style['lightbox_rl_btn_size']); ?>px;
807
- width: <?php echo esc_html($style['lightbox_rl_btn_width']); ?>px;
808
- opacity: <?php echo number_format(esc_html($style['lightbox_rl_btn_transparent']) / 100, 2, ".", ""); ?>;
809
- filter: Alpha(opacity=<?php echo esc_html($style['lightbox_rl_btn_transparent']); ?>);
810
- }
811
-
812
- <?php echo $lb_container; ?> .wdi_ctrl_btn:hover,
813
- <?php echo $lb_container; ?> .wdi_toggle_btn:hover,
814
- <?php echo $lb_container; ?> #wdi_spider_popup_left-ico:hover,
815
- <?php echo $lb_container; ?> #wdi_spider_popup_right-ico:hover {
816
- color: <?php echo esc_html($style['lightbox_close_rl_btn_hover_color']); ?>;
817
- cursor: pointer;
818
- }
819
-
820
- <?php echo $lb_container; ?> .wdi_spider_popup_close:hover,
821
- <?php echo $lb_container; ?> .wdi_spider_popup_close_fullscreen:hover{
822
- color: <?php echo esc_html($style['lightbox_close_btn_hover_color']);?>;
823
- cursor: pointer;
824
- }
825
-
826
- .wdi_image_wrap {
827
- height: inherit;
828
- display: table;
829
- position: absolute;
830
- text-align: center;
831
- width: inherit;
832
- }
833
- .wdi_image_wrap * {
834
- -moz-user-select: none;
835
- -khtml-user-select: none;
836
- -webkit-user-select: none;
837
- -ms-user-select: none;
838
- user-select: none;
839
- }
840
- .wdi_embed_frame{
841
- text-align:center;
842
- }
843
- .wdi_comment_wrap {
844
- bottom: 0;
845
- left: 0;
846
- overflow: hidden;
847
- position: absolute;
848
- right: 0;
849
- top: 0;
850
- z-index: -1;
851
- }
852
-
853
- <?php echo $lb_container; ?> .wdi_comment_container {
854
- -moz-box-sizing: border-box;
855
- background-color: <?php echo esc_html($style['lightbox_comment_bg_color']); ?>;
856
- color: <?php echo esc_html($style['lightbox_comment_font_color']); ?>;
857
- font-size: <?php echo esc_html($style['lightbox_comment_font_size']); ?>px;
858
- font-family: <?php echo esc_html($style['lightbox_comment_font_style']); ?>;
859
- height: 100%;
860
- overflow: hidden;
861
- position: absolute;
862
- <?php echo esc_html($style['lightbox_comment_pos']); ?>: -<?php echo esc_html($style['lightbox_comment_width']); ?>px;
863
- top: 0;
864
- width: <?php echo esc_html($style['lightbox_comment_width']); ?>px;
865
- z-index: 10103;
866
- }
867
-
868
- <?php echo $lb_container; ?> .wdi_comments {
869
- bottom: 0;
870
- font-size: <?php echo esc_html($style['lightbox_comment_font_size']); ?>px;
871
- font-family: <?php echo esc_html($style['lightbox_comment_font_style']); ?>;
872
- height: 100%;
873
- left: 0;
874
- overflow-x: hidden;
875
- overflow-y: auto;
876
- position: absolute;
877
- top: 0;
878
- width: 100%;
879
- z-index: 10101;
880
- }
881
-
882
- .wdi_comments p,
883
- .wdi_comment_body_p {
884
- margin: 5px !important;
885
- text-align: left;
886
- word-wrap: break-word;
887
- word-break: break-word;
888
- }
889
- .wdi_no_comment{
890
- text-align: center !important;
891
- }
892
-
893
- <?php echo $lb_container; ?> .wdi_comments input[type="submit"] {
894
- background: none repeat scroll 0 0 <?php echo esc_html($style['lightbox_comment_button_bg_color']); ?>;
895
- border: <?php echo esc_html($style['lightbox_comment_button_border_width']); ?>px <?php echo esc_html($style['lightbox_comment_button_border_style']); ?> <?php echo esc_html($style['lightbox_comment_button_border_color']); ?>;
896
- border-radius: <?php echo esc_html($style['lightbox_comment_button_border_radius']); ?>px;
897
- color: <?php echo esc_html($style['lightbox_comment_font_color']); ?>;
898
- cursor: pointer;
899
- padding: <?php echo esc_html($style['lightbox_comment_button_padding']); ?>;
900
- }
901
-
902
-
903
- <?php echo $lb_container; ?> .wdi_comments input[type="text"],
904
- <?php echo $lb_container; ?> .wdi_comments textarea {
905
- background: none repeat scroll 0 0 <?php echo esc_html($style['lightbox_comment_input_bg_color']); ?>;
906
- border: <?php echo esc_html($style['lightbox_comment_input_border_width']); ?>px <?php echo esc_html($style['lightbox_comment_input_border_style']); ?> <?php echo esc_html($style['lightbox_comment_input_border_color']); ?>;
907
- /***/
908
- border-radius: <?php echo esc_html($style['lightbox_comment_input_border_radius']); ?>px;
909
- /***/
910
- color: <?php echo esc_html($style['lightbox_comment_font_color']); ?>;
911
- padding: <?php echo esc_html($style['lightbox_comment_input_padding']); ?>;
912
- width: 100%;
913
- }
914
-
915
- .wdi_comments textarea {
916
- resize: vertical;
917
- }
918
- <?php echo $lb_container; ?> .wdi_comment_header_p {
919
- border-top: <?php echo esc_html($style['lightbox_comment_separator_width']); ?>px <?php echo esc_html($style['lightbox_comment_separator_style']); ?> <?php echo esc_html($style['lightbox_comment_separator_color']); ?>;
920
- }
921
-
922
- <?php echo $lb_container; ?> .wdi_comment_header {
923
- margin-top: 2px;
924
- display: inline-block;
925
- color: <?php echo esc_html($style['lightbox_comment_font_color']); ?>;
926
- font-size: <?php echo esc_html($style['lightbox_comment_author_font_size']); ?>px;
927
- }
928
-
929
- <?php echo $lb_container; ?> .wdi_comment_date {
930
- color: <?php echo esc_html($style['lightbox_comment_font_color']); ?>;
931
- float: right;
932
- font-size: <?php echo esc_html($style['lightbox_comment_date_font_size']); ?>px;
933
- }
934
-
935
- <?php echo $lb_container; ?> .wdi_comment_body {
936
- color: <?php echo esc_html($style['lightbox_comment_font_color']); ?>;
937
- font-size: <?php echo esc_html($style['lightbox_comment_body_font_size']); ?>px;
938
- }
939
- .wdi_comment_delete_btn {
940
- color: #FFFFFF;
941
- cursor: pointer;
942
- float: right;
943
- font-size: 14px;
944
- margin: 2px;
945
- }
946
-
947
- <?php echo $lb_container; ?> .wdi_comments_close {
948
- cursor: pointer;
949
- line-height: 0;
950
- position: absolute;
951
- font-size: 13px;
952
- text-align: <?php echo ((esc_html($style['lightbox_comment_pos']) == 'left') ? 'right' : 'left'); ?>;
953
- margin: 5px;
954
- <?php echo ((esc_html($style['lightbox_comment_pos']) == 'left') ? 'right' : 'left'); ?> : 0;
955
- top: 0;
956
- background-color: <?php echo esc_html($style['lightbox_comment_bg_color']); ?>;
957
- z-index: 10202;
958
- }
959
-
960
- .wdi_comments_close i{
961
- z-index: 10201;
962
- }
963
- .wdi_comment_textarea::-webkit-scrollbar {
964
- width: 4px;
965
- }
966
- .wdi_comment_textarea::-webkit-scrollbar-track {
967
- }
968
- .wdi_comment_textarea::-webkit-scrollbar-thumb {
969
- background-color: rgba(255, 255, 255, 0.55);
970
- border-radius: 2px;
971
- }
972
- .wdi_comment_textarea::-webkit-scrollbar-thumb:hover {
973
- background-color: #D9D9D9;
974
- }
975
- .wdi_ctrl_btn_container a,
976
- .wdi_ctrl_btn_container a:hover {
977
- text-decoration: none;
978
- }
979
-
980
- .wdi_facebook:hover {
981
- color: #3B5998 !important;
982
- cursor: pointer;
983
- }
984
- .wdi_twitter:hover {
985
- color: #4099FB !important;
986
- cursor: pointer;
987
- }
988
- .wdi_google:hover {
989
- color: #DD4B39 !important;
990
- cursor: pointer;
991
- }
992
- .wdi_pinterest:hover {
993
- color: #cb2027 !important;
994
- cursor: pointer;
995
- }
996
- .wdi_tumblr:hover {
997
- color: #2F5070 !important;
998
- cursor: pointer;
999
- }
1000
- .wdi_linkedin:hover {
1001
- color: #0077B5 !important;
1002
- cursor: pointer;
1003
- }
1004
-
1005
- <?php echo $lb_container; ?> .wdi_facebook,
1006
- <?php echo $lb_container; ?> .wdi_twitter,
1007
- <?php echo $lb_container; ?> .wdi_google,
1008
- <?php echo $lb_container; ?> .wdi_pinterest,
1009
- <?php echo $lb_container; ?> .wdi_tumblr,
1010
- <?php echo $lb_container; ?> .wdi_linkedin {
1011
- color: <?php echo esc_html($style['lightbox_comment_share_button_color']); ?> !important;
1012
- }
1013
-
1014
- <?php echo $lb_container; ?> .wdi_thumb_active {
1015
- opacity: 1;
1016
- filter: Alpha(opacity=100);
1017
- border: <?php echo esc_html($style['lightbox_filmstrip_thumb_active_border_width']); ?>px solid <?php echo esc_html($style['lightbox_filmstrip_thumb_active_border_color']); ?>;
1018
- }
1019
-
1020
- <?php echo $lb_container; ?> .wdi_thumb_deactive {
1021
- opacity: <?php echo number_format(esc_html($style['lightbox_filmstrip_thumb_deactive_transparent']) / 100, 2, ".", ""); ?>;
1022
- filter: Alpha(opacity=<?php echo esc_html($style['lightbox_filmstrip_thumb_deactive_transparent']); ?>);
1023
- }
1024
- <?php echo $lb_container; ?> .wdi_filmstrip_thumbnail_img {
1025
- display: block;
1026
- opacity: 1;
1027
- filter: Alpha(opacity=100);
1028
- }
1029
-
1030
- <?php echo $lb_container; ?> .wdi_filmstrip_left i,
1031
- <?php echo $lb_container; ?> .wdi_filmstrip_right i {
1032
- color: <?php echo esc_html($style['lightbox_filmstrip_rl_btn_color']); ?>;
1033
- font-size: <?php echo esc_html($style['lightbox_filmstrip_rl_btn_size']); ?>px;
1034
- }
1035
-
1036
- .wdi_none_selectable {
1037
- -webkit-touch-callout: none;
1038
- -webkit-user-select: none;
1039
- -khtml-user-select: none;
1040
- -moz-user-select: none;
1041
- -ms-user-select: none;
1042
- user-select: none;
1043
- }
1044
- .wdi_slide_container {
1045
- display: table-cell;
1046
- position: absolute;
1047
- vertical-align: middle;
1048
- width: 100%;
1049
- height: 100%;
1050
- }
1051
- .wdi_slide_bg {
1052
- margin: 0 auto;
1053
- width: inherit;
1054
- height: inherit;
1055
- }
1056
- .wdi_slider {
1057
- height: inherit;
1058
- width: inherit;
1059
- }
1060
- .wdi_popup_image_spun {
1061
- height: inherit;
1062
- display: table-cell;
1063
- filter: Alpha(opacity=100);
1064
- opacity: 1;
1065
- position: absolute;
1066
- vertical-align: middle;
1067
- width: inherit;
1068
- z-index: 2;
1069
- }
1070
- .wdi_popup_image_second_spun {
1071
- width: inherit;
1072
- height: inherit;
1073
- display: table-cell;
1074
- filter: Alpha(opacity=0);
1075
- opacity: 0;
1076
- position: absolute;
1077
- vertical-align: middle;
1078
- z-index: 1;
1079
- }
1080
- .wdi_grid {
1081
- display: none;
1082
- height: 100%;
1083
- overflow: hidden;
1084
- position: absolute;
1085
- width: 100%;
1086
- }
1087
- .wdi_gridlet {
1088
- opacity: 1;
1089
- filter: Alpha(opacity=100);
1090
- position: absolute;
1091
- }
1092
-
1093
- <?php echo $lb_container; ?> .wdi_image_info_spun {
1094
- text-align: <?php echo esc_html($style['lightbox_info_align']); ?>;
1095
- vertical-align: <?php echo esc_html($style['lightbox_info_pos']); ?>;
1096
- }
1097
-
1098
- <?php echo $lb_container; ?> .wdi_image_title,
1099
- <?php echo $lb_container; ?> .wdi_image_title * {
1100
- color: <?php echo esc_html($style['lightbox_title_color']); ?> !important;
1101
- font-family: <?php echo esc_html($style['lightbox_title_font_style']); ?>;
1102
- font-size: <?php echo esc_html($style['lightbox_title_font_size']); ?>px;
1103
- font-weight: <?php echo esc_html($style['lightbox_title_font_weight']); ?>;
1104
- }
1105
-
1106
- <?php echo $lb_container; ?> .wdi_image_description,
1107
- <?php echo $lb_container; ?> .wdi_image_description * {
1108
- color: <?php echo esc_html($style['lightbox_description_color']); ?> !important;
1109
- font-family: <?php echo esc_html($style['lightbox_description_font_style']); ?>;
1110
- font-size: <?php echo esc_html($style['lightbox_description_font_size']); ?>px;
1111
- font-weight: <?php echo esc_html($style['lightbox_description_font_weight']); ?>;
1112
- }
1113
-
1114
- .wdi_title{
1115
- display: inline-table;
1116
- }
1117
- .wdi_title:hover{
1118
- cursor: pointer;
1119
- }
1120
- .wdi_title .wdi_users_img_wrap{
1121
- width: 50px;
1122
- display: table-cell;
1123
- vertical-align: middle;
1124
- float: right;
1125
- padding-left: 10px;
1126
- overflow: hidden;
1127
- }
1128
- .wdi_title .wdi_users_img_wrap img{
1129
- width: 100%;
1130
- }
1131
- .wdi_title .wdi_header_text{
1132
- display: table-cell;
1133
- vertical-align: middle;
1134
- word-break: break-all;
1135
- }
1136
-
1137
- <?php echo $lb_container ; ?> .wdi_share_btns{
1138
- position: absolute;
1139
- <?php $shareBtn = esc_html($style['lightbox_ctrl_btn_height']) + esc_html($style['lightbox_ctrl_btn_margin_top']) + 8; ?>
1140
- <?php echo (esc_html($style['lightbox_ctrl_btn_pos']) == 'top') ? 'bottom' : 'top';?>: <?php echo -$shareBtn;?>px;
1141
- height: <?php echo esc_html($style['lightbox_ctrl_btn_height']) + esc_html($style['lightbox_ctrl_btn_margin_top']);?>px;
1142
- width: <?php echo esc_html($style['lightbox_ctrl_btn_height'])*7.5;?>px;
1143
- border-radius: 3px;
1144
- right: -145px;
1145
- margin: 0;
1146
- z-index: 200000;
1147
- background-color: rgba(<?php echo esc_html($rgb_lightbox_ctrl_cont_bg_color['red']); ?>, <?php echo esc_html($rgb_lightbox_ctrl_cont_bg_color['green']); ?>, <?php echo esc_html($rgb_lightbox_ctrl_cont_bg_color['blue']); ?>, <?php echo number_format(esc_html($style['lightbox_ctrl_cont_transparent']) / 100, 2, ".", ""); ?>);
1148
- padding-top: 5px;
1149
- }
1150
-
1151
- .wdi_share_btns_container{
1152
- position: relative;
1153
- display: inline-block;
1154
- }
1155
-
1156
- <?php echo $lb_container ; ?> .wdi_share_popup_btn{
1157
- color: <?php echo esc_html($style['lightbox_ctrl_btn_color']); ?>;
1158
- padding: 3px;
1159
- opacity: <?php echo number_format(esc_html($style['lightbox_ctrl_btn_transparent']) / 100, 2, ".", ""); ?>;
1160
- filter: Alpha(opacity=<?php echo esc_html($style['lightbox_ctrl_btn_transparent']); ?>);
1161
- font-size: <?php echo esc_html($style['lightbox_ctrl_btn_height']);?>px;
1162
- }
1163
-
1164
- <?php echo $lb_container ; ?> .wdi_share_caret{
1165
- font-size: 15px;
1166
- color: <?php echo esc_html($style['lightbox_ctrl_cont_bg_color']); ?>;
1167
- opacity: <?php echo number_format(esc_html($style['lightbox_ctrl_cont_transparent']) / 100, 2, ".", ""); ?>;
1168
- position: absolute;
1169
- top: -25px;
1170
- left: 13px;
1171
- }
1172
-
1173
- .wdi_share_toggler{
1174
- display: block !important;
1175
- }
1176
- .wdi_facebook_btn:hover{
1177
- color: #45619D;
1178
- }
1179
- .wdi_facebook_btn:hover{
1180
- color: #4099FB;
1181
- }
1182
-
1183
- <?php echo $lb_container;?> .wdi_comment_header a,
1184
- <?php echo $lb_container;?> .wdi_comment_header a:visited{
1185
- color: <?php echo esc_html($style['lightbox_comment_author_font_color']); ?> !important;
1186
- }
1187
-
1188
- <?php echo $lb_container;?> .wdi_comm_text_link,
1189
- <?php echo $lb_container;?> a.wdi_comm_text_link:visited{
1190
- color: <?php echo esc_html($style['lightbox_comment_author_font_color']); ?>!important;
1191
- }
1192
- <?php echo $lb_container;?> .wdi_comment_header a:hover,
1193
- <?php echo $lb_container;?> a.wdi_comm_text_link:hover{
1194
- text-decoration: none;
1195
- color: <?php echo esc_html($style['lightbox_comment_author_font_color_hover']); ?>!important;
1196
- }
1197
-
1198
- <?php echo $lb_container;?> .wdi_load_more_comments{
1199
- display: inline-block;
1200
- color: <?php echo esc_html($style['lightbox_comment_load_more_color']); ?>;
1201
- background-color: <?php echo esc_html($style['lightbox_comment_bg_color']); ?>;
1202
- -webkit-user-select: none; /* Chrome/Safari */
1203
- -moz-user-select: none; /* Firefox */
1204
- -ms-user-select: none; /* IE10+ */
1205
- /* Rules below not implemented in browsers yet */
1206
- -o-user-select: none;
1207
- user-select: none;
1208
- font-family: 'Verdana', sans-serif;
1209
- text-transform: capitalize;
1210
- font-size: 17px;
1211
- }
1212
-
1213
- <?php echo $lb_container;?> .wdi_load_more_comments:hover{
1214
- color: <?php echo esc_html($style['lightbox_comment_load_more_color_hover']);?>;
1215
- cursor: pointer;
1216
- }
1217
-
1218
-
1219
- /*partly*/
1220
-
1221
- .wdi_popup_image {
1222
- vertical-align: middle;
1223
- display: inline-block;
1224
- }
1225
-
1226
-
1227
- .wdi_popup_embed {
1228
- vertical-align: middle;
1229
- text-align: center;
1230
- display: inline-block;
1231
- }
1232
-
1233
- .wdi_image_container{
1234
- display: table;
1235
- position: absolute;
1236
- text-align: center;
1237
- vertical-align: middle;
1238
- width: 100%;
1239
- }
1240
-
1241
- <?php echo $lb_container; ?> .wdi_filmstrip_container {
1242
- display: <?php echo ($filmstrip_direction == 'horizontal'? 'table' : 'block'); ?>;
1243
- position: absolute;
1244
- z-index: 10105;
1245
- <?php echo esc_html($style['lightbox_filmstrip_pos']); ?>: 0;
1246
- }
1247
-
1248
- .wdi_filmstrip {
1249
- overflow: hidden;
1250
- position: absolute;
1251
- z-index: 10106;
1252
- }
1253
-
1254
- .wdi_filmstrip_thumbnails {
1255
- margin: 0 auto;
1256
- overflow: hidden;
1257
- position: relative;
1258
- }
1259
-
1260
- <?php echo $lb_container; ?> .wdi_filmstrip_thumbnail {
1261
- position: relative;
1262
- background: none;
1263
- border: <?php echo esc_html($style['lightbox_filmstrip_thumb_border_width']); ?>px <?php echo esc_html($style['lightbox_filmstrip_thumb_border_style']); ?> <?php echo esc_html($style['lightbox_filmstrip_thumb_border_color']); ?>;
1264
- border-radius: <?php echo esc_html($style['lightbox_filmstrip_thumb_border_radius']); ?>px;
1265
- cursor: pointer;
1266
- float: left;
1267
- margin: <?php echo esc_html($style['lightbox_filmstrip_thumb_margin']); ?>;
1268
- overflow: hidden;
1269
- }
1270
-
1271
- <?php echo $lb_container; ?> .wdi_filmstrip_left {
1272
- background-color: <?php echo esc_html($style['lightbox_filmstrip_rl_bg_color']); ?>;
1273
- cursor: pointer;
1274
- display: <?php echo ($filmstrip_direction == 'horizontal' ? 'table-cell' : 'block') ?>;
1275
- vertical-align: middle;
1276
- z-index: 10106;
1277
- <?php echo ($filmstrip_direction == 'horizontal' ? '' : 'position: absolute;'); ?>
1278
- <?php echo ($filmstrip_direction == 'horizontal' ? '' : 'width: 100%;'); ?>
1279
- }
1280
-
1281
- <?php echo $lb_container; ?> .wdi_filmstrip_right {
1282
- background-color: <?php echo esc_html($style['lightbox_filmstrip_rl_bg_color']); ?>;
1283
- cursor: pointer;
1284
- <?php echo($filmstrip_direction == 'horizontal' ? 'right' : 'bottom') ?>: 0;
1285
- display: <?php echo ($filmstrip_direction == 'horizontal' ? 'table-cell' : 'block') ?>;
1286
- vertical-align: middle;
1287
- z-index: 10106;
1288
- <?php echo ($filmstrip_direction == 'horizontal' ? '' : 'position: absolute;') ?>
1289
- <?php echo ($filmstrip_direction == 'horizontal' ? '' : 'width: 100%;') ?>
1290
- }
1291
-
1292
- <?php echo $lb_container; ?> .wdi_image_info{
1293
- background: rgba(<?php echo esc_html($rgb_wdi_image_info_bg_color['red']); ?>, <?php echo esc_html($rgb_wdi_image_info_bg_color['green']); ?>, <?php echo esc_html($rgb_wdi_image_info_bg_color['blue']); ?>, <?php echo number_format(esc_html($style['lightbox_info_bg_transparent']) / 100, 2, ".", ""); ?>);
1294
- border: <?php echo esc_html($style['lightbox_info_border_width']); ?>px <?php echo esc_html($style['lightbox_info_border_style']); ?> <?php echo esc_html($style['lightbox_info_border_color']); ?>;
1295
- border-radius: <?php echo esc_html($style['lightbox_info_border_radius']); ?>px;
1296
- padding: <?php echo esc_html($style['lightbox_info_padding']); ?>;
1297
- overflow: auto;
1298
- }
1299
-
1300
- @media (max-width: 480px) {
1301
- .wdi_image_count_container {
1302
- display: none;
1303
- }
1304
 
1305
- .wdi_image_title,
1306
- .wdi_image_title * {
1307
- font-size: 12px;
1308
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1309
 
1310
- .wdi_image_description,
1311
- .wdi_image_description * {
1312
- font-size: 10px;
1313
- }
1314
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1315
 
1316
- .wdi_image_count_container {
1317
- left: 0;
1318
- line-height: 1;
1319
- position: absolute;
1320
- vertical-align: middle;
1321
- }
1322
- </style>
1323
- <?php
1324
- $css = ob_get_contents();
1325
- ob_end_clean();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1326
 
1327
- $css = strip_tags($css);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1328
 
1329
- return $css;
1330
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1331
 
1332
  /**
 
 
1333
  * @param string $file_name
1334
  * @param string $file_content
1335
  * @return WP_Error|boolean
1336
  * */
1337
- public function update_file($file_content){
1338
 
1339
  $file_name = sprintf($this->file_name_format, $this->theme_id);
1340
-
1341
  $wp_upload_dir = wp_upload_dir();
1342
  $wp_upload_dir = $wp_upload_dir['basedir'];
1343
-
1344
  $folder = $wp_upload_dir . '/' . $this->folder_name;
1345
-
1346
- if(!is_dir($folder)) {
1347
- if(mkdir($folder, 0777, true) === false) {
 
1348
  return new WP_Error('wdi_failed_create_folder');
1349
  }
1350
-
1351
- if(file_put_contents($folder . '/index.html', "Index file.") === false) {
 
1352
  return new WP_Error('wdi_failed_create_index_file');
1353
  }
1354
-
1355
  }
1356
-
1357
- if(file_put_contents($folder . '/' . $file_name, $file_content) === false) {
 
1358
  return new WP_Error('wdi_failed_create_css_file');
1359
  }
1360
-
1361
  $this->refresh_file_key();
1362
- return true;
 
1363
  }
1364
 
1365
 
1366
- /**
1367
- * @param $view_type string
1368
- * @return string empty if file dose not exists or file url
1369
- * */
1370
- public function get_file_url(){
1371
- $file_name = sprintf($this->file_name_format, $this->theme_id);
1372
 
1373
- $wp_upload_dir = wp_upload_dir();
1374
- $basedir = $wp_upload_dir['basedir'];
1375
- $baseurl = $wp_upload_dir['baseurl'];
 
 
 
 
1376
 
1377
- if(is_ssl()) {
1378
- $baseurl = str_replace('http://', 'https://', $baseurl);
 
 
 
 
1379
  }
1380
 
1381
- $dir = $basedir . '/' . $this->folder_name . '/' . $file_name;
1382
- if(file_exists($dir)) {
1383
- return $baseurl . '/' . $this->folder_name . '/' . $file_name;
1384
- } else {
1385
- return "";
1386
  }
1387
- }
1388
 
1389
- public function get_css(){
1390
- return $this->css;
1391
- }
1392
 
1393
- public function refresh_file_key(){
1394
- $option = get_option('wdi_theme_keys');
 
1395
 
1396
- if(!is_array($option)) {
1397
- $option = array();
 
 
1398
  }
1399
 
1400
- $this->file_key = uniqid();
1401
- $option[$this->theme_id] = $this->file_key;
1402
- update_option('wdi_theme_keys', $option);
1403
- return $option;
1404
- }
1405
 
1406
- public function get_file_key(){
1407
- if($this->file_key !== null) {
1408
- $this->file_key;
1409
- }
1410
 
1411
- $option = get_option('wdi_theme_keys');
1412
- if(!isset($option[$this->theme_id])) {
1413
- $option = $this->refresh_file_key();
1414
  }
1415
 
1416
- return $option[$this->theme_id];
1417
- }
1418
-
1419
  }
8
 
9
  class WDI_generate_styles {
10
 
11
+ private $theme_id;
12
+ private $theme_options;
13
+ private $folder_name = 'wd-instagram-feed';
14
+ private $file_name_format = "wdi_theme_%s.css"; //theme_id
15
+ private $css = "";
16
+ private $file_key = null;
17
+
18
+ public function __construct($theme_id, $theme_options){
19
+ $this->theme_id = $theme_id;
20
+ $this->theme_options = $theme_options;
21
+ }
22
 
23
+ /**
24
+ * All views styles․
25
+ *
26
+ * @param bool $write_in_file
27
+ * @param bool $minify
28
+ *
29
+ * @return bool|string|WP_Error
30
+ */
31
+ public function all_views_styles( $write_in_file = TRUE, $minify = TRUE ) {
32
  $css = "";
33
  $css .= $this->common_styles();
34
  $css .= $this->thumbnail_view_styles();
36
  $css .= $this->blog_view_styles();
37
  $css .= $this->browser_view_styles();
38
  $css .= $this->lightbox_styles();
39
+ if ( $minify == TRUE ) {
 
40
  require_once(WDI_DIR . '/framework/WDILibrary.php');
41
  $css = WDILibrary::minify_styles($css);
42
  }
 
43
  $this->css = $css;
44
+ if ( $write_in_file === TRUE ) {
 
45
  return $this->update_file($css);
46
  }
47
 
48
  return $css;
49
  }
50
 
51
+ public function common_styles() {
52
+ $style = $this->theme_options;
53
+ $theme_id = $this->theme_id;
54
+ ob_start();
55
+ ?>
56
+ <style>
57
+ .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_feed_wrapper {
58
+ width: <?php echo esc_html($style['feed_wrapper_width']); ?>; /*feed_wrapper_width,column number * image size*/
59
+ background-color: <?php echo esc_html($style['feed_wrapper_bg_color']); ?>; /*feed_wrapper_bg_color*/
60
+ text-align: <?php echo esc_html($style['header_position']); ?>; /*header_position*/
61
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
 
63
+ .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_feed_header {
64
+ margin: <?php echo esc_html($style['header_margin']); ?>; /*header_margin*/
65
+ padding: <?php echo esc_html($style['header_padding']); ?>; /*header_padding*/
66
+ border: <?php echo esc_html($style['header_border_size']); ?> solid <?php echo esc_html($style['header_border_color']); ?>; /*header_border_size, header_border_color*/
67
+ text-align: <?php echo esc_html($style['header_position']); ?>; /*header_position*/
68
+ }
69
 
70
+ .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_header_text {
71
+ font-size: <?php echo esc_html($style['header_text_font_size']); ?>;
72
+ font-style: <?php echo esc_html($style['header_text_font_style']); ?>;
73
+ padding: <?php echo esc_html($style['header_text_padding']); ?>; /*header_text_padding*/
74
+ color: <?php echo esc_html($style['header_text_color']); ?>; /*header_text_color*/
75
+ font-weight: <?php echo esc_html($style['header_font_weight']); ?>; /*header_font_weight*/
76
+ line-height: <?php echo esc_html($style['header_img_width']); ?>px; /*header_img_width*/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  }
 
 
 
 
 
 
 
 
78
 
79
+ .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_single_user {
80
+ padding-top: <?php echo esc_html($style['user_padding']); ?>; /*user_padding*/
81
+ padding-bottom: <?php echo esc_html($style['user_padding']); ?>; /*user_padding*/
82
+ padding-left: <?php echo esc_html($style['user_padding']); ?>; /*user_padding*/
83
+ padding-right: <?php echo esc_html($style['user_padding']); ?>; /*user_padding*/
84
+ }
85
 
86
+ .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_header_hashtag h3 {
87
+ margin-top: <?php echo (intval($style['user_img_width']) - intval($style['users_text_font_size']))/2?>px;
88
+ }
 
89
 
90
+ .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_header_user_text h3 {
91
+ font-size: <?php echo esc_html($style['users_text_font_size']); ?>;
92
+ font-style: <?php echo esc_html($style['users_text_font_style']); ?>;
93
+ line-height: <?php echo esc_html($style['users_text_font_size']); ?>;
94
+ color: <?php echo esc_html($style['users_text_color']); ?>; /*header_text_color*/;
95
+ }
96
 
97
+ .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_user_img_wrap img {
98
+ height: <?php echo esc_html($style['user_img_width']); ?>px;
99
+ width: <?php echo esc_html($style['user_img_width']); ?>px;
100
+ border-radius: <?php echo esc_html($style['user_border_radius']); ?>px;
101
+ }
102
 
103
+ .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_media_info {
104
+ /*display: inline-block;*/
105
+ margin-left: <?php echo intval($style['user_img_width']) + 10;?>px;
106
+ line-height: <?php echo esc_html($style['users_text_font_size']); ?>;
107
+ color: <?php echo esc_html($style['users_text_color']); ?>; /*header_text_color !mmm/ seperate*/
108
+ }
109
 
110
+ .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_bio {
111
+ color: <?php echo esc_html($style['users_text_color']); ?>; /*header_text_color*/
112
+ font-size: <?php echo esc_html($style['user_description_font_size']); ?>; /*header_text_color*/
113
+ }
114
+
115
+ .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_follow_btn {
116
+ border-radius: <?php echo esc_html($style['follow_btn_border_radius']); ?>px;
117
+ font-size: <?php echo esc_html($style['follow_btn_font_size']); ?>px;
118
+ background-color: <?php echo esc_html($style['follow_btn_bg_color']); ?>;
119
+ border-color: <?php echo esc_html($style['follow_btn_border_color']); ?>;
120
+ color: <?php echo esc_html($style['follow_btn_text_color']); ?>;
121
+ margin-left: <?php echo esc_html($style['follow_btn_margin']); ?>px;
122
+ padding: 0 <?php echo esc_html($style['follow_btn_padding']); ?>px;
123
+ }
124
+
125
+ .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_follow_btn:hover {
126
+ border-color: <?php echo esc_html($style['follow_btn_border_hover_color']); ?>;
127
+ color: <?php echo esc_html($style['follow_btn_text_hover_color']); ?>;
128
+ background-color: <?php echo esc_html($style['follow_btn_background_hover_color']); ?>;
129
+ }
130
+
131
+ .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_filter_overlay {
132
+ width: <?php echo esc_html($style['user_img_width']); ?>px; /*user_img_width*/
133
+ height: <?php echo esc_html($style['user_img_width']); ?>px; /*user_img_width*/
134
+ border-radius: <?php echo esc_html($style['user_border_radius']); ?>px; /*user_img_width*/
135
+ background-color: <?php echo esc_html($style['th_overlay_hover_color']); ?>;
136
+ }
137
+
138
+ .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_filter_icon span {
139
+ width: <?php echo esc_html($style['user_img_width']); ?>px; /*header_img_width*/
140
+ height: <?php echo esc_html($style['user_img_width']); ?>px; /*header_img_width*/
141
+ }
142
+
143
+ .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_load_more_text {
144
+ color: <?php echo esc_html($style['load_more_text_color']); ?>; /*load_more_text_color*/
145
+ font-size: <?php echo esc_html($style['load_more_text_font_size']); ?>; /*load_more_text_font_size*/
146
+ }
147
+
148
+ .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_load_more_text img {
149
+ height: <?php echo esc_html($style['load_more_height']); ?>; /*load_more_height*/
150
+ width: <?php echo esc_html($style['load_more_height']); ?>; /*load_more_height*/
151
+ }
152
+
153
+ .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_load_more_wrap:hover {
154
+ background-color: <?php echo esc_html($style['load_more_wrap_hover_color']); ?>; /*load_more_wrap_hover_color*/
155
+ }
156
+
157
+ .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_pagination {
158
+
159
+ text-align: <?php echo esc_html($style['pagination_position']); ?>; /*load_more_position*/
160
+ color: <?php echo esc_html($style['pagination_ctrl_color']); ?>; /*pagination_ctrl_color*/
161
+ font-size: <?php echo esc_html($style['pagination_size']); ?>; /*pagination_size*/
162
+ }
163
+
164
+ .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_pagination_ctrl {
165
+ margin: <?php echo esc_html($style['pagination_ctrl_margin']); ?>;
166
+ }
167
+
168
+ .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_pagination_ctrl:hover {
169
+ color: <?php echo esc_html($style['pagination_ctrl_hover_color']); ?>;
170
+ }
171
+
172
+ .wdi_feed_theme_<?php echo intval($theme_id); ?> .wdi_filter_active_col {
173
+ color: <?php echo esc_html($style['active_filter_bg_color']);?>;
174
+ border-color: <?php echo esc_html($style['active_filter_bg_color']);?>;
175
+ }
176
+
177
+ </style>
178
+ <?php
179
+ $css = ob_get_contents();
180
+ ob_end_clean();
181
+ $css = wp_filter_nohtml_kses($css);
182
+
183
+ return $css;
184
+ }
185
+
186
+ public function thumbnail_view_styles(){
187
+ $style = $this->theme_options;
188
+ $theme_id = $this->theme_id;
189
+ ob_start();
190
+ ?>
191
+ <style>
192
+ .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_feed_container {
193
+ width: <?php echo esc_html($style['feed_container_width']); ?>;
194
+ background-color: <?php echo esc_html($style['feed_container_bg_color']); ?>; /*feed_container_bg_color*/
195
+ border-bottom: 5px solid <?php echo esc_html($style['feed_container_bg_color']); ?>; /*feed_container_bg_color*/;
196
+ }
197
+
198
+ .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_header_img_wrap {
199
+ height: <?php echo esc_html($style['header_img_width']); ?>px; /*header_img_width*/
200
+ width: <?php echo esc_html($style['header_img_width']); ?>px; /*header_img_width*/
201
+ border-radius: <?php echo esc_html($style['header_border_radius']); ?>px; /*header_img_width*/
202
+ }
203
+
204
+ .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_photo_wrap {
205
+ padding: <?php echo esc_html($style['th_photo_wrap_padding']); ?>; /*photo_wrap_padding*/
206
+ width: calc(100% - 2 *<?php echo esc_html($style['th_photo_wrap_padding']); ?>);
207
+ }
208
+
209
+ .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_photo_wrap_inner {
210
+ border: <?php echo esc_html($style['th_photo_wrap_border_size']); ?> solid <?php echo esc_html($style['th_photo_wrap_border_color']); ?>; /*photo_wrap_border_size,photo_wrap_border_color*/
211
+ background-color: <?php echo esc_html($style['th_photo_wrap_bg_color']); ?>; /*photo_wrap_bg_color*/
212
+ }
213
+
214
+ .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_photo_img {
215
+ border-radius: <?php echo esc_html($style['th_photo_img_border_radius']); ?>; /*photo_img_border_radius*/
216
+ }
217
+
218
+ .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_photo_meta {
219
+ background-color: <?php echo esc_html($style['th_photo_meta_bg_color']); ?>; /*photo_meta_bg_color*/
220
+ }
221
+
222
+ .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_thumb_likes {
223
+ width: <?php echo (esc_html($style['th_photo_meta_one_line'])=='1')? '50%' : '100%' ?>; /*photo_meta_one_line==false else 100%*/
224
+ float: <?php echo (esc_html($style['th_photo_meta_one_line'])=='1')? 'left' : 'none'?>; /*photo_meta_one_line==true else float none*/
225
+ font-size: <?php echo esc_html($style['th_like_comm_font_size']); ?>; /*photo_caption_font_size*/;
226
+ color: <?php echo esc_html($style['th_like_text_color']); ?>; /*like_text_color*/
227
+
228
+ }
229
+
230
+ .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_thumb_comments {
231
+ width: <?php echo (esc_html($style['th_photo_meta_one_line'])=='1')? '50%' : '100%' ?>; /*photo_meta_one_line==false else 100%*/
232
+ float: <?php echo (esc_html($style['th_photo_meta_one_line'])=='1')? 'left' : 'none'?>; /*photo_meta_one_line==true else float none*/
233
+ font-size: <?php echo esc_html($style['th_like_comm_font_size']); ?>; /*photo_caption_font_size*/;
234
+ color: <?php echo esc_html($style['th_comment_text_color']); ?>; /*comment_text_color*/
235
+
236
+ }
237
+
238
+ .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_photo_title {
239
+ font-size: <?php echo esc_html($style['th_photo_caption_font_size']); ?>; /*photo_caption_font_size*/
240
+ color: <?php echo esc_html($style['th_photo_caption_color']); ?>; /*photo_caption_color*/
241
+ }
242
+
243
+ .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_photo_title:hover {
244
+ color: <?php echo esc_html($style['th_photo_caption_hover_color']); ?>;
245
+ }
246
+
247
+ .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_load_more_spinner {
248
+ color: <?php echo esc_html($style['load_more_text_color']); ?>; /*load_more_text_color*/
249
+ font-size: <?php echo intval($style['load_more_text_font_size'])*1.3?>px; /*load_more_text_font_size*/
250
+ }
251
+
252
+ .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_load_more,
253
+ .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_spinner {
254
+ background-color: <?php echo esc_html($style['feed_container_bg_color']); ?>; /*feed_container_bg_color*/
255
+ text-align: <?php echo esc_html($style['load_more_position']); ?>; /*load_more_position*/
256
+ }
257
+
258
+ .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_load_more_wrap,
259
+ .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_spinner_wrap {
260
+ padding: <?php echo esc_html($style['load_more_padding']); ?>; /*load_more_padding*/
261
+ background-color: <?php echo esc_html($style['load_more_bg_color']); ?>; /*load_more_bg_color*/
262
+ border-radius: <?php echo esc_html($style['load_more_border_radius']); ?>; /*load_more_border_radius*/
263
+ height: <?php echo esc_html($style['load_more_height']); ?>; /*load_more_height*/
264
+ width: <?php echo esc_html($style['load_more_width']); ?>; /*load_more_width*/
265
+ border: <?php echo esc_html($style['load_more_border_size']); ?> solid <?php echo esc_html($style['load_more_border_color']); ?>; /*load_more_border_size, load_more_border_color*/;
266
+ }
267
+
268
+ <?php
269
+ require_once(WDI_DIR . '/framework/WDILibrary.php');
270
+ $rgb_overlay = WDILibrary::wdi_spider_hex2rgb(esc_html($style['th_overlay_hover_color']));
271
+ $rgba_overlay = 'rgba('. $rgb_overlay['red'] .',' . $rgb_overlay['green'] . ',' . $rgb_overlay['blue'] . ','.((100 - intval($style['th_overlay_hover_transparent']))/100).')';
272
+ ?>
273
+ .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_photo_overlay:hover {
274
+ background-color: <?php echo esc_html($rgba_overlay);?>
275
+ }
276
+
277
+ .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_photo_overlay i {
278
+ font-size: <?php echo esc_html($style['th_overlay_hover_icon_font_size']); ?>;
279
+ }
280
+
281
+ .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_photo_overlay:hover i {
282
+ color: <?php echo esc_html($style['th_overlay_hover_icon_color'])?>
283
+ }
284
+
285
+ <?php
286
+ switch(esc_html($style['th_photo_img_hover_effect'])){
287
+ case 'rotate': {
288
+ $effect = 'rotate(5deg)';
289
+ break;
290
+ }
291
+ case 'scale':{
292
+ $effect = 'scale(1.2)';
293
+ break;
294
+ }
295
+ case 'rotate_and_scale':{
296
+ $effect = 'scale(1.2) rotate(5deg)';
297
+ break;
298
+ }
299
+ default:{
300
+ $effect = 'none';
301
+ break;
302
+ }
303
  }
304
+ ?>
305
+ .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_photo_img:hover img {
306
+ -webkit-transform: translateX(-50%) translateY(-50%) <?php echo esc_html($effect)?>;
307
+ -moz-transform: translateX(-50%) translateY(-50%) <?php echo esc_html($effect)?>;
308
+ -ms-transform: translateX(-50%) translateY(-50%) <?php echo esc_html($effect)?>;
309
+ -o-transform: translateX(-50%) translateY(-50%) <?php echo esc_html($effect)?>;
310
+ transform: translateX(-50%) translateY(-50%) <?php echo esc_html($effect)?>;
311
+ }
312
+
313
+ .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_filter_active_bg {
314
+ background-color: <?php echo esc_html($style['active_filter_bg_color']); ?>;
315
+ }
316
+
317
+ .wdi_feed_<?php echo 'thumbnail_' . intval($theme_id); ?> .wdi_media_user {
318
+ color: <?php echo esc_html($style['th_thumb_user_color']); ?>;
319
+ background-color: <?php echo esc_html($style['th_thumb_user_bg_color']); ?>;
320
+ }
321
+
322
+ </style>
323
+ <?php
324
+ $css = ob_get_contents();
325
+ ob_end_clean();
326
+ $css = wp_filter_nohtml_kses($css);
327
+ return $css;
328
+ }
329
+
330
+ public function masonry_view_styles(){
331
+ $style = $this->theme_options;
332
+ $theme_id = $this->theme_id;
333
+ ob_start();
334
+ ?>
335
+ <style>
336
+ .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_feed_container {
337
+ width: <?php echo esc_html($style['feed_container_width']); ?>;
338
+ background-color: <?php echo esc_html($style['feed_container_bg_color']); ?>; /*feed_container_bg_color*/
339
+ border-bottom: 5px solid <?php echo esc_html($style['feed_container_bg_color']); ?>; /*feed_container_bg_color*/;
340
+ }
341
+
342
+ .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_header_img_wrap,
343
+ .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_users_img_wrap {
344
+ height: <?php echo esc_html($style['header_img_width']); ?>px; /*header_img_width*/
345
+ width: <?php echo esc_html($style['header_img_width']); ?>px; /*header_img_width*/
346
+ border-radius: <?php echo esc_html($style['header_border_radius']); ?>px; /*header_img_width*/
347
+ }
348
+
349
+ .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_photo_wrap {
350
+ padding: <?php echo esc_html($style['mas_photo_wrap_padding']); ?>; /*photo_wrap_padding*/
351
+ }
352
+
353
+ .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_photo_wrap_inner {
354
+ border: <?php echo esc_html($style['mas_photo_wrap_border_size']); ?> solid <?php echo esc_html($style['mas_photo_wrap_border_color']); ?>; /*photo_wrap_border_size,photo_wrap_border_color*/
355
+ background-color: <?php echo esc_html($style['mas_photo_wrap_bg_color']); ?>; /*photo_wrap_bg_color*/
356
+ }
357
+
358
+ .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_photo_img {
359
+ border-radius: <?php echo esc_html($style['mas_photo_img_border_radius']); ?>; /*photo_img_border_radius*/
360
+ }
361
+
362
+ .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_photo_meta {
363
+ background-color: <?php echo esc_html($style['mas_photo_meta_bg_color']); ?>; /*photo_meta_bg_color*/
364
+ }
365
+
366
+ .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_thumb_likes {
367
+ width: <?php echo (esc_html($style['mas_photo_meta_one_line'])=='1')? '50%' : '100%' ?>; /*photo_meta_one_line==false else 100%*/
368
+ float: <?php echo (esc_html($style['mas_photo_meta_one_line'])=='1')? 'left' : 'none'?>; /*photo_meta_one_line==true else float none*/
369
+ font-size: <?php echo esc_html($style['mas_like_comm_font_size']); ?>; /*photo_caption_font_size*/;
370
+ color: <?php echo esc_html($style['mas_like_text_color']); ?>; /*like_text_color*/
371
+
372
+ }
373
+
374
+ .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_thumb_comments {
375
+ width: <?php echo (esc_html($style['mas_photo_meta_one_line'])=='1')? '50%' : '100%' ?>; /*photo_meta_one_line==false else 100%*/
376
+ float: <?php echo (esc_html($style['mas_photo_meta_one_line'])=='1')? 'left' : 'none'?>; /*photo_meta_one_line==true else float none*/
377
+ font-size: <?php echo esc_html($style['mas_like_comm_font_size']); ?>; /*photo_caption_font_size*/;
378
+ color: <?php echo esc_html($style['mas_comment_text_color']); ?>; /*comment_text_color*/
379
+
380
+ }
381
+
382
+ .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_photo_title {
383
+ font-size: <?php echo esc_html($style['mas_photo_caption_font_size']); ?>; /*photo_caption_font_size*/
384
+ color: <?php echo esc_html($style['mas_photo_caption_color']); ?>; /*photo_caption_color*/
385
+ }
386
+
387
+ .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_photo_title:hover {
388
+ color: <?php echo esc_html($style['mas_photo_caption_hover_color']); ?>;
389
+ }
390
+
391
+ .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_load_more_spinner {
392
+ color: <?php echo esc_html($style['load_more_text_color']); ?>; /*load_more_text_color*/
393
+ font-size: <?php echo intval($style['load_more_text_font_size'])*1.5?>px; /*load_more_text_font_size*/
394
+ }
395
+
396
+ .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_load_more,
397
+ .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_spinner {
398
+ background-color: <?php echo esc_html($style['feed_container_bg_color']); ?>; /*feed_container_bg_color*/
399
+ text-align: <?php echo esc_html($style['load_more_position']); ?>; /*load_more_position*/
400
+ }
401
+
402
+ .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_load_more_wrap,
403
+ .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_spinner_wrap {
404
+ padding: <?php echo esc_html($style['load_more_padding']); ?>; /*load_more_padding*/
405
+ background-color: <?php echo esc_html($style['load_more_bg_color']); ?>; /*load_more_bg_color*/
406
+ border-radius: <?php echo esc_html($style['load_more_border_radius']); ?>; /*load_more_border_radius*/
407
+ height: <?php echo esc_html($style['load_more_height']); ?>; /*load_more_height*/
408
+ width: <?php echo esc_html($style['load_more_width']); ?>; /*load_more_width*/
409
+ border: <?php echo esc_html($style['load_more_border_size']); ?> solid <?php echo esc_html($style['load_more_border_color']); ?>; /*load_more_border_size, load_more_border_color*/;
410
+ }
411
+
412
+ <?php
413
+ require_once(WDI_DIR . '/framework/WDILibrary.php');
414
+ $rgb_overlay = WDILibrary::wdi_spider_hex2rgb(esc_html($style['mas_overlay_hover_color']));
415
+ $rgba_overlay = 'rgba('. $rgb_overlay['red'] .',' . $rgb_overlay['green'] . ',' . $rgb_overlay['blue'] . ','.((100 - intval($style['mas_overlay_hover_transparent']))/100).')';
416
+ ?>
417
+
418
+ .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_photo_overlay:hover {
419
+ background-color: <?php echo esc_html($rgba_overlay);?>
420
+ }
421
+
422
+ .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_photo_overlay i {
423
+ font-size: <?php echo esc_html($style['th_overlay_hover_icon_font_size']); ?>;
424
+ }
425
+
426
+ .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_photo_overlay:hover i {
427
+ color: <?php echo esc_html($style['th_overlay_hover_icon_color']);?>
428
+ }
429
+
430
+ <?php
431
+ switch(esc_html($style['mas_photo_img_hover_effect'])){
432
+ case 'rotate': {
433
+ $effect = 'rotate(5deg)';
434
+ break;
435
+ }
436
+ case 'scale':{
437
+ $effect = 'scale(1.2)';
438
+ break;
439
+ }
440
+ case 'rotate_and_scale':{
441
+ $effect = 'scale(1.2) rotate(5deg)';
442
+ break;
443
+ }
444
+ default:{
445
+ $effect = 'none';
446
+ break;
447
+ }
448
  }
449
+ ?>
450
+ .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_photo_img:hover img {
451
+ transform: <?php echo esc_html($effect)?>
452
  }
 
 
 
 
453
 
454
+ .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_filter_active_bg {
455
+ background-color: <?php echo esc_html($style['active_filter_bg_color']);?>;
456
+ }
457
 
458
+ .wdi_feed_<?php echo 'masonry_' . intval($theme_id); ?> .wdi_media_user {
459
+ color: <?php echo esc_html($style['mas_thumb_user_color']);?>;
460
+ background-color: <?php echo esc_html($style['mas_thumb_user_bg_color']);?>;
461
+ }
462
+
463
+ </style>
464
+ <?php
465
+ $css = ob_get_contents();
466
+ ob_end_clean();
467
+ $css = wp_filter_nohtml_kses($css);
468
+ return $css;
469
+ }
470
 
471
+ public function blog_view_styles(){
472
+ $style = $this->theme_options;
473
+ $theme_id = $this->theme_id;
474
+ ob_start();
475
+ ?>
476
+ <style>
477
+ .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_feed_container {
478
+ width: <?php echo esc_html($style['feed_container_width']); ?>;
479
+ background-color: <?php echo esc_html($style['feed_container_bg_color']); ?>; /*feed_container_bg_color*/
480
+ }
481
 
482
+ .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_header_img_wrap,
483
+ .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_users_img_wrap {
484
+ height: <?php echo esc_html($style['header_img_width']); ?>px; /*header_img_width*/
485
+ width: <?php echo esc_html($style['header_img_width']); ?>px; /*header_img_width*/
486
+ border-radius: <?php echo esc_html($style['header_border_radius']); ?>px; /*header_img_width*/
487
+ }
488
 
489
+ .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_photo_wrap {
490
+ padding: <?php echo esc_html($style['blog_style_photo_wrap_padding']); ?>; /*photo_wrap_padding*/
491
+ }
492
 
493
+ .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_photo_wrap_inner {
494
+ border: <?php echo esc_html($style['blog_style_photo_wrap_border_size']); ?> solid <?php echo esc_html($style['blog_style_photo_wrap_border_color']); ?>; /*photo_wrap_border_size,photo_wrap_border_color*/
495
+ background-color: <?php echo esc_html($style['blog_style_photo_wrap_bg_color']); ?>; /*photo_wrap_bg_color*/
496
+ }
497
 
498
+ .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_photo_img {
499
+ border-radius: <?php echo esc_html($style['blog_style_photo_img_border_radius']); ?>; /*photo_img_border_radius*/
500
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
501
 
502
+ .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_photo_meta {
503
+ background-color: <?php echo esc_html($style['blog_style_photo_meta_bg_color']); ?>; /*photo_meta_bg_color*/
504
+ }
505
 
506
+ .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_thumb_likes {
507
+ width: <?php echo (esc_html($style['blog_style_photo_meta_one_line'])=='1')? '50%' : '100%' ?>; /*photo_meta_one_line==false else 100%*/
508
+ float: <?php echo (esc_html($style['blog_style_photo_meta_one_line'])=='1')? 'left' : 'none'?>; /*photo_meta_one_line==true else float none*/
509
+ font-size: <?php echo esc_html($style['blog_style_like_comm_font_size']); ?>; /*photo_caption_font_size*/;
510
+ color: <?php echo esc_html($style['blog_style_like_text_color']); ?>; /*like_text_color*/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
511
 
512
+ }
513
+
514
+ .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_thumb_comments {
515
+ width: <?php echo (esc_html($style['blog_style_photo_meta_one_line'])=='1')? '50%' : '100%' ?>; /*photo_meta_one_line==false else 100%*/
516
+ float: <?php echo (esc_html($style['blog_style_photo_meta_one_line'])=='1')? 'left' : 'none'?>; /*photo_meta_one_line==true else float none*/
517
+ font-size: <?php echo esc_html($style['blog_style_like_comm_font_size']); ?>; /*photo_caption_font_size*/;
518
+ color: <?php echo esc_html($style['blog_style_comment_text_color']); ?>; /*comment_text_color*/
519
 
520
+ }
521
+
522
+ .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_photo_title {
523
+ font-size: <?php echo esc_html($style['blog_style_photo_caption_font_size']); ?>; /*photo_caption_font_size*/
524
+ color: <?php echo esc_html($style['blog_style_photo_caption_color']); ?>; /*photo_caption_color*/
525
+ }
526
+
527
+ .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_photo_title:hover {
528
+ color: <?php echo esc_html($style['blog_style_photo_caption_hover_color']); ?>;
529
+ }
530
+
531
+ .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_load_more_spinner {
532
+ color: <?php echo esc_html($style['load_more_text_color']); ?>; /*load_more_text_color*/
533
+ font-size: <?php echo intval($style['load_more_text_font_size'])*1.5?>px; /*load_more_text_font_size*/
534
+ }
535
+
536
+ .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_load_more,
537
+ .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_spinner {
538
+ background-color: <?php echo esc_html($style['feed_container_bg_color']); ?>; /*feed_container_bg_color*/
539
+ text-align: <?php echo esc_html($style['load_more_position']); ?>; /*load_more_position*/
540
+ }
541
 
542
+ .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_load_more_wrap,
543
+ .wdi_feed_<?php echo 'blog_' . intval($theme_id); ?> .wdi_spinner_wrap {
544
+ padding: <?php echo esc_html($style['load_more_padding']); ?>; /*load_more_padding*/
545
+ background-color: <?php echo esc_html($style['load_more_bg_color']); ?>; /*load_more_bg_color*/
546
+ border-radius: <?php echo esc_html($style['load_more_border_radius']); ?>; /*load_more_border_radius*/
547
+ height: <?php echo esc_html($style['load_more_height']); ?>; /*load_more_height*/
548
+ width: <?php echo esc_html($style['load_more_width']); ?>; /*load_more_width*/
549
+ border: <?php echo esc_html($style['load_more_border_size']); ?> solid <?php echo esc_html($style['load_more_border_color']); ?>; /*load_more_border_size, load_more_border_color*/;
550
+ }
551
+
552
+ </style>
553
+ <?php
554
+ $css = ob_get_contents();
555
+ ob_end_clean();
556
+ $css = wp_filter_nohtml_kses($css);
557
+ return $css;
558
  }
559
 
560
+ public function browser_view_styles(){
561
+ $style = $this->theme_options;
562
+ $theme_id = $this->theme_id;
563
+ ob_start();
564
+ ?>
565
+ <style>
566
+ .wdi_feed_<?php echo 'browser_' . intval($theme_id); ?> .wdi_feed_container {
567
+ width: <?php echo esc_html($style['feed_container_width']); ?>;
568
+ background-color: <?php echo esc_html($style['feed_container_bg_color']); ?>; /*feed_container_bg_color*/
569
+ border-bottom: 5px solid <?php echo esc_html($style['feed_container_bg_color']); ?>; /*feed_container_bg_color*/;
570
+ }
571
+
572
+ .wdi_feed_<?php echo 'browser_' . intval($theme_id); ?> .wdi_header_img_wrap,
573
+ .wdi_feed_<?php echo 'browser_' . intval($theme_id); ?> .wdi_users_img_wrap {
574
+ height: <?php echo esc_html($style['header_img_width']); ?>px; /*header_img_width*/
575
+ width: <?php echo esc_html($style['header_img_width']); ?>px; /*header_img_width*/
576
+ border-radius: <?php echo esc_html($style['header_border_radius']); ?>px; /*header_img_width*/
577
+ }
578
+
579
+ .wdi_feed_<?php echo 'browser_' . intval($theme_id); ?> .wdi_photo_wrap {
580
+ padding: <?php echo esc_html($style['image_browser_photo_wrap_padding']); ?>; /*photo_wrap_padding*/
581
+
582
+ }
583
+
584
+ .wdi_feed_<?php echo 'browser_' . intval($theme_id); ?> .wdi_photo_wrap_inner {
585
+ border: <?php echo esc_html($style['image_browser_photo_wrap_border_size']); ?> solid <?php echo esc_html($style['image_browser_photo_wrap_border_color']); ?>; /*photo_wrap_border_size,photo_wrap_border_color*/
586
+ background-color: <?php echo esc_html($style['image_browser_photo_wrap_bg_color']); ?>; /*photo_wrap_bg_color*/
587
+ }
588
+
589
+ .wdi_feed_<?php echo 'browser_' . intval($theme_id); ?> .wdi_photo_img {
590
+ border-radius: <?php echo esc_html($style['image_browser_photo_img_border_radius']); ?>; /*photo_img_border_radius*/
591
+ }
592
+
593
+ .wdi_feed_<?php echo 'browser_' . intval($theme_id); ?> .wdi_photo_meta {
594
+ background-color: <?php echo esc_html($style['image_browser_photo_meta_bg_color']); ?>; /*photo_meta_bg_color*/
595
+ }
596
+
597
+ .wdi_feed_<?php echo 'browser_' . intval($theme_id); ?> .wdi_thumb_likes {
598
+ width: <?php echo (esc_html($style['image_browser_photo_meta_one_line'])=='1')? '50%' : '100%' ?>; /*photo_meta_one_line==false else 100%*/
599
+ float: <?php echo (esc_html($style['image_browser_photo_meta_one_line'])=='1')? 'left' : 'none'?>; /*photo_meta_one_line==true else float none*/
600
+ font-size: <?php echo esc_html($style['image_browser_like_comm_font_size']); ?>; /*photo_caption_font_size*/;
601
+ color: <?php echo esc_html($style['image_browser_like_text_color']); ?>; /*like_text_color*/
602
+
603
+ }
604
+
605
+ .wdi_feed_<?php echo 'browser_' . intval($theme_id); ?> .wdi_thumb_comments {
606
+ width: <?php echo (esc_html($style['image_browser_photo_meta_one_line'])=='1')? '50%' : '100%' ?>; /*photo_meta_one_line==false else 100%*/
607
+ float: <?php echo (esc_html($style['image_browser_photo_meta_one_line'])=='1')? 'left' : 'none'?>; /*photo_meta_one_line==true else float none*/
608
+ font-size: <?php echo esc_html($style['image_browser_like_comm_font_size']); ?>; /*photo_caption_font_size*/;
609
+ color: <?php echo esc_html($style['image_browser_comment_text_color']); ?>; /*comment_text_color*/
610
+
611
+ }
612
+
613
+ .wdi_feed_<?php echo 'browser_' . intval($theme_id); ?> .wdi_photo_title {
614
+ font-size: <?php echo esc_html($style['image_browser_photo_caption_font_size']); ?>; /*photo_caption_font_size*/
615
+ color: <?php echo esc_html($style['image_browser_photo_caption_color']); ?>; /*photo_caption_color*/
616
+ }
617
+
618
+ .wdi_feed_<?php echo 'browser_' . intval($theme_id); ?> .wdi_photo_title:hover {
619
+ color: <?php echo esc_html($style['image_browser_photo_caption_hover_color']); ?>;
620
+ }
621
+
622
+ .wdi_feed_<?php echo 'browser_' . intval($theme_id); ?> .wdi_load_more {
623
+ background-color: <?php echo esc_html($style['feed_container_bg_color']); ?>; /*feed_container_bg_color*/
624
+ text-align: <?php echo esc_html($style['load_more_position']); ?>; /*load_more_position*/
625
+ }
626
+
627
+ .wdi_feed_<?php echo 'browser_' . intval($theme_id); ?> .wdi_load_more_wrap {
628
+ padding: <?php echo esc_html($style['load_more_padding']); ?>; /*load_more_padding*/
629
+ background-color: <?php echo esc_html($style['load_more_bg_color']); ?>; /*load_more_bg_color*/
630
+ border-radius: <?php echo esc_html($style['load_more_border_radius']); ?>; /*load_more_border_radius*/
631
+ height: <?php echo esc_html($style['load_more_height']); ?>; /*load_more_height*/
632
+ width: <?php echo esc_html($style['load_more_width']); ?>; /*load_more_width*/
633
+ border: <?php echo esc_html($style['load_more_border_size']); ?> solid <?php echo esc_html($style['load_more_border_color']); ?>; /*load_more_border_size, load_more_border_color*/;
634
+ }
635
+
636
+ </style>
637
+ <?php
638
+ $css = ob_get_contents();
639
+ ob_end_clean();
640
+ $css = wp_filter_nohtml_kses($css);
641
+ return $css;
642
+ }
643
+
644
+ public function lightbox_styles(){
645
+ $style = $this->theme_options;
646
+ $theme_id = $this->theme_id;
647
+ $rgb_lightbox_ctrl_cont_bg_color = WDILibrary::wdi_spider_hex2rgb(esc_html($style['lightbox_ctrl_cont_bg_color']));
648
+ $rgb_wdi_image_info_bg_color = WDILibrary::wdi_spider_hex2rgb(esc_html($style['lightbox_info_bg_color']));
649
+
650
+ $filmstrip_direction = 'horizontal';
651
+ if (esc_html($style['lightbox_filmstrip_pos']) == 'right' || esc_html($style['lightbox_filmstrip_pos']) == 'left') {
652
+ $filmstrip_direction = 'vertical';
653
+ }
654
+
655
+ $lb_container = '.wdi_lightbox_theme_' . intval($theme_id);
656
+ $feed_conatiner = '.wdi_feed_theme_' . intval($theme_id);
657
+ ob_start();
658
+ ?>
659
+ <style>
660
+ .wdi_spider_popup_wrap * {
661
+ -moz-box-sizing: border-box;
662
+ -webkit-box-sizing: border-box;
663
+ box-sizing: border-box;
664
+ }
665
+
666
+ <?php echo esc_html($feed_conatiner); ?> .wdi_spider_popup_overlay {
667
+ background-color: <?php echo esc_html($style['lightbox_overlay_bg_color']); ?>;
668
+ opacity: <?php echo floatval($style['lightbox_overlay_bg_transparent'] / 100); ?>;
669
+ }
670
+
671
+ <?php echo esc_html($lb_container); ?>.wdi_spider_popup_wrap {
672
+ background-color: <?php echo esc_html($style['lightbox_bg_color']); ?>;
673
+ display: inline-block;
674
+ left: 50%;
675
+ outline: medium none;
676
+ position: fixed;
677
+ text-align: center;
678
+ top: 50%;
679
+ z-index: 100000;
680
+ }
681
+
682
+ <?php echo esc_html($lb_container); ?> .wdi_ctrl_btn {
683
+ color: <?php echo esc_html($style['lightbox_ctrl_btn_color']); ?>;
684
+ font-size: <?php echo esc_html($style['lightbox_ctrl_btn_height']); ?>px;
685
+ margin: <?php echo esc_html($style['lightbox_ctrl_btn_margin_top']); ?>px <?php echo esc_html($style['lightbox_ctrl_btn_margin_left']); ?>px;
686
+ opacity: <?php echo number_format(esc_html($style['lightbox_ctrl_btn_transparent']) / 100, 2, ".", ""); ?>;
687
+ filter: Alpha(opacity=<?php echo esc_attr($style['lightbox_ctrl_btn_transparent']); ?>);
688
+ }
689
+
690
+ <?php echo esc_html($lb_container); ?> .wdi_toggle_btn {
691
+ color: <?php echo esc_html($style['lightbox_ctrl_btn_color']); ?>;
692
+ font-size: <?php echo esc_html($style['lightbox_toggle_btn_height']); ?>px;
693
+ margin: 0;
694
+ opacity: <?php echo number_format(esc_html($style['lightbox_ctrl_btn_transparent']) / 100, 2, ".", ""); ?>;
695
+ filter: Alpha(opacity=<?php echo esc_attr($style['lightbox_ctrl_btn_transparent']); ?>);
696
+ padding: 0;
697
+ }
698
+
699
+ .wdi_btn_container {
700
+ bottom: 0;
701
+ left: 0;
702
+ overflow: hidden;
703
+ position: absolute;
704
+ right: 0;
705
+ top: 0;
706
+ }
707
+
708
+ <?php echo esc_html($lb_container); ?> .wdi_ctrl_btn_container {
709
+ background-color: rgba(<?php echo esc_html($rgb_lightbox_ctrl_cont_bg_color['red']); ?>, <?php echo esc_html($rgb_lightbox_ctrl_cont_bg_color['green']); ?>, <?php echo esc_html($rgb_lightbox_ctrl_cont_bg_color['blue']); ?>, <?php echo number_format(esc_html($style['lightbox_ctrl_cont_transparent']) / 100, 2, ".", ""); ?>);
710
+ /*background: none repeat scroll 0 0 #
711
+ <?php echo esc_html($style['lightbox_ctrl_cont_bg_color']); ?> ;*/
712
+ <?php
713
+ if (esc_html($style['lightbox_ctrl_btn_pos']) == 'top') { ?> border-bottom-left-radius: <?php echo esc_html($style['lightbox_ctrl_cont_border_radius']); ?>px;
714
+ border-bottom-right-radius: <?php echo esc_html($style['lightbox_ctrl_cont_border_radius']); ?>px;
715
+ <?php } else { ?> bottom: 0;
716
+ border-top-left-radius: <?php echo esc_html($style['lightbox_ctrl_cont_border_radius']); ?>px;
717
+ border-top-right-radius: <?php echo esc_html($style['lightbox_ctrl_cont_border_radius']); ?>px;
718
+ <?php } ?> height: <?php echo esc_html($style['lightbox_ctrl_btn_height']) + 2 * esc_html($style['lightbox_ctrl_btn_margin_top']); ?>px;
719
+ /*opacity:
720
+ <?php echo number_format(esc_html($style['lightbox_ctrl_cont_transparent']) / 100, 2, ".", ""); ?> ;
721
  filter: Alpha(opacity=
722
  <?php echo esc_html($style['lightbox_ctrl_cont_transparent']); ?> );*/
723
+ position: absolute;
724
+ text-align: <?php echo esc_html($style['lightbox_ctrl_btn_align']); ?>;
725
+ width: 100%;
726
+ z-index: 10150;
727
+ padding: 8px;
728
+ }
729
+
730
+ <?php echo esc_html($lb_container); ?> .wdi_toggle_container {
731
+ background: none repeat scroll 0 0 <?php echo esc_html($style['lightbox_ctrl_cont_bg_color']); ?>;
732
+ <?php if (esc_html($style['lightbox_ctrl_btn_pos']) == 'top') { ?>
733
+ border-bottom-left-radius: <?php echo esc_html($style['lightbox_ctrl_cont_border_radius']); ?>px;
734
+ border-bottom-right-radius: <?php echo esc_html($style['lightbox_ctrl_cont_border_radius']); ?>px;
735
+ border-radius: <?php echo esc_html($style['lightbox_ctrl_cont_border_radius']); ?>px;
736
+ top: <?php echo esc_html($style['lightbox_ctrl_btn_height']) + 2 * esc_html($style['lightbox_ctrl_btn_margin_top']); ?>px;
737
+ <?php } else { ?>
738
+ border-top-left-radius: <?php echo esc_html($style['lightbox_ctrl_cont_border_radius']); ?>px;
739
+ border-top-right-radius: <?php echo esc_html($style['lightbox_ctrl_cont_border_radius']); ?>px;
740
+ border-radius: <?php echo esc_html($style['lightbox_ctrl_cont_border_radius']); ?>px;
741
+ bottom: <?php echo esc_html($style['lightbox_ctrl_btn_height']) + 2 * esc_html($style['lightbox_ctrl_btn_margin_top']); ?>px;
742
+ <?php }?>
743
+ cursor: pointer;
744
+ left: 50%;
745
+ line-height: 0;
746
+ margin-left: -<?php echo esc_html($style['lightbox_toggle_btn_width']) / 2; ?>px;
747
+ opacity: <?php echo number_format(esc_html($style['lightbox_ctrl_cont_transparent']) / 100, 2, ".", ""); ?>;
748
+ filter: Alpha(opacity=<?php echo esc_attr($style['lightbox_ctrl_cont_transparent']); ?>);
749
+ position: absolute;
750
+ text-align: center;
751
+ width: <?php echo esc_html($style['lightbox_toggle_btn_width']); ?>px;
752
+ z-index: 10149;
753
+ }
754
+
755
+ <?php echo esc_html($lb_container); ?> .wdi_close_btn {
756
+ opacity: <?php echo number_format(esc_html($style['lightbox_close_btn_transparent']) / 100, 2, ".", ""); ?>;
757
+ filter: Alpha(opacity=<?php echo esc_attr($style['lightbox_close_btn_transparent']); ?>);
758
+ }
759
+
760
+ <?php echo esc_html($lb_container); ?> .wdi_spider_popup_close {
761
+ background-color: <?php echo esc_html($style['lightbox_close_btn_bg_color']); ?>;
762
+ border-radius: <?php echo esc_html($style['lightbox_close_btn_border_radius']); ?>px;
763
+ border: <?php echo esc_html($style['lightbox_close_btn_border_width']); ?>px <?php echo esc_html($style['lightbox_close_btn_border_style']); ?> <?php echo esc_html($style['lightbox_close_btn_border_color']); ?>;
764
+ box-shadow: <?php echo esc_html($style['lightbox_close_btn_box_shadow']); ?>;
765
+ color: <?php echo esc_html($style['lightbox_close_btn_color']); ?>;
766
+ height: <?php echo esc_html($style['lightbox_close_btn_height']); ?>px;
767
+ font-size: <?php echo esc_html($style['lightbox_close_btn_size']); ?>px;
768
+ right: <?php echo esc_html($style['lightbox_close_btn_right']); ?>px;
769
+ top: <?php echo esc_html($style['lightbox_close_btn_top']); ?>px;
770
+ width: <?php echo esc_html($style['lightbox_close_btn_width']); ?>px;
771
+ }
772
+
773
+ <?php echo esc_html($lb_container); ?> .wdi_spider_popup_close_fullscreen {
774
+ color: <?php echo esc_html($style['lightbox_close_btn_full_color']); ?>;
775
+ font-size: <?php echo esc_html($style['lightbox_close_btn_size']); ?>px;
776
+ right: 15px;
777
+ }
778
+
779
+ .wdi_spider_popup_close span,
780
+ #wdi_spider_popup_left-ico span,
781
+ #wdi_spider_popup_right-ico span {
782
+ display: table-cell;
783
+ text-align: center;
784
+ vertical-align: middle;
785
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
786
 
787
+ <?php echo esc_html($lb_container); ?> #wdi_spider_popup_left-ico,
788
+ <?php echo esc_html($lb_container); ?> #wdi_spider_popup_right-ico {
789
+ background-color: <?php echo esc_html($style['lightbox_rl_btn_bg_color']); ?>;
790
+ /***/
791
+ border-radius: <?php echo esc_html($style['lightbox_rl_btn_border_radius']); ?>px;
792
+ /***/
793
+ border: <?php echo esc_html($style['lightbox_rl_btn_border_width']); ?>px <?php echo esc_html($style['lightbox_rl_btn_border_style']); ?> <?php echo esc_html($style['lightbox_rl_btn_border_color']); ?>;
794
+ box-shadow: <?php echo esc_html($style['lightbox_rl_btn_box_shadow']); ?>;
795
+ color: <?php echo esc_html($style['lightbox_rl_btn_color']); ?>;
796
+ height: <?php echo esc_html($style['lightbox_rl_btn_height']); ?>px;
797
+ font-size: <?php echo esc_html($style['lightbox_rl_btn_size']); ?>px;
798
+ width: <?php echo esc_html($style['lightbox_rl_btn_width']); ?>px;
799
+ opacity: <?php echo number_format(esc_html($style['lightbox_rl_btn_transparent']) / 100, 2, ".", ""); ?>;
800
+ filter: Alpha(opacity=<?php echo esc_attr($style['lightbox_rl_btn_transparent']); ?>);
801
+ }
802
+
803
+ <?php echo esc_html($lb_container); ?> .wdi_ctrl_btn:hover,
804
+ <?php echo esc_html($lb_container); ?> .wdi_toggle_btn:hover,
805
+ <?php echo esc_html($lb_container); ?> #wdi_spider_popup_left-ico:hover,
806
+ <?php echo esc_html($lb_container); ?> #wdi_spider_popup_right-ico:hover {
807
+ color: <?php echo esc_html($style['lightbox_close_rl_btn_hover_color']); ?>;
808
+ cursor: pointer;
809
+ }
810
+
811
+ <?php echo esc_html($lb_container); ?> .wdi_spider_popup_close:hover,
812
+ <?php echo esc_html($lb_container); ?> .wdi_spider_popup_close_fullscreen:hover{
813
+ color: <?php echo esc_html($style['lightbox_close_btn_hover_color']);?>;
814
+ cursor: pointer;
815
+ }
816
+
817
+ .wdi_image_wrap {
818
+ height: inherit;
819
+ display: table;
820
+ position: absolute;
821
+ text-align: center;
822
+ width: inherit;
823
+ }
824
+ .wdi_image_wrap * {
825
+ -moz-user-select: none;
826
+ -khtml-user-select: none;
827
+ -webkit-user-select: none;
828
+ -ms-user-select: none;
829
+ user-select: none;
830
+ }
831
+ .wdi_embed_frame{
832
+ text-align:center;
833
+ }
834
+ .wdi_comment_wrap {
835
+ bottom: 0;
836
+ left: 0;
837
+ overflow: hidden;
838
+ position: absolute;
839
+ right: 0;
840
+ top: 0;
841
+ z-index: -1;
842
+ }
843
 
844
+ <?php echo esc_html($lb_container); ?> .wdi_comment_container {
845
+ -moz-box-sizing: border-box;
846
+ background-color: <?php echo esc_html($style['lightbox_comment_bg_color']); ?>;
847
+ color: <?php echo esc_html($style['lightbox_comment_font_color']); ?>;
848
+ font-size: <?php echo esc_html($style['lightbox_comment_font_size']); ?>px;
849
+ font-family: <?php echo esc_html($style['lightbox_comment_font_style']); ?>;
850
+ height: 100%;
851
+ overflow: hidden;
852
+ position: absolute;
853
+ <?php echo esc_html($style['lightbox_comment_pos']); ?>: -<?php echo esc_html($style['lightbox_comment_width']); ?>px;
854
+ top: 0;
855
+ width: <?php echo esc_html($style['lightbox_comment_width']); ?>px;
856
+ z-index: 10103;
857
+ }
858
+
859
+ <?php echo esc_html($lb_container); ?> .wdi_comments {
860
+ bottom: 0;
861
+ font-size: <?php echo esc_html($style['lightbox_comment_font_size']); ?>px;
862
+ font-family: <?php echo esc_html($style['lightbox_comment_font_style']); ?>;
863
+ height: 100%;
864
+ left: 0;
865
+ overflow-x: hidden;
866
+ overflow-y: auto;
867
+ position: absolute;
868
+ top: 0;
869
+ width: 100%;
870
+ z-index: 10101;
871
+ }
872
+
873
+ .wdi_comments p,
874
+ .wdi_comment_body_p {
875
+ margin: 5px !important;
876
+ text-align: left;
877
+ word-wrap: break-word;
878
+ word-break: break-word;
879
+ }
880
+ .wdi_no_comment{
881
+ text-align: center !important;
882
+ }
883
 
884
+ <?php echo esc_html($lb_container); ?> .wdi_comments input[type="submit"] {
885
+ background: none repeat scroll 0 0 <?php echo esc_html($style['lightbox_comment_button_bg_color']); ?>;
886
+ border: <?php echo esc_html($style['lightbox_comment_button_border_width']); ?>px <?php echo esc_html($style['lightbox_comment_button_border_style']); ?> <?php echo esc_html($style['lightbox_comment_button_border_color']); ?>;
887
+ border-radius: <?php echo esc_html($style['lightbox_comment_button_border_radius']); ?>px;
888
+ color: <?php echo esc_html($style['lightbox_comment_font_color']); ?>;
889
+ cursor: pointer;
890
+ padding: <?php echo esc_html($style['lightbox_comment_button_padding']); ?>;
891
+ }
892
+
893
+
894
+ <?php echo esc_html($lb_container); ?> .wdi_comments input[type="text"],
895
+ <?php echo esc_html($lb_container); ?> .wdi_comments textarea {
896
+ background: none repeat scroll 0 0 <?php echo esc_html($style['lightbox_comment_input_bg_color']); ?>;
897
+ border: <?php echo esc_html($style['lightbox_comment_input_border_width']); ?>px <?php echo esc_html($style['lightbox_comment_input_border_style']); ?> <?php echo esc_html($style['lightbox_comment_input_border_color']); ?>;
898
+ /***/
899
+ border-radius: <?php echo esc_html($style['lightbox_comment_input_border_radius']); ?>px;
900
+ /***/
901
+ color: <?php echo esc_html($style['lightbox_comment_font_color']); ?>;
902
+ padding: <?php echo esc_html($style['lightbox_comment_input_padding']); ?>;
903
+ width: 100%;
904
+ }
905
+
906
+ .wdi_comments textarea {
907
+ resize: vertical;
908
+ }
909
+ <?php echo esc_html($lb_container); ?> .wdi_comment_header_p {
910
+ border-top: <?php echo esc_html($style['lightbox_comment_separator_width']); ?>px <?php echo esc_html($style['lightbox_comment_separator_style']); ?> <?php echo esc_html($style['lightbox_comment_separator_color']); ?>;
911
+ }
912
+
913
+ <?php echo esc_html($lb_container); ?> .wdi_comment_header {
914
+ margin-top: 2px;
915
+ display: inline-block;
916
+ color: <?php echo esc_html($style['lightbox_comment_font_color']); ?>;
917
+ font-size: <?php echo esc_html($style['lightbox_comment_author_font_size']); ?>px;
918
+ }
919
+
920
+ <?php echo esc_html($lb_container); ?> .wdi_comment_date {
921
+ color: <?php echo esc_html($style['lightbox_comment_font_color']); ?>;
922
+ float: right;
923
+ font-size: <?php echo esc_html($style['lightbox_comment_date_font_size']); ?>px;
924
+ }
925
+
926
+ <?php echo esc_html($lb_container); ?> .wdi_comment_body {
927
+ color: <?php echo esc_html($style['lightbox_comment_font_color']); ?>;
928
+ font-size: <?php echo esc_html($style['lightbox_comment_body_font_size']); ?>px;
929
+ }
930
+ .wdi_comment_delete_btn {
931
+ color: #FFFFFF;
932
+ cursor: pointer;
933
+ float: right;
934
+ font-size: 14px;
935
+ margin: 2px;
936
+ }
937
 
938
+ <?php echo esc_html($lb_container); ?> .wdi_comments_close {
939
+ cursor: pointer;
940
+ line-height: 0;
941
+ position: absolute;
942
+ font-size: 13px;
943
+ text-align: <?php echo ((esc_html($style['lightbox_comment_pos']) == 'left') ? 'right' : 'left'); ?>;
944
+ margin: 5px;
945
+ <?php echo ((esc_html($style['lightbox_comment_pos']) == 'left') ? 'right' : 'left'); ?> : 0;
946
+ top: 0;
947
+ background-color: <?php echo esc_html($style['lightbox_comment_bg_color']); ?>;
948
+ z-index: 10202;
949
+ }
950
+
951
+ .wdi_comments_close i{
952
+ z-index: 10201;
953
+ }
954
+ .wdi_comment_textarea::-webkit-scrollbar {
955
+ width: 4px;
956
+ }
957
+ .wdi_comment_textarea::-webkit-scrollbar-track {
958
+ }
959
+ .wdi_comment_textarea::-webkit-scrollbar-thumb {
960
+ background-color: rgba(255, 255, 255, 0.55);
961
+ border-radius: 2px;
962
+ }
963
+ .wdi_comment_textarea::-webkit-scrollbar-thumb:hover {
964
+ background-color: #D9D9D9;
965
+ }
966
+ .wdi_ctrl_btn_container a,
967
+ .wdi_ctrl_btn_container a:hover {
968
+ text-decoration: none;
969
+ }
970
+
971
+ .wdi_facebook:hover {
972
+ color: #3B5998 !important;
973
+ cursor: pointer;
974
+ }
975
+ .wdi_twitter:hover {
976
+ color: #4099FB !important;
977
+ cursor: pointer;
978
+ }
979
+ .wdi_google:hover {
980
+ color: #DD4B39 !important;
981
+ cursor: pointer;
982
+ }
983
+ .wdi_pinterest:hover {
984
+ color: #cb2027 !important;
985
+ cursor: pointer;
986
+ }
987
+ .wdi_tumblr:hover {
988
+ color: #2F5070 !important;
989
+ cursor: pointer;
990
+ }
991
+ .wdi_linkedin:hover {
992
+ color: #0077B5 !important;
993
+ cursor: pointer;
994
+ }
995
+
996
+ <?php echo esc_html($lb_container); ?> .wdi_facebook,
997
+ <?php echo esc_html($lb_container); ?> .wdi_twitter,
998
+ <?php echo esc_html($lb_container); ?> .wdi_google,
999
+ <?php echo esc_html($lb_container); ?> .wdi_pinterest,
1000
+ <?php echo esc_html($lb_container); ?> .wdi_tumblr,
1001
+ <?php echo esc_html($lb_container); ?> .wdi_linkedin {
1002
+ color: <?php echo esc_html($style['lightbox_comment_share_button_color']); ?> !important;
1003
+ }
1004
+
1005
+ <?php echo esc_html($lb_container); ?> .wdi_thumb_active {
1006
+ opacity: 1;
1007
+ filter: Alpha(opacity=100);
1008
+ border: <?php echo esc_html($style['lightbox_filmstrip_thumb_active_border_width']); ?>px solid <?php echo esc_html($style['lightbox_filmstrip_thumb_active_border_color']); ?>;
1009
+ }
1010
+
1011
+ <?php echo esc_html($lb_container); ?> .wdi_thumb_deactive {
1012
+ opacity: <?php echo number_format(esc_html($style['lightbox_filmstrip_thumb_deactive_transparent']) / 100, 2, ".", ""); ?>;
1013
+ filter: Alpha(opacity=<?php echo esc_attr($style['lightbox_filmstrip_thumb_deactive_transparent']); ?>);
1014
+ }
1015
+ <?php echo esc_html($lb_container); ?> .wdi_filmstrip_thumbnail_img {
1016
+ display: block;
1017
+ opacity: 1;
1018
+ filter: Alpha(opacity=100);
1019
+ }
1020
+
1021
+ <?php echo esc_html($lb_container); ?> .wdi_filmstrip_left i,
1022
+ <?php echo esc_html($lb_container); ?> .wdi_filmstrip_right i {
1023
+ color: <?php echo esc_html($style['lightbox_filmstrip_rl_btn_color']); ?>;
1024
+ font-size: <?php echo esc_html($style['lightbox_filmstrip_rl_btn_size']); ?>px;
1025
+ }
1026
+
1027
+ .wdi_none_selectable {
1028
+ -webkit-touch-callout: none;
1029
+ -webkit-user-select: none;
1030
+ -khtml-user-select: none;
1031
+ -moz-user-select: none;
1032
+ -ms-user-select: none;
1033
+ user-select: none;
1034
+ }
1035
+ .wdi_slide_container {
1036
+ display: table-cell;
1037
+ position: absolute;
1038
+ vertical-align: middle;
1039
+ width: 100%;
1040
+ height: 100%;
1041
+ }
1042
+ .wdi_slide_bg {
1043
+ margin: 0 auto;
1044
+ width: inherit;
1045
+ height: inherit;
1046
+ }
1047
+ .wdi_slider {
1048
+ height: inherit;
1049
+ width: inherit;
1050
+ }
1051
+ .wdi_popup_image_spun {
1052
+ height: inherit;
1053
+ display: table-cell;
1054
+ filter: Alpha(opacity=100);
1055
+ opacity: 1;
1056
+ position: absolute;
1057
+ vertical-align: middle;
1058
+ width: inherit;
1059
+ z-index: 2;
1060
+ }
1061
+ .wdi_popup_image_second_spun {
1062
+ width: inherit;
1063
+ height: inherit;
1064
+ display: table-cell;
1065
+ filter: Alpha(opacity=0);
1066
+ opacity: 0;
1067
+ position: absolute;
1068
+ vertical-align: middle;
1069
+ z-index: 1;
1070
+ }
1071
+ .wdi_grid {
1072
+ display: none;
1073
+ height: 100%;
1074
+ overflow: hidden;
1075
+ position: absolute;
1076
+ width: 100%;
1077
+ }
1078
+ .wdi_gridlet {
1079
+ opacity: 1;
1080
+ filter: Alpha(opacity=100);
1081
+ position: absolute;
1082
+ }
1083
+
1084
+ <?php echo esc_html($lb_container); ?> .wdi_image_info_spun {
1085
+ text-align: <?php echo esc_html($style['lightbox_info_align']); ?>;
1086
+ vertical-align: <?php echo esc_html($style['lightbox_info_pos']); ?>;
1087
+ }
1088
+
1089
+ <?php echo esc_html($lb_container); ?> .wdi_image_title,
1090
+ <?php echo esc_html($lb_container); ?> .wdi_image_title * {
1091
+ color: <?php echo esc_html($style['lightbox_title_color']); ?> !important;
1092
+ font-family: <?php echo esc_html($style['lightbox_title_font_style']); ?>;
1093
+ font-size: <?php echo esc_html($style['lightbox_title_font_size']); ?>px;
1094
+ font-weight: <?php echo esc_html($style['lightbox_title_font_weight']); ?>;
1095
+ }
1096
+
1097
+ <?php echo esc_html($lb_container); ?> .wdi_image_description,
1098
+ <?php echo esc_html($lb_container); ?> .wdi_image_description * {
1099
+ color: <?php echo esc_html($style['lightbox_description_color']); ?> !important;
1100
+ font-family: <?php echo esc_html($style['lightbox_description_font_style']); ?>;
1101
+ font-size: <?php echo esc_html($style['lightbox_description_font_size']); ?>px;
1102
+ font-weight: <?php echo esc_html($style['lightbox_description_font_weight']); ?>;
1103
+ }
1104
+
1105
+ .wdi_title{
1106
+ display: inline-table;
1107
+ }
1108
+ .wdi_title:hover{
1109
+ cursor: pointer;
1110
+ }
1111
+ .wdi_title .wdi_users_img_wrap{
1112
+ width: 50px;
1113
+ display: table-cell;
1114
+ vertical-align: middle;
1115
+ float: right;
1116
+ padding-left: 10px;
1117
+ overflow: hidden;
1118
+ }
1119
+ .wdi_title .wdi_users_img_wrap img{
1120
+ width: 100%;
1121
+ }
1122
+ .wdi_title .wdi_header_text{
1123
+ display: table-cell;
1124
+ vertical-align: middle;
1125
+ word-break: break-all;
1126
+ }
1127
+
1128
+ <?php echo esc_html($lb_container) ; ?> .wdi_share_btns{
1129
+ position: absolute;
1130
+ <?php $shareBtn = $style['lightbox_ctrl_btn_height'] + $style['lightbox_ctrl_btn_margin_top'] + 8; ?>
1131
+ <?php echo (esc_html($style['lightbox_ctrl_btn_pos']) == 'top') ? 'bottom' : 'top';?>: <?php echo esc_html(- $shareBtn);?>px;
1132
+ height: <?php echo esc_html($style['lightbox_ctrl_btn_height']) + esc_html($style['lightbox_ctrl_btn_margin_top']);?>px;
1133
+ width: <?php echo esc_html($style['lightbox_ctrl_btn_height'])*7.5;?>px;
1134
+ border-radius: 3px;
1135
+ right: -145px;
1136
+ margin: 0;
1137
+ z-index: 200000;
1138
+ background-color: rgba(<?php echo esc_html($rgb_lightbox_ctrl_cont_bg_color['red']); ?>, <?php echo esc_html($rgb_lightbox_ctrl_cont_bg_color['green']); ?>, <?php echo esc_html($rgb_lightbox_ctrl_cont_bg_color['blue']); ?>, <?php echo number_format(esc_html($style['lightbox_ctrl_cont_transparent']) / 100, 2, ".", ""); ?>);
1139
+ padding-top: 5px;
1140
+ }
1141
+
1142
+ .wdi_share_btns_container{
1143
+ position: relative;
1144
+ display: inline-block;
1145
+ }
1146
+
1147
+ <?php echo esc_html($lb_container) ; ?> .wdi_share_popup_btn{
1148
+ color: <?php echo esc_html($style['lightbox_ctrl_btn_color']); ?>;
1149
+ padding: 3px;
1150
+ opacity: <?php echo number_format(esc_html($style['lightbox_ctrl_btn_transparent']) / 100, 2, ".", ""); ?>;
1151
+ filter: Alpha(opacity=<?php echo esc_attr($style['lightbox_ctrl_btn_transparent']); ?>);
1152
+ font-size: <?php echo esc_html($style['lightbox_ctrl_btn_height']);?>px;
1153
+ }
1154
+
1155
+ <?php echo esc_html($lb_container) ; ?> .wdi_share_caret{
1156
+ font-size: 15px;
1157
+ color: <?php echo esc_html($style['lightbox_ctrl_cont_bg_color']); ?>;
1158
+ opacity: <?php echo number_format(esc_html($style['lightbox_ctrl_cont_transparent']) / 100, 2, ".", ""); ?>;
1159
+ position: absolute;
1160
+ top: -25px;
1161
+ left: 13px;
1162
+ }
1163
+
1164
+ .wdi_share_toggler{
1165
+ display: block !important;
1166
+ }
1167
+ .wdi_facebook_btn:hover{
1168
+ color: #45619D;
1169
+ }
1170
+ .wdi_facebook_btn:hover{
1171
+ color: #4099FB;
1172
+ }
1173
+
1174
+ <?php echo esc_html($lb_container);?> .wdi_comment_header a,
1175
+ <?php echo esc_html($lb_container);?> .wdi_comment_header a:visited{
1176
+ color: <?php echo esc_html($style['lightbox_comment_author_font_color']); ?> !important;
1177
+ }
1178
+
1179
+ <?php echo esc_html($lb_container);?> .wdi_comm_text_link,
1180
+ <?php echo esc_html($lb_container);?> a.wdi_comm_text_link:visited{
1181
+ color: <?php echo esc_html($style['lightbox_comment_author_font_color']); ?>!important;
1182
+ }
1183
+ <?php echo esc_html($lb_container);?> .wdi_comment_header a:hover,
1184
+ <?php echo esc_html($lb_container);?> a.wdi_comm_text_link:hover{
1185
+ text-decoration: none;
1186
+ color: <?php echo esc_html($style['lightbox_comment_author_font_color_hover']); ?>!important;
1187
+ }
1188
+
1189
+ <?php echo esc_html($lb_container);?> .wdi_load_more_comments{
1190
+ display: inline-block;
1191
+ color: <?php echo esc_html($style['lightbox_comment_load_more_color']); ?>;
1192
+ background-color: <?php echo esc_html($style['lightbox_comment_bg_color']); ?>;
1193
+ -webkit-user-select: none; /* Chrome/Safari */
1194
+ -moz-user-select: none; /* Firefox */
1195
+ -ms-user-select: none; /* IE10+ */
1196
+ /* Rules below not implemented in browsers yet */
1197
+ -o-user-select: none;
1198
+ user-select: none;
1199
+ font-family: 'Verdana', sans-serif;
1200
+ text-transform: capitalize;
1201
+ font-size: 17px;
1202
+ }
1203
+
1204
+ <?php echo esc_html($lb_container);?> .wdi_load_more_comments:hover{
1205
+ color: <?php echo esc_html($style['lightbox_comment_load_more_color_hover']);?>;
1206
+ cursor: pointer;
1207
+ }
1208
+
1209
+
1210
+ /*partly*/
1211
+
1212
+ .wdi_popup_image {
1213
+ vertical-align: middle;
1214
+ display: inline-block;
1215
+ }
1216
 
1217
+
1218
+ .wdi_popup_embed {
1219
+ vertical-align: middle;
1220
+ text-align: center;
1221
+ display: inline-block;
1222
+ }
1223
+
1224
+ .wdi_image_container{
1225
+ display: table;
1226
+ position: absolute;
1227
+ text-align: center;
1228
+ vertical-align: middle;
1229
+ width: 100%;
1230
+ }
1231
+
1232
+ <?php echo esc_html($lb_container); ?> .wdi_filmstrip_container {
1233
+ display: <?php echo ($filmstrip_direction == 'horizontal'? 'table' : 'block'); ?>;
1234
+ position: absolute;
1235
+ z-index: 10105;
1236
+ <?php echo esc_html($style['lightbox_filmstrip_pos']); ?>: 0;
1237
+ }
1238
+
1239
+ .wdi_filmstrip {
1240
+ overflow: hidden;
1241
+ position: absolute;
1242
+ z-index: 10106;
1243
+ }
1244
+
1245
+ .wdi_filmstrip_thumbnails {
1246
+ margin: 0 auto;
1247
+ overflow: hidden;
1248
+ position: relative;
1249
+ }
1250
+
1251
+ <?php echo esc_html($lb_container); ?> .wdi_filmstrip_thumbnail {
1252
+ position: relative;
1253
+ background: none;
1254
+ border: <?php echo esc_html($style['lightbox_filmstrip_thumb_border_width']); ?>px <?php echo esc_html($style['lightbox_filmstrip_thumb_border_style']); ?> <?php echo esc_html($style['lightbox_filmstrip_thumb_border_color']); ?>;
1255
+ border-radius: <?php echo esc_html($style['lightbox_filmstrip_thumb_border_radius']); ?>px;
1256
+ cursor: pointer;
1257
+ float: left;
1258
+ margin: <?php echo esc_html($style['lightbox_filmstrip_thumb_margin']); ?>;
1259
+ overflow: hidden;
1260
+ }
1261
+
1262
+ <?php echo esc_html($lb_container); ?> .wdi_filmstrip_left {
1263
+ background-color: <?php echo esc_html($style['lightbox_filmstrip_rl_bg_color']); ?>;
1264
+ cursor: pointer;
1265
+ display: <?php echo ($filmstrip_direction == 'horizontal' ? 'table-cell' : 'block') ?>;
1266
+ vertical-align: middle;
1267
+ z-index: 10106;
1268
+ <?php echo ($filmstrip_direction == 'horizontal' ? '' : 'position: absolute;'); ?>
1269
+ <?php echo ($filmstrip_direction == 'horizontal' ? '' : 'width: 100%;'); ?>
1270
+ }
1271
+
1272
+ <?php echo esc_html($lb_container); ?> .wdi_filmstrip_right {
1273
+ background-color: <?php echo esc_html($style['lightbox_filmstrip_rl_bg_color']); ?>;
1274
+ cursor: pointer;
1275
+ <?php echo($filmstrip_direction == 'horizontal' ? 'right' : 'bottom') ?>: 0;
1276
+ display: <?php echo ($filmstrip_direction == 'horizontal' ? 'table-cell' : 'block') ?>;
1277
+ vertical-align: middle;
1278
+ z-index: 10106;
1279
+ <?php echo ($filmstrip_direction == 'horizontal' ? '' : 'position: absolute;') ?>
1280
+ <?php echo ($filmstrip_direction == 'horizontal' ? '' : 'width: 100%;') ?>
1281
+ }
1282
+
1283
+ <?php echo esc_html($lb_container); ?> .wdi_image_info{
1284
+ background: rgba(<?php echo esc_html($rgb_wdi_image_info_bg_color['red']); ?>, <?php echo esc_html($rgb_wdi_image_info_bg_color['green']); ?>, <?php echo esc_html($rgb_wdi_image_info_bg_color['blue']); ?>, <?php echo number_format(esc_html($style['lightbox_info_bg_transparent']) / 100, 2, ".", ""); ?>);
1285
+ border: <?php echo esc_html($style['lightbox_info_border_width']); ?>px <?php echo esc_html($style['lightbox_info_border_style']); ?> <?php echo esc_html($style['lightbox_info_border_color']); ?>;
1286
+ border-radius: <?php echo esc_html($style['lightbox_info_border_radius']); ?>px;
1287
+ padding: <?php echo esc_html($style['lightbox_info_padding']); ?>;
1288
+ overflow: auto;
1289
+ }
1290
+
1291
+ @media (max-width: 480px) {
1292
+ .wdi_image_count_container {
1293
+ display: none;
1294
+ }
1295
+
1296
+ .wdi_image_title,
1297
+ .wdi_image_title * {
1298
+ font-size: 12px;
1299
+ }
1300
+
1301
+ .wdi_image_description,
1302
+ .wdi_image_description * {
1303
+ font-size: 10px;
1304
+ }
1305
+ }
1306
+
1307
+ .wdi_image_count_container {
1308
+ left: 0;
1309
+ line-height: 1;
1310
+ position: absolute;
1311
+ vertical-align: middle;
1312
+ }
1313
+ </style>
1314
+ <?php
1315
+ $css = ob_get_contents();
1316
+ ob_end_clean();
1317
+ $css = wp_filter_nohtml_kses($css);
1318
+ return $css;
1319
+ }
1320
 
1321
  /**
1322
+ * Update file.
1323
+ *
1324
  * @param string $file_name
1325
  * @param string $file_content
1326
  * @return WP_Error|boolean
1327
  * */
1328
+ public function update_file( $file_content ) {
1329
 
1330
  $file_name = sprintf($this->file_name_format, $this->theme_id);
 
1331
  $wp_upload_dir = wp_upload_dir();
1332
  $wp_upload_dir = $wp_upload_dir['basedir'];
 
1333
  $folder = $wp_upload_dir . '/' . $this->folder_name;
1334
+ if ( !is_dir($folder) ) {
1335
+ //folder creating to save plugin styles in separated folder in upload folder
1336
+ //phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.directory_mkdir
1337
+ if ( mkdir($folder, 0777, TRUE) === FALSE ) {
1338
  return new WP_Error('wdi_failed_create_folder');
1339
  }
1340
+ //value of $folder, obtained from the wp_upload_dir() helper function
1341
+ //phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_file_put_contents
1342
+ if ( file_put_contents($folder . '/index.html', "Index file.") === FALSE ) {
1343
  return new WP_Error('wdi_failed_create_index_file');
1344
  }
 
1345
  }
1346
+ //value of $folder, obtained from the wp_upload_dir() helper function
1347
+ //phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_file_put_contents
1348
+ if ( file_put_contents($folder . '/' . $file_name, $file_content) === FALSE ) {
1349
  return new WP_Error('wdi_failed_create_css_file');
1350
  }
 
1351
  $this->refresh_file_key();
1352
+
1353
+ return TRUE;
1354
  }
1355
 
1356
 
1357
+ /**
1358
+ * @param $view_type string
1359
+ * @return string empty if file dose not exists or file url
1360
+ * */
1361
+ public function get_file_url(){
1362
+ $file_name = sprintf($this->file_name_format, $this->theme_id);
1363
 
1364
+ $wp_upload_dir = wp_upload_dir();
1365
+ $basedir = $wp_upload_dir['basedir'];
1366
+ $baseurl = $wp_upload_dir['baseurl'];
1367
+
1368
+ if(is_ssl()) {
1369
+ $baseurl = str_replace('http://', 'https://', $baseurl);
1370
+ }
1371
 
1372
+ $dir = $basedir . '/' . $this->folder_name . '/' . $file_name;
1373
+ if( file_exists($dir) ) {
1374
+ return $baseurl . '/' . $this->folder_name . '/' . $file_name;
1375
+ } else {
1376
+ return "";
1377
+ }
1378
  }
1379
 
1380
+ public function get_css(){
1381
+ return $this->css;
 
 
 
1382
  }
 
1383
 
1384
+ public function refresh_file_key(){
1385
+ $option = get_option('wdi_theme_keys');
 
1386
 
1387
+ if(!is_array($option)) {
1388
+ $option = array();
1389
+ }
1390
 
1391
+ $this->file_key = uniqid();
1392
+ $option[$this->theme_id] = $this->file_key;
1393
+ update_option('wdi_theme_keys', $option);
1394
+ return $option;
1395
  }
1396
 
1397
+ public function get_file_key(){
1398
+ if($this->file_key !== null) {
1399
+ $this->file_key;
1400
+ }
 
1401
 
1402
+ $option = get_option('wdi_theme_keys');
1403
+ if(!isset($option[$this->theme_id])) {
1404
+ $option = $this->refresh_file_key();
1405
+ }
1406
 
1407
+ return $option[$this->theme_id];
 
 
1408
  }
1409
 
 
 
 
1410
  }
frontend/models/WDIModelGalleryBox.php CHANGED
@@ -5,10 +5,12 @@ class WDIModelGalleryBox {
5
  public function get_theme_row_data($id) {
6
  global $wpdb;
7
  if ($id) {
8
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . WDI_THEME_TABLE . ' WHERE id="%d"', $id));
 
9
  }
10
- else {
11
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . WDI_THEME_TABLE .' WHERE default_theme="%d"', 1));
 
12
  }
13
 
14
  return WDILibrary::objectToArray($row);
@@ -16,19 +18,22 @@ class WDIModelGalleryBox {
16
 
17
  public function get_feed_row_data($id) {
18
  global $wpdb;
19
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . WDI_FEED_TABLE . ' WHERE id="%d"', $id));
 
20
  return WDILibrary::objectToArray($row);
21
  }
22
 
23
  public function get_option_row_data() {
24
  global $wpdb;
25
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wdi_option WHERE id="%d"', 1));
 
26
  return $row;
27
  }
28
 
29
  public function get_comment_rows_data($image_id) {
30
  global $wpdb;
31
- $row = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wdi_image_comment WHERE image_id="%d" AND published=1 ORDER BY `id` DESC', $image_id));
 
32
  return $row;
33
  }
34
 
@@ -43,8 +48,12 @@ class WDIModelGalleryBox {
43
  if (preg_replace('/\s+/', '', $order_by) != 'asc') {
44
  $order_by = 'desc';
45
  }
46
- $row = $wpdb->get_results($wpdb->prepare('SELECT t1.*,t2.rate FROM ' . $wpdb->prefix . 'wdi_image as t1 LEFT JOIN (SELECT rate, image_id FROM ' . $wpdb->prefix . 'wdi_image_rate WHERE ip="%s") as t2 ON t1.id=t2.image_id WHERE t1.published=1 AND t1.gallery_id="%d" ORDER BY ' . $sort_by . ' ' . $order_by, $_SERVER['REMOTE_ADDR'], $gallery_id));
47
-
 
 
 
 
48
  return $row;
49
  }
50
 
@@ -59,7 +68,11 @@ class WDIModelGalleryBox {
59
  if (preg_replace('/\s+/', '', $order_by) != 'asc') {
60
  $order_by = 'desc';
61
  }
62
- $row = $wpdb->get_results($wpdb->prepare('SELECT t1.*,t2.rate FROM (SELECT image.* FROM ' . $wpdb->prefix . 'wdi_image as image INNER JOIN ' . $wpdb->prefix . 'wdi_image_tag as tag ON image.id=tag.image_id WHERE image.published=1 AND tag.tag_id="%d" ORDER BY ' . $sort_by . ' ' . $order_by. ') as t1 LEFT JOIN (SELECT rate, image_id FROM ' . $wpdb->prefix . 'wdi_image_rate WHERE ip="%s") as t2 ON t1.id=t2.image_id ', $tag_id, $_SERVER['REMOTE_ADDR']));
 
 
 
 
63
  return $row;
64
  }
65
  }
5
  public function get_theme_row_data($id) {
6
  global $wpdb;
7
  if ($id) {
8
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
9
+ $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . esc_sql($wpdb->prefix . WDI_THEME_TABLE) . ' WHERE id="%d"', $id)); //db call ok
10
  }
11
+ else {
12
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
13
+ $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . esc_sql($wpdb->prefix . WDI_THEME_TABLE) . ' WHERE default_theme="%d"', 1)); //db call ok
14
  }
15
 
16
  return WDILibrary::objectToArray($row);
18
 
19
  public function get_feed_row_data($id) {
20
  global $wpdb;
21
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
22
+ $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . esc_sql($wpdb->prefix . WDI_FEED_TABLE) . ' WHERE id="%d"', $id)); //db call ok
23
  return WDILibrary::objectToArray($row);
24
  }
25
 
26
  public function get_option_row_data() {
27
  global $wpdb;
28
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
29
+ $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . esc_sql($wpdb->prefix . 'wdi_option') . ' WHERE id="%d"', 1)); //db call ok
30
  return $row;
31
  }
32
 
33
  public function get_comment_rows_data($image_id) {
34
  global $wpdb;
35
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
36
+ $row = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . esc_sql($wpdb->prefix . 'wdi_image_comment') . ' WHERE image_id="%d" AND published=1 ORDER BY `id` DESC', $image_id)); //db call ok
37
  return $row;
38
  }
39
 
48
  if (preg_replace('/\s+/', '', $order_by) != 'asc') {
49
  $order_by = 'desc';
50
  }
51
+ $ip = WDILibrary::get_user_ip();
52
+ $query_order_by = sprintf(' ORDER BY %s %s', $sort_by, $order_by);
53
+ // $wpdb->prepare() not needed (will throw a notice) as there are no parameters (all parts are already sanitised or cast to known-safe types if not sanitised here)
54
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared */
55
+ $row = $wpdb->get_results($wpdb->prepare('SELECT t1.*,t2.rate FROM ' . esc_sql($wpdb->prefix . 'wdi_image') . ' AS t1 LEFT JOIN (SELECT rate, image_id FROM ' . esc_sql($wpdb->prefix . 'wdi_image_rate') . ' WHERE ip="%s") AS t2 ON t1.id=t2.image_id WHERE t1.published=1 AND t1.gallery_id="%d" ' . $query_order_by, $ip, $gallery_id)); //db call ok
56
+
57
  return $row;
58
  }
59
 
68
  if (preg_replace('/\s+/', '', $order_by) != 'asc') {
69
  $order_by = 'desc';
70
  }
71
+ $ip = WDILibrary::get_user_ip();
72
+ $query_order_by = sprintf(' ORDER BY %s %s', $sort_by, $order_by);
73
+ // $wpdb->prepare() not needed (will throw a notice) as there are no parameters (all parts are already sanitised or cast to known-safe types if not sanitised here)
74
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared */
75
+ $row = $wpdb->get_results($wpdb->prepare('SELECT t1.*,t2.rate FROM (SELECT image.* FROM ' . esc_sql($wpdb->prefix . 'wdi_image') . ' AS image INNER JOIN ' . $wpdb->prefix . 'wdi_image_tag AS tag ON image.id=tag.image_id WHERE image.published=1 AND tag.tag_id="%d" ' . $query_order_by . ') AS t1 LEFT JOIN (SELECT rate, image_id FROM ' . esc_sql($wpdb->prefix . 'wdi_image_rate') . ' WHERE ip="%s") AS t2 ON t1.id=t2.image_id ', $tag_id, $ip)); //db call ok
76
  return $row;
77
  }
78
  }
frontend/models/imagebrowser.php CHANGED
@@ -33,16 +33,16 @@ class WDI_ImageBrowser_model {
33
  }
34
 
35
  private function setThemeDefaults() {
36
- require_once(WDI_DIR . '/admin/models/WDIModelThemes_wdi.php');
37
- $defaults = WDIModelThemes_wdi::get_theme_defaults();
38
  $theme_row = $this->get_theme_row($this->feed_row['theme_id']);
39
 
40
  return wp_parse_args($theme_row, $defaults);
41
  }
42
 
43
  public function get_theme_row( $theme_id ) {
44
- require_once(WDI_DIR . '/admin/models/WDIModelThemes_wdi.php');
45
- $theme_row = WDIModelThemes_wdi::get_theme_row($theme_id);
46
 
47
  return WDILibrary::objectToArray($theme_row);
48
  }
33
  }
34
 
35
  private function setThemeDefaults() {
36
+ require_once(WDI_DIR . '/admin/models/themes.php');
37
+ $defaults = Themes_model_wdi::get_theme_defaults();
38
  $theme_row = $this->get_theme_row($this->feed_row['theme_id']);
39
 
40
  return wp_parse_args($theme_row, $defaults);
41
  }
42
 
43
  public function get_theme_row( $theme_id ) {
44
+ require_once(WDI_DIR . '/admin/models/themes.php');
45
+ $theme_row = Themes_model_wdi::get_theme_row($theme_id);
46
 
47
  return WDILibrary::objectToArray($theme_row);
48
  }
frontend/models/thumbnails.php CHANGED
@@ -27,16 +27,16 @@ class WDI_Thumbnails_model {
27
  }
28
 
29
  private function setThemeDefaults() {
30
- require_once(WDI_DIR . '/admin/models/WDIModelThemes_wdi.php');
31
- $defaults = WDIModelThemes_wdi::get_theme_defaults();
32
  $theme_row = $this->get_theme_row($this->feed_row['theme_id']);
33
 
34
  return wp_parse_args($theme_row, $defaults);
35
  }
36
 
37
  public function get_theme_row( $theme_id ) {
38
- require_once(WDI_DIR . '/admin/models/WDIModelThemes_wdi.php');
39
- $theme_row = WDIModelThemes_wdi::get_theme_row($theme_id);
40
 
41
  return WDILibrary::objectToArray($theme_row);
42
  }
27
  }
28
 
29
  private function setThemeDefaults() {
30
+ require_once(WDI_DIR . '/admin/models/themes.php');
31
+ $defaults = Themes_model_wdi::get_theme_defaults();
32
  $theme_row = $this->get_theme_row($this->feed_row['theme_id']);
33
 
34
  return wp_parse_args($theme_row, $defaults);
35
  }
36
 
37
  public function get_theme_row( $theme_id ) {
38
+ require_once(WDI_DIR . '/admin/models/themes.php');
39
+ $theme_row = Themes_model_wdi::get_theme_row($theme_id);
40
 
41
  return WDILibrary::objectToArray($theme_row);
42
  }
frontend/shortcode.php CHANGED
@@ -18,25 +18,6 @@ function wdi_feed($atts, $widget_params = '') {
18
  global $wdi_options;
19
  global $wdi_feed_counter;
20
  ob_start();
21
- /*
22
- // @Todo. This part must be changed. The update should be for every user.
23
- // Will access_token refresh in the last 30 dey.
24
- if ( !empty($wdi_options['wdi_access_token']) && !empty($wdi_options['wdi_start_in']) && !empty($wdi_options['wdi_expires_in']) ) {
25
- $expires_time = $wdi_options['wdi_start_in'] + $wdi_options['wdi_expires_in'] - (30 * 24 * 60 * 60);
26
- if ( time() >= $expires_time ) {
27
- $refresh = WDILibrary::refresh_instagram_access_token();
28
- }
29
- }
30
- // @Todo. This part must be changed. The expired should be for every user.
31
- if ( !empty($wdi_options['wdi_access_token']) && !empty($wdi_options['wdi_start_in']) && !empty($wdi_options['wdi_expires_in']) ) {
32
- $expires_time = $wdi_options['wdi_start_in'] + $wdi_options['wdi_expires_in'] - (10 * 60);
33
- if ( time() >= $expires_time ) {
34
- ob_get_clean();
35
-
36
- return __('Error: Access token session has expired, please reauthorize access token.', "wd-instagram-feed");
37
- }
38
- }
39
- */
40
  $feed_id = WDILibrary::get('feed_id', 0, 'intval');
41
  if ( $feed_id != 0 && $post->post_type === "wdi_instagram" && $widget_params === '' ) {
42
  if ( !is_array($atts) ) {
@@ -108,7 +89,7 @@ function wdi_feed($atts, $widget_params = '') {
108
  wdi_register_frontend_scripts( $params );
109
  if ( WDILibrary::is_ajax() || WDILibrary::elementor_is_active() ) {
110
  if ( $wdi_feed_counter == 0 ) {
111
- $wdi_feed_counter = rand(1000, 9999);
112
  global $wdi_feed_counter_init;
113
  $wdi_feed_counter_init = $wdi_feed_counter;
114
  }
@@ -207,7 +188,7 @@ function wdi_feed($atts, $widget_params = '') {
207
  }
208
  if ( isset($wdi_options['wdi_custom_js']) ) {
209
  ?>
210
- <script><?php echo str_replace('&quot;', '"', esc_js($wdi_options['wdi_custom_js'])); ?></script>
211
  <?php
212
  }
213
 
@@ -327,13 +308,13 @@ function wdi_load_frontend_scripts_ajax($additional_scripts = array(), $addition
327
  }
328
 
329
  if(!empty($wp_scripts->registered[$handle]->extra['data'])) {
330
- echo '<script>' . str_replace('&quot;', '"', esc_js($wp_scripts->registered[$handle]->extra['data'])) . '</script>';
331
  }
332
 
333
  if(strpos($wp_scripts->registered[$handle]->src, '/wp-includes/js/') === 0) {
334
- echo sprintf($script_tag, $wp_scripts->base_url . $wp_scripts->registered[$handle]->src, $wp_scripts->registered[$handle]->ver);
335
  } else {
336
- echo sprintf($script_tag, $wp_scripts->registered[$handle]->src, $wp_scripts->registered[$handle]->ver);
337
  }
338
  }
339
 
@@ -352,13 +333,14 @@ function wdi_load_frontend_scripts_ajax($additional_scripts = array(), $addition
352
  }
353
 
354
  if(!empty($wp_styles->registered[$handle]->extra['data'])) {
355
- echo '<script>' . esc_js($wp_styles->registered[$handle]->extra['data']) . '</script>';
356
  }
357
 
358
  if(strpos($wp_styles->registered[$handle]->src, '/wp-includes/js/') === 0) {
359
- echo sprintf($style_tag, $handle, $wp_styles->base_url . $wp_styles->registered[$handle]->src, $wp_styles->registered[$handle]->ver);
360
- } else {
361
- echo sprintf($style_tag, $handle, $wp_styles->registered[$handle]->src, $wp_styles->registered[$handle]->ver);
 
362
  }
363
  }
364
  }
@@ -371,21 +353,29 @@ function wdi_token_flag() {
371
  $add = add_option('wdi_token_error_flag', 1);
372
  $json = array( 'success' => $add );
373
  }
374
- echo json_encode($json);
375
  exit;
376
  }
377
 
378
  function wdi_feed_frontend_messages() {
379
  $manage_options_user = current_user_can('manage_options');
 
 
 
 
 
 
380
  if ( $manage_options_user ) {
381
- echo '<div style="color: #cc0000; text-align: center;" class="wdi_js_error">' . __("Something is wrong. Response takes too long or there is JS error. Press Ctrl+Shift+J or Cmd+Shift+J on a Mac to see error in console or ask for <a class='wdi_error_link' href='https://wordpress.org/support/plugin/wd-instagram-feed' target='_blank'>free support</a>.", 'wd-instagram-feed') . '<br/>' . (defined('DOING_AJAX') && DOING_AJAX) ? __("Warning: Instagram Feed is loaded using AJAX request. It might not display properly.", "wd-instagram-feed") : '' . '</div>';
382
- echo '<div style="color: #cc0000; text-align: center;" class="wdi_token_error wdi_hidden">' . __("Instagram token is invalid or expired. Please <a href='" . site_url() . "/wp-admin/admin.php?page=wdi_settings' target='_blank'>reset token</a> and sign-in again to get new one.") . '</div>';
383
- echo '<div style="color: #cc0000; text-align: center;" class="wdi_private_feed_error wdi_hidden"><span>' . __('Admin warning: there is one or more private user in this feed', 'wd-instagram-feed') . '(<span class="wdi_private_feed_names"></span>). ' . __('Their media won\'t be displayed.', 'wd-instagram-feed') . '</span></div>';
384
- echo '<div class="wdi_check_fontawesome wdi_hidden"><i class="tenweb-i tenweb-i-instagram""></i></div>';
385
- } else {
386
- echo '<div class="wdi_js_error">' . __('Something is wrong.', 'wd-instagram-feed') . '<br/>' . (defined('DOING_AJAX') && DOING_AJAX) ? __("Warning: Instagram Feed is loaded using AJAX request. It might not display properly.", "wd-instagram-feed") : '' . '</div>';
387
- echo '<div class="wdi_token_error wdi_hidden">' . __('Instagram token error.', 'wd-instagram-feed') . '</div>';
388
- echo '<div class="wdi_private_feed_error wdi_hidden"><span></span></div>';
389
- echo '<div class="wdi_check_fontawesome wdi_hidden"><i class="tenweb-i tenweb-i-instagram""></i></div>';
390
  }
 
 
 
 
 
391
  }
18
  global $wdi_options;
19
  global $wdi_feed_counter;
20
  ob_start();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  $feed_id = WDILibrary::get('feed_id', 0, 'intval');
22
  if ( $feed_id != 0 && $post->post_type === "wdi_instagram" && $widget_params === '' ) {
23
  if ( !is_array($atts) ) {
89
  wdi_register_frontend_scripts( $params );
90
  if ( WDILibrary::is_ajax() || WDILibrary::elementor_is_active() ) {
91
  if ( $wdi_feed_counter == 0 ) {
92
+ $wdi_feed_counter = wp_rand(1000, 9999);
93
  global $wdi_feed_counter_init;
94
  $wdi_feed_counter_init = $wdi_feed_counter;
95
  }
188
  }
189
  if ( isset($wdi_options['wdi_custom_js']) ) {
190
  ?>
191
+ <?php echo wp_kses('<script>' . str_replace('&quot;', '"', $wdi_options['wdi_custom_js']) . '</script>', array('script' => array())); ?>
192
  <?php
193
  }
194
 
308
  }
309
 
310
  if(!empty($wp_scripts->registered[$handle]->extra['data'])) {
311
+ echo wp_kses('<script>' . str_replace('&quot;', '"', $wp_scripts->registered[$handle]->extra['data']) . '</script>', array('script' =>array()));
312
  }
313
 
314
  if(strpos($wp_scripts->registered[$handle]->src, '/wp-includes/js/') === 0) {
315
+ echo wp_kses(sprintf($script_tag, $wp_scripts->base_url . $wp_scripts->registered[$handle]->src, $wp_scripts->registered[$handle]->ver), array('script' => array('src' => true)));
316
  } else {
317
+ echo wp_kses(sprintf($script_tag, $wp_scripts->registered[$handle]->src, $wp_scripts->registered[$handle]->ver), array('script' => array('src' => true)));
318
  }
319
  }
320
 
333
  }
334
 
335
  if(!empty($wp_styles->registered[$handle]->extra['data'])) {
336
+ echo wp_kses('<script>' . $wp_styles->registered[$handle]->extra['data'] . '</script>', array('script' => array()));
337
  }
338
 
339
  if(strpos($wp_styles->registered[$handle]->src, '/wp-includes/js/') === 0) {
340
+ echo wp_kses(sprintf($style_tag, $handle, $wp_styles->base_url . $wp_styles->registered[$handle]->src, $wp_styles->registered[$handle]->ver), array('link' => array('rel' => true, 'id' => true, 'href' => true, 'type' => true, 'media' => true)));
341
+ }
342
+ else {
343
+ echo wp_kses(sprintf($style_tag, $handle, $wp_styles->registered[$handle]->src, $wp_styles->registered[$handle]->ver), array('link' => array('rel' => true, 'id' => true, 'href' => true, 'type' => true, 'media' => true)));
344
  }
345
  }
346
  }
353
  $add = add_option('wdi_token_error_flag', 1);
354
  $json = array( 'success' => $add );
355
  }
356
+ echo wp_json_encode($json);
357
  exit;
358
  }
359
 
360
  function wdi_feed_frontend_messages() {
361
  $manage_options_user = current_user_can('manage_options');
362
+ $js_error_message = __('Something is wrong.', 'wd-instagram-feed');
363
+ $token_error_message = __('Instagram token error.', 'wd-instagram-feed');
364
+ $error_style = '';
365
+ $private_feed_error_1 = '';
366
+ $private_feed_error_2 = '';
367
+ $private_feed_error_3 = '';
368
  if ( $manage_options_user ) {
369
+ $js_error_message = __("Something is wrong. Response takes too long or there is JS error. Press Ctrl+Shift+J or Cmd+Shift+J on a Mac to see error in console or ask for <a class='wdi_error_link' href='https://wordpress.org/support/plugin/wd-instagram-feed' target='_blank'>free support</a>.", 'wd-instagram-feed');
370
+ $token_error_message = __("Instagram token is invalid or expired. Please <a href='" . site_url() . "/wp-admin/admin.php?page=wdi_settings' target='_blank'>reset token</a> and sign-in again to get new one.");
371
+ $error_style = 'style="color: #cc0000; text-align: center;"';
372
+ $private_feed_error_1 = __('Admin warning: there is one or more private user in this feed', 'wd-instagram-feed');
373
+ $private_feed_error_2 = __('Their media won\'t be displayed.', 'wd-instagram-feed');
374
+ $private_feed_error_3 = '(<span class="wdi_private_feed_names"></span>). ';
 
 
 
375
  }
376
+ $ajax_error_message = (defined('DOING_AJAX') && DOING_AJAX) ? __("Warning: Instagram Feed is loaded using AJAX request. It might not display properly.", "wd-instagram-feed") : '';
377
+ echo wp_kses('<div ' . $error_style . ' class="wdi_js_error">' . $js_error_message . '<br/>' . $ajax_error_message . '</div>', array('div' => array('style' => true, 'class' => true), 'br' => array(), 'a' => array('href' =>true, 'target' => true, 'class' => true)));
378
+ echo wp_kses('<div ' . $error_style . ' class="wdi_token_error wdi_hidden">' . $token_error_message . '</div>', array('div' => array('style' => true, 'class' => true), 'a' => array('href' =>true, 'target' => true, 'class' => true)));
379
+ echo wp_kses('<div ' . $error_style . ' class="wdi_private_feed_error wdi_hidden"><span>' . $private_feed_error_1 . $private_feed_error_3 . $private_feed_error_2 . '</span></div>', array('div' => array('style' => true, 'class' => true), 'span' =>array()));
380
+ echo wp_kses('<div class="wdi_check_fontawesome wdi_hidden"><i class="tenweb-i tenweb-i-instagram""></i></div>', array('div' => array('style' => true, 'class' => true), 'i' => array('class' => true)));
381
  }
frontend/views/WDIViewGalleryBox.php CHANGED
@@ -18,6 +18,7 @@ class WDIViewGalleryBox {
18
 
19
  $feed_id = WDILibrary::get('feed_id', 0, 'intval', 'POST');
20
  $current_feed = $this->model->get_feed_row_data( $feed_id );
 
21
  $is_hashtag = FALSE;
22
  if ( !empty($current_feed['feed_users']) ) {
23
  $feed_users = json_decode($current_feed['feed_users'], TRUE);
@@ -59,12 +60,15 @@ class WDIViewGalleryBox {
59
  $current_image_id = WDILibrary::get('image_id', 0, 'intval', 'GET');
60
  $current_image_index = WDILibrary::get('current_image_index', 0, 'intval', 'POST');
61
  $theme_id = (isset($current_feed['theme_id']) ? esc_html($current_feed['theme_id']) : 1);
62
-
 
63
  $carousel_media_row = isset($_POST["carousel_media_row"]) ? $_POST["carousel_media_row"] : '';
64
- $carousel_media = json_decode(stripslashes($carousel_media_row), true);
65
- $carousel_media = WDILibrary::get('', $carousel_media, 'sanitize_text_field', '');
66
- $carousel_media = is_array($carousel_media) ? $carousel_media : array();
67
-
 
 
68
  $thumb_width = WDILibrary::get('thumb_width', 90, 'floatval', 'GET');/*watch later*/
69
  $thumb_height = WDILibrary::get('thumb_height', 90, 'floatval', 'GET');/*watch later*/
70
 
@@ -83,8 +87,8 @@ class WDIViewGalleryBox {
83
  $popup_enable_info = (isset($current_feed['popup_enable_info']) ? esc_html($current_feed['popup_enable_info']) : 1);
84
  $popup_info_always_show = (isset($current_feed['popup_info_always_show']) ? esc_html($current_feed['popup_info_always_show']) : 0);
85
  $popup_info_full_width = (isset($current_feed['popup_info_full_width']) ? esc_html($current_feed['popup_info_full_width']) : 0);
86
- $popup_enable_rate = (isset($current_feed['lightbox_rating']) ? esc_html($current_feed['lightbox_rating']) : 0);/*deprecated*/
87
- $popup_hit_counter = (isset($current_feed['lightbox_hit_counter']) ? esc_html($current_feed['lightbox_hit_counter']) : 0);/*deprecated*/
88
  if ($enable_image_filmstrip) {
89
  $image_filmstrip_height = (isset($current_feed['popup_filmstrip_height']) ? esc_html($current_feed['popup_filmstrip_height']) : '20');
90
  $thumb_ratio = $thumb_width / $thumb_height;
@@ -105,10 +109,7 @@ class WDIViewGalleryBox {
105
  $enable_share_buttons = (isset($current_feed['popup_enable_share_buttons']) ? esc_html($current_feed['popup_enable_share_buttons']) : 1);
106
  $image_right_click = (isset($current_feed['popup_image_right_click']) ? esc_html($current_feed['popup_image_right_click']) : 1);
107
 
108
- //$option_row = $this->model->get_option_row_data();
109
- // $image_right_click = 0; //$option_row->image_right_click;/*watch later havent this options*/
110
- $comment_moderation = 0;//$option_row->comment_moderation;/*watch later havent this options*/
111
-
112
  $filmstrip_direction = 'horizontal';
113
  if ($theme_row->lightbox_filmstrip_pos == 'right' || $theme_row->lightbox_filmstrip_pos == 'left') {
114
  $filmstrip_direction = 'vertical';
@@ -129,20 +130,23 @@ class WDIViewGalleryBox {
129
  $image_filmstrip_height = 0;
130
  $image_filmstrip_width = 0;
131
  }
132
-
133
- $json = isset($_POST['image_rows']) ? $_POST['image_rows']: '';
134
- $image_rows = json_decode(stripslashes($json));
135
- $image_rows = WDILibrary::get('', $image_rows, 'sanitize_text_field', '');
136
- $image_rows_count = WDILibrary::get('image_rows_count', 0, 'intval', 'POST');//parseint
137
- $image_rows = WDILibrary::arrayToObject($image_rows);
138
-
139
- /////////////////////////////////Parametes for deprecated content////////////////////
 
 
 
 
 
140
  $theme_row->lightbox_rate_stars_count = 0;
141
  $theme_row->lightbox_rate_size = 0;
142
- /////////////////////////////////////////////////////////////////////////////////////
143
 
144
  $image_id = WDILibrary::get('image_id', $current_image_id, 'intval', 'POST');
145
- //$comment_rows = $this->model->get_comment_rows_data($image_id);
146
 
147
  $params_array = array(
148
  'action' => 'GalleryBox',
@@ -221,13 +225,13 @@ class WDIViewGalleryBox {
221
  ?>
222
  <style>
223
  .wdi_popup_image {
224
- max-width: <?php echo $image_width - ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>px;
225
- max-height: <?php echo $image_height - ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>px;
226
  }
227
 
228
  .wdi_popup_embed {
229
- width: <?php echo $image_width - ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>px;
230
- height: <?php echo $image_height - ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>px;
231
  }
232
 
233
  <?php
@@ -250,62 +254,73 @@ class WDIViewGalleryBox {
250
  <?php } ?>
251
 
252
  .wdi_image_container {
253
- <?php echo $theme_row->lightbox_filmstrip_pos; ?>: <?php echo ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : $image_filmstrip_width); ?>px;
254
  }
255
 
256
  .wdi_filmstrip_container {
257
- height: <?php echo ($filmstrip_direction == 'horizontal'? $image_filmstrip_height : $image_height); ?>px;
258
- width: <?php echo ($filmstrip_direction == 'horizontal' ? $image_width : $image_filmstrip_width); ?>px;
259
  }
260
 
261
  .wdi_filmstrip {
262
- <?php echo $left_or_top; ?>: 20px;
263
- <?php echo $width_or_height; ?>: <?php echo ($filmstrip_direction == 'horizontal' ? $image_width - 40 : $image_height - 40); ?>px;
264
  }
265
 
266
  .wdi_filmstrip_thumbnails {
267
- height: <?php echo ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : ($image_filmstrip_height + $filmstrip_thumb_margin_hor * $theme_row->lightbox_filmstrip_thumb_border_width) * $image_rows_count); ?>px;
268
- <?php echo $left_or_top; ?>: 0px;
269
- width: <?php echo ($filmstrip_direction == 'horizontal' ? ($image_filmstrip_width + $filmstrip_thumb_margin_hor * $theme_row->lightbox_filmstrip_thumb_border_width) * $image_rows_count : $image_filmstrip_width); ?>px;
270
  }
271
 
272
  .wdi_filmstrip_thumbnail {
273
- height: <?php echo $image_filmstrip_height; ?>px;
274
- width: <?php echo $image_filmstrip_width; ?>px;
275
  }
276
 
277
  .wdi_filmstrip_left {
278
- <?php echo $width_or_height; ?>: 20px;
279
- <?php echo $left_or_top; ?>: 0;
280
  }
281
  .wdi_filmstrip_right {
282
- <?php echo $width_or_height; ?>: 20px;
283
  }
284
 
285
  .wdi_image_info_container1 {
286
- display: <?php echo $popup_info_always_show ? 'table-cell' : 'none'; ?>;
287
  }
288
 
289
  .wdi_image_info {
290
- <?php echo ((!$enable_image_filmstrip || $theme_row->lightbox_filmstrip_pos != 'bottom') && $theme_row->lightbox_ctrl_btn_pos == 'bottom' && $theme_row->lightbox_info_pos == 'bottom') ? 'bottom: ' . ($theme_row->lightbox_ctrl_btn_height + 2 * $theme_row->lightbox_ctrl_btn_margin_top) . 'px;' : '' ?>
291
- <?php if($params_array['popup_info_full_width']) { ?>
292
- width: 100%;
293
- <?php } else { ?>
294
- width: 33%;
295
- margin: <?php echo $theme_row->lightbox_info_margin; ?>;
 
 
 
 
 
 
296
  <?php } ?>
297
- <?php echo ((!$enable_image_filmstrip || $theme_row->lightbox_filmstrip_pos != 'top') && $theme_row->lightbox_ctrl_btn_pos == 'top' && $theme_row->lightbox_info_pos == 'top') ? 'top: ' . ($theme_row->lightbox_ctrl_btn_height + 2 * $theme_row->lightbox_ctrl_btn_margin_top) . 'px;' : '' ?>
 
 
 
 
298
  }
299
  </style>
300
  <script>
301
  var event_stack = [];
302
  <?php
303
  $image_id_exist = FALSE;
304
- foreach ($image_rows as $key => $image_row) {
305
  if (strpos($image_row->filename, 'https://') === false) {
306
- $image_row->filename = sanitize_text_field($image_row->filename);
307
- } else {
308
- $image_row->filename = esc_url_raw($image_row->filename);
 
309
  }
310
  if (intval($image_row->id) == $image_id) {
311
  $current_avg_rating = floatval($image_row->avg_rating);
@@ -313,7 +328,7 @@ class WDIViewGalleryBox {
313
  $current_rate_count = intval($image_row->rate_count);
314
  $current_image_key = sanitize_text_field($key);
315
  }
316
- if (intval($image_row->id) == $current_image_id) {
317
  $current_image_alt = sanitize_text_field($image_row->alt);
318
  $current_image_user_name = sanitize_text_field($image_row->username);
319
  if (isset($image_row->profile_picture)){
@@ -322,27 +337,31 @@ class WDIViewGalleryBox {
322
  $current_image_user_pic = '';
323
  }
324
  $current_image_hit_count = intval($image_row->hit_count);
325
- $current_image_description = str_replace('#',' #',str_replace(array("\r\n", "\n", "\r"), esc_html('<br />'), sanitize_text_field($image_row->description)));
326
- $current_image_url = esc_url_raw($image_row->image_url);
327
  $current_thumb_url = esc_url_raw($image_row->thumb_url);
328
  $current_filetype = sanitize_text_field($image_row->filetype);
329
  $current_filename = $image_row->filename;
330
  $image_id_exist = TRUE;
331
  }
332
  continue;
333
- //sanitizing image description
334
  $instaDesc = sanitize_text_field($image_row->description);
335
  $instaDesc = preg_replace('/\\\\/', esc_html('&#92;'), $instaDesc);
336
 
337
- /*last two are ZWSP and P-SEP*/
338
  $instaDesc = str_replace(array("\r\n", "\n", "\r",'
', '
'), esc_html(''), str_replace('"','\"',$instaDesc));
339
  $instaDesc = str_replace('#', ' #', $instaDesc);
340
  }
341
  ?>
342
  </script>
343
  <?php
344
- if (!$image_id_exist) {
345
- echo WDILibrary::message(__('The image has been deleted.', "wd-instagram-feed"), 'error');
 
 
 
 
346
  die();
347
  }
348
  ?>
@@ -354,7 +373,7 @@ class WDIViewGalleryBox {
354
  <div class="wdi_carousel_btn_content">
355
  <?php foreach($carousel_media as $key => $media){
356
  $class = ($key == 0 ? "active" : ($key > 9 ? "small" : "")); ?>
357
- <span class="<?php echo $class; ?>" data-id="<?php echo esc_attr($key); ?>"></span>
358
  <?php } ?>
359
  </div>
360
  </div>
@@ -369,73 +388,74 @@ class WDIViewGalleryBox {
369
  if ($option_row->show_image_counts) {
370
  ?>
371
  <span class="wdi_image_count_container wdi_ctrl_btn">
372
- <span class="wdi_image_count"><?php echo esc_html($current_image_key + 1); ?></span> /
373
- <span><?php echo esc_html($image_rows_count); ?></span>
374
  </span>
375
  <?php
376
  }
377
  ?>
378
- <i title="<?php echo __('Play', "wd-instagram-feed"); ?>" class="wdi_ctrl_btn wdi_play_pause tenweb-i tenweb-i-play"></i>
379
  <?php
380
  if ($enable_image_fullscreen) {
381
  if (!$open_with_fullscreen) {
382
  ?>
383
- <i title="<?php echo __('Maximize', "wd-instagram-feed"); ?>" class="wdi_ctrl_btn wdi_resize-full tenweb-i tenweb-i-expand "></i>
384
  <?php
385
  }
386
  ?>
387
- <i title="<?php echo __('Fullscreen', "wd-instagram-feed"); ?>" class="wdi_ctrl_btn wdi_fullscreen tenweb-i tenweb-i-arrows-out"></i>
388
  <?php
389
  }
390
  if ($popup_enable_info) {
391
  ?>
392
- <i title="<?php echo __('Show Caption', "wd-instagram-feed"); ?>" class="wdi_ctrl_btn wdi_info tenweb-i tenweb-i-info-circle"></i>
393
  <?php }
394
  if ( $enable_comment_social && $business && !$is_hashtag ) { ?>
395
- <i title="<?php echo __('Show comments', "wd-instagram-feed"); ?>" class="wdi_ctrl_btn wdi_comment tenweb-i tenweb-i-comment-square"></i>
396
  <?php }
397
  if ($popup_enable_rate) { ?>
398
- <i title="<?php echo __('Show rating', "wd-instagram-feed"); ?>" class="wdi_ctrl_btn wdi_rate tenweb-i tenweb-i-star"></i>
399
  <?php }
400
  $is_embed = preg_match('/EMBED/', $current_filetype) == 1 ? TRUE : FALSE;
401
  $share_image_url = urlencode( $is_embed ? $current_thumb_url : site_url() . '/' . $WD_WDI_UPLOAD_DIR . $current_image_url);
402
  if ($enable_image_facebook) {
403
  ?>
404
- <a id="wdi_facebook_a" href="https://www.facebook.com/sharer/sharer.php?u=<?php echo urlencode($share_url); ?>" target="_blank" title="<?php echo __('Share on Facebook', "wd-instagram-feed"); ?>">
405
- <i title="<?php echo __('Share on Facebook', "wd-instagram-feed"); ?>" class="wdi_ctrl_btn wdi_facebook tenweb-i tenweb-i-facebook-square"></i>
406
  </a>
407
  <?php
408
  }
409
  if ($enable_image_twitter) {
410
  ?>
411
- <a id="wdi_twitter_a" href="https://twitter.com/intent/tweet?url=<?php echo urlencode($share_url); ?>" target="_blank" title="<?php echo __('Share on Twitter', "wd-instagram-feed"); ?>">
412
- <i title="<?php echo __('Share on Twitter', "wd-instagram-feed"); ?>" class="wdi_ctrl_btn wdi_twitter tenweb-i tenweb-i-twitter-square"></i>
413
  </a>
414
  <?php
415
  }
416
  if ($enable_image_pinterest) {
417
  ?>
418
- <a id="wdi_pinterest_a" href="http://pinterest.com/pin/create/button/?s=100&url=<?php echo urlencode($share_url); ?>&media=<?php echo $share_image_url; ?>&description=<?php echo $current_image_description; ?>" target="_blank" title="<?php echo __('Share on Pinterest', "wd-instagram-feed"); ?>">
419
- <i title="<?php echo __('Share on Pinterest', "wd-instagram-feed"); ?>" class="wdi_ctrl_btn wdi_pinterest tenweb-i tenweb-i-pinterest-square"></i>
420
  </a>
421
  <?php
422
  }
423
  if ($enable_image_tumblr) {
424
  ?>
425
- <a id="wdi_tumblr_a" href="https://www.tumblr.com/share/photo?source=<?php echo $share_image_url; ?>&caption=<?php echo urlencode($current_image_alt); ?>&clickthru=<?php echo urlencode($share_url); ?>" target="_blank" title="<?php echo __('Share on Tumblr', "wd-instagram-feed"); ?>">
426
- <i title="<?php echo __('Share on Tumblr', "wd-instagram-feed"); ?>" class="wdi_ctrl_btn wdi_tumblr tenweb-i tenweb-i-tumblr-square"></i>
427
  </a>
428
  <?php
429
  }
 
430
  if ($enable_share_buttons) {
431
  ?>
432
  <span class="wdi_share_btns_container">
433
- <i onclick="jQuery(this).parent().find('.wdi_share_btns').toggleClass('wdi_share_toggler');jQuery(this).parent().find('.wdi_share_caret').toggleClass('wdi_share_toggler')" title="<?php echo __('Share', "wd-instagram-feed"); ?>" class="wdi_ctrl_btn tenweb-i tenweb-i-share"></i>
434
  <p class="wdi_share_btns" style="display:none">
435
- <a id="wdi_popup_fb" href="https://www.facebook.com/sharer/sharer.php?u=<?php echo $current_image_url;?>" target="_blank" class='wdi_share_popup_btn wdi_facebook tenweb-i tenweb-i-facebook-square'></a>
436
- <a id="wdi_popup_tw" href="https://twitter.com/intent/tweet?url=<?php echo $current_image_url;?>" target="_blank" class='wdi_share_popup_btn wdi_twitter tenweb-i tenweb-i-twitter-square'></a>
437
- <a id="wdi_popup_li" href="https://www.linkedin.com/shareArticle?mini=true&url=<?php echo $current_image_url;?>&title=<?php echo $current_image_description?>" target="_blank" class='wdi_share_popup_btn wdi_linkedin tenweb-i tenweb-i-linkedin'></a>
438
- <a id="wdi_popup_pt" href="https://pinterest.com/pin/create/button/?url=<?php echo $current_image_url;?>&media=<?php echo urlencode($current_thumb_url); ?>&description=<?php echo $current_image_description?>" target="_blank" class='wdi_share_popup_btn wdi_pinterest tenweb-i tenweb-i-pinterest-square'></a>
439
  </p>
440
  <i class="wdi_share_caret " style="display:none;"></i>
441
  </span>
@@ -443,41 +463,42 @@ class WDIViewGalleryBox {
443
  }
444
  if ($option_row->popup_enable_fullsize_image) {
445
  ?>
446
- <a id="wdi_fullsize_image" href="<?php echo !$is_embed ? site_url() . '/' . $WD_WDI_UPLOAD_DIR . $current_image_url : $current_image_url; ?>" target="_blank">
447
- <i title="<?php echo __('Open image in Instagram.', "wd-instagram-feed"); ?>" class="wdi_ctrl_btn tenweb-i tenweb-i-instagram"></i>
448
  </a>
449
  <?php
450
  }
451
  if ($option_row->popup_enable_download) {
452
- $style = 'none';
453
- $current_image_arr = explode('/', $current_image_url);
454
- if (!$is_embed) {
455
- $download_href = site_url() . '/' . $WD_WDI_UPLOAD_DIR . $current_image_url;
456
- $style = 'inline-block';
457
- }
458
- elseif (preg_match('/FLICKR/', $current_filetype) == 1) {
459
- $download_href = $current_filename;
460
- $style = 'inline-block';
461
- }
462
- elseif (preg_match('/INSTAGRAM/', $current_filetype) == 1) {
463
- if(preg_match('/IMAGE/',$current_filetype) == 1){
464
- $download_href = substr_replace($current_thumb_url, 'l', -1);
465
- }
466
- if(preg_match('/VIDEO/',$current_filetype) == 1){
467
- $download_href = $current_filename;
468
- }
469
- $style = 'inline-block';
470
- }
471
- ?>
472
- <a id="wdi_download" href="<?php echo $download_href; ?>" target="_blank" download="<?php echo end($current_image_arr); ?>" style="display: <?php echo $style; ?>;">
473
- <i title="<?php echo __('Download original image', "wd-instagram-feed"); ?>" class="wdi_ctrl_btn tenweb-i tenweb-i-download"></i>
474
- </a>
475
- <?php
476
- }
 
477
  ?>
478
  </div>
479
  <div class="wdi_toggle_container">
480
- <i class="wdi_toggle_btn tenweb-i <?php echo (($theme_row->lightbox_ctrl_btn_pos == 'top') ? 'tenweb-i-angle-up' : 'tenweb-i-angle-down'); ?>"></i>
481
  </div>
482
  <?php } ?>
483
  </div>
@@ -498,8 +519,8 @@ class WDIViewGalleryBox {
498
  <span class="wdi_image_info_spun">
499
  <div class="wdi_image_info" <?php if(trim($current_image_alt) == '' && trim($current_image_description) == '') { echo 'style="background:none;"'; } ?>>
500
  <div class="wdi_image_title">
501
- <div class="wdi_title" onclick="window.open('//instagram.com/<?php echo $current_image_user_name; ?>','_blank')">
502
- <div class="wdi_header_text"><?php echo $current_image_user_name;?></div>
503
  <?php if(!empty($current_image_user_pic)): ?>
504
  <div class="wdi_users_img_wrap"><img src="<?php echo esc_url($current_image_user_pic); ?>" alt=""></div>
505
  <?php endif;?>
@@ -532,7 +553,7 @@ class WDIViewGalleryBox {
532
  <?php
533
  if ( !$is_embed ) {
534
  ?>
535
- <img class="wdi_popup_image wdi_popup_watermark" src="<?php echo site_url() . '/' . $WD_WDI_UPLOAD_DIR . esc_url_raw($image_row->image_url); ?>" alt="<?php echo sanitize_text_field($image_row->alt); ?>" />
536
  <?php
537
  }
538
  else { ?>
@@ -550,7 +571,7 @@ class WDIViewGalleryBox {
550
  </span>
551
  <span class="wdi_popup_image_second_spun">
552
  </span>
553
- <input type="hidden" id="wdi_current_image_key" value="<?php echo $current_image_index; ?>" />
554
  <?php
555
  break;
556
  }
@@ -559,23 +580,23 @@ class WDIViewGalleryBox {
559
  </div>
560
  </div>
561
  </div>
562
- <a id="wdi_spider_popup_left" <?php echo ($option_row->enable_loop == 0 && $current_key == 0) ? 'style="display: none;"' : ''; ?>><span id="wdi_spider_popup_left-ico"><span><i class="wdi_prev_btn tenweb-i <?php echo str_replace("fa-", "tenweb-i-", $theme_row->lightbox_rl_btn_style); ?>-left-sm"></i></span></span></a>
563
- <a id="wdi_spider_popup_right" <?php echo ($option_row->enable_loop == 0 && $current_key == $image_rows_count - 1) ? 'style="display: none;"' : ''; ?>><span id="wdi_spider_popup_right-ico"><span><i class="wdi_next_btn tenweb-i <?php echo str_replace("fa-", "tenweb-i-", $theme_row->lightbox_rl_btn_style); ?>-right-sm"></i></span></span></a>
564
  </div>
565
  </div>
566
  <a class="wdi_spider_popup_close" onclick="wdi_spider_destroypopup(1000); return false;" ontouchend="wdi_spider_destroypopup(1000); return false;"><span><i class="wdi_close_btn tenweb-i tenweb-i-times"></i></span></a>
567
  <script>
568
  function checkNeedToDisableRightArrow() {
569
  window.setTimeout(function(){
570
- if( ( -(jQuery(".wdi_filmstrip_thumbnails").<?php echo $width_or_height; ?>() - jQuery(".wdi_filmstrip").<?php echo $width_or_height; ?>()) ==
571
- jQuery(".wdi_filmstrip_thumbnails").position().<?php echo $left_or_top; ?> ) ) {
572
  jQuery(".wdi_filmstrip_right").css({opacity: 0.3, filter: "Alpha(opacity=30)"});
573
  }
574
  }, 600); // after lightbox open animation
575
  }
576
  function checkNeedToDisableLeftArrow() {
577
  window.setTimeout(function(){
578
- if (jQuery(".wdi_filmstrip_thumbnails").position().<?php echo $left_or_top; ?> == 0) {
579
  jQuery(".wdi_filmstrip_left").css({opacity: 0.3, filter: "Alpha(opacity=30)"});
580
  }
581
  }, 600); // after lightbox open animation
@@ -583,18 +604,18 @@ class WDIViewGalleryBox {
583
  checkNeedToDisableRightArrow();
584
  checkNeedToDisableLeftArrow();
585
  var wdi_trans_in_progress = false;
586
- var wdi_transition_duration = <?php echo (($slideshow_interval < 4) && ($slideshow_interval != 0)) ? ($slideshow_interval * 1000) / 4 : 800; ?>;
587
  var wdi_playInterval;
588
  if ((jQuery("#wdi_spider_popup_wrap").width() >= jQuery(window).width()) || (jQuery("#wdi_spider_popup_wrap").height() >= jQuery(window).height())) {
589
  jQuery(".wdi_spider_popup_close").attr("class", "wdi_ctrl_btn wdi_spider_popup_close_fullscreen");
590
  }
591
- /* Stop autoplay.*/
592
  window.clearInterval(wdi_playInterval);
593
- /* Set watermark container size.*/
594
  function wdi_change_watermark_container() {
595
  jQuery(".wdi_slider").children().each(function() {
596
  if (jQuery(this).css("zIndex") == 2) {
597
- /* This may be neither img nor iframe.*/
598
  var wdi_current_image_span = jQuery(this).find("img");
599
  if (!wdi_current_image_span.length) {
600
  wdi_current_image_span = jQuery(this).find("iframe");
@@ -602,46 +623,45 @@ class WDIViewGalleryBox {
602
  if (!wdi_current_image_span.length) {
603
  wdi_current_image_span = jQuery(this).find("video");
604
  }
605
- /*set timeout for video to get size according to style, and then put watermark*/
606
  setTimeout(function () {
607
  var width = wdi_current_image_span.width();
608
  var height = wdi_current_image_span.height();
609
 
610
  var comment_container_width = 0;
611
  if (jQuery(".wdi_comment_container").hasClass("wdi_open")) {
612
- comment_container_width = <?php echo $theme_row->lightbox_comment_width; ?>;
613
  }
614
-
615
  }, 800);
616
  }
617
  });
618
  }
619
- var wdi_current_key = '<?php echo $current_key; ?>';
620
- var wdi_current_filmstrip_pos = <?php echo $current_pos; ?>;
621
- /* Set filmstrip initial position.*/
622
  function wdi_set_filmstrip_pos(filmStripWidth) {
623
- var selectedImagePos = -wdi_current_filmstrip_pos - (jQuery(".wdi_filmstrip_thumbnail").<?php echo $outerWidth_or_outerHeight; ?>(true)) / 2;
624
- var imagesContainerLeft = Math.min(0, Math.max(filmStripWidth - jQuery(".wdi_filmstrip_thumbnails").<?php echo $width_or_height; ?>(), selectedImagePos + filmStripWidth / 2));
625
  jQuery(".wdi_filmstrip_thumbnails").animate({
626
- <?php echo $left_or_top; ?>: imagesContainerLeft
627
  }, {
628
  duration: 500,
629
  complete: function () { wdi_filmstrip_arrows(); }
630
  });
631
  }
632
  function wdi_move_filmstrip() {
633
- var image_left = jQuery(".wdi_thumb_active").position().<?php echo $left_or_top; ?>;
634
- var image_right = jQuery(".wdi_thumb_active").position().<?php echo $left_or_top; ?> + jQuery(".wdi_thumb_active").<?php echo $outerWidth_or_outerHeight; ?>(true);
635
- var wdi_filmstrip_width = jQuery(".wdi_filmstrip").<?php echo $outerWidth_or_outerHeight; ?>(true);
636
- var wdi_filmstrip_thumbnails_width = jQuery(".wdi_filmstrip_thumbnails").<?php echo $outerWidth_or_outerHeight; ?>(true);
637
- var long_filmstrip_cont_left = jQuery(".wdi_filmstrip_thumbnails").position().<?php echo $left_or_top; ?>;
638
- var long_filmstrip_cont_right = Math.abs(jQuery(".wdi_filmstrip_thumbnails").position().<?php echo $left_or_top; ?>) + wdi_filmstrip_width;
639
  if (wdi_filmstrip_width > wdi_filmstrip_thumbnails_width) {
640
  return;
641
  }
642
  if (image_left < Math.abs(long_filmstrip_cont_left)) {
643
  jQuery(".wdi_filmstrip_thumbnails").animate({
644
- <?php echo $left_or_top; ?>: -image_left
645
  }, {
646
  duration: 500,
647
  complete: function () { wdi_filmstrip_arrows(); }
@@ -649,16 +669,16 @@ class WDIViewGalleryBox {
649
  }
650
  else if (image_right > long_filmstrip_cont_right) {
651
  jQuery(".wdi_filmstrip_thumbnails").animate({
652
- <?php echo $left_or_top; ?>: -(image_right - wdi_filmstrip_width)
653
  }, {
654
  duration: 500,
655
  complete: function () { wdi_filmstrip_arrows(); }
656
  });
657
  }
658
  }
659
- /* Show/hide filmstrip arrows.*/
660
  function wdi_filmstrip_arrows() {
661
- if (jQuery(".wdi_filmstrip_thumbnails").<?php echo $width_or_height; ?>() < jQuery(".wdi_filmstrip").<?php echo $width_or_height; ?>()) {
662
  jQuery(".wdi_filmstrip_left").hide();
663
  jQuery(".wdi_filmstrip_right").hide();
664
  }
@@ -673,7 +693,7 @@ class WDIViewGalleryBox {
673
  wdi_pause_stream('#wdi_image_container');
674
  jQuery("#wdi_spider_popup_left").show();
675
  jQuery("#wdi_spider_popup_right").show();
676
- if (<?php echo $option_row->enable_loop; ?> == 0) {
677
  if (key == (parseInt(wdi_data.length) - 1)) {
678
  jQuery("#wdi_spider_popup_right").hide();
679
  }
@@ -681,7 +701,7 @@ class WDIViewGalleryBox {
681
  jQuery("#wdi_spider_popup_left").hide();
682
  }
683
  }
684
- /* Pause videos.*/
685
  jQuery("#wdi_image_container").find("iframe").each(function () {
686
  jQuery(this)[0].contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*');
687
  jQuery(this)[0].contentWindow.postMessage('{ "method": "pause" }', "*");
@@ -691,15 +711,11 @@ class WDIViewGalleryBox {
691
  if (typeof wdi_data[key] != 'undefined') {
692
  if (typeof wdi_data[current_key] != 'undefined') {
693
  if (jQuery('.wdi_ctrl_btn').hasClass('tenweb-i-pause')) {
694
-
695
  wdi_play();
696
  }
697
  if (!from_effect) {
698
- /* Change image key.*/
699
  jQuery("#wdi_current_image_key").val(key);
700
- /*if (current_key == '-1') {
701
- current_key = jQuery(".wdi_thumb_active").children("img").attr("image_key");
702
- }*/
703
  }
704
  if (wdi_trans_in_progress) {
705
  event_stack.push(current_key + '-' + key);
@@ -712,15 +728,13 @@ class WDIViewGalleryBox {
712
  else if (wdi_current_key == key) {
713
  return;
714
  }
715
- /*jQuery("#wdi_spider_popup_left").hover().css({"display": "inline"});
716
- jQuery("#wdi_spider_popup_right").hover().css({"display": "inline"});*/
717
  jQuery(".wdi_image_count").html(wdi_data[key]["number"]);
718
- /* Set active thumbnail position.*/
719
- wdi_current_filmstrip_pos = key * (jQuery(".wdi_filmstrip_thumbnail").<?php echo $width_or_height; ?>() + 2 + 2 * <?php echo $theme_row->lightbox_filmstrip_thumb_border_width; ?>);
720
  wdi_current_key = key;
721
- /* Change hash.*/
722
- window.location.hash = "wdi<?php echo $gallery_id; ?>/" + wdi_data[key]["id"];
723
- /* Change image id for rating.*/
724
  <?php if ($popup_enable_rate) { ?>
725
  jQuery("#wdi_rate_form input[name='image_id']").val(wdi_data[key]["id"]);
726
  jQuery("#wdi_star").attr("data-score", wdi_data[key]["avg_rating"]);
@@ -731,7 +745,7 @@ class WDIViewGalleryBox {
731
  wdi_spider_set_input_value('rate_ajax_task', 'save_hit_count');
732
  //wdi_spider_rate_ajax_save('wdi_rate_form');
733
  jQuery(".wdi_image_hits span").html(++wdi_data[key]["hit_count"]);
734
- /* Change image id.*/
735
  jQuery("#wdi_popup_image").attr('image_id', wdi_data[key]["id"]);
736
 
737
  //creating image title template
@@ -745,7 +759,7 @@ class WDIViewGalleryBox {
745
  '<div class="wdi_image_description"></div>'+
746
  '</div>');
747
 
748
- /* Change carousel media dots*/
749
  if (typeof wdi_data[key]['carousel_media'] != "undefined" && wdi_data[key]['carousel_media'] != null) {
750
  if(jQuery(".wdi_carousel_btn_container").length){
751
  jQuery(".wdi_carousel_btn_container").remove();
@@ -766,7 +780,7 @@ class WDIViewGalleryBox {
766
  }
767
  }
768
 
769
- /* Change image title, description.*/
770
  jQuery(".wdi_image_title").html(jQuery('<span style="display: block;" />').append(wdi_title_div));
771
  jQuery(".wdi_image_description").html(jQuery('<span style="display: block;" />').text(wdi_data[key]["description"]).text());
772
  jQuery(".wdi_image_info").removeAttr("style");
@@ -795,7 +809,7 @@ class WDIViewGalleryBox {
795
  var cur_width = jQuery(current_image_class).width();
796
  var innhtml = '<span class="wdi_popup_image_spun1" style="display: table; width: inherit; height: inherit;"><span class="wdi_popup_image_spun2" style="display: table-cell; vertical-align: middle; text-align: center;">';
797
  if (!is_embed) {
798
- innhtml += '<img style="max-height: ' + cur_height + 'px; max-width: ' + cur_width + 'px;" class="wdi_popup_image wdi_popup_watermark" src="<?php echo site_url() . '/' . $WD_WDI_UPLOAD_DIR; ?>' + jQuery('<span style="display: block;" />').html(wdi_data[key]["image_url"]).text() + '" alt="' + wdi_data[key]["alt"] + '" />';
799
  }
800
  else { /*is_embed*/
801
  innhtml += '<span style="display:table; table-layout:fixed; height: ' + cur_height + 'px; width: ' + cur_width + 'px;" class="wdi_popup_embed wdi_popup_watermark" >';
@@ -816,11 +830,11 @@ class WDIViewGalleryBox {
816
  echo 'wdi_preload_images(key);';
817
  }
818
  ?>
819
- wdi_<?php echo $image_effect; ?>(current_image_class, next_image_class, direction);
820
  jQuery("#wdi_download").show();
821
  if (!is_embed) {
822
- jQuery("#wdi_fullsize_image").attr("href", "<?php echo site_url() . '/' . $WD_WDI_UPLOAD_DIR; ?>" + wdi_data[key]['image_url']);
823
- jQuery("#wdi_download").attr("href", "<?php echo site_url() . '/' . $WD_WDI_UPLOAD_DIR; ?>" + wdi_data[key]['image_url']);
824
  }
825
  else {
826
  jQuery("#wdi_fullsize_image").attr("href", wdi_data[key]['image_url']);
@@ -839,7 +853,7 @@ class WDIViewGalleryBox {
839
  var wdi_image_description = wdi_data[key]['description'];
840
  jQuery("#wdi_download").attr("download", image_arr[image_arr.length - 1]);
841
  /* Change image social networks urls.*/
842
- var wdi_share_url = encodeURIComponent("<?php echo add_query_arg(array('action' => 'Share', 'curr_url' => $current_url, 'image_id' => ''), admin_url('admin-ajax.php')); ?>") + "=" + wdi_data[key]['id'] + encodeURIComponent('#wdi<?php echo $gallery_id; ?>/') + wdi_data[key]['id'];
843
  if (is_embed) {
844
  var wdi_share_image_url = encodeURIComponent(wdi_data[key]['thumb_url']);
845
  }
@@ -878,17 +892,6 @@ class WDIViewGalleryBox {
878
  wdi_comments_manager.init(cur_image_key);
879
  }
880
  }
881
- /* Update custom scroll.*/
882
- // if (typeof jQuery().mCustomScrollbar !== 'undefined') {
883
- // if (jQuery.isFunction(jQuery().mCustomScrollbar)) {
884
- // jQuery(".wdi_comments").mCustomScrollbar({
885
- // advanced:{
886
- // updateOnContentResize: true
887
- // }
888
- // });
889
- // }
890
- // }
891
- // jQuery(".mCSB_scrollTools").hide();
892
  <?php
893
  if ($enable_image_filmstrip) {
894
  ?>
@@ -896,7 +899,6 @@ class WDIViewGalleryBox {
896
  <?php
897
  }
898
  ?>
899
-
900
  }
901
  if (!is_embed) {
902
  var cur_img = jQuery(next_image_class).find('img');
@@ -932,7 +934,7 @@ class WDIViewGalleryBox {
932
  function wdi_preload_images(key) {
933
  count = <?php echo (int) $option_row->preload_images_count / 2; ?>;
934
  var count_all = wdi_data.length;
935
- if (count_all < <?php echo $option_row->preload_images_count; ?>) {
936
  count = 0;
937
  }
938
  if (count != 0) {
@@ -941,7 +943,7 @@ class WDIViewGalleryBox {
941
  var is_embed = wdi_data[index]['filetype'].indexOf("EMBED_") > -1 ? true : false;
942
  if (typeof wdi_data[index] != "undefined") {
943
  if (!is_embed) {
944
- jQuery("<img/>").attr("src", '<?php echo site_url() . '/' . $WD_WDI_UPLOAD_DIR; ?>' + jQuery('<span style="display: block;" />').html(wdi_data[index]["image_url"]).text());
945
  }
946
  }
947
  }
@@ -951,7 +953,7 @@ class WDIViewGalleryBox {
951
  var is_embed = wdi_data[i]['filetype'].indexOf("EMBED_") > -1 ? true : false;
952
  if (typeof wdi_data[index] != "undefined") {
953
  if (!is_embed) {
954
- jQuery("<img/>").attr("src", '<?php echo site_url() . '/' . $WD_WDI_UPLOAD_DIR; ?>' + jQuery('<span style="display: block;" />').html(wdi_data[i]["image_url"]).text());
955
  }
956
  }
957
  }
@@ -963,15 +965,15 @@ class WDIViewGalleryBox {
963
  if (!jQuery.fullscreen.isFullScreen()) {
964
  jQuery(".wdi_resize-full").show();
965
  jQuery(".wdi_resize-full").attr("class", "wdi_ctrl_btn wdi_resize-full tenweb-i tenweb-i-expand");
966
- jQuery(".wdi_resize-full").attr("title", "<?php echo __('Maximize', "wd-instagram-feed"); ?>");
967
  jQuery(".wdi_fullscreen").attr("class", "wdi_ctrl_btn wdi_fullscreen tenweb-i tenweb-i-arrows-out");
968
- jQuery(".wdi_fullscreen").attr("title", "<?php echo __('Fullscreen', "wd-instagram-feed"); ?>");
969
  }
970
  }
971
  }
972
  var comment_container_width = 0;
973
  if (jQuery(".wdi_comment_container").hasClass("wdi_open")) {
974
- comment_container_width = <?php echo $theme_row->lightbox_comment_width; ?>;
975
  }
976
  if (comment_container_width > jQuery(window).width()) {
977
  comment_container_width = jQuery(window).width();
@@ -984,28 +986,28 @@ class WDIViewGalleryBox {
984
  jQuery(".wdi_spider_popup_close_fullscreen").show();
985
  }
986
 
987
- if (!(!(jQuery(window).height() > <?php echo $image_height; ?>) || !(<?php echo $open_with_fullscreen; ?> != 1))) {
988
  jQuery("#wdi_spider_popup_wrap").css({
989
- height: <?php echo $image_height; ?>,
990
  top: '50%',
991
- marginTop: -<?php echo $image_height / 2; ?>,
992
  zIndex: 100000
993
  });
994
 
995
- jQuery(".wdi_image_container").css({height: (<?php echo $image_height - ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>)});
996
 
997
  jQuery(".wdi_popup_image").css({
998
- maxHeight: <?php echo $image_height - ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>
999
  });
1000
  jQuery(".wdi_popup_embed").css({
1001
- height: <?php echo $image_height - ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>
1002
  });
1003
  wdi_resize_instagram_post();
1004
  <?php if ($filmstrip_direction == 'vertical') { ?>
1005
- jQuery(".wdi_filmstrip_container").css({height: <?php echo $image_height; ?>});
1006
- jQuery(".wdi_filmstrip").css({height: (<?php echo $image_height; ?> - 40)});
1007
  <?php } ?>
1008
- wdi_popup_current_height = <?php echo $image_height; ?>;
1009
  }
1010
  else {
1011
  jQuery("#wdi_spider_popup_wrap").css({
@@ -1014,43 +1016,43 @@ class WDIViewGalleryBox {
1014
  marginTop: 0,
1015
  zIndex: 100000
1016
  });
1017
- jQuery(".wdi_image_container").css({height: (jQuery(window).height() - <?php echo ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>)});
1018
 
1019
  jQuery(".wdi_popup_image").css({
1020
- maxHeight: jQuery(window).height() - <?php echo ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>
1021
  });
1022
  jQuery(".wdi_popup_embed").css({
1023
- height: jQuery(window).height() - <?php echo ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>
1024
  });
1025
  wdi_resize_instagram_post();
1026
- <?php if ($filmstrip_direction == 'vertical') { ?>
1027
  jQuery(".wdi_filmstrip_container").css({height: (jQuery(window).height())});
1028
  jQuery(".wdi_filmstrip").css({height: (jQuery(window).height() - 40)});
1029
  <?php } ?>
1030
  wdi_popup_current_height = jQuery(window).height();
1031
  }
1032
- if (!(!(jQuery(window).width() >= <?php echo $image_width; ?>) || !(<?php echo $open_with_fullscreen; ?> != 1))) {
1033
  jQuery("#wdi_spider_popup_wrap").css({
1034
- width: <?php echo $image_width; ?>,
1035
  left: '50%',
1036
- marginLeft: -<?php echo $image_width / 2; ?>,
1037
  zIndex: 100000
1038
  });
1039
- jQuery(".wdi_image_wrap").css({width: <?php echo $image_width; ?> - comment_container_width});
1040
- jQuery(".wdi_image_container").css({width: (<?php echo $image_width - ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?> - comment_container_width)});
1041
 
1042
  jQuery(".wdi_popup_image").css({
1043
- maxWidth: <?php echo $image_width - ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?> - comment_container_width
1044
  });
1045
  jQuery(".wdi_popup_embed").css({
1046
- width: <?php echo $image_width - ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?> - comment_container_width
1047
  });
1048
  wdi_resize_instagram_post();
1049
  <?php if ($filmstrip_direction == 'horizontal') { ?>
1050
- jQuery(".wdi_filmstrip_container").css({width: <?php echo $image_width; ?> - comment_container_width});
1051
- jQuery(".wdi_filmstrip").css({width: (<?php echo $image_width; ?> - comment_container_width- 40)});
1052
  <?php } ?>
1053
- wdi_popup_current_width = <?php echo $image_width; ?>;
1054
  }
1055
  else {
1056
  jQuery("#wdi_spider_popup_wrap").css({
@@ -1060,16 +1062,16 @@ class WDIViewGalleryBox {
1060
  zIndex: 100000
1061
  });
1062
  jQuery(".wdi_image_wrap").css({width: (jQuery(window).width() - comment_container_width)});
1063
- jQuery(".wdi_image_container").css({width: (jQuery(window).width() - <?php echo ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?> - comment_container_width)});
1064
 
1065
  jQuery(".wdi_popup_image").css({
1066
- maxWidth: jQuery(window).width() - <?php echo ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?> - comment_container_width
1067
  });
1068
  jQuery(".wdi_popup_embed").css({
1069
- width: jQuery(window).width() - <?php echo ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?> - comment_container_width
1070
  });
1071
  wdi_resize_instagram_post();
1072
- <?php if ($filmstrip_direction == 'horizontal') { ?>
1073
  jQuery(".wdi_filmstrip_container").css({width: (jQuery(window).width() - comment_container_width)});
1074
  jQuery(".wdi_filmstrip").css({width: (jQuery(window).width() - comment_container_width - 40)});
1075
  <?php } ?>
@@ -1077,7 +1079,7 @@ class WDIViewGalleryBox {
1077
  }
1078
  /* Set watermark container size.*/
1079
  wdi_change_watermark_container();
1080
- if (!(!(jQuery(window).height() > <?php echo $image_height - 2 * $theme_row->lightbox_close_btn_top; ?>) || !(jQuery(window).width() >= <?php echo $image_width - 2 * $theme_row->lightbox_close_btn_right; ?>) || !(<?php echo $open_with_fullscreen; ?> != 1))) {
1081
  jQuery(".wdi_spider_popup_close_fullscreen").attr("class", "wdi_spider_popup_close");
1082
  }
1083
  else {
@@ -1096,8 +1098,8 @@ class WDIViewGalleryBox {
1096
  }
1097
  });
1098
  /* Popup current width/height.*/
1099
- var wdi_popup_current_width = <?php echo $image_width; ?>;
1100
- var wdi_popup_current_height = <?php echo $image_height; ?>;
1101
  /* Open/close comments.*/
1102
  function wdi_comment() {
1103
 
@@ -1108,38 +1110,38 @@ class WDIViewGalleryBox {
1108
  if (!border_width) {
1109
  border_width = 0;
1110
  }
1111
- jQuery(".wdi_comment_container").animate({<?php echo $theme_row->lightbox_comment_pos; ?>: -jQuery(".wdi_comment_container").width() - border_width}, 500);
1112
  jQuery(".wdi_image_wrap").animate({
1113
- <?php echo $theme_row->lightbox_comment_pos; ?>: 0,
1114
  width: jQuery("#wdi_spider_popup_wrap").width()
1115
  }, 500);
1116
  jQuery(".wdi_image_container").animate({
1117
- width: jQuery("#wdi_spider_popup_wrap").width() - <?php echo ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>}, 500);
1118
  jQuery(".wdi_popup_image").animate({
1119
- maxWidth: jQuery("#wdi_spider_popup_wrap").width() - <?php echo ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>
1120
  }, {
1121
  duration: 500,
1122
  complete: function () { wdi_change_watermark_container(); }
1123
  });
1124
  jQuery(".wdi_popup_embed").animate({
1125
- width: jQuery("#wdi_spider_popup_wrap").width() - <?php echo ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>
1126
  }, {
1127
  duration: 500,
1128
  complete: function () {
1129
  wdi_resize_instagram_post();
1130
  wdi_change_watermark_container(); }
1131
  });
1132
- jQuery(".wdi_filmstrip_container").animate({<?php echo $width_or_height; ?>: jQuery(".wdi_spider_popup_wrap").<?php echo $width_or_height; ?>()}, 500);
1133
- jQuery(".wdi_filmstrip").animate({<?php echo $width_or_height; ?>: jQuery(".wdi_spider_popup_wrap").<?php echo $width_or_height; ?>() - 40}, 500);
1134
  /* Set filmstrip initial position.*/
1135
  wdi_set_filmstrip_pos(jQuery(".wdi_spider_popup_wrap").width() - 40);
1136
  jQuery(".wdi_comment_container").attr("class", "wdi_comment_container wdi_close");
1137
- jQuery(".wdi_comment").attr("title", "<?php echo __('Show Comments', "wd-instagram-feed"); ?>");
1138
  jQuery(".wdi_spider_popup_close_fullscreen").show();
1139
  }
1140
  else {
1141
  /* Open comment.*/
1142
- var comment_container_width = <?php echo $theme_row->lightbox_comment_width; ?>;
1143
  if (comment_container_width > jQuery(window).width()) {
1144
  comment_container_width = jQuery(window).width();
1145
  jQuery(".wdi_comment_container").css({
@@ -1154,32 +1156,32 @@ class WDIViewGalleryBox {
1154
  else {
1155
  jQuery(".wdi_spider_popup_close_fullscreen").show();
1156
  }
1157
- jQuery(".wdi_comment_container").animate({<?php echo $theme_row->lightbox_comment_pos; ?>: 0}, 500);
1158
  jQuery(".wdi_image_wrap").animate({
1159
- <?php echo $theme_row->lightbox_comment_pos; ?>: jQuery(".wdi_comment_container").width(),
1160
  width: jQuery("#wdi_spider_popup_wrap").width() - jQuery(".wdi_comment_container").width()}, 500);
1161
  jQuery(".wdi_image_container").animate({
1162
- width: jQuery("#wdi_spider_popup_wrap").width() - <?php echo ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?> - jQuery(".wdi_comment_container").width()}, 500);
1163
  jQuery(".wdi_popup_image").animate({
1164
- maxWidth: jQuery("#wdi_spider_popup_wrap").width() - jQuery(".wdi_comment_container").width() - <?php echo ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>
1165
  }, {
1166
  duration: 500,
1167
  complete: function () { wdi_change_watermark_container(); }
1168
  });
1169
  jQuery(".wdi_popup_embed").animate({
1170
- width: jQuery("#wdi_spider_popup_wrap").width() - jQuery(".wdi_comment_container").width() - <?php echo ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>
1171
  }, {
1172
  duration: 500,
1173
  complete: function () {
1174
  wdi_resize_instagram_post();
1175
  wdi_change_watermark_container(); }
1176
  });
1177
- jQuery(".wdi_filmstrip_container").css({<?php echo $width_or_height; ?>: jQuery("#wdi_spider_popup_wrap").<?php echo $width_or_height; ?>() - <?php echo ($filmstrip_direction == 'vertical' ? 0: 'jQuery(".wdi_comment_container").width()'); ?>});
1178
- jQuery(".wdi_filmstrip").animate({<?php echo $width_or_height; ?>: jQuery(".wdi_filmstrip_container").<?php echo $width_or_height; ?>() - 40}, 500);
1179
  /* Set filmstrip initial position.*/
1180
- wdi_set_filmstrip_pos(jQuery(".wdi_filmstrip_container").<?php echo $width_or_height; ?>() - 40);
1181
  jQuery(".wdi_comment_container").attr("class", "wdi_comment_container wdi_open");
1182
- jQuery(".wdi_comment").attr("title", "<?php echo __('Hide Comments', "wd-instagram-feed"); ?>");
1183
  /* Load comments.*/
1184
 
1185
  var cur_image_key = parseInt(jQuery("#wdi_current_image_key").val());
@@ -1197,14 +1199,6 @@ class WDIViewGalleryBox {
1197
  }
1198
 
1199
  jQuery(document).ready(function () {
1200
- /* Increase image hit counter.*/
1201
- // wdi_spider_set_input_value('rate_ajax_task', 'save_hit_count');
1202
- // wdi_spider_rate_ajax_save('wdi_rate_form');
1203
- // jQuery(".wdi_image_hits span").html(++wdi_data["<?php echo $current_image_key; ?>"]["hit_count"]);
1204
- // var wdi_hash = window.location.hash;
1205
- // if (!wdi_hash || wdi_hash.indexOf("wdi") == "-1") {
1206
- // window.location.hash = "wdi<?php echo $gallery_id; ?>/<?php echo $current_image_id; ?>";
1207
- // }
1208
  <?php
1209
  if ($image_right_click) {
1210
  ?>
@@ -1237,10 +1231,10 @@ class WDIViewGalleryBox {
1237
  var wdi_click = isMobile ? 'touchend' : 'click';
1238
 
1239
  /*Carousel Media*/
1240
- jQuery("body").on(wdi_click, ".wdi_carousel_btn_container span", function () {
1241
- if(jQuery("video.carousel_media.active").length){
1242
- jQuery("video.carousel_media.active").get(0).pause();
1243
- }
1244
  var id = jQuery(this).data("id");
1245
  jQuery(this).closest(".wdi_carousel_btn_container").find("span").removeClass("active");
1246
  jQuery(this).addClass("active");
@@ -1294,28 +1288,17 @@ class WDIViewGalleryBox {
1294
  }
1295
  }
1296
  }
1297
- /* Set image container height.*/
1298
- <?php if ($filmstrip_direction == 'horizontal') { ?>
1299
- jQuery(".wdi_image_container").height(jQuery(".wdi_image_wrap").height() - <?php echo $image_filmstrip_height; ?>);
1300
  jQuery(".wdi_image_container").width(jQuery(".wdi_image_wrap").width());
1301
-
1302
-
1303
  <?php }
1304
  else {
1305
  ?>
1306
  jQuery(".wdi_image_container").height(jQuery(".wdi_image_wrap").height());
1307
- jQuery(".wdi_image_container").width(jQuery(".wdi_image_wrap").width() - <?php echo $image_filmstrip_width; ?>);
1308
-
1309
  <?php
1310
  } ?>
1311
- /* Change default scrollbar in comments.*/
1312
- // if (typeof jQuery().mCustomScrollbar !== 'undefined') {
1313
- // if (jQuery.isFunction(jQuery().mCustomScrollbar)) {
1314
- // jQuery(".wdi_comments").mCustomScrollbar({scrollInertia: 150});
1315
- // }
1316
- // }
1317
-
1318
-
1319
  var mousewheelevt = (/Firefox/i.test(navigator.userAgent)) ? "DOMMouseScroll" : "mousewheel" /*FF doesn't recognize mousewheel as of FF3.x*/
1320
  jQuery('.wdi_filmstrip').on(mousewheelevt, function(e) {
1321
  var evt = window.event || e; /* Equalize event object.*/
@@ -1332,18 +1315,16 @@ class WDIViewGalleryBox {
1332
  }
1333
  });
1334
 
1335
-
1336
  jQuery(".wdi_filmstrip_right").on(wdi_click, function () {
1337
  jQuery( ".wdi_filmstrip_thumbnails" ).stop(true, false);
1338
- if (jQuery(".wdi_filmstrip_thumbnails").position().<?php echo $left_or_top; ?>
1339
- >= -(jQuery(".wdi_filmstrip_thumbnails").<?php echo $width_or_height; ?>() - jQuery(".wdi_filmstrip").<?php echo $width_or_height; ?>())) {
1340
  jQuery(".wdi_filmstrip_left").css({opacity: 1, filter: "Alpha(opacity=100)"});
1341
- if (jQuery(".wdi_filmstrip_thumbnails").position().<?php echo $left_or_top; ?>
1342
- < -(jQuery(".wdi_filmstrip_thumbnails").<?php echo $width_or_height; ?>() - jQuery(".wdi_filmstrip").<?php echo $width_or_height; ?>() - <?php echo $filmstrip_thumb_margin_hor + $image_filmstrip_width; ?>)) {
1343
- jQuery(".wdi_filmstrip_thumbnails").animate({<?php echo $left_or_top; ?>: -(jQuery(".wdi_filmstrip_thumbnails").<?php echo $width_or_height; ?>() - jQuery(".wdi_filmstrip").<?php echo $width_or_height; ?>())}, 500, 'linear');
1344
  }
1345
  else {
1346
- jQuery(".wdi_filmstrip_thumbnails").animate({<?php echo $left_or_top; ?>: (jQuery(".wdi_filmstrip_thumbnails").position().<?php echo $left_or_top; ?> - <?php echo $filmstrip_thumb_margin_hor + $image_filmstrip_width; ?>)}, 500, 'linear');
1347
  }
1348
  }
1349
  /* Disable right arrow.*/
@@ -1352,53 +1333,47 @@ class WDIViewGalleryBox {
1352
 
1353
  jQuery(".wdi_filmstrip_left").on(wdi_click, function () {
1354
  jQuery( ".wdi_filmstrip_thumbnails" ).stop(true, false);
1355
- if ((jQuery(".wdi_filmstrip_thumbnails").position().<?php echo $left_or_top; ?>) < 0) {
1356
  jQuery(".wdi_filmstrip_right").css({opacity: 1, filter: "Alpha(opacity=100)"});
1357
- if (jQuery(".wdi_filmstrip_thumbnails").position().<?php echo $left_or_top; ?> > - <?php echo $filmstrip_thumb_margin_hor + $image_filmstrip_width; ?>) {
1358
- jQuery(".wdi_filmstrip_thumbnails").animate({<?php echo $left_or_top; ?>: 0}, 500, 'linear');
1359
  }
1360
  else {
1361
- jQuery(".wdi_filmstrip_thumbnails").animate({<?php echo $left_or_top; ?>: (jQuery(".wdi_filmstrip_thumbnails").position().<?php echo $left_or_top; ?> + <?php echo $image_filmstrip_width + $filmstrip_thumb_margin_hor; ?>)}, 500, 'linear');
1362
  }
1363
  }
1364
- /* Disable left arrow.*/
1365
  checkNeedToDisableLeftArrow();
1366
  });
1367
 
1368
  /* Set filmstrip initial position.*/
1369
- wdi_set_filmstrip_pos(jQuery(".wdi_filmstrip").<?php echo $width_or_height; ?>());
1370
  /* Show/hide image title/description.*/
1371
  jQuery(".wdi_info").on(wdi_click, function() {
1372
  if (jQuery(".wdi_image_info_container1").css("display") == 'none') {
1373
  jQuery(".wdi_image_info_container1").css("display", "table-cell");
1374
- jQuery(".wdi_info").attr("title", "<?php echo __('Hide info', "wd-instagram-feed"); ?>");
1375
-
1376
-
1377
-
1378
- if(!jQuery('.wdi_image_info').hasClass('mCustomScrollbar')){
1379
- var wdi_desc_max_height = <?php echo $image_height - ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?> -jQuery(".wdi_ctrl_btn_container").height()-parseInt(jQuery('.wdi_image_info').css('margin-bottom'))-parseInt(jQuery('.wdi_image_info').css('padding-bottom'));
1380
- jQuery('.wdi_image_info').css('max-height',wdi_desc_max_height+"px");
1381
- jQuery('.wdi_image_info').mCustomScrollbar({scrollInertia: 250});
1382
- }
1383
-
1384
 
 
 
 
 
 
1385
  }
1386
  else {
1387
  jQuery(".wdi_image_info_container1").css("display", "none");
1388
- jQuery(".wdi_info").attr("title", "<?php echo __('Show info', "wd-instagram-feed"); ?>");
1389
  }
1390
-
1391
-
1392
  });
1393
  /* Show/hide image rating.*/
1394
  jQuery(".wdi_rate").on(wdi_click, function() {
1395
  if (jQuery(".wdi_image_rate_container1").css("display") == 'none') {
1396
  jQuery(".wdi_image_rate_container1").css("display", "table-cell");
1397
- jQuery(".wdi_rate").attr("title", "<?php echo __('Hide rating', "wd-instagram-feed"); ?>");
1398
  }
1399
  else {
1400
  jQuery(".wdi_image_rate_container1").css("display", "none");
1401
- jQuery(".wdi_rate").attr("title", "<?php echo __('Show rating', "wd-instagram-feed"); ?>");
1402
  }
1403
  });
1404
  /* Open/close comments.*/
@@ -1422,12 +1397,11 @@ class WDIViewGalleryBox {
1422
  jQuery(".wdi_image_info").animate({top: 0}, 500);
1423
  <?php
1424
  }
1425
-
1426
  ?>
1427
- jQuery(".wdi_ctrl_btn_container").animate({<?php echo $theme_row->lightbox_ctrl_btn_pos; ?>: '-' + jQuery(".wdi_ctrl_btn_container").height() - 16}, 500);
1428
- jQuery(".wdi_carousel_btn_container").animate({<?php echo $theme_row->lightbox_ctrl_btn_pos; ?>: '40px'}, 500);
1429
  jQuery(".wdi_toggle_container").animate({
1430
- <?php echo $theme_row->lightbox_ctrl_btn_pos; ?>: 0
1431
  }, {
1432
  duration: 500,
1433
  complete: function () { jQuery(".wdi_toggle_container i").attr("class", "wdi_toggle_btn tenweb-i " + wdi_close_toggle_btn_class) }
@@ -1448,17 +1422,15 @@ class WDIViewGalleryBox {
1448
  }
1449
 
1450
  ?>
1451
- jQuery(".wdi_ctrl_btn_container").animate({<?php echo $theme_row->lightbox_ctrl_btn_pos; ?>: 0}, 500);
1452
- jQuery(".wdi_carousel_btn_container").animate({<?php echo $theme_row->lightbox_ctrl_btn_pos; ?>: jQuery(".wdi_ctrl_btn_container").height() + 25}, 500);
1453
  jQuery(".wdi_toggle_container").animate({
1454
- <?php echo $theme_row->lightbox_ctrl_btn_pos; ?>: jQuery(".wdi_ctrl_btn_container").height() + 16
1455
  }, {
1456
  duration: 500,
1457
  complete: function () { jQuery(".wdi_toggle_container i").attr("class", "wdi_toggle_btn tenweb-i " + wdi_open_toggle_btn_class) }
1458
  });
1459
  }
1460
-
1461
-
1462
  //close share buttons popup if open
1463
  jQuery('.wdi_share_btns').removeClass('wdi_share_toggler');
1464
  jQuery('.wdi_share_caret').removeClass('wdi_share_toggler');
@@ -1470,13 +1442,13 @@ class WDIViewGalleryBox {
1470
  comment_container_width = jQuery(".wdi_comment_container").width();
1471
  }
1472
  if (jQuery(".wdi_resize-full").hasClass("tenweb-i-compress")) {
1473
- if (jQuery(window).width() > <?php echo $image_width; ?>) {
1474
- wdi_popup_current_width = <?php echo $image_width; ?>;
1475
  }
1476
- if (jQuery(window).height() > <?php echo $image_height; ?>) {
1477
- wdi_popup_current_height = <?php echo $image_height; ?>;
1478
  }
1479
- /* Minimize.*/
1480
  jQuery("#wdi_spider_popup_wrap").animate({
1481
  width: wdi_popup_current_width,
1482
  height: wdi_popup_current_height,
@@ -1487,10 +1459,10 @@ class WDIViewGalleryBox {
1487
  zIndex: 100000
1488
  }, 500);
1489
  jQuery(".wdi_image_wrap").animate({width: wdi_popup_current_width - comment_container_width}, 500);
1490
- jQuery(".wdi_image_container").animate({height: wdi_popup_current_height - <?php echo ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>, width: wdi_popup_current_width - comment_container_width - <?php echo ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>}, 500);
1491
  jQuery(".wdi_popup_image").animate({
1492
- maxWidth: wdi_popup_current_width - comment_container_width - <?php echo ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>,
1493
- maxHeight: wdi_popup_current_height - <?php echo ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>
1494
  }, {
1495
  duration: 500,
1496
  complete: function () {
@@ -1503,8 +1475,8 @@ class WDIViewGalleryBox {
1503
  }
1504
  });
1505
  jQuery(".wdi_popup_embed").animate({
1506
- width: wdi_popup_current_width - comment_container_width - <?php echo ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>,
1507
- height: wdi_popup_current_height - <?php echo ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>
1508
  }, {
1509
  duration: 500,
1510
  complete: function () {
@@ -1517,17 +1489,17 @@ class WDIViewGalleryBox {
1517
  }
1518
  }
1519
  });
1520
- jQuery(".wdi_filmstrip_container").animate({<?php echo $width_or_height; ?>: wdi_popup_current_<?php echo $width_or_height; ?> - <?php echo ($filmstrip_direction == 'horizontal' ? 'comment_container_width' : 0); ?>}, 500);
1521
- jQuery(".wdi_filmstrip").animate({<?php echo $width_or_height; ?>: wdi_popup_current_<?php echo $width_or_height; ?> - <?php echo ($filmstrip_direction == 'horizontal' ? 'comment_container_width' : 0); ?> - 40}, 500);
1522
  /* Set filmstrip initial position.*/
1523
- wdi_set_filmstrip_pos(wdi_popup_current_<?php echo $width_or_height; ?> - 40);
1524
  jQuery(".wdi_resize-full").attr("class", "wdi_ctrl_btn wdi_resize-full tenweb-i tenweb-i-expand");
1525
- jQuery(".wdi_resize-full").attr("title", "<?php echo __('Maximize', "wd-instagram-feed"); ?>");
1526
  }
1527
  else {
1528
  wdi_popup_current_width = jQuery(window).width();
1529
  wdi_popup_current_height = jQuery(window).height();
1530
- /* Maximize.*/
1531
  jQuery("#wdi_spider_popup_wrap").animate({
1532
  width: jQuery(window).width(),
1533
  height: jQuery(window).height(),
@@ -1537,29 +1509,31 @@ class WDIViewGalleryBox {
1537
  zIndex: 100000
1538
  }, 500);
1539
  jQuery(".wdi_image_wrap").animate({width: (jQuery(window).width() - comment_container_width)}, 500);
1540
- jQuery(".wdi_image_container").animate({height: (wdi_popup_current_height - <?php echo ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>), width: wdi_popup_current_width - comment_container_width - <?php echo ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>}, 500);
1541
  jQuery(".wdi_popup_image").animate({
1542
- maxWidth: jQuery(window).width() - comment_container_width - <?php echo ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>,
1543
- maxHeight: jQuery(window).height() - <?php echo ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>
1544
  }, {
1545
  duration: 500,
1546
  complete: function () { wdi_change_watermark_container(); }
1547
- });
1548
  jQuery(".wdi_popup_embed").animate({
1549
- width: jQuery(window).width() - comment_container_width - <?php echo ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>,
1550
- height: jQuery(window).height() - <?php echo ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>
1551
- }, {
 
1552
  duration: 500,
1553
  complete: function () {
1554
  wdi_resize_instagram_post();
1555
- wdi_change_watermark_container(); }
1556
- });
1557
- jQuery(".wdi_filmstrip_container").animate({<?php echo $width_or_height; ?>: jQuery(window).<?php echo $width_or_height; ?>() - <?php echo ($filmstrip_direction == 'horizontal' ? 'comment_container_width' : 0); ?>}, 500);
1558
- jQuery(".wdi_filmstrip").animate({<?php echo $width_or_height; ?>: jQuery(window).<?php echo $width_or_height; ?>() - <?php echo ($filmstrip_direction == 'horizontal' ? 'comment_container_width' : 0); ?> - 40}, 500);
 
1559
  /* Set filmstrip initial position.*/
1560
- wdi_set_filmstrip_pos(jQuery(window).<?php echo $width_or_height; ?>() - <?php echo ($filmstrip_direction == 'horizontal' ? 'comment_container_width' : 0); ?> - 40);
1561
  jQuery(".wdi_resize-full").attr("class", "wdi_ctrl_btn wdi_resize-full tenweb-i tenweb-i-compress");
1562
- jQuery(".wdi_resize-full").attr("title", "<?php echo __('Restore', "wd-instagram-feed"); ?>");
1563
  jQuery(".wdi_spider_popup_close").attr("class", "wdi_ctrl_btn wdi_spider_popup_close_fullscreen");
1564
  }
1565
  });
@@ -1571,11 +1545,11 @@ class WDIViewGalleryBox {
1571
  comment_container_width = jQuery(".wdi_comment_container").width();
1572
  }
1573
  function wdi_exit_fullscreen() {
1574
- if (jQuery(window).width() > <?php echo $image_width; ?>) {
1575
- wdi_popup_current_width = <?php echo $image_width; ?>;
1576
  }
1577
- if (jQuery(window).height() > <?php echo $image_height; ?>) {
1578
- wdi_popup_current_height = <?php echo $image_height; ?>;
1579
  }
1580
  <?php
1581
  /* "Full width lightbox" sets yes.*/
@@ -1597,30 +1571,28 @@ class WDIViewGalleryBox {
1597
  zIndex: 100000
1598
  });
1599
  jQuery(".wdi_image_wrap").css({width: wdi_popup_current_width - comment_container_width});
1600
- jQuery(".wdi_image_container").css({height: wdi_popup_current_height - <?php echo ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>, width: wdi_popup_current_width - comment_container_width - <?php echo ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>});
1601
 
1602
- /*jQuery(".wdi_slide_bg").css({height: wdi_popup_current_height - <?php /*echo $image_filmstrip_height;*/ ?>});
1603
- jQuery(".wdi_popup_image_spun1").css({height: wdi_popup_current_height - <?php /*echo $image_filmstrip_height;*/ ?>});*/
1604
  jQuery(".wdi_popup_image").css({
1605
- maxWidth: wdi_popup_current_width - comment_container_width - <?php echo ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>,
1606
- maxHeight: wdi_popup_current_height - <?php echo ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>
1607
  });
1608
  jQuery(".wdi_popup_embed").css({
1609
- width: wdi_popup_current_width - comment_container_width - <?php echo ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>,
1610
- height: wdi_popup_current_height - <?php echo ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>
1611
  });
1612
  wdi_resize_instagram_post();
1613
- /* Set watermark container size.*/
1614
  wdi_change_watermark_container();
1615
- jQuery(".wdi_filmstrip_container").css({<?php echo $width_or_height; ?>: wdi_popup_current_<?php echo $width_or_height; ?> - <?php echo ($filmstrip_direction == 'horizontal' ? 'comment_container_width' : 0); ?>});
1616
- jQuery(".wdi_filmstrip").css({<?php echo $width_or_height; ?>: wdi_popup_current_<?php echo $width_or_height; ?> - <?php echo ($filmstrip_direction == 'horizontal' ? 'comment_container_width' : 0); ?>- 40});
1617
- /* Set filmstrip initial position.*/
1618
- wdi_set_filmstrip_pos(wdi_popup_current_<?php echo $width_or_height; ?> - 40);
1619
  jQuery(".wdi_resize-full").show();
1620
  jQuery(".wdi_resize-full").attr("class", "wdi_ctrl_btn wdi_resize-full tenweb-i tenweb-i-expand");
1621
- jQuery(".wdi_resize-full").attr("title", "<?php echo __('Maximize', "wd-instagram-feed"); ?>");
1622
  jQuery(".wdi_fullscreen").attr("class", "wdi_ctrl_btn wdi_fullscreen tenweb-i tenweb-i-arrows-out");
1623
- jQuery(".wdi_fullscreen").attr("title", "<?php echo __('Fullscreen', "wd-instagram-feed"); ?>");
1624
  if (jQuery("#wdi_spider_popup_wrap").width() < jQuery(window).width()) {
1625
  if (jQuery("#wdi_spider_popup_wrap").height() < jQuery(window).height()) {
1626
  jQuery(".wdi_spider_popup_close_fullscreen").attr("class", "wdi_spider_popup_close");
@@ -1651,29 +1623,28 @@ class WDIViewGalleryBox {
1651
  zIndex: 100000
1652
  });
1653
  jQuery(".wdi_image_wrap").css({width: screen_width - comment_container_width});
1654
- jQuery(".wdi_image_container").css({height: (screen_height - <?php echo ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>), width: screen_width - comment_container_width - <?php echo ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>});
1655
- /* jQuery(".wdi_slide_bg").css({height: screen_height - <?php /*echo $image_filmstrip_height;*/ ?>});*/
1656
  jQuery(".wdi_popup_image").css({
1657
- maxWidth: (screen_width - comment_container_width - <?php echo ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>),
1658
- maxHeight: (screen_height - <?php echo ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>)
1659
  });
1660
 
1661
  jQuery(".wdi_popup_embed").css({
1662
- width: (screen_width - comment_container_width - <?php echo ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>),
1663
- height: (screen_height - <?php echo ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>)
1664
  });
1665
 
1666
  wdi_resize_instagram_post();
1667
 
1668
  /* Set watermark container size.*/
1669
  wdi_change_watermark_container();
1670
- jQuery(".wdi_filmstrip_container").css({<?php echo $width_or_height; ?>: (screen_<?php echo $width_or_height; ?> - <?php echo ($filmstrip_direction == 'horizontal' ? 'comment_container_width' : 0); ?>)});
1671
- jQuery(".wdi_filmstrip").css({<?php echo $width_or_height; ?>: (screen_<?php echo $width_or_height; ?> - <?php echo ($filmstrip_direction == 'horizontal' ? 'comment_container_width' : 0); ?> - 40)});
1672
  /* Set filmstrip initial position.*/
1673
- wdi_set_filmstrip_pos(screen_<?php echo $width_or_height; ?> - <?php echo ($filmstrip_direction == 'horizontal' ? 'comment_container_width' : 0); ?> - 40);
1674
  jQuery(".wdi_resize-full").hide();
1675
  jQuery(".wdi_fullscreen").attr("class", "wdi_ctrl_btn wdi_fullscreen tenweb-i tenweb-i-compress");
1676
- jQuery(".wdi_fullscreen").attr("title", "<?php echo __('Exit Fullscreen', "wd-instagram-feed"); ?>");
1677
  jQuery(".wdi_spider_popup_close").attr("class", "wdi_ctrl_btn wdi_spider_popup_close_fullscreen");
1678
  /*});
1679
  }*/
@@ -1688,13 +1659,13 @@ class WDIViewGalleryBox {
1688
 
1689
  /* PLay.*/
1690
  wdi_play();
1691
- jQuery(".wdi_play_pause").attr("title", "<?php echo __('Pause', "wd-instagram-feed"); ?>");
1692
  jQuery(".wdi_play_pause").attr("class", "wdi_ctrl_btn wdi_play_pause tenweb-i tenweb-i-pause");
1693
  }
1694
  else {
1695
  /* Pause.*/
1696
  window.clearInterval(wdi_playInterval);
1697
- jQuery(".wdi_play_pause").attr("title", "<?php echo __('Play', "wd-instagram-feed"); ?>");
1698
  jQuery(".wdi_play_pause").attr("class", "wdi_ctrl_btn wdi_play_pause tenweb-i tenweb-i-play");
1699
  }
1700
  });
@@ -1705,7 +1676,7 @@ class WDIViewGalleryBox {
1705
  ?>
1706
 
1707
  wdi_play();
1708
- jQuery(".wdi_play_pause").attr("title", "<?php echo __('Pause', "wd-instagram-feed"); ?>");
1709
  jQuery(".wdi_play_pause").attr("class", "wdi_ctrl_btn wdi_play_pause tenweb-i tenweb-i-pause");
1710
  <?php
1711
  }
@@ -1714,7 +1685,7 @@ class WDIViewGalleryBox {
1714
  <?php
1715
  if ($open_with_fullscreen) {
1716
  ?>
1717
- wdi_open_with_fullscreen();
1718
  <?php
1719
  }
1720
  ?>
@@ -1724,14 +1695,12 @@ class WDIViewGalleryBox {
1724
 
1725
  //if info is displayed by defult then double trigger
1726
  //info click for displaying it with proper scrollbar
1727
- if(<?php echo $popup_info_always_show?>){
1728
  setTimeout(function(){
1729
  jQuery(".wdi_info").trigger(wdi_click);
1730
  jQuery(".wdi_info").trigger(wdi_click);
1731
  },100);
1732
  }
1733
-
1734
-
1735
  });
1736
  /* Open with fullscreen.*/
1737
  function wdi_open_with_fullscreen() {
@@ -1750,34 +1719,34 @@ class WDIViewGalleryBox {
1750
  zIndex: 100000
1751
  });
1752
  jQuery(".wdi_image_wrap").css({width: (jQuery(window).width() - comment_container_width)});
1753
- jQuery(".wdi_image_container").css({height: (wdi_popup_current_height - <?php echo ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>), width: wdi_popup_current_width - comment_container_width - <?php echo ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>});
1754
  jQuery(".wdi_popup_image").css({
1755
- maxWidth: jQuery(window).width() - comment_container_width - <?php echo ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>,
1756
- maxHeight: jQuery(window).height() - <?php echo ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>
1757
  }, {
1758
  complete: function () { wdi_change_watermark_container(); }
1759
  });
1760
  jQuery(".wdi_popup_video").css({
1761
- width: jQuery(window).width() - comment_container_width - <?php echo ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>,
1762
- height: jQuery(window).height() - <?php echo ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>
1763
  }, {
1764
  complete: function () { wdi_change_watermark_container(); }
1765
  });
1766
  jQuery(".wdi_popup_embed").css({
1767
- width: jQuery(window).width() - comment_container_width - <?php echo ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>,
1768
- height: jQuery(window).height() - <?php echo ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>
1769
  }, {
1770
  complete: function () {
1771
  wdi_resize_instagram_post();
1772
  wdi_change_watermark_container(); }
1773
  });
1774
- jQuery(".wdi_filmstrip_container").css({<?php echo $width_or_height; ?>: jQuery(window).<?php echo $width_or_height; ?>() - <?php echo ($filmstrip_direction == 'horizontal' ? 'comment_container_width' : 0); ?>});
1775
- jQuery(".wdi_filmstrip").css({<?php echo $width_or_height; ?>: jQuery(window).<?php echo $width_or_height; ?>() - <?php echo ($filmstrip_direction == 'horizontal' ? 'comment_container_width' : 0); ?> - 40});
1776
  /* Set filmstrip initial position.*/
1777
- wdi_set_filmstrip_pos(jQuery(window).<?php echo $width_or_height; ?>() - <?php echo ($filmstrip_direction == 'horizontal' ? 'comment_container_width' : 0); ?> - 40);
1778
 
1779
  jQuery(".wdi_resize-full").attr("class", "wdi_ctrl_btn wdi_resize-full tenweb-i tenweb-i-compress");
1780
- jQuery(".wdi_resize-full").attr("title", "<?php echo __('Restore', "wd-instagram-feed"); ?>");
1781
  jQuery(".wdi_spider_popup_close").attr("class", "wdi_ctrl_btn wdi_spider_popup_close_fullscreen");
1782
  }
1783
 
@@ -1812,8 +1781,6 @@ class WDIViewGalleryBox {
1812
  top: top_pos
1813
  });
1814
  });
1815
-
1816
-
1817
  wdi_change_watermark_container();
1818
  }
1819
  }
@@ -1822,28 +1789,19 @@ class WDIViewGalleryBox {
1822
  window.clearInterval(wdi_playInterval);
1823
  wdi_playInterval = setInterval(function () {
1824
  if (!wdi_data[parseInt(jQuery('#wdi_current_image_key').val()) + 1]) {
1825
- if (<?php echo $option_row->enable_loop; ?> == 1) {
1826
- /* Wrap around.*/
1827
  wdi_change_image(parseInt(jQuery('#wdi_current_image_key').val()), 0, wdi_data);
1828
  }
1829
  return;
1830
  }
1831
  wdi_change_image(parseInt(jQuery('#wdi_current_image_key').val()), parseInt(jQuery('#wdi_current_image_key').val()) + 1, wdi_data)
1832
- }, '<?php echo $slideshow_interval * 1000; ?>');
1833
  }
1834
  jQuery(window).focus(function() {
1835
-
1836
- /* event_stack = [];*/
1837
  if (!jQuery(".wdi_ctrl_btn").hasClass("tenweb-i-play")) {
1838
  wdi_play();
1839
  }
1840
- /*var i = 0;
1841
- jQuery(".wdi_slider").children("span").each(function () {
1842
- if (jQuery(this).css('opacity') == 1) {
1843
- jQuery("#wdi_current_image_key").val(i);
1844
- }
1845
- i++;
1846
- });*/
1847
  });
1848
  jQuery(window).blur(function() {
1849
  event_stack = [];
@@ -1852,7 +1810,6 @@ class WDIViewGalleryBox {
1852
  wdi_popup_resize();
1853
  })
1854
  });
1855
-
1856
  </script>
1857
  <?php
1858
  die();
18
 
19
  $feed_id = WDILibrary::get('feed_id', 0, 'intval', 'POST');
20
  $current_feed = $this->model->get_feed_row_data( $feed_id );
21
+
22
  $is_hashtag = FALSE;
23
  if ( !empty($current_feed['feed_users']) ) {
24
  $feed_users = json_decode($current_feed['feed_users'], TRUE);
60
  $current_image_id = WDILibrary::get('image_id', 0, 'intval', 'GET');
61
  $current_image_index = WDILibrary::get('current_image_index', 0, 'intval', 'POST');
62
  $theme_id = (isset($current_feed['theme_id']) ? esc_html($current_feed['theme_id']) : 1);
63
+ // $ _POST["carousel_media_row"] is esc done it uses the WDILibrary::get() function in which the corresponding esc is executed.
64
+ /* phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized */
65
  $carousel_media_row = isset($_POST["carousel_media_row"]) ? $_POST["carousel_media_row"] : '';
66
+ $carousel_media = array();
67
+ if ( !empty($carousel_media_row) ) {
68
+ $carousel_media = json_decode(stripslashes($carousel_media_row), TRUE);
69
+ $carousel_media = WDILibrary::get('', $carousel_media, 'sanitize_text_field', '');
70
+ $carousel_media = is_array($carousel_media) ? $carousel_media : array();
71
+ }
72
  $thumb_width = WDILibrary::get('thumb_width', 90, 'floatval', 'GET');/*watch later*/
73
  $thumb_height = WDILibrary::get('thumb_height', 90, 'floatval', 'GET');/*watch later*/
74
 
87
  $popup_enable_info = (isset($current_feed['popup_enable_info']) ? esc_html($current_feed['popup_enable_info']) : 1);
88
  $popup_info_always_show = (isset($current_feed['popup_info_always_show']) ? esc_html($current_feed['popup_info_always_show']) : 0);
89
  $popup_info_full_width = (isset($current_feed['popup_info_full_width']) ? esc_html($current_feed['popup_info_full_width']) : 0);
90
+ $popup_enable_rate = (isset($current_feed['lightbox_rating']) ? esc_html($current_feed['lightbox_rating']) : 0); /*deprecated*/
91
+ $popup_hit_counter = (isset($current_feed['lightbox_hit_counter']) ? esc_html($current_feed['lightbox_hit_counter']) : 0); /*deprecated*/
92
  if ($enable_image_filmstrip) {
93
  $image_filmstrip_height = (isset($current_feed['popup_filmstrip_height']) ? esc_html($current_feed['popup_filmstrip_height']) : '20');
94
  $thumb_ratio = $thumb_width / $thumb_height;
109
  $enable_share_buttons = (isset($current_feed['popup_enable_share_buttons']) ? esc_html($current_feed['popup_enable_share_buttons']) : 1);
110
  $image_right_click = (isset($current_feed['popup_image_right_click']) ? esc_html($current_feed['popup_image_right_click']) : 1);
111
 
112
+ $comment_moderation = 0;
 
 
 
113
  $filmstrip_direction = 'horizontal';
114
  if ($theme_row->lightbox_filmstrip_pos == 'right' || $theme_row->lightbox_filmstrip_pos == 'left') {
115
  $filmstrip_direction = 'vertical';
130
  $image_filmstrip_height = 0;
131
  $image_filmstrip_width = 0;
132
  }
133
+ // $ _POST["image_rows"] is esc done it uses the WDILibrary::get() function in which the corresponding esc is executed.
134
+ /* phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized */
135
+ $json = isset($_POST['image_rows']) ? $_POST['image_rows'] : '';
136
+ $image_rows = new stdClass();
137
+ if ( !empty($json) ) {
138
+ $image_rows_decode = json_decode(stripslashes($json), true);
139
+ if ( !empty($image_rows_decode) ) {
140
+ $image_rows = WDILibrary::get('', $image_rows_decode, 'sanitize_text_field', '');
141
+ $image_rows = WDILibrary::arrayToObject($image_rows);
142
+ }
143
+ }
144
+ $image_rows_count = WDILibrary::get('image_rows_count', 0, 'intval', 'POST');
145
+ ///////////////////////////////// Parametes for deprecated content ////////////////////
146
  $theme_row->lightbox_rate_stars_count = 0;
147
  $theme_row->lightbox_rate_size = 0;
 
148
 
149
  $image_id = WDILibrary::get('image_id', $current_image_id, 'intval', 'POST');
 
150
 
151
  $params_array = array(
152
  'action' => 'GalleryBox',
225
  ?>
226
  <style>
227
  .wdi_popup_image {
228
+ max-width: <?php echo floatval($image_width - ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0)); ?>px;
229
+ max-height: <?php echo floatval($image_height - ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0)); ?>px;
230
  }
231
 
232
  .wdi_popup_embed {
233
+ width: <?php echo floatval($image_width - ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0)); ?>px;
234
+ height: <?php echo floatval($image_height - ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0)); ?>px;
235
  }
236
 
237
  <?php
254
  <?php } ?>
255
 
256
  .wdi_image_container {
257
+ <?php echo esc_html($theme_row->lightbox_filmstrip_pos); ?>: <?php echo floatval(($filmstrip_direction == 'horizontal') ? $image_filmstrip_height : $image_filmstrip_width); ?>px;
258
  }
259
 
260
  .wdi_filmstrip_container {
261
+ height: <?php echo floatval(($filmstrip_direction == 'horizontal') ? $image_filmstrip_height : $image_height); ?>px;
262
+ width: <?php echo floatval(($filmstrip_direction == 'horizontal') ? $image_width : $image_filmstrip_width); ?>px;
263
  }
264
 
265
  .wdi_filmstrip {
266
+ <?php echo esc_html($left_or_top); ?>: 20px;
267
+ <?php echo esc_html($width_or_height); ?>: <?php echo floatval(($filmstrip_direction == 'horizontal') ? $image_width - 40 : $image_height - 40); ?>px;
268
  }
269
 
270
  .wdi_filmstrip_thumbnails {
271
+ height: <?php echo floatval(($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : ($image_filmstrip_height + $filmstrip_thumb_margin_hor * $theme_row->lightbox_filmstrip_thumb_border_width) * $image_rows_count)); ?>px;
272
+ <?php echo esc_html($left_or_top); ?>: 0px;
273
+ width: <?php echo floatval(($filmstrip_direction == 'horizontal' ? ($image_filmstrip_width + $filmstrip_thumb_margin_hor * $theme_row->lightbox_filmstrip_thumb_border_width) * $image_rows_count : $image_filmstrip_width)); ?>px;
274
  }
275
 
276
  .wdi_filmstrip_thumbnail {
277
+ height: <?php echo floatval($image_filmstrip_height); ?>px;
278
+ width: <?php echo floatval($image_filmstrip_width); ?>px;
279
  }
280
 
281
  .wdi_filmstrip_left {
282
+ <?php echo esc_html($width_or_height); ?>: 20px;
283
+ <?php echo esc_html($left_or_top); ?>: 0;
284
  }
285
  .wdi_filmstrip_right {
286
+ <?php echo esc_html($width_or_height); ?>: 20px;
287
  }
288
 
289
  .wdi_image_info_container1 {
290
+ display: <?php echo esc_html( ($popup_info_always_show) ? 'table-cell' : 'none' ); ?>;
291
  }
292
 
293
  .wdi_image_info {
294
+ <?php
295
+ if ( (!$enable_image_filmstrip || $theme_row->lightbox_filmstrip_pos != 'bottom') && $theme_row->lightbox_ctrl_btn_pos == 'bottom' && $theme_row->lightbox_info_pos == 'bottom' ) {
296
+ echo 'bottom: ' . floatval($theme_row->lightbox_ctrl_btn_height + 2 * $theme_row->lightbox_ctrl_btn_margin_top) . 'px;';
297
+ }
298
+ ?>
299
+ <?php
300
+ if ( $params_array['popup_info_full_width']) { ?>
301
+ width: 100%;
302
+ <?php }
303
+ else { ?>
304
+ width: 33%;
305
+ margin: <?php echo esc_html($theme_row->lightbox_info_margin); ?>;
306
  <?php } ?>
307
+ <?php
308
+ if ( (!$enable_image_filmstrip || $theme_row->lightbox_filmstrip_pos != 'top') && $theme_row->lightbox_ctrl_btn_pos == 'top' && $theme_row->lightbox_info_pos == 'top' ) {
309
+ echo 'top: ' . floatval($theme_row->lightbox_ctrl_btn_height + 2 * $theme_row->lightbox_ctrl_btn_margin_top) . 'px;';
310
+ }
311
+ ?>
312
  }
313
  </style>
314
  <script>
315
  var event_stack = [];
316
  <?php
317
  $image_id_exist = FALSE;
318
+ foreach ( $image_rows as $key => $image_row ) {
319
  if (strpos($image_row->filename, 'https://') === false) {
320
+ $image_row->filename = sanitize_text_field($image_row->filename);
321
+ }
322
+ else {
323
+ $image_row->filename = esc_url_raw($image_row->filename);
324
  }
325
  if (intval($image_row->id) == $image_id) {
326
  $current_avg_rating = floatval($image_row->avg_rating);
328
  $current_rate_count = intval($image_row->rate_count);
329
  $current_image_key = sanitize_text_field($key);
330
  }
331
+ if ( intval($image_row->id) == $current_image_id ) {
332
  $current_image_alt = sanitize_text_field($image_row->alt);
333
  $current_image_user_name = sanitize_text_field($image_row->username);
334
  if (isset($image_row->profile_picture)){
337
  $current_image_user_pic = '';
338
  }
339
  $current_image_hit_count = intval($image_row->hit_count);
340
+ $current_image_description = str_replace('#',' #', str_replace(array("\r\n", "\n", "\r"), '<br />', sanitize_text_field($image_row->description)));
341
+ $current_image_url = ($image_row->image_url);
342
  $current_thumb_url = esc_url_raw($image_row->thumb_url);
343
  $current_filetype = sanitize_text_field($image_row->filetype);
344
  $current_filename = $image_row->filename;
345
  $image_id_exist = TRUE;
346
  }
347
  continue;
348
+ // sanitizing image description
349
  $instaDesc = sanitize_text_field($image_row->description);
350
  $instaDesc = preg_replace('/\\\\/', esc_html('&#92;'), $instaDesc);
351
 
352
+ /* last two are ZWSP and P-SEP */
353
  $instaDesc = str_replace(array("\r\n", "\n", "\r",'
', '
'), esc_html(''), str_replace('"','\"',$instaDesc));
354
  $instaDesc = str_replace('#', ' #', $instaDesc);
355
  }
356
  ?>
357
  </script>
358
  <?php
359
+ if ( !$image_id_exist ) {
360
+ ?>
361
+ <div style="width:99%" class="error inline">
362
+ <p><strong><?php _e('The image has been deleted.', 'wd-instagram-feed'); ?></strong></p>
363
+ </div>
364
+ <?php
365
  die();
366
  }
367
  ?>
373
  <div class="wdi_carousel_btn_content">
374
  <?php foreach($carousel_media as $key => $media){
375
  $class = ($key == 0 ? "active" : ($key > 9 ? "small" : "")); ?>
376
+ <span class="<?php echo esc_attr($class); ?>" data-id="<?php echo esc_attr($key); ?>"></span>
377
  <?php } ?>
378
  </div>
379
  </div>
388
  if ($option_row->show_image_counts) {
389
  ?>
390
  <span class="wdi_image_count_container wdi_ctrl_btn">
391
+ <span class="wdi_image_count"><?php echo intval($current_image_key + 1); ?></span> /
392
+ <span><?php echo intval($image_rows_count); ?></span>
393
  </span>
394
  <?php
395
  }
396
  ?>
397
+ <i title="<?php _e('Play', "wd-instagram-feed"); ?>" class="wdi_ctrl_btn wdi_play_pause tenweb-i tenweb-i-play"></i>
398
  <?php
399
  if ($enable_image_fullscreen) {
400
  if (!$open_with_fullscreen) {
401
  ?>
402
+ <i title="<?php _e('Maximize', "wd-instagram-feed"); ?>" class="wdi_ctrl_btn wdi_resize-full tenweb-i tenweb-i-expand "></i>
403
  <?php
404
  }
405
  ?>
406
+ <i title="<?php _e('Fullscreen', "wd-instagram-feed"); ?>" class="wdi_ctrl_btn wdi_fullscreen tenweb-i tenweb-i-arrows-out"></i>
407
  <?php
408
  }
409
  if ($popup_enable_info) {
410
  ?>
411
+ <i title="<?php _e('Show Caption', "wd-instagram-feed"); ?>" class="wdi_ctrl_btn wdi_info tenweb-i tenweb-i-info-circle"></i>
412
  <?php }
413
  if ( $enable_comment_social && $business && !$is_hashtag ) { ?>
414
+ <i title="<?php _e('Show comments', "wd-instagram-feed"); ?>" class="wdi_ctrl_btn wdi_comment tenweb-i tenweb-i-comment-square"></i>
415
  <?php }
416
  if ($popup_enable_rate) { ?>
417
+ <i title="<?php _e('Show rating', "wd-instagram-feed"); ?>" class="wdi_ctrl_btn wdi_rate tenweb-i tenweb-i-star"></i>
418
  <?php }
419
  $is_embed = preg_match('/EMBED/', $current_filetype) == 1 ? TRUE : FALSE;
420
  $share_image_url = urlencode( $is_embed ? $current_thumb_url : site_url() . '/' . $WD_WDI_UPLOAD_DIR . $current_image_url);
421
  if ($enable_image_facebook) {
422
  ?>
423
+ <a id="wdi_facebook_a" href="https://www.facebook.com/sharer/sharer.php?u=<?php echo urlencode($share_url); ?>" target="_blank" title="<?php _e('Share on Facebook', "wd-instagram-feed"); ?>">
424
+ <i title="<?php _e('Share on Facebook', "wd-instagram-feed"); ?>" class="wdi_ctrl_btn wdi_facebook tenweb-i tenweb-i-facebook-square"></i>
425
  </a>
426
  <?php
427
  }
428
  if ($enable_image_twitter) {
429
  ?>
430
+ <a id="wdi_twitter_a" href="https://twitter.com/intent/tweet?url=<?php echo urlencode($share_url); ?>" target="_blank" title="<?php _e('Share on Twitter', "wd-instagram-feed"); ?>">
431
+ <i title="<?php _e('Share on Twitter', "wd-instagram-feed"); ?>" class="wdi_ctrl_btn wdi_twitter tenweb-i tenweb-i-twitter-square"></i>
432
  </a>
433
  <?php
434
  }
435
  if ($enable_image_pinterest) {
436
  ?>
437
+ <a id="wdi_pinterest_a" href="http://pinterest.com/pin/create/button/?s=100&url=<?php echo urlencode($share_url); ?>&media=<?php echo esc_url($share_image_url); ?>&description=<?php echo esc_attr($current_image_description); ?>" target="_blank" title="<?php _e('Share on Pinterest', "wd-instagram-feed"); ?>">
438
+ <i title="<?php _e('Share on Pinterest', "wd-instagram-feed"); ?>" class="wdi_ctrl_btn wdi_pinterest tenweb-i tenweb-i-pinterest-square"></i>
439
  </a>
440
  <?php
441
  }
442
  if ($enable_image_tumblr) {
443
  ?>
444
+ <a id="wdi_tumblr_a" href="https://www.tumblr.com/share/photo?source=<?php echo esc_url($share_image_url); ?>&caption=<?php echo urlencode($current_image_alt); ?>&clickthru=<?php echo urlencode($share_url); ?>" target="_blank" title="<?php _e('Share on Tumblr', "wd-instagram-feed"); ?>">
445
+ <i title="<?php _e('Share on Tumblr', "wd-instagram-feed"); ?>" class="wdi_ctrl_btn wdi_tumblr tenweb-i tenweb-i-tumblr-square"></i>
446
  </a>
447
  <?php
448
  }
449
+
450
  if ($enable_share_buttons) {
451
  ?>
452
  <span class="wdi_share_btns_container">
453
+ <i onclick="jQuery(this).parent().find('.wdi_share_btns').toggleClass('wdi_share_toggler');jQuery(this).parent().find('.wdi_share_caret').toggleClass('wdi_share_toggler')" title="<?php _e('Share', "wd-instagram-feed"); ?>" class="wdi_ctrl_btn tenweb-i tenweb-i-share"></i>
454
  <p class="wdi_share_btns" style="display:none">
455
+ <a id="wdi_popup_fb" href="https://www.facebook.com/sharer/sharer.php?u=<?php echo esc_url_raw($current_image_url);?>" target="_blank" class='wdi_share_popup_btn wdi_facebook tenweb-i tenweb-i-facebook-square'></a>
456
+ <a id="wdi_popup_tw" href="https://twitter.com/intent/tweet?url=<?php echo esc_url_raw($current_image_url);?>" target="_blank" class='wdi_share_popup_btn wdi_twitter tenweb-i tenweb-i-twitter-square'></a>
457
+ <a id="wdi_popup_li" href="https://www.linkedin.com/shareArticle?mini=true&url=<?php echo esc_url_raw($current_image_url);?>&title=<?php echo esc_attr($current_image_description); ?>" target="_blank" class='wdi_share_popup_btn wdi_linkedin tenweb-i tenweb-i-linkedin'></a>
458
+ <a id="wdi_popup_pt" href="https://pinterest.com/pin/create/button/?url=<?php echo esc_url_raw($current_image_url);?>&media=<?php echo urlencode($current_thumb_url); ?>&description=<?php echo esc_attr($current_image_description); ?>" target="_blank" class='wdi_share_popup_btn wdi_pinterest tenweb-i tenweb-i-pinterest-square'></a>
459
  </p>
460
  <i class="wdi_share_caret " style="display:none;"></i>
461
  </span>
463
  }
464
  if ($option_row->popup_enable_fullsize_image) {
465
  ?>
466
+ <a id="wdi_fullsize_image" href="<?php echo esc_url_raw(!$is_embed ? site_url() . '/' . $WD_WDI_UPLOAD_DIR . $current_image_url : $current_image_url); ?>" target="_blank">
467
+ <i title="<?php _e('Open image in Instagram.', "wd-instagram-feed"); ?>" class="wdi_ctrl_btn tenweb-i tenweb-i-instagram"></i>
468
  </a>
469
  <?php
470
  }
471
  if ($option_row->popup_enable_download) {
472
+ $style = 'none';
473
+ $current_image_arr = explode('/', esc_url_raw($current_image_url));
474
+ $current_image_name = end($current_image_arr);
475
+ if (!$is_embed) {
476
+ $download_href = site_url() . '/' . $WD_WDI_UPLOAD_DIR . esc_url_raw($current_image_url);
477
+ $style = 'inline-block';
478
+ }
479
+ elseif (preg_match('/FLICKR/', $current_filetype) == 1) {
480
+ $download_href = $current_filename;
481
+ $style = 'inline-block';
482
+ }
483
+ elseif (preg_match('/INSTAGRAM/', $current_filetype) == 1) {
484
+ if(preg_match('/IMAGE/',$current_filetype) == 1){
485
+ $download_href = substr_replace($current_thumb_url, 'l', -1);
486
+ }
487
+ if(preg_match('/VIDEO/',$current_filetype) == 1){
488
+ $download_href = $current_filename;
489
+ }
490
+ $style = 'inline-block';
491
+ }
492
+ ?>
493
+ <a id="wdi_download" href="<?php echo esc_url($download_href); ?>" target="_blank" download="<?php echo esc_attr($current_image_name); ?>" style="display: <?php echo esc_html($style); ?>;">
494
+ <i title="<?php _e('Download original image', "wd-instagram-feed"); ?>" class="wdi_ctrl_btn tenweb-i tenweb-i-download"></i>
495
+ </a>
496
+ <?php
497
+ }
498
  ?>
499
  </div>
500
  <div class="wdi_toggle_container">
501
+ <i class="wdi_toggle_btn tenweb-i <?php echo esc_html(($theme_row->lightbox_ctrl_btn_pos == 'top') ? 'tenweb-i-angle-up' : 'tenweb-i-angle-down'); ?>"></i>
502
  </div>
503
  <?php } ?>
504
  </div>
519
  <span class="wdi_image_info_spun">
520
  <div class="wdi_image_info" <?php if(trim($current_image_alt) == '' && trim($current_image_description) == '') { echo 'style="background:none;"'; } ?>>
521
  <div class="wdi_image_title">
522
+ <div class="wdi_title" onclick="window.open('//instagram.com/<?php echo esc_html($current_image_user_name); ?>','_blank')">
523
+ <div class="wdi_header_text"><?php echo esc_html($current_image_user_name); ?></div>
524
  <?php if(!empty($current_image_user_pic)): ?>
525
  <div class="wdi_users_img_wrap"><img src="<?php echo esc_url($current_image_user_pic); ?>" alt=""></div>
526
  <?php endif;?>
553
  <?php
554
  if ( !$is_embed ) {
555
  ?>
556
+ <img class="wdi_popup_image wdi_popup_watermark" src="<?php echo esc_url(site_url() . '/' . $WD_WDI_UPLOAD_DIR) . esc_url_raw($image_row->image_url); ?>" alt="<?php echo esc_attr($image_row->alt); ?>" />
557
  <?php
558
  }
559
  else { ?>
571
  </span>
572
  <span class="wdi_popup_image_second_spun">
573
  </span>
574
+ <input type="hidden" id="wdi_current_image_key" value="<?php echo intval($current_image_index); ?>" />
575
  <?php
576
  break;
577
  }
580
  </div>
581
  </div>
582
  </div>
583
+ <a id="wdi_spider_popup_left" <?php echo esc_html(($option_row->enable_loop == 0 && $current_key == 0) ? 'style="display: none;"' : ''); ?>><span id="wdi_spider_popup_left-ico"><span><i class="wdi_prev_btn tenweb-i <?php echo esc_attr(str_replace("fa-", "tenweb-i-", $theme_row->lightbox_rl_btn_style)); ?>-left-sm"></i></span></span></a>
584
+ <a id="wdi_spider_popup_right" <?php echo esc_html(($option_row->enable_loop == 0 && $current_key == $image_rows_count - 1) ? 'style="display: none;"' : ''); ?>><span id="wdi_spider_popup_right-ico"><span><i class="wdi_next_btn tenweb-i <?php echo esc_attr(str_replace("fa-", "tenweb-i-", $theme_row->lightbox_rl_btn_style)); ?>-right-sm"></i></span></span></a>
585
  </div>
586
  </div>
587
  <a class="wdi_spider_popup_close" onclick="wdi_spider_destroypopup(1000); return false;" ontouchend="wdi_spider_destroypopup(1000); return false;"><span><i class="wdi_close_btn tenweb-i tenweb-i-times"></i></span></a>
588
  <script>
589
  function checkNeedToDisableRightArrow() {
590
  window.setTimeout(function(){
591
+ if( jQuery(".wdi_filmstrip_thumbnails").length > 0 && ( -(jQuery(".wdi_filmstrip_thumbnails").<?php echo esc_html($width_or_height); ?>() - jQuery(".wdi_filmstrip").<?php echo esc_html($width_or_height); ?>()) ==
592
+ jQuery(".wdi_filmstrip_thumbnails").position().<?php echo esc_html($left_or_top); ?> ) ) {
593
  jQuery(".wdi_filmstrip_right").css({opacity: 0.3, filter: "Alpha(opacity=30)"});
594
  }
595
  }, 600); // after lightbox open animation
596
  }
597
  function checkNeedToDisableLeftArrow() {
598
  window.setTimeout(function(){
599
+ if ( jQuery(".wdi_filmstrip_thumbnails").length > 0 && jQuery(".wdi_filmstrip_thumbnails").position().<?php echo esc_html($left_or_top); ?> == 0) {
600
  jQuery(".wdi_filmstrip_left").css({opacity: 0.3, filter: "Alpha(opacity=30)"});
601
  }
602
  }, 600); // after lightbox open animation
604
  checkNeedToDisableRightArrow();
605
  checkNeedToDisableLeftArrow();
606
  var wdi_trans_in_progress = false;
607
+ var wdi_transition_duration = <?php echo floatval((($slideshow_interval < 4) && ($slideshow_interval != 0)) ? ($slideshow_interval * 1000) / 4 : 800); ?>;
608
  var wdi_playInterval;
609
  if ((jQuery("#wdi_spider_popup_wrap").width() >= jQuery(window).width()) || (jQuery("#wdi_spider_popup_wrap").height() >= jQuery(window).height())) {
610
  jQuery(".wdi_spider_popup_close").attr("class", "wdi_ctrl_btn wdi_spider_popup_close_fullscreen");
611
  }
612
+ /* Stop autoplay. */
613
  window.clearInterval(wdi_playInterval);
614
+ /* Set watermark container size. */
615
  function wdi_change_watermark_container() {
616
  jQuery(".wdi_slider").children().each(function() {
617
  if (jQuery(this).css("zIndex") == 2) {
618
+ /* This may be neither img nor iframe. */
619
  var wdi_current_image_span = jQuery(this).find("img");
620
  if (!wdi_current_image_span.length) {
621
  wdi_current_image_span = jQuery(this).find("iframe");
623
  if (!wdi_current_image_span.length) {
624
  wdi_current_image_span = jQuery(this).find("video");
625
  }
626
+ /* set timeout for video to get size according to style, and then put watermark */
627
  setTimeout(function () {
628
  var width = wdi_current_image_span.width();
629
  var height = wdi_current_image_span.height();
630
 
631
  var comment_container_width = 0;
632
  if (jQuery(".wdi_comment_container").hasClass("wdi_open")) {
633
+ comment_container_width = <?php echo floatval($theme_row->lightbox_comment_width); ?>;
634
  }
 
635
  }, 800);
636
  }
637
  });
638
  }
639
+ var wdi_current_key = '<?php echo esc_html($current_key); ?>';
640
+ var wdi_current_filmstrip_pos = <?php echo esc_html($current_pos); ?>;
641
+ /* Set filmstrip initial position. */
642
  function wdi_set_filmstrip_pos(filmStripWidth) {
643
+ var selectedImagePos = -wdi_current_filmstrip_pos - (jQuery(".wdi_filmstrip_thumbnail").<?php echo esc_html($outerWidth_or_outerHeight); ?>(true)) / 2;
644
+ var imagesContainerLeft = Math.min(0, Math.max(filmStripWidth - jQuery(".wdi_filmstrip_thumbnails").<?php echo esc_html($width_or_height); ?>(), selectedImagePos + filmStripWidth / 2));
645
  jQuery(".wdi_filmstrip_thumbnails").animate({
646
+ <?php echo esc_html($left_or_top); ?>: imagesContainerLeft
647
  }, {
648
  duration: 500,
649
  complete: function () { wdi_filmstrip_arrows(); }
650
  });
651
  }
652
  function wdi_move_filmstrip() {
653
+ var image_left = jQuery(".wdi_thumb_active").position().<?php echo esc_html($left_or_top); ?>;
654
+ var image_right = jQuery(".wdi_thumb_active").position().<?php echo esc_html($left_or_top); ?> + jQuery(".wdi_thumb_active").<?php echo esc_html($outerWidth_or_outerHeight); ?>(true);
655
+ var wdi_filmstrip_width = jQuery(".wdi_filmstrip").<?php echo esc_html($outerWidth_or_outerHeight); ?>(true);
656
+ var wdi_filmstrip_thumbnails_width = jQuery(".wdi_filmstrip_thumbnails").<?php echo esc_html($outerWidth_or_outerHeight); ?>(true);
657
+ var long_filmstrip_cont_left = jQuery(".wdi_filmstrip_thumbnails").position().<?php echo esc_html($left_or_top); ?>;
658
+ var long_filmstrip_cont_right = Math.abs(jQuery(".wdi_filmstrip_thumbnails").position().<?php echo esc_html($left_or_top); ?>) + wdi_filmstrip_width;
659
  if (wdi_filmstrip_width > wdi_filmstrip_thumbnails_width) {
660
  return;
661
  }
662
  if (image_left < Math.abs(long_filmstrip_cont_left)) {
663
  jQuery(".wdi_filmstrip_thumbnails").animate({
664
+ <?php echo esc_html($left_or_top); ?>: -image_left
665
  }, {
666
  duration: 500,
667
  complete: function () { wdi_filmstrip_arrows(); }
669
  }
670
  else if (image_right > long_filmstrip_cont_right) {
671
  jQuery(".wdi_filmstrip_thumbnails").animate({
672
+ <?php echo esc_html($left_or_top); ?>: -(image_right - wdi_filmstrip_width)
673
  }, {
674
  duration: 500,
675
  complete: function () { wdi_filmstrip_arrows(); }
676
  });
677
  }
678
  }
679
+ /* Show/hide filmstrip arrows. */
680
  function wdi_filmstrip_arrows() {
681
+ if (jQuery(".wdi_filmstrip_thumbnails").<?php echo esc_html($width_or_height); ?>() < jQuery(".wdi_filmstrip").<?php echo esc_html($width_or_height); ?>()) {
682
  jQuery(".wdi_filmstrip_left").hide();
683
  jQuery(".wdi_filmstrip_right").hide();
684
  }
693
  wdi_pause_stream('#wdi_image_container');
694
  jQuery("#wdi_spider_popup_left").show();
695
  jQuery("#wdi_spider_popup_right").show();
696
+ if (<?php echo intval($option_row->enable_loop); ?> == 0) {
697
  if (key == (parseInt(wdi_data.length) - 1)) {
698
  jQuery("#wdi_spider_popup_right").hide();
699
  }
701
  jQuery("#wdi_spider_popup_left").hide();
702
  }
703
  }
704
+ /* Pause videos. */
705
  jQuery("#wdi_image_container").find("iframe").each(function () {
706
  jQuery(this)[0].contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*');
707
  jQuery(this)[0].contentWindow.postMessage('{ "method": "pause" }', "*");
711
  if (typeof wdi_data[key] != 'undefined') {
712
  if (typeof wdi_data[current_key] != 'undefined') {
713
  if (jQuery('.wdi_ctrl_btn').hasClass('tenweb-i-pause')) {
 
714
  wdi_play();
715
  }
716
  if (!from_effect) {
717
+ /* Change image key. */
718
  jQuery("#wdi_current_image_key").val(key);
 
 
 
719
  }
720
  if (wdi_trans_in_progress) {
721
  event_stack.push(current_key + '-' + key);
728
  else if (wdi_current_key == key) {
729
  return;
730
  }
 
 
731
  jQuery(".wdi_image_count").html(wdi_data[key]["number"]);
732
+ /* Set active thumbnail position. */
733
+ wdi_current_filmstrip_pos = key * (jQuery(".wdi_filmstrip_thumbnail").<?php echo esc_html($width_or_height); ?>() + 2 + 2 * <?php echo floatval($theme_row->lightbox_filmstrip_thumb_border_width); ?>);
734
  wdi_current_key = key;
735
+ /* Change hash. */
736
+ window.location.hash = "wdi<?php echo intval($gallery_id); ?>/" + wdi_data[key]["id"];
737
+ /* Change image id for rating. */
738
  <?php if ($popup_enable_rate) { ?>
739
  jQuery("#wdi_rate_form input[name='image_id']").val(wdi_data[key]["id"]);
740
  jQuery("#wdi_star").attr("data-score", wdi_data[key]["avg_rating"]);
745
  wdi_spider_set_input_value('rate_ajax_task', 'save_hit_count');
746
  //wdi_spider_rate_ajax_save('wdi_rate_form');
747
  jQuery(".wdi_image_hits span").html(++wdi_data[key]["hit_count"]);
748
+ /* Change image id. */
749
  jQuery("#wdi_popup_image").attr('image_id', wdi_data[key]["id"]);
750
 
751
  //creating image title template
759
  '<div class="wdi_image_description"></div>'+
760
  '</div>');
761
 
762
+ /* Change carousel media dots */
763
  if (typeof wdi_data[key]['carousel_media'] != "undefined" && wdi_data[key]['carousel_media'] != null) {
764
  if(jQuery(".wdi_carousel_btn_container").length){
765
  jQuery(".wdi_carousel_btn_container").remove();
780
  }
781
  }
782
 
783
+ /* Change image title, description. */
784
  jQuery(".wdi_image_title").html(jQuery('<span style="display: block;" />').append(wdi_title_div));
785
  jQuery(".wdi_image_description").html(jQuery('<span style="display: block;" />').text(wdi_data[key]["description"]).text());
786
  jQuery(".wdi_image_info").removeAttr("style");
809
  var cur_width = jQuery(current_image_class).width();
810
  var innhtml = '<span class="wdi_popup_image_spun1" style="display: table; width: inherit; height: inherit;"><span class="wdi_popup_image_spun2" style="display: table-cell; vertical-align: middle; text-align: center;">';
811
  if (!is_embed) {
812
+ innhtml += '<img style="max-height: ' + cur_height + 'px; max-width: ' + cur_width + 'px;" class="wdi_popup_image wdi_popup_watermark" src="<?php echo esc_url(site_url() . '/' . $WD_WDI_UPLOAD_DIR); ?>' + jQuery('<span style="display: block;" />').html(wdi_data[key]["image_url"]).text() + '" alt="' + wdi_data[key]["alt"] + '" />';
813
  }
814
  else { /*is_embed*/
815
  innhtml += '<span style="display:table; table-layout:fixed; height: ' + cur_height + 'px; width: ' + cur_width + 'px;" class="wdi_popup_embed wdi_popup_watermark" >';
830
  echo 'wdi_preload_images(key);';
831
  }
832
  ?>
833
+ wdi_<?php echo esc_html($image_effect); ?>(current_image_class, next_image_class, direction);
834
  jQuery("#wdi_download").show();
835
  if (!is_embed) {
836
+ jQuery("#wdi_fullsize_image").attr("href", "<?php echo esc_url(site_url() . '/' . $WD_WDI_UPLOAD_DIR); ?>" + wdi_data[key]['image_url']);
837
+ jQuery("#wdi_download").attr("href", "<?php echo esc_url(site_url() . '/' . $WD_WDI_UPLOAD_DIR); ?>" + wdi_data[key]['image_url']);
838
  }
839
  else {
840
  jQuery("#wdi_fullsize_image").attr("href", wdi_data[key]['image_url']);
853
  var wdi_image_description = wdi_data[key]['description'];
854
  jQuery("#wdi_download").attr("download", image_arr[image_arr.length - 1]);
855
  /* Change image social networks urls.*/
856
+ var wdi_share_url = encodeURIComponent("<?php echo esc_url(add_query_arg(array('action' => 'Share', 'curr_url' => $current_url, 'image_id' => ''), admin_url('admin-ajax.php'))); ?>") + "=" + wdi_data[key]['id'] + encodeURIComponent('#wdi<?php echo intval($gallery_id); ?>/') + wdi_data[key]['id'];
857
  if (is_embed) {
858
  var wdi_share_image_url = encodeURIComponent(wdi_data[key]['thumb_url']);
859
  }
892
  wdi_comments_manager.init(cur_image_key);
893
  }
894
  }
 
 
 
 
 
 
 
 
 
 
 
895
  <?php
896
  if ($enable_image_filmstrip) {
897
  ?>
899
  <?php
900
  }
901
  ?>
 
902
  }
903
  if (!is_embed) {
904
  var cur_img = jQuery(next_image_class).find('img');
934
  function wdi_preload_images(key) {
935
  count = <?php echo (int) $option_row->preload_images_count / 2; ?>;
936
  var count_all = wdi_data.length;
937
+ if (count_all < <?php echo (int) $option_row->preload_images_count; ?>) {
938
  count = 0;
939
  }
940
  if (count != 0) {
943
  var is_embed = wdi_data[index]['filetype'].indexOf("EMBED_") > -1 ? true : false;
944
  if (typeof wdi_data[index] != "undefined") {
945
  if (!is_embed) {
946
+ jQuery("<img/>").attr("src", '<?php echo esc_url(site_url() . '/' . $WD_WDI_UPLOAD_DIR); ?>' + jQuery('<span style="display: block;" />').html(wdi_data[index]["image_url"]).text());
947
  }
948
  }
949
  }
953
  var is_embed = wdi_data[i]['filetype'].indexOf("EMBED_") > -1 ? true : false;
954
  if (typeof wdi_data[index] != "undefined") {
955
  if (!is_embed) {
956
+ jQuery("<img/>").attr("src", '<?php echo esc_url(site_url() . '/' . $WD_WDI_UPLOAD_DIR); ?>' + jQuery('<span style="display: block;" />').html(wdi_data[i]["image_url"]).text());
957
  }
958
  }
959
  }
965
  if (!jQuery.fullscreen.isFullScreen()) {
966
  jQuery(".wdi_resize-full").show();
967
  jQuery(".wdi_resize-full").attr("class", "wdi_ctrl_btn wdi_resize-full tenweb-i tenweb-i-expand");
968
+ jQuery(".wdi_resize-full").attr("title", "<?php _e('Maximize', "wd-instagram-feed"); ?>");
969
  jQuery(".wdi_fullscreen").attr("class", "wdi_ctrl_btn wdi_fullscreen tenweb-i tenweb-i-arrows-out");
970
+ jQuery(".wdi_fullscreen").attr("title", "<?php _e('Fullscreen', "wd-instagram-feed"); ?>");
971
  }
972
  }
973
  }
974
  var comment_container_width = 0;
975
  if (jQuery(".wdi_comment_container").hasClass("wdi_open")) {
976
+ comment_container_width = <?php echo floatval($theme_row->lightbox_comment_width); ?>;
977
  }
978
  if (comment_container_width > jQuery(window).width()) {
979
  comment_container_width = jQuery(window).width();
986
  jQuery(".wdi_spider_popup_close_fullscreen").show();
987
  }
988
 
989
+ if (!(!(jQuery(window).height() > <?php echo floatval($image_height); ?>) || !(<?php echo intval($open_with_fullscreen); ?> != 1))) {
990
  jQuery("#wdi_spider_popup_wrap").css({
991
+ height: <?php echo floatval($image_height); ?>,
992
  top: '50%',
993
+ marginTop: -<?php echo floatval($image_height / 2); ?>,
994
  zIndex: 100000
995
  });
996
 
997
+ jQuery(".wdi_image_container").css({height: (<?php echo floatval($image_height - ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0)); ?>)});
998
 
999
  jQuery(".wdi_popup_image").css({
1000
+ maxHeight: <?php echo floatval($image_height - ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0)); ?>
1001
  });
1002
  jQuery(".wdi_popup_embed").css({
1003
+ height: <?php echo floatval($image_height - ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0)); ?>
1004
  });
1005
  wdi_resize_instagram_post();
1006
  <?php if ($filmstrip_direction == 'vertical') { ?>
1007
+ jQuery(".wdi_filmstrip_container").css({height: <?php echo floatval($image_height); ?>});
1008
+ jQuery(".wdi_filmstrip").css({height: (<?php echo floatval($image_height); ?> - 40)});
1009
  <?php } ?>
1010
+ wdi_popup_current_height = <?php echo floatval($image_height); ?>;
1011
  }
1012
  else {
1013
  jQuery("#wdi_spider_popup_wrap").css({
1016
  marginTop: 0,
1017
  zIndex: 100000
1018
  });
1019
+ jQuery(".wdi_image_container").css({height: (jQuery(window).height() - <?php echo floatval($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>)});
1020
 
1021
  jQuery(".wdi_popup_image").css({
1022
+ maxHeight: jQuery(window).height() - <?php echo floatval($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>
1023
  });
1024
  jQuery(".wdi_popup_embed").css({
1025
+ height: jQuery(window).height() - <?php echo floatval($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>
1026
  });
1027
  wdi_resize_instagram_post();
1028
+ <?php if ( $filmstrip_direction == 'vertical' ) { ?>
1029
  jQuery(".wdi_filmstrip_container").css({height: (jQuery(window).height())});
1030
  jQuery(".wdi_filmstrip").css({height: (jQuery(window).height() - 40)});
1031
  <?php } ?>
1032
  wdi_popup_current_height = jQuery(window).height();
1033
  }
1034
+ if (!(!(jQuery(window).width() >= <?php echo floatval($image_width); ?>) || !(<?php echo intval($open_with_fullscreen); ?> != 1))) {
1035
  jQuery("#wdi_spider_popup_wrap").css({
1036
+ width: <?php echo floatval($image_width); ?>,
1037
  left: '50%',
1038
+ marginLeft: -<?php echo floatval($image_width / 2); ?>,
1039
  zIndex: 100000
1040
  });
1041
+ jQuery(".wdi_image_wrap").css({width: <?php echo floatval($image_width); ?> - comment_container_width});
1042
+ jQuery(".wdi_image_container").css({width: (<?php echo floatval($image_width - ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0)); ?> - comment_container_width)});
1043
 
1044
  jQuery(".wdi_popup_image").css({
1045
+ maxWidth: <?php echo floatval($image_width - ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0)); ?> - comment_container_width
1046
  });
1047
  jQuery(".wdi_popup_embed").css({
1048
+ width: <?php echo floatval($image_width - ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0)); ?> - comment_container_width
1049
  });
1050
  wdi_resize_instagram_post();
1051
  <?php if ($filmstrip_direction == 'horizontal') { ?>
1052
+ jQuery(".wdi_filmstrip_container").css({width: <?php echo floatval($image_width); ?> - comment_container_width});
1053
+ jQuery(".wdi_filmstrip").css({width: (<?php echo floatval($image_width); ?> - comment_container_width- 40)});
1054
  <?php } ?>
1055
+ wdi_popup_current_width = <?php echo floatval($image_width); ?>;
1056
  }
1057
  else {
1058
  jQuery("#wdi_spider_popup_wrap").css({
1062
  zIndex: 100000
1063
  });
1064
  jQuery(".wdi_image_wrap").css({width: (jQuery(window).width() - comment_container_width)});
1065
+ jQuery(".wdi_image_container").css({width: (jQuery(window).width() - <?php echo floatval($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?> - comment_container_width)});
1066
 
1067
  jQuery(".wdi_popup_image").css({
1068
+ maxWidth: jQuery(window).width() - <?php echo floatval($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?> - comment_container_width
1069
  });
1070
  jQuery(".wdi_popup_embed").css({
1071
+ width: jQuery(window).width() - <?php echo floatval($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?> - comment_container_width
1072
  });
1073
  wdi_resize_instagram_post();
1074
+ <?php if ( $filmstrip_direction == 'horizontal' ) { ?>
1075
  jQuery(".wdi_filmstrip_container").css({width: (jQuery(window).width() - comment_container_width)});
1076
  jQuery(".wdi_filmstrip").css({width: (jQuery(window).width() - comment_container_width - 40)});
1077
  <?php } ?>
1079
  }
1080
  /* Set watermark container size.*/
1081
  wdi_change_watermark_container();
1082
+ if (!(!(jQuery(window).height() > <?php echo floatval($image_height - 2 * $theme_row->lightbox_close_btn_top); ?>) || !(jQuery(window).width() >= <?php echo floatval($image_width - 2 * $theme_row->lightbox_close_btn_right); ?>) || !(<?php echo intval($open_with_fullscreen); ?> != 1))) {
1083
  jQuery(".wdi_spider_popup_close_fullscreen").attr("class", "wdi_spider_popup_close");
1084
  }
1085
  else {
1098
  }
1099
  });
1100
  /* Popup current width/height.*/
1101
+ var wdi_popup_current_width = <?php echo floatval($image_width); ?>;
1102
+ var wdi_popup_current_height = <?php echo floatval($image_height); ?>;
1103
  /* Open/close comments.*/
1104
  function wdi_comment() {
1105
 
1110
  if (!border_width) {
1111
  border_width = 0;
1112
  }
1113
+ jQuery(".wdi_comment_container").animate({<?php echo esc_html($theme_row->lightbox_comment_pos); ?>: -jQuery(".wdi_comment_container").width() - border_width}, 500);
1114
  jQuery(".wdi_image_wrap").animate({
1115
+ <?php echo esc_html($theme_row->lightbox_comment_pos); ?>: 0,
1116
  width: jQuery("#wdi_spider_popup_wrap").width()
1117
  }, 500);
1118
  jQuery(".wdi_image_container").animate({
1119
+ width: jQuery("#wdi_spider_popup_wrap").width() - <?php echo floatval($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>}, 500);
1120
  jQuery(".wdi_popup_image").animate({
1121
+ maxWidth: jQuery("#wdi_spider_popup_wrap").width() - <?php echo floatval($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>
1122
  }, {
1123
  duration: 500,
1124
  complete: function () { wdi_change_watermark_container(); }
1125
  });
1126
  jQuery(".wdi_popup_embed").animate({
1127
+ width: jQuery("#wdi_spider_popup_wrap").width() - <?php echo floatval($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>
1128
  }, {
1129
  duration: 500,
1130
  complete: function () {
1131
  wdi_resize_instagram_post();
1132
  wdi_change_watermark_container(); }
1133
  });
1134
+ jQuery(".wdi_filmstrip_container").animate({<?php echo esc_html($width_or_height); ?>: jQuery(".wdi_spider_popup_wrap").<?php echo esc_html($width_or_height); ?>()}, 500);
1135
+ jQuery(".wdi_filmstrip").animate({<?php echo esc_html($width_or_height); ?>: jQuery(".wdi_spider_popup_wrap").<?php echo esc_html($width_or_height); ?>() - 40}, 500);
1136
  /* Set filmstrip initial position.*/
1137
  wdi_set_filmstrip_pos(jQuery(".wdi_spider_popup_wrap").width() - 40);
1138
  jQuery(".wdi_comment_container").attr("class", "wdi_comment_container wdi_close");
1139
+ jQuery(".wdi_comment").attr("title", "<?php _e('Show Comments', "wd-instagram-feed"); ?>");
1140
  jQuery(".wdi_spider_popup_close_fullscreen").show();
1141
  }
1142
  else {
1143
  /* Open comment.*/
1144
+ var comment_container_width = <?php echo floatval($theme_row->lightbox_comment_width); ?>;
1145
  if (comment_container_width > jQuery(window).width()) {
1146
  comment_container_width = jQuery(window).width();
1147
  jQuery(".wdi_comment_container").css({
1156
  else {
1157
  jQuery(".wdi_spider_popup_close_fullscreen").show();
1158
  }
1159
+ jQuery(".wdi_comment_container").animate({<?php echo esc_html($theme_row->lightbox_comment_pos); ?>: 0}, 500);
1160
  jQuery(".wdi_image_wrap").animate({
1161
+ <?php echo esc_html($theme_row->lightbox_comment_pos); ?>: jQuery(".wdi_comment_container").width(),
1162
  width: jQuery("#wdi_spider_popup_wrap").width() - jQuery(".wdi_comment_container").width()}, 500);
1163
  jQuery(".wdi_image_container").animate({
1164
+ width: jQuery("#wdi_spider_popup_wrap").width() - <?php echo floatval($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?> - jQuery(".wdi_comment_container").width()}, 500);
1165
  jQuery(".wdi_popup_image").animate({
1166
+ maxWidth: jQuery("#wdi_spider_popup_wrap").width() - jQuery(".wdi_comment_container").width() - <?php echo floatval($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>
1167
  }, {
1168
  duration: 500,
1169
  complete: function () { wdi_change_watermark_container(); }
1170
  });
1171
  jQuery(".wdi_popup_embed").animate({
1172
+ width: jQuery("#wdi_spider_popup_wrap").width() - jQuery(".wdi_comment_container").width() - <?php echo floatval($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>
1173
  }, {
1174
  duration: 500,
1175
  complete: function () {
1176
  wdi_resize_instagram_post();
1177
  wdi_change_watermark_container(); }
1178
  });
1179
+ jQuery(".wdi_filmstrip_container").css({<?php echo esc_html($width_or_height); ?>: jQuery("#wdi_spider_popup_wrap").<?php echo esc_html($width_or_height); ?>() - <?php echo floatval($filmstrip_direction == 'vertical' ? 0 : 'jQuery(".wdi_comment_container").width()'); ?>});
1180
+ jQuery(".wdi_filmstrip").animate({<?php echo esc_html($width_or_height); ?>: jQuery(".wdi_filmstrip_container").<?php echo esc_html($width_or_height); ?>() - 40}, 500);
1181
  /* Set filmstrip initial position.*/
1182
+ wdi_set_filmstrip_pos(jQuery(".wdi_filmstrip_container").<?php echo esc_html($width_or_height); ?>() - 40);
1183
  jQuery(".wdi_comment_container").attr("class", "wdi_comment_container wdi_open");
1184
+ jQuery(".wdi_comment").attr("title", "<?php _e('Hide Comments', "wd-instagram-feed"); ?>");
1185
  /* Load comments.*/
1186
 
1187
  var cur_image_key = parseInt(jQuery("#wdi_current_image_key").val());
1199
  }
1200
 
1201
  jQuery(document).ready(function () {
 
 
 
 
 
 
 
 
1202
  <?php
1203
  if ($image_right_click) {
1204
  ?>
1231
  var wdi_click = isMobile ? 'touchend' : 'click';
1232
 
1233
  /*Carousel Media*/
1234
+ jQuery("body").on(wdi_click, ".wdi_carousel_btn_container span", function () {
1235
+ if(jQuery("video.carousel_media.active").length){
1236
+ jQuery("video.carousel_media.active").get(0).pause();
1237
+ }
1238
  var id = jQuery(this).data("id");
1239
  jQuery(this).closest(".wdi_carousel_btn_container").find("span").removeClass("active");
1240
  jQuery(this).addClass("active");
1288
  }
1289
  }
1290
  }
1291
+ /* Set image container height. */
1292
+ <?php if ( $filmstrip_direction == 'horizontal' ) { ?>
1293
+ jQuery(".wdi_image_container").height(jQuery(".wdi_image_wrap").height() - <?php echo floatval($image_filmstrip_height); ?>);
1294
  jQuery(".wdi_image_container").width(jQuery(".wdi_image_wrap").width());
 
 
1295
  <?php }
1296
  else {
1297
  ?>
1298
  jQuery(".wdi_image_container").height(jQuery(".wdi_image_wrap").height());
1299
+ jQuery(".wdi_image_container").width(jQuery(".wdi_image_wrap").width() - <?php echo floatval($image_filmstrip_width); ?>);
 
1300
  <?php
1301
  } ?>
 
 
 
 
 
 
 
 
1302
  var mousewheelevt = (/Firefox/i.test(navigator.userAgent)) ? "DOMMouseScroll" : "mousewheel" /*FF doesn't recognize mousewheel as of FF3.x*/
1303
  jQuery('.wdi_filmstrip').on(mousewheelevt, function(e) {
1304
  var evt = window.event || e; /* Equalize event object.*/
1315
  }
1316
  });
1317
 
 
1318
  jQuery(".wdi_filmstrip_right").on(wdi_click, function () {
1319
  jQuery( ".wdi_filmstrip_thumbnails" ).stop(true, false);
1320
+ if (jQuery(".wdi_filmstrip_thumbnails").position().<?php echo esc_html($left_or_top); ?> >= -(jQuery(".wdi_filmstrip_thumbnails").<?php echo esc_html($width_or_height); ?>() - jQuery(".wdi_filmstrip").<?php echo esc_html($width_or_height); ?>())) {
 
1321
  jQuery(".wdi_filmstrip_left").css({opacity: 1, filter: "Alpha(opacity=100)"});
1322
+ if (jQuery(".wdi_filmstrip_thumbnails").position().<?php echo esc_html($left_or_top); ?>
1323
+ < -(jQuery(".wdi_filmstrip_thumbnails").<?php echo esc_html($width_or_height); ?>() - jQuery(".wdi_filmstrip").<?php echo esc_html($width_or_height); ?>() - <?php echo floatval($filmstrip_thumb_margin_hor + $image_filmstrip_width); ?>)) {
1324
+ jQuery(".wdi_filmstrip_thumbnails").animate({<?php echo esc_html($left_or_top); ?>: -(jQuery(".wdi_filmstrip_thumbnails").<?php echo esc_html($width_or_height); ?>() - jQuery(".wdi_filmstrip").<?php echo esc_html($width_or_height); ?>())}, 500, 'linear');
1325
  }
1326
  else {
1327
+ jQuery(".wdi_filmstrip_thumbnails").animate({<?php echo esc_html($left_or_top); ?>: (jQuery(".wdi_filmstrip_thumbnails").position().<?php echo esc_html($left_or_top); ?> - <?php echo floatval($filmstrip_thumb_margin_hor + $image_filmstrip_width); ?>)}, 500, 'linear');
1328
  }
1329
  }
1330
  /* Disable right arrow.*/
1333
 
1334
  jQuery(".wdi_filmstrip_left").on(wdi_click, function () {
1335
  jQuery( ".wdi_filmstrip_thumbnails" ).stop(true, false);
1336
+ if ((jQuery(".wdi_filmstrip_thumbnails").position().<?php echo esc_html($left_or_top); ?>) < 0) {
1337
  jQuery(".wdi_filmstrip_right").css({opacity: 1, filter: "Alpha(opacity=100)"});
1338
+ if (jQuery(".wdi_filmstrip_thumbnails").position().<?php echo esc_html($left_or_top); ?> > - <?php echo floatval($filmstrip_thumb_margin_hor + $image_filmstrip_width); ?>) {
1339
+ jQuery(".wdi_filmstrip_thumbnails").animate({<?php echo esc_html($left_or_top); ?>: 0}, 500, 'linear');
1340
  }
1341
  else {
1342
+ jQuery(".wdi_filmstrip_thumbnails").animate({<?php echo esc_html($left_or_top); ?>: (jQuery(".wdi_filmstrip_thumbnails").position().<?php echo esc_html($left_or_top); ?> + <?php echo floatval($image_filmstrip_width + $filmstrip_thumb_margin_hor); ?>)}, 500, 'linear');
1343
  }
1344
  }
1345
+ /* Disable left arrow. */
1346
  checkNeedToDisableLeftArrow();
1347
  });
1348
 
1349
  /* Set filmstrip initial position.*/
1350
+ wdi_set_filmstrip_pos(jQuery(".wdi_filmstrip").<?php echo esc_html($width_or_height); ?>());
1351
  /* Show/hide image title/description.*/
1352
  jQuery(".wdi_info").on(wdi_click, function() {
1353
  if (jQuery(".wdi_image_info_container1").css("display") == 'none') {
1354
  jQuery(".wdi_image_info_container1").css("display", "table-cell");
1355
+ jQuery(".wdi_info").attr("title", "<?php _e('Hide info', "wd-instagram-feed"); ?>");
 
 
 
 
 
 
 
 
 
1356
 
1357
+ if(!jQuery('.wdi_image_info').hasClass('mCustomScrollbar')){
1358
+ var wdi_desc_max_height = <?php echo floatval($image_height - ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0)); ?> -jQuery(".wdi_ctrl_btn_container").height()-parseInt(jQuery('.wdi_image_info').css('margin-bottom'))-parseInt(jQuery('.wdi_image_info').css('padding-bottom'));
1359
+ jQuery('.wdi_image_info').css('max-height',wdi_desc_max_height+"px");
1360
+ jQuery('.wdi_image_info').mCustomScrollbar({scrollInertia: 250});
1361
+ }
1362
  }
1363
  else {
1364
  jQuery(".wdi_image_info_container1").css("display", "none");
1365
+ jQuery(".wdi_info").attr("title", "<?php _e('Show info', "wd-instagram-feed"); ?>");
1366
  }
 
 
1367
  });
1368
  /* Show/hide image rating.*/
1369
  jQuery(".wdi_rate").on(wdi_click, function() {
1370
  if (jQuery(".wdi_image_rate_container1").css("display") == 'none') {
1371
  jQuery(".wdi_image_rate_container1").css("display", "table-cell");
1372
+ jQuery(".wdi_rate").attr("title", "<?php _e('Hide rating', "wd-instagram-feed"); ?>");
1373
  }
1374
  else {
1375
  jQuery(".wdi_image_rate_container1").css("display", "none");
1376
+ jQuery(".wdi_rate").attr("title", "<?php _e('Show rating', "wd-instagram-feed"); ?>");
1377
  }
1378
  });
1379
  /* Open/close comments.*/
1397
  jQuery(".wdi_image_info").animate({top: 0}, 500);
1398
  <?php
1399
  }
 
1400
  ?>
1401
+ jQuery(".wdi_ctrl_btn_container").animate({<?php echo esc_html($theme_row->lightbox_ctrl_btn_pos); ?>: '-' + jQuery(".wdi_ctrl_btn_container").height() - 16}, 500);
1402
+ jQuery(".wdi_carousel_btn_container").animate({<?php echo esc_html($theme_row->lightbox_ctrl_btn_pos); ?>: '40px'}, 500);
1403
  jQuery(".wdi_toggle_container").animate({
1404
+ <?php echo esc_html($theme_row->lightbox_ctrl_btn_pos); ?>: 0
1405
  }, {
1406
  duration: 500,
1407
  complete: function () { jQuery(".wdi_toggle_container i").attr("class", "wdi_toggle_btn tenweb-i " + wdi_close_toggle_btn_class) }
1422
  }
1423
 
1424
  ?>
1425
+ jQuery(".wdi_ctrl_btn_container").animate({<?php echo esc_html($theme_row->lightbox_ctrl_btn_pos); ?>: 0}, 500);
1426
+ jQuery(".wdi_carousel_btn_container").animate({<?php echo esc_html($theme_row->lightbox_ctrl_btn_pos); ?>: jQuery(".wdi_ctrl_btn_container").height() + 25}, 500);
1427
  jQuery(".wdi_toggle_container").animate({
1428
+ <?php echo esc_html($theme_row->lightbox_ctrl_btn_pos); ?>: jQuery(".wdi_ctrl_btn_container").height() + 16
1429
  }, {
1430
  duration: 500,
1431
  complete: function () { jQuery(".wdi_toggle_container i").attr("class", "wdi_toggle_btn tenweb-i " + wdi_open_toggle_btn_class) }
1432
  });
1433
  }
 
 
1434
  //close share buttons popup if open
1435
  jQuery('.wdi_share_btns').removeClass('wdi_share_toggler');
1436
  jQuery('.wdi_share_caret').removeClass('wdi_share_toggler');
1442
  comment_container_width = jQuery(".wdi_comment_container").width();
1443
  }
1444
  if (jQuery(".wdi_resize-full").hasClass("tenweb-i-compress")) {
1445
+ if (jQuery(window).width() > <?php echo floatval($image_width); ?>) {
1446
+ wdi_popup_current_width = <?php echo floatval($image_width); ?>;
1447
  }
1448
+ if (jQuery(window).height() > <?php echo floatval($image_height); ?>) {
1449
+ wdi_popup_current_height = <?php echo floatval($image_height); ?>;
1450
  }
1451
+ /* Minimize. */
1452
  jQuery("#wdi_spider_popup_wrap").animate({
1453
  width: wdi_popup_current_width,
1454
  height: wdi_popup_current_height,
1459
  zIndex: 100000
1460
  }, 500);
1461
  jQuery(".wdi_image_wrap").animate({width: wdi_popup_current_width - comment_container_width}, 500);
1462
+ jQuery(".wdi_image_container").animate({height: wdi_popup_current_height - <?php echo floatval($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>, width: wdi_popup_current_width - comment_container_width - <?php echo floatval($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>}, 500);
1463
  jQuery(".wdi_popup_image").animate({
1464
+ maxWidth: wdi_popup_current_width - comment_container_width - <?php echo floatval($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>,
1465
+ maxHeight: wdi_popup_current_height - <?php echo floatval($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>
1466
  }, {
1467
  duration: 500,
1468
  complete: function () {
1475
  }
1476
  });
1477
  jQuery(".wdi_popup_embed").animate({
1478
+ width: wdi_popup_current_width - comment_container_width - <?php echo floatval($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>,
1479
+ height: wdi_popup_current_height - <?php echo floatval($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>
1480
  }, {
1481
  duration: 500,
1482
  complete: function () {
1489
  }
1490
  }
1491
  });
1492
+ jQuery(".wdi_filmstrip_container").animate({<?php echo esc_html($width_or_height); ?>: wdi_popup_current_<?php echo esc_html($width_or_height); ?> - <?php echo ($filmstrip_direction == 'horizontal' ? 'comment_container_width' : 0); ?>}, 500);
1493
+ jQuery(".wdi_filmstrip").animate({<?php echo esc_html($width_or_height); ?>: wdi_popup_current_<?php echo esc_html($width_or_height); ?> - <?php echo ($filmstrip_direction == 'horizontal' ? 'comment_container_width' : 0); ?> - 40}, 500);
1494
  /* Set filmstrip initial position.*/
1495
+ wdi_set_filmstrip_pos(wdi_popup_current_<?php echo esc_html($width_or_height); ?> - 40);
1496
  jQuery(".wdi_resize-full").attr("class", "wdi_ctrl_btn wdi_resize-full tenweb-i tenweb-i-expand");
1497
+ jQuery(".wdi_resize-full").attr("title", "<?php _e('Maximize', "wd-instagram-feed"); ?>");
1498
  }
1499
  else {
1500
  wdi_popup_current_width = jQuery(window).width();
1501
  wdi_popup_current_height = jQuery(window).height();
1502
+ /* Maximize. */
1503
  jQuery("#wdi_spider_popup_wrap").animate({
1504
  width: jQuery(window).width(),
1505
  height: jQuery(window).height(),
1509
  zIndex: 100000
1510
  }, 500);
1511
  jQuery(".wdi_image_wrap").animate({width: (jQuery(window).width() - comment_container_width)}, 500);
1512
+ jQuery(".wdi_image_container").animate({height: (wdi_popup_current_height - <?php echo floatval($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>), width: wdi_popup_current_width - comment_container_width - <?php echo floatval($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>}, 500);
1513
  jQuery(".wdi_popup_image").animate({
1514
+ maxWidth: jQuery(window).width() - comment_container_width - <?php echo floatval($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>,
1515
+ maxHeight: jQuery(window).height() - <?php echo floatval($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>
1516
  }, {
1517
  duration: 500,
1518
  complete: function () { wdi_change_watermark_container(); }
1519
+ });
1520
  jQuery(".wdi_popup_embed").animate({
1521
+ width: jQuery(window).width() - comment_container_width - <?php echo floatval($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>,
1522
+ height: jQuery(window).height() - <?php echo floatval($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>
1523
+ },
1524
+ {
1525
  duration: 500,
1526
  complete: function () {
1527
  wdi_resize_instagram_post();
1528
+ wdi_change_watermark_container();
1529
+ }
1530
+ });
1531
+ jQuery(".wdi_filmstrip_container").animate({<?php echo esc_html($width_or_height); ?>: jQuery(window).<?php echo esc_html($width_or_height); ?>() - <?php echo ($filmstrip_direction == 'horizontal' ? 'comment_container_width' : 0); ?>}, 500);
1532
+ jQuery(".wdi_filmstrip").animate({<?php echo esc_html($width_or_height); ?>: jQuery(window).<?php echo esc_html($width_or_height); ?>() - <?php echo ($filmstrip_direction == 'horizontal' ? 'comment_container_width' : 0); ?> - 40}, 500);
1533
  /* Set filmstrip initial position.*/
1534
+ wdi_set_filmstrip_pos(jQuery(window).<?php echo esc_html($width_or_height); ?>() - <?php echo ($filmstrip_direction == 'horizontal' ? 'comment_container_width' : 0); ?> - 40);
1535
  jQuery(".wdi_resize-full").attr("class", "wdi_ctrl_btn wdi_resize-full tenweb-i tenweb-i-compress");
1536
+ jQuery(".wdi_resize-full").attr("title", "<?php _e('Restore', "wd-instagram-feed"); ?>");
1537
  jQuery(".wdi_spider_popup_close").attr("class", "wdi_ctrl_btn wdi_spider_popup_close_fullscreen");
1538
  }
1539
  });
1545
  comment_container_width = jQuery(".wdi_comment_container").width();
1546
  }
1547
  function wdi_exit_fullscreen() {
1548
+ if (jQuery(window).width() > <?php echo floatval($image_width); ?>) {
1549
+ wdi_popup_current_width = <?php echo floatval($image_width); ?>;
1550
  }
1551
+ if (jQuery(window).height() > <?php echo floatval($image_height); ?>) {
1552
+ wdi_popup_current_height = <?php echo floatval($image_height); ?>;
1553
  }
1554
  <?php
1555
  /* "Full width lightbox" sets yes.*/
1571
  zIndex: 100000
1572
  });
1573
  jQuery(".wdi_image_wrap").css({width: wdi_popup_current_width - comment_container_width});
1574
+ jQuery(".wdi_image_container").css({height: wdi_popup_current_height - <?php echo floatval($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>, width: wdi_popup_current_width - comment_container_width - <?php echo floatval($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>});
1575
 
 
 
1576
  jQuery(".wdi_popup_image").css({
1577
+ maxWidth: wdi_popup_current_width - comment_container_width - <?php echo floatval($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>,
1578
+ maxHeight: wdi_popup_current_height - <?php echo floatval($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>
1579
  });
1580
  jQuery(".wdi_popup_embed").css({
1581
+ width: wdi_popup_current_width - comment_container_width - <?php echo floatval($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>,
1582
+ height: wdi_popup_current_height - <?php echo floatval($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>
1583
  });
1584
  wdi_resize_instagram_post();
1585
+ /* Set watermark container size. */
1586
  wdi_change_watermark_container();
1587
+ jQuery(".wdi_filmstrip_container").css({<?php echo esc_html($width_or_height); ?>: wdi_popup_current_<?php echo esc_html($width_or_height); ?> - <?php echo ($filmstrip_direction == 'horizontal' ? 'comment_container_width' : 0); ?>});
1588
+ jQuery(".wdi_filmstrip").css({<?php echo esc_html($width_or_height); ?>: wdi_popup_current_<?php echo esc_html($width_or_height); ?> - <?php echo ($filmstrip_direction == 'horizontal' ? 'comment_container_width' : 0); ?>- 40});
1589
+ /* Set filmstrip initial position. */
1590
+ wdi_set_filmstrip_pos(wdi_popup_current_<?php echo esc_html($width_or_height); ?> - 40);
1591
  jQuery(".wdi_resize-full").show();
1592
  jQuery(".wdi_resize-full").attr("class", "wdi_ctrl_btn wdi_resize-full tenweb-i tenweb-i-expand");
1593
+ jQuery(".wdi_resize-full").attr("title", "<?php _e('Maximize', "wd-instagram-feed"); ?>");
1594
  jQuery(".wdi_fullscreen").attr("class", "wdi_ctrl_btn wdi_fullscreen tenweb-i tenweb-i-arrows-out");
1595
+ jQuery(".wdi_fullscreen").attr("title", "<?php _e('Fullscreen', "wd-instagram-feed"); ?>");
1596
  if (jQuery("#wdi_spider_popup_wrap").width() < jQuery(window).width()) {
1597
  if (jQuery("#wdi_spider_popup_wrap").height() < jQuery(window).height()) {
1598
  jQuery(".wdi_spider_popup_close_fullscreen").attr("class", "wdi_spider_popup_close");
1623
  zIndex: 100000
1624
  });
1625
  jQuery(".wdi_image_wrap").css({width: screen_width - comment_container_width});
1626
+ jQuery(".wdi_image_container").css({height: (screen_height - <?php echo floatval($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>), width: screen_width - comment_container_width - <?php echo floatval($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>});
 
1627
  jQuery(".wdi_popup_image").css({
1628
+ maxWidth: (screen_width - comment_container_width - <?php echo floatval($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>),
1629
+ maxHeight: (screen_height - <?php echo floatval($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>)
1630
  });
1631
 
1632
  jQuery(".wdi_popup_embed").css({
1633
+ width: (screen_width - comment_container_width - <?php echo floatval($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>),
1634
+ height: (screen_height - <?php echo floatval($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>)
1635
  });
1636
 
1637
  wdi_resize_instagram_post();
1638
 
1639
  /* Set watermark container size.*/
1640
  wdi_change_watermark_container();
1641
+ jQuery(".wdi_filmstrip_container").css({<?php echo esc_html($width_or_height); ?>: (screen_<?php echo esc_html($width_or_height); ?> - <?php echo ($filmstrip_direction == 'horizontal' ? 'comment_container_width' : 0); ?>)});
1642
+ jQuery(".wdi_filmstrip").css({<?php echo esc_html($width_or_height); ?>: (screen_<?php echo esc_html($width_or_height); ?> - <?php echo ($filmstrip_direction == 'horizontal' ? 'comment_container_width' : 0); ?> - 40)});
1643
  /* Set filmstrip initial position.*/
1644
+ wdi_set_filmstrip_pos(screen_<?php echo esc_html($width_or_height); ?> - <?php echo ($filmstrip_direction == 'horizontal' ? 'comment_container_width' : 0); ?> - 40);
1645
  jQuery(".wdi_resize-full").hide();
1646
  jQuery(".wdi_fullscreen").attr("class", "wdi_ctrl_btn wdi_fullscreen tenweb-i tenweb-i-compress");
1647
+ jQuery(".wdi_fullscreen").attr("title", "<?php _e('Exit Fullscreen', "wd-instagram-feed"); ?>");
1648
  jQuery(".wdi_spider_popup_close").attr("class", "wdi_ctrl_btn wdi_spider_popup_close_fullscreen");
1649
  /*});
1650
  }*/
1659
 
1660
  /* PLay.*/
1661
  wdi_play();
1662
+ jQuery(".wdi_play_pause").attr("title", "<?php _e('Pause', "wd-instagram-feed"); ?>");
1663
  jQuery(".wdi_play_pause").attr("class", "wdi_ctrl_btn wdi_play_pause tenweb-i tenweb-i-pause");
1664
  }
1665
  else {
1666
  /* Pause.*/
1667
  window.clearInterval(wdi_playInterval);
1668
+ jQuery(".wdi_play_pause").attr("title", "<?php _e('Play', "wd-instagram-feed"); ?>");
1669
  jQuery(".wdi_play_pause").attr("class", "wdi_ctrl_btn wdi_play_pause tenweb-i tenweb-i-play");
1670
  }
1671
  });
1676
  ?>
1677
 
1678
  wdi_play();
1679
+ jQuery(".wdi_play_pause").attr("title", "<?php _e('Pause', "wd-instagram-feed"); ?>");
1680
  jQuery(".wdi_play_pause").attr("class", "wdi_ctrl_btn wdi_play_pause tenweb-i tenweb-i-pause");
1681
  <?php
1682
  }
1685
  <?php
1686
  if ($open_with_fullscreen) {
1687
  ?>
1688
+ wdi_open_with_fullscreen();
1689
  <?php
1690
  }
1691
  ?>
1695
 
1696
  //if info is displayed by defult then double trigger
1697
  //info click for displaying it with proper scrollbar
1698
+ if(<?php echo esc_html($popup_info_always_show) ?> ) {
1699
  setTimeout(function(){
1700
  jQuery(".wdi_info").trigger(wdi_click);
1701
  jQuery(".wdi_info").trigger(wdi_click);
1702
  },100);
1703
  }
 
 
1704
  });
1705
  /* Open with fullscreen.*/
1706
  function wdi_open_with_fullscreen() {
1719
  zIndex: 100000
1720
  });
1721
  jQuery(".wdi_image_wrap").css({width: (jQuery(window).width() - comment_container_width)});
1722
+ jQuery(".wdi_image_container").css({height: (wdi_popup_current_height - <?php echo floatval($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>), width: wdi_popup_current_width - comment_container_width - <?php echo floatval($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>});
1723
  jQuery(".wdi_popup_image").css({
1724
+ maxWidth: jQuery(window).width() - comment_container_width - <?php echo floatval($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>,
1725
+ maxHeight: jQuery(window).height() - <?php echo floatval($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>
1726
  }, {
1727
  complete: function () { wdi_change_watermark_container(); }
1728
  });
1729
  jQuery(".wdi_popup_video").css({
1730
+ width: jQuery(window).width() - comment_container_width - <?php echo floatval($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>,
1731
+ height: jQuery(window).height() - <?php echo floatval($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>
1732
  }, {
1733
  complete: function () { wdi_change_watermark_container(); }
1734
  });
1735
  jQuery(".wdi_popup_embed").css({
1736
+ width: jQuery(window).width() - comment_container_width - <?php echo floatval($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>,
1737
+ height: jQuery(window).height() - <?php echo floatval($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>
1738
  }, {
1739
  complete: function () {
1740
  wdi_resize_instagram_post();
1741
  wdi_change_watermark_container(); }
1742
  });
1743
+ jQuery(".wdi_filmstrip_container").css({<?php echo esc_html($width_or_height); ?>: jQuery(window).<?php echo esc_html($width_or_height); ?>() - <?php echo ($filmstrip_direction == 'horizontal' ? 'comment_container_width' : 0); ?>});
1744
+ jQuery(".wdi_filmstrip").css({<?php echo esc_html($width_or_height); ?>: jQuery(window).<?php echo esc_html($width_or_height); ?>() - <?php echo ($filmstrip_direction == 'horizontal' ? 'comment_container_width' : 0); ?> - 40});
1745
  /* Set filmstrip initial position.*/
1746
+ wdi_set_filmstrip_pos(jQuery(window).<?php echo esc_html($width_or_height); ?>() - <?php echo ($filmstrip_direction == 'horizontal' ? 'comment_container_width' : 0); ?> - 40);
1747
 
1748
  jQuery(".wdi_resize-full").attr("class", "wdi_ctrl_btn wdi_resize-full tenweb-i tenweb-i-compress");
1749
+ jQuery(".wdi_resize-full").attr("title", "<?php _e('Restore', "wd-instagram-feed"); ?>");
1750
  jQuery(".wdi_spider_popup_close").attr("class", "wdi_ctrl_btn wdi_spider_popup_close_fullscreen");
1751
  }
1752
 
1781
  top: top_pos
1782
  });
1783
  });
 
 
1784
  wdi_change_watermark_container();
1785
  }
1786
  }
1789
  window.clearInterval(wdi_playInterval);
1790
  wdi_playInterval = setInterval(function () {
1791
  if (!wdi_data[parseInt(jQuery('#wdi_current_image_key').val()) + 1]) {
1792
+ if (<?php echo intval($option_row->enable_loop); ?> == 1) {
1793
+ /* Wrap around. */
1794
  wdi_change_image(parseInt(jQuery('#wdi_current_image_key').val()), 0, wdi_data);
1795
  }
1796
  return;
1797
  }
1798
  wdi_change_image(parseInt(jQuery('#wdi_current_image_key').val()), parseInt(jQuery('#wdi_current_image_key').val()) + 1, wdi_data)
1799
+ }, '<?php echo floatval($slideshow_interval) * 1000; ?>');
1800
  }
1801
  jQuery(window).focus(function() {
 
 
1802
  if (!jQuery(".wdi_ctrl_btn").hasClass("tenweb-i-play")) {
1803
  wdi_play();
1804
  }
 
 
 
 
 
 
 
1805
  });
1806
  jQuery(window).blur(function() {
1807
  event_stack = [];
1810
  wdi_popup_resize();
1811
  })
1812
  });
 
1813
  </script>
1814
  <?php
1815
  die();
frontend/views/imagebrowser.php CHANGED
@@ -16,7 +16,7 @@ class WDI_ImageBrowser_view {
16
  $this->generate_feed_styles($feed_row);
17
  $style = $this->model->theme_row;
18
  $wdi_feed_counter = $this->model->wdi_feed_counter;
19
- $container_class = 'wdi_feed_theme_' . esc_attr($style['id']) . ' wdi_feed_browser_' . esc_attr($style['id']);
20
  $wdi_data_ajax = defined('DOING_AJAX') && DOING_AJAX ? 'data-wdi_ajax=1' : '';
21
  ?>
22
  <div id="wdi_feed_<?php echo esc_attr($wdi_feed_counter) ?>" class="wdi_feed_main_container wdi_layout_ib <?php echo esc_attr($container_class); ?>" <?php echo esc_attr($wdi_data_ajax); ?> >
@@ -30,6 +30,8 @@ class WDI_ImageBrowser_view {
30
  <div id="wdi_feed_<?php echo esc_attr($wdi_feed_counter) ?>_users" class='wdi_feed_users'>
31
  <?php
32
  if ( !empty($user_feed_header_args) ) {
 
 
33
  echo WDILibrary::user_feed_header_info( $user_feed_header_args );
34
  } ?>
35
  </div>
@@ -39,17 +41,17 @@ class WDI_ImageBrowser_view {
39
  ?>
40
  <div id="wdi_pagination" class="wdi_pagination wdi_hidden">
41
  <div class="wdi_pagination_container">
42
- <i id="wdi_first_page" title="<?php echo __('First Page', "wd-instagram-feed") ?>" class="tenweb-i tenweb-i-step-backward wdi_pagination_ctrl wdi_disabled"></i>
43
- <i id="wdi_prev" title="<?php echo __('Previous Page', "wd-instagram-feed") ?>" class="tenweb-i tenweb-i-arrow-left wdi_pagination_ctrl"></i>
44
  <i id="wdi_current_page" class="wdi_pagination_ctrl" style="font-style:normal">1</i>
45
- <i id="wdi_next" title="<?php echo __('Next Page', "wd-instagram-feed") ?>" class="tenweb-i tenweb-i-arrow-right wdi_pagination_ctrl"></i>
46
- <i id="wdi_last_page" title="<?php echo __('Last Page', "wd-instagram-feed") ?>" class="tenweb-i tenweb-i-step-forward wdi_pagination_ctrl wdi_disabled"></i>
47
  </div>
48
  </div>
49
  <?php
50
  }
51
  ?>
52
- <div class="wdi_feed_wrapper <?php echo 'wdi_col_' . esc_attr($feed_row['number_of_columns']) ?>" wdi-res='<?php echo 'wdi_col_' . esc_attr($feed_row['number_of_columns']) ?>'></div>
53
  <div class="wdi_clear"></div>
54
  <?php
55
  switch ($feed_row['feed_display_view']) {
@@ -59,7 +61,7 @@ class WDI_ImageBrowser_view {
59
  <div class="wdi_load_more_container">
60
  <div class="wdi_load_more_wrap">
61
  <div class="wdi_load_more_wrap_inner">
62
- <div class="wdi_load_more_text"><?php echo __('Load More', "wd-instagram-feed"); ?></div>
63
  </div>
64
  </div>
65
  </div></div><?php
@@ -70,11 +72,11 @@ class WDI_ImageBrowser_view {
70
  ?>
71
  <div id="wdi_pagination" class="wdi_pagination wdi_hidden">
72
  <div class="wdi_pagination_container">
73
- <i id="wdi_first_page" title="<?php echo __('First Page', "wd-instagram-feed") ?>" class="tenweb-i tenweb-i-step-backward wdi_pagination_ctrl wdi_disabled"></i>
74
- <i id="wdi_prev" title="<?php echo __('Previous Page', "wd-instagram-feed") ?>" class="tenweb-i tenweb-i-arrow-left wdi_pagination_ctrl"></i>
75
  <i id="wdi_current_page" class="wdi_pagination_ctrl" style="font-style:normal">1</i>
76
- <i id="wdi_next" title="<?php echo __('Next Page', "wd-instagram-feed") ?>" class="tenweb-i tenweb-i-arrow-right wdi_pagination_ctrl"></i>
77
- <i id="wdi_last_page" title="<?php echo __('Last Page', "wd-instagram-feed") ?>" class="tenweb-i tenweb-i-step-forward wdi_pagination_ctrl wdi_disabled"></i>
78
  </div>
79
  </div>
80
  <?php
@@ -117,7 +119,7 @@ class WDI_ImageBrowser_view {
117
 
118
  if(WDILibrary::is_ajax() || WDILibrary::elementor_is_active()) {
119
  wdi_load_frontend_scripts_ajax();
120
- echo '<style id="generate_feed_styles-inline-css">' . $this->generate_feed_styles( $feed_row, TRUE ) .'</style>';
121
  }
122
  }
123
 
@@ -136,7 +138,7 @@ class WDI_ImageBrowser_view {
136
  return;
137
  }
138
 
139
- echo '<style>' . $generator->get_css() . '</style>';
140
  }
141
 
142
  /**
@@ -149,9 +151,10 @@ class WDI_ImageBrowser_view {
149
  $theme_path_parts = pathinfo($file_url);
150
 
151
  if(WDILibrary::is_ajax() || WDILibrary::elementor_is_active()) {
152
- echo sprintf("<link rel='stylesheet' id='%s' href='%s' type='text/css' media='all' />", esc_html($theme_path_parts['basename']), esc_url($file_url . '?key=' . $generator->get_file_key()));
153
- } else {
154
- wp_enqueue_style($theme_path_parts['basename'], $file_url . '?key=' . $generator->get_file_key());
 
155
  }
156
 
157
  return true;
@@ -168,7 +171,7 @@ class WDI_ImageBrowser_view {
168
  ob_start();
169
  ?>
170
  #wdi_feed_<?php echo esc_attr($wdi_feed_counter) ?> .wdi_feed_header {
171
- display: <?php echo (esc_html($feed_row['display_header'])=='1')? 'block' : 'none'?>; /*if display-header is true display:block*/
172
  }
173
 
174
  <?php
@@ -189,17 +192,17 @@ class WDI_ImageBrowser_view {
189
  }
190
 
191
  #wdi_feed_<?php echo esc_attr($wdi_feed_counter)?> .wdi_media_info {
192
- display: <?php echo (esc_html($feed_row['display_user_post_follow_number']) == '1') ? 'block' : 'none'; ?>
193
  }
194
 
195
  #wdi_feed_<?php echo esc_attr($wdi_feed_counter) ?> .wdi_feed_item {
196
- width: <?php echo $colNum.'%'?>; /*thumbnail_size*/
197
  }
198
 
199
  <?php if($feed_row['disable_mobile_layout']=="0") { ?>
200
  @media screen and (min-width: 800px) and (max-width: 1024px) {
201
  #wdi_feed_<?php echo esc_attr($wdi_feed_counter)?> .wdi_feed_item {
202
- width: <?php echo (esc_html($colNum)<33.33) ? '33.333333333333%' : esc_html($colNum).'%'?>; /*thumbnail_size*/
203
  margin: 0;
204
  display: inline-block;
205
  vertical-align: top;
@@ -230,7 +233,7 @@ class WDI_ImageBrowser_view {
230
 
231
  @media screen and (max-width: 480px) {
232
  #wdi_feed_<?php echo esc_attr($wdi_feed_counter)?> .wdi_feed_item {
233
- width: <?php echo (esc_html($colNum<100)) ? '100%' : esc_html($colNum).'%'?>; /*thumbnail_size*/
234
  margin: 0;
235
  display: inline-block;
236
  overflow: hidden;
16
  $this->generate_feed_styles($feed_row);
17
  $style = $this->model->theme_row;
18
  $wdi_feed_counter = $this->model->wdi_feed_counter;
19
+ $container_class = 'wdi_feed_theme_' . $style['id'] . ' wdi_feed_browser_' . $style['id'];
20
  $wdi_data_ajax = defined('DOING_AJAX') && DOING_AJAX ? 'data-wdi_ajax=1' : '';
21
  ?>
22
  <div id="wdi_feed_<?php echo esc_attr($wdi_feed_counter) ?>" class="wdi_feed_main_container wdi_layout_ib <?php echo esc_attr($container_class); ?>" <?php echo esc_attr($wdi_data_ajax); ?> >
30
  <div id="wdi_feed_<?php echo esc_attr($wdi_feed_counter) ?>_users" class='wdi_feed_users'>
31
  <?php
32
  if ( !empty($user_feed_header_args) ) {
33
+ //WDILibrary::user_feed_header_info function returns fully escaped data
34
+ //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
35
  echo WDILibrary::user_feed_header_info( $user_feed_header_args );
36
  } ?>
37
  </div>
41
  ?>
42
  <div id="wdi_pagination" class="wdi_pagination wdi_hidden">
43
  <div class="wdi_pagination_container">
44
+ <i id="wdi_first_page" title="<?php echo esc_attr(__('First Page', "wd-instagram-feed")) ?>" class="tenweb-i tenweb-i-step-backward wdi_pagination_ctrl wdi_disabled"></i>
45
+ <i id="wdi_prev" title="<?php echo esc_attr(__('Previous Page', "wd-instagram-feed")) ?>" class="tenweb-i tenweb-i-arrow-left wdi_pagination_ctrl"></i>
46
  <i id="wdi_current_page" class="wdi_pagination_ctrl" style="font-style:normal">1</i>
47
+ <i id="wdi_next" title="<?php echo esc_attr(__('Next Page', "wd-instagram-feed")) ?>" class="tenweb-i tenweb-i-arrow-right wdi_pagination_ctrl"></i>
48
+ <i id="wdi_last_page" title="<?php echo esc_attr(__('Last Page', "wd-instagram-feed")) ?>" class="tenweb-i tenweb-i-step-forward wdi_pagination_ctrl wdi_disabled"></i>
49
  </div>
50
  </div>
51
  <?php
52
  }
53
  ?>
54
+ <div class="wdi_feed_wrapper <?php echo esc_attr('wdi_col_' . $feed_row['number_of_columns']) ?>" wdi-res='<?php echo esc_attr('wdi_col_' . $feed_row['number_of_columns']) ?>'></div>
55
  <div class="wdi_clear"></div>
56
  <?php
57
  switch ($feed_row['feed_display_view']) {
61
  <div class="wdi_load_more_container">
62
  <div class="wdi_load_more_wrap">
63
  <div class="wdi_load_more_wrap_inner">
64
+ <div class="wdi_load_more_text"><?php echo esc_html(__('Load More', "wd-instagram-feed")); ?></div>
65
  </div>
66
  </div>
67
  </div></div><?php
72
  ?>
73
  <div id="wdi_pagination" class="wdi_pagination wdi_hidden">
74
  <div class="wdi_pagination_container">
75
+ <i id="wdi_first_page" title="<?php echo esc_attr(__('First Page', "wd-instagram-feed")) ?>" class="tenweb-i tenweb-i-step-backward wdi_pagination_ctrl wdi_disabled"></i>
76
+ <i id="wdi_prev" title="<?php echo esc_attr(__('Previous Page', "wd-instagram-feed")) ?>" class="tenweb-i tenweb-i-arrow-left wdi_pagination_ctrl"></i>
77
  <i id="wdi_current_page" class="wdi_pagination_ctrl" style="font-style:normal">1</i>
78
+ <i id="wdi_next" title="<?php echo esc_attr(__('Next Page', "wd-instagram-feed")) ?>" class="tenweb-i tenweb-i-arrow-right wdi_pagination_ctrl"></i>
79
+ <i id="wdi_last_page" title="<?php echo esc_attr(__('Last Page', "wd-instagram-feed")) ?>" class="tenweb-i tenweb-i-step-forward wdi_pagination_ctrl wdi_disabled"></i>
80
  </div>
81
  </div>
82
  <?php
119
 
120
  if(WDILibrary::is_ajax() || WDILibrary::elementor_is_active()) {
121
  wdi_load_frontend_scripts_ajax();
122
+ echo wp_kses('<style id="generate_feed_styles-inline-css">' . $this->generate_feed_styles( $feed_row, TRUE ) .'</style>', array('style' => array('id' => true)));
123
  }
124
  }
125
 
138
  return;
139
  }
140
 
141
+ echo '<style>' . esc_html($generator->get_css()) . '</style>';
142
  }
143
 
144
  /**
151
  $theme_path_parts = pathinfo($file_url);
152
 
153
  if(WDILibrary::is_ajax() || WDILibrary::elementor_is_active()) {
154
+ echo sprintf("<link rel='stylesheet' id='%s' href='%s' type='text/css' media='all' />", esc_html($theme_path_parts['filename']), esc_url_raw($file_url . '?key=' . $generator->get_file_key()));
155
+ }
156
+ else {
157
+ wp_enqueue_style($theme_path_parts['filename'], $file_url . '?key=' . $generator->get_file_key());
158
  }
159
 
160
  return true;
171
  ob_start();
172
  ?>
173
  #wdi_feed_<?php echo esc_attr($wdi_feed_counter) ?> .wdi_feed_header {
174
+ display: <?php echo (esc_html(($feed_row['display_header']=='1') ? 'block' : 'none'))?>; /*if display-header is true display:block*/
175
  }
176
 
177
  <?php
192
  }
193
 
194
  #wdi_feed_<?php echo esc_attr($wdi_feed_counter)?> .wdi_media_info {
195
+ display: <?php echo (esc_html($feed_row['display_user_post_follow_number'] == '1') ? 'block' : 'none'); ?>
196
  }
197
 
198
  #wdi_feed_<?php echo esc_attr($wdi_feed_counter) ?> .wdi_feed_item {
199
+ width: <?php echo esc_html($colNum).'%'?>; /*thumbnail_size*/
200
  }
201
 
202
  <?php if($feed_row['disable_mobile_layout']=="0") { ?>
203
  @media screen and (min-width: 800px) and (max-width: 1024px) {
204
  #wdi_feed_<?php echo esc_attr($wdi_feed_counter)?> .wdi_feed_item {
205
+ width: <?php echo (esc_html($colNum<33.33 ? '33.333333333333%' : $colNum.'%'))?>; /*thumbnail_size*/
206
  margin: 0;
207
  display: inline-block;
208
  vertical-align: top;
233
 
234
  @media screen and (max-width: 480px) {
235
  #wdi_feed_<?php echo esc_attr($wdi_feed_counter)?> .wdi_feed_item {
236
+ width: <?php echo (esc_html($colNum<100 ? '100%' : esc_html($colNum).'%'))?>; /*thumbnail_size*/
237
  margin: 0;
238
  display: inline-block;
239
  overflow: hidden;
frontend/views/thumbnails.php CHANGED
@@ -16,10 +16,10 @@ class WDI_Thumbnails_view {
16
  $this->generate_feed_styles($feed_row); // @TODO. should be moved to shortcode.php
17
  $style = $this->model->theme_row;
18
  $wdi_feed_counter = $this->model->wdi_feed_counter;
19
- $container_class = 'wdi_feed_theme_' . esc_attr($style['id']) . ' wdi_feed_thumbnail_' . esc_attr($style['id']);
20
  $wdi_data_ajax = defined('DOING_AJAX') && DOING_AJAX ? 'data-wdi_ajax=1' : '';
21
  ?>
22
- <div id="wdi_feed_<?php echo esc_attr($wdi_feed_counter) ?>" class="wdi_feed_main_container wdi_layout_th <?php echo $container_class; ?>" <?php echo $wdi_data_ajax; ?> >
23
  <?php wdi_feed_frontend_messages();?>
24
  <div id="wdi_spider_popup_loading_<?php echo esc_attr($wdi_feed_counter) ?>" class="wdi_spider_popup_loading"></div>
25
  <div id="wdi_spider_popup_overlay_<?php echo esc_attr($wdi_feed_counter) ?>" class="wdi_spider_popup_overlay" onclick="wdi_spider_destroypopup(1000)"></div>
@@ -29,6 +29,8 @@ class WDI_Thumbnails_view {
29
  <div id="wdi_feed_<?php echo esc_attr($wdi_feed_counter) ?>_users" class='wdi_feed_users'>
30
  <?php
31
  if ( !empty($user_feed_header_args) ) {
 
 
32
  echo WDILibrary::user_feed_header_info( $user_feed_header_args );
33
  } ?>
34
  </div>
@@ -36,15 +38,15 @@ class WDI_Thumbnails_view {
36
  <?php if ($feed_row['feed_display_view'] === 'pagination' && $style['pagination_position_vert'] === 'top') { ?>
37
  <div id="wdi_pagination" class="wdi_pagination wdi_hidden">
38
  <div class="wdi_pagination_container">
39
- <i id="wdi_first_page" title="<?php echo __('First Page', "wd-instagram-feed") ?>" class="tenweb-i tenweb-i-step-backward wdi_pagination_ctrl wdi_disabled"></i>
40
- <i id="wdi_prev" title="<?php echo __('Previous Page', "wd-instagram-feed") ?>" class="tenweb-i tenweb-i-arrow-left wdi_pagination_ctrl"></i>
41
  <i id="wdi_current_page" class="wdi_pagination_ctrl" style="font-style:normal">1</i>
42
- <i id="wdi_next" title="<?php echo __('Next Page', "wd-instagram-feed") ?>" class="tenweb-i tenweb-i-arrow-right wdi_pagination_ctrl"></i>
43
- <i id="wdi_last_page" title="<?php echo __('Last Page', "wd-instagram-feed") ?>" class="tenweb-i tenweb-i-step-forward wdi_pagination_ctrl wdi_disabled"></i>
44
  </div>
45
  </div>
46
  <?php } ?>
47
- <div class="wdi_feed_wrapper <?php echo esc_attr('wdi_col_' . $feed_row['number_of_columns']) ?>" wdi-res='<?php echo 'wdi_col_' . esc_attr($feed_row['number_of_columns'])?>'></div>
48
  <div class="wdi_clear"></div>
49
  <?php
50
  switch ($feed_row['feed_display_view']) {
@@ -54,7 +56,7 @@ class WDI_Thumbnails_view {
54
  <div class="wdi_load_more_container">
55
  <div class="wdi_load_more_wrap">
56
  <div class="wdi_load_more_wrap_inner">
57
- <div class="wdi_load_more_text"><?php echo __('Load More', "wd-instagram-feed"); ?></div>
58
  </div>
59
  </div>
60
  </div>
@@ -75,11 +77,11 @@ class WDI_Thumbnails_view {
75
  ?>
76
  <div id="wdi_pagination" class="wdi_pagination wdi_hidden">
77
  <div class="wdi_pagination_container">
78
- <i id="wdi_first_page" title="<?php echo __('First Page', "wd-instagram-feed") ?>" class="tenweb-i tenweb-i-step-backward wdi_disabled wdi_pagination_ctrl"></i>
79
- <i id="wdi_prev" title="<?php echo __('Previous Page', "wd-instagram-feed") ?>" class="tenweb-i tenweb-i-arrow-left wdi_pagination_ctrl"></i>
80
  <i id="wdi_current_page" class="wdi_pagination_ctrl" style="font-style:normal">1</i>
81
- <i id="wdi_next" title="<?php echo __('Next Page', "wd-instagram-feed") ?>" class="tenweb-i tenweb-i-arrow-right wdi_pagination_ctrl"></i>
82
- <i id="wdi_last_page" title="<?php echo __('Last Page', "wd-instagram-feed") ?>" class="tenweb-i tenweb-i-step-forward wdi_pagination_ctrl wdi_disabled"></i>
83
  </div>
84
  </div>
85
  <?php
@@ -122,7 +124,7 @@ class WDI_Thumbnails_view {
122
 
123
  if ( WDILibrary::is_ajax() || WDILibrary::elementor_is_active() ) {
124
  wdi_load_frontend_scripts_ajax();
125
- echo '<style id="generate_feed_styles-inline-css">' . $this->generate_feed_styles( $feed_row, TRUE ) .'</style>';
126
  }
127
  }
128
 
@@ -137,30 +139,34 @@ class WDI_Thumbnails_view {
137
  return;
138
  }
139
 
140
- if($generator->all_views_styles(true, true) === true &&
141
- $this->load_theme_css_file($generator) === true) {
142
  return;
143
  }
144
 
145
- echo '<style>' . $generator->get_css() . '</style>';
146
  }
147
 
148
  /**
 
 
149
  * @param $generator WDI_generate_styles
150
  * @return boolean
151
  * */
152
- private function load_theme_css_file($generator){
153
  $file_url = $generator->get_file_url();
154
- if($file_url !== "") {
155
  $theme_path_parts = pathinfo($file_url);
156
- if(WDILibrary::is_ajax() || WDILibrary::elementor_is_active()) {
157
- echo sprintf("<link rel='stylesheet' id='%s' href='%s' type='text/css' media='all' />",esc_html($theme_path_parts['basename']), esc_url($file_url . '?key=' . $generator->get_file_key()));
158
- }else{
159
- wp_enqueue_style($theme_path_parts['basename'], $file_url . '?key=' . $generator->get_file_key());
 
160
  }
161
- return true;
162
- } else {
163
- return false;
 
 
164
  }
165
  }
166
 
@@ -171,7 +177,7 @@ class WDI_Thumbnails_view {
171
  ob_start();
172
  ?>
173
  #wdi_feed_<?php echo esc_attr($wdi_feed_counter)?> .wdi_feed_header {
174
- display: <?php echo (esc_html($feed_row['display_header'])=='1')? 'block' : 'none'?>; /*if display-header is true display:block*/
175
  }
176
  <?php
177
  if($feed_row['display_user_post_follow_number'] == '1'){
@@ -212,7 +218,6 @@ class WDI_Thumbnails_view {
212
  margin: 0 auto;
213
  background-color: <?php echo esc_html($style['feed_container_bg_color'])?>; /*feed_container_bg_color*/
214
  }
215
-
216
  }
217
 
218
  @media screen and (min-width: 480px) and (max-width: 800px) {
16
  $this->generate_feed_styles($feed_row); // @TODO. should be moved to shortcode.php
17
  $style = $this->model->theme_row;
18
  $wdi_feed_counter = $this->model->wdi_feed_counter;
19
+ $container_class = 'wdi_feed_theme_' . $style['id'] . ' wdi_feed_thumbnail_' . $style['id'];
20
  $wdi_data_ajax = defined('DOING_AJAX') && DOING_AJAX ? 'data-wdi_ajax=1' : '';
21
  ?>
22
+ <div id="wdi_feed_<?php echo esc_attr($wdi_feed_counter) ?>" class="wdi_feed_main_container wdi_layout_th <?php echo esc_attr($container_class); ?>" <?php echo esc_attr($wdi_data_ajax); ?> >
23
  <?php wdi_feed_frontend_messages();?>
24
  <div id="wdi_spider_popup_loading_<?php echo esc_attr($wdi_feed_counter) ?>" class="wdi_spider_popup_loading"></div>
25
  <div id="wdi_spider_popup_overlay_<?php echo esc_attr($wdi_feed_counter) ?>" class="wdi_spider_popup_overlay" onclick="wdi_spider_destroypopup(1000)"></div>
29
  <div id="wdi_feed_<?php echo esc_attr($wdi_feed_counter) ?>_users" class='wdi_feed_users'>
30
  <?php
31
  if ( !empty($user_feed_header_args) ) {
32
+ //WDILibrary::user_feed_header_info function returns fully escaped data
33
+ //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
34
  echo WDILibrary::user_feed_header_info( $user_feed_header_args );
35
  } ?>
36
  </div>
38
  <?php if ($feed_row['feed_display_view'] === 'pagination' && $style['pagination_position_vert'] === 'top') { ?>
39
  <div id="wdi_pagination" class="wdi_pagination wdi_hidden">
40
  <div class="wdi_pagination_container">
41
+ <i id="wdi_first_page" title="<?php echo esc_attr(__('First Page', "wd-instagram-feed")) ?>" class="tenweb-i tenweb-i-step-backward wdi_pagination_ctrl wdi_disabled"></i>
42
+ <i id="wdi_prev" title="<?php echo esc_attr(__('Previous Page', "wd-instagram-feed")) ?>" class="tenweb-i tenweb-i-arrow-left wdi_pagination_ctrl"></i>
43
  <i id="wdi_current_page" class="wdi_pagination_ctrl" style="font-style:normal">1</i>
44
+ <i id="wdi_next" title="<?php echo esc_attr(__('Next Page', "wd-instagram-feed")) ?>" class="tenweb-i tenweb-i-arrow-right wdi_pagination_ctrl"></i>
45
+ <i id="wdi_last_page" title="<?php echo esc_attr(__('Last Page', "wd-instagram-feed")) ?>" class="tenweb-i tenweb-i-step-forward wdi_pagination_ctrl wdi_disabled"></i>
46
  </div>
47
  </div>
48
  <?php } ?>
49
+ <div class="wdi_feed_wrapper <?php echo esc_attr('wdi_col_' . $feed_row['number_of_columns']) ?>" wdi-res='<?php echo esc_attr( 'wdi_col_' . $feed_row['number_of_columns'])?>'></div>
50
  <div class="wdi_clear"></div>
51
  <?php
52
  switch ($feed_row['feed_display_view']) {
56
  <div class="wdi_load_more_container">
57
  <div class="wdi_load_more_wrap">
58
  <div class="wdi_load_more_wrap_inner">
59
+ <div class="wdi_load_more_text"><?php echo esc_html(__('Load More', "wd-instagram-feed")); ?></div>
60
  </div>
61
  </div>
62
  </div>
77
  ?>
78
  <div id="wdi_pagination" class="wdi_pagination wdi_hidden">
79
  <div class="wdi_pagination_container">
80
+ <i id="wdi_first_page" title="<?php echo esc_attr(__('First Page', "wd-instagram-feed")) ?>" class="tenweb-i tenweb-i-step-backward wdi_disabled wdi_pagination_ctrl"></i>
81
+ <i id="wdi_prev" title="<?php echo esc_attr(__('Previous Page', "wd-instagram-feed")) ?>" class="tenweb-i tenweb-i-arrow-left wdi_pagination_ctrl"></i>
82
  <i id="wdi_current_page" class="wdi_pagination_ctrl" style="font-style:normal">1</i>
83
+ <i id="wdi_next" title="<?php echo esc_attr(__('Next Page', "wd-instagram-feed")) ?>" class="tenweb-i tenweb-i-arrow-right wdi_pagination_ctrl"></i>
84
+ <i id="wdi_last_page" title="<?php echo esc_attr(__('Last Page', "wd-instagram-feed")) ?>" class="tenweb-i tenweb-i-step-forward wdi_pagination_ctrl wdi_disabled"></i>
85
  </div>
86
  </div>
87
  <?php
124
 
125
  if ( WDILibrary::is_ajax() || WDILibrary::elementor_is_active() ) {
126
  wdi_load_frontend_scripts_ajax();
127
+ echo wp_kses('<style id="generate_feed_styles-inline-css">' . $this->generate_feed_styles( $feed_row, TRUE ) .'</style>', array('style' => array('id' => true)));
128
  }
129
  }
130
 
139
  return;
140
  }
141
 
142
+ if($generator->all_views_styles(true, true) === true && $this->load_theme_css_file($generator) === true) {
 
143
  return;
144
  }
145
 
146
+ echo '<style>' . esc_html($generator->get_css()) . '</style>';
147
  }
148
 
149
  /**
150
+ * Load theme css file.
151
+ *
152
  * @param $generator WDI_generate_styles
153
  * @return boolean
154
  * */
155
+ private function load_theme_css_file( $generator ) {
156
  $file_url = $generator->get_file_url();
157
+ if ( $file_url !== "" ) {
158
  $theme_path_parts = pathinfo($file_url);
159
+ if ( WDILibrary::is_ajax() || WDILibrary::elementor_is_active() ) {
160
+ echo sprintf("<link rel='stylesheet' id='%s' href='%s' type='text/css' media='all' />", esc_html($theme_path_parts['filename']), esc_url_raw($file_url . '?key=' . $generator->get_file_key()));
161
+ }
162
+ else {
163
+ wp_enqueue_style($theme_path_parts['filename'], $file_url . '?key=' . $generator->get_file_key());
164
  }
165
+
166
+ return TRUE;
167
+ }
168
+ else {
169
+ return FALSE;
170
  }
171
  }
172
 
177
  ob_start();
178
  ?>
179
  #wdi_feed_<?php echo esc_attr($wdi_feed_counter)?> .wdi_feed_header {
180
+ display: <?php echo (esc_html(($feed_row['display_header']=='1') ? 'block' : 'none'))?>; /*if display-header is true display:block*/
181
  }
182
  <?php
183
  if($feed_row['display_user_post_follow_number'] == '1'){
218
  margin: 0 auto;
219
  background-color: <?php echo esc_html($style['feed_container_bg_color'])?>; /*feed_container_bg_color*/
220
  }
 
221
  }
222
 
223
  @media screen and (min-width: 480px) and (max-width: 800px) {
js/gallerybox/wdi_gallery_box.js CHANGED
@@ -168,8 +168,6 @@ var wdi_construct_popup = function (popup, currentFeed, image_rows, current_imag
168
  }
169
  }
170
  thumbnails_html += '<div id="wdi_filmstrip_thumbnail_' + i + '" class="' + class_name + '">' + img_html + '</div>';
171
-
172
-
173
  }
174
 
175
  var html = '' +
168
  }
169
  }
170
  thumbnails_html += '<div id="wdi_filmstrip_thumbnail_' + i + '" class="' + class_name + '">' + img_html + '</div>';
 
 
171
  }
172
 
173
  var html = '' +
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: custom instagram feed, feed, instagram, hashtag, Instagram feed, instagram
4
  Requires at least: 3.9
5
  Requires PHP: 5.2
6
  Tested up to: 5.8
7
- Stable tag: 1.4.30
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -505,6 +505,9 @@ Please make sure you don't have any important information before you proceed.
505
  10Web Social Photo Feed for Instagram plugin uses Instagram API on website front end. You have to authorize the plugin via sign in to get data from Instagram on your behalf. The plugin does not send any user’s data to Instagram. All the data received from Instagram via API is cached in WordPress database for some short customizable period to provide front end optimization. You can delete or update cached data. Instagram saves some cookies in browsers of website visitors via API data. These cookies are mostly used for security purposes. They are regulated under terms of Instagram’s privacy policy https://instagram.com/legal/privacy. The plugin asks for your consent to collect site administrator’s email address and site URL to offer customer support, deals and discounts on premium products and more.
506
 
507
  == Changelog ==
 
 
 
508
  = 1.4.30 =
509
  Fixed: Security issue.
510
 
4
  Requires at least: 3.9
5
  Requires PHP: 5.2
6
  Tested up to: 5.8
7
+ Stable tag: 1.4.31
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
505
  10Web Social Photo Feed for Instagram plugin uses Instagram API on website front end. You have to authorize the plugin via sign in to get data from Instagram on your behalf. The plugin does not send any user’s data to Instagram. All the data received from Instagram via API is cached in WordPress database for some short customizable period to provide front end optimization. You can delete or update cached data. Instagram saves some cookies in browsers of website visitors via API data. These cookies are mostly used for security purposes. They are regulated under terms of Instagram’s privacy policy https://instagram.com/legal/privacy. The plugin asks for your consent to collect site administrator’s email address and site URL to offer customer support, deals and discounts on premium products and more.
506
 
507
  == Changelog ==
508
+ = 1.4.31 =
509
+ Fixed: Security issue.
510
+
511
  = 1.4.30 =
512
  Fixed: Security issue.
513
 
update/wdi_update.php CHANGED
@@ -1,64 +1,82 @@
1
  <?php
2
  /**
3
- * @param version without first '1' or '2'
4
- *
5
- */
6
 
7
- function wdi_update_diff($new_v, $old_v = 0.0){
8
- global $wpdb;
9
- @ini_set('max_execution_time', 60);
 
10
 
11
- if(version_compare($old_v, "0.6", '<')){
12
-
13
- $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_FEED_TABLE . " ADD `conditional_filters` varchar(10000) NOT NULL DEFAULT ''");
14
- $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_FEED_TABLE . " ADD `conditional_filter_type` varchar(32) NOT NULL DEFAULT 'none'");
15
- $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_FEED_TABLE . " ADD `show_username_on_thumb` varchar(32) NOT NULL DEFAULT '0'");
16
- $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_FEED_TABLE . " ADD `conditional_filter_enable` varchar(32) NOT NULL DEFAULT '0'");
 
 
 
 
17
 
18
- $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_THEME_TABLE . " ADD `th_thumb_user_bg_color` varchar(32) NOT NULL DEFAULT '#429FFF'");
19
- $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_THEME_TABLE . " ADD `th_thumb_user_color` varchar(32) NOT NULL DEFAULT '#FFFFFF'");
20
- $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_THEME_TABLE . " ADD `mas_thumb_user_bg_color` varchar(32) NOT NULL DEFAULT '#429FFF'");
21
- $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_THEME_TABLE . " ADD `mas_thumb_user_color` varchar(32) NOT NULL DEFAULT '#FFFFFF'");
22
- }
 
 
 
 
23
 
24
- if(version_compare($old_v, "0.7", '<')){
25
- $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_THEME_TABLE . " ADD `th_photo_img_hover_effect` varchar(32) NOT NULL DEFAULT 'none'");
26
- $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_THEME_TABLE . " ADD `mas_photo_img_hover_effect` varchar(32) NOT NULL DEFAULT 'none'");
27
- }
28
- if(version_compare($old_v, "1.0", '<')){
29
- /*add api update notice*/
30
- $admin_notices_option = get_option('wdi_admin_notice', array());
31
- $admin_notices_option['api_update_token_reset'] = array(
32
- 'start' => current_time("n/j/Y"),
33
- 'int' => 0,
34
- //'dismissed' => 1,
35
- );
36
- update_option('wdi_admin_notice', $admin_notices_option);
37
- }
38
- if(version_compare($old_v, "1.2", '<')){
39
- $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_THEME_TABLE . " convert to character set latin1 collate latin1_general_ci");
40
- }
41
- if(version_compare($old_v, "1.12", '<')){
42
- $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_FEED_TABLE . " ADD `liked_feed` varchar(30) NOT NULL DEFAULT 'userhash'");
43
- }
44
- if(version_compare($old_v, "1.17", '<')){
45
- $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_FEED_TABLE . " ADD `mobile_breakpoint` varchar(10) NOT NULL DEFAULT '640'");
46
- }
47
- if(version_compare($old_v, "2.2", '<')){
48
- $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_FEED_TABLE . " ADD `redirect_url` varchar(255) NOT NULL DEFAULT ''");
49
- }
50
- if(version_compare($old_v, "2.8", '<')){
51
- $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_FEED_TABLE . " MODIFY `feed_users` VARCHAR(2000) NOT NULL");
52
- }
53
- if(version_compare($old_v, "2.12", '<')){
54
- $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_FEED_TABLE . " ADD `feed_resolution` varchar(30) NOT NULL DEFAULT 'optimal'");
 
 
 
 
 
 
 
55
  }
56
- if(version_compare($old_v, "3.6", '<')){
57
- $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_FEED_TABLE . " MODIFY COLUMN feed_thumb varchar(800) NOT NULL");
 
58
  }
59
 
60
- if(version_compare($old_v, "3.13", '<')){
61
- $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_FEED_TABLE . " ADD `hashtag_top_recent` varchar(10) NOT NULL DEFAULT '1'");
 
62
  }
63
 
64
  }
1
  <?php
2
  /**
3
+ * @param version without first '1' or '2'
4
+ *
5
+ */
6
 
7
+ function wdi_update_diff($new_v, $old_v = 0.0)
8
+ {
9
+ global $wpdb;
10
+ set_time_limit(60);
11
 
12
+ // no need to prepare a constant WDI_FEED_TABLE
13
+ if (version_compare($old_v, "0.6", '<')) {
14
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange */
15
+ $wpdb->query("ALTER TABLE " . esc_sql($wpdb->prefix . WDI_FEED_TABLE) . " ADD `conditional_filters` varchar(10000) NOT NULL DEFAULT ''"); //db call ok
16
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange */
17
+ $wpdb->query("ALTER TABLE " . esc_sql($wpdb->prefix . WDI_FEED_TABLE) . " ADD `conditional_filter_type` varchar(32) NOT NULL DEFAULT 'none'"); //db call ok
18
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange */
19
+ $wpdb->query("ALTER TABLE " . esc_sql($wpdb->prefix . WDI_FEED_TABLE) . " ADD `show_username_on_thumb` varchar(32) NOT NULL DEFAULT '0'"); //db call ok
20
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange */
21
+ $wpdb->query("ALTER TABLE " . esc_sql($wpdb->prefix . WDI_FEED_TABLE) . " ADD `conditional_filter_enable` varchar(32) NOT NULL DEFAULT '0'"); //db call ok
22
 
23
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange */
24
+ $wpdb->query("ALTER TABLE " . esc_sql($wpdb->prefix . WDI_THEME_TABLE) . " ADD `th_thumb_user_bg_color` varchar(32) NOT NULL DEFAULT '#429FFF'"); //db call ok
25
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange */
26
+ $wpdb->query("ALTER TABLE " . esc_sql($wpdb->prefix . WDI_THEME_TABLE) . " ADD `th_thumb_user_color` varchar(32) NOT NULL DEFAULT '#FFFFFF'"); //db call ok
27
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange */
28
+ $wpdb->query("ALTER TABLE " . esc_sql($wpdb->prefix . WDI_THEME_TABLE) . " ADD `mas_thumb_user_bg_color` varchar(32) NOT NULL DEFAULT '#429FFF'"); //db call ok
29
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange */
30
+ $wpdb->query("ALTER TABLE " . esc_sql($wpdb->prefix . WDI_THEME_TABLE) . " ADD `mas_thumb_user_color` varchar(32) NOT NULL DEFAULT '#FFFFFF'"); //db call ok
31
+ }
32
 
33
+ if (version_compare($old_v, "0.7", '<')) {
34
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange */
35
+ $wpdb->query("ALTER TABLE " . esc_sql($wpdb->prefix . WDI_THEME_TABLE) . " ADD `th_photo_img_hover_effect` varchar(32) NOT NULL DEFAULT 'none'"); //db call ok
36
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange */
37
+ $wpdb->query("ALTER TABLE " . esc_sql($wpdb->prefix . WDI_THEME_TABLE) . " ADD `mas_photo_img_hover_effect` varchar(32) NOT NULL DEFAULT 'none'"); //db call ok
38
+ }
39
+ if (version_compare($old_v, "1.0", '<')) {
40
+ /*add api update notice*/
41
+ $admin_notices_option = get_option('wdi_admin_notice', array());
42
+ $admin_notices_option['api_update_token_reset'] = array(
43
+ 'start' => current_time("n/j/Y"),
44
+ 'int' => 0,
45
+ );
46
+ update_option('wdi_admin_notice', $admin_notices_option);
47
+ }
48
+ if (version_compare($old_v, "1.2", '<')) {
49
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange */
50
+ $wpdb->query("ALTER TABLE " . esc_sql($wpdb->prefix . WDI_THEME_TABLE) . " convert to character set latin1 collate latin1_general_ci"); //db call ok
51
+ }
52
+ if (version_compare($old_v, "1.12", '<')) {
53
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange */
54
+ $wpdb->query("ALTER TABLE " . esc_sql($wpdb->prefix . WDI_FEED_TABLE) . " ADD `liked_feed` varchar(30) NOT NULL DEFAULT 'userhash'"); //db call ok
55
+ }
56
+ if (version_compare($old_v, "1.17", '<')) {
57
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange */
58
+ $wpdb->query("ALTER TABLE " . esc_sql($wpdb->prefix . WDI_FEED_TABLE) . " ADD `mobile_breakpoint` varchar(10) NOT NULL DEFAULT '640'"); //db call ok
59
+ }
60
+ if (version_compare($old_v, "2.2", '<')) {
61
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange */
62
+ $wpdb->query("ALTER TABLE " . esc_sql($wpdb->prefix . WDI_FEED_TABLE) . " ADD `redirect_url` varchar(255) NOT NULL DEFAULT ''"); //db call ok
63
+ }
64
+ if (version_compare($old_v, "2.8", '<')) {
65
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange */
66
+ $wpdb->query("ALTER TABLE " . esc_sql($wpdb->prefix . WDI_FEED_TABLE) . " MODIFY `feed_users` VARCHAR(2000) NOT NULL"); //db call ok
67
+ }
68
+ if (version_compare($old_v, "2.12", '<')) {
69
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange */
70
+ $wpdb->query("ALTER TABLE " . esc_sql($wpdb->prefix . WDI_FEED_TABLE) . " ADD `feed_resolution` varchar(30) NOT NULL DEFAULT 'optimal'"); //db call ok
71
  }
72
+ if (version_compare($old_v, "3.6", '<')) {
73
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange */
74
+ $wpdb->query("ALTER TABLE " . esc_sql($wpdb->prefix . WDI_FEED_TABLE) . " MODIFY COLUMN feed_thumb varchar(800) NOT NULL"); //db call ok
75
  }
76
 
77
+ if (version_compare($old_v, "3.13", '<')) {
78
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange */
79
+ $wpdb->query("ALTER TABLE " . esc_sql($wpdb->prefix . WDI_FEED_TABLE) . " ADD `hashtag_top_recent` varchar(10) NOT NULL DEFAULT '1'"); //db call ok
80
  }
81
 
82
  }
wd-instagram-feed.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: 10Web Social Photo Feed
4
  * Plugin URI: https://10web.io/plugins/wordpress-instagram-feed/?utm_source=instagram_feed&utm_medium=free_plugin
5
  * Description: 10Web Social Photo Feed is a user-friendly tool for displaying user or hashtag-based feeds on your website. You can create feeds with one of the available layouts. It allows displaying image metadata, open up images in lightbox, download them and even share in social networking websites.
6
- * Version: 1.4.30
7
  * Author: 10Web
8
  * Author URI: https://10Web.io/plugins/?utm_source=instagram_feed&utm_medium=free_plugin
9
  * License: GPLv2 or later
@@ -70,6 +70,8 @@ function wdi_getUserMedia(){
70
  require_once ("framework/WDIInstagram.php");
71
  $WDIInstagram = new WDIInstagram();
72
  $data = $WDIInstagram->getUserMedia($user_name, $feed_id);
 
 
73
  echo $data; die;
74
  }
75
  }
@@ -86,6 +88,8 @@ function wdi_set_preload_cache_data() {
86
  require_once ("framework/WDIInstagram.php");
87
  $WDIInstagram = new WDIInstagram();
88
  $data = $WDIInstagram->wdi_set_preload_cache_data($user_name, $feed_id, $endpoint, $tag_id, $tag_name);
 
 
89
  echo $data;
90
  die;
91
  }
@@ -100,7 +104,7 @@ function wdi_getHashtagId() {
100
  require_once("framework/WDIInstagram.php");
101
  $WDIInstagram = new WDIInstagram();
102
  $data = $WDIInstagram->wdi_getHashtagId($tagname,$user_name);
103
- echo json_encode($data);
104
  die;
105
  }
106
  }
@@ -114,6 +118,8 @@ function wdi_getRecentMediaComments(){
114
  require_once ("framework/WDIInstagram.php");
115
  $WDIInstagram = new WDIInstagram();
116
  $data = $WDIInstagram->getRecentMediaComments($user_name,$media_id);
 
 
117
  echo $data; die;
118
  }
119
  }
@@ -122,11 +128,13 @@ function wdi_getTagRecentMedia(){
122
  require_once(WDI_DIR . '/framework/WDILibrary.php');
123
  $wdi_nonce = WDILibrary::get('wdi_nonce');
124
  if ( wp_verify_nonce($wdi_nonce, 'wdi_cache') ) {
125
- $feed_id = WDILibrary::get('feed_id');
126
- require_once ("framework/WDIInstagram.php");
127
- $WDIInstagram = new WDIInstagram();
128
- $data = $WDIInstagram->getTagRecentMedia($feed_id);
129
- echo $data; die;
 
 
130
  }
131
  }
132
 
@@ -145,35 +153,22 @@ function wdi_cache(){
145
  } elseif ($task == "set"){
146
  $wdi_cache_response = WDILibrary::get('wdi_cache_response');
147
  if ( $wdi_cache_response != '' ) {
148
- //$data = $WDICache->set_cache_data($wdi_cache_name, $wdi_cache_response);
149
- /*if ( $data === FALSE ) {
150
- wdi_send_response(array( "success" => FALSE ));
151
- }
152
- else {
153
- wdi_send_response(array( "success" => TRUE ));
154
- } */
155
  die;
156
  }
157
  }
158
  }
159
  if ($task == "reset") {
160
-
161
  global $wpdb;
162
- $feeds = $wpdb->get_results("SELECT id,feed_users,hashtag_top_recent FROM ". $wpdb->prefix.WDI_FEED_TABLE, ARRAY_A);
 
163
  foreach ( $feeds as $feed ) {
164
-
165
-
166
-
167
  $data['data'][] = array(
168
  'feed_id' => $feed['id'],
169
  'users' => $feed['feed_users'],
170
  'endpoint' => $feed['hashtag_top_recent']
171
  );
172
  }
173
-
174
-
175
  $status = $WDICache->reset_cache();
176
-
177
  if ( $status === FALSE ) {
178
  $data['status'] = FALSE;
179
  wdi_send_response($data);
@@ -188,14 +183,13 @@ function wdi_cache(){
188
  }
189
 
190
  function wdi_send_response($data){
191
- echo json_encode($data);
192
  die;
193
  }
194
 
195
  add_action('wp_ajax_WDIGalleryBox', 'wdi_ajax_frontend');
196
  add_action('wp_ajax_nopriv_WDIGalleryBox', 'wdi_ajax_frontend');
197
  function wdi_ajax_frontend(){
198
-
199
  /* reset from user to site locale*/
200
  if(function_exists('switch_to_locale')) {
201
  switch_to_locale(get_locale());
@@ -231,7 +225,8 @@ function wdi_instagram_activate( $networkwide ) {
231
  if ( $networkwide ) {
232
  global $wpdb;
233
  // Get all blog ids.
234
- $blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
 
235
  foreach ( $blogids as $blog_id ) {
236
  switch_to_blog($blog_id);
237
  wdi_install();
@@ -251,7 +246,8 @@ function wdi_instagram_deactivate( $networkwide ) {
251
  global $wpdb;
252
  // Check if it is a network activation - if so, run the activation function for each blog id.
253
  // Get all blog ids.
254
- $blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
 
255
  foreach ( $blogids as $blog_id ) {
256
  switch_to_blog($blog_id);
257
  wdi_deactivate();
@@ -373,7 +369,7 @@ function wdi_create_sample_feed($new_options){
373
  $default_user->id = "";
374
 
375
  $settings = array(
376
- 'feed_users' => json_encode(array($default_user)),
377
  );
378
 
379
  $controller = new WDIControllerFeeds_wdi();
@@ -428,9 +424,10 @@ function WDI_instagram_menu() {
428
  add_submenu_page($parent_slug, __('Settings', 'wd-instagram-feed'), __('Settings', 'wd-instagram-feed'), 'manage_options', 'wdi_settings', 'WDI_instagram_settings_page');
429
  add_submenu_page("", __('Uninstall', 'wd-instagram-feed'), __('Uninstall', 'wd-instagram-feed'), 'manage_options', 'wdi_uninstall', 'WDI_instagram_uninstall_page');
430
  if ( WDI_IS_FREE ) {
431
- /* Custom link to wordpress.org*/
432
  global $submenu;
433
  $url = 'https://wordpress.org/support/plugin/wd-instagram-feed/#new-post';
 
434
  $submenu[$parent_slug][] = array(
435
  '<div id="wdi_ask_question">' . __('Ask a question', 'wd-instagram-feed') . '</div>',
436
  'manage_options',
@@ -466,9 +463,8 @@ function WDI_instagram_feeds_page(){
466
 
467
  function WDI_instagram_themes_page(){
468
  require_once(WDI_DIR . '/framework/WDILibrary.php');
469
- $controller_class = 'WDIControllerThemes_wdi';
470
- require_once(WDI_DIR . '/admin/controllers/' . $controller_class . '.php');
471
- $controller = new $controller_class();
472
  $controller->execute();
473
  }
474
 
@@ -573,7 +569,7 @@ function wdi_enqueue_block_editor_assets(){
573
  wp_localize_script('tw-gb-block', 'tw_obj_translate', array(
574
  'nothing_selected' => __('Nothing selected.', 'wdi'),
575
  'empty_item' => __('- Select -', 'wdi'),
576
- 'blocks' => json_encode($blocks),
577
  ));
578
  wp_enqueue_style('tw-gb-block', $assets['css_path'], array('wp-edit-blocks'), $assets['version']);
579
  }
@@ -600,14 +596,14 @@ function wdi_add_editor_button($context){
600
  global $pagenow;
601
  if(in_array($pagenow, array('post.php', 'page.php', 'post-new.php', 'post-edit.php'))) {
602
  ?>
603
- <a onclick="tb_click.call(this);wdi_thickDims();return false;" href="<?php echo add_query_arg(array('action' => 'WDIEditorShortcode', 'TB_iframe' => '1'), admin_url('admin-ajax.php')) ?>" class="wdi_thickbox button" style="padding-left: 0.4em;" title="Add Instagram Feed">
604
- <span class="wp-media-buttons-icon wdi_media_button_icon" style="vertical-align: text-bottom; background: url(<?php echo WDI_URL ?>/images/menu_icon.png) no-repeat scroll left top rgba(0, 0, 0, 0);background-size:contain;"></span>
605
  Add Instagram Feed
606
  </a>
607
  <?php
608
  }
609
-
610
-
611
  echo ob_get_clean();
612
  }
613
 
@@ -722,10 +718,8 @@ function wdi_wd_lib_init(){
722
  if(!isset($wdi_options['wdi_access_token']) || empty($wdi_options['wdi_access_token'])) {
723
  $parent_slug = "wdi_settings";
724
  }
725
-
726
-
727
- if(!isset($_REQUEST['ajax']) && is_admin()) {
728
-
729
  if(!class_exists("TenWebLib")) {
730
  require_once(WDI_DIR . '/wd/start.php');
731
  }
@@ -832,7 +826,7 @@ function wdi_wd_lib_init(){
832
  "plugin_menu_title" => "Instagram Feed",
833
  "plugin_menu_icon" => WDI_URL . '/images/menu_icon.png',
834
  "subscribe" => false,
835
- "custom_post" => '', // if true => edit.php?post_type=contact
836
  "menu_capability" => wdi_get_create_feeds_cap(),
837
  "menu_position" => null,
838
  "display_overview" => false,
@@ -861,11 +855,11 @@ function wdi_token_error_flag_notice(){
861
  $screen_base = get_current_screen()->base;
862
 
863
  if($screen_base === "dashboard" || $screen_base === "toplevel_page_wdi_feeds" || $screen_base === "instagram-feed_page_wdi_themes" || $screen_base === "instagram-feed_page_wdi_settings" || $screen_base === "instagram-feed_page_overview_wdi" ){
864
- $link_to_reset = "<a href='".site_url()."/wp-admin/admin.php?page=wdi_settings' >reset token</a>";
865
  if($screen_base === "instagram-feed_page_wdi_settings"){
866
  $link_to_reset = "reset token";
867
  }
868
- echo "<div class='notice notice-error'><p>Instagram token is invalid or expired. Please ". $link_to_reset ." and sign-in again to get new one.</p></div>";
869
  }
870
  }
871
 
@@ -914,13 +908,13 @@ function wdi_backend_ajax() {
914
  $file = WDI_DIR . '/admin/controllers/' . $page . '.php';
915
 
916
  if ( !file_exists($file) ) {
917
- die ( $page . ' file not found.' );
918
  }
919
  if ( wp_verify_nonce($ajax_nonce, 'wdi_cache') == FALSE ) {
920
  die ( 'Invalid nonce.' );
921
  }
922
  if ( !empty($page) && !in_array($page, $allowed_pages) ) {
923
- die ('The ' . $page . ' page not available.');
924
  }
925
 
926
  require_once($file);
@@ -930,6 +924,6 @@ function wdi_backend_ajax() {
930
  $controller->$action();
931
  }
932
  else {
933
- die ( $action . ' not found on ' . ucfirst($page) . ' class.' );
934
  }
935
  }
3
  * Plugin Name: 10Web Social Photo Feed
4
  * Plugin URI: https://10web.io/plugins/wordpress-instagram-feed/?utm_source=instagram_feed&utm_medium=free_plugin
5
  * Description: 10Web Social Photo Feed is a user-friendly tool for displaying user or hashtag-based feeds on your website. You can create feeds with one of the available layouts. It allows displaying image metadata, open up images in lightbox, download them and even share in social networking websites.
6
+ * Version: 1.4.31
7
  * Author: 10Web
8
  * Author URI: https://10Web.io/plugins/?utm_source=instagram_feed&utm_medium=free_plugin
9
  * License: GPLv2 or later
70
  require_once ("framework/WDIInstagram.php");
71
  $WDIInstagram = new WDIInstagram();
72
  $data = $WDIInstagram->getUserMedia($user_name, $feed_id);
73
+ // All variables in the "getUserMedia()" function are esc․
74
+ /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */
75
  echo $data; die;
76
  }
77
  }
88
  require_once ("framework/WDIInstagram.php");
89
  $WDIInstagram = new WDIInstagram();
90
  $data = $WDIInstagram->wdi_set_preload_cache_data($user_name, $feed_id, $endpoint, $tag_id, $tag_name);
91
+ // All variables in the "wdi_set_preload_cache_data()" function are esc․
92
+ /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */
93
  echo $data;
94
  die;
95
  }
104
  require_once("framework/WDIInstagram.php");
105
  $WDIInstagram = new WDIInstagram();
106
  $data = $WDIInstagram->wdi_getHashtagId($tagname,$user_name);
107
+ echo wp_json_encode($data);
108
  die;
109
  }
110
  }
118
  require_once ("framework/WDIInstagram.php");
119
  $WDIInstagram = new WDIInstagram();
120
  $data = $WDIInstagram->getRecentMediaComments($user_name,$media_id);
121
+ // All variables in the "getRecentMediaComments()" function are esc․
122
+ /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */
123
  echo $data; die;
124
  }
125
  }
128
  require_once(WDI_DIR . '/framework/WDILibrary.php');
129
  $wdi_nonce = WDILibrary::get('wdi_nonce');
130
  if ( wp_verify_nonce($wdi_nonce, 'wdi_cache') ) {
131
+ $feed_id = WDILibrary::get('feed_id');
132
+ require_once ("framework/WDIInstagram.php");
133
+ $WDIInstagram = new WDIInstagram();
134
+ $data = $WDIInstagram->getTagRecentMedia($feed_id);
135
+ // All variables in the "getTagRecentMedia()" function are esc․
136
+ /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */
137
+ echo $data; die;
138
  }
139
  }
140
 
153
  } elseif ($task == "set"){
154
  $wdi_cache_response = WDILibrary::get('wdi_cache_response');
155
  if ( $wdi_cache_response != '' ) {
 
 
 
 
 
 
 
156
  die;
157
  }
158
  }
159
  }
160
  if ($task == "reset") {
 
161
  global $wpdb;
162
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
163
+ $feeds = $wpdb->get_results("SELECT id,feed_users,hashtag_top_recent FROM " . esc_sql($wpdb->prefix . WDI_FEED_TABLE), ARRAY_A); //db call ok
164
  foreach ( $feeds as $feed ) {
 
 
 
165
  $data['data'][] = array(
166
  'feed_id' => $feed['id'],
167
  'users' => $feed['feed_users'],
168
  'endpoint' => $feed['hashtag_top_recent']
169
  );
170
  }
 
 
171
  $status = $WDICache->reset_cache();
 
172
  if ( $status === FALSE ) {
173
  $data['status'] = FALSE;
174
  wdi_send_response($data);
183
  }
184
 
185
  function wdi_send_response($data){
186
+ echo wp_json_encode($data);
187
  die;
188
  }
189
 
190
  add_action('wp_ajax_WDIGalleryBox', 'wdi_ajax_frontend');
191
  add_action('wp_ajax_nopriv_WDIGalleryBox', 'wdi_ajax_frontend');
192
  function wdi_ajax_frontend(){
 
193
  /* reset from user to site locale*/
194
  if(function_exists('switch_to_locale')) {
195
  switch_to_locale(get_locale());
225
  if ( $networkwide ) {
226
  global $wpdb;
227
  // Get all blog ids.
228
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
229
+ $blogids = $wpdb->get_col("SELECT blog_id FROM " . esc_sql($wpdb->blogs) ); //db call ok
230
  foreach ( $blogids as $blog_id ) {
231
  switch_to_blog($blog_id);
232
  wdi_install();
246
  global $wpdb;
247
  // Check if it is a network activation - if so, run the activation function for each blog id.
248
  // Get all blog ids.
249
+ /* phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching */
250
+ $blogids = $wpdb->get_col("SELECT blog_id FROM " . esc_sql($wpdb->blogs) ); //db call ok
251
  foreach ( $blogids as $blog_id ) {
252
  switch_to_blog($blog_id);
253
  wdi_deactivate();
369
  $default_user->id = "";
370
 
371
  $settings = array(
372
+ 'feed_users' => wp_json_encode(array($default_user)),
373
  );
374
 
375
  $controller = new WDIControllerFeeds_wdi();
424
  add_submenu_page($parent_slug, __('Settings', 'wd-instagram-feed'), __('Settings', 'wd-instagram-feed'), 'manage_options', 'wdi_settings', 'WDI_instagram_settings_page');
425
  add_submenu_page("", __('Uninstall', 'wd-instagram-feed'), __('Uninstall', 'wd-instagram-feed'), 'manage_options', 'wdi_uninstall', 'WDI_instagram_uninstall_page');
426
  if ( WDI_IS_FREE ) {
427
+ // Custom link to wordpress.org
428
  global $submenu;
429
  $url = 'https://wordpress.org/support/plugin/wd-instagram-feed/#new-post';
430
+ /* phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited */
431
  $submenu[$parent_slug][] = array(
432
  '<div id="wdi_ask_question">' . __('Ask a question', 'wd-instagram-feed') . '</div>',
433
  'manage_options',
463
 
464
  function WDI_instagram_themes_page(){
465
  require_once(WDI_DIR . '/framework/WDILibrary.php');
466
+ require_once(WDI_DIR . '/admin/controllers/themes.php');
467
+ $controller = new Themes_controller_wdi();
 
468
  $controller->execute();
469
  }
470
 
569
  wp_localize_script('tw-gb-block', 'tw_obj_translate', array(
570
  'nothing_selected' => __('Nothing selected.', 'wdi'),
571
  'empty_item' => __('- Select -', 'wdi'),
572
+ 'blocks' => wp_json_encode($blocks),
573
  ));
574
  wp_enqueue_style('tw-gb-block', $assets['css_path'], array('wp-edit-blocks'), $assets['version']);
575
  }
596
  global $pagenow;
597
  if(in_array($pagenow, array('post.php', 'page.php', 'post-new.php', 'post-edit.php'))) {
598
  ?>
599
+ <a onclick="tb_click.call(this);wdi_thickDims(); return false;" href="<?php echo esc_url_raw( add_query_arg(array('action' => 'WDIEditorShortcode', 'TB_iframe' => '1'), admin_url('admin-ajax.php')) ); ?>" class="wdi_thickbox button" style="padding-left: 0.4em;" title="Add Instagram Feed">
600
+ <span class="wp-media-buttons-icon wdi_media_button_icon" style="vertical-align: text-bottom; background: url(<?php echo esc_url(WDI_URL); ?>/images/menu_icon.png) no-repeat scroll left top rgba(0, 0, 0, 0);background-size:contain;"></span>
601
  Add Instagram Feed
602
  </a>
603
  <?php
604
  }
605
+ // All variables used in HTML are esc․
606
+ /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */
607
  echo ob_get_clean();
608
  }
609
 
718
  if(!isset($wdi_options['wdi_access_token']) || empty($wdi_options['wdi_access_token'])) {
719
  $parent_slug = "wdi_settings";
720
  }
721
+ /* phpcs:ignore WordPress.Security.NonceVerification.Recommended */
722
+ if ( !isset($_REQUEST['ajax']) && is_admin() ) {
 
 
723
  if(!class_exists("TenWebLib")) {
724
  require_once(WDI_DIR . '/wd/start.php');
725
  }
826
  "plugin_menu_title" => "Instagram Feed",
827
  "plugin_menu_icon" => WDI_URL . '/images/menu_icon.png',
828
  "subscribe" => false,
829
+ "custom_post" => '',
830
  "menu_capability" => wdi_get_create_feeds_cap(),
831
  "menu_position" => null,
832
  "display_overview" => false,
855
  $screen_base = get_current_screen()->base;
856
 
857
  if($screen_base === "dashboard" || $screen_base === "toplevel_page_wdi_feeds" || $screen_base === "instagram-feed_page_wdi_themes" || $screen_base === "instagram-feed_page_wdi_settings" || $screen_base === "instagram-feed_page_overview_wdi" ){
858
+ $link_to_reset = "<a href='" . site_url() . "/wp-admin/admin.php?page=wdi_settings'>reset token</a>";
859
  if($screen_base === "instagram-feed_page_wdi_settings"){
860
  $link_to_reset = "reset token";
861
  }
862
+ echo "<div class='notice notice-error'><p>Instagram token is invalid or expired. Please " . wp_kses( $link_to_reset, array('a' => array('href')) ) . " and sign-in again to get new one.</p></div>";
863
  }
864
  }
865
 
908
  $file = WDI_DIR . '/admin/controllers/' . $page . '.php';
909
 
910
  if ( !file_exists($file) ) {
911
+ die ( esc_html( $page ) . ' file not found.' );
912
  }
913
  if ( wp_verify_nonce($ajax_nonce, 'wdi_cache') == FALSE ) {
914
  die ( 'Invalid nonce.' );
915
  }
916
  if ( !empty($page) && !in_array($page, $allowed_pages) ) {
917
+ die ('The ' . esc_html($page) . ' page not available.');
918
  }
919
 
920
  require_once($file);
924
  $controller->$action();
925
  }
926
  else {
927
+ die ( esc_html( $action ) . ' not found on ' . esc_html( ucfirst($page) ) . ' class.' );
928
  }
929
  }
wd/includes/subscribe.php CHANGED
@@ -80,7 +80,7 @@ class TenWebLibSubscribe
80
  $data["email"] = $admin_data->data->user_email;
81
  $data["wp_version"] = get_bloginfo('version');
82
  $data["product_id"] = $wd_options->plugin_id;
83
- $data["all_plugins"] = json_encode($all_plugins);
84
 
85
 
86
  $response = wp_remote_post(TEN_WEB_LIB_SUBSCRIBE_URL, array(
80
  $data["email"] = $admin_data->data->user_email;
81
  $data["wp_version"] = get_bloginfo('version');
82
  $data["product_id"] = $wd_options->plugin_id;
83
+ $data["all_plugins"] = wp_json_encode($all_plugins);
84
 
85
 
86
  $response = wp_remote_post(TEN_WEB_LIB_SUBSCRIBE_URL, array(