AdSense Plugin WP QUADS - Version 1.8.2

Version Description

  • Fix: Gutenberg breaks traditional admin notices so we remove our admin notices from the edit screen
Download this release

Release Info

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

Code changes from version 1.8.1 to 1.8.2

includes/admin/admin-notices.php CHANGED
@@ -9,7 +9,7 @@
9
  * @since 1.0.9
10
  */
11
  // Exit if accessed directly
12
- if (!defined('ABSPATH'))
13
  exit;
14
 
15
  /**
@@ -22,10 +22,15 @@ if (!defined('ABSPATH'))
22
  function quads_admin_messages() {
23
  global $quads_options;
24
 
25
- if (!current_user_can('update_plugins') || quads_is_addon_page()) {
26
  return;
27
  }
28
-
 
 
 
 
 
29
  quads_show_update_auto_ads();
30
 
31
  quads_theme_notice();
@@ -44,12 +49,12 @@ function quads_admin_messages() {
44
  echo quads_show_vi_notices();
45
 
46
  quads_show_ads_txt_notice();
47
-
48
  quads_show_license_expired();
49
 
50
 
51
- if (quads_is_admin_page()) {
52
- 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>';
53
  }
54
 
55
  // if( !quads_is_any_ad_activated() && quads_is_admin_page() ) {
@@ -59,23 +64,23 @@ function quads_admin_messages() {
59
  // echo '<div class="notice notice-warning">' . sprintf( __( '<strong>No ads defined!</strong> You need to create at least one ad code. Fix this in <a href="%s">ADSENSE CODE</a>.', 'quick-adsense-reloaded' ), admin_url() . 'admin.php?page=quads-settings#quads_settingsadsense_header' ) . '</div>';
60
  // }
61
 
62
- if (!quads_is_post_type_activated() && quads_is_admin_page()) {
63
- echo '<div class="notice notice-warning">' . sprintf(__('<strong>No ads are shown - No post type chosen!</strong> You need to select at least 1 post type like <i>blog</i> or <i>page</i>. Fix this in <a href="%s">General Settings</a> or no ads are shown at all.', 'quick-adsense-reloaded'), admin_url() . 'admin.php?page=quads-settings#quads_settingsgeneral_header') . '</div>';
64
  }
65
 
66
- if (isset($_GET['quads-action']) && $_GET['quads-action'] === 'validate' && quads_is_admin_page() && quads_is_any_ad_activated() && quads_is_post_type_activated() && quads_get_active_ads() > 0) {
67
- echo '<div class="notice notice-success">' . sprintf(__('<strong>No errors detected in WP QUADS settings.</strong> If ads are still not shown read the <a href="%s" target="_blank">troubleshooting guide</a>'), 'http://wpquads.com/docs/adsense-ads-are-not-showing/?utm_source=plugin&utm_campaign=wpquads-settings&utm_medium=website&utm_term=toplink') . '</div>';
68
  }
69
 
70
 
71
- $install_date = get_option('quads_install_date');
72
- $display_date = date('Y-m-d h:i:s');
73
- $datetime1 = new DateTime($install_date);
74
- $datetime2 = new DateTime($display_date);
75
- $diff_intrval = round(($datetime2->format('U') - $datetime1->format('U')) / (60 * 60 * 24));
76
 
77
- $rate = get_option('quads_rating_div', false);
78
- if ($diff_intrval >= 7 && ($rate === "no" || false === $rate || quads_rate_again() )) {
79
  echo '<div class="quads_fivestar updated " style="box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);background-color:white;">
80
  <p>Awesome, you\'ve been using <strong>WP QUADS</strong> for more than 1 week. <br> May i ask you to give it a <strong>5-star rating</strong> on Wordpress? </br>
81
  This will help to spread its popularity and to make this plugin a better one.
@@ -98,7 +103,7 @@ function quads_admin_messages() {
98
  var data={\'action\':\'quads_hide_rating\'}
99
  jQuery.ajax({
100
 
101
- url: "' . admin_url('admin-ajax.php') . '",
102
  type: "post",
103
  data: data,
104
  dataType: "json",
@@ -118,7 +123,7 @@ function quads_admin_messages() {
118
  var data={\'action\':\'quads_hide_rating_week\'}
119
  jQuery.ajax({
120
 
121
- url: "' . admin_url('admin-ajax.php') . '",
122
  type: "post",
123
  data: data,
124
  dataType: "json",
@@ -139,7 +144,7 @@ function quads_admin_messages() {
139
  }
140
  }
141
 
142
- add_action('admin_notices', 'quads_admin_messages');
143
 
144
 
145
  /* Hide the rating div
@@ -154,27 +159,27 @@ add_action('admin_notices', 'quads_admin_messages');
154
  */
155
 
156
  function quads_hide_rating_div() {
157
- update_option('quads_rating_div', 'yes');
158
- delete_option('quads_date_next_notice');
159
- echo json_encode(array("success"));
160
  exit;
161
  }
162
 
163
- add_action('wp_ajax_quads_hide_rating', 'quads_hide_rating_div');
164
 
165
  /**
166
  * Write the timestamp when rating notice will be opened again
167
  */
168
  function quads_hide_rating_notice_week() {
169
- $nextweek = time() + (7 * 24 * 60 * 60);
170
- $human_date = date('Y-m-d h:i:s', $nextweek);
171
- update_option('quads_date_next_notice', $human_date);
172
- update_option('quads_rating_div', 'yes');
173
- echo json_encode(array("success"));
174
  exit;
175
  }
176
 
177
- add_action('wp_ajax_quads_hide_rating_week', 'quads_hide_rating_notice_week');
178
 
179
  /**
180
  * Check if admin notice will open again after one week of closing
@@ -182,18 +187,18 @@ add_action('wp_ajax_quads_hide_rating_week', 'quads_hide_rating_notice_week');
182
  */
183
  function quads_rate_again() {
184
 
185
- $rate_again_date = get_option('quads_date_next_notice');
186
 
187
- if (false === $rate_again_date) {
188
  return false;
189
  }
190
 
191
- $current_date = date('Y-m-d h:i:s');
192
- $datetime1 = new DateTime($rate_again_date);
193
- $datetime2 = new DateTime($current_date);
194
- $diff_intrval = round(($datetime2->format('U') - $datetime1->format('U')) / (60 * 60 * 24));
195
 
196
- if ($diff_intrval >= 0) {
197
  return true;
198
  }
199
  }
@@ -205,17 +210,17 @@ function quads_rate_again() {
205
  * @not used
206
  */
207
  function quads_plugin_deactivated_notice() {
208
- if (false !== ( $deactivated_notice_id = get_transient('quads_deactivated_notice_id') )) {
209
- if ('1' === $deactivated_notice_id) {
210
- $message = __("WP QUADS and WP QUADS Pro cannot be activated both. We've automatically deactivated WP QUADS.", 'wpstg');
211
  } else {
212
- $message = __("WP QUADS and WP QUADS Pro cannot be activated both. We've automatically deactivated WP QUADS Pro.", 'wpstg');
213
  }
214
  ?>
215
  <div class="updated notice is-dismissible" style="border-left: 4px solid #ffba00;">
216
- <p><?php echo esc_html($message); ?></p>
217
  </div> <?php
218
- delete_transient('quads_deactivated_notice_id');
219
  }
220
  }
221
 
@@ -226,10 +231,10 @@ function quads_plugin_deactivated_notice() {
226
  */
227
  function quads_theme_notice() {
228
 
229
- $show_notice = get_option('quads_show_theme_notice');
230
 
231
- if (false !== $show_notice && 'no' !== $show_notice && quads_is_commercial_theme()) {
232
- $message = __('<strong>Extend the' . quads_is_commercial_theme() . '</strong> theme with <strong>WP QUADS PRO!</strong><br>Save time and earn more - Bring your AdSense earnings to next level. <a href="http://wpquads.com?utm_campaign=adminnotice&utm_source=admin_notice&utm_medium=admin&utm_content=bimber_upgrade_notice" target="_blank"> Purchase Now</a> or <a href="http://wpquads.com?utm_campaign=free_plugin&utm_source=admin_notice&utm_medium=admin&utm_content=bimber_upgrade_notice" target="_blank">Get Details</a> <p> <a href="' . admin_url() . 'admin.php?page=quads-settings&quads-action=close_upgrade_notice" class="button">Close Notice</a>', 'quick-adsense-reloaded');
233
  ?>
234
  <div class="updated notice" style="border-left: 4px solid #ffba00;">
235
  <p><?php echo $message; ?></p>
@@ -244,15 +249,15 @@ function quads_theme_notice() {
244
  */
245
  function quads_update_notice() {
246
 
247
- $show_notice = get_option('quads_show_update_notice');
248
 
249
  // do not do anything
250
- if (false !== $show_notice) {
251
  return false;
252
  }
253
 
254
- if ((version_compare(QUADS_VERSION, '1.3.9', '>=') ) && quads_is_pro_active() && (version_compare(QUADS_PRO_VERSION, '1.3.0', '<') )) {
255
- $message = sprintf(__('<strong>WP QUADS ' . QUADS_VERSION . ': </strong> Update WP QUADS PRO to get custom post type support from <a href="%s">General Settings</a>.', 'quick-adsense-reloaded'), admin_url() . 'admin.php?page=quads-settings');
256
  $message .= '<br><br><a href="' . admin_url() . 'admin.php?page=quads-settings&quads-action=hide_update_notice" class="button-primary thankyou" target="_self" title="Close Notice" style="font-weight:bold;">Close Notice</a>';
257
  ?>
258
  <div class="updated notice" style="border-left: 4px solid #ffba00;">
@@ -260,8 +265,8 @@ function quads_update_notice() {
260
  </div> <?php
261
  //update_option ('quads_show_update_notice', 'no');
262
  } else
263
- if (!quads_is_extra()) {
264
- $message = sprintf(__('<strong>WP QUADS ' . QUADS_VERSION . ': </strong> Install <a href="%1s" target="_blank">WP QUADS PRO</a> to get custom post type support in <a href="%2s">General Settings</a>.', 'quick-adsense-reloaded'), 'http://wpquads.com?utm_campaign=admin_notice&utm_source=admin_notice&utm_medium=admin&utm_content=custom_post_type', admin_url() . 'admin.php?page=quads-settings');
265
  $message .= '<br><br><a href="' . admin_url() . 'admin.php?page=quads-settings&quads-action=hide_update_notice" class="button-primary thankyou" target="_self" title="Close Notice" style="font-weight:bold;">Close Notice</a>';
266
  ?>
267
  <div class="updated notice" style="border-left: 4px solid #ffba00;">
@@ -277,8 +282,8 @@ function quads_update_notice() {
277
  */
278
  function quads_update_notice_v2() {
279
 
280
- if (quads_is_pro_active() && (version_compare(QUADS_PRO_VERSION, '1.3.6', '<') ) && quads_is_admin_page()) {
281
- $message = sprintf(__('You need to update <strong>WP QUADS PRO to version 1.3.6</strong> or higher. Your version of <strong>WP QUADS Pro</strong> is ' . QUADS_PRO_VERSION . '.<br>WP QUADS Pro ' . QUADS_PRO_VERSION . ' supports unlimited amount of ads. <br>Updating requires a valid <a href="%s" target="_new">license key</a>.', 'quick-adsense-reloaded'), 'https://wpquads.com/#buy-wpquads?utm_source=plugin_notice&utm_medium=admin&utm_campaign=activate_license');
282
  ?>
283
  <div class="notice notice-error">
284
  <p><?php echo $message; ?></p>
@@ -293,22 +298,22 @@ function quads_update_notice_v2() {
293
  function quads_update_notice_1_5_3() {
294
 
295
  // do not show anything
296
- if (false !== get_option('quads_hide_update_notice_1_5_3')) {
297
  return false;
298
  }
299
 
300
- $previous_version = get_option('quads_version_upgraded_from');
301
 
302
  //wp_die(QUADS_VERSION);
303
  // Show update message if previous version was lower than 1.7 - This makes sure that the message is shown for future updates without complicated version number conditions
304
- if (!empty($previous_version) && version_compare(QUADS_VERSION, '1.7.0', '<=')) {
305
 
306
- $message = sprintf(__('This is a huge update! The data structure of WP QUADS has been modified and improved for better performance and great new features. <br> For the case you\'d experience issues, we made a <a href="%1s" target="_self">backup of previous WP QUADS data</a>. So you can <a href="%2s" target="_new">switch back to the previous version</a> anytime. <br><br>Please <a href="%3s" target="_new">open first a support ticket</a> if you experience any issue.', 'quick-adsense-reloaded'), admin_url() . '?page=quads-settings&tab=help', 'https://wpquads.com/docs/install-older-plugin-version/?utm_source=plugin_notice&utm_medium=admin&utm_campaign=install_older_version', 'https://wordpress.org/support/plugin/quick-adsense-reloaded');
307
  ?>
308
  <div class="notice notice-error">
309
  <p><?php echo $message; ?></p>
310
  <?php
311
- echo '<p><a href="' . admin_url() . 'admin.php?page=quads-settings&quads-action=hide_update_notice_1_5_3" class="button-primary" target="_self" title="Close Notice" style="font-weight:bold;">' . __('Close Notice', 'quick-adsense-reloaded') . '</a>';
312
  ?>
313
  </div> <?php
314
  }
@@ -318,20 +323,20 @@ function quads_update_notice_1_5_3() {
318
  * Hide Notice and update db option quads_hide_notice
319
  */
320
  function quads_hide_notice() {
321
- update_option('quads_show_update_notice', 'no');
322
  }
323
 
324
- add_action('quads_hide_update_notice', 'quads_hide_notice', 10);
325
 
326
  /**
327
  * Set option to hide admin notice 1.5.3
328
  * @return boolean
329
  */
330
  function quads_hide_notice_1_5_3() {
331
- update_option('quads_hide_update_notice_1_5_3', '1');
332
  }
333
 
334
- add_action('quads_hide_update_notice_1_5_3', 'quads_hide_notice_1_5_3');
335
 
336
  /**
337
  * Check if any ad is activated and assigned in general settings
@@ -344,28 +349,28 @@ function quads_is_any_ad_activated() {
344
 
345
  // Check if custom positions location_settings is empty or does not exists
346
  $check = array();
347
- if (isset($quads_options['location_settings'])) {
348
- foreach ($quads_options['location_settings'] as $location_array) {
349
- if (isset($location_array['status'])) {
350
  $check[] = $location_array['status'];
351
  }
352
  }
353
  }
354
 
355
  // ad activated with api (custom position)
356
- if (count($check) > 0) {
357
  return true;
358
  }
359
  // check if any other ad is assigned and activated
360
- if (isset($quads_options['pos1']['BegnAds']) ||
361
- isset($quads_options['pos2']['MiddAds']) ||
362
- isset($quads_options['pos3']['EndiAds']) ||
363
- isset($quads_options['pos4']['MoreAds']) ||
364
- isset($quads_options['pos5']['LapaAds']) ||
365
- isset($quads_options['pos6']['Par1Ads']) ||
366
- isset($quads_options['pos7']['Par2Ads']) ||
367
- isset($quads_options['pos8']['Par3Ads']) ||
368
- isset($quads_options['pos9']['Img1Ads'])
369
  ) {
370
  return true;
371
  }
@@ -382,7 +387,7 @@ function quads_is_any_ad_activated() {
382
  function quads_is_post_type_activated() {
383
  global $quads_options;
384
 
385
- if (empty($quads_options['post_types'])) {
386
  return false;
387
  }
388
  return true;
@@ -399,18 +404,17 @@ function quads_ads_empty() {
399
 
400
  $check = array();
401
 
402
- for ($i = 1; $i <= 10; $i++) {
403
- if (!empty($quads_options['ads']['ad' . $i]['code'])) {
404
  $check[] = 'true';
405
  }
406
  }
407
- if (count($check) === 0) {
408
  return true;
409
  }
410
  return false;
411
  }
412
 
413
-
414
  /**
415
  * Return VI admin notice
416
  * @return string
@@ -418,11 +422,11 @@ function quads_ads_empty() {
418
  function quads_get_vi_notice() {
419
  global $quads;
420
 
421
- if (false !== get_option('quads_close_vi_welcome_notice') || !quads_is_admin_page() ) {
422
  return false;
423
  }
424
 
425
- $mail = get_option('admin_email');
426
  $domain = $quads->vi->getDomain();
427
 
428
 
@@ -431,10 +435,10 @@ function quads_get_vi_notice() {
431
  <div class="quads-banner-columns">
432
  <main class="quads-banner-main"><p>' .
433
  sprintf(
434
- __('This update features vi stories from <strong>video intelligence</strong>. This video player will supply you with both video
435
  content and video advertising.<br>
436
  To begin earning, visit the WP QUADS plugin page, <a href="%1$s" target="_blank" class="quads-vi-welcome-white" style="text-decoration: none;border-bottom:3px solid yellow;font-weight: bold;color:black;">sign up</a> to vi stories and <a href="%2$s" class="quads-vi-welcome-white" style="text-decoration: none;border-bottom:3px solid yellow;font-weight: bold;color:black;">place the ad live now!</a> Read the <a href="%3$s" target="_blank">FAQ</a>.
437
- <p style="font-size:10px;">By clicking <strong>sign up</strong> you agree to send your current domain, email and affiliate ID to video intelligence & WP QUADS</p>', 'quick-adsense-reloaed'), 'https://www.vi.ai/publisher-registration/?aid=WP_Quads&domain=' . $domain . '&email=' . $mail . '&utm_source=Wordpress&utm_medium=wp%20quads&utm_campaign=white', admin_url() . 'admin.php?page=quads-settings#quads_settingsvi_header', 'https://www.vi.ai/publisherfaq/?aid=WP_Quads&utm_source=Wordpress&utm_medium=wp%20quads&utm_campaign=white'
438
  )
439
  . '</p></main>
440
  <!--<aside class="quads-banner-sidebar-first"><p><a href="https://www.vi.ai/?utm_source=Wordpress&utm_medium=wp%20quads&utm_campaign=white"><img src="' . QUADS_PLUGIN_URL . 'assets/images/vi_quads_logo.png" width="168" height="72"></a></p></aside>//-->
@@ -450,10 +454,10 @@ To begin earning, visit the WP QUADS plugin page, <a href="%1$s" target="_blank"
450
  <div class="quads-banner-columns">
451
  <main class="quads-banner-main" style="color:white;"><p>' .
452
  sprintf(
453
- __('This update features vi stories from <strong>video intelligence</strong>. This video player will supply you with both video
454
  content and video advertising.<br>
455
  To begin earning, visit the WP QUADS plugin page, <a href="%1$s" target="_blank" class="quads-vi-welcome-black" style="text-decoration: none;border-bottom:3px solid yellow;font-weight: bold;color:white;">sign up</a> to vi stories and <a href="%2$s" class="quads-vi-welcome-black" style="text-decoration: none;border-bottom:3px solid yellow;font-weight: bold;color:white;">place the ad live now!</a> Read the <a href="%3$s" target="_blank">FAQ</a>.
456
- <p style="font-size:10px;">By clicking <strong>sign up</strong> you agree to send your current domain, email and affiliate ID to video intelligence & WP QUADS</p>', 'quick-adsense-reloaded'), 'https://www.vi.ai/publisher-registration/?aid=WP_Quads&domain=' . $domain . '&email=' . $mail . '&utm_source=Wordpress&utm_medium=wp%20quads&utm_campaign=black', admin_url() . 'admin.php?page=quads-settings#quads_settingsvi_header', 'https://www.vi.ai/publisherfaq/?aid=WP_Quads&utm_source=Wordpress&utm_medium=wp%20quads&utm_campaign=black'
457
  )
458
  . '</p></main>
459
  <!--<aside class="quads-banner-sidebar-first"><p><a href="https://www.vi.ai/?utm_source=Wordpress&utm_medium=wp%20quads&utm_campaign=black"><img src="' . QUADS_PLUGIN_URL . 'assets/images/vi_quads_logo.png" width="168" height="72"></a></p></aside>//-->
@@ -463,9 +467,9 @@ To begin earning, visit the WP QUADS plugin page, <a href="%1$s" target="_blank"
463
  </section>
464
  </div>';
465
 
466
- $variant = get_option('quads_vi_variant');
467
 
468
- switch ($variant) {
469
  case 'a':
470
  return $white;
471
  break;
@@ -484,18 +488,18 @@ To begin earning, visit the WP QUADS plugin page, <a href="%1$s" target="_blank"
484
  */
485
  function quads_show_vi_notice_again() {
486
 
487
- $show_again_date = get_option('quads_show_vi_notice_later');
488
 
489
- if (false === $show_again_date) {
490
  return false;
491
  }
492
 
493
- $current_date = date('Y-m-d h:i:s');
494
- $datetime1 = new DateTime($show_again_date);
495
- $datetime2 = new DateTime($current_date);
496
- $diff_intrval = round(($datetime2->format('U') - $datetime1->format('U')) / (60 * 60 * 24));
497
 
498
- if ($diff_intrval >= 0) {
499
  return true;
500
  }
501
  }
@@ -506,32 +510,32 @@ function quads_show_vi_notice_again() {
506
  function quads_show_vi_notices() {
507
  global $quads, $quads_options;
508
 
509
- if (!quads_is_admin_page()) {
510
  return false;
511
  }
512
 
513
 
514
  // adsense ads.txt content
515
- $adsense = new wpquads\adsense($quads_options);
516
  $adsensePublisherIds = $adsense->getPublisherIds();
517
 
518
  $adsenseAdsTxtText = '';
519
- if (!empty($adsensePublisherIds)) {
520
- foreach ($adsensePublisherIds as $adsensePublisherId) {
521
- $adsenseAdsTxtText .= "google.com, " . str_replace('ca-', '', $adsensePublisherId) . ", DIRECT, f08c47fec0942fa0\r\n";
522
  }
523
  }
524
 
525
  // vi ads.txt content
526
  $viAdsTxtText = '';
527
- if ($quads->vi->getPublisherId()) {
528
  $viAdsTxtText = $quads->vi->getAdsTxtContent();
529
  }
530
 
531
  // Show ads.txt warning if logged into vi and ads.txt option is disabled
532
- if (get_transient('quads_vi_ads_txt_disabled') && get_option('quads_vi_token')) {
533
  // ads.txt content
534
- $notice['message'] = sprintf('<p><strong>ADS.TXT couldn\'t be updated automatically.</strong><br><br>You need the ads.txt to display vi video ads. <br>If you want WP QUADS to create an ads.txt automatically you can enable the ads.txt option at <a href="%1$s">General & Position</a>. Alternatively you can also enter the following line manually into <strong>' . get_site_url() . '/ads.txt</strong>:'
535
  . "<p>"
536
  . "<pre>" . $viAdsTxtText . "<br>"
537
  . $adsenseAdsTxtText
@@ -540,23 +544,23 @@ function quads_show_vi_notices() {
540
  , admin_url() . 'admin.php?page=quads-settings#quads_settingsgeneral_header'
541
  , 'https://wpquads.com/make-more-revenue-by-using-an-ads-txt-in-your-website-root-domain/'
542
  );
543
- $notice['type'] = 'update-nag';
544
- $adsTxtDisabled = new wpquads\template('/includes/vendor/vi/views/notices', $notice);
545
  echo $adsTxtDisabled->render();
546
  return false;
547
  }
548
 
549
  // show ad.txt update notice
550
- if (get_transient('quads_vi_ads_txt_notice')) {
551
  $notice['message'] = '<strong>ADS.TXT has been added</strong><br><br><strong>WP QUADS</strong> has updated your ads.txt '
552
  . 'file with lines that declare video inteligence as a legitmate seller of your inventory and enables you to make more money through video inteligence. <a href="https://www.vi.ai/publisher-video-monetization/?utm_source=WordPress&utm_medium=Plugin%20blurb&utm_campaign=wpquads" target="blank" rel="external nofollow">FAQ</a>';
553
- $notice['type'] = 'update-nag';
554
- $adsUpdated = new wpquads\template('/includes/vendor/vi/views/notices', $notice);
555
  echo $adsUpdated->render();
556
  }
557
 
558
  // show ad.txt update notice
559
- if (get_transient('quads_vi_ads_txt_error')) {
560
 
561
 
562
  // ads.txt content
@@ -566,10 +570,10 @@ function quads_show_vi_notices() {
566
  . $adsenseAdsTxtText
567
  . "</pre></p>"
568
  . "Only by doing so you are able to make more money through video inteligence.</p>";
569
- $notice['type'] = 'error';
570
 
571
  // render blurb
572
- $adsTxtError = new wpquads\template('/includes/vendor/vi/views/notices', $notice);
573
  echo $adsTxtError->render();
574
  }
575
  }
@@ -580,37 +584,37 @@ function quads_show_vi_notices() {
580
  function quads_show_ads_txt_notice() {
581
  global $quads, $quads_options;
582
 
583
- if (!quads_is_admin_page())
584
  return false;
585
 
586
 
587
  // show ad.txt update notice
588
- if (get_transient('quads_ads_txt_notice') && isset($quads_options['adsTxtEnabled'])) {
589
  $notice['message'] = '<strong>ADS.TXT has been added</strong><br><br><strong>WP QUADS</strong> has updated the file ' . ABSPATH . 'ads.txt '
590
  . 'file with lines that declare Google.com as a legitmate seller of your inventory and is recommended setting by AdSense.<br><a href="https://wpquads.com/make-more-revenue-by-using-an-ads-txt-in-your-website-root-domain/" target="blank" rel="external nofollow">What is ads.txt?</a>';
591
- $notice['type'] = 'update-nag';
592
- $notice['action'] = 'close_ads_txt_notice';
593
- $adsUpdated = new wpquads\template('/includes/admin/views/notices', $notice);
594
  echo $adsUpdated->render();
595
  }
596
 
597
  // show ads.txt error notice
598
- if (get_transient('close_ads_txt_error') && isset($quads_options['adsTxtEnabled'])) {
599
 
600
  // Check if adsense is used and add the adsense publisherId to ads.txt blurb as well
601
- $adsense = new wpquads\adsense($quads_options);
602
  $adsensePublisherIds = $adsense->getPublisherIds();
603
 
604
 
605
  $adsenseAdsTxtText = '';
606
- if (!empty($adsensePublisherIds)) {
607
- foreach ($adsensePublisherIds as $adsensePublisherId) {
608
- $adsenseAdsTxtText .= "google.com, " . str_replace('ca-', '', $adsensePublisherId) . ", DIRECT, f08c47fec0942fa0\n\r";
609
  }
610
  }
611
 
612
  $viAdsTxtText = '';
613
- if ($quads->vi->getPublisherId()) {
614
  $viAdsTxtText = $quads->vi->getAdsTxtContent();
615
  }
616
 
@@ -621,11 +625,11 @@ function quads_show_ads_txt_notice() {
621
  . $adsenseAdsTxtText
622
  . "</pre></p>"
623
  . "Only by doing so AdSense ads are shown on your site.</p>";
624
- $notice['type'] = 'error';
625
- $notice['action'] = 'quads_ads_txt_error';
626
 
627
  // render blurb
628
- $adsTxtError = new wpquads\template('/includes/admin/views/notices', $notice);
629
  echo $adsTxtError->render();
630
  }
631
  }
@@ -634,16 +638,16 @@ function quads_show_ads_txt_notice() {
634
  * Show api errors
635
  */
636
  function quads_show_vi_api_error() {
637
- if (!quads_is_admin_page()) {
638
  return false;
639
  }
640
 
641
- if (false !== get_option('quads_vi_api_error')) {
642
- $notice['message'] = 'WP QUADS - Can not retrive ad settings from vi API. Error: ' . get_option('quads_vi_api_error');
643
- $notice['type'] = 'error';
644
- $notice['action'] = '';
645
  // render blurb
646
- $blurb = new wpquads\template('/includes/admin/views/notices', $notice);
647
  echo $blurb->render();
648
  }
649
  }
@@ -653,68 +657,59 @@ function quads_show_vi_api_error() {
653
  * @return mixed boolean | string
654
  */
655
  function quads_show_license_expired() {
656
- global $quads_options, $wp_version;
657
 
658
- $licKey = isset($quads_options['quads_wp_quads_pro_license_key']) ? $quads_options['quads_wp_quads_pro_license_key'] : '';
 
 
659
 
660
- $lic = get_option('quads_wp_quads_pro_license_active');
661
-
662
  //var_dump($lic);
663
 
664
- if (!$lic ||(isset($lic->license) && $lic->license !== 'invalid')) {
665
  return false;
666
  }
667
-
668
- if (get_transient('quads_notice_lic_expired')) {
669
  return false;
670
  }
671
  echo '<div class="notice notice-error">';
672
  echo sprintf(
673
- __( '<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>'
674
- . '<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>'
675
- , 'quick-adsense-reloaded' ), date_i18n( get_option( 'date_format' ), strtotime( $lic->expires, current_time( 'timestamp' ) ) ),
676
- 'http://wpquads.com/checkout/?edd_license_key=' . $licKey . '&utm_campaign=adminnotic123e&utm_source=adminnotice123&utm_medium=admin&utm_content=license-expired',
677
- admin_url() . 'admin.php?page=quads-settings&tab=licenses&quads-action=hide_license_expired_notice'
678
-
679
- );
680
  echo '</p></div>';
681
  }
682
 
683
  /**
684
  * Store the transient for 30 days
685
  */
686
- function quads_hide_license_expired_notice(){
687
- set_transient('quads_notice_lic_expired', 'hide', 60 * 60 * 24 * 30);
688
  }
689
 
690
-
691
- add_action('quads_hide_license_expired_notice', 'quads_hide_license_expired_notice');
692
-
693
-
694
 
695
  /**
696
  * Return update notice for Google Auto Ads
697
  * @since 3.5.3.0
698
  */
699
  function quads_show_update_auto_ads() {
700
-
701
-
702
- $message = sprintf(__( '<h2 style="color:white;">WP QUADS & Google Auto Ads</h2>'
703
- . 'WP QUADS Pro adds support for Google Auto Ads<br><br> Get the Pro plugin from <a href="https://wpquads.com/?utm_source=wp-admin&utm_medium=autoads-notice&utm_campaign=autoads-notice" target="_blank" style="color:#87c131;font-weight:500;">wpquads.com</a>'
704
- , 'mashsb' ),
705
- admin_url() . 'admin.php?page=quads-settings'
706
- );
707
-
708
- if( get_option( 'quads_show_notice_auto_ads' ) === 'no' ) {
709
- return false;
710
- }
711
-
712
- // admin notice after updating wp quads
713
- echo '<div class="quads-notice-gdpr update-nag" style="background-color: black;color: #87c131;padding: 20px;margin-top: 20px;border: 3px solid #87c131;display:block;">' . $message .
714
- '<p><a href="'.admin_url().'admin.php?page=quads-settings&quads-action=hide_auto_ads_notice" class="quads_hide_gdpr" title="I got it" style="text-decoration:none;color:white;">- I Understand! Do Not Show This Hint Again -</a></a>'.
715
- '</div>';
716
-
717
-
718
  }
719
 
720
  /**
@@ -722,9 +717,10 @@ function quads_show_update_auto_ads() {
722
  *
723
  * @global array $mashsb_options
724
  */
725
- function mashsb_hide_auto_ads_notice(){
726
- global $quads_options;
727
- // Get all settings
728
- update_option( 'quads_show_notice_auto_ads', 'no' );
729
  }
730
- add_action ('quads_hide_auto_ads_notice', 'mashsb_hide_auto_ads_notice');
 
9
  * @since 1.0.9
10
  */
11
  // Exit if accessed directly
12
+ if( !defined( 'ABSPATH' ) )
13
  exit;
14
 
15
  /**
22
  function quads_admin_messages() {
23
  global $quads_options;
24
 
25
+ if( !current_user_can( 'update_plugins' ) || quads_is_addon_page() ) {
26
  return;
27
  }
28
+
29
+ $screen = get_current_screen();
30
+ if( $screen->parent_base == 'edit' ) {
31
+ return;
32
+ }
33
+
34
  quads_show_update_auto_ads();
35
 
36
  quads_theme_notice();
49
  echo quads_show_vi_notices();
50
 
51
  quads_show_ads_txt_notice();
52
+
53
  quads_show_license_expired();
54
 
55
 
56
+ if( quads_is_admin_page() ) {
57
+ 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>';
58
  }
59
 
60
  // if( !quads_is_any_ad_activated() && quads_is_admin_page() ) {
64
  // echo '<div class="notice notice-warning">' . sprintf( __( '<strong>No ads defined!</strong> You need to create at least one ad code. Fix this in <a href="%s">ADSENSE CODE</a>.', 'quick-adsense-reloaded' ), admin_url() . 'admin.php?page=quads-settings#quads_settingsadsense_header' ) . '</div>';
65
  // }
66
 
67
+ if( !quads_is_post_type_activated() && quads_is_admin_page() ) {
68
+ echo '<div class="notice notice-warning">' . sprintf( __( '<strong>No ads are shown - No post type chosen!</strong> You need to select at least 1 post type like <i>blog</i> or <i>page</i>. Fix this in <a href="%s">General Settings</a> or no ads are shown at all.', 'quick-adsense-reloaded' ), admin_url() . 'admin.php?page=quads-settings#quads_settingsgeneral_header' ) . '</div>';
69
  }
70
 
71
+ if( isset( $_GET['quads-action'] ) && $_GET['quads-action'] === 'validate' && quads_is_admin_page() && quads_is_any_ad_activated() && quads_is_post_type_activated() && quads_get_active_ads() > 0 ) {
72
+ echo '<div class="notice notice-success">' . sprintf( __( '<strong>No errors detected in WP QUADS settings.</strong> If ads are still not shown read the <a href="%s" target="_blank">troubleshooting guide</a>' ), 'http://wpquads.com/docs/adsense-ads-are-not-showing/?utm_source=plugin&utm_campaign=wpquads-settings&utm_medium=website&utm_term=toplink' ) . '</div>';
73
  }
74
 
75
 
76
+ $install_date = get_option( 'quads_install_date' );
77
+ $display_date = date( 'Y-m-d h:i:s' );
78
+ $datetime1 = new DateTime( $install_date );
79
+ $datetime2 = new DateTime( $display_date );
80
+ $diff_intrval = round( ($datetime2->format( 'U' ) - $datetime1->format( 'U' )) / (60 * 60 * 24) );
81
 
82
+ $rate = get_option( 'quads_rating_div', false );
83
+ if( $diff_intrval >= 7 && ($rate === "no" || false === $rate || quads_rate_again() ) ) {
84
  echo '<div class="quads_fivestar updated " style="box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);background-color:white;">
85
  <p>Awesome, you\'ve been using <strong>WP QUADS</strong> for more than 1 week. <br> May i ask you to give it a <strong>5-star rating</strong> on Wordpress? </br>
86
  This will help to spread its popularity and to make this plugin a better one.
103
  var data={\'action\':\'quads_hide_rating\'}
104
  jQuery.ajax({
105
 
106
+ url: "' . admin_url( 'admin-ajax.php' ) . '",
107
  type: "post",
108
  data: data,
109
  dataType: "json",
123
  var data={\'action\':\'quads_hide_rating_week\'}
124
  jQuery.ajax({
125
 
126
+ url: "' . admin_url( 'admin-ajax.php' ) . '",
127
  type: "post",
128
  data: data,
129
  dataType: "json",
144
  }
145
  }
146
 
147
+ add_action( 'admin_notices', 'quads_admin_messages' );
148
 
149
 
150
  /* Hide the rating div
159
  */
160
 
161
  function quads_hide_rating_div() {
162
+ update_option( 'quads_rating_div', 'yes' );
163
+ delete_option( 'quads_date_next_notice' );
164
+ echo json_encode( array("success") );
165
  exit;
166
  }
167
 
168
+ add_action( 'wp_ajax_quads_hide_rating', 'quads_hide_rating_div' );
169
 
170
  /**
171
  * Write the timestamp when rating notice will be opened again
172
  */
173
  function quads_hide_rating_notice_week() {
174
+ $nextweek = time() + (7 * 24 * 60 * 60);
175
+ $human_date = date( 'Y-m-d h:i:s', $nextweek );
176
+ update_option( 'quads_date_next_notice', $human_date );
177
+ update_option( 'quads_rating_div', 'yes' );
178
+ echo json_encode( array("success") );
179
  exit;
180
  }
181
 
182
+ add_action( 'wp_ajax_quads_hide_rating_week', 'quads_hide_rating_notice_week' );
183
 
184
  /**
185
  * Check if admin notice will open again after one week of closing
187
  */
188
  function quads_rate_again() {
189
 
190
+ $rate_again_date = get_option( 'quads_date_next_notice' );
191
 
192
+ if( false === $rate_again_date ) {
193
  return false;
194
  }
195
 
196
+ $current_date = date( 'Y-m-d h:i:s' );
197
+ $datetime1 = new DateTime( $rate_again_date );
198
+ $datetime2 = new DateTime( $current_date );
199
+ $diff_intrval = round( ($datetime2->format( 'U' ) - $datetime1->format( 'U' )) / (60 * 60 * 24) );
200
 
201
+ if( $diff_intrval >= 0 ) {
202
  return true;
203
  }
204
  }
210
  * @not used
211
  */
212
  function quads_plugin_deactivated_notice() {
213
+ if( false !== ( $deactivated_notice_id = get_transient( 'quads_deactivated_notice_id' ) ) ) {
214
+ if( '1' === $deactivated_notice_id ) {
215
+ $message = __( "WP QUADS and WP QUADS Pro cannot be activated both. We've automatically deactivated WP QUADS.", 'wpstg' );
216
  } else {
217
+ $message = __( "WP QUADS and WP QUADS Pro cannot be activated both. We've automatically deactivated WP QUADS Pro.", 'wpstg' );
218
  }
219
  ?>
220
  <div class="updated notice is-dismissible" style="border-left: 4px solid #ffba00;">
221
+ <p><?php echo esc_html( $message ); ?></p>
222
  </div> <?php
223
+ delete_transient( 'quads_deactivated_notice_id' );
224
  }
225
  }
226
 
231
  */
232
  function quads_theme_notice() {
233
 
234
+ $show_notice = get_option( 'quads_show_theme_notice' );
235
 
236
+ if( false !== $show_notice && 'no' !== $show_notice && quads_is_commercial_theme() ) {
237
+ $message = __( '<strong>Extend the' . quads_is_commercial_theme() . '</strong> theme with <strong>WP QUADS PRO!</strong><br>Save time and earn more - Bring your AdSense earnings to next level. <a href="http://wpquads.com?utm_campaign=adminnotice&utm_source=admin_notice&utm_medium=admin&utm_content=bimber_upgrade_notice" target="_blank"> Purchase Now</a> or <a href="http://wpquads.com?utm_campaign=free_plugin&utm_source=admin_notice&utm_medium=admin&utm_content=bimber_upgrade_notice" target="_blank">Get Details</a> <p> <a href="' . admin_url() . 'admin.php?page=quads-settings&quads-action=close_upgrade_notice" class="button">Close Notice</a>', 'quick-adsense-reloaded' );
238
  ?>
239
  <div class="updated notice" style="border-left: 4px solid #ffba00;">
240
  <p><?php echo $message; ?></p>
249
  */
250
  function quads_update_notice() {
251
 
252
+ $show_notice = get_option( 'quads_show_update_notice' );
253
 
254
  // do not do anything
255
+ if( false !== $show_notice ) {
256
  return false;
257
  }
258
 
259
+ if( (version_compare( QUADS_VERSION, '1.3.9', '>=' ) ) && quads_is_pro_active() && (version_compare( QUADS_PRO_VERSION, '1.3.0', '<' ) ) ) {
260
+ $message = sprintf( __( '<strong>WP QUADS ' . QUADS_VERSION . ': </strong> Update WP QUADS PRO to get custom post type support from <a href="%s">General Settings</a>.', 'quick-adsense-reloaded' ), admin_url() . 'admin.php?page=quads-settings' );
261
  $message .= '<br><br><a href="' . admin_url() . 'admin.php?page=quads-settings&quads-action=hide_update_notice" class="button-primary thankyou" target="_self" title="Close Notice" style="font-weight:bold;">Close Notice</a>';
262
  ?>
263
  <div class="updated notice" style="border-left: 4px solid #ffba00;">
265
  </div> <?php
266
  //update_option ('quads_show_update_notice', 'no');
267
  } else
268
+ if( !quads_is_extra() ) {
269
+ $message = sprintf( __( '<strong>WP QUADS ' . QUADS_VERSION . ': </strong> Install <a href="%1s" target="_blank">WP QUADS PRO</a> to get custom post type support in <a href="%2s">General Settings</a>.', 'quick-adsense-reloaded' ), 'http://wpquads.com?utm_campaign=admin_notice&utm_source=admin_notice&utm_medium=admin&utm_content=custom_post_type', admin_url() . 'admin.php?page=quads-settings' );
270
  $message .= '<br><br><a href="' . admin_url() . 'admin.php?page=quads-settings&quads-action=hide_update_notice" class="button-primary thankyou" target="_self" title="Close Notice" style="font-weight:bold;">Close Notice</a>';
271
  ?>
272
  <div class="updated notice" style="border-left: 4px solid #ffba00;">
282
  */
283
  function quads_update_notice_v2() {
284
 
285
+ if( quads_is_pro_active() && (version_compare( QUADS_PRO_VERSION, '1.3.6', '<' ) ) && quads_is_admin_page() ) {
286
+ $message = sprintf( __( 'You need to update <strong>WP QUADS PRO to version 1.3.6</strong> or higher. Your version of <strong>WP QUADS Pro</strong> is ' . QUADS_PRO_VERSION . '.<br>WP QUADS Pro ' . QUADS_PRO_VERSION . ' supports unlimited amount of ads. <br>Updating requires a valid <a href="%s" target="_new">license key</a>.', 'quick-adsense-reloaded' ), 'https://wpquads.com/#buy-wpquads?utm_source=plugin_notice&utm_medium=admin&utm_campaign=activate_license' );
287
  ?>
288
  <div class="notice notice-error">
289
  <p><?php echo $message; ?></p>
298
  function quads_update_notice_1_5_3() {
299
 
300
  // do not show anything
301
+ if( false !== get_option( 'quads_hide_update_notice_1_5_3' ) ) {
302
  return false;
303
  }
304
 
305
+ $previous_version = get_option( 'quads_version_upgraded_from' );
306
 
307
  //wp_die(QUADS_VERSION);
308
  // Show update message if previous version was lower than 1.7 - This makes sure that the message is shown for future updates without complicated version number conditions
309
+ if( !empty( $previous_version ) && version_compare( QUADS_VERSION, '1.7.0', '<=' ) ) {
310
 
311
+ $message = sprintf( __( 'This is a huge update! The data structure of WP QUADS has been modified and improved for better performance and great new features. <br> For the case you\'d experience issues, we made a <a href="%1s" target="_self">backup of previous WP QUADS data</a>. So you can <a href="%2s" target="_new">switch back to the previous version</a> anytime. <br><br>Please <a href="%3s" target="_new">open first a support ticket</a> if you experience any issue.', 'quick-adsense-reloaded' ), admin_url() . '?page=quads-settings&tab=help', 'https://wpquads.com/docs/install-older-plugin-version/?utm_source=plugin_notice&utm_medium=admin&utm_campaign=install_older_version', 'https://wordpress.org/support/plugin/quick-adsense-reloaded' );
312
  ?>
313
  <div class="notice notice-error">
314
  <p><?php echo $message; ?></p>
315
  <?php
316
+ echo '<p><a href="' . admin_url() . 'admin.php?page=quads-settings&quads-action=hide_update_notice_1_5_3" class="button-primary" target="_self" title="Close Notice" style="font-weight:bold;">' . __( 'Close Notice', 'quick-adsense-reloaded' ) . '</a>';
317
  ?>
318
  </div> <?php
319
  }
323
  * Hide Notice and update db option quads_hide_notice
324
  */
325
  function quads_hide_notice() {
326
+ update_option( 'quads_show_update_notice', 'no' );
327
  }
328
 
329
+ add_action( 'quads_hide_update_notice', 'quads_hide_notice', 10 );
330
 
331
  /**
332
  * Set option to hide admin notice 1.5.3
333
  * @return boolean
334
  */
335
  function quads_hide_notice_1_5_3() {
336
+ update_option( 'quads_hide_update_notice_1_5_3', '1' );
337
  }
338
 
339
+ add_action( 'quads_hide_update_notice_1_5_3', 'quads_hide_notice_1_5_3' );
340
 
341
  /**
342
  * Check if any ad is activated and assigned in general settings
349
 
350
  // Check if custom positions location_settings is empty or does not exists
351
  $check = array();
352
+ if( isset( $quads_options['location_settings'] ) ) {
353
+ foreach ( $quads_options['location_settings'] as $location_array ) {
354
+ if( isset( $location_array['status'] ) ) {
355
  $check[] = $location_array['status'];
356
  }
357
  }
358
  }
359
 
360
  // ad activated with api (custom position)
361
+ if( count( $check ) > 0 ) {
362
  return true;
363
  }
364
  // check if any other ad is assigned and activated
365
+ if( isset( $quads_options['pos1']['BegnAds'] ) ||
366
+ isset( $quads_options['pos2']['MiddAds'] ) ||
367
+ isset( $quads_options['pos3']['EndiAds'] ) ||
368
+ isset( $quads_options['pos4']['MoreAds'] ) ||
369
+ isset( $quads_options['pos5']['LapaAds'] ) ||
370
+ isset( $quads_options['pos6']['Par1Ads'] ) ||
371
+ isset( $quads_options['pos7']['Par2Ads'] ) ||
372
+ isset( $quads_options['pos8']['Par3Ads'] ) ||
373
+ isset( $quads_options['pos9']['Img1Ads'] )
374
  ) {
375
  return true;
376
  }
387
  function quads_is_post_type_activated() {
388
  global $quads_options;
389
 
390
+ if( empty( $quads_options['post_types'] ) ) {
391
  return false;
392
  }
393
  return true;
404
 
405
  $check = array();
406
 
407
+ for ( $i = 1; $i <= 10; $i++ ) {
408
+ if( !empty( $quads_options['ads']['ad' . $i]['code'] ) ) {
409
  $check[] = 'true';
410
  }
411
  }
412
+ if( count( $check ) === 0 ) {
413
  return true;
414
  }
415
  return false;
416
  }
417
 
 
418
  /**
419
  * Return VI admin notice
420
  * @return string
422
  function quads_get_vi_notice() {
423
  global $quads;
424
 
425
+ if( false !== get_option( 'quads_close_vi_welcome_notice' ) || !quads_is_admin_page() ) {
426
  return false;
427
  }
428
 
429
+ $mail = get_option( 'admin_email' );
430
  $domain = $quads->vi->getDomain();
431
 
432
 
435
  <div class="quads-banner-columns">
436
  <main class="quads-banner-main"><p>' .
437
  sprintf(
438
+ __( 'This update features vi stories from <strong>video intelligence</strong>. This video player will supply you with both video
439
  content and video advertising.<br>
440
  To begin earning, visit the WP QUADS plugin page, <a href="%1$s" target="_blank" class="quads-vi-welcome-white" style="text-decoration: none;border-bottom:3px solid yellow;font-weight: bold;color:black;">sign up</a> to vi stories and <a href="%2$s" class="quads-vi-welcome-white" style="text-decoration: none;border-bottom:3px solid yellow;font-weight: bold;color:black;">place the ad live now!</a> Read the <a href="%3$s" target="_blank">FAQ</a>.
441
+ <p style="font-size:10px;">By clicking <strong>sign up</strong> you agree to send your current domain, email and affiliate ID to video intelligence & WP QUADS</p>', 'quick-adsense-reloaed' ), 'https://www.vi.ai/publisher-registration/?aid=WP_Quads&domain=' . $domain . '&email=' . $mail . '&utm_source=Wordpress&utm_medium=wp%20quads&utm_campaign=white', admin_url() . 'admin.php?page=quads-settings#quads_settingsvi_header', 'https://www.vi.ai/publisherfaq/?aid=WP_Quads&utm_source=Wordpress&utm_medium=wp%20quads&utm_campaign=white'
442
  )
443
  . '</p></main>
444
  <!--<aside class="quads-banner-sidebar-first"><p><a href="https://www.vi.ai/?utm_source=Wordpress&utm_medium=wp%20quads&utm_campaign=white"><img src="' . QUADS_PLUGIN_URL . 'assets/images/vi_quads_logo.png" width="168" height="72"></a></p></aside>//-->
454
  <div class="quads-banner-columns">
455
  <main class="quads-banner-main" style="color:white;"><p>' .
456
  sprintf(
457
+ __( 'This update features vi stories from <strong>video intelligence</strong>. This video player will supply you with both video
458
  content and video advertising.<br>
459
  To begin earning, visit the WP QUADS plugin page, <a href="%1$s" target="_blank" class="quads-vi-welcome-black" style="text-decoration: none;border-bottom:3px solid yellow;font-weight: bold;color:white;">sign up</a> to vi stories and <a href="%2$s" class="quads-vi-welcome-black" style="text-decoration: none;border-bottom:3px solid yellow;font-weight: bold;color:white;">place the ad live now!</a> Read the <a href="%3$s" target="_blank">FAQ</a>.
460
+ <p style="font-size:10px;">By clicking <strong>sign up</strong> you agree to send your current domain, email and affiliate ID to video intelligence & WP QUADS</p>', 'quick-adsense-reloaded' ), 'https://www.vi.ai/publisher-registration/?aid=WP_Quads&domain=' . $domain . '&email=' . $mail . '&utm_source=Wordpress&utm_medium=wp%20quads&utm_campaign=black', admin_url() . 'admin.php?page=quads-settings#quads_settingsvi_header', 'https://www.vi.ai/publisherfaq/?aid=WP_Quads&utm_source=Wordpress&utm_medium=wp%20quads&utm_campaign=black'
461
  )
462
  . '</p></main>
463
  <!--<aside class="quads-banner-sidebar-first"><p><a href="https://www.vi.ai/?utm_source=Wordpress&utm_medium=wp%20quads&utm_campaign=black"><img src="' . QUADS_PLUGIN_URL . 'assets/images/vi_quads_logo.png" width="168" height="72"></a></p></aside>//-->
467
  </section>
468
  </div>';
469
 
470
+ $variant = get_option( 'quads_vi_variant' );
471
 
472
+ switch ( $variant ) {
473
  case 'a':
474
  return $white;
475
  break;
488
  */
489
  function quads_show_vi_notice_again() {
490
 
491
+ $show_again_date = get_option( 'quads_show_vi_notice_later' );
492
 
493
+ if( false === $show_again_date ) {
494
  return false;
495
  }
496
 
497
+ $current_date = date( 'Y-m-d h:i:s' );
498
+ $datetime1 = new DateTime( $show_again_date );
499
+ $datetime2 = new DateTime( $current_date );
500
+ $diff_intrval = round( ($datetime2->format( 'U' ) - $datetime1->format( 'U' )) / (60 * 60 * 24) );
501
 
502
+ if( $diff_intrval >= 0 ) {
503
  return true;
504
  }
505
  }
510
  function quads_show_vi_notices() {
511
  global $quads, $quads_options;
512
 
513
+ if( !quads_is_admin_page() ) {
514
  return false;
515
  }
516
 
517
 
518
  // adsense ads.txt content
519
+ $adsense = new wpquads\adsense( $quads_options );
520
  $adsensePublisherIds = $adsense->getPublisherIds();
521
 
522
  $adsenseAdsTxtText = '';
523
+ if( !empty( $adsensePublisherIds ) ) {
524
+ foreach ( $adsensePublisherIds as $adsensePublisherId ) {
525
+ $adsenseAdsTxtText .= "google.com, " . str_replace( 'ca-', '', $adsensePublisherId ) . ", DIRECT, f08c47fec0942fa0\r\n";
526
  }
527
  }
528
 
529
  // vi ads.txt content
530
  $viAdsTxtText = '';
531
+ if( $quads->vi->getPublisherId() ) {
532
  $viAdsTxtText = $quads->vi->getAdsTxtContent();
533
  }
534
 
535
  // Show ads.txt warning if logged into vi and ads.txt option is disabled
536
+ if( get_transient( 'quads_vi_ads_txt_disabled' ) && get_option( 'quads_vi_token' ) ) {
537
  // ads.txt content
538
+ $notice['message'] = sprintf( '<p><strong>ADS.TXT couldn\'t be updated automatically.</strong><br><br>You need the ads.txt to display vi video ads. <br>If you want WP QUADS to create an ads.txt automatically you can enable the ads.txt option at <a href="%1$s">General & Position</a>. Alternatively you can also enter the following line manually into <strong>' . get_site_url() . '/ads.txt</strong>:'
539
  . "<p>"
540
  . "<pre>" . $viAdsTxtText . "<br>"
541
  . $adsenseAdsTxtText
544
  , admin_url() . 'admin.php?page=quads-settings#quads_settingsgeneral_header'
545
  , 'https://wpquads.com/make-more-revenue-by-using-an-ads-txt-in-your-website-root-domain/'
546
  );
547
+ $notice['type'] = 'update-nag';
548
+ $adsTxtDisabled = new wpquads\template( '/includes/vendor/vi/views/notices', $notice );
549
  echo $adsTxtDisabled->render();
550
  return false;
551
  }
552
 
553
  // show ad.txt update notice
554
+ if( get_transient( 'quads_vi_ads_txt_notice' ) ) {
555
  $notice['message'] = '<strong>ADS.TXT has been added</strong><br><br><strong>WP QUADS</strong> has updated your ads.txt '
556
  . 'file with lines that declare video inteligence as a legitmate seller of your inventory and enables you to make more money through video inteligence. <a href="https://www.vi.ai/publisher-video-monetization/?utm_source=WordPress&utm_medium=Plugin%20blurb&utm_campaign=wpquads" target="blank" rel="external nofollow">FAQ</a>';
557
+ $notice['type'] = 'update-nag';
558
+ $adsUpdated = new wpquads\template( '/includes/vendor/vi/views/notices', $notice );
559
  echo $adsUpdated->render();
560
  }
561
 
562
  // show ad.txt update notice
563
+ if( get_transient( 'quads_vi_ads_txt_error' ) ) {
564
 
565
 
566
  // ads.txt content
570
  . $adsenseAdsTxtText
571
  . "</pre></p>"
572
  . "Only by doing so you are able to make more money through video inteligence.</p>";
573
+ $notice['type'] = 'error';
574
 
575
  // render blurb
576
+ $adsTxtError = new wpquads\template( '/includes/vendor/vi/views/notices', $notice );
577
  echo $adsTxtError->render();
578
  }
579
  }
584
  function quads_show_ads_txt_notice() {
585
  global $quads, $quads_options;
586
 
587
+ if( !quads_is_admin_page() )
588
  return false;
589
 
590
 
591
  // show ad.txt update notice
592
+ if( get_transient( 'quads_ads_txt_notice' ) && isset( $quads_options['adsTxtEnabled'] ) ) {
593
  $notice['message'] = '<strong>ADS.TXT has been added</strong><br><br><strong>WP QUADS</strong> has updated the file ' . ABSPATH . 'ads.txt '
594
  . 'file with lines that declare Google.com as a legitmate seller of your inventory and is recommended setting by AdSense.<br><a href="https://wpquads.com/make-more-revenue-by-using-an-ads-txt-in-your-website-root-domain/" target="blank" rel="external nofollow">What is ads.txt?</a>';
595
+ $notice['type'] = 'update-nag';
596
+ $notice['action'] = 'close_ads_txt_notice';
597
+ $adsUpdated = new wpquads\template( '/includes/admin/views/notices', $notice );
598
  echo $adsUpdated->render();
599
  }
600
 
601
  // show ads.txt error notice
602
+ if( get_transient( 'close_ads_txt_error' ) && isset( $quads_options['adsTxtEnabled'] ) ) {
603
 
604
  // Check if adsense is used and add the adsense publisherId to ads.txt blurb as well
605
+ $adsense = new wpquads\adsense( $quads_options );
606
  $adsensePublisherIds = $adsense->getPublisherIds();
607
 
608
 
609
  $adsenseAdsTxtText = '';
610
+ if( !empty( $adsensePublisherIds ) ) {
611
+ foreach ( $adsensePublisherIds as $adsensePublisherId ) {
612
+ $adsenseAdsTxtText .= "google.com, " . str_replace( 'ca-', '', $adsensePublisherId ) . ", DIRECT, f08c47fec0942fa0\n\r";
613
  }
614
  }
615
 
616
  $viAdsTxtText = '';
617
+ if( $quads->vi->getPublisherId() ) {
618
  $viAdsTxtText = $quads->vi->getAdsTxtContent();
619
  }
620
 
625
  . $adsenseAdsTxtText
626
  . "</pre></p>"
627
  . "Only by doing so AdSense ads are shown on your site.</p>";
628
+ $notice['type'] = 'error';
629
+ $notice['action'] = 'quads_ads_txt_error';
630
 
631
  // render blurb
632
+ $adsTxtError = new wpquads\template( '/includes/admin/views/notices', $notice );
633
  echo $adsTxtError->render();
634
  }
635
  }
638
  * Show api errors
639
  */
640
  function quads_show_vi_api_error() {
641
+ if( !quads_is_admin_page() ) {
642
  return false;
643
  }
644
 
645
+ if( false !== get_option( 'quads_vi_api_error' ) ) {
646
+ $notice['message'] = 'WP QUADS - Can not retrive ad settings from vi API. Error: ' . get_option( 'quads_vi_api_error' );
647
+ $notice['type'] = 'error';
648
+ $notice['action'] = '';
649
  // render blurb
650
+ $blurb = new wpquads\template( '/includes/admin/views/notices', $notice );
651
  echo $blurb->render();
652
  }
653
  }
657
  * @return mixed boolean | string
658
  */
659
  function quads_show_license_expired() {
660
+ global $quads_options, $wp_version;
661
 
662
+ $licKey = isset( $quads_options['quads_wp_quads_pro_license_key'] ) ? $quads_options['quads_wp_quads_pro_license_key'] : '';
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
+ );
 
 
 
681
  echo '</p></div>';
682
  }
683
 
684
  /**
685
  * Store the transient for 30 days
686
  */
687
+ function quads_hide_license_expired_notice() {
688
+ set_transient( 'quads_notice_lic_expired', 'hide', 60 * 60 * 24 * 30 );
689
  }
690
 
691
+ add_action( 'quads_hide_license_expired_notice', 'quads_hide_license_expired_notice' );
 
 
 
692
 
693
  /**
694
  * Return update notice for Google Auto Ads
695
  * @since 3.5.3.0
696
  */
697
  function quads_show_update_auto_ads() {
698
+
699
+
700
+ $message = sprintf( __( '<h2 style="color:white;">WP QUADS & Google Auto Ads</h2>'
701
+ . 'WP QUADS Pro adds support for Google Auto Ads<br><br> Get the Pro plugin from <a href="https://wpquads.com/?utm_source=wp-admin&utm_medium=autoads-notice&utm_campaign=autoads-notice" target="_blank" style="color:#87c131;font-weight:500;">wpquads.com</a>'
702
+ , 'mashsb' ), admin_url() . 'admin.php?page=quads-settings'
703
+ );
704
+
705
+ if( get_option( 'quads_show_notice_auto_ads' ) === 'no' ) {
706
+ return false;
707
+ }
708
+
709
+ // admin notice after updating wp quads
710
+ echo '<div class="quads-notice-gdpr update-nag" style="background-color: black;color: #87c131;padding: 20px;margin-top: 20px;border: 3px solid #87c131;display:block;">' . $message .
711
+ '<p><a href="' . admin_url() . 'admin.php?page=quads-settings&quads-action=hide_auto_ads_notice" class="quads_hide_gdpr" title="I got it" style="text-decoration:none;color:white;">- I Understand! Do Not Show This Hint Again -</a></a>' .
712
+ '</div>';
 
 
 
713
  }
714
 
715
  /**
717
  *
718
  * @global array $mashsb_options
719
  */
720
+ function mashsb_hide_auto_ads_notice() {
721
+ global $quads_options;
722
+ // Get all settings
723
+ update_option( 'quads_show_notice_auto_ads', 'no' );
724
  }
725
+
726
+ add_action( 'quads_hide_auto_ads_notice', 'mashsb_hide_auto_ads_notice' );
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.1
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.1' );
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.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
 
39
  // Plugin version
40
  if( !defined( 'QUADS_VERSION' ) ) {
41
+ define( 'QUADS_VERSION', '1.8.2' );
42
  }
43
 
44
  // Plugin name
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: 4.9
12
  Requires PHP: 5.3
13
- Stable tag: 1.8.1
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,9 @@ Alternative Installation:
130
 
131
  == Changelog ==
132
 
 
 
 
133
  = 1.8.1 =
134
  * New: Allow to show widget ads on homepage but disable all content ads
135
  * Fix: Widget ads are not counted correctly if the settings were saved incomplete
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
 
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
+
136
  = 1.8.1 =
137
  * New: Allow to show widget ads on homepage but disable all content ads
138
  * Fix: Widget ads are not counted correctly if the settings were saved incomplete