Slider by WD – Responsive Slider - Version 1.2.18

Version Description

  • Added: Elementor widget.
Download this release

Release Info

Developer webdorado
Plugin Icon 128x128 Slider by WD – Responsive Slider
Version 1.2.18
Comparing to
See all releases

Code changes from version 1.2.17 to 1.2.18

admin/controllers/elementorWidget.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WDSElementor extends \Elementor\Widget_Base {
4
+ /**
5
+ * Get widget name.
6
+ *
7
+ * @return string Widget name.
8
+ */
9
+ public function get_name() {
10
+ return 'wds-elementor';
11
+ }
12
+
13
+ /**
14
+ * Get widget title.
15
+ *
16
+ * @return string Widget title.
17
+ */
18
+ public function get_title() {
19
+ return __('Slider', WDS()->prefix);
20
+ }
21
+
22
+ /**
23
+ * Get widget icon.
24
+ *
25
+ * @return string Widget icon.
26
+ */
27
+ public function get_icon() {
28
+ return 'fa fa-image';
29
+ }
30
+
31
+ /**
32
+ * Get widget categories.
33
+ *
34
+ * @return array Widget categories.
35
+ */
36
+ public function get_categories() {
37
+ return [ 'tenweb-widgets' ];
38
+ }
39
+
40
+ /**
41
+ * Register widget controls.
42
+ */
43
+ protected function _register_controls() {
44
+ $this->start_controls_section(
45
+ 'general',
46
+ [
47
+ 'label' => __('Slider', WDS()->prefix),
48
+ ]
49
+ );
50
+
51
+ $sliders = wds_get_sliders();
52
+ $sliders[0] = __('Select a Slider', WDS()->prefix);
53
+ $this->add_control(
54
+ 'sliders',
55
+ [
56
+ 'label_block' => TRUE,
57
+ 'show_label' => FALSE,
58
+ 'description' => __('Select the slider to display.', WDS()->prefix) . ' <a target="_balnk" href="' . add_query_arg(array( 'page' => 'sliders_' . WDS()->prefix ), admin_url('admin.php')) . '">' . __('Edit slider', WDS()->prefix) . '</a>',
59
+ 'type' => \Elementor\Controls_Manager::SELECT,
60
+ 'default' => 0,
61
+ 'options' => $sliders,
62
+ ]
63
+ );
64
+
65
+ $this->end_controls_section();
66
+ }
67
+
68
+ /**
69
+ * Render widget output on the frontend.
70
+ */
71
+ protected function render() {
72
+ $settings = $this->get_settings_for_display();
73
+
74
+ echo WDS()->front_end($settings['sliders']);
75
+ }
76
+ }
77
+
78
+ \Elementor\Plugin::instance()->widgets_manager->register_widget_type(new WDSElementor());
admin/views/AdminView.php CHANGED
@@ -4,7 +4,7 @@ defined('ABSPATH') || die('Access Denied');
4
  /**
5
  * Admin view class.
6
  */
7
- class AdminView_bwg {
8
 
9
  public function __construct() {
10
  wp_enqueue_style(WDS()->prefix . '_tables');
4
  /**
5
  * Admin view class.
6
  */
7
+ class AdminView_wds {
8
 
9
  public function __construct() {
10
  wp_enqueue_style(WDS()->prefix . '_tables');
admin/views/Sliders.php CHANGED
@@ -3,7 +3,7 @@
3
  /**
4
  * Class SlidersView_wds
5
  */
6
- class SlidersView_wds extends AdminView_bwg {
7
 
8
  /**
9
  * Display.
3
  /**
4
  * Class SlidersView_wds
5
  */
6
+ class SlidersView_wds extends AdminView_wds {
7
 
8
  /**
9
  * Display.
admin/views/WDSViewWidgetSlideshow.php CHANGED
@@ -38,10 +38,9 @@ class WDSViewWidgetSlideshow {
38
  require_once(WDS()->plugin_dir . '/frontend/controllers/WDSControllerSlider.php');
39
  $controller_class = 'WDSControllerSlider';
40
  $controller = new $controller_class();
41
- global $wds;
42
  $params = array( 'id' => $id );
43
  $controller->execute($id, 1, $wds);
44
- $wds++;
45
  // After widget.
46
  echo $after_widget;
47
  }
38
  require_once(WDS()->plugin_dir . '/frontend/controllers/WDSControllerSlider.php');
39
  $controller_class = 'WDSControllerSlider';
40
  $controller = new $controller_class();
41
+ $wds = WDW_S_Library::unique_number();
42
  $params = array( 'id' => $id );
43
  $controller->execute($id, 1, $wds);
 
44
  // After widget.
45
  echo $after_widget;
46
  }
framework/WDW_S_Library.php CHANGED
@@ -1,9 +1,5 @@
1
  <?php
2
  class WDW_S_Library {
3
-
4
- public function __construct() {
5
- }
6
-
7
  /**
8
  * Get request value.
9
  *
@@ -2553,4 +2549,22 @@ class WDW_S_Library {
2553
  echo ob_get_clean();
2554
  }
2555
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2556
  }
1
  <?php
2
  class WDW_S_Library {
 
 
 
 
3
  /**
4
  * Get request value.
5
  *
2549
  echo ob_get_clean();
2550
  }
2551
 
2552
+ /**
2553
+ * Get unique number for view.
2554
+ *
2555
+ * @return int
2556
+ */
2557
+ public static function unique_number() {
2558
+ $use_random_number = (WDW_S_Library::elementor_is_active()) ? TRUE : FALSE;
2559
+ if ( $use_random_number ) {
2560
+ return mt_rand();
2561
+ }
2562
+ else {
2563
+ global $wds;
2564
+ $unique = $wds;
2565
+ $wds++;
2566
+
2567
+ return $unique;
2568
+ }
2569
+ }
2570
  }
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
- === Slider by 10Web - Responsive Slider ===
2
  Contributors: webdorado,10web
3
  Tags: responsive slider, slider, slideshow, wordpress slider, image slider, gallery slider, images slider, Photo Slider, post slider, slider plugin
4
  Requires at least: 3.4
5
  Tested up to: 4.9
6
  Requires PHP: 5.2
7
- Stable tag: 1.2.17
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -442,6 +442,9 @@ The plugin takes the full width of the widget area if the **Boxed Layout** in **
442
 
443
  == Changelog ==
444
 
 
 
 
445
  = 1.2.17 =
446
  * Fixed: Bug on restarting slider.
447
  * Fixed: Smart crop functionality.
1
+ === Slider by 10Web - Responsive Image Slider ===
2
  Contributors: webdorado,10web
3
  Tags: responsive slider, slider, slideshow, wordpress slider, image slider, gallery slider, images slider, Photo Slider, post slider, slider plugin
4
  Requires at least: 3.4
5
  Tested up to: 4.9
6
  Requires PHP: 5.2
7
+ Stable tag: 1.2.18
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
442
 
443
  == Changelog ==
444
 
445
+ = 1.2.18 =
446
+ * Added: Elementor widget.
447
+
448
  = 1.2.17 =
449
  * Fixed: Bug on restarting slider.
450
  * Fixed: Smart crop functionality.
slider-wd.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Slider by 10Web
4
  * Plugin URI: https://10web.io/plugins/wordpress-slider/
5
  * Description: This is a responsive plugin, which allows adding sliders to your posts/pages and to custom location. It uses large number of transition effects and supports various types of layers.
6
- * Version: 1.2.17
7
  * Author: 10Web
8
  * Author URI: https://10web.io/pricing/
9
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
@@ -78,8 +78,8 @@ final class WDS {
78
  $this->plugin_dir = WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__));
79
  $this->plugin_url = plugins_url(plugin_basename(dirname(__FILE__)));
80
  $this->main_file = plugin_basename(__FILE__);
81
- $this->plugin_version = '1.2.17';
82
- $this->db_version = '1.2.17';
83
  $this->prefix = 'wds';
84
  $this->nicename = __('Slider', $this->prefix);
85
  $this->use_home_url();
@@ -180,11 +180,37 @@ final class WDS {
180
 
181
  // Privacy policy.
182
  add_action( 'admin_init', array($this, 'add_privacy_policy_content') );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  }
184
 
185
  function plugins_loaded() {
186
- // Prevent adding shortcode conflict with some builders.
187
- $this->before_shortcode_add_builder_editor();
188
  }
189
 
190
  function add_privacy_policy_content() {
@@ -200,7 +226,6 @@ final class WDS {
200
  );
201
  }
202
 
203
-
204
  /**
205
  * Wordpress init actions.
206
  */
@@ -388,7 +413,7 @@ final class WDS {
388
  * @return mixed|string|void
389
  */
390
  function shortcode($params) {
391
- if ( is_admin() || isset($_GET['elementor-preview'])) {
392
  // return ob_get_clean();
393
  return __('Preview unavailable', $this->prefix);
394
  }
@@ -407,22 +432,22 @@ final class WDS {
407
  function front_end($id, $from_shortcode = 1) {
408
  require_once(WDS()->plugin_dir . '/frontend/controllers/WDSControllerSlider.php');
409
  $controller = new WDSControllerSlider();
410
- global $wds;
411
  $controller->execute($id, $from_shortcode, $wds);
412
- $wds++;
413
  return;
414
  }
415
 
416
  function media_button($context) {
417
  ob_start();
418
- $href = add_query_arg(array('action' => 'WDSShortcode', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
419
- ?>
420
  <a onclick="tb_click.call(this); wds_thickDims(); return false;" href="<?php echo $href; ?>" class="wds_thickbox button" title="<?php _e('Select slider', $this->prefix); ?>">
421
  <span class="wp-media-buttons-icon wds_media_button_icon" style="vertical-align: text-bottom; background: url(<?php echo $this->plugin_url; ?>/images/wd_slider.png) no-repeat scroll left top rgba(0, 0, 0, 0);"></span>
422
  <?php _e('Add Slider', $this->prefix); ?>
423
  </a>
424
  <?php
425
- $context .= ob_get_clean();
426
  return $context;
427
  }
428
 
3
  * Plugin Name: Slider by 10Web
4
  * Plugin URI: https://10web.io/plugins/wordpress-slider/
5
  * Description: This is a responsive plugin, which allows adding sliders to your posts/pages and to custom location. It uses large number of transition effects and supports various types of layers.
6
+ * Version: 1.2.18
7
  * Author: 10Web
8
  * Author URI: https://10web.io/pricing/
9
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
78
  $this->plugin_dir = WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__));
79
  $this->plugin_url = plugins_url(plugin_basename(dirname(__FILE__)));
80
  $this->main_file = plugin_basename(__FILE__);
81
+ $this->plugin_version = '1.2.18';
82
+ $this->db_version = '1.2.18';
83
  $this->prefix = 'wds';
84
  $this->nicename = __('Slider', $this->prefix);
85
  $this->use_home_url();
180
 
181
  // Privacy policy.
182
  add_action( 'admin_init', array($this, 'add_privacy_policy_content') );
183
+
184
+ // Register widget for Elementor builder.
185
+ add_action('elementor/widgets/widgets_registered', array($this, 'register_elementor_widget'));
186
+ // Register 10Web category for Elementor widget if 10Web builder doesn't installed.
187
+ add_action('elementor/elements/categories_registered', array($this, 'register_widget_category'), 1, 1);
188
+ }
189
+
190
+ /**
191
+ * Register widget for Elementor builder.
192
+ */
193
+ public function register_elementor_widget() {
194
+ if ( defined('ELEMENTOR_PATH') && class_exists('Elementor\Widget_Base') ) {
195
+ require_once ($this->plugin_dir . '/admin/controllers/elementorWidget.php');
196
+ }
197
+ }
198
+
199
+ /**
200
+ * Register 10Web category for Elementor widget if 10Web builder doesn't installed.
201
+ *
202
+ * @param $elements_manager
203
+ */
204
+ public function register_widget_category( $elements_manager ) {
205
+ $elements_manager->add_category('tenweb-widgets', array(
206
+ 'title' => __('10WEB', 'tenweb-builder'),
207
+ 'icon' => 'fa fa-plug',
208
+ ));
209
  }
210
 
211
  function plugins_loaded() {
212
+ // Prevent adding shortcode conflict with some builders.
213
+ $this->before_shortcode_add_builder_editor();
214
  }
215
 
216
  function add_privacy_policy_content() {
226
  );
227
  }
228
 
 
229
  /**
230
  * Wordpress init actions.
231
  */
413
  * @return mixed|string|void
414
  */
415
  function shortcode($params) {
416
+ if ( is_admin() ) {
417
  // return ob_get_clean();
418
  return __('Preview unavailable', $this->prefix);
419
  }
432
  function front_end($id, $from_shortcode = 1) {
433
  require_once(WDS()->plugin_dir . '/frontend/controllers/WDSControllerSlider.php');
434
  $controller = new WDSControllerSlider();
435
+ $wds = WDW_S_Library::unique_number();
436
  $controller->execute($id, $from_shortcode, $wds);
437
+
438
  return;
439
  }
440
 
441
  function media_button($context) {
442
  ob_start();
443
+ $href = add_query_arg(array('action' => 'WDSShortcode', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
444
+ ?>
445
  <a onclick="tb_click.call(this); wds_thickDims(); return false;" href="<?php echo $href; ?>" class="wds_thickbox button" title="<?php _e('Select slider', $this->prefix); ?>">
446
  <span class="wp-media-buttons-icon wds_media_button_icon" style="vertical-align: text-bottom; background: url(<?php echo $this->plugin_url; ?>/images/wd_slider.png) no-repeat scroll left top rgba(0, 0, 0, 0);"></span>
447
  <?php _e('Add Slider', $this->prefix); ?>
448
  </a>
449
  <?php
450
+ $context .= ob_get_clean();
451
  return $context;
452
  }
453