Happy Addons for Elementor (Mega Menu, Post Grid, Woocommerce Product Grid, Table, Event Calendar, Slider Elementor Widget) - Version 2.14.2

Version Description

  • 20 September 2020 =

  • Fix: JS loading issue for non logged in users

  • Fix: JS loading issue for logged in users

  • Fix: All the JS dependent widgets with issue

  • Fix: Editor loading issue

Download this release

Release Info

Developer thehappymonster
Plugin Icon 128x128 Happy Addons for Elementor (Mega Menu, Post Grid, Woocommerce Product Grid, Table, Event Calendar, Slider Elementor Widget)
Version 2.14.2
Comparing to
See all releases

Code changes from version 2.14.1 to 2.14.2

Files changed (5) hide show
  1. changelog.txt +7 -0
  2. classes/assets-manager.php +18 -16
  3. classes/cache-manager.php +132 -127
  4. plugin.php +2 -2
  5. readme.txt +8 -1
changelog.txt CHANGED
@@ -1,3 +1,10 @@
 
 
 
 
 
 
 
1
  = 2.14.1 - 7 September 2020 =
2
 
3
  - Fix: JS loading issue for non logged in users
1
+ = 2.14.2 - 20 September 2020 =
2
+
3
+ - Fix: JS loading issue for non logged in users
4
+ - Fix: JS loading issue for logged in users
5
+ - Fix: All the JS dependent widgets with issue
6
+ - Fix: Editor loading issue
7
+
8
  = 2.14.1 - 7 September 2020 =
9
 
10
  - Fix: JS loading issue for non logged in users
classes/assets-manager.php CHANGED
@@ -14,7 +14,7 @@ class Assets_Manager {
14
  public static function init() {
15
  // Frontend scripts
16
  add_action( 'wp_enqueue_scripts', [ __CLASS__, 'frontend_register' ] );
17
- add_action( 'wp_enqueue_scripts', [ __CLASS__, 'frontend_enqueue' ], 15 );
18
  add_action( 'elementor/css-file/post/enqueue', [ __CLASS__, 'frontend_enqueue_exceptions' ] );
19
 
20
  // Edit and preview enqueue
@@ -244,17 +244,11 @@ class Assets_Manager {
244
  HAPPY_ADDONS_VERSION
245
  );
246
 
247
- $script_deps = [
248
- 'elementor-frontend-modules',
249
- 'elementor-frontend',
250
- 'jquery'
251
- ];
252
-
253
  // Happy addons script
254
  wp_register_script(
255
  'happy-elementor-addons',
256
  HAPPY_ADDONS_ASSETS . 'js/happy-addons' . $suffix . 'js',
257
- $script_deps,
258
  HAPPY_ADDONS_VERSION,
259
  true
260
  );
@@ -285,10 +279,14 @@ class Assets_Manager {
285
  return;
286
  }
287
 
288
- if ( Cache_Manager::should_enqueue( $file->get_post_id() ) ) {
289
- Cache_Manager::enqueue( $file->get_post_id() );
290
- } else {
291
- Cache_Manager::enqueue_without_cache();
 
 
 
 
292
  }
293
  }
294
 
@@ -297,10 +295,14 @@ class Assets_Manager {
297
  return;
298
  }
299
 
300
- if ( Cache_Manager::should_enqueue( get_the_ID() ) ) {
301
- Cache_Manager::enqueue( get_the_ID() );
302
- } else {
303
- Cache_Manager::enqueue_without_cache();
 
 
 
 
304
  }
305
  }
306
 
14
  public static function init() {
15
  // Frontend scripts
16
  add_action( 'wp_enqueue_scripts', [ __CLASS__, 'frontend_register' ] );
17
+ add_action( 'wp_enqueue_scripts', [ __CLASS__, 'frontend_enqueue' ], 100 );
18
  add_action( 'elementor/css-file/post/enqueue', [ __CLASS__, 'frontend_enqueue_exceptions' ] );
19
 
20
  // Edit and preview enqueue
244
  HAPPY_ADDONS_VERSION
245
  );
246
 
 
 
 
 
 
 
247
  // Happy addons script
248
  wp_register_script(
249
  'happy-elementor-addons',
250
  HAPPY_ADDONS_ASSETS . 'js/happy-addons' . $suffix . 'js',
251
+ ['jquery'],
252
  HAPPY_ADDONS_VERSION,
253
  true
254
  );
279
  return;
280
  }
281
 
282
+ $post_id = $file->get_post_id();
283
+
284
+ if ( Cache_Manager::should_enqueue( $post_id ) ) {
285
+ Cache_Manager::enqueue( $post_id );
286
+ }
287
+
288
+ if ( Cache_Manager::should_enqueue_raw( $post_id ) ) {
289
+ Cache_Manager::enqueue_raw( $post_id );
290
  }
291
  }
292
 
295
  return;
296
  }
297
 
298
+ $post_id = get_the_ID();
299
+
300
+ if ( Cache_Manager::should_enqueue( $post_id ) ) {
301
+ Cache_Manager::enqueue( $post_id );
302
+ }
303
+
304
+ if ( Cache_Manager::should_enqueue_raw( $post_id ) ) {
305
+ Cache_Manager::enqueue_raw( $post_id );
306
  }
307
  }
308
 
classes/cache-manager.php CHANGED
@@ -1,127 +1,132 @@
1
- <?php
2
- namespace Happy_Addons\Elementor;
3
-
4
- use Elementor\Core\Files\CSS\Post as Post_CSS;
5
-
6
- defined( 'ABSPATH' ) || die();
7
-
8
- class Cache_Manager {
9
-
10
- private static $widgets_cache;
11
-
12
- public static function init() {
13
- add_action( 'elementor/editor/after_save', [ __CLASS__, 'cache_widgets' ], 10, 2 );
14
- add_action( 'after_delete_post', [ __CLASS__, 'delete_cache' ] );
15
- }
16
-
17
- public static function delete_cache( $post_id ) {
18
- // Delete to regenerate cache file
19
- $assets_cache = new Assets_Cache( $post_id );
20
- $assets_cache->delete();
21
- }
22
-
23
- public static function cache_widgets( $post_id, $data ) {
24
- if ( ! self::is_published( $post_id ) ) {
25
- return;
26
- }
27
-
28
- self::$widgets_cache = new Widgets_Cache( $post_id, $data );
29
- self::$widgets_cache->save();
30
-
31
- // Delete to regenerate cache file
32
- $assets_cache = new Assets_Cache( $post_id, self::$widgets_cache );
33
- $assets_cache->delete();
34
- }
35
-
36
- public static function is_published( $post_id ) {
37
- return get_post_status( $post_id ) === 'publish';
38
- }
39
-
40
- public static function is_editing_mode() {
41
- return (
42
- ha_elementor()->editor->is_edit_mode() ||
43
- ha_elementor()->preview->is_preview_mode() ||
44
- is_preview()
45
- );
46
- }
47
-
48
- public static function is_built_with_elementor( $post_id ) {
49
- return ha_elementor()->db->is_built_with_elementor( $post_id );
50
- }
51
-
52
- public static function should_enqueue( $post_id ) {
53
- if ( ! ha_is_on_demand_cache_enabled() ||
54
- ! self::is_built_with_elementor( $post_id ) ||
55
- ! self::is_published( $post_id ) ||
56
- self::is_editing_mode() ) {
57
- return false;
58
- }
59
-
60
- return true;
61
- }
62
-
63
- public static function enqueue_fa5_fonts( $post_id ) {
64
- $post_css = new Post_CSS( $post_id );
65
- $meta = $post_css->get_meta();
66
- if ( ! empty( $meta['icons'] ) ) {
67
- $icons_types = \Elementor\Icons_Manager::get_icon_manager_tabs();
68
- foreach ( $meta['icons'] as $icon_font ) {
69
- if ( ! isset( $icons_types[ $icon_font ] ) ) {
70
- continue;
71
- }
72
- ha_elementor()->frontend->enqueue_font( $icon_font );
73
- }
74
- }
75
- }
76
-
77
- public static function enqueue( $post_id ) {
78
- $assets_cache = new Assets_Cache( $post_id, self::$widgets_cache );
79
- $assets_cache->enqueue_libraries();
80
- $assets_cache->enqueue();
81
- self::enqueue_fa5_fonts( $post_id );
82
-
83
- wp_enqueue_script( 'happy-elementor-addons' );
84
-
85
- do_action( 'happyaddons_enqueue_assets', $is_cache = true, $post_id );
86
- }
87
-
88
- public static function enqueue_without_cache() {
89
- if ( ! self::is_editing_mode() ) {
90
- return;
91
- }
92
-
93
- $widgets_map = Widgets_Manager::get_widgets_map();
94
- $inactive_widgets = Widgets_Manager::get_inactive_widgets();
95
-
96
- foreach ( $widgets_map as $widget_key => $data ) {
97
- if ( ! isset( $data['vendor'] ) ) {
98
- continue;
99
- }
100
-
101
- if ( in_array( $widget_key, $inactive_widgets ) ) {
102
- continue;
103
- }
104
-
105
- $vendor = $data['vendor'];
106
-
107
- if ( isset( $vendor['css'] ) && is_array( $vendor['css'] ) ) {
108
- foreach ( $vendor['css'] as $vendor_css_handle ) {
109
- wp_enqueue_style( $vendor_css_handle );
110
- }
111
- }
112
-
113
- if ( isset( $vendor['js'] ) && is_array( $vendor['js'] ) ) {
114
- foreach ( $vendor['js'] as $vendor_js_handle ) {
115
- wp_enqueue_script( $vendor_js_handle );
116
- }
117
- }
118
- }
119
-
120
- wp_enqueue_style( 'happy-elementor-addons' );
121
- wp_enqueue_script( 'happy-elementor-addons' );
122
-
123
- do_action( 'happyaddons_enqueue_assets', $is_cache = false, 0 );
124
- }
125
- }
126
-
127
- Cache_Manager::init();
 
 
 
 
 
1
+ <?php
2
+ namespace Happy_Addons\Elementor;
3
+
4
+ use Elementor\Core\Files\CSS\Post as Post_CSS;
5
+
6
+ defined( 'ABSPATH' ) || die();
7
+
8
+ class Cache_Manager {
9
+
10
+ private static $widgets_cache;
11
+
12
+ public static function init() {
13
+ add_action( 'elementor/editor/after_save', [ __CLASS__, 'cache_widgets' ], 10, 2 );
14
+ add_action( 'after_delete_post', [ __CLASS__, 'delete_cache' ] );
15
+ }
16
+
17
+ public static function delete_cache( $post_id ) {
18
+ // Delete to regenerate cache file
19
+ $assets_cache = new Assets_Cache( $post_id );
20
+ $assets_cache->delete();
21
+ }
22
+
23
+ public static function cache_widgets( $post_id, $data ) {
24
+ if ( ! self::is_published( $post_id ) ) {
25
+ return;
26
+ }
27
+
28
+ self::$widgets_cache = new Widgets_Cache( $post_id, $data );
29
+ self::$widgets_cache->save();
30
+
31
+ // Delete to regenerate cache file
32
+ $assets_cache = new Assets_Cache( $post_id, self::$widgets_cache );
33
+ $assets_cache->delete();
34
+ }
35
+
36
+ public static function is_published( $post_id ) {
37
+ return get_post_status( $post_id ) === 'publish';
38
+ }
39
+
40
+ public static function is_editing_mode() {
41
+ return (
42
+ ha_elementor()->editor->is_edit_mode() ||
43
+ ha_elementor()->preview->is_preview_mode() ||
44
+ is_preview()
45
+ );
46
+ }
47
+
48
+ public static function is_built_with_elementor( $post_id ) {
49
+ return ha_elementor()->db->is_built_with_elementor( $post_id );
50
+ }
51
+
52
+ public static function should_enqueue( $post_id ) {
53
+ if ( ha_is_on_demand_cache_enabled() && self::is_built_with_elementor( $post_id ) && self::is_published( $post_id ) && ! self::is_editing_mode() ) {
54
+ return true;
55
+ }
56
+
57
+ return false;
58
+ }
59
+
60
+ public static function should_enqueue_raw( $post_id ) {
61
+ if ( ( ! ha_is_on_demand_cache_enabled() && self::is_built_with_elementor( $post_id ) ) || self::is_editing_mode() ) {
62
+ return true;
63
+ }
64
+
65
+ return false;
66
+ }
67
+
68
+ public static function enqueue_fa5_fonts( $post_id ) {
69
+ $post_css = new Post_CSS( $post_id );
70
+ $meta = $post_css->get_meta();
71
+ if ( ! empty( $meta['icons'] ) ) {
72
+ $icons_types = \Elementor\Icons_Manager::get_icon_manager_tabs();
73
+ foreach ( $meta['icons'] as $icon_font ) {
74
+ if ( ! isset( $icons_types[ $icon_font ] ) ) {
75
+ continue;
76
+ }
77
+ ha_elementor()->frontend->enqueue_font( $icon_font );
78
+ }
79
+ }
80
+ }
81
+
82
+ public static function enqueue( $post_id ) {
83
+ $assets_cache = new Assets_Cache( $post_id, self::$widgets_cache );
84
+ $assets_cache->enqueue_libraries();
85
+ $assets_cache->enqueue();
86
+ self::enqueue_fa5_fonts( $post_id );
87
+
88
+ wp_enqueue_script( 'happy-elementor-addons' );
89
+
90
+ do_action( 'happyaddons_enqueue_assets', $is_cache = true, $post_id );
91
+ }
92
+
93
+ public static function enqueue_raw() {
94
+ if ( ! self::is_editing_mode() ) {
95
+ return;
96
+ }
97
+
98
+ $widgets_map = Widgets_Manager::get_widgets_map();
99
+ $inactive_widgets = Widgets_Manager::get_inactive_widgets();
100
+
101
+ foreach ( $widgets_map as $widget_key => $data ) {
102
+ if ( ! isset( $data['vendor'] ) ) {
103
+ continue;
104
+ }
105
+
106
+ if ( in_array( $widget_key, $inactive_widgets ) ) {
107
+ continue;
108
+ }
109
+
110
+ $vendor = $data['vendor'];
111
+
112
+ if ( isset( $vendor['css'] ) && is_array( $vendor['css'] ) ) {
113
+ foreach ( $vendor['css'] as $vendor_css_handle ) {
114
+ wp_enqueue_style( $vendor_css_handle );
115
+ }
116
+ }
117
+
118
+ if ( isset( $vendor['js'] ) && is_array( $vendor['js'] ) ) {
119
+ foreach ( $vendor['js'] as $vendor_js_handle ) {
120
+ wp_enqueue_script( $vendor_js_handle );
121
+ }
122
+ }
123
+ }
124
+
125
+ wp_enqueue_style( 'happy-elementor-addons' );
126
+ wp_enqueue_script( 'happy-elementor-addons' );
127
+
128
+ do_action( 'happyaddons_enqueue_assets', $is_cache = false, 0 );
129
+ }
130
+ }
131
+
132
+ Cache_Manager::init();
plugin.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Happy Elementor Addons
4
  * Plugin URI: https://happyaddons.com/
5
  * Description: <a href="https://happyaddons.com/">HappyAddons</a> is a collection of slick, powerful widgets that works seamlessly with Elementor page builder. It’s trendy look with detail customization features allows to create extraordinary designs instantly. <a href="https://happyaddons.com/">HappyAddons</a> is free, rapidly growing and comes with great support.
6
- * Version: 2.14.1
7
  * Author: weDevs
8
  * Author URI: https://happyaddons.com/
9
  * License: GPLv2
@@ -34,7 +34,7 @@ Copyright 2019 HappyMonster <http://happymonster.me>
34
 
35
  defined( 'ABSPATH' ) || die();
36
 
37
- define( 'HAPPY_ADDONS_VERSION', '2.14.1' );
38
  define( 'HAPPY_ADDONS__FILE__', __FILE__ );
39
  define( 'HAPPY_ADDONS_DIR_PATH', plugin_dir_path( HAPPY_ADDONS__FILE__ ) );
40
  define( 'HAPPY_ADDONS_DIR_URL', plugin_dir_url( HAPPY_ADDONS__FILE__ ) );
3
  * Plugin Name: Happy Elementor Addons
4
  * Plugin URI: https://happyaddons.com/
5
  * Description: <a href="https://happyaddons.com/">HappyAddons</a> is a collection of slick, powerful widgets that works seamlessly with Elementor page builder. It’s trendy look with detail customization features allows to create extraordinary designs instantly. <a href="https://happyaddons.com/">HappyAddons</a> is free, rapidly growing and comes with great support.
6
+ * Version: 2.14.2
7
  * Author: weDevs
8
  * Author URI: https://happyaddons.com/
9
  * License: GPLv2
34
 
35
  defined( 'ABSPATH' ) || die();
36
 
37
+ define( 'HAPPY_ADDONS_VERSION', '2.14.2' );
38
  define( 'HAPPY_ADDONS__FILE__', __FILE__ );
39
  define( 'HAPPY_ADDONS_DIR_PATH', plugin_dir_path( HAPPY_ADDONS__FILE__ ) );
40
  define( 'HAPPY_ADDONS_DIR_URL', plugin_dir_url( HAPPY_ADDONS__FILE__ ) );
readme.txt CHANGED
@@ -1,6 +1,6 @@
1
  === Happy Addons for Elementor ===
2
  Plugin Name: Happy Addons for Elementor
3
- Version: 2.14.1
4
  Author: weDevs
5
  Author URI: https://happyaddons.com/
6
  Contributors: thehappymonster, happyaddons, hasinhayder, mosaddek73, tareq1988, sourav926, wedevs, iqbalrony, mrokon, obiplabon
@@ -259,6 +259,13 @@ For a more detailed explanation check out the following documentation
259
 
260
  == Changelog ==
261
 
 
 
 
 
 
 
 
262
  = 2.14.1 - 7 September 2020 =
263
 
264
  - Fix: JS loading issue for non logged in users
1
  === Happy Addons for Elementor ===
2
  Plugin Name: Happy Addons for Elementor
3
+ Version: 2.14.2
4
  Author: weDevs
5
  Author URI: https://happyaddons.com/
6
  Contributors: thehappymonster, happyaddons, hasinhayder, mosaddek73, tareq1988, sourav926, wedevs, iqbalrony, mrokon, obiplabon
259
 
260
  == Changelog ==
261
 
262
+ = 2.14.2 - 20 September 2020 =
263
+
264
+ - Fix: JS loading issue for non logged in users
265
+ - Fix: JS loading issue for logged in users
266
+ - Fix: All the JS dependent widgets with issue
267
+ - Fix: Editor loading issue
268
+
269
  = 2.14.1 - 7 September 2020 =
270
 
271
  - Fix: JS loading issue for non logged in users