@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @since 6.0.0 |
31 | 31 | */ |
32 | 32 | public function __construct() { |
33 | - add_filter( 'monsterinsights_reports_abstract_get_data_pre_cache', array( $this, 'requirements' ), 10 , 3 ); |
|
33 | + add_filter( 'monsterinsights_reports_abstract_get_data_pre_cache', array( $this, 'requirements' ), 10, 3 ); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | // Let's get the HTML to output for a particular report. This is not the AJAX endpoint. Args can hold things (generally start/end date range) |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | return ''; |
41 | 41 | } |
42 | 42 | |
43 | - public function additional_data(){ |
|
43 | + public function additional_data() { |
|
44 | 44 | return array(); |
45 | 45 | } |
46 | 46 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | public function show_report( $args = array() ) { |
52 | 52 | |
53 | 53 | if ( ! current_user_can( 'monsterinsights_view_dashboard' ) ) { |
54 | - return monsterinsights_get_message( 'error', esc_html__( 'Access denied' , 'google-analytics-for-wordpress' ) ); |
|
54 | + return monsterinsights_get_message( 'error', esc_html__( 'Access denied', 'google-analytics-for-wordpress' ) ); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | if ( monsterinsights_get_option( 'dashboard_disabled', false ) ) { |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
72 | - if ( monsterinsights_is_pro_version() ){ |
|
72 | + if ( monsterinsights_is_pro_version() ) { |
|
73 | 73 | if ( ! MonsterInsights()->license->has_license() ) { |
74 | 74 | $url = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_settings' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
75 | - return monsterinsights_get_message( 'error', esc_html__( 'You do not have an active license. Please %1$scheck your license configuration.%2$s', 'google-analytics-for-wordpress' ),'<a href="' . $url . '">','</a>' ); |
|
75 | + return monsterinsights_get_message( 'error', esc_html__( 'You do not have an active license. Please %1$scheck your license configuration.%2$s', 'google-analytics-for-wordpress' ), '<a href="' . $url . '">', '</a>' ); |
|
76 | 76 | } else if ( MonsterInsights()->license->license_has_error() ) { |
77 | 77 | return monsterinsights_get_message( 'error', $this->get_license_error() ); |
78 | 78 | } |
@@ -107,13 +107,13 @@ discard block |
||
107 | 107 | return monsterinsights_get_message( 'error', $args['error'] ); |
108 | 108 | } |
109 | 109 | |
110 | - if ( empty( $args['data' ] ) || ! is_array( $args['data' ] ) ) { |
|
110 | + if ( empty( $args['data'] ) || ! is_array( $args['data'] ) ) { |
|
111 | 111 | if ( monsterinsights_is_pro_version() ) { |
112 | 112 | return ''; |
113 | 113 | } else { |
114 | 114 | // Try to get default data. |
115 | 115 | $args = $this->get_data( array( 'default' => true ) ); |
116 | - if ( empty( $args['data'] ) || is_array( $args['data' ] ) ) { |
|
116 | + if ( empty( $args['data'] ) || is_array( $args['data'] ) ) { |
|
117 | 117 | return monsterinsights_get_message( 'error', __( 'No data found', 'google-analytics-for-wordpress' ) ); |
118 | 118 | } |
119 | 119 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | } |
148 | 148 | |
149 | 149 | $start = ! empty( $args['start'] ) && $this->is_valid_date( $args['start'] ) ? $args['start'] : ''; |
150 | - $end = ! empty( $args['end'] ) && $this->is_valid_date( $args['end'] ) ? $args['end'] : ''; |
|
150 | + $end = ! empty( $args['end'] ) && $this->is_valid_date( $args['end'] ) ? $args['end'] : ''; |
|
151 | 151 | |
152 | 152 | if ( ! MonsterInsights()->license->license_can( $this->level ) ) { |
153 | 153 | return array( |
@@ -202,11 +202,11 @@ discard block |
||
202 | 202 | $data = ! $site_auth && $ms_auth ? get_site_transient( $transient ) : get_transient( $transient ); |
203 | 203 | } |
204 | 204 | |
205 | - if ( ! empty( $data ) && |
|
206 | - ! empty( $data['expires'] ) && |
|
205 | + if ( ! empty( $data ) && |
|
206 | + ! empty( $data['expires'] ) && |
|
207 | 207 | $data['expires'] >= time() && |
208 | - ! empty( $data['data'] ) && |
|
209 | - ! empty( $data['p'] ) && |
|
208 | + ! empty( $data['data'] ) && |
|
209 | + ! empty( $data['p'] ) && |
|
210 | 210 | $data['p'] === $p |
211 | 211 | ) { |
212 | 212 | return array( |
@@ -216,12 +216,12 @@ discard block |
||
216 | 216 | } |
217 | 217 | |
218 | 218 | // Nothing in cache, either not saved before, expired or mismatch. Let's grab from API |
219 | - $api_options = array( 'start' => $start, 'end' => $end); |
|
219 | + $api_options = array( 'start' => $start, 'end' => $end ); |
|
220 | 220 | if ( ! $site_auth && $ms_auth ) { |
221 | 221 | $api_options['network'] = true; |
222 | 222 | } |
223 | 223 | |
224 | - $api = new MonsterInsights_API_Request( 'analytics/reports/' . $this->name . '/', $api_options, 'GET' ); |
|
224 | + $api = new MonsterInsights_API_Request( 'analytics/reports/' . $this->name . '/', $api_options, 'GET' ); |
|
225 | 225 | |
226 | 226 | $additional_data = $this->additional_data(); |
227 | 227 | |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | $api->set_additional_data( $additional_data ); |
230 | 230 | } |
231 | 231 | |
232 | - $ret = $api->request(); |
|
232 | + $ret = $api->request(); |
|
233 | 233 | //echo print_r( $ret['data']);wp_die(); |
234 | 234 | |
235 | 235 | if ( is_wp_error( $ret ) ) { |
@@ -290,44 +290,44 @@ discard block |
||
290 | 290 | // Is a valid date value |
291 | 291 | public function is_valid_date( $date = '' ) { |
292 | 292 | $d = MonsterInsightsDateTime::createFromFormat( 'Y-m-d', $date ); |
293 | - return $d && $d->format('Y-m-d') === $date; |
|
293 | + return $d && $d->format( 'Y-m-d' ) === $date; |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | /** |
297 | 297 | * Do not use the functions below this. They are unused and are just here so people |
298 | 298 | * with out of date MonsterInsights addons won't get fatal errors. |
299 | 299 | */ |
300 | - protected function get_api_max_limit() {return 300;} |
|
301 | - protected function get_date_range() {return array();} |
|
300 | + protected function get_api_max_limit() {return 300; } |
|
301 | + protected function get_date_range() {return array(); } |
|
302 | 302 | |
303 | 303 | public function get_upsell_notice() { |
304 | 304 | $has_level = MonsterInsights()->license->get_license_type(); |
305 | 305 | $has_level = $has_level ? $has_level : 'lite'; |
306 | 306 | $message = sprintf( __( 'You currently have a %s level license, but this report requires at least a %s level license to view the %s. Please upgrade to view this report.', 'google-analytics-for-wordpress' ), $has_level, $this->level, $this->title ); |
307 | - ob_start();?> |
|
308 | - <div class="monsterinsights-upsell-report-container monsterinsights-upsell-report-<?php echo $this->name;?>-bg"> |
|
307 | + ob_start(); ?> |
|
308 | + <div class="monsterinsights-upsell-report-container monsterinsights-upsell-report-<?php echo $this->name; ?>-bg"> |
|
309 | 309 | <div class="monsterinsights-upsell-container"> |
310 | 310 | <div class="row justify-content-center"> |
311 | 311 | <div class="col-lg-10 col-lg-offset-1 align-self-center"> |
312 | 312 | <div class="monsterinsights-upsell-card"> |
313 | - <img class="monsterinsights-upgrade-mascot" src="<?php echo trailingslashit( MONSTERINSIGHTS_PLUGIN_URL );?>assets/css/images/mascot.png" srcset="<?php echo trailingslashit( MONSTERINSIGHTS_PLUGIN_URL );?>assets/css/images/[email protected] 2x" alt=""> |
|
313 | + <img class="monsterinsights-upgrade-mascot" src="<?php echo trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ); ?>assets/css/images/mascot.png" srcset="<?php echo trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ); ?>assets/css/images/[email protected] 2x" alt=""> |
|
314 | 314 | <div class="monsterinsights-upsell-card-card-content"> |
315 | - <span class="monsterinsights-upsell-card-title"><?php esc_html_e( 'Ready to Get Analytics Super-Powers?', 'google-analytics-for-wordpress' );?></span> |
|
316 | - <p class="monsterinsights-upsell-card-subtitle"><strong><?php esc_html_e( '(And Crush Your Competition?)', 'google-analytics-for-wordpress' );?></strong></p> |
|
315 | + <span class="monsterinsights-upsell-card-title"><?php esc_html_e( 'Ready to Get Analytics Super-Powers?', 'google-analytics-for-wordpress' ); ?></span> |
|
316 | + <p class="monsterinsights-upsell-card-subtitle"><strong><?php esc_html_e( '(And Crush Your Competition?)', 'google-analytics-for-wordpress' ); ?></strong></p> |
|
317 | 317 | <?php if ( monsterinsights_is_pro_version() ) { ?> |
318 | 318 | <p ><?php echo sprintf( esc_html__( "Hey there! It looks like you've got the %s license installed on your site. |
319 | - That's awesome! %s",'google-analytics-for-wordpress'), $has_level, '<span class="dashicons dashicons-smiley"></span>' ); ?></p> |
|
319 | + That's awesome! %s",'google-analytics-for-wordpress' ), $has_level, '<span class="dashicons dashicons-smiley"></span>' ); ?></p> |
|
320 | 320 | |
321 | - <p><?php echo sprintf( esc_html__( "Do you you want to access to %s reporting right now%s in your WordPress Dashboard? That comes with %s level%s of our paid packages. You'll need to upgrade your license to get instant access.",'google-analytics-for-wordpress'), '<strong>' . $this->title, '</strong>','<a href="https://monsterinsights.com/my-account/">' . $this->level,'</a>' ); ?></p> |
|
322 | - <p><?php echo sprintf( esc_html__( "It's easy! To upgrade, navigate to %sMy Account%s on MonsterInsights.com, go to the licenses tab, and click upgrade. We also have a %sstep by step guide%s with pictures of this process.",'google-analytics-for-wordpress'), '<a href="https://monsterinsights.com/my-account/?utm_source=wpdashboard&utm_campaign=reportupsellpro"><strong>','</strong></a>', '<a href="https://www.monsterinsights.com/docs/upgrade-monsterinsights-license/" style="text-decoration:underline !important">', '</a>' ); ?></p> |
|
323 | - <p><?php esc_html_e( "If you have any questions, don't hesitate to reach out. We're here to help.", 'google-analytics-for-wordpress');?></p> |
|
321 | + <p><?php echo sprintf( esc_html__( "Do you you want to access to %s reporting right now%s in your WordPress Dashboard? That comes with %s level%s of our paid packages. You'll need to upgrade your license to get instant access.", 'google-analytics-for-wordpress' ), '<strong>' . $this->title, '</strong>', '<a href="https://monsterinsights.com/my-account/">' . $this->level, '</a>' ); ?></p> |
|
322 | + <p><?php echo sprintf( esc_html__( "It's easy! To upgrade, navigate to %sMy Account%s on MonsterInsights.com, go to the licenses tab, and click upgrade. We also have a %sstep by step guide%s with pictures of this process.", 'google-analytics-for-wordpress' ), '<a href="https://monsterinsights.com/my-account/?utm_source=wpdashboard&utm_campaign=reportupsellpro"><strong>', '</strong></a>', '<a href="https://www.monsterinsights.com/docs/upgrade-monsterinsights-license/" style="text-decoration:underline !important">', '</a>' ); ?></p> |
|
323 | + <p><?php esc_html_e( "If you have any questions, don't hesitate to reach out. We're here to help.", 'google-analytics-for-wordpress' ); ?></p> |
|
324 | 324 | <?php } else { ?> |
325 | 325 | <p><?php echo sprintf( esc_html__( "Hey there! %s It looks like you've got the free version of MonsterInsights installed on your site. |
326 | - That's awesome!",'google-analytics-for-wordpress'), '<span class="dashicons dashicons-smiley"></span>' ); ?></p> |
|
326 | + That's awesome!",'google-analytics-for-wordpress' ), '<span class="dashicons dashicons-smiley"></span>' ); ?></p> |
|
327 | 327 | |
328 | - <p><?php echo sprintf( esc_html__( "Do you you want to access to %s reporting right now%s in your WordPress Dashboard? That comes with %s level%s of our paid packages. To get instant access, you'll want to buy a MonsterInsights license, which also gives you access to powerful addons, expanded reporting (including the ability to use custom date ranges), comprehensive tracking features (like UserID tracking) and access to our world-class support team.",'google-analytics-for-wordpress'), '<strong>' . $this->title, '</strong>','<a href="https://monsterinsights.com/lite/">' . $this->level,'</a>' ); ?></p> |
|
329 | - <p><?php echo sprintf( esc_html__( "Upgrading is easy! To upgrade, navigate to %sour pricing page%s, purchase the required license, and then follow the %sinstructions in the email receipt%s to upgrade. It only takes a few minutes to unlock the most powerful, yet easy to use analytics tracking system for WordPress.",'google-analytics-for-wordpress'), '<a href="https://monsterinsights.com/lite/?utm_source=wpdashboard&utm_campaign=reportupselllite"><strong>', '</strong></a>','<a style="text-decoration:underline !important" href="https://www.monsterinsights.com/docs/go-lite-pro/">', '</a>' ); ?></p> |
|
330 | - <p><?php esc_html_e( "If you have any questions, don't hesitate to reach out. We're here to help.", 'google-analytics-for-wordpress');?></p> |
|
328 | + <p><?php echo sprintf( esc_html__( "Do you you want to access to %s reporting right now%s in your WordPress Dashboard? That comes with %s level%s of our paid packages. To get instant access, you'll want to buy a MonsterInsights license, which also gives you access to powerful addons, expanded reporting (including the ability to use custom date ranges), comprehensive tracking features (like UserID tracking) and access to our world-class support team.", 'google-analytics-for-wordpress' ), '<strong>' . $this->title, '</strong>', '<a href="https://monsterinsights.com/lite/">' . $this->level, '</a>' ); ?></p> |
|
329 | + <p><?php echo sprintf( esc_html__( "Upgrading is easy! To upgrade, navigate to %sour pricing page%s, purchase the required license, and then follow the %sinstructions in the email receipt%s to upgrade. It only takes a few minutes to unlock the most powerful, yet easy to use analytics tracking system for WordPress.", 'google-analytics-for-wordpress' ), '<a href="https://monsterinsights.com/lite/?utm_source=wpdashboard&utm_campaign=reportupselllite"><strong>', '</strong></a>', '<a style="text-decoration:underline !important" href="https://www.monsterinsights.com/docs/go-lite-pro/">', '</a>' ); ?></p> |
|
330 | + <p><?php esc_html_e( "If you have any questions, don't hesitate to reach out. We're here to help.", 'google-analytics-for-wordpress' ); ?></p> |
|
331 | 331 | <?php } ?> |
332 | 332 | </div> |
333 | 333 | <div class="monsterinsights-upsell-card-action"> |
@@ -352,9 +352,9 @@ discard block |
||
352 | 352 | return ''; |
353 | 353 | } else { |
354 | 354 | if ( ! empty( $data['reportprevrange'] ) && ! empty( $data['reportprevrange']['startDate'] ) && ! empty( $data['reportprevrange']['endDate'] ) ) { |
355 | - return '%3F_u.date00%3D' . str_replace( '-', '', $data['reportcurrentrange']['startDate'] ) .'%26_u.date01%3D' . str_replace( '-', '', $data['reportcurrentrange']['endDate'] ) . '%26_u.date10%3D' . str_replace( '-', '', $data['reportprevrange']['startDate'] ) .'%26_u.date11%3D' . str_replace( '-', '', $data['reportprevrange']['endDate'] ) . '/'; |
|
355 | + return '%3F_u.date00%3D' . str_replace( '-', '', $data['reportcurrentrange']['startDate'] ) . '%26_u.date01%3D' . str_replace( '-', '', $data['reportcurrentrange']['endDate'] ) . '%26_u.date10%3D' . str_replace( '-', '', $data['reportprevrange']['startDate'] ) . '%26_u.date11%3D' . str_replace( '-', '', $data['reportprevrange']['endDate'] ) . '/'; |
|
356 | 356 | } else { |
357 | - return '%3F_u.date00%3D' . str_replace( '-', '', $data['reportcurrentrange']['startDate'] ) .'%26_u.date01%3D' . str_replace( '-', '', $data['reportcurrentrange']['endDate'] ) . '/'; |
|
357 | + return '%3F_u.date00%3D' . str_replace( '-', '', $data['reportcurrentrange']['startDate'] ) . '%26_u.date01%3D' . str_replace( '-', '', $data['reportcurrentrange']['endDate'] ) . '/'; |
|
358 | 358 | } |
359 | 359 | } |
360 | 360 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | // Outputs the report. |
39 | - protected function get_report_html( $data = array() ){ |
|
39 | + protected function get_report_html( $data = array() ) { |
|
40 | 40 | ob_start(); |
41 | 41 | if ( ! empty( $data['overviewgraph']['count'] ) && $data['overviewgraph']['count'] > 0 ) { |
42 | 42 | ?> |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | <img src="<?php echo $up; ?>" srcset="<?php echo $up2x; ?> 2x" alt="<?php echo $uplabel; ?>"/> |
94 | 94 | <?php echo esc_html( $data['infobox']['sessions']['prev'] ) . '%'; ?> |
95 | 95 | </div> |
96 | - <?php } else { ?> |
|
96 | + <?php } else { ?> |
|
97 | 97 | <div class="monsterinsights-reports-infobox-prev"> |
98 | 98 | <img src="<?php echo $down; ?>" srcset="<?php echo $down2x; ?> 2x" alt="<?php echo $downlabel; ?>"/> |
99 | 99 | <?php echo esc_html( absint( $data['infobox']['sessions']['prev'] ) ) . '%'; ?> |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | <img src="<?php echo $up; ?>" srcset="<?php echo $up2x; ?> 2x" alt="<?php echo $uplabel; ?>"/> |
121 | 121 | <?php echo esc_html( $data['infobox']['pageviews']['prev'] ) . '%'; ?> |
122 | 122 | </div> |
123 | - <?php } else { ?> |
|
123 | + <?php } else { ?> |
|
124 | 124 | <div class="monsterinsights-reports-infobox-prev"> |
125 | 125 | <img src="<?php echo $down; ?>" srcset="<?php echo $down2x; ?> 2x" alt="<?php echo $downlabel; ?>"/> |
126 | 126 | <?php echo esc_html( absint( $data['infobox']['pageviews']['prev'] ) ) . '%'; ?> |
@@ -147,10 +147,10 @@ discard block |
||
147 | 147 | <img src="<?php echo $up; ?>" srcset="<?php echo $up2x; ?> 2x" alt="<?php echo $uplabel; ?>"/> |
148 | 148 | <?php echo esc_html( $data['infobox']['duration']['prev'] ) . '%'; ?> |
149 | 149 | </div> |
150 | - <?php } else { ?> |
|
150 | + <?php } else { ?> |
|
151 | 151 | <div class="monsterinsights-reports-infobox-prev"> |
152 | 152 | <img src="<?php echo $down; ?>" srcset="<?php echo $down2x; ?> 2x" alt="<?php echo $downlabel; ?>"/> |
153 | - <?php echo esc_html( absint( $data['infobox']['duration']['prev'] ) ) . '%'; ?> |
|
153 | + <?php echo esc_html( absint( $data['infobox']['duration']['prev'] ) ) . '%'; ?> |
|
154 | 154 | </div> |
155 | 155 | <?php } ?> |
156 | 156 | <div class="monsterinsights-reports-infobox-compare"> |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | <img src="<?php echo $up; ?>" srcset="<?php echo $up2x; ?> 2x" alt="<?php echo $uplabel; ?>"/> |
175 | 175 | <?php echo esc_html( $data['infobox']['bounce']['prev'] ) . '%'; ?> |
176 | 176 | </div> |
177 | - <?php } else { ?> |
|
177 | + <?php } else { ?> |
|
178 | 178 | <div class="monsterinsights-reports-infobox-prev"> |
179 | 179 | <img src="<?php echo $down; ?>" srcset="<?php echo $down2x; ?> 2x" alt="<?php echo $downlabel; ?>"/> |
180 | 180 | <?php echo esc_html( absint( $data['infobox']['bounce']['prev'] ) ) . '%'; ?> |
@@ -186,12 +186,12 @@ discard block |
||
186 | 186 | </div> |
187 | 187 | </div> |
188 | 188 | <?php } ?> |
189 | - <?php if ( ! empty( $data['newvsreturn'] ) && ! empty( $data['devices'] ) ) { ?> |
|
189 | + <?php if ( ! empty( $data['newvsreturn'] ) && ! empty( $data['devices'] ) ) { ?> |
|
190 | 190 | <div class="monsterinsights-reports-2-column-container row"> |
191 | 191 | <div class="monsterinsights-reports-2-column-item col-md-6"> |
192 | 192 | <div class="monsterinsights-reports-2-column-panel panel monsterinsights-pie-chart-panel chart-panel"> |
193 | 193 | <div class="monsterinsights-reports-panel-title"> |
194 | - <?php echo esc_html__( 'New vs. Returning Visitors', 'google-analytics-for-wordpress' );?> |
|
194 | + <?php echo esc_html__( 'New vs. Returning Visitors', 'google-analytics-for-wordpress' ); ?> |
|
195 | 195 | </div> |
196 | 196 | <div class="monsterinsights-reports-uright-tooltip" data-tooltip-title="<?php echo esc_attr( __( 'New vs. Returning Visitors', 'google-analytics-for-wordpress' ) ); ?>" data-tooltip-description="<?php echo esc_attr( __( 'This graph shows what percent of your user sessions come from new versus repeat visitors.', 'google-analytics-for-wordpress' ) ); ?>"></div> |
197 | 197 | <div class="monsterinsights-reports-pie-graph monsterinsights-clear"> |
@@ -281,8 +281,8 @@ discard block |
||
281 | 281 | }], |
282 | 282 | values: [<?php echo esc_js( $data['newvsreturn']['new'] ); ?>,<?php echo esc_js( $data['newvsreturn']['returning'] ); ?> ], |
283 | 283 | labels: [ |
284 | - "<?php echo esc_js( __('New', 'google-analytics-for-wordpress' ) ); ?>", |
|
285 | - "<?php echo esc_js( __('Returning', 'google-analytics-for-wordpress' ) ); ?>", |
|
284 | + "<?php echo esc_js( __( 'New', 'google-analytics-for-wordpress' ) ); ?>", |
|
285 | + "<?php echo esc_js( __( 'Returning', 'google-analytics-for-wordpress' ) ); ?>", |
|
286 | 286 | ] |
287 | 287 | }, |
288 | 288 | options: { |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | <div class="monsterinsights-reports-2-column-item col-md-6"> |
341 | 341 | <div class="monsterinsights-reports-2-column-panel panel monsterinsights-pie-chart-panel chart-panel"> |
342 | 342 | <div class="monsterinsights-reports-panel-title"> |
343 | - <?php echo esc_html__( 'Device Breakdown', 'google-analytics-for-wordpress' );?> |
|
343 | + <?php echo esc_html__( 'Device Breakdown', 'google-analytics-for-wordpress' ); ?> |
|
344 | 344 | </div> |
345 | 345 | <div class="monsterinsights-reports-uright-tooltip" data-tooltip-title="<?php echo esc_attr( __( 'Device Breakdown', 'google-analytics-for-wordpress' ) ); ?>" data-tooltip-description="<?php echo esc_attr( __( 'This graph shows what percent of your visitor sessions are done using a traditional computer or laptop, tablet or mobile device to view your site.', 'google-analytics-for-wordpress' ) ); ?>"></div> |
346 | 346 | <div class="monsterinsights-reports-pie-graph monsterinsights-clear"> |
@@ -432,9 +432,9 @@ discard block |
||
432 | 432 | }], |
433 | 433 | values: [<?php echo esc_js( $data['devices']['desktop'] ); ?>,<?php echo esc_js( $data['devices']['tablet'] ); ?>,<?php echo esc_js( $data['devices']['mobile'] ); ?> ], |
434 | 434 | labels: [ |
435 | - "<?php echo esc_js( __('Desktop', 'google-analytics-for-wordpress' ) ); ?>", |
|
436 | - "<?php echo esc_js( __('Tablet', 'google-analytics-for-wordpress' ) ); ?>", |
|
437 | - "<?php echo esc_js( __('Mobile', 'google-analytics-for-wordpress' ) ); ?>", |
|
435 | + "<?php echo esc_js( __( 'Desktop', 'google-analytics-for-wordpress' ) ); ?>", |
|
436 | + "<?php echo esc_js( __( 'Tablet', 'google-analytics-for-wordpress' ) ); ?>", |
|
437 | + "<?php echo esc_js( __( 'Mobile', 'google-analytics-for-wordpress' ) ); ?>", |
|
438 | 438 | ] |
439 | 439 | }, |
440 | 440 | options: { |
@@ -492,12 +492,12 @@ discard block |
||
492 | 492 | </div> |
493 | 493 | <?php } ?> |
494 | 494 | |
495 | - <?php if ( ! empty( $data['countries'] ) && ! empty( $data['referrals'] ) ) { ?> |
|
495 | + <?php if ( ! empty( $data['countries'] ) && ! empty( $data['referrals'] ) ) { ?> |
|
496 | 496 | <div class="monsterinsights-reports-2-column-container row"> |
497 | 497 | <div class="monsterinsights-reports-2-column-item col-md-6 list-has-icons"> |
498 | 498 | <div class="monsterinsights-reports-2-column-panel panel nopadding"> |
499 | 499 | <div class="monsterinsights-reports-panel-title"> |
500 | - <?php echo esc_html__( 'Top 10 Countries', 'google-analytics-for-wordpress' );?> |
|
500 | + <?php echo esc_html__( 'Top 10 Countries', 'google-analytics-for-wordpress' ); ?> |
|
501 | 501 | </div> |
502 | 502 | <div class="monsterinsights-reports-uright-tooltip" data-tooltip-title="<?php echo esc_attr( __( 'Top 10 Countries', 'google-analytics-for-wordpress' ) ); ?>" data-tooltip-description="<?php echo esc_attr( __( 'This list shows the top countries your website visitors are from.', 'google-analytics-for-wordpress' ) ); ?>"></div> |
503 | 503 | <div class="monsterinsights-reports-list"> |
@@ -505,11 +505,11 @@ discard block |
||
505 | 505 | <?php |
506 | 506 | $countries = monsterinsights_get_country_list( false ); |
507 | 507 | $i = 1; |
508 | - foreach( $data['countries'] as $icountry => $countrydata ) { |
|
509 | - if ( ! empty( $countries[ $countrydata['iso'] ] ) ) { |
|
510 | - echo '<li class="list-group-item"><span class="monsterinsights-reports-list-count">'. $i .'.</span><span class="monsterinsights-reports-country-flag monsterinsights-flag-icon monsterinsights-flag-icon-' . strtolower( $countrydata['iso'] ) . ' "></span><span class="monsterinsights-reports-list-text">' . $countries[ $countrydata['iso'] ] . '</span><span class="monsterinsights-reports-list-number">' . number_format_i18n( $countrydata['sessions'] ) . '</span></li>'; |
|
508 | + foreach ( $data['countries'] as $icountry => $countrydata ) { |
|
509 | + if ( ! empty( $countries[$countrydata['iso']] ) ) { |
|
510 | + echo '<li class="list-group-item"><span class="monsterinsights-reports-list-count">' . $i . '.</span><span class="monsterinsights-reports-country-flag monsterinsights-flag-icon monsterinsights-flag-icon-' . strtolower( $countrydata['iso'] ) . ' "></span><span class="monsterinsights-reports-list-text">' . $countries[$countrydata['iso']] . '</span><span class="monsterinsights-reports-list-number">' . number_format_i18n( $countrydata['sessions'] ) . '</span></li>'; |
|
511 | 511 | } else { |
512 | - echo '<li class="list-group-item"><span class="monsterinsights-reports-list-count">'. $num .'</span><span class="monsterinsights-flag-icon monsterinsights-flag-icon-' . strtolower( $countrydata['iso'] ) . ' "></span><span class="monsterinsights-reports-list-text">' . $countrydata['iso'] . '</span><span class="monsterinsights-reports-list-number">' . number_format_i18n( $countrydata['sessions'] ) . '</span></li>'; |
|
512 | + echo '<li class="list-group-item"><span class="monsterinsights-reports-list-count">' . $num . '</span><span class="monsterinsights-flag-icon monsterinsights-flag-icon-' . strtolower( $countrydata['iso'] ) . ' "></span><span class="monsterinsights-reports-list-text">' . $countrydata['iso'] . '</span><span class="monsterinsights-reports-list-number">' . number_format_i18n( $countrydata['sessions'] ) . '</span></li>'; |
|
513 | 513 | } |
514 | 514 | $i++; |
515 | 515 | } |
@@ -517,35 +517,35 @@ discard block |
||
517 | 517 | </ul> |
518 | 518 | </div> |
519 | 519 | <?php |
520 | - $referral_url = 'https://analytics.google.com/analytics/web/#report/visitors-geo/'. MonsterInsights()->auth->get_referral_url() . $this->get_ga_report_range( $data ); |
|
520 | + $referral_url = 'https://analytics.google.com/analytics/web/#report/visitors-geo/' . MonsterInsights()->auth->get_referral_url() . $this->get_ga_report_range( $data ); |
|
521 | 521 | ?> |
522 | 522 | <div class="monsterinsights-reports-panel-footer"> |
523 | - <a href="<?php echo $referral_url; ?>" target="_blank" title="<?php echo esc_html__( 'View Full Countries Report', 'google-analytics-for-wordpress' );?>" class="monsterinsights-reports-panel-footer-button"><?php echo esc_html__( 'View All Countries Report', 'google-analytics-for-wordpress' );?></a> |
|
523 | + <a href="<?php echo $referral_url; ?>" target="_blank" title="<?php echo esc_html__( 'View Full Countries Report', 'google-analytics-for-wordpress' ); ?>" class="monsterinsights-reports-panel-footer-button"><?php echo esc_html__( 'View All Countries Report', 'google-analytics-for-wordpress' ); ?></a> |
|
524 | 524 | </div> |
525 | 525 | </div> |
526 | 526 | </div> |
527 | 527 | <div class="monsterinsights-reports-2-column-item col-md-6 list-has-icons"> |
528 | 528 | <div class="monsterinsights-reports-2-column-panel panel nopadding"> |
529 | 529 | <div class="monsterinsights-reports-panel-title"> |
530 | - <?php echo esc_html__( 'Referrals', 'google-analytics-for-wordpress' );?> |
|
530 | + <?php echo esc_html__( 'Referrals', 'google-analytics-for-wordpress' ); ?> |
|
531 | 531 | </div> |
532 | 532 | <div class="monsterinsights-reports-uright-tooltip" data-tooltip-title="<?php echo esc_attr( __( 'Referrals', 'google-analytics-for-wordpress' ) ); ?>" data-tooltip-description="<?php echo esc_attr( __( 'This list shows the top websites that send your website traffic, known as "referral traffic".', 'google-analytics-for-wordpress' ) ); ?>"></div> |
533 | 533 | <div class="monsterinsights-reports-list"> |
534 | 534 | <ul class="monsterinsights-reports-referral-list list-group"> |
535 | 535 | <?php |
536 | 536 | $i = 1; |
537 | - foreach( $data['referrals'] as $ireferrals => $referralsdata ) { |
|
538 | - echo '<li class="list-group-item">'. |
|
537 | + foreach ( $data['referrals'] as $ireferrals => $referralsdata ) { |
|
538 | + echo '<li class="list-group-item">' . |
|
539 | 539 | '<span class="monsterinsights-reports-list-count">' |
540 | 540 | . $i . |
541 | - '</span>'. |
|
542 | - '<img class="monsterinsights-reports-referral-icon" src="https://www.google.com/s2/favicons?domain=' . $referralsdata['url'] . '" width="16px" height="16px" />'. |
|
541 | + '</span>' . |
|
542 | + '<img class="monsterinsights-reports-referral-icon" src="https://www.google.com/s2/favicons?domain=' . $referralsdata['url'] . '" width="16px" height="16px" />' . |
|
543 | 543 | '<span class="monsterinsights-reports-list-text">' |
544 | 544 | . $referralsdata['url'] . |
545 | 545 | '</span> |
546 | 546 | <span class="monsterinsights-reports-list-number">' |
547 | 547 | . number_format_i18n( $referralsdata['sessions'] ) . |
548 | - '</span>'. |
|
548 | + '</span>' . |
|
549 | 549 | '</li>'; |
550 | 550 | $i++; |
551 | 551 | } |
@@ -553,10 +553,10 @@ discard block |
||
553 | 553 | </ul> |
554 | 554 | </div> |
555 | 555 | <?php |
556 | - $referral_url = 'https://analytics.google.com/analytics/web/#report/trafficsources-referrals/'. MonsterInsights()->auth->get_referral_url() . $this->get_ga_report_range( $data ); |
|
556 | + $referral_url = 'https://analytics.google.com/analytics/web/#report/trafficsources-referrals/' . MonsterInsights()->auth->get_referral_url() . $this->get_ga_report_range( $data ); |
|
557 | 557 | ?> |
558 | 558 | <div class="monsterinsights-reports-panel-footer"> |
559 | - <a href="<?php echo $referral_url; ?>" target="_blank" title="<?php echo esc_html__( 'View All Referral Resources', 'google-analytics-for-wordpress' );?>" class="monsterinsights-reports-panel-footer-button"><?php echo esc_html__( 'View All Referral Resources', 'google-analytics-for-wordpress' );?></a> |
|
559 | + <a href="<?php echo $referral_url; ?>" target="_blank" title="<?php echo esc_html__( 'View All Referral Resources', 'google-analytics-for-wordpress' ); ?>" class="monsterinsights-reports-panel-footer-button"><?php echo esc_html__( 'View All Referral Resources', 'google-analytics-for-wordpress' ); ?></a> |
|
560 | 560 | </div> |
561 | 561 | </div> |
562 | 562 | </div> |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | <?php if ( ! empty( $data['toppages'] ) ) { ?> |
567 | 567 | <div class="monsterinsights-reports-1-column-row panel row container-fluid nopadding list-no-icons" style="position: relative;"> |
568 | 568 | <div class="monsterinsights-reports-panel-title"> |
569 | - <?php echo esc_html__( 'Top Posts / Pages', 'google-analytics-for-wordpress' );?> |
|
569 | + <?php echo esc_html__( 'Top Posts / Pages', 'google-analytics-for-wordpress' ); ?> |
|
570 | 570 | </div> |
571 | 571 | |
572 | 572 | <div class="monsterinsights-reports-uright-tooltip" data-tooltip-title="<?php echo esc_attr( __( 'Top Posts / Pages', 'google-analytics-for-wordpress' ) ); ?>" data-tooltip-description="<?php echo esc_attr( __( 'This list shows the most viewed posts and pages on your website.', 'google-analytics-for-wordpress' ) ); ?>"></div> |
@@ -574,23 +574,23 @@ discard block |
||
574 | 574 | <ul class="monsterinsights-reports-pages-list list-group"> |
575 | 575 | <?php |
576 | 576 | $i = 1; |
577 | - foreach( $data['toppages'] as $itoppages => $toppagesdata ) { |
|
578 | - $hide = $i > 10 ? ' style="display: none;" ': ''; |
|
577 | + foreach ( $data['toppages'] as $itoppages => $toppagesdata ) { |
|
578 | + $hide = $i > 10 ? ' style="display: none;" ' : ''; |
|
579 | 579 | $protocol = is_ssl() ? 'https://' : 'http://'; |
580 | - $opening = ! empty( $toppagesdata['url'] ) && ! empty( $toppagesdata['hostname'] ) ? '<a href="' . $protocol . esc_attr( $toppagesdata['hostname'] . $toppagesdata['url'] ) .'" target="_blank">' : ''; |
|
580 | + $opening = ! empty( $toppagesdata['url'] ) && ! empty( $toppagesdata['hostname'] ) ? '<a href="' . $protocol . esc_attr( $toppagesdata['hostname'] . $toppagesdata['url'] ) . '" target="_blank">' : ''; |
|
581 | 581 | $closing = ! empty( $opening ) ? '</a>' : ''; |
582 | - echo '<li class="list-group-item monsterinsights-listing-table-row"'. $hide . '>'. |
|
582 | + echo '<li class="list-group-item monsterinsights-listing-table-row"' . $hide . '>' . |
|
583 | 583 | '<span class="monsterinsights-reports-list-count">' |
584 | 584 | . $i . |
585 | - '. </span> '. |
|
585 | + '. </span> ' . |
|
586 | 586 | '<span class="monsterinsights-reports-list-text">' |
587 | 587 | . $opening |
588 | 588 | . $toppagesdata['title'] |
589 | 589 | . $closing . |
590 | - '</span>'. |
|
590 | + '</span>' . |
|
591 | 591 | '<span class="monsterinsights-reports-list-number">' . |
592 | 592 | number_format_i18n( $toppagesdata['sessions'] ) . |
593 | - '</span>'. |
|
593 | + '</span>' . |
|
594 | 594 | '</li>'; |
595 | 595 | $i++; |
596 | 596 | } |
@@ -598,16 +598,16 @@ discard block |
||
598 | 598 | </ul> |
599 | 599 | </div> |
600 | 600 | <?php |
601 | - $referral_url = 'https://analytics.google.com/analytics/web/#report/content-pages/'. MonsterInsights()->auth->get_referral_url() . $this->get_ga_report_range( $data ); |
|
601 | + $referral_url = 'https://analytics.google.com/analytics/web/#report/content-pages/' . MonsterInsights()->auth->get_referral_url() . $this->get_ga_report_range( $data ); |
|
602 | 602 | ?> |
603 | 603 | <div class="monsterinsights-reports-panel-footer monsterinsights-reports-panel-footer-large"> |
604 | - <?php echo esc_html__( 'Show', 'google-analytics-for-wordpress' );?> |
|
605 | - <div class="monsterinsights-reports-show-selector-group btn-group" role="group" aria-label="<?php echo esc_html__( 'How many to show', 'google-analytics-for-wordpress' );?>"> |
|
604 | + <?php echo esc_html__( 'Show', 'google-analytics-for-wordpress' ); ?> |
|
605 | + <div class="monsterinsights-reports-show-selector-group btn-group" role="group" aria-label="<?php echo esc_html__( 'How many to show', 'google-analytics-for-wordpress' ); ?>"> |
|
606 | 606 | <button type="button" data-tid="monsterinsights-report-top-page-list" class="monsterinsights-reports-show-selector-button ten btn btn-default active" disabled="disabled">10</button> |
607 | 607 | <button type="button" data-tid="monsterinsights-report-top-page-list" class="monsterinsights-reports-show-selector-button twentyfive btn btn-default">25</button> |
608 | 608 | <button type="button" data-tid="monsterinsights-report-top-page-list" class="monsterinsights-reports-show-selector-button fifty btn btn-default">50</button> |
609 | 609 | </div> |
610 | - <a href="<?php echo $referral_url; ?>" target="_blank" title="<?php echo esc_html__( 'View Full Post/Page Report', 'google-analytics-for-wordpress' );?>" class="monsterinsights-reports-panel-footer-button alignright" style="margin-right: 20px;"><?php echo esc_html__( 'View Full Post/Page Report', 'google-analytics-for-wordpress' );?></a> |
|
610 | + <a href="<?php echo $referral_url; ?>" target="_blank" title="<?php echo esc_html__( 'View Full Post/Page Report', 'google-analytics-for-wordpress' ); ?>" class="monsterinsights-reports-panel-footer-button alignright" style="margin-right: 20px;"><?php echo esc_html__( 'View Full Post/Page Report', 'google-analytics-for-wordpress' ); ?></a> |
|
611 | 611 | </div> |
612 | 612 | </div> |
613 | 613 | <?php } ?> |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | |
645 | 645 | ob_start(); ?> |
646 | 646 | <div class="monsterinsights-reports-box-datagraph" style="position:relative;"> |
647 | - <canvas id="monsterinsights-overview-<?php echo $class;?>" width="400px" height="400px"></canvas> |
|
647 | + <canvas id="monsterinsights-overview-<?php echo $class; ?>" width="400px" height="400px"></canvas> |
|
648 | 648 | <script> |
649 | 649 | jQuery(document).ready(function() { |
650 | 650 | if ( window.uorigindetected != null){ |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | } |
676 | 676 | }); |
677 | 677 | |
678 | - var ctx = document.getElementById("monsterinsights-overview-<?php echo $class;?>"); |
|
678 | + var ctx = document.getElementById("monsterinsights-overview-<?php echo $class; ?>"); |
|
679 | 679 | var data = { |
680 | 680 | labels: [<?php echo implode( ', ', $labels ); ?>], |
681 | 681 | datasets: [ |
@@ -700,8 +700,8 @@ discard block |
||
700 | 700 | pointHoverRadius: 6,//The radius of the point when hovered. |
701 | 701 | |
702 | 702 | |
703 | - labels: [<?php echo implode( ', ', $labels ); ?>], |
|
704 | - data: [<?php echo implode( ', ', $datapoints ); ?>], |
|
703 | + labels: [<?php echo implode( ', ', $labels ); ?>], |
|
704 | + data: [<?php echo implode( ', ', $datapoints ); ?>], |
|
705 | 705 | trend: [<?php echo implode( ', ', $trendpoints ); ?>], |
706 | 706 | }, |
707 | 707 | ] |
@@ -783,7 +783,7 @@ discard block |
||
783 | 783 | }); |
784 | 784 | }; |
785 | 785 | |
786 | - var MonsterInsightsOverview<?php echo time();?> = new Chart(ctx, { |
|
786 | + var MonsterInsightsOverview<?php echo time(); ?> = new Chart(ctx, { |
|
787 | 787 | type: 'LineWithLine', |
788 | 788 | data: data, |
789 | 789 | plugins: [{ |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | // Outputs the report. |
39 | - protected function get_report_html( $data = array() ){ |
|
39 | + protected function get_report_html( $data = array() ) { |
|
40 | 40 | ob_start(); |
41 | 41 | if ( ! empty( $data['overviewgraph']['count'] ) && $data['overviewgraph']['count'] > 0 ) { |
42 | 42 | ?> |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | foreach( $data['countries'] as $icountry => $countrydata ) { |
509 | 509 | if ( ! empty( $countries[ $countrydata['iso'] ] ) ) { |
510 | 510 | echo '<li class="list-group-item"><span class="monsterinsights-reports-list-count">'. $i .'.</span><span class="monsterinsights-reports-country-flag monsterinsights-flag-icon monsterinsights-flag-icon-' . strtolower( $countrydata['iso'] ) . ' "></span><span class="monsterinsights-reports-list-text">' . $countries[ $countrydata['iso'] ] . '</span><span class="monsterinsights-reports-list-number">' . number_format_i18n( $countrydata['sessions'] ) . '</span></li>'; |
511 | - } else { |
|
511 | + } else { |
|
512 | 512 | echo '<li class="list-group-item"><span class="monsterinsights-reports-list-count">'. $num .'</span><span class="monsterinsights-flag-icon monsterinsights-flag-icon-' . strtolower( $countrydata['iso'] ) . ' "></span><span class="monsterinsights-reports-list-text">' . $countrydata['iso'] . '</span><span class="monsterinsights-reports-list-number">' . number_format_i18n( $countrydata['sessions'] ) . '</span></li>'; |
513 | 513 | } |
514 | 514 | $i++; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $data['usesauth'] = $usesauth; |
97 | 97 | |
98 | 98 | // Retrieve current plugin information |
99 | - if( ! function_exists( 'get_plugins' ) ) { |
|
99 | + if ( ! function_exists( 'get_plugins' ) ) { |
|
100 | 100 | include ABSPATH . '/wp-admin/includes/plugin.php'; |
101 | 101 | } |
102 | 102 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | foreach ( $plugins as $key => $plugin ) { |
107 | 107 | if ( in_array( $plugin, $active_plugins ) ) { |
108 | 108 | // Remove active plugins from list so we can show active and inactive separately |
109 | - unset( $plugins[ $key ] ); |
|
109 | + unset( $plugins[$key] ); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | return false; |
125 | 125 | } |
126 | 126 | |
127 | - if( ! $this->tracking_allowed() && ! $override ) { |
|
127 | + if ( ! $this->tracking_allowed() && ! $override ) { |
|
128 | 128 | return false; |
129 | 129 | } |
130 | 130 | |
@@ -156,15 +156,15 @@ discard block |
||
156 | 156 | public function schedule_send() { |
157 | 157 | if ( ! wp_next_scheduled( 'monsterinsights_usage_tracking_cron' ) ) { |
158 | 158 | $tracking = array(); |
159 | - $tracking['day'] = rand( 0, 6 ); |
|
159 | + $tracking['day'] = rand( 0, 6 ); |
|
160 | 160 | $tracking['hour'] = rand( 0, 23 ); |
161 | 161 | $tracking['minute'] = rand( 0, 59 ); |
162 | 162 | $tracking['second'] = rand( 0, 59 ); |
163 | - $tracking['offset'] = ( $tracking['day'] * DAY_IN_SECONDS ) + |
|
164 | - ( $tracking['hour'] * HOUR_IN_SECONDS ) + |
|
163 | + $tracking['offset'] = ( $tracking['day'] * DAY_IN_SECONDS ) + |
|
164 | + ( $tracking['hour'] * HOUR_IN_SECONDS ) + |
|
165 | 165 | ( $tracking['minute'] * MINUTE_IN_SECONDS ) + |
166 | 166 | $tracking['second']; |
167 | - $tracking['initsend'] = strtotime("next sunday") + $tracking['offset']; |
|
167 | + $tracking['initsend'] = strtotime( "next sunday" ) + $tracking['offset']; |
|
168 | 168 | |
169 | 169 | wp_schedule_event( $tracking['initsend'], 'weekly', 'monsterinsights_usage_tracking_cron' ); |
170 | 170 | update_option( 'monsterinsights_usage_tracking_config', $tracking ); |