Version Description
- 11/11/2019 =
- Fixed : Style breaking issue after update
- Few minor bugfix and improvements
Download this release
Release Info
Developer | re_enter_rupok |
Plugin | Elementor Essential Addons |
Version | 3.5.2 |
Comparing to | |
See all releases |
Code changes from version 3.5.1 to 3.5.2
- assets/admin/js/admin-bar.js +21 -23
- assets/admin/js/admin.js +7 -7
- essential_adons_elementor.php +2 -2
- includes/Classes/Bootstrap.php +1 -1
- includes/Traits/Admin.php +2 -2
- includes/Traits/Elements.php +10 -14
- includes/Traits/Enqueue.php +68 -73
- includes/Traits/Generator.php +87 -39
- includes/Traits/Helper.php +26 -5
- includes/Traits/Library.php +10 -4
- includes/templates/admin/tools.php +5 -7
- readme.txt +5 -1
assets/admin/js/admin-bar.js
CHANGED
@@ -1,30 +1,31 @@
|
|
1 |
(function($) {
|
2 |
-
|
3 |
|
4 |
-
$(document).on('click', '.ea-clear-cache', function
|
5 |
e.preventDefault();
|
6 |
|
7 |
-
if(typeof localize != 'undefined' && localize) {
|
8 |
-
var pageID = $(this)
|
9 |
-
|
|
|
|
|
|
|
10 |
|
11 |
$.ajax({
|
12 |
url: localize.ajaxurl,
|
13 |
-
type:
|
14 |
data: {
|
15 |
-
action:
|
16 |
security: localize.nonce,
|
17 |
pageID: pageID,
|
18 |
actionType: 'post'
|
19 |
},
|
20 |
beforeSend: function() {
|
21 |
-
text.text(
|
22 |
-
'Clearing...'
|
23 |
-
);
|
24 |
},
|
25 |
success: function(response) {
|
26 |
setTimeout(function() {
|
27 |
-
text.text('
|
28 |
window.location.reload();
|
29 |
}, 1000);
|
30 |
},
|
@@ -37,27 +38,25 @@
|
|
37 |
}
|
38 |
});
|
39 |
|
40 |
-
$(document).on('click', '.ea-all-cache-clear', function
|
41 |
e.preventDefault();
|
42 |
|
43 |
-
if(typeof localize != 'undefined' && localize) {
|
44 |
var text = $(this).find('.ab-item');
|
45 |
-
|
46 |
$.ajax({
|
47 |
url: localize.ajaxurl,
|
48 |
-
type:
|
49 |
data: {
|
50 |
-
action:
|
51 |
security: localize.nonce
|
52 |
},
|
53 |
beforeSend: function() {
|
54 |
-
text.text(
|
55 |
-
'Clearing...'
|
56 |
-
);
|
57 |
},
|
58 |
success: function(response) {
|
59 |
setTimeout(function() {
|
60 |
-
text.text('
|
61 |
window.location.reload();
|
62 |
}, 1000);
|
63 |
},
|
@@ -65,9 +64,8 @@
|
|
65 |
console.log('Something went wrong!');
|
66 |
}
|
67 |
});
|
68 |
-
}else {
|
69 |
-
console.log('This page has no widget from EA,
|
70 |
}
|
71 |
});
|
72 |
-
|
73 |
})(jQuery);
|
1 |
(function($) {
|
2 |
+
'use strict';
|
3 |
|
4 |
+
$(document).on('click', '.ea-clear-cache', function(e) {
|
5 |
e.preventDefault();
|
6 |
|
7 |
+
if (typeof localize != 'undefined' && localize) {
|
8 |
+
var pageID = $(this)
|
9 |
+
.parent()
|
10 |
+
.find('.ea-clear-cache-id')
|
11 |
+
.data('pageid'),
|
12 |
+
text = $(this).find('.ab-item');
|
13 |
|
14 |
$.ajax({
|
15 |
url: localize.ajaxurl,
|
16 |
+
type: 'post',
|
17 |
data: {
|
18 |
+
action: 'clear_cache_files_with_ajax',
|
19 |
security: localize.nonce,
|
20 |
pageID: pageID,
|
21 |
actionType: 'post'
|
22 |
},
|
23 |
beforeSend: function() {
|
24 |
+
text.text('Generating...');
|
|
|
|
|
25 |
},
|
26 |
success: function(response) {
|
27 |
setTimeout(function() {
|
28 |
+
text.text('Regenerate Page Assets');
|
29 |
window.location.reload();
|
30 |
}, 1000);
|
31 |
},
|
38 |
}
|
39 |
});
|
40 |
|
41 |
+
$(document).on('click', '.ea-all-cache-clear', function(e) {
|
42 |
e.preventDefault();
|
43 |
|
44 |
+
if (typeof localize != 'undefined' && localize) {
|
45 |
var text = $(this).find('.ab-item');
|
46 |
+
|
47 |
$.ajax({
|
48 |
url: localize.ajaxurl,
|
49 |
+
type: 'post',
|
50 |
data: {
|
51 |
+
action: 'clear_cache_files_with_ajax',
|
52 |
security: localize.nonce
|
53 |
},
|
54 |
beforeSend: function() {
|
55 |
+
text.text('Generating...');
|
|
|
|
|
56 |
},
|
57 |
success: function(response) {
|
58 |
setTimeout(function() {
|
59 |
+
text.text('Regenerate All Assets');
|
60 |
window.location.reload();
|
61 |
}, 1000);
|
62 |
},
|
64 |
console.log('Something went wrong!');
|
65 |
}
|
66 |
});
|
67 |
+
} else {
|
68 |
+
console.log('This page has no widget from EA, Regenerate Assets from Dashboard');
|
69 |
}
|
70 |
});
|
|
|
71 |
})(jQuery);
|
assets/admin/js/admin.js
CHANGED
@@ -83,7 +83,7 @@
|
|
83 |
}
|
84 |
});
|
85 |
|
86 |
-
//
|
87 |
$('#eael-regenerate-files').on('click', function(e) {
|
88 |
e.preventDefault();
|
89 |
var _this = $(this);
|
@@ -97,16 +97,16 @@
|
|
97 |
},
|
98 |
beforeSend: function() {
|
99 |
_this.html(
|
100 |
-
'<svg id="eael-spinner" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 48 48"><circle cx="24" cy="4" r="4" fill="#fff"/><circle cx="12.19" cy="7.86" r="3.7" fill="#fffbf2"/><circle cx="5.02" cy="17.68" r="3.4" fill="#fef7e4"/><circle cx="5.02" cy="30.32" r="3.1" fill="#fef3d7"/><circle cx="12.19" cy="40.14" r="2.8" fill="#feefc9"/><circle cx="24" cy="44" r="2.5" fill="#feebbc"/><circle cx="35.81" cy="40.14" r="2.2" fill="#fde7af"/><circle cx="42.98" cy="30.32" r="1.9" fill="#fde3a1"/><circle cx="42.98" cy="17.68" r="1.6" fill="#fddf94"/><circle cx="35.81" cy="7.86" r="1.3" fill="#fcdb86"/></svg><span>
|
101 |
);
|
102 |
},
|
103 |
success: function(response) {
|
104 |
setTimeout(function() {
|
105 |
-
_this.html('
|
106 |
|
107 |
Swal.fire({
|
108 |
type: 'success',
|
109 |
-
title: '
|
110 |
showConfirmButton: false,
|
111 |
timer: 2000
|
112 |
});
|
@@ -167,11 +167,11 @@
|
|
167 |
var target = $(this).data('target');
|
168 |
var val = $(target).val();
|
169 |
|
170 |
-
if(Object.keys(options).length > 0) {
|
171 |
prepareOptions['all'] = 'All';
|
172 |
|
173 |
-
for(var index in options) {
|
174 |
-
prepareOptions[index] = options[index].toUpperCase()
|
175 |
}
|
176 |
}
|
177 |
|
83 |
}
|
84 |
});
|
85 |
|
86 |
+
// Regenerate Assets
|
87 |
$('#eael-regenerate-files').on('click', function(e) {
|
88 |
e.preventDefault();
|
89 |
var _this = $(this);
|
97 |
},
|
98 |
beforeSend: function() {
|
99 |
_this.html(
|
100 |
+
'<svg id="eael-spinner" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 48 48"><circle cx="24" cy="4" r="4" fill="#fff"/><circle cx="12.19" cy="7.86" r="3.7" fill="#fffbf2"/><circle cx="5.02" cy="17.68" r="3.4" fill="#fef7e4"/><circle cx="5.02" cy="30.32" r="3.1" fill="#fef3d7"/><circle cx="12.19" cy="40.14" r="2.8" fill="#feefc9"/><circle cx="24" cy="44" r="2.5" fill="#feebbc"/><circle cx="35.81" cy="40.14" r="2.2" fill="#fde7af"/><circle cx="42.98" cy="30.32" r="1.9" fill="#fde3a1"/><circle cx="42.98" cy="17.68" r="1.6" fill="#fddf94"/><circle cx="35.81" cy="7.86" r="1.3" fill="#fcdb86"/></svg><span>Generating...</span>'
|
101 |
);
|
102 |
},
|
103 |
success: function(response) {
|
104 |
setTimeout(function() {
|
105 |
+
_this.html('Regenerate Assets');
|
106 |
|
107 |
Swal.fire({
|
108 |
type: 'success',
|
109 |
+
title: 'Assets Regenerated!',
|
110 |
showConfirmButton: false,
|
111 |
timer: 2000
|
112 |
});
|
167 |
var target = $(this).data('target');
|
168 |
var val = $(target).val();
|
169 |
|
170 |
+
if (Object.keys(options).length > 0) {
|
171 |
prepareOptions['all'] = 'All';
|
172 |
|
173 |
+
for (var index in options) {
|
174 |
+
prepareOptions[index] = options[index].toUpperCase();
|
175 |
}
|
176 |
}
|
177 |
|
essential_adons_elementor.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Description: The ultimate elements library for Elementor page builder plugin for WordPress.
|
5 |
* Plugin URI: https://essential-addons.com/elementor/
|
6 |
* Author: WPDeveloper
|
7 |
-
* Version: 3.5.
|
8 |
* Author URI: https://wpdeveloper.net/
|
9 |
*
|
10 |
* Text Domain: essential-addons-elementor
|
@@ -24,7 +24,7 @@ define('EAEL_PLUGIN_FILE', __FILE__);
|
|
24 |
define('EAEL_PLUGIN_BASENAME', plugin_basename(__FILE__));
|
25 |
define('EAEL_PLUGIN_PATH', trailingslashit(plugin_dir_path(__FILE__)));
|
26 |
define('EAEL_PLUGIN_URL', trailingslashit(plugins_url('/', __FILE__)));
|
27 |
-
define('EAEL_PLUGIN_VERSION', '3.5.
|
28 |
define('EAEL_ASSET_PATH', WP_CONTENT_DIR . '/uploads/essential-addons-elementor');
|
29 |
define('EAEL_ASSET_URL', WP_CONTENT_URL . '/uploads/essential-addons-elementor');
|
30 |
|
4 |
* Description: The ultimate elements library for Elementor page builder plugin for WordPress.
|
5 |
* Plugin URI: https://essential-addons.com/elementor/
|
6 |
* Author: WPDeveloper
|
7 |
+
* Version: 3.5.2
|
8 |
* Author URI: https://wpdeveloper.net/
|
9 |
*
|
10 |
* Text Domain: essential-addons-elementor
|
24 |
define('EAEL_PLUGIN_BASENAME', plugin_basename(__FILE__));
|
25 |
define('EAEL_PLUGIN_PATH', trailingslashit(plugin_dir_path(__FILE__)));
|
26 |
define('EAEL_PLUGIN_URL', trailingslashit(plugins_url('/', __FILE__)));
|
27 |
+
define('EAEL_PLUGIN_VERSION', '3.5.2');
|
28 |
define('EAEL_ASSET_PATH', WP_CONTENT_DIR . '/uploads/essential-addons-elementor');
|
29 |
define('EAEL_ASSET_URL', WP_CONTENT_URL . '/uploads/essential-addons-elementor');
|
30 |
|
includes/Classes/Bootstrap.php
CHANGED
@@ -104,8 +104,8 @@ class Bootstrap
|
|
104 |
add_action('elementor/editor/after_save', array($this, 'save_global_values'), 10, 2);
|
105 |
|
106 |
// Generator
|
|
|
107 |
add_action('elementor/frontend/before_render', array($this, 'collect_transient_elements'));
|
108 |
-
add_action('wp_print_footer_scripts', array($this, 'generate_frontend_scripts'));
|
109 |
|
110 |
// Enqueue
|
111 |
add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
|
104 |
add_action('elementor/editor/after_save', array($this, 'save_global_values'), 10, 2);
|
105 |
|
106 |
// Generator
|
107 |
+
add_action('wp', [$this, 'before_page_render']);
|
108 |
add_action('elementor/frontend/before_render', array($this, 'collect_transient_elements'));
|
|
|
109 |
|
110 |
// Enqueue
|
111 |
add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
|
includes/Traits/Admin.php
CHANGED
@@ -265,7 +265,7 @@ trait Admin
|
|
265 |
'meta' => [
|
266 |
'class' => 'ea-all-cache-clear'
|
267 |
],
|
268 |
-
'title' => '
|
269 |
]);
|
270 |
|
271 |
$wp_admin_bar->add_node([
|
@@ -276,7 +276,7 @@ trait Admin
|
|
276 |
'class' => 'ea-clear-cache',
|
277 |
'html' => '<div class="ea-clear-cache-id" data-pageid="'.get_queried_object_id().'">'
|
278 |
],
|
279 |
-
'title' => '
|
280 |
]);
|
281 |
|
282 |
|
265 |
'meta' => [
|
266 |
'class' => 'ea-all-cache-clear'
|
267 |
],
|
268 |
+
'title' => 'Regenerate All Assets'
|
269 |
]);
|
270 |
|
271 |
$wp_admin_bar->add_node([
|
276 |
'class' => 'ea-clear-cache',
|
277 |
'html' => '<div class="ea-clear-cache-id" data-pageid="'.get_queried_object_id().'">'
|
278 |
],
|
279 |
+
'title' => 'Regenerate Page Assets'
|
280 |
]);
|
281 |
|
282 |
|
includes/Traits/Elements.php
CHANGED
@@ -90,23 +90,19 @@ trait Elements
|
|
90 |
*/
|
91 |
public function render_global_html()
|
92 |
{
|
93 |
-
if (is_singular()) {
|
|
|
|
|
|
|
94 |
$page_settings_manager = Settings_Manager::get_settings_managers('page');
|
95 |
-
$page_settings_model = $page_settings_manager->get_model(
|
|
|
|
|
96 |
$global_settings = get_option('eael_global_settings');
|
97 |
-
|
98 |
-
|
99 |
-
if($this->get_settings('eael-reading-progress') == false) {
|
100 |
-
return;
|
101 |
-
}
|
102 |
-
|
103 |
-
if ($page_settings_model->get_settings('eael_ext_reading_progress') == 'yes' || isset($global_settings['reading_progress']['enabled'])) {
|
104 |
-
add_filter('eael/section/after_render', function ($extensions) {
|
105 |
-
$extensions[] = 'eael-reading-progress';
|
106 |
-
return $extensions;
|
107 |
-
});
|
108 |
|
109 |
-
|
|
|
110 |
<div class="eael-reading-progress eael-reading-progress-local eael-reading-progress-' . $page_settings_model->get_settings('eael_ext_reading_progress_position') . '">
|
111 |
<div class="eael-reading-progress-fill"></div>
|
112 |
</div>
|
90 |
*/
|
91 |
public function render_global_html()
|
92 |
{
|
93 |
+
if (is_singular() || is_home() || is_archive()) {
|
94 |
+
$queried_object = get_queried_object_id();
|
95 |
+
|
96 |
+
// get elementor page settings
|
97 |
$page_settings_manager = Settings_Manager::get_settings_managers('page');
|
98 |
+
$page_settings_model = $page_settings_manager->get_model($queried_object);
|
99 |
+
|
100 |
+
// get global settings
|
101 |
$global_settings = get_option('eael_global_settings');
|
102 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
+
if ($this->get_settings('eael-reading-progress') && ($page_settings_model->get_settings('eael_ext_reading_progress') == 'yes' || isset($global_settings['reading_progress']['enabled']))) {
|
105 |
+
$html = '<div class="eael-reading-progress-wrap eael-reading-progress-wrap-' . ($page_settings_model->get_settings('eael_ext_reading_progress') == 'yes' ? 'local' : 'global') . '">
|
106 |
<div class="eael-reading-progress eael-reading-progress-local eael-reading-progress-' . $page_settings_model->get_settings('eael_ext_reading_progress_position') . '">
|
107 |
<div class="eael-reading-progress-fill"></div>
|
108 |
</div>
|
includes/Traits/Enqueue.php
CHANGED
@@ -29,7 +29,8 @@ trait Enqueue
|
|
29 |
add_filter('caldera_forms_force_enqueue_styles_early', '__return_true');
|
30 |
}
|
31 |
|
32 |
-
|
|
|
33 |
wp_enqueue_style(
|
34 |
'fluent-form-styles',
|
35 |
WP_PLUGIN_URL . '/fluentform/public/css/fluent-forms-public.css',
|
@@ -47,41 +48,42 @@ trait Enqueue
|
|
47 |
|
48 |
// Load fontawesome as fallback
|
49 |
wp_enqueue_style(
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
);
|
55 |
-
|
56 |
-
wp_enqueue_style(
|
57 |
-
'font-awesome-4-shim',
|
58 |
-
ELEMENTOR_ASSETS_URL . 'lib/font-awesome/css/v4-shims.min.css',
|
59 |
-
false,
|
60 |
-
EAEL_PLUGIN_VERSION
|
61 |
);
|
62 |
-
|
63 |
-
//Admin bar css
|
64 |
wp_enqueue_style(
|
65 |
-
'
|
66 |
-
|
67 |
false,
|
68 |
EAEL_PLUGIN_VERSION
|
69 |
);
|
70 |
-
|
71 |
wp_enqueue_script(
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
);
|
77 |
-
|
78 |
-
//
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
|
86 |
// My Assets
|
87 |
if ($this->is_preview_mode()) {
|
@@ -128,19 +130,50 @@ trait Enqueue
|
|
128 |
if (is_singular() || is_home() || is_archive()) {
|
129 |
$queried_object = get_queried_object_id();
|
130 |
$post_type = (is_singular() || is_home() ? 'post' : 'term');
|
131 |
-
$elements = (array) get_metadata($post_type, $queried_object, 'eael_transient_elements', true);
|
132 |
|
133 |
-
|
134 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
}
|
136 |
-
|
137 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
}
|
139 |
}
|
140 |
}
|
141 |
|
142 |
// editor styles
|
143 |
-
public function editor_enqueue_scripts()
|
|
|
144 |
wp_enqueue_style(
|
145 |
'eael-editor-css',
|
146 |
$this->safe_protocol(EAEL_PLUGIN_URL . '/assets/admin/css/editor.css'),
|
@@ -148,42 +181,4 @@ trait Enqueue
|
|
148 |
EAEL_PLUGIN_VERSION
|
149 |
);
|
150 |
}
|
151 |
-
|
152 |
-
// rules how css will be enqueued on front-end
|
153 |
-
protected function enqueue_protocols($post_type, $queried_object)
|
154 |
-
{
|
155 |
-
if ($this->has_cache_files($post_type, $queried_object)) {
|
156 |
-
$css_file = EAEL_ASSET_URL . '/eael-' . $post_type . '-' . $queried_object . '.min.css';
|
157 |
-
$js_file = EAEL_ASSET_URL . '/eael-' . $post_type . '-' . $queried_object . '.min.js';
|
158 |
-
} else {
|
159 |
-
$css_file = EAEL_PLUGIN_URL . 'assets/front-end/css/eael.min.css';
|
160 |
-
$js_file = EAEL_PLUGIN_URL . 'assets/front-end/js/eael.min.js';
|
161 |
-
}
|
162 |
-
|
163 |
-
wp_enqueue_style(
|
164 |
-
'eael-front-end',
|
165 |
-
$this->safe_protocol($css_file),
|
166 |
-
false,
|
167 |
-
EAEL_PLUGIN_VERSION
|
168 |
-
);
|
169 |
-
|
170 |
-
wp_enqueue_script(
|
171 |
-
'eael-front-end',
|
172 |
-
$this->safe_protocol($js_file),
|
173 |
-
['jquery'],
|
174 |
-
EAEL_PLUGIN_VERSION,
|
175 |
-
true
|
176 |
-
);
|
177 |
-
|
178 |
-
// hook extended assets
|
179 |
-
do_action('eael/after_enqueue_scripts', $this->has_cache_files($post_type, $queried_object));
|
180 |
-
|
181 |
-
// localize script
|
182 |
-
$this->localize_objects = apply_filters('eael/localize_objects', [
|
183 |
-
'ajaxurl' => admin_url('admin-ajax.php'),
|
184 |
-
'nonce' => wp_create_nonce('essential-addons-elementor'),
|
185 |
-
]);
|
186 |
-
|
187 |
-
wp_localize_script('eael-front-end', 'localize', $this->localize_objects);
|
188 |
-
}
|
189 |
}
|
29 |
add_filter('caldera_forms_force_enqueue_styles_early', '__return_true');
|
30 |
}
|
31 |
|
32 |
+
// Fluent form compatibility
|
33 |
+
if (defined('FLUENTFORM')) {
|
34 |
wp_enqueue_style(
|
35 |
'fluent-form-styles',
|
36 |
WP_PLUGIN_URL . '/fluentform/public/css/fluent-forms-public.css',
|
48 |
|
49 |
// Load fontawesome as fallback
|
50 |
wp_enqueue_style(
|
51 |
+
'font-awesome-5-all',
|
52 |
+
ELEMENTOR_ASSETS_URL . 'lib/font-awesome/css/all.min.css',
|
53 |
+
false,
|
54 |
+
EAEL_PLUGIN_VERSION
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
);
|
56 |
+
|
|
|
57 |
wp_enqueue_style(
|
58 |
+
'font-awesome-4-shim',
|
59 |
+
ELEMENTOR_ASSETS_URL . 'lib/font-awesome/css/v4-shims.min.css',
|
60 |
false,
|
61 |
EAEL_PLUGIN_VERSION
|
62 |
);
|
63 |
+
|
64 |
wp_enqueue_script(
|
65 |
+
'font-awesome-4-shim',
|
66 |
+
ELEMENTOR_ASSETS_URL . 'lib/font-awesome/js/v4-shims.min.js',
|
67 |
+
false,
|
68 |
+
EAEL_PLUGIN_VERSION
|
69 |
);
|
70 |
+
|
71 |
+
// admin bar
|
72 |
+
if (is_admin_bar_showing()) {
|
73 |
+
wp_enqueue_style(
|
74 |
+
'ea-admin-bar',
|
75 |
+
EAEL_PLUGIN_URL . 'assets/admin/css/admin-bar.css',
|
76 |
+
false,
|
77 |
+
EAEL_PLUGIN_VERSION
|
78 |
+
);
|
79 |
+
|
80 |
+
wp_enqueue_script(
|
81 |
+
'ea-admin-bar',
|
82 |
+
EAEL_PLUGIN_URL . 'assets/admin/js/admin-bar.js',
|
83 |
+
['jquery'],
|
84 |
+
EAEL_PLUGIN_VERSION
|
85 |
+
);
|
86 |
+
}
|
87 |
|
88 |
// My Assets
|
89 |
if ($this->is_preview_mode()) {
|
130 |
if (is_singular() || is_home() || is_archive()) {
|
131 |
$queried_object = get_queried_object_id();
|
132 |
$post_type = (is_singular() || is_home() ? 'post' : 'term');
|
|
|
133 |
|
134 |
+
$this->generate_frontend_scripts($queried_object, $post_type);
|
135 |
+
|
136 |
+
if ($this->has_cache_files($queried_object, $post_type)) {
|
137 |
+
$uid = get_metadata($post_type, $queried_object, 'eael_uid', true);
|
138 |
+
$css_file = EAEL_ASSET_URL . '/' . $uid . '.min.css';
|
139 |
+
$js_file = EAEL_ASSET_URL . '/' . $uid . '.min.js';
|
140 |
+
} else {
|
141 |
+
$css_file = EAEL_PLUGIN_URL . 'assets/front-end/css/eael.min.css';
|
142 |
+
$js_file = EAEL_PLUGIN_URL . 'assets/front-end/js/eael.min.js';
|
143 |
}
|
144 |
+
|
145 |
+
wp_enqueue_style(
|
146 |
+
'eael-front-end',
|
147 |
+
$this->safe_protocol($css_file),
|
148 |
+
false,
|
149 |
+
EAEL_PLUGIN_VERSION
|
150 |
+
);
|
151 |
+
|
152 |
+
wp_enqueue_script(
|
153 |
+
'eael-front-end',
|
154 |
+
$this->safe_protocol($js_file),
|
155 |
+
['jquery'],
|
156 |
+
EAEL_PLUGIN_VERSION,
|
157 |
+
true
|
158 |
+
);
|
159 |
+
|
160 |
+
// hook extended assets
|
161 |
+
do_action('eael/after_enqueue_scripts', $this->has_cache_files($queried_object, $post_type));
|
162 |
+
|
163 |
+
// localize script
|
164 |
+
$this->localize_objects = apply_filters('eael/localize_objects', [
|
165 |
+
'ajaxurl' => admin_url('admin-ajax.php'),
|
166 |
+
'nonce' => wp_create_nonce('essential-addons-elementor'),
|
167 |
+
]);
|
168 |
+
|
169 |
+
wp_localize_script('eael-front-end', 'localize', $this->localize_objects);
|
170 |
}
|
171 |
}
|
172 |
}
|
173 |
|
174 |
// editor styles
|
175 |
+
public function editor_enqueue_scripts()
|
176 |
+
{
|
177 |
wp_enqueue_style(
|
178 |
'eael-editor-css',
|
179 |
$this->safe_protocol(EAEL_PLUGIN_URL . '/assets/admin/css/editor.css'),
|
181 |
EAEL_PLUGIN_VERSION
|
182 |
);
|
183 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
}
|
includes/Traits/Generator.php
CHANGED
@@ -5,10 +5,44 @@ if (!defined('ABSPATH')) {
|
|
5 |
exit;
|
6 |
} // Exit if accessed directly
|
7 |
|
|
|
|
|
8 |
use \ReflectionClass;
|
9 |
|
10 |
trait Generator
|
11 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
/**
|
13 |
* Collect elements in a page or post
|
14 |
*
|
@@ -16,12 +50,12 @@ trait Generator
|
|
16 |
*/
|
17 |
public function collect_transient_elements($widget)
|
18 |
{
|
19 |
-
if($widget->get_name() === 'global') {
|
20 |
$reflection = new ReflectionClass(get_class($widget));
|
21 |
$protected = $reflection->getProperty('template_data');
|
22 |
$protected->setAccessible(true);
|
23 |
|
24 |
-
if($global_data = $protected->getValue($widget)) {
|
25 |
$this->transient_elements = array_merge($this->transient_elements, $this->collect_recursive_elements($global_data['content']));
|
26 |
}
|
27 |
} else {
|
@@ -34,11 +68,12 @@ trait Generator
|
|
34 |
*
|
35 |
* @since 3.0.5
|
36 |
*/
|
37 |
-
public function collect_recursive_elements($elements)
|
|
|
38 |
$collections = [];
|
39 |
|
40 |
-
array_walk_recursive($elements, function($val, $key) use (&$collections) {
|
41 |
-
if($key == 'widgetType') {
|
42 |
$collections[] = $val;
|
43 |
}
|
44 |
});
|
@@ -130,10 +165,20 @@ trait Generator
|
|
130 |
*
|
131 |
* @since 3.0.0
|
132 |
*/
|
133 |
-
public function has_cache_files($
|
134 |
{
|
135 |
-
|
136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
|
138 |
if (is_readable($this->safe_path($css_path)) && is_readable($this->safe_path($js_path))) {
|
139 |
return true;
|
@@ -147,12 +192,8 @@ trait Generator
|
|
147 |
*
|
148 |
* @since 3.0.0
|
149 |
*/
|
150 |
-
public function generate_frontend_scripts()
|
151 |
{
|
152 |
-
if ($this->is_preview_mode()) {
|
153 |
-
return;
|
154 |
-
}
|
155 |
-
|
156 |
$replace = [
|
157 |
'eicon-woocommerce' => 'eael-product-grid',
|
158 |
'eael-countdown' => 'eael-count-down',
|
@@ -173,47 +214,54 @@ trait Generator
|
|
173 |
];
|
174 |
|
175 |
$elements = array_map(function ($val) use ($replace) {
|
176 |
-
if(array_key_exists($val, $replace)) {
|
177 |
$val = $replace[$val];
|
178 |
}
|
179 |
|
180 |
return (strpos($val, 'eael-') !== false ? str_replace(['eael-'], [''], $val) : null);
|
181 |
}, $this->transient_elements);
|
182 |
|
183 |
-
$
|
184 |
|
185 |
-
$elements = array_filter(array_unique(array_merge($elements, $
|
|
|
|
|
186 |
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
$old_elements = (array) get_metadata($post_type, $queried_object, 'eael_transient_elements', true);
|
191 |
|
192 |
-
|
193 |
-
|
194 |
-
sort($old_elements);
|
195 |
|
196 |
-
if
|
197 |
-
|
|
|
|
|
198 |
|
199 |
-
//
|
200 |
-
|
201 |
-
$this->generate_scripts($elements, 'eael-' . $post_type . '-' . $queried_object);
|
202 |
|
203 |
-
|
204 |
-
|
205 |
-
}
|
206 |
}
|
|
|
207 |
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
|
213 |
-
//
|
214 |
-
|
215 |
-
|
216 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
}
|
218 |
}
|
219 |
}
|
5 |
exit;
|
6 |
} // Exit if accessed directly
|
7 |
|
8 |
+
use \Elementor\Core\Settings\Manager as Settings_Manager;
|
9 |
+
use \Elementor\Frontend;
|
10 |
use \ReflectionClass;
|
11 |
|
12 |
trait Generator
|
13 |
{
|
14 |
+
/**
|
15 |
+
* Hit the page before it renders
|
16 |
+
*
|
17 |
+
* @since 3.5.2
|
18 |
+
* @todo new class
|
19 |
+
*/
|
20 |
+
public function before_page_render()
|
21 |
+
{
|
22 |
+
if (is_singular() || is_home() || is_archive()) {
|
23 |
+
$queried_object = get_queried_object_id();
|
24 |
+
|
25 |
+
// hit page
|
26 |
+
$frontend = new Frontend;
|
27 |
+
$frontend->get_builder_content($queried_object);
|
28 |
+
|
29 |
+
// get elementor page settings
|
30 |
+
$page_settings_manager = Settings_Manager::get_settings_managers('page');
|
31 |
+
$page_settings_model = $page_settings_manager->get_model($queried_object);
|
32 |
+
|
33 |
+
// get global settings
|
34 |
+
$global_settings = get_option('eael_global_settings');
|
35 |
+
|
36 |
+
// add global extension in transient
|
37 |
+
if ($this->get_settings('eael-reading-progress') && ($page_settings_model->get_settings('eael_ext_reading_progress') == 'yes' || isset($global_settings['reading_progress']['enabled']))) {
|
38 |
+
add_filter('eael/section/after_render', function ($extensions) {
|
39 |
+
$extensions[] = 'eael-reading-progress';
|
40 |
+
return $extensions;
|
41 |
+
});
|
42 |
+
}
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
/**
|
47 |
* Collect elements in a page or post
|
48 |
*
|
50 |
*/
|
51 |
public function collect_transient_elements($widget)
|
52 |
{
|
53 |
+
if ($widget->get_name() === 'global') {
|
54 |
$reflection = new ReflectionClass(get_class($widget));
|
55 |
$protected = $reflection->getProperty('template_data');
|
56 |
$protected->setAccessible(true);
|
57 |
|
58 |
+
if ($global_data = $protected->getValue($widget)) {
|
59 |
$this->transient_elements = array_merge($this->transient_elements, $this->collect_recursive_elements($global_data['content']));
|
60 |
}
|
61 |
} else {
|
68 |
*
|
69 |
* @since 3.0.5
|
70 |
*/
|
71 |
+
public function collect_recursive_elements($elements)
|
72 |
+
{
|
73 |
$collections = [];
|
74 |
|
75 |
+
array_walk_recursive($elements, function ($val, $key) use (&$collections) {
|
76 |
+
if ($key == 'widgetType') {
|
77 |
$collections[] = $val;
|
78 |
}
|
79 |
});
|
165 |
*
|
166 |
* @since 3.0.0
|
167 |
*/
|
168 |
+
public function has_cache_files($post_id = null, $post_type = null)
|
169 |
{
|
170 |
+
if ($post_id && $post_type) {
|
171 |
+
$uid = get_metadata($post_type, $post_id, 'eael_uid', true);
|
172 |
+
|
173 |
+
if ($uid === false) {
|
174 |
+
return false;
|
175 |
+
}
|
176 |
+
} else {
|
177 |
+
$uid = 'eael';
|
178 |
+
}
|
179 |
+
|
180 |
+
$css_path = EAEL_ASSET_PATH . DIRECTORY_SEPARATOR . $uid . '.min.css';
|
181 |
+
$js_path = EAEL_ASSET_PATH . DIRECTORY_SEPARATOR . $uid . '.min.js';
|
182 |
|
183 |
if (is_readable($this->safe_path($css_path)) && is_readable($this->safe_path($js_path))) {
|
184 |
return true;
|
192 |
*
|
193 |
* @since 3.0.0
|
194 |
*/
|
195 |
+
public function generate_frontend_scripts($queried_object, $post_type)
|
196 |
{
|
|
|
|
|
|
|
|
|
197 |
$replace = [
|
198 |
'eicon-woocommerce' => 'eael-product-grid',
|
199 |
'eael-countdown' => 'eael-count-down',
|
214 |
];
|
215 |
|
216 |
$elements = array_map(function ($val) use ($replace) {
|
217 |
+
if (array_key_exists($val, $replace)) {
|
218 |
$val = $replace[$val];
|
219 |
}
|
220 |
|
221 |
return (strpos($val, 'eael-') !== false ? str_replace(['eael-'], [''], $val) : null);
|
222 |
}, $this->transient_elements);
|
223 |
|
224 |
+
$this->transient_extensions = apply_filters('eael/section/after_render', $this->transient_extensions);
|
225 |
|
226 |
+
$elements = array_filter(array_unique(array_merge($elements, $this->transient_extensions)));
|
227 |
+
$file_name = str_rot13($post_type . $queried_object . time());
|
228 |
+
$old_elements = (array) get_metadata($post_type, $queried_object, 'eael_transient_elements', true);
|
229 |
|
230 |
+
// sort two arr for compare
|
231 |
+
sort($elements);
|
232 |
+
sort($old_elements);
|
|
|
233 |
|
234 |
+
if ($old_elements != $elements) {
|
235 |
+
update_metadata($post_type, $queried_object, 'eael_transient_elements', $elements);
|
|
|
236 |
|
237 |
+
// if not empty elements, regenerate cache files
|
238 |
+
if (!empty($elements)) {
|
239 |
+
// remove old cache
|
240 |
+
$this->remove_files($post_type, $queried_object);
|
241 |
|
242 |
+
// update new meta
|
243 |
+
update_metadata($post_type, $queried_object, 'eael_uid', $file_name);
|
|
|
244 |
|
245 |
+
// generate new cache
|
246 |
+
$this->generate_scripts($elements, $file_name);
|
|
|
247 |
}
|
248 |
+
}
|
249 |
|
250 |
+
// if no cache files, generate new
|
251 |
+
if (!$this->has_cache_files($queried_object, $post_type)) {
|
252 |
+
// remove old cache
|
253 |
+
$this->remove_files($post_type, $queried_object);
|
254 |
|
255 |
+
// update new meta
|
256 |
+
update_metadata($post_type, $queried_object, 'eael_uid', $file_name);
|
257 |
+
|
258 |
+
// generate new cache
|
259 |
+
$this->generate_scripts($elements, $file_name);
|
260 |
+
}
|
261 |
+
|
262 |
+
// if no elements, remove cache files
|
263 |
+
if (empty($elements)) {
|
264 |
+
$this->remove_files($post_type, $queried_object);
|
265 |
}
|
266 |
}
|
267 |
}
|
includes/Traits/Helper.php
CHANGED
@@ -957,15 +957,36 @@ trait Helper
|
|
957 |
$this->end_controls_section();
|
958 |
}
|
959 |
|
960 |
-
public function fix_old_query($settings)
|
961 |
-
|
962 |
-
|
|
|
|
|
|
|
963 |
$settings[str_replace('eaeposts_', '', $key)] = $value;
|
964 |
-
|
965 |
-
update_post_meta(get_the_ID(), '_elementor_data', str_replace('eaeposts_', '', get_post_meta(get_the_ID(), '_elementor_data', true)));
|
966 |
}
|
967 |
}
|
968 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
969 |
return $settings;
|
970 |
}
|
971 |
|
957 |
$this->end_controls_section();
|
958 |
}
|
959 |
|
960 |
+
public function fix_old_query($settings)
|
961 |
+
{
|
962 |
+
$update_query = false;
|
963 |
+
|
964 |
+
foreach ($settings as $key => $value) {
|
965 |
+
if (strpos($key, 'eaeposts_') !== false) {
|
966 |
$settings[str_replace('eaeposts_', '', $key)] = $value;
|
967 |
+
$update_query = true;
|
|
|
968 |
}
|
969 |
}
|
970 |
|
971 |
+
if ($update_query) {
|
972 |
+
global $wpdb;
|
973 |
+
|
974 |
+
$post_id = get_the_ID();
|
975 |
+
$data = get_post_meta($post_id, '_elementor_data', true);
|
976 |
+
$data = str_replace('eaeposts_', '', $data);
|
977 |
+
|
978 |
+
$wpdb->update(
|
979 |
+
$wpdb->postmeta,
|
980 |
+
[
|
981 |
+
'meta_value' => $data,
|
982 |
+
],
|
983 |
+
[
|
984 |
+
'post_id' => $post_id,
|
985 |
+
'meta_key' => '_elementor_data',
|
986 |
+
]
|
987 |
+
);
|
988 |
+
}
|
989 |
+
|
990 |
return $settings;
|
991 |
}
|
992 |
|
includes/Traits/Library.php
CHANGED
@@ -39,8 +39,14 @@ trait Library
|
|
39 |
*/
|
40 |
public function remove_files($post_type = null, $post_id = null)
|
41 |
{
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
if (file_exists($css_path)) {
|
46 |
unlink($css_path);
|
@@ -80,9 +86,9 @@ trait Library
|
|
80 |
{
|
81 |
check_ajax_referer('essential-addons-elementor', 'security');
|
82 |
|
83 |
-
if(isset($_POST['pageID']) && 'post' === $_POST['actionType']
|
84 |
$this->remove_files($_POST['actionType'], $_POST['pageID']);
|
85 |
-
}else {
|
86 |
// clear cache files
|
87 |
$this->empty_dir(EAEL_ASSET_PATH);
|
88 |
}
|
39 |
*/
|
40 |
public function remove_files($post_type = null, $post_id = null)
|
41 |
{
|
42 |
+
if($post_id && $post_type) {
|
43 |
+
$filename = get_metadata($post_type, $post_id, 'eael_uid', true);
|
44 |
+
} else {
|
45 |
+
$filename = 'eael';
|
46 |
+
}
|
47 |
+
|
48 |
+
$css_path = $this->safe_path(EAEL_ASSET_PATH . DIRECTORY_SEPARATOR . $filename . '.min.css');
|
49 |
+
$js_path = $this->safe_path(EAEL_ASSET_PATH . DIRECTORY_SEPARATOR . $filename . '.min.js');
|
50 |
|
51 |
if (file_exists($css_path)) {
|
52 |
unlink($css_path);
|
86 |
{
|
87 |
check_ajax_referer('essential-addons-elementor', 'security');
|
88 |
|
89 |
+
if (isset($_POST['pageID']) && 'post' === $_POST['actionType']) {
|
90 |
$this->remove_files($_POST['actionType'], $_POST['pageID']);
|
91 |
+
} else {
|
92 |
// clear cache files
|
93 |
$this->empty_dir(EAEL_ASSET_PATH);
|
94 |
}
|
includes/templates/admin/tools.php
CHANGED
@@ -7,21 +7,19 @@
|
|
7 |
<div class="eael-admin-block-header-icon">
|
8 |
<img src="<?php echo EAEL_PLUGIN_URL . 'assets/admin/images/icon-clean-cache.svg'; ?>" alt="essential-addons-tools-clean-cache">
|
9 |
</div>
|
10 |
-
<h4 class="eael-admin-title"><?php _e('
|
11 |
</header>
|
12 |
<div class="eael-admin-block-content">
|
13 |
-
<p><?php _e('Essential Addons styles & scripts are saved in Uploads folder. This option will clear all those
|
14 |
-
<a href="#" id="eael-regenerate-files" class="button eael-btn" target="_blank"><?php _e('
|
15 |
|
16 |
<div class="eael-checkbox eael-checkbox-quick-tools">
|
17 |
-
<p class="eael-el-title">
|
18 |
-
<?php _e( 'Show Quick Tools in Admin Bar?', 'essential-addons-elementor' ); ?>
|
19 |
-
</p>
|
20 |
|
21 |
<input type="checkbox" id="<?php echo esc_attr('quick_tools'); ?>" name="<?php echo esc_attr('quick_tools'); ?>" <?php echo checked( 1, $this->get_settings('quick_tools'), false ); ?>>
|
22 |
<label for="<?php echo esc_attr('quick_tools'); ?>"></label>
|
23 |
</div>
|
24 |
-
<p class="quick-tools-description"><?php _e('Display quick
|
25 |
</div>
|
26 |
</div>
|
27 |
</div>
|
7 |
<div class="eael-admin-block-header-icon">
|
8 |
<img src="<?php echo EAEL_PLUGIN_URL . 'assets/admin/images/icon-clean-cache.svg'; ?>" alt="essential-addons-tools-clean-cache">
|
9 |
</div>
|
10 |
+
<h4 class="eael-admin-title"><?php _e('Regenerate Assets', 'essential-addons-elementor'); ?></h4>
|
11 |
</header>
|
12 |
<div class="eael-admin-block-content">
|
13 |
+
<p><?php _e('Essential Addons styles & scripts are saved in Uploads folder. This option will clear all those generated files.', 'essential-addons-elementor'); ?></p>
|
14 |
+
<a href="#" id="eael-regenerate-files" class="button eael-btn" target="_blank"><?php _e('Regenerate Assets', 'essential-addons-elementor'); ?></a>
|
15 |
|
16 |
<div class="eael-checkbox eael-checkbox-quick-tools">
|
17 |
+
<p class="eael-el-title"><?php _e( 'Show Quick Tools in Admin Bar?', 'essential-addons-elementor' ); ?></p>
|
|
|
|
|
18 |
|
19 |
<input type="checkbox" id="<?php echo esc_attr('quick_tools'); ?>" name="<?php echo esc_attr('quick_tools'); ?>" <?php echo checked( 1, $this->get_settings('quick_tools'), false ); ?>>
|
20 |
<label for="<?php echo esc_attr('quick_tools'); ?>"></label>
|
21 |
</div>
|
22 |
+
<p class="quick-tools-description"><?php _e('Display quick assets generating tools in admin bar from where you can regenerate global assets or page assets.', 'essential-addons-elementor'); ?></p>
|
23 |
</div>
|
24 |
</div>
|
25 |
</div>
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: elementor, elements, addons, elementor addon, elementor widget, page build
|
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 5.2
|
6 |
Requires PHP: 5.4
|
7 |
-
Stable tag: 3.5.
|
8 |
License: GPLv3
|
9 |
License URI: https://opensource.org/licenses/GPL-3.0
|
10 |
|
@@ -174,6 +174,10 @@ Your existing elements/content will work with premium version. So you won't lose
|
|
174 |
|
175 |
== Changelog ==
|
176 |
|
|
|
|
|
|
|
|
|
177 |
= 3.5.1 - 31/10/2019 =
|
178 |
- Conflict Fix: Elementor Pro Media Carousel
|
179 |
- Fixed : Few Creative Buttons effects
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 5.2
|
6 |
Requires PHP: 5.4
|
7 |
+
Stable tag: 3.5.2
|
8 |
License: GPLv3
|
9 |
License URI: https://opensource.org/licenses/GPL-3.0
|
10 |
|
174 |
|
175 |
== Changelog ==
|
176 |
|
177 |
+
= 3.5.2 - 11/11/2019 =
|
178 |
+
- Fixed : Style breaking issue after update
|
179 |
+
- Few minor bugfix and improvements
|
180 |
+
|
181 |
= 3.5.1 - 31/10/2019 =
|
182 |
- Conflict Fix: Elementor Pro Media Carousel
|
183 |
- Fixed : Few Creative Buttons effects
|