Quick Adsense - Version 2.3.2

Version Description

  • Bug fixes
  • 3 option fields have been removed
  • The API limiter added
  • QuickTag issues have been fixed
Download this release

Release Info

Developer quickadsense
Plugin Icon 128x128 Quick Adsense
Version 2.3.2
Comparing to
See all releases

Code changes from version 2.3.1 to 2.3.2

includes/api/vi.php CHANGED
@@ -314,91 +314,89 @@ function quick_adsense_vi_api_set_vi_code($args = null) {
314
  if(isset($args['native_bg_color']) && ($args['native_bg_color'] != '') && ($args['native_bg_color'] != 'undefined')) {
315
  $selectedArgs['backgroundColor'] = $args['native_bg_color'];
316
  }
317
-
318
- if(isset($args['optional_1']) && ($args['optional_1'] != '') && ($args['optional_1'] != 'undefined')) {
319
- $selectedArgs['vioptional1'] = $args['optional_1'];
320
- }
321
- if(isset($args['optional_2']) && ($args['optional_2'] != '') && ($args['optional_2'] != 'undefined')) {
322
- $selectedArgs['vioptional2'] = $args['optional_2'];
323
- }
324
- if(isset($args['optional_3']) && ($args['optional_3'] != '') && ($args['optional_3'] != 'undefined')) {
325
- $selectedArgs['vioptional3'] = $args['optional_3'];
326
- }
327
  }
328
 
329
- $viSettings = quick_adsense_vi_api_get_settings();
330
- if(($viSettings != false) && is_array($viSettings)) {
331
- $viToken = quick_adsense_vi_api_get_publisher_token();
332
- if($viToken !== false) {
333
- try{
334
- $response = wp_remote_request(
335
- $viSettings['jsTagAPI'],
336
- array(
337
- 'method' => 'POST',
338
- 'timeout' => 15,
339
- 'headers' => array(
340
- 'Content-Type' => 'application/json',
341
- 'Authorization' => $viToken
342
- ),
343
- 'body' => json_encode($selectedArgs)
344
- )
345
- );
346
- if(!is_wp_error($response)) {
347
- if(400 == wp_remote_retrieve_response_code($response)) {
348
- $responseBody = json_decode($response['body']);
349
- if((json_last_error() == JSON_ERROR_NONE) && ($responseBody->status == 'error')) {
350
- return array(
351
- 'status' => 'error',
352
- 'errorCode' => 'WIVI108',
353
- 'message' => $responseBody->error->description,
354
- );
355
- } else {
356
- return array(
357
- 'status' => 'error',
358
- 'errorCode' => 'WIVI107',
359
- 'message' => 'Response JSON error, Please try again later!',
360
- );
361
- }
362
- } else if(201 == wp_remote_retrieve_response_code($response)) {
363
- $responseBody = json_decode($response['body']);
364
- if((json_last_error() == JSON_ERROR_NONE) && ($responseBody->status == 'ok')) {
365
- delete_transient('quick_adsense_vi_api_jstag');
366
- set_transient('quick_adsense_vi_api_jstag', $responseBody->data, YEAR_IN_SECONDS);
367
- return $responseBody->data;
 
 
 
 
 
 
 
 
368
  } else {
369
  return array(
370
  'status' => 'error',
371
- 'errorCode' => 'WIVI106',
372
- 'message' => 'Response JSON error!',
373
  );
374
  }
375
- } else {
376
- return array(
377
- 'status' => 'error',
378
- 'errorCode' => 'WIVI105',
379
- 'message' => 'Unknown response code',
380
- );
381
  }
 
 
 
 
 
 
382
  }
383
- } catch(Exception $ex) {
384
  return array(
385
  'status' => 'error',
386
- 'errorCode' => 'WIVI103',
387
- 'message' => 'Exception during API communication',
388
  );
389
  }
390
- } else {
391
- return array(
392
  'status' => 'error',
393
- 'errorCode' => 'WIVI102',
394
- 'message' => 'Authorization Token is Missing',
395
- );
396
- }
397
  } else {
398
  return array(
399
  'status' => 'error',
400
- 'errorCode' => 'WIVI101',
401
- 'message' => 'API is unreachable',
402
  );
403
  }
404
  }
314
  if(isset($args['native_bg_color']) && ($args['native_bg_color'] != '') && ($args['native_bg_color'] != 'undefined')) {
315
  $selectedArgs['backgroundColor'] = $args['native_bg_color'];
316
  }
 
 
 
 
 
 
 
 
 
 
317
  }
318
 
319
+ //if(isset($selectedArgs['language']) && ($selectedArgs['language'] != '') && isset($selectedArgs['iabCategory']) && ($selectedArgs['iabCategory'] != '')) { /* Polling limiter temporarily removed as API now support defaults*/
320
+ $viSettings = quick_adsense_vi_api_get_settings();
321
+ if(($viSettings != false) && is_array($viSettings)) {
322
+ $viToken = quick_adsense_vi_api_get_publisher_token();
323
+ if($viToken !== false) {
324
+ try{
325
+ $response = wp_remote_request(
326
+ $viSettings['jsTagAPI'],
327
+ array(
328
+ 'method' => 'POST',
329
+ 'timeout' => 15,
330
+ 'headers' => array(
331
+ 'Content-Type' => 'application/json',
332
+ 'Authorization' => $viToken
333
+ ),
334
+ 'body' => json_encode($selectedArgs)
335
+ )
336
+ );
337
+ if(!is_wp_error($response)) {
338
+ if(400 == wp_remote_retrieve_response_code($response)) {
339
+ $responseBody = json_decode($response['body']);
340
+ if((json_last_error() == JSON_ERROR_NONE) && ($responseBody->status == 'error')) {
341
+ return array(
342
+ 'status' => 'error',
343
+ 'errorCode' => 'WIVI108',
344
+ 'message' => $responseBody->error->description,
345
+ );
346
+ } else {
347
+ return array(
348
+ 'status' => 'error',
349
+ 'errorCode' => 'WIVI107',
350
+ 'message' => 'Response JSON error, Please try again later!',
351
+ );
352
+ }
353
+ } else if(201 == wp_remote_retrieve_response_code($response)) {
354
+ $responseBody = json_decode($response['body']);
355
+ if((json_last_error() == JSON_ERROR_NONE) && ($responseBody->status == 'ok')) {
356
+ delete_transient('quick_adsense_vi_api_jstag');
357
+ set_transient('quick_adsense_vi_api_jstag', $responseBody->data, YEAR_IN_SECONDS);
358
+ return $responseBody->data;
359
+ } else {
360
+ return array(
361
+ 'status' => 'error',
362
+ 'errorCode' => 'WIVI106',
363
+ 'message' => 'Response JSON error!',
364
+ );
365
+ }
366
  } else {
367
  return array(
368
  'status' => 'error',
369
+ 'errorCode' => 'WIVI105',
370
+ 'message' => 'Unknown response code',
371
  );
372
  }
 
 
 
 
 
 
373
  }
374
+ } catch(Exception $ex) {
375
+ return array(
376
+ 'status' => 'error',
377
+ 'errorCode' => 'WIVI103',
378
+ 'message' => 'Exception during API communication',
379
+ );
380
  }
381
+ } else {
382
  return array(
383
  'status' => 'error',
384
+ 'errorCode' => 'WIVI102',
385
+ 'message' => 'Authorization Token is Missing',
386
  );
387
  }
388
+ //} else {
389
+ /*return array(
390
  'status' => 'error',
391
+ 'errorCode' => 'WIVI101',
392
+ 'message' => 'API is unreachable',
393
+ );*/
394
+ //}
395
  } else {
396
  return array(
397
  'status' => 'error',
398
+ 'errorCode' => 'WIVI109',
399
+ 'message' => 'Defaults Not Set',
400
  );
401
  }
402
  }
includes/content.php CHANGED
@@ -3,6 +3,22 @@ $quickAdsenseAdsDisplayed = 0;
3
  $quickAdsenseAdsId = array();
4
  $quickAdsenseBeginEnd = 0;
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  add_filter('the_content', 'quick_adsense_the_content');
7
  function quick_adsense_the_content($content) {
8
  global $quickAdsenseAdsDisplayed;
3
  $quickAdsenseAdsId = array();
4
  $quickAdsenseBeginEnd = 0;
5
 
6
+ add_action('wp_head', 'quick_adsense_embed_wp_head');
7
+ function quick_adsense_embed_wp_head() {
8
+ $settings = get_option('quick_adsense_settings');
9
+ if(isset($settings['header_embed_code']) && ($settings['header_embed_code'] != '')) {
10
+ echo $settings['header_embed_code'];
11
+ }
12
+ }
13
+
14
+ add_action('wp_footer', 'quick_adsense_embed_wp_footer');
15
+ function quick_adsense_embed_wp_footer() {
16
+ $settings = get_option('quick_adsense_settings');
17
+ if(isset($settings['footer_embed_code']) && ($settings['footer_embed_code'] != '')) {
18
+ echo $settings['footer_embed_code'];
19
+ }
20
+ }
21
+
22
  add_filter('the_content', 'quick_adsense_the_content');
23
  function quick_adsense_the_content($content) {
24
  global $quickAdsenseAdsDisplayed;
includes/controls.php CHANGED
@@ -34,7 +34,13 @@ if(!function_exists('quickadsense_get_control')) {
34
  if($label != '') {
35
  $output .= '<label for="'.$name.'">'.$label.'</label><br />';
36
  }
37
- $output .= '<textarea id="'.$id.'" name="'.$name.'" class="multilanguage-input '.$class.'" class="height: 100px;" style="'.$style.'" placeholder="'.$placeholder.'">'.$value.'</textarea>';
 
 
 
 
 
 
38
  break;
39
  case 'select':
40
  if($label != '') {
34
  if($label != '') {
35
  $output .= '<label for="'.$name.'">'.$label.'</label><br />';
36
  }
37
+ $output .= '<textarea id="'.$id.'" name="'.$name.'" class="multilanguage-input '.$class.'" class="multilanguage-input '.$class.'" style="height: 100px; '.$style.'" placeholder="'.$placeholder.'">'.$value.'</textarea>';
38
+ break;
39
+ case 'textarea-big':
40
+ if($label != '') {
41
+ $output .= '<label for="'.$name.'">'.$label.'</label><br />';
42
+ }
43
+ $output .= '<textarea id="'.$id.'" name="'.$name.'" class="multilanguage-input '.$class.'" class="multilanguage-input '.$class.'" style="height: 300px; '.$style.'" placeholder="'.$placeholder.'">'.$value.'</textarea>';
44
  break;
45
  case 'select':
46
  if($label != '') {
includes/defaults.php CHANGED
@@ -1,58 +1,155 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  add_action('init', 'quick_adsense_defaults_init');
3
  function quick_adsense_defaults_init() {
4
  $settings = get_option('quick_adsense_settings');
5
- if(isset($settings) && is_array($settings)) { // Existing 2.1 User
6
  return;
7
  } else { // New User OR V2.0 User OR V1.X User
8
- $quickAdsense2 = get_option('quick_adsense_2_settings');
9
  if(isset($quickAdsense2) && is_array($quickAdsense2) && (count($quickAdsense2) > 1)) { // V2.0 User
10
  $settings = quick_adsense_get_defaults();
11
  if(isset($quickAdsense2['AdsDisp']) && ($quickAdsense2['AdsDisp'] != '')) { $settings['max_ads_per_page'] = $quickAdsense2['AdsDisp']; }
12
 
13
- if(isset($quickAdsense2['BegnAds']) && ($quickAdsense2['BegnAds'] != '')) { $settings['enable_position_beginning_of_post'] = $quickAdsense2['BegnAds']; }
14
  if(isset($quickAdsense2['BegnRnd']) && ($quickAdsense2['BegnRnd'] != '')) { $settings['ad_beginning_of_post'] = $quickAdsense2['BegnRnd']; }
15
- if(isset($quickAdsense2['MiddAds']) && ($quickAdsense2['MiddAds'] != '')) { $settings['enable_position_middle_of_post'] = $quickAdsense2['MiddAds']; }
16
  if(isset($quickAdsense2['MiddRnd']) && ($quickAdsense2['MiddRnd'] != '')) { $settings['ad_middle_of_post'] = $quickAdsense2['MiddRnd']; }
17
- if(isset($quickAdsense2['EndiAds']) && ($quickAdsense2['EndiAds'] != '')) { $settings['enable_position_end_of_post'] = $quickAdsense2['EndiAds']; }
18
  if(isset($quickAdsense2['EndiRnd']) && ($quickAdsense2['EndiRnd'] != '')) { $settings['ad_end_of_post'] = $quickAdsense2['EndiRnd']; }
19
 
20
- if(isset($quickAdsense2['MoreAds']) && ($quickAdsense2['MoreAds'] != '')) { $settings['enable_position_after_more_tag'] = $quickAdsense2['MoreAds']; }
21
  if(isset($quickAdsense2['MoreRnd']) && ($quickAdsense2['MoreRnd'] != '')) { $settings['ad_after_more_tag'] = $quickAdsense2['MoreRnd']; }
22
- if(isset($quickAdsense2['LapaAds']) && ($quickAdsense2['LapaAds'] != '')) { $settings['enable_position_before_last_para'] = $quickAdsense2['LapaAds']; }
23
  if(isset($quickAdsense2['LapaRnd']) && ($quickAdsense2['LapaRnd'] != '')) { $settings['ad_before_last_para'] = $quickAdsense2['LapaRnd']; }
24
 
25
  for($i = 1; $i <= 3; $i++) {
26
- if(isset($quickAdsense2['Par'.$i.'Ads']) && ($quickAdsense2['Par'.$i.'Ads'] != '')) { $settings['enable_position_after_para_option_'.$i] = $quickAdsense2['Par'.$i.'Ads']; }
27
  if(isset($quickAdsense2['Par'.$i.'Rnd']) && ($quickAdsense2['Par'.$i.'Rnd'] != '')) { $settings['ad_after_para_option_'.$i] = $quickAdsense2['Par'.$i.'Rnd']; }
28
  if(isset($quickAdsense2['Par'.$i.'Nup']) && ($quickAdsense2['Par'.$i.'Nup'] != '')) { $settings['position_after_para_option_'.$i] = $quickAdsense2['Par'.$i.'Nup']; }
29
- if(isset($quickAdsense2['Par'.$i.'Con']) && ($quickAdsense2['Par'.$i.'Con'] != '')) { $settings['enable_jump_position_after_para_option_'.$i] = $quickAdsense2['Par'.$i.'Con']; }
30
  }
31
 
32
  for($i = 1; $i <= 1; $i++) {
33
- if(isset($quickAdsense2['Img'.$i.'Ads']) && ($quickAdsense2['Img'.$i.'Ads'] != '')) { $settings['enable_position_after_image_option_'.$i] = $quickAdsense2['Img'.$i.'Ads']; }
34
  if(isset($quickAdsense2['Img'.$i.'Rnd']) && ($quickAdsense2['Img'.$i.'Rnd'] != '')) { $settings['ad_after_image_option_'.$i] = $quickAdsense2['Img'.$i.'Rnd']; }
35
  if(isset($quickAdsense2['Img'.$i.'Nup']) && ($quickAdsense2['Img'.$i.'Nup'] != '')) { $settings['position_after_image_option_'.$i] = $quickAdsense2['Img'.$i.'Nup']; }
36
- if(isset($quickAdsense2['Img'.$i.'Con']) && ($quickAdsense2['Img'.$i.'Con'] != '')) { $settings['enable_jump_position_after_image_option_'.$i] = $quickAdsense2['Img'.$i.'Con']; }
37
  }
38
 
39
- if(isset($quickAdsense2['AppPost']) && ($quickAdsense2['AppPost'] != '')) { $settings['enable_on_posts'] = $quickAdsense2['AppPost']; }
40
- if(isset($quickAdsense2['AppPage']) && ($quickAdsense2['AppPage'] != '')) { $settings['enable_on_pages'] = $quickAdsense2['AppPage']; }
41
 
42
- if(isset($quickAdsense2['AppHome']) && ($quickAdsense2['AppHome'] != '')) { $settings['enable_on_homepage'] = $quickAdsense2['AppHome']; }
43
- if(isset($quickAdsense2['AppCate']) && ($quickAdsense2['AppCate'] != '')) { $settings['enable_on_categories'] = $quickAdsense2['AppCate']; }
44
- if(isset($quickAdsense2['AppArch']) && ($quickAdsense2['AppArch'] != '')) { $settings['enable_on_archives'] = $quickAdsense2['AppArch']; }
45
- if(isset($quickAdsense2['AppTags']) && ($quickAdsense2['AppTags'] != '')) { $settings['enable_on_tags'] = $quickAdsense2['AppTags']; }
46
- if(isset($quickAdsense2['AppMaxA']) && ($quickAdsense2['AppMaxA'] != '')) { $settings['enable_all_possible_ads'] = $quickAdsense2['AppMaxA']; }
47
 
48
- if(isset($quickAdsense2['AppSide']) && ($quickAdsense2['AppSide'] != '')) { $settings['disable_widgets_on_homepage'] = $quickAdsense2['AppSide']; }
49
 
50
- if(isset($quickAdsense2['AppLogg']) && ($quickAdsense2['AppLogg'] != '')) { $settings['disable_for_loggedin_users'] = $quickAdsense2['AppLogg']; }
51
 
52
- if(isset($quickAdsense2['QckTags']) && ($quickAdsense2['QckTags'] != '')) { $settings['enable_quicktag_buttons'] = $quickAdsense2['QckTags']; }
53
- if(isset($quickAdsense2['QckRnds']) && ($quickAdsense2['QckRnds'] != '')) { $settings['disable_randomads_quicktag_button'] = $quickAdsense2['QckRnds']; }
54
- if(isset($quickAdsense2['QckOffs']) && ($quickAdsense2['QckOffs'] != '')) { $settings['disable_disablead_quicktag_buttons'] = $quickAdsense2['QckOffs']; }
55
- if(isset($quickAdsense2['QckOfPs']) && ($quickAdsense2['QckOfPs'] != '')) { $settings['disable_positionad_quicktag_buttons'] = $quickAdsense2['QckOfPs']; }
56
 
57
  for($i = 1; $i <= 10; $i++) {
58
  if(isset($quickAdsense2['AdsCode'.$i]) && ($quickAdsense2['AdsCode'.$i] != '')) { $settings['onpost_ad_'.$i.'_content'] = $quickAdsense2['AdsCode'.$i]; }
@@ -62,57 +159,57 @@ function quick_adsense_defaults_init() {
62
  if(isset($quickAdsense2['WidCode'.$i]) && ($quickAdsense2['WidCode'.$i] != '')) { $settings['widget_ad_'.$i.'_content'] = $quickAdsense2['WidCode'.$i]; }
63
  }
64
  update_option('quick_adsense_settings', $settings);
65
- update_option('quick_adsense_2_settings_bak', $quickAdsense2);
66
- delete_option('quick_adsense_2_settings');
67
  } else { // New User OR V1.X User
68
  $quickAdsense1AdsDisp = get_option('AdsDisp');
69
  if(isset($quickAdsense1AdsDisp) && in_array($quickAdsense1AdsDisp, array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'))) { // V1.X User
70
  $settings = quick_adsense_get_defaults();
71
  $temp = get_option('AdsDisp'); if(isset($temp) && ($temp != '')) { $settings['max_ads_per_page'] = $temp; }
72
 
73
- $temp = get_option('BegnAds'); if(isset($temp) && ($temp != '')) { $settings['enable_position_beginning_of_post'] = $temp; }
74
  $temp = get_option('BegnRnd'); if(isset($temp) && ($temp != '')) { $settings['ad_beginning_of_post'] = $temp; }
75
- $temp = get_option('MiddAds'); if(isset($temp) && ($temp != '')) { $settings['enable_position_middle_of_post'] = $temp; }
76
  $temp = get_option('MiddRnd'); if(isset($temp) && ($temp != '')) { $settings['ad_middle_of_post'] = $temp; }
77
- $temp = get_option('EndiAds'); if(isset($temp) && ($temp != '')) { $settings['enable_position_end_of_post'] = $temp; }
78
  $temp = get_option('EndiRnd'); if(isset($temp) && ($temp != '')) { $settings['ad_end_of_post'] = $temp; }
79
 
80
- $temp = get_option('MoreAds'); if(isset($temp) && ($temp != '')) { $settings['enable_position_after_more_tag'] = $temp; }
81
  $temp = get_option('MoreRnd'); if(isset($temp) && ($temp != '')) { $settings['ad_after_more_tag'] = $temp; }
82
- $temp = get_option('LapaAds'); if(isset($temp) && ($temp != '')) { $settings['enable_position_before_last_para'] = $temp; }
83
  $temp = get_option('LapaRnd'); if(isset($temp) && ($temp != '')) { $settings['ad_before_last_para'] = $temp; }
84
 
85
  for($i = 1; $i <= 3; $i++) {
86
- $temp = get_option('Par'.$i.'Ads'); if(isset($temp) && ($temp != '')) { $settings['enable_position_after_para_option_'.$i] = $temp; }
87
  $temp = get_option('Par'.$i.'Rnd'); if(isset($temp) && ($temp != '')) { $settings['ad_after_para_option_'.$i] = $temp; }
88
  $temp = get_option('Par'.$i.'Nup'); if(isset($temp) && ($temp != '')) { $settings['position_after_para_option_'.$i] = $temp; }
89
- $temp = get_option('Par'.$i.'Con'); if(isset($temp) && ($temp != '')) { $settings['enable_jump_position_after_para_option_'.$i] = $temp; }
90
  }
91
 
92
  for($i = 1; $i <= 1; $i++) {
93
- $temp = get_option('Img'.$i.'Ads'); if(isset($temp) && ($temp != '')) { $settings['enable_position_after_image_option_'.$i] = $temp; }
94
  $temp = get_option('Img'.$i.'Rnd'); if(isset($temp) && ($temp != '')) { $settings['ad_after_image_option_'.$i] = $temp; }
95
  $temp = get_option('Img'.$i.'Nup'); if(isset($temp) && ($temp != '')) { $settings['position_after_image_option_'.$i] = $temp; }
96
- $temp = get_option('Img'.$i.'Con'); if(isset($temp) && ($temp != '')) { $settings['enable_jump_position_after_image_option_'.$i] = $temp; }
97
  }
98
 
99
- $temp = get_option('AppPost'); if(isset($temp) && ($temp != '')) { $settings['enable_on_posts'] = $temp; }
100
- $temp = get_option('AppPage'); if(isset($temp) && ($temp != '')) { $settings['enable_on_pages'] = $temp; }
101
 
102
- $temp = get_option('AppHome'); if(isset($temp) && ($temp != '')) { $settings['enable_on_homepage'] = $temp; }
103
- $temp = get_option('AppCate'); if(isset($temp) && ($temp != '')) { $settings['enable_on_categories'] = $temp; }
104
- $temp = get_option('AppArch'); if(isset($temp) && ($temp != '')) { $settings['enable_on_archives'] = $temp; }
105
- $temp = get_option('AppTags'); if(isset($temp) && ($temp != '')) { $settings['enable_on_tags'] = $temp; }
106
- $temp = get_option('AppMaxA'); if(isset($temp) && ($temp != '')) { $settings['enable_all_possible_ads'] = $temp; }
107
 
108
- $temp = get_option('AppSide'); if(isset($temp) && ($temp != '')) { $settings['disable_widgets_on_homepage'] = $temp; }
109
 
110
- $temp = get_option('AppLogg'); if(isset($temp) && ($temp != '')) { $settings['disable_for_loggedin_users'] = $temp; }
111
 
112
- $temp = get_option('QckTags'); if(isset($temp) && ($temp != '')) { $settings['enable_quicktag_buttons'] = $temp; }
113
- $temp = get_option('QckRnds'); if(isset($temp) && ($temp != '')) { $settings['disable_randomads_quicktag_button'] = $temp; }
114
- $temp = get_option('QckOffs'); if(isset($temp) && ($temp != '')) { $settings['disable_disablead_quicktag_buttons'] = $temp; }
115
- $temp = get_option('QckOfPs'); if(isset($temp) && ($temp != '')) { $settings['disable_positionad_quicktag_buttons'] = $temp; }
116
 
117
  for($i = 1; $i <= 10; $i++) {
118
  $temp = get_option('AdsCode'.$i); if(isset($temp)) { $settings['onpost_ad_'.$i.'_content'] = $temp; }
1
  <?php
2
+ //add_action('init', 'quick_adsense_defaults_clear_data');
3
+ function quick_adsense_defaults_clear_data() {
4
+ if(isset($_GET['quick_adsense_1_X_clear_data'])) {
5
+ delete_option('AdsDisp');
6
+ delete_option('BegnAds');
7
+ delete_option('BegnRnd');
8
+ delete_option('MiddAds');
9
+ delete_option('MiddRnd');
10
+ delete_option('EndiAds');
11
+ delete_option('EndiRnd');
12
+ delete_option('MoreAds');
13
+ delete_option('MoreRnd');
14
+ delete_option('LapaAds');
15
+ delete_option('LapaRnd');
16
+ delete_option('Par1Ads');
17
+ delete_option('Par1Rnd');
18
+ delete_option('Par1Nup');
19
+ delete_option('Par1Con');
20
+ delete_option('Par2Ads');
21
+ delete_option('Par2Rnd');
22
+ delete_option('Par2Nup');
23
+ delete_option('Par2Con');
24
+ delete_option('Par3Ads');
25
+ delete_option('Par3Rnd');
26
+ delete_option('Par3Nup');
27
+ delete_option('Par3Con');
28
+ delete_option('Img1Ads');
29
+ delete_option('Img1Rnd');
30
+ delete_option('Img1Nup');
31
+ delete_option('Img1Con');
32
+ delete_option('AppPost');
33
+ delete_option('AppPage');
34
+ delete_option('AppHome');
35
+ delete_option('AppCate');
36
+ delete_option('AppArch');
37
+ delete_option('AppTags');
38
+ delete_option('AppMaxA');
39
+ delete_option('AppSide');
40
+ delete_option('AppLogg');
41
+ delete_option('QckTags');
42
+ delete_option('QckRnds');
43
+ delete_option('QckOffs');
44
+ delete_option('QckOfPs');
45
+ delete_option('AdsCode1');
46
+ delete_option('AdsAlign1');
47
+ delete_option('AdsMargin1');
48
+ delete_option('AdsCode2');
49
+ delete_option('AdsAlign2');
50
+ delete_option('AdsMargin2');
51
+ delete_option('AdsCode3');
52
+ delete_option('AdsAlign3');
53
+ delete_option('AdsMargin3');
54
+ delete_option('AdsCode4');
55
+ delete_option('AdsAlign4');
56
+ delete_option('AdsMargin4');
57
+ delete_option('AdsCode5');
58
+ delete_option('AdsAlign5');
59
+ delete_option('AdsMargin5');
60
+ delete_option('AdsCode6');
61
+ delete_option('AdsAlign6');
62
+ delete_option('AdsMargin6');
63
+ delete_option('AdsCode7');
64
+ delete_option('AdsAlign7');
65
+ delete_option('AdsMargin7');
66
+ delete_option('AdsCode8');
67
+ delete_option('AdsAlign8');
68
+ delete_option('AdsMargin8');
69
+ delete_option('AdsCode9');
70
+ delete_option('AdsAlign9');
71
+ delete_option('AdsMargin9');
72
+ delete_option('AdsCode10');
73
+ delete_option('AdsAlign10');
74
+ delete_option('AdsMargin10');
75
+ delete_option('WidCode1');
76
+ delete_option('WidCode2');
77
+ delete_option('WidCode3');
78
+ delete_option('WidCode4');
79
+ delete_option('WidCode5');
80
+ delete_option('WidCode6');
81
+ delete_option('WidCode7');
82
+ delete_option('WidCode8');
83
+ delete_option('WidCode9');
84
+ delete_option('WidCode10');
85
+ wp_redirect(esc_url(admin_url('/admin.php?page=quick-adsense')));
86
+ }
87
+
88
+ if(isset($_GET['quick_adsense_2_0_clear_data'])) {
89
+ delete_option('quick_adsense_2_options');
90
+ wp_redirect(esc_url(admin_url('/admin.php?page=quick-adsense')));
91
+ }
92
+
93
+ if(isset($_GET['quick_adsense_2_1_clear_data'])) {
94
+ delete_option('quick_adsense_settings');
95
+ wp_redirect(esc_url(admin_url('/admin.php?page=quick-adsense')));
96
+ }
97
+ }
98
+
99
  add_action('init', 'quick_adsense_defaults_init');
100
  function quick_adsense_defaults_init() {
101
  $settings = get_option('quick_adsense_settings');
102
+ if(isset($settings) && is_array($settings)) { // Existing 2.1+ User
103
  return;
104
  } else { // New User OR V2.0 User OR V1.X User
105
+ $quickAdsense2 = get_option('quick_adsense_2_options');
106
  if(isset($quickAdsense2) && is_array($quickAdsense2) && (count($quickAdsense2) > 1)) { // V2.0 User
107
  $settings = quick_adsense_get_defaults();
108
  if(isset($quickAdsense2['AdsDisp']) && ($quickAdsense2['AdsDisp'] != '')) { $settings['max_ads_per_page'] = $quickAdsense2['AdsDisp']; }
109
 
110
+ if(isset($quickAdsense2['BegnAds']) && ($quickAdsense2['BegnAds'] != '')) { $settings['enable_position_beginning_of_post'] = '1'; }
111
  if(isset($quickAdsense2['BegnRnd']) && ($quickAdsense2['BegnRnd'] != '')) { $settings['ad_beginning_of_post'] = $quickAdsense2['BegnRnd']; }
112
+ if(isset($quickAdsense2['MiddAds']) && ($quickAdsense2['MiddAds'] != '')) { $settings['enable_position_middle_of_post'] = '1'; }
113
  if(isset($quickAdsense2['MiddRnd']) && ($quickAdsense2['MiddRnd'] != '')) { $settings['ad_middle_of_post'] = $quickAdsense2['MiddRnd']; }
114
+ if(isset($quickAdsense2['EndiAds']) && ($quickAdsense2['EndiAds'] != '')) { $settings['enable_position_end_of_post'] = '1'; }
115
  if(isset($quickAdsense2['EndiRnd']) && ($quickAdsense2['EndiRnd'] != '')) { $settings['ad_end_of_post'] = $quickAdsense2['EndiRnd']; }
116
 
117
+ if(isset($quickAdsense2['MoreAds']) && ($quickAdsense2['MoreAds'] != '')) { $settings['enable_position_after_more_tag'] = '1'; }
118
  if(isset($quickAdsense2['MoreRnd']) && ($quickAdsense2['MoreRnd'] != '')) { $settings['ad_after_more_tag'] = $quickAdsense2['MoreRnd']; }
119
+ if(isset($quickAdsense2['LapaAds']) && ($quickAdsense2['LapaAds'] != '')) { $settings['enable_position_before_last_para'] = '1'; }
120
  if(isset($quickAdsense2['LapaRnd']) && ($quickAdsense2['LapaRnd'] != '')) { $settings['ad_before_last_para'] = $quickAdsense2['LapaRnd']; }
121
 
122
  for($i = 1; $i <= 3; $i++) {
123
+ if(isset($quickAdsense2['Par'.$i.'Ads']) && ($quickAdsense2['Par'.$i.'Ads'] != '')) { $settings['enable_position_after_para_option_'.$i] = '1'; }
124
  if(isset($quickAdsense2['Par'.$i.'Rnd']) && ($quickAdsense2['Par'.$i.'Rnd'] != '')) { $settings['ad_after_para_option_'.$i] = $quickAdsense2['Par'.$i.'Rnd']; }
125
  if(isset($quickAdsense2['Par'.$i.'Nup']) && ($quickAdsense2['Par'.$i.'Nup'] != '')) { $settings['position_after_para_option_'.$i] = $quickAdsense2['Par'.$i.'Nup']; }
126
+ if(isset($quickAdsense2['Par'.$i.'Con']) && ($quickAdsense2['Par'.$i.'Con'] != '')) { $settings['enable_jump_position_after_para_option_'.$i] = '1'; }
127
  }
128
 
129
  for($i = 1; $i <= 1; $i++) {
130
+ if(isset($quickAdsense2['Img'.$i.'Ads']) && ($quickAdsense2['Img'.$i.'Ads'] != '')) { $settings['enable_position_after_image_option_'.$i] = '1'; }
131
  if(isset($quickAdsense2['Img'.$i.'Rnd']) && ($quickAdsense2['Img'.$i.'Rnd'] != '')) { $settings['ad_after_image_option_'.$i] = $quickAdsense2['Img'.$i.'Rnd']; }
132
  if(isset($quickAdsense2['Img'.$i.'Nup']) && ($quickAdsense2['Img'.$i.'Nup'] != '')) { $settings['position_after_image_option_'.$i] = $quickAdsense2['Img'.$i.'Nup']; }
133
+ if(isset($quickAdsense2['Img'.$i.'Con']) && ($quickAdsense2['Img'.$i.'Con'] != '')) { $settings['enable_jump_position_after_image_option_'.$i] = '1'; }
134
  }
135
 
136
+ if(isset($quickAdsense2['AppPost']) && ($quickAdsense2['AppPost'] != '')) { $settings['enable_on_posts'] = '1'; }
137
+ if(isset($quickAdsense2['AppPage']) && ($quickAdsense2['AppPage'] != '')) { $settings['enable_on_pages'] = '1'; }
138
 
139
+ if(isset($quickAdsense2['AppHome']) && ($quickAdsense2['AppHome'] != '')) { $settings['enable_on_homepage'] = '1'; }
140
+ if(isset($quickAdsense2['AppCate']) && ($quickAdsense2['AppCate'] != '')) { $settings['enable_on_categories'] = '1'; }
141
+ if(isset($quickAdsense2['AppArch']) && ($quickAdsense2['AppArch'] != '')) { $settings['enable_on_archives'] = '1'; }
142
+ if(isset($quickAdsense2['AppTags']) && ($quickAdsense2['AppTags'] != '')) { $settings['enable_on_tags'] = '1'; }
143
+ if(isset($quickAdsense2['AppMaxA']) && ($quickAdsense2['AppMaxA'] != '')) { $settings['enable_all_possible_ads'] = '1'; }
144
 
145
+ if(isset($quickAdsense2['AppSide']) && ($quickAdsense2['AppSide'] != '')) { $settings['disable_widgets_on_homepage'] = '1'; }
146
 
147
+ if(isset($quickAdsense2['AppLogg']) && ($quickAdsense2['AppLogg'] != '')) { $settings['disable_for_loggedin_users'] = '1'; }
148
 
149
+ if(isset($quickAdsense2['QckTags']) && ($quickAdsense2['QckTags'] != '')) { $settings['enable_quicktag_buttons'] = '1'; }
150
+ if(isset($quickAdsense2['QckRnds']) && ($quickAdsense2['QckRnds'] != '')) { $settings['disable_randomads_quicktag_button'] = '1'; }
151
+ if(isset($quickAdsense2['QckOffs']) && ($quickAdsense2['QckOffs'] != '')) { $settings['disable_disablead_quicktag_buttons'] = '1'; }
152
+ if(isset($quickAdsense2['QckOfPs']) && ($quickAdsense2['QckOfPs'] != '')) { $settings['disable_positionad_quicktag_buttons'] = '1'; }
153
 
154
  for($i = 1; $i <= 10; $i++) {
155
  if(isset($quickAdsense2['AdsCode'.$i]) && ($quickAdsense2['AdsCode'.$i] != '')) { $settings['onpost_ad_'.$i.'_content'] = $quickAdsense2['AdsCode'.$i]; }
159
  if(isset($quickAdsense2['WidCode'.$i]) && ($quickAdsense2['WidCode'.$i] != '')) { $settings['widget_ad_'.$i.'_content'] = $quickAdsense2['WidCode'.$i]; }
160
  }
161
  update_option('quick_adsense_settings', $settings);
162
+ update_option('quick_adsense_2_options_bak', $quickAdsense2);
163
+ delete_option('quick_adsense_2_options');
164
  } else { // New User OR V1.X User
165
  $quickAdsense1AdsDisp = get_option('AdsDisp');
166
  if(isset($quickAdsense1AdsDisp) && in_array($quickAdsense1AdsDisp, array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'))) { // V1.X User
167
  $settings = quick_adsense_get_defaults();
168
  $temp = get_option('AdsDisp'); if(isset($temp) && ($temp != '')) { $settings['max_ads_per_page'] = $temp; }
169
 
170
+ $temp = get_option('BegnAds'); if(isset($temp) && ($temp != '')) { $settings['enable_position_beginning_of_post'] = '1'; }
171
  $temp = get_option('BegnRnd'); if(isset($temp) && ($temp != '')) { $settings['ad_beginning_of_post'] = $temp; }
172
+ $temp = get_option('MiddAds'); if(isset($temp) && ($temp != '')) { $settings['enable_position_middle_of_post'] = '1'; }
173
  $temp = get_option('MiddRnd'); if(isset($temp) && ($temp != '')) { $settings['ad_middle_of_post'] = $temp; }
174
+ $temp = get_option('EndiAds'); if(isset($temp) && ($temp != '')) { $settings['enable_position_end_of_post'] = '1'; }
175
  $temp = get_option('EndiRnd'); if(isset($temp) && ($temp != '')) { $settings['ad_end_of_post'] = $temp; }
176
 
177
+ $temp = get_option('MoreAds'); if(isset($temp) && ($temp != '')) { $settings['enable_position_after_more_tag'] = '1'; }
178
  $temp = get_option('MoreRnd'); if(isset($temp) && ($temp != '')) { $settings['ad_after_more_tag'] = $temp; }
179
+ $temp = get_option('LapaAds'); if(isset($temp) && ($temp != '')) { $settings['enable_position_before_last_para'] = '1'; }
180
  $temp = get_option('LapaRnd'); if(isset($temp) && ($temp != '')) { $settings['ad_before_last_para'] = $temp; }
181
 
182
  for($i = 1; $i <= 3; $i++) {
183
+ $temp = get_option('Par'.$i.'Ads'); if(isset($temp) && ($temp != '')) { $settings['enable_position_after_para_option_'.$i] = '1'; }
184
  $temp = get_option('Par'.$i.'Rnd'); if(isset($temp) && ($temp != '')) { $settings['ad_after_para_option_'.$i] = $temp; }
185
  $temp = get_option('Par'.$i.'Nup'); if(isset($temp) && ($temp != '')) { $settings['position_after_para_option_'.$i] = $temp; }
186
+ $temp = get_option('Par'.$i.'Con'); if(isset($temp) && ($temp != '')) { $settings['enable_jump_position_after_para_option_'.$i] = '1'; }
187
  }
188
 
189
  for($i = 1; $i <= 1; $i++) {
190
+ $temp = get_option('Img'.$i.'Ads'); if(isset($temp) && ($temp != '')) { $settings['enable_position_after_image_option_'.$i] = '1'; }
191
  $temp = get_option('Img'.$i.'Rnd'); if(isset($temp) && ($temp != '')) { $settings['ad_after_image_option_'.$i] = $temp; }
192
  $temp = get_option('Img'.$i.'Nup'); if(isset($temp) && ($temp != '')) { $settings['position_after_image_option_'.$i] = $temp; }
193
+ $temp = get_option('Img'.$i.'Con'); if(isset($temp) && ($temp != '')) { $settings['enable_jump_position_after_image_option_'.$i] = '1'; }
194
  }
195
 
196
+ $temp = get_option('AppPost'); if(isset($temp) && ($temp != '')) { $settings['enable_on_posts'] = '1'; }
197
+ $temp = get_option('AppPage'); if(isset($temp) && ($temp != '')) { $settings['enable_on_pages'] = '1'; }
198
 
199
+ $temp = get_option('AppHome'); if(isset($temp) && ($temp != '')) { $settings['enable_on_homepage'] = '1'; }
200
+ $temp = get_option('AppCate'); if(isset($temp) && ($temp != '')) { $settings['enable_on_categories'] = '1'; }
201
+ $temp = get_option('AppArch'); if(isset($temp) && ($temp != '')) { $settings['enable_on_archives'] = '1'; }
202
+ $temp = get_option('AppTags'); if(isset($temp) && ($temp != '')) { $settings['enable_on_tags'] = '1'; }
203
+ $temp = get_option('AppMaxA'); if(isset($temp) && ($temp != '')) { $settings['enable_all_possible_ads'] = '1'; }
204
 
205
+ $temp = get_option('AppSide'); if(isset($temp) && ($temp != '')) { $settings['disable_widgets_on_homepage'] = '1'; }
206
 
207
+ $temp = get_option('AppLogg'); if(isset($temp) && ($temp != '')) { $settings['disable_for_loggedin_users'] = '1'; }
208
 
209
+ $temp = get_option('QckTags'); if(isset($temp) && ($temp != '')) { $settings['enable_quicktag_buttons'] = '1'; }
210
+ $temp = get_option('QckRnds'); if(isset($temp) && ($temp != '')) { $settings['disable_randomads_quicktag_button'] = '1'; }
211
+ $temp = get_option('QckOffs'); if(isset($temp) && ($temp != '')) { $settings['disable_disablead_quicktag_buttons'] = '1'; }
212
+ $temp = get_option('QckOfPs'); if(isset($temp) && ($temp != '')) { $settings['disable_positionad_quicktag_buttons'] = '1'; }
213
 
214
  for($i = 1; $i <= 10; $i++) {
215
  $temp = get_option('AdsCode'.$i); if(isset($temp)) { $settings['onpost_ad_'.$i.'_content'] = $temp; }
includes/js/admin.js CHANGED
@@ -707,7 +707,7 @@ function quick_adsense_vi_check_status(sender) {
707
  },
708
  buttons : {
709
  'Ok': function() {
710
- jQuery('#quick_adsense_settings_tabs').tabs('option', 'active', 1);
711
  jQuery(this).dialog("close");
712
  }
713
  },
@@ -749,9 +749,6 @@ function quick_adsense_vi_customize_adcode() {
749
  var quick_adsense_vi_code_settings_native_text_color = jQuery('#quick_adsense_vi_code_settings_native_text_color').val();
750
  var quick_adsense_vi_code_settings_font_family = jQuery('#quick_adsense_vi_code_settings_font_family').val();
751
  var quick_adsense_vi_code_settings_font_size = jQuery('#quick_adsense_vi_code_settings_font_size').val();
752
- var quick_adsense_vi_code_settings_optional_1 = jQuery('#quick_adsense_vi_code_settings_optional_1').val();
753
- var quick_adsense_vi_code_settings_optional_2 = jQuery('#quick_adsense_vi_code_settings_optional_2').val();
754
- var quick_adsense_vi_code_settings_optional_3 = jQuery('#quick_adsense_vi_code_settings_optional_3').val();
755
  jQuery('.ui-dialog-content').html('<div class="quick_adsense_ajaxloader"></div>');
756
  jQuery('.quick_adsense_ajaxloader').show();
757
  jQuery.post(
@@ -767,9 +764,6 @@ function quick_adsense_vi_customize_adcode() {
767
  'quick_adsense_vi_code_settings_native_text_color': quick_adsense_vi_code_settings_native_text_color,
768
  'quick_adsense_vi_code_settings_font_family': quick_adsense_vi_code_settings_font_family,
769
  'quick_adsense_vi_code_settings_font_size': quick_adsense_vi_code_settings_font_size,
770
- 'quick_adsense_vi_code_settings_optional_1': quick_adsense_vi_code_settings_optional_1,
771
- 'quick_adsense_vi_code_settings_optional_2': quick_adsense_vi_code_settings_optional_2,
772
- 'quick_adsense_vi_code_settings_optional_3': quick_adsense_vi_code_settings_optional_3,
773
  }, function(response) {
774
  if(response.indexOf('###SUCCESS###') !== -1) {
775
  jQuery('#quick_adsense_vi_embedcode_status').val('Configured');
707
  },
708
  buttons : {
709
  'Ok': function() {
710
+ jQuery('#quick_adsense_settings_tabs').tabs('option', 'active', 2);
711
  jQuery(this).dialog("close");
712
  }
713
  },
749
  var quick_adsense_vi_code_settings_native_text_color = jQuery('#quick_adsense_vi_code_settings_native_text_color').val();
750
  var quick_adsense_vi_code_settings_font_family = jQuery('#quick_adsense_vi_code_settings_font_family').val();
751
  var quick_adsense_vi_code_settings_font_size = jQuery('#quick_adsense_vi_code_settings_font_size').val();
 
 
 
752
  jQuery('.ui-dialog-content').html('<div class="quick_adsense_ajaxloader"></div>');
753
  jQuery('.quick_adsense_ajaxloader').show();
754
  jQuery.post(
764
  'quick_adsense_vi_code_settings_native_text_color': quick_adsense_vi_code_settings_native_text_color,
765
  'quick_adsense_vi_code_settings_font_family': quick_adsense_vi_code_settings_font_family,
766
  'quick_adsense_vi_code_settings_font_size': quick_adsense_vi_code_settings_font_size,
 
 
 
767
  }, function(response) {
768
  if(response.indexOf('###SUCCESS###') !== -1) {
769
  jQuery('#quick_adsense_vi_embedcode_status').val('Configured');
includes/quicktags.php CHANGED
@@ -15,15 +15,15 @@ function quick_adsense_quicktag_admin_print_footer_scripts() {
15
  }
16
  if(!isset($settings['disable_disablead_quicktag_buttons']) || (!$settings['disable_disablead_quicktag_buttons'])) {
17
  echo 'QTags.addButton("quick_adsense_quicktag_noads", "NoAds", "\n<!--NoAds-->\n", "", "", "No Ads", 201);';
18
- echo 'QTags.addButton("quick_adsense_quicktag_noads", "OffDef", "\n<!--OffDef-->\n", "", "", "No Def", 201);';
19
- echo 'QTags.addButton("quick_adsense_quicktag_noads", "OffWidget", "\n<!--OffWidget-->\n", "", "", "No AdWidgets", 201);';
20
  }
21
  if(!isset($settings['disable_positionad_quicktag_buttons']) || (!$settings['disable_positionad_quicktag_buttons'])) {
22
- echo 'QTags.addButton("quick_adsense_quicktag_noads", "OffBegin", "\n<!--OffBegin-->\n", "", "", "Disable Beginning of Post Ads", 201);';
23
- echo 'QTags.addButton("quick_adsense_quicktag_noads", "OffMiddle", "\n<!--OffMiddle-->\n", "", "", "Disable Middle of Post Ads", 201);';
24
- echo 'QTags.addButton("quick_adsense_quicktag_noads", "OffEnd", "\n<!--OffEnd-->\n", "", "", "Disable End of Post Ads", 201);';
25
- echo 'QTags.addButton("quick_adsense_quicktag_noads", "OffAfMore", "\n<!--OffAfMore-->\n", "", "", "OffAfMore", 201);';
26
- echo 'QTags.addButton("quick_adsense_quicktag_noads", "OffBfLastPara", "\n<!--OffBfLastPara-->\n", "", "", "OffBfLastPara", 201);';
27
  }
28
  }
29
 
15
  }
16
  if(!isset($settings['disable_disablead_quicktag_buttons']) || (!$settings['disable_disablead_quicktag_buttons'])) {
17
  echo 'QTags.addButton("quick_adsense_quicktag_noads", "NoAds", "\n<!--NoAds-->\n", "", "", "No Ads", 201);';
18
+ echo 'QTags.addButton("quick_adsense_quicktag_offdef", "OffDef", "\n<!--OffDef-->\n", "", "", "No Def", 201);';
19
+ echo 'QTags.addButton("quick_adsense_quicktag_offwidget", "OffWidget", "\n<!--OffWidget-->\n", "", "", "No AdWidgets", 201);';
20
  }
21
  if(!isset($settings['disable_positionad_quicktag_buttons']) || (!$settings['disable_positionad_quicktag_buttons'])) {
22
+ echo 'QTags.addButton("quick_adsense_quicktag_offbegin", "OffBegin", "\n<!--OffBegin-->\n", "", "", "Disable Beginning of Post Ads", 201);';
23
+ echo 'QTags.addButton("quick_adsense_quicktag_offmiddle", "OffMiddle", "\n<!--OffMiddle-->\n", "", "", "Disable Middle of Post Ads", 201);';
24
+ echo 'QTags.addButton("quick_adsense_quicktag_offend", "OffEnd", "\n<!--OffEnd-->\n", "", "", "Disable End of Post Ads", 201);';
25
+ echo 'QTags.addButton("quick_adsense_quicktag_offafmore", "OffAfMore", "\n<!--OffAfMore-->\n", "", "", "OffAfMore", 201);';
26
+ echo 'QTags.addButton("quick_adsense_quicktag_offbflastpara", "OffBfLastPara", "\n<!--OffBfLastPara-->\n", "", "", "OffBfLastPara", 201);';
27
  }
28
  }
29
 
includes/settings.php CHANGED
@@ -35,16 +35,18 @@ function quick_adsense_admin_init() {
35
  add_settings_section('quick_adsense_general', '', 'quick_adsense_general_content', 'quick-adsense-general');
36
  add_settings_section('quick_adsense_onpost', '', 'quick_adsense_onpost_content', 'quick-adsense-onpost');
37
  add_settings_section('quick_adsense_widgets', '', 'quick_adsense_widgets_content', 'quick-adsense-widgets');
 
38
  }
39
 
40
  function quick_adsense_settings_page() { ?>
41
  <div class="wrap">
42
- <h2 id="quick_adsense_title">Quick Adsense Setting <span style="font-size: 14px;">(Version 2.3)</span></h2>
43
  <form id="quick_adsense_settings_form" method="post" action="options.php" name="wp_auto_commenter_form" style="display: none;">
44
  <?php settings_fields('quick_adsense_settings'); ?>
45
  <div id="quick_adsense_settings_tabs">
46
  <ul>
47
  <li><a href="#tabs-settings">Settings</a></li>
 
48
  <li><a href="#tabs-vi"> Monetization with vi stories </a></li>
49
  </ul>
50
  <div id="tabs-settings">
@@ -62,6 +64,10 @@ function quick_adsense_settings_page() { ?>
62
  </div>
63
  <?php submit_button('Save Changes'); ?>
64
  </div>
 
 
 
 
65
  <div id="tabs-vi">
66
  <?php do_settings_sections('quick-adsense-vi'); ?>
67
  </div>
@@ -78,6 +84,28 @@ function quick_adsense_settings_page() { ?>
78
  <?php
79
  }
80
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  function quick_adsense_vi_plugin_card() {
82
  echo '<div class="quick_adsense_vi_block">';
83
  if(quick_adsense_vi_api_is_loggedin()) {
@@ -88,7 +116,7 @@ function quick_adsense_vi_plugin_card() {
88
  echo '</div>';
89
  }
90
 
91
- function quick_adsense_general_content() {
92
  $settings = get_option('quick_adsense_settings');
93
  echo '<div class="quick_adsense_block">';
94
  echo '<div class="quick_adsense_block_labels">';
35
  add_settings_section('quick_adsense_general', '', 'quick_adsense_general_content', 'quick-adsense-general');
36
  add_settings_section('quick_adsense_onpost', '', 'quick_adsense_onpost_content', 'quick-adsense-onpost');
37
  add_settings_section('quick_adsense_widgets', '', 'quick_adsense_widgets_content', 'quick-adsense-widgets');
38
+ add_settings_section('quick_adsense_header_footer_codes', '', 'quick_adsense_header_footer_codes_plugin_card', 'quick-adsense-header-footer-codes');
39
  }
40
 
41
  function quick_adsense_settings_page() { ?>
42
  <div class="wrap">
43
+ <h2 id="quick_adsense_title">Quick Adsense Setting <span style="font-size: 14px;">(Version 2.4)</span></h2>
44
  <form id="quick_adsense_settings_form" method="post" action="options.php" name="wp_auto_commenter_form" style="display: none;">
45
  <?php settings_fields('quick_adsense_settings'); ?>
46
  <div id="quick_adsense_settings_tabs">
47
  <ul>
48
  <li><a href="#tabs-settings">Settings</a></li>
49
+ <li><a href="#tabs-header-footer-codes">Header / Footer Codes</a></li>
50
  <li><a href="#tabs-vi"> Monetization with vi stories </a></li>
51
  </ul>
52
  <div id="tabs-settings">
64
  </div>
65
  <?php submit_button('Save Changes'); ?>
66
  </div>
67
+ <div id="tabs-header-footer-codes">
68
+ <?php do_settings_sections('quick-adsense-header-footer-codes'); ?>
69
+ <?php submit_button('Save Changes'); ?>
70
+ </div>
71
  <div id="tabs-vi">
72
  <?php do_settings_sections('quick-adsense-vi'); ?>
73
  </div>
84
  <?php
85
  }
86
 
87
+ function quick_adsense_header_footer_codes_plugin_card() {
88
+ $settings = get_option('quick_adsense_settings');
89
+ echo '<div id="quick_adsense_top_sections_wrapper">';
90
+ echo '<div class="quick_adsense_block">';
91
+ echo '<div class="quick_adsense_block_labels">';
92
+ echo '<span>Header<br />Embed Code</span>';
93
+ echo '</div>';
94
+ echo '<div class="quick_adsense_block_controls">';
95
+ echo quickadsense_get_control('textarea-big', '', 'quick_adsense_settings_header_embed_code', 'quick_adsense_settings[header_embed_code]', ((isset($settings['header_embed_code']))?$settings['header_embed_code']:''));
96
+ echo '</div>';
97
+ echo '<div class="clear"></div>';
98
+ echo '<div class="quick_adsense_block_labels">';
99
+ echo '<span>Footer<br />Embed Code</span>';
100
+ echo '</div>';
101
+ echo '<div class="quick_adsense_block_controls">';
102
+ echo quickadsense_get_control('textarea-big', '', 'quick_adsense_settings_footer_embed_code', 'quick_adsense_settings[footer_embed_code]', ((isset($settings['footer_embed_code']))?$settings['footer_embed_code']:''));
103
+ echo '</div>';
104
+ echo '<div class="clear"></div>';
105
+ echo '</div>';
106
+ echo '</div>';
107
+ }
108
+
109
  function quick_adsense_vi_plugin_card() {
110
  echo '<div class="quick_adsense_vi_block">';
111
  if(quick_adsense_vi_api_is_loggedin()) {
116
  echo '</div>';
117
  }
118
 
119
+ function quick_adsense_general_content() {
120
  $settings = get_option('quick_adsense_settings');
121
  echo '<div class="quick_adsense_block">';
122
  echo '<div class="quick_adsense_block_labels">';
includes/vi.php CHANGED
@@ -141,7 +141,7 @@ function quick_adsense_vi_get_chart() {
141
  echo '</div>';
142
  echo '<div class="clear"></div>';
143
  } else {
144
- echo '<p class="viError">There was an error processing your request, our team was notified.<br />Please try again later.</p>';
145
  echo '<div id="quick_adsense_vi_earnings_wrapper">';
146
  echo '<div id="quick_adsense_vi_earnings">';
147
  echo '<span id="quick_adsense_vi_earnings_label">Total Earnings</span>';
@@ -171,7 +171,7 @@ function quick_adsense_vi_signup_form_get_content() {
171
  echo '</div>';
172
  } else {
173
  echo '<div class="quick_adsense_popup_content_wrapper">';
174
- echo '<p> There was an error processing your request. Please try again later. </p>';
175
  echo '</div>';
176
  }
177
  die();
@@ -315,18 +315,6 @@ function quick_adsense_vi_customize_adcode_form_get_content() {
315
  echo quickadsense_get_control('select', 'Native Text Font Size', 'quick_adsense_vi_code_settings_font_size', 'quick_adsense_vi_code_settings_font_size', ((isset($vicodeSettings['font_size']))?$vicodeSettings['font_size']:''), quick_adsense_vi_get_constant_font_sizes());
316
  echo '<small></small>';
317
  echo '</p>';
318
- echo '<p>';
319
- echo quickadsense_get_control('textarea', 'Optional 1', 'quick_adsense_vi_code_settings_optional_1', 'quick_adsense_vi_code_settings_optional_1', ((isset($vicodeSettings['optional_1']))?$vicodeSettings['optional_1']:''), null, 'input widefat', '', 'Max length 200 chars');
320
- echo '<small></small>';
321
- echo '</p>';
322
- echo '<p>';
323
- echo quickadsense_get_control('textarea', 'Optional 2', 'quick_adsense_vi_code_settings_optional_2', 'quick_adsense_vi_code_settings_optional_2', ((isset($vicodeSettings['optional_2']))?$vicodeSettings['optional_2']:''), null, 'input widefat', '', 'Max length 200 chars');
324
- echo '<small></small>';
325
- echo '</p>';
326
- echo '<p>';
327
- echo quickadsense_get_control('textarea', 'Optional 3', 'quick_adsense_vi_code_settings_optional_3', 'quick_adsense_vi_code_settings_optional_3', ((isset($vicodeSettings['optional_3']))?$vicodeSettings['optional_3']:''), null, 'input widefat', '', 'Max length 200 chars');
328
- echo '<small></small>';
329
- echo '</p>';
330
  echo '<p class="quick_adsense_vi_delay_notice">vi Ad Changes might take some time to take into effect</p>';
331
  echo '</div>';
332
  echo '<div class="clear"></div>';
@@ -356,9 +344,6 @@ function quick_adsense_vi_customize_adcode_form_save_action() {
356
  $vicodeSettings['native_text_color'] = ((isset($_POST['quick_adsense_vi_code_settings_native_text_color']))?$_POST['quick_adsense_vi_code_settings_native_text_color']:'');
357
  $vicodeSettings['font_family'] = ((isset($_POST['quick_adsense_vi_code_settings_font_family']))?$_POST['quick_adsense_vi_code_settings_font_family']:'');
358
  $vicodeSettings['font_size'] = ((isset($_POST['quick_adsense_vi_code_settings_font_size']))?$_POST['quick_adsense_vi_code_settings_font_size']:'');
359
- $vicodeSettings['optional_1'] = ((isset($_POST['quick_adsense_vi_code_settings_optional_1']))?$_POST['quick_adsense_vi_code_settings_optional_1']:'');
360
- $vicodeSettings['optional_2'] = ((isset($_POST['quick_adsense_vi_code_settings_optional_2']))?$_POST['quick_adsense_vi_code_settings_optional_2']:'');
361
- $vicodeSettings['optional_3'] = ((isset($_POST['quick_adsense_vi_code_settings_optional_3']))?$_POST['quick_adsense_vi_code_settings_optional_3']:'');
362
  update_option('quick_adsense_vi_code_settings', $vicodeSettings);
363
  $viCodeStatus = quick_adsense_vi_api_set_vi_code($vicodeSettings);
364
  if(is_array($viCodeStatus) && (isset($viCodeStatus['status'])) && ($viCodeStatus['status'] == 'error')) {
@@ -367,7 +352,8 @@ function quick_adsense_vi_customize_adcode_form_save_action() {
367
  echo '<p class="viError">'.$viCodeStatus['message'].'</p>';
368
  } else {
369
  echo '###FAIL###';
370
- echo '<p class="viError">There was an error processing your request, our team was notified.<br />Please try again later.</p>';
 
371
  }
372
  } else {
373
  echo '###SUCCESS###';
141
  echo '</div>';
142
  echo '<div class="clear"></div>';
143
  } else {
144
+ echo '<p class="viError">There was an error processing your request, our team was notified.<br />Try clearing your browser cache, log out and log in again.</p>';
145
  echo '<div id="quick_adsense_vi_earnings_wrapper">';
146
  echo '<div id="quick_adsense_vi_earnings">';
147
  echo '<span id="quick_adsense_vi_earnings_label">Total Earnings</span>';
171
  echo '</div>';
172
  } else {
173
  echo '<div class="quick_adsense_popup_content_wrapper">';
174
+ echo '<p> There was an error processing your request. Please try again later.</p>';
175
  echo '</div>';
176
  }
177
  die();
315
  echo quickadsense_get_control('select', 'Native Text Font Size', 'quick_adsense_vi_code_settings_font_size', 'quick_adsense_vi_code_settings_font_size', ((isset($vicodeSettings['font_size']))?$vicodeSettings['font_size']:''), quick_adsense_vi_get_constant_font_sizes());
316
  echo '<small></small>';
317
  echo '</p>';
 
 
 
 
 
 
 
 
 
 
 
 
318
  echo '<p class="quick_adsense_vi_delay_notice">vi Ad Changes might take some time to take into effect</p>';
319
  echo '</div>';
320
  echo '<div class="clear"></div>';
344
  $vicodeSettings['native_text_color'] = ((isset($_POST['quick_adsense_vi_code_settings_native_text_color']))?$_POST['quick_adsense_vi_code_settings_native_text_color']:'');
345
  $vicodeSettings['font_family'] = ((isset($_POST['quick_adsense_vi_code_settings_font_family']))?$_POST['quick_adsense_vi_code_settings_font_family']:'');
346
  $vicodeSettings['font_size'] = ((isset($_POST['quick_adsense_vi_code_settings_font_size']))?$_POST['quick_adsense_vi_code_settings_font_size']:'');
 
 
 
347
  update_option('quick_adsense_vi_code_settings', $vicodeSettings);
348
  $viCodeStatus = quick_adsense_vi_api_set_vi_code($vicodeSettings);
349
  if(is_array($viCodeStatus) && (isset($viCodeStatus['status'])) && ($viCodeStatus['status'] == 'error')) {
352
  echo '<p class="viError">'.$viCodeStatus['message'].'</p>';
353
  } else {
354
  echo '###FAIL###';
355
+ echo '<p class="viError">There was an error processing your request, our team was notified.<br />Try clearing your browser cache, log out and log in again.</p>';
356
+ echo '<p style="font-size: 10px; margin: 0;">'.$viCodeStatus['errorCode'].': '.$viCodeStatus['message'].'</p>';
357
  }
358
  } else {
359
  echo '###SUCCESS###';
quick-adsense.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin URI: http://quickadsense.com/
5
  Description: Quick Adsense offers a quicker & flexible way to insert Google Adsense or any Ads code into a blog post.
6
  Author: Quicksense
7
- Version: 2.3.1
8
  Author URI: http://quickadsense.com/
9
  */
10
  /*
4
  Plugin URI: http://quickadsense.com/
5
  Description: Quick Adsense offers a quicker & flexible way to insert Google Adsense or any Ads code into a blog post.
6
  Author: Quicksense
7
+ Version: 2.3.2
8
  Author URI: http://quickadsense.com/
9
  */
10
  /*
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: quickadsense
3
  Tags: WordPress Plugin, adsense, google adsense, random adsense, random ads, advertising, adsense insertion, ad manager, ad, yahoo, google, ads, text insertion, widget, sidebar, admin, posts, plugin
4
  Requires at least: 4.0
5
  Tested up to: 4.9.4
6
- Stable tag: 2.3.1
7
 
8
  Quick Adsense offers a quicker & flexible way to insert Google Adsense or any Ads code into a blog post.
9
 
@@ -48,6 +48,12 @@ Sign up for a [Google Adsense Account](http://adsense.google.com/) to generate r
48
  Please feedback to [http://quickadsense.com/](http://quickadsense.com/) for any bug you might have found, or any suggestion you like to add.
49
 
50
  == Change Log ==
 
 
 
 
 
 
51
  = 2.3 =
52
  * Updated ads.txt modification logic
53
  * Introduced monetization with video intelligence AG
3
  Tags: WordPress Plugin, adsense, google adsense, random adsense, random ads, advertising, adsense insertion, ad manager, ad, yahoo, google, ads, text insertion, widget, sidebar, admin, posts, plugin
4
  Requires at least: 4.0
5
  Tested up to: 4.9.4
6
+ Stable tag: 2.3.2
7
 
8
  Quick Adsense offers a quicker & flexible way to insert Google Adsense or any Ads code into a blog post.
9
 
48
  Please feedback to [http://quickadsense.com/](http://quickadsense.com/) for any bug you might have found, or any suggestion you like to add.
49
 
50
  == Change Log ==
51
+ = 2.3.2 =
52
+ * Bug fixes
53
+ * 3 option fields have been removed
54
+ * The API limiter added
55
+ * QuickTag issues have been fixed
56
+
57
  = 2.3 =
58
  * Updated ads.txt modification logic
59
  * Introduced monetization with video intelligence AG