PluginProbe ʕ •ᴥ•ʔ
Essential Addons for Elementor – Popular Elementor Templates & Widgets / 5.8.7
Essential Addons for Elementor – Popular Elementor Templates & Widgets v5.8.7
6.6.5 6.6.4 6.6.3 5.7.3 5.7.4 5.8.0 5.8.1 5.8.10 5.8.11 5.8.12 5.8.13 5.8.14 5.8.15 5.8.16 5.8.18 5.8.2 5.8.3 5.8.4 5.8.5 5.8.6 5.8.7 5.8.8 5.8.9 5.9.0 5.9.1 5.9.10 5.9.11 5.9.12 5.9.13 5.9.14 5.9.15 5.9.16 5.9.17 5.9.18 5.9.19 5.9.2 5.9.20 5.9.21 5.9.22 5.9.23 5.9.24 5.9.25 5.9.26 5.9.27 5.9.3 5.9.4 5.9.5 5.9.6 5.9.7 5.9.8 5.9.9 6.0.0 6.0.1 6.0.10 6.0.11 6.0.12 6.0.13 6.0.14 6.0.15 6.0.2 6.0.3 6.0.4 6.0.5 6.0.6 6.0.7 6.0.8 6.0.9 6.1.0 6.1.1 6.1.10 6.1.11 trunk 6.1.12 1.0.0 6.1.13 1.0.1 6.1.14 1.1.0 6.1.15 2.0 6.1.17 2.1 6.1.18 2.10.0 6.1.19 2.10.1 6.1.2 2.10.2 6.1.20 2.10.3 6.1.3 2.10.4 6.1.4 2.10.5 6.1.5 2.2.0 6.1.6 2.2.1 6.1.7 2.2.2 6.1.8 2.2.3 6.1.9 2.2.4 6.2.0 2.2.5 6.2.1 2.3.0 6.2.2 2.3.1 6.2.3 2.4.0 6.2.4 2.4.1 6.3.0 2.4.2 6.3.1 2.4.3 6.3.2 2.5.0 6.3.3 2.6.0 6.4.0 2.7.0 6.5.0 2.7.1 6.5.1 2.7.10 6.5.10 2.7.11 6.5.11 2.7.2 6.5.12 2.7.3 6.5.13 2.7.4 6.5.2 2.7.5 6.5.3 2.7.6 6.5.4 2.7.7 6.5.5 2.7.8 6.5.6 2.7.9 6.5.7 2.8.0 6.5.8 2.8.1 6.5.9 2.8.2 6.6.0 2.8.3 6.6.1 2.8.4 6.6.2 2.8.5 2.8.6 2.8.7 2.9.0 2.9.1 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8 2.9.9 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.4.1 3.1.5 3.2.0 3.3.0 3.3.1 3.3.2 3.3.3 3.4.0 3.5.0 3.5.1 3.5.2 3.6.0 3.6.1 3.6.2 3.7.0 3.7.1 3.7.2 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.3.0 4.3.1 4.3.2 4.3.3 4.3.4 4.3.5 4.3.6 4.3.7 4.3.8 4.3.9 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.5.3 4.5.4 4.5.5 4.6.0 4.6.1 4.6.2 4.6.3 4.6.4 4.6.5 4.6.6 4.7.0 4.7.1 4.7.2 4.7.3 4.7.4 4.7.5 4.8.0 4.8.1 4.8.2 4.8.3 4.8.4 4.9.0 4.9.1 4.9.2 4.9.3 4.9.4 4.9.5 4.9.6 4.9.7 5.0.0 5.0.1 5.0.10 5.0.11 5.0.12 5.0.13 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.0.9 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.1.8 5.1.9 5.2.0 5.2.1 5.2.2 5.2.3 5.2.4 5.3.0 5.3.1 5.3.2 5.4.6 5.5.5 5.6.5 5.7.2
essential-addons-for-elementor-lite / includes / Traits / Library.php
essential-addons-for-elementor-lite / includes / Traits Last commit date
Admin.php 3 years ago Ajax_Handler.php 2 years ago Controls.php 2 years ago Core.php 3 years ago Elements.php 2 years ago Enqueue.php 3 years ago Facebook_Feed.php 3 years ago Helper.php 2 years ago Library.php 3 years ago Login_Registration.php 2 years ago Shared.php 5 years ago Template_Query.php 4 years ago Twitter_Feed.php 2 years ago Woo_Product_Comparable.php 3 years ago index.php 3 years ago
Library.php
321 lines
1 <?php
2
3 namespace Essential_Addons_Elementor\Traits;
4
5 use Elementor\Plugin;
6
7 if (!defined('ABSPATH')) {
8 exit;
9 } // Exit if accessed directly
10
11 trait Library
12 {
13 public $a;
14 /**
15 * Return array of registered elements.
16 *
17 * @todo filter output
18 */
19
20 public function get_registered_elements()
21 {
22 return array_keys($this->registered_elements);
23 }
24
25 /**
26 * Return saved settings
27 *
28 * @since 3.0.0
29 */
30 public function get_settings($element = null)
31 {
32 $defaults = array_fill_keys(array_keys(array_merge($this->registered_elements, $this->registered_extensions)), true);
33 $elements = get_option('eael_save_settings', $defaults);
34 $elements = array_merge($defaults, $elements);
35
36 return (isset($element) ? (isset($elements[$element]) ? $elements[$element] : 0) : array_keys(array_filter($elements)));
37 }
38
39 /**
40 * @param $page_obj
41 * @param $key
42 * @return string
43 */
44 public function get_extension_settings($page_settings = [], $global_settings = [], $extension = '', $key = '')
45 {
46 if (isset($page_settings) && $page_settings->get_settings($extension) == 'yes') {
47 return $page_settings->get_settings($key);
48 } else if (isset($global_settings[$extension]['enabled'])) {
49 return isset($global_settings[$extension][$key]) ? $global_settings[$extension][$key] : '';
50 }
51
52 return '';
53 }
54
55 /**
56 * @param $id
57 * @param $global_data
58 * @return string
59 */
60 public function get_typography_data($id, $global_data)
61 {
62 $typo_data = '';
63 $fields_keys = [
64 'font_family',
65 'font_weight',
66 'text_transform',
67 'font_style',
68 'text_decoration',
69 'font_size',
70 'letter_spacing',
71 'line_height',
72 ];
73
74 foreach ($fields_keys as $key => $field) {
75 $typo_attr = $global_data[$id . '_' . $field];
76 $attr = str_replace('_', '-', $field);
77
78 if (in_array($field, ['font_size', 'letter_spacing', 'line_height'])) {
79 if (!empty($typo_attr['size'])) {
80 $typo_data .= "{$attr}:{$typo_attr['size']}{$typo_attr['unit']} !important;";
81 }
82 } elseif (!empty($typo_attr)) {
83 $typo_data .= ($attr == 'font-family') ? "{$attr}:{$typo_attr}, sans-serif;" : "{$attr}:{$typo_attr};";
84 }
85 }
86
87 return $typo_data;
88 }
89
90 /**
91 * Check if assets files exists
92 *
93 * @since 3.0.0
94 */
95 public function has_assets_files($uid = null, $ext = ['css', 'js'])
96 {
97 if (!is_array($ext)) {
98 $ext = (array) $ext;
99 }
100
101 foreach ($ext as $e) {
102 $path = EAEL_ASSET_PATH . DIRECTORY_SEPARATOR . ($uid ? $uid : 'eael') . '.min.' . $e;
103
104 if (!is_readable($this->safe_path($path))) {
105 return false;
106 }
107 }
108
109 return true;
110 }
111
112 /**
113 * Remove files
114 *
115 * @since 3.0.0
116 */
117 public function remove_files( $post_id = null, $ext = [ 'css', 'js' ] ) {
118 foreach ( $ext as $e ) {
119 $path = EAEL_ASSET_PATH . DIRECTORY_SEPARATOR . 'eael' . ( $post_id ? '-' . $post_id : '' ) . '.' . $e;
120 if ( file_exists( $path ) ) {
121 unlink( $path );
122 }
123 }
124 do_action( 'eael_remove_assets', $post_id, $ext );
125 }
126
127 /**
128 * Remove files in dir
129 *
130 * @since 3.0.0
131 */
132 public function empty_dir($path)
133 {
134 if (!is_dir($path) || !file_exists($path)) {
135 return;
136 }
137
138 foreach (scandir($path) as $item) {
139 if ($item == '.' || $item == '..') {
140 continue;
141 }
142
143 unlink($this->safe_path($path . DIRECTORY_SEPARATOR . $item));
144 }
145 }
146
147 /**
148 * Clear cache files
149 *
150 * @since 3.0.0
151 */
152
153
154 /**
155 * Check if wp running in background
156 *
157 * @since 3.0.0
158 */
159 public function is_running_background()
160 {
161 if (wp_doing_cron()) {
162 return true;
163 }
164
165 if (wp_doing_ajax()) {
166 return true;
167 }
168
169 if (!empty($_REQUEST['action']) && !$this->check_background_action( sanitize_text_field( $_REQUEST['action'] ) )) {
170 return true;
171 }
172
173 return false;
174 }
175
176 /**
177 * Check if elementor edit mode or not
178 *
179 * @since 3.0.0
180 */
181 public function is_edit_mode()
182 {
183 if (isset($_REQUEST['elementor-preview'])) {
184 return true;
185 }
186
187 return false;
188 }
189
190 /**
191 * Check if elementor edit mode or not
192 *
193 * @since 3.0.0
194 */
195 public function is_preview_mode()
196 {
197 if (isset($_REQUEST['elementor-preview'])) {
198 return false;
199 }
200
201 if (!empty($_REQUEST['action']) && !$this->check_background_action( sanitize_text_field( $_REQUEST['action'] ) )) {
202 return false;
203 }
204
205
206 return true;
207 }
208
209 /**
210 * Check if a plugin is installed
211 *
212 * @since v3.0.0
213 */
214 public function is_plugin_installed($basename)
215 {
216 if (!function_exists('get_plugins')) {
217 include_once ABSPATH . '/wp-admin/includes/plugin.php';
218 }
219
220 $installed_plugins = get_plugins();
221
222 return isset($installed_plugins[$basename]);
223 }
224
225 /**
226 * Generate safe path
227 *
228 * @since v3.0.0
229 */
230 public function safe_path($path)
231 {
232 $path = str_replace(['//', '\\\\'], ['/', '\\'], $path);
233
234 return str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $path);
235 }
236
237 /**
238 * Generate safe url
239 *
240 * @since v3.0.0
241 */
242 public function safe_url($url)
243 {
244 if (is_ssl()) {
245 $url = wp_parse_url($url);
246
247 if (!empty($url['host'])) {
248 $url['scheme'] = 'https';
249 }
250
251 return $this->unparse_url($url);
252 }
253
254 return $url;
255 }
256
257 public function unparse_url($parsed_url)
258 {
259 $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : '';
260 $host = isset($parsed_url['host']) ? $parsed_url['host'] : '';
261 $port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : '';
262 $user = isset($parsed_url['user']) ? $parsed_url['user'] : '';
263 $pass = isset($parsed_url['pass']) ? ':' . $parsed_url['pass'] : '';
264 $pass = ($user || $pass) ? "$pass@" : '';
265 $path = isset($parsed_url['path']) ? $parsed_url['path'] : '';
266 $query = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : '';
267 $fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : '';
268
269 return "$scheme$user$pass$host$port$path$query$fragment";
270 }
271
272 /**
273 * Allow to load asset for some pre defined action query param in elementor preview
274 * @return bool
275 */
276 public function check_background_action($action_name){
277 $allow_action = [
278 'subscriptions',
279 'mepr_unauthorized',
280 'home',
281 'subscriptions',
282 'payments',
283 'newpassword',
284 'manage_sub_accounts',
285 'ppw_postpass',
286 ];
287 if (in_array($action_name, $allow_action)){
288 return true;
289 }
290 return false;
291 }
292
293 /*
294 * Check some other cookie for solve asset loading issue
295 */
296 public function check_third_party_cookie_status($id='') {
297 global $Password_Protected;
298 if ( is_object( $Password_Protected ) && method_exists( $Password_Protected, 'cookie_name' ) && isset( $_COOKIE[ $Password_Protected->cookie_name() ] ) ) {
299 return true;
300 }
301 return false;
302 }
303
304 /**
305 * check_protected_content_status
306 *
307 * check EaeL Protected content cookie set or not
308 *
309 * @return bool
310 */
311 public function check_protected_content_status(){
312 if(!empty($_POST['eael_protected_content_id'])){
313 if(!empty($_POST['protection_password_'.$_POST['eael_protected_content_id']])){
314 return true;
315 }
316 }
317 return false;
318 }
319
320 }
321