AdSense Plugin WP QUADS - Version 1.5.8

Version Description

  • New: Compatible to all AMP plugin, not limited only to automattics AMP plugin
Download this release

Release Info

Developer ReneHermi
Plugin Icon 128x128 AdSense Plugin WP QUADS
Version 1.5.8
Comparing to
See all releases

Code changes from version 1.5.3 to 1.5.8

assets/css/quads.css CHANGED
@@ -1,10 +1 @@
1
- /*
2
- To change this license header, choose License Headers in Project Properties.
3
- To change this template file, choose Tools | Templates
4
- @version
5
- */
6
- /*
7
- Created on : 20.10.2016, 10:37:23
8
- Author : IronMan
9
- */
10
-
1
+ /* Silence */
 
 
 
 
 
 
 
 
 
includes/Cron/Cron.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Chron relevant stuff
5
+ */
6
+
7
+ // No Direct Access
8
+ if( !defined( "WPINC" ) ) {
9
+ die;
10
+ }
11
+
12
+ class quadsCron {
13
+
14
+ public function __construct() {
15
+ add_filter( 'cron_schedules', array($this, 'add_new_intervals') );
16
+ }
17
+
18
+ /**
19
+ * Add new intervals for wp cron jobs
20
+ * @param type $schedules
21
+ * @return type
22
+ */
23
+ public function add_new_intervals( $schedules ) {
24
+ // add weekly and monthly intervals
25
+ $schedules['weekly'] = array(
26
+ 'interval' => 604800,
27
+ 'display' => __( 'Once Weekly' )
28
+ );
29
+
30
+ $schedules['monthly'] = array(
31
+ 'interval' => 2635200,
32
+ 'display' => __( 'Once a month' )
33
+ );
34
+
35
+ return $schedules;
36
+ }
37
+
38
+ public function schedule_event() {
39
+ if( !wp_next_scheduled( 'quads_weekly_event' ) ) {
40
+ wp_schedule_event( time(), 'weekly', 'quads_weekly_event' );
41
+ }
42
+ }
43
+ }
44
+
45
+ $quadsCron = new quadsCron();
includes/admin/admin-footer.php CHANGED
@@ -24,7 +24,7 @@ function quads_admin_rate_us( $footer_text ) {
24
  global $typenow;
25
 
26
  if ( quads_is_admin_page() ) {
27
- $rate_text = sprintf( __( '<strong>Please do us a BIG favor and give us a 5 star rating <a href="%1$s" target="_blank">here</a> . If you`re not happy, please open a <a href="%2s" target="_blank">support ticket</a>, so that we can sort it out. Thank you!</strong>', 'quick-adsense-reloaded' ),
28
  'https://wordpress.org/support/plugin/quick-adsense-reloaded/reviews/?filter=5#new-post',
29
  'http://wpquads.com/support/'
30
  );
24
  global $typenow;
25
 
26
  if ( quads_is_admin_page() ) {
27
+ $rate_text = sprintf( __( '<strong>Please do us a BIG favor and give us a 5 star rating <a href="%1$s" target="_blank">here</a>. If you have issues, open a <a href="%2s" target="_blank">support ticket</a>, so that we can sort it out. Thank you!</strong>', 'quick-adsense-reloaded' ),
28
  'https://wordpress.org/support/plugin/quick-adsense-reloaded/reviews/?filter=5#new-post',
29
  'http://wpquads.com/support/'
30
  );
includes/admin/admin-notices.php CHANGED
@@ -35,7 +35,7 @@ function quads_admin_messages() {
35
  quads_update_notice_1_5_3();
36
 
37
  if( quads_is_admin_page() ) {
38
- echo '<div class="notice notice-error" id="wpquads-adblock-notice" style="display:none;">' . sprintf( __( '<strong><p>Your ad blocker browser extension is removing WP QUADS ressources and is breaking this settings screen! Deactivate adblock for this website and you are good! WP QUADS is used on 40.000 websites and is into focus of the big adblocking companies. That\'s the downside of our success but nothing you need to worry about. </strong></p>', 'quick-adsense-reloaded' ), admin_url() . 'admin.php?page=quads-settings#quads_settingsgeneral_header' ) . '</div>';
39
  }
40
 
41
  if( !quads_is_any_ad_activated() && quads_is_admin_page() ) {
@@ -61,8 +61,8 @@ function quads_admin_messages() {
61
  $datetime2 = new DateTime( $display_date );
62
  $diff_intrval = round( ($datetime2->format( 'U' ) - $datetime1->format( 'U' )) / (60 * 60 * 24) );
63
 
64
-
65
- if( $diff_intrval >= 7 && get_option( 'quads_rating_div' ) == "no" || false === get_option( 'quads_rating_div' ) || quads_rate_again() ) {
66
  echo '<div class="quads_fivestar updated " style="box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);background-color:white;">
67
  <p>Awesome, you\'ve been using <strong>WP QUADS</strong> for more than 1 week. <br> May i ask you to give it a <strong>5-star rating</strong> on Wordpress? </br>
68
  This will help to spread its popularity and to make this plugin a better one.
@@ -146,7 +146,6 @@ function quads_hide_rating_div() {
146
  echo json_encode( array("success") );
147
  exit;
148
  }
149
-
150
  add_action( 'wp_ajax_quads_hide_rating', 'quads_hide_rating_div' );
151
 
152
  /**
@@ -265,7 +264,7 @@ function quads_update_notice() {
265
  function quads_update_notice_v2(){
266
 
267
  if( quads_is_pro_active() && (version_compare( QUADS_PRO_VERSION, '1.3.6', '<' ) ) ) {
268
- $message = sprintf( __( 'You need to update <strong>WP QUADS PRO to version 1.3.6</strong> or higher. Your version of <strong>WP QUADS Pro</strong> is '.QUADS_PRO_VERSION. '.<br>WP QUADS Pro '.QUADS_PRO_VERSION.' allows unlimited amount of ads. <br>Updating requires a valid <a href="%s" target="_new">license key</a>.', 'quick-adsense-reloaded' ), 'https://wpquads.com/#buy-wpquads?utm_source=plugin_notice&utm_medium=admin&utm_campaign=activate_license' );
269
  ?>
270
  <div class="notice notice-error">
271
  <p><?php echo $message; ?></p>
@@ -274,7 +273,7 @@ function quads_update_notice_v2(){
274
  }
275
 
276
  /**
277
- * Show upgrade notice after updating from 1.5.2 to 1.5.3
278
  * @return boolean
279
  */
280
  function quads_update_notice_1_5_3(){
@@ -288,10 +287,10 @@ function quads_update_notice_1_5_3(){
288
 
289
  //wp_die(QUADS_VERSION);
290
 
291
-
292
- if( !empty($previous_version) && QUADS_VERSION == '1.5.3' ) {
293
 
294
- $message = sprintf( __( 'This is a huge update! The data structure of WP QUADS has been modified and improved for better performance and great new features. <br> For the case you\'d experience any issues, we made a <a href="%1s" target="_self">backup of previous WP QUADS data</a>. So you can <a href="%2s" target="_new">switch back to the previous version</a> anytime. <br><br>Please <a href="%3s" target="_new">open first a support ticket</a> if you experience any issue.', 'quick-adsense-reloaded' ), admin_url() . '?page=quads-settings&tab=help', 'https://wpquads.com/docs/install-older-plugin-version/?utm_source=plugin_notice&utm_medium=admin&utm_campaign=install_older_version', 'https://wordpress.org/support/plugin/quick-adsense-reloaded' );
295
  ?>
296
  <div class="notice notice-error">
297
  <p><?php echo $message; ?></p>
35
  quads_update_notice_1_5_3();
36
 
37
  if( quads_is_admin_page() ) {
38
+ echo '<div class="notice notice-error" id="wpquads-adblock-notice" style="display:none;">' . sprintf( __( '<strong><p>You need to deactivate your ad blocker to use WP QUADS settings.</strong> Your ad blocker browser extension is removing WP QUADS css ressources and is breaking the settings screen! Deactivating the ad blocker will resolve it. WP QUADS is used on 60.000 websites and is into focus of the big adblocking companies. That\'s the downside of our success but nothing you need to worry about.</p>', 'quick-adsense-reloaded' ), admin_url() . 'admin.php?page=quads-settings#quads_settingsgeneral_header' ) . '</div>';
39
  }
40
 
41
  if( !quads_is_any_ad_activated() && quads_is_admin_page() ) {
61
  $datetime2 = new DateTime( $display_date );
62
  $diff_intrval = round( ($datetime2->format( 'U' ) - $datetime1->format( 'U' )) / (60 * 60 * 24) );
63
 
64
+ $rate = get_option( 'quads_rating_div', false);
65
+ if( $diff_intrval >= 7 && ($rate === "no" || false === $rate || quads_rate_again() ) ) {
66
  echo '<div class="quads_fivestar updated " style="box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);background-color:white;">
67
  <p>Awesome, you\'ve been using <strong>WP QUADS</strong> for more than 1 week. <br> May i ask you to give it a <strong>5-star rating</strong> on Wordpress? </br>
68
  This will help to spread its popularity and to make this plugin a better one.
146
  echo json_encode( array("success") );
147
  exit;
148
  }
 
149
  add_action( 'wp_ajax_quads_hide_rating', 'quads_hide_rating_div' );
150
 
151
  /**
264
  function quads_update_notice_v2(){
265
 
266
  if( quads_is_pro_active() && (version_compare( QUADS_PRO_VERSION, '1.3.6', '<' ) ) ) {
267
+ $message = sprintf( __( 'You need to update <strong>WP QUADS PRO to version 1.3.6</strong> or higher. Your version of <strong>WP QUADS Pro</strong> is '.QUADS_PRO_VERSION. '.<br>WP QUADS Pro '.QUADS_PRO_VERSION.' supports unlimited amount of ads. <br>Updating requires a valid <a href="%s" target="_new">license key</a>.', 'quick-adsense-reloaded' ), 'https://wpquads.com/#buy-wpquads?utm_source=plugin_notice&utm_medium=admin&utm_campaign=activate_license' );
268
  ?>
269
  <div class="notice notice-error">
270
  <p><?php echo $message; ?></p>
273
  }
274
 
275
  /**
276
+ * Show upgrade notice after updating from 1.5.2 to 1.5.3 and higher
277
  * @return boolean
278
  */
279
  function quads_update_notice_1_5_3(){
287
 
288
  //wp_die(QUADS_VERSION);
289
 
290
+ // Show update message if previous version was lower than 1.7 - This makes sure that the message is shown for future updates without complicated version number conditions
291
+ if( !empty($previous_version) && version_compare( QUADS_VERSION, '1.7.0', '<=' ) ) {
292
 
293
+ $message = sprintf( __( 'This is a huge update! The data structure of WP QUADS has been modified and improved for better performance and great new features. <br> For the case you\'d experience issues, we made a <a href="%1s" target="_self">backup of previous WP QUADS data</a>. So you can <a href="%2s" target="_new">switch back to the previous version</a> anytime. <br><br>Please <a href="%3s" target="_new">open first a support ticket</a> if you experience any issue.', 'quick-adsense-reloaded' ), admin_url() . '?page=quads-settings&tab=help', 'https://wpquads.com/docs/install-older-plugin-version/?utm_source=plugin_notice&utm_medium=admin&utm_campaign=install_older_version', 'https://wordpress.org/support/plugin/quick-adsense-reloaded' );
294
  ?>
295
  <div class="notice notice-error">
296
  <p><?php echo $message; ?></p>
includes/admin/settings/display-settings.php CHANGED
@@ -230,22 +230,25 @@ function quads_options_page() {
230
  <?php settings_errors(); ?>
231
  <?php
232
  // do not show save button on add-on page
233
- if ($active_tab !== 'addons'){
234
  $other_attributes = array( 'id' => 'quads-submit-button' );
235
  submit_button(null, 'primary', 'quads-save-settings' , true, $other_attributes );
 
236
  ?>
237
  <a href="<?php echo admin_url() . '/admin.php?page=quads-settings&quads-action=validate'; ?> " id="quads-validate"><?php _e('Validate Ad Settings','quick-adsense-reloaded')?></a>
238
  <?php
 
 
239
  }
240
  ?>
241
  </form>
242
  <?php
243
  if ($active_tab !== 'addons' && $active_tab !== 'licenses'){
244
- echo sprintf( __( '<strong>If you like this plugin please do us a BIG favor and give us a 5 star rating <a href="%s" target="_blank">here</a> . If you`re not happy, please open a <a href="%2s" target="_blank">support ticket</a>, so that we can sort it out. Thank you!</strong>', 'quick-adsense-reloaded' ),
245
  'https://wordpress.org/support/plugin/quick-adsense-reloaded/reviews/#new-post',
246
  'http://wpquads.com/support/'
247
  );
248
- echo '<p>' . sprintf( __( '<strong>Ads are not showing? Read the <a href="%s" target="_blank">troubleshooting guide</a> to find out how to resolve this issue.', 'quick-adsense-reloaded' ),
249
  'http://wpquads.com/docs/adsense-ads-are-not-showing/?utm_source=plugin&utm_campaign=wpquads-settings&utm_medium=website&utm_term=bottomlink'
250
  );
251
  }
230
  <?php settings_errors(); ?>
231
  <?php
232
  // do not show save button on add-on page
233
+ if ($active_tab !== 'addons' && $active_tab !== 'imexport' && $active_tab !== 'help'){
234
  $other_attributes = array( 'id' => 'quads-submit-button' );
235
  submit_button(null, 'primary', 'quads-save-settings' , true, $other_attributes );
236
+ if ($active_tab !== 'licenses'){
237
  ?>
238
  <a href="<?php echo admin_url() . '/admin.php?page=quads-settings&quads-action=validate'; ?> " id="quads-validate"><?php _e('Validate Ad Settings','quick-adsense-reloaded')?></a>
239
  <?php
240
+ }
241
+
242
  }
243
  ?>
244
  </form>
245
  <?php
246
  if ($active_tab !== 'addons' && $active_tab !== 'licenses'){
247
+ echo sprintf( __( '<strong>If you like this plugin please do us a BIG favor and give us a 5 star rating <a href="%s" target="_blank">here</a> . If you have issues, open a <a href="%2s" target="_blank">support ticket</a>, so that we can sort it out. Thank you!</strong>', 'quick-adsense-reloaded' ),
248
  'https://wordpress.org/support/plugin/quick-adsense-reloaded/reviews/#new-post',
249
  'http://wpquads.com/support/'
250
  );
251
+ echo '<p>' . sprintf( __( '<strong>Ads are not showing? Read the <a href="%s" target="_blank">troubleshooting guide</a> to find out how to resolve it.', 'quick-adsense-reloaded' ),
252
  'http://wpquads.com/docs/adsense-ads-are-not-showing/?utm_source=plugin&utm_campaign=wpquads-settings&utm_medium=website&utm_term=bottomlink'
253
  );
254
  }
includes/admin/settings/register-settings.php CHANGED
@@ -130,9 +130,9 @@ function quads_get_registered_settings() {
130
  'id' => 'maxads',
131
  'name' => __( 'Limit Amount of ads:', 'quick-adsense-reloaded' ),
132
  'desc' => __( ' ads on a page.', 'quick-adsense-reloaded' ),
133
- 'desc2' => sprintf( __( '<a href="%s" target="_blank">Read here</a> to learn how many AdSense ads are allowed. If you are unsure select 3 ads.', 'quick-adsense-reloaded' ), 'http://wpquads.com/google-adsense-allowed-number-ads/' ),
134
  'type' => 'select',
135
- 'std' => 3,
136
  'options' => array(
137
  1 => '1',
138
  2 => '2',
@@ -196,9 +196,9 @@ function quads_get_registered_settings() {
196
  'desc' => '<div class="adsense_admin_header">' . sprintf( __( 'Enter your ad codes below:</div>'
197
  . '<ul style="margin-top:10px;">'
198
  . '<li style="font-weight:600;">Select <i>AdSense</i> if you are using AdSense!</li>'
199
- . '<li style="font-weight:600;">Use <i>Plain Text / HTML / JS</i> for all other ads! <br><strong>Caution:</strong> Adding AdSense code into Plain text field can result in non visible ads!</li></ul>', 'quick-adsense-reloaded' ), 'http://wpquads.com/effective-adsense-banner-size-formats/?utm_campaign=plugin&utm_source=general_tab&utm_medium=admin&utm_content=best_banner_sizes' )
200
  . '</ul>'
201
- . '<div style="clear:both;">' . sprintf( __( '<strong>Ads are not showing? Read the <a href="%s" target="_blank">troubleshooting guide</a> to find out how to resolve this issue.', 'quick-adsense-reloaded' ), 'http://wpquads.com/docs/adsense-ads-are-not-showing/?utm_source=plugin&utm_campaign=wpquads-settings&utm_medium=website&utm_term=toplink' ) . ''
202
  . '<br><a href="%s" target="_blank">Read here</a> to find out the most effective AdSense banner sizes. </div>'
203
  . '<div id="quads-open-toggle" class="button">' . __( 'Open All Ads', 'quick-adsense-reloaded' ) . '</div>',
204
  'type' => 'header'
@@ -576,7 +576,7 @@ function quads_get_settings_tabs() {
576
  }
577
 
578
 
579
- if( !empty( $settings['licenses'] ) && quads_is_extra() ) {
580
  $tabs['licenses'] = __( 'Licenses', 'quick-adsense-reloaded' );
581
  }
582
 
@@ -1058,13 +1058,19 @@ function quads_upload_callback( $args ) {
1058
 
1059
 
1060
  /**
1061
- * Check if extra settings are available
1062
  *
1063
  * @return boolean
1064
  */
1065
  function quads_is_extra() {
 
 
 
 
 
 
1066
  if( function_exists( 'quads_extra' ) ) {
1067
- return quads_extra();
1068
  }
1069
  return false;
1070
  }
@@ -1419,8 +1425,21 @@ function quads_log_permissions() {
1419
  function quads_get_ads() {
1420
  global $quads_options;
1421
 
1422
- if (!isset($quads_options['ads']) && 0 === count( $quads_options['ads'] ) ) {
1423
- return array();
 
 
 
 
 
 
 
 
 
 
 
 
 
1424
  }
1425
 
1426
  // Start array with
@@ -1672,7 +1691,9 @@ function quads_count_normal_ads() {
1672
  }
1673
 
1674
  function quads_new_ad_callback(){
 
1675
  echo '<a href="#" id="quads-add-new-ad">' . __('Add New Ad','quick-adsense-reloaded') . '</a>';
 
1676
  }
1677
 
1678
  /**
@@ -1788,8 +1809,8 @@ function quads_adsense_code_callback( $args ) {
1788
  </div>
1789
  <textarea style="vertical-align:top;margin-right:20px;" class="large-text quads-textarea" cols="50" rows="10" id="quads_settings[ads][<?php echo $id; ?>][code]" name="quads_settings[ads][<?php echo $id; ?>][code]"><?php echo esc_textarea( stripslashes( $code ) ); ?></textarea>
1790
  <!--<label for="quads_settings[ads][ <?php //echo $id; ?> ][code]"> <?php //echo $args['desc']; ?></label><br>//-->
1791
- <label for="quads_shortcode_<?php echo $args['id'];?>">Post Shortcode:</label><input readonly id="quads_shortcode_<?php echo $args['id'];?>" type="text" onclick="this.focus(); this.select()" value='[quads id=<?php echo $args['id'];?>]' title="Copy and paste the shortcode into the post editor, click below then press Ctrl + C (PC) or Cmd + C (Mac).">
1792
- <label for="quads_php_shortcode_<?php echo $args['id'];?>">PHP:</label><input readonly id="quads_php_shortcode_<?php echo $args['id'];?>" type="text" onclick="this.focus(); this.select()" style="width:290px;" value="&lt;?php echo do_shortcode('[quads id=<?php echo $args['id']; ?>]'); ?&gt;" title="Copy and paste the PHP code into your theme files, click below then press Ctrl + C (PC) or Cmd + C (Mac).">
1793
  <br>
1794
  <div class="quads_adsense_code">
1795
  <input type="button" style="vertical-align:inherit;" class="button button-primary quads-add-adsense" value="Copy / Paste AdSense Code"> <span>or add Ad Slot ID & Publisher ID manually below:</span>
130
  'id' => 'maxads',
131
  'name' => __( 'Limit Amount of ads:', 'quick-adsense-reloaded' ),
132
  'desc' => __( ' ads on a page.', 'quick-adsense-reloaded' ),
133
+ 'desc2' => sprintf( __( '<a href="%s" target="_blank">Read here</a> to learn how many AdSense ads are allowed. If you are unsure set the value to unlimited.', 'quick-adsense-reloaded' ), 'http://wpquads.com/google-adsense-allowed-number-ads/' ),
134
  'type' => 'select',
135
+ 'std' => 100,
136
  'options' => array(
137
  1 => '1',
138
  2 => '2',
196
  'desc' => '<div class="adsense_admin_header">' . sprintf( __( 'Enter your ad codes below:</div>'
197
  . '<ul style="margin-top:10px;">'
198
  . '<li style="font-weight:600;">Select <i>AdSense</i> if you are using AdSense!</li>'
199
+ . '<li style="font-weight:600;">Use <i>Plain Text / HTML / JS</i> for all other ads! <br><strong>Caution:</strong> Adding AdSense code into <i>Plain Text</i> option can result in non-displayed ads!</li></ul>', 'quick-adsense-reloaded' ), 'http://wpquads.com/effective-adsense-banner-size-formats/?utm_campaign=plugin&utm_source=general_tab&utm_medium=admin&utm_content=best_banner_sizes' )
200
  . '</ul>'
201
+ . '<div style="clear:both;">' . sprintf( __( '<strong>Ads are not showing? Read the <a href="%s" target="_blank">troubleshooting guide</a> to find out how to resolve it.', 'quick-adsense-reloaded' ), 'http://wpquads.com/docs/adsense-ads-are-not-showing/?utm_source=plugin&utm_campaign=wpquads-settings&utm_medium=website&utm_term=toplink' ) . ''
202
  . '<br><a href="%s" target="_blank">Read here</a> to find out the most effective AdSense banner sizes. </div>'
203
  . '<div id="quads-open-toggle" class="button">' . __( 'Open All Ads', 'quick-adsense-reloaded' ) . '</div>',
204
  'type' => 'header'
576
  }
577
 
578
 
579
+ if( !empty( $settings['licenses'] ) && quads_is_extra() || quads_is_advanced() ) {
580
  $tabs['licenses'] = __( 'Licenses', 'quick-adsense-reloaded' );
581
  }
582
 
1058
 
1059
 
1060
  /**
1061
+ * Check if extra settings are available and activated
1062
  *
1063
  * @return boolean
1064
  */
1065
  function quads_is_extra() {
1066
+
1067
+ $lic = get_option( 'quads_wp_quads_pro_license_active' );
1068
+ if( !$lic || (is_object( $lic ) && $lic->success !== true) ) {
1069
+ return false;
1070
+ }
1071
+
1072
  if( function_exists( 'quads_extra' ) ) {
1073
+ return true;
1074
  }
1075
  return false;
1076
  }
1425
  function quads_get_ads() {
1426
  global $quads_options;
1427
 
1428
+ if (!isset($quads_options['ads']) || ( isset($quads_options['ads']) && count( $quads_options['ads'] ) === 0) ) {
1429
+ $ads = array(
1430
+ 0 => __( 'Random Ads', 'quick-adsense-reloaded' ),
1431
+ 1 => isset( $quads_options['ads']['ad1']['label'] ) ? $quads_options['ads']['ad1']['label'] : 'ad1',
1432
+ 2 => isset( $quads_options['ads']['ad2']['label'] ) ? $quads_options['ads']['ad2']['label'] : 'ad2',
1433
+ 3 => isset( $quads_options['ads']['ad3']['label'] ) ? $quads_options['ads']['ad3']['label'] : 'ad3',
1434
+ 4 => isset( $quads_options['ads']['ad4']['label'] ) ? $quads_options['ads']['ad4']['label'] : 'ad4',
1435
+ 5 => isset( $quads_options['ads']['ad5']['label'] ) ? $quads_options['ads']['ad5']['label'] : 'ad5',
1436
+ 6 => isset( $quads_options['ads']['ad6']['label'] ) ? $quads_options['ads']['ad6']['label'] : 'ad6',
1437
+ 7 => isset( $quads_options['ads']['ad7']['label'] ) ? $quads_options['ads']['ad7']['label'] : 'ad7',
1438
+ 8 => isset( $quads_options['ads']['ad8']['label'] ) ? $quads_options['ads']['ad8']['label'] : 'ad8',
1439
+ 9 => isset( $quads_options['ads']['ad9']['label'] ) ? $quads_options['ads']['ad9']['label'] : 'ad9',
1440
+ 10 => isset( $quads_option['ads']['ad10']['label'] ) ? $quads_options['ads']['ad10']['label'] : 'ad10',
1441
+ );
1442
+ return $ads;
1443
  }
1444
 
1445
  // Start array with
1691
  }
1692
 
1693
  function quads_new_ad_callback(){
1694
+ if (quads_is_extra()) {
1695
  echo '<a href="#" id="quads-add-new-ad">' . __('Add New Ad','quick-adsense-reloaded') . '</a>';
1696
+ }
1697
  }
1698
 
1699
  /**
1809
  </div>
1810
  <textarea style="vertical-align:top;margin-right:20px;" class="large-text quads-textarea" cols="50" rows="10" id="quads_settings[ads][<?php echo $id; ?>][code]" name="quads_settings[ads][<?php echo $id; ?>][code]"><?php echo esc_textarea( stripslashes( $code ) ); ?></textarea>
1811
  <!--<label for="quads_settings[ads][ <?php //echo $id; ?> ][code]"> <?php //echo $args['desc']; ?></label><br>//-->
1812
+ <label for="quads_shortcode_<?php echo $args['id'];?>">Post Shortcode:</label><input readonly id="quads_shortcode_<?php echo $args['id'];?>" type="text" onclick="this.focus(); this.select()" value='[quads id=<?php echo $args['id'];?>]' title="Optional: Copy and paste the shortcode into the post editor, click below then press Ctrl + C (PC) or Cmd + C (Mac).">
1813
+ <label for="quads_php_shortcode_<?php echo $args['id'];?>">PHP:</label><input readonly id="quads_php_shortcode_<?php echo $args['id'];?>" type="text" onclick="this.focus(); this.select()" style="width:290px;" value="&lt;?php echo do_shortcode('[quads id=<?php echo $args['id']; ?>]'); ?&gt;" title="Optional: Copy and paste the PHP code into your theme files, click below then press Ctrl + C (PC) or Cmd + C (Mac).">
1814
  <br>
1815
  <div class="quads_adsense_code">
1816
  <input type="button" style="vertical-align:inherit;" class="button button-primary quads-add-adsense" value="Copy / Paste AdSense Code"> <span>or add Ad Slot ID & Publisher ID manually below:</span>
includes/admin/tools.php CHANGED
@@ -158,7 +158,7 @@ function quads_tools_import_export_process_export() {
158
  ignore_user_abort( true );
159
 
160
  if ( ! quads_is_func_disabled( 'set_time_limit' ) )
161
- set_time_limit( 0 );
162
 
163
  nocache_headers();
164
  header( 'Content-Type: application/json; charset=utf-8' );
158
  ignore_user_abort( true );
159
 
160
  if ( ! quads_is_func_disabled( 'set_time_limit' ) )
161
+ @set_time_limit( 0 );
162
 
163
  nocache_headers();
164
  header( 'Content-Type: application/json; charset=utf-8' );
includes/admin/upgrades/upgrade-functions.php CHANGED
@@ -24,6 +24,10 @@ function quads_do_automatic_upgrades() {
24
  $did_upgrade = false;
25
  // Get current installed version
26
  $quads_version = preg_replace( '/[^0-9.].*/', '', get_option( 'quads_version' ) );
 
 
 
 
27
 
28
  // if( version_compare( $quads_version, '1.2.5', '<' ) ) {
29
  // quads_store_adsense_args();
@@ -36,10 +40,10 @@ function quads_do_automatic_upgrades() {
36
  quads_is_commercial_theme();
37
  }
38
 
39
- if( version_compare( $quads_version, '1.5.3', '<' ) ) {
40
- quads_update_settings();
41
- //quads_store_adsense_args();
42
- quads_is_commercial_theme();
43
  }
44
 
45
 
@@ -49,26 +53,25 @@ function quads_do_automatic_upgrades() {
49
  $did_upgrade = true;
50
  }
51
 
52
- // Update Version number
53
- if( $did_upgrade ) {
54
- update_option( 'quads_version', preg_replace( '/[^0-9.].*/', '', QUADS_VERSION ) );
55
  }
56
  }
57
  add_action( 'admin_init', 'quads_do_automatic_upgrades' );
58
 
59
  /**
60
- * Update Settings for version 1.5.3
61
  * Add new index $settings['ads']
62
  */
63
- function quads_update_settings(){
64
  $settings = get_option( 'quads_settings' );
65
 
66
  // Do not update - we already did it
67
  if (isset($settings['ads'])){
68
- //wp_die('already updated');
69
  return false;
70
  }
71
- //wp_die('update it');
72
 
73
  foreach ( $settings as $key => $value ) {
74
 
24
  $did_upgrade = false;
25
  // Get current installed version
26
  $quads_version = preg_replace( '/[^0-9.].*/', '', get_option( 'quads_version' ) );
27
+
28
+ // Previous version
29
+ $previous_version = get_option( 'quads_version_upgraded_from' );
30
+
31
 
32
  // if( version_compare( $quads_version, '1.2.5', '<' ) ) {
33
  // quads_store_adsense_args();
40
  quads_is_commercial_theme();
41
  }
42
 
43
+ // Update settings - Try to do this after any update
44
+ if( version_compare( $quads_version, QUADS_VERSION, '<=' )) {
45
+ quads_update_settings_1_5_3();
46
+ quads_is_commercial_theme();
47
  }
48
 
49
 
53
  $did_upgrade = true;
54
  }
55
 
56
+ // Update Current Version number
57
+ if( $did_upgrade ) {
58
+ update_option( 'quads_version', preg_replace( '/[^0-9.].*/', '', QUADS_VERSION ) );
59
  }
60
  }
61
  add_action( 'admin_init', 'quads_do_automatic_upgrades' );
62
 
63
  /**
64
+ * Update Settings for version 1.5.3 and higher
65
  * Add new index $settings['ads']
66
  */
67
+ function quads_update_settings_1_5_3(){
68
  $settings = get_option( 'quads_settings' );
69
 
70
  // Do not update - we already did it
71
  if (isset($settings['ads'])){
72
+ //wp_die('test');
73
  return false;
74
  }
 
75
 
76
  foreach ( $settings as $key => $value ) {
77
 
includes/class-quads-license-handler.php CHANGED
@@ -24,8 +24,7 @@ class QUADS_License {
24
  private $version;
25
  private $author;
26
  private $api_url = 'http://wpquads.com/edd-sl-api/'; // production
27
- //private $api_url = 'https://www.mashshare.net/edd-sl-api/'; // production
28
- private $api_url_debug = 'http://src.wordpress-develop.dev/edd-sl-api/'; // development
29
  /**
30
  * Class constructor
31
  *
@@ -107,7 +106,7 @@ class QUADS_License {
107
  add_action( 'admin_init', array( $this, 'deactivate_license' ) );
108
 
109
  // Check that license is valid once per week
110
- add_action( 'quads_weekly_scheduled_events', array( $this, 'weekly_license_check' ) );
111
 
112
  // For testing license notices, uncomment this line to force checks on every page load
113
  //add_action( 'admin_init', array( $this, 'weekly_license_check' ) );
@@ -411,14 +410,19 @@ class QUADS_License {
411
  $messages = array();
412
 
413
  $license = get_option( $this->item_shortname . '_license_active' );
 
 
 
414
 
415
  if( is_object( $license ) && 'valid' !== $license->license && empty( $showed_invalid_message ) ) {
416
 
417
  if( empty( $_GET['tab'] ) || 'licenses' !== $_GET['tab'] ) {
418
 
419
  $messages[] = sprintf(
420
- __( 'You have invalid or expired license keys for WPQUADS PRO. Please go to the <a href="%s" title="Go to Licenses page">Licenses page</a> to correct this issue.', 'quick-adsense-reloaded' ),
421
- admin_url( 'admin.php?page=quads-settings&tab=licenses' )
 
 
422
  );
423
 
424
  $showed_invalid_message = true;
24
  private $version;
25
  private $author;
26
  private $api_url = 'http://wpquads.com/edd-sl-api/'; // production
27
+ private $api_url_debug = 'http://src.wordpress-develop.dev/edd-sl-api/'; // development
 
28
  /**
29
  * Class constructor
30
  *
106
  add_action( 'admin_init', array( $this, 'deactivate_license' ) );
107
 
108
  // Check that license is valid once per week
109
+ add_action( 'quads_weekly_event', array( $this, 'weekly_license_check' ) );
110
 
111
  // For testing license notices, uncomment this line to force checks on every page load
112
  //add_action( 'admin_init', array( $this, 'weekly_license_check' ) );
410
  $messages = array();
411
 
412
  $license = get_option( $this->item_shortname . '_license_active' );
413
+
414
+ $licensekey = empty( $quads_options['quads_wp_quads_pro_license_key'] ) ? '' : $quads_options['quads_wp_quads_pro_license_key'];
415
+
416
 
417
  if( is_object( $license ) && 'valid' !== $license->license && empty( $showed_invalid_message ) ) {
418
 
419
  if( empty( $_GET['tab'] ) || 'licenses' !== $_GET['tab'] ) {
420
 
421
  $messages[] = sprintf(
422
+ __( 'You have invalid or expired license keys for WPQUADS PRO. Go to the <a href="%s" title="Go to Licenses page">Licenses page</a> to correct this issue or <a href="%1s" target="_new">Renew your license key</a>.', 'quick-adsense-reloaded' ),
423
+ admin_url( 'admin.php?page=quads-settings&tab=licenses' ),
424
+ 'https://wpquads.com/checkout/?edd_license_key=' . $licensekey . '&download_id=11'
425
+
426
  );
427
 
428
  $showed_invalid_message = true;
includes/conditions.php CHANGED
@@ -31,7 +31,7 @@ function quads_ad_is_allowed( $content = null ) {
31
  }
32
 
33
  // Frontpage check
34
- if (is_front_page() && isset( $quads_options['visibility']['AppHome'] ) ){
35
  return true;
36
  }
37
 
@@ -41,6 +41,7 @@ function quads_ad_is_allowed( $content = null ) {
41
  (is_404() ) ||
42
  (strpos( $content, '<!--NoAds-->' ) !== false) ||
43
  (strpos( $content, '<!--OffAds-->' ) !== false) ||
 
44
  (is_category() && !(isset( $quads_options['visibility']['AppCate'] ) ) ) ||
45
  (is_archive() && !( isset( $quads_options['visibility']['AppArch'] ) ) ) ||
46
  (is_tag() && !( isset( $quads_options['visibility']['AppTags'] ) ) ) ||
31
  }
32
 
33
  // Frontpage check
34
+ if (is_front_page() && isset( $quads_options['visibility']['AppHome'] ) ){
35
  return true;
36
  }
37
 
41
  (is_404() ) ||
42
  (strpos( $content, '<!--NoAds-->' ) !== false) ||
43
  (strpos( $content, '<!--OffAds-->' ) !== false) ||
44
+ (is_front_page() && !isset( $quads_options['visibility']['AppHome'] ) ) ||
45
  (is_category() && !(isset( $quads_options['visibility']['AppCate'] ) ) ) ||
46
  (is_archive() && !( isset( $quads_options['visibility']['AppArch'] ) ) ) ||
47
  (is_tag() && !( isset( $quads_options['visibility']['AppTags'] ) ) ) ||
includes/frontend-checks.php CHANGED
@@ -215,12 +215,12 @@ function quads_check_the_content_filter( $content ) {
215
  */
216
  function quads_check_adblocker() {
217
  ?>
218
- <!--noptimize--><style>.quads-hidden { display: none; } .quads-adminbar-is-warnings { background: #ef4000 ! important; color: #fff !important; }
219
  .quads-highlight-ads { outline:6px solid #83c11f !important; }#wp-admin-bar-quads_ad_check_highlight_ads label {color:#b4b9be !important;}</style>
220
  <script type="text/javascript" src="<?php echo QUADS_PLUGIN_URL . 'assets/js/ads.js' ?>"></script>
221
  <script>
222
  (function (d, w) {
223
- var jquery_not_detected = typeof jQuery === 'undefined';
224
 
225
  var addEvent = function (obj, type, fn) {
226
  if (obj.addEventListener)
@@ -262,11 +262,11 @@ function quads_check_adblocker() {
262
  hide_fine = true;
263
  }
264
 
265
- if (jQuery_item && jquery_not_detected) {
266
- // show quads-hidden item
267
- jQuery_item.className = jQuery_item.className.replace(/quads-hidden/, '');
268
- hide_fine = true;
269
- }
270
 
271
  if (hide_fine && fine_item) {
272
  fine_item.className += ' quads-hidden';
215
  */
216
  function quads_check_adblocker() {
217
  ?>
218
+ <!--noptimize--><style>.quads-hidden { display: none; } .quads-adminbar-is-warnings { background: #abc116 ! important; color: #fff !important; }
219
  .quads-highlight-ads { outline:6px solid #83c11f !important; }#wp-admin-bar-quads_ad_check_highlight_ads label {color:#b4b9be !important;}</style>
220
  <script type="text/javascript" src="<?php echo QUADS_PLUGIN_URL . 'assets/js/ads.js' ?>"></script>
221
  <script>
222
  (function (d, w) {
223
+ //var jquery_not_detected = typeof jQuery === 'undefined';
224
 
225
  var addEvent = function (obj, type, fn) {
226
  if (obj.addEventListener)
262
  hide_fine = true;
263
  }
264
 
265
+ // if (jQuery_item && jquery_not_detected) {
266
+ // // show quads-hidden item
267
+ // jQuery_item.className = jQuery_item.className.replace(/quads-hidden/, '');
268
+ // hide_fine = true;
269
+ // }
270
 
271
  if (hide_fine && fine_item) {
272
  fine_item.className += ' quads-hidden';
includes/render-ad-functions.php CHANGED
@@ -170,9 +170,18 @@ function quads_render_desktop_js( $id, $default_ad_sizes ) {
170
  $html = '<ins class="adsbygoogle" style="' . $style . '"';
171
  $html .= ' data-ad-client="' . $quads_options['ads'][$id]['g_data_ad_client'] . '"';
172
  $html .= ' data-ad-slot="' . $quads_options['ads'][$id]['g_data_ad_slot'] . '" ' . $ad_format . '></ins>';
173
-
 
 
 
 
 
 
 
 
 
174
  if( !isset( $quads_options['ads'][$id][$adtype] ) and !empty( $default_ad_sizes[$id][$adtype.'_width'] ) and ! empty( $default_ad_sizes[$id][$adtype.'_height'] ) ) {
175
- $js = 'if ( quads_screen_width >= 1140 ) {
176
  /* desktop monitors */
177
  document.write(\'' . $html . '\');
178
  (adsbygoogle = window.adsbygoogle || []).push({});
@@ -225,6 +234,15 @@ function quads_render_tablet_landscape_js( $id, $default_ad_sizes ) {
225
  $html .= ' data-ad-client="' . $quads_options['ads'][$id]['g_data_ad_client'] . '"';
226
  $html .= ' data-ad-slot="' . $quads_options['ads'][$id]['g_data_ad_slot'] . '" ' . $ad_format . '></ins>';
227
 
 
 
 
 
 
 
 
 
 
228
  if( !isset( $quads_options['ads'][$id]['tablet_landscape'] ) and ! empty( $default_ad_sizes[$id][$adtype.'_width'] ) and ! empty( $default_ad_sizes[$id][$adtype.'_height'] ) ) {
229
  $js = 'if ( quads_screen_width >= 1024 && quads_screen_width < 1140 ) {
230
  /* tablet landscape */
@@ -278,13 +296,22 @@ function quads_render_tablet_portrait_js( $id, $default_ad_sizes ) {
278
  $html .= ' data-ad-client="' . $quads_options['ads'][$id]['g_data_ad_client'] . '"';
279
  $html .= ' data-ad-slot="' . $quads_options['ads'][$id]['g_data_ad_slot'] . '" ' . $ad_format . '></ins>';
280
 
 
 
 
 
 
 
 
 
 
281
  if( !isset( $quads_options['ads'][$id]['tablet_portrait'] ) and !empty( $default_ad_sizes[$id]['tbl_portrait_width'] ) and !empty( $default_ad_sizes[$id][$adtype.'_height'] ) ) {
282
- $js = 'if ( quads_screen_width >= 768 && quads_screen_width < 1024 ) {
283
  /* tablet portrait */
284
  document.write(\'' . $html . '\');
285
  (adsbygoogle = window.adsbygoogle || []).push({});
286
  }';
287
- return $js;
288
  }
289
  }
290
 
@@ -329,6 +356,16 @@ function quads_render_phone_js( $id, $default_ad_sizes ) {
329
  $html .= ' data-ad-client="' . $quads_options['ads'][$id]['g_data_ad_client'] . '"';
330
  $html .= ' data-ad-slot="' . $quads_options['ads'][$id]['g_data_ad_slot'] . '" ' . $ad_format . '></ins>';
331
 
 
 
 
 
 
 
 
 
 
 
332
  if( !isset( $quads_options['ads'][$id][$adtype] ) and ! empty( $default_ad_sizes[$id][$adtype.'_width'] ) and ! empty( $default_ad_sizes[$id][$adtype.'_height'] ) ) {
333
  $js = 'if ( quads_screen_width < 768 ) {
334
  /* phone */
@@ -366,6 +403,11 @@ function quads_is_adsense( $id, $string ) {
366
  */
367
  function quads_render_amp($id){
368
  global $quads_options;
 
 
 
 
 
369
 
370
  // if amp is not activated return empty
371
  if (!isset($quads_options['ads'][$id]['amp']) || quads_is_disabled_post_amp() ){
@@ -388,6 +430,12 @@ function quads_render_amp($id){
388
  * @return boolean
389
  */
390
  function quads_is_amp_endpoint(){
 
 
 
 
 
 
391
  // Automattic AMP plugin
392
  if ( function_exists( 'is_amp_endpoint' )){
393
  if ( is_amp_endpoint()){
170
  $html = '<ins class="adsbygoogle" style="' . $style . '"';
171
  $html .= ' data-ad-client="' . $quads_options['ads'][$id]['g_data_ad_client'] . '"';
172
  $html .= ' data-ad-slot="' . $quads_options['ads'][$id]['g_data_ad_slot'] . '" ' . $ad_format . '></ins>';
173
+
174
+ if (!quads_is_extra() && !empty( $default_ad_sizes[$id][$adtype.'_width'] ) and ! empty( $default_ad_sizes[$id][$adtype.'_height'])){
175
+ $js = 'if ( quads_screen_width >= 1140 ) {
176
+ /* desktop monitors */
177
+ document.write(\'' . $html . '\');
178
+ (adsbygoogle = window.adsbygoogle || []).push({});
179
+ }';
180
+ return $js;
181
+ }
182
+
183
  if( !isset( $quads_options['ads'][$id][$adtype] ) and !empty( $default_ad_sizes[$id][$adtype.'_width'] ) and ! empty( $default_ad_sizes[$id][$adtype.'_height'] ) ) {
184
+ $js = 'if ( quads_screen_width >= 1140 ) {
185
  /* desktop monitors */
186
  document.write(\'' . $html . '\');
187
  (adsbygoogle = window.adsbygoogle || []).push({});
234
  $html .= ' data-ad-client="' . $quads_options['ads'][$id]['g_data_ad_client'] . '"';
235
  $html .= ' data-ad-slot="' . $quads_options['ads'][$id]['g_data_ad_slot'] . '" ' . $ad_format . '></ins>';
236
 
237
+ if( !quads_is_extra() && ! empty( $default_ad_sizes[$id][$adtype.'_width'] ) and ! empty( $default_ad_sizes[$id][$adtype.'_height'] ) ) {
238
+ $js = 'if ( quads_screen_width >= 1024 && quads_screen_width < 1140 ) {
239
+ /* tablet landscape */
240
+ document.write(\'' . $html . '\');
241
+ (adsbygoogle = window.adsbygoogle || []).push({});
242
+ }';
243
+ return $js;
244
+ }
245
+
246
  if( !isset( $quads_options['ads'][$id]['tablet_landscape'] ) and ! empty( $default_ad_sizes[$id][$adtype.'_width'] ) and ! empty( $default_ad_sizes[$id][$adtype.'_height'] ) ) {
247
  $js = 'if ( quads_screen_width >= 1024 && quads_screen_width < 1140 ) {
248
  /* tablet landscape */
296
  $html .= ' data-ad-client="' . $quads_options['ads'][$id]['g_data_ad_client'] . '"';
297
  $html .= ' data-ad-slot="' . $quads_options['ads'][$id]['g_data_ad_slot'] . '" ' . $ad_format . '></ins>';
298
 
299
+ if( !quads_is_extra() and !empty( $default_ad_sizes[$id]['tbl_portrait_width'] ) and !empty( $default_ad_sizes[$id][$adtype.'_height'] ) ) {
300
+ $js = 'if ( quads_screen_width >= 768 && quads_screen_width < 1024 ) {
301
+ /* tablet portrait */
302
+ document.write(\'' . $html . '\');
303
+ (adsbygoogle = window.adsbygoogle || []).push({});
304
+ }';
305
+ return $js;
306
+ }
307
+
308
  if( !isset( $quads_options['ads'][$id]['tablet_portrait'] ) and !empty( $default_ad_sizes[$id]['tbl_portrait_width'] ) and !empty( $default_ad_sizes[$id][$adtype.'_height'] ) ) {
309
+ $js = 'if ( quads_screen_width >= 768 && quads_screen_width < 1024 ) {
310
  /* tablet portrait */
311
  document.write(\'' . $html . '\');
312
  (adsbygoogle = window.adsbygoogle || []).push({});
313
  }';
314
+ return $js;
315
  }
316
  }
317
 
356
  $html .= ' data-ad-client="' . $quads_options['ads'][$id]['g_data_ad_client'] . '"';
357
  $html .= ' data-ad-slot="' . $quads_options['ads'][$id]['g_data_ad_slot'] . '" ' . $ad_format . '></ins>';
358
 
359
+ if( !quads_is_extra() and ! empty( $default_ad_sizes[$id][$adtype.'_width'] ) and ! empty( $default_ad_sizes[$id][$adtype.'_height'] ) ) {
360
+ $js = 'if ( quads_screen_width < 768 ) {
361
+ /* phone */
362
+ document.write(\'' . $html . '\');
363
+ (adsbygoogle = window.adsbygoogle || []).push({});
364
+ }';
365
+ return $js;
366
+ }
367
+
368
+
369
  if( !isset( $quads_options['ads'][$id][$adtype] ) and ! empty( $default_ad_sizes[$id][$adtype.'_width'] ) and ! empty( $default_ad_sizes[$id][$adtype.'_height'] ) ) {
370
  $js = 'if ( quads_screen_width < 768 ) {
371
  /* phone */
403
  */
404
  function quads_render_amp($id){
405
  global $quads_options;
406
+
407
+ // quads pro not installed and activated
408
+ if ( !quads_is_extra() ){
409
+ return '';
410
+ }
411
 
412
  // if amp is not activated return empty
413
  if (!isset($quads_options['ads'][$id]['amp']) || quads_is_disabled_post_amp() ){
430
  * @return boolean
431
  */
432
  function quads_is_amp_endpoint(){
433
+
434
+ // General AMP query
435
+ if (false !== get_query_var( 'amp', false )){
436
+ return true;
437
+ }
438
+
439
  // Automattic AMP plugin
440
  if ( function_exists( 'is_amp_endpoint' )){
441
  if ( is_amp_endpoint()){
includes/scripts.php CHANGED
@@ -12,8 +12,9 @@
12
  if( !defined( 'ABSPATH' ) )
13
  exit;
14
 
15
- add_action( 'wp_enqueue_scripts', 'quads_register_styles', 10 );
16
  add_action( 'wp_print_styles', 'quads_inline_styles', 9999 );
 
17
  add_action( 'admin_enqueue_scripts', 'quads_load_admin_scripts', 100 );
18
  add_action( 'admin_enqueue_scripts', 'quads_load_plugins_admin_scripts', 100 );
19
  add_action('admin_print_footer_scripts', 'quads_check_ad_blocker');
@@ -113,14 +114,15 @@ function quads_load_plugins_admin_scripts( $hook ) {
113
  * @global $mashsb_options
114
  * @return void
115
  */
116
- function quads_register_styles( $hook ) {
117
- global $quads_options;
118
-
119
- // Register empty quads.css to be able to register quads_inline_styles()
120
- $url = QUADS_PLUGIN_URL . 'assets/css/quads.css';
121
-
122
- wp_enqueue_style( 'quads-styles', $url, array(), QUADS_VERSION );
123
- }
 
124
 
125
  /**
126
  * Add dynamic CSS to write media queries for removing unwanted ads without the need to use any cache busting method
@@ -142,8 +144,11 @@ function quads_inline_styles() {
142
  $css .= quads_render_media_query( $key, $value );
143
  }
144
  }
145
-
146
-
 
 
 
147
  wp_add_inline_style( 'quads-styles', $css );
148
  }
149
 
@@ -155,11 +160,14 @@ function quads_inline_styles() {
155
  * @return string
156
  */
157
  function quads_render_media_query($key, $value){
 
 
 
 
158
 
159
  $html = '';
160
 
161
  if (isset($value['desktop']) ){
162
- //$html .= '@media only screen and (min-width:1140px){.quads-'.$key.' {display:none;}}'. "\n";
163
  //$html .= '/* Hide on desktop */';
164
  $html .= '@media only screen and (min-width:1140px){#quads-'.$key.', .quads-' . $key . ' {display:none;}}'. "\n";
165
  }
@@ -213,7 +221,7 @@ function quads_ads_head_script() {
213
  if(typeof(edButtons)!='undefined') {
214
  edadd = edButtons.length;
215
  var dynads={"all":[
216
- <?php for ($i=1;$i<=count( quads_get_ads() )-1;$i++) { if( isset($quads_options['ad'.$i]['code']) && $quads_options['ad'.$i]['code'] !='' ){echo('"1",');}else{echo('"0",');}; } ?>
217
  "0"]};
218
  for(i=1;i<=<?php echo count( quads_get_ads() ) -1; ?>;i++) {
219
  if(dynads.all[i-1]=="1") {
12
  if( !defined( 'ABSPATH' ) )
13
  exit;
14
 
15
+ //add_action( 'wp_enqueue_scripts', 'quads_register_styles', 10 );
16
  add_action( 'wp_print_styles', 'quads_inline_styles', 9999 );
17
+
18
  add_action( 'admin_enqueue_scripts', 'quads_load_admin_scripts', 100 );
19
  add_action( 'admin_enqueue_scripts', 'quads_load_plugins_admin_scripts', 100 );
20
  add_action('admin_print_footer_scripts', 'quads_check_ad_blocker');
114
  * @global $mashsb_options
115
  * @return void
116
  */
117
+ //function quads_register_styles( $hook ) {
118
+ // global $quads_options;
119
+ //
120
+ // // Register empty quads.css to be able to register quads_inline_styles()
121
+ // //$url = QUADS_PLUGIN_URL . 'assets/css/quads.css';
122
+ //
123
+ // //wp_enqueue_style( 'quads-styles', $url, array(), QUADS_VERSION );
124
+ // wp_enqueue_style( 'quads-styles', false );
125
+ //}
126
 
127
  /**
128
  * Add dynamic CSS to write media queries for removing unwanted ads without the need to use any cache busting method
144
  $css .= quads_render_media_query( $key, $value );
145
  }
146
  }
147
+ // Register empty style so we do not need an external css file
148
+ wp_register_style( 'quads-styles', false );
149
+ // Enque empty style
150
+ wp_enqueue_style( 'quads-styles' );
151
+ // Add inline css to that style
152
  wp_add_inline_style( 'quads-styles', $css );
153
  }
154
 
160
  * @return string
161
  */
162
  function quads_render_media_query($key, $value){
163
+ $lic = get_option( 'quads_wp_quads_pro_license_active' );
164
+ if( !$lic || (is_object( $lic ) && $lic->success !== true) ) {
165
+ return '';
166
+ }
167
 
168
  $html = '';
169
 
170
  if (isset($value['desktop']) ){
 
171
  //$html .= '/* Hide on desktop */';
172
  $html .= '@media only screen and (min-width:1140px){#quads-'.$key.', .quads-' . $key . ' {display:none;}}'. "\n";
173
  }
221
  if(typeof(edButtons)!='undefined') {
222
  edadd = edButtons.length;
223
  var dynads={"all":[
224
+ <?php for ($i=1;$i<=count( quads_get_ads() )-1;$i++) { if( isset($quads_options['ads']['ad'.$i]['code']) && $quads_options['ads']['ad'.$i]['code'] !='' ){echo('"1",');}else{echo('"0",');}; } ?>
225
  "0"]};
226
  for(i=1;i<=<?php echo count( quads_get_ads() ) -1; ?>;i++) {
227
  if(dynads.all[i-1]=="1") {
includes/shortcodes.php CHANGED
@@ -44,7 +44,7 @@ function quads_shortcode_display_ad( $atts ) {
44
  'float:left;margin:%1$dpx %1$dpx %1$dpx 0;',
45
  'float:none;margin:%1$dpx 0 %1$dpx 0;text-align:center;',
46
  'float:right;margin:%1$dpx 0 %1$dpx %1$dpx;',
47
- 'float:none;margin:0px;');
48
 
49
  $adsalign = isset($quads_options['ads']['ad' . $id]['align']) ? $quads_options['ads']['ad' . $id]['align'] : 3; // default
50
  $adsmargin = isset( $quads_options['ads']['ad' . $id]['margin'] ) ? $quads_options['ads']['ad' . $id]['margin'] : '3'; // default
44
  'float:left;margin:%1$dpx %1$dpx %1$dpx 0;',
45
  'float:none;margin:%1$dpx 0 %1$dpx 0;text-align:center;',
46
  'float:right;margin:%1$dpx 0 %1$dpx %1$dpx;',
47
+ 'float:none;margin:%1$dpx;');
48
 
49
  $adsalign = isset($quads_options['ads']['ad' . $id]['align']) ? $quads_options['ads']['ad' . $id]['align'] : 3; // default
50
  $adsmargin = isset( $quads_options['ads']['ad' . $id]['margin'] ) ? $quads_options['ads']['ad' . $id]['margin'] : '3'; // default
includes/template-functions.php CHANGED
@@ -228,14 +228,13 @@ function quads_get_max_allowed_post_ads( $content ) {
228
  $AdsWidName = 'AdsWidget%d (Quick Adsense Reloaded)';
229
 
230
  // count number of active widgets and subtract them
231
- if( strpos( $content, '<!--OffWidget-->' ) === false && !quads_is_amp_endpoint() ) {
232
  for ( $i = 1; $i <= $numberWidgets; $i++ ) {
233
  $wadsid = sanitize_title( str_replace( array('(', ')'), '', sprintf( $AdsWidName, $i ) ) );
234
  $maxAds -= (is_active_widget( '', '', $wadsid )) ? 1 : 0;
235
  }
236
  }
237
- //echo 'test' . $maxAds . quads_is_amp_endpoint();
238
- //wp_die($maxAds);
239
  return $maxAds;
240
  }
241
 
@@ -721,17 +720,20 @@ function quads_get_inline_ad_style( $id ) {
721
  'float:left;margin:%1$dpx %1$dpx %1$dpx 0;',
722
  'float:none;margin:%1$dpx 0 %1$dpx 0;text-align:center;',
723
  'float:right;margin:%1$dpx 0 %1$dpx %1$dpx;',
724
- 'float:none;margin:0px;');
725
 
726
  // Alignment
727
- $adsalign = $quads_options['ads']['ad' . $id]['align'];
728
 
729
  // Margin
730
- $adsmargin = isset( $quads_options['ads']['ad' . $id]['margin'] ) ? $quads_options['ads']['ad' . $id]['margin'] : '3'; // default optin = 3
731
- $margin = sprintf( $styleArray[( int ) $adsalign], $adsmargin );
 
 
 
732
 
733
  // Do not create any inline style on AMP site
734
- $style = !quads_is_amp_endpoint() ? apply_filters( 'quads_filter_margins', $margin, 'ad' . $id ) : '';
735
 
736
  return $style;
737
  }
228
  $AdsWidName = 'AdsWidget%d (Quick Adsense Reloaded)';
229
 
230
  // count number of active widgets and subtract them
231
+ if( strpos( $content, '<!--OffWidget-->' ) === false && !quads_is_amp_endpoint() ) {
232
  for ( $i = 1; $i <= $numberWidgets; $i++ ) {
233
  $wadsid = sanitize_title( str_replace( array('(', ')'), '', sprintf( $AdsWidName, $i ) ) );
234
  $maxAds -= (is_active_widget( '', '', $wadsid )) ? 1 : 0;
235
  }
236
  }
237
+
 
238
  return $maxAds;
239
  }
240
 
720
  'float:left;margin:%1$dpx %1$dpx %1$dpx 0;',
721
  'float:none;margin:%1$dpx 0 %1$dpx 0;text-align:center;',
722
  'float:right;margin:%1$dpx 0 %1$dpx %1$dpx;',
723
+ 'float:none;margin:%1$dpx;');
724
 
725
  // Alignment
726
+ $adsalign = ( int )$quads_options['ads']['ad' . $id]['align'];
727
 
728
  // Margin
729
+ $adsmargin = isset( $quads_options['ads']['ad' . $id]['margin'] ) ? $quads_options['ads']['ad' . $id]['margin'] : '3'; // default option = 3
730
+ $margin = sprintf( $styleArray[$adsalign], $adsmargin );
731
+
732
+ //wp_die($quads_options['ads']['ad' . $id]['margin']);
733
+ //wp_die('ad'.$id);
734
 
735
  // Do not create any inline style on AMP site
736
+ $style = !quads_is_amp_endpoint() ? apply_filters( 'quads_filter_margins', $margin, 'ad' . $id ) : '';
737
 
738
  return $style;
739
  }
quick-adsense-reloaded.php CHANGED
@@ -6,7 +6,7 @@
6
  * Description: Insert Google AdSense or any Ads code into your website. A fork of Quick AdSense
7
  * Author: Rene Hermenau, WP-Staging
8
  * Author URI: https://wordpress.org/plugins/quick-adsense-reloaded/
9
- * Version: 1.5.3
10
  * Text Domain: quick-adsense-reloaded
11
  * Domain Path: languages
12
  * Credits: WP QUADS - Quick AdSense Reloaded is a fork of Quick AdSense
@@ -35,7 +35,7 @@ if( !defined( 'ABSPATH' ) )
35
 
36
  // Plugin version
37
  if( !defined( 'QUADS_VERSION' ) ) {
38
- define( 'QUADS_VERSION', '1.5.3' );
39
  }
40
 
41
  // Plugin name
@@ -61,9 +61,6 @@ $ad_count_custom = 0; // Number of active custom ads which are shown on the site
61
  $ad_count_widget = 0; // Number of active ads in widgets
62
  $AdsId = array(); // Array of active ad id's
63
  $maxWidgets = 10; // number of widgets
64
- //$maxAds = 10; // number of regular ads
65
- //$AdsWidName = 'AdsWidget%d (WP QUADS)';
66
- //$AdsWidName = 'AdsWidget%d (Quick Adsense Reloaded)';
67
 
68
 
69
  if( !class_exists( 'QuickAdsenseReloaded' ) ) :
@@ -203,6 +200,8 @@ if( !class_exists( 'QuickAdsenseReloaded' ) ) :
203
  require_once QUADS_PLUGIN_DIR . 'includes/helper-functions.php';
204
  require_once QUADS_PLUGIN_DIR . 'includes/conditions.php';
205
  require_once QUADS_PLUGIN_DIR . 'includes/frontend-checks.php';
 
 
206
 
207
  if( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
208
  require_once QUADS_PLUGIN_DIR . 'includes/admin/add-ons.php';
@@ -296,6 +295,11 @@ if( !class_exists( 'QuickAdsenseReloaded' ) ) :
296
  * @return void
297
  */
298
  public static function during_activation() {
 
 
 
 
 
299
 
300
  // Add Upgraded From Option
301
  $current_version = get_option( 'quads_version' );
6
  * Description: Insert Google AdSense or any Ads code into your website. A fork of Quick AdSense
7
  * Author: Rene Hermenau, WP-Staging
8
  * Author URI: https://wordpress.org/plugins/quick-adsense-reloaded/
9
+ * Version: 1.5.8
10
  * Text Domain: quick-adsense-reloaded
11
  * Domain Path: languages
12
  * Credits: WP QUADS - Quick AdSense Reloaded is a fork of Quick AdSense
35
 
36
  // Plugin version
37
  if( !defined( 'QUADS_VERSION' ) ) {
38
+ define( 'QUADS_VERSION', '1.5.8' );
39
  }
40
 
41
  // Plugin name
61
  $ad_count_widget = 0; // Number of active ads in widgets
62
  $AdsId = array(); // Array of active ad id's
63
  $maxWidgets = 10; // number of widgets
 
 
 
64
 
65
 
66
  if( !class_exists( 'QuickAdsenseReloaded' ) ) :
200
  require_once QUADS_PLUGIN_DIR . 'includes/helper-functions.php';
201
  require_once QUADS_PLUGIN_DIR . 'includes/conditions.php';
202
  require_once QUADS_PLUGIN_DIR . 'includes/frontend-checks.php';
203
+ require_once QUADS_PLUGIN_DIR . 'includes/Cron/Cron.php';
204
+
205
 
206
  if( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
207
  require_once QUADS_PLUGIN_DIR . 'includes/admin/add-ons.php';
295
  * @return void
296
  */
297
  public static function during_activation() {
298
+
299
+ // Add cron event
300
+ require_once plugin_dir_path( __FILE__ ) . 'includes/Cron/Cron.php';
301
+ $cron = new quadsCron();
302
+ $cron->schedule_event();
303
 
304
  // Add Upgraded From Option
305
  $current_version = get_option( 'quads_version' );
readme.txt CHANGED
@@ -9,7 +9,7 @@ License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  Tags: adsense, ads, ad, google adsense, advertising, amp, ad injection, ad inserter, ad manager
10
  Requires at least: 3.6+
11
  Tested up to: 4.8
12
- Stable tag: 1.5.3
13
 
14
  Quick Adsense Reloaded! Quickest way to insert Google AdSense & other ads into your website. Google AdSense integration with Google AMP support
15
 
@@ -26,7 +26,7 @@ WP QUADS is coded well with no overhead and is used on huge websites with millio
26
  * Disable AdSense ads on phone, tablet or desktop devices<br />
27
  * Define AdSense sizes for different devices<br />
28
 
29
- AMP feature requires [Automattic AMP plugin](http://wpquads.com/?utm_source=wp_org&utm_medium=plugin_page&utm_term=check_out_wp_quads&utm_campaign=wpquads) installed <br />
30
  Get WP QUADS PRO: [wpquads.com](http://wpquads.com/?utm_source=wp_org&utm_medium=plugin_page&utm_term=check_out_wp_quads&utm_campaign=wpquads) <br />
31
 
32
  This AdSense plugin is rewritten from scratch with a solid code
@@ -129,8 +129,30 @@ Alternative Installation:
129
 
130
  == Changelog ==
131
 
132
- = 1.5.3 =
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  * Fix: Hide widget on homepage option not working
 
134
  * Tweak: Clean up code
135
 
136
  = 1.5.3 =
9
  Tags: adsense, ads, ad, google adsense, advertising, amp, ad injection, ad inserter, ad manager
10
  Requires at least: 3.6+
11
  Tested up to: 4.8
12
+ Stable tag: 1.5.8
13
 
14
  Quick Adsense Reloaded! Quickest way to insert Google AdSense & other ads into your website. Google AdSense integration with Google AMP support
15
 
26
  * Disable AdSense ads on phone, tablet or desktop devices<br />
27
  * Define AdSense sizes for different devices<br />
28
 
29
+ AMP feature requires [Automattic AMP plugin](http://wpquads.com/?utm_source=wp_org&utm_medium=plugin_page&utm_term=check_out_wp_quads&utm_campaign=wpquads) or any other AMP plugin installed <br />
30
  Get WP QUADS PRO: [wpquads.com](http://wpquads.com/?utm_source=wp_org&utm_medium=plugin_page&utm_term=check_out_wp_quads&utm_campaign=wpquads) <br />
31
 
32
  This AdSense plugin is rewritten from scratch with a solid code
129
 
130
  == Changelog ==
131
 
132
+ = 1.5.8 =
133
+ * New: Compatible to all AMP plugin, not limited only to automattics AMP plugin
134
+
135
+ = 1.5.7 =
136
+ * Tweak: Remove external empty quads.css file
137
+ * Tweak: Better wordings for ad blocker notice
138
+ * Tweak: Make code more robust
139
+ * Tweak: Simpler notice for renewing license keys
140
+ * Tweak: Change admin bar warning color from red to a more suitable orange
141
+ * Fix: Remove jQuery frontpage check
142
+ * Fix: Rating notice not hiding
143
+
144
+ = 1.5.6 =
145
+ * Fix: License tab not shown after update of WP QUADS to version 1.5.5 and WP QUADS PRO is lower than version 1.3.3
146
+ * Fix: Quicktags button in editor not shown
147
+ * Fix: Margin option not working when ad layout floating option is default
148
+
149
+ = 1.5.5 =
150
+ * Fix: No ad position visible after new installation
151
+ * Fix: Show Add new Ad button only when wp quads pro is installed
152
+
153
+ = 1.5.4 =
154
  * Fix: Hide widget on homepage option not working
155
+ * Tweak: Change default value of ad limitation to unlimited ads
156
  * Tweak: Clean up code
157
 
158
  = 1.5.3 =