Premium Addons for Elementor - Version 3.6.0

Version Description

  • New: Introducing Premium Templates - The Easiest Way to insert templates with just ONE click.
  • Fixed: Grid widget categorization doesn't work with non English characters.
Download this release

Release Info

Developer leap13
Plugin Icon 128x128 Premium Addons for Elementor
Version 3.6.0
Comparing to
See all releases

Code changes from version 3.5.9 to 3.6.0

Files changed (44) hide show
  1. admin/includes/admin-notices.php +23 -49
  2. admin/includes/papro-actions.php +4 -2
  3. admin/includes/plugin-info.php +1 -1
  4. admin/includes/version-control.php +1 -1
  5. admin/settings/modules-setting.php +36 -5
  6. assets/editor/templates/css/editor.css +515 -0
  7. assets/editor/templates/css/preview.css +5 -0
  8. assets/editor/templates/js/editor.js +1022 -0
  9. includes/class-addons-integration.php +10 -42
  10. includes/class-helper-functions.php +27 -0
  11. includes/elementor-helper.php +40 -1
  12. includes/templates/classes/api.php +173 -0
  13. includes/templates/classes/assets.php +195 -0
  14. includes/templates/classes/config.php +223 -0
  15. includes/templates/classes/manager.php +374 -0
  16. includes/templates/documents/base.php +27 -0
  17. includes/templates/documents/section.php +21 -0
  18. includes/templates/scripts/template-modal-content.php +10 -0
  19. includes/templates/scripts/template-modal-error.php +21 -0
  20. includes/templates/scripts/template-modal-filters-item.php +9 -0
  21. includes/templates/scripts/template-modal-filters.php +6 -0
  22. includes/templates/scripts/template-modal-header-back.php +9 -0
  23. includes/templates/scripts/template-modal-header-logo.php +12 -0
  24. includes/templates/scripts/template-modal-header.php +11 -0
  25. includes/templates/scripts/template-modal-insert-button.php +17 -0
  26. includes/templates/scripts/template-modal-item.php +29 -0
  27. includes/templates/scripts/template-modal-keywords.php +18 -0
  28. includes/templates/scripts/template-modal-loading.php +14 -0
  29. includes/templates/scripts/template-modal-preview.php +9 -0
  30. includes/templates/scripts/template-modal-tabs-item.php +9 -0
  31. includes/templates/scripts/template-modal-tabs.php +6 -0
  32. includes/templates/scripts/template-modal-templates.php +6 -0
  33. includes/templates/sources/base.php +286 -0
  34. includes/templates/sources/premium-api.php +422 -0
  35. includes/templates/templates.php +239 -0
  36. includes/templates/types/base.php +64 -0
  37. includes/templates/types/manager.php +143 -0
  38. includes/templates/types/section.php +53 -0
  39. premium-addons-for-elementor.php +8 -5
  40. readme.txt +9 -3
  41. widgets/premium-carousel.php +5 -7
  42. widgets/premium-grid.php +1 -1
  43. widgets/premium-modalbox.php +3 -4
  44. widgets/premium-vscroll.php +2 -12
admin/includes/admin-notices.php CHANGED
@@ -2,6 +2,8 @@
2
 
3
  namespace PremiumAddons\Admin\Includes;
4
 
 
 
5
  if( ! defined( 'ABSPATH') ) exit();
6
 
7
  class Admin_Notices {
@@ -36,7 +38,7 @@ class Admin_Notices {
36
 
37
  $this->handle_review_notice();
38
 
39
- $this->handle_fb_notice();
40
 
41
  }
42
 
@@ -56,7 +58,7 @@ class Admin_Notices {
56
  }
57
  //$this->get_pbg_notice();
58
 
59
- $this->get_fb_notice();
60
 
61
  }
62
 
@@ -109,25 +111,25 @@ class Admin_Notices {
109
  }
110
 
111
  /**
112
- * Checks if Facebook Reviews message is dismissed.
113
  *
114
- * @since 3.5.2
115
  * @access public
116
  *
117
  * @return void
118
  */
119
- public function handle_fb_notice() {
120
- if ( ! isset( $_GET['fb'] ) ) {
121
  return;
122
  }
123
 
124
- if ( 'opt_out' === $_GET['fb'] ) {
125
  check_admin_referer( 'opt_out' );
126
 
127
- update_option( 'fb_notice', '1' );
128
  }
129
 
130
- wp_redirect( remove_query_arg( 'fb' ) );
131
  exit;
132
  }
133
 
@@ -273,64 +275,36 @@ class Admin_Notices {
273
 
274
  /**
275
  *
276
- * Shows an admin notice for Facebook Reviews.
277
  *
278
- * @since 3.5.2
279
  * @access public
280
  *
281
  * @return void
282
  */
283
- public function get_fb_notice() {
284
 
285
- $fb_notice = get_option( 'fb_notice' );
286
 
287
- $theme = self::get_installed_theme();
288
 
289
- $notice_url = sprintf( 'http://premiumaddons.com/facebook-reviews-widget-for-elementor-page-builder/?utm_source=fb-notification&utm_medium=wp-dash&utm_campaign=get-pro&utm_term=%s', $theme );
290
 
291
- if ( '1' === $fb_notice ) {
292
  return;
293
- } else if ( '1' !== $fb_notice ) {
294
- $optout_url = wp_nonce_url( add_query_arg( 'fb', 'opt_out' ), 'opt_out' );
295
 
296
- $fb_message = sprintf( __('<p class="pa-text-wrap" style="display: flex; align-items: center; padding:10px 10px 10px 0;"><img src="%s" style="margin-right: 0.8em; width: 40px;"><strong><span>Facebook Reviews Widget for Elementor&nbsp</strong> has been amazingly improved.&nbsp</span><a href="%s" target="_blank" style="flex-grow: 2;"> Check it out now.</a>', 'premium-addons-for-elementor' ), PREMIUM_ADDONS_URL .'admin/images/premium-addons-logo.png', $notice_url );
297
 
298
- $fb_message .= sprintf(__('<a href="%s" style="text-decoration: none; margin-left: 1em; float:right; "><span class="dashicons dashicons-dismiss"></span></a></p>', 'premium-addons-for-elementor'), $optout_url );
299
 
300
- $this->render_admin_notices( $fb_message );
301
 
302
  }
303
 
304
  }
305
 
306
- /**
307
- * Get Installed Theme
308
- *
309
- * Returns the active theme slug
310
- *
311
- * @access public
312
- * @return string theme slug
313
- */
314
- public static function get_installed_theme() {
315
-
316
- $theme = wp_get_theme();
317
-
318
- if( $theme->parent() ) {
319
-
320
- $theme_name = $theme->parent()->get('Name');
321
-
322
- } else {
323
-
324
- $theme_name = $theme->get('Name');
325
-
326
- }
327
-
328
- $theme_name = sanitize_key( $theme_name );
329
-
330
- return $theme_name;
331
- }
332
-
333
-
334
  /**
335
  * Checks if a plugin is installed
336
  *
2
 
3
  namespace PremiumAddons\Admin\Includes;
4
 
5
+ use PremiumAddons\Helper_Functions;
6
+
7
  if( ! defined( 'ABSPATH') ) exit();
8
 
9
  class Admin_Notices {
38
 
39
  $this->handle_review_notice();
40
 
41
+ $this->handle_templates_notice();
42
 
43
  }
44
 
58
  }
59
  //$this->get_pbg_notice();
60
 
61
+ $this->get_templates_notice();
62
 
63
  }
64
 
111
  }
112
 
113
  /**
114
+ * Checks if Premium Templates message is dismissed.
115
  *
116
+ * @since 3.6.0
117
  * @access public
118
  *
119
  * @return void
120
  */
121
+ public function handle_templates_notice() {
122
+ if ( ! isset( $_GET['templates'] ) ) {
123
  return;
124
  }
125
 
126
+ if ( 'opt_out' === $_GET['templates'] ) {
127
  check_admin_referer( 'opt_out' );
128
 
129
+ update_option( 'templates_notice', '1' );
130
  }
131
 
132
+ wp_redirect( remove_query_arg( 'templates' ) );
133
  exit;
134
  }
135
 
275
 
276
  /**
277
  *
278
+ * Shows an admin notice for Premium Templates.
279
  *
280
+ * @since 3.6.0
281
  * @access public
282
  *
283
  * @return void
284
  */
285
+ public function get_templates_notice() {
286
 
287
+ $templates_notice = get_option( 'templates_notice' );
288
 
289
+ $theme = Helper_Functions::get_installed_theme();
290
 
291
+ $notice_url = sprintf( 'https://premiumaddons.com/premium-templates-for-elementor/?utm_source=templates-notification&utm_medium=wp-dash&utm_campaign=get-pro&utm_term=%s', $theme );
292
 
293
+ if ( '1' === $templates_notice ) {
294
  return;
295
+ } else if ( '1' !== $templates_notice ) {
296
+ $optout_url = wp_nonce_url( add_query_arg( 'templates', 'opt_out' ), 'opt_out' );
297
 
298
+ $templates_message = sprintf( __('<p class="pa-text-wrap" style="display: flex; align-items: center; padding:10px 10px 10px 0;"><img src="%s" style="margin-right: 0.8em; width: 40px;"><strong><span>Premium Templates&nbsp</strong> is now available in Premium Addons for Elementor.&nbsp</span><a href="%s" target="_blank" style="flex-grow: 2;"> Check it out now.</a>', 'premium-addons-for-elementor' ), PREMIUM_ADDONS_URL .'admin/images/premium-addons-logo.png', $notice_url );
299
 
300
+ $templates_message .= sprintf(__('<a href="%s" style="text-decoration: none; margin-left: 1em; float:right; "><span class="dashicons dashicons-dismiss"></span></a></p>', 'premium-addons-for-elementor'), $optout_url );
301
 
302
+ $this->render_admin_notices( $templates_message );
303
 
304
  }
305
 
306
  }
307
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
308
  /**
309
  * Checks if a plugin is installed
310
  *
admin/includes/papro-actions.php CHANGED
@@ -2,6 +2,8 @@
2
 
3
  namespace PremiumAddons\Admin\Includes;
4
 
 
 
5
  if ( ! defined( 'ABSPATH' ) ) exit;
6
 
7
  class Papro_Actions {
@@ -22,7 +24,7 @@ class Papro_Actions {
22
 
23
  public function handle_custom_redirects() {
24
 
25
- $theme_name = Admin_Notices::get_installed_theme();
26
 
27
  if ( empty( $_GET['page'] ) ) {
28
  return;
@@ -30,7 +32,7 @@ class Papro_Actions {
30
 
31
  if ( 'premium-addons-pro' === $_GET['page'] ) {
32
 
33
- $url = sprintf('https://premiumaddons.com/pro/?utm_source=wp-menu&utm_medium=wp-dash&utm_campaign=get-pro&utm_term=%s', $theme_name );
34
 
35
  wp_redirect( $url );
36
 
2
 
3
  namespace PremiumAddons\Admin\Includes;
4
 
5
+ use PremiumAddons\Helper_Functions;
6
+
7
  if ( ! defined( 'ABSPATH' ) ) exit;
8
 
9
  class Papro_Actions {
24
 
25
  public function handle_custom_redirects() {
26
 
27
+ $theme_slug = Helper_Functions::get_installed_theme();
28
 
29
  if ( empty( $_GET['page'] ) ) {
30
  return;
32
 
33
  if ( 'premium-addons-pro' === $_GET['page'] ) {
34
 
35
+ $url = sprintf('https://premiumaddons.com/pro/?utm_source=wp-menu&utm_medium=wp-dash&utm_campaign=get-pro&utm_term=%s', $theme_slug );
36
 
37
  wp_redirect( $url );
38
 
admin/includes/plugin-info.php CHANGED
@@ -25,7 +25,7 @@ class Plugin_Info {
25
 
26
  public function pa_about_page() {
27
 
28
- $theme_name = Admin_Notices::get_installed_theme();
29
 
30
  $url = sprintf('https://premiumaddons.com/pro/?utm_source=about-page&utm_medium=wp-dash&utm_campaign=get-pro&utm_term=%s', $theme_name );
31
 
25
 
26
  public function pa_about_page() {
27
 
28
+ $theme_name = Helper_Functions::get_installed_theme();
29
 
30
  $url = sprintf('https://premiumaddons.com/pro/?utm_source=about-page&utm_medium=wp-dash&utm_campaign=get-pro&utm_term=%s', $theme_name );
31
 
admin/includes/version-control.php CHANGED
@@ -91,7 +91,7 @@ class Version_Control {
91
  <tr class="pa-roll-row">
92
  <th><?php echo __('Rollback Version', 'premium-addons-for-elementor'); ?></th>
93
  <td>
94
- <div><?php echo sprintf( '<a target="_blank" href="%1$s" class="button pa-btn pa-rollback-button elementor-button-spinner">%2$s</a>', wp_nonce_url( admin_url( 'admin-post.php?action=premium_addons_rollback' ), 'premium_addons_rollback' ), __('Reinstall Version 3.5.8', 'premium-addons-for-elementor') ); ?></div>
95
  <p class="pa-roll-desc">
96
  <span><?php echo __('Warning: Please backup your database before making the rollback.', 'premium-addons-for-elementor'); ?></span>
97
  </p>
91
  <tr class="pa-roll-row">
92
  <th><?php echo __('Rollback Version', 'premium-addons-for-elementor'); ?></th>
93
  <td>
94
+ <div><?php echo sprintf( '<a target="_blank" href="%1$s" class="button pa-btn pa-rollback-button elementor-button-spinner">%2$s</a>', wp_nonce_url( admin_url( 'admin-post.php?action=premium_addons_rollback' ), 'premium_addons_rollback' ), __('Reinstall Version 3.5.9', 'premium-addons-for-elementor') ); ?></div>
95
  <p class="pa-roll-desc">
96
  <span><?php echo __('Warning: Please backup your database before making the rollback.', 'premium-addons-for-elementor'); ?></span>
97
  </p>
admin/settings/modules-setting.php CHANGED
@@ -12,7 +12,7 @@ class Modules_Settings {
12
 
13
  protected $page_slug = 'premium-addons';
14
 
15
- public static $pa_elements_keys = ['premium-banner', 'premium-blog','premium-carousel', 'premium-countdown','premium-counter','premium-dual-header','premium-fancytext','premium-image-separator','premium-maps','premium-modalbox','premium-person','premium-progressbar','premium-testimonials','premium-title','premium-videobox','premium-pricing-table','premium-button','premium-contactform', 'premium-image-button', 'premium-grid','premium-vscroll', 'premium-image-scroll'];
16
 
17
  private $pa_default_settings;
18
 
@@ -140,11 +140,11 @@ class Modules_Settings {
140
 
141
  public function pa_admin_page() {
142
 
143
- $theme_name = Admin_Notices::get_installed_theme();
144
 
145
  $js_info = array(
146
  'ajaxurl' => admin_url( 'admin-ajax.php' ),
147
- 'theme' => $theme_name
148
  );
149
 
150
  wp_localize_script( 'pa-admin-js', 'settings', $js_info );
@@ -353,16 +353,26 @@ class Modules_Settings {
353
  </label>
354
  </td>
355
 
356
- <th><?php echo sprintf( '%1$s %2$s', $prefix, __('Title', 'premium-addons-for-elementor') ); ?></th>
357
  <td>
358
  <label class="switch">
359
- <input type="checkbox" id="premium-title" name="premium-title" <?php checked(1, $this->pa_get_settings['premium-title'], true) ?>>
360
  <span class="slider round"></span>
361
  </label>
362
  </td>
 
363
  </tr>
364
 
365
  <tr>
 
 
 
 
 
 
 
 
 
366
  <th><?php echo sprintf( '%1$s %2$s', $prefix, __('Video Box', 'premium-addons-for-elementor') ); ?></th>
367
  <td>
368
  <label class="switch">
@@ -370,6 +380,11 @@ class Modules_Settings {
370
  <span class="slider round"></span>
371
  </label>
372
  </td>
 
 
 
 
 
373
  <th><?php echo sprintf( '%1$s %2$s', $prefix, __('Vertical Scroll', 'premium-addons-for-elementor') ); ?></th>
374
  <td>
375
  <label class="switch">
@@ -665,6 +680,21 @@ class Modules_Settings {
665
 
666
  return $enabled_keys;
667
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
668
 
669
  public function pa_save_settings() {
670
 
@@ -689,6 +719,7 @@ class Modules_Settings {
689
  'premium-progressbar' => intval( $settings['premium-progressbar'] ? 1 : 0 ),
690
  'premium-testimonials' => intval( $settings['premium-testimonials'] ? 1 : 0 ),
691
  'premium-title' => intval( $settings['premium-title'] ? 1 : 0 ),
 
692
  'premium-videobox' => intval( $settings['premium-videobox'] ? 1 : 0 ),
693
  'premium-pricing-table' => intval( $settings['premium-pricing-table'] ? 1 : 0),
694
  'premium-button' => intval( $settings['premium-button'] ? 1 : 0),
12
 
13
  protected $page_slug = 'premium-addons';
14
 
15
+ public static $pa_elements_keys = ['premium-banner', 'premium-blog','premium-carousel', 'premium-countdown','premium-counter','premium-dual-header','premium-fancytext','premium-image-separator','premium-maps','premium-modalbox','premium-person','premium-progressbar','premium-testimonials','premium-title','premium-videobox','premium-pricing-table','premium-button','premium-contactform', 'premium-image-button', 'premium-grid','premium-vscroll', 'premium-image-scroll', 'premium-templates'];
16
 
17
  private $pa_default_settings;
18
 
140
 
141
  public function pa_admin_page() {
142
 
143
+ $theme_slug = Helper_Functions::get_installed_theme();
144
 
145
  $js_info = array(
146
  'ajaxurl' => admin_url( 'admin-ajax.php' ),
147
+ 'theme' => $theme_slug
148
  );
149
 
150
  wp_localize_script( 'pa-admin-js', 'settings', $js_info );
353
  </label>
354
  </td>
355
 
356
+ <th><?php echo sprintf( '%1$s %2$s', $prefix, __('Templates', 'premium-addons-for-elementor') ); ?></th>
357
  <td>
358
  <label class="switch">
359
+ <input type="checkbox" id="premium-templates" name="premium-templates" <?php checked(1, $this->pa_get_settings['premium-templates'], true) ?>>
360
  <span class="slider round"></span>
361
  </label>
362
  </td>
363
+
364
  </tr>
365
 
366
  <tr>
367
+
368
+ <th><?php echo sprintf( '%1$s %2$s', $prefix, __('Title', 'premium-addons-for-elementor') ); ?></th>
369
+ <td>
370
+ <label class="switch">
371
+ <input type="checkbox" id="premium-title" name="premium-title" <?php checked(1, $this->pa_get_settings['premium-title'], true) ?>>
372
+ <span class="slider round"></span>
373
+ </label>
374
+ </td>
375
+
376
  <th><?php echo sprintf( '%1$s %2$s', $prefix, __('Video Box', 'premium-addons-for-elementor') ); ?></th>
377
  <td>
378
  <label class="switch">
380
  <span class="slider round"></span>
381
  </label>
382
  </td>
383
+
384
+ </tr>
385
+
386
+ <tr>
387
+
388
  <th><?php echo sprintf( '%1$s %2$s', $prefix, __('Vertical Scroll', 'premium-addons-for-elementor') ); ?></th>
389
  <td>
390
  <label class="switch">
680
 
681
  return $enabled_keys;
682
  }
683
+
684
+ /*
685
+ * Check If Premium Templates is enabled
686
+ *
687
+ * @since 3.6.0
688
+ * @access public
689
+ *
690
+ * @return boolean
691
+ */
692
+ public static function check_premium_templates() {
693
+
694
+ $premium_templates = self::get_enabled_keys()['premium-templates'];
695
+
696
+ return $premium_templates;
697
+ }
698
 
699
  public function pa_save_settings() {
700
 
719
  'premium-progressbar' => intval( $settings['premium-progressbar'] ? 1 : 0 ),
720
  'premium-testimonials' => intval( $settings['premium-testimonials'] ? 1 : 0 ),
721
  'premium-title' => intval( $settings['premium-title'] ? 1 : 0 ),
722
+ 'premium-templates' => intval( $settings['premium-templates'] ? 1 : 0 ),
723
  'premium-videobox' => intval( $settings['premium-videobox'] ? 1 : 0 ),
724
  'premium-pricing-table' => intval( $settings['premium-pricing-table'] ? 1 : 0),
725
  'premium-button' => intval( $settings['premium-button'] ? 1 : 0),
assets/editor/templates/css/editor.css ADDED
@@ -0,0 +1,515 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #premium-template-modal .dialog-widget-content {
2
+ background-color: #f1f3f5;
3
+ width: 100%;
4
+ }
5
+ @media (max-width: 1439px) {
6
+ #premium-template-modal .dialog-widget-content {
7
+ max-width: 990px;
8
+ }
9
+ }
10
+ @media (min-width: 1440px) {
11
+ #premium-template-modal .dialog-widget-content {
12
+ max-width: 1200px;
13
+ }
14
+ }
15
+ #premium-template-modal .dialog-widget-header,
16
+ #premium-template-modal .dialog-header {
17
+ padding: 0;
18
+ background-color: #fff;
19
+ -webkit-box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
20
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
21
+ position: relative;
22
+ z-index: 1;
23
+ }
24
+ #premium-template-modal .dialog-buttons-wrapper {
25
+ display: none;
26
+ }
27
+ #premium-template-modal a,
28
+ #premium-template-modal a:hover {
29
+ color: inherit;
30
+ }
31
+ #premium-template-modal a.elementor-template-library-blank-footer-link {
32
+ -webkit-transition: color 0.5s;
33
+ transition: color 0.5s;
34
+ }
35
+ #premium-template-modal a.elementor-template-library-blank-footer-link:hover {
36
+ color: #9b0a46;
37
+ }
38
+ #premium-template-modal .elementor-button {
39
+ text-transform: uppercase;
40
+ }
41
+ #premium-template-modal ::-webkit-scrollbar {
42
+ width: 6px;
43
+ height: 0;
44
+ border-radius: 3px;
45
+ }
46
+ #premium-template-modal ::-webkit-scrollbar-button {
47
+ width: 0;
48
+ height: 10px;
49
+ }
50
+ #premium-template-modal ::-webkit-scrollbar-thumb {
51
+ background-color: #d5dadf;
52
+ border: 0 none #d5dadf;
53
+ border-radius: 0;
54
+ border-radius: 3px;
55
+ }
56
+ #premium-template-modal ::-webkit-scrollbar-track {
57
+ border: 0 none #fff;
58
+ border-radius: 0;
59
+ }
60
+ #premium-template-modal ::-webkit-scrollbar-corner {
61
+ background: transparent;
62
+ }
63
+ #premium-template-modal-header {
64
+ display: -webkit-box;
65
+ display: -ms-flexbox;
66
+ display: flex;
67
+ -webkit-box-pack: justify;
68
+ -ms-flex-pack: justify;
69
+ display: -webkit-box;
70
+ display: -webkit-flex;
71
+ display: -ms-flexbox;
72
+ display: flex;
73
+ -webkit-box-align: center;
74
+ -webkit-align-items: center;
75
+ -ms-flex-align: center;
76
+ align-items: center;
77
+ -webkit-box-pack: justify;
78
+ -ms-flex-pack: justify;
79
+
80
+ height: 50px;
81
+ }
82
+ #premium-template-modal-header .premium-template-modal-back {
83
+ background: none;
84
+ border: none;
85
+ border-right: 1px solid #e6e9ec;
86
+ padding: 15px 20px 15px 15px;
87
+ line-height: 20px;
88
+ font-size: 13px;
89
+ font-weight: 700;
90
+ outline: none;
91
+ -webkit-transition: all 200ms linear;
92
+ transition: all 200ms linear;
93
+ cursor: pointer;
94
+ color: #6d7882;
95
+ }
96
+ #premium-template-modal-header .premium-template-modal-back:not(:hover) {
97
+ color: #a4afb7;
98
+ }
99
+ #premium-template-modal-header .elementor-button {
100
+ padding: 8px 10px;
101
+ }
102
+ #premium-template-modal-header-close-modal {
103
+ width: 45px;
104
+ border-left: 1px solid #e6e9ec;
105
+ display: -webkit-box;
106
+ display: -ms-flexbox;
107
+ display: flex;
108
+ -webkit-box-align: center;
109
+ -ms-flex-align: center;
110
+ align-items: center;
111
+ -webkit-box-pack: center;
112
+ -ms-flex-pack: center;
113
+ justify-content: center;
114
+ cursor: pointer;
115
+ -webkit-transition: all 200ms linear;
116
+ transition: all 200ms linear;
117
+ }
118
+ #premium-template-modal-header-close-modal i {
119
+ color: #a4afb7;
120
+ font-size: 16px;
121
+ }
122
+ #premium-template-modal-header-close-modal:hover i {
123
+ color: #6d7882;
124
+ }
125
+ #premium-template-modal-header-actions .template-library-activate-license {
126
+ display: block;
127
+ padding: 8px 10px;
128
+ color: #fff;
129
+ }
130
+ #premium-template-modal-header-actions
131
+ .template-library-activate-license:hover {
132
+ color: #fff;
133
+ opacity: 0.85;
134
+ -webkit-box-shadow: 0 0 2px rgba(0, 0, 0, 0.12),
135
+ 0 2px 2px rgba(0, 0, 0, 0.2);
136
+ box-shadow: 0 0 2px rgba(0, 0, 0, 0.12), 0 2px 2px rgba(0, 0, 0, 0.2);
137
+ }
138
+ #premium-template-modal .elementor-library-error {
139
+ margin: 18% 0 0;
140
+ }
141
+ #premium-template-modal .elementor-library-error-message {
142
+ font-size: 18px;
143
+ padding: 0 0 20px;
144
+ }
145
+ #premium-template-modal .elementor-library-error-link a {
146
+ display: inline-block;
147
+ color: #fff;
148
+ background-image: none;
149
+ background: #fcb92c;
150
+ font-size: 13px;
151
+ font-weight: 400;
152
+ font-style: normal;
153
+ text-transform: uppercase;
154
+ line-height: 1;
155
+ height: 40px;
156
+ line-height: 40px;
157
+ min-width: 170px;
158
+ padding: 0 20px;
159
+ border: none;
160
+ border-radius: 3px;
161
+ cursor: pointer;
162
+ -webkit-transition: all 0.5s;
163
+ transition: all 0.5s;
164
+ }
165
+ #premium-template-modal .elementor-library-error-link a:hover {
166
+ opacity: 0.85;
167
+ -webkit-box-shadow: 0 0 2px rgba(0, 0, 0, 0.12),
168
+ 0 2px 2px rgba(0, 0, 0, 0.2);
169
+ box-shadow: 0 0 2px rgba(0, 0, 0, 0.12), 0 2px 2px rgba(0, 0, 0, 0.2);
170
+ }
171
+ #premium-modal-tabs-items {
172
+ display: none;
173
+ }
174
+ #premium-template-modal-header-tabs {
175
+ display: -webkit-box;
176
+ display: -webkit-flex;
177
+ display: -ms-flexbox;
178
+ display: flex;
179
+ flex: 2;
180
+ -webkit-box-align: center;
181
+ -webkit-align-items: center;
182
+ -ms-flex-align: center;
183
+ align-items: center;
184
+ -webkit-box-pack: justify;
185
+ -webkit-justify-content: space-between;
186
+ -ms-flex-pack: justify;
187
+ justify-content: space-between;
188
+ }
189
+ #premium-template-modal-header-logo-area {
190
+ text-align: left;
191
+ padding-left: 15px;
192
+ }
193
+ #premium-template-modal-header-logo-area > * {
194
+ display: -webkit-box;
195
+ display: -webkit-flex;
196
+ display: -ms-flexbox;
197
+ display: flex;
198
+ -webkit-box-align: center;
199
+ -webkit-align-items: center;
200
+ -ms-flex-align: center;
201
+ align-items: center;
202
+ }
203
+ #premium-template-modal-header-logo .premium-template-modal-header-logo-icon {
204
+ margin-right: 5px;
205
+ }
206
+ #premium-template-modal-header-logo
207
+ .premium-template-modal-header-logo-icon
208
+ img {
209
+ width: 30px;
210
+ height: 30px;
211
+ }
212
+ #premium-template-modal-header-logo {
213
+ line-height: 1;
214
+ text-transform: uppercase;
215
+ font-weight: 700;
216
+ cursor: pointer;
217
+ }
218
+ #premium-template-library-content {
219
+ display: -webkit-box;
220
+ display: -ms-flexbox;
221
+ display: flex;
222
+ height: calc(100% - 20px);
223
+ }
224
+ #premium-template-library-content .premium-filters-list {
225
+ width: 18%;
226
+ padding: 0px 10px 10px 0px;
227
+ height: 100%;
228
+ overflow: auto;
229
+ }
230
+ #premium-template-library-content .premium-templates-wrap {
231
+ width: 85%;
232
+ }
233
+ #premium-template-library-content .premium-templates-list {
234
+ height: 100%;
235
+ overflow: auto;
236
+ margin-top: 12px;
237
+ }
238
+ #premium-template-library-content .premium-keywords-list {
239
+ padding-left: 10px;
240
+ }
241
+ #elementor-template-library-filter {
242
+ display: -webkit-box;
243
+ display: -ms-flexbox;
244
+ display: flex;
245
+ align-items: center;
246
+ }
247
+ #elementor-template-library-filter label {
248
+ font-size: 14px;s
249
+ font-weight: 500;
250
+ margin-right: 0.5em;
251
+ }
252
+ #premium-template-modal .elementor-loader {
253
+ position: relative;
254
+ }
255
+ #premium-template-modal .elementor-loader .elementor-loader-box:first-of-type {
256
+ left: 40px;
257
+ top: 40px;
258
+ width: 14px;
259
+ height: 70px;
260
+ }
261
+ #premium-template-modal .elementor-loader .elementor-loader-box:nth-of-type(2) {
262
+ top: 40px;
263
+ }
264
+ #premium-template-modal .elementor-loader .elementor-loader-box:nth-of-type(3) {
265
+ top: 68px;
266
+ }
267
+ #premium-template-modal .elementor-loader .elementor-loader-box:nth-of-type(4) {
268
+ bottom: 40px;
269
+ }
270
+ #premium-template-modal
271
+ .elementor-loader
272
+ .elementor-loader-box:not(:first-of-type) {
273
+ right: 40px;
274
+ height: 14px;
275
+ width: 42px;
276
+ }
277
+ #premium-template-library-content .premium-template-filter-label {
278
+ display: block;
279
+ position: relative;
280
+ text-align: left;
281
+ padding: 9px 0;
282
+ }
283
+ #premium-template-library-content
284
+ .premium-template-filter-label
285
+ input[type="radio"] {
286
+ position: absolute;
287
+ left: 0;
288
+ top: 0;
289
+ right: 0;
290
+ bottom: 0;
291
+ margin: 0;
292
+ opacity: 0;
293
+ display: block;
294
+ width: 100%;
295
+ height: 100%;
296
+ }
297
+ #premium-template-library-content .premium-template-filter-label:hover span,
298
+ #premium-template-library-content
299
+ .premium-template-filter-label
300
+ input:checked
301
+ + span {
302
+ color: #f47216;
303
+ }
304
+ #premium-template-library-content .premium-template-filter-item {
305
+ border-top: 1px solid rgba(213, 218, 223, 0.5);
306
+ }
307
+ #premium-template-library-content .premium-template-filter-item:first-child {
308
+ border-top: none;
309
+ }
310
+ #premium-template-library-content .premium-templates-wrap {
311
+ width: 100%;
312
+ }
313
+ #premium-template-library-content .premium-template-insert {
314
+ padding: 5px 12px;
315
+ }
316
+ #premium-template-library-content .premium-template-insert i {
317
+ margin-right: 2px;
318
+ }
319
+ #premium-template-library-content .premium-template-insert span {
320
+ font-size: 11px;
321
+ }
322
+ #premium-template-library-content .elementor-template-library-template-name {
323
+ width: 200px;
324
+ }
325
+ #premium-modal-templates-container {
326
+ display: -webkit-box;
327
+ display: -ms-flexbox;
328
+ display: flex;
329
+ -ms-flex-wrap: wrap;
330
+ flex-wrap: wrap;
331
+ -webkit-box-align: start;
332
+ -ms-flex-align: start;
333
+ align-items: flex-start;
334
+ }
335
+ #premium-modal-templates-container .elementor-template-library-template {
336
+ position: relative;
337
+ }
338
+ #premium-modal-templates-container .premium-template-pro::before {
339
+ position: absolute;
340
+ right: -76px;
341
+ top: 2px;
342
+ content: "PRO";
343
+ z-index: 10;
344
+ width: 180px;
345
+ height: 20px;
346
+ padding: 0 20px;
347
+ font-size: 12px;
348
+ line-height: 10px;
349
+ text-align: center;
350
+ color: #fff;
351
+ font-weight: bold;
352
+ box-shadow: 0px 1px 3px #888888;
353
+ background: #f47216;
354
+ border-top: 5px solid #f47216;
355
+ border-bottom: 5px solid #f47216;
356
+ -webkit-transform: rotate(35deg);
357
+ transform: rotate(35deg);
358
+ }
359
+ #premium-modal-templates-container .elementor-template-library-template-remote {
360
+ width: calc(33.3333% - 30px);
361
+ }
362
+ #premium-template-library-content
363
+ #premium-modal-templates-container
364
+ .elementor-template-library-template-controls {
365
+ position: absolute;
366
+ background-color: #fff;
367
+ left: 0;
368
+ bottom: -15px;
369
+ right: 0;
370
+ display: -webkit-box;
371
+ display: -ms-flexbox;
372
+ display: flex;
373
+ -webkit-box-pack: justify;
374
+ -ms-flex-pack: justify;
375
+ -webkit-transition: all 0.3s ease;
376
+ transition: all 0.3s ease;
377
+ justify-content: center;
378
+ padding: 9px 10px 9px 8px;
379
+ z-index: 10;
380
+ }
381
+ #premium-template-library-content
382
+ #premium-modal-templates-container
383
+ .elementor-template-library-template:hover
384
+ .elementor-template-library-template-controls {
385
+ bottom: 0;
386
+ }
387
+ #premium-template-library-content
388
+ #premium-modal-templates-container
389
+ .premium-template-insert {
390
+ padding: 0;
391
+ margin: 0;
392
+ color: #39b54a;
393
+ background: none;
394
+ text-transform: none;
395
+ font-size: 12px;
396
+ }
397
+ #premium-template-library-content
398
+ #premium-modal-templates-container
399
+ .premium-clone-template {
400
+ background: none;
401
+ border: none;
402
+ padding: 0;
403
+ margin: 0;
404
+ color: #9b0a46;
405
+ cursor: pointer;
406
+ display: none;
407
+ font-size: 12px;
408
+ -webkit-box-shadow: none;
409
+ box-shadow: none;
410
+ outline: none;
411
+ font-weight: bold;
412
+ }
413
+ div.premium-template-has-url:hover .premium-clone-template {
414
+ display: block !important;
415
+ }
416
+ #premium-template-library-content
417
+ #premium-modal-templates-container
418
+ .premium-template-insert:hover {
419
+ -webkit-box-shadow: none;
420
+ box-shadow: none;
421
+ }
422
+ #premium-template-library-content
423
+ #premium-modal-templates-container
424
+ .elementor-template-library-template-name {
425
+ padding: 5px 0 0;
426
+ text-align: center;
427
+ display: block !important;
428
+ }
429
+ #premium-template-library-content
430
+ #premium-modal-templates-container
431
+ .elementor-template-library-template-name-holder {
432
+ height: 23px;
433
+ }
434
+ #premium-template-library-content
435
+ #premium-modal-templates-container
436
+ .template-library-activate-license {
437
+ display: none;
438
+ color: #fcb92c;
439
+ font-size: 12px;
440
+ }
441
+ #premium-template-library-content
442
+ #premium-modal-templates-container
443
+ .template-library-activate-license:hover {
444
+ color: #d89403;
445
+ }
446
+ #premium-template-library-content
447
+ #premium-modal-templates-container
448
+ .elementor-template-library-template:hover
449
+ .elementor-template-library-template-name {
450
+ opacity: 0;
451
+ }
452
+ .library-tab-premium_page
453
+ #premium-modal-templates-container
454
+ .elementor-template-library-template-remote {
455
+ width: calc(25% - 20px);
456
+ margin: 10px;
457
+ }
458
+ .library-tab-premium_page
459
+ #premium-modal-templates-container
460
+ .elementor-template-library-template-remote
461
+ .elementor-template-library-template-action {
462
+ padding: 8px;
463
+ }
464
+ #premium-modal-templates-container
465
+ .premium-template-no-url
466
+ .elementor-template-library-template-preview {
467
+ cursor: default !important;
468
+ opacity: 0 !important;
469
+ }
470
+ #premium-modal-templates-container .premium-template-no-url .fa-search-plus {
471
+ display: none !important;
472
+ }
473
+ #premium-modal-templates-container
474
+ .elementor-template-library-template:hover
475
+ .template-library-activate-license {
476
+ display: block !important;
477
+ }
478
+ .elementor-template-library-template-screenshot img {
479
+ width: 100%;
480
+ max-width: 100%;
481
+ height: auto;
482
+ display: block;
483
+ }
484
+ /* * Preview Iframe */
485
+ #premium-templatate-item-preview-wrap,
486
+ #premium-templatate-item-preview-wrap .premium-template-item-preview-iframe {
487
+ height: 100%;
488
+ overflow: hidden;
489
+ }
490
+ #premium-templatate-item-preview-wrap iframe {
491
+ height: 140%;
492
+ -webkit-transform: scale(0.666) translateX(-25%) translateY(-25%);
493
+ -ms-transform: scale(0.666) translateX(-25%) translateY(-25%);
494
+ transform: scale(0.666) translateX(-25%) translateY(-25%);
495
+ }
496
+ @media (max-width: 1439px) {
497
+ #premium-templatate-item-preview-wrap iframe {
498
+ width: 1440px;
499
+ }
500
+ }
501
+ @media (min-width: 1440px) {
502
+ #premium-templatate-item-preview-wrap iframe {
503
+ width: 1710px;
504
+ }
505
+ }
506
+ .premium-template-item-notice div {
507
+ color: #31708f;
508
+ background-color: #d9edf7;
509
+ border-color: #bcdff1;
510
+ padding: 15px;
511
+ border-left: 5px solid #bcdff1;
512
+ position: relative;
513
+ text-align: left;
514
+ margin-bottom: 8px;
515
+ }
assets/editor/templates/css/preview.css ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ .elementor-add-new-section .pa-add-section-btn {
2
+ color: #fff;
3
+ background: #F47216;
4
+ margin-right: 5px;
5
+ }
assets/editor/templates/js/editor.js ADDED
@@ -0,0 +1,1022 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function ($) {
2
+
3
+ 'use strict';
4
+
5
+ var PremiumTempsData = window.PremiumTempsData || {},
6
+ PremiumEditor,
7
+ PremiumEditorViews,
8
+ PremiumControlsViews,
9
+ PremiumModules;
10
+
11
+ PremiumEditorViews = {
12
+
13
+ ModalLayoutView: null,
14
+ ModalHeaderView: null,
15
+ ModalHeaderInsertButton: null,
16
+ ModalLoadingView: null,
17
+ ModalBodyView: null,
18
+ ModalErrorView: null,
19
+ LibraryCollection: null,
20
+ KeywordsModel: null,
21
+ ModalCollectionView: null,
22
+ ModalTabsCollection: null,
23
+ ModalTabsCollectionView: null,
24
+ FiltersCollectionView: null,
25
+ FiltersItemView: null,
26
+ ModalTabsItemView: null,
27
+ ModalTemplateItemView: null,
28
+ ModalInsertTemplateBehavior: null,
29
+ ModalTemplateModel: null,
30
+ CategoriesCollection: null,
31
+ ModalPreviewView: null,
32
+ ModalHeaderBack: null,
33
+ ModalHeaderLogo: null,
34
+ KeywordsView: null,
35
+ TabModel: null,
36
+ CategoryModel: null,
37
+
38
+ init: function () {
39
+ var self = this;
40
+
41
+ self.ModalTemplateModel = Backbone.Model.extend({
42
+ defaults: {
43
+ template_id: 0,
44
+ name: '',
45
+ title: '',
46
+ thumbnail: '',
47
+ preview: '',
48
+ source: '',
49
+ categories: [],
50
+ keywords: []
51
+ }
52
+ });
53
+
54
+ self.ModalHeaderView = Marionette.LayoutView.extend({
55
+
56
+ id: 'premium-template-modal-header',
57
+ template: '#tmpl-premium-template-modal-header',
58
+
59
+ ui: {
60
+ closeModal: '#premium-template-modal-header-close-modal'
61
+ },
62
+
63
+ events: {
64
+ 'click @ui.closeModal': 'onCloseModalClick'
65
+ },
66
+
67
+ regions: {
68
+ headerLogo: '#premium-template-modal-header-logo-area',
69
+ headerTabs: '#premium-template-modal-header-tabs',
70
+ headerActions: '#premium-template-modal-header-actions'
71
+ },
72
+
73
+ onCloseModalClick: function () {
74
+ PremiumEditor.closeModal();
75
+ }
76
+
77
+ });
78
+
79
+ self.TabModel = Backbone.Model.extend({
80
+ defaults: {
81
+ slug: '',
82
+ title: ''
83
+ }
84
+ });
85
+
86
+ self.LibraryCollection = Backbone.Collection.extend({
87
+ model: self.ModalTemplateModel
88
+ });
89
+
90
+ self.ModalTabsCollection = Backbone.Collection.extend({
91
+ model: self.TabModel
92
+ });
93
+
94
+ self.CategoryModel = Backbone.Model.extend({
95
+ defaults: {
96
+ slug: '',
97
+ title: ''
98
+ }
99
+ });
100
+
101
+ self.KeywordsModel = Backbone.Model.extend({
102
+ defaults: {
103
+ keywords: {}
104
+ }
105
+ });
106
+
107
+ self.CategoriesCollection = Backbone.Collection.extend({
108
+ model: self.CategoryModel
109
+ });
110
+
111
+ self.KeywordsView = Marionette.ItemView.extend({
112
+ id: 'elementor-template-library-filter',
113
+ template: '#tmpl-premium-template-modal-keywords',
114
+ ui: {
115
+ keywords: '.premium-library-keywords'
116
+ },
117
+
118
+ events: {
119
+ 'change @ui.keywords': 'onSelectKeyword'
120
+ },
121
+
122
+ onSelectKeyword: function (event) {
123
+ var selected = event.currentTarget.selectedOptions[0].value;
124
+ PremiumEditor.setFilter('keyword', selected);
125
+ },
126
+
127
+ onRender: function() {
128
+ var $filters = this.$('.premium-library-keywords');
129
+ $filters.select2({
130
+ placeholder: 'Choose Widget',
131
+ allowClear: true,
132
+ width: 250
133
+ });
134
+ }
135
+ });
136
+
137
+ self.ModalPreviewView = Marionette.ItemView.extend({
138
+
139
+ template: '#tmpl-premium-template-modal-preview',
140
+
141
+ id: 'premium-templatate-item-preview-wrap',
142
+
143
+ ui: {
144
+ iframe: 'iframe',
145
+ notice: '.premium-template-item-notice'
146
+ },
147
+
148
+
149
+ onRender: function () {
150
+
151
+ if (null !== this.getOption('notice')) {
152
+ if (this.getOption('notice').length) {
153
+ var message = "";
154
+ if (-1 !== this.getOption('notice').indexOf("facebook")) {
155
+ message += "<p>Please login with your Facebook account in order to get your Facebook Reviews.</p>";
156
+ } else if (-1 !== this.getOption('notice').indexOf("google")) {
157
+ message += "<p>You need to add your Google API key from Dashboard -> Premium Add-ons for Elementor -> Google Maps</p>";
158
+ } else if (-1 !== this.getOption('notice').indexOf("form")) {
159
+ message += "<p>You need to have <a href='https://wordpress.org/plugins/contact-form-7/' target='_blank'>Contact Form 7 plugin</a> installed and active.</p>";
160
+ }
161
+ console.log(this.ui.notice);
162
+ this.ui.notice.html('<div><p><strong>Important!</strong></p>' + message + '</div>');
163
+ }
164
+ }
165
+
166
+ this.ui.iframe.attr('src', this.getOption('url'));
167
+
168
+ }
169
+ });
170
+
171
+ self.ModalHeaderBack = Marionette.ItemView.extend({
172
+
173
+ template: '#tmpl-premium-template-modal-header-back',
174
+
175
+ id: 'premium-template-modal-header-back',
176
+
177
+ ui: {
178
+ button: 'button'
179
+ },
180
+
181
+ events: {
182
+ 'click @ui.button': 'onBackClick',
183
+ },
184
+
185
+ onBackClick: function () {
186
+ PremiumEditor.setPreview('back');
187
+ }
188
+
189
+ });
190
+
191
+ self.ModalHeaderLogo = Marionette.ItemView.extend({
192
+
193
+ template: '#tmpl-premium-template-modal-header-logo',
194
+
195
+ id: 'premium-template-modal-header-logo'
196
+
197
+ });
198
+
199
+ self.ModalBodyView = Marionette.LayoutView.extend({
200
+
201
+ id: 'premium-template-library-content',
202
+
203
+ className: function () {
204
+ return 'library-tab-' + PremiumEditor.getTab();
205
+ },
206
+
207
+ template: '#tmpl-premium-template-modal-content',
208
+
209
+ regions: {
210
+ contentTemplates: '.premium-templates-list',
211
+ contentFilters: '.premium-filters-list',
212
+ contentKeywords: '.premium-keywords-list'
213
+ }
214
+
215
+ });
216
+
217
+ self.ModalInsertTemplateBehavior = Marionette.Behavior.extend({
218
+ ui: {
219
+ insertButton: '.premium-template-insert'
220
+ },
221
+
222
+ events: {
223
+ 'click @ui.insertButton': 'onInsertButtonClick'
224
+ },
225
+
226
+ onInsertButtonClick: function () {
227
+
228
+ var templateModel = this.view.model,
229
+ innerTemplates = templateModel.attributes.dependencies,
230
+ isPro = templateModel.attributes.pro,
231
+ innerTemplatesLength = Object.keys(innerTemplates).length,
232
+ options = {};
233
+
234
+ PremiumEditor.layout.showLoadingView();
235
+ if (innerTemplatesLength > 0) {
236
+ for (var key in innerTemplates) {
237
+ $.ajax({
238
+ url: ajaxurl,
239
+ type: 'post',
240
+ dataType: 'json',
241
+ data: {
242
+ action: 'premium_inner_template',
243
+ template: innerTemplates[key],
244
+ tab: PremiumEditor.getTab()
245
+ }
246
+ });
247
+ }
248
+ }
249
+
250
+ if ("valid" === PremiumTempsData.license.status || !isPro) {
251
+ elementor.templates.requestTemplateContent(
252
+ templateModel.get('source'),
253
+ templateModel.get('template_id'),
254
+ {
255
+ data: {
256
+ tab: PremiumEditor.getTab(),
257
+ page_settings: false
258
+ },
259
+ success: function (data) {
260
+ console.log("%c Inner Templates Inserted Successfully!!", "color: #7a7a7a; background-color: #eee;");
261
+
262
+ PremiumEditor.closeModal();
263
+
264
+ elementor.channels.data.trigger('template:before:insert', templateModel);
265
+
266
+ if (null !== PremiumEditor.atIndex) {
267
+ options.at = PremiumEditor.atIndex;
268
+ }
269
+
270
+ elementor.sections.currentView.addChildModel(data.content, options);
271
+
272
+ elementor.channels.data.trigger('template:after:insert', templateModel);
273
+
274
+ PremiumEditor.atIndex = null;
275
+
276
+ },
277
+ error: function (err) {
278
+ console.log(err);
279
+ }
280
+ }
281
+ );
282
+ } else {
283
+ PremiumEditor.layout.showLicenseError();
284
+ }
285
+ }
286
+ });
287
+
288
+ self.ModalHeaderInsertButton = Marionette.ItemView.extend({
289
+
290
+ template: '#tmpl-premium-template-modal-insert-button',
291
+
292
+ id: 'premium-template-modal-insert-button',
293
+
294
+ behaviors: {
295
+ insertTemplate: {
296
+ behaviorClass: self.ModalInsertTemplateBehavior
297
+ }
298
+ }
299
+
300
+ });
301
+
302
+ self.FiltersItemView = Marionette.ItemView.extend({
303
+
304
+ template: '#tmpl-premium-template-modal-filters-item',
305
+
306
+ className: function () {
307
+ return 'premium-template-filter-item';
308
+ },
309
+
310
+ ui: function () {
311
+ return {
312
+ filterLabels: '.premium-template-filter-label'
313
+ };
314
+ },
315
+
316
+ events: function () {
317
+ return {
318
+ 'click @ui.filterLabels': 'onFilterClick'
319
+ };
320
+ },
321
+
322
+ onFilterClick: function (event) {
323
+
324
+ var $clickedInput = jQuery(event.target);
325
+ jQuery('.premium-library-keywords').val('');
326
+ PremiumEditor.setFilter('category', $clickedInput.val());
327
+ PremiumEditor.setFilter('keyword', '');
328
+ }
329
+
330
+ });
331
+
332
+ self.ModalTabsItemView = Marionette.ItemView.extend({
333
+
334
+ template: '#tmpl-premium-template-modal-tabs-item',
335
+
336
+ className: function () {
337
+ return 'elementor-template-library-menu-item';
338
+ },
339
+
340
+ ui: function () {
341
+ return {
342
+ tabsLabels: 'label',
343
+ tabsInput: 'input'
344
+ };
345
+ },
346
+
347
+ events: function () {
348
+ return {
349
+ 'click @ui.tabsLabels': 'onTabClick'
350
+ };
351
+ },
352
+
353
+ onRender: function () {
354
+ if (this.model.get('slug') === PremiumEditor.getTab()) {
355
+ this.ui.tabsInput.attr('checked', 'checked');
356
+ }
357
+ },
358
+
359
+ onTabClick: function (event) {
360
+
361
+ var $clickedInput = jQuery(event.target);
362
+ PremiumEditor.setTab($clickedInput.val());
363
+ PremiumEditor.setFilter('keyword', '');
364
+ }
365
+
366
+ });
367
+
368
+ self.FiltersCollectionView = Marionette.CompositeView.extend({
369
+
370
+ id: 'premium-template-library-filters',
371
+
372
+ template: '#tmpl-premium-template-modal-filters',
373
+
374
+ childViewContainer: '#premium-modal-filters-container',
375
+
376
+ getChildView: function (childModel) {
377
+ return self.FiltersItemView;
378
+ }
379
+
380
+ });
381
+
382
+ self.ModalTabsCollectionView = Marionette.CompositeView.extend({
383
+
384
+ template: '#tmpl-premium-template-modal-tabs',
385
+
386
+ childViewContainer: '#premium-modal-tabs-items',
387
+
388
+ initialize: function () {
389
+ this.listenTo(PremiumEditor.channels.layout, 'tamplate:cloned', this._renderChildren);
390
+ },
391
+
392
+ getChildView: function (childModel) {
393
+ return self.ModalTabsItemView;
394
+ }
395
+
396
+ });
397
+
398
+ self.ModalTemplateItemView = Marionette.ItemView.extend({
399
+
400
+ template: '#tmpl-premium-template-modal-item',
401
+
402
+ className: function () {
403
+
404
+ var urlClass = ' premium-template-has-url',
405
+ sourceClass = ' elementor-template-library-template-',
406
+ proTemplate = '';
407
+
408
+ if ('' === this.model.get('preview')) {
409
+ urlClass = ' premium-template-no-url';
410
+ }
411
+
412
+ sourceClass += 'remote';
413
+
414
+ if (this.model.get('pro')) {
415
+ proTemplate = ' premium-template-pro';
416
+ }
417
+
418
+ return 'elementor-template-library-template' + sourceClass + urlClass + proTemplate;
419
+ },
420
+
421
+ ui: function () {
422
+ return {
423
+ previewButton: '.elementor-template-library-template-preview',
424
+ };
425
+ },
426
+
427
+ events: function () {
428
+ return {
429
+ 'click @ui.previewButton': 'onPreviewButtonClick',
430
+ };
431
+ },
432
+
433
+ onPreviewButtonClick: function () {
434
+
435
+ if ('' === this.model.get('url')) {
436
+ return;
437
+ }
438
+
439
+ PremiumEditor.setPreview(this.model);
440
+ },
441
+
442
+ behaviors: {
443
+ insertTemplate: {
444
+ behaviorClass: self.ModalInsertTemplateBehavior
445
+ }
446
+ }
447
+ });
448
+
449
+ self.ModalCollectionView = Marionette.CompositeView.extend({
450
+
451
+ template: '#tmpl-premium-template-modal-templates',
452
+
453
+ id: 'premium-template-library-templates',
454
+
455
+ childViewContainer: '#premium-modal-templates-container',
456
+
457
+ initialize: function () {
458
+
459
+ this.listenTo(PremiumEditor.channels.templates, 'filter:change', this._renderChildren);
460
+ },
461
+
462
+ filter: function (childModel) {
463
+
464
+ var filter = PremiumEditor.getFilter('category'),
465
+ keyword = PremiumEditor.getFilter('keyword');
466
+
467
+ if (!filter && !keyword) {
468
+ return true;
469
+ }
470
+
471
+ if (keyword && !filter) {
472
+ return _.contains(childModel.get('keywords'), keyword);
473
+ }
474
+
475
+ if (filter && !keyword) {
476
+ return _.contains(childModel.get('categories'), filter);
477
+ }
478
+
479
+ return _.contains(childModel.get('categories'), filter) && _.contains(childModel.get('keywords'), keyword);
480
+
481
+ },
482
+
483
+ getChildView: function (childModel) {
484
+ return self.ModalTemplateItemView;
485
+ },
486
+
487
+ onRenderCollection: function () {
488
+
489
+ var container = this.$childViewContainer,
490
+ items = this.$childViewContainer.children(),
491
+ tab = PremiumEditor.getTab();
492
+
493
+ if ('premium_page' === tab || 'local' === tab) {
494
+ return;
495
+ }
496
+
497
+ // Wait for thumbnails to be loaded
498
+ container.imagesLoaded(function () {}).done(function () {
499
+ self.masonry.init({
500
+ container: container,
501
+ items: items
502
+ });
503
+ });
504
+ }
505
+
506
+ });
507
+
508
+ self.ModalLayoutView = Marionette.LayoutView.extend({
509
+
510
+ el: '#premium-template-modal',
511
+
512
+ regions: PremiumTempsData.modalRegions,
513
+
514
+ initialize: function () {
515
+
516
+ this.getRegion('modalHeader').show(new self.ModalHeaderView());
517
+ this.listenTo(PremiumEditor.channels.tabs, 'filter:change', this.switchTabs);
518
+ this.listenTo(PremiumEditor.channels.layout, 'preview:change', this.switchPreview);
519
+
520
+ },
521
+
522
+ switchTabs: function () {
523
+ this.showLoadingView();
524
+ PremiumEditor.setFilter('keyword', '');
525
+ PremiumEditor.requestTemplates(PremiumEditor.getTab());
526
+ },
527
+
528
+ switchPreview: function () {
529
+
530
+ var header = this.getHeaderView(),
531
+ preview = PremiumEditor.getPreview();
532
+
533
+ if ('back' === preview) {
534
+ header.headerLogo.show(new self.ModalHeaderLogo());
535
+ header.headerTabs.show(new self.ModalTabsCollectionView({
536
+ collection: PremiumEditor.collections.tabs
537
+ }));
538
+
539
+ header.headerActions.empty();
540
+ PremiumEditor.setTab(PremiumEditor.getTab());
541
+ return;
542
+ }
543
+
544
+ if ('initial' === preview) {
545
+ header.headerActions.empty();
546
+ header.headerLogo.show(new self.ModalHeaderLogo());
547
+ return;
548
+ }
549
+
550
+ this.getRegion('modalContent').show(new self.ModalPreviewView({
551
+ 'preview': preview.get('preview'),
552
+ 'url': preview.get('url'),
553
+ 'notice': preview.get('notice')
554
+ }));
555
+
556
+ header.headerLogo.empty();
557
+ header.headerTabs.show(new self.ModalHeaderBack());
558
+ header.headerActions.show(new self.ModalHeaderInsertButton({
559
+ model: preview
560
+ }));
561
+
562
+ },
563
+
564
+ getHeaderView: function () {
565
+ return this.getRegion('modalHeader').currentView;
566
+ },
567
+
568
+ getContentView: function () {
569
+ return this.getRegion('modalContent').currentView;
570
+ },
571
+
572
+ showLoadingView: function () {
573
+ this.modalContent.show(new self.ModalLoadingView());
574
+ },
575
+
576
+ showLicenseError: function () {
577
+ this.modalContent.show(new self.ModalErrorView());
578
+ },
579
+
580
+ showTemplatesView: function (templatesCollection, categoriesCollection, keywords) {
581
+
582
+ this.getRegion('modalContent').show(new self.ModalBodyView());
583
+
584
+ var contentView = this.getContentView(),
585
+ header = this.getHeaderView(),
586
+ keywordsModel = new self.KeywordsModel({
587
+ keywords: keywords
588
+ });
589
+
590
+ PremiumEditor.collections.tabs = new self.ModalTabsCollection(PremiumEditor.getTabs());
591
+
592
+ header.headerTabs.show(new self.ModalTabsCollectionView({
593
+ collection: PremiumEditor.collections.tabs
594
+ }));
595
+
596
+ contentView.contentTemplates.show(new self.ModalCollectionView({
597
+ collection: templatesCollection
598
+ }));
599
+
600
+ contentView.contentFilters.show(new self.FiltersCollectionView({
601
+ collection: categoriesCollection
602
+ }));
603
+
604
+ contentView.contentKeywords.show(new self.KeywordsView({
605
+ model: keywordsModel
606
+ }));
607
+
608
+ }
609
+
610
+ });
611
+
612
+ self.ModalLoadingView = Marionette.ItemView.extend({
613
+ id: 'premium-template-modal-loading',
614
+ template: '#tmpl-premium-template-modal-loading'
615
+ });
616
+
617
+ self.ModalErrorView = Marionette.ItemView.extend({
618
+ id: 'premium-template-modal-loading',
619
+ template: '#tmpl-premium-template-modal-error'
620
+ });
621
+
622
+ },
623
+
624
+ masonry: {
625
+
626
+ self: {},
627
+ elements: {},
628
+
629
+ init: function (settings) {
630
+
631
+ var self = this;
632
+ self.settings = $.extend(self.getDefaultSettings(), settings);
633
+ self.elements = self.getDefaultElements();
634
+
635
+ self.run();
636
+ },
637
+
638
+ getSettings: function (key) {
639
+ if (key) {
640
+ return this.settings[key];
641
+ } else {
642
+ return this.settings;
643
+ }
644
+ },
645
+
646
+ getDefaultSettings: function () {
647
+ return {
648
+ container: null,
649
+ items: null,
650
+ columnsCount: 3,
651
+ verticalSpaceBetween: 30
652
+ };
653
+ },
654
+
655
+ getDefaultElements: function () {
656
+ return {
657
+ $container: jQuery(this.getSettings('container')),
658
+ $items: jQuery(this.getSettings('items'))
659
+ };
660
+ },
661
+
662
+ run: function () {
663
+ var heights = [],
664
+ distanceFromTop = this.elements.$container.position().top,
665
+ settings = this.getSettings(),
666
+ columnsCount = settings.columnsCount;
667
+
668
+ distanceFromTop += parseInt(this.elements.$container.css('margin-top'), 10);
669
+
670
+ this.elements.$container.height('');
671
+
672
+ this.elements.$items.each(function (index) {
673
+ var row = Math.floor(index / columnsCount),
674
+ indexAtRow = index % columnsCount,
675
+ $item = jQuery(this),
676
+ itemPosition = $item.position(),
677
+ itemHeight = $item[0].getBoundingClientRect().height + settings.verticalSpaceBetween;
678
+
679
+ if (row) {
680
+ var pullHeight = itemPosition.top - distanceFromTop - heights[indexAtRow];
681
+ pullHeight -= parseInt($item.css('margin-top'), 10);
682
+ pullHeight *= -1;
683
+ $item.css('margin-top', pullHeight + 'px');
684
+ heights[indexAtRow] += itemHeight;
685
+ } else {
686
+ heights.push(itemHeight);
687
+ }
688
+ });
689
+
690
+ this.elements.$container.height(Math.max.apply(Math, heights));
691
+ }
692
+ }
693
+
694
+ };
695
+
696
+ PremiumControlsViews = {
697
+
698
+ PremiumSearchView: null,
699
+
700
+ init: function () {
701
+
702
+ var self = this;
703
+
704
+ self.PremiumSearchView = window.elementor.modules.controls.BaseData.extend({
705
+
706
+ onReady: function () {
707
+
708
+ var action = this.model.attributes.action,
709
+ queryParams = this.model.attributes.query_params;
710
+
711
+ this.ui.select.find('option').each(function (index, el) {
712
+ $(this).attr('selected', true);
713
+ });
714
+
715
+ this.ui.select.select2({
716
+ ajax: {
717
+ url: function () {
718
+
719
+ var query = '';
720
+
721
+ if (queryParams.length > 0) {
722
+ $.each(queryParams, function (index, param) {
723
+
724
+ if (window.elementor.settings.page.model.attributes[param]) {
725
+ query += '&' + param + '=' + window.elementor.settings.page.model.attributes[param];
726
+ }
727
+ });
728
+ }
729
+
730
+ return ajaxurl + '?action=' + action + query;
731
+ },
732
+ dataType: 'json'
733
+ },
734
+ placeholder: 'Please enter 3 or more characters',
735
+ minimumInputLength: 3
736
+ });
737
+
738
+ },
739
+
740
+ onBeforeDestroy: function () {
741
+
742
+ if (this.ui.select.data('select2')) {
743
+ this.ui.select.select2('destroy');
744
+ }
745
+
746
+ this.$el.remove();
747
+ }
748
+
749
+ });
750
+
751
+ window.elementor.addControlView('premium_search', self.PremiumSearchView);
752
+
753
+ }
754
+
755
+ };
756
+
757
+
758
+ PremiumModules = {
759
+
760
+ getDataToSave: function (data) {
761
+ data.id = window.elementor.config.post_id;
762
+ return data;
763
+ },
764
+
765
+ init: function () {
766
+ if (window.elementor.settings.premium_template) {
767
+ window.elementor.settings.premium_template.getDataToSave = this.getDataToSave;
768
+ }
769
+
770
+ if (window.elementor.settings.premium_page) {
771
+ window.elementor.settings.premium_page.getDataToSave = this.getDataToSave;
772
+ window.elementor.settings.premium_page.changeCallbacks = {
773
+ custom_header: function () {
774
+ this.save(function () {
775
+ elementor.reloadPreview();
776
+
777
+ elementor.once('preview:loaded', function () {
778
+ elementor.getPanelView().setPage('premium_page_settings');
779
+ });
780
+ });
781
+ },
782
+ custom_footer: function () {
783
+ this.save(function () {
784
+ elementor.reloadPreview();
785
+
786
+ elementor.once('preview:loaded', function () {
787
+ elementor.getPanelView().setPage('premium_page_settings');
788
+ });
789
+ });
790
+ }
791
+ };
792
+ }
793
+
794
+ }
795
+
796
+ };
797
+
798
+ PremiumEditor = {
799
+
800
+ modal: false,
801
+ layout: false,
802
+ collections: {},
803
+ tabs: {},
804
+ defaultTab: '',
805
+ channels: {},
806
+ atIndex: null,
807
+
808
+ init: function () {
809
+
810
+ window.elementor.on(
811
+ 'preview:loaded',
812
+ window._.bind(PremiumEditor.onPreviewLoaded, PremiumEditor)
813
+ );
814
+
815
+ PremiumEditorViews.init();
816
+ PremiumControlsViews.init();
817
+ PremiumModules.init();
818
+
819
+ },
820
+
821
+ onPreviewLoaded: function () {
822
+
823
+ this.initPremTempsButton();
824
+
825
+ window.elementor.$previewContents.on(
826
+ 'click.addPremiumTemplate',
827
+ '.pa-add-section-btn',
828
+ _.bind(this.showTemplatesModal, this)
829
+ );
830
+
831
+ this.channels = {
832
+ templates: Backbone.Radio.channel('PREMIUM_EDITOR:templates'),
833
+ tabs: Backbone.Radio.channel('PREMIUM_EDITOR:tabs'),
834
+ layout: Backbone.Radio.channel('PREMIUM_EDITOR:layout'),
835
+ };
836
+
837
+ this.tabs = PremiumTempsData.tabs;
838
+ this.defaultTab = PremiumTempsData.defaultTab;
839
+
840
+ },
841
+
842
+ initPremTempsButton: function () {
843
+
844
+
845
+ var $addNewSection = window.elementor.$previewContents.find('.elementor-add-new-section'),
846
+ addPremiumTemplate = "<div class='elementor-add-section-area-button pa-add-section-btn' title='Add Premium Template'><i class='fa fa-star'></i></div>",
847
+ $addPremiumTemplate;
848
+
849
+ if ($addNewSection.length && PremiumTempsData.PremiumTemplatesBtn) {
850
+
851
+ $addPremiumTemplate = $(addPremiumTemplate).prependTo($addNewSection);
852
+ }
853
+
854
+ window.elementor.$previewContents.on(
855
+ 'click.addPremiumTemplate',
856
+ '.elementor-editor-section-settings .elementor-editor-element-add',
857
+ function () {
858
+
859
+ var $this = $(this),
860
+ $section = $this.closest('.elementor-top-section'),
861
+ modelID = $section.data('model-cid');
862
+
863
+ if (window.elementor.sections.currentView.collection.length) {
864
+ $.each(window.elementor.sections.currentView.collection.models, function (index, model) {
865
+ if (modelID === model.cid) {
866
+ PremiumEditor.atIndex = index;
867
+ }
868
+ });
869
+ }
870
+
871
+ if (PremiumTempsData.PremiumTemplatesBtn) {
872
+ setTimeout(function () {
873
+ var $addNew = $section.prev('.elementor-add-section').find('.elementor-add-new-section');
874
+ $addNew.prepend(addPremiumTemplate);
875
+ }, 100);
876
+ }
877
+
878
+ }
879
+ );
880
+ },
881
+
882
+ getFilter: function (name) {
883
+
884
+ return this.channels.templates.request('filter:' + name);
885
+ },
886
+
887
+ setFilter: function (name, value) {
888
+ this.channels.templates.reply('filter:' + name, value);
889
+ this.channels.templates.trigger('filter:change');
890
+ },
891
+
892
+ getTab: function () {
893
+ return this.channels.tabs.request('filter:tabs');
894
+ },
895
+
896
+ setTab: function (value, silent) {
897
+
898
+ this.channels.tabs.reply('filter:tabs', value);
899
+
900
+ if (!silent) {
901
+ this.channels.tabs.trigger('filter:change');
902
+ }
903
+
904
+ },
905
+
906
+ getTabs: function () {
907
+
908
+ var tabs = [];
909
+
910
+ _.each(this.tabs, function (item, slug) {
911
+ tabs.push({
912
+ slug: slug,
913
+ title: item.title
914
+ });
915
+ });
916
+
917
+ return tabs;
918
+ },
919
+
920
+ getPreview: function (name) {
921
+ return this.channels.layout.request('preview');
922
+ },
923
+
924
+ setPreview: function (value, silent) {
925
+
926
+ this.channels.layout.reply('preview', value);
927
+
928
+ if (!silent) {
929
+ this.channels.layout.trigger('preview:change');
930
+ }
931
+ },
932
+
933
+ getKeywords: function () {
934
+
935
+ var keywords = [];
936
+
937
+ _.each(this.keywords, function (title, slug) {
938
+ tabs.push({
939
+ slug: slug,
940
+ title: title
941
+ });
942
+ });
943
+
944
+ return keywords;
945
+ },
946
+
947
+ showTemplatesModal: function () {
948
+
949
+ this.getModal().show();
950
+
951
+ if (!this.layout) {
952
+ this.layout = new PremiumEditorViews.ModalLayoutView();
953
+ this.layout.showLoadingView();
954
+ }
955
+
956
+ this.setTab(this.defaultTab, true);
957
+ this.requestTemplates(this.defaultTab);
958
+ this.setPreview('initial');
959
+
960
+ },
961
+
962
+ requestTemplates: function (tabName) {
963
+
964
+ var self = this,
965
+ tab = self.tabs[tabName];
966
+
967
+ self.setFilter('category', false);
968
+
969
+ if (tab.data.templates && tab.data.categories) {
970
+ self.layout.showTemplatesView(tab.data.templates, tab.data.categories, tab.data.keywords);
971
+ } else {
972
+ $.ajax({
973
+ url: ajaxurl,
974
+ type: 'get',
975
+ dataType: 'json',
976
+ data: {
977
+ action: 'premium_get_templates',
978
+ tab: tabName
979
+ },
980
+ success: function (response) {
981
+ console.log("%cTemplates Retrieved Successfully!!", "color: #7a7a7a; background-color: #eee;");
982
+
983
+ var templates = new PremiumEditorViews.LibraryCollection(response.data.templates),
984
+ categories = new PremiumEditorViews.CategoriesCollection(response.data.categories);
985
+
986
+ self.tabs[tabName].data = {
987
+ templates: templates,
988
+ categories: categories,
989
+ keywords: response.data.keywords
990
+ };
991
+
992
+ self.layout.showTemplatesView(templates, categories, response.data.keywords);
993
+
994
+ }
995
+ });
996
+ }
997
+
998
+ },
999
+
1000
+ closeModal: function () {
1001
+ this.getModal().hide();
1002
+ },
1003
+
1004
+ getModal: function () {
1005
+
1006
+ if (!this.modal) {
1007
+ this.modal = elementor.dialogsManager.createWidget('lightbox', {
1008
+ id: 'premium-template-modal',
1009
+ className: 'elementor-templates-modal',
1010
+ closeButton: false
1011
+ });
1012
+ }
1013
+
1014
+ return this.modal;
1015
+
1016
+ }
1017
+
1018
+ };
1019
+
1020
+ $(window).on('elementor:init', PremiumEditor.init);
1021
+
1022
+ })(jQuery);
includes/class-addons-integration.php CHANGED
@@ -4,6 +4,7 @@ namespace PremiumAddons;
4
 
5
  use PremiumAddons\Admin\Settings\Maps;
6
  use PremiumAddons\Admin\Settings\Modules_Settings;
 
7
 
8
  if( ! defined( 'ABSPATH' ) ) exit();
9
 
@@ -15,11 +16,13 @@ class Addons_Integration {
15
  //Modules Keys
16
  private static $modules = null;
17
 
 
 
 
 
18
  //Maps Keys
19
  private static $maps = null;
20
 
21
- //Elementor Frontend Class instance
22
- public static $frontend = null;
23
 
24
  /**
25
  * Initialize integration hooks
@@ -32,6 +35,8 @@ class Addons_Integration {
32
 
33
  self::$maps = Maps::get_enabled_keys();
34
 
 
 
35
  add_action( 'elementor/editor/before_enqueue_styles', array( $this, 'premium_font_setup' ) );
36
 
37
  add_action( 'elementor/widgets/widgets_registered', array( $this, 'widgets_area' ) );
@@ -42,15 +47,10 @@ class Addons_Integration {
42
 
43
  add_action( 'elementor/frontend/after_register_styles', array( $this, 'register_frontend_styles' ) );
44
 
45
- add_action( 'elementor/frontend/after_enqueue_styles', array( $this, 'enqueue_frontend_styles' ) );
46
-
47
  add_action( 'elementor/frontend/after_register_scripts', array( $this, 'register_frontend_scripts' ) );
48
 
49
  add_action( 'wp_ajax_get_elementor_template_content', array( $this, 'get_template_content' ) );
50
 
51
- // if( defined('ELEMENTOR_VERSION') ) {
52
- // self::$frontend = new \Elementor\Frontend;
53
- // }
54
  }
55
 
56
  /**
@@ -91,14 +91,6 @@ class Addons_Integration {
91
  'all'
92
  );
93
 
94
- /*wp_register_style(
95
- 'pa-preview',
96
- PREMIUM_ADDONS_URL . 'assets/editor/templates/css/preview.css',
97
- array(),
98
- PREMIUM_ADDONS_VERSION,
99
- 'all'
100
- );*/
101
-
102
  wp_register_style(
103
  'premium-addons',
104
  PREMIUM_ADDONS_URL . 'assets/frontend/css/premium-addons.css',
@@ -120,22 +112,8 @@ class Addons_Integration {
120
 
121
  wp_enqueue_style('pa-prettyphoto');
122
 
123
- //wp_enqueue_style('pa-preview');
124
-
125
  wp_enqueue_style('premium-addons');
126
 
127
- }
128
-
129
- /**
130
- * Enqueue Widgets` CSS file
131
- *
132
- * @since 2.9.0
133
- * @access public
134
- */
135
- public function enqueue_frontend_styles() {
136
-
137
-
138
-
139
  }
140
 
141
  /**
@@ -277,14 +255,6 @@ class Addons_Integration {
277
  true
278
  );
279
 
280
- // wp_register_script(
281
- // 'scrollify-js',
282
- // PREMIUM_ADDONS_URL . 'assets/js/lib/scrollify.js',
283
- // array('jquery'),
284
- // PREMIUM_ADDONS_VERSION,
285
- // true
286
- // );
287
-
288
  }
289
 
290
  /*
@@ -344,15 +314,13 @@ class Addons_Integration {
344
  */
345
  public function get_template_content() {
346
 
347
- self::$frontend = new \Elementor\Frontend;
348
-
349
- $template_id = $_GET['templateID'];
350
 
351
- if( ! isset( $template_id ) ) {
352
  return;
353
  }
354
 
355
- $template_content = self::$frontend->get_builder_content( $template_id, true );
356
 
357
  if ( empty ( $template_content ) || ! isset( $template_content ) ) {
358
  wp_send_json_error();
4
 
5
  use PremiumAddons\Admin\Settings\Maps;
6
  use PremiumAddons\Admin\Settings\Modules_Settings;
7
+ use PremiumAddons\Includes\premium_Template_Tags;
8
 
9
  if( ! defined( 'ABSPATH' ) ) exit();
10
 
16
  //Modules Keys
17
  private static $modules = null;
18
 
19
+ //`premium_Template_Tags` Instance
20
+ protected $templateInstance;
21
+
22
+
23
  //Maps Keys
24
  private static $maps = null;
25
 
 
 
26
 
27
  /**
28
  * Initialize integration hooks
35
 
36
  self::$maps = Maps::get_enabled_keys();
37
 
38
+ $this->templateInstance = Includes\premium_Template_Tags::getInstance();
39
+
40
  add_action( 'elementor/editor/before_enqueue_styles', array( $this, 'premium_font_setup' ) );
41
 
42
  add_action( 'elementor/widgets/widgets_registered', array( $this, 'widgets_area' ) );
47
 
48
  add_action( 'elementor/frontend/after_register_styles', array( $this, 'register_frontend_styles' ) );
49
 
 
 
50
  add_action( 'elementor/frontend/after_register_scripts', array( $this, 'register_frontend_scripts' ) );
51
 
52
  add_action( 'wp_ajax_get_elementor_template_content', array( $this, 'get_template_content' ) );
53
 
 
 
 
54
  }
55
 
56
  /**
91
  'all'
92
  );
93
 
 
 
 
 
 
 
 
 
94
  wp_register_style(
95
  'premium-addons',
96
  PREMIUM_ADDONS_URL . 'assets/frontend/css/premium-addons.css',
112
 
113
  wp_enqueue_style('pa-prettyphoto');
114
 
 
 
115
  wp_enqueue_style('premium-addons');
116
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  }
118
 
119
  /**
255
  true
256
  );
257
 
 
 
 
 
 
 
 
 
258
  }
259
 
260
  /*
314
  */
315
  public function get_template_content() {
316
 
317
+ $template = $_GET['templateID'];
 
 
318
 
319
+ if( ! isset( $template ) ) {
320
  return;
321
  }
322
 
323
+ $template_content = $this->templateInstance->get_template_content( $template );
324
 
325
  if ( empty ( $template_content ) || ! isset( $template_content ) ) {
326
  wp_send_json_error();
includes/class-helper-functions.php CHANGED
@@ -172,4 +172,31 @@ class Helper_Functions {
172
  return self::$google_localize;
173
 
174
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  }
172
  return self::$google_localize;
173
 
174
  }
175
+
176
+ /**
177
+ * Get Installed Theme
178
+ *
179
+ * Returns the active theme slug
180
+ *
181
+ * @access public
182
+ * @return string theme slug
183
+ */
184
+ public static function get_installed_theme() {
185
+
186
+ $theme = wp_get_theme();
187
+
188
+ if( $theme->parent() ) {
189
+
190
+ $theme_name = $theme->parent()->get('Name');
191
+
192
+ } else {
193
+
194
+ $theme_name = $theme->get('Name');
195
+
196
+ }
197
+
198
+ $theme_name = sanitize_key( $theme_name );
199
+
200
+ return $theme_name;
201
+ }
202
  }
includes/elementor-helper.php CHANGED
@@ -2,6 +2,8 @@
2
 
3
  namespace PremiumAddons\Includes;
4
 
 
 
5
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
6
 
7
  /**
@@ -66,6 +68,23 @@ class premium_Template_Tags {
66
  }
67
  return $this->options;
68
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
 
70
  public function get_elementor_page_list() {
71
 
@@ -77,7 +96,7 @@ class premium_Template_Tags {
77
  if ( ! empty( $pagelist ) && ! is_wp_error( $pagelist ) ) {
78
 
79
  foreach ( $pagelist as $post ) {
80
- $options[ $post->ID ] = $post->post_title;
81
  }
82
 
83
  update_option( 'temp_count', $options );
@@ -85,4 +104,24 @@ class premium_Template_Tags {
85
  return $options;
86
  }
87
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  }
2
 
3
  namespace PremiumAddons\Includes;
4
 
5
+ use Elementor\Frontend;
6
+
7
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
8
 
9
  /**
68
  }
69
  return $this->options;
70
  }
71
+
72
+ /*
73
+ * Get Elementor Template ID by title
74
+ *
75
+ * @since 3.6.0
76
+ * @access public
77
+ *
78
+ */
79
+ public function get_id_by_title( $handle ) {
80
+
81
+ $template = get_page_by_title( $handle, OBJECT, 'elementor_library' );
82
+
83
+ $template_id = isset ( $template->ID ) ? $template->ID : $handle;
84
+
85
+ return $template_id;
86
+ }
87
+
88
 
89
  public function get_elementor_page_list() {
90
 
96
  if ( ! empty( $pagelist ) && ! is_wp_error( $pagelist ) ) {
97
 
98
  foreach ( $pagelist as $post ) {
99
+ $options[ $post->post_title ] = $post->post_title;
100
  }
101
 
102
  update_option( 'temp_count', $options );
104
  return $options;
105
  }
106
  }
107
+
108
+ /*
109
+ * Get Elementor Template HTML Content
110
+ *
111
+ * @since 3.6.0
112
+ * @access public
113
+ *
114
+ */
115
+ public function get_template_content( $title ) {
116
+
117
+ $frontend = new Frontend;
118
+
119
+ $id = $this->get_id_by_title( $title );
120
+
121
+ $template_content = $frontend->get_builder_content( $id, true );
122
+
123
+ return $template_content;
124
+
125
+ }
126
+
127
  }
includes/templates/classes/api.php ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace PremiumAddons\Includes\Templates\Classes;
4
+
5
+ use PremiumAddons\Includes\Templates;
6
+
7
+ if( ! defined( 'ABSPATH' ) ) exit; // No access of directly access
8
+
9
+ if ( ! class_exists( 'Premium_Templates_API' ) ) {
10
+
11
+ /**
12
+ * Premium API.
13
+ *
14
+ * Premium API class is responsible for getting API data.
15
+ *
16
+ * @since 3.6.0
17
+ *
18
+ */
19
+ class Premium_Templates_API {
20
+
21
+ /**
22
+ * API URL which is used to get the response from.
23
+ *
24
+ * @since 3.6.0
25
+ * @var (String) URL
26
+ */
27
+ private $config = array();
28
+
29
+ /**
30
+ * API enabled
31
+ *
32
+ * @since 3.6.0
33
+ * @var (Boolean)
34
+ */
35
+ private $enabled = null;
36
+
37
+ /**
38
+ * Premium_API constructor.
39
+ *
40
+ * Get all API data.
41
+ *
42
+ * @since 3.6.0
43
+ * @access public
44
+ */
45
+ public function __construct() {
46
+
47
+ $this->config = Templates\premium_templates()->config->get( 'api' );
48
+
49
+ }
50
+
51
+ /**
52
+ * Is Enabled.
53
+ *
54
+ * Check if remote API is enabled.
55
+ *
56
+ * @since 3.6.0
57
+ * @access public
58
+ *
59
+ * @return boolean
60
+ */
61
+ public function is_enabled() {
62
+
63
+ if ( null !== $this->enabled ) {
64
+ return $this->enabled;
65
+ }
66
+
67
+ if ( empty( $this->config['enabled'] ) || true !== $this->config['enabled'] ) {
68
+ $this->enabled = false;
69
+ return $this->enabled;
70
+ }
71
+
72
+ if ( empty( $this->config['base'] ) || empty( $this->config['path'] ) || empty( $this->config['endpoints'] ) ) {
73
+ $this->enabled = false;
74
+ return $this->enabled;
75
+ }
76
+
77
+ $this->enabled = true;
78
+
79
+ return $this->enabled;
80
+ }
81
+
82
+ /**
83
+ * API URL.
84
+ *
85
+ * Get API for template library area data.
86
+ *
87
+ * @since 3.6.0
88
+ * @access public
89
+ *
90
+ */
91
+ public function api_url( $flag ) {
92
+
93
+ if ( ! $this->is_enabled() ) {
94
+ return false;
95
+ }
96
+
97
+ if ( empty( $this->config['endpoints'][ $flag ] ) ) {
98
+ return false;
99
+ }
100
+
101
+ return $this->config['base'] . $this->config['path'] . $this->config['endpoints'][ $flag ];
102
+ }
103
+
104
+ /**
105
+ * Get Info from the remote server.
106
+ *
107
+ * Get remote system info.
108
+ *
109
+ * @since 3.6.0
110
+ * @access public
111
+ *
112
+ */
113
+ public function get_info( $key = '' ) {
114
+
115
+ $api_url = $this->api_url( 'info' );
116
+
117
+ if ( ! $api_url ) {
118
+ return false;
119
+ }
120
+
121
+ $response = wp_remote_get( $api_url, $this->request_args() );
122
+
123
+ $body = wp_remote_retrieve_body( $response );
124
+ $body = json_decode( $body, true );
125
+
126
+ if ( ! $body || ! isset( $body['success'] ) || true !== $body['success'] ) {
127
+ return false;
128
+ }
129
+
130
+ if ( ! $key ) {
131
+ unset( $body['success'] );
132
+ return $body;
133
+ }
134
+
135
+ if ( is_string( $key ) ) {
136
+ return isset( $body[ $key ] ) ? $body[ $key ] : false;
137
+ }
138
+
139
+ if ( is_array( $key ) ) {
140
+
141
+ $result = array();
142
+
143
+ foreach ( $key as $_key ) {
144
+ $result[ $_key ] = isset( $body[ $_key ] ) ? $body[ $_key ] : false;
145
+ }
146
+
147
+ return $result;
148
+
149
+ }
150
+
151
+ }
152
+
153
+ /**
154
+ * Request Args
155
+ *
156
+ * Get request arguments for the remote request.
157
+ *
158
+ * @since 3.6.0
159
+ * @access public
160
+ *
161
+ * @return array
162
+ *
163
+ */
164
+ public function request_args() {
165
+ return array(
166
+ 'timeout' => 60,
167
+ 'sslverify' => false
168
+ );
169
+ }
170
+
171
+ }
172
+
173
+ }
includes/templates/classes/assets.php ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace PremiumAddons\Includes\Templates\Classes;
4
+
5
+ use PremiumAddons\Includes\Templates;
6
+
7
+ if( ! defined( 'ABSPATH' ) ) exit; // No access of directly access
8
+
9
+ if( ! class_exists('Premium_Templates_Assets') ) {
10
+
11
+ /**
12
+ * Premium Templates Assets.
13
+ *
14
+ * Premium Templates Assets class is responsible for enqueuing all required assets for integration templates on the editor page.
15
+ *
16
+ * @since 3.6.0
17
+ *
18
+ */
19
+ class Premium_Templates_Assets {
20
+
21
+ /*
22
+ * Instance of the class
23
+ *
24
+ * @since 3.6.0
25
+ * @access private
26
+ */
27
+ private static $instance = null;
28
+
29
+ /**
30
+ * Premium_Templates_Assets constructor.
31
+ *
32
+ * Triggers the required hooks to enqueue CSS/JS files.
33
+ *
34
+ * @since 3.6.0
35
+ * @access public
36
+ *
37
+ */
38
+ public function __construct() {
39
+
40
+ add_action( 'elementor/preview/enqueue_styles', array( $this, 'enqueue_preview_styles' ) );
41
+
42
+ add_action( 'elementor/editor/before_enqueue_scripts', array( $this, 'editor_scripts' ), 0 );
43
+
44
+ add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'editor_styles' ) );
45
+
46
+ add_action( 'elementor/editor/footer', array( $this, 'load_footer_scripts') );
47
+
48
+ }
49
+
50
+ /**
51
+ * Editor Styles
52
+ *
53
+ * Enqueue required editor CSS files.
54
+ *
55
+ * @since 3.6.0
56
+ * @access public
57
+ *
58
+ */
59
+ public function editor_styles() {
60
+
61
+ wp_enqueue_style(
62
+ 'premium-editor-style',
63
+ PREMIUM_ADDONS_URL . 'assets/editor/templates/css/editor.css',
64
+ array(),
65
+ PREMIUM_ADDONS_VERSION,
66
+ 'all'
67
+ );
68
+
69
+ }
70
+
71
+ /**
72
+ * Preview Styles
73
+ *
74
+ * Enqueue required templates CSS file.
75
+ *
76
+ * @since 3.6.0
77
+ * @access public
78
+ */
79
+ public function enqueue_preview_styles() {
80
+
81
+ wp_enqueue_style(
82
+ 'pa-preview',
83
+ PREMIUM_ADDONS_URL . 'assets/editor/templates/css/preview.css',
84
+ array(),
85
+ PREMIUM_ADDONS_VERSION,
86
+ 'all'
87
+ );
88
+
89
+ }
90
+
91
+ /**
92
+ * Editor Scripts
93
+ *
94
+ * Enqueue required editor JS files, localize JS with required data.
95
+ *
96
+ * @since 3.6.0
97
+ * @access public
98
+ */
99
+ public function editor_scripts() {
100
+
101
+ wp_enqueue_script(
102
+ 'premium-temps-editor',
103
+ PREMIUM_ADDONS_URL . 'assets/editor/templates/js/editor.js',
104
+ array(
105
+ 'jquery',
106
+ 'underscore',
107
+ 'backbone-marionette'
108
+ ),
109
+ PREMIUM_ADDONS_VERSION,
110
+ true
111
+ );
112
+
113
+ $button = Templates\premium_templates()->config->get('premium_temps');
114
+
115
+ wp_localize_script( 'premium-temps-editor', 'PremiumTempsData', apply_filters(
116
+ 'premium-templates-core/assets/editor/localize',
117
+ array(
118
+ 'PremiumTemplatesBtn' => $button,
119
+ 'modalRegions' => $this->get_modal_region(),
120
+ 'license' => array(
121
+ 'status' => Templates\premium_templates()->config->get('status'),
122
+ 'activateLink' => Templates\premium_templates()->config->get('license_page'),
123
+ 'proMessage' => Templates\premium_templates()->config->get('pro_message')
124
+ )
125
+ ))
126
+ );
127
+
128
+ }
129
+
130
+ /**
131
+ * Get Modal Region
132
+ *
133
+ * Get modal region in the editor.
134
+ *
135
+ * @since 3.6.0
136
+ * @access public
137
+ */
138
+ public function get_modal_region() {
139
+
140
+ return array(
141
+ 'modalHeader' => '.dialog-header',
142
+ 'modalContent' => '.dialog-message',
143
+ );
144
+
145
+ }
146
+
147
+ /**
148
+ * Add Templates Scripts
149
+ *
150
+ * Load required templates for the templates library.
151
+ *
152
+ * @since 3.6.0
153
+ * @access public
154
+ */
155
+ public function load_footer_scripts() {
156
+
157
+ $scripts = glob( PREMIUM_ADDONS_PATH . 'includes/templates/scripts/*.php' );
158
+
159
+ array_map( function( $file ) {
160
+
161
+ $name = basename( $file, '.php' );
162
+ ob_start();
163
+ include $file;
164
+ printf( '<script type="text/html" id="tmpl-premium-%1$s">%2$s</script>', $name, ob_get_clean() );
165
+
166
+ }, $scripts);
167
+
168
+ }
169
+
170
+ /**
171
+ * Get Instance
172
+ *
173
+ * Creates and returns an instance of the class.
174
+ *
175
+ * @since 3.6.0
176
+ * @access public
177
+ *
178
+ * @return object
179
+ */
180
+ public static function get_instance() {
181
+
182
+ if( self::$instance == null ) {
183
+
184
+ self::$instance = new self;
185
+
186
+ }
187
+
188
+ return self::$instance;
189
+
190
+ }
191
+
192
+
193
+ }
194
+
195
+ }
includes/templates/classes/config.php ADDED
@@ -0,0 +1,223 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace PremiumAddons\Includes\Templates\Classes;
4
+
5
+ use PremiumAddons\Helper_Functions;
6
+ use PremiumAddonsPro\License\Admin;
7
+
8
+
9
+ if( ! defined( 'ABSPATH' ) ) exit; // No access of directly access
10
+
11
+ if( ! class_exists('Premium_Templates_Core_Config') ) {
12
+
13
+ /**
14
+ * Premium Templates Core config.
15
+ *
16
+ * Templates core class is responsible for handling templates library.
17
+ *
18
+ * @since 3.6.0
19
+ *
20
+ */
21
+ class Premium_Templates_Core_Config {
22
+
23
+ /*
24
+ * Instance of the class
25
+ *
26
+ * @access private
27
+ * @since 3.6.0
28
+ *
29
+ */
30
+ private static $instance = null;
31
+
32
+ /*
33
+ * Holds config data
34
+ *
35
+ * @access private
36
+ * @since 3.6.0
37
+ *
38
+ */
39
+ private $config;
40
+
41
+ /*
42
+ * License page slug
43
+ *
44
+ * @access private
45
+ * @since 3.6.0
46
+ *
47
+ */
48
+ private $slug = 'premium-addons-pro-license';
49
+
50
+ /**
51
+ * Premium_Templates_Core_Config constructor.
52
+ *
53
+ * Sets config data.
54
+ *
55
+ * @since 3.6.0
56
+ * @access public
57
+ */
58
+ public function __construct() {
59
+
60
+ $this->config = array(
61
+ 'premium_temps' => __('Premium Templates', 'premium-addons-for-elementor'),
62
+ 'key' => $this->get_license_key(),
63
+ 'status' => $this->get_license_status(),
64
+ 'license_page' => $this->get_license_page(),
65
+ 'pro_message' => $this->get_pro_message(),
66
+ 'api' => array(
67
+ 'enabled' => true,
68
+ 'base' => 'https://pa.premiumtemplates.io/',
69
+ 'path' => 'wp-json/patemp/v2',
70
+ 'id' => 9,
71
+ 'endpoints' => array(
72
+ 'templates' => '/templates/',
73
+ 'keywords' => '/keywords/',
74
+ 'categories' => '/categories/',
75
+ 'template' => '/template/',
76
+ 'info' => '/info/',
77
+ 'template' => '/template/',
78
+ ),
79
+ ),
80
+ );
81
+
82
+ }
83
+
84
+ /**
85
+ * Get license key.
86
+ *
87
+ * Gets Premium Add-ons PRO license key.
88
+ *
89
+ * @since 3.6.0
90
+ * @access public
91
+ *
92
+ * @return string|boolean license key or false if no license key
93
+ */
94
+ public function get_license_key() {
95
+
96
+ if( ! defined ('PREMIUM_PRO_ADDONS_VERSION') ) {
97
+ return;
98
+ }
99
+
100
+ $key = Admin::get_license_key();
101
+
102
+ return $key;
103
+
104
+ }
105
+
106
+ /**
107
+ * Get license status.
108
+ *
109
+ * Gets Premium Add-ons PRO license status.
110
+ *
111
+ * @since 3.6.0
112
+ * @access public
113
+ *
114
+ * @return string|boolean license status or false if no license key
115
+ */
116
+ public function get_license_status() {
117
+
118
+ if( ! defined ('PREMIUM_PRO_ADDONS_VERSION') ) {
119
+ return;
120
+ }
121
+
122
+ $status = Admin::get_license_status();
123
+
124
+ return $status;
125
+
126
+ }
127
+
128
+ /**
129
+ * Get license page.
130
+ *
131
+ * Gets Premium Add-ons PRO license page.
132
+ *
133
+ * @since 3.6.0
134
+ * @access public
135
+ *
136
+ * @return string admin license page or plugin URI
137
+ */
138
+ public function get_license_page() {
139
+
140
+ if( defined ('PREMIUM_PRO_ADDONS_VERSION') ) {
141
+
142
+ return add_query_arg(
143
+ array(
144
+ 'page' => $this->slug,
145
+ ),
146
+ esc_url( admin_url('admin.php') )
147
+ );
148
+
149
+ } else {
150
+
151
+ $theme_slug = Helper_Functions::get_installed_theme();
152
+
153
+ $url = sprintf('https://premiumaddons.com/pro/?utm_source=premium-templates&utm_medium=wp-dash&utm_campaign=get-pro&utm_term=%s', $theme_slug);
154
+
155
+ return $url;
156
+
157
+ }
158
+
159
+ }
160
+
161
+ /**
162
+ *
163
+ * Get License Message
164
+ *
165
+ * @since 3.6.0
166
+ * @access public
167
+ *
168
+ * @return string Pro version message
169
+ */
170
+ public function get_pro_message() {
171
+
172
+ if( defined ('PREMIUM_PRO_ADDONS_VERSION') ) {
173
+ return __('Activate License', 'premium-addons-for-elementor');
174
+ } else {
175
+ return __('Get Pro', 'premium-addons-for-elementor');
176
+ }
177
+
178
+ }
179
+
180
+
181
+
182
+ /**
183
+ * Get
184
+ *
185
+ * Gets a segment of config data.
186
+ *
187
+ * @since 3.6.0
188
+ * @access public
189
+ *
190
+ * @return string|array|false data or false if not set
191
+ */
192
+ public function get( $key = '' ) {
193
+
194
+ return isset( $this->config[ $key ] ) ? $this->config[ $key ] : false;
195
+
196
+ }
197
+
198
+
199
+ /**
200
+ * Creates and returns an instance of the class
201
+ *
202
+ * @since 3.6.0
203
+ * @access public
204
+ *
205
+ * @return object
206
+ *
207
+ */
208
+ public static function get_instance() {
209
+
210
+ if( self::$instance == null ) {
211
+
212
+ self::$instance = new self;
213
+
214
+ }
215
+
216
+ return self::$instance;
217
+
218
+ }
219
+
220
+
221
+ }
222
+
223
+ }
includes/templates/classes/manager.php ADDED
@@ -0,0 +1,374 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace PremiumAddons\Includes\Templates\Classes;
4
+
5
+ use PremiumAddons\Includes\Templates;
6
+
7
+ if( ! defined( 'ABSPATH') ) exit;
8
+
9
+ if ( ! class_exists( 'Premium_Templates_Manager' ) ) {
10
+
11
+ /**
12
+ * Premium Templates Manager.
13
+ *
14
+ * Templates manager class handles all templates library insertion
15
+ *
16
+ * @since 3.6.0
17
+ *
18
+ */
19
+ class Premium_Templates_Manager {
20
+
21
+ private static $instance = null;
22
+
23
+ private $sources = array();
24
+
25
+ /**
26
+ * Premium_Templates_Manager constructor.
27
+ *
28
+ * initialize required hooks for templates.
29
+ *
30
+ * @since 3.6.0
31
+ * @access public
32
+ *
33
+ */
34
+ public function __construct() {
35
+
36
+ //Register AJAX hooks
37
+ add_action( 'wp_ajax_premium_get_templates', array( $this, 'get_templates' ) );
38
+ add_action( 'wp_ajax_premium_inner_template', array( $this, 'insert_inner_template' ) );
39
+
40
+
41
+ if ( defined( 'ELEMENTOR_VERSION' ) && version_compare( ELEMENTOR_VERSION, '2.2.8', '>' ) ) {
42
+ add_action( 'elementor/ajax/register_actions', array( $this, 'register_ajax_actions' ), 20 );
43
+ } else {
44
+ add_action( 'wp_ajax_elementor_get_template_data', array( $this, 'get_template_data' ), -1 );
45
+ }
46
+
47
+ $this->register_sources();
48
+
49
+ add_filter( 'premium-templates-core/assets/editor/localize', array( $this, 'localize_tabs' ) );
50
+
51
+ }
52
+
53
+ /**
54
+ * Localize tabs
55
+ *
56
+ * Add tabs data to localize object
57
+ *
58
+ * @since 3.6.0
59
+ * @access public
60
+ *
61
+ * @return [type] [description]
62
+ */
63
+ public function localize_tabs( $data ) {
64
+
65
+ $tabs = $this->get_template_tabs();
66
+ $ids = array_keys( $tabs );
67
+ $default = $ids[0];
68
+
69
+ $data['tabs'] = $this->get_template_tabs();
70
+ $data['defaultTab'] = $default;
71
+
72
+ return $data;
73
+
74
+ }
75
+
76
+ /**
77
+ * Register sources
78
+ *
79
+ * Register templates sources.
80
+ *
81
+ * @since 3.6.0
82
+ * @access public
83
+ *
84
+ * @return void
85
+ */
86
+ public function register_sources() {
87
+
88
+ require PREMIUM_ADDONS_PATH . 'includes/templates/sources/base.php';
89
+
90
+ $namespace = str_replace( 'Classes', 'Sources' , __NAMESPACE__ );
91
+
92
+ $sources = array(
93
+ 'premium-api' => $namespace . '\Premium_Templates_Source_Api',
94
+ );
95
+
96
+ foreach ( $sources as $key => $class ) {
97
+
98
+ require PREMIUM_ADDONS_PATH . 'includes/templates/sources/' . $key . '.php';
99
+
100
+ $this->add_source( $key, $class );
101
+ }
102
+
103
+ }
104
+
105
+ /**
106
+ * Get template tabs
107
+ *
108
+ * Get tabs for the library.
109
+ *
110
+ * @since 3.6.0
111
+ * @access public
112
+ *
113
+ */
114
+ public function get_template_tabs() {
115
+
116
+ $tabs = Templates\premium_templates()->types->get_types_for_popup();
117
+
118
+ return $tabs;
119
+
120
+ }
121
+
122
+ /**
123
+ * Get template tabs
124
+ *
125
+ * Get tabs for the library.
126
+ *
127
+ * @since 3.6.0
128
+ * @access public
129
+ *
130
+ * @param $key source key
131
+ * @param $class source class
132
+ *
133
+ */
134
+ public function add_source( $key, $class ) {
135
+ $this->sources[ $key ] = new $class();
136
+ }
137
+
138
+ /**
139
+ * Returns needed source instance
140
+ *
141
+ * @return object
142
+ */
143
+ public function get_source( $slug = null ) {
144
+ return isset( $this->sources[ $slug ] ) ? $this->sources[ $slug ] : false;
145
+ }
146
+
147
+
148
+ /**
149
+ * Get template
150
+ *
151
+ * Get templates grid data.
152
+ *
153
+ * @since 3.6.0
154
+ * @access public
155
+ *
156
+ */
157
+ public function get_templates() {
158
+
159
+ if ( ! current_user_can( 'edit_posts' ) ) {
160
+ wp_send_json_error();
161
+ }
162
+
163
+ $tab = $_GET['tab'];
164
+ $tabs = $this->get_template_tabs();
165
+ $sources = $tabs[ $tab ]['sources'];
166
+
167
+ $result = array(
168
+ 'templates' => array(),
169
+ 'categories' => array(),
170
+ 'keywords' => array(),
171
+ );
172
+
173
+ foreach ( $sources as $source_slug ) {
174
+
175
+ $source = isset( $this->sources[ $source_slug ] ) ? $this->sources[ $source_slug ] : false;
176
+
177
+ if ( $source ) {
178
+ $result['templates'] = array_merge( $result['templates'], $source->get_items( $tab ) );
179
+ $result['categories'] = array_merge( $result['categories'], $source->get_categories( $tab ) );
180
+ $result['keywords'] = array_merge( $result['keywords'], $source->get_keywords( $tab ) );
181
+ }
182
+
183
+ }
184
+
185
+
186
+ $all_cats = array(
187
+ array(
188
+ 'slug' => '',
189
+ 'title' => __( 'All', 'premium-addons-for-elementor' ),
190
+ )
191
+ );
192
+
193
+ if ( ! empty( $result['categories'] ) ) {
194
+ $result['categories'] = array_merge( $all_cats, $result['categories'] );
195
+ }
196
+
197
+ wp_send_json_success( $result );
198
+
199
+ }
200
+
201
+ /**
202
+ * Insert inner template
203
+ *
204
+ * Insert an inner template before insert the parent one.
205
+ *
206
+ * @since 3.6.0
207
+ * @access public
208
+ *
209
+ */
210
+ public function insert_inner_template() {
211
+
212
+ if ( ! current_user_can( 'edit_posts' ) ) {
213
+ wp_send_json_error();
214
+ }
215
+
216
+ $template = isset( $_REQUEST['template'] ) ? $_REQUEST['template'] : false;
217
+
218
+ if ( ! $template ) {
219
+ wp_send_json_error();
220
+ }
221
+
222
+ $template_id = isset( $template['template_id'] ) ? esc_attr( $template['template_id'] ) : false;
223
+ $source_name = isset( $template['source'] ) ? esc_attr( $template['source'] ) : false;
224
+ $source = isset( $this->sources[ $source_name ] ) ? $this->sources[ $source_name ] : false;
225
+
226
+ if ( ! $source || ! $template_id ) {
227
+ wp_send_json_error();
228
+ }
229
+
230
+ $template_data = $source->get_item( $template_id );
231
+
232
+ if ( ! empty( $template_data['content'] ) ) {
233
+ wp_insert_post( array(
234
+ 'post_type' => 'elementor_library',
235
+ 'post_title' => $template['title'],
236
+ 'post_status' => 'publish',
237
+ 'meta_input' => array(
238
+ '_elementor_data' => $template_data['content'],
239
+ '_elementor_edit_mode' => 'builder',
240
+ '_elementor_template_type' => 'section',
241
+ ),
242
+ ) );
243
+ }
244
+
245
+ wp_send_json_success();
246
+
247
+ }
248
+
249
+ /**
250
+ * Register AJAX actions
251
+ *
252
+ * Add new actions to handle data after an AJAX requests returned.
253
+ *
254
+ * @since 3.6.0
255
+ * @access public
256
+ *
257
+ */
258
+ public function register_ajax_actions( $ajax_manager ) {
259
+
260
+ if ( ! isset( $_POST['actions'] ) ) {
261
+ return;
262
+ }
263
+
264
+ $actions = json_decode( stripslashes( $_REQUEST['actions'] ), true );
265
+ $data = false;
266
+
267
+ foreach ( $actions as $id => $action_data ) {
268
+ if ( ! isset( $action_data['get_template_data'] ) ) {
269
+ $data = $action_data;
270
+ }
271
+ }
272
+
273
+ if ( ! $data ) {
274
+ return;
275
+ }
276
+
277
+ if ( ! isset( $data['data'] ) ) {
278
+ return;
279
+ }
280
+
281
+ if ( ! isset( $data['data']['source'] ) ) {
282
+ return;
283
+ }
284
+
285
+ $source = $data['data']['source'];
286
+
287
+ if ( ! isset( $this->sources[ $source ] ) ) {
288
+ return;
289
+ }
290
+
291
+ $ajax_manager->register_ajax_action( 'get_template_data', function( $data ) {
292
+ return $this->get_template_data_array( $data );
293
+ } );
294
+
295
+ }
296
+
297
+ /**
298
+ * Get template data array
299
+ *
300
+ * triggered to get an array for a single template data
301
+ *
302
+ * @since 3.6.0
303
+ * @access public
304
+ *
305
+ */
306
+ public function get_template_data_array( $data ) {
307
+
308
+ if ( ! current_user_can( 'edit_posts' ) ) {
309
+ return false;
310
+ }
311
+
312
+ if ( empty( $data['template_id'] ) ) {
313
+ return false;
314
+ }
315
+
316
+ $source_name = isset( $data['source'] ) ? esc_attr( $data['source'] ) : '';
317
+
318
+ if ( ! $source_name ) {
319
+ return false;
320
+ }
321
+
322
+ $source = isset( $this->sources[ $source_name ] ) ? $this->sources[ $source_name ] : false;
323
+
324
+ if ( ! $source ) {
325
+ return false;
326
+ }
327
+
328
+ if ( empty( $data['tab'] ) ) {
329
+ return false;
330
+ }
331
+
332
+ $template = $source->get_item( $data['template_id'], $data['tab'] );
333
+
334
+ return $template;
335
+ }
336
+
337
+ /**
338
+ * Premium get template data
339
+ *
340
+ * trigger `get_template_data_array` after template insert
341
+ *
342
+ * @since 3.6.0
343
+ * @access public
344
+ *
345
+ */
346
+ public function premium_get_template_data() {
347
+
348
+ $template = $this->get_template_data_array( $_REQUEST );
349
+
350
+ if ( ! $template ) {
351
+ wp_send_json_error();
352
+ }
353
+
354
+ wp_send_json_success( $template );
355
+
356
+ }
357
+
358
+ /**
359
+ * Returns the instance.
360
+ *
361
+ * @since 3.6.0
362
+ * @return object
363
+ */
364
+ public static function get_instance() {
365
+
366
+ // If the single instance hasn't been set, set it now.
367
+ if ( null == self::$instance ) {
368
+ self::$instance = new self;
369
+ }
370
+ return self::$instance;
371
+ }
372
+ }
373
+
374
+ }
includes/templates/documents/base.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace PremiumAddons\Includes\Templates\Documents;
4
+
5
+ use Elementor\Core\Base\Document as Document;
6
+
7
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
8
+
9
+ class Premium_Document_Base extends Document {
10
+
11
+ public function get_name() {
12
+ return '';
13
+ }
14
+
15
+ public static function get_title() {
16
+ return '';
17
+ }
18
+
19
+ public function has_conditions() {
20
+ return true;
21
+ }
22
+
23
+ public function get_preview_as_query_args() {
24
+ return array();
25
+ }
26
+
27
+ }
includes/templates/documents/section.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace PremiumAddons\Includes\Templates\Documents;
4
+
5
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
6
+
7
+ class Premium_Section_Document extends Premium_Document_Base {
8
+
9
+ public function get_name() {
10
+ return 'premium_page';
11
+ }
12
+
13
+ public static function get_title() {
14
+ return __( 'Section', 'premium-addons-for-elementor' );
15
+ }
16
+
17
+ public function has_conditions() {
18
+ return false;
19
+ }
20
+
21
+ }
includes/templates/scripts/template-modal-content.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Templates Loader View
4
+ */
5
+ ?>
6
+ <div class="premium-filters-list"></div>
7
+ <div class="premium-templates-wrap">
8
+ <div class="premium-keywords-list"></div>
9
+ <div class="premium-templates-list"></div>
10
+ </div>
includes/templates/scripts/template-modal-error.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ use PremiumAddons\Includes\Templates;
4
+
5
+ /**
6
+ * Templates Loader Error
7
+ */
8
+ ?>
9
+ <div class="elementor-library-error">
10
+ <div class="elementor-library-error-message"><?php
11
+ echo __( 'Template couldn\'t be loaded. Please activate you license key before.', 'premium-addons-for-elementor' );
12
+ ?></div>
13
+ <div class="elementor-library-error-link"><?php
14
+ printf(
15
+ '<a class="template-library-activate-license" href="%1$s" target="_blank">%2$s %3$s</a>',
16
+ Templates\premium_templates()->config->get('license_page'),
17
+ '<i class="fa fa-external-link" aria-hidden="true"></i>',
18
+ Templates\premium_templates()->config->get('pro_message')
19
+ );
20
+ ?></div>
21
+ </div>
includes/templates/scripts/template-modal-filters-item.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Template Library Filter Item
4
+ */
5
+ ?>
6
+ <label class="premium-template-filter-label">
7
+ <input type="radio" value="{{ slug }}" <# if ( '' === slug ) { #> checked<# } #> name="premium-template-filter">
8
+ <span>{{ title.replace('&amp;', '&') }}</span>
9
+ </label>
includes/templates/scripts/template-modal-filters.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Template Library Filter
4
+ */
5
+ ?>
6
+ <div id="premium-modal-filters-container"></div>
includes/templates/scripts/template-modal-header-back.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Templates Back to Library Button
4
+ */
5
+ ?>
6
+ <button type="button" class="premium-template-modal-back">
7
+ <i class="dashicons dashicons-arrow-left-alt2"></i>
8
+ <?php echo __( 'Back to Library', 'premium-addons-for-elementor' ); ?>
9
+ </button>
includes/templates/scripts/template-modal-header-logo.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Template Library Modal Header
4
+ */
5
+ ?>
6
+ <span class="premium-template-modal-header-logo-icon">
7
+ <img src="<?php echo PREMIUM_ADDONS_URL .'admin/images/premium-addons-logo.png'; ?>">
8
+ </span>
9
+ <span class="premium-template-modal-header-logo-label">
10
+ <?php echo __('Premium Templates', 'premium-addons-for-elementor'); ?>
11
+ </span>
12
+
includes/templates/scripts/template-modal-header.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Template Library Header
4
+ */
5
+ ?>
6
+ <div id="premium-template-modal-header-logo-area"></div>
7
+ <div id="premium-template-modal-header-tabs"></div>
8
+ <div id="premium-template-modal-header-actions"></div>
9
+ <div id="premium-template-modal-header-close-modal" class="elementor-template-library-header-item" title="<?php echo __( 'Close', 'premium-addons-for-elementor' ); ?>">
10
+ <i class="eicon-close" title="Close"></i>
11
+ </div>
includes/templates/scripts/template-modal-insert-button.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Template Insert Button
4
+ */
5
+ ?>
6
+ <# if ( 'valid' === window.PremiumTempsData.license.status || ! pro ) { #>
7
+ <button class="elementor-template-library-template-action premium-template-insert elementor-button elementor-button-success">
8
+ <i class="eicon-file-download"></i><span class="elementor-button-title"><?php
9
+ echo __( 'Insert', 'premium-addons-for-elementor' );
10
+ ?></span>
11
+ </button>
12
+ <# } else { #>
13
+ <a class="template-library-activate-license elementor-button elementor-button-go-pro" href="{{{ window.PremiumTempsData.license.activateLink }}}" target="_blank">
14
+ <i class="fa fa-external-link" aria-hidden="true"></i>
15
+ {{{ window.PremiumTempsData.license.proMessage }}}
16
+ </a>
17
+ <# } #>
includes/templates/scripts/template-modal-item.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Template Item
4
+ */
5
+ ?>
6
+
7
+ <div class="elementor-template-library-template-body">
8
+ <div class="elementor-template-library-template-screenshot">
9
+ <div class="elementor-template-library-template-preview">
10
+ <i class="fa fa-search-plus"></i>
11
+ </div>
12
+ <img src="{{ thumbnail }}" alt="{{ title }}">
13
+ </div>
14
+ </div>
15
+ <div class="elementor-template-library-template-controls">
16
+ <# if ( 'valid' === window.PremiumTempsData.license.status || ! pro ) { #>
17
+ <button class="elementor-template-library-template-action premium-template-insert elementor-button elementor-button-success">
18
+ <i class="eicon-file-download"></i>
19
+ <span class="elementor-button-title"><?php echo __( 'Insert', 'premium-addons-for-elementor' ); ?></span>
20
+ </button>
21
+ <# } else if ( pro ) { #>
22
+ <a class="template-library-activate-license" href="{{{ window.PremiumTempsData.license.activateLink }}}" target="_blank">
23
+ <i class="fa fa-external-link" aria-hidden="true"></i>
24
+ {{{ window.PremiumTempsData.license.proMessage }}}
25
+ </a>
26
+ <# } #>
27
+ </div>
28
+
29
+ <!--<div class="elementor-template-library-template-name">{{{ title }}}</div>-->
includes/templates/scripts/template-modal-keywords.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Templates Keywords Filter
4
+ */
5
+ ?>
6
+ <#
7
+ if ( ! _.isEmpty( keywords ) ) {
8
+ #>
9
+ <label><?php echo __('Filter by Widget / Addon', 'premium-addons-for-elementor'); ?></label>
10
+ <select id="elementor-template-library-filter-subtype" class="elementor-template-library-filter-select premium-library-keywords" data-elementor-filter="subtype">
11
+ <option value=""><?php echo __( 'All Widgets/Addons', 'premium-addons-for-elementor' ); ?></option>
12
+ <# _.each( keywords, function( title, slug ) { #>
13
+ <option value="{{ slug }}">{{ title }}</option>
14
+ <# } ); #>
15
+ </select>
16
+ <#
17
+ }
18
+ #>
includes/templates/scripts/template-modal-loading.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Templates Loader View
4
+ */
5
+ ?>
6
+ <div class="elementor-loader-wrapper">
7
+ <div class="elementor-loader">
8
+ <div class="elementor-loader-box"></div>
9
+ <div class="elementor-loader-box"></div>
10
+ <div class="elementor-loader-box"></div>
11
+ <div class="elementor-loader-box"></div>
12
+ </div>
13
+ <div class="elementor-loading-title"><?php echo __('Loading', 'premium-addons-for-elementor'); ?></div>
14
+ </div>
includes/templates/scripts/template-modal-preview.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Templates Item Preview
4
+ */
5
+ ?>
6
+ <div class="premium-template-item-notice"></div>
7
+ <div class="premium-template-item-preview-iframe">
8
+ <iframe></iframe>
9
+ </div>
includes/templates/scripts/template-modal-tabs-item.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Template Library Header Tabs
4
+ */
5
+ ?>
6
+ <label>
7
+ <input type="radio" value="{{ slug }}" name="premium-template-modal-header-tab">
8
+ <span>{{ title }}</span>
9
+ </label>
includes/templates/scripts/template-modal-tabs.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Template Library Header Tabs
4
+ */
5
+ ?>
6
+ <div id="premium-modal-tabs-items"></div>
includes/templates/scripts/template-modal-templates.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Templates Modal Container
4
+ */
5
+ ?>
6
+ <div id="premium-modal-templates-container"></div>
includes/templates/sources/base.php ADDED
@@ -0,0 +1,286 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace PremiumAddons\Includes\Templates\Sources;
4
+
5
+ if ( ! defined( 'ABSPATH' ) ) {
6
+ exit; // Exit if accessed directly.
7
+ }
8
+
9
+ abstract class Premium_Templates_Source_Base {
10
+
11
+ /**
12
+ * @abstract
13
+ * @since 3.6.0
14
+ * @access public
15
+ */
16
+ abstract public function get_slug();
17
+
18
+ /**
19
+ * @abstract
20
+ * @since 3.6.0
21
+ * @access public
22
+ */
23
+ abstract public function get_version();
24
+
25
+ /**
26
+ * @abstract
27
+ * @since 3.6.0
28
+ * @access public
29
+ */
30
+ abstract public function get_items();
31
+
32
+ /**
33
+ * @abstract
34
+ * @since 3.6.0
35
+ * @access public
36
+ */
37
+ abstract public function get_categories();
38
+
39
+ /**
40
+ * Return source item list
41
+ *
42
+ * @since 3.6.0
43
+ * @access public
44
+ */
45
+ abstract public function get_keywords();
46
+
47
+ /**
48
+ * @abstract
49
+ * @since 3.6.0
50
+ * @access public
51
+ */
52
+ abstract public function get_item( $template_id );
53
+
54
+ /**
55
+ * @abstract
56
+ * @since 3.6.0
57
+ * @access public
58
+ */
59
+ abstract public function transient_lifetime();
60
+
61
+ /**
62
+ * Returns templates transient key for current source
63
+ *
64
+ * @return string
65
+ */
66
+ public function templates_key() {
67
+ return 'premium_templates_' . $this->get_slug() . '_' . $this->get_version();
68
+ }
69
+
70
+ /**
71
+ * Returns categories transient key for current source
72
+ *
73
+ * @return string
74
+ */
75
+ public function categories_key() {
76
+ return 'premium_categories_' . $this->get_slug() . '_' . $this->get_version();
77
+ }
78
+
79
+ /**
80
+ * Returns keywords transient key for current source
81
+ *
82
+ * @return string
83
+ */
84
+ public function keywords_key() {
85
+ return 'premium_keywords_' . $this->get_slug() . '_' . $this->get_version();
86
+ }
87
+
88
+ /**
89
+ * Set templates cache.
90
+ *
91
+ * @param array $value
92
+ */
93
+ public function set_templates_cache( $value ) {
94
+ set_transient( $this->templates_key(), $value, $this->transient_lifetime() );
95
+ }
96
+
97
+ /**
98
+ * Set templates cache.
99
+ *
100
+ * @param array $value
101
+ */
102
+ public function get_templates_cache() {
103
+
104
+ if ( $this->is_debug_active() ) {
105
+ return false;
106
+ }
107
+
108
+ return get_transient( $this->templates_key() );
109
+ }
110
+
111
+ /**
112
+ * Delete templates cache
113
+ *
114
+ * @return [type] [description]
115
+ */
116
+ public function delete_templates_cache() {
117
+ delete_transient( $this->templates_key() );
118
+ }
119
+
120
+ /**
121
+ * Set categories cache.
122
+ *
123
+ * @param array $value
124
+ */
125
+ public function set_categories_cache( $value ) {
126
+ set_transient( $this->categories_key(), $value, $this->transient_lifetime() );
127
+ }
128
+
129
+ /**
130
+ * Set categories cache.
131
+ *
132
+ * @param array $value
133
+ */
134
+ public function get_categories_cache() {
135
+
136
+ if ( $this->is_debug_active() ) {
137
+ return false;
138
+ }
139
+
140
+ return get_transient( $this->categories_key() );
141
+ }
142
+
143
+ /**
144
+ * Delete categories cache
145
+ *
146
+ * @return [type] [description]
147
+ */
148
+ public function delete_categories_cache() {
149
+ delete_transient( $this->categories_key() );
150
+ }
151
+
152
+ /**
153
+ * Set categories cache.
154
+ *
155
+ * @param array $value
156
+ */
157
+ public function set_keywords_cache( $value ) {
158
+ set_transient( $this->keywords_key(), $value, $this->transient_lifetime() );
159
+ }
160
+
161
+ /**
162
+ * Set categories cache.
163
+ *
164
+ * @param array $value
165
+ */
166
+ public function get_keywords_cache() {
167
+
168
+ if ( $this->is_debug_active() ) {
169
+ return false;
170
+ }
171
+
172
+ return get_transient( $this->keywords_key() );
173
+ }
174
+
175
+ /**
176
+ * Delete categories cache
177
+ *
178
+ * @return [type] [description]
179
+ */
180
+ public function delete_keywords_cache() {
181
+ delete_transient( $this->keywords_key() );
182
+ }
183
+
184
+ /**
185
+ * Check if debug is active
186
+ *
187
+ * @return boolean
188
+ */
189
+ public function is_debug_active() {
190
+
191
+ if ( defined( 'PREMIUM_API_DEBUG' ) && true === PREMIUM_API_DEBUG ) {
192
+ return true;
193
+ } else {
194
+ return false;
195
+ }
196
+
197
+ }
198
+
199
+ /**
200
+ * Returns template ID prefix for premium templates
201
+ *
202
+ * @return string
203
+ */
204
+ public function id_prefix() {
205
+ return 'premium_';
206
+ }
207
+
208
+ /**
209
+ * @since 3.6.0
210
+ * @access protected
211
+ */
212
+ protected function replace_elements_ids( $content ) {
213
+ return \Elementor\Plugin::$instance->db->iterate_data( $content, function( $element ) {
214
+ $element['id'] = \Elementor\Utils::generate_random_string();
215
+ return $element;
216
+ } );
217
+ }
218
+
219
+ /**
220
+ * Process content for export/import.
221
+ *
222
+ * Process the content and all the inner elements, and prepare all the
223
+ * elements data for export/import.
224
+ *
225
+ * @since 3.6.0
226
+ * @access protected
227
+ *
228
+ * @param array $content A set of elements.
229
+ * @param string $method Accepts either `on_export` to export data or
230
+ * `on_import` to import data.
231
+ *
232
+ * @return mixed Processed content data.
233
+ */
234
+ protected function process_export_import_content( $content, $method ) {
235
+ return \Elementor\Plugin::$instance->db->iterate_data(
236
+ $content, function( $element_data ) use ( $method ) {
237
+ $element = \Elementor\Plugin::$instance->elements_manager->create_element_instance( $element_data );
238
+
239
+ // If the widget/element isn't exist, like a plugin that creates a widget but deactivated
240
+ if ( ! $element ) {
241
+ return null;
242
+ }
243
+
244
+ return $this->process_element_export_import_content( $element, $method );
245
+ }
246
+ );
247
+ }
248
+
249
+ /**
250
+ * Process single element content for export/import.
251
+ *
252
+ * Process any given element and prepare the element data for export/import.
253
+ *
254
+ * @since 3.6.0
255
+ * @access protected
256
+ *
257
+ * @param Controls_Stack $element
258
+ * @param string $method
259
+ *
260
+ * @return array Processed element data.
261
+ */
262
+ protected function process_element_export_import_content( $element, $method ) {
263
+
264
+ $element_data = $element->get_data();
265
+
266
+ if ( method_exists( $element, $method ) ) {
267
+ // TODO: Use the internal element data without parameters.
268
+ $element_data = $element->{$method}( $element_data );
269
+ }
270
+
271
+ foreach ( $element->get_controls() as $control ) {
272
+ $control_class = \Elementor\Plugin::$instance->controls_manager->get_control( $control['type'] );
273
+
274
+ // If the control isn't exist, like a plugin that creates the control but deactivated.
275
+ if ( ! $control_class ) {
276
+ return $element_data;
277
+ }
278
+
279
+ if ( method_exists( $control_class, $method ) ) {
280
+ $element_data['settings'][ $control['name'] ] = $control_class->{$method}( $element->get_settings( $control['name'] ), $control );
281
+ }
282
+ }
283
+
284
+ return $element_data;
285
+ }
286
+ }
includes/templates/sources/premium-api.php ADDED
@@ -0,0 +1,422 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace PremiumAddons\Includes\Templates\Sources;
4
+
5
+ use PremiumAddons\Includes\Templates;
6
+
7
+ if ( ! defined( 'ABSPATH' ) ) {
8
+ exit; // Exit if accessed directly.
9
+ }
10
+
11
+ class Premium_Templates_Source_Api extends Premium_Templates_Source_Base {
12
+
13
+ private $_object_cache = array();
14
+
15
+ /**
16
+ * Return source slug.
17
+ *
18
+ * @since 3.6.0
19
+ * @access public
20
+ */
21
+ public function get_slug() {
22
+ return 'premium-api';
23
+ }
24
+
25
+ /**
26
+ * Return source version.
27
+ *
28
+ * @since 3.6.0
29
+ * @access public
30
+ */
31
+ public function get_version() {
32
+
33
+ $key = $this->get_slug() . '_version';
34
+ $version = get_transient( $key );
35
+ $version = false;
36
+
37
+ if ( ! $version ) {
38
+ $version = Templates\premium_templates()->api->get_info( 'api_version' );
39
+ set_transient( $key, $version, DAY_IN_SECONDS );
40
+ }
41
+
42
+ return $version;
43
+ }
44
+
45
+ /**
46
+ * Return cached items list
47
+ *
48
+ * @since 3.6.0
49
+ * @access public
50
+ */
51
+ public function get_items( $tab = null ) {
52
+
53
+ if ( ! $tab ) {
54
+
55
+ return array();
56
+ }
57
+
58
+ $cached = $this->get_templates_cache();
59
+
60
+ if ( ! empty( $cached[ $tab ] ) ) {
61
+
62
+ return array_values( $cached[ $tab ] );
63
+ }
64
+
65
+ $templates = $this->remote_get_templates( $tab );
66
+
67
+ if ( ! $templates ) {
68
+ return array();
69
+ }
70
+
71
+ if ( empty( $cached ) ) {
72
+ $cached = array();
73
+ }
74
+
75
+ $cached[ $tab ] = $templates;
76
+
77
+ $this->set_templates_cache( $cached );
78
+
79
+ return $templates;
80
+
81
+ }
82
+
83
+ /**
84
+ * Prepare items tab
85
+ *
86
+ * @return object $result templates data
87
+ *
88
+ * @param string $tab tab slug
89
+ */
90
+ public function prepare_items_tab( $tab = '' ) {
91
+
92
+ if ( ! empty( $this->_object_cache[ $tab ] ) ) {
93
+ return $this->_object_cache[ $tab ];
94
+ }
95
+
96
+ $result = array(
97
+ 'templates' => array(),
98
+ 'categories' => array(),
99
+ 'keywords' => array(),
100
+ );
101
+
102
+ $templates_cache = $this->get_templates_cache();
103
+ $categories_cache = $this->get_categories_cache();
104
+ $keywords_cache = $this->get_keywords_cache();
105
+
106
+ if ( empty( $templates_cache ) ) {
107
+ $templates_cache = array();
108
+ }
109
+
110
+ if ( empty( $categories_cache ) ) {
111
+ $categories_cache = array();
112
+ }
113
+
114
+ if ( empty( $keywords_cache ) ) {
115
+ $keywords_cache = array();
116
+ }
117
+
118
+ $result['templates'] = $this->remote_get_templates( $tab );
119
+ $result['templates'] = $this->remote_get_categories( $tab );
120
+ $result['templates'] = $this->remote_get_keywords( $tab );
121
+
122
+ $templates_cache[ $tab ] = $result['templates'];
123
+ $categories_cache[ $tab ] = $result['categories'];
124
+ $keywords_cache[ $tab ] = $result['keywords'];
125
+
126
+ $this->set_templates_cache( $templates_cache );
127
+ $this->set_categories_cache( $categories_cache );
128
+ $this->set_keywords_cache( $keywords_cache );
129
+
130
+ $this->_object_cache[ $tab ] = $result;
131
+
132
+ return $result;
133
+ }
134
+
135
+ /**
136
+ * Get templates from remote server
137
+ *
138
+ * @param string $tab tab slug.
139
+ *
140
+ * @return array
141
+ */
142
+ public function remote_get_templates( $tab ) {
143
+
144
+ $api_url = Templates\premium_templates()->api->api_url( 'templates' );
145
+
146
+ if ( ! $api_url ) {
147
+ return false;
148
+ }
149
+
150
+ $response = wp_remote_get( $api_url . $tab, array(
151
+ 'timeout' => 60,
152
+ 'sslverify' => false
153
+ ) );
154
+
155
+ $body = wp_remote_retrieve_body( $response );
156
+
157
+ if ( ! $body ) {
158
+ return false;
159
+ }
160
+
161
+ $body = json_decode( $body, true );
162
+
163
+ if ( ! isset( $body['success'] ) || true !== $body['success'] ) {
164
+ return false;
165
+ }
166
+
167
+ if ( empty( $body['templates'] ) ) {
168
+ return false;
169
+ }
170
+
171
+ return $body['templates'];
172
+
173
+ }
174
+
175
+ /**
176
+ * Get categories from remote server
177
+ *
178
+ * @param string $tab tab slug.
179
+ *
180
+ * @return array
181
+ */
182
+ public function remote_get_categories( $tab ) {
183
+
184
+ $api_url = Templates\premium_templates()->api->api_url( 'categories' );
185
+
186
+ if ( ! $api_url ) {
187
+ return false;
188
+ }
189
+
190
+ $response = wp_remote_get( $api_url . $tab, array(
191
+ 'timeout' => 60,
192
+ 'sslverify' => false
193
+ ) );
194
+
195
+ $body = wp_remote_retrieve_body( $response );
196
+
197
+ if ( ! $body ) {
198
+ return false;
199
+ }
200
+
201
+ $body = json_decode( $body, true );
202
+
203
+ if ( ! isset( $body['success'] ) || true !== $body['success'] ) {
204
+ return false;
205
+ }
206
+
207
+ if ( empty( $body['terms'] ) ) {
208
+ return false;
209
+ }
210
+
211
+ return $body['terms'];
212
+
213
+ }
214
+
215
+ /**
216
+ * Get keywords from remote server
217
+ *
218
+ * @param string $tab tab slug
219
+ *
220
+ * @return array
221
+ */
222
+ public function remote_get_keywords( $tab ) {
223
+
224
+ $api_url = Templates\premium_templates()->api->api_url( 'keywords' );
225
+
226
+ if ( ! $api_url ) {
227
+ return false;
228
+ }
229
+
230
+ $response = wp_remote_get( $api_url . $tab, array(
231
+ 'timeout' => 60,
232
+ 'sslverify' => false
233
+ ) );
234
+
235
+ $body = wp_remote_retrieve_body( $response );
236
+
237
+ if ( ! $body ) {
238
+ return false;
239
+ }
240
+
241
+ $body = json_decode( $body, true );
242
+
243
+ if ( ! isset( $body['success'] ) || true !== $body['success'] ) {
244
+ return false;
245
+ }
246
+
247
+ if ( empty( $body['terms'] ) ) {
248
+ return false;
249
+ }
250
+
251
+ return $body['terms'];
252
+
253
+ }
254
+
255
+ /**
256
+ * Return source item list
257
+ *
258
+ * @since 3.6.0
259
+ * @access public
260
+ */
261
+ public function get_categories( $tab = null ) {
262
+
263
+ if ( ! $tab ) {
264
+ return array();
265
+ }
266
+
267
+ $cached = $this->get_categories_cache();
268
+
269
+ if ( ! empty( $cached[ $tab ] ) ) {
270
+ return $this->prepare_categories( $cached[ $tab ] );
271
+ }
272
+
273
+ $categories = $this->remote_get_categories( $tab );
274
+
275
+ if ( ! $categories ) {
276
+ return array();
277
+ }
278
+
279
+ if ( empty( $cached ) ) {
280
+ $cached = array();
281
+ }
282
+
283
+ $cached[ $tab ] = $categories;
284
+
285
+ $this->set_categories_cache( $cached );
286
+
287
+ return $this->prepare_categories( $categories );
288
+ }
289
+
290
+ /**
291
+ * Prepare categories for response
292
+ *
293
+ * @return [type] [description]
294
+ */
295
+ public function prepare_categories( $categories ) {
296
+
297
+ $result = array();
298
+
299
+ foreach ( $categories as $slug => $title ) {
300
+ $result[] = array(
301
+ 'slug' => $slug,
302
+ 'title' => $title,
303
+ );
304
+ }
305
+
306
+ return $result;
307
+ }
308
+
309
+ /**
310
+ * Return source item list
311
+ *
312
+ * @since 3.6.0
313
+ * @access public
314
+ */
315
+ public function get_keywords( $tab = null ) {
316
+
317
+ if ( ! $tab ) {
318
+ return array();
319
+ }
320
+
321
+ $cached = $this->get_keywords_cache();
322
+
323
+ if ( ! empty( $cached[ $tab ] ) ) {
324
+ return $cached[ $tab ];
325
+ }
326
+
327
+ $keywords = $this->remote_get_keywords( $tab );
328
+
329
+ if ( ! $keywords ) {
330
+ return array();
331
+ }
332
+
333
+ if ( empty( $cached ) ) {
334
+ $cached = array();
335
+ }
336
+
337
+ $cached[ $tab ] = $keywords;
338
+
339
+ $this->set_keywords_cache( $cached );
340
+
341
+ return $keywords;
342
+
343
+ }
344
+
345
+ /**
346
+ * Return single item
347
+ *
348
+ * @since 3.6.0
349
+ * @access public
350
+ */
351
+ public function get_item( $template_id, $tab = false ) {
352
+
353
+ $id = str_replace( $this->id_prefix(), '', $template_id );
354
+
355
+ if ( ! $tab ) {
356
+ $tab = isset( $_REQUEST['tab'] ) ? esc_attr( $_REQUEST['tab'] ) : false;
357
+ }
358
+
359
+ $license_key = Templates\premium_templates()->config->get( 'key' );
360
+
361
+ $api_url = Templates\premium_templates()->api->api_url( 'template' );
362
+
363
+ if ( ! $api_url ) {
364
+ wp_send_json_success( array(
365
+ 'licenseError' => true,
366
+ ) );
367
+ }
368
+
369
+ $request = add_query_arg(
370
+ array(
371
+ 'license' => $license_key,
372
+ 'url' => urlencode( home_url( '/' ) ),
373
+ ),
374
+ $api_url . $id
375
+ );
376
+
377
+ $response = wp_remote_get( $request, array(
378
+ 'timeout' => 60,
379
+ 'sslverify' => false
380
+ ) );
381
+
382
+ $body = wp_remote_retrieve_body( $response );
383
+ $body = json_decode( $body, true );
384
+
385
+ if ( ! isset( $body['success'] ) ) {
386
+ wp_send_json_error( array(
387
+ 'message' => 'Internal Error',
388
+ ) );
389
+ }
390
+
391
+ // if ( false === $body['license'] ) {
392
+ // wp_send_json_success( array(
393
+ // 'licenseError' => true,
394
+ // ) );
395
+ // }
396
+
397
+ $content = isset( $body['content'] ) ? $body['content'] : '';
398
+ $type = isset( $body['type'] ) ? $body['type'] : '';
399
+
400
+ if ( ! empty( $content ) ) {
401
+ $content = $this->replace_elements_ids( $content );
402
+ $content = $this->process_export_import_content( $content, 'on_import' );
403
+ }
404
+
405
+ return array(
406
+ 'page_settings' => array(),
407
+ 'type' => $type,
408
+ 'content' => $content
409
+ );
410
+
411
+ }
412
+
413
+ /**
414
+ * Return transient lifetime
415
+ *
416
+ * @since 3.6.0
417
+ * @access public
418
+ */
419
+ public function transient_lifetime() {
420
+ return DAY_IN_SECONDS;
421
+ }
422
+ }
includes/templates/templates.php ADDED
@@ -0,0 +1,239 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace PremiumAddons\Includes\Templates;
4
+
5
+ if ( ! defined('ABSPATH') ) exit;
6
+
7
+ // If class `Premium_Templates` not created.
8
+ if ( ! class_exists('Premium_Templates') ) {
9
+
10
+ /**
11
+ * Sets up and initializes the plugin.
12
+ */
13
+ class Premium_Templates {
14
+
15
+ /*
16
+ * Instance of the class
17
+ *
18
+ * @access private
19
+ * @since 3.6.0
20
+ *
21
+ */
22
+ private static $instance = null;
23
+
24
+ /*
25
+ * Holds API data
26
+ *
27
+ * @access public
28
+ * @since 3.6.0
29
+ *
30
+ */
31
+ public $api;
32
+
33
+ /*
34
+ * Holds templates configuration data
35
+ *
36
+ * @access public
37
+ * @since 3.6.0
38
+ *
39
+ */
40
+ public $config;
41
+
42
+ /*
43
+ * Holds templates assets
44
+ *
45
+ * @access public
46
+ * @since 3.6.0
47
+ *
48
+ */
49
+ public $assets;
50
+
51
+ /*
52
+ * Templates Manager
53
+ *
54
+ * @access public
55
+ * @since 3.6.0
56
+ *
57
+ */
58
+ public $temp_manager;
59
+
60
+ /*
61
+ * Holds templates types
62
+ *
63
+ * @access public
64
+ * @since 3.6.0
65
+ *
66
+ */
67
+ public $types;
68
+
69
+
70
+ /*
71
+ * Construct
72
+ *
73
+ * Class Constructor
74
+ *
75
+ * @since 3.6.0
76
+ * @access public
77
+ *
78
+ */
79
+ public function __construct() {
80
+
81
+ add_action( 'init', array( $this, 'init' ) );
82
+
83
+
84
+ }
85
+
86
+ /**
87
+ * Init Premium Templates
88
+ *
89
+ * @since 3.6.0
90
+ * @access public
91
+ *
92
+ * @return void
93
+ */
94
+ public function init() {
95
+
96
+ $this->load_files();
97
+
98
+ $this->set_config();
99
+
100
+ $this->set_assets();
101
+
102
+ $this->set_api();
103
+
104
+ $this->set_types();
105
+
106
+ $this->set_templates_manager();
107
+
108
+ }
109
+
110
+ /**
111
+ * Load required files for premium templates
112
+ *
113
+ * @since 3.6.0
114
+ * @access private
115
+ *
116
+ * @return void
117
+ */
118
+ private function load_files() {
119
+
120
+ require PREMIUM_ADDONS_PATH . 'includes/templates/classes/config.php';
121
+
122
+ require PREMIUM_ADDONS_PATH . 'includes/templates/classes/assets.php';
123
+
124
+ require PREMIUM_ADDONS_PATH . 'includes/templates/classes/manager.php';
125
+
126
+ require PREMIUM_ADDONS_PATH . 'includes/templates/types/manager.php';
127
+
128
+ require PREMIUM_ADDONS_PATH . 'includes/templates/classes/api.php';
129
+
130
+ }
131
+
132
+ /**
133
+ * Init `Premium_Templates_Core_Config`
134
+ *
135
+ * @since 3.6.0
136
+ * @access private
137
+ *
138
+ * @return void
139
+ */
140
+ private function set_config() {
141
+
142
+ $this->config = new Classes\Premium_Templates_Core_Config();
143
+
144
+ }
145
+
146
+ /**
147
+ * Init `Premium_Templates_Assets`
148
+ *
149
+ * @since 3.6.0
150
+ * @access private
151
+ *
152
+ * @return void
153
+ */
154
+ private function set_assets() {
155
+
156
+ $this->assets = new Classes\Premium_Templates_Assets();
157
+
158
+ }
159
+
160
+ /**
161
+ * Init `Premium_Templates_API`
162
+ *
163
+ * @since 3.6.0
164
+ * @access private
165
+ *
166
+ * @return void
167
+ */
168
+ private function set_api() {
169
+
170
+ $this->api = new Classes\Premium_Templates_API();
171
+
172
+ }
173
+
174
+ /**
175
+ * Init `Premium_Templates_Types`
176
+ *
177
+ * @since 3.6.0
178
+ * @access private
179
+ *
180
+ * @return void
181
+ */
182
+ private function set_types() {
183
+
184
+ $this->types = new Types\Premium_Templates_Types();
185
+
186
+ }
187
+
188
+ /**
189
+ * Init `Premium_Templates_Manager`
190
+ *
191
+ * @since 3.6.0
192
+ * @access private
193
+ *
194
+ * @return void
195
+ */
196
+ private function set_templates_manager() {
197
+
198
+ $this->temp_manager = new Classes\Premium_Templates_Manager();
199
+
200
+ }
201
+
202
+ /**
203
+ * Get instance
204
+ *
205
+ * Creates and returns an instance of the class
206
+ *
207
+ * @since 0.0.1
208
+ * @access public
209
+ *
210
+ * @return object
211
+ *
212
+ */
213
+ public static function get_instance() {
214
+ if( self::$instance == null ) {
215
+ self::$instance = new self;
216
+ }
217
+ return self::$instance;
218
+ }
219
+
220
+ }
221
+
222
+ }
223
+
224
+ if ( ! function_exists('premium_templates') ) {
225
+
226
+ /**
227
+ * Triggers `get_instance` method
228
+ * @since 3.6.0
229
+ * @access public
230
+ * return object
231
+ */
232
+ function premium_templates() {
233
+
234
+ return Premium_Templates::get_instance();
235
+
236
+ }
237
+
238
+ }
239
+ premium_templates();
includes/templates/types/base.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace PremiumAddons\Includes\Templates\Types;
4
+
5
+ if ( ! defined('ABSPATH') ) exit; // No access of directly access
6
+
7
+ if ( ! class_exists( 'Premium_Structure_Base' ) ) {
8
+
9
+ /**
10
+ * Define Premium_Structure_Base class
11
+ */
12
+ abstract class Premium_Structure_Base {
13
+
14
+ abstract public function get_id();
15
+
16
+ abstract public function get_single_label();
17
+
18
+ abstract public function get_plural_label();
19
+
20
+ abstract public function get_sources();
21
+
22
+ abstract public function get_document_type();
23
+
24
+ /**
25
+ * Is current structure could be outputed as location
26
+ *
27
+ * @since 3.6.0
28
+ * @access public
29
+ *
30
+ * @return boolean
31
+ */
32
+ public function is_location() {
33
+ return false;
34
+ }
35
+
36
+ /**
37
+ * Location name
38
+ *
39
+ * @since 3.6.0
40
+ * @access public
41
+ *
42
+ * @return boolean
43
+ */
44
+ public function location_name() {
45
+ return '';
46
+ }
47
+
48
+ /**
49
+ * Library settings for current structure
50
+ *
51
+ * @return void
52
+ */
53
+ public function library_settings() {
54
+
55
+ return array(
56
+ 'show_title' => true,
57
+ 'show_keywords' => true,
58
+ );
59
+
60
+ }
61
+
62
+ }
63
+
64
+ }
includes/templates/types/manager.php ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace PremiumAddons\Includes\Templates\Types;
4
+
5
+ if ( ! defined('ABSPATH') ) exit; // No access of directly access
6
+
7
+ if ( ! class_exists( 'Premium_Templates_Types' ) ) {
8
+
9
+ /**
10
+ * Premium Templates Types.
11
+ *
12
+ * Templates types responsible for handling templates library tabs
13
+ *
14
+ * @since 3.6.0
15
+ *
16
+ */
17
+ class Premium_Templates_Types {
18
+
19
+ /*
20
+ * Templates Types
21
+ */
22
+ private $types = null;
23
+
24
+ /**
25
+ * Premium_Templates_Types constructor.
26
+ *
27
+ * Get available types for the templates.
28
+ *
29
+ * @since 3.6.0
30
+ * @access public
31
+ *
32
+ */
33
+ public function __construct() {
34
+
35
+ $this->register_types();
36
+
37
+ }
38
+
39
+ /**
40
+ * Register default templates types
41
+ *
42
+ * @since 3.6.0
43
+ * @access public
44
+ *
45
+ * @return void
46
+ */
47
+ public function register_types() {
48
+
49
+ $base_path = PREMIUM_ADDONS_PATH . 'includes/templates/types/';
50
+
51
+ require $base_path . 'base.php';
52
+
53
+ $temp_types = array(
54
+ __NAMESPACE__ . '\Premium_Structure_Section' => $base_path . 'section.php',
55
+ );
56
+
57
+ array_walk( $temp_types, function( $file, $class ) {
58
+ require $file;
59
+ $this->register_type( $class );
60
+ } );
61
+
62
+ do_action( 'premium-templates/types/register', $this );
63
+
64
+ }
65
+
66
+ /**
67
+ * Register templates type
68
+ *
69
+ * @since 3.6.0
70
+ * @access public
71
+ *
72
+ * @return void
73
+ */
74
+ public function register_type( $class ) {
75
+
76
+ $instance = new $class;
77
+
78
+ $this->types[ $instance->get_id() ] = $instance;
79
+
80
+ if ( true === $instance->is_location() ) {
81
+
82
+ register_structure()->locations->register_location( $instance->location_name(), $instance );
83
+
84
+ }
85
+
86
+ }
87
+
88
+ /**
89
+ * Returns all templates types data
90
+ *
91
+ * @since 3.6.0
92
+ * @access public
93
+ *
94
+ * @return array
95
+ */
96
+ public function get_types() {
97
+
98
+ return $this->types;
99
+
100
+ }
101
+
102
+ /**
103
+ * Returns all templates types data
104
+ *
105
+ * @since 3.6.0
106
+ * @access public
107
+ *
108
+ * @return object
109
+ */
110
+ public function get_type( $id ) {
111
+
112
+ return isset( $this->types[ $id ] ) ? $this->types[ $id ] : false;
113
+
114
+ }
115
+
116
+
117
+ /**
118
+ * Return types prepared for templates library tabs
119
+ *
120
+ * @since 3.6.0
121
+ * @access public
122
+ *
123
+ */
124
+ public function get_types_for_popup() {
125
+
126
+ $result = array();
127
+
128
+ foreach ( $this->types as $id => $structure ) {
129
+ $result[ $id ] = array(
130
+ 'title' => $structure->get_plural_label(),
131
+ 'data' => array(),
132
+ 'sources' => $structure->get_sources(),
133
+ 'settings' => $structure->library_settings(),
134
+ );
135
+ }
136
+
137
+ return $result;
138
+
139
+ }
140
+
141
+ }
142
+
143
+ }
includes/templates/types/section.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace PremiumAddons\Includes\Templates\Types;
4
+
5
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
6
+
7
+ if ( ! class_exists( 'Premium_Structure_Section' ) ) {
8
+
9
+ /**
10
+ * Define Premium_Structure_Section class
11
+ */
12
+ class Premium_Structure_Section extends Premium_Structure_Base {
13
+
14
+ public function get_id() {
15
+ return 'premium_section';
16
+ }
17
+
18
+ public function get_single_label() {
19
+ return __( 'Section', 'premium-addons-for-elementor' );
20
+ }
21
+
22
+ public function get_plural_label() {
23
+ return __( 'Sections', 'premium-addons-for-elementor' );
24
+ }
25
+
26
+ public function get_sources() {
27
+ return array( 'premium-api' );
28
+ }
29
+
30
+ public function get_document_type() {
31
+ return array(
32
+ 'class' => 'Premium_Section_Document',
33
+ 'file' => PREMIUM_ADDONS_PATH . 'includes/templates/documents/section.php',
34
+ );
35
+ }
36
+
37
+ /**
38
+ * Library settings for current structure
39
+ *
40
+ * @return void
41
+ */
42
+ public function library_settings() {
43
+
44
+ return array(
45
+ 'show_title' => false,
46
+ 'show_keywords' => true,
47
+ );
48
+
49
+ }
50
+
51
+ }
52
+
53
+ }
premium-addons-for-elementor.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Premium Addons for Elementor
4
  Description: Premium Addons Plugin Includes 22+ premium widgets for Elementor Page Builder.
5
  Plugin URI: https://premiumaddons.com
6
- Version: 3.5.9
7
  Author: Leap13
8
  Author URI: https://leap13.com/
9
  Text Domain: premium-addons-for-elementor
@@ -14,12 +14,12 @@ License: GNU General Public License v3.0
14
  if ( ! defined('ABSPATH') ) exit; // No access of directly access
15
 
16
  // Define Constants
17
- define('PREMIUM_ADDONS_VERSION', '3.5.9');
18
  define('PREMIUM_ADDONS_URL', plugins_url('/', __FILE__));
19
  define('PREMIUM_ADDONS_PATH', plugin_dir_path(__FILE__));
20
  define('PREMIUM_ADDONS_FILE', __FILE__);
21
  define('PREMIUM_ADDONS_BASENAME', plugin_basename( PREMIUM_ADDONS_FILE ) );
22
- define('PREMIUM_ADDONS_STABLE_VERSION', '3.5.8');
23
 
24
  if( ! class_exists('Premium_Addons_Elementor') ) {
25
 
@@ -168,7 +168,7 @@ if( ! class_exists('Premium_Addons_Elementor') ) {
168
  /**
169
  * Load the required files for templates integration
170
  *
171
- * @since 3.4.0
172
  * @access public
173
  *
174
  * @return void
@@ -190,7 +190,10 @@ if( ! class_exists('Premium_Addons_Elementor') ) {
190
 
191
  $this->init_addons();
192
 
193
- //$this->init_templates();
 
 
 
194
 
195
  }
196
 
3
  Plugin Name: Premium Addons for Elementor
4
  Description: Premium Addons Plugin Includes 22+ premium widgets for Elementor Page Builder.
5
  Plugin URI: https://premiumaddons.com
6
+ Version: 3.6.0
7
  Author: Leap13
8
  Author URI: https://leap13.com/
9
  Text Domain: premium-addons-for-elementor
14
  if ( ! defined('ABSPATH') ) exit; // No access of directly access
15
 
16
  // Define Constants
17
+ define('PREMIUM_ADDONS_VERSION', '3.6.0');
18
  define('PREMIUM_ADDONS_URL', plugins_url('/', __FILE__));
19
  define('PREMIUM_ADDONS_PATH', plugin_dir_path(__FILE__));
20
  define('PREMIUM_ADDONS_FILE', __FILE__);
21
  define('PREMIUM_ADDONS_BASENAME', plugin_basename( PREMIUM_ADDONS_FILE ) );
22
+ define('PREMIUM_ADDONS_STABLE_VERSION', '3.5.9');
23
 
24
  if( ! class_exists('Premium_Addons_Elementor') ) {
25
 
168
  /**
169
  * Load the required files for templates integration
170
  *
171
+ * @since 3.6.0
172
  * @access public
173
  *
174
  * @return void
190
 
191
  $this->init_addons();
192
 
193
+ if ( PremiumAddons\Admin\Settings\Modules_Settings::check_premium_templates() ) {
194
+ $this->init_templates();
195
+
196
+ }
197
 
198
  }
199
 
readme.txt CHANGED
@@ -1,11 +1,11 @@
1
- === Premium Addons for Elementor ===
2
  Contributors: leap13
3
  Tags: Elementor, Elementor Page Builder, Elements, Elementor Addons, Add-ons, page builder, widgets, Elementor widgets
4
  Donate link: http://premiumaddons.com
5
  Requires at least: 4.5
6
  Tested up to: 5.2.2
7
  Requires PHP: 5.4
8
- Stable tag: 3.5.9
9
  License: GPL v3.0
10
  License URI: https://opensource.org/licenses/GPL-3.0
11
 
@@ -23,6 +23,7 @@ Premium Addons for Elementor can be used only as a complement of Elementor page
23
 
24
  ### Features
25
 
 
26
  * 22+ Fully Customizable Elementor add-on widgets.
27
  * Options panel for enabling desired widgets only for faster performance.
28
  * Free Support through online forums and our Facebook group.
@@ -141,9 +142,14 @@ Premium Addons for Elementor is 100% Ads Free, Ads can only be detected from You
141
 
142
  == Changelog ==
143
 
 
 
 
 
 
144
  = 3.5.9 =
145
 
146
- - Tweak: Added `Title Border` and `Inner Border` color option for Effect 3,4 and 6 in Banner widget.
147
 
148
  = 3.5.8 =
149
 
1
+ === Premium Addons for Elementor ===
2
  Contributors: leap13
3
  Tags: Elementor, Elementor Page Builder, Elements, Elementor Addons, Add-ons, page builder, widgets, Elementor widgets
4
  Donate link: http://premiumaddons.com
5
  Requires at least: 4.5
6
  Tested up to: 5.2.2
7
  Requires PHP: 5.4
8
+ Stable tag: 3.6.0
9
  License: GPL v3.0
10
  License URI: https://opensource.org/licenses/GPL-3.0
11
 
23
 
24
  ### Features
25
 
26
+ * NEW: Pre-Made [Premium Elementor Templates](https://premiumaddons.com/premium-templates-for-elementor/?utm_source=wp-plugins&utm_medium=wp-dash). Import it with just ONE click.
27
  * 22+ Fully Customizable Elementor add-on widgets.
28
  * Options panel for enabling desired widgets only for faster performance.
29
  * Free Support through online forums and our Facebook group.
142
 
143
  == Changelog ==
144
 
145
+ = 3.6.0 =
146
+
147
+ - New: Introducing Premium Templates - The Easiest Way to insert templates with just ONE click.
148
+ - Fixed: Grid widget categorization doesn't work with non English characters.
149
+
150
  = 3.5.9 =
151
 
152
+ - Tweak: Added Title Border and Inner Border color option for Effect 3,4 and 6 in Banner widget.
153
 
154
  = 3.5.8 =
155
 
widgets/premium-carousel.php CHANGED
@@ -8,7 +8,6 @@ use Elementor\Widget_Base;
8
  use Elementor\Controls_Manager;
9
  use Elementor\Repeater;
10
  use Elementor\Scheme_Color;
11
- use Elementor\Frontend;
12
 
13
  if( ! defined( 'ABSPATH' ) ) exit; // No access of directly access
14
 
@@ -1033,17 +1032,16 @@ class Premium_Carousel extends Widget_Base {
1033
  'mobileBreak' => $mobile_breakpoint
1034
  ];
1035
 
1036
- $premium_elements_page_id = array();
 
1037
  if( 'select' === $settings['premium_carousel_content_type'] ){
1038
  $premium_elements_page_id = $settings['premium_carousel_slider_content'];
1039
  } else {
1040
  foreach( $settings['premium_carousel_templates_repeater'] as $template ){
1041
- array_push($premium_elements_page_id, $template['premium_carousel_repeater_item']);
1042
  }
1043
  }
1044
 
1045
- $premium_elements_frontend = new Frontend;
1046
-
1047
  $this->add_render_attribute( 'carousel', 'id', 'premium-carousel-wrapper-' . esc_attr( $this->get_id() ) );
1048
 
1049
  $this->add_render_attribute( 'carousel', 'class', [
@@ -1070,10 +1068,10 @@ class Premium_Carousel extends Widget_Base {
1070
  <div <?php echo $this->get_render_attribute_string('carousel'); ?>>
1071
  <div id="premium-carousel-<?php echo esc_attr( $this->get_id() ); ?>" class="premium-carousel-inner">
1072
  <?php
1073
- foreach( $premium_elements_page_id as $elementor_post_id ) :
1074
  ?>
1075
  <div class="item-wrapper">
1076
- <?php echo $premium_elements_frontend->get_builder_content( $elementor_post_id, true ); ?>
1077
  </div>
1078
  <?php endforeach; ?>
1079
  </div>
8
  use Elementor\Controls_Manager;
9
  use Elementor\Repeater;
10
  use Elementor\Scheme_Color;
 
11
 
12
  if( ! defined( 'ABSPATH' ) ) exit; // No access of directly access
13
 
1032
  'mobileBreak' => $mobile_breakpoint
1033
  ];
1034
 
1035
+ $templates = array();
1036
+
1037
  if( 'select' === $settings['premium_carousel_content_type'] ){
1038
  $premium_elements_page_id = $settings['premium_carousel_slider_content'];
1039
  } else {
1040
  foreach( $settings['premium_carousel_templates_repeater'] as $template ){
1041
+ array_push($templates, $template['premium_carousel_repeater_item']);
1042
  }
1043
  }
1044
 
 
 
1045
  $this->add_render_attribute( 'carousel', 'id', 'premium-carousel-wrapper-' . esc_attr( $this->get_id() ) );
1046
 
1047
  $this->add_render_attribute( 'carousel', 'class', [
1068
  <div <?php echo $this->get_render_attribute_string('carousel'); ?>>
1069
  <div id="premium-carousel-<?php echo esc_attr( $this->get_id() ); ?>" class="premium-carousel-inner">
1070
  <?php
1071
+ foreach( $templates as $template_title ) :
1072
  ?>
1073
  <div class="item-wrapper">
1074
+ <?php echo $this->getTemplateInstance()->get_template_content( $template_title ); ?>
1075
  </div>
1076
  <?php endforeach; ?>
1077
  </div>
widgets/premium-grid.php CHANGED
@@ -1530,7 +1530,7 @@ class Premium_Grid extends Widget_Base {
1530
 
1531
  public function filter_cats( $string ) {
1532
 
1533
- $cat_filtered = strtolower( $string );
1534
 
1535
  if( strpos( $cat_filtered, 'class' ) || strpos( $cat_filtered, 'src' ) ) {
1536
  $cat_filtered = substr( $cat_filtered, strpos( $cat_filtered, '"' ) + 1 );
1530
 
1531
  public function filter_cats( $string ) {
1532
 
1533
+ $cat_filtered = mb_strtolower( $string );
1534
 
1535
  if( strpos( $cat_filtered, 'class' ) || strpos( $cat_filtered, 'src' ) ) {
1536
  $cat_filtered = substr( $cat_filtered, strpos( $cat_filtered, '"' ) + 1 );
widgets/premium-modalbox.php CHANGED
@@ -6,7 +6,6 @@ use PremiumAddons\Helper_Functions;
6
  use PremiumAddons\Includes;
7
  use Elementor\Widget_Base;
8
  use Elementor\Utils;
9
- use Elementor\Frontend;
10
  use Elementor\Control_Media;
11
  use Elementor\Controls_Manager;
12
  use Elementor\Scheme_Color;
@@ -1317,8 +1316,8 @@ class Premium_Modalbox extends Widget_Base {
1317
 
1318
  $button_icon = $settings['premium_modal_box_button_icon_selection'];
1319
 
1320
- $elementor_post_id = $settings['premium_modal_box_content_temp'];
1321
- $premium_elements_frontend = new Frontend;
1322
  $modal_settings = [
1323
  'trigger' => $settings['premium_modal_box_display_on'],
1324
  'delay' => $settings['premium_modal_box_popup_delay'],
@@ -1414,7 +1413,7 @@ class Premium_Modalbox extends Widget_Base {
1414
  </div>
1415
  <?php endif; ?>
1416
  <div class="premium-modal-box-modal-body">
1417
- <?php if( $settings['premium_modal_box_content_type'] == 'editor' ) : echo $this->parse_text_editor( $settings['premium_modal_box_content'] ); else: echo $premium_elements_frontend->get_builder_content( $elementor_post_id, true ); endif; ?>
1418
  </div>
1419
  <?php if ( $settings['premium_modal_box_lower_close'] === 'yes' ) : ?>
1420
  <div class="premium-modal-box-modal-footer">
6
  use PremiumAddons\Includes;
7
  use Elementor\Widget_Base;
8
  use Elementor\Utils;
 
9
  use Elementor\Control_Media;
10
  use Elementor\Controls_Manager;
11
  use Elementor\Scheme_Color;
1316
 
1317
  $button_icon = $settings['premium_modal_box_button_icon_selection'];
1318
 
1319
+ $template = $settings['premium_modal_box_content_temp'];
1320
+
1321
  $modal_settings = [
1322
  'trigger' => $settings['premium_modal_box_display_on'],
1323
  'delay' => $settings['premium_modal_box_popup_delay'],
1413
  </div>
1414
  <?php endif; ?>
1415
  <div class="premium-modal-box-modal-body">
1416
+ <?php if( $settings['premium_modal_box_content_type'] == 'editor' ) : echo $this->parse_text_editor( $settings['premium_modal_box_content'] ); else: echo $this->getTemplateInstance()->get_template_content( $template ); endif; ?>
1417
  </div>
1418
  <?php if ( $settings['premium_modal_box_lower_close'] === 'yes' ) : ?>
1419
  <div class="premium-modal-box-modal-footer">
widgets/premium-vscroll.php CHANGED
@@ -7,7 +7,6 @@ use PremiumAddons\Includes;
7
  use Elementor\Widget_Base;
8
  use Elementor\Controls_Manager;
9
  use Elementor\Repeater;
10
- use Elementor\Frontend;
11
  use Elementor\Scheme_Color;
12
  use Elementor\Scheme_Typography;
13
  use Elementor\Group_Control_Border;
@@ -745,15 +744,6 @@ class Premium_Vscroll extends Widget_Base {
745
 
746
  }
747
 
748
- protected function get_template_content( $template_id ) {
749
-
750
- $premium_elements_frontend = new Frontend;
751
-
752
- $template_content = $premium_elements_frontend->get_builder_content($template_id, true);
753
-
754
- return $template_content;
755
- }
756
-
757
  protected function render() {
758
 
759
  $settings = $this->get_settings_for_display();
@@ -833,8 +823,8 @@ class Premium_Vscroll extends Widget_Base {
833
  ?>
834
  <div <?php echo $this->get_render_attribute_string('section_' . $index); ?>>
835
  <?php
836
- $template_id = $section['section_template'];
837
- echo $this->get_template_content( $template_id );
838
  ?>
839
  </div>
840
  <?php endforeach; ?>
7
  use Elementor\Widget_Base;
8
  use Elementor\Controls_Manager;
9
  use Elementor\Repeater;
 
10
  use Elementor\Scheme_Color;
11
  use Elementor\Scheme_Typography;
12
  use Elementor\Group_Control_Border;
744
 
745
  }
746
 
 
 
 
 
 
 
 
 
 
747
  protected function render() {
748
 
749
  $settings = $this->get_settings_for_display();
823
  ?>
824
  <div <?php echo $this->get_render_attribute_string('section_' . $index); ?>>
825
  <?php
826
+ $template_title = $section['section_template'];
827
+ echo $this->getTemplateInstance()->get_template_content( $template_title );
828
  ?>
829
  </div>
830
  <?php endforeach; ?>