AdSense Plugin WP QUADS - Version 1.4.1

Version Description

  • New: Add filter to add 3 more paragraph AdSense ads placed with WP QUADS PRO
  • 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
  • New: Allow the use of the same ad on several different ad positions at the same time

  • Fix: Check if WP QUADS PRO is installed was very slow

  • 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

  • Tweak: Remove deprecated code lines and move relevant functons to api.php

Download this release

Release Info

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

Code changes from version 1.4.0 to 1.4.1

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
 
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
 
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}}.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}
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
@@ -191,13 +191,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 +224,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;">
191
 
192
  $show_notice = get_option('quads_show_theme_notice');
193
 
194
+ if( false !== $show_notice && 'no' !== $show_notice && quads_is_commercial_theme() ) {
195
+ $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' );
196
  ?>
197
+ <div class="updated notice" 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
  //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 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' );
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;">
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,7 +234,8 @@ 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>
@@ -242,6 +244,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
  ?>
241
  </form>
244
  'https://wordpress.org/support/plugin/quick-adsense-reloaded/reviews/#new-post',
245
  'http://wpquads.com/support/'
246
  );
247
+ 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' ),
248
+ 'http://wpquads.com/docs/adsense-ads-are-not-showing/?utm_source=plugin&utm_campaign=wpquads-settings&utm_medium=website&utm_term=bottomlink'
249
+ );
250
  ?>
251
  </div> <!-- new //-->
252
  <?php quads_get_advertising(); ?>
includes/admin/settings/register-settings.php CHANGED
@@ -145,7 +145,16 @@ function quads_get_registered_settings() {
145
  7 => '7',
146
  8 => '8',
147
  9 => '9',
148
- 10 => '10',
 
 
 
 
 
 
 
 
 
149
  ),
150
  ),
151
  array(
@@ -184,11 +193,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 +1479,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 +1579,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 +1633,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; ?>">
145
  7 => '7',
146
  8 => '8',
147
  9 => '9',
148
+ 11 => '11',
149
+ 12 => '12',
150
+ 13 => '13',
151
+ 14 => '14',
152
+ 15 => '15',
153
+ 16 => '16',
154
+ 17 => '17',
155
+ 18 => '18',
156
+ 19 => '19',
157
+ 20 => '20',
158
  ),
159
  ),
160
  array(
193
  'adsense_header' => array(
194
  'id' => 'adsense_header',
195
  'name' => '<strong>' . __( 'AdSense Code', 'quick-adsense-reloaded' ) . '</strong>',
196
+ '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>'
197
  . '<ul style="margin-top:10px;">'
198
+ . '<li>- Use option <i>AdSense</i> for unmodified AdSense code</li>'
199
+ . '<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' )
200
  . '</ul>'
201
+ . '<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>'
202
  . '<div id="quads-open-toggle" class="button">'.__('Open All Ads','quick-adsense-reloaded').'</div>',
203
  'type' => 'header'
204
  ),
1479
 
1480
 
1481
  // Pos 1
1482
+ $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') );
1483
  $html .= ' ' . __( 'Assign', 'quick-adsense-reloaded' ) . ' ';
1484
+ $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) );
1485
  $html .= ' ' . __( 'to <strong>Beginning of Post</strong>', 'quick-adsense-reloaded' ) . '</br>';
1486
 
1487
  // Pos 2
1488
+ $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') );
1489
  $html .= ' ' . __( 'Assign', 'quick-adsense-reloaded' ) . ' ';
1490
+ $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) );
1491
  $html .= ' ' . __( 'to <strong>Middle of Post</strong>', 'quick-adsense-reloaded' ) . '</br>';
1492
 
1493
  // Pos 3
1494
+ $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') );
1495
  $html .= ' ' . __( 'Assign', 'quick-adsense-reloaded' ) . ' ';
1496
+ $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) );
1497
  $html .= ' ' . __( 'to <strong>End of Post</strong>', 'quick-adsense-reloaded' ) . '</br>';
1498
 
1499
  // Pos 4
1500
+ $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') );
1501
  $html .= ' ' . __( 'Assign', 'quick-adsense-reloaded' ) . ' ';
1502
+ $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) );
1503
  $html .= ' ' . __( 'right after <strong>the <span style="font-family:Courier New,Courier,Fixed;">&lt;!--more--&gt;</span> tag</strong>', 'quick-adsense-reloaded' ) . '</br>';
1504
 
1505
  // Pos 5
1506
+ $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') );
1507
  $html .= ' ' . __( 'Assign', 'quick-adsense-reloaded' ) . ' ';
1508
+ $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) );
1509
  $html .= ' ' . __( 'right before <strong>the last Paragraph</strong>', 'quick-adsense-reloaded' ) . ' </br>';
1510
 
1511
  // Pos 6
1512
+ $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') );
1513
  $html .= ' ' . __( 'Assign', 'quick-adsense-reloaded' ) . ' ';
1514
+ $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) );
1515
  $html .= ' ' . __( '<strong>After Paragraph</strong>', 'quick-adsense-reloaded' ) . ' ';
1516
+ $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) );
1517
  $html .= ' ' . __( '→', 'quick-adsense-reloaded' ) . ' ';
1518
+ $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') );
1519
  $html .= ' ' . __( 'to <strong>End of Post</strong> if fewer paragraphs are found.', 'quick-adsense-reloaded' ) . ' </br>';
1520
 
1521
  // Pos 7
1522
+ $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') );
1523
  $html .= ' ' . __( 'Assign', 'quick-adsense-reloaded' ) . ' ';
1524
+ $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) );
1525
  $html .= ' ' . __( '<strong>After Paragraph</strong>', 'quick-adsense-reloaded' ) . ' ';
1526
+ $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) );
1527
  $html .= ' ' . __( '→', 'quick-adsense-reloaded' ) . ' ';
1528
+ $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') );
1529
  $html .= ' ' . __( 'to <strong>End of Post</strong> if fewer paragraphs are found.', 'quick-adsense-reloaded' ) . ' </br>';
1530
 
1531
  // Pos 8
1532
+ $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') );
1533
  $html .= ' ' . __( 'Assign', 'quick-adsense-reloaded' ) . ' ';
1534
+ $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) );
1535
  $html .= ' ' . __( '<strong>After Paragraph</strong>', 'quick-adsense-reloaded' ) . ' ';
1536
+ $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) );
1537
  $html .= ' ' . __( '→', 'quick-adsense-reloaded' ) . ' ';
1538
+ $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') );
1539
  $html .= ' ' . __( 'to <strong>End of Post</strong> if fewer paragraphs are found.', 'quick-adsense-reloaded' ) . ' </br>';
1540
 
1541
+ $html .= apply_filters('quads_extra_paragraph', '');
1542
+
1543
  // Pos 9
1544
+ $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') );
1545
  $html .= ' ' . __( 'Assign', 'quick-adsense-reloaded' ) . ' ';
1546
  $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) );
1547
  $html .= ' ' . __( '<strong>After Image</strong>', 'quick-adsense-reloaded' ) . ' ';
1548
+ $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) );
1549
  $html .= ' ' . __( '→', 'quick-adsense-reloaded' ) . ' ';
1550
+ $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') );
1551
  $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>';
1552
 
1553
  echo apply_filters( 'quads_ad_position_callback', $html );
1579
  echo $html;
1580
  }
1581
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1582
  /**
1583
  * AdSense Code Callback
1584
  *
1633
  <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>
1634
  <br>
1635
  <div class="quads_adsense_code">
1636
+ <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>
1637
  <br />
1638
  <?php //echo __('Generate Ad Slot & Publisher ID automatically from your adsense code', 'quick-adsense-reloaded')?>
1639
  <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
  *
33
  */
34
 
35
 
36
+ /**
37
+ * Return ad locations HTML based on new API.
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
  *
includes/conditionals.php CHANGED
@@ -72,6 +72,7 @@ function quads_get_total_ad_count(){
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
 
@@ -135,6 +136,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;
72
  $custom = isset($ad_count_custom) ? (int)$ad_count_custom : 0;
73
  $widget = isset($ad_count_widget) ? (int)$ad_count_widget : 0;
74
 
75
+ //wp_die($ad_count_widget);
76
  return $shortcode + $content + $custom + $widget;
77
  }
78
 
136
  * Increment count of active ads generated on widgets
137
  *
138
  * @return int amount of active widget ads
139
+ * @deprecated since 1.4.1
140
  */
141
  function quads_set_ad_count_widget(){
142
  global $ad_count_widget;
includes/shortcodes.php CHANGED
@@ -24,20 +24,41 @@ 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 +77,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
  }
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
+ // The ad id
39
+ $id = isset( $atts['id'] ) ? ( int ) $atts['id'] : 0;
40
+
41
+ $arr = array(
42
+ 'float:left;margin:%1$dpx %1$dpx %1$dpx 0;',
43
+ 'float:none;margin:%1$dpx 0 %1$dpx 0;text-align:center;',
44
+ 'float:right;margin:%1$dpx 0 %1$dpx %1$dpx;',
45
+ 'float:none;margin:0px;');
46
+
47
+ $adsalign = $quads_options['ad' . $id]['align'];
48
+ $adsmargin = isset( $quads_options['ad' . $id]['margin'] ) ? $quads_options['ad' . $id]['margin'] : '3'; // default
49
+ $margin = sprintf( $arr[( int ) $adsalign], $adsmargin );
50
 
51
+
52
+ // Do not create any inline style on AMP site
53
+ $style = !quads_is_amp_endpoint() ? apply_filters( 'quads_filter_margins', $margin, 'ad' . $id ) : '';
54
 
55
+ $code = "\n" . '<!-- WP QUADS v. ' . QUADS_VERSION . ' Shortcode Ad -->' . "\n" .
56
+ '<div class="quads-location quads-ad' . $id . '" id="quads-ad' . $id . '" style="' . $style . '">' . "\n";
57
+ $code .= do_shortcode( quads_get_ad( $id ) );
58
+ $code .= '</div>' . "\n";
59
+
60
+ return $code;
61
+ }
62
 
63
  /**
64
  * return ad content
77
  if ( isset($quads_options['ad' . $id]['code']) ){
78
  // Count how often the shortcode is used - Important
79
  quads_set_ad_count_shortcode();
80
+ //$code = "\n".'<!-- WP QUADS Shortcode Ad v. ' . QUADS_VERSION .' -->'."\n";
81
  //return $code . $quads_options['ad' . $id]['code'];
82
  return quads_render_ad('ad' . $id, $quads_options['ad' . $id]['code']);
83
  }
includes/template-functions.php CHANGED
@@ -84,11 +84,12 @@ function quads_get_visibility_quicktags_str ( $post_id = null ) {
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
@@ -97,7 +98,7 @@ function quads_get_visibility_quicktags_str ( $post_id = null ) {
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,22 +108,25 @@ 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'] ) ) ) {
@@ -145,13 +149,14 @@ function quads_process_content($content){
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;
@@ -169,19 +174,20 @@ function quads_process_content($content){
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;
@@ -194,22 +200,58 @@ function quads_process_content($content){
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
@@ -217,20 +259,20 @@ function quads_process_content($content){
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
 
@@ -250,23 +292,11 @@ function quads_process_content($content){
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 +309,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
@@ -308,16 +338,17 @@ function quads_process_content($content){
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();
@@ -351,8 +382,8 @@ function quads_process_content($content){
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.'-->');
@@ -461,19 +492,19 @@ function quads_clean_tags($content, $trimonly = false) {
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;',
@@ -481,7 +512,7 @@ function quads_replace_ads($content, $nme, $id) {
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 ) : '';
@@ -496,7 +527,7 @@ function quads_replace_ads($content, $nme, $id) {
496
  } else {
497
  $adscode ='';
498
  }
499
- $cont = explode('<!--'.$nme.'-->', $content, 2);
500
 
501
  return $cont[0].$adscode.$cont[1];
502
  }
@@ -504,15 +535,15 @@ function quads_replace_ads($content, $nme, $id) {
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;
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 $maxWidgets maximum number of ad widgets
88
+ * @global int $maxAds 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
+ * @global int $ad_count_widget number of active widget ads
93
  * @param string $content
94
  *
95
  * @return string
98
  */
99
 
100
  function quads_process_content($content){
101
+ global $quads_options, $visibleContentAds, $AdsId, $maxWidgets, $maxAds, $AdsWidName, $visibleContentAdsGlobal, $visibleShortcodeAds, $ad_count_widget;
102
 
103
  // Return original content if QUADS is not allowed
104
  if ( !quads_ad_is_allowed($content) ) {
108
  // Maximum allowed ads
109
  $maxAds = isset($quads_options['maxads']) ? $quads_options['maxads'] : 10;
110
 
111
+ // count active widget ads
112
  if (strpos($content,'<!--OffWidget-->')===false) {
113
+ for($i=1;$i<=$maxWidgets;$i++) {
114
  $wadsid = sanitize_title(str_replace(array('(',')'),'',sprintf($AdsWidName,$i)));
115
+ //$maxAds -= (is_active_widget('', '', $wadsid)) ? 1 : 0 ;
116
+ $ad_count_widget += (is_active_widget('', '', $wadsid)) ? 1 : 0 ;
117
  }
118
  }
119
 
120
+
121
  // Return here if max visible ads are exceeded
122
+ if( $visibleContentAds+$visibleShortcodeAds+$ad_count_widget >= $maxAds ) { // ShownAds === 0 or larger/equal than $maxAds
123
  $content = quads_clean_tags($content);
124
  return $content;
125
  };
126
 
127
  // Create array of valid id's
128
  if( count( $AdsId ) === 0 ) { //
129
+ for ( $i = 1; $i <= $maxAds; $i++ ) {
130
  $tmp = isset($quads_options['ad' . $i]['code']) ? trim( $quads_options['ad' . $i]['code'] ) : '';
131
  // id is valid if there is either the plain text field populated or the adsense ad slot and the ad client id
132
  if( !empty( $tmp ) || (!empty($quads_options['ad' . $i]['g_data_ad_slot']) && !empty($quads_options['ad' . $i]['g_data_ad_client'] ) ) ) {
149
  $content = str_replace("<p></p>", "##QA-TP1##", $content);
150
  // Replace all <p>&nbsp;</p> tags with placeholder ##QA-TP2##
151
  $content = str_replace("<p>&nbsp;</p>", "##QA-TP2##", $content);
152
+ $off_default_ads = (strpos($content,'<!--OffDef-->')!==false);
153
 
154
+ if( !$off_default_ads ) { // disabled default positioned ads
155
 
156
+ $AdsIdCus = array(); // ids of used ads
157
+
158
+ $cusrnd = 'CusRnd'; // placeholder string for random ad
159
+ $cusads = 'CusAds'; // placeholder string for custom ad spots
160
 
161
  $begn1 = isset($quads_options['pos1']['BegnAds']) ? true : false;
162
  $begn2 = isset($quads_options['pos1']['BegnRnd']) ? $quads_options['pos1']['BegnRnd'] : 0;
174
  $lapa2 = isset($quads_options['pos5']['LapaRnd'])? $quads_options['pos5']['LapaRnd'] : 0 ;
175
 
176
 
 
 
 
177
 
178
+ $number = 3; // number of paragraph ads | default value 3.
179
+ $default = 5; // Position. Let's start with id 5
180
+ for($i=1;$i<=$number;$i++) {
181
+
182
+ $key = $default +$i; // 6,7,8
183
 
184
+ $paragraph['status'][$i] = isset($quads_options['pos' . $key]['Par'.$i .'Ads']) ? $quads_options['pos' . $key]['Par'.$i .'Ads'] : 0; // Status - active | inactive
185
+ $paragraph['id'][$i] = isset($quads_options['pos' . $key]['Par'.$i .'Rnd']) ? $quads_options['pos' . $key]['Par'.$i .'Rnd'] : 0; // Ad id
186
+ $paragraph['position'][$i] = isset($quads_options['pos' . $key]['Par'.$i .'Nup']) ? $quads_options['pos' . $key]['Par'.$i .'Nup'] : 0; // Paragraph No
187
+ $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
188
 
189
  }
190
+ // Position 9 Ad after Image
191
  $imageActive = isset($quads_options['pos9']['Img1Ads']) ? $quads_options['pos9']['Img1Ads'] : false;
192
  $imageAdNo = isset($quads_options['pos9']['Img1Rnd']) ? $quads_options['pos9']['Img1Rnd'] : false;
193
  $imageNo = isset($quads_options['pos9']['Img1Nup']) ? $quads_options['pos9']['Img1Nup'] : false;
200
  if ( $lapa2 == 0 ) { $g1 = $cusrnd; } else { $g1 = $cusads.$lapa2; array_push($AdsIdCus, $lapa2); };
201
  if ( $endi2 == 0 ) { $b2 = $cusrnd; } else { $b2 = $cusads.$endi2; array_push($AdsIdCus, $endi2); };
202
 
203
+ for($i=1;$i<=$number;$i++) {
204
+ if ( $paragraph['id'][$i] == 0 ) {
205
+ $paragraph[$i] = $cusrnd;
206
  } else {
207
+ $paragraph[$i] = $cusads.$paragraph['id'][$i];
208
+ array_push($AdsIdCus, $paragraph['id'][$i]);
209
 
210
  };
211
  }
212
 
213
+ // Create the arguments for filter quads_filter_paragraphs
214
+ $quads_args = array (
215
+ 'paragraph' => $paragraph,
216
+ 'cusads' => $cusads,
217
+ 'cusrnd' => $cusrnd,
218
+ 'AdsIdCus' => $AdsIdCus,
219
+
220
+ );
221
+
222
+ // Execute filter to add more paragraph ad spots
223
+ $quads_filtered = apply_filters('quads_filter_paragraphs', $quads_args);
224
+
225
+ // The filtered arguments
226
+ $paragraph = $quads_filtered['paragraph'];
227
+
228
+ // filtered list of ad spots
229
+ $AdsIdCus = $quads_filtered['AdsIdCus'];
230
+
231
+ // Create paragraph ads
232
+ $number = 6;
233
+ //$number = 3;
234
+ for($i=$number;$i>=1;$i--) {
235
+ if ( !empty($paragraph['status'][$i]) ){
236
+
237
+ $sch = "</p>";
238
+ $content = str_replace("</P>", $sch, $content);
239
+ // paragraphs in content
240
+ $paragraphsArray = explode($sch, $content);
241
+ if ( (int)$paragraph['position'][$i] < count($paragraphsArray) ) {
242
+ $content = implode($sch, array_slice($paragraphsArray, 0, $paragraph['position'][$i])).$sch .'<!--'.$paragraph[$i].'-->'. implode($sch, array_slice($paragraphsArray, $paragraph['position'][$i]));
243
+ } elseif ($paragraph['end_post'][$i]) {
244
+ $content = implode($sch, $paragraphsArray).'<!--'.$paragraph[$i].'-->';
245
+ }
246
+ }
247
+ }
248
+
249
+ // Check if image ad is random one
250
  if ( $imageAdNo == 0 ) {
251
+ $imageAd = $cusrnd;
252
  } else {
253
+ $imageAd = $cusads.$imageAdNo;
254
+ array_push($AdsIdCus, $imageAdNo);
255
  };
256
 
257
  // Check if image ad is middle one
259
  if( substr_count(strtolower($content), '</p>')>=2 ) {
260
  $sch = "</p>";
261
  $content = str_replace("</P>", $sch, $content);
262
+ $paragraphsArray = explode($sch, $content);
263
  $nn = 0; $mm = strlen($content)/2;
264
+ for($i=0;$i<count($paragraphsArray);$i++) {
265
+ $nn += strlen($paragraphsArray[$i]) + 4;
266
  if($nn>$mm) {
267
+ if( ($mm - ($nn - strlen($paragraphsArray[$i]))) > ($nn - $mm) && $i+1<count($paragraphsArray) ) {
268
+ $paragraphsArray[$i+1] = '<!--'.$m1.'-->'.$paragraphsArray[$i+1];
269
  } else {
270
+ $paragraphsArray[$i] = '<!--'.$m1.'-->'.$paragraphsArray[$i];
271
  }
272
  break;
273
  }
274
  }
275
+ $content = implode($sch, $paragraphsArray);
276
  }
277
  }
278
 
292
  if( $lapa1 && strpos($content,'<!--OffBfLastPara-->')===false){
293
  $sch = "<p>";
294
  $content = str_replace("<P>", $sch, $content);
295
+ $paragraphsArray = explode($sch, $content);
296
+ if ( count($paragraphsArray) > 2 ) {
297
+ $content = implode($sch, array_slice($paragraphsArray, 0, count($paragraphsArray)-1)) .'<!--'.$g1.'-->'. $sch. $paragraphsArray[count($paragraphsArray)-1];
298
  }
299
  }
 
 
 
 
 
 
 
 
 
 
 
 
300
 
301
  if ( $imageActive ){
302
 
309
  $content = str_replace("</A>", $atag, $content);
310
 
311
  // Start
312
+ $paragraphsArray = explode($imgtag, $content);
313
+ if ( (int)$imageNo < count($paragraphsArray) ) {
314
+ $paragraphsArrayImages = explode($delimiter, $paragraphsArray[$imageNo]);
315
+ if ( count($paragraphsArrayImages) > 1 ) {
316
+ $tss = explode($caption, $paragraphsArray[$imageNo]);
317
  $ccp = ( count($tss) > 1 ) ? strpos(strtolower($tss[0]),'[caption ')===false : false ;
318
+ $paragraphsArrayAtag = explode($atag, $paragraphsArray[$imageNo]);
319
+ $cdu = ( count($paragraphsArrayAtag) > 1 ) ? strpos(strtolower($paragraphsArrayAtag[0]),'<a href')===false : false ;
320
  if ( $imageCaption && $ccp ) {
321
+ $paragraphsArray[$imageNo] = implode($caption, array_slice($tss, 0, 1)).$caption. "\r\n".'<!--'.$imageAd.'-->'."\r\n". implode($caption, array_slice($tss, 1));
322
  }else if ( $cdu ) {
323
+ $paragraphsArray[$imageNo] = implode($atag, array_slice($paragraphsArrayAtag, 0, 1)).$atag. "\r\n".'<!--'.$imageAd.'-->'."\r\n". implode($atag, array_slice($paragraphsArrayAtag, 1));
324
  }else{
325
+ $paragraphsArray[$imageNo] = implode($delimiter, array_slice($paragraphsArrayImages, 0, 1)).$delimiter. "\r\n".'<!--'.$imageAd.'-->'."\r\n". implode($delimiter, array_slice($paragraphsArrayImages, 1));
326
  }
327
  }
328
+ $content = implode($imgtag, $paragraphsArray);
329
  }
330
  }
331
+ } // end disabled default positioned ads
332
 
333
  /*
334
  * Tidy up content
338
 
339
 
340
  /*
341
+ * Replace Beginning/Middle/End/Paragraph Ads1-10
342
  */
343
 
344
+ if( !$off_default_ads ) { // disabled default ads
345
  for( $i=1; $i<=count($AdsIdCus); $i++ ) {
346
 
347
  if( strpos($content,'<!--'.$cusads.$AdsIdCus[$i-1].'-->')!==false && in_array($AdsIdCus[$i-1], $AdsId)) {
348
 
349
  $content = quads_replace_ads( $content, $cusads.$AdsIdCus[$i-1], $AdsIdCus[$i-1] );
350
+ // Comment this to allow the use of the same ad on several ad spots
351
+ //$AdsId = quads_del_element($AdsId, array_search($AdsIdCus[$i-1], $AdsId)) ;
352
  $visibleContentAds += 1;
353
 
354
  quads_set_ad_count_content();
382
 
383
 
384
 
385
+ /* ... Replace Beginning/Middle/End random Ads ... */
386
+ if( !$off_default_ads ) {
387
  if( strpos($content, '<!--'.$cusrnd.'-->')!==false && is_singular() ) {
388
  $tcx = count($AdsId);
389
  $tcy = substr_count($content, '<!--'.$cusrnd.'-->');
492
  *
493
  * @global type $quads_options
494
  * @param string $content
495
+ * @param string $quicktag Quicktag
496
  * @param string $id id of the ad
497
  * @return type
498
  */
499
+ function quads_replace_ads($content, $quicktag, $id) {
500
  global $quads_options;
501
 
502
 
503
+ if( strpos($content,'<!--'.$quicktag.'-->')===false ) {
504
  return $content;
505
  }
506
  if ($id != -1) {
507
+ $paragraphsArray = array(
508
  'float:left;margin:%1$dpx %1$dpx %1$dpx 0;',
509
  'float:none;margin:%1$dpx 0 %1$dpx 0;text-align:center;',
510
  'float:right;margin:%1$dpx 0 %1$dpx %1$dpx;',
512
 
513
  $adsalign = $quads_options['ad' . $id]['align'];
514
  $adsmargin = isset($quads_options['ad' . $id]['margin']) ? $quads_options['ad' . $id]['margin'] : '3'; // default
515
+ $margin = sprintf($paragraphsArray[(int)$adsalign], $adsmargin);
516
 
517
  // Do not create any inline style on AMP site
518
  $style = !quads_is_amp_endpoint() ? apply_filters ('quads_filter_margins', $margin, 'ad'.$id ) : '';
527
  } else {
528
  $adscode ='';
529
  }
530
+ $cont = explode('<!--'.$quicktag.'-->', $content, 2);
531
 
532
  return $cont[0].$adscode.$cont[1];
533
  }
535
  /**
536
  * Remove element from array
537
  *
538
+ * @param array $paragraphsArrayay
539
  * @param int $idx key to remove from array
540
  * @return array
541
  */
542
+ function quads_del_element($paragraphsArrayay, $idx) {
543
  $copy = array();
544
+ for( $i=0; $i<count($paragraphsArrayay) ;$i++) {
545
  if ( $idx != $i ) {
546
+ array_push($copy, $paragraphsArrayay[$i]);
547
  }
548
  }
549
  return $copy;
includes/widgets.php CHANGED
@@ -83,7 +83,7 @@ class quads_widgets_1 extends WP_Widget {
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";
@@ -128,7 +128,7 @@ class quads_widgets_2 extends WP_Widget {
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))
@@ -171,7 +171,7 @@ class quads_widgets_3 extends WP_Widget {
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 ) )
@@ -215,7 +215,7 @@ class quads_widgets_4 extends WP_Widget {
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 ) )
@@ -259,7 +259,7 @@ class quads_widgets_5 extends WP_Widget {
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 ) )
@@ -303,7 +303,7 @@ class quads_widgets_6 extends WP_Widget {
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 ) )
@@ -347,7 +347,7 @@ class quads_widgets_7 extends WP_Widget {
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 ) )
@@ -391,7 +391,7 @@ class quads_widgets_8 extends WP_Widget {
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 ) )
@@ -435,7 +435,7 @@ class quads_widgets_9 extends WP_Widget {
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 ) )
@@ -479,7 +479,7 @@ class quads_widgets_10 extends WP_Widget {
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 ) )
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";
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))
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 ) )
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 ) )
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 ) )
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 ) )
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 ) )
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 ) )
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 ) )
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 ) )
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,20 @@ 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 +286,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.
@@ -348,12 +342,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 +371,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.1
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.1' );
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'; // load it at the end to make sure all ads are counted
206
 
207
  if( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
208
  require_once QUADS_PLUGIN_DIR . 'includes/admin/add-ons.php';
286
  }
287
  QuickAdsenseReloaded::during_activation();
288
  }
289
+
 
 
 
 
 
 
 
290
 
291
  /**
292
  * This function is fired from the activation method.
342
  * @since 2.0.0
343
  * @return object The one true QuickAdsenseReloaded Instance
344
  */
 
 
 
 
 
 
345
 
346
  /**
347
  * Populate the $quads global with an instance of the QuickAdsenseReloaded class and return it.
371
  register_activation_hook( __FILE__, array('QuickAdsenseReloaded', 'activation') );
372
 
373
 
 
 
 
 
 
 
 
 
374
  /**
375
  * Check if advanced settings are available
376
  *
377
  * @return boolean
378
  */
379
+
 
 
 
 
 
 
 
 
 
 
 
380
 
381
  function quads_is_advanced(){
382
  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
 
@@ -130,6 +130,25 @@ Alternative Installation:
130
  == Changelog ==
131
 
132
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  = 1.4.0 =
134
  * New: Add poll when AdSense plugin is deactivated
135
  * Fix: Responsive AdSense ads are not working if shortcode [quads] is used
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.1
13
 
14
  Quick Adsense Reloaded! Quickest way to insert Google AdSense & other ads into your website. Google AdSense integration with Google AMP support
15
 
130
  == Changelog ==
131
 
132
 
133
+ = 1.4.1 =
134
+ * New: Add filter to add 3 more paragraph AdSense ads placed with WP QUADS PRO
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
140
+ * New: Allow the use of the same ad on several different ad positions at the same time
141
+
142
+ * Fix: Check if WP QUADS PRO is installed was very slow
143
+ * Fix: AdSense option Hide on device X condition not working width shortcode [quads]
144
+ * 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
145
+ * Fix: Button Open All Ads only works on second click
146
+ * Fix: Hide Sizing Options when ad type is not AdSense
147
+
148
+ * Tweak: Remove deprecated code lines and move relevant functons to api.php
149
+
150
+
151
+
152
  = 1.4.0 =
153
  * New: Add poll when AdSense plugin is deactivated
154
  * Fix: Responsive AdSense ads are not working if shortcode [quads] is used