AdSense Plugin WP QUADS - Version 1.7.5

Version Description

  • Fix: Disable ads on infinite scrolling pages
  • Fix: Condition ad before last paragraph is not working
  • Fix: Do not inject ads into blockquote elements
  • Fix: ads.txt not writeable admin notice is showing incorrect google adsense publisherId
  • Fix: WP QUADS Pro not working if valid license key expired
  • Tweak: Rename ADSENSE CODE to Ad Code
  • Tweak: default load priority is 10
Download this release

Release Info

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

Code changes from version 1.7.4 to 1.7.5

includes/Cron/Cron.php CHANGED
@@ -12,7 +12,8 @@ if( !defined( "WPINC" ) ) {
12
  class quadsCron {
13
 
14
  public function __construct() {
15
- add_filter( 'cron_schedules', array($this, 'add_new_intervals') );
 
16
  }
17
 
18
  /**
@@ -39,13 +40,15 @@ class quadsCron {
39
 
40
 
41
  public function schedule_event() {
 
42
  if( !wp_next_scheduled( 'quads_weekly_event' ) ) {
43
  wp_schedule_event( time(), 'weekly', 'quads_weekly_event' );
 
44
  }
45
  if( !wp_next_scheduled( 'quads_daily_event' ) ) {
46
  wp_schedule_event( time(), 'daily', 'quads_daily_event' );
 
47
  }
48
  }
49
  }
50
-
51
  $quadsCron = new quadsCron();
12
  class quadsCron {
13
 
14
  public function __construct() {
15
+ add_filter( 'cron_schedules', array($this, 'add_new_intervals'), 100 );
16
+
17
  }
18
 
19
  /**
40
 
41
 
42
  public function schedule_event() {
43
+
44
  if( !wp_next_scheduled( 'quads_weekly_event' ) ) {
45
  wp_schedule_event( time(), 'weekly', 'quads_weekly_event' );
46
+
47
  }
48
  if( !wp_next_scheduled( 'quads_daily_event' ) ) {
49
  wp_schedule_event( time(), 'daily', 'quads_daily_event' );
50
+
51
  }
52
  }
53
  }
 
54
  $quadsCron = new quadsCron();
includes/admin/admin-notices.php CHANGED
@@ -536,7 +536,7 @@ function quads_show_vi_notices() {
536
  $adsenseAdsTxtText = '';
537
  if (!empty($adsensePublisherIds)) {
538
  foreach ($adsensePublisherIds as $adsensePublisherId) {
539
- $adsenseAdsTxtText .= "google.com, " . $adsensePublisherId . ", DIRECT, f08c47fec0942fa0\r\n";
540
  }
541
  }
542
 
@@ -623,7 +623,7 @@ function quads_show_ads_txt_notice() {
623
  $adsenseAdsTxtText = '';
624
  if (!empty($adsensePublisherIds)) {
625
  foreach ($adsensePublisherIds as $adsensePublisherId) {
626
- $adsenseAdsTxtText .= "google.com, " . $adsensePublisherId . ", DIRECT, f08c47fec0942fa0\n\r";
627
  }
628
  }
629
 
536
  $adsenseAdsTxtText = '';
537
  if (!empty($adsensePublisherIds)) {
538
  foreach ($adsensePublisherIds as $adsensePublisherId) {
539
+ $adsenseAdsTxtText .= "google.com, " . str_replace('ca-', '', $adsensePublisherId) . ", DIRECT, f08c47fec0942fa0\r\n";
540
  }
541
  }
542
 
623
  $adsenseAdsTxtText = '';
624
  if (!empty($adsensePublisherIds)) {
625
  foreach ($adsensePublisherIds as $adsensePublisherId) {
626
+ $adsenseAdsTxtText .= "google.com, " . str_replace('ca-', '', $adsensePublisherId) . ", DIRECT, f08c47fec0942fa0\n\r";
627
  }
628
  }
629
 
includes/admin/settings/register-settings.php CHANGED
@@ -228,7 +228,7 @@ function quads_get_registered_settings() {
228
  ), */
229
  'adsense_header' => array(
230
  'id' => 'adsense_header',
231
- 'name' => '<strong>' . __( 'AdSense Code', 'quick-adsense-reloaded' ) . '</strong>',
232
  'desc' => '<div class="adsense_admin_header">' . sprintf( __( 'Enter your ads below:</div>'
233
  . '<ul style="margin-top:10px;">'
234
  . '<li style="font-weight:600;">Select <i>AdSense</i> for using <span style="font-weight:600;">AdSense Text & display Ads</span>!</li>'
@@ -338,7 +338,7 @@ function quads_get_registered_settings() {
338
  'helper-desc' => __( 'Do not change this until you know what you are doing. Usually the default value 20 is working fine. Changing this value can lead to unexpected results like ads not showing or loaded on wrong order. <strong>Default:</strong> 20', 'quick-adsense-reloaded' ),
339
  'type' => 'number',
340
  'size' => 'small',
341
- 'std' => 20
342
  ),
343
  'create_settings' => array(
344
  'id' => 'create_settings',
@@ -733,29 +733,6 @@ function quads_adposition_callback( $id, $args ) {
733
  endforeach;
734
  }
735
 
736
- /**
737
- * Gateways Callback
738
- *
739
- * Renders gateways fields.
740
- *
741
- * @since 1.0
742
- * @param array $args Arguments passed by the setting
743
- * @global $quads_options Array of all the QUADS Options
744
- * @return void
745
- */
746
- //function quads_gateways_callback( $args ) {
747
- // global $quads_options;
748
- //
749
- // foreach ( $args['options'] as $key => $option ) :
750
- // if( isset( $quads_options['gateways'][$key] ) )
751
- // $enabled = '1';
752
- // else
753
- // $enabled = null;
754
- //
755
- // echo '<input name="quads_settings[' . $args['id'] . '][' . $key . ']"" id="quads_settings[' . $args['id'] . '][' . $key . ']" type="checkbox" value="1" ' . checked( '1', $enabled, false ) . '/>&nbsp;';
756
- // echo '<label for="quads_settings[' . $args['id'] . '][' . $key . ']">' . $option['admin_label'] . '</label><br/>';
757
- // endforeach;
758
- //}
759
 
760
  /**
761
  * Text Callback
@@ -1029,15 +1006,34 @@ function quads_upload_callback( $args ) {
1029
  * @return boolean
1030
  */
1031
  function quads_is_extra() {
 
 
 
 
1032
 
1033
  $lic = get_option( 'quads_wp_quads_pro_license_active' );
1034
- if( !$lic || (is_object( $lic ) && $lic->success !== true) ) {
1035
- return false;
 
1036
  }
1037
 
1038
- if( function_exists( 'quads_extra' ) ) {
1039
- return true;
1040
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1041
  return false;
1042
  }
1043
 
@@ -1094,6 +1090,7 @@ if( !function_exists( 'quads_license_key_callback' ) ) {
1094
  }
1095
 
1096
  if( !empty( $license ) && is_object( $license ) ) {
 
1097
 
1098
  // activate_license 'invalid' on anything other than valid, so if there was an error capture it
1099
  if( false === $license->success ) {
@@ -1152,6 +1149,7 @@ if( !function_exists( 'quads_license_key_callback' ) ) {
1152
 
1153
  break;
1154
  }
 
1155
  } else {
1156
 
1157
  switch ( $license->license ) {
@@ -1184,12 +1182,28 @@ if( !function_exists( 'quads_license_key_callback' ) ) {
1184
 
1185
  $license_status = 'quads-license-expiration-date-notice';
1186
  }
1187
-
1188
- break;
 
 
 
 
 
 
1189
  }
1190
  }
 
 
 
 
 
 
 
 
 
1191
  } else {
1192
  $license_status = null;
 
1193
  }
1194
 
1195
  $size = ( isset( $args['size'] ) && !is_null( $args['size'] ) ) ? $args['size'] : 'regular';
228
  ), */
229
  'adsense_header' => array(
230
  'id' => 'adsense_header',
231
+ 'name' => '<strong>' . __( 'Ad Code', 'quick-adsense-reloaded' ) . '</strong>',
232
  'desc' => '<div class="adsense_admin_header">' . sprintf( __( 'Enter your ads below:</div>'
233
  . '<ul style="margin-top:10px;">'
234
  . '<li style="font-weight:600;">Select <i>AdSense</i> for using <span style="font-weight:600;">AdSense Text & display Ads</span>!</li>'
338
  'helper-desc' => __( 'Do not change this until you know what you are doing. Usually the default value 20 is working fine. Changing this value can lead to unexpected results like ads not showing or loaded on wrong order. <strong>Default:</strong> 20', 'quick-adsense-reloaded' ),
339
  'type' => 'number',
340
  'size' => 'small',
341
+ 'std' => 10
342
  ),
343
  'create_settings' => array(
344
  'id' => 'create_settings',
733
  endforeach;
734
  }
735
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
736
 
737
  /**
738
  * Text Callback
1006
  * @return boolean
1007
  */
1008
  function quads_is_extra() {
1009
+
1010
+ if( !function_exists( 'quads_extra' ) ) {
1011
+ return false;
1012
+ }
1013
 
1014
  $lic = get_option( 'quads_wp_quads_pro_license_active' );
1015
+
1016
+ if (!$lic){
1017
+ return false;
1018
  }
1019
 
1020
+ if (isset($lic->error) && $lic->error === 'expired'){
1021
+ return true;
1022
  }
1023
+
1024
+ if (isset($lic->license) && $lic->license === 'valid'){
1025
+ return true;
1026
+ }
1027
+
1028
+ if (isset($lic->license) && $lic->license === 'inactive'){
1029
+ return false;
1030
+ }
1031
+
1032
+
1033
+ // if( !$lic || (is_object( $lic ) && $lic->success !== true) ) {
1034
+ // return false;
1035
+ // }
1036
+
1037
  return false;
1038
  }
1039
 
1090
  }
1091
 
1092
  if( !empty( $license ) && is_object( $license ) ) {
1093
+
1094
 
1095
  // activate_license 'invalid' on anything other than valid, so if there was an error capture it
1096
  if( false === $license->success ) {
1149
 
1150
  break;
1151
  }
1152
+
1153
  } else {
1154
 
1155
  switch ( $license->license ) {
1182
 
1183
  $license_status = 'quads-license-expiration-date-notice';
1184
  }
1185
+ break;
1186
+
1187
+ case 'inactive' :
1188
+ $messages[] = sprintf(
1189
+ __( 'Your license key has been disabled! <a href="%s" target="_blank" title="Renew license">Renew your license key</a>.', 'quick-adsense-reloaded' ), 'http://wpquads.com/checkout/?edd_license_key=' . $value . '&utm_campaign=notice&utm_source=licenses-tab&utm_medium=admin'
1190
+ );
1191
+ $license_status = 'quads-license-error-notice';
1192
+ break;
1193
  }
1194
  }
1195
+
1196
+ switch ( $license->license ) {
1197
+ case 'invalid' :
1198
+ $messages[] = sprintf(
1199
+ __( 'Your license key has been disabled! <a href="%s" target="_blank" title="Renew license">Renew your license key</a>.', 'quick-adsense-reloaded' ), 'http://wpquads.com/checkout/?edd_license_key=' . $value . '&utm_campaign=notice&utm_source=licenses-tab&utm_medium=admin'
1200
+ );
1201
+ break;
1202
+ }
1203
+
1204
  } else {
1205
  $license_status = null;
1206
+
1207
  }
1208
 
1209
  $size = ( isset( $args['size'] ) && !is_null( $args['size'] ) ) ? $args['size'] : 'regular';
includes/class-quads-license-handler.php CHANGED
@@ -419,7 +419,7 @@ class QUADS_License {
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
 
419
  if( empty( $_GET['tab'] ) || 'licenses' !== $_GET['tab'] ) {
420
 
421
  $messages[] = sprintf(
422
+ __( 'You have invalid or expired license keys for WPQUADS PRO. WP QUADS Pro will not work properly until you have resolved this. 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
 
includes/conditions.php CHANGED
@@ -25,9 +25,9 @@ function quads_ad_is_allowed( $content = null ) {
25
 
26
 
27
  // Never show ads in ajax calls
28
- if ( isset($quads_options['is_ajax']) && (defined('DOING_AJAX') && DOING_AJAX ||
29
  (! empty( $_SERVER[ 'HTTP_X_REQUESTED_WITH' ] ) && strtolower( $_SERVER[ 'HTTP_X_REQUESTED_WITH' ]) == 'xmlhttprequest' )
30
- ))
31
  {
32
  /* it's an AJAX call */
33
  return false;
25
 
26
 
27
  // Never show ads in ajax calls
28
+ if ( isset($quads_options['is_ajax']) && (defined('DOING_AJAX') && DOING_AJAX) ||
29
  (! empty( $_SERVER[ 'HTTP_X_REQUESTED_WITH' ] ) && strtolower( $_SERVER[ 'HTTP_X_REQUESTED_WITH' ]) == 'xmlhttprequest' )
30
+ )
31
  {
32
  /* it's an AJAX call */
33
  return false;
includes/template-functions.php CHANGED
@@ -336,18 +336,33 @@ function quads_filter_default_ads( $content ) {
336
 
337
  // Create paragraph ads
338
  $number = 6;
339
- //$number = 3;
340
  for ( $i = $number; $i >= 1; $i-- ) {
341
  if( !empty( $paragraph['status'][$i] ) ) {
342
  $sch = "</p>";
343
  $content = str_replace( "</P>", $sch, $content );
 
 
344
  // paragraphs in content
345
  $paragraphsArray = explode( $sch, $content );
 
 
346
  if( ( int ) $paragraph['position'][$i] < count( $paragraphsArray ) ) {
347
- $content = implode( $sch, array_slice( $paragraphsArray, 0, $paragraph['position'][$i] ) ) . $sch . '<!--' . $paragraph[$i] . '-->' . implode( $sch, array_slice( $paragraphsArray, $paragraph['position'][$i] ) );
 
 
 
 
 
 
 
 
 
348
  } elseif( $paragraph['end_post'][$i] ) {
349
  $content = implode( $sch, $paragraphsArray ) . '<!--' . $paragraph[$i] . '-->';
350
  }
 
 
351
  }
352
  }
353
 
@@ -402,14 +417,17 @@ function quads_filter_default_ads( $content ) {
402
  $content = str_replace( '<span id="more-' . $postid . '"></span>', $mmr, $content );
403
  }
404
 
405
- // Right after last paragraph ad
406
  if( $last_paragraph_position_status && strpos( $content, '<!--OffBfLastPara-->' ) === false ) {
407
- $sch = "<p>";
408
- $content = str_replace( "<P>", $sch, $content );
409
  $paragraphsArray = explode( $sch, $content );
410
- if( count( $paragraphsArray ) > 2 ) {
 
411
  $content = implode( $sch, array_slice( $paragraphsArray, 0, count( $paragraphsArray ) - 1 ) ) . '<!--' . $g1 . '-->' . $sch . $paragraphsArray[count( $paragraphsArray ) - 1];
412
  }
 
 
413
  }
414
 
415
  // After Image ad
336
 
337
  // Create paragraph ads
338
  $number = 6;
339
+
340
  for ( $i = $number; $i >= 1; $i-- ) {
341
  if( !empty( $paragraph['status'][$i] ) ) {
342
  $sch = "</p>";
343
  $content = str_replace( "</P>", $sch, $content );
344
+ //xdebug_break();
345
+
346
  // paragraphs in content
347
  $paragraphsArray = explode( $sch, $content );
348
+
349
+
350
  if( ( int ) $paragraph['position'][$i] < count( $paragraphsArray ) ) {
351
+ $test = strpos( $paragraphsArray[$paragraph['position'][$i]], '</blockquote>');
352
+ // Check if a blockquote element is used
353
+ if (false === strpos( $paragraphsArray[$paragraph['position'][$i]], '</blockquote>')){
354
+ $content = implode( $sch, array_slice( $paragraphsArray, 0, $paragraph['position'][$i] ) ) . $sch . '<!--' . $paragraph[$i] . '-->' . implode( $sch, array_slice( $paragraphsArray, $paragraph['position'][$i] ) );
355
+ } else {
356
+ // Skip the p tag with blockquote element. Otherwise it would inject the ad into blockquote
357
+ $content = implode( $sch, array_slice( $paragraphsArray, 0, $paragraph['position'][$i]+1 ) ) . $sch . '<!--' . $paragraph[$i] . '-->' . implode( $sch, array_slice( $paragraphsArray, $paragraph['position'][$i] ) );
358
+ }
359
+
360
+
361
  } elseif( $paragraph['end_post'][$i] ) {
362
  $content = implode( $sch, $paragraphsArray ) . '<!--' . $paragraph[$i] . '-->';
363
  }
364
+ xdebug_break();
365
+
366
  }
367
  }
368
 
417
  $content = str_replace( '<span id="more-' . $postid . '"></span>', $mmr, $content );
418
  }
419
 
420
+ // Right before last paragraph ad
421
  if( $last_paragraph_position_status && strpos( $content, '<!--OffBfLastPara-->' ) === false ) {
422
+ $sch = "</p>";
423
+ $content = str_replace( "</P>", $sch, $content );
424
  $paragraphsArray = explode( $sch, $content );
425
+ //if( count( $paragraphsArray ) > 2 && !strpos($paragraphsArray[count( $paragraphsArray ) - 1], '</blockquote>')) {
426
+ if( count( $paragraphsArray ) > 2) {
427
  $content = implode( $sch, array_slice( $paragraphsArray, 0, count( $paragraphsArray ) - 1 ) ) . '<!--' . $g1 . '-->' . $sch . $paragraphsArray[count( $paragraphsArray ) - 1];
428
  }
429
+ xdebug_break();
430
+
431
  }
432
 
433
  // After Image ad
quick-adsense-reloaded.php CHANGED
@@ -6,7 +6,7 @@
6
  * Description: Insert Google AdSense and other ad formats fully automatic into your website
7
  * Author: Rene Hermenau, WP-Staging
8
  * Author URI: https://wordpress.org/plugins/quick-adsense-reloaded/
9
- * Version: 1.7.4
10
  * Text Domain: quick-adsense-reloaded
11
  * Domain Path: languages
12
  * Credits: WP QUADS - Quick AdSense Reloaded is a fork of Quick AdSense
@@ -38,7 +38,7 @@ if( !defined( 'ABSPATH' ) )
38
 
39
  // Plugin version
40
  if( !defined( 'QUADS_VERSION' ) ) {
41
- define( 'QUADS_VERSION', '1.7.4' );
42
  }
43
 
44
  // Plugin name
6
  * Description: Insert Google AdSense and other ad formats fully automatic into your website
7
  * Author: Rene Hermenau, WP-Staging
8
  * Author URI: https://wordpress.org/plugins/quick-adsense-reloaded/
9
+ * Version: 1.7.5
10
  * Text Domain: quick-adsense-reloaded
11
  * Domain Path: languages
12
  * Credits: WP QUADS - Quick AdSense Reloaded is a fork of Quick AdSense
38
 
39
  // Plugin version
40
  if( !defined( 'QUADS_VERSION' ) ) {
41
+ define( 'QUADS_VERSION', '1.7.5' );
42
  }
43
 
44
  // Plugin name
readme.txt CHANGED
@@ -130,6 +130,15 @@ Alternative Installation:
130
 
131
  == Changelog ==
132
 
 
 
 
 
 
 
 
 
 
133
  = 1.7.4 =
134
  * New: Option to explicetely allow wp quads to create the ads.txt
135
  * Fix: Invalid arguments and several thrown errors when no ads are defined
130
 
131
  == Changelog ==
132
 
133
+ = 1.7.5 =
134
+ * Fix: Disable ads on infinite scrolling pages
135
+ * Fix: Condition ad before last paragraph is not working
136
+ * Fix: Do not inject ads into blockquote elements
137
+ * Fix: ads.txt not writeable admin notice is showing incorrect google adsense publisherId
138
+ * Fix: WP QUADS Pro not working if valid license key expired
139
+ * Tweak: Rename ADSENSE CODE to Ad Code
140
+ * Tweak: default load priority is 10
141
+
142
  = 1.7.4 =
143
  * New: Option to explicetely allow wp quads to create the ads.txt
144
  * Fix: Invalid arguments and several thrown errors when no ads are defined