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