Photo Gallery by WD – Responsive Photo Gallery - Version 1.8.5

Version Description

  • Added: Check page speed score from Elementor.
  • Fixed: Bug on getting plugin/theme path.
  • Fixed: Bug on illegal string offset.
  • Fixed: Remove unnecessary js from frontend.
Download this release

Release Info

Developer 10web
Plugin Icon 128x128 Photo Gallery by WD – Responsive Photo Gallery
Version 1.8.5
Comparing to
See all releases

Code changes from version 1.8.4 to 1.8.5

booster/AdminBar.php CHANGED
@@ -36,8 +36,14 @@ class TWBAdminBar
36
  echo wp_json_encode(array('html' => $html, 'clearInterval' => $clearInterval, 'changeLogo' => $changeLogo));
37
  die;
38
  } else {
 
 
 
 
 
 
39
 
40
- $this->page_speed_status = $this->get_page_speed_status();
41
  $this->include_style_scripts();
42
  $wp_admin_bar->add_menu(array(
43
  'id' => 'twb_adminbar_info',
@@ -56,35 +62,6 @@ class TWBAdminBar
56
  wp_enqueue_script(TenWebBooster::PREFIX . '-global');
57
  }
58
 
59
- /**
60
- * Get status which return if score counted = 2, not counted = 0, inprogress = 1
61
- *
62
- * @return int
63
- */
64
- public function get_page_speed_status() {
65
- global $post;
66
- if ( empty($post) ) {
67
- return FALSE;
68
- }
69
-
70
- $post_id = $post->ID;
71
- $page_score = get_post_meta( $post_id, 'two_page_speed' );
72
- if ( empty($page_score) ) {
73
- return 'notstarted';
74
- }
75
- $page_score = end($page_score);
76
- if ( isset($page_score['previous_score']) ) {
77
- if ( isset( $page_score['previous_score']['error'] ) && $page_score['previous_score']['error'] == "1" ) {
78
- return 'error';
79
- } elseif ( isset( $page_score['previous_score']['status'] ) && $page_score['previous_score']['status'] == "inprogress" ) {
80
- return 'inprogress';
81
- } elseif( isset( $page_score['previous_score']['status'] ) && $page_score['previous_score']['status'] == "completed" ) {
82
- return 'completed';
83
- }
84
- }
85
- return 'notstarted';
86
- }
87
-
88
  /**
89
  * Admin bar menu.
90
  *
36
  echo wp_json_encode(array('html' => $html, 'clearInterval' => $clearInterval, 'changeLogo' => $changeLogo));
37
  die;
38
  } else {
39
+ global $post;
40
+ if ( !empty($post) ) {
41
+ if ( get_post_status($post->ID) != 'publish' ) {
42
+ return;
43
+ }
44
+ }
45
 
46
+ $this->page_speed_status = TWBLibrary::get_page_speed_status();
47
  $this->include_style_scripts();
48
  $wp_admin_bar->add_menu(array(
49
  'id' => 'twb_adminbar_info',
62
  wp_enqueue_script(TenWebBooster::PREFIX . '-global');
63
  }
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  /**
66
  * Admin bar menu.
67
  *
booster/Elementor.php CHANGED
@@ -5,6 +5,9 @@
5
  */
6
  class TWBElementor {
7
  private $booster;
 
 
 
8
 
9
  function __construct( $booster ) {
10
  $this->booster = $booster;
@@ -18,15 +21,28 @@ class TWBElementor {
18
  * @return void
19
  */
20
  public function scripts_styles() {
 
 
 
 
21
  wp_enqueue_style('twb-open-sans', 'https://fonts.googleapis.com/css?family=Open+Sans:300,400,500,600,700,800&display=swap');
22
- wp_enqueue_style(TenWebBooster::PREFIX . '-global', $this->booster->plugin_url . '/assets/css/global.css', array( 'twb-open-sans' ), TenWebBooster::VERSION);
23
  if ( $this->booster->cta_button['button_color'] || $this->booster->cta_button['text_color'] ) {
24
- wp_add_inline_style(TenWebBooster::PREFIX . '-global', '.twb-custom-button, .twb-custom-button:hover {background-color: ' . $this->booster->cta_button['button_color'] . ' !important; color: ' . $this->booster->cta_button['text_color'] . ' !important;}');
25
  }
 
26
 
27
- wp_enqueue_script(TenWebBooster::PREFIX . '-elementor', $this->booster->plugin_url . '/assets/js/elementor.js', array('jquery'), TenWebBooster::VERSION);
28
- wp_localize_script(TenWebBooster::PREFIX . '-elementor', 'twb', array(
 
 
29
  'title' => $this->booster->cta_button['section_label'],
 
 
 
 
 
 
30
  ));
31
  }
32
 
@@ -36,7 +52,15 @@ class TWBElementor {
36
  * @param \Elementor\Core\DocumentTypes\PageBase $document The PageBase document instance.
37
  */
38
  public function register_document_controls( $document ) {
39
- if ( ! $document instanceof \Elementor\Core\DocumentTypes\PageBase || ! $document::get_property( 'has_elements' ) || !empty($document->get_section_controls('twb_optimize_section')) ) {
 
 
 
 
 
 
 
 
40
  return;
41
  }
42
 
@@ -50,15 +74,23 @@ class TWBElementor {
50
  'tab' => 'twb_optimize',
51
  ]
52
  );
53
-
54
- $content = TWBLibrary::twb_button_template( $this->booster );
55
- $content .= TWBLibrary::dismiss_info_content( $this->booster );
56
  $classname = 'twb_elementor_settings_content twb_optimized';
57
- $label_html = '';
58
- if ( $section_label != '' ) {
59
- $label_html = '<p class="twb_elementor_control_title">' . esc_html($section_label) . '</p>';
 
 
 
 
 
 
 
 
 
 
60
  }
61
-
62
  $document->add_control(
63
  'twb_raw_html',
64
  [
@@ -71,4 +103,138 @@ class TWBElementor {
71
 
72
  $document->end_controls_section();
73
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  }
5
  */
6
  class TWBElementor {
7
  private $booster;
8
+ private $post_published = 0;
9
+ private $post_id = 0;
10
+ private $page_speed_status;
11
 
12
  function __construct( $booster ) {
13
  $this->booster = $booster;
21
  * @return void
22
  */
23
  public function scripts_styles() {
24
+ if ( !$this->post_published ) {
25
+ return;
26
+ }
27
+
28
  wp_enqueue_style('twb-open-sans', 'https://fonts.googleapis.com/css?family=Open+Sans:300,400,500,600,700,800&display=swap');
29
+ wp_enqueue_style('two_speed_dark_css', $this->booster->plugin_url . '/assets/css/elementor_dark.css', array( 'twb-open-sans', 'elementor-editor-dark-mode' ), TenWebBooster::VERSION);
30
  if ( $this->booster->cta_button['button_color'] || $this->booster->cta_button['text_color'] ) {
31
+ wp_add_inline_style(TenWebBooster::PREFIX . '-elementor', '.twb-custom-button, .twb-custom-button:hover {background-color: ' . $this->booster->cta_button['button_color'] . ' !important; color: ' . $this->booster->cta_button['text_color'] . ' !important;}');
32
  }
33
+ wp_enqueue_style(TenWebBooster::PREFIX . '-global', $this->booster->plugin_url . '/assets/css/global.css', array( 'twb-open-sans' ), TenWebBooster::VERSION);
34
 
35
+ $required_scripts = array( 'jquery' );
36
+ wp_enqueue_script(TenWebBooster::PREFIX . '-circle', $this->booster->plugin_url . '/assets/js/circle-progress.js', $required_scripts, '1.2.2');
37
+ wp_enqueue_script(TenWebBooster::PREFIX . '-global', $this->booster->plugin_url . '/assets/js/global.js', array('jquery'), TenWebBooster::VERSION);
38
+ wp_localize_script(TenWebBooster::PREFIX . '-global', 'twb', array(
39
  'title' => $this->booster->cta_button['section_label'],
40
+ 'nonce' => wp_create_nonce('twb_nonce'),
41
+ 'ajax_url' => admin_url('admin-ajax.php'),
42
+ 'plugin_url' => $this->booster->plugin_url,
43
+ 'href' => $this->booster->submenu_url,
44
+ 'checking' => __('Checking...', 'twb-hidden'),
45
+ 'notoptimized' => __('Not optimized', 'twb-hidden'),
46
  ));
47
  }
48
 
52
  * @param \Elementor\Core\DocumentTypes\PageBase $document The PageBase document instance.
53
  */
54
  public function register_document_controls( $document ) {
55
+ global $post;
56
+ if ( !empty($post) ) {
57
+ $this->post_id = $post->ID;
58
+ if ( get_post_status($this->post_id) == 'publish' ) {
59
+ $this->post_published = 1;
60
+ }
61
+ }
62
+
63
+ if ( ! $this->post_published || ! $document instanceof \Elementor\Core\DocumentTypes\PageBase || ! $document::get_property( 'has_elements' ) || !empty($document->get_section_controls('twb_optimize_section')) ) {
64
  return;
65
  }
66
 
74
  'tab' => 'twb_optimize',
75
  ]
76
  );
77
+ $this->page_speed_status = TWBLibrary::get_page_speed_status();
 
 
78
  $classname = 'twb_elementor_settings_content twb_optimized';
79
+ if ( $this->page_speed_status == "completed" ) {
80
+ $content = $this->comleted_content();
81
+ $label_html = '<p class="twb_elementor_control_title twb_not_optimized">' . __('Not optimized', 'tenweb-booster') . '</p>';
82
+ } elseif ( $this->page_speed_status == "notstarted" ) {
83
+ $content = $this->notstarted_content();
84
+ $classname = 'twb_elementor_settings_content twb-optimized';
85
+ $label_html = '<p class="twb_elementor_control_title twb_not_optimized">' . __('PageSpeed Score', 'tenweb-booster') . '</p>';
86
+ } elseif ( $this->page_speed_status == 'error' ) {
87
+ $content = $this->error_content();
88
+ $label_html = '<p class="twb_elementor_control_title twb_not_optimized">' . __('Not optimized', 'tenweb-booster') . '</p>';
89
+ } else {
90
+ $content = $this->inprogress_content();
91
+ $label_html = '<p class="twb_elementor_control_title"><span class="twb_inprogress"></span>' . __('Checking...', 'tenweb-booster') . '</p>';
92
  }
93
+ $content .= TWBLibrary::dismiss_info_content( $this->booster );
94
  $document->add_control(
95
  'twb_raw_html',
96
  [
103
 
104
  $document->end_controls_section();
105
  }
106
+
107
+ /**
108
+ * Content html which score counted.
109
+ *
110
+ * @param bool $hide hide content in case of not counted
111
+ *
112
+ * @return string html content
113
+ */
114
+ public function comleted_content( $hide = 0 ) {
115
+
116
+ if ( !$this->post_id ) {
117
+ return false;
118
+ }
119
+
120
+ $post_id = $this->post_id;
121
+ $page_score = get_post_meta( $post_id, 'two_page_speed' );
122
+
123
+ $score = array(
124
+ 'mobile_score' => 0,
125
+ 'mobile_tti' => 0,
126
+ 'desktop_score' => 0,
127
+ 'desktop_tti' => 0,
128
+ );
129
+
130
+ if ( !empty($page_score) ) {
131
+ $page_score = end($page_score);
132
+ if ( !empty($page_score['previous_score']) && !empty($page_score['previous_score']['mobile_score']) ) {
133
+ $page_score = $page_score['previous_score'];
134
+ $score = array(
135
+ 'mobile_score' => $page_score['mobile_score'],
136
+ 'mobile_tti' => $page_score['mobile_tti'],
137
+ 'desktop_score' => $page_score['desktop_score'],
138
+ 'desktop_tti' => $page_score['desktop_tti'],
139
+ );
140
+ }
141
+ }
142
+
143
+
144
+ $page_title = get_the_title( $post_id );
145
+ $title = sprintf(__('%s page', 'tenweb-booster'), '<i>'.$page_title.'</i>');
146
+ $url = $this->booster->submenu_url;
147
+ ob_start(); ?>
148
+ <script>
149
+ if ( typeof twb_draw_score_circle == 'function') {
150
+ jQuery('.twb-score-circle').each(function () {
151
+ twb_draw_score_circle(this);
152
+ });
153
+ }
154
+ </script>
155
+ <?php
156
+ TWBLibrary::score($score, $url, $post_id, $title, $hide, 40);
157
+ return ob_get_clean();
158
+ }
159
+
160
+ /**
161
+ * Content html which score counted with error.
162
+ *
163
+ * @return string html content
164
+ */
165
+ public function error_content() {
166
+ if ( !$this->post_id ) {
167
+ return false;
168
+ }
169
+
170
+ $post_id = $this->post_id;
171
+ $page_title = get_the_title( $post_id );
172
+ $title = sprintf(__('%s page', 'tenweb-booster'), '<i>'.$page_title.'</i>');
173
+ $url = $this->booster->submenu_url;
174
+
175
+ $score = array(
176
+ 'error' => 1,
177
+ );
178
+
179
+ ob_start();
180
+ TWBLibrary::score($score, $url, $post_id, $title, 0, 40);
181
+ return ob_get_clean();
182
+ }
183
+
184
+ /**
185
+ * Content html which score not counted and started.
186
+ *
187
+ * @return string html content
188
+ */
189
+ public function notstarted_content() {
190
+ if ( !$this->post_id ) {
191
+ return false;
192
+ }
193
+
194
+ $post_id = $this->post_id;
195
+ ob_start();
196
+ ?>
197
+ <div class="twb-notoptimized">
198
+ <p class="twb_status_description"><?php _e('PageSpeed score is an essential attribute to your website’s performance. It affects both the user experience and SEO rankings.', 'tenweb-booster') ?></p>
199
+ <div class="twb_check_score_button_cont">
200
+ <a onclick="twb_check_score(this)" data-post_id="<?php echo esc_attr($post_id); ?>"
201
+ data-initiator="admin-bar" target="_blank"
202
+ class="twb_check_score_button"><?php _e('Check PageSpeed Score', 'tenweb-booster') ?></a>
203
+ </div>
204
+ </div>
205
+ <div class="twb-optimized twb-hidden">
206
+ <?php
207
+ echo $this->comleted_content();
208
+ ?>
209
+ </div>
210
+ <div class="twb-optimizing twb-hidden">
211
+ <?php
212
+ echo $this->inprogress_content();
213
+ ?>
214
+ </div>
215
+ <?php
216
+ return ob_get_clean();
217
+ }
218
+
219
+ /**
220
+ * Content html which score in progress.
221
+ *
222
+ * @return string html content
223
+ */
224
+ public function inprogress_content() {
225
+ if ( !$this->post_id ) {
226
+ return false;
227
+ }
228
+
229
+ $post_id = $this->post_id;
230
+ $page_title = get_the_title( $post_id );
231
+ ob_start();
232
+ ?>
233
+ <div class="twb_admin_bar_menu_content twb-optimizing <?php echo $this->page_speed_status == 'notstarted' ? 'twb-hidden' : ''; ?>">
234
+ <p class="twb_status_description"><?php echo sprintf(__('We are checking the PageSpeed score of your %s page.', 'tenweb-booster'), '<i>'.esc_html($page_title).'</i>'); ?></p>
235
+ </div>
236
+ <?php
237
+ return ob_get_clean();
238
+ }
239
+
240
  }
booster/README.md DELETED
@@ -1,2 +0,0 @@
1
- # Booster Sdk
2
-
 
 
booster/TWBLibrary.php CHANGED
@@ -96,7 +96,7 @@ class TWBLibrary {
96
  }
97
 
98
  $desktop_score = TWBLibrary::google_check_score($url, 'desktop');
99
- // $desktop_score = array('desktop_score' => 75, 'desktop_tti' => '1.1');
100
  // $desktop_score = array('error' => 1);
101
  $score = $desktop_score;
102
  $mobile_score = TWBLibrary::google_check_score($url, 'mobile');
@@ -167,11 +167,12 @@ class TWBLibrary {
167
  * @param $url
168
  * @param $post_id
169
  * @param $title
170
- * @param $hidden
 
171
  *
172
  * @return void
173
  */
174
- public static function score( $score, $url = '', $post_id = 0, $title = '', $hidden = 1 ) {
175
  $error = empty($score['error']) ? 0 : 1;
176
  if (empty($score) || $error) {
177
  $score = array(
@@ -186,13 +187,13 @@ class TWBLibrary {
186
  $title = ($title != '') ? 'of ' . $title : '';
187
  ?>
188
  <div class="twb-score-container <?php echo $hidden ? 'twb-hidden' : '' ?>" data-id="<?php echo esc_attr($post_id); ?>">
189
- <div class="twb-score-title"><?php echo sprintf(__('PageSpeed score %s', 'tenweb-booster'), esc_html($title)); ?></div>
190
  <div class="twb-score">
191
  <div class="twb-score-mobile">
192
  <div class="twb-score-circle"
193
  data-id="mobile"
194
  data-thickness="2"
195
- data-size="30"
196
  data-score="<?php echo esc_attr($score['mobile_score']); ?>"
197
  data-tti="<?php echo esc_attr($score['mobile_tti']); ?>">
198
  <span class="twb-score-circle-animated"></span>
@@ -204,13 +205,13 @@ class TWBLibrary {
204
  </div>
205
  </div>
206
  <div class="twb-score-mobile twb-score-mobile-overlay twb-score-overlay <?php echo esc_html($error ? '' : 'twb-hidden'); ?>">
207
- <div class="twb-reload" data-post_id="<?php echo $post_id; ?>"></div>
208
  </div>
209
  <div class="twb-score-desktop">
210
  <div class="twb-score-circle"
211
  data-id="desktop"
212
  data-thickness="2"
213
- data-size="30"
214
  data-score="<?php echo esc_attr($score['desktop_score']); ?>"
215
  data-tti="<?php echo esc_attr($score['desktop_tti']); ?>">
216
  <span class="twb-score-circle-animated"></span>
@@ -222,7 +223,7 @@ class TWBLibrary {
222
  </div>
223
  </div>
224
  <div class="twb-score-desktop twb-score-desktop-overlay twb-score-overlay <?php echo esc_html($error ? '' : 'twb-hidden'); ?>">
225
- <div class="twb-reload" data-post_id="<?php echo $post_id; ?>"></div>
226
  </div>
227
  </div>
228
  <?php
@@ -246,4 +247,33 @@ class TWBLibrary {
246
  <?php
247
  return ob_get_clean();
248
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
249
  }
 
 
96
  }
97
 
98
  $desktop_score = TWBLibrary::google_check_score($url, 'desktop');
99
+ //$desktop_score = array('desktop_score' => 75, 'desktop_tti' => '1.1');
100
  // $desktop_score = array('error' => 1);
101
  $score = $desktop_score;
102
  $mobile_score = TWBLibrary::google_check_score($url, 'mobile');
167
  * @param $url
168
  * @param $post_id
169
  * @param $title
170
+ * @param $hidden bool need to hidden class or no
171
+ * @param $size int size of circle in speed score
172
  *
173
  * @return void
174
  */
175
+ public static function score( $score, $url = '', $post_id = 0, $title = '', $hidden = 1, $size = 30 ) {
176
  $error = empty($score['error']) ? 0 : 1;
177
  if (empty($score) || $error) {
178
  $score = array(
187
  $title = ($title != '') ? 'of ' . $title : '';
188
  ?>
189
  <div class="twb-score-container <?php echo $hidden ? 'twb-hidden' : '' ?>" data-id="<?php echo esc_attr($post_id); ?>">
190
+ <div class="twb-score-title"><?php echo sprintf(__('PageSpeed score %s', 'tenweb-booster'), strip_tags($title, "<i>")); ?></div>
191
  <div class="twb-score">
192
  <div class="twb-score-mobile">
193
  <div class="twb-score-circle"
194
  data-id="mobile"
195
  data-thickness="2"
196
+ data-size="<?php echo esc_attr($size); ?>"
197
  data-score="<?php echo esc_attr($score['mobile_score']); ?>"
198
  data-tti="<?php echo esc_attr($score['mobile_tti']); ?>">
199
  <span class="twb-score-circle-animated"></span>
205
  </div>
206
  </div>
207
  <div class="twb-score-mobile twb-score-mobile-overlay twb-score-overlay <?php echo esc_html($error ? '' : 'twb-hidden'); ?>">
208
+ <div class="twb-reload" onclick="twb_check_score(this)" data-post_id="<?php echo $post_id; ?>"></div>
209
  </div>
210
  <div class="twb-score-desktop">
211
  <div class="twb-score-circle"
212
  data-id="desktop"
213
  data-thickness="2"
214
+ data-size="<?php echo esc_attr($size); ?>"
215
  data-score="<?php echo esc_attr($score['desktop_score']); ?>"
216
  data-tti="<?php echo esc_attr($score['desktop_tti']); ?>">
217
  <span class="twb-score-circle-animated"></span>
223
  </div>
224
  </div>
225
  <div class="twb-score-desktop twb-score-desktop-overlay twb-score-overlay <?php echo esc_html($error ? '' : 'twb-hidden'); ?>">
226
+ <div class="twb-reload" onclick="twb_check_score(this)" data-post_id="<?php echo $post_id; ?>"></div>
227
  </div>
228
  </div>
229
  <?php
247
  <?php
248
  return ob_get_clean();
249
  }
250
+
251
+ /**
252
+ * Get status which return if score counted = 2, not counted = 0, inprogress = 1
253
+ *
254
+ * @return string
255
+ */
256
+ public static function get_page_speed_status() {
257
+ global $post;
258
+ if ( empty($post) ) {
259
+ return false;
260
+ }
261
+
262
+ $post_id = $post->ID;
263
+ $page_score = get_post_meta( $post_id, 'two_page_speed' );
264
+ $page_score = end($page_score);
265
+
266
+ if ( isset($page_score['previous_score']) ) {
267
+ if ( isset( $page_score['previous_score']['error'] ) && $page_score['previous_score']['error'] == "1" ) {
268
+ return 'error';
269
+ } elseif ( isset( $page_score['previous_score']['status'] ) && $page_score['previous_score']['status'] == "inprogress" ) {
270
+ return 'inprogress';
271
+ } elseif( isset( $page_score['previous_score']['status'] ) && $page_score['previous_score']['status'] == "completed" ) {
272
+ return 'completed';
273
+ }
274
+ }
275
+ return 'notstarted';
276
+ }
277
  }
278
+
279
+
booster/assets/css/elementor.css ADDED
@@ -0,0 +1,246 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .elementor-panel-menu-item-icon .twb-element-menu-icon:before {
2
+ display: block;
3
+ margin: auto;
4
+ width: 26px;
5
+ height: 26px;
6
+ content: " ";
7
+ background: transparent url(../images/logo_dark.svg) 0 0 no-repeat;
8
+ background-size: 26px;
9
+ }
10
+
11
+ .elementor-control-twb_optimize_section .elementor-panel-heading {
12
+ display: none;
13
+ }
14
+
15
+ .elementor-panel .elementor-tab-control-twb_optimize {
16
+ position: relative;
17
+ padding: 0 5px;
18
+ box-sizing: border-box;
19
+ min-width: 80px;
20
+ width: initial;
21
+ }
22
+
23
+ .elementor-panel .elementor-panel-navigation .elementor-panel-navigation-tab.elementor-tab-control-twb_optimize a {
24
+ top: 22px;
25
+ position: absolute;
26
+ left: 50%;
27
+ transform: translateX(-50%);
28
+ font-size: 8px;
29
+ font-weight: 600;
30
+ width: 100%;
31
+ }
32
+
33
+ .elementor-panel .elementor-panel-navigation .elementor-panel-navigation-tab.elementor-tab-control-twb_optimize a:before {
34
+ width: 26px;
35
+ position: absolute;
36
+ top: -17px;
37
+ left: calc(50% - 13px);
38
+ content: " ";
39
+ height: 26px;
40
+ background: transparent url(../images/logo_dark.svg) 0 0 no-repeat;
41
+ background-size: 26px;
42
+ }
43
+
44
+ .elementor-control .twb-score-container,
45
+ .elementor-control .twb-score-disabled-container {
46
+ display: flex;
47
+ flex-direction: column;
48
+ padding: 0;
49
+ background: transparent 0% 0% no-repeat padding-box;
50
+ border: 1px solid #FFFFFF1A;
51
+ border-radius: 6px;
52
+ color: #FFFFFF;
53
+ width: 100%;
54
+ position: relative;
55
+ }
56
+
57
+ .elementor-control .twb-score {
58
+ flex-direction: row;
59
+ display: flex;
60
+ padding: 20px 0 10px 0;
61
+ background-color: #F9F9F9;
62
+ margin: 20px 0 10px 0;
63
+ border-radius: 6px;
64
+ }
65
+
66
+ .elementor-control .twb-score-mobile,
67
+ .elementor-control .twb-score-desktop {
68
+ display: flex;
69
+ flex-direction: column;
70
+ width: 50%;
71
+ padding: 10px;
72
+ background: #FFFFFF0D 0% 0% no-repeat padding-box;
73
+ border-radius: 6px;
74
+ align-items: center;
75
+ margin: 0;
76
+ }
77
+
78
+ .elementor-control .twb-score-circle {
79
+ width: 40px;
80
+ height: 40px;
81
+ position: relative;
82
+ border-radius: 50%;
83
+ margin: 0;
84
+ background: #FD3C311A 0% 0% no-repeat padding-box;
85
+ }
86
+
87
+ .elementor-control .twb-score-text {
88
+ margin: 0;
89
+ text-align: center;
90
+ font-family: Open Sans;
91
+ font-weight: 100;
92
+ }
93
+
94
+ .elementor-control .twb-hidden,
95
+ .elementor-control .twb-score-container.twb-hidden,
96
+ .elementor-control .twb-score-overlay.twb-hidden,
97
+ .elementor-control .twb-score-disabled-container.twb-hidden {
98
+ display: none;
99
+ }
100
+
101
+ .elementor-control .twb-score-title {
102
+ font-size: 12px;
103
+ line-height: 18px;
104
+ font-weight: 400;
105
+ color:#1E1E1E;
106
+ margin-top:2px;
107
+ }
108
+
109
+ .elementor-control .twb-score-text-name {
110
+ display: block;
111
+ font: normal normal bold 10px/16px Open Sans;
112
+ letter-spacing: 0px;
113
+ opacity: 1;
114
+ color:#323A45;
115
+ }
116
+
117
+ .elementor-control .twb-load-text-time {
118
+ display: block;
119
+ font: normal normal 600 10px/16px Open Sans;
120
+ letter-spacing: 0.08px;
121
+ color: #323A45;
122
+ opacity: 0.5;
123
+ }
124
+
125
+ body .twb_elementor_control_title {
126
+ font-size: 12px;
127
+ font-weight: bold;
128
+ line-height: 18px;
129
+ vertical-align: middle;
130
+ display: flex;
131
+ align-items: center;
132
+ margin-bottom: 2px;
133
+ color:#1E1E1E
134
+ }
135
+
136
+ .elementor-control .twb_elementor_control_title.twb_not_optimized {
137
+ background: url(../images/red-info.svg) no-repeat;
138
+ background-size: 16px;
139
+ padding-left: 22px;
140
+ font-size: 12px;
141
+ font-weight: bold;
142
+ line-height: 18px;
143
+ vertical-align: middle;
144
+ display: flex;
145
+ align-items: center;
146
+ margin-bottom: 2px;
147
+ color: #1E1E1E;
148
+ }
149
+
150
+ .elementor-control .twb-score-circle .twb-score-circle-animated {
151
+ position: absolute;
152
+ left: 50%;
153
+ top: 50%;
154
+ -webkit-transform: translate(-50%, -50%);
155
+ -moz-transform: translate(-50%, -50%);
156
+ transform: translate(-50%, -50%);
157
+ text-align: center;
158
+ font: normal normal bold 12px/18px Open Sans;
159
+ letter-spacing: 0px;
160
+ }
161
+
162
+ .elementor-control .twb_elementor_control_title span.twb_inprogress {
163
+ background: transparent url(../images/loader_green.svg) 0 0 no-repeat padding-box;
164
+ animation: rotation 1s infinite linear;
165
+ background-size: 16px;
166
+ margin-right: 6px;
167
+ width: 16px;
168
+ height: 16px;
169
+ display: inline-block;
170
+ }
171
+
172
+ @keyframes rotation {
173
+ from {
174
+ transform: rotate(0deg);
175
+ }
176
+ to {
177
+ transform: rotate(359deg);
178
+ }
179
+ }
180
+
181
+ .elementor-control .twb-score-bottom {
182
+ text-align: right;
183
+ }
184
+
185
+ .elementor-control .twb-score-bottom a,
186
+ .elementor-control .twb-score-bottom a:hover {
187
+ text-decoration: underline;
188
+ font-size: 12px;
189
+ line-height: 18px;
190
+ color: #22B339;
191
+ font-weight: 600;
192
+ cursor: pointer;
193
+ border: none;
194
+ }
195
+
196
+ .elementor-control .twb_check_score_button {
197
+ width: 180px;
198
+ height: 30px;
199
+ line-height: 30px;
200
+ box-sizing: border-box;
201
+ text-decoration: none;
202
+ background-color: #22B339;
203
+ color: #FFFFFF;
204
+ border-radius: 4px;
205
+ text-align: center;
206
+ margin-top: 20px;
207
+ float: right;
208
+ cursor: pointer;
209
+ }
210
+
211
+ .elementor-control .twb_status_description {
212
+ padding-left: 21px;
213
+ font-size: 12px;
214
+ line-height: 18px;
215
+ }
216
+
217
+ .elementor-control .twb-score-overlay {
218
+ width:47%;
219
+ height: 80px;
220
+ z-index: 10;
221
+ position: absolute;
222
+ background-color: #2E3338 !important;
223
+ align-items: center;
224
+ justify-content: center;
225
+ }
226
+
227
+ .elementor-control .twb-score-desktop-overlay {
228
+ right: 2%;
229
+ }
230
+ .elementor-control .twb-score-mobile-overlay {
231
+ left: 2%;
232
+ }
233
+
234
+ .elementor-control .twb-loader {
235
+ background: transparent url(../images/loader.svg) 0% 0% no-repeat padding-box;
236
+ animation: rotation 1s infinite linear;
237
+ width: 14px;
238
+ height: 14px;
239
+ }
240
+
241
+ .elementor-control .twb-reload {
242
+ background: transparent url(../images/reload.svg) 0% 0% no-repeat padding-box;
243
+ width: 28px;
244
+ height: 28px;
245
+ cursor: pointer;
246
+ }
booster/assets/css/elementor_dark.css ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .elementor-control .twb_elementor_control_title.twb_not_optimized,
2
+ .elementor-control .twb-score-title,
3
+ body .twb_elementor_control_title,
4
+ .elementor-panel .twb-dismiss-info p,
5
+ .elementor-panel .twb-dismiss-info a {
6
+ color: #FFFFFF;
7
+ }
8
+
9
+ .elementor-control .twb-score-container,
10
+ .elementor-control .twb-score-disabled-container {
11
+ border: none;
12
+ }
booster/assets/css/global.css CHANGED
@@ -16,8 +16,6 @@
16
 
17
  a.twb-custom-button,
18
  a.twb-custom-button:hover,
19
- .elementor-control a.twb-custom-button,
20
- .elementor-control a.twb-custom-button:hover,
21
  #wp-admin-bar-booster-top-button .ab-item,
22
  #wp-admin-bar-booster-top-button .ab-item:hover{
23
  margin: 3px 0 0 10px !important;
@@ -36,8 +34,6 @@ a.twb-custom-button:hover,
36
  .twb-green-button,
37
  .twb-green-button:hover,
38
  .twb-green-button:focus,
39
- .elementor-control a.twb-green-button,
40
- .elementor-control a.twb-green-button:hover,
41
  #wp-admin-bar-booster-top-button .ab-item,
42
  #wp-admin-bar-booster-top-button .ab-item:hover,
43
  #wp-admin-bar-booster-top-button .ab-item:focus,
@@ -100,6 +96,160 @@ a.twb-custom-button:hover,
100
  width: 100%;
101
  }
102
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  .elementor-panel .elementor-tab-control-twb_optimize a:before {
104
  width: 26px;
105
  position: absolute;
@@ -122,7 +272,8 @@ a.twb-custom-button:hover,
122
  }
123
 
124
  .elementor-panel .twb-dismiss-info {
125
- justify-content: left;
 
126
  opacity: 0.7;
127
  }
128
 
@@ -621,7 +772,8 @@ a.twb-see-score {
621
  font: italic normal bold 12px/18px Open Sans;
622
  }
623
 
624
- #wpadminbar .twb_admin_bar_menu_content .twb_check_score_button_cont {
 
625
  display: flex;
626
  justify-content: right;
627
  margin-bottom: 15px;
16
 
17
  a.twb-custom-button,
18
  a.twb-custom-button:hover,
 
 
19
  #wp-admin-bar-booster-top-button .ab-item,
20
  #wp-admin-bar-booster-top-button .ab-item:hover{
21
  margin: 3px 0 0 10px !important;
34
  .twb-green-button,
35
  .twb-green-button:hover,
36
  .twb-green-button:focus,
 
 
37
  #wp-admin-bar-booster-top-button .ab-item,
38
  #wp-admin-bar-booster-top-button .ab-item:hover,
39
  #wp-admin-bar-booster-top-button .ab-item:focus,
96
  width: 100%;
97
  }
98
 
99
+ .elementor-control .twb-score-container,
100
+ .elementor-control .twb-score-disabled-container {
101
+ display: flex;
102
+ flex-direction: column;
103
+ padding: 0;
104
+ background: transparent 0% 0% no-repeat padding-box;
105
+ border: none;
106
+ color: #FFFFFF;
107
+ width: 100%;
108
+ position: relative;
109
+ }
110
+
111
+ .elementor-control .twb_elementor_control_title.twb_not_optimized {
112
+ background: url(../images/red-info.svg) no-repeat;
113
+ background-size: 16px;
114
+ padding-left: 22px;
115
+ font-size: 12px;
116
+ font-weight: bold;
117
+ line-height: 18px;
118
+ vertical-align: middle;
119
+ display: flex;
120
+ align-items: center;
121
+ margin-bottom: 2px;
122
+ color: #1E1E1E;
123
+ }
124
+
125
+ .elementor-control .twb-score-title {
126
+ font-size: 12px;
127
+ line-height: 18px;
128
+ font-weight: 400;
129
+ color: #1E1E1E;
130
+ margin-top: 2px;
131
+ }
132
+
133
+ .elementor-control .twb-score {
134
+ flex-direction: row;
135
+ display: flex;
136
+ padding: 20px 0 10px 0;
137
+ background-color: #F9F9F9;
138
+ margin: 20px 0 10px 0;
139
+ border-radius: 6px;
140
+ }
141
+
142
+ .elementor-control .twb-score-mobile,
143
+ .elementor-control .twb-score-desktop {
144
+ display: flex;
145
+ flex-direction: column;
146
+ width: 50%;
147
+ padding: 10px;
148
+ background: #FFFFFF0D 0% 0% no-repeat padding-box;
149
+ border-radius: 6px;
150
+ align-items: center;
151
+ margin: 0;
152
+ }
153
+
154
+ .elementor-control .twb-score-circle {
155
+ width: 40px;
156
+ height: 40px;
157
+ position: relative;
158
+ border-radius: 50%;
159
+ margin: 0;
160
+ background: #FD3C311A 0% 0% no-repeat padding-box;
161
+ }
162
+
163
+ .elementor-control .twb-score-text {
164
+ margin: 0;
165
+ text-align: center;
166
+ font-family: Open Sans;
167
+ font-weight: 100;
168
+ }
169
+
170
+ .elementor-control .twb-score-text-name {
171
+ display: block;
172
+ font: normal normal bold 10px/16px Open Sans;
173
+ letter-spacing: 0px;
174
+ opacity: 1;
175
+ color: #323A45;
176
+ }
177
+
178
+ .elementor-control .twb-load-text-time {
179
+ display: block;
180
+ font: normal normal 600 10px/16px Open Sans;
181
+ letter-spacing: 0.08px;
182
+ color: #323A45;
183
+ opacity: 0.5;
184
+ }
185
+
186
+ .elementor-control .twb_check_score_button {
187
+ width: 180px;
188
+ height: 30px;
189
+ line-height: 30px;
190
+ box-sizing: border-box;
191
+ text-decoration: none;
192
+ background-color: #22B339;
193
+ color: #FFFFFF;
194
+ border-radius: 4px;
195
+ text-align: center;
196
+ margin-top: 20px;
197
+ float: right;
198
+ cursor: pointer;
199
+ }
200
+
201
+ .elementor-control .twb_status_description {
202
+ padding-left: 21px;
203
+ font-size: 12px;
204
+ line-height: 18px;
205
+ }
206
+
207
+ .elementor-control .twb_elementor_control_title span.twb_inprogress {
208
+ background: transparent url(../images/loader_green.svg) 0 0 no-repeat padding-box;
209
+ animation: rotation 1s infinite linear;
210
+ background-size: 16px;
211
+ margin-right: 6px;
212
+ width: 16px;
213
+ height: 16px;
214
+ display: inline-block;
215
+ }
216
+
217
+ @keyframes rotation {
218
+ from {
219
+ transform: rotate(0deg);
220
+ }
221
+ to {
222
+ transform: rotate(359deg);
223
+ }
224
+ }
225
+
226
+ .elementor-control .twb-score-overlay {
227
+ width:47%;
228
+ height: 80px;
229
+ z-index: 10;
230
+ position: absolute;
231
+ background-color: #2E3338 !important;
232
+ align-items: center;
233
+ justify-content: center;
234
+ }
235
+
236
+ .elementor-control .twb-score-desktop-overlay {
237
+ right: 2%;
238
+ }
239
+ .elementor-control .twb-score-mobile-overlay {
240
+ left: 2%;
241
+ }
242
+
243
+ .elementor-control .twb-score-bottom a, .elementor-control .twb-score-bottom a:hover {
244
+ text-decoration: underline;
245
+ font-size: 12px;
246
+ line-height: 18px;
247
+ color: #22B339;
248
+ font-weight: 600;
249
+ cursor: pointer;
250
+ border: none;
251
+ }
252
+
253
  .elementor-panel .elementor-tab-control-twb_optimize a:before {
254
  width: 26px;
255
  position: absolute;
272
  }
273
 
274
  .elementor-panel .twb-dismiss-info {
275
+ justify-content: right;
276
+ margin-top: 15px;
277
  opacity: 0.7;
278
  }
279
 
772
  font: italic normal bold 12px/18px Open Sans;
773
  }
774
 
775
+ #wpadminbar .twb_admin_bar_menu_content .twb_check_score_button_cont,
776
+ .elementor-control .twb_check_score_button_cont{
777
  display: flex;
778
  justify-content: right;
779
  margin-bottom: 15px;
booster/assets/js/elementor.js DELETED
@@ -1,22 +0,0 @@
1
- /* Adding button in Elementor edit panel navigation view */
2
- function twb_add_elementor_button() {
3
- window.elementor.modules.layouts.panel.pages.menu.Menu.addItem({
4
- name: twb.title,
5
- icon: "twb-element-menu-icon",
6
- title: twb.title,
7
- type: "page",
8
- callback: () => {
9
- try {
10
- window.$e.route("panel/page-settings/twb_optimize")
11
- } catch (e) {
12
- window.$e.route("panel/page-settings/settings"), window.$e.route("panel/page-settings/twb_optimize")
13
- }
14
- }
15
- }, "more")
16
- }
17
-
18
- jQuery(window).on("elementor:init", () => {
19
- window.elementor.on("panel:init", () => {
20
- setTimeout(twb_add_elementor_button)
21
- })
22
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
booster/assets/js/global.js CHANGED
@@ -29,10 +29,6 @@ jQuery(function () {
29
  twb_check_score(this);
30
  }
31
  });
32
- /* Add check score action to the reload buttons.*/
33
- jQuery(".twb-reload").on("click", function () {
34
- twb_check_score(this);
35
- });
36
 
37
  /* Add a hover action to show dismiss tooltip.*/
38
  jQuery("th[id^='twb-speed-']").hover(function () {
@@ -126,7 +122,7 @@ function twb_disable_check() {
126
  */
127
  function twb_check_score(that) {
128
  var post_id = jQuery(that).data("post_id");
129
- var parent = jQuery(that).parent().parent();
130
  //var parent = jQuery(that).closest(".twb-score-container").parent();
131
  /* Class add loading near admin bar menu */
132
  jQuery(".twb_admin_bar_menu.twb_frontend").addClass("twb_score_inprogress");
@@ -144,6 +140,11 @@ function twb_check_score(that) {
144
 
145
  parent.find(".twb-notoptimized").addClass("twb-hidden");
146
 
 
 
 
 
 
147
  /* Disable score check button.*/
148
  twb_disable_check();
149
 
@@ -201,6 +202,11 @@ function twb_check_score(that) {
201
  jQuery(".twb-notoptimized").hover(function () {
202
  jQuery(this).parent().find(".twb-score-disabled-container").addClass("twb-hidden");
203
  });
 
 
 
 
 
204
  }
205
  });
206
  }
@@ -234,4 +240,27 @@ function twb_draw_score_circle(that) {
234
  jQuery(that).find('.twb-score-circle-animated').html(content).css({"color": color});
235
  jQuery(that).find('canvas').html(Math.round(score * progress));
236
  });
237
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  twb_check_score(this);
30
  }
31
  });
 
 
 
 
32
 
33
  /* Add a hover action to show dismiss tooltip.*/
34
  jQuery("th[id^='twb-speed-']").hover(function () {
122
  */
123
  function twb_check_score(that) {
124
  var post_id = jQuery(that).data("post_id");
125
+ var parent = jQuery(that).parent().parent().parent();
126
  //var parent = jQuery(that).closest(".twb-score-container").parent();
127
  /* Class add loading near admin bar menu */
128
  jQuery(".twb_admin_bar_menu.twb_frontend").addClass("twb_score_inprogress");
140
 
141
  parent.find(".twb-notoptimized").addClass("twb-hidden");
142
 
143
+ /* In case of Elementor */
144
+ if( parent.hasClass("twb_elementor_settings_content") ) {
145
+ jQuery(".twb_elementor_control_title").text(twb.checking).removeClass("twb_not_optimized").prepend("<span class='twb_inprogress'></span>");
146
+ }
147
+
148
  /* Disable score check button.*/
149
  twb_disable_check();
150
 
202
  jQuery(".twb-notoptimized").hover(function () {
203
  jQuery(this).parent().find(".twb-score-disabled-container").addClass("twb-hidden");
204
  });
205
+
206
+ /* In case of Elementor */
207
+ if( parent.hasClass("twb_elementor_settings_content") ) {
208
+ jQuery(".twb_elementor_control_title").text(twb.notoptimized).remove("span.twb_inprogress").addClass("twb_not_optimized");
209
+ }
210
  }
211
  });
212
  }
240
  jQuery(that).find('.twb-score-circle-animated').html(content).css({"color": color});
241
  jQuery(that).find('canvas').html(Math.round(score * progress));
242
  });
243
+ }
244
+
245
+ /* Adding button in Elementor edit panel navigation view */
246
+ function twb_add_elementor_button() {
247
+ window.elementor.modules.layouts.panel.pages.menu.Menu.addItem({
248
+ name: twb.title,
249
+ icon: "twb-element-menu-icon",
250
+ title: twb.title,
251
+ type: "page",
252
+ callback: () => {
253
+ try {
254
+ window.$e.route("panel/page-settings/twb_optimize")
255
+ } catch (e) {
256
+ window.$e.route("panel/page-settings/settings"), window.$e.route("panel/page-settings/twb_optimize")
257
+ }
258
+ }
259
+ }, "more")
260
+ }
261
+
262
+ jQuery(window).on("elementor:init", () => {
263
+ window.elementor.on("panel:init", () => {
264
+ setTimeout(twb_add_elementor_button)
265
+ })
266
+ });
booster/assets/js/speed.js CHANGED
@@ -146,7 +146,8 @@ function twb_install_plugin( that ) {
146
  speed_ajax_nonce: twb.speed_ajax_nonce
147
  },
148
  success: function ( data ) {
149
- jQuery(".twb-speed-header").html(data).find(".wrap").remove();;
 
150
  }
151
  });
152
  }
@@ -350,7 +351,7 @@ function twb_get_google_score( that, url, last_api_key_index ) {
350
  var data = JSON.parse(result);
351
  if ( data['error'] === 1 ) {
352
  if ( typeof data['last_api_key_index'] !== 'undefined' ) {
353
- twb_get_google_score(that, home_url, data['last_api_key_index'] );
354
  return;
355
  }
356
  var msg = '';
146
  speed_ajax_nonce: twb.speed_ajax_nonce
147
  },
148
  success: function ( data ) {
149
+ jQuery(".twb-speed-header").html(data).find(".wrap").remove();
150
+ jQuery(".twb-speed-footer").remove();
151
  }
152
  });
153
  }
351
  var data = JSON.parse(result);
352
  if ( data['error'] === 1 ) {
353
  if ( typeof data['last_api_key_index'] !== 'undefined' ) {
354
+ twb_get_google_score(that, twb.home_url, data['last_api_key_index'] );
355
  return;
356
  }
357
  var msg = '';
booster/controller.php CHANGED
@@ -154,10 +154,14 @@ class BoosterController {
154
 
155
  $pages_compressed_api = $data['pages_compressed'];
156
 
157
- $twb_optimized_pages = \TenWebOptimizer\OptimizerUtils::getCriticalPages();
 
 
 
158
 
159
  $total_compressed_images = 0;
160
  $i = 0;
 
161
  /* Adding new pages which are optimized but haven't images and endpoint doesn't have that pages in response */
162
  foreach ( $twb_optimized_pages as $page_id => $val ) {
163
  /* Permalink text for front_page should be Homepage */
@@ -215,7 +219,6 @@ class BoosterController {
215
  * @return array
216
  */
217
  public function get_pages_compressed( $params ) {
218
-
219
  $return_data = array(
220
  'pages' => array(),
221
  'total_compressed_images' => 0,
@@ -353,7 +356,18 @@ class BoosterController {
353
  $params['booster_plugin_status'] = $this->booster->booster_plugin_status;
354
  $params['status'] = $this->booster->status;
355
  $params['is_plugin'] = $this->booster->is_plugin;
 
 
 
 
 
 
 
356
  $params['submenu_parent_slug'] = $this->booster->submenu['parent_slug'];
 
 
 
 
357
  $this->view->header($params);
358
  die;
359
  }
@@ -368,7 +382,7 @@ class BoosterController {
368
  private function install_plugin() {
369
  $activated = FALSE;
370
  if ( $this->booster->booster_plugin_status == 0 ) {
371
- include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
372
  wp_cache_flush();
373
  $upgrader = new Plugin_Upgrader();
374
  $installed = $upgrader->install(self::PLUGIN_ZIP);
@@ -505,7 +519,7 @@ class BoosterController {
505
  public function get_google_page_speed() {
506
  $last_api_key_index = isset($_POST['last_api_key_index']) ? sanitize_text_field($_POST['last_api_key_index']) : '';
507
 
508
- $url = isset($_POST['twb_url']) ? sanitize_url($_POST['twb_url']) : '';;
509
 
510
  /* Check if url hasn't http or https add */
511
  if ( strpos($url, 'http') !== 0 ){
154
 
155
  $pages_compressed_api = $data['pages_compressed'];
156
 
157
+ $twb_optimized_pages = array();
158
+ if ( class_exists('\TenWebOptimizer\OptimizerUtils') ) {
159
+ $twb_optimized_pages = \TenWebOptimizer\OptimizerUtils::getCriticalPages();
160
+ }
161
 
162
  $total_compressed_images = 0;
163
  $i = 0;
164
+ $pages_compressed = array();
165
  /* Adding new pages which are optimized but haven't images and endpoint doesn't have that pages in response */
166
  foreach ( $twb_optimized_pages as $page_id => $val ) {
167
  /* Permalink text for front_page should be Homepage */
219
  * @return array
220
  */
221
  public function get_pages_compressed( $params ) {
 
222
  $return_data = array(
223
  'pages' => array(),
224
  'total_compressed_images' => 0,
356
  $params['booster_plugin_status'] = $this->booster->booster_plugin_status;
357
  $params['status'] = $this->booster->status;
358
  $params['is_plugin'] = $this->booster->is_plugin;
359
+ $params['tenweb_is_paid'] = $this->booster->is_paid;
360
+ $params['slug'] = $this->booster->slug;
361
+ $domain_id = get_site_option('tenweb_domain_id');
362
+ $params['dashboard_booster_url'] = '';
363
+ if ( defined("TENWEB_DASHBOARD") && !empty($domain_id) ) {
364
+ $params['dashboard_booster_url'] = trim(TENWEB_DASHBOARD, '/') . '/websites/' . $domain_id . '/booster/frontend';
365
+ }
366
  $params['submenu_parent_slug'] = $this->booster->submenu['parent_slug'];
367
+ $params['section_booster_title'] = $this->booster->page['section_booster_title'];
368
+ $params['section_booster_desc'] = $this->booster->page['section_booster_desc'];
369
+ $params['section_booster_success_title'] = $this->booster->page['section_booster_success_title'];
370
+ $params['section_booster_success_desc'] = $this->booster->page['section_booster_success_desc'];
371
  $this->view->header($params);
372
  die;
373
  }
382
  private function install_plugin() {
383
  $activated = FALSE;
384
  if ( $this->booster->booster_plugin_status == 0 ) {
385
+ include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php');
386
  wp_cache_flush();
387
  $upgrader = new Plugin_Upgrader();
388
  $installed = $upgrader->install(self::PLUGIN_ZIP);
519
  public function get_google_page_speed() {
520
  $last_api_key_index = isset($_POST['last_api_key_index']) ? sanitize_text_field($_POST['last_api_key_index']) : '';
521
 
522
+ $url = isset($_POST['twb_url']) ? sanitize_url($_POST['twb_url']) : '';
523
 
524
  /* Check if url hasn't http or https add */
525
  if ( strpos($url, 'http') !== 0 ){
booster/init.php CHANGED
@@ -4,10 +4,11 @@ add_action('init', function() {
4
  $version = '1.0.0';
5
  if ( !isset($path['version']) || version_compare($path['version'], $version) === -1 ) {
6
  $path['version'] = $version;
7
- if ( strpos(str_replace("/", "\\", plugin_dir_path( __FILE__ )), str_replace("/", "\\", WP_PLUGIN_DIR)) > -1 ) {
 
 
 
8
  $path['path'] = WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__));
9
- } else {
10
- $path['path'] = get_template_directory().'/booster/';
11
  }
12
  }
13
 
@@ -16,24 +17,26 @@ add_action('init', function() {
16
  }, 8);
17
  add_action('init', function() {
18
  if (!class_exists("TenWebBooster")) {
19
- if ( strpos( str_replace("/", "\\", plugin_dir_path( __FILE__ )), str_replace("/", "\\", WP_PLUGIN_DIR) ) > -1 ) {
20
  $plugin_dir = apply_filters('tenweb_booster_sdk', array(
21
  'version' => '1.0.0',
22
- 'path' => WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__)),
23
  ));
24
- } else {
 
25
  $plugin_dir = apply_filters('tenweb_booster_sdk', array(
26
  'version' => '1.0.0',
27
- 'path' => get_template_directory().'/booster/',
28
  ));
29
  }
30
  require_once($plugin_dir['path'] . '/main.php');
31
 
32
  function TWB($params = array()) {
33
  if ( isset($params['is_plugin']) && !$params['is_plugin'] ) {
34
- $plugin_dir = get_template_directory().'/booster';
35
  $plugin_url = get_template_directory_uri() . "/booster";
36
- } else {
 
37
  $plugin_dir = WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__));
38
  $plugin_url = plugins_url(plugin_basename(dirname(__FILE__)));
39
  }
4
  $version = '1.0.0';
5
  if ( !isset($path['version']) || version_compare($path['version'], $version) === -1 ) {
6
  $path['version'] = $version;
7
+ if ( FALSE ) {
8
+ $path['path'] = get_template_directory() . '/booster/';
9
+ }
10
+ else {
11
  $path['path'] = WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__));
 
 
12
  }
13
  }
14
 
17
  }, 8);
18
  add_action('init', function() {
19
  if (!class_exists("TenWebBooster")) {
20
+ if ( FALSE ) {
21
  $plugin_dir = apply_filters('tenweb_booster_sdk', array(
22
  'version' => '1.0.0',
23
+ 'path' => get_template_directory() . '/booster/',
24
  ));
25
+ }
26
+ else {
27
  $plugin_dir = apply_filters('tenweb_booster_sdk', array(
28
  'version' => '1.0.0',
29
+ 'path' => WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__)),
30
  ));
31
  }
32
  require_once($plugin_dir['path'] . '/main.php');
33
 
34
  function TWB($params = array()) {
35
  if ( isset($params['is_plugin']) && !$params['is_plugin'] ) {
36
+ $plugin_dir = get_template_directory() . '/booster';
37
  $plugin_url = get_template_directory_uri() . "/booster";
38
+ }
39
+ else {
40
  $plugin_dir = WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__));
41
  $plugin_url = plugins_url(plugin_basename(dirname(__FILE__)));
42
  }
booster/main.php CHANGED
@@ -20,7 +20,7 @@ class TenWebBooster {
20
  );
21
 
22
  public $cta_button = array(
23
- 'section_label' => '10Web Booster',
24
  'label' => 'Check PageSpeed score',
25
  'button_color' => '',
26
  'text_color' => '',
@@ -34,7 +34,6 @@ class TenWebBooster {
34
  private $list = TRUE;
35
 
36
  public $slug = '';
37
- private $abspath = '';
38
  public $plugin_dir = '';
39
  public $plugin_url = '';
40
  public $booster_plugin_status = 0; //0-not installed, 1-not active, 2-active
@@ -169,21 +168,18 @@ class TenWebBooster {
169
  }
170
  $admin_page = admin_url((isset($params['is_plugin']) && !$params['is_plugin']) ? 'themes.php' : 'admin.php');
171
  $this->submenu_url = add_query_arg( array('page' => TenWebBooster::PREFIX . '_' . $this->slug), $admin_page );
172
-
173
- $this->abspath = $this->get_abspath();
174
  }
175
 
176
  private function change_defaults( $params = array()) {
177
  foreach ( $params as $key => $param ) {
178
- if ( is_array($param) ) {
179
- foreach ( $param as $par_key => $par ) {
180
- if ( isset($this->$key[$par_key]) ) {
181
- $this->$key[$par_key] = sanitize_text_field($par);
182
  }
 
183
  }
184
- }
185
- else {
186
- if ( isset($this->$key) ) {
187
  $this->$key = sanitize_text_field($param);
188
  }
189
  }
@@ -314,7 +310,7 @@ class TenWebBooster {
314
  * @return int 0-not installed, 1-not active, 2-active
315
  */
316
  private function get_booster_status() {
317
- include_once( $this->abspath . 'wp-admin/includes/plugin.php' );
318
  if ( is_plugin_active(self::BOOSTER_PlUGIN_FILE) ) {
319
  return 2;
320
  }
@@ -326,22 +322,6 @@ class TenWebBooster {
326
  }
327
  }
328
 
329
- /**
330
- * get ABSPATH from WP_CONTENT_DIR.
331
- *
332
- * @param string $dirpath
333
- *
334
- * @return string
335
- */
336
- private function get_abspath() {
337
- $dirpath = defined( 'WP_CONTENT_DIR' ) ? WP_CONTENT_DIR : ABSPATH;
338
- $array = explode( "wp-content", $dirpath );
339
- if( isset( $array[0] ) && $array[0] != "" ) {
340
- return $array[0];
341
- }
342
- return ABSPATH;
343
- }
344
-
345
  /**
346
  * Check if the plugin already installed.
347
  *
@@ -351,7 +331,7 @@ class TenWebBooster {
351
  */
352
  private function is_plugin_installed() {
353
  if ( ! function_exists( 'get_plugins' ) ) {
354
- require_once ABSPATH . 'wp-admin/includes/plugin.php';
355
  }
356
  $all_plugins = get_plugins();
357
 
20
  );
21
 
22
  public $cta_button = array(
23
+ 'section_label' => 'PageSpeed score',
24
  'label' => 'Check PageSpeed score',
25
  'button_color' => '',
26
  'text_color' => '',
34
  private $list = TRUE;
35
 
36
  public $slug = '';
 
37
  public $plugin_dir = '';
38
  public $plugin_url = '';
39
  public $booster_plugin_status = 0; //0-not installed, 1-not active, 2-active
168
  }
169
  $admin_page = admin_url((isset($params['is_plugin']) && !$params['is_plugin']) ? 'themes.php' : 'admin.php');
170
  $this->submenu_url = add_query_arg( array('page' => TenWebBooster::PREFIX . '_' . $this->slug), $admin_page );
 
 
171
  }
172
 
173
  private function change_defaults( $params = array()) {
174
  foreach ( $params as $key => $param ) {
175
+ if ( isset($this->$key) ) {
176
+ if ( is_array($param) ) {
177
+ foreach ( $param as $par_key => $par ) {
178
+ $param[$par_key] = sanitize_text_field($par);
179
  }
180
+ $this->$key = array_merge($this->$key, $param);
181
  }
182
+ else {
 
 
183
  $this->$key = sanitize_text_field($param);
184
  }
185
  }
310
  * @return int 0-not installed, 1-not active, 2-active
311
  */
312
  private function get_booster_status() {
313
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
314
  if ( is_plugin_active(self::BOOSTER_PlUGIN_FILE) ) {
315
  return 2;
316
  }
322
  }
323
  }
324
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
325
  /**
326
  * Check if the plugin already installed.
327
  *
331
  */
332
  private function is_plugin_installed() {
333
  if ( ! function_exists( 'get_plugins' ) ) {
334
+ require_once( ABSPATH . 'wp-admin/includes/plugin.php');
335
  }
336
  $all_plugins = get_plugins();
337
 
booster/view.php CHANGED
@@ -54,7 +54,7 @@ class BoosterView {
54
  }
55
  }
56
  // If CTAs disable option is enabled.
57
- if ( $params['show_cta_option']) {
58
  ?>
59
  <div class="twb-speed-footer">
60
  <input type="checkbox" id="twb-show-cta" <?php echo $params['show_cta'] == 1 ? 'checked' : ''; ?>>
54
  }
55
  }
56
  // If CTAs disable option is enabled.
57
+ if ( $params['show_cta_option'] && $params['booster_plugin_status'] != 2 ) {
58
  ?>
59
  <div class="twb-speed-footer">
60
  <input type="checkbox" id="twb-show-cta" <?php echo $params['show_cta'] == 1 ? 'checked' : ''; ?>>
photo-gallery.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Photo Gallery
4
  * Plugin URI: https://10web.io/plugins/wordpress-photo-gallery/?utm_source=photo_gallery&utm_medium=free_plugin
5
  * Description: This plugin is a fully responsive gallery plugin with advanced functionality. It allows having different image galleries for your posts and pages. You can create unlimited number of galleries, combine them into albums, and provide descriptions and tags.
6
- * Version: 1.8.4
7
  * Author: Photo Gallery Team
8
  * Author URI: https://10web.io/plugins/?utm_source=photo_gallery&utm_medium=free_plugin
9
  * Text Domain: photo-gallery
@@ -107,8 +107,8 @@ final class BWG {
107
  $this->plugin_url = plugins_url(plugin_basename(dirname(__FILE__)));
108
  $this->front_url = $this->plugin_url;
109
  $this->main_file = plugin_basename(__FILE__);
110
- $this->plugin_version = '1.8.4';
111
- $this->db_version = '1.8.4';
112
  $this->prefix = 'bwg';
113
  $this->nicename = __('Photo Gallery', 'photo-gallery');
114
  require_once($this->plugin_dir . '/framework/WDWLibrary.php');
@@ -1374,7 +1374,6 @@ final class BWG {
1374
  wp_register_style('mCustomScrollbar', BWG()->front_url . '/css/jquery.mCustomScrollbar.min.css', array(), '3.1.5');
1375
  wp_register_script('jquery-fullscreen', BWG()->front_url . '/js/jquery.fullscreen.min.js', $required_scripts, '0.6.0', $in_footer);
1376
  wp_register_script($this->prefix . '_lazyload', BWG()->front_url . '/js/jquery.lazy.min.js', $required_scripts, $version, $in_footer);
1377
- wp_register_script($this->prefix . '_circle', BWG()->front_url . '/js/circle-progress.js', $required_scripts, '1.2.2', $in_footer);
1378
  array_push($required_scripts,
1379
  'sumoselect',
1380
  'jquery-mobile',
@@ -2045,4 +2044,4 @@ add_action('init', function() {
2045
  'slug' => 'photo-gallery',
2046
  ),
2047
  ));
2048
- }, 11);
3
  * Plugin Name: Photo Gallery
4
  * Plugin URI: https://10web.io/plugins/wordpress-photo-gallery/?utm_source=photo_gallery&utm_medium=free_plugin
5
  * Description: This plugin is a fully responsive gallery plugin with advanced functionality. It allows having different image galleries for your posts and pages. You can create unlimited number of galleries, combine them into albums, and provide descriptions and tags.
6
+ * Version: 1.8.5
7
  * Author: Photo Gallery Team
8
  * Author URI: https://10web.io/plugins/?utm_source=photo_gallery&utm_medium=free_plugin
9
  * Text Domain: photo-gallery
107
  $this->plugin_url = plugins_url(plugin_basename(dirname(__FILE__)));
108
  $this->front_url = $this->plugin_url;
109
  $this->main_file = plugin_basename(__FILE__);
110
+ $this->plugin_version = '1.8.5';
111
+ $this->db_version = '1.8.5';
112
  $this->prefix = 'bwg';
113
  $this->nicename = __('Photo Gallery', 'photo-gallery');
114
  require_once($this->plugin_dir . '/framework/WDWLibrary.php');
1374
  wp_register_style('mCustomScrollbar', BWG()->front_url . '/css/jquery.mCustomScrollbar.min.css', array(), '3.1.5');
1375
  wp_register_script('jquery-fullscreen', BWG()->front_url . '/js/jquery.fullscreen.min.js', $required_scripts, '0.6.0', $in_footer);
1376
  wp_register_script($this->prefix . '_lazyload', BWG()->front_url . '/js/jquery.lazy.min.js', $required_scripts, $version, $in_footer);
 
1377
  array_push($required_scripts,
1378
  'sumoselect',
1379
  'jquery-mobile',
2044
  'slug' => 'photo-gallery',
2045
  ),
2046
  ));
2047
+ }, 11);
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: webdorado,wdsupport,photogallerysupport,10web
3
  Tags: gallery, photo gallery, image gallery, responsive gallery, wordpress gallery plugin, photo albums, gallery slider, gallery lightbox, wordpress photo gallery plugin, fullscreen gallery, watermarking, video gallery
4
  Requires at least: 4.6
5
  Tested up to: 6.1
6
- Stable tag: 1.8.4
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -273,6 +273,12 @@ Choose whether to display random or the first/last specific number of images.
273
 
274
  == Changelog ==
275
 
 
 
 
 
 
 
276
  = 1.8.4 =
277
  * Fixed: Dismissible CTAs.
278
 
3
  Tags: gallery, photo gallery, image gallery, responsive gallery, wordpress gallery plugin, photo albums, gallery slider, gallery lightbox, wordpress photo gallery plugin, fullscreen gallery, watermarking, video gallery
4
  Requires at least: 4.6
5
  Tested up to: 6.1
6
+ Stable tag: 1.8.5
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
273
 
274
  == Changelog ==
275
 
276
+ = 1.8.5 =
277
+ * Added: Check page speed score from Elementor.
278
+ * Fixed: Bug on getting plugin/theme path.
279
+ * Fixed: Bug on illegal string offset.
280
+ * Fixed: Remove unnecessary js from frontend.
281
+
282
  = 1.8.4 =
283
  * Fixed: Dismissible CTAs.
284