AdSense Plugin WP QUADS - Version 1.7.7

Version Description

  • New: Option to prevent multiple injection of https://cdn.ampproject.org/v0/amp-ad-0.1.js into AMP pages
  • Fix: Revert load priority to 20
  • Fix: Change vi default background and text color
  • Fix: vi password field too large - css issue
  • Fix: Error in_array() if post_type condition is empty
  • Fix: If last counted paragraph is empty, ad is injected in wrong position
  • Fix: Ads are injected into blockquote elements
  • Fix: Do not show vi notice on all admin pages. If ad blocker is enabled it can not be closed
  • Fix: Do not update vi ad code when vi api returns null
  • Tweak: Show error message when vi ad can not be created
  • Tweak: Show notice if WP QUADS Pro license has been expired but make sure that the pro plugin does not stop working
  • Tweak: Better ad blocker notice
Download this release

Release Info

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

Code changes from version 1.7.5 to 1.7.7

assets/js/quads-admin.js CHANGED
@@ -41,8 +41,8 @@ jQuery(document).ready(function ($) {
41
  // vi login process
42
  $("#quads_vi_login_submit").click(function(e){
43
  e.preventDefault();
44
- username = $("#email").val();
45
- password = $("#password").val();
46
 
47
  var data = '{"email":"' + username + '", "password":"' + password + '"}';
48
 
41
  // vi login process
42
  $("#quads_vi_login_submit").click(function(e){
43
  e.preventDefault();
44
+ username = $("#quads-vi-email").val();
45
+ password = $("#quads-vi-password").val();
46
 
47
  var data = '{"email":"' + username + '", "password":"' + password + '"}';
48
 
assets/js/quads-admin.min.js CHANGED
@@ -41,8 +41,8 @@ jQuery(document).ready(function ($) {
41
  // vi login process
42
  $("#quads_vi_login_submit").click(function(e){
43
  e.preventDefault();
44
- username = $("#email").val();
45
- password = $("#password").val();
46
 
47
  var data = '{"email":"' + username + '", "password":"' + password + '"}';
48
 
@@ -131,12 +131,12 @@ e.preventDefault();
131
  console.log('Success, login succesfull, token stored' + response);
132
  window.location.href = quads.path + '/wp-admin/?page=quads-settings&tab=general#quads_settingsvi_header';
133
  return false;
134
- }
135
  else {
136
  console.log("Can not store token");
137
  window.location.href = quads.path + '/wp-admin/?page=quads-settings&tab=general#quads_settingsvi_header';
138
  return false;
139
- }
140
  },
141
  beforeSend:function()
142
  {
41
  // vi login process
42
  $("#quads_vi_login_submit").click(function(e){
43
  e.preventDefault();
44
+ username = $("#quads-vi-email").val();
45
+ password = $("#quads-vi-password").val();
46
 
47
  var data = '{"email":"' + username + '", "password":"' + password + '"}';
48
 
131
  console.log('Success, login succesfull, token stored' + response);
132
  window.location.href = quads.path + '/wp-admin/?page=quads-settings&tab=general#quads_settingsvi_header';
133
  return false;
134
+ }
135
  else {
136
  console.log("Can not store token");
137
  window.location.href = quads.path + '/wp-admin/?page=quads-settings&tab=general#quads_settingsvi_header';
138
  return false;
139
+ }
140
  },
141
  beforeSend:function()
142
  {
includes/Autoloader.php CHANGED
@@ -1,154 +1,154 @@
1
- <?php
2
- namespace wpquads;
3
-
4
- /**
5
- * Class Autoloader
6
- * @package quads
7
- */
8
- class Autoloader
9
- {
10
- /**
11
- * An associative array; "namespace" => "directory"
12
- * @var array
13
- */
14
- private $namespaces;
15
-
16
- /**
17
- * Register multiple namespaces
18
- * @param array $namespaces
19
- */
20
- public function registerNamespaces($namespaces)
21
- {
22
- foreach($namespaces as $namespace => $baseDirectory)
23
- {
24
- // A string
25
- if (is_string($baseDirectory))
26
- {
27
- $this->registerNamespace($namespace, $baseDirectory);
28
- continue;
29
- }
30
-
31
- // Multiple directories
32
- foreach ($baseDirectory as $directory)
33
- {
34
- $this->registerNamespace($namespace, $directory);
35
- }
36
- }
37
- }
38
-
39
- /**
40
- * Register a namespace
41
- * @param string $namespace
42
- * @param string $baseDirectory
43
- * @param bool $prepend
44
- */
45
- public function registerNamespace($namespace, $baseDirectory, $prepend = false)
46
- {
47
- // Normalization
48
- // Normalize namespace
49
- $namespace = trim($namespace, "\\") . "\\";
50
- // Normalize base directory
51
- $baseDirectory = rtrim($baseDirectory, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
52
-
53
- // Namespace is not set
54
- if (false === isset($this->namespaces[$namespace]))
55
- {
56
- $this->namespaces[$namespace] = array();
57
- }
58
-
59
- // Prepend or add
60
- if ($prepend)
61
- {
62
- array_unshift($this->namespaces[$namespace], $baseDirectory);
63
- }
64
- else
65
- {
66
- array_push($this->namespaces[$namespace], $baseDirectory);
67
- }
68
- }
69
-
70
- /**
71
- * Loads the class file for given class name
72
- * @param string $class
73
- * @return bool
74
- */
75
- public function load($class)
76
- {
77
- $namespace = $class;
78
-
79
- // As long as we have a namespace
80
- while (false !== ($pos = strrpos($namespace, "\\")))
81
- {
82
- // Basic variables
83
- $namespace = substr($class, 0, $pos +1);
84
- $className = substr($class, $pos + 1);
85
-
86
- // Find file for given namespace & class name
87
- if ($this->findFile($namespace, $className))
88
- {
89
- return true;
90
- }
91
-
92
- // Trim to search another namespace
93
- $namespace = rtrim($namespace, "\\");
94
- }
95
-
96
- // Class not found
97
- return false;
98
- }
99
-
100
- /**
101
- * Attempts to find file for given namespace and class
102
- * @param string $namespace
103
- * @param string $class
104
- * @return bool
105
- */
106
- protected function findFile($namespace, $class)
107
- {
108
- // No registered base directory for given namespace
109
- if (false === isset($this->namespaces[$namespace]))
110
- {
111
- return false;
112
- }
113
-
114
- foreach ($this->namespaces[$namespace] as $baseDirectory)
115
- {
116
- // Look through base directory for given namespace
117
- $file = $baseDirectory . str_replace("\\", DIRECTORY_SEPARATOR, $class) . ".php";
118
-
119
- // File found
120
- if ($this->requireFile($file))
121
- {
122
- return true;
123
- }
124
- }
125
-
126
- // No file found
127
- return false;
128
- }
129
-
130
- /**
131
- * Requires file from FS if it exists
132
- * @param string $file
133
- * @return bool
134
- */
135
- protected function requireFile($file)
136
- {
137
- // File not found
138
- if (!file_exists($file))
139
- {
140
- return false;
141
- }
142
-
143
- require_once $file;
144
- return true;
145
- }
146
-
147
- /**
148
- * Registers autoloader with SPL autoloader stack
149
- */
150
- public function register()
151
- {
152
- spl_autoload_register(array($this, "load"));
153
- }
154
- }
1
+ <?php
2
+ namespace wpquads;
3
+
4
+ /**
5
+ * Class Autoloader
6
+ * @package quads
7
+ */
8
+ class Autoloader
9
+ {
10
+ /**
11
+ * An associative array; "namespace" => "directory"
12
+ * @var array
13
+ */
14
+ private $namespaces;
15
+
16
+ /**
17
+ * Register multiple namespaces
18
+ * @param array $namespaces
19
+ */
20
+ public function registerNamespaces($namespaces)
21
+ {
22
+ foreach($namespaces as $namespace => $baseDirectory)
23
+ {
24
+ // A string
25
+ if (is_string($baseDirectory))
26
+ {
27
+ $this->registerNamespace($namespace, $baseDirectory);
28
+ continue;
29
+ }
30
+
31
+ // Multiple directories
32
+ foreach ($baseDirectory as $directory)
33
+ {
34
+ $this->registerNamespace($namespace, $directory);
35
+ }
36
+ }
37
+ }
38
+
39
+ /**
40
+ * Register a namespace
41
+ * @param string $namespace
42
+ * @param string $baseDirectory
43
+ * @param bool $prepend
44
+ */
45
+ public function registerNamespace($namespace, $baseDirectory, $prepend = false)
46
+ {
47
+ // Normalization
48
+ // Normalize namespace
49
+ $namespace = trim($namespace, "\\") . "\\";
50
+ // Normalize base directory
51
+ $baseDirectory = rtrim($baseDirectory, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
52
+
53
+ // Namespace is not set
54
+ if (false === isset($this->namespaces[$namespace]))
55
+ {
56
+ $this->namespaces[$namespace] = array();
57
+ }
58
+
59
+ // Prepend or add
60
+ if ($prepend)
61
+ {
62
+ array_unshift($this->namespaces[$namespace], $baseDirectory);
63
+ }
64
+ else
65
+ {
66
+ array_push($this->namespaces[$namespace], $baseDirectory);
67
+ }
68
+ }
69
+
70
+ /**
71
+ * Loads the class file for given class name
72
+ * @param string $class
73
+ * @return bool
74
+ */
75
+ public function load($class)
76
+ {
77
+ $namespace = $class;
78
+
79
+ // As long as we have a namespace
80
+ while (false !== ($pos = strrpos($namespace, "\\")))
81
+ {
82
+ // Basic variables
83
+ $namespace = substr($class, 0, $pos +1);
84
+ $className = substr($class, $pos + 1);
85
+
86
+ // Find file for given namespace & class name
87
+ if ($this->findFile($namespace, $className))
88
+ {
89
+ return true;
90
+ }
91
+
92
+ // Trim to search another namespace
93
+ $namespace = rtrim($namespace, "\\");
94
+ }
95
+
96
+ // Class not found
97
+ return false;
98
+ }
99
+
100
+ /**
101
+ * Attempts to find file for given namespace and class
102
+ * @param string $namespace
103
+ * @param string $class
104
+ * @return bool
105
+ */
106
+ protected function findFile($namespace, $class)
107
+ {
108
+ // No registered base directory for given namespace
109
+ if (false === isset($this->namespaces[$namespace]))
110
+ {
111
+ return false;
112
+ }
113
+
114
+ foreach ($this->namespaces[$namespace] as $baseDirectory)
115
+ {
116
+ // Look through base directory for given namespace
117
+ $file = $baseDirectory . str_replace("\\", DIRECTORY_SEPARATOR, $class) . ".php";
118
+
119
+ // File found
120
+ if ($this->requireFile($file))
121
+ {
122
+ return true;
123
+ }
124
+ }
125
+
126
+ // No file found
127
+ return false;
128
+ }
129
+
130
+ /**
131
+ * Requires file from FS if it exists
132
+ * @param string $file
133
+ * @return bool
134
+ */
135
+ protected function requireFile($file)
136
+ {
137
+ // File not found
138
+ if (!file_exists($file))
139
+ {
140
+ return false;
141
+ }
142
+
143
+ require_once $file;
144
+ return true;
145
+ }
146
+
147
+ /**
148
+ * Registers autoloader with SPL autoloader stack
149
+ */
150
+ public function register()
151
+ {
152
+ spl_autoload_register(array($this, "load"));
153
+ }
154
+ }
includes/admin/admin-actions.php CHANGED
@@ -42,16 +42,6 @@ function quads_close_upgrade_notice() {
42
 
43
  add_action('quads_close_upgrade_notice', 'quads_close_upgrade_notice');
44
 
45
-
46
- /**
47
- * Close vi notice and do not show again
48
- */
49
- //function quads_close_vi_notice(){
50
- // update_option ('quads_close_vi_notice', 'yes');
51
- // delete_option('quads_show_vi_notice_later');
52
- //}
53
- //add_action('quads_close_vi_notice', 'quads_close_vi_notice');
54
-
55
  /**
56
  * Close vi welcome notice and do not show again
57
  */
42
 
43
  add_action('quads_close_upgrade_notice', 'quads_close_upgrade_notice');
44
 
 
 
 
 
 
 
 
 
 
 
45
  /**
46
  * Close vi welcome notice and do not show again
47
  */
includes/admin/admin-notices.php CHANGED
@@ -42,10 +42,12 @@ function quads_admin_messages() {
42
  echo quads_show_vi_notices();
43
 
44
  quads_show_ads_txt_notice();
 
 
45
 
46
 
47
  if (quads_is_admin_page()) {
48
- 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>';
49
  }
50
 
51
  // if( !quads_is_any_ad_activated() && quads_is_admin_page() ) {
@@ -406,29 +408,7 @@ function quads_ads_empty() {
406
  return false;
407
  }
408
 
409
- /**
410
- * Return VI admin notice
411
- * @return string
412
- */
413
- //function quads_get_vi_notice() {
414
- // if (false !== get_option ('quads_close_vi_notice') && false == quads_show_vi_notice_again() ) {
415
- // return false;
416
- // }
417
- //
418
- // $html = '<div class="quads-banner-wrapper">
419
- // <section class="quads-banner-content">
420
- // <div class="quads-banner-columns">
421
- // <main class="quads-banner-main"><p>' . sprintf(__('Available soon: the upcoming update to <strong>WP QUADS</strong> will feature a native video ad unit powered by video intelligence that will results in up to 10x higher revenue (RPM) </p>'
422
- // . '<p><a href="%s" target="_blank" rel="external nofollow">https://www.vi.ai/publisher-video-monetization</a>'), 'https://www.vi.ai/publisher-video-monetization/?utm_source=WordPress&utm_medium=Plugin%20blurb&utm_campaign=wpquads') . '</p></main>
423
- // <aside class="quads-banner-sidebar-first"><p><img src="' . QUADS_PLUGIN_URL . 'assets/images/vi_quads_logo.png" width="152" height="70"></p></aside>
424
- // <aside class="quads-banner-sidebar-second"><p style="text-align:center;"><a href="https://www.vi.ai/publisher-video-monetization/?utm_source=WordPress&utm_medium=Plugin%20blurb&utm_campaign=wpquads" class="quads-button-primary" target="_blank" rel="external nofollow">Learn More</a><a href="'.admin_url().'admin.php?page=quads-settings&quads-action=show_vi_notice_later" style="line-height:25px;"><br>Show again later</a></p></aside>
425
- // </div>
426
- // <aside class="quads-banner-close"><div style="margin-top:5px;"><a href="'.admin_url().'admin.php?page=quads-settings&quads-action=close_vi_notice" class="quads-notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></a></div></aside>
427
- // </section>
428
- //</div>';
429
- //
430
- // return $html;
431
- //}
432
  /**
433
  * Return VI admin notice
434
  * @return string
@@ -436,7 +416,7 @@ function quads_ads_empty() {
436
  function quads_get_vi_notice() {
437
  global $quads;
438
 
439
- if (false !== get_option('quads_close_vi_welcome_notice')) {
440
  return false;
441
  }
442
 
@@ -665,3 +645,43 @@ function quads_show_vi_api_error() {
665
  echo $blurb->render();
666
  }
667
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  echo quads_show_vi_notices();
43
 
44
  quads_show_ads_txt_notice();
45
+
46
+ quads_show_license_expired();
47
 
48
 
49
  if (quads_is_admin_page()) {
50
+ echo '<div class="notice notice-error" style="background-color:#ffebeb;display:none;" id="wpquads-adblock-notice">' . sprintf(__('<strong><p>Please disable your browser AdBlocker to resolve problems with WP QUADS ad setup</strong></p>', 'quick-adsense-reloaded'), admin_url() . 'admin.php?page=quads-settings#quads_settingsgeneral_header') . '</div>';
51
  }
52
 
53
  // if( !quads_is_any_ad_activated() && quads_is_admin_page() ) {
408
  return false;
409
  }
410
 
411
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
412
  /**
413
  * Return VI admin notice
414
  * @return string
416
  function quads_get_vi_notice() {
417
  global $quads;
418
 
419
+ if (false !== get_option('quads_close_vi_welcome_notice') || !quads_is_admin_page() ) {
420
  return false;
421
  }
422
 
645
  echo $blurb->render();
646
  }
647
  }
648
+
649
+ /**
650
+ * Show global notice WP QUADS Pro license expired
651
+ * @return mixed boolean | string
652
+ */
653
+ function quads_show_license_expired() {
654
+ global $quads_options, $wp_version;
655
+
656
+ $licKey = isset($quads_options['quads_wp_quads_pro_license_key']) ? $quads_options['quads_wp_quads_pro_license_key'] : '';
657
+
658
+ $lic = get_option('quads_wp_quads_pro_license_active');
659
+
660
+ if (!$lic) {
661
+ return false;
662
+ }
663
+
664
+ if (get_transient('quads_notice_lic_expired')) {
665
+ return false;
666
+ }
667
+ echo '<div class="notice notice-error">';
668
+ echo sprintf(
669
+ __( '<p>Oh No! <strong>WP Quads Pro</strong> expired on %s. Renew your license key to make sure that your (AdSense) ads are shown properly with your WordPress, version ' . $wp_version . '<br>'
670
+ . '<a href="%s" target="_blank" title="Renew your license key" class="button"><strong>Renew Your License Key Now</strong></a> | <a href="%s" title="Renew your license key">I am aware of possible issues and want to hide this reminder</a>'
671
+ , 'quick-adsense-reloaded' ), date_i18n( get_option( 'date_format' ), strtotime( $lic->expires, current_time( 'timestamp' ) ) ),
672
+ 'http://wpquads.com/checkout/?edd_license_key=' . $licKey . '&utm_campaign=adminnotic123e&utm_source=adminnotice123&utm_medium=admin&utm_content=license-expired',
673
+ admin_url() . 'admin.php?page=quads-settings&tab=licenses&quads-action=hide_license_expired_notice'
674
+
675
+ );
676
+ echo '</p></div>';
677
+ }
678
+
679
+ /**
680
+ * Store the transient for 30 days
681
+ */
682
+ function quads_hide_license_expired_notice(){
683
+ set_transient('quads_notice_lic_expired', 'hide', 60 * 60 * 24 * 30);
684
+ }
685
+
686
+
687
+ add_action('quads_hide_license_expired_notice', 'quads_hide_license_expired_notice');
includes/admin/settings/display-settings.php CHANGED
@@ -250,8 +250,9 @@ function quads_options_page() {
250
  'https://wordpress.org/support/plugin/quick-adsense-reloaded/reviews/#new-post',
251
  'http://wpquads.com/support/'
252
  );
253
- 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' ),
254
- 'http://wpquads.com/docs/adsense-ads-are-not-showing/?utm_source=plugin&utm_campaign=wpquads-settings&utm_medium=website&utm_term=bottomlink'
 
255
  );
256
  }
257
  ?>
@@ -340,8 +341,8 @@ function quads_render_adsense_form(){
340
  ?>
341
  <div id="quads-adsense-bg-div" style="display: none;">
342
  <div id="quads-adsense-container">
343
- <h3><?php _e( 'Copy ad code from AdSense account and paste it here', 'quick-adsense-reloaded' ); ?></h3>
344
- <?php _e('Do not enter code for <a href="https://wpquads.com/docs/integrate-page-level-ads-wordpress/" target="_blank">AdSense page level ads</a> here! <br> <a href="https://wpquads.com/docs/how-to-create-and-where-to-get-adsense-code/" target="_blank">Learn how to create AdSense ad code</a>', 'quick-adsense-reloaded'); ?>
345
  <textarea rows="15" cols="55" id="quads-adsense-form"></textarea><hr />
346
  <button class="button button-primary" id="quads-paste-button"><?php _e( 'Get Code', 'quick-adsense-reloaded' ); ?></button>&nbsp;&nbsp;
347
  <button class="button button-secondary" id="quads-close-button"><?php _e( 'Close', 'quick-adsense-reloaded' ); ?></button>
250
  'https://wordpress.org/support/plugin/quick-adsense-reloaded/reviews/#new-post',
251
  'http://wpquads.com/support/'
252
  );
253
+ echo '<br/><br/>' . sprintf( __( '<strong>Ads are not showing? Read the <a href="%s" target="_blank">troubleshooting guide</a> to find out how to resolve it.<p> Looking for a quick way to clone your WordPress? Try the free plugin <a href="%s" target="_blank">WP Staging</a>.', 'quick-adsense-reloaded' ),
254
+ 'http://wpquads.com/docs/adsense-ads-are-not-showing/?utm_source=plugin&utm_campaign=wpquads-settings&utm_medium=website&utm_term=bottomlink',
255
+ 'https://wp-staging.com/?utm_source=wpquads_plugin&utm_campaign=footer&utm_medium=website&utm_term=bottomlink'
256
  );
257
  }
258
  ?>
341
  ?>
342
  <div id="quads-adsense-bg-div" style="display: none;">
343
  <div id="quads-adsense-container">
344
+ <h3><?php _e( 'Enter <a ahref="https://wpquads.com/docs/how-to-create-and-where-to-get-adsense-code/" target="_blank">AdSense text & display ad code</a> here', 'quick-adsense-reloaded' ); ?></h3>
345
+ <?php _e('Do not enter <a href="https://wpquads.com/docs/integrate-page-level-ads-wordpress/" target="_blank">AdSense page level ads</a> or <a href="https://wpquads.com/introducing-new-adsense-auto-ads/" target="_blank">Auto ads!</a> <br> <a href="https://wpquads.com/docs/how-to-create-and-where-to-get-adsense-code/" target="_blank">Learn how to create AdSense ad code</a>', 'quick-adsense-reloaded'); ?>
346
  <textarea rows="15" cols="55" id="quads-adsense-form"></textarea><hr />
347
  <button class="button button-primary" id="quads-paste-button"><?php _e( 'Get Code', 'quick-adsense-reloaded' ); ?></button>&nbsp;&nbsp;
348
  <button class="button button-secondary" id="quads-close-button"><?php _e( 'Close', 'quick-adsense-reloaded' ); ?></button>
includes/admin/settings/register-settings.php CHANGED
@@ -211,7 +211,7 @@ function quads_get_registered_settings() {
211
  ),
212
  array(
213
  'id' => 'vi_header',
214
- 'name' => '<strong>' . __( 'New: vi', 'quick-adsense-reloaded' ) . '</strong>',
215
  'desc' => '<strong>Native video ad units powered by video intelligence</strong>',
216
  'type' => 'header'
217
  ),
@@ -229,13 +229,13 @@ function quads_get_registered_settings() {
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>'
235
- . '<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' )
236
  . '</ul>'
237
  . '<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' ) . ''
238
- . '<br><a href="%s" target="_blank">Read here</a> to find out the most effective AdSense banner sizes. </div>'
239
  . '<div id="quads-open-toggle" class="button">' . __( 'Open All Ads', 'quick-adsense-reloaded' ) . '</div>',
240
  'type' => 'header'
241
  ),
@@ -348,6 +348,14 @@ function quads_get_registered_settings() {
348
  'helper-desc' => __( 'Make the WPQUADS settings available from <strong>Settings->WPQUADS</strong>. This will remove the primary menu button from the admin sidebar', 'quick-adsense-reloaded' ),
349
  'type' => 'checkbox',
350
  ),
 
 
 
 
 
 
 
 
351
  'uninstall_on_delete' => array(
352
  'id' => 'uninstall_on_delete',
353
  'name' => __( 'Delete Data on Uninstall?', 'quick-adsense-reloaded' ),
@@ -1193,13 +1201,13 @@ if( !function_exists( 'quads_license_key_callback' ) ) {
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;
211
  ),
212
  array(
213
  'id' => 'vi_header',
214
+ 'name' => '<strong>' . __( 'vi ads', 'quick-adsense-reloaded' ) . '</strong>',
215
  'desc' => '<strong>Native video ad units powered by video intelligence</strong>',
216
  'type' => 'header'
217
  ),
229
  'adsense_header' => array(
230
  'id' => 'adsense_header',
231
  'name' => '<strong>' . __( 'Ad Code', 'quick-adsense-reloaded' ) . '</strong>',
232
+ 'desc' => '<div class="adsense_admin_header">' . __( 'Enter your ads below:</div>'
233
  . '<ul style="margin-top:10px;">'
234
+ . '<li style="font-weight:600;">- <i>AdSense</i> for using <span style="font-weight:600;">AdSense Text & display Ads</span>!</li>'
235
+ . '<li style="font-weight:600;">- <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' )
236
  . '</ul>'
237
  . '<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' ) . ''
238
+ . '<br><a href="http://wpquads.com/effective-adsense-banner-size-formats/?utm_campaign=plugin&utm_source=general_tab&utm_medium=admin&utm_content=best_banner_sizes" target="_blank">Read this</a> to find out the most effective AdSense banner sizes. </div>'
239
  . '<div id="quads-open-toggle" class="button">' . __( 'Open All Ads', 'quick-adsense-reloaded' ) . '</div>',
240
  'type' => 'header'
241
  ),
348
  'helper-desc' => __( 'Make the WPQUADS settings available from <strong>Settings->WPQUADS</strong>. This will remove the primary menu button from the admin sidebar', 'quick-adsense-reloaded' ),
349
  'type' => 'checkbox',
350
  ),
351
+ 'disableAmpScript' => array(
352
+ 'id' => 'disableAmpScript',
353
+ 'name' => __( 'Disable AMP script', 'quick-adsense-reloaded' ),
354
+ //'desc' => __( 'Make the WPQUADS settings available from <strong>Settings->WPQUADS</strong>. This will remove the primary menu button from the admin sidebar', 'quick-adsense-reloaded' ),
355
+ 'desc' => __( 'Disable AMP Scripts' ),
356
+ 'helper-desc' => __( 'Disable duplicate AMP ad script integration if your AMP plugin is already loading the script https://cdn.ampproject.org/v0/amp-ad-0.1.js into your site', 'quick-adsense-reloaded' ),
357
+ 'type' => 'checkbox',
358
+ ),
359
  'uninstall_on_delete' => array(
360
  'id' => 'uninstall_on_delete',
361
  'name' => __( 'Delete Data on Uninstall?', 'quick-adsense-reloaded' ),
1201
  }
1202
  }
1203
 
1204
+ // switch ( $license->license ) {
1205
+ // case 'invalid' :
1206
+ // $messages[] = sprintf(
1207
+ // __( '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'
1208
+ // );
1209
+ // break;
1210
+ // }
1211
 
1212
  } else {
1213
  $license_status = null;
includes/automattic-amp-ad.php CHANGED
@@ -12,6 +12,11 @@
12
 
13
  add_action( 'amp_post_template_head', 'quads_amp_add_amp_ad_js' );
14
  function quads_amp_add_amp_ad_js( $amp_template ) {
 
 
 
 
 
15
  ?>
16
  <script async custom-element="amp-ad" src="https://cdn.ampproject.org/v0/amp-ad-0.1.js"></script>
17
  <?php
12
 
13
  add_action( 'amp_post_template_head', 'quads_amp_add_amp_ad_js' );
14
  function quads_amp_add_amp_ad_js( $amp_template ) {
15
+ global $quads_options;
16
+
17
+ if (isset($quads_options['disableAmpScript'])){
18
+ return false;
19
+ }
20
  ?>
21
  <script async custom-element="amp-ad" src="https://cdn.ampproject.org/v0/amp-ad-0.1.js"></script>
22
  <?php
includes/class-quads-license-handler.php CHANGED
@@ -24,7 +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_debug = 'http://src.wordpress-develop.dev/edd-sl-api/'; // development
28
  /**
29
  * Class constructor
30
  *
@@ -115,7 +115,7 @@ class QUADS_License {
115
  add_action( 'admin_init', array( $this, 'auto_updater' ), 0 );
116
 
117
  // Display notices to admins
118
- add_action( 'admin_notices', array( $this, 'notices' ) );
119
 
120
  add_action( 'in_plugin_update_message-' . plugin_basename( $this->file ), array( $this, 'plugin_row_license_missing' ), 10, 2 );
121
 
@@ -395,55 +395,55 @@ class QUADS_License {
395
  * @access public
396
  * @return void
397
  */
398
- public function notices() {
399
-
400
- static $showed_invalid_message;
401
-
402
- if( empty( $this->license ) ) {
403
- return;
404
- }
405
-
406
- if( ! current_user_can( 'manage_options' ) ) {
407
- return;
408
- }
409
-
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. 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
-
426
- );
427
-
428
- $showed_invalid_message = true;
429
-
430
- }
431
-
432
- }
433
-
434
- if( ! empty( $messages ) ) {
435
-
436
- foreach( $messages as $message ) {
437
-
438
- echo '<div class="error">';
439
- echo '<p>' . $message . '</p>';
440
- echo '</div>';
441
-
442
- }
443
-
444
- }
445
-
446
- }
447
 
448
  /**
449
  * Displays message inline on plugin row that the license key is missing
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
  *
115
  add_action( 'admin_init', array( $this, 'auto_updater' ), 0 );
116
 
117
  // Display notices to admins
118
+ //add_action( 'admin_notices', array( $this, 'notices' ) );
119
 
120
  add_action( 'in_plugin_update_message-' . plugin_basename( $this->file ), array( $this, 'plugin_row_license_missing' ), 10, 2 );
121
 
395
  * @access public
396
  * @return void
397
  */
398
+ // public function notices() {
399
+ //
400
+ // static $showed_invalid_message;
401
+ //
402
+ // if( empty( $this->license ) ) {
403
+ // return;
404
+ // }
405
+ //
406
+ // if( ! current_user_can( 'manage_options' ) ) {
407
+ // return;
408
+ // }
409
+ //
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. 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
+ //
426
+ // );
427
+ //
428
+ // $showed_invalid_message = true;
429
+ //
430
+ // }
431
+ //
432
+ // }
433
+ //
434
+ // if( ! empty( $messages ) ) {
435
+ //
436
+ // foreach( $messages as $message ) {
437
+ //
438
+ // echo '<div class="error">';
439
+ // echo '<p>' . $message . '</p>';
440
+ // echo '</div>';
441
+ //
442
+ // }
443
+ //
444
+ // }
445
+ //
446
+ // }
447
 
448
  /**
449
  * Displays message inline on plugin row that the license key is missing
includes/post_types.php CHANGED
@@ -36,10 +36,12 @@ function quads_post_type_allowed(){
36
 
37
  if (!isset($post)){
38
  $return = false;
 
39
  }
40
 
41
- if (!isset($quads_options['post_types']) || empty($quads_options['post_types'])){
42
  $return = false;
 
43
  }
44
 
45
  $current_post_type = get_post_type($post->ID);
36
 
37
  if (!isset($post)){
38
  $return = false;
39
+ return apply_filters('quads_post_type_allowed',$return);
40
  }
41
 
42
+ if (!isset($quads_options['post_types']) || !is_array($quads_options['post_types']) || empty($quads_options['post_types'])){
43
  $return = false;
44
+ return apply_filters('quads_post_type_allowed',$return);
45
  }
46
 
47
  $current_post_type = get_post_type($post->ID);
includes/scripts.php CHANGED
@@ -35,6 +35,7 @@ function quads_check_ad_blocker(){
35
  if (typeof wpquads_adblocker_check === 'undefined' || false === wpquads_adblocker_check) {
36
  if (document.getElementById('wpquads-adblock-notice')){
37
  document.getElementById('wpquads-adblock-notice').style.display = 'block';
 
38
  }
39
  }
40
  }
35
  if (typeof wpquads_adblocker_check === 'undefined' || false === wpquads_adblocker_check) {
36
  if (document.getElementById('wpquads-adblock-notice')){
37
  document.getElementById('wpquads-adblock-notice').style.display = 'block';
38
+ console.log('adblocker detected');
39
  }
40
  }
41
  }
includes/template-functions.php CHANGED
@@ -16,7 +16,36 @@ if ( ! defined( 'ABSPATH' ) ) exit;
16
  add_filter('the_content', 'quads_post_settings_to_quicktags', 5);
17
  add_filter('the_content', 'quads_process_content', quads_get_load_priority());
18
 
 
 
 
 
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  /**
22
  * Adds quicktags, defined via post meta options, to content.
@@ -341,28 +370,50 @@ function quads_filter_default_ads( $content ) {
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
 
@@ -383,9 +434,15 @@ function quads_filter_default_ads( $content ) {
383
  // Check if ad is middle one
384
  if( $middle_position_status && strpos( $content, '<!--OffMiddle-->' ) === false ) {
385
  if( substr_count( strtolower( $content ), '</p>' ) >= 2 ) {
386
- $sch = "</p>";
387
- $content = str_replace( "</P>", $sch, $content );
388
- $paragraphsArray = explode( $sch, $content );
 
 
 
 
 
 
389
  $nn = 0;
390
  $mm = strlen( $content ) / 2;
391
  for ( $i = 0; $i < count( $paragraphsArray ); $i++ ) {
@@ -399,7 +456,7 @@ function quads_filter_default_ads( $content ) {
399
  break;
400
  }
401
  }
402
- $content = implode( $sch, $paragraphsArray );
403
  }
404
  }
405
 
@@ -419,14 +476,21 @@ function quads_filter_default_ads( $content ) {
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
 
16
  add_filter('the_content', 'quads_post_settings_to_quicktags', 5);
17
  add_filter('the_content', 'quads_process_content', quads_get_load_priority());
18
 
19
+ /**
20
+ * Show ads before posts
21
+ */
22
+ add_action('loop_start', 'quads_inject_ad');
23
 
24
+ function quads_inject_ad() {
25
+ global $quads_options, $post;
26
+
27
+ // Ads are deactivated via post meta settings
28
+ if( quads_check_meta_setting( 'NoAds' ) === '1' || quads_check_meta_setting( 'OffBegin' ) === '1'){
29
+ return false;
30
+ }
31
+
32
+ if( !quads_ad_is_allowed( '' ) || !is_main_query() ) {
33
+ return false;
34
+ }
35
+ // Array of ad codes ids
36
+ $adsArray = quads_get_active_ads();
37
+
38
+ // Return no ads are defined
39
+ if( count($adsArray) === 0 ) {
40
+ return false;
41
+ }
42
+
43
+ $id = 1;
44
+
45
+ $code = !empty($quads_options['ads']['ad' . $id ]['code']) ? $quads_options['ads']['ad' . $id ]['code'] : '';
46
+ echo quads_render_ad(1, $code, false);
47
+
48
+ }
49
 
50
  /**
51
  * Adds quicktags, defined via post meta options, to content.
370
  if( !empty( $paragraph['status'][$i] ) ) {
371
  $sch = "</p>";
372
  $content = str_replace( "</P>", $sch, $content );
373
+
374
+
375
+ /**
376
+ * Get all blockquote if there are any
377
+ */
378
+
379
+ preg_match_all("/<blockquote>(.*?)<\/blockquote>/s", $content, $blockquotes);
380
+
381
+ /**
382
+ * Replace blockquotes with placeholder
383
+ */
384
+ if(!empty($blockquotes)){
385
+ $bId = 0;
386
+ foreach($blockquotes[0] as $blockquote){
387
+ $content = str_replace(trim($blockquote), "#QUADSBLOCKQUOTE#" . $bId, $content);
388
+ $bId++;
389
+ }
390
+ }
391
+
392
+ // Get paragraph tags
393
  $paragraphsArray = explode( $sch, $content );
394
 
395
+ /**
396
+ * Check if last element is empty and remove it
397
+ */
398
+ if(trim($paragraphsArray[count($paragraphsArray)-1]) == "") array_pop($paragraphsArray);
399
 
400
+ if( ( int ) $paragraph['position'][$i] <= count( $paragraphsArray ) ) {
401
+ $content = implode( $sch, array_slice( $paragraphsArray, 0, $paragraph['position'][$i] ) ) . $sch . '<!--' . $paragraph[$i] . '-->' . implode( $sch, array_slice( $paragraphsArray, $paragraph['position'][$i] ) );
 
 
 
 
 
 
 
 
 
402
  } elseif( $paragraph['end_post'][$i] ) {
403
  $content = implode( $sch, $paragraphsArray ) . '<!--' . $paragraph[$i] . '-->';
404
  }
405
+
406
+ /**
407
+ * Put back blockquotes into content
408
+ */
409
+
410
+ if(!empty($blockquotes)){
411
+ $bId = 0;
412
+ foreach($blockquotes[0] as $blockquote){
413
+ $content = str_replace('#QUADSBLOCKQUOTE#' . $bId, trim($blockquote), $content);
414
+ $bId++;
415
+ }
416
+ }
417
  }
418
  }
419
 
434
  // Check if ad is middle one
435
  if( $middle_position_status && strpos( $content, '<!--OffMiddle-->' ) === false ) {
436
  if( substr_count( strtolower( $content ), '</p>' ) >= 2 ) {
437
+ $closingTagP = "</p>";
438
+ $content = str_replace( "</P>", $closingTagP, $content );
439
+ $paragraphsArray = explode( $closingTagP, $content );
440
+
441
+ /**
442
+ * Check if last element is empty and remove it
443
+ */
444
+ if(trim($paragraphsArray[count($paragraphsArray)-1]) == "") array_pop($paragraphsArray);
445
+
446
  $nn = 0;
447
  $mm = strlen( $content ) / 2;
448
  for ( $i = 0; $i < count( $paragraphsArray ); $i++ ) {
456
  break;
457
  }
458
  }
459
+ $content = implode( $closingTagP, $paragraphsArray );
460
  }
461
  }
462
 
476
 
477
  // Right before last paragraph ad
478
  if( $last_paragraph_position_status && strpos( $content, '<!--OffBfLastPara-->' ) === false ) {
479
+ $closingTagP = "</p>";
480
+ $content = str_replace( "</P>", $closingTagP, $content );
481
+ $paragraphsArray = explode( $closingTagP, $content );
482
+
483
+
484
+ /**
485
+ * Check if last element is empty and remove it
486
+ */
487
+ if(trim($paragraphsArray[count($paragraphsArray)-1]) == "") array_pop($paragraphsArray);
488
+
489
+
490
  //if( count( $paragraphsArray ) > 2 && !strpos($paragraphsArray[count( $paragraphsArray ) - 1], '</blockquote>')) {
491
  if( count( $paragraphsArray ) > 2) {
492
+ $content = implode( $closingTagP, array_slice( $paragraphsArray, 0, count( $paragraphsArray ) - 1 ) ) . '<!--' . $g1 . '-->' . $closingTagP . $paragraphsArray[count( $paragraphsArray ) - 1];
493
  }
 
494
 
495
  }
496
 
includes/vendor/vi/public/js/vi.js CHANGED
@@ -127,17 +127,22 @@ var save_quads_vi_ad_settings = function (){
127
  var data = {
128
  'action': 'quads_save_vi_ads',
129
  };
 
130
  jQuery.ajax({
131
  type: "POST",
132
  url: ajaxurl,
133
  dataType: "json",
134
  data: data,
 
135
  //contentType: 'application/json',
136
  success: function(response){
137
  console.log(response);
138
  //response = JSON.parse(response);
 
 
 
139
 
140
- if(typeof response.status != 'undefined' && response.status == 'error'){
141
 
142
  var resp = '<span style="color:red;">Error: </span>' + response.error.message + ' ' + (response.error.description ? response.error.description : '');
143
  } else {
127
  var data = {
128
  'action': 'quads_save_vi_ads',
129
  };
130
+
131
  jQuery.ajax({
132
  type: "POST",
133
  url: ajaxurl,
134
  dataType: "json",
135
  data: data,
136
+ //data: JSON.stringify(data),
137
  //contentType: 'application/json',
138
  success: function(response){
139
  console.log(response);
140
  //response = JSON.parse(response);
141
+
142
+ if(response === null){
143
+ var resp = '<span style="color:red;">Fatal Error: vi API is not returning anything </span>';
144
 
145
+ } else if(typeof response.status != 'undefined' && response.status == 'error'){
146
 
147
  var resp = '<span style="color:red;">Error: </span>' + response.error.message + ' ' + (response.error.description ? response.error.description : '');
148
  } else {
includes/vendor/vi/vi.php CHANGED
@@ -196,7 +196,7 @@ class vi {
196
  }
197
 
198
 
199
- if (isset($response->status) && $response->status == 'ok') {
200
  update_option('quads_vi_settings', $response);
201
  return true;
202
  }
@@ -453,8 +453,10 @@ class vi {
453
 
454
  $ads = get_option('quads_vi_ads');
455
 
456
- if (!$vi_token)
 
457
  return false;
 
458
 
459
 
460
  $viParam = $this->getViAdParams($ads);
@@ -491,13 +493,25 @@ class vi {
491
  );
492
 
493
  $response = wp_remote_post($this->settings->data->jsTagAPI, $args);
 
 
494
 
495
- if (is_wp_error($response))
496
- return false;
497
- if (wp_remote_retrieve_response_code($response) == '404' || wp_remote_retrieve_response_code($response) == '401')
498
  return false;
499
- if (empty($response))
 
 
 
 
 
 
 
 
 
500
  return false;
 
501
 
502
  // convert into object
503
  $response = json_decode($response['body']);
@@ -505,7 +519,8 @@ class vi {
505
 
506
  // Die()
507
  if ($response->status !== 'ok' || empty($response->data)) {
508
- return json_encode($response);
 
509
  }
510
 
511
  // Add ad code to key 1 as long as there are no more vi ad codes
@@ -536,8 +551,8 @@ class vi {
536
  'font' => !empty($ads['ads'][1]['txt_font_family']) && $ads['ads'][1]['txt_font_family'] != 'select' ? $ads['ads'][1]['txt_font_family'] : 'Verdana',
537
  'fontSize' => !empty($ads['ads'][1]['font_size']) ? $ads['ads'][1]['font_size'] : '12',
538
  'keywords' => !empty($ads['ads'][1]['keywords']) ? $ads['ads'][1]['keywords'] : 'key,words',
539
- 'textColor' => !empty($ads['ads'][1]['text_color']) ? '#' . $ads['ads'][1]['text_color'] : '#00ff00',
540
- 'backgroundColor' => !empty($ads['ads'][1]['bg_color']) ? '#' . $ads['ads'][1]['bg_color'] : '#00ff00',
541
  'vioptional1' => isset($ads['ads'][1]['optional1']) ? $ads['ads'][1]['optional1'] : 'optional1',
542
  'vioptional2' => isset($ads['ads'][1]['optional2']) ? $ads['ads'][1]['optional2'] : 'optional2',
543
  'vioptional3' => isset($ads['ads'][1]['optional3']) ? $ads['ads'][1]['optional3'] : 'optional3',
@@ -557,8 +572,8 @@ class vi {
557
  'iabCategory' => isset($ads['ads'][1]['iab2']) && 'select' != $ads['ads'][1]['iab2'] ? $ads['ads'][1]['iab2'] : 'IAB2-16',
558
  'font' => !empty($ads['ads'][1]['txt_font_family']) && $ads['ads'][1]['txt_font_family'] != 'select' ? $ads['ads'][1]['txt_font_family'] : 'Verdana',
559
  'keywords' => !empty($ads['ads'][1]['keywords']) ? $ads['ads'][1]['keywords'] : 'key,words',
560
- 'textColor' => !empty($ads['ads'][1]['text_color']) ? '#' . $ads['ads'][1]['text_color'] : '#00ff00',
561
- 'backgroundColor' => !empty($ads['ads'][1]['bg_color']) ? '#' . $ads['ads'][1]['bg_color'] : '#00ff00',
562
  'vioptional1' => isset($ads['ads'][1]['optional1']) ? $ads['ads'][1]['optional1'] : 'optional1',
563
  'vioptional2' => isset($ads['ads'][1]['optional2']) ? $ads['ads'][1]['optional2'] : 'optional2',
564
  'vioptional3' => isset($ads['ads'][1]['optional3']) ? $ads['ads'][1]['optional3'] : 'optional3',
196
  }
197
 
198
 
199
+ if (isset($response->status) && $response->status == 'ok' && !empty($response)) {
200
  update_option('quads_vi_settings', $response);
201
  return true;
202
  }
453
 
454
  $ads = get_option('quads_vi_ads');
455
 
456
+ if (!$vi_token){
457
+ error_log('vi token is empty');
458
  return false;
459
+ }
460
 
461
 
462
  $viParam = $this->getViAdParams($ads);
493
  );
494
 
495
  $response = wp_remote_post($this->settings->data->jsTagAPI, $args);
496
+
497
+ //wp_die(json_encode($response));
498
 
499
+
500
+ if (is_wp_error($response)){
501
+ error_log('is wp error: ' . $response);
502
  return false;
503
+ }
504
+ if (wp_remote_retrieve_response_code($response) == '404' || wp_remote_retrieve_response_code($response) == '401'){
505
+ error_log('is 404 or 401! Endpoint: ' . $this->settings->data->jsTagAPI . ' Token: '. $vi_token . ' Response: ' . print_r($response, true) . ' Params: ' . print_r($viParam, true));
506
+ // convert into object
507
+ $response = json_decode($response['body']);
508
+ return json_encode($response);
509
+ //return false;
510
+ }
511
+ if (empty($response)){
512
+ error_log('is empty');
513
  return false;
514
+ }
515
 
516
  // convert into object
517
  $response = json_decode($response['body']);
519
 
520
  // Die()
521
  if ($response->status !== 'ok' || empty($response->data)) {
522
+ error_log( 'is ok ' . $response );
523
+ return json_encode($response);
524
  }
525
 
526
  // Add ad code to key 1 as long as there are no more vi ad codes
551
  'font' => !empty($ads['ads'][1]['txt_font_family']) && $ads['ads'][1]['txt_font_family'] != 'select' ? $ads['ads'][1]['txt_font_family'] : 'Verdana',
552
  'fontSize' => !empty($ads['ads'][1]['font_size']) ? $ads['ads'][1]['font_size'] : '12',
553
  'keywords' => !empty($ads['ads'][1]['keywords']) ? $ads['ads'][1]['keywords'] : 'key,words',
554
+ 'textColor' => !empty($ads['ads'][1]['text_color']) ? '#' . $ads['ads'][1]['text_color'] : '#000000',
555
+ 'backgroundColor' => !empty($ads['ads'][1]['bg_color']) ? '#' . $ads['ads'][1]['bg_color'] : '#ffffff',
556
  'vioptional1' => isset($ads['ads'][1]['optional1']) ? $ads['ads'][1]['optional1'] : 'optional1',
557
  'vioptional2' => isset($ads['ads'][1]['optional2']) ? $ads['ads'][1]['optional2'] : 'optional2',
558
  'vioptional3' => isset($ads['ads'][1]['optional3']) ? $ads['ads'][1]['optional3'] : 'optional3',
572
  'iabCategory' => isset($ads['ads'][1]['iab2']) && 'select' != $ads['ads'][1]['iab2'] ? $ads['ads'][1]['iab2'] : 'IAB2-16',
573
  'font' => !empty($ads['ads'][1]['txt_font_family']) && $ads['ads'][1]['txt_font_family'] != 'select' ? $ads['ads'][1]['txt_font_family'] : 'Verdana',
574
  'keywords' => !empty($ads['ads'][1]['keywords']) ? $ads['ads'][1]['keywords'] : 'key,words',
575
+ 'textColor' => !empty($ads['ads'][1]['text_color']) ? '#' . $ads['ads'][1]['text_color'] : '#000000',
576
+ 'backgroundColor' => !empty($ads['ads'][1]['bg_color']) ? '#' . $ads['ads'][1]['bg_color'] : '#ffffff',
577
  'vioptional1' => isset($ads['ads'][1]['optional1']) ? $ads['ads'][1]['optional1'] : 'optional1',
578
  'vioptional2' => isset($ads['ads'][1]['optional2']) ? $ads['ads'][1]['optional2'] : 'optional2',
579
  'vioptional3' => isset($ads['ads'][1]['optional3']) ? $ads['ads'][1]['optional3'] : 'optional3',
includes/vendor/vi/views/not_logged_in.php CHANGED
@@ -43,10 +43,10 @@
43
  <form action="<?php echo admin_url() . '?quads_action=vi_login' ?>">
44
  <div class="quads-container">
45
  <label><b>E-Mail</b></label>
46
- <input type="text" placeholder="Enter Mail Address" name="email" id="email" novalidate>
47
 
48
  <label><b>Password</b></label>
49
- <input type="password" placeholder="Enter Password" name="password" id="password" novalidate>
50
 
51
  <button type="submit" id="quads_vi_login_submit" style="display:none;">Login</button>
52
  </div>
43
  <form action="<?php echo admin_url() . '?quads_action=vi_login' ?>">
44
  <div class="quads-container">
45
  <label><b>E-Mail</b></label>
46
+ <input type="text" placeholder="Enter Mail Address" name="email" id="quads-vi-email" novalidate>
47
 
48
  <label><b>Password</b></label>
49
+ <input type="password" placeholder="Enter Password" name="password" id="quads-vi-password" novalidate>
50
 
51
  <button type="submit" id="quads_vi_login_submit" style="display:none;">Login</button>
52
  </div>
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.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,7 +38,7 @@ if( !defined( 'ABSPATH' ) )
38
 
39
  // Plugin version
40
  if( !defined( 'QUADS_VERSION' ) ) {
41
- define( 'QUADS_VERSION', '1.7.5' );
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.7
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.7' );
42
  }
43
 
44
  // Plugin name
readme.txt CHANGED
@@ -10,7 +10,7 @@ Tags: adsense, ads, ad, google adsense, advertising, amp, ad injection, ad inser
10
  Requires at least: 3.6+
11
  Tested up to: 4.9
12
  Requires PHP: 5.3
13
- Stable tag: 1.7.4
14
 
15
  Quick Adsense Reloaded! Quickest way to insert Google AdSense & other ads into your website. Google AdSense integration with Google AMP support
16
 
@@ -43,8 +43,8 @@ So i decided to continue the project to make sure the plugin will also work in f
43
  Deprecated functions removed, bugs fixed and new filters and hooks created to make this plugin extensible by third party developers!
44
 
45
  <strong>We Guarantee: </strong><br>
46
- No revenue sharing from your Google AdSense advertising income. We never show our ads on your website.<br>
47
- We are an active and engaged member of the WordPress community and we are following strongly the WordPress Codex in terms of code quality and good behave.
48
 
49
  = Main Features =
50
 
@@ -130,9 +130,26 @@ Alternative Installation:
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
@@ -246,5 +263,5 @@ Complete changelog: https://wpquads.com/changelog
246
 
247
  == Upgrade Notice ==
248
 
249
- = 1.7.2 =
250
- 1.7.2 New: This update is highly recommended. It fixes serious issues which led to missing content elements.
10
  Requires at least: 3.6+
11
  Tested up to: 4.9
12
  Requires PHP: 5.3
13
+ Stable tag: 1.7.7
14
 
15
  Quick Adsense Reloaded! Quickest way to insert Google AdSense & other ads into your website. Google AdSense integration with Google AMP support
16
 
43
  Deprecated functions removed, bugs fixed and new filters and hooks created to make this plugin extensible by third party developers!
44
 
45
  <strong>We Guarantee: </strong><br>
46
+ This plugin does not do any revenue sharing with your Google AdSense ads. We never show our on ads ads on your website.<br>
47
+ We are an active and dedicated member of the WordPress community and we are following strictly the WordPress Codex in terms of code quality and good behave.
48
 
49
  = Main Features =
50
 
130
 
131
  == Changelog ==
132
 
133
+ = 1.7.7 =
134
+ * New: Option to prevent multiple injection of https://cdn.ampproject.org/v0/amp-ad-0.1.js into AMP pages
135
+ * Fix: Revert load priority to 20
136
+ * Fix: Change vi default background and text color
137
+ * Fix: vi password field too large - css issue
138
+ * Fix: Error in_array() if post_type condition is empty
139
+ * Fix: If last counted paragraph is empty, ad is injected in wrong position
140
+ * Fix: Ads are injected into blockquote elements
141
+ * Fix: Do not show vi notice on all admin pages. If ad blocker is enabled it can not be closed
142
+ * Fix: Do not update vi ad code when vi api returns null
143
+ * Tweak: Show error message when vi ad can not be created
144
+ * Tweak: Show notice if WP QUADS Pro license has been expired but make sure that the pro plugin does not stop working
145
+ * Tweak: Better ad blocker notice
146
+
147
+ = 1.7.6 =
148
+ * Fix: remove debug vars
149
+
150
  = 1.7.5 =
151
  * Fix: Disable ads on infinite scrolling pages
152
+ * Fix: Condition ad before last paragraph is not workingFix: Disable ads on infinite scrolling pages
153
  * Fix: Do not inject ads into blockquote elements
154
  * Fix: ads.txt not writeable admin notice is showing incorrect google adsense publisherId
155
  * Fix: WP QUADS Pro not working if valid license key expired
263
 
264
  == Upgrade Notice ==
265
 
266
+ = 1.7.7 =
267
+ 1.7.7 Lots of small improvements and tweaks