AdSense Plugin WP QUADS - Version 1.4.3

Version Description

  • New: Add filter to add 3 more paragraph AdSense ads placed with WP QUADS PRO
  • New: Add ad health and checking function to detect if there are error in adsense settings
  • New: Support link to troubleshooting guide if AdSense ads are not shown
  • New: Add floating Save Settings button
  • New: Grey out unused AdSense ad spots in general settings
  • New: Tested up to Wordpress 4.7.1
  • New: Use up to 20 maximum AdSense ads on one page from a collection of 10 different ads
  • New: Allow the use of the same ad on several different ad positions at the same time
  • New: Complete rewrite of the main processing function for easier maintanance

  • Fix: Settings are lost after updating when db option quads_version is empty

  • Fix: AdSense option Hide on device X condition not working width shortcode [quads]

  • Fix: Rewrite admin html and css for a more robust structure to prevent to be overwritten by other plugin devs who think its cool to load their css stuff all over the admin area

  • Fix: Button Open All Ads only works on second click

  • Fix: Hide Sizing Options when ad type is not AdSense

  • Fix: Meta Box option "Hide all ads" is not hiding custom created ads with commercial themes like bimber.

  • Tweak: Enable quicktags button per default on first time installation

  • Tweak: Performance update. Uses less ressources

Download this release

Release Info

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

Code changes from version 1.4.0 to 1.4.3

assets/css/quads-admin.css CHANGED
@@ -128,13 +128,13 @@ input.medium-text, textarea.medium-text {
128
 
129
 
130
 
131
- #quads_tab_container .row{
132
  padding-top:12px;
133
  padding-bottom:12px;
134
  }
135
 
136
 
137
- #quads_tab_container .row label strong, #tab_container .row strong {
138
  font-weight: bold;
139
  }
140
 
@@ -463,7 +463,7 @@ li.quads-tabs {
463
  max-width:640px;
464
  }
465
 
466
- #quads_settingslicenses_header .row.th{
467
  min-width:250px;
468
  }
469
 
@@ -795,3 +795,11 @@ li.quads-tabs {
795
  min-height: 25px;
796
  }
797
 
 
 
 
 
 
 
 
 
128
 
129
 
130
 
131
+ #quads_tab_container .quads-row{
132
  padding-top:12px;
133
  padding-bottom:12px;
134
  }
135
 
136
 
137
+ #quads_tab_container .quads-row label strong, #tab_container .quads-row strong {
138
  font-weight: bold;
139
  }
140
 
463
  max-width:640px;
464
  }
465
 
466
+ #quads_settingslicenses_header .quads-row.th{
467
  min-width:250px;
468
  }
469
 
795
  min-height: 25px;
796
  }
797
 
798
+
799
+ #quads-validate{
800
+ margin-top: -20px;
801
+ display: block;
802
+ margin-left: 2px;
803
+ margin-bottom: 20px;
804
+ font-weight: bold;
805
+ }
assets/css/quads-admin.min.css CHANGED
@@ -1 +1 @@
1
- .quads-share-button-container{margin:5px 0}.quads-share-button-container p{margin:0 0 10px}.quads-share-button{display:inline-block}.quads-share-button a{text-decoration:none}.quads-share-button .quads-share{font-family:sans-serif;font-weight:700;text-decoration:none;text-align:center;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;color:#FFF;display:inline;font-size:16px;width:40px;padding:4px 8px}.quads-share-button-twitter .quads-share{background-color:#00ABF0}.quads-share-button-facebook .quads-share{background-color:#3b5998}.quads-share-button-googleplus .quads-share{background-color:#F53424}.quads-share-button-facebook .share:active,.quads-share-button-googleplus .share:active,.quads-share-button-twitter .share:active{background-color:#353535}@media (max-width:925px){.quads-share-button .quads-share{font-size:15px;padding:8px 16px}}.quads-richeditor{font-size:11px}#quads-add-ons h2{margin:0 0 15px}#quads-add-ons .quadsshare-addons{float:left;margin:0 15px 15px 0;background:#f0f0f0;border:1px solid #ccc;width:320px;padding:8px;height:315px;position:relative}#quads-add-ons .quadsshare-addons h3{margin:0 0 8px;font-size:13px}#quads-add-ons .quadsshare-addons .button-secondary{position:absolute;bottom:8px;left:8px}#quads-add-ons .quadsshare-addons .third-party{display:none}#system-info-textarea{width:580px;height:400px;font-family:Menlo,Monaco,monospace;background:0 0;white-space:pre;overflow:auto;display:block}.quads-select-chosen{width:300px}input.large-text,textarea.large-text{max-width:600px}input.medium-text,textarea.medium-text{min-width:190px}#quads_tab_container ul{list-style:none;margin:0;padding:0;background:#fff;float:left}#quads_tab_container ul li:first-child.selected-tab{border-top:none}#quads_tab_container ul li a.selected-tab{font-weight:700;text-decoration:none}#quads_tab_container .row{padding-top:12px;padding-bottom:12px}#quads_tab_container .row label strong,#tab_container .row strong{font-weight:700}.quads-tabs a{padding:5px;color:#a1a1a1;text-transform:uppercase}.quads-tabs a strong{font-weight:700}li.quads-tabs{float:left;margin-left:0;background-color:#e5e5e5}#quads_tab_container>ul>li.quads-tabs.active{background-color:#fff}#quads_tab_container>ul>li.quads-tabs.active a{color:#83c11f}#quads_tab_container .quads-panel-container{background:#FFF;padding:20px;overflow:auto;text-align:left;margin-bottom:10px;max-width:640px;float:left;clear:both}.form-table{margin-top:-20px}#quads_tab_container .form-table th{vertical-align:top;text-align:left;padding:20px 10px 20px 0;line-height:1.3;font-weight:700;font-size:14px;color:#484848;width:30%}#quads_tab_container .form-table tr{border-bottom:1px solid #E7E7E7}#quads_tab_container span.description{display:block;font-weight:400;font-style:normal;font-size:13px;margin-top:7px;color:#484848}#quads_tab_container .col-title{font-size:18px;color:#484848}@media only screen and (max-width:680px){#quads_tab_container ul{float:none;background:#fff}#quads_tab_container .form-table tr>th{width:100%}#quads_tab_container span.description{font-size:14px}#quads_tab_container .form-table tr>th,#tab_container .form-table tr>td{padding:10px}#quads_tab_container .quads-tabs a{text-align:left}#quads_tab_container li.quads-tabs{float:none;margin-left:0}}#quads_tab_container ul li.quads-tabs{margin-bottom:0}#quads_tab_container ul li.quads-tabs a{display:block;padding:10px;text-decoration:none;font-weight:700}#quads_tab_container ul li.quads-tabs a:hover{color:#383838}#quads_tab_container ul li.quads-tabs a.active{text-decoration:underline}#quads_tab_container table tbody tr:nth-child(1)>th>div{font-size:20px}#quadstabcontainer>.quadstabs{background-color:#fff}#quadstabcontainer ul .active{background-color:#00adef;color:#fff;border-bottom-color:#0098D2}#quadstabcontainer ul .active:hover{background-color:#00A4E2;color:#fff;border-bottom-color:#0098D2}#quadstabcontainer ul li a{padding:10px 14px;background-color:#f3f3f3}#quadstabcontainer .quadstab-container{border:0 solid #ececec}.quads-quote-docs{font-family:Courier New,Courier,Fixed;color:#050}.quads-desc{display:block;font-style:italic;padding-top:10px}.quads-postbox{padding:10px;position:relative;min-width:255px;border:1px solid #e5e5e5;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.04);box-shadow:0 1px 1px rgba(0,0,0,.04);background:#fff;margin-bottom:20px}.nav-tab-active{background-color:#fff;border-bottom:0}#quads-add-ons{padding:20px}.quads-toggle{position:absolute;right:0;top:0}.quads-box-close .quads-close-open-icon{background-position:0 -38px}.quads-close-open-icon{width:38px;height:38px;background:url(../images/arrow-close.png) repeat-y #f4f4f4}.quads-ad-toggle-header{position:relative;background-color:#f4f4f4;margin-bottom:2px;padding:10px 10px 10px 15px;-moz-user-select:-moz-none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;user-select:none;cursor:pointer!important}.quads-ad-toggle-container{padding:20px;background-color:#f4f4f4}.quads-toogle-title{font-size:16px;font-weight:700}.adsense-size-title,.quads-advanced-description label{font-weight:600;font-size:12px;text-transform:uppercase;float:left}.quads-advanced-description label{width:215px}.quads-advanced-ad-box{clear:both;margin-top:20px;margin-bottom:20px}.adsense-size-title{margin-right:0;line-height:32px;margin-left:14px;min-width:100px}.quads-select-style-overwrite{border:1px solid #e6e6e6;width:150px;overflow:hidden;background:url(../images/box_arrow.png) 120px 0 repeat-y #fff;margin:0 0 5px}.quads-select-style-overwrite select{width:150px}.quads-size-input{position:relative;top:-1px;width:110%;border:none;box-shadow:none;background:0 0;-webkit-appearance:none;font-family:'Open Sans',arial,sans-serif;color:#555;font-size:12px}.quads-pro-overlay{height:200px}.quads-license-error-notice,.quads-license-expires-soon-notice{background-color:#fff;padding:10px;overflow:auto;-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,.1);box-shadow:0 1px 1px 0 rgba(0,0,0,.1);border:1px solid #ECECEC;border-radius:3px}.quads-license-error-notice a{color:#0097df;text-decoration:underline}.quads-license-error-notice{border-left:4px solid #dd3d36}.quads-license-expiration-date-notice,.quads-license-lifetime-notice,.quads-license-null{padding:0}.quads-license-expiration-date-notice .quads-license-data p,.quads-license-lifetime-notice .quads-license-data p{color:#666;font-size:14px;font-style:italic;margin:4px 0 0}#quads_settingslicenses_header-nav{display:none}#quads_settingslicenses_header{max-width:640px}#quads_settingslicenses_header .row.th{min-width:250px}.quads-notice{background:#fff;border-left:4px solid #46b450;-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,.1);box-shadow:0 1px 1px 0 rgba(0,0,0,.1);margin:5px 15px 2px;padding:1px 12px}.quads_admin h2.nav-tab-wrapper{border:0}.quads_admin .nav-tab{border:0;text-transform:uppercase;color:#a1a1a1;font-weight:700}.quads-h1{margin-bottom:1.35rem;font-size:2.5em;line-height:3.68rem;letter-spacing:normal}.quads-h2{margin-top:0;margin-bottom:1.2rem;font-size:30px;line-height:2.5rem}.quads-heading-pro{color:#83c11f;font-weight:700}.quads-button.green{display:inline-block;background-color:#83c11f;padding:10px;min-width:170px;color:#fff;font-size:16px;text-decoration:none;text-align:center;margin-top:20px}#quads-add-ons .quads-footer{clear:both;margin-top:20px;font-style:italic}#quads-add-ons li{font-size:18px;line-height:29px;position:relative;padding-left:23px;list-style:none!important}#quads-add-ons li:before{width:1em;height:100%;background:url(data:image/svg+xml;charset=utf8,%3Csvg%20width%3D%221792%22%20height%3D%221792%22%20viewBox%3D%220%200%201792%201792%22%20xmlns%3D%22http%3A%2F%2Fwww%2Ew3%2Eorg%2F2000%2Fsvg%22%3E%3Cpath%20fill%3D%22%2377B227%22%20d%3D%22M1671%20566q0%2040%2D28%2068l%2D724%20724%2D136%20136q%2D28%2028%2D68%2028t%2D68%2D28l%2D136%2D136%2D362%2D362q%2D28%2D28%2D28%2D68t28%2D68l136%2D136q28%2D28%2068%2D28t68%2028l294%20295%20656%2D657q28%2D28%2068%2D28t68%2028l136%20136q28%2028%2028%2068z%22%2F%3E%3C%2Fsvg%3E) left .4em no-repeat;background-size:contain;content:"";position:absolute;top:0;left:0;color:#77b227}.adsense_admin_header{font-size:14px;font-weight:500}#quads-adsense-bg-div{position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.65);z-index:250000}#quads-adsense-container{text-align:center;width:480px;margin:85px auto 0;background-color:#fff;padding:2%;border-radius:2px}#quads-adsense-container h3{margin-top:0}#quads-adsense-container textarea,.quads-ad-toggle-container textarea{width:100%}.quads-ad-toggle-container input{margin-top:7px;margin-bottom:10px}.quads-adsense-code label,input{margin-right:2px}#quads_settings\5b ad2\5d \5b g_data_ad_client\5d{width:200px}.quads-ad-toggle-container label{display:inline-block;margin-right:2px;margin-top:-3px}.quads_adsense_code .quads-add-adsense{margin:20px 5px 20px 0}.quads-label-left{min-width:71px}#quads-label-Type{min-width:67px}.quads-medium-size{width:110px}#quads-msg{display:none;margin:5px;background-color:#c55c5c;color:#fff}.quads-loader,.quads-success-modal{display:block;position:fixed;top:45%;left:25%;width:200px;height:auto;padding:5px 20px;z-index:1002;overflow:auto}.quads-form-table{width:100%}.quads-left-box{width:45%;min-height:100px;float:left;line-height:35px;min-width:300px}@media screen and (max-width:700px){.adsense-size-title{margin-left:0}.quads-left-box{width:45%;min-height:100px;float:none;line-height:35px;min-width:300px}.quads-style img{max-width:50px}}.adsense_admin_header ul li{margin-top:2px;margin-left:20px;list-style-type:square}.quads-general-helper,.quads-helper{background-color:#83c11f;width:15px;display:inline-block;top:4px;cursor:pointer;margin-left:2px}.quads-helper{border-radius:50%;border:2px solid #fff;height:15px;position:relative;margin-top:-4px}.quads-general-helper:after,.quads-helper:after{height:20px;font-family:sans-serif;content:"?";font-size:11px;font-weight:700;left:4px;position:absolute;color:#fff}.quads-helper:after{margin-top:-10px}.quads-general-helper:after{margin-top:-2px}.quads-general-helper{border-radius:50%;border:2px solid #fff;height:15px;position:relative;margin-top:-4px}.quads-message{padding:10px;border:1px solid #FBFBFB;border-radius:2px;background-color:#F8F8F8;position:absolute;max-width:500px;z-index:9999;display:none;box-shadow:0 0 5px rgba(0,0,0,.2);font-weight:400;line-height:20px;text-transform:none;font-size:14px}#quads-pro-hover{background-color:#83c11f;padding:20px;min-width:150px;color:#fff;display:block;position:relative;margin-top:-100px;margin-left:50%}#quads-pro-hover-background{width:100%;height:100%;background:rgba(0,0,0,.6)}#quads-open-toggle{clear:both;float:left;margin-top:10px}#quads_settingsadsense_header input[type=number].small-text{width:55px}.quads_adsense_code input.quads-bggrey{background-color:#f5f5f5;color:#939393}.quads-amp-code{color:#939393;height:130px}.quads-chosen-select .chosen-choices li.search-field input{min-height:25px}
1
+ .quads-share-button-container{margin:5px 0}.quads-share-button-container p{margin:0 0 10px}.quads-share-button{display:inline-block}.quads-share-button a{text-decoration:none}.quads-share-button .quads-share{font-family:sans-serif;font-weight:700;text-decoration:none;text-align:center;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;color:#FFF;display:inline;font-size:16px;width:40px;padding:4px 8px}.quads-share-button-twitter .quads-share{background-color:#00ABF0}.quads-share-button-facebook .quads-share{background-color:#3b5998}.quads-share-button-googleplus .quads-share{background-color:#F53424}.quads-share-button-facebook .share:active,.quads-share-button-googleplus .share:active,.quads-share-button-twitter .share:active{background-color:#353535}@media (max-width:925px){.quads-share-button .quads-share{font-size:15px;padding:8px 16px}}.quads-richeditor{font-size:11px}#quads-add-ons h2{margin:0 0 15px}#quads-add-ons .quadsshare-addons{float:left;margin:0 15px 15px 0;background:#f0f0f0;border:1px solid #ccc;width:320px;padding:8px;height:315px;position:relative}#quads-add-ons .quadsshare-addons h3{margin:0 0 8px;font-size:13px}#quads-add-ons .quadsshare-addons .button-secondary{position:absolute;bottom:8px;left:8px}#quads-add-ons .quadsshare-addons .third-party{display:none}#system-info-textarea{width:580px;height:400px;font-family:Menlo,Monaco,monospace;background:0 0;white-space:pre;overflow:auto;display:block}.quads-select-chosen{width:300px}input.large-text,textarea.large-text{max-width:600px}input.medium-text,textarea.medium-text{min-width:190px}#quads_tab_container ul{list-style:none;margin:0;padding:0;background:#fff;float:left}#quads_tab_container ul li:first-child.selected-tab{border-top:none}#quads_tab_container ul li a.selected-tab{font-weight:700;text-decoration:none}#quads_tab_container .quads-row{padding-top:12px;padding-bottom:12px}#quads_tab_container .quads-row label strong,#tab_container .quads-row strong{font-weight:700}.quads-tabs a{padding:5px;color:#a1a1a1;text-transform:uppercase}.quads-tabs a strong{font-weight:700}li.quads-tabs{float:left;margin-left:0;background-color:#e5e5e5}#quads_tab_container>ul>li.quads-tabs.active{background-color:#fff}#quads_tab_container>ul>li.quads-tabs.active a{color:#83c11f}#quads_tab_container .quads-panel-container{background:#FFF;padding:20px;overflow:auto;text-align:left;margin-bottom:10px;max-width:640px;float:left;clear:both}.form-table{margin-top:-20px}#quads_tab_container .form-table th{vertical-align:top;text-align:left;padding:20px 10px 20px 0;line-height:1.3;font-weight:700;font-size:14px;color:#484848;width:30%}#quads_tab_container .form-table tr{border-bottom:1px solid #E7E7E7}#quads_tab_container span.description{display:block;font-weight:400;font-style:normal;font-size:13px;margin-top:7px;color:#484848}#quads_tab_container .col-title{font-size:18px;color:#484848}@media only screen and (max-width:680px){#quads_tab_container ul{float:none;background:#fff}#quads_tab_container .form-table tr>th{width:100%}#quads_tab_container span.description{font-size:14px}#quads_tab_container .form-table tr>th,#tab_container .form-table tr>td{padding:10px}#quads_tab_container .quads-tabs a{text-align:left}#quads_tab_container li.quads-tabs{float:none;margin-left:0}}#quads_tab_container ul li.quads-tabs{margin-bottom:0}#quads_tab_container ul li.quads-tabs a{display:block;padding:10px;text-decoration:none;font-weight:700}#quads_tab_container ul li.quads-tabs a:hover{color:#383838}#quads_tab_container ul li.quads-tabs a.active{text-decoration:underline}#quads_tab_container table tbody tr:nth-child(1)>th>div{font-size:20px}#quadstabcontainer>.quadstabs{background-color:#fff}#quadstabcontainer ul .active{background-color:#00adef;color:#fff;border-bottom-color:#0098D2}#quadstabcontainer ul .active:hover{background-color:#00A4E2;color:#fff;border-bottom-color:#0098D2}#quadstabcontainer ul li a{padding:10px 14px;background-color:#f3f3f3}#quadstabcontainer .quadstab-container{border:0 solid #ececec}.quads-quote-docs{font-family:Courier New,Courier,Fixed;color:#050}.quads-desc{display:block;font-style:italic;padding-top:10px}.quads-postbox{padding:10px;position:relative;min-width:255px;border:1px solid #e5e5e5;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.04);box-shadow:0 1px 1px rgba(0,0,0,.04);background:#fff;margin-bottom:20px}.nav-tab-active{background-color:#fff;border-bottom:0}#quads-add-ons{padding:20px}.quads-toggle{position:absolute;right:0;top:0}.quads-box-close .quads-close-open-icon{background-position:0 -38px}.quads-close-open-icon{width:38px;height:38px;background:url(../images/arrow-close.png) repeat-y #f4f4f4}.quads-ad-toggle-header{position:relative;background-color:#f4f4f4;margin-bottom:2px;padding:10px 10px 10px 15px;-moz-user-select:-moz-none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;user-select:none;cursor:pointer!important}.quads-ad-toggle-container{padding:20px;background-color:#f4f4f4}.quads-toogle-title{font-size:16px;font-weight:700}.adsense-size-title,.quads-advanced-description label{font-weight:600;font-size:12px;text-transform:uppercase;float:left}.quads-advanced-description label{width:215px}.quads-advanced-ad-box{clear:both;margin-top:20px;margin-bottom:20px}.adsense-size-title{margin-right:0;line-height:32px;margin-left:14px;min-width:100px}.quads-select-style-overwrite{border:1px solid #e6e6e6;width:150px;overflow:hidden;background:url(../images/box_arrow.png) 120px 0 repeat-y #fff;margin:0 0 5px}.quads-select-style-overwrite select{width:150px}.quads-size-input{position:relative;top:-1px;width:110%;border:none;box-shadow:none;background:0 0;-webkit-appearance:none;font-family:'Open Sans',arial,sans-serif;color:#555;font-size:12px}.quads-pro-overlay{height:200px}.quads-license-error-notice,.quads-license-expires-soon-notice{background-color:#fff;padding:10px;overflow:auto;-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,.1);box-shadow:0 1px 1px 0 rgba(0,0,0,.1);border:1px solid #ECECEC;border-radius:3px}.quads-license-error-notice a{color:#0097df;text-decoration:underline}.quads-license-error-notice{border-left:4px solid #dd3d36}.quads-license-expiration-date-notice,.quads-license-lifetime-notice,.quads-license-null{padding:0}.quads-license-expiration-date-notice .quads-license-data p,.quads-license-lifetime-notice .quads-license-data p{color:#666;font-size:14px;font-style:italic;margin:4px 0 0}#quads_settingslicenses_header-nav{display:none}#quads_settingslicenses_header{max-width:640px}#quads_settingslicenses_header .quads-row.th{min-width:250px}.quads-notice{background:#fff;border-left:4px solid #46b450;-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,.1);box-shadow:0 1px 1px 0 rgba(0,0,0,.1);margin:5px 15px 2px;padding:1px 12px}.quads_admin h2.nav-tab-wrapper{border:0}.quads_admin .nav-tab{border:0;text-transform:uppercase;color:#a1a1a1;font-weight:700}.quads-h1{margin-bottom:1.35rem;font-size:2.5em;line-height:3.68rem;letter-spacing:normal}.quads-h2{margin-top:0;margin-bottom:1.2rem;font-size:30px;line-height:2.5rem}.quads-heading-pro{color:#83c11f;font-weight:700}.quads-button.green{display:inline-block;background-color:#83c11f;padding:10px;min-width:170px;color:#fff;font-size:16px;text-decoration:none;text-align:center;margin-top:20px}#quads-add-ons .quads-footer{clear:both;margin-top:20px;font-style:italic}#quads-add-ons li{font-size:18px;line-height:29px;position:relative;padding-left:23px;list-style:none!important}#quads-add-ons li:before{width:1em;height:100%;background:url(data:image/svg+xml;charset=utf8,%3Csvg%20width%3D%221792%22%20height%3D%221792%22%20viewBox%3D%220%200%201792%201792%22%20xmlns%3D%22http%3A%2F%2Fwww%2Ew3%2Eorg%2F2000%2Fsvg%22%3E%3Cpath%20fill%3D%22%2377B227%22%20d%3D%22M1671%20566q0%2040%2D28%2068l%2D724%20724%2D136%20136q%2D28%2028%2D68%2028t%2D68%2D28l%2D136%2D136%2D362%2D362q%2D28%2D28%2D28%2D68t28%2D68l136%2D136q28%2D28%2068%2D28t68%2028l294%20295%20656%2D657q28%2D28%2068%2D28t68%2028l136%20136q28%2028%2028%2068z%22%2F%3E%3C%2Fsvg%3E) left .4em no-repeat;background-size:contain;content:"";position:absolute;top:0;left:0;color:#77b227}.adsense_admin_header{font-size:14px;font-weight:500}#quads-adsense-bg-div{position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.65);z-index:250000}#quads-adsense-container{text-align:center;width:480px;margin:85px auto 0;background-color:#fff;padding:2%;border-radius:2px}#quads-adsense-container h3{margin-top:0}#quads-adsense-container textarea,.quads-ad-toggle-container textarea{width:100%}.quads-ad-toggle-container input{margin-top:7px;margin-bottom:10px}.quads-adsense-code label,input{margin-right:2px}#quads_settings\5b ad2\5d \5b g_data_ad_client\5d{width:200px}.quads-ad-toggle-container label{display:inline-block;margin-right:2px;margin-top:-3px}.quads_adsense_code .quads-add-adsense{margin:20px 5px 20px 0}.quads-label-left{min-width:71px}#quads-label-Type{min-width:67px}.quads-medium-size{width:110px}#quads-msg{display:none;margin:5px;background-color:#c55c5c;color:#fff}.quads-loader,.quads-success-modal{display:block;position:fixed;top:45%;left:25%;width:200px;height:auto;padding:5px 20px;z-index:1002;overflow:auto}.quads-form-table{width:100%}.quads-left-box{width:45%;min-height:100px;float:left;line-height:35px;min-width:300px}@media screen and (max-width:700px){.adsense-size-title{margin-left:0}.quads-left-box{width:45%;min-height:100px;float:none;line-height:35px;min-width:300px}.quads-style img{max-width:50px}}.quads-general-helper,.quads-helper{background-color:#83c11f;width:15px;display:inline-block;top:4px;cursor:pointer}.adsense_admin_header ul li{margin-top:2px;margin-left:20px;list-style-type:square}.quads-helper{border-radius:50%;border:2px solid #fff;height:15px;position:relative;margin-top:-4px;margin-left:2px}.quads-general-helper:after,.quads-helper:after{height:20px;font-family:sans-serif;content:"?";font-size:11px;font-weight:700;left:4px;position:absolute;color:#fff}.quads-helper:after{margin-top:-10px}.quads-general-helper:after{margin-top:-2px}.quads-general-helper{border-radius:50%;border:2px solid #fff;height:15px;position:relative;margin-top:-4px;margin-left:2px}.quads-message{padding:10px;border:1px solid #FBFBFB;border-radius:2px;background-color:#F8F8F8;position:absolute;max-width:500px;z-index:9999;display:none;box-shadow:0 0 5px rgba(0,0,0,.2);font-weight:400;line-height:20px;text-transform:none;font-size:14px}#quads-pro-hover{background-color:#83c11f;padding:20px;min-width:150px;color:#fff;display:block;position:relative;margin-top:-100px;margin-left:50%}#quads-pro-hover-background{width:100%;height:100%;background:rgba(0,0,0,.6)}#quads-open-toggle{clear:both;float:left;margin-top:10px}#quads_settingsadsense_header input[type=number].small-text{width:55px}.quads_adsense_code input.quads-bggrey{background-color:#f5f5f5;color:#939393}.quads-amp-code{color:#939393;height:130px}.quads-chosen-select .chosen-choices li.search-field input{min-height:25px}#quads-validate{margin-top:-20px;display:block;margin-left:2px;margin-bottom:20px;font-weight:700}
assets/css/quads-plugins-admin.min.css CHANGED
@@ -32,6 +32,7 @@
32
  margin:5px;
33
  }
34
 
 
35
  @media screen and (max-width:400px){
36
  #quick-adsense-reloaded-feedback-content {
37
  padding:0px;
32
  margin:5px;
33
  }
34
 
35
+
36
  @media screen and (max-width:400px){
37
  #quick-adsense-reloaded-feedback-content {
38
  padding:0px;
assets/js/ads.js ADDED
@@ -0,0 +1 @@
 
1
+ var wpquads_adblocker_check = true;
assets/js/quads-admin.js CHANGED
@@ -1,7 +1,40 @@
1
  var strict;
2
 
 
3
  jQuery(document).ready(function ($) {
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  // Activate chosen select boxes
6
  $(".quads-chosen-select").chosen({
7
  inherit_select_classes: true
@@ -34,12 +67,15 @@ jQuery(document).ready(function ($) {
34
  // });
35
 
36
  /**
37
- * Toggle Button Open All Ads
38
  */
39
  $('#quads-open-toggle').click(function(){
40
- if ($('#quads-open-toggle').html() == 'Open All Ads' ){
 
 
 
41
  $('.quads-ad-toggle-container').show();
42
- $('#quads-open-toggle').html('Close Tabs');
43
  }else{
44
  $('.quads-ad-toggle-container').hide();
45
  $('#quads-open-toggle').html('Open All Ads');
@@ -386,7 +422,7 @@ jQuery(document).ready(function ($) {
386
  });
387
 
388
 
389
- // Toggle between AdSense or Plain Text
390
  $(document).on('click', '.quads_adsense_type', function () {
391
 
392
  var parentContainerID = $(this).parents('.quads-ad-toggle-container').attr('id');
@@ -394,11 +430,15 @@ jQuery(document).ready(function ($) {
394
  if ($(this).val() === 'adsense') {
395
  $('#' + parentContainerID).children('textarea').hide();
396
  $('#' + parentContainerID).find('div.quads_adsense_code').show();
 
 
397
 
398
  }
399
  if ($(this).val() === 'plain_text') {
400
  $('#' + parentContainerID).children('textarea').show();
401
  $('#' + parentContainerID).children('div.quads_adsense_code').hide();
 
 
402
  }
403
  });
404
 
1
  var strict;
2
 
3
+
4
  jQuery(document).ready(function ($) {
5
 
6
+ // Inactive select fields are greyed out
7
+ $('.quads-assign').each(function(e){
8
+ if (!$(this).prop('checked')){
9
+ $(this).next('select').css('background-color', 'whitesmoke').css('color', '#939393');
10
+ }else {
11
+ $(this).next('select').css('background-color', 'white').css('color', 'black');
12
+ }
13
+ });
14
+
15
+ $('.quads-assign').click(function(){
16
+ if (!$(this).prop('checked')){
17
+ $(this).next('select').css('background-color', 'whitesmoke').css('color', '#939393');
18
+ } else {
19
+ $(this).next('select').css('background-color', 'white').css('color', 'black');
20
+ }
21
+ });
22
+
23
+ // Check if submit button is visible than stick it to the bottom of the page
24
+ $(window).scroll(function() {
25
+ var elem = '#quads_tab_container .submit';
26
+ var top_of_element = $(elem).offset().top;
27
+ var bottom_of_element = $(elem).offset().top + $(elem).outerHeight(false);
28
+ var bottom_of_screen = $(window).scrollTop() + $(window).height();
29
+ if (bottom_of_screen > top_of_element){
30
+ // The element is visible, do something
31
+ $('#quads-submit-button').css('position', 'relative').css('bottom', '20px');
32
+ } else {
33
+ // The element is NOT visible, do something else
34
+ $('#quads-submit-button').css('position', 'fixed').css('bottom', '20px');
35
+ }
36
+ });
37
+
38
  // Activate chosen select boxes
39
  $(".quads-chosen-select").chosen({
40
  inherit_select_classes: true
67
  // });
68
 
69
  /**
70
+ * Toggle Button | Open All Ads
71
  */
72
  $('#quads-open-toggle').click(function(){
73
+ console.log($('#quads-open-toggle').html());
74
+
75
+
76
+ if ($('#quads-open-toggle').text() === 'Open All Ads' ){
77
  $('.quads-ad-toggle-container').show();
78
+ $('#quads-open-toggle').html('Close Ads');
79
  }else{
80
  $('.quads-ad-toggle-container').hide();
81
  $('#quads-open-toggle').html('Open All Ads');
422
  });
423
 
424
 
425
+ // Toggle between AdSense or Plain Text option
426
  $(document).on('click', '.quads_adsense_type', function () {
427
 
428
  var parentContainerID = $(this).parents('.quads-ad-toggle-container').attr('id');
430
  if ($(this).val() === 'adsense') {
431
  $('#' + parentContainerID).children('textarea').hide();
432
  $('#' + parentContainerID).find('div.quads_adsense_code').show();
433
+ $('#' + parentContainerID).find('.quads-sizes').show();
434
+ $('#' + parentContainerID).find('.quads-sizes-container').css('clear','');
435
 
436
  }
437
  if ($(this).val() === 'plain_text') {
438
  $('#' + parentContainerID).children('textarea').show();
439
  $('#' + parentContainerID).children('div.quads_adsense_code').hide();
440
+ $('#' + parentContainerID).find('.quads-sizes').hide();
441
+ $('#' + parentContainerID).find('.quads-sizes-container').css('clear','both');
442
  }
443
  });
444
 
assets/js/quads-admin.min.js CHANGED
@@ -1,7 +1,40 @@
1
  var strict;
2
 
 
3
  jQuery(document).ready(function ($) {
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  // Activate chosen select boxes
6
  $(".quads-chosen-select").chosen({
7
  inherit_select_classes: true
@@ -34,12 +67,15 @@ jQuery(document).ready(function ($) {
34
  // });
35
 
36
  /**
37
- * Toggle Button Open All Ads
38
  */
39
  $('#quads-open-toggle').click(function(){
40
- if ($('#quads-open-toggle').html() == 'Open All Ads' ){
 
 
 
41
  $('.quads-ad-toggle-container').show();
42
- $('#quads-open-toggle').html('Close Tabs');
43
  }else{
44
  $('.quads-ad-toggle-container').hide();
45
  $('#quads-open-toggle').html('Open All Ads');
@@ -386,7 +422,7 @@ jQuery(document).ready(function ($) {
386
  });
387
 
388
 
389
- // Toggle between AdSense or Plain Text
390
  $(document).on('click', '.quads_adsense_type', function () {
391
 
392
  var parentContainerID = $(this).parents('.quads-ad-toggle-container').attr('id');
@@ -394,11 +430,15 @@ jQuery(document).ready(function ($) {
394
  if ($(this).val() === 'adsense') {
395
  $('#' + parentContainerID).children('textarea').hide();
396
  $('#' + parentContainerID).find('div.quads_adsense_code').show();
 
 
397
 
398
  }
399
  if ($(this).val() === 'plain_text') {
400
  $('#' + parentContainerID).children('textarea').show();
401
  $('#' + parentContainerID).children('div.quads_adsense_code').hide();
 
 
402
  }
403
  });
404
 
1
  var strict;
2
 
3
+
4
  jQuery(document).ready(function ($) {
5
 
6
+ // Inactive select fields are greyed out
7
+ $('.quads-assign').each(function(e){
8
+ if (!$(this).prop('checked')){
9
+ $(this).next('select').css('background-color', 'whitesmoke').css('color', '#939393');
10
+ }else {
11
+ $(this).next('select').css('background-color', 'white').css('color', 'black');
12
+ }
13
+ });
14
+
15
+ $('.quads-assign').click(function(){
16
+ if (!$(this).prop('checked')){
17
+ $(this).next('select').css('background-color', 'whitesmoke').css('color', '#939393');
18
+ } else {
19
+ $(this).next('select').css('background-color', 'white').css('color', 'black');
20
+ }
21
+ });
22
+
23
+ // Check if submit button is visible than stick it to the bottom of the page
24
+ $(window).scroll(function() {
25
+ var elem = '#quads_tab_container .submit';
26
+ var top_of_element = $(elem).offset().top;
27
+ var bottom_of_element = $(elem).offset().top + $(elem).outerHeight(false);
28
+ var bottom_of_screen = $(window).scrollTop() + $(window).height();
29
+ if (bottom_of_screen > top_of_element){
30
+ // The element is visible, do something
31
+ $('#quads-submit-button').css('position', 'relative').css('bottom', '20px');
32
+ } else {
33
+ // The element is NOT visible, do something else
34
+ $('#quads-submit-button').css('position', 'fixed').css('bottom', '20px');
35
+ }
36
+ });
37
+
38
  // Activate chosen select boxes
39
  $(".quads-chosen-select").chosen({
40
  inherit_select_classes: true
67
  // });
68
 
69
  /**
70
+ * Toggle Button | Open All Ads
71
  */
72
  $('#quads-open-toggle').click(function(){
73
+ console.log($('#quads-open-toggle').html());
74
+
75
+
76
+ if ($('#quads-open-toggle').text() === 'Open All Ads' ){
77
  $('.quads-ad-toggle-container').show();
78
+ $('#quads-open-toggle').html('Close Ads');
79
  }else{
80
  $('.quads-ad-toggle-container').hide();
81
  $('#quads-open-toggle').html('Open All Ads');
422
  });
423
 
424
 
425
+ // Toggle between AdSense or Plain Text option
426
  $(document).on('click', '.quads_adsense_type', function () {
427
 
428
  var parentContainerID = $(this).parents('.quads-ad-toggle-container').attr('id');
430
  if ($(this).val() === 'adsense') {
431
  $('#' + parentContainerID).children('textarea').hide();
432
  $('#' + parentContainerID).find('div.quads_adsense_code').show();
433
+ $('#' + parentContainerID).find('.quads-sizes').show();
434
+ $('#' + parentContainerID).find('.quads-sizes-container').css('clear','');
435
 
436
  }
437
  if ($(this).val() === 'plain_text') {
438
  $('#' + parentContainerID).children('textarea').show();
439
  $('#' + parentContainerID).children('div.quads_adsense_code').hide();
440
+ $('#' + parentContainerID).find('.quads-sizes').hide();
441
+ $('#' + parentContainerID).find('.quads-sizes-container').css('clear','both');
442
  }
443
  });
444
 
includes/admin/admin-actions.php CHANGED
@@ -30,3 +30,12 @@ function quads_process_actions() {
30
  }
31
  add_action( 'admin_init', 'quads_process_actions' );
32
 
 
 
 
 
 
 
 
 
 
30
  }
31
  add_action( 'admin_init', 'quads_process_actions' );
32
 
33
+ /**
34
+ * Update option quads_show_theme_notice
35
+ * "no" means no further upgrade notices are shown
36
+ */
37
+ function quads_close_upgrade_notice(){
38
+ update_option ('quads_show_theme_notice', 'no');
39
+ }
40
+ add_action('quads_close_upgrade_notice', 'quads_close_upgrade_notice');
41
+
includes/admin/admin-notices.php CHANGED
@@ -29,6 +29,18 @@ function quads_admin_messages() {
29
  quads_theme_notice();
30
 
31
  quads_update_notice();
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
  //quads_plugin_deactivated_notice();
34
 
@@ -191,13 +203,13 @@ function quads_theme_notice(){
191
 
192
  $show_notice = get_option('quads_show_theme_notice');
193
 
194
- if( false !== $show_notice && 'no' !== $show_notice ) {
195
- $message = __( '<strong>Extend the <strong>' . quads_is_commercial_theme(). '</strong> theme with <strong>WP QUADS PRO!</strong> 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></strong>', 'quick-adsense-reloaded' );
196
  ?>
197
- <div class="updated notice is-dismissible" style="border-left: 4px solid #ffba00;">
198
  <p><?php echo $message; ?></p>
199
  </div> <?php
200
- update_option ('quads_show_theme_notice', 'no');
201
  }
202
  }
203
 
@@ -224,7 +236,7 @@ function quads_update_notice() {
224
  //update_option ('quads_show_update_notice', 'no');
225
  } else
226
  if( !quads_is_advanced() ) {
227
- $message = sprintf( __( '<strong>WP QUADS ' . QUADS_VERSION . ': <strong> Install <a href="%1s" target="_blank">WP QUADS PRO</a> to get custom post type support from <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' );
228
  $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>';
229
  ?>
230
  <div class="updated notice" style="border-left: 4px solid #ffba00;">
@@ -233,8 +245,61 @@ function quads_update_notice() {
233
  <?php
234
  }
235
  }
236
-
 
 
237
  function quads_hide_notice(){
238
  update_option ('quads_show_update_notice', 'no');
239
  }
240
  add_action('quads_hide_update_notice', 'quads_hide_notice', 10);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  quads_theme_notice();
30
 
31
  quads_update_notice();
32
+
33
+ if (!quads_is_any_ad_activated() && quads_is_admin_page() ){
34
+ echo '<div class="notice notice-warning">'.sprintf(__('<strong>No ads are activated!</strong> You need to assign at least 1 ad to an ad spot. Fix this in <a href="%s">General Settings</a>! Alternatively you need to use a shortcode in your posts or no ads are shown at all.', 'quick-adsense-reloaded'), admin_url().'admin.php?page=quads-settings&quads-message=settings-imported&tab=general#quads_settingsgeneral_header').'</div>';
35
+ }
36
+
37
+ if (!quads_is_post_type_activated() && quads_is_admin_page() ){
38
+ echo '<div class="notice notice-warning">'.sprintf(__('<strong>No ads are shown - No post types selected</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-message=settings-imported&tab=general#quads_settingsgeneral_header').'</div>';
39
+ }
40
+
41
+ if (isset($_GET['quads-action']) && $_GET['quads-action'] === 'validate' && quads_is_admin_page() && quads_is_any_ad_activated() && quads_is_post_type_activated() ){
42
+ 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>';
43
+ }
44
 
45
  //quads_plugin_deactivated_notice();
46
 
203
 
204
  $show_notice = get_option('quads_show_theme_notice');
205
 
206
+ if( false !== $show_notice && 'no' !== $show_notice && quads_is_commercial_theme() ) {
207
+ $message = __( '<strong>Extend the <strong>' . 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></strong> <p> <a href="'.admin_url().'admin.php?page=quads-settings&quads-action=close_upgrade_notice" class="button">Close Notice</a>', 'quick-adsense-reloaded' );
208
  ?>
209
+ <div class="updated notice" style="border-left: 4px solid #ffba00;">
210
  <p><?php echo $message; ?></p>
211
  </div> <?php
212
+ //update_option ('quads_show_theme_notice', 'no');
213
  }
214
  }
215
 
236
  //update_option ('quads_show_update_notice', 'no');
237
  } else
238
  if( !quads_is_advanced() ) {
239
+ $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' );
240
  $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>';
241
  ?>
242
  <div class="updated notice" style="border-left: 4px solid #ffba00;">
245
  <?php
246
  }
247
  }
248
+ /**
249
+ * Hide Notice and update db option quads_hide_notice
250
+ */
251
  function quads_hide_notice(){
252
  update_option ('quads_show_update_notice', 'no');
253
  }
254
  add_action('quads_hide_update_notice', 'quads_hide_notice', 10);
255
+
256
+ /**
257
+ * Check if any ad is activated and assigned in general settings
258
+ *
259
+ * @global array $quads_options
260
+ * @return boolean
261
+ */
262
+ function quads_is_any_ad_activated() {
263
+ global $quads_options;
264
+
265
+ // Check if custom positions location_settings is empty or does not exists
266
+ $check = array();
267
+ if( isset( $quads_options['location_settings'] ) ) {
268
+ foreach ( $quads_options['location_settings'] as $location_array ) {
269
+ if( isset( $location_array['status'] ) ) {
270
+ $check[] = $location_array['status'];
271
+ }
272
+ }
273
+ }
274
+
275
+ //wp_die(print_r($check));
276
+
277
+ if( count( $check ) === 0 &&
278
+ !isset( $quads_options['pos1']['BegnAds'] ) &&
279
+ !isset( $quads_options['pos2']['MiddAds'] ) &&
280
+ !isset( $quads_options['pos3']['EndiAds'] ) &&
281
+ !isset( $quads_options['pos4']['MoreAds'] ) &&
282
+ !isset( $quads_options['pos5']['LapaAds'] ) &&
283
+ !isset( $quads_options['pos6']['Para1Ads'] ) &&
284
+ !isset( $quads_options['pos7']['Para2Ads'] ) &&
285
+ !isset( $quads_options['pos8']['Para3Ads'] ) &&
286
+ !isset( $quads_options['pos9']['Img1Ads'] ) ) {
287
+ return false;
288
+ }
289
+ return true;
290
+ }
291
+
292
+ /**
293
+ * Check if any post type is enabled
294
+ *
295
+ * @global array $quads_options
296
+ * @return boolean
297
+ */
298
+ function quads_is_post_type_activated(){
299
+ global $quads_options;
300
+
301
+ if (empty($quads_options['post_types'])){
302
+ return false;
303
+ }
304
+ return true;
305
+ }
includes/admin/settings/display-settings.php CHANGED
@@ -109,18 +109,18 @@ function quads_do_settings_fields($page, $section) {
109
  }
110
 
111
  if (!empty($field['args']['label_for']) && !quads_is_excluded_title( $field['args']['id'] )){
112
- echo '<tr class="row">';
113
- echo '<td class="row th">';
114
  echo '<label for="' . esc_attr($field['args']['label_for']) . '">' . $field['title'] . '</label>';
115
  echo '</td></tr>';
116
  }else if (!empty($field['title']) && !quads_is_excluded_title( $field['args']['id'] ) && !empty($field['args']['helper-desc'])){
117
- echo '<tr class="row">';
118
- echo '<td class="row th">';
119
  echo '<div class="col-title">' . $field['title'] . '<a class="quads-general-helper" href="#"></a><div class="quads-message">' . $field['args']['helper-desc']. '</div></div>';
120
  echo '</td></tr>';
121
  }else if (!empty($field['title']) && !quads_is_excluded_title( $field['args']['id'] ) ){
122
- echo '<tr class="row">';
123
- echo '<td class="row th">';
124
  echo '<div class="col-title">' . $field['title'] . '</div>';
125
  echo '</td></tr>';
126
  }
@@ -223,6 +223,7 @@ function quads_options_page() {
223
  <?php quads_get_tab_header( 'quads_settings_' . $active_tab, 'quads_settings_' . $active_tab ); ?>
224
  <div class="quads-panel-container"> <!-- new //-->
225
  <form method="post" action="options.php" id="quads_settings">
 
226
  <?php
227
  settings_fields( 'quads_settings' );
228
  quads_do_settings_fields( 'quads_settings_' . $active_tab, 'quads_settings_' . $active_tab );
@@ -233,8 +234,12 @@ function quads_options_page() {
233
  <?php
234
  // do not show save button on add-on page
235
  if ($active_tab !== 'addons'){
236
- submit_button();
237
- }
 
 
 
 
238
  ?>
239
  </form>
240
  <?php
@@ -242,6 +247,9 @@ function quads_options_page() {
242
  'https://wordpress.org/support/plugin/quick-adsense-reloaded/reviews/#new-post',
243
  'http://wpquads.com/support/'
244
  );
 
 
 
245
  ?>
246
  </div> <!-- new //-->
247
  <?php quads_get_advertising(); ?>
109
  }
110
 
111
  if (!empty($field['args']['label_for']) && !quads_is_excluded_title( $field['args']['id'] )){
112
+ echo '<tr class="quads-row">';
113
+ echo '<td class="quads-row th">';
114
  echo '<label for="' . esc_attr($field['args']['label_for']) . '">' . $field['title'] . '</label>';
115
  echo '</td></tr>';
116
  }else if (!empty($field['title']) && !quads_is_excluded_title( $field['args']['id'] ) && !empty($field['args']['helper-desc'])){
117
+ echo '<tr class="quads-row">';
118
+ echo '<td class="quads-row th">';
119
  echo '<div class="col-title">' . $field['title'] . '<a class="quads-general-helper" href="#"></a><div class="quads-message">' . $field['args']['helper-desc']. '</div></div>';
120
  echo '</td></tr>';
121
  }else if (!empty($field['title']) && !quads_is_excluded_title( $field['args']['id'] ) ){
122
+ echo '<tr class="quads-row">';
123
+ echo '<td class="quads-row th">';
124
  echo '<div class="col-title">' . $field['title'] . '</div>';
125
  echo '</td></tr>';
126
  }
223
  <?php quads_get_tab_header( 'quads_settings_' . $active_tab, 'quads_settings_' . $active_tab ); ?>
224
  <div class="quads-panel-container"> <!-- new //-->
225
  <form method="post" action="options.php" id="quads_settings">
226
+
227
  <?php
228
  settings_fields( 'quads_settings' );
229
  quads_do_settings_fields( 'quads_settings_' . $active_tab, 'quads_settings_' . $active_tab );
234
  <?php
235
  // do not show save button on add-on page
236
  if ($active_tab !== 'addons'){
237
+ $other_attributes = array( 'id' => 'quads-submit-button' );
238
+ submit_button(null, 'primary', 'quads-save-settings' , true, $other_attributes );
239
+ ?>
240
+ <a href="<?php echo admin_url() . '/admin.php?page=quads-settings&quads-action=validate'; ?> " id="quads-validate"><?php _e('Validate Settings','quick-adsense-reloaded')?></a>
241
+ <?php
242
+ }
243
  ?>
244
  </form>
245
  <?php
247
  'https://wordpress.org/support/plugin/quick-adsense-reloaded/reviews/#new-post',
248
  'http://wpquads.com/support/'
249
  );
250
+ echo '<p>' . sprintf( __( '<strong>Ads are not showing? Read the <a href="%s" target="_blank">troubleshooting guide</a> to find out how to resolve this issue.', 'quick-adsense-reloaded' ),
251
+ 'http://wpquads.com/docs/adsense-ads-are-not-showing/?utm_source=plugin&utm_campaign=wpquads-settings&utm_medium=website&utm_term=bottomlink'
252
+ );
253
  ?>
254
  </div> <!-- new //-->
255
  <?php quads_get_advertising(); ?>
includes/admin/settings/register-settings.php CHANGED
@@ -124,7 +124,7 @@ function quads_get_registered_settings() {
124
  'general' => apply_filters( 'quads_settings_general', array(
125
  array(
126
  'id' => 'general_header',
127
- 'name' => '<strong>' . __( 'General Settings', 'quick-adsense-reloaded' ) . '</strong>',
128
  'desc' => __( '', 'quick-adsense-reloaded' ),
129
  'type' => 'header'
130
  ),
@@ -146,11 +146,21 @@ function quads_get_registered_settings() {
146
  8 => '8',
147
  9 => '9',
148
  10 => '10',
 
 
 
 
 
 
 
 
 
 
149
  ),
150
  ),
151
  array(
152
  'id' => 'ad_position',
153
- 'name' => __( 'Position', 'quick-adsense-reloaded' ),
154
  'desc' => __( 'Assign and activate ads on specific ad places', 'quick-adsense-reloaded' ),
155
  'type' => 'ad_position'
156
  ),
@@ -184,11 +194,12 @@ function quads_get_registered_settings() {
184
  'adsense_header' => array(
185
  'id' => 'adsense_header',
186
  'name' => '<strong>' . __( 'AdSense Code', 'quick-adsense-reloaded' ) . '</strong>',
187
- 'desc' => '<div class="adsense_admin_header">' . sprintf( __( 'Paste up to 10 Ad codes on post body and up to 10 Ad codes on sidebar widget. <a href="%s" target="_blank">Read here</a> to find out the most effective AdSense banner sizes. </div>'
188
  . '<ul style="margin-top:10px;">'
189
- . '<li> Use option <i>AdSense</i> for unmodified AdSense code</li>'
190
- . '<li> Use <i>Plain Text / HTML / JS</i> for modified AdSense code with custom css or for none AdSense ads</li></ul>', 'quick-adsense-reloaded' ), 'http://wpquads.com/effective-adsense-banner-size-formats/?utm_campaign=plugin&utm_source=general_tab&utm_medium=admin&utm_content=best_banner_sizes' )
191
  . '</ul>'
 
192
  . '<div id="quads-open-toggle" class="button">'.__('Open All Ads','quick-adsense-reloaded').'</div>',
193
  'type' => 'header'
194
  ),
@@ -1469,73 +1480,75 @@ function quads_ad_position_callback( $args ) {
1469
 
1470
 
1471
  // Pos 1
1472
- $html = $quads->html->checkbox( array('name' => 'quads_settings[pos1][BegnAds]', 'current' => !empty( $quads_options['pos1']['BegnAds'] ) ? $quads_options['pos1']['BegnAds'] : null, 'class' => 'quads-checkbox') );
1473
  $html .= ' ' . __( 'Assign', 'quick-adsense-reloaded' ) . ' ';
1474
- $html .= $quads->html->select( array('options' => quads_get_ads(), 'name' => 'quads_settings[pos1][BegnRnd]', 'selected' => !empty( $quads_options['pos1']['BegnRnd'] ) ? $quads_options['pos1']['BegnRnd'] : null, 'show_option_all' => false, 'show_option_none' => false) );
1475
  $html .= ' ' . __( 'to <strong>Beginning of Post</strong>', 'quick-adsense-reloaded' ) . '</br>';
1476
 
1477
  // Pos 2
1478
- $html .= $quads->html->checkbox( array('name' => 'quads_settings[pos2][MiddAds]', 'current' => !empty( $quads_options['pos2']['MiddAds'] ) ? $quads_options['pos2']['MiddAds'] : null, 'class' => 'quads-checkbox') );
1479
  $html .= ' ' . __( 'Assign', 'quick-adsense-reloaded' ) . ' ';
1480
- $html .= $quads->html->select( array('options' => quads_get_ads(), 'name' => 'quads_settings[pos2][MiddRnd]', 'selected' => !empty( $quads_options['pos2']['MiddRnd'] ) ? $quads_options['pos2']['MiddRnd'] : null, 'show_option_all' => false, 'show_option_none' => false) );
1481
  $html .= ' ' . __( 'to <strong>Middle of Post</strong>', 'quick-adsense-reloaded' ) . '</br>';
1482
 
1483
  // Pos 3
1484
- $html .= $quads->html->checkbox( array('name' => 'quads_settings[pos3][EndiAds]', 'current' => !empty( $quads_options['pos3']['EndiAds'] ) ? $quads_options['pos3']['EndiAds'] : null, 'class' => 'quads-checkbox') );
1485
  $html .= ' ' . __( 'Assign', 'quick-adsense-reloaded' ) . ' ';
1486
- $html .= $quads->html->select( array('options' => quads_get_ads(), 'name' => 'quads_settings[pos3][EndiRnd]', 'selected' => !empty( $quads_options['pos3']['EndiRnd'] ) ? $quads_options['pos3']['EndiRnd'] : null, 'show_option_all' => false, 'show_option_none' => false) );
1487
  $html .= ' ' . __( 'to <strong>End of Post</strong>', 'quick-adsense-reloaded' ) . '</br>';
1488
 
1489
  // Pos 4
1490
- $html .= $quads->html->checkbox( array('name' => 'quads_settings[pos4][MoreAds]', 'current' => !empty( $quads_options['pos4']['MoreAds'] ) ? $quads_options['pos4']['MoreAds'] : null, 'class' => 'quads-checkbox') );
1491
  $html .= ' ' . __( 'Assign', 'quick-adsense-reloaded' ) . ' ';
1492
- $html .= $quads->html->select( array('options' => quads_get_ads(), 'name' => 'quads_settings[pos4][MoreRnd]', 'selected' => !empty( $quads_options['pos4']['MoreRnd'] ) ? $quads_options['pos4']['MoreRnd'] : null, 'show_option_all' => false, 'show_option_none' => false) );
1493
  $html .= ' ' . __( 'right after <strong>the <span style="font-family:Courier New,Courier,Fixed;">&lt;!--more--&gt;</span> tag</strong>', 'quick-adsense-reloaded' ) . '</br>';
1494
 
1495
  // Pos 5
1496
- $html .= $quads->html->checkbox( array('name' => 'quads_settings[pos5][LapaAds]', 'current' => !empty( $quads_options['pos5']['LapaAds'] ) ? $quads_options['pos5']['LapaAds'] : null, 'class' => 'quads-checkbox') );
1497
  $html .= ' ' . __( 'Assign', 'quick-adsense-reloaded' ) . ' ';
1498
- $html .= $quads->html->select( array('options' => quads_get_ads(), 'name' => 'quads_settings[pos5][LapaRnd]', 'selected' => !empty( $quads_options['pos5']['LapaRnd'] ) ? $quads_options['pos5']['LapaRnd'] : null, 'show_option_all' => false, 'show_option_none' => false) );
1499
  $html .= ' ' . __( 'right before <strong>the last Paragraph</strong>', 'quick-adsense-reloaded' ) . ' </br>';
1500
 
1501
  // Pos 6
1502
- $html .= $quads->html->checkbox( array('name' => 'quads_settings[pos6][Par1Ads]', 'current' => !empty( $quads_options['pos6']['Par1Ads'] ) ? $quads_options['pos6']['Par1Ads'] : null, 'class' => 'quads-checkbox') );
1503
  $html .= ' ' . __( 'Assign', 'quick-adsense-reloaded' ) . ' ';
1504
- $html .= $quads->html->select( array('options' => quads_get_ads(), 'name' => 'quads_settings[pos6][Par1Rnd]', 'selected' => !empty( $quads_options['pos6']['Par1Rnd'] ) ? $quads_options['pos6']['Par1Rnd'] : null, 'show_option_all' => false, 'show_option_none' => false) );
1505
  $html .= ' ' . __( '<strong>After Paragraph</strong>', 'quick-adsense-reloaded' ) . ' ';
1506
- $html .= $quads->html->select( array('options' => quads_get_values(), 'name' => 'quads_settings[pos6][Par1Nup]', 'selected' => !empty( $quads_options['pos6']['Par1Nup'] ) ? $quads_options['pos6']['Par1Nup'] : null, 'show_option_all' => false, 'show_option_none' => false) );
1507
  $html .= ' ' . __( '→', 'quick-adsense-reloaded' ) . ' ';
1508
- $html .= $quads->html->checkbox( array('name' => 'quads_settings[pos6][Par1Con]', 'current' => !empty( $quads_options['pos6']['Par1Con'] ) ? $quads_options['pos6']['Par1Con'] : null, 'class' => 'quads-checkbox') );
1509
  $html .= ' ' . __( 'to <strong>End of Post</strong> if fewer paragraphs are found.', 'quick-adsense-reloaded' ) . ' </br>';
1510
 
1511
  // Pos 7
1512
- $html .= $quads->html->checkbox( array('name' => 'quads_settings[pos7][Par2Ads]', 'current' => !empty( $quads_options['pos7']['Par2Ads'] ) ? $quads_options['pos7']['Par2Ads'] : null, 'class' => 'quads-checkbox') );
1513
  $html .= ' ' . __( 'Assign', 'quick-adsense-reloaded' ) . ' ';
1514
- $html .= $quads->html->select( array('options' => quads_get_ads(), 'name' => 'quads_settings[pos7][Par2Rnd]', 'selected' => !empty( $quads_options['pos7']['Par2Rnd'] ) ? $quads_options['pos7']['Par2Rnd'] : null, 'show_option_all' => false, 'show_option_none' => false) );
1515
  $html .= ' ' . __( '<strong>After Paragraph</strong>', 'quick-adsense-reloaded' ) . ' ';
1516
- $html .= $quads->html->select( array('options' => quads_get_values(), 'name' => 'quads_settings[pos7][Par2Nup]', 'selected' => !empty( $quads_options['pos7']['Par2Nup'] ) ? $quads_options['pos7']['Par2Nup'] : null, 'show_option_all' => false, 'show_option_none' => false) );
1517
  $html .= ' ' . __( '→', 'quick-adsense-reloaded' ) . ' ';
1518
- $html .= $quads->html->checkbox( array('name' => 'quads_settings[pos7][Par2Con]', 'current' => !empty( $quads_options['pos7']['Par2Con'] ) ? $quads_options['pos7']['Par2Con'] : null, 'class' => 'quads-checkbox') );
1519
  $html .= ' ' . __( 'to <strong>End of Post</strong> if fewer paragraphs are found.', 'quick-adsense-reloaded' ) . ' </br>';
1520
 
1521
  // Pos 8
1522
- $html .= $quads->html->checkbox( array('name' => 'quads_settings[pos8][Par3Ads]', 'current' => !empty( $quads_options['pos8']['Par3Ads'] ) ? $quads_options['pos8']['Par3Ads'] : null, 'class' => 'quads-checkbox') );
1523
  $html .= ' ' . __( 'Assign', 'quick-adsense-reloaded' ) . ' ';
1524
- $html .= $quads->html->select( array('options' => quads_get_ads(), 'name' => 'quads_settings[pos8][Par3Rnd]', 'selected' => !empty( $quads_options['pos8']['Par3Rnd'] ) ? $quads_options['pos8']['Par3Rnd'] : null, 'show_option_all' => false, 'show_option_none' => false) );
1525
  $html .= ' ' . __( '<strong>After Paragraph</strong>', 'quick-adsense-reloaded' ) . ' ';
1526
- $html .= $quads->html->select( array('options' => quads_get_values(), 'name' => 'quads_settings[pos8][Par3Nup]', 'selected' => !empty( $quads_options['pos8']['Par3Nup'] ) ? $quads_options['pos8']['Par3Nup'] : null, 'show_option_all' => false, 'show_option_none' => false) );
1527
  $html .= ' ' . __( '→', 'quick-adsense-reloaded' ) . ' ';
1528
- $html .= $quads->html->checkbox( array('name' => 'quads_settings[pos8][Par3Con]', 'current' => !empty( $quads_options['pos8']['Par3Con'] ) ? $quads_options['pos8']['Par3Con'] : null, 'class' => 'quads-checkbox') );
1529
  $html .= ' ' . __( 'to <strong>End of Post</strong> if fewer paragraphs are found.', 'quick-adsense-reloaded' ) . ' </br>';
1530
 
 
 
1531
  // Pos 9
1532
- $html .= $quads->html->checkbox( array('name' => 'quads_settings[pos9][Img1Ads]', 'current' => !empty( $quads_options['pos9']['Img1Ads'] ) ? $quads_options['pos9']['Img1Ads'] : null, 'class' => 'quads-checkbox') );
1533
  $html .= ' ' . __( 'Assign', 'quick-adsense-reloaded' ) . ' ';
1534
  $html .= $quads->html->select( array('options' => quads_get_ads(), 'name' => 'quads_settings[pos9][Img1Rnd]', 'selected' => !empty( $quads_options['pos9']['Img1Rnd'] ) ? $quads_options['pos9']['Img1Rnd'] : null, 'show_option_all' => false, 'show_option_none' => false) );
1535
  $html .= ' ' . __( '<strong>After Image</strong>', 'quick-adsense-reloaded' ) . ' ';
1536
- $html .= $quads->html->select( array('options' => quads_get_values(), 'name' => 'quads_settings[pos9][Img1Nup]', 'selected' => !empty( $quads_options['pos9']['Img1Nup'] ) ? $quads_options['pos9']['Img1Nup'] : null, 'show_option_all' => false, 'show_option_none' => false) );
1537
  $html .= ' ' . __( '→', 'quick-adsense-reloaded' ) . ' ';
1538
- $html .= $quads->html->checkbox( array('name' => 'quads_settings[pos9][Img1Con]', 'current' => !empty( $quads_options['pos9']['Img1Con'] ) ? $quads_options['pos9']['Img1Con'] : null, 'class' => 'quads-checkbox') );
1539
  $html .= ' ' . __( 'after <b>Image\'s outer</b><b><span style="font-family:Courier New,Courier,Fixed;"> &lt;div&gt; wp-caption</span></b> if any.', 'quick-adsense-reloaded' ) . ' </br>';
1540
 
1541
  echo apply_filters( 'quads_ad_position_callback', $html );
@@ -1567,46 +1580,6 @@ function quads_quicktags_callback( $args ) {
1567
  echo $html;
1568
  }
1569
 
1570
- /**
1571
- * This hook should be removed and the hook function should replace entire "quads_ad_position_callback" function.
1572
- */
1573
- add_filter( 'quads_ad_position_callback', 'quads_render_ad_locations' );
1574
-
1575
- /**
1576
- * Return ad locations HTML based on new API.
1577
- *
1578
- * @param $html
1579
- * @return string Locations HTML
1580
- */
1581
- function quads_render_ad_locations( $html ) {
1582
- global $quads_options, $_quads_registered_ad_locations, $quads;
1583
-
1584
- if( isset( $_quads_registered_ad_locations ) && is_array( $_quads_registered_ad_locations ) ) {
1585
- foreach ( $_quads_registered_ad_locations as $location => $location_args ) {
1586
-
1587
- $location_settings = quads_get_ad_location_settings( $location );
1588
-
1589
- $html .= $quads->html->checkbox( array(
1590
- 'name' => 'quads_settings[location_settings][' . $location . '][status]',
1591
- 'current' => !empty( $location_settings['status'] ) ? $location_settings['status'] : null,
1592
- 'class' => 'quads-checkbox'
1593
- ) );
1594
- $html .= ' ' . __( 'Assign', 'quick-adsense-reloaded' ) . ' ';
1595
-
1596
- $html .= $quads->html->select( array(
1597
- 'options' => quads_get_ads(),
1598
- 'name' => 'quads_settings[location_settings][' . $location . '][ad]',
1599
- 'selected' => !empty( $location_settings['ad'] ) ? $location_settings['ad'] : null,
1600
- 'show_option_all' => false,
1601
- 'show_option_none' => false
1602
- ) );
1603
- $html .= ' ' . $location_args['description'] . '</br>';
1604
- }
1605
- }
1606
-
1607
- return $html;
1608
- }
1609
-
1610
  /**
1611
  * AdSense Code Callback
1612
  *
@@ -1661,7 +1634,7 @@ function quads_adsense_code_callback( $args ) {
1661
  <textarea style="vertical-align:top;margin-right:20px;" class="large-text quads-textarea" cols="50" rows="10" id="quads_settings[<?php echo $id; ?>][code]" name="quads_settings[<?php echo $id; ?>][code]"><?php echo esc_textarea( stripslashes( $code ) ); ?></textarea><label for="quads_settings[ <?php echo $id; ?> ][code]"> <?php echo $args['desc']; ?></label>
1662
  <br>
1663
  <div class="quads_adsense_code">
1664
- <input type="button" style="vertical-align:inherit;" class="button button-primary quads-add-adsense" value="Copy / Paste AdSense Code"> <span>or add Ad Slot ID & Publisher ID manually below</span>
1665
  <br />
1666
  <?php //echo __('Generate Ad Slot & Publisher ID automatically from your adsense code', 'quick-adsense-reloaded')?>
1667
  <label class="quads-label-left" for="quads_settings[<?php echo $id; ?>][g_data_ad_slot]">Ad Slot ID </label><input type="text" class="quads-medium-size quads-bggrey" id="quads_settings[<?php echo $id; ?>][g_data_ad_slot]" name="quads_settings[<?php echo $id; ?>][g_data_ad_slot]" value="<?php echo $g_data_ad_slot; ?>">
124
  'general' => apply_filters( 'quads_settings_general', array(
125
  array(
126
  'id' => 'general_header',
127
+ 'name' => '<strong>' . __( 'General & Position', 'quick-adsense-reloaded' ) . '</strong>',
128
  'desc' => __( '', 'quick-adsense-reloaded' ),
129
  'type' => 'header'
130
  ),
146
  8 => '8',
147
  9 => '9',
148
  10 => '10',
149
+ 11 => '11',
150
+ 12 => '12',
151
+ 13 => '13',
152
+ 14 => '14',
153
+ 15 => '15',
154
+ 16 => '16',
155
+ 17 => '17',
156
+ 18 => '18',
157
+ 19 => '19',
158
+ 20 => '20',
159
  ),
160
  ),
161
  array(
162
  'id' => 'ad_position',
163
+ 'name' => __( 'Position - Default Ads', 'quick-adsense-reloaded' ),
164
  'desc' => __( 'Assign and activate ads on specific ad places', 'quick-adsense-reloaded' ),
165
  'type' => 'ad_position'
166
  ),
194
  'adsense_header' => array(
195
  'id' => 'adsense_header',
196
  'name' => '<strong>' . __( 'AdSense Code', 'quick-adsense-reloaded' ) . '</strong>',
197
+ 'desc' => '<div class="adsense_admin_header">' . sprintf( __( 'Paste up to 10 Ad codes on post body and up to 10 Ad codes on sidebar widget.<br><a href="%s" target="_blank">Read here</a> to find out the most effective AdSense banner sizes. </div>'
198
  . '<ul style="margin-top:10px;">'
199
+ . '<li>- Use option <i>AdSense</i> for unmodified AdSense code</li>'
200
+ . '<li>- Use <i>Plain Text / HTML / JS</i> for modified AdSense code with custom css or for none AdSense ads</li></ul>', 'quick-adsense-reloaded' ), 'http://wpquads.com/effective-adsense-banner-size-formats/?utm_campaign=plugin&utm_source=general_tab&utm_medium=admin&utm_content=best_banner_sizes' )
201
  . '</ul>'
202
+ . '<div style="clear:both;">' . sprintf( __( '<strong>Ads are not showing? Read the <a href="%s" target="_blank">troubleshooting guide</a> to find out how to resolve this issue.', 'quick-adsense-reloaded' ),'http://wpquads.com/docs/adsense-ads-are-not-showing/?utm_source=plugin&utm_campaign=wpquads-settings&utm_medium=website&utm_term=toplink') . '</div>'
203
  . '<div id="quads-open-toggle" class="button">'.__('Open All Ads','quick-adsense-reloaded').'</div>',
204
  'type' => 'header'
205
  ),
1480
 
1481
 
1482
  // Pos 1
1483
+ $html = $quads->html->checkbox( array('name' => 'quads_settings[pos1][BegnAds]','current' => !empty( $quads_options['pos1']['BegnAds'] ) ? $quads_options['pos1']['BegnAds'] : null, 'class' => 'quads-checkbox quads-assign') );
1484
  $html .= ' ' . __( 'Assign', 'quick-adsense-reloaded' ) . ' ';
1485
+ $html .= $quads->html->select( array('options' => quads_get_ads(), 'id' => 'quads_settings[pos1][BegnRnd]', 'name' => 'quads_settings[pos1][BegnRnd]', 'selected' => !empty( $quads_options['pos1']['BegnRnd'] ) ? $quads_options['pos1']['BegnRnd'] : null, 'show_option_all' => false, 'show_option_none' => false) );
1486
  $html .= ' ' . __( 'to <strong>Beginning of Post</strong>', 'quick-adsense-reloaded' ) . '</br>';
1487
 
1488
  // Pos 2
1489
+ $html .= $quads->html->checkbox( array('name' => 'quads_settings[pos2][MiddAds]', 'current' => !empty( $quads_options['pos2']['MiddAds'] ) ? $quads_options['pos2']['MiddAds'] : null, 'class' => 'quads-checkbox quads-assign') );
1490
  $html .= ' ' . __( 'Assign', 'quick-adsense-reloaded' ) . ' ';
1491
+ $html .= $quads->html->select( array('options' => quads_get_ads(), 'id' => 'quads_settings[pos2][MiddRnd]', 'name' => 'quads_settings[pos2][MiddRnd]', 'selected' => !empty( $quads_options['pos2']['MiddRnd'] ) ? $quads_options['pos2']['MiddRnd'] : null, 'show_option_all' => false, 'show_option_none' => false) );
1492
  $html .= ' ' . __( 'to <strong>Middle of Post</strong>', 'quick-adsense-reloaded' ) . '</br>';
1493
 
1494
  // Pos 3
1495
+ $html .= $quads->html->checkbox( array('name' => 'quads_settings[pos3][EndiAds]', 'current' => !empty( $quads_options['pos3']['EndiAds'] ) ? $quads_options['pos3']['EndiAds'] : null, 'class' => 'quads-checkbox quads-assign') );
1496
  $html .= ' ' . __( 'Assign', 'quick-adsense-reloaded' ) . ' ';
1497
+ $html .= $quads->html->select( array('options' => quads_get_ads(), 'id' => 'quads_settings[pos3][EndiRnd]', 'name' => 'quads_settings[pos3][EndiRnd]', 'selected' => !empty( $quads_options['pos3']['EndiRnd'] ) ? $quads_options['pos3']['EndiRnd'] : null, 'show_option_all' => false, 'show_option_none' => false) );
1498
  $html .= ' ' . __( 'to <strong>End of Post</strong>', 'quick-adsense-reloaded' ) . '</br>';
1499
 
1500
  // Pos 4
1501
+ $html .= $quads->html->checkbox( array('name' => 'quads_settings[pos4][MoreAds]', 'current' => !empty( $quads_options['pos4']['MoreAds'] ) ? $quads_options['pos4']['MoreAds'] : null, 'class' => 'quads-checkbox quads-assign') );
1502
  $html .= ' ' . __( 'Assign', 'quick-adsense-reloaded' ) . ' ';
1503
+ $html .= $quads->html->select( array('options' => quads_get_ads(), 'id' => 'quads_settings[pos4][MoreRnd]', 'name' => 'quads_settings[pos4][MoreRnd]', 'selected' => !empty( $quads_options['pos4']['MoreRnd'] ) ? $quads_options['pos4']['MoreRnd'] : null, 'show_option_all' => false, 'show_option_none' => false) );
1504
  $html .= ' ' . __( 'right after <strong>the <span style="font-family:Courier New,Courier,Fixed;">&lt;!--more--&gt;</span> tag</strong>', 'quick-adsense-reloaded' ) . '</br>';
1505
 
1506
  // Pos 5
1507
+ $html .= $quads->html->checkbox( array('name' => 'quads_settings[pos5][LapaAds]', 'current' => !empty( $quads_options['pos5']['LapaAds'] ) ? $quads_options['pos5']['LapaAds'] : null, 'class' => 'quads-checkbox quads-assign') );
1508
  $html .= ' ' . __( 'Assign', 'quick-adsense-reloaded' ) . ' ';
1509
+ $html .= $quads->html->select( array('options' => quads_get_ads(), 'id' => 'quads_settings[pos5][LapaRnd]', 'name' => 'quads_settings[pos5][LapaRnd]', 'selected' => !empty( $quads_options['pos5']['LapaRnd'] ) ? $quads_options['pos5']['LapaRnd'] : null, 'show_option_all' => false, 'show_option_none' => false) );
1510
  $html .= ' ' . __( 'right before <strong>the last Paragraph</strong>', 'quick-adsense-reloaded' ) . ' </br>';
1511
 
1512
  // Pos 6
1513
+ $html .= $quads->html->checkbox( array('name' => 'quads_settings[pos6][Par1Ads]', 'current' => !empty( $quads_options['pos6']['Par1Ads'] ) ? $quads_options['pos6']['Par1Ads'] : null, 'class' => 'quads-checkbox quads-assign') );
1514
  $html .= ' ' . __( 'Assign', 'quick-adsense-reloaded' ) . ' ';
1515
+ $html .= $quads->html->select( array('options' => quads_get_ads(),'id' => 'quads_settings[pos6][Par1Rnd]', 'name' => 'quads_settings[pos6][Par1Rnd]', 'selected' => !empty( $quads_options['pos6']['Par1Rnd'] ) ? $quads_options['pos6']['Par1Rnd'] : null, 'show_option_all' => false, 'show_option_none' => false) );
1516
  $html .= ' ' . __( '<strong>After Paragraph</strong>', 'quick-adsense-reloaded' ) . ' ';
1517
+ $html .= $quads->html->select( array('options' => quads_get_values(), 'class' => 'quads-paragraph', 'id' => 'quads_settings[pos6][Par1Nup]', 'name' => 'quads_settings[pos6][Par1Nup]', 'selected' => !empty( $quads_options['pos6']['Par1Nup'] ) ? $quads_options['pos6']['Par1Nup'] : null, 'show_option_all' => false, 'show_option_none' => false) );
1518
  $html .= ' ' . __( '→', 'quick-adsense-reloaded' ) . ' ';
1519
+ $html .= $quads->html->checkbox( array('name' => 'quads_settings[pos6][Par1Con]', 'current' => !empty( $quads_options['pos6']['Par1Con'] ) ? $quads_options['pos6']['Par1Con'] : null, 'class' => 'quads-checkbox quads-assign') );
1520
  $html .= ' ' . __( 'to <strong>End of Post</strong> if fewer paragraphs are found.', 'quick-adsense-reloaded' ) . ' </br>';
1521
 
1522
  // Pos 7
1523
+ $html .= $quads->html->checkbox( array('name' => 'quads_settings[pos7][Par2Ads]', 'current' => !empty( $quads_options['pos7']['Par2Ads'] ) ? $quads_options['pos7']['Par2Ads'] : null, 'class' => 'quads-checkbox quads-assign') );
1524
  $html .= ' ' . __( 'Assign', 'quick-adsense-reloaded' ) . ' ';
1525
+ $html .= $quads->html->select( array('options' => quads_get_ads(), 'id' => 'quads_settings[pos7][Par2Rnd]', 'name' => 'quads_settings[pos7][Par2Rnd]', 'selected' => !empty( $quads_options['pos7']['Par2Rnd'] ) ? $quads_options['pos7']['Par2Rnd'] : null, 'show_option_all' => false, 'show_option_none' => false) );
1526
  $html .= ' ' . __( '<strong>After Paragraph</strong>', 'quick-adsense-reloaded' ) . ' ';
1527
+ $html .= $quads->html->select( array('options' => quads_get_values(), 'id' => 'quads_settings[pos7][Par2Nup]', 'name' => 'quads_settings[pos7][Par2Nup]', 'selected' => !empty( $quads_options['pos7']['Par2Nup'] ) ? $quads_options['pos7']['Par2Nup'] : null, 'show_option_all' => false, 'show_option_none' => false) );
1528
  $html .= ' ' . __( '→', 'quick-adsense-reloaded' ) . ' ';
1529
+ $html .= $quads->html->checkbox( array('name' => 'quads_settings[pos7][Par2Con]', 'current' => !empty( $quads_options['pos7']['Par2Con'] ) ? $quads_options['pos7']['Par2Con'] : null, 'class' => 'quads-checkbox quads-assign') );
1530
  $html .= ' ' . __( 'to <strong>End of Post</strong> if fewer paragraphs are found.', 'quick-adsense-reloaded' ) . ' </br>';
1531
 
1532
  // Pos 8
1533
+ $html .= $quads->html->checkbox( array('name' => 'quads_settings[pos8][Par3Ads]', 'current' => !empty( $quads_options['pos8']['Par3Ads'] ) ? $quads_options['pos8']['Par3Ads'] : null, 'class' => 'quads-checkbox quads-assign') );
1534
  $html .= ' ' . __( 'Assign', 'quick-adsense-reloaded' ) . ' ';
1535
+ $html .= $quads->html->select( array('options' => quads_get_ads(), 'id' => 'quads_settings[pos8][Par3Rnd]', 'name' => 'quads_settings[pos8][Par3Rnd]', 'selected' => !empty( $quads_options['pos8']['Par3Rnd'] ) ? $quads_options['pos8']['Par3Rnd'] : null, 'show_option_all' => false, 'show_option_none' => false) );
1536
  $html .= ' ' . __( '<strong>After Paragraph</strong>', 'quick-adsense-reloaded' ) . ' ';
1537
+ $html .= $quads->html->select( array('options' => quads_get_values(), 'id' => 'quads_settings[pos8][Par3Nup]', 'name' => 'quads_settings[pos8][Par3Nup]', 'selected' => !empty( $quads_options['pos8']['Par3Nup'] ) ? $quads_options['pos8']['Par3Nup'] : null, 'show_option_all' => false, 'show_option_none' => false) );
1538
  $html .= ' ' . __( '→', 'quick-adsense-reloaded' ) . ' ';
1539
+ $html .= $quads->html->checkbox( array('name' => 'quads_settings[pos8][Par3Con]', 'current' => !empty( $quads_options['pos8']['Par3Con'] ) ? $quads_options['pos8']['Par3Con'] : null, 'class' => 'quads-checkbox quads-assign') );
1540
  $html .= ' ' . __( 'to <strong>End of Post</strong> if fewer paragraphs are found.', 'quick-adsense-reloaded' ) . ' </br>';
1541
 
1542
+ $html .= apply_filters('quads_extra_paragraph', '');
1543
+
1544
  // Pos 9
1545
+ $html .= $quads->html->checkbox( array('name' => 'quads_settings[pos9][Img1Ads]', 'current' => !empty( $quads_options['pos9']['Img1Ads'] ) ? $quads_options['pos9']['Img1Ads'] : null, 'class' => 'quads-checkbox quads-assign') );
1546
  $html .= ' ' . __( 'Assign', 'quick-adsense-reloaded' ) . ' ';
1547
  $html .= $quads->html->select( array('options' => quads_get_ads(), 'name' => 'quads_settings[pos9][Img1Rnd]', 'selected' => !empty( $quads_options['pos9']['Img1Rnd'] ) ? $quads_options['pos9']['Img1Rnd'] : null, 'show_option_all' => false, 'show_option_none' => false) );
1548
  $html .= ' ' . __( '<strong>After Image</strong>', 'quick-adsense-reloaded' ) . ' ';
1549
+ $html .= $quads->html->select( array('options' => quads_get_values(), 'id' => 'quads_settings[pos9][Img1Nup]', 'name' => 'quads_settings[pos9][Img1Nup]', 'selected' => !empty( $quads_options['pos9']['Img1Nup'] ) ? $quads_options['pos9']['Img1Nup'] : null, 'show_option_all' => false, 'show_option_none' => false) );
1550
  $html .= ' ' . __( '→', 'quick-adsense-reloaded' ) . ' ';
1551
+ $html .= $quads->html->checkbox( array('name' => 'quads_settings[pos9][Img1Con]', 'current' => !empty( $quads_options['pos9']['Img1Con'] ) ? $quads_options['pos9']['Img1Con'] : null, 'class' => 'quads-checkbox quads-assign') );
1552
  $html .= ' ' . __( 'after <b>Image\'s outer</b><b><span style="font-family:Courier New,Courier,Fixed;"> &lt;div&gt; wp-caption</span></b> if any.', 'quick-adsense-reloaded' ) . ' </br>';
1553
 
1554
  echo apply_filters( 'quads_ad_position_callback', $html );
1580
  echo $html;
1581
  }
1582
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1583
  /**
1584
  * AdSense Code Callback
1585
  *
1634
  <textarea style="vertical-align:top;margin-right:20px;" class="large-text quads-textarea" cols="50" rows="10" id="quads_settings[<?php echo $id; ?>][code]" name="quads_settings[<?php echo $id; ?>][code]"><?php echo esc_textarea( stripslashes( $code ) ); ?></textarea><label for="quads_settings[ <?php echo $id; ?> ][code]"> <?php echo $args['desc']; ?></label>
1635
  <br>
1636
  <div class="quads_adsense_code">
1637
+ <input type="button" style="vertical-align:inherit;" class="button button-primary quads-add-adsense" value="Copy / Paste AdSense Code"> <span>or add Ad Slot ID & Publisher ID manually below:</span>
1638
  <br />
1639
  <?php //echo __('Generate Ad Slot & Publisher ID automatically from your adsense code', 'quick-adsense-reloaded')?>
1640
  <label class="quads-label-left" for="quads_settings[<?php echo $id; ?>][g_data_ad_slot]">Ad Slot ID </label><input type="text" class="quads-medium-size quads-bggrey" id="quads_settings[<?php echo $id; ?>][g_data_ad_slot]" name="quads_settings[<?php echo $id; ?>][g_data_ad_slot]" value="<?php echo $g_data_ad_slot; ?>">
includes/admin/upgrades/upgrade-functions.php CHANGED
@@ -112,8 +112,8 @@ function quads_is_commercial_theme() {
112
  $themes = array('Bunchy', 'Bimber', 'boombox', 'Boombox');
113
 
114
  if( is_object( $my_theme ) && in_array( $my_theme->get( 'Name' ), $themes ) ) {
115
- update_option( 'quads_show_theme_notice', $my_theme->get( 'Name' ) );
116
- return true;
117
  }
118
 
119
  return false;
112
  $themes = array('Bunchy', 'Bimber', 'boombox', 'Boombox');
113
 
114
  if( is_object( $my_theme ) && in_array( $my_theme->get( 'Name' ), $themes ) ) {
115
+ //update_option( 'quads_show_theme_notice', $my_theme->get( 'Name' ) );
116
+ return $my_theme->get( 'Name' );
117
  }
118
 
119
  return false;
includes/api.php CHANGED
@@ -33,6 +33,47 @@
33
  */
34
 
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  /**
37
  * Register an ad position.
38
  *
@@ -79,12 +120,14 @@ function quads_has_ad( $location ) {
79
  return apply_filters( 'quads_has_ad', $result, $location );
80
  }
81
  /**
82
- * Display an ad
83
  *
84
  * @param array $args Displaying options
85
  * @return string|void Ad code or none if echo set to true
86
  */
87
  function quads_ad( $args ) {
 
 
88
  $defaults = array(
89
  'location' => '',
90
  'echo' => true,
@@ -92,14 +135,18 @@ function quads_ad( $args ) {
92
  $args = wp_parse_args( $args, $defaults );
93
  $code = '';
94
 
 
 
 
 
 
95
  if ( quads_has_ad( $args['location'] ) ) {
96
  global $quads_options;
97
 
98
- quads_set_ad_count_custom(); // increase amount of shortcode ads
99
 
100
  $location_settings = quads_get_ad_location_settings( $args['location'] );
101
  $code .= "\n".'<!-- WP QUADS Custom Ad v. ' . QUADS_VERSION .' -->'."\n";
102
- //$code .= $quads_options[ 'ad' . $location_settings['ad'] ]['code'];
103
  $code .= '<div class="quads-location quads-ad' .$location_settings['ad']. '" id="quads-ad' .$location_settings['ad']. '">'."\n";
104
  $code .= quads_render_ad( 'ad' . $location_settings['ad'], $quads_options[ 'ad' . $location_settings['ad'] ]['code'] );
105
  $code .= '</div>';
33
  */
34
 
35
 
36
+ /**
37
+ * Return ad locations HTML based on new API in general settings
38
+ *
39
+ * @param $html
40
+ * @return string Locations HTML
41
+ */
42
+ function quads_render_ad_locations( $html ) {
43
+ global $quads_options, $_quads_registered_ad_locations, $quads;
44
+
45
+ if( isset( $_quads_registered_ad_locations ) && is_array( $_quads_registered_ad_locations ) ) {
46
+ foreach ( $_quads_registered_ad_locations as $location => $location_args ) {
47
+
48
+ $location_settings = quads_get_ad_location_settings( $location );
49
+
50
+ $html .= $quads->html->checkbox( array(
51
+ 'name' => 'quads_settings[location_settings][' . $location . '][status]',
52
+ 'current' => !empty( $location_settings['status'] ) ? $location_settings['status'] : null,
53
+ 'class' => 'quads-checkbox quads-assign'
54
+ ) );
55
+ $html .= ' ' . __( 'Assign', 'quick-adsense-reloaded' ) . ' ';
56
+
57
+ $html .= $quads->html->select( array(
58
+ 'options' => quads_get_ads(),
59
+ 'name' => 'quads_settings[location_settings][' . $location . '][ad]',
60
+ 'selected' => !empty( $location_settings['ad'] ) ? $location_settings['ad'] : null,
61
+ 'show_option_all' => false,
62
+ 'show_option_none' => false
63
+ ) );
64
+ $html .= ' ' . $location_args['description'] . '</br>';
65
+ }
66
+ }
67
+
68
+ return $html;
69
+ }
70
+
71
+ /**
72
+ * This hook should be removed and the hook function should replace entire "quads_ad_position_callback" function.
73
+ */
74
+ add_filter( 'quads_ad_position_callback', 'quads_render_ad_locations' );
75
+
76
+
77
  /**
78
  * Register an ad position.
79
  *
120
  return apply_filters( 'quads_has_ad', $result, $location );
121
  }
122
  /**
123
+ * Display a custom ad
124
  *
125
  * @param array $args Displaying options
126
  * @return string|void Ad code or none if echo set to true
127
  */
128
  function quads_ad( $args ) {
129
+ global $post;
130
+
131
  $defaults = array(
132
  'location' => '',
133
  'echo' => true,
135
  $args = wp_parse_args( $args, $defaults );
136
  $code = '';
137
 
138
+ // All ads are deactivated via post meta settings
139
+ if( quads_check_meta_setting( 'NoAds' ) === '1' ){
140
+ return false;
141
+ }
142
+
143
  if ( quads_has_ad( $args['location'] ) ) {
144
  global $quads_options;
145
 
146
+ quads_set_ad_count_custom(); // increase amount of Custom ads
147
 
148
  $location_settings = quads_get_ad_location_settings( $args['location'] );
149
  $code .= "\n".'<!-- WP QUADS Custom Ad v. ' . QUADS_VERSION .' -->'."\n";
 
150
  $code .= '<div class="quads-location quads-ad' .$location_settings['ad']. '" id="quads-ad' .$location_settings['ad']. '">'."\n";
151
  $code .= quads_render_ad( 'ad' . $location_settings['ad'], $quads_options[ 'ad' . $location_settings['ad'] ]['code'] );
152
  $code .= '</div>';
includes/conditionals.php CHANGED
@@ -70,8 +70,11 @@ function quads_get_total_ad_count(){
70
  $shortcode = isset($visibleShortcodeAds) ? (int)$visibleShortcodeAds : 0;
71
  $content = isset($visibleContentAdsGlobal) ? (int)$visibleContentAdsGlobal : 0;
72
  $custom = isset($ad_count_custom) ? (int)$ad_count_custom : 0;
73
- $widget = isset($ad_count_widget) ? (int)$ad_count_widget : 0;
74
-
 
 
 
75
  return $shortcode + $content + $custom + $widget;
76
  }
77
 
@@ -88,6 +91,10 @@ function quads_ad_reach_max_count(){
88
  global $quads_options;
89
 
90
  $maxads = isset($quads_options['maxads']) ? $quads_options['maxads'] : 10;
 
 
 
 
91
  if ( quads_get_total_ad_count() >= $maxads ){
92
  return true;
93
  }
@@ -135,6 +142,7 @@ function quads_set_ad_count_custom(){
135
  * Increment count of active ads generated on widgets
136
  *
137
  * @return int amount of active widget ads
 
138
  */
139
  function quads_set_ad_count_widget(){
140
  global $ad_count_widget;
70
  $shortcode = isset($visibleShortcodeAds) ? (int)$visibleShortcodeAds : 0;
71
  $content = isset($visibleContentAdsGlobal) ? (int)$visibleContentAdsGlobal : 0;
72
  $custom = isset($ad_count_custom) ? (int)$ad_count_custom : 0;
73
+ //$widget = isset($ad_count_widget) ? (int)$ad_count_widget : 0;
74
+ $widget = quads_get_number_widget_ads();
75
+
76
+ //wp_die($widget);
77
+ //wp_die( $shortcode + $content + $custom + $widget);
78
  return $shortcode + $content + $custom + $widget;
79
  }
80
 
91
  global $quads_options;
92
 
93
  $maxads = isset($quads_options['maxads']) ? $quads_options['maxads'] : 10;
94
+ $maxads = $maxads - quads_get_number_widget_ads();
95
+
96
+ //echo 'Total ads: '. quads_get_total_ad_count() . ' maxads: '. $maxads . '<br>';
97
+
98
  if ( quads_get_total_ad_count() >= $maxads ){
99
  return true;
100
  }
142
  * Increment count of active ads generated on widgets
143
  *
144
  * @return int amount of active widget ads
145
+ * @deprecated since 1.4.1
146
  */
147
  function quads_set_ad_count_widget(){
148
  global $ad_count_widget;
includes/frontend-checks.php ADDED
@@ -0,0 +1,298 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Helper Functions
4
+ *
5
+ * @package QUADS
6
+ * @subpackage INCLUDES
7
+ * @copyright Copyright (c) 2016, René Hermenau
8
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
+ * @author René Hermenau
10
+ * @author Thank you Thomas Maier (advanced ads) for that great inspiration. I borrowed some code. Hope you dont mind:)
11
+ * @since 1.4.3
12
+ */
13
+ // Exit if accessed directly
14
+ if( !defined( 'ABSPATH' ) )
15
+ exit;
16
+
17
+ function quads_frontend_checks_init() {
18
+ if( !is_admin() && is_admin_bar_showing() && current_user_can( 'update_plugins' )
19
+ ) {
20
+ add_action( 'admin_bar_menu', 'quads_add_admin_bar_menu', 1000 );
21
+ add_filter( 'the_content', 'quads_check_the_content_filter' );
22
+ add_filter( 'wp_footer', 'quads_check_adblocker', -101 );
23
+ add_filter( 'quads-ad-output', 'after_ad_output', 10, 2 );
24
+ }
25
+ }
26
+
27
+ add_action( 'init', 'quads_frontend_checks_init' );
28
+
29
+ /**
30
+ * Create WP QUADS List possible error cases in the admin-bar.
31
+ *
32
+ * @param obj $wp_admin_bar WP_Admin_Bar
33
+ */
34
+ function quads_add_admin_bar_menu( $wp_admin_bar ) {
35
+ global $quads_options, $wp_the_query, $post, $wp_scripts, $the_content;
36
+
37
+ $error = false;
38
+
39
+ $wp_admin_bar->add_node( array(
40
+ 'id' => 'quads_ad_check',
41
+ 'title' => __( 'Ad Check', 'quick-adsense-reloaded' ),
42
+ ) );
43
+
44
+ // Hidden by default
45
+ $wp_admin_bar->add_node( array(
46
+ 'parent' => 'quads_ad_check',
47
+ 'id' => 'quads_ad_check_jquery',
48
+ 'title' => __( '- JavaScript / jQuery error', 'quick-adsense-reloaded' ),
49
+ 'href' => 'http://wpquads.com/docs/javascript-issues-breaking-adsense-ads/',
50
+ 'meta' => array(
51
+ 'class' => 'quads-hidden quads_ad_check_warning',
52
+ 'target' => '_blank'
53
+ )
54
+ ) );
55
+
56
+ // Hidden by default
57
+ $wp_admin_bar->add_node( array(
58
+ 'parent' => 'quads_ad_check',
59
+ 'id' => 'quads_ad_check_adblocker_enabled',
60
+ 'title' => __( '- Ad blocker enabled', 'quick-adsense-reloaded' ),
61
+ 'meta' => array(
62
+ 'class' => 'quads-hidden quads_ad_check_warning',
63
+ 'target' => '_blank'
64
+ )
65
+ ) );
66
+ // Hidden by default
67
+ if( $wp_the_query->is_singular() ) {
68
+ // Check if the_content filter is available
69
+ if( !$the_content ) {
70
+ $wp_admin_bar->add_node( array(
71
+ 'parent' => 'quads_ad_check',
72
+ 'id' => 'quads_ad_check_the_content_not_invoked',
73
+ 'title' => __( '- <em>the_content</em> filter does not exist', 'quick-adsense-reloaded' ),
74
+ 'href' => 'http://wpquads.com/docs/the_content-filter-missing/',
75
+ 'meta' => array(
76
+ 'class' => 'quads_ad_check_warning',
77
+ 'target' => '_blank'
78
+ )
79
+ ) );
80
+ $error = true;
81
+ }
82
+ // Hidden by default
83
+ if( !empty( $post->ID ) ) {
84
+ $ad_settings = get_post_meta( $post->ID, '_quads_config_visibility', true );
85
+
86
+ if( !empty( $ad_settings['NoAds'] ) ) {
87
+ $wp_admin_bar->add_node( array(
88
+ 'parent' => 'quads_ad_check',
89
+ 'id' => 'quads_ad_check_disabled_on_page',
90
+ 'title' => __( '- All Ads are disabled on this page', 'quick-adsense-reloaded' ),
91
+ 'href' => get_edit_post_link( $post->ID ) . '#quads-ad-settings',
92
+ 'meta' => array(
93
+ 'class' => 'quads_ad_check_warning',
94
+ 'target' => '_blank'
95
+ )
96
+ ) );
97
+ $error = true;
98
+ }
99
+ if( !empty( $ad_settings['OffDef'] ) ) {
100
+ $wp_admin_bar->add_node( array(
101
+ 'parent' => 'quads_ad_check',
102
+ 'id' => 'quads_ad_check_disabled_in_content',
103
+ 'title' => __( '- Default Ads disabled in content of this page', 'quick-adsense-reloaded' ),
104
+ 'href' => get_edit_post_link( $post->ID ) . '#quads-ad-settings',
105
+ 'meta' => array(
106
+ 'class' => 'quads_ad_check_warning',
107
+ 'target' => '_blank'
108
+ )
109
+ ) );
110
+ $error = true;
111
+ }
112
+ } else {
113
+ $wp_admin_bar->add_node( array(
114
+ 'parent' => 'quads_ad_check',
115
+ 'id' => 'quads_ad_check_post_zero',
116
+ 'title' => __( '- Current post ID is 0 ', 'quick-adsense-reloaded' ),
117
+ 'href' => 'https://wpadvancedads.com/manual/known-plugin-conflicts/#frontend-issue-post-id-empty',
118
+ 'meta' => array(
119
+ 'class' => 'quads_ad_check_warning',
120
+ 'target' => '_blank'
121
+ )
122
+ ) );
123
+ $error = true;
124
+ }
125
+ }
126
+
127
+ if( $wp_the_query->is_404() && !empty( $quads_options['disabled-ads']['404'] ) ) {
128
+ $wp_admin_bar->add_node( array(
129
+ 'parent' => 'quads_ad_check',
130
+ 'id' => 'quads_ad_check_no_404',
131
+ 'title' => __( 'Ads are disabled on 404 pages', 'quick-adsense-reloaded' ),
132
+ 'href' => admin_url( 'admin.php?page=quads-settings' ),
133
+ 'meta' => array(
134
+ 'class' => 'quads_ad_check_warning',
135
+ 'target' => '_blank'
136
+ )
137
+ ) );
138
+ $error = true;
139
+ }
140
+
141
+ if( !$wp_the_query->is_singular() && !empty( $quads_options['disabled-ads']['archives'] ) ) {
142
+ $wp_admin_bar->add_node( array(
143
+ 'parent' => 'quads_ad_check',
144
+ 'id' => 'quads_ad_check_no_archive',
145
+ 'title' => __( 'Ads are disabled on non singular pages', 'quick-adsense-reloaded' ),
146
+ 'href' => admin_url( 'admin.php?page=quads-settings' ),
147
+ 'meta' => array(
148
+ 'class' => 'quads_ad_check_warning',
149
+ 'target' => '_blank'
150
+ )
151
+ ) );
152
+ $error = true;
153
+ }
154
+
155
+ if( !extension_loaded( 'dom' ) ) {
156
+ $wp_admin_bar->add_node( array(
157
+ 'parent' => 'quads_ad_check',
158
+ 'id' => 'quads_ad_check_no_dom_document',
159
+ 'title' => sprintf( __( 'The %s extension(s) is not loaded', 'quick-adsense-reloaded' ), 'dom' ),
160
+ 'href' => 'http://php.net/manual/en/book.dom.php',
161
+ 'meta' => array(
162
+ 'class' => 'quads_ad_check_warning',
163
+ 'target' => '_blank'
164
+ )
165
+ ) );
166
+ $error = true;
167
+ }
168
+
169
+ if( !$error ) {
170
+ $wp_admin_bar->add_node( array(
171
+ 'parent' => 'quads_ad_check',
172
+ 'id' => 'quads_ad_check_fine',
173
+ 'title' => __( 'WP QUADS is working fine', 'quick-adsense-reloaded' ),
174
+ 'href' => false,
175
+ 'meta' => array(
176
+ 'target' => '_blank',
177
+ )
178
+ ) );
179
+ }
180
+
181
+ $wp_admin_bar->add_node( array(
182
+ 'parent' => 'quads_ad_check',
183
+ 'id' => 'quads_ad_check_debug_dfp',
184
+ 'title' => __( 'debug DFP ads', 'quick-adsense-reloaded' ),
185
+ 'href' => esc_url( add_query_arg( 'googfc', '' ) ),
186
+ 'meta' => array(
187
+ 'class' => 'quads-hidden quads_ad_check_debug_dfp_link',
188
+ 'target' => '_blank',
189
+ )
190
+ ) );
191
+
192
+ $wp_admin_bar->add_node( array(
193
+ 'parent' => 'quads_ad_check',
194
+ 'id' => 'quads_ad_check_highlight_ads',
195
+ 'title' => sprintf( '<label><input id="quads_highlight_ads_checkbox" type="checkbox"> %s</label>', __( 'highlight ads', 'quick-adsense-reloaded' ) )
196
+ ) );
197
+ }
198
+
199
+ /**
200
+ * Set variable to 'true' when 'the_content' filter is available.
201
+ *
202
+ * @param string $content
203
+ * @return string $content
204
+ */
205
+ function quads_check_the_content_filter( $content ) {
206
+ global $the_content;
207
+
208
+ $the_content = true;
209
+
210
+ return $content;
211
+ }
212
+
213
+ /**
214
+ * Check conditions and display warning. Conditions: AdBlocker enabled, jQuery is included in header
215
+ */
216
+ function quads_check_adblocker() {
217
+ ?>
218
+ <!--noptimize--><style>.quads-hidden { display: none; } .quads-adminbar-is-warnings { background: #ef4000 ! important; color: #fff !important; }
219
+ .quads-highlight-ads { outline:6px solid #83c11f !important; }</style>
220
+ <script type="text/javascript" src="<?php echo QUADS_PLUGIN_URL . 'assets/js/ads.js' ?>"></script>
221
+ <script>
222
+ (function (d, w) {
223
+ var jquery_not_detected = typeof jQuery === 'undefined';
224
+
225
+ var addEvent = function (obj, type, fn) {
226
+ if (obj.addEventListener)
227
+ obj.addEventListener(type, fn, false);
228
+ else if (obj.attachEvent)
229
+ obj.attachEvent('on' + type, function () {
230
+ return fn.call(obj, window.event);
231
+ });
232
+ };
233
+
234
+ function highlight_ads() {
235
+ try {
236
+ var ad_wrappers = document.querySelectorAll('div[id^="quads-ad"]')
237
+ } catch (e) {
238
+ return;
239
+ }
240
+ for (i = 0; i < ad_wrappers.length; i++) {
241
+ if (this.checked) {
242
+ ad_wrappers[i].className += ' quads-highlight-ads';
243
+ } else {
244
+ ad_wrappers[i].className = ad_wrappers[i].className.replace('quads-highlight-ads', '');
245
+ }
246
+ }
247
+ }
248
+
249
+ addEvent(w, 'load', function () {
250
+ var adblock_item = d.getElementById('wp-admin-bar-quads_ad_check_adblocker_enabled'),
251
+ jQuery_item = d.getElementById('wp-admin-bar-quads_ad_check_jquery'),
252
+ fine_item = d.getElementById('wp-admin-bar-quads_ad_check_fine'),
253
+ hide_fine = false;
254
+
255
+ var highlight_checkbox = d.getElementById('quads_highlight_ads_checkbox');
256
+ if (highlight_checkbox) {
257
+ addEvent(highlight_checkbox, 'change', highlight_ads);
258
+ }
259
+ if (adblock_item && typeof wpquads_adblocker_check === 'undefined' || false === wpquads_adblocker_check) {
260
+ // show quads-hidden item
261
+ adblock_item.className = adblock_item.className.replace(/quads-hidden/, '');
262
+ hide_fine = true;
263
+ }
264
+
265
+ if (jQuery_item && jquery_not_detected) {
266
+ // show quads-hidden item
267
+ jQuery_item.className = jQuery_item.className.replace(/quads-hidden/, '');
268
+ hide_fine = true;
269
+ }
270
+
271
+ if (hide_fine && fine_item) {
272
+ fine_item.className += ' quads-hidden';
273
+ }
274
+
275
+ showCount();
276
+ });
277
+
278
+ var showCount = function () {
279
+ try {
280
+ // select not quads-hidden warning items, exclude the 'fine_item'
281
+ var warning_count = document.querySelectorAll('.quads_ad_check_warning:not(.quads-hidden)').length;
282
+ } catch (e) {
283
+ return;
284
+ }
285
+
286
+ if (warning_count) {
287
+ var header = document.querySelector('#wp-admin-bar-quads_ad_check > div');
288
+
289
+ if (header) {
290
+ header.innerHTML += ' <i>(' + warning_count + ')</i>';
291
+ header.className += ' quads-adminbar-is-warnings';
292
+ }
293
+ }
294
+ };
295
+ })(document, window);
296
+ </script><!--/noptimize-->
297
+ <?php
298
+ }
includes/meta-boxes.php CHANGED
@@ -8,11 +8,12 @@
8
  * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
  * @since 0.9.6
10
  */
11
- function quads_load_meta_box () {
12
  new Quads_Meta_Box();
13
- }
14
- add_action( 'load-post.php', 'quads_load_meta_box' );
15
- add_action( 'load-post-new.php', 'quads_load_meta_box' );
 
16
  /**
17
  * Ads options for a single post
18
  */
@@ -40,7 +41,7 @@ class Quads_Meta_Box {
40
  __('WP QUADS - Hide Ads', 'quick-adsense-reloaded'), // title
41
  array($this, 'render_meta_box'), // render function callback
42
  $post_type, // post_type
43
- 'normal', // context
44
  'default' // priority
45
  );
46
  }
8
  * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
  * @since 0.9.6
10
  */
11
+ //function quads_load_meta_box () {
12
  new Quads_Meta_Box();
13
+ //}
14
+ //add_action( 'load-post.php', 'quads_load_meta_box' );
15
+ //add_action( 'load-post-new.php', 'quads_load_meta_box' );
16
+ //add_action( 'add_meta_boxes', 'quads_load_meta_box' );
17
  /**
18
  * Ads options for a single post
19
  */
41
  __('WP QUADS - Hide Ads', 'quick-adsense-reloaded'), // title
42
  array($this, 'render_meta_box'), // render function callback
43
  $post_type, // post_type
44
+ 'advanced', // context
45
  'default' // priority
46
  );
47
  }
includes/quicktags.php CHANGED
@@ -43,6 +43,8 @@ function quads_get_quicktags_from_content ( $content ) {
43
  }
44
  return $found;
45
  }
 
 
46
  /**
47
  * Removes all quicktags from content
48
  *
43
  }
44
  return $found;
45
  }
46
+
47
+
48
  /**
49
  * Removes all quicktags from content
50
  *
includes/shortcodes.php CHANGED
@@ -24,20 +24,42 @@ add_shortcode( 'quads', 'quads_shortcode_display_ad', 1); // Important use a ver
24
  * @since 0.9.4
25
  * @param array $atts
26
  */
27
- function quads_shortcode_display_ad($atts) {
28
- if ( !quads_ad_is_allowed() )
29
- return;
30
 
 
 
 
31
 
32
  //return quads_check_meta_setting('NoAds');
33
- if ( quads_check_meta_setting('NoAds') === '1')
34
  return;
 
35
 
36
- $id = isset($atts['id']) ? (int) $atts['id'] : 0;
37
- return do_shortcode(quads_get_ad($id));
38
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
 
 
 
 
40
 
 
 
41
 
42
  /**
43
  * return ad content
@@ -56,7 +78,7 @@ function quads_get_ad($id = 0) {
56
  if ( isset($quads_options['ad' . $id]['code']) ){
57
  // Count how often the shortcode is used - Important
58
  quads_set_ad_count_shortcode();
59
- $code = "\n".'<!-- WP QUADS Shortcode Ad v. ' . QUADS_VERSION .' -->'."\n";
60
  //return $code . $quads_options['ad' . $id]['code'];
61
  return quads_render_ad('ad' . $id, $quads_options['ad' . $id]['code']);
62
  }
@@ -73,8 +95,9 @@ function quads_get_ad($id = 0) {
73
  function quads_check_meta_setting($key){
74
  global $post;
75
 
76
- if ( !isset($post->ID ) )
77
- return false;
 
78
 
79
  $meta_key = '_quads_config_visibility';
80
 
24
  * @since 0.9.4
25
  * @param array $atts
26
  */
27
+ function quads_shortcode_display_ad( $atts ) {
28
+ global $quads_options;
 
29
 
30
+ if( !quads_ad_is_allowed() )
31
+ return;
32
+
33
 
34
  //return quads_check_meta_setting('NoAds');
35
+ if( quads_check_meta_setting( 'NoAds' ) === '1' ){
36
  return;
37
+ }
38
 
39
+ // The ad id
40
+ $id = isset( $atts['id'] ) ? ( int ) $atts['id'] : 0;
41
+
42
+ $arr = array(
43
+ 'float:left;margin:%1$dpx %1$dpx %1$dpx 0;',
44
+ 'float:none;margin:%1$dpx 0 %1$dpx 0;text-align:center;',
45
+ 'float:right;margin:%1$dpx 0 %1$dpx %1$dpx;',
46
+ 'float:none;margin:0px;');
47
+
48
+ $adsalign = $quads_options['ad' . $id]['align'];
49
+ $adsmargin = isset( $quads_options['ad' . $id]['margin'] ) ? $quads_options['ad' . $id]['margin'] : '3'; // default
50
+ $margin = sprintf( $arr[( int ) $adsalign], $adsmargin );
51
+
52
+
53
+ // Do not create any inline style on AMP site
54
+ $style = !quads_is_amp_endpoint() ? apply_filters( 'quads_filter_margins', $margin, 'ad' . $id ) : '';
55
 
56
+ $code = "\n" . '<!-- WP QUADS v. ' . QUADS_VERSION . ' Shortcode Ad -->' . "\n" .
57
+ '<div class="quads-location quads-ad' . $id . '" id="quads-ad' . $id . '" style="' . $style . '">' . "\n";
58
+ $code .= do_shortcode( quads_get_ad( $id ) );
59
+ $code .= '</div>' . "\n";
60
 
61
+ return $code;
62
+ }
63
 
64
  /**
65
  * return ad content
78
  if ( isset($quads_options['ad' . $id]['code']) ){
79
  // Count how often the shortcode is used - Important
80
  quads_set_ad_count_shortcode();
81
+ //$code = "\n".'<!-- WP QUADS Shortcode Ad v. ' . QUADS_VERSION .' -->'."\n";
82
  //return $code . $quads_options['ad' . $id]['code'];
83
  return quads_render_ad('ad' . $id, $quads_options['ad' . $id]['code']);
84
  }
95
  function quads_check_meta_setting($key){
96
  global $post;
97
 
98
+ if ( !isset($post->ID ) ){
99
+ return false;
100
+ }
101
 
102
  $meta_key = '_quads_config_visibility';
103
 
includes/template-functions.php CHANGED
@@ -16,20 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) exit;
16
  add_filter('the_content', 'quads_post_settings_to_quicktags', 5);
17
  add_filter('the_content', 'quads_process_content', quads_get_load_priority());
18
 
19
- /**
20
- * Get load priority
21
- *
22
- * @global arr $quads_options
23
- * @return int
24
- */
25
- function quads_get_load_priority(){
26
- global $quads_options;
27
-
28
- if (!empty($quads_options['priority'])){
29
- return intval($quads_options['priority']);
30
- }
31
- return 20;
32
- }
33
 
34
  /**
35
  * Adds quicktags, defined via post meta options, to content.
@@ -78,17 +65,651 @@ function quads_get_visibility_quicktags_str ( $post_id = null ) {
78
  return $str;
79
  }
80
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  /**
82
  * Main processing for the_content filter
83
  *
84
  * @global arr $quads_options all plugin settings
85
  * @global int $visibleContentAds number of active content ads (reseted internally so we have to use a similar global below for external purposes: $visibleContentAdsGlobal)
86
- * @global arr $AdsId Whitespace trimmed array of ad codes
87
- * @global int $numberWidgets number of ad widgets
88
- * @global int $numberAds number of maximum available ads
89
  * @global string $AdsWidName name of widget
90
- * @global int $visibleContentAdsGlobal number of active content ads
91
  * @global int $visibleShortcodeAds number of active shortcode ads
 
92
  * @param string $content
93
  *
94
  * @return string
@@ -96,8 +717,8 @@ function quads_get_visibility_quicktags_str ( $post_id = null ) {
96
  * @since 0.9.0
97
  */
98
 
99
- function quads_process_content($content){
100
- global $quads_options, $visibleContentAds, $AdsId, $numberWidgets, $numberAds, $AdsWidName, $visibleContentAdsGlobal, $visibleShortcodeAds;
101
 
102
  // Return original content if QUADS is not allowed
103
  if ( !quads_ad_is_allowed($content) ) {
@@ -107,166 +728,193 @@ function quads_process_content($content){
107
  // Maximum allowed ads
108
  $maxAds = isset($quads_options['maxads']) ? $quads_options['maxads'] : 10;
109
 
 
110
  if (strpos($content,'<!--OffWidget-->')===false) {
111
- for($i=1;$i<=$numberWidgets;$i++) {
112
  $wadsid = sanitize_title(str_replace(array('(',')'),'',sprintf($AdsWidName,$i)));
113
- $maxAds -= (is_active_widget('', '', $wadsid)) ? 1 : 0 ;
 
114
  }
115
  }
116
 
117
  // Return here if max visible ads are exceeded
118
- if( $visibleContentAds+$visibleShortcodeAds >= $maxAds ) { // ShownAds === 0 or larger/equal than $maxAds
119
  $content = quads_clean_tags($content);
120
  return $content;
121
  };
122
 
123
  // Create array of valid id's
124
- if( count( $AdsId ) === 0 ) { //
125
- for ( $i = 1; $i <= $numberAds; $i++ ) {
126
  $tmp = isset($quads_options['ad' . $i]['code']) ? trim( $quads_options['ad' . $i]['code'] ) : '';
127
  // id is valid if there is either the plain text field populated or the adsense ad slot and the ad client id
128
  if( !empty( $tmp ) || (!empty($quads_options['ad' . $i]['g_data_ad_slot']) && !empty($quads_options['ad' . $i]['g_data_ad_client'] ) ) ) {
129
- $AdsId[] = $i;
130
  }
131
  }
132
- // echo '<pre>';
133
- // wp_die(var_dump($AdsId));
134
  }
135
 
136
  // Ad code array is empty so break here
137
- if( count($AdsId) === 0 ) {
138
  $content = quads_clean_tags($content);
139
  return $content;
140
  };
141
 
142
  /* ... Tidy up content ... */
143
  // Replace all <p></p> tags with placeholder ##QA-TP1##
144
- // Replace all
145
  $content = str_replace("<p></p>", "##QA-TP1##", $content);
 
146
  // Replace all <p>&nbsp;</p> tags with placeholder ##QA-TP2##
147
- $content = str_replace("<p>&nbsp;</p>", "##QA-TP2##", $content);
148
- $offdef = (strpos($content,'<!--OffDef-->')!==false);
149
 
150
- if( !$offdef ) {
 
151
 
152
- $AdsIdCus = array();
153
- $cusads = 'CusAds';
154
- $cusrnd = 'CusRnd';
 
155
 
156
- $begn1 = isset($quads_options['pos1']['BegnAds']) ? true : false;
157
- $begn2 = isset($quads_options['pos1']['BegnRnd']) ? $quads_options['pos1']['BegnRnd'] : 0;
158
 
159
- $midd1 = isset($quads_options['pos2']['MiddAds']) ? true : false;
160
- $midd2 = isset($quads_options['pos2']['MiddRnd']) ? $quads_options['pos2']['MiddRnd'] : 0;
161
 
162
- $endi1 = isset($quads_options['pos3']['EndiAds']) ? true : false;
163
- $endi2 = isset($quads_options['pos3']['EndiRnd']) ? $quads_options['pos3']['EndiRnd'] : 0;
164
 
165
- $more1 = isset($quads_options['pos4']['MoreAds']) ? true : false;
166
- $more2 = isset($quads_options['pos4']['MoreRnd']) ? $quads_options['pos4']['MoreRnd'] : 0;
167
 
168
- $lapa1 = isset($quads_options['pos5']['LapaAds']) ? true : false;
169
- $lapa2 = isset($quads_options['pos5']['LapaRnd'])? $quads_options['pos5']['LapaRnd'] : 0 ;
170
 
171
 
172
- $rc=3;
173
- $default = 5;
174
- for($i=1;$i<=$rc;$i++) {
175
 
176
- $key = $default +$i; // 6;7;8
 
 
 
 
177
 
178
- $para1[$i] = isset($quads_options['pos' . $key]['Par'.$i .'Ads']) ? $quads_options['pos' . $key]['Par'.$i .'Ads'] : 0;
179
- $para2[$i] = isset($quads_options['pos' . $key]['Par'.$i .'Rnd']) ? $quads_options['pos' . $key]['Par'.$i .'Rnd'] : 0;
180
- $para3[$i] = isset($quads_options['pos' . $key]['Par'.$i .'Nup']) ? $quads_options['pos' . $key]['Par'.$i .'Nup'] : 0;
181
- $para4[$i] = isset($quads_options['pos' . $key]['Par'.$i .'Con']) ? $quads_options['pos' . $key]['Par'.$i .'Con'] : 0;
182
 
183
  }
184
-
185
  $imageActive = isset($quads_options['pos9']['Img1Ads']) ? $quads_options['pos9']['Img1Ads'] : false;
186
  $imageAdNo = isset($quads_options['pos9']['Img1Rnd']) ? $quads_options['pos9']['Img1Rnd'] : false;
187
  $imageNo = isset($quads_options['pos9']['Img1Nup']) ? $quads_options['pos9']['Img1Nup'] : false;
188
  $imageCaption = isset($quads_options['pos9']['Img1Con']) ? $quads_options['pos9']['Img1Con'] : false;
189
 
190
 
191
- if ( $begn2 == 0 ) { $b1 = $cusrnd; } else { $b1 = $cusads.$begn2; array_push($AdsIdCus, $begn2); };
192
- if ( $more2 == 0 ) { $r1 = $cusrnd; } else { $r1 = $cusads.$more2; array_push($AdsIdCus, $more2); };
193
- if ( $midd2 == 0 ) { $m1 = $cusrnd; } else { $m1 = $cusads.$midd2; array_push($AdsIdCus, $midd2); };
194
- if ( $lapa2 == 0 ) { $g1 = $cusrnd; } else { $g1 = $cusads.$lapa2; array_push($AdsIdCus, $lapa2); };
195
- if ( $endi2 == 0 ) { $b2 = $cusrnd; } else { $b2 = $cusads.$endi2; array_push($AdsIdCus, $endi2); };
196
 
197
- for($i=1;$i<=$rc;$i++) {
198
- if ( $para2[$i] == 0 ) { $b3[$i] = $cusrnd;
199
-
200
  } else {
201
- $b3[$i] = $cusads.$para2[$i];
202
- array_push($AdsIdCus, $para2[$i]);
203
 
204
  };
205
  }
206
 
207
- // Check if image ad is random one
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
  if ( $imageAdNo == 0 ) {
209
- $b4 = $cusrnd;
210
  } else {
211
- $b4 = $cusads.$imageAdNo;
212
- array_push($AdsIdCus, $imageAdNo);
213
  };
214
 
215
- // Check if image ad is middle one
216
- if( $midd1 && strpos($content,'<!--OffMiddle-->')===false) {
217
  if( substr_count(strtolower($content), '</p>')>=2 ) {
218
  $sch = "</p>";
219
  $content = str_replace("</P>", $sch, $content);
220
- $arr = explode($sch, $content);
221
  $nn = 0; $mm = strlen($content)/2;
222
- for($i=0;$i<count($arr);$i++) {
223
- $nn += strlen($arr[$i]) + 4;
224
  if($nn>$mm) {
225
- if( ($mm - ($nn - strlen($arr[$i]))) > ($nn - $mm) && $i+1<count($arr) ) {
226
- $arr[$i+1] = '<!--'.$m1.'-->'.$arr[$i+1];
227
  } else {
228
- $arr[$i] = '<!--'.$m1.'-->'.$arr[$i];
229
  }
230
  break;
231
  }
232
  }
233
- $content = implode($sch, $arr);
234
  }
235
  }
236
 
 
237
  // Check if image ad is "More Tag" one
238
- if( $more1 && strpos($content,'<!--OffAfMore-->')===false) {
239
  $mmr = '<!--'.$r1.'-->';
240
  $postid = get_the_ID();
241
  $content = str_replace('<span id="more-'.$postid.'"></span>', $mmr, $content);
242
  }
243
 
244
- if( $begn1 && strpos($content,'<!--OffBegin-->')===false) {
245
  $content = '<!--'.$b1.'-->'.$content;
246
  }
247
- if( $endi1 && strpos($content,'<!--OffEnd-->')===false) {
248
  $content = $content.'<!--'.$b2.'-->';
249
  }
250
- if( $lapa1 && strpos($content,'<!--OffBfLastPara-->')===false){
251
  $sch = "<p>";
252
  $content = str_replace("<P>", $sch, $content);
253
- $arr = explode($sch, $content);
254
- if ( count($arr) > 2 ) {
255
- $content = implode($sch, array_slice($arr, 0, count($arr)-1)) .'<!--'.$g1.'-->'. $sch. $arr[count($arr)-1];
256
  }
257
  }
258
- for($i=$rc;$i>=1;$i--) {
259
- if ( $para1[$i] ){
260
- $sch = "</p>";
261
- $content = str_replace("</P>", $sch, $content);
262
- $arr = explode($sch, $content);
263
- if ( (int)$para3[$i] < count($arr) ) {
264
- $content = implode($sch, array_slice($arr, 0, $para3[$i])).$sch .'<!--'.$b3[$i].'-->'. implode($sch, array_slice($arr, $para3[$i]));
265
- } elseif ($para4[$i]) {
266
- $content = implode($sch, $arr).'<!--'.$b3[$i].'-->';
267
- }
268
- }
269
- }
270
 
271
  if ( $imageActive ){
272
 
@@ -279,26 +927,26 @@ function quads_process_content($content){
279
  $content = str_replace("</A>", $atag, $content);
280
 
281
  // Start
282
- $arr = explode($imgtag, $content);
283
- if ( (int)$imageNo < count($arr) ) {
284
- $arrImages = explode($delimiter, $arr[$imageNo]);
285
- if ( count($arrImages) > 1 ) {
286
- $tss = explode($caption, $arr[$imageNo]);
287
  $ccp = ( count($tss) > 1 ) ? strpos(strtolower($tss[0]),'[caption ')===false : false ;
288
- $arrAtag = explode($atag, $arr[$imageNo]);
289
- $cdu = ( count($arrAtag) > 1 ) ? strpos(strtolower($arrAtag[0]),'<a href')===false : false ;
290
  if ( $imageCaption && $ccp ) {
291
- $arr[$imageNo] = implode($caption, array_slice($tss, 0, 1)).$caption. "\r\n".'<!--'.$b4.'-->'."\r\n". implode($caption, array_slice($tss, 1));
292
  }else if ( $cdu ) {
293
- $arr[$imageNo] = implode($atag, array_slice($arrAtag, 0, 1)).$atag. "\r\n".'<!--'.$b4.'-->'."\r\n". implode($atag, array_slice($arrAtag, 1));
294
  }else{
295
- $arr[$imageNo] = implode($delimiter, array_slice($arrImages, 0, 1)).$delimiter. "\r\n".'<!--'.$b4.'-->'."\r\n". implode($delimiter, array_slice($arrImages, 1));
296
  }
297
  }
298
- $content = implode($imgtag, $arr);
299
  }
300
  }
301
- }
302
 
303
  /*
304
  * Tidy up content
@@ -306,18 +954,18 @@ function quads_process_content($content){
306
  $content = '<!--EmptyClear-->'.$content."\n".'<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>';
307
  $content = quads_clean_tags($content, true);
308
 
309
-
310
  /*
311
- * Replace Beginning/Middle/End Ads1-10
312
  */
313
 
314
- if( !$offdef ) {
315
- for( $i=1; $i<=count($AdsIdCus); $i++ ) {
316
 
317
- if( strpos($content,'<!--'.$cusads.$AdsIdCus[$i-1].'-->')!==false && in_array($AdsIdCus[$i-1], $AdsId)) {
318
-
319
- $content = quads_replace_ads( $content, $cusads.$AdsIdCus[$i-1], $AdsIdCus[$i-1] );
320
- $AdsId = quads_del_element($AdsId, array_search($AdsIdCus[$i-1], $AdsId)) ;
321
  $visibleContentAds += 1;
322
 
323
  quads_set_ad_count_content();
@@ -327,16 +975,17 @@ function quads_process_content($content){
327
  }
328
  }
329
  }
 
330
 
331
  /**
332
  * Replace Quicktags Ads1 to Ads10
333
  **/
334
 
335
- $tcn = count($AdsId); $tt = 0;
336
  for( $i=1; $i<=$tcn; $i++ ) {
337
- if( strpos($content, '<!--Ads'.$AdsId[$tt].'-->')!==false ) {
338
- $content = quads_replace_ads( $content, 'Ads'.$AdsId[$tt], $AdsId[$tt] );
339
- $AdsId = quads_del_element($AdsId, $tt) ;
340
  $visibleContentAds += 1;
341
  quads_set_ad_count_content();
342
  if (quads_ad_reach_max_count()){
@@ -345,25 +994,27 @@ function quads_process_content($content){
345
  }
346
 
347
  } else {
348
- $tt += 1;
349
  }
350
  }
351
 
352
 
353
 
354
- /* ... Replace Beginning/Middle/End random Ads ... */
355
- if( !$offdef ) {
356
  if( strpos($content, '<!--'.$cusrnd.'-->')!==false && is_singular() ) {
357
- $tcx = count($AdsId);
 
 
358
  $tcy = substr_count($content, '<!--'.$cusrnd.'-->');
359
 
360
  for( $i=$tcx; $i<=$tcy-1; $i++ ) {
361
- array_push($AdsId, -1);
362
  }
363
- shuffle($AdsId);
364
  for( $i=1; $i<=$tcy; $i++ ) {
365
- $content = quads_replace_ads( $content, $cusrnd, $AdsId[0] );
366
- $AdsId = quads_del_element($AdsId, 0) ;
367
  $visibleContentAds += 1;
368
  quads_set_ad_count_content();
369
  if (quads_ad_reach_max_count()){
@@ -378,23 +1029,23 @@ function quads_process_content($content){
378
  * Replace RndAds Random Ads
379
  */
380
  if( strpos($content, '<!--RndAds-->')!==false && is_singular() ) {
381
- $AdsIdTmp = array();
382
- shuffle($AdsId);
383
  for( $i=1; $i<=$maxAds-$visibleContentAds; $i++ ) {
384
- if( $i <= count($AdsId) ) {
385
- array_push($AdsIdTmp, $AdsId[$i-1]);
386
  }
387
  }
388
- $tcx = count($AdsIdTmp);
389
  $tcy = substr_count($content, '<!--RndAds-->');
390
  for( $i=$tcx; $i<=$tcy-1; $i++ ) {
391
- array_push($AdsIdTmp, -1);
392
  }
393
- shuffle($AdsIdTmp);
394
  for( $i=1; $i<=$tcy; $i++ ) {
395
- $tmp = $AdsIdTmp[0];
396
- $content = quads_replace_ads( $content, 'RndAds', $AdsIdTmp[0] );
397
- $AdsIdTmp = quads_del_element($AdsIdTmp, 0) ;
398
  if($tmp != -1){
399
  $visibleContentAds += 1;
400
  };
@@ -416,7 +1067,7 @@ function quads_process_content($content){
416
  * Revert content into original content without any ad code
417
  *
418
  * @global int $visibleContentAds
419
- * @global array $AdsId
420
  * @global array $quads_options
421
  * @global int $ad_count
422
  * @param string $content
@@ -426,7 +1077,7 @@ function quads_process_content($content){
426
  */
427
  function quads_clean_tags($content, $trimonly = false) {
428
  global $visibleContentAds;
429
- global $AdsId;
430
  global $quads_options;
431
  global $ad_count;
432
 
@@ -438,12 +1089,12 @@ function quads_clean_tags($content, $trimonly = false) {
438
  };
439
 
440
 
441
- foreach ($tagnames as $tgn) {
442
- if(strpos($content,'<!--'.$tgn.'-->')!==false || $tgn=='EmptyClear') {
443
  if($trimonly) {
444
- $content = str_replace('<p><!--'.$tgn.'--></p>', '<!--'.$tgn.'-->', $content);
445
  }else{
446
- $content = str_replace(array('<p><!--'.$tgn.'--></p>','<!--'.$tgn.'-->'), '', $content);
447
  $content = str_replace("##QA-TP1##", "<p></p>", $content);
448
  $content = str_replace("##QA-TP2##", "<p>&nbsp;</p>", $content);
449
  }
@@ -451,68 +1102,25 @@ function quads_clean_tags($content, $trimonly = false) {
451
  }
452
  if(!$trimonly && (is_single() || is_page()) ) {
453
  $visibleContentAds = 0;
454
- $AdsId = array();
455
  }
456
  return $content;
457
  }
458
 
459
- /**
460
- * Replace ad code in content
461
- *
462
- * @global type $quads_options
463
- * @param string $content
464
- * @param string $nme Quicktag
465
- * @param string $id id of the ad
466
- * @return type
467
- */
468
- function quads_replace_ads($content, $nme, $id) {
469
- global $quads_options;
470
-
471
 
472
- if( strpos($content,'<!--'.$nme.'-->')===false ) {
473
- return $content;
474
- }
475
- if ($id != -1) {
476
- $arr = array(
477
- 'float:left;margin:%1$dpx %1$dpx %1$dpx 0;',
478
- 'float:none;margin:%1$dpx 0 %1$dpx 0;text-align:center;',
479
- 'float:right;margin:%1$dpx 0 %1$dpx %1$dpx;',
480
- 'float:none;margin:0px;');
481
-
482
- $adsalign = $quads_options['ad' . $id]['align'];
483
- $adsmargin = isset($quads_options['ad' . $id]['margin']) ? $quads_options['ad' . $id]['margin'] : '3'; // default
484
- $margin = sprintf($arr[(int)$adsalign], $adsmargin);
485
-
486
- // Do not create any inline style on AMP site
487
- $style = !quads_is_amp_endpoint() ? apply_filters ('quads_filter_margins', $margin, 'ad'.$id ) : '';
488
- $adscode = $quads_options['ad' . $id ]['code'];
489
-
490
- $adscode =
491
- "\n".'<!-- WP QUADS Content Ad Plugin v. ' . QUADS_VERSION .' -->'."\n".
492
- '<div class="quads-location quads-ad' .$id. '" id="quads-ad' .$id. '" style="'.$style.'">'."\n".
493
- quads_render_ad('ad'.$id, $adscode)."\n".
494
- '</div>'. "\n";
495
-
496
- } else {
497
- $adscode ='';
498
- }
499
- $cont = explode('<!--'.$nme.'-->', $content, 2);
500
-
501
- return $cont[0].$adscode.$cont[1];
502
- }
503
 
504
  /**
505
  * Remove element from array
506
  *
507
- * @param array $array
508
  * @param int $idx key to remove from array
509
  * @return array
510
  */
511
- function quads_del_element($array, $idx) {
512
  $copy = array();
513
- for( $i=0; $i<count($array) ;$i++) {
514
  if ( $idx != $i ) {
515
- array_push($copy, $array[$i]);
516
  }
517
  }
518
  return $copy;
16
  add_filter('the_content', 'quads_post_settings_to_quicktags', 5);
17
  add_filter('the_content', 'quads_process_content', quads_get_load_priority());
18
 
19
+
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  /**
22
  * Adds quicktags, defined via post meta options, to content.
65
  return $str;
66
  }
67
 
68
+ /**
69
+ * Get load priority
70
+ *
71
+ * @global arr $quads_options
72
+ * @return int
73
+ */
74
+ function quads_get_load_priority(){
75
+ global $quads_options;
76
+
77
+ if (!empty($quads_options['priority'])){
78
+ return intval($quads_options['priority']);
79
+ }
80
+ return 20;
81
+ }
82
+
83
+ /**
84
+ *
85
+ * @global arr $quads_options
86
+ * @global type $adsArray
87
+ * @param type $content
88
+ * @return type
89
+ */
90
+ function quads_process_content( $content ) {
91
+ global $quads_options, $adsArray, $adsArrayCus, $visibleContentAds, $ad_count_widget, $visibleShortcodeAds;
92
+
93
+ // Do not do anything if ads are not allowed
94
+ if( !quads_ad_is_allowed( $content ) ) {
95
+ $content = quads_clean_tags( $content );
96
+ return $content;
97
+ }
98
+
99
+ // Do nothing if maximum ads are reached in post content
100
+ if( $visibleContentAds >= quads_get_max_allowed_post_ads( $content ) ) {
101
+ $content = quads_clean_tags( $content );
102
+ return $content;
103
+ }
104
+
105
+ // placeholder string for random ad
106
+ $cusrnd = 'CusRnd';
107
+
108
+ // placeholder string for custom ad spots
109
+ $cusads = 'CusAds';
110
+
111
+ // Array of ad codes ids
112
+ $adsArray = quads_get_active_ads();
113
+
114
+ $content = quads_sanitize_content( $content );
115
+
116
+ $content = quads_filter_default_ads( $content );
117
+
118
+ //wp_die($content);
119
+ /*
120
+ * Tidy up content
121
+ */
122
+ $content = '<!--EmptyClear-->' . $content . "\n" . '<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>';
123
+ $content = quads_clean_tags( $content, true );
124
+
125
+ $content = quads_parse_default_ads($content);
126
+
127
+ $content = quads_parse_quicktags( $content );
128
+
129
+ $content = quads_parse_random_quicktag_ads($content);
130
+
131
+ $content = quads_parse_random_ads( $content );
132
+
133
+ /* ... That's it. DONE :) ... */
134
+ $content = quads_clean_tags( $content );
135
+ // Reset ad_count - Important!!!
136
+ $visibleContentAdsGlobal = 0;
137
+ return do_shortcode( $content );
138
+ }
139
+
140
+
141
+ /**
142
+ * Return number of active widget ads
143
+ * @param string the_content
144
+ * @return int amount of widget ads
145
+ */
146
+ function quads_get_number_widget_ads() {
147
+ $number_widgets = 0;
148
+ $maxWidgets = 10;
149
+ // count active widget ads
150
+ for ( $i = 1; $i <= $maxWidgets; $i++ ) {
151
+ $AdsWidName = 'AdsWidget%d (Quick Adsense Reloaded)';
152
+ $wadsid = sanitize_title( str_replace( array('(', ')'), '', sprintf( $AdsWidName, $i ) ) );
153
+ $number_widgets += (is_active_widget( '', '', $wadsid )) ? 1 : 0;
154
+ }
155
+
156
+ return $number_widgets;
157
+ }
158
+
159
+ /**
160
+ * Get list of valid ad ids's where either the plain text code field or the adsense ad slot and the ad client id is populated.
161
+ * @global arr $quads_options
162
+ */
163
+ function quads_get_active_ads() {
164
+ global $quads_options;
165
+
166
+ // Max amount of different content ads we can have
167
+ $numberAds = 10;
168
+
169
+ $adsArray = array();
170
+
171
+
172
+ // Array of ad codes
173
+ for ( $i = 1; $i <= $numberAds; $i++ ) {
174
+ $tmp = isset( $quads_options['ad' . $i]['code'] ) ? trim( $quads_options['ad' . $i]['code'] ) : '';
175
+ // id is valid if there is either the plain text field populated or the adsense ad slot and the ad client id
176
+ if( !empty( $tmp ) || (!empty( $quads_options['ad' . $i]['g_data_ad_slot'] ) && !empty( $quads_options['ad' . $i]['g_data_ad_client'] ) ) ) {
177
+ $adsArray[] = $i;
178
+ }
179
+ }
180
+ //wp_die(count($adsArray));
181
+ return (count($adsArray) > 0) ? $adsArray : 0;
182
+ }
183
+
184
+ /**
185
+ * Get complete array of valid ads
186
+ * @global arr $quads_options
187
+ */
188
+ function quads_get_ad_content() {
189
+ global $quads_options;
190
+
191
+ // Max amount of different content ads we can have
192
+ $numberAds = 10;
193
+
194
+ $adsArray = array();
195
+
196
+ // Array of ad codes
197
+ for ( $i = 1; $i <= $numberAds; $i++ ) {
198
+ $tmp = isset( $quads_options['ad' . $i]['code'] ) ? trim( $quads_options['ad' . $i]['code'] ) : '';
199
+ // id is valid if there is either the plain text field populated or the adsense ad slot and the ad client id
200
+ if( !empty( $tmp ) || (!empty( $quads_options['ad' . $i]['g_data_ad_slot'] ) && !empty( $quads_options['ad' . $i]['g_data_ad_client'] ) ) ) {
201
+ $adsArray[] = $quads_options['ad' . $i];
202
+ }
203
+ }
204
+
205
+ return count($adsArray) ? $adsArray : 0;
206
+ }
207
+
208
+
209
+ /**
210
+ * Get max allowed numbers of ads
211
+ *
212
+ * @param string $content
213
+ * @return int maximum number of ads
214
+ */
215
+ function quads_get_max_allowed_post_ads( $content ) {
216
+ global $quads_options;
217
+
218
+ // Maximum allowed general number of ads
219
+ $maxAds = isset( $quads_options['maxads'] ) ? $quads_options['maxads'] : 10;
220
+
221
+ $numberWidgets = 10;
222
+
223
+ $AdsWidName = 'AdsWidget%d (Quick Adsense Reloaded)';
224
+
225
+ // count number of active widgets and subtract them
226
+ if( strpos( $content, '<!--OffWidget-->' ) === false ) {
227
+ for ( $i = 1; $i <= $numberWidgets; $i++ ) {
228
+ $wadsid = sanitize_title( str_replace( array('(', ')'), '', sprintf( $AdsWidName, $i ) ) );
229
+ $maxAds -= (is_active_widget( '', '', $wadsid )) ? 1 : 0;
230
+ }
231
+ }
232
+ return $maxAds;
233
+ }
234
+
235
+
236
+ /**
237
+ * Filter default ads
238
+ *
239
+ * @global array $quads_options global settings
240
+ * @global array $adsArrayCus List of ad id'S
241
+ * @param string $content
242
+ * @return string content
243
+ */
244
+ function quads_filter_default_ads( $content ) {
245
+ global $quads_options, $adsArrayCus;
246
+
247
+ $off_default_ads = (strpos( $content, '<!--OffDef-->' ) !== false);
248
+
249
+ if( $off_default_ads ) { // If default ads are disabled
250
+ return $content;
251
+ }
252
+
253
+ // Default Ads
254
+ $adsArrayCus = array();
255
+
256
+ // placeholder string for random ad
257
+ $cusrnd = 'CusRnd';
258
+
259
+ // placeholder string for custom ad spots
260
+ $cusads = 'CusAds';
261
+
262
+ // Beginning of Post
263
+ $beginning_position_status = isset( $quads_options['pos1']['BegnAds'] ) ? true : false;
264
+ $beginning_position_ad_id = isset( $quads_options['pos1']['BegnRnd'] ) ? $quads_options['pos1']['BegnRnd'] : 0;
265
+
266
+ // Middle of Post
267
+ $middle_position_status = isset( $quads_options['pos2']['MiddAds'] ) ? true : false;
268
+ $middle_position_ad_id = isset( $quads_options['pos2']['MiddRnd'] ) ? $quads_options['pos2']['MiddRnd'] : 0;
269
+
270
+ // End of Post
271
+ $end_position_status = isset( $quads_options['pos3']['EndiAds'] ) ? true : false;
272
+ $end_position_ad_id = isset( $quads_options['pos3']['EndiRnd'] ) ? $quads_options['pos3']['EndiRnd'] : 0;
273
+
274
+ // After the more tag
275
+ $more_position_status = isset( $quads_options['pos4']['MoreAds'] ) ? true : false;
276
+ $more_position_ad_id = isset( $quads_options['pos4']['MoreRnd'] ) ? $quads_options['pos4']['MoreRnd'] : 0;
277
+
278
+ // Right before the last paragraph
279
+ $last_paragraph_position_status = isset( $quads_options['pos5']['LapaAds'] ) ? true : false;
280
+ $last_paragraph_position_ad_id = isset( $quads_options['pos5']['LapaRnd'] ) ? $quads_options['pos5']['LapaRnd'] : 0;
281
+
282
+ // After Paragraph option 1 - 3
283
+ $number = 3; // number of paragraph ads | default value 3.
284
+ $default = 5; // Position. Let's start with id 5
285
+ for ( $i = 1; $i <= $number; $i++ ) {
286
+ $key = $default + $i; // 6,7,8
287
+
288
+ $paragraph['status'][$i] = isset( $quads_options['pos' . $key]['Par' . $i . 'Ads'] ) ? $quads_options['pos' . $key]['Par' . $i . 'Ads'] : 0; // Status - active | inactive
289
+ $paragraph['id'][$i] = isset( $quads_options['pos' . $key]['Par' . $i . 'Rnd'] ) ? $quads_options['pos' . $key]['Par' . $i . 'Rnd'] : 0; // Ad id
290
+ $paragraph['position'][$i] = isset( $quads_options['pos' . $key]['Par' . $i . 'Nup'] ) ? $quads_options['pos' . $key]['Par' . $i . 'Nup'] : 0; // Paragraph No
291
+ $paragraph['end_post'][$i] = isset( $quads_options['pos' . $key]['Par' . $i . 'Con'] ) ? $quads_options['pos' . $key]['Par' . $i . 'Con'] : 0; // End of post - yes | no
292
+ }
293
+ // After Image ad
294
+ $imageActive = isset( $quads_options['pos9']['Img1Ads'] ) ? $quads_options['pos9']['Img1Ads'] : false;
295
+ $imageAdNo = isset( $quads_options['pos9']['Img1Rnd'] ) ? $quads_options['pos9']['Img1Rnd'] : false;
296
+ $imageNo = isset( $quads_options['pos9']['Img1Nup'] ) ? $quads_options['pos9']['Img1Nup'] : false;
297
+ $imageCaption = isset( $quads_options['pos9']['Img1Con'] ) ? $quads_options['pos9']['Img1Con'] : false;
298
+
299
+
300
+ if( $beginning_position_ad_id == 0 ) {
301
+ $b1 = $cusrnd;
302
+ } else {
303
+ $b1 = $cusads . $beginning_position_ad_id;
304
+ array_push( $adsArrayCus, $beginning_position_ad_id );
305
+ };
306
+
307
+ if( $more_position_ad_id == 0 ) {
308
+ $r1 = $cusrnd;
309
+ } else {
310
+ $r1 = $cusads . $more_position_ad_id;
311
+ array_push( $adsArrayCus, $more_position_ad_id );
312
+ };
313
+
314
+ if( $middle_position_ad_id == 0 ) {
315
+ $m1 = $cusrnd;
316
+ } else {
317
+ $m1 = $cusads . $middle_position_ad_id;
318
+ array_push( $adsArrayCus, $middle_position_ad_id );
319
+ };
320
+ if( $last_paragraph_position_ad_id == 0 ) {
321
+ $g1 = $cusrnd;
322
+ } else {
323
+ $g1 = $cusads . $last_paragraph_position_ad_id;
324
+ array_push( $adsArrayCus, $last_paragraph_position_ad_id );
325
+ };
326
+ if( $end_position_ad_id == 0 ) {
327
+ $b2 = $cusrnd;
328
+ } else {
329
+ $b2 = $cusads . $end_position_ad_id;
330
+ array_push( $adsArrayCus, $end_position_ad_id );
331
+ };
332
+ for ( $i = 1; $i <= $number; $i++ ) {
333
+ if( $paragraph['id'][$i] == 0 ) {
334
+ $paragraph[$i] = $cusrnd;
335
+ } else {
336
+ $paragraph[$i] = $cusads . $paragraph['id'][$i];
337
+ array_push( $adsArrayCus, $paragraph['id'][$i] );
338
+ };
339
+ }
340
+ //wp_die(print_r($adsArrayCus));
341
+
342
+ // Create the arguments for filter quads_filter_paragraphs
343
+ $quads_args = array(
344
+ 'paragraph' => $paragraph,
345
+ 'cusads' => $cusads,
346
+ 'cusrnd' => $cusrnd,
347
+ 'AdsIdCus' => $adsArrayCus,
348
+ );
349
+
350
+ // Execute filter to add more paragraph ad spots
351
+ $quads_filtered = apply_filters( 'quads_filter_paragraphs', $quads_args );
352
+
353
+ // The filtered arguments
354
+ $paragraph = $quads_filtered['paragraph'];
355
+
356
+ // filtered list of ad spots
357
+ $adsArrayCus = $quads_filtered['AdsIdCus'];
358
+
359
+ // Create paragraph ads
360
+ $number = 6;
361
+ //$number = 3;
362
+ for ( $i = $number; $i >= 1; $i-- ) {
363
+ if( !empty( $paragraph['status'][$i] ) ) {
364
+ $sch = "</p>";
365
+ $content = str_replace( "</P>", $sch, $content );
366
+ // paragraphs in content
367
+ $paragraphsArray = explode( $sch, $content );
368
+ if( ( int ) $paragraph['position'][$i] < count( $paragraphsArray ) ) {
369
+ $content = implode( $sch, array_slice( $paragraphsArray, 0, $paragraph['position'][$i] ) ) . $sch . '<!--' . $paragraph[$i] . '-->' . implode( $sch, array_slice( $paragraphsArray, $paragraph['position'][$i] ) );
370
+ } elseif( $paragraph['end_post'][$i] ) {
371
+ $content = implode( $sch, $paragraphsArray ) . '<!--' . $paragraph[$i] . '-->';
372
+ }
373
+ }
374
+ }
375
+
376
+ // Check if image ad is random one
377
+ if( $imageAdNo == 0 ) {
378
+ $imageAd = $cusrnd;
379
+ } else {
380
+ $imageAd = $cusads . $imageAdNo;
381
+ array_push( $adsArrayCus, $imageAdNo );
382
+ };
383
+
384
+
385
+ // Beginning of post ad
386
+ if( $beginning_position_status && strpos( $content, '<!--OffBegin-->' ) === false ) {
387
+ $content = '<!--' . $b1 . '-->' . $content;
388
+ }
389
+
390
+ // Check if ad is middle one
391
+ if( $middle_position_status && strpos( $content, '<!--OffMiddle-->' ) === false ) {
392
+ if( substr_count( strtolower( $content ), '</p>' ) >= 2 ) {
393
+ $sch = "</p>";
394
+ $content = str_replace( "</P>", $sch, $content );
395
+ $paragraphsArray = explode( $sch, $content );
396
+ $nn = 0;
397
+ $mm = strlen( $content ) / 2;
398
+ for ( $i = 0; $i < count( $paragraphsArray ); $i++ ) {
399
+ $nn += strlen( $paragraphsArray[$i] ) + 4;
400
+ if( $nn > $mm ) {
401
+ if( ($mm - ($nn - strlen( $paragraphsArray[$i] ))) > ($nn - $mm) && $i + 1 < count( $paragraphsArray ) ) {
402
+ $paragraphsArray[$i + 1] = '<!--' . $m1 . '-->' . $paragraphsArray[$i + 1];
403
+ } else {
404
+ $paragraphsArray[$i] = '<!--' . $m1 . '-->' . $paragraphsArray[$i];
405
+ }
406
+ break;
407
+ }
408
+ }
409
+ $content = implode( $sch, $paragraphsArray );
410
+ }
411
+ }
412
+
413
+ // End of Post ad
414
+ if( $end_position_status && strpos( $content, '<!--OffEnd-->' ) === false ) {
415
+ $content = $content . '<!--' . $b2 . '-->';
416
+ }
417
+
418
+
419
+
420
+ // Check if ad is after "More Tag"
421
+ if( $more_position_status && strpos( $content, '<!--OffAfMore-->' ) === false ) {
422
+ $mmr = '<!--' . $r1 . '-->';
423
+ $postid = get_the_ID();
424
+ $content = str_replace( '<span id="more-' . $postid . '"></span>', $mmr, $content );
425
+ }
426
+
427
+ // Right after last paragraph ad
428
+ if( $last_paragraph_position_status && strpos( $content, '<!--OffBfLastPara-->' ) === false ) {
429
+ $sch = "<p>";
430
+ $content = str_replace( "<P>", $sch, $content );
431
+ $paragraphsArray = explode( $sch, $content );
432
+ if( count( $paragraphsArray ) > 2 ) {
433
+ $content = implode( $sch, array_slice( $paragraphsArray, 0, count( $paragraphsArray ) - 1 ) ) . '<!--' . $g1 . '-->' . $sch . $paragraphsArray[count( $paragraphsArray ) - 1];
434
+ }
435
+ }
436
+
437
+ // After Image ad
438
+ if( $imageActive ) {
439
+
440
+ // Sanitation
441
+ $imgtag = "<img";
442
+ $delimiter = ">";
443
+ $caption = "[/caption]";
444
+ $atag = "</a>";
445
+ $content = str_replace( "<IMG", $imgtag, $content );
446
+ $content = str_replace( "</A>", $atag, $content );
447
+
448
+ // Start
449
+ $paragraphsArray = explode( $imgtag, $content );
450
+ if( ( int ) $imageNo < count( $paragraphsArray ) ) {
451
+ $paragraphsArrayImages = explode( $delimiter, $paragraphsArray[$imageNo] );
452
+ if( count( $paragraphsArrayImages ) > 1 ) {
453
+ $tss = explode( $caption, $paragraphsArray[$imageNo] );
454
+ $ccp = ( count( $tss ) > 1 ) ? strpos( strtolower( $tss[0] ), '[caption ' ) === false : false;
455
+ $paragraphsArrayAtag = explode( $atag, $paragraphsArray[$imageNo] );
456
+ $cdu = ( count( $paragraphsArrayAtag ) > 1 ) ? strpos( strtolower( $paragraphsArrayAtag[0] ), '<a href' ) === false : false;
457
+ if( $imageCaption && $ccp ) {
458
+ $paragraphsArray[$imageNo] = implode( $caption, array_slice( $tss, 0, 1 ) ) . $caption . "\r\n" . '<!--' . $imageAd . '-->' . "\r\n" . implode( $caption, array_slice( $tss, 1 ) );
459
+ } else if( $cdu ) {
460
+ $paragraphsArray[$imageNo] = implode( $atag, array_slice( $paragraphsArrayAtag, 0, 1 ) ) . $atag . "\r\n" . '<!--' . $imageAd . '-->' . "\r\n" . implode( $atag, array_slice( $paragraphsArrayAtag, 1 ) );
461
+ } else {
462
+ $paragraphsArray[$imageNo] = implode( $delimiter, array_slice( $paragraphsArrayImages, 0, 1 ) ) . $delimiter . "\r\n" . '<!--' . $imageAd . '-->' . "\r\n" . implode( $delimiter, array_slice( $paragraphsArrayImages, 1 ) );
463
+ }
464
+ }
465
+ $content = implode( $imgtag, $paragraphsArray );
466
+ }
467
+ }
468
+
469
+ return $content;
470
+ }
471
+ /**
472
+ * Sanitize content and return it cleaned
473
+ *
474
+ * @param string $content
475
+ * @return string
476
+ */
477
+ function quads_sanitize_content($content){
478
+
479
+ /* ... Tidy up content ... */
480
+ // Replace all <p></p> tags with placeholder ##QA-TP1##
481
+ $content = str_replace( "<p></p>", "##QA-TP1##", $content );
482
+
483
+ // Replace all <p>&nbsp;</p> tags with placeholder ##QA-TP2##
484
+ $content = str_replace( "<p>&nbsp;</p>", "##QA-TP2##", $content );
485
+
486
+ return $content;
487
+ }
488
+
489
+
490
+
491
+ /**
492
+ * Parse random ads which are created from quicktag <!--RndAds-->
493
+ *
494
+ * @global array $adsArray
495
+ * @global int $visibleContentAds
496
+ * @return content
497
+ */
498
+ function quads_parse_random_quicktag_ads($content){
499
+ global $adsArray, $visibleContentAds, $quads_options;
500
+
501
+ $maxAds = isset($quads_options['maxads']) ? $quads_options['maxads'] : 10;
502
+ /*
503
+ * Replace RndAds Random Ads
504
+ */
505
+ if( strpos( $content, '<!--RndAds-->' ) !== false && is_singular() ) {
506
+ $adsArrayTmp = array();
507
+ shuffle( $adsArray );
508
+ for ( $i = 1; $i <= $maxAds - $visibleContentAds; $i++ ) {
509
+ if( $i <= count( $adsArray ) ) {
510
+ array_push( $adsArrayTmp, $adsArray[$i - 1] );
511
+ }
512
+ }
513
+ $tcx = count( $adsArrayTmp );
514
+ $tcy = substr_count( $content, '<!--RndAds-->' );
515
+ for ( $i = $tcx; $i <= $tcy - 1; $i++ ) {
516
+ array_push( $adsArrayTmp, -1 );
517
+ }
518
+ shuffle( $adsArrayTmp );
519
+ for ( $i = 1; $i <= $tcy; $i++ ) {
520
+ $tmp = $adsArrayTmp[0];
521
+ $content = quads_replace_ads( $content, 'RndAds', $adsArrayTmp[0] );
522
+ $adsArrayTmp = quads_del_element( $adsArrayTmp, 0 );
523
+ if( $tmp != -1 ) {
524
+ $visibleContentAds += 1;
525
+ };
526
+ //quads_set_ad_count_content();
527
+ //if( quads_ad_reach_max_count() ) {
528
+ if( $visibleContentAds >= quads_get_max_allowed_post_ads( $content ) ) {
529
+ $content = quads_clean_tags( $content );
530
+ return $content;
531
+ }
532
+ }
533
+ }
534
+
535
+ return $content;
536
+ }
537
+
538
+ /**
539
+ * Parse random default ads which can be enabled from general settings
540
+ *
541
+ * @global array $adsArray
542
+ * @global int $visibleContentAds
543
+ * @return string
544
+ */
545
+ function quads_parse_random_ads($content) {
546
+ global $adsArray, $adsRandom, $visibleContentAds;
547
+
548
+ $off_default_ads = (strpos( $content, '<!--OffDef-->' ) !== false);
549
+ if( $off_default_ads ) { // disabled default ads
550
+ return $content;
551
+ }
552
+
553
+ if( strpos( $content, '<!--CusRnd-->' ) !== false && is_singular() ) {
554
+
555
+ $tcx = count( $adsRandom );
556
+ $tcy = substr_count( $content, '<!--CusRnd-->' );
557
+
558
+ for ( $i = $tcx; $i <= $tcy - 1; $i++ ) {
559
+ array_push( $adsArray, -1 );
560
+ }
561
+ shuffle( $adsRandom );
562
+ for ( $i = 1; $i <= $tcy; $i++ ) {
563
+ $content = quads_replace_ads( $content, 'CusRnd', $adsRandom[0] );
564
+ $adsRandom = quads_del_element( $adsRandom, 0 );
565
+ $visibleContentAds += 1;
566
+ //quads_set_ad_count_content();
567
+ //if( quads_ad_reach_max_count() ) {
568
+ if( $visibleContentAds >= quads_get_max_allowed_post_ads( $content ) ) {
569
+ $content = quads_clean_tags( $content );
570
+ return $content;
571
+ }
572
+ }
573
+ }
574
+
575
+ return $content;
576
+ }
577
+
578
+ /**
579
+ * Parse Quicktags
580
+ *
581
+ * @global array $adsArray
582
+ * @param string $content
583
+ * @return string
584
+ */
585
+ function quads_parse_quicktags($content){
586
+ global $adsArray, $visibleContentAds;
587
+
588
+ $idx = 0;
589
+ for ( $i = 1; $i <= count( $adsArray ); $i++ ) {
590
+ if( strpos( $content, '<!--Ads' . $adsArray[$idx] . '-->' ) !== false ) {
591
+ $content = quads_replace_ads( $content, 'Ads' . $adsArray[$idx], $adsArray[$idx] );
592
+ $adsArray = quads_del_element( $adsArray, $idx );
593
+ $visibleContentAds += 1;
594
+ //quads_set_ad_count_content();
595
+ //if( quads_ad_reach_max_count() ) {
596
+ if( $visibleContentAds >= quads_get_max_allowed_post_ads( $content ) ) {
597
+ $content = quads_clean_tags( $content );
598
+ return $content;
599
+ }
600
+ } else {
601
+ $idx += 1;
602
+ }
603
+ }
604
+
605
+ return $content;
606
+ }
607
+
608
+ /**
609
+ * Parse default ads Beginning/Middle/End/Paragraph Ads1-10
610
+ *
611
+ * @param string $content
612
+ * @return string
613
+ */
614
+ function quads_parse_default_ads( $content ) {
615
+ global $adsArrayCus, $adsRandom, $adsArray, $visibleContentAds;
616
+
617
+ $off_default_ads = (strpos( $content, '<!--OffDef-->' ) !== false);
618
+
619
+ if( $off_default_ads ) { // disabled default ads
620
+ return $content;
621
+ }
622
+ // Create the array which contains the random ads
623
+ $adsRandom = $adsArray;
624
+
625
+ // echo '<pre>';
626
+ // echo 'adsArrayCus';
627
+ // print_r($adsArrayCus);
628
+ // echo 'adsArray';
629
+ // print_r( $adsArray );
630
+ // echo '</pre>';
631
+
632
+ for ( $i = 0; $i <= count( $adsArrayCus ); $i++ ) {
633
+ if( isset( $adsArrayCus[$i] ) && strpos( $content, '<!--CusAds' . $adsArrayCus[$i] . '-->' ) !== false && in_array( $adsArrayCus[$i], $adsArray ) ) {
634
+ $content = quads_replace_ads( $content, 'CusAds' . $adsArrayCus[$i], $adsArrayCus[$i] );
635
+ // Create array $adsRandom for quads_parse_random_ads() parsing functions to make sure that the random function
636
+ // is never using ads that are already used on static ad spots which are generated with quads_parse_default_ads()
637
+ if ($i == 0){
638
+ $adsRandom = quads_del_element($adsRandom, array_search($adsArrayCus[$i], $adsRandom));
639
+ }else{
640
+ $adsRandom = quads_del_element($adsRandom, array_search($adsArrayCus[$i-1], $adsRandom));
641
+ }
642
+
643
+ $visibleContentAds += 1;
644
+ //quads_set_ad_count_content();
645
+ //if( quads_ad_reach_max_count() || $visibleContentAds >= quads_get_max_allowed_post_ads( $content ) ) {
646
+ //wp_die(quads_get_max_allowed_post_ads( $content ));
647
+ if( $visibleContentAds >= quads_get_max_allowed_post_ads( $content ) ) {
648
+ $content = quads_clean_tags( $content );
649
+ }
650
+ }
651
+ }
652
+ return $content;
653
+ }
654
+
655
+ /**
656
+ * Replace ad code in content
657
+ *
658
+ * @global type $quads_options
659
+ * @param string $content
660
+ * @param string $quicktag Quicktag
661
+ * @param string $id id of the ad
662
+ * @return type
663
+ */
664
+ function quads_replace_ads($content, $quicktag, $id) {
665
+ global $quads_options;
666
+
667
+
668
+ if( strpos($content,'<!--'.$quicktag.'-->')===false ) {
669
+ return $content;
670
+ }
671
+
672
+ if ($id != -1) {
673
+ $paragraphsArray = array(
674
+ 'float:left;margin:%1$dpx %1$dpx %1$dpx 0;',
675
+ 'float:none;margin:%1$dpx 0 %1$dpx 0;text-align:center;',
676
+ 'float:right;margin:%1$dpx 0 %1$dpx %1$dpx;',
677
+ 'float:none;margin:0px;');
678
+
679
+ $adsalign = $quads_options['ad' . $id]['align'];
680
+ $adsmargin = isset($quads_options['ad' . $id]['margin']) ? $quads_options['ad' . $id]['margin'] : '3'; // default
681
+ $margin = sprintf($paragraphsArray[(int)$adsalign], $adsmargin);
682
+
683
+ // Do not create any inline style on AMP site
684
+ $style = !quads_is_amp_endpoint() ? apply_filters ('quads_filter_margins', $margin, 'ad'.$id ) : '';
685
+ $adscode = $quads_options['ad' . $id ]['code'];
686
+
687
+ $adscode =
688
+ "\n".'<!-- WP QUADS Content Ad Plugin v. ' . QUADS_VERSION .' -->'."\n".
689
+ '<div class="quads-location quads-ad' .$id. '" id="quads-ad' .$id. '" style="'.$style.'">'."\n".
690
+ quads_render_ad('ad'.$id, $adscode)."\n".
691
+ '</div>'. "\n";
692
+
693
+ } else {
694
+ $adscode ='';
695
+ }
696
+ $cont = explode('<!--'.$quicktag.'-->', $content, 2);
697
+
698
+ return $cont[0].$adscode.$cont[1];
699
+ }
700
+
701
  /**
702
  * Main processing for the_content filter
703
  *
704
  * @global arr $quads_options all plugin settings
705
  * @global int $visibleContentAds number of active content ads (reseted internally so we have to use a similar global below for external purposes: $visibleContentAdsGlobal)
706
+ * @global arr $adsArray Whitespace trimmed array of ad codes
707
+ * @global int $maxWidgets maximum number of ad widgets
708
+ * @global int $maxAds number of maximum available ads
709
  * @global string $AdsWidName name of widget
710
+ * @global int $visibleContentAdsGlobal number of active content ads
711
  * @global int $visibleShortcodeAds number of active shortcode ads
712
+ * @global int $ad_count_widget number of active widget ads
713
  * @param string $content
714
  *
715
  * @return string
717
  * @since 0.9.0
718
  */
719
 
720
+ function quads_process_content_old($content){
721
+ global $quads_options, $visibleContentAds, $adsArray, $maxWidgets, $maxAds, $AdsWidName, $visibleContentAdsGlobal, $visibleShortcodeAds, $ad_count_widget;
722
 
723
  // Return original content if QUADS is not allowed
724
  if ( !quads_ad_is_allowed($content) ) {
728
  // Maximum allowed ads
729
  $maxAds = isset($quads_options['maxads']) ? $quads_options['maxads'] : 10;
730
 
731
+ // count active widget ads
732
  if (strpos($content,'<!--OffWidget-->')===false) {
733
+ for($i=1;$i<=$maxWidgets;$i++) {
734
  $wadsid = sanitize_title(str_replace(array('(',')'),'',sprintf($AdsWidName,$i)));
735
+ //$maxAds -= (is_active_widget('', '', $wadsid)) ? 1 : 0 ;
736
+ $ad_count_widget += (is_active_widget('', '', $wadsid)) ? 1 : 0 ;
737
  }
738
  }
739
 
740
  // Return here if max visible ads are exceeded
741
+ if( $visibleContentAds+$visibleShortcodeAds+$ad_count_widget >= $maxAds ) { // ShownAds === 0 or larger/equal than $maxAds
742
  $content = quads_clean_tags($content);
743
  return $content;
744
  };
745
 
746
  // Create array of valid id's
747
+ if( count( $adsArray ) === 0 ) { //
748
+ for ( $i = 1; $i <= $maxAds; $i++ ) {
749
  $tmp = isset($quads_options['ad' . $i]['code']) ? trim( $quads_options['ad' . $i]['code'] ) : '';
750
  // id is valid if there is either the plain text field populated or the adsense ad slot and the ad client id
751
  if( !empty( $tmp ) || (!empty($quads_options['ad' . $i]['g_data_ad_slot']) && !empty($quads_options['ad' . $i]['g_data_ad_client'] ) ) ) {
752
+ $adsArray[] = $i;
753
  }
754
  }
 
 
755
  }
756
 
757
  // Ad code array is empty so break here
758
+ if( count($adsArray) === 0 ) {
759
  $content = quads_clean_tags($content);
760
  return $content;
761
  };
762
 
763
  /* ... Tidy up content ... */
764
  // Replace all <p></p> tags with placeholder ##QA-TP1##
 
765
  $content = str_replace("<p></p>", "##QA-TP1##", $content);
766
+
767
  // Replace all <p>&nbsp;</p> tags with placeholder ##QA-TP2##
768
+ $content = str_replace("<p>&nbsp;</p>", "##QA-TP2##", $content);
 
769
 
770
+ $off_default_ads = (strpos($content,'<!--OffDef-->')!==false);
771
+ if( !$off_default_ads ) { // disabled default positioned ads
772
 
773
+ $adsArrayCus = array(); // ids of used ads
774
+
775
+ $cusrnd = 'CusRnd'; // placeholder string for random ad
776
+ $cusads = 'CusAds'; // placeholder string for custom ad spots
777
 
778
+ $beginning_position_status = isset($quads_options['pos1']['BegnAds']) ? true : false;
779
+ $beginning_position_ad_id = isset($quads_options['pos1']['BegnRnd']) ? $quads_options['pos1']['BegnRnd'] : 0;
780
 
781
+ $middle_position_status = isset($quads_options['pos2']['MiddAds']) ? true : false;
782
+ $middle_position_ad_id = isset($quads_options['pos2']['MiddRnd']) ? $quads_options['pos2']['MiddRnd'] : 0;
783
 
784
+ $end_position_status = isset($quads_options['pos3']['EndiAds']) ? true : false;
785
+ $end_position_ad_id = isset($quads_options['pos3']['EndiRnd']) ? $quads_options['pos3']['EndiRnd'] : 0;
786
 
787
+ $more_position_status = isset($quads_options['pos4']['MoreAds']) ? true : false;
788
+ $more_position_ad_id = isset($quads_options['pos4']['MoreRnd']) ? $quads_options['pos4']['MoreRnd'] : 0;
789
 
790
+ $last_paragraph_position_status = isset($quads_options['pos5']['LapaAds']) ? true : false;
791
+ $last_paragraph_position_ad_id = isset($quads_options['pos5']['LapaRnd'])? $quads_options['pos5']['LapaRnd'] : 0 ;
792
 
793
 
 
 
 
794
 
795
+ $number = 3; // number of paragraph ads | default value 3.
796
+ $default = 5; // Position. Let's start with id 5
797
+ for($i=1;$i<=$number;$i++) {
798
+
799
+ $key = $default +$i; // 6,7,8
800
 
801
+ $paragraph['status'][$i] = isset($quads_options['pos' . $key]['Par'.$i .'Ads']) ? $quads_options['pos' . $key]['Par'.$i .'Ads'] : 0; // Status - active | inactive
802
+ $paragraph['id'][$i] = isset($quads_options['pos' . $key]['Par'.$i .'Rnd']) ? $quads_options['pos' . $key]['Par'.$i .'Rnd'] : 0; // Ad id
803
+ $paragraph['position'][$i] = isset($quads_options['pos' . $key]['Par'.$i .'Nup']) ? $quads_options['pos' . $key]['Par'.$i .'Nup'] : 0; // Paragraph No
804
+ $paragraph['end_post'][$i] = isset($quads_options['pos' . $key]['Par'.$i .'Con']) ? $quads_options['pos' . $key]['Par'.$i .'Con'] : 0; // End of post - yes | no
805
 
806
  }
807
+ // Position 9 Ad after Image
808
  $imageActive = isset($quads_options['pos9']['Img1Ads']) ? $quads_options['pos9']['Img1Ads'] : false;
809
  $imageAdNo = isset($quads_options['pos9']['Img1Rnd']) ? $quads_options['pos9']['Img1Rnd'] : false;
810
  $imageNo = isset($quads_options['pos9']['Img1Nup']) ? $quads_options['pos9']['Img1Nup'] : false;
811
  $imageCaption = isset($quads_options['pos9']['Img1Con']) ? $quads_options['pos9']['Img1Con'] : false;
812
 
813
 
814
+ if ( $beginning_position_ad_id == 0 ) { $b1 = $cusrnd; } else { $b1 = $cusads.$beginning_position_ad_id; array_push($adsArrayCus, $beginning_position_ad_id); };
815
+ if ( $more_position_ad_id == 0 ) { $r1 = $cusrnd; } else { $r1 = $cusads.$more_position_ad_id; array_push($adsArrayCus, $more_position_ad_id); };
816
+ if ( $middle_position_ad_id == 0 ) { $m1 = $cusrnd; } else { $m1 = $cusads.$middle_position_ad_id; array_push($adsArrayCus, $middle_position_ad_id); };
817
+ if ( $last_paragraph_position_ad_id == 0 ) { $g1 = $cusrnd; } else { $g1 = $cusads.$last_paragraph_position_ad_id; array_push($adsArrayCus, $last_paragraph_position_ad_id); };
818
+ if ( $end_position_ad_id == 0 ) { $b2 = $cusrnd; } else { $b2 = $cusads.$end_position_ad_id; array_push($adsArrayCus, $end_position_ad_id); };
819
 
820
+ for($i=1;$i<=$number;$i++) {
821
+ if ( $paragraph['id'][$i] == 0 ) {
822
+ $paragraph[$i] = $cusrnd;
823
  } else {
824
+ $paragraph[$i] = $cusads.$paragraph['id'][$i];
825
+ array_push($adsArrayCus, $paragraph['id'][$i]);
826
 
827
  };
828
  }
829
 
830
+ // Create the arguments for filter quads_filter_paragraphs
831
+ $quads_args = array (
832
+ 'paragraph' => $paragraph,
833
+ 'cusads' => $cusads,
834
+ 'cusrnd' => $cusrnd,
835
+ 'AdsIdCus' => $adsArrayCus,
836
+
837
+ );
838
+
839
+ // Execute filter to add more paragraph ad spots
840
+ $quads_filtered = apply_filters('quads_filter_paragraphs', $quads_args);
841
+
842
+ // The filtered arguments
843
+ $paragraph = $quads_filtered['paragraph'];
844
+
845
+ // filtered list of ad spots
846
+ $adsArrayCus = $quads_filtered['AdsIdCus'];
847
+
848
+ // Create paragraph ads
849
+ //$number = 6;
850
+ $number = 3;
851
+ for($i=$number;$i>=1;$i--) {
852
+ if ( !empty($paragraph['status'][$i]) ){
853
+
854
+ $sch = "</p>";
855
+ $content = str_replace("</P>", $sch, $content);
856
+ // paragraphs in content
857
+ $paragraphsArray = explode($sch, $content);
858
+ if ( (int)$paragraph['position'][$i] < count($paragraphsArray) ) {
859
+ $content = implode($sch, array_slice($paragraphsArray, 0, $paragraph['position'][$i])).$sch .'<!--'.$paragraph[$i].'-->'. implode($sch, array_slice($paragraphsArray, $paragraph['position'][$i]));
860
+ } elseif ($paragraph['end_post'][$i]) {
861
+ $content = implode($sch, $paragraphsArray).'<!--'.$paragraph[$i].'-->';
862
+ }
863
+ }
864
+ }
865
+
866
+ // Check if image ad is random one
867
  if ( $imageAdNo == 0 ) {
868
+ $imageAd = $cusrnd;
869
  } else {
870
+ $imageAd = $cusads.$imageAdNo;
871
+ array_push($adsArrayCus, $imageAdNo);
872
  };
873
 
874
+ // Check if ad is middle one
875
+ if( $middle_position_status && strpos($content,'<!--OffMiddle-->')===false) {
876
  if( substr_count(strtolower($content), '</p>')>=2 ) {
877
  $sch = "</p>";
878
  $content = str_replace("</P>", $sch, $content);
879
+ $paragraphsArray = explode($sch, $content);
880
  $nn = 0; $mm = strlen($content)/2;
881
+ for($i=0;$i<count($paragraphsArray);$i++) {
882
+ $nn += strlen($paragraphsArray[$i]) + 4;
883
  if($nn>$mm) {
884
+ if( ($mm - ($nn - strlen($paragraphsArray[$i]))) > ($nn - $mm) && $i+1<count($paragraphsArray) ) {
885
+ $paragraphsArray[$i+1] = '<!--'.$m1.'-->'.$paragraphsArray[$i+1];
886
  } else {
887
+ $paragraphsArray[$i] = '<!--'.$m1.'-->'.$paragraphsArray[$i];
888
  }
889
  break;
890
  }
891
  }
892
+ $content = implode($sch, $paragraphsArray);
893
  }
894
  }
895
 
896
+
897
  // Check if image ad is "More Tag" one
898
+ if( $more_position_status && strpos($content,'<!--OffAfMore-->')===false) {
899
  $mmr = '<!--'.$r1.'-->';
900
  $postid = get_the_ID();
901
  $content = str_replace('<span id="more-'.$postid.'"></span>', $mmr, $content);
902
  }
903
 
904
+ if( $beginning_position_status && strpos($content,'<!--OffBegin-->')===false) {
905
  $content = '<!--'.$b1.'-->'.$content;
906
  }
907
+ if( $end_position_status && strpos($content,'<!--OffEnd-->')===false) {
908
  $content = $content.'<!--'.$b2.'-->';
909
  }
910
+ if( $last_paragraph_position_status && strpos($content,'<!--OffBfLastPara-->')===false){
911
  $sch = "<p>";
912
  $content = str_replace("<P>", $sch, $content);
913
+ $paragraphsArray = explode($sch, $content);
914
+ if ( count($paragraphsArray) > 2 ) {
915
+ $content = implode($sch, array_slice($paragraphsArray, 0, count($paragraphsArray)-1)) .'<!--'.$g1.'-->'. $sch. $paragraphsArray[count($paragraphsArray)-1];
916
  }
917
  }
 
 
 
 
 
 
 
 
 
 
 
 
918
 
919
  if ( $imageActive ){
920
 
927
  $content = str_replace("</A>", $atag, $content);
928
 
929
  // Start
930
+ $paragraphsArray = explode($imgtag, $content);
931
+ if ( (int)$imageNo < count($paragraphsArray) ) {
932
+ $paragraphsArrayImages = explode($delimiter, $paragraphsArray[$imageNo]);
933
+ if ( count($paragraphsArrayImages) > 1 ) {
934
+ $tss = explode($caption, $paragraphsArray[$imageNo]);
935
  $ccp = ( count($tss) > 1 ) ? strpos(strtolower($tss[0]),'[caption ')===false : false ;
936
+ $paragraphsArrayAtag = explode($atag, $paragraphsArray[$imageNo]);
937
+ $cdu = ( count($paragraphsArrayAtag) > 1 ) ? strpos(strtolower($paragraphsArrayAtag[0]),'<a href')===false : false ;
938
  if ( $imageCaption && $ccp ) {
939
+ $paragraphsArray[$imageNo] = implode($caption, array_slice($tss, 0, 1)).$caption. "\r\n".'<!--'.$imageAd.'-->'."\r\n". implode($caption, array_slice($tss, 1));
940
  }else if ( $cdu ) {
941
+ $paragraphsArray[$imageNo] = implode($atag, array_slice($paragraphsArrayAtag, 0, 1)).$atag. "\r\n".'<!--'.$imageAd.'-->'."\r\n". implode($atag, array_slice($paragraphsArrayAtag, 1));
942
  }else{
943
+ $paragraphsArray[$imageNo] = implode($delimiter, array_slice($paragraphsArrayImages, 0, 1)).$delimiter. "\r\n".'<!--'.$imageAd.'-->'."\r\n". implode($delimiter, array_slice($paragraphsArrayImages, 1));
944
  }
945
  }
946
+ $content = implode($imgtag, $paragraphsArray);
947
  }
948
  }
949
+ } // end disabled default positioned ads
950
 
951
  /*
952
  * Tidy up content
954
  $content = '<!--EmptyClear-->'.$content."\n".'<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>';
955
  $content = quads_clean_tags($content, true);
956
 
957
+
958
  /*
959
+ * Replace Beginning/Middle/End/Paragraph Ads1-10
960
  */
961
 
962
+ if( !$off_default_ads ) { // disabled default ads
963
+ for( $i=1; $i<=count($adsArrayCus); $i++ ) {
964
 
965
+ if( strpos($content,'<!--'.$cusads.$adsArrayCus[$i-1].'-->')!==false && in_array($adsArrayCus[$i-1], $adsArray)) {
966
+ $content = quads_replace_ads( $content, $cusads.$adsArrayCus[$i], $adsArrayCus[$i] );
967
+ // Comment this to allow the use of the same ad on several ad spots
968
+ //$adsArray = quads_del_element($adsArray, array_search($adsArrayCus[$i-1], $adsArray)) ;
969
  $visibleContentAds += 1;
970
 
971
  quads_set_ad_count_content();
975
  }
976
  }
977
  }
978
+
979
 
980
  /**
981
  * Replace Quicktags Ads1 to Ads10
982
  **/
983
 
984
+ $tcn = count($adsArray); $idx = 0;
985
  for( $i=1; $i<=$tcn; $i++ ) {
986
+ if( strpos($content, '<!--Ads'.$adsArray[$idx].'-->')!==false ) {
987
+ $content = quads_replace_ads( $content, 'Ads'.$adsArray[$idx], $adsArray[$idx] );
988
+ $adsArray = quads_del_element($adsArray, $idx) ;
989
  $visibleContentAds += 1;
990
  quads_set_ad_count_content();
991
  if (quads_ad_reach_max_count()){
994
  }
995
 
996
  } else {
997
+ $idx += 1;
998
  }
999
  }
1000
 
1001
 
1002
 
1003
+ /* ... Replace Beginning/Middle/End random Ads ... */
1004
+ if( !$off_default_ads ) {
1005
  if( strpos($content, '<!--'.$cusrnd.'-->')!==false && is_singular() ) {
1006
+ //wp_die($visibleContentAds + ' ' + $visibleShortcodeAds + $ad_count_widget + ' ');
1007
+
1008
+ $tcx = count($adsArray);
1009
  $tcy = substr_count($content, '<!--'.$cusrnd.'-->');
1010
 
1011
  for( $i=$tcx; $i<=$tcy-1; $i++ ) {
1012
+ array_push($adsArray, -1);
1013
  }
1014
+ shuffle($adsArray);
1015
  for( $i=1; $i<=$tcy; $i++ ) {
1016
+ $content = quads_replace_ads( $content, $cusrnd, $adsArray[0] );
1017
+ $adsArray = quads_del_element($adsArray, 0) ;
1018
  $visibleContentAds += 1;
1019
  quads_set_ad_count_content();
1020
  if (quads_ad_reach_max_count()){
1029
  * Replace RndAds Random Ads
1030
  */
1031
  if( strpos($content, '<!--RndAds-->')!==false && is_singular() ) {
1032
+ $adsArrayTmp = array();
1033
+ shuffle($adsArray);
1034
  for( $i=1; $i<=$maxAds-$visibleContentAds; $i++ ) {
1035
+ if( $i <= count($adsArray) ) {
1036
+ array_push($adsArrayTmp, $adsArray[$i-1]);
1037
  }
1038
  }
1039
+ $tcx = count($adsArrayTmp);
1040
  $tcy = substr_count($content, '<!--RndAds-->');
1041
  for( $i=$tcx; $i<=$tcy-1; $i++ ) {
1042
+ array_push($adsArrayTmp, -1);
1043
  }
1044
+ shuffle($adsArrayTmp);
1045
  for( $i=1; $i<=$tcy; $i++ ) {
1046
+ $tmp = $adsArrayTmp[0];
1047
+ $content = quads_replace_ads( $content, 'RndAds', $adsArrayTmp[0] );
1048
+ $adsArrayTmp = quads_del_element($adsArrayTmp, 0) ;
1049
  if($tmp != -1){
1050
  $visibleContentAds += 1;
1051
  };
1067
  * Revert content into original content without any ad code
1068
  *
1069
  * @global int $visibleContentAds
1070
+ * @global array $adsArray
1071
  * @global array $quads_options
1072
  * @global int $ad_count
1073
  * @param string $content
1077
  */
1078
  function quads_clean_tags($content, $trimonly = false) {
1079
  global $visibleContentAds;
1080
+ global $adsArray;
1081
  global $quads_options;
1082
  global $ad_count;
1083
 
1089
  };
1090
 
1091
 
1092
+ foreach ($tagnames as $tags) {
1093
+ if(strpos($content,'<!--'.$tags.'-->')!==false || $tags=='EmptyClear') {
1094
  if($trimonly) {
1095
+ $content = str_replace('<p><!--'.$tags.'--></p>', '<!--'.$tags.'-->', $content);
1096
  }else{
1097
+ $content = str_replace(array('<p><!--'.$tags.'--></p>','<!--'.$tags.'-->'), '', $content);
1098
  $content = str_replace("##QA-TP1##", "<p></p>", $content);
1099
  $content = str_replace("##QA-TP2##", "<p>&nbsp;</p>", $content);
1100
  }
1102
  }
1103
  if(!$trimonly && (is_single() || is_page()) ) {
1104
  $visibleContentAds = 0;
1105
+ $adsArray = array();
1106
  }
1107
  return $content;
1108
  }
1109
 
 
 
 
 
 
 
 
 
 
 
 
 
1110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1111
 
1112
  /**
1113
  * Remove element from array
1114
  *
1115
+ * @param array $paragraphsArrayay
1116
  * @param int $idx key to remove from array
1117
  * @return array
1118
  */
1119
+ function quads_del_element($paragraphsArrayay, $idx) {
1120
  $copy = array();
1121
+ for( $i=0; $i<count($paragraphsArrayay) ;$i++) {
1122
  if ( $idx != $i ) {
1123
+ array_push($copy, $paragraphsArrayay[$i]);
1124
  }
1125
  }
1126
  return $copy;
includes/widgets.php CHANGED
@@ -18,9 +18,8 @@
18
  add_action( 'widgets_init', 'quads_register_widgets', 1 );
19
 
20
  function quads_register_widgets() {
21
-
22
-
23
  global $quads_options;
 
24
  $amountWidgets = 10;
25
  for ( $i = 1; $i <= $amountWidgets; $i++ ) {
26
  if( !empty( $quads_options['ad' . $i . '_widget'] ) ) {
@@ -29,23 +28,6 @@ function quads_register_widgets() {
29
  }
30
  }
31
 
32
- /**
33
- * Check if Ad widgets are visible on homepage
34
- *
35
- * @since 0.9.7
36
- * return true when ad widgets are not visible on frontpage else false
37
- * @deprecated since version 1.3.8
38
- */
39
- //function quads_hide_adwidget_on_homepage() {
40
- // global $quads_options;
41
- //
42
- // $is_active = isset( $quads_options["visibility"]["AppSide"] ) ? $quads_options["visibility"]["AppSide"] : null;
43
- //
44
- // if( is_front_page() && $is_active )
45
- // return true;
46
- //
47
- // return false;
48
- //}
49
 
50
  class quads_widgets_1 extends WP_Widget {
51
 
@@ -77,13 +59,19 @@ class quads_widgets_1 extends WP_Widget {
77
  */
78
  public function widget( $args, $instance ) {
79
  global $quads_options, $ad_count_widget;
 
 
 
 
 
 
80
  extract( $args );
81
 
82
-
83
  $cont = quads_post_settings_to_quicktags( get_the_content() );
84
- if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
 
85
 
86
- quads_set_ad_count_widget();
87
  //$codetxt = $quads_options['ad' . $this->adsID . '_widget'];
88
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
89
  echo "\n" . "<!-- Quick Adsense Reloaded -->" . "\n";
@@ -123,12 +111,18 @@ class quads_widgets_2 extends WP_Widget {
123
 
124
  public function widget( $args, $instance ) {
125
  global $quads_options;
 
 
 
 
 
126
  extract( $args );
127
 
128
  $cont = quads_post_settings_to_quicktags( get_the_content() );
129
- if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
 
130
 
131
- quads_set_ad_count_widget();
132
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
133
  echo "\n" . "<!-- Quick Adsense Reloaded -->" . "\n";
134
  //if (array_key_exists('before_widget', $args))
@@ -167,11 +161,16 @@ class quads_widgets_3 extends WP_Widget {
167
 
168
  public function widget( $args, $instance ) {
169
  global $quads_options;
 
 
 
 
 
170
  extract( $args );
171
  $cont = quads_post_settings_to_quicktags( get_the_content() );
172
  if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
173
 
174
- quads_set_ad_count_widget();
175
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
176
  echo "\n" . "<!-- Quick Adsense Reloaded -->" . "\n";
177
  if( array_key_exists( 'before_widget', $args ) )
@@ -210,12 +209,17 @@ class quads_widgets_4 extends WP_Widget {
210
 
211
  public function widget( $args, $instance ) {
212
  global $quads_options;
213
-
 
 
 
 
 
214
  extract( $args );
215
  $cont = quads_post_settings_to_quicktags( get_the_content() );
216
  if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
217
 
218
- quads_set_ad_count_widget();
219
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
220
  echo "\n" . "<!-- Quick Adsense Reloaded -->" . "\n";
221
  if( array_key_exists( 'before_widget', $args ) )
@@ -255,11 +259,15 @@ class quads_widgets_5 extends WP_Widget {
255
  public function widget( $args, $instance ) {
256
  global $quads_options;
257
 
 
 
 
 
258
  extract( $args );
259
  $cont = quads_post_settings_to_quicktags( get_the_content() );
260
  if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
261
 
262
- quads_set_ad_count_widget();
263
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
264
  echo "\n" . "<!-- Quick Adsense Reloaded -->" . "\n";
265
  if( array_key_exists( 'before_widget', $args ) )
@@ -299,11 +307,16 @@ class quads_widgets_6 extends WP_Widget {
299
  public function widget( $args, $instance ) {
300
  global $quads_options;
301
 
 
 
 
 
 
302
  extract( $args );
303
  $cont = quads_post_settings_to_quicktags( get_the_content() );
304
  if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
305
 
306
- quads_set_ad_count_widget();
307
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
308
  echo "\n" . "<!-- Quick Adsense Reloaded -->" . "\n";
309
  if( array_key_exists( 'before_widget', $args ) )
@@ -343,11 +356,16 @@ class quads_widgets_7 extends WP_Widget {
343
  public function widget( $args, $instance ) {
344
  global $quads_options;
345
 
 
 
 
 
 
346
  extract( $args );
347
  $cont = quads_post_settings_to_quicktags( get_the_content() );
348
  if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
349
 
350
- quads_set_ad_count_widget();
351
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
352
  echo "\n" . "<!-- Quick Adsense Reloaded -->" . "\n";
353
  if( array_key_exists( 'before_widget', $args ) )
@@ -386,12 +404,17 @@ class quads_widgets_8 extends WP_Widget {
386
 
387
  public function widget( $args, $instance ) {
388
  global $quads_options;
389
-
 
 
 
 
 
390
  extract( $args );
391
  $cont = quads_post_settings_to_quicktags( get_the_content() );
392
  if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
393
 
394
- quads_set_ad_count_widget();
395
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
396
  echo "\n" . "<!-- Quick Adsense Reloaded -->" . "\n";
397
  if( array_key_exists( 'before_widget', $args ) )
@@ -430,12 +453,17 @@ class quads_widgets_9 extends WP_Widget {
430
 
431
  public function widget( $args, $instance ) {
432
  global $quads_options;
433
-
 
 
 
 
 
434
  extract( $args );
435
  $cont = quads_post_settings_to_quicktags( get_the_content() );
436
  if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
437
 
438
- quads_set_ad_count_widget();
439
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
440
  echo "\n" . "<!-- Quick Adsense Reloaded -->" . "\n";
441
  if( array_key_exists( 'before_widget', $args ) )
@@ -474,12 +502,17 @@ class quads_widgets_10 extends WP_Widget {
474
 
475
  public function widget( $args, $instance ) {
476
  global $quads_options;
477
-
 
 
 
 
 
478
  extract( $args );
479
  $cont = quads_post_settings_to_quicktags( get_the_content() );
480
  if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
481
 
482
- quads_set_ad_count_widget();
483
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
484
  echo "\n" . "<!-- Quick Adsense Reloaded -->" . "\n";
485
  if( array_key_exists( 'before_widget', $args ) )
18
  add_action( 'widgets_init', 'quads_register_widgets', 1 );
19
 
20
  function quads_register_widgets() {
 
 
21
  global $quads_options;
22
+
23
  $amountWidgets = 10;
24
  for ( $i = 1; $i <= $amountWidgets; $i++ ) {
25
  if( !empty( $quads_options['ad' . $i . '_widget'] ) ) {
28
  }
29
  }
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
  class quads_widgets_1 extends WP_Widget {
33
 
59
  */
60
  public function widget( $args, $instance ) {
61
  global $quads_options, $ad_count_widget;
62
+
63
+ // All widget ads are deactivated via post meta settings
64
+ if( quads_check_meta_setting( 'NoAds' ) === '1' ){
65
+ return false;
66
+ }
67
+
68
  extract( $args );
69
 
 
70
  $cont = quads_post_settings_to_quicktags( get_the_content() );
71
+ //if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
72
+ if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() ) {
73
 
74
+ //quads_set_ad_count_widget();
75
  //$codetxt = $quads_options['ad' . $this->adsID . '_widget'];
76
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
77
  echo "\n" . "<!-- Quick Adsense Reloaded -->" . "\n";
111
 
112
  public function widget( $args, $instance ) {
113
  global $quads_options;
114
+
115
+ // All widget ads are deactivated via post meta settings
116
+ if( quads_check_meta_setting( 'NoAds' ) === '1' ){
117
+ return false;
118
+ }
119
  extract( $args );
120
 
121
  $cont = quads_post_settings_to_quicktags( get_the_content() );
122
+ //if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
123
+ if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() ) {
124
 
125
+ //quads_set_ad_count_widget();
126
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
127
  echo "\n" . "<!-- Quick Adsense Reloaded -->" . "\n";
128
  //if (array_key_exists('before_widget', $args))
161
 
162
  public function widget( $args, $instance ) {
163
  global $quads_options;
164
+
165
+ // All widget ads are deactivated via post meta settings
166
+ if( quads_check_meta_setting( 'NoAds' ) === '1' ){
167
+ return false;
168
+ }
169
  extract( $args );
170
  $cont = quads_post_settings_to_quicktags( get_the_content() );
171
  if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
172
 
173
+ //quads_set_ad_count_widget();
174
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
175
  echo "\n" . "<!-- Quick Adsense Reloaded -->" . "\n";
176
  if( array_key_exists( 'before_widget', $args ) )
209
 
210
  public function widget( $args, $instance ) {
211
  global $quads_options;
212
+
213
+ // All widget ads are deactivated via post meta settings
214
+ if( quads_check_meta_setting( 'NoAds' ) === '1' ){
215
+ return false;
216
+ }
217
+
218
  extract( $args );
219
  $cont = quads_post_settings_to_quicktags( get_the_content() );
220
  if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
221
 
222
+ //quads_set_ad_count_widget();
223
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
224
  echo "\n" . "<!-- Quick Adsense Reloaded -->" . "\n";
225
  if( array_key_exists( 'before_widget', $args ) )
259
  public function widget( $args, $instance ) {
260
  global $quads_options;
261
 
262
+ // All widget ads are deactivated via post meta settings
263
+ if( quads_check_meta_setting( 'NoAds' ) === '1' ){
264
+ return false;
265
+ }
266
  extract( $args );
267
  $cont = quads_post_settings_to_quicktags( get_the_content() );
268
  if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
269
 
270
+ //quads_set_ad_count_widget();
271
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
272
  echo "\n" . "<!-- Quick Adsense Reloaded -->" . "\n";
273
  if( array_key_exists( 'before_widget', $args ) )
307
  public function widget( $args, $instance ) {
308
  global $quads_options;
309
 
310
+ // All widget ads are deactivated via post meta settings
311
+ if( quads_check_meta_setting( 'NoAds' ) === '1' ){
312
+ return false;
313
+ }
314
+
315
  extract( $args );
316
  $cont = quads_post_settings_to_quicktags( get_the_content() );
317
  if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
318
 
319
+ //quads_set_ad_count_widget();
320
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
321
  echo "\n" . "<!-- Quick Adsense Reloaded -->" . "\n";
322
  if( array_key_exists( 'before_widget', $args ) )
356
  public function widget( $args, $instance ) {
357
  global $quads_options;
358
 
359
+ // All widget ads are deactivated via post meta settings
360
+ if( quads_check_meta_setting( 'NoAds' ) === '1' ){
361
+ return false;
362
+ }
363
+
364
  extract( $args );
365
  $cont = quads_post_settings_to_quicktags( get_the_content() );
366
  if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
367
 
368
+ //quads_set_ad_count_widget();
369
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
370
  echo "\n" . "<!-- Quick Adsense Reloaded -->" . "\n";
371
  if( array_key_exists( 'before_widget', $args ) )
404
 
405
  public function widget( $args, $instance ) {
406
  global $quads_options;
407
+
408
+ // All widget ads are deactivated via post meta settings
409
+ if( quads_check_meta_setting( 'NoAds' ) === '1' ){
410
+ return false;
411
+ }
412
+
413
  extract( $args );
414
  $cont = quads_post_settings_to_quicktags( get_the_content() );
415
  if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
416
 
417
+ //quads_set_ad_count_widget();
418
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
419
  echo "\n" . "<!-- Quick Adsense Reloaded -->" . "\n";
420
  if( array_key_exists( 'before_widget', $args ) )
453
 
454
  public function widget( $args, $instance ) {
455
  global $quads_options;
456
+
457
+ // All widget ads are deactivated via post meta settings
458
+ if( quads_check_meta_setting( 'NoAds' ) === '1' ){
459
+ return false;
460
+ }
461
+
462
  extract( $args );
463
  $cont = quads_post_settings_to_quicktags( get_the_content() );
464
  if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
465
 
466
+ //quads_set_ad_count_widget();
467
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
468
  echo "\n" . "<!-- Quick Adsense Reloaded -->" . "\n";
469
  if( array_key_exists( 'before_widget', $args ) )
502
 
503
  public function widget( $args, $instance ) {
504
  global $quads_options;
505
+
506
+ // All widget ads are deactivated via post meta settings
507
+ if( quads_check_meta_setting( 'NoAds' ) === '1' ){
508
+ return false;
509
+ }
510
+
511
  extract( $args );
512
  $cont = quads_post_settings_to_quicktags( get_the_content() );
513
  if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
514
 
515
+ //quads_set_ad_count_widget();
516
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
517
  echo "\n" . "<!-- Quick Adsense Reloaded -->" . "\n";
518
  if( array_key_exists( 'before_widget', $args ) )
quick-adsense-reloaded.php CHANGED
@@ -6,7 +6,7 @@
6
  * Description: Insert Google AdSense or any Ads code into your website. A fork of Quick AdSense
7
  * Author: Rene Hermenau, WP-Staging
8
  * Author URI: https://wordpress.org/plugins/quick-adsense-reloaded/
9
- * Version: 1.4.0
10
  * Text Domain: quick-adsense-reloaded
11
  * Domain Path: languages
12
  * Credits: WP QUADS - Quick AdSense Reloaded is a fork of Quick AdSense
@@ -35,7 +35,7 @@ if( !defined( 'ABSPATH' ) )
35
 
36
  // Plugin version
37
  if( !defined( 'QUADS_VERSION' ) ) {
38
- define( 'QUADS_VERSION', '1.4.0' );
39
  }
40
 
41
  // Plugin name
@@ -60,9 +60,10 @@ $visibleContentAdsGlobal = 0; // Number of active ads which are shown in the_con
60
  $ad_count_custom = 0; // Number of active custom ads which are shown on the site
61
  $ad_count_widget = 0; // Number of active ads in widgets
62
  $AdsId = array(); // Array of active ad id's
63
- $adWidgets = 10; // number of widgets
64
- $numberAds = 10; // number of regular ads
65
- $AdsWidName = 'AdsWidget%d (WP QUADS)';
 
66
 
67
 
68
  if( !class_exists( 'QuickAdsenseReloaded' ) ) :
@@ -188,20 +189,21 @@ if( !class_exists( 'QuickAdsenseReloaded' ) ) :
188
 
189
  require_once QUADS_PLUGIN_DIR . 'includes/admin/settings/register-settings.php';
190
  $quads_options = quads_get_settings();
191
- require_once QUADS_PLUGIN_DIR . 'includes/conditionals.php';
192
  require_once QUADS_PLUGIN_DIR . 'includes/post_types.php';
193
  require_once QUADS_PLUGIN_DIR . 'includes/user_roles.php';
 
194
  require_once QUADS_PLUGIN_DIR . 'includes/template-functions.php';
195
  require_once QUADS_PLUGIN_DIR . 'includes/class-quads-license-handler.php';
196
  require_once QUADS_PLUGIN_DIR . 'includes/logger.php';
197
  require_once QUADS_PLUGIN_DIR . 'includes/class-quads-html-elements.php';
198
- require_once QUADS_PLUGIN_DIR . 'includes/widgets.php';
199
  require_once QUADS_PLUGIN_DIR . 'includes/shortcodes.php';
200
  require_once QUADS_PLUGIN_DIR . 'includes/api.php';
201
  require_once QUADS_PLUGIN_DIR . 'includes/render-ad-functions.php';
202
  require_once QUADS_PLUGIN_DIR . 'includes/scripts.php';
203
  require_once QUADS_PLUGIN_DIR . 'includes/automattic-amp-ad.php';
204
  require_once QUADS_PLUGIN_DIR . 'includes/helper-functions.php';
 
 
205
 
206
  if( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
207
  require_once QUADS_PLUGIN_DIR . 'includes/admin/add-ons.php';
@@ -285,14 +287,7 @@ if( !class_exists( 'QuickAdsenseReloaded' ) ) :
285
  }
286
  QuickAdsenseReloaded::during_activation();
287
  }
288
- /**
289
- * Deactivation function fires when the plugin is deactivated.
290
- */
291
- public static function deactivation() {
292
- // Hook to plugin uninstall.
293
- //register_uninstall_hook( $this, array('Freemius', '_uninstall_plugin_hook') );
294
- wp_die('uninstall');
295
- }
296
 
297
  /**
298
  * This function is fired from the activation method.
@@ -308,19 +303,22 @@ if( !class_exists( 'QuickAdsenseReloaded' ) ) :
308
  $current_version = get_option( 'quads_version' );
309
  if( $current_version ) {
310
  update_option( 'quads_version_upgraded_from', $current_version );
311
- } else {
312
- // First time installation
 
 
 
313
  $quads_options['post_types'] = array('post', 'page');
314
  $quads_options['visibility']['AppHome'] = "1";
315
  $quads_options['visibility']['AppCate'] = "1";
316
  $quads_options['visibility']['AppArch'] = "1";
317
  $quads_options['visibility']['AppTags'] = "1";
 
318
 
319
  update_option('quads_settings', $quads_options);
320
  }
321
 
322
  // Update the current version
323
- // Its done from the upgrade-functions.php routine
324
  //update_option( 'quads_version', QUADS_VERSION );
325
 
326
  // Add plugin installation date and variable for rating div
@@ -348,12 +346,6 @@ if( !class_exists( 'QuickAdsenseReloaded' ) ) :
348
  * @since 2.0.0
349
  * @return object The one true QuickAdsenseReloaded Instance
350
  */
351
- //function QUADS() {
352
- // return QuickAdsenseReloaded::instance();
353
- //}
354
- //
355
- //// Get QUADS Running
356
- //QUADS();
357
 
358
  /**
359
  * Populate the $quads global with an instance of the QuickAdsenseReloaded class and return it.
@@ -383,31 +375,12 @@ add_action( 'plugins_loaded', 'quads_loaded' );
383
  register_activation_hook( __FILE__, array('QuickAdsenseReloaded', 'activation') );
384
 
385
 
386
- /**
387
- * The deactivation hook is called outside of the singleton because WordPress doesn't
388
- * register the call from within the class hence, needs to be called outside and the
389
- * function also needs to be static.
390
- */
391
- //register_deactivation_hook( __FILE__, array('QuickAdsenseReloaded', 'deactivation') );
392
-
393
-
394
  /**
395
  * Check if advanced settings are available
396
  *
397
  * @return boolean
398
  */
399
- //function quads_is_advanced() {
400
- // include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
401
- // //$plugin = 'wp-quads-pro/wp-quads-pro.php';
402
- // $plugin = 'wp-quads-pro.php';
403
- // //$plugin = plugin_dir_path( __FILE__ ) . basename( __FILE__ );
404
- //
405
- // if( is_plugin_active( $plugin ) ) {
406
- // return true;
407
- // }
408
- //
409
- // return false;
410
- //}
411
 
412
  function quads_is_advanced(){
413
  if ( function_exists( 'quads_is_active_pro' )){
6
  * Description: Insert Google AdSense or any Ads code into your website. A fork of Quick AdSense
7
  * Author: Rene Hermenau, WP-Staging
8
  * Author URI: https://wordpress.org/plugins/quick-adsense-reloaded/
9
+ * Version: 1.4.3
10
  * Text Domain: quick-adsense-reloaded
11
  * Domain Path: languages
12
  * Credits: WP QUADS - Quick AdSense Reloaded is a fork of Quick AdSense
35
 
36
  // Plugin version
37
  if( !defined( 'QUADS_VERSION' ) ) {
38
+ define( 'QUADS_VERSION', '1.4.3' );
39
  }
40
 
41
  // Plugin name
60
  $ad_count_custom = 0; // Number of active custom ads which are shown on the site
61
  $ad_count_widget = 0; // Number of active ads in widgets
62
  $AdsId = array(); // Array of active ad id's
63
+ $maxWidgets = 10; // number of widgets
64
+ //$maxAds = 10; // number of regular ads
65
+ //$AdsWidName = 'AdsWidget%d (WP QUADS)';
66
+ //$AdsWidName = 'AdsWidget%d (Quick Adsense Reloaded)';
67
 
68
 
69
  if( !class_exists( 'QuickAdsenseReloaded' ) ) :
189
 
190
  require_once QUADS_PLUGIN_DIR . 'includes/admin/settings/register-settings.php';
191
  $quads_options = quads_get_settings();
 
192
  require_once QUADS_PLUGIN_DIR . 'includes/post_types.php';
193
  require_once QUADS_PLUGIN_DIR . 'includes/user_roles.php';
194
+ require_once QUADS_PLUGIN_DIR . 'includes/widgets.php';
195
  require_once QUADS_PLUGIN_DIR . 'includes/template-functions.php';
196
  require_once QUADS_PLUGIN_DIR . 'includes/class-quads-license-handler.php';
197
  require_once QUADS_PLUGIN_DIR . 'includes/logger.php';
198
  require_once QUADS_PLUGIN_DIR . 'includes/class-quads-html-elements.php';
 
199
  require_once QUADS_PLUGIN_DIR . 'includes/shortcodes.php';
200
  require_once QUADS_PLUGIN_DIR . 'includes/api.php';
201
  require_once QUADS_PLUGIN_DIR . 'includes/render-ad-functions.php';
202
  require_once QUADS_PLUGIN_DIR . 'includes/scripts.php';
203
  require_once QUADS_PLUGIN_DIR . 'includes/automattic-amp-ad.php';
204
  require_once QUADS_PLUGIN_DIR . 'includes/helper-functions.php';
205
+ require_once QUADS_PLUGIN_DIR . 'includes/conditionals.php';
206
+ require_once QUADS_PLUGIN_DIR . 'includes/frontend-checks.php';
207
 
208
  if( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
209
  require_once QUADS_PLUGIN_DIR . 'includes/admin/add-ons.php';
287
  }
288
  QuickAdsenseReloaded::during_activation();
289
  }
290
+
 
 
 
 
 
 
 
291
 
292
  /**
293
  * This function is fired from the activation method.
303
  $current_version = get_option( 'quads_version' );
304
  if( $current_version ) {
305
  update_option( 'quads_version_upgraded_from', $current_version );
306
+ }
307
+ // First time installation
308
+ // Get all settings and update them only if they are empty
309
+ $quads_options = get_option('quads_settings');
310
+ if(!$quads_options) {
311
  $quads_options['post_types'] = array('post', 'page');
312
  $quads_options['visibility']['AppHome'] = "1";
313
  $quads_options['visibility']['AppCate'] = "1";
314
  $quads_options['visibility']['AppArch'] = "1";
315
  $quads_options['visibility']['AppTags'] = "1";
316
+ $quads_options['quicktags']['QckTags'] = "1";
317
 
318
  update_option('quads_settings', $quads_options);
319
  }
320
 
321
  // Update the current version
 
322
  //update_option( 'quads_version', QUADS_VERSION );
323
 
324
  // Add plugin installation date and variable for rating div
346
  * @since 2.0.0
347
  * @return object The one true QuickAdsenseReloaded Instance
348
  */
 
 
 
 
 
 
349
 
350
  /**
351
  * Populate the $quads global with an instance of the QuickAdsenseReloaded class and return it.
375
  register_activation_hook( __FILE__, array('QuickAdsenseReloaded', 'activation') );
376
 
377
 
 
 
 
 
 
 
 
 
378
  /**
379
  * Check if advanced settings are available
380
  *
381
  * @return boolean
382
  */
383
+
 
 
 
 
 
 
 
 
 
 
 
384
 
385
  function quads_is_advanced(){
386
  if ( function_exists( 'quads_is_active_pro' )){
readme.txt CHANGED
@@ -8,8 +8,8 @@ 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.7
12
- Stable tag: 1.4.0
13
 
14
  Quick Adsense Reloaded! Quickest way to insert Google AdSense & other ads into your website. Google AdSense integration with Google AMP support
15
 
@@ -129,6 +129,33 @@ Alternative Installation:
129
 
130
  == Changelog ==
131
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
 
133
  = 1.4.0 =
134
  * New: Add poll when AdSense plugin is deactivated
@@ -354,5 +381,5 @@ Alternative Installation:
354
 
355
  == Upgrade Notice ==
356
 
357
- = 1.3.1 =
358
- 1.3.1 Smaller, Faster, Quicker, Better - WP QUADS<a href="https://wordpress.org/plugins/quick-adsense-reloaded/changelog/" style="color:white;text-decoration: underline;">Complete changelog! </a>
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.7.1
12
+ Stable tag: 1.4.3
13
 
14
  Quick Adsense Reloaded! Quickest way to insert Google AdSense & other ads into your website. Google AdSense integration with Google AMP support
15
 
129
 
130
  == Changelog ==
131
 
132
+ = 1.4.3 =
133
+ * New: Add filter to add 3 more paragraph AdSense ads placed with WP QUADS PRO
134
+ * New: Add ad health and checking function to detect if there are error in adsense settings
135
+ * New: Support link to troubleshooting guide if AdSense ads are not shown
136
+ * New: Add floating Save Settings button
137
+ * New: Grey out unused AdSense ad spots in general settings
138
+ * New: Tested up to Wordpress 4.7.1
139
+ * New: Use up to 20 maximum AdSense ads on one page from a collection of 10 different ads
140
+ * New: Allow the use of the same ad on several different ad positions at the same time
141
+ * New: Complete rewrite of the main processing function for easier maintanance
142
+
143
+ * Fix: Settings are lost after updating when db option quads_version is empty
144
+ * Fix: AdSense option Hide on device X condition not working width shortcode [quads]
145
+ * Fix: Rewrite admin html and css for a more robust structure to prevent to be overwritten by other plugin devs who think its cool to load their css stuff all over the admin area
146
+ * Fix: Button Open All Ads only works on second click
147
+ * Fix: Hide Sizing Options when ad type is not AdSense
148
+ * Fix: Meta Box option "Hide all ads" is not hiding custom created ads with commercial themes like bimber.
149
+
150
+ * Tweak: Enable quicktags button per default on first time installation
151
+ * Tweak: Performance update. Uses less ressources
152
+
153
+
154
+ = 1.4.2 =
155
+ * Skiped internally
156
+
157
+ = 1.4.1 =
158
+ * Skiped internally
159
 
160
  = 1.4.0 =
161
  * New: Add poll when AdSense plugin is deactivated
381
 
382
  == Upgrade Notice ==
383
 
384
+ = 1.4.3 =
385
+ 1.4.3 This new version brings a ton of improvements and small fixes - WP QUADS<a href="https://wordpress.org/plugins/quick-adsense-reloaded/changelog/" style="color:white;text-decoration: underline;">Complete changelog! </a>