AdSense Plugin WP QUADS - Version 1.8.3

Version Description

  • New: WordPress 5.0 Gutenberg support
  • New: WordPress 5.1 support
  • New: WordPress 5.1.1 support
  • Fix: Undefined offset in wpquads\adsense
Download this release

Release Info

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

Code changes from version 1.8.2 to 1.8.3

assets/js/blocks.js ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var el = wp.element.createElement,
2
+ registerBlockType = wp.blocks.registerBlockType,
3
+ blockStyle = { backgroundColor: '#900', color: '#fff', padding: '20px' };
4
+
5
+ registerBlockType( 'wpquads/blocks', {
6
+ title: 'Hello World (Step 1)',
7
+
8
+ icon: 'universal-access-alt',
9
+
10
+ category: 'layout',
11
+
12
+ edit: function() {
13
+ return el( 'p', { style: blockStyle }, 'Hello editor.' );
14
+ },
15
+
16
+ save: function() {
17
+ return el( 'p', { style: blockStyle }, 'Hello saved content.' );
18
+ },
19
+ } );
20
+
21
+
includes/admin/admin-notices.php CHANGED
@@ -663,18 +663,20 @@ function quads_show_license_expired() {
663
 
664
  $lic = get_option( 'quads_wp_quads_pro_license_active' );
665
 
666
- //var_dump($lic);
667
-
668
  if( !$lic || (isset( $lic->license ) && $lic->license !== 'invalid') ) {
669
  return false;
670
  }
671
 
 
672
  if( get_transient( 'quads_notice_lic_expired' ) ) {
673
  return false;
674
  }
 
 
675
  echo '<div class="notice notice-error">';
676
  echo sprintf(
677
- __( '<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>'
678
  . '<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>'
679
  , 'quick-adsense-reloaded' ), date_i18n( get_option( 'date_format' ), strtotime( $lic->expires, current_time( 'timestamp' ) ) ), 'http://wpquads.com/checkout/?edd_license_key=' . $licKey . '&utm_campaign=adminnotic123e&utm_source=adminnotice123&utm_medium=admin&utm_content=license-expired', admin_url() . 'admin.php?page=quads-settings&tab=licenses&quads-action=hide_license_expired_notice'
680
  );
663
 
664
  $lic = get_option( 'quads_wp_quads_pro_license_active' );
665
 
666
+ // Do not show if no license at all or if there is a valid license key
 
667
  if( !$lic || (isset( $lic->license ) && $lic->license !== 'invalid') ) {
668
  return false;
669
  }
670
 
671
+ // Do not show notice for another 30 days
672
  if( get_transient( 'quads_notice_lic_expired' ) ) {
673
  return false;
674
  }
675
+
676
+
677
  echo '<div class="notice notice-error">';
678
  echo sprintf(
679
+ __( '<p>Oh No! <strong>WP Quads Pro</strong> license key is not activated or has been expired. It expires on %s. Renew or activate your license key to make sure that your (AdSense) ads are shown properly with your WordPress, version ' . $wp_version . '<br>'
680
  . '<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>'
681
  , 'quick-adsense-reloaded' ), date_i18n( get_option( 'date_format' ), strtotime( $lic->expires, current_time( 'timestamp' ) ) ), 'http://wpquads.com/checkout/?edd_license_key=' . $licKey . '&utm_campaign=adminnotic123e&utm_source=adminnotice123&utm_medium=admin&utm_content=license-expired', admin_url() . 'admin.php?page=quads-settings&tab=licenses&quads-action=hide_license_expired_notice'
682
  );
includes/admin/settings/register-settings.php CHANGED
@@ -2150,7 +2150,9 @@ function quads_adsense_code_callback( $args ) {
2150
  //get g_data_ad_slot
2151
  $explode_ad_code = explode( 'data-ad-slot', $value['code'] );
2152
  preg_match( '#"([a-zA-Z0-9/\s]+)"#', $explode_ad_code[1], $matches_add_slot );
 
2153
  $quads_options['ads'][$key]['g_data_ad_slot'] = str_replace( array('"', ' '), array(''), $matches_add_slot[1] );
 
2154
  } else {
2155
  //*** GOOGLE SYNCRON *************
2156
  $quads_options['ads'][$key]['current_ad_type'] = 'google_sync';
@@ -2161,8 +2163,10 @@ function quads_adsense_code_callback( $args ) {
2161
 
2162
  //get g_data_ad_slot
2163
  $explode_ad_code = explode( 'google_ad_slot', $value['code'] );
2164
- preg_match( '#"([a-zA-Z0-9/\s]+)"#', $explode_ad_code[1], $matches_add_slot );
2165
- $quads_options['ads'][$key]['g_data_ad_slot'] = str_replace( array('"', ' '), array(''), $matches_add_slot[1] );
 
 
2166
  }
2167
  }
2168
  }
2150
  //get g_data_ad_slot
2151
  $explode_ad_code = explode( 'data-ad-slot', $value['code'] );
2152
  preg_match( '#"([a-zA-Z0-9/\s]+)"#', $explode_ad_code[1], $matches_add_slot );
2153
+ if (isset($matches_add_slot[1])){
2154
  $quads_options['ads'][$key]['g_data_ad_slot'] = str_replace( array('"', ' '), array(''), $matches_add_slot[1] );
2155
+ }
2156
  } else {
2157
  //*** GOOGLE SYNCRON *************
2158
  $quads_options['ads'][$key]['current_ad_type'] = 'google_sync';
2163
 
2164
  //get g_data_ad_slot
2165
  $explode_ad_code = explode( 'google_ad_slot', $value['code'] );
2166
+ //preg_match( '#"([a-zA-Z0-9/\s]+)"#', $explode_ad_code[1], $matches_add_slot );
2167
+ //$quads_options['ads'][$key]['g_data_ad_slot'] = str_replace( array('"', ' '), array(''), $matches_add_slot[1] );
2168
+ preg_match( '#"([a-zA-Z0-9/\s]+)"#', isset($explode_ad_code[1]) ? $explode_ad_code[1] : null, $matches_add_slot );
2169
+ $quads_options['ads'][$key]['g_data_ad_slot'] = str_replace( array('"', ' '), array(''), isset($matches_add_slot[1]) ? $matches_add_slot[1] : null );
2170
  }
2171
  }
2172
  }
includes/scripts.php CHANGED
@@ -18,29 +18,29 @@ add_action( 'wp_print_styles', 'quads_inline_styles', 9999 );
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_enqueue_scripts', 'quads_load_all_admin_scripts', 100 );
21
- add_action('admin_print_footer_scripts', 'quads_check_ad_blocker');
22
 
23
  /**
24
  * Create ad blocker admin script
25
  *
26
  * @return mixed boolean | string
27
  */
28
- function quads_check_ad_blocker(){
29
- if (!quads_is_admin_page()){
30
  return false;
31
  }
32
  ?>
33
- <script type="text/javascript">
34
- window.onload = function(){
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
- }
42
- </script>
43
- <?php
44
  }
45
 
46
  /**
@@ -58,13 +58,13 @@ function quads_load_admin_scripts( $hook ) {
58
  return;
59
  }
60
  global $wp_version, $quads;
61
-
62
- $js_dir = QUADS_PLUGIN_URL . 'assets/js/';
63
  $css_dir = QUADS_PLUGIN_URL . 'assets/css/';
64
 
65
  // Use minified libraries if SCRIPT_DEBUG is turned off
66
  $suffix = ( quadsIsDebugMode() ) ? '' : '.min';
67
-
68
 
69
  // These have to be global
70
  wp_enqueue_script( 'quads-admin-ads', $js_dir . 'ads.js', array('jquery'), QUADS_VERSION, false );
@@ -74,24 +74,24 @@ function quads_load_admin_scripts( $hook ) {
74
  wp_enqueue_script( 'jquery-form' );
75
 
76
  $vi_dir = QUADS_PLUGIN_URL . 'includes/vendor/vi/public/js/';
77
- wp_enqueue_script('quads-vi', $vi_dir . 'vi.js', array(), QUADS_VERSION, false);
 
78
 
79
-
80
  wp_enqueue_style( 'quads-admin', $css_dir . 'quads-admin' . $suffix . '.css', QUADS_VERSION );
81
  wp_enqueue_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', QUADS_VERSION );
82
-
83
  $signupURL = $quads->vi->getSettings()->data->signupURL;
84
-
85
  wp_localize_script( 'quads-admin-scripts', 'quads', array(
86
- 'nonce' => wp_create_nonce( 'quads_ajax_nonce' ),
87
- 'error' => __( "error", 'quick-adsense-reloaded' ),
88
- 'path' => get_option( 'siteurl' ),
89
- 'vi_revenue' => !empty($quads->vi->getRevenue()->mtdReport) ? $quads->vi->getRevenue()->mtdReport : '',
90
- 'vi_login_url' => $quads->vi->getLoginURL(),
91
- 'vi_signup_url' => !empty($signupURL) ? $signupURL : '',
92
- 'domain' => $quads->vi->getDomain(),
93
- 'email' => get_option('admin_email'),
94
- 'aid' => 'WP_Quads'
95
  ) );
96
  }
97
 
@@ -110,15 +110,16 @@ function quads_load_plugins_admin_scripts( $hook ) {
110
  return;
111
  }
112
 
113
- $js_dir = QUADS_PLUGIN_URL . 'assets/js/';
114
  $css_dir = QUADS_PLUGIN_URL . 'assets/css/';
115
 
116
  // Use minified libraries if SCRIPT_DEBUG is turned off
117
  $suffix = ( quadsIsDebugMode() ) ? '' : '.min';
118
 
119
  wp_enqueue_script( 'quads-plugins-admin-scripts', $js_dir . 'quads-plugins-admin' . $suffix . '.js', array('jquery'), QUADS_VERSION, false );
120
- wp_enqueue_style( 'quads-plugins-admin', $css_dir . 'quads-plugins-admin' . $suffix . '.css', QUADS_VERSION );
121
  }
 
122
  /**
123
  * Load Admin Scripts available on all admin pages
124
  *
@@ -130,15 +131,29 @@ function quads_load_plugins_admin_scripts( $hook ) {
130
  * @return void
131
  */
132
  function quads_load_all_admin_scripts( $hook ) {
133
- // if( !apply_filters( 'quads_load_all_admin_scripts', quads_is_plugins_page(), $hook ) ) {
134
- // //return;
135
- // }
136
 
137
  $css_dir = QUADS_PLUGIN_URL . 'assets/css/';
138
 
139
- wp_enqueue_style( 'quads-admin-all', $css_dir . 'quads-admin-all.css', QUADS_VERSION );
140
  }
141
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  /**
143
  * Register CSS Styles
144
  *
@@ -170,20 +185,20 @@ function quads_load_all_admin_scripts( $hook ) {
170
  */
171
  function quads_inline_styles() {
172
  global $quads_options;
173
-
174
  $css = '';
175
-
176
  if( isset( $quads_options['ads'] ) ) {
177
- foreach ( $quads_options['ads'] as $key => $value ) {
178
- $css .= quads_render_media_query( $key, $value );
179
- }
180
- }
181
- // Register empty style so we do not need an external css file
182
- wp_register_style( 'quads-styles', false );
183
- // Enque empty style
184
- wp_enqueue_style( 'quads-styles' );
185
- // Add inline css to that style
186
- wp_add_inline_style( 'quads-styles', $css );
187
  }
188
 
189
  /**
@@ -193,31 +208,31 @@ function quads_inline_styles() {
193
  * @param string $value
194
  * @return string
195
  */
196
- function quads_render_media_query($key, $value){
197
- $lic = get_option( 'quads_wp_quads_pro_license_active' );
198
- if( !$lic || (is_object( $lic ) && $lic->success !== true) ) {
199
- return '';
200
- }
201
-
202
- $html = '';
203
-
204
- if (isset($value['desktop']) ){
205
  //$html .= '/* Hide on desktop */';
206
- $html .= '@media only screen and (min-width:1140px){#quads-'.$key.', .quads-' . $key . ' {display:none;}}'. "\n";
207
  }
208
- if (isset($value['tablet_landscape']) ){
209
  //$html .= '/* Hide on tablet landscape */';
210
- $html .= '@media only screen and (min-width:1024px) and (max-width:1140px) {#quads-'.$key.', .quads-'.$key.' {display:none;}}' . "\n";
211
  }
212
- if (isset($value['tablet_portrait']) ){
213
  //$html .= '/* Hide on tablet portrait */';
214
- $html .= '@media only screen and (min-width:768px) and (max-width:1023px){#quads-'.$key.', .quads-'.$key.' {display:none;}}' . "\n";
215
  }
216
- if (isset($value['phone']) ){
217
  //$html .= '/* Hide on mobile device */';
218
- $html .= '@media only screen and (max-width:767px){#quads-'.$key.', .quads-'.$key.' {display:none;}}' . "\n";
219
  }
220
-
221
  return $html;
222
  }
223
 
@@ -227,10 +242,11 @@ function quads_render_media_query($key, $value){
227
  * @since 0.9.0
228
  * @return bool true if Mashshare debug mode is on
229
  */
230
- function quadsIsDebugMode(){
 
231
  global $quads_options;
232
 
233
- $debug_mode = isset($quads_options['debug_mode']) ? true : false;
234
  return $debug_mode;
235
  }
236
 
@@ -240,53 +256,61 @@ function quadsIsDebugMode(){
240
  * @author Tedd Garland, René Hermenau
241
  * @since 0.9.0
242
  */
 
243
 
244
-
245
-
246
- $wpvcomp = (bool)(version_compare(get_bloginfo('version'), '3.1', '>='));
247
  function quads_ads_head_script() {
248
  global $quads_options, $wpvcomp;
249
 
250
- if ( isset($quads_options['quicktags']['QckTags'] ) ) { ?>
 
251
  <script type="text/javascript">
252
- wpvcomp = <?php echo(($wpvcomp==1)?"true":"false"); ?>;
253
  edaddID = new Array();
254
  edaddNm = new Array();
255
- if(typeof(edButtons)!='undefined') {
256
- edadd = edButtons.length;
257
- var dynads={"all":[
258
- <?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",');}; } ?>
259
- "0"]};
260
- for(i=1;i<=<?php echo count( quads_get_ads() ) -1; ?>;i++) {
261
- if(dynads.all[i-1]=="1") {
262
- edButtons[edButtons.length]=new edButton("ads"+i.toString(),"Ads"+i.toString(),"\n<!--Ads"+i.toString()+"-->\n","","",-1);
263
- edaddID[edaddID.length] = "ads"+i.toString();
264
- edaddNm[edaddNm.length] = "Ads"+i.toString();
265
- }
266
- }
267
- <?php if( !isset($quads_options['quicktags']['QckRnds'] ) ){ ?>
268
- edButtons[edButtons.length]=new edButton("random_ads","RndAds","\n<!--RndAds-->\n","","",-1);
269
- edaddID[edaddID.length] = "random_ads";
270
- edaddNm[edaddNm.length] = "RndAds";
 
 
 
 
 
 
 
271
  <?php } ?>
272
- edButtons[edButtons.length]=new edButton("no_ads","NoAds","\n<!--NoAds-->\n","","",-1);
273
- edaddID[edaddID.length] = "no_ads";
274
- edaddNm[edaddNm.length] = "NoAds";
275
- };
276
- (function(){
277
- if(typeof(edButtons)!='undefined' && typeof(jQuery)!='undefined' && wpvcomp){
278
- jQuery(document).ready(function(){
279
- for(i=0;i<edaddID.length;i++) {
280
- jQuery("#ed_toolbar").append('<input type="button" value="' + edaddNm[i] +'" id="' + edaddID[i] +'" class="ed_button" onclick="edInsertTag(edCanvas, ' + (edadd+i) + ');" title="' + edaddNm[i] +'" />');
281
- }
282
- });
283
- }
284
- }());
285
  </script>
286
- <?php }
287
  }
288
- if ($wpvcomp) {
289
- add_action('admin_print_footer_scripts', 'quads_ads_head_script');
290
- }else{
291
- add_action('admin_head', 'quads_ads_head_javascript_script');
 
 
292
  }
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_enqueue_scripts', 'quads_load_all_admin_scripts', 100 );
21
+ add_action( 'admin_print_footer_scripts', 'quads_check_ad_blocker' );
22
 
23
  /**
24
  * Create ad blocker admin script
25
  *
26
  * @return mixed boolean | string
27
  */
28
+ function quads_check_ad_blocker() {
29
+ if( !quads_is_admin_page() ) {
30
  return false;
31
  }
32
  ?>
33
+ <script type="text/javascript">
34
+ window.onload = function(){
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
+ }
42
+ </script>
43
+ <?php
44
  }
45
 
46
  /**
58
  return;
59
  }
60
  global $wp_version, $quads;
61
+
62
+ $js_dir = QUADS_PLUGIN_URL . 'assets/js/';
63
  $css_dir = QUADS_PLUGIN_URL . 'assets/css/';
64
 
65
  // Use minified libraries if SCRIPT_DEBUG is turned off
66
  $suffix = ( quadsIsDebugMode() ) ? '' : '.min';
67
+
68
 
69
  // These have to be global
70
  wp_enqueue_script( 'quads-admin-ads', $js_dir . 'ads.js', array('jquery'), QUADS_VERSION, false );
74
  wp_enqueue_script( 'jquery-form' );
75
 
76
  $vi_dir = QUADS_PLUGIN_URL . 'includes/vendor/vi/public/js/';
77
+ wp_enqueue_script( 'quads-vi', $vi_dir . 'vi.js', array(), QUADS_VERSION, false );
78
+
79
 
 
80
  wp_enqueue_style( 'quads-admin', $css_dir . 'quads-admin' . $suffix . '.css', QUADS_VERSION );
81
  wp_enqueue_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', QUADS_VERSION );
82
+
83
  $signupURL = $quads->vi->getSettings()->data->signupURL;
84
+
85
  wp_localize_script( 'quads-admin-scripts', 'quads', array(
86
+ 'nonce' => wp_create_nonce( 'quads_ajax_nonce' ),
87
+ 'error' => __( "error", 'quick-adsense-reloaded' ),
88
+ 'path' => get_option( 'siteurl' ),
89
+ 'vi_revenue' => !empty( $quads->vi->getRevenue()->mtdReport ) ? $quads->vi->getRevenue()->mtdReport : '',
90
+ 'vi_login_url' => $quads->vi->getLoginURL(),
91
+ 'vi_signup_url' => !empty( $signupURL ) ? $signupURL : '',
92
+ 'domain' => $quads->vi->getDomain(),
93
+ 'email' => get_option( 'admin_email' ),
94
+ 'aid' => 'WP_Quads'
95
  ) );
96
  }
97
 
110
  return;
111
  }
112
 
113
+ $js_dir = QUADS_PLUGIN_URL . 'assets/js/';
114
  $css_dir = QUADS_PLUGIN_URL . 'assets/css/';
115
 
116
  // Use minified libraries if SCRIPT_DEBUG is turned off
117
  $suffix = ( quadsIsDebugMode() ) ? '' : '.min';
118
 
119
  wp_enqueue_script( 'quads-plugins-admin-scripts', $js_dir . 'quads-plugins-admin' . $suffix . '.js', array('jquery'), QUADS_VERSION, false );
120
+ wp_enqueue_style( 'quads-plugins-admin', $css_dir . 'quads-plugins-admin' . $suffix . '.css', QUADS_VERSION );
121
  }
122
+
123
  /**
124
  * Load Admin Scripts available on all admin pages
125
  *
131
  * @return void
132
  */
133
  function quads_load_all_admin_scripts( $hook ) {
134
+
 
 
135
 
136
  $css_dir = QUADS_PLUGIN_URL . 'assets/css/';
137
 
138
+ wp_enqueue_style( 'quads-admin-all', $css_dir . 'quads-admin-all.css', QUADS_VERSION );
139
  }
140
 
141
+ /**
142
+ * Create Gutenberg block
143
+ */
144
+ function quads_load_blocks() {
145
+ $js_dir = QUADS_PLUGIN_URL . 'assets/js/';
146
+
147
+ wp_register_script( 'wpquads', $js_dir . 'blocks.js', array('wp-blocks', 'wp-element', 'wp-editor') );
148
+
149
+ register_block_type( 'wpquads/blocks', array(
150
+ 'editor_script' => 'wpquads',
151
+ ) );
152
+ }
153
+
154
+ add_action( 'init', 'quads_load_blocks' );
155
+
156
+
157
  /**
158
  * Register CSS Styles
159
  *
185
  */
186
  function quads_inline_styles() {
187
  global $quads_options;
188
+
189
  $css = '';
190
+
191
  if( isset( $quads_options['ads'] ) ) {
192
+ foreach ( $quads_options['ads'] as $key => $value ) {
193
+ $css .= quads_render_media_query( $key, $value );
194
+ }
195
+ }
196
+ // Register empty style so we do not need an external css file
197
+ wp_register_style( 'quads-styles', false );
198
+ // Enque empty style
199
+ wp_enqueue_style( 'quads-styles' );
200
+ // Add inline css to that style
201
+ wp_add_inline_style( 'quads-styles', $css );
202
  }
203
 
204
  /**
208
  * @param string $value
209
  * @return string
210
  */
211
+ function quads_render_media_query( $key, $value ) {
212
+ $lic = get_option( 'quads_wp_quads_pro_license_active' );
213
+ if( !$lic || (is_object( $lic ) && $lic->success !== true) ) {
214
+ return '';
215
+ }
216
+
217
+ $html = '';
218
+
219
+ if( isset( $value['desktop'] ) ) {
220
  //$html .= '/* Hide on desktop */';
221
+ $html .= '@media only screen and (min-width:1140px){#quads-' . $key . ', .quads-' . $key . ' {display:none;}}' . "\n";
222
  }
223
+ if( isset( $value['tablet_landscape'] ) ) {
224
  //$html .= '/* Hide on tablet landscape */';
225
+ $html .= '@media only screen and (min-width:1024px) and (max-width:1140px) {#quads-' . $key . ', .quads-' . $key . ' {display:none;}}' . "\n";
226
  }
227
+ if( isset( $value['tablet_portrait'] ) ) {
228
  //$html .= '/* Hide on tablet portrait */';
229
+ $html .= '@media only screen and (min-width:768px) and (max-width:1023px){#quads-' . $key . ', .quads-' . $key . ' {display:none;}}' . "\n";
230
  }
231
+ if( isset( $value['phone'] ) ) {
232
  //$html .= '/* Hide on mobile device */';
233
+ $html .= '@media only screen and (max-width:767px){#quads-' . $key . ', .quads-' . $key . ' {display:none;}}' . "\n";
234
  }
235
+
236
  return $html;
237
  }
238
 
242
  * @since 0.9.0
243
  * @return bool true if Mashshare debug mode is on
244
  */
245
+
246
+ function quadsIsDebugMode() {
247
  global $quads_options;
248
 
249
+ $debug_mode = isset( $quads_options['debug_mode'] ) ? true : false;
250
  return $debug_mode;
251
  }
252
 
256
  * @author Tedd Garland, René Hermenau
257
  * @since 0.9.0
258
  */
259
+ $wpvcomp = ( bool ) (version_compare( get_bloginfo( 'version' ), '3.1', '>=' ));
260
 
 
 
 
261
  function quads_ads_head_script() {
262
  global $quads_options, $wpvcomp;
263
 
264
+ if( isset( $quads_options['quicktags']['QckTags'] ) ) {
265
+ ?>
266
  <script type="text/javascript">
267
+ wpvcomp = <?php echo (($wpvcomp == 1) ? "true " : "false"); ?>;
268
  edaddID = new Array();
269
  edaddNm = new Array();
270
+ if (typeof (edButtons) != 'undefined') {
271
+ edadd = edButtons.length;
272
+ var dynads = {"all":[
273
+ <?php
274
+ for ( $i = 1; $i <= count( quads_get_ads() ) - 1; $i++ ) {
275
+ if( isset( $quads_options['ads']['ad' . $i]['code'] ) && $quads_options['ads']['ad' . $i]['code'] != '' ) {
276
+ echo('" 1",');
277
+ } else {
278
+ echo('"0",');
279
+ };
280
+ }
281
+ ?>
282
+ " 0 "] };
283
+ for (i = 1; i <=<?php echo count( quads_get_ads() ) - 1; ?>; i++) { i f (dynads.all[ i - 1 ] == "1") {
284
+ edButtons [ edButtons.le n gth] = n ew edB u tton("ads" + i.toString(), "Ads" + i.toString(), "\n<!--Ads"+i.toSt r ing()+"-->\n", "", "", - 1);
285
+ edaddID[eda d dID.length] = " ads" + i.t oString();
286
+ edaddNm[edaddNm.length] ="Ads" + i.toString();
287
+ }
288
+ }
289
+ <?php if( !isset( $quads_options['quicktags']['QckRnds'] ) ) { ?>
290
+ edButtons[edButtons.length] = n e w edButton("random_ads", " RndAds", "\n<!--RndAds-->\n", "", "", - 1);
291
+ edaddID[edaddID.length] = "random_ads";
292
+ edaddNm[edaddNm.length] = "RndAds";
293
  <?php } ?>
294
+ edButtons[edButtons.length] = new edButton("no_ads", "NoAds", "\n<!--NoAds-->\n","","",-1);
295
+ edaddID[edaddID.length] = "no_ads";
296
+ edaddNm[edaddNm.length] = "NoAds";
297
+ };
298
+ (function(){
299
+ if(typeof(edButtons)!='undefined' && typeof(jQuery)!='undefined' && wpvcomp){
300
+ jQuery(document).ready(function(){
301
+ for(i=0;i<edaddID.length;i++) {
302
+ jQuery("#ed_toolbar").append('<input type="button" value="' + edaddNm[i] +'" id="' + edaddID[i] +'" class="ed_button" onclick="edInsertTag(edCanvas, ' + (edadd+i) + ');" title="' + edaddNm[i] +'" />');
303
+ }
304
+ });
305
+ }
306
+ }());
307
  </script>
308
+ <?php
309
  }
310
+ }
311
+
312
+ if( $wpvcomp ) {
313
+ add_action( 'admin_print_footer_scripts', 'quads_ads_head_script' );
314
+ } else {
315
+ add_action( 'admin_head', 'quads_ads_head_javascript_script' );
316
  }
includes/vendor/google/adsense.php CHANGED
@@ -67,13 +67,17 @@ class adsense {
67
  //get g_data_ad_client
68
  $explode_ad_code = explode('data-ad-client', $value['code']);
69
  preg_match('#"([a-zA-Z0-9-\s]+)"#', $explode_ad_code[1], $matches_add_client);
70
- $this->publisherIds[] = str_replace(array('"', ' '), array(''), $matches_add_client[1]);
 
 
71
  } else {
72
  //*** GOOGLE SYNCRON *************
73
  //get g_data_ad_client
74
  $explode_ad_code = explode('google_ad_client', $value['code']);
75
  preg_match('#"([a-zA-Z0-9-\s]+)"#', $explode_ad_code[1], $matches_add_client);
76
- $this->publisherIds[] = str_replace(array('"', ' '), array(''), $matches_add_client[1]);
 
 
77
  }
78
  }
79
  }
67
  //get g_data_ad_client
68
  $explode_ad_code = explode('data-ad-client', $value['code']);
69
  preg_match('#"([a-zA-Z0-9-\s]+)"#', $explode_ad_code[1], $matches_add_client);
70
+ if(isset($matches_add_client[1])){
71
+ $this->publisherIds[] = str_replace(array('"', ' '), array(''), $matches_add_client[1]);
72
+ }
73
  } else {
74
  //*** GOOGLE SYNCRON *************
75
  //get g_data_ad_client
76
  $explode_ad_code = explode('google_ad_client', $value['code']);
77
  preg_match('#"([a-zA-Z0-9-\s]+)"#', $explode_ad_code[1], $matches_add_client);
78
+ if(isset($matches_add_client[1])){
79
+ $this->publisherIds[] = str_replace(array('"', ' '), array(''), $matches_add_client[1]);
80
+ }
81
  }
82
  }
83
  }
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.8.2
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.8.2' );
42
  }
43
 
44
  // Plugin name
@@ -269,22 +269,6 @@ if( !class_exists( 'QuickAdsenseReloaded' ) ) :
269
  $autoloader->register();
270
  }
271
 
272
- /**
273
- * Set a variable to DI with given name
274
- * @param string $name
275
- * @param mixed $variable
276
- * @return $this
277
- */
278
- // public function set( $name, $variable ) {
279
- // // It is a function
280
- // if( is_callable( $variable ) )
281
- // $variable = $variable();
282
- //
283
- // // Add it to services
284
- // $this->services[$name] = $variable;
285
- //
286
- // return $this;
287
- // }
288
 
289
 
290
  public function load_hooks() {
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.8.3
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.8.3' );
42
  }
43
 
44
  // Plugin name
269
  $autoloader->register();
270
  }
271
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
272
 
273
 
274
  public function load_hooks() {
readme.txt CHANGED
@@ -8,9 +8,9 @@ License: GPLv2 or later
8
  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: 5.0
12
  Requires PHP: 5.3
13
- Stable tag: 1.8.2
14
 
15
  Quick Adsense Reloaded! Quickest way to insert Google AdSense & other ads into your website. Google AdSense integration with Google AMP support
16
 
@@ -130,6 +130,13 @@ Alternative Installation:
130
 
131
  == Changelog ==
132
 
 
 
 
 
 
 
 
133
  = 1.8.2 =
134
  * Fix: Gutenberg breaks traditional admin notices so we remove our admin notices from the edit screen
135
 
@@ -168,5 +175,5 @@ Complete changelog: https://wpquads.com/changelog
168
 
169
  == Upgrade Notice ==
170
 
171
- = 1.7.8 =
172
- 1.7.8 Lots of small improvements and tweaks
8
  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: 5.1
12
  Requires PHP: 5.3
13
+ Stable tag: 1.8.3
14
 
15
  Quick Adsense Reloaded! Quickest way to insert Google AdSense & other ads into your website. Google AdSense integration with Google AMP support
16
 
130
 
131
  == Changelog ==
132
 
133
+ = 1.8.3 =
134
+ * New: WordPress 5.0 Gutenberg support
135
+ * New: WordPress 5.1 support
136
+ * New: WordPress 5.1.1 support
137
+ * Fix: Undefined offset in wpquads\adsense
138
+
139
+
140
  = 1.8.2 =
141
  * Fix: Gutenberg breaks traditional admin notices so we remove our admin notices from the edit screen
142
 
175
 
176
  == Upgrade Notice ==
177
 
178
+ = 1.8.3 =
179
+ 1.8.3 Gutenberg Support