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

Version Description

  • 5 April 2020 =

  • Tweak: Adminbar actions terms updated to more meaningful terms

  • Fix: Floating effect not working on frontend

  • Fix: Adminbar HappyAddons icon position

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.8.1
Comparing to
See all releases

Code changes from version 2.8.0 to 2.8.1

assets/admin/css/admin.css CHANGED
@@ -1,7 +1,8 @@
1
  #wp-admin-bar-happy-addons > .ab-item > img {
2
- margin-top: 7px;
3
  width: 18px;
4
  height: 18px;
 
5
  }
6
 
7
  #wp-admin-bar-happy-addons .ab-item .dashicons {
@@ -36,9 +37,11 @@
36
  @-webkit-keyframes ha-inifinite-rotate {
37
  from {
38
  -webkit-transform: rotate(0deg);
 
39
  }
40
  to {
41
  -webkit-transform: rotate(359deg);
 
42
  }
43
  }
44
 
1
  #wp-admin-bar-happy-addons > .ab-item > img {
2
+ margin-top: -4px;
3
  width: 18px;
4
  height: 18px;
5
+ vertical-align: text-bottom;
6
  }
7
 
8
  #wp-admin-bar-happy-addons .ab-item .dashicons {
37
  @-webkit-keyframes ha-inifinite-rotate {
38
  from {
39
  -webkit-transform: rotate(0deg);
40
+ transform: rotate(0deg);
41
  }
42
  to {
43
  -webkit-transform: rotate(359deg);
44
+ transform: rotate(359deg);
45
  }
46
  }
47
 
assets/admin/css/admin.min.css CHANGED
@@ -1 +1 @@
1
- #wp-admin-bar-happy-addons>.ab-item>img{margin-top:7px;width:18px;height:18px}#wp-admin-bar-happy-addons .ab-item .dashicons{position:relative;top:7px;display:inline-block;font-weight:400;font-style:normal;font-variant:normal;font-size:inherit;font-family:dashicons;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:auto}#wp-admin-bar-happy-addons .ab-item .dashicons-update-alt:before{content:"\f113"}#wp-admin-bar-happy-addons .ha-clear-cache--done .ab-item>i{color:#46b450}#wp-admin-bar-happy-addons .ha-clear-cache--init .ab-item>i{-webkit-animation:ha-inifinite-rotate .5s infinite linear;animation:ha-inifinite-rotate .5s infinite linear}@-webkit-keyframes ha-inifinite-rotate{0%{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(359deg)}}@keyframes ha-inifinite-rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}
1
+ #wp-admin-bar-happy-addons>.ab-item>img{margin-top:-4px;width:18px;height:18px;vertical-align:text-bottom}#wp-admin-bar-happy-addons .ab-item .dashicons{position:relative;top:7px;display:inline-block;font-weight:400;font-style:normal;font-variant:normal;font-size:inherit;font-family:dashicons;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:auto}#wp-admin-bar-happy-addons .ab-item .dashicons-update-alt:before{content:"\f113"}#wp-admin-bar-happy-addons .ha-clear-cache--done .ab-item>i{color:#46b450}#wp-admin-bar-happy-addons .ha-clear-cache--init .ab-item>i{-webkit-animation:ha-inifinite-rotate .5s infinite linear;animation:ha-inifinite-rotate .5s infinite linear}@-webkit-keyframes ha-inifinite-rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes ha-inifinite-rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}
assets/admin/js/select2.js CHANGED
@@ -50,7 +50,7 @@
50
  onReady: function () {
51
  var self = this,
52
  dataQueryOption = this.dataQueryOption();
53
-
54
  if( !dataQueryOption ){
55
  return;
56
  }
50
  onReady: function () {
51
  var self = this,
52
  dataQueryOption = this.dataQueryOption();
53
+
54
  if( !dataQueryOption ){
55
  return;
56
  }
changelog.txt CHANGED
@@ -1,3 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
1
  = 2.7.3 - 31 March 2020 =
2
 
3
  - Tweak: Custom attribute output support for all links
1
+ = 2.8.1 - 5 April 2020 =
2
+
3
+ - Tweak: Adminbar actions terms updated to more meaningful terms
4
+ - Fix: Floating effect not working on frontend
5
+ - Fix: Adminbar HappyAddons icon position
6
+
7
+ = 2.8.0 - 1 April 2020 =
8
+
9
+ - New: Post Tab widget
10
+ - New: Post List widget
11
+
12
  = 2.7.3 - 31 March 2020 =
13
 
14
  - Tweak: Custom attribute output support for all links
classes/admin-bar.php CHANGED
@@ -66,14 +66,16 @@ class Admin_Bar {
66
  public static function add_toolbar_items( \WP_Admin_Bar $admin_bar ) {
67
  if ( ! current_user_can( 'manage_options' ) ) {
68
  return;
69
- }
 
 
70
 
71
  $admin_bar->add_menu( array(
72
  'id' => 'happy-addons',
73
  'title' => '<img src="'.ha_get_b64_icon().'"">',
74
  'href' => ha_get_dashboard_link(),
75
  'meta' => [
76
- 'title' => __( 'Happy Addons Menu', 'happy-elementor-addons' ),
77
  ]
78
  ) );
79
 
@@ -81,7 +83,7 @@ class Admin_Bar {
81
  $admin_bar->add_menu( array(
82
  'id' => 'ha-clear-page-cache',
83
  'parent' => 'happy-addons',
84
- 'title' => '<i class="dashicons dashicons-update-alt"></i> ' . __( 'Renew Page Cache', 'happy-elementor-addons' ),
85
  'href' => '#',
86
  'meta' => [
87
  'class' => 'hajs-clear-cache ha-clear-page-cache',
@@ -92,7 +94,7 @@ class Admin_Bar {
92
  $admin_bar->add_menu( array(
93
  'id' => 'ha-clear-all-cache',
94
  'parent' => 'happy-addons',
95
- 'title' => '<i class="dashicons dashicons-update-alt"></i> ' . __( 'Renew All Cache', 'happy-elementor-addons' ),
96
  'href' => '#',
97
  'meta' => [
98
  'class' => 'hajs-clear-cache ha-clear-all-cache',
66
  public static function add_toolbar_items( \WP_Admin_Bar $admin_bar ) {
67
  if ( ! current_user_can( 'manage_options' ) ) {
68
  return;
69
+ }
70
+
71
+ $icon = '<i class="dashicons dashicons-update-alt"></i> ';
72
 
73
  $admin_bar->add_menu( array(
74
  'id' => 'happy-addons',
75
  'title' => '<img src="'.ha_get_b64_icon().'"">',
76
  'href' => ha_get_dashboard_link(),
77
  'meta' => [
78
+ 'title' => __( 'Happy Elementor Addons', 'happy-elementor-addons' ),
79
  ]
80
  ) );
81
 
83
  $admin_bar->add_menu( array(
84
  'id' => 'ha-clear-page-cache',
85
  'parent' => 'happy-addons',
86
+ 'title' => $icon . __( 'Page: Renew On Demand Assets', 'happy-elementor-addons' ),
87
  'href' => '#',
88
  'meta' => [
89
  'class' => 'hajs-clear-cache ha-clear-page-cache',
94
  $admin_bar->add_menu( array(
95
  'id' => 'ha-clear-all-cache',
96
  'parent' => 'happy-addons',
97
+ 'title' => $icon . __( 'Global: Renew On Demand Assets', 'happy-elementor-addons' ),
98
  'href' => '#',
99
  'meta' => [
100
  'class' => 'hajs-clear-cache ha-clear-all-cache',
classes/assets-cache.php CHANGED
@@ -5,187 +5,190 @@ defined( 'ABSPATH' ) || die();
5
 
6
  class Assets_Cache {
7
 
8
- const FILE_PREFIX = 'happy-';
9
-
10
- /**
11
- * @var int
12
- */
13
- protected $post_id = 0;
14
-
15
- /**
16
- * @var Widgets_Cache
17
- */
18
- protected $widgets_cache = null;
19
-
20
- protected $upload_path;
21
-
22
- protected $upload_url;
23
-
24
- public function __construct( $post_id = 0, Widgets_Cache $widget_cache_instance = null ) {
25
- $this->post_id = $post_id;
26
- $this->widgets_cache = $widget_cache_instance;
27
-
28
- $upload_dir = wp_upload_dir();
29
- $this->upload_path = trailingslashit( $upload_dir['basedir'] );
30
- $this->upload_url = trailingslashit( $upload_dir['baseurl'] );
31
- }
32
-
33
- public function get_widgets_cache() {
34
- if ( is_null( $this->widgets_cache ) ) {
35
- $this->widgets_cache = new Widgets_Cache( $this->get_post_id() );
36
- }
37
- return $this->widgets_cache;
38
- }
39
-
40
- public function get_cache_dir_name() {
41
- return trailingslashit( 'happyaddons' ) . trailingslashit( 'cache' );
42
- }
43
-
44
- public function get_post_id() {
45
- return $this->post_id;
46
- }
47
-
48
- public function get_cache_dir() {
49
- return $this->upload_path . $this->get_cache_dir_name();
50
- }
51
-
52
- public function get_cache_url() {
53
- return $this->upload_url . $this->get_cache_dir_name();
54
- }
55
-
56
- public function get_file_name() {
57
- return $this->get_cache_dir() . self::FILE_PREFIX . "{$this->get_post_id()}.css";
58
- }
59
-
60
- public function get_file_url() {
61
- return $this->get_cache_url() . self::FILE_PREFIX . "{$this->get_post_id()}.css";
62
- }
63
-
64
- public function cache_exists() {
65
- return file_exists( $this->get_file_name() );
66
- }
67
-
68
- public function has() {
69
- if ( ! $this->cache_exists() ) {
70
- $this->save();
71
- }
72
- return $this->cache_exists();
73
- }
74
-
75
- public function delete() {
76
- if ( $this->cache_exists() ) {
77
- unlink( $this->get_file_name() );
78
- }
79
- }
80
-
81
- public function delete_all() {
82
- $files = glob( $this->get_cache_dir() . '*' );
83
- foreach ( $files as $file ) {
84
- if ( is_file( $file ) ) {
85
- unlink( $file );
86
- }
87
- }
88
- }
89
-
90
- public function enqueue() {
91
- if ( $this->has() ) {
92
- wp_enqueue_style(
93
- 'happy-elementor-addons-' . $this->get_post_id(),
94
- $this->get_file_url(),
95
- [ 'elementor-frontend' ],
96
- HAPPY_ADDONS_VERSION . '.' . get_post_modified_time()
97
- );
98
- }
99
- }
100
-
101
- public function enqueue_libraries() {
102
- $widgets = $this->get_widgets_cache()->get();
103
-
104
- if ( empty( $widgets ) || ! is_array( $widgets ) ) {
105
- return;
106
- }
107
-
108
- $widgets_map = Widgets_Manager::get_widgets_map();
109
- $base_widget = isset( $widgets_map[ Widgets_Manager::get_base_widget_key() ] ) ? $widgets_map[ Widgets_Manager::get_base_widget_key() ] : [];
110
-
111
- if ( isset( $base_widget['vendor'], $base_widget['vendor']['css'] ) && is_array( $base_widget['vendor']['css'] ) ) {
112
- foreach ( $base_widget['vendor']['css'] as $vendor_css_handle ) {
113
- wp_enqueue_style( $vendor_css_handle );
114
- }
115
- }
116
-
117
- if ( isset( $base_widget['vendor'], $base_widget['vendor']['js'] ) && is_array( $base_widget['vendor']['js'] ) ) {
118
- foreach ( $base_widget['vendor']['js'] as $vendor_js_handle ) {
119
- wp_enqueue_script( $vendor_js_handle );
120
- }
121
- }
122
-
123
- foreach ( $widgets as $widget_key ) {
124
- if ( ! isset( $widgets_map[ $widget_key ], $widgets_map[ $widget_key ]['vendor'] ) ) {
125
- continue;
126
- }
127
-
128
- $vendor = $widgets_map[ $widget_key ]['vendor'];
129
-
130
- if ( isset( $vendor['css'] ) && is_array( $vendor['css'] ) ) {
131
- foreach ( $vendor['css'] as $vendor_css_handle ) {
132
- wp_enqueue_style( $vendor_css_handle );
133
- }
134
- }
135
-
136
- if ( isset( $vendor['js'] ) && is_array( $vendor['js'] ) ) {
137
- foreach ( $vendor['js'] as $vendor_js_handle ) {
138
- wp_enqueue_script( $vendor_js_handle );
139
- }
140
- }
141
- }
142
- }
143
-
144
- public function save() {
145
- $widgets = $this->get_widgets_cache()->get();
146
-
147
- if ( empty( $widgets ) ) {
148
- return;
149
- }
150
-
151
- $widgets_map = Widgets_Manager::get_widgets_map();
152
- $base_widget = isset( $widgets_map[ Widgets_Manager::get_base_widget_key() ] ) ? $widgets_map[ Widgets_Manager::get_base_widget_key() ] : [];
153
- $styles = '';
154
-
155
- // Get common css styles
156
- if ( isset( $base_widget['css'] ) && is_array( $base_widget['css'] ) ) {
157
- $styles = $this->get_styles( $base_widget['css'] );
158
- }
159
-
160
- $cached_widgets = [];
161
- foreach ( $widgets as $widget_key ) {
162
- if ( isset( $cached_widgets[ $widget_key ] ) ||
163
- ! isset( $widgets_map[ $widget_key ], $widgets_map[ $widget_key ]['css'] )
164
- ) {
165
- continue;
166
- }
167
- $is_pro = ( isset( $widgets_map[ $widget_key ]['is_pro'] ) && $widgets_map[ $widget_key ]['is_pro'] );
168
- $styles .= $this->get_styles( $widgets_map[ $widget_key ]['css'], $is_pro );
169
- $cached_widgets[ $widget_key ] = true;
170
- }
171
- $styles .= sprintf( '/** Compiled CSS for: %s **/', implode(', ', array_keys( $cached_widgets ) ) );
172
-
173
- if ( ! is_dir( $this->get_cache_dir() ) ) {
174
- @mkdir( $this->get_cache_dir(), 0755, true );
175
- }
176
-
177
- file_put_contents( $this->get_file_name(), $styles );
178
- }
179
-
180
- protected function get_styles( $files_name, $is_pro = false ) {
181
- $styles = '';
182
- foreach ( $files_name as $file_name ) {
183
- $file_path = HAPPY_ADDONS_DIR_PATH . "assets/css/widgets/{$file_name}.min.css";
184
- $file_path = apply_filters( 'happyaddons_get_styles_file_path', $file_path, $file_name, $is_pro );
185
- if ( is_readable( $file_path ) ) {
186
- $styles .= file_get_contents( $file_path );
187
- };
188
- }
189
- return $styles;
190
- }
 
 
 
191
  }
5
 
6
  class Assets_Cache {
7
 
8
+ const FILE_PREFIX = 'happy-';
9
+
10
+ /**
11
+ * @var int
12
+ */
13
+ protected $post_id = 0;
14
+
15
+ /**
16
+ * @var Widgets_Cache
17
+ */
18
+ protected $widgets_cache = null;
19
+
20
+ protected $upload_path;
21
+
22
+ protected $upload_url;
23
+
24
+ public function __construct( $post_id = 0, Widgets_Cache $widget_cache_instance = null ) {
25
+ $this->post_id = $post_id;
26
+ $this->widgets_cache = $widget_cache_instance;
27
+
28
+ $upload_dir = wp_upload_dir();
29
+ $this->upload_path = trailingslashit( $upload_dir['basedir'] );
30
+ $this->upload_url = trailingslashit( $upload_dir['baseurl'] );
31
+ }
32
+
33
+ public function get_widgets_cache() {
34
+ if ( is_null( $this->widgets_cache ) ) {
35
+ $this->widgets_cache = new Widgets_Cache( $this->get_post_id() );
36
+ }
37
+ return $this->widgets_cache;
38
+ }
39
+
40
+ public function get_cache_dir_name() {
41
+ return trailingslashit( 'happyaddons' ) . trailingslashit( 'cache' );
42
+ }
43
+
44
+ public function get_post_id() {
45
+ return $this->post_id;
46
+ }
47
+
48
+ public function get_cache_dir() {
49
+ return $this->upload_path . $this->get_cache_dir_name();
50
+ }
51
+
52
+ public function get_cache_url() {
53
+ return $this->upload_url . $this->get_cache_dir_name();
54
+ }
55
+
56
+ public function get_file_name() {
57
+ return $this->get_cache_dir() . self::FILE_PREFIX . "{$this->get_post_id()}.css";
58
+ }
59
+
60
+ public function get_file_url() {
61
+ return $this->get_cache_url() . self::FILE_PREFIX . "{$this->get_post_id()}.css";
62
+ }
63
+
64
+ public function cache_exists() {
65
+ return file_exists( $this->get_file_name() );
66
+ }
67
+
68
+ public function has() {
69
+ if ( ! $this->cache_exists() ) {
70
+ $this->save();
71
+ }
72
+ return $this->cache_exists();
73
+ }
74
+
75
+ public function delete() {
76
+ if ( $this->cache_exists() ) {
77
+ unlink( $this->get_file_name() );
78
+ }
79
+ }
80
+
81
+ public function delete_all() {
82
+ $files = glob( $this->get_cache_dir() . '*' );
83
+ foreach ( $files as $file ) {
84
+ if ( is_file( $file ) ) {
85
+ unlink( $file );
86
+ }
87
+ }
88
+ }
89
+
90
+ public function enqueue() {
91
+ if ( $this->has() ) {
92
+ wp_enqueue_style(
93
+ 'happy-elementor-addons-' . $this->get_post_id(),
94
+ $this->get_file_url(),
95
+ [ 'elementor-frontend' ],
96
+ HAPPY_ADDONS_VERSION . '.' . get_post_modified_time()
97
+ );
98
+ }
99
+ }
100
+
101
+ public function enqueue_libraries() {
102
+ $widgets_map = Widgets_Manager::get_widgets_map();
103
+ $base_widget = isset( $widgets_map[ Widgets_Manager::get_base_widget_key() ] ) ? $widgets_map[ Widgets_Manager::get_base_widget_key() ] : [];
104
+
105
+ if ( isset( $base_widget['vendor'], $base_widget['vendor']['css'] ) && is_array( $base_widget['vendor']['css'] ) ) {
106
+ foreach ( $base_widget['vendor']['css'] as $vendor_css_handle ) {
107
+ wp_enqueue_style( $vendor_css_handle );
108
+ }
109
+ }
110
+
111
+ if ( isset( $base_widget['vendor'], $base_widget['vendor']['js'] ) && is_array( $base_widget['vendor']['js'] ) ) {
112
+ foreach ( $base_widget['vendor']['js'] as $vendor_js_handle ) {
113
+ wp_enqueue_script( $vendor_js_handle );
114
+ }
115
+ }
116
+
117
+ /**
118
+ * Return early if there's no widget cache
119
+ */
120
+ $widgets = $this->get_widgets_cache()->get();
121
+
122
+ if ( empty( $widgets ) || ! is_array( $widgets ) ) {
123
+ return;
124
+ }
125
+
126
+ foreach ( $widgets as $widget_key ) {
127
+ if ( ! isset( $widgets_map[ $widget_key ], $widgets_map[ $widget_key ]['vendor'] ) ) {
128
+ continue;
129
+ }
130
+
131
+ $vendor = $widgets_map[ $widget_key ]['vendor'];
132
+
133
+ if ( isset( $vendor['css'] ) && is_array( $vendor['css'] ) ) {
134
+ foreach ( $vendor['css'] as $vendor_css_handle ) {
135
+ wp_enqueue_style( $vendor_css_handle );
136
+ }
137
+ }
138
+
139
+ if ( isset( $vendor['js'] ) && is_array( $vendor['js'] ) ) {
140
+ foreach ( $vendor['js'] as $vendor_js_handle ) {
141
+ wp_enqueue_script( $vendor_js_handle );
142
+ }
143
+ }
144
+ }
145
+ }
146
+
147
+ public function save() {
148
+ $widgets = $this->get_widgets_cache()->get();
149
+
150
+ if ( empty( $widgets ) ) {
151
+ return;
152
+ }
153
+
154
+ $widgets_map = Widgets_Manager::get_widgets_map();
155
+ $base_widget = isset( $widgets_map[ Widgets_Manager::get_base_widget_key() ] ) ? $widgets_map[ Widgets_Manager::get_base_widget_key() ] : [];
156
+ $styles = '';
157
+
158
+ // Get common css styles
159
+ if ( isset( $base_widget['css'] ) && is_array( $base_widget['css'] ) ) {
160
+ $styles = $this->get_styles( $base_widget['css'] );
161
+ }
162
+
163
+ $cached_widgets = [];
164
+ foreach ( $widgets as $widget_key ) {
165
+ if ( isset( $cached_widgets[ $widget_key ] ) ||
166
+ ! isset( $widgets_map[ $widget_key ], $widgets_map[ $widget_key ]['css'] )
167
+ ) {
168
+ continue;
169
+ }
170
+ $is_pro = ( isset( $widgets_map[ $widget_key ]['is_pro'] ) && $widgets_map[ $widget_key ]['is_pro'] );
171
+ $styles .= $this->get_styles( $widgets_map[ $widget_key ]['css'], $is_pro );
172
+ $cached_widgets[ $widget_key ] = true;
173
+ }
174
+ $styles .= sprintf( '/** Compiled CSS for: %s **/', implode(', ', array_keys( $cached_widgets ) ) );
175
+
176
+ if ( ! is_dir( $this->get_cache_dir() ) ) {
177
+ @mkdir( $this->get_cache_dir(), 0755, true );
178
+ }
179
+
180
+ file_put_contents( $this->get_file_name(), $styles );
181
+ }
182
+
183
+ protected function get_styles( $files_name, $is_pro = false ) {
184
+ $styles = '';
185
+ foreach ( $files_name as $file_name ) {
186
+ $file_path = HAPPY_ADDONS_DIR_PATH . "assets/css/widgets/{$file_name}.min.css";
187
+ $file_path = apply_filters( 'happyaddons_get_styles_file_path', $file_path, $file_name, $is_pro );
188
+ if ( is_readable( $file_path ) ) {
189
+ $styles .= file_get_contents( $file_path );
190
+ };
191
+ }
192
+ return $styles;
193
+ }
194
  }
classes/cache-manager.php CHANGED
@@ -7,124 +7,119 @@ 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_happy_mode_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
- self::$widgets_cache = new Widgets_Cache( $post_id );
61
-
62
- if ( ! self::$widgets_cache->has() ) {
63
- return false;
64
- }
65
-
66
- return true;
67
- }
68
-
69
- public static function enqueue_fa5_fonts( $post_id ) {
70
- $post_css = new Post_CSS( $post_id );
71
- $meta = $post_css->get_meta();
72
- if ( ! empty( $meta['icons'] ) ) {
73
- $icons_types = \Elementor\Icons_Manager::get_icon_manager_tabs();
74
- foreach ( $meta['icons'] as $icon_font ) {
75
- if ( ! isset( $icons_types[ $icon_font ] ) ) {
76
- continue;
77
- }
78
- ha_elementor()->frontend->enqueue_font( $icon_font );
79
- }
80
- }
81
- }
82
-
83
- public static function enqueue( $post_id ) {
84
- $assets_cache = new Assets_Cache( $post_id, self::$widgets_cache );
85
- $assets_cache->enqueue_libraries();
86
- $assets_cache->enqueue();
87
- self::enqueue_fa5_fonts( $post_id );
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_without_cache() {
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
  }
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_happy_mode_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
  }
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.8.0
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.8.0' );
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.8.1
7
  * Author: weDevs
8
  * Author URI: https://happyaddons.com/
9
  * License: GPLv2
34
 
35
  defined( 'ABSPATH' ) || die();
36
 
37
+ define( 'HAPPY_ADDONS_VERSION', '2.8.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__ ) );
readme.txt CHANGED
@@ -1,6 +1,6 @@
1
  === Happy Elementor Addons ===
2
  Plugin Name: Happy Elementor Addons
3
- Version: 2.8.0
4
  Author: weDevs
5
  Author URI: https://happyaddons.com/
6
  Contributors: thehappymonster, happyaddons, hasinhayder, mosaddek73, tareq1988, sourav926, wedevs, iqbalrony, mrokon, obiplabon
@@ -278,6 +278,12 @@ It's really easy and super simple to install **Happy Elementor Addons** plugin b
278
 
279
  == Changelog ==
280
 
 
 
 
 
 
 
281
  = 2.8.0 - 1 April 2020 =
282
 
283
  - New: Post Tab widget
1
  === Happy Elementor Addons ===
2
  Plugin Name: Happy Elementor Addons
3
+ Version: 2.8.1
4
  Author: weDevs
5
  Author URI: https://happyaddons.com/
6
  Contributors: thehappymonster, happyaddons, hasinhayder, mosaddek73, tareq1988, sourav926, wedevs, iqbalrony, mrokon, obiplabon
278
 
279
  == Changelog ==
280
 
281
+ = 2.8.1 - 5 April 2020 =
282
+
283
+ - Tweak: Adminbar actions terms updated to more meaningful terms
284
+ - Fix: Floating effect not working on frontend
285
+ - Fix: Adminbar HappyAddons icon position
286
+
287
  = 2.8.0 - 1 April 2020 =
288
 
289
  - New: Post Tab widget