AdSense Plugin WP QUADS - Version 1.4.4

Version Description

  • Fix: Undefined variable if WP QUADS PRO beta version is used with more than 3 AdSebse paragraph AdSebse spots
  • Fix: Deactivate License button not working
  • Fix: Admin notice if AdSense codes are empty
  • Fix: PHP Warning when AdSense ad codes are empty
  • Fix: Not more than 3 AdSense widgets are shown at the same time
Download this release

Release Info

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

Code changes from version 1.4.1 to 1.4.4

assets/css/quads-admin.css CHANGED
@@ -795,3 +795,11 @@ li.quads-tabs {
795
  min-height: 25px;
796
  }
797
 
 
 
 
 
 
 
 
 
795
  min-height: 25px;
796
  }
797
 
798
+
799
+ #quads-validate{
800
+ margin-top: -20px;
801
+ display: block;
802
+ margin-left: 2px;
803
+ margin-bottom: 20px;
804
+ font-weight: bold;
805
+ }
assets/css/quads-admin.min.css CHANGED
@@ -1 +1 @@
1
- .quads-share-button-container{margin:5px 0}.quads-share-button-container p{margin:0 0 10px}.quads-share-button{display:inline-block}.quads-share-button a{text-decoration:none}.quads-share-button .quads-share{font-family:sans-serif;font-weight:700;text-decoration:none;text-align:center;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;color:#FFF;display:inline;font-size:16px;width:40px;padding:4px 8px}.quads-share-button-twitter .quads-share{background-color:#00ABF0}.quads-share-button-facebook .quads-share{background-color:#3b5998}.quads-share-button-googleplus .quads-share{background-color:#F53424}.quads-share-button-facebook .share:active,.quads-share-button-googleplus .share:active,.quads-share-button-twitter .share:active{background-color:#353535}@media (max-width:925px){.quads-share-button .quads-share{font-size:15px;padding:8px 16px}}.quads-richeditor{font-size:11px}#quads-add-ons h2{margin:0 0 15px}#quads-add-ons .quadsshare-addons{float:left;margin:0 15px 15px 0;background:#f0f0f0;border:1px solid #ccc;width:320px;padding:8px;height:315px;position:relative}#quads-add-ons .quadsshare-addons h3{margin:0 0 8px;font-size:13px}#quads-add-ons .quadsshare-addons .button-secondary{position:absolute;bottom:8px;left:8px}#quads-add-ons .quadsshare-addons .third-party{display:none}#system-info-textarea{width:580px;height:400px;font-family:Menlo,Monaco,monospace;background:0 0;white-space:pre;overflow:auto;display:block}.quads-select-chosen{width:300px}input.large-text,textarea.large-text{max-width:600px}input.medium-text,textarea.medium-text{min-width:190px}#quads_tab_container ul{list-style:none;margin:0;padding:0;background:#fff;float:left}#quads_tab_container ul li:first-child.selected-tab{border-top:none}#quads_tab_container ul li a.selected-tab{font-weight:700;text-decoration:none}#quads_tab_container .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}
1
+ .quads-share-button-container{margin:5px 0}.quads-share-button-container p{margin:0 0 10px}.quads-share-button{display:inline-block}.quads-share-button a{text-decoration:none}.quads-share-button .quads-share{font-family:sans-serif;font-weight:700;text-decoration:none;text-align:center;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;color:#FFF;display:inline;font-size:16px;width:40px;padding:4px 8px}.quads-share-button-twitter .quads-share{background-color:#00ABF0}.quads-share-button-facebook .quads-share{background-color:#3b5998}.quads-share-button-googleplus .quads-share{background-color:#F53424}.quads-share-button-facebook .share:active,.quads-share-button-googleplus .share:active,.quads-share-button-twitter .share:active{background-color:#353535}@media (max-width:925px){.quads-share-button .quads-share{font-size:15px;padding:8px 16px}}.quads-richeditor{font-size:11px}#quads-add-ons h2{margin:0 0 15px}#quads-add-ons .quadsshare-addons{float:left;margin:0 15px 15px 0;background:#f0f0f0;border:1px solid #ccc;width:320px;padding:8px;height:315px;position:relative}#quads-add-ons .quadsshare-addons h3{margin:0 0 8px;font-size:13px}#quads-add-ons .quadsshare-addons .button-secondary{position:absolute;bottom:8px;left:8px}#quads-add-ons .quadsshare-addons .third-party{display:none}#system-info-textarea{width:580px;height:400px;font-family:Menlo,Monaco,monospace;background:0 0;white-space:pre;overflow:auto;display:block}.quads-select-chosen{width:300px}input.large-text,textarea.large-text{max-width:600px}input.medium-text,textarea.medium-text{min-width:190px}#quads_tab_container ul{list-style:none;margin:0;padding:0;background:#fff;float:left}#quads_tab_container ul li:first-child.selected-tab{border-top:none}#quads_tab_container ul li a.selected-tab{font-weight:700;text-decoration:none}#quads_tab_container .quads-row{padding-top:12px;padding-bottom:12px}#quads_tab_container .quads-row label strong,#tab_container .quads-row strong{font-weight:700}.quads-tabs a{padding:5px;color:#a1a1a1;text-transform:uppercase}.quads-tabs a strong{font-weight:700}li.quads-tabs{float:left;margin-left:0;background-color:#e5e5e5}#quads_tab_container>ul>li.quads-tabs.active{background-color:#fff}#quads_tab_container>ul>li.quads-tabs.active a{color:#83c11f}#quads_tab_container .quads-panel-container{background:#FFF;padding:20px;overflow:auto;text-align:left;margin-bottom:10px;max-width:640px;float:left;clear:both}.form-table{margin-top:-20px}#quads_tab_container .form-table th{vertical-align:top;text-align:left;padding:20px 10px 20px 0;line-height:1.3;font-weight:700;font-size:14px;color:#484848;width:30%}#quads_tab_container .form-table tr{border-bottom:1px solid #E7E7E7}#quads_tab_container span.description{display:block;font-weight:400;font-style:normal;font-size:13px;margin-top:7px;color:#484848}#quads_tab_container .col-title{font-size:18px;color:#484848}@media only screen and (max-width:680px){#quads_tab_container ul{float:none;background:#fff}#quads_tab_container .form-table tr>th{width:100%}#quads_tab_container span.description{font-size:14px}#quads_tab_container .form-table tr>th,#tab_container .form-table tr>td{padding:10px}#quads_tab_container .quads-tabs a{text-align:left}#quads_tab_container li.quads-tabs{float:none;margin-left:0}}#quads_tab_container ul li.quads-tabs{margin-bottom:0}#quads_tab_container ul li.quads-tabs a{display:block;padding:10px;text-decoration:none;font-weight:700}#quads_tab_container ul li.quads-tabs a:hover{color:#383838}#quads_tab_container ul li.quads-tabs a.active{text-decoration:underline}#quads_tab_container table tbody tr:nth-child(1)>th>div{font-size:20px}#quadstabcontainer>.quadstabs{background-color:#fff}#quadstabcontainer ul .active{background-color:#00adef;color:#fff;border-bottom-color:#0098D2}#quadstabcontainer ul .active:hover{background-color:#00A4E2;color:#fff;border-bottom-color:#0098D2}#quadstabcontainer ul li a{padding:10px 14px;background-color:#f3f3f3}#quadstabcontainer .quadstab-container{border:0 solid #ececec}.quads-quote-docs{font-family:Courier New,Courier,Fixed;color:#050}.quads-desc{display:block;font-style:italic;padding-top:10px}.quads-postbox{padding:10px;position:relative;min-width:255px;border:1px solid #e5e5e5;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.04);box-shadow:0 1px 1px rgba(0,0,0,.04);background:#fff;margin-bottom:20px}.nav-tab-active{background-color:#fff;border-bottom:0}#quads-add-ons{padding:20px}.quads-toggle{position:absolute;right:0;top:0}.quads-box-close .quads-close-open-icon{background-position:0 -38px}.quads-close-open-icon{width:38px;height:38px;background:url(../images/arrow-close.png) repeat-y #f4f4f4}.quads-ad-toggle-header{position:relative;background-color:#f4f4f4;margin-bottom:2px;padding:10px 10px 10px 15px;-moz-user-select:-moz-none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;user-select:none;cursor:pointer!important}.quads-ad-toggle-container{padding:20px;background-color:#f4f4f4}.quads-toogle-title{font-size:16px;font-weight:700}.adsense-size-title,.quads-advanced-description label{font-weight:600;font-size:12px;text-transform:uppercase;float:left}.quads-advanced-description label{width:215px}.quads-advanced-ad-box{clear:both;margin-top:20px;margin-bottom:20px}.adsense-size-title{margin-right:0;line-height:32px;margin-left:14px;min-width:100px}.quads-select-style-overwrite{border:1px solid #e6e6e6;width:150px;overflow:hidden;background:url(../images/box_arrow.png) 120px 0 repeat-y #fff;margin:0 0 5px}.quads-select-style-overwrite select{width:150px}.quads-size-input{position:relative;top:-1px;width:110%;border:none;box-shadow:none;background:0 0;-webkit-appearance:none;font-family:'Open Sans',arial,sans-serif;color:#555;font-size:12px}.quads-pro-overlay{height:200px}.quads-license-error-notice,.quads-license-expires-soon-notice{background-color:#fff;padding:10px;overflow:auto;-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,.1);box-shadow:0 1px 1px 0 rgba(0,0,0,.1);border:1px solid #ECECEC;border-radius:3px}.quads-license-error-notice a{color:#0097df;text-decoration:underline}.quads-license-error-notice{border-left:4px solid #dd3d36}.quads-license-expiration-date-notice,.quads-license-lifetime-notice,.quads-license-null{padding:0}.quads-license-expiration-date-notice .quads-license-data p,.quads-license-lifetime-notice .quads-license-data p{color:#666;font-size:14px;font-style:italic;margin:4px 0 0}#quads_settingslicenses_header-nav{display:none}#quads_settingslicenses_header{max-width:640px}#quads_settingslicenses_header .quads-row.th{min-width:250px}.quads-notice{background:#fff;border-left:4px solid #46b450;-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,.1);box-shadow:0 1px 1px 0 rgba(0,0,0,.1);margin:5px 15px 2px;padding:1px 12px}.quads_admin h2.nav-tab-wrapper{border:0}.quads_admin .nav-tab{border:0;text-transform:uppercase;color:#a1a1a1;font-weight:700}.quads-h1{margin-bottom:1.35rem;font-size:2.5em;line-height:3.68rem;letter-spacing:normal}.quads-h2{margin-top:0;margin-bottom:1.2rem;font-size:30px;line-height:2.5rem}.quads-heading-pro{color:#83c11f;font-weight:700}.quads-button.green{display:inline-block;background-color:#83c11f;padding:10px;min-width:170px;color:#fff;font-size:16px;text-decoration:none;text-align:center;margin-top:20px}#quads-add-ons .quads-footer{clear:both;margin-top:20px;font-style:italic}#quads-add-ons li{font-size:18px;line-height:29px;position:relative;padding-left:23px;list-style:none!important}#quads-add-ons li:before{width:1em;height:100%;background:url(data:image/svg+xml;charset=utf8,%3Csvg%20width%3D%221792%22%20height%3D%221792%22%20viewBox%3D%220%200%201792%201792%22%20xmlns%3D%22http%3A%2F%2Fwww%2Ew3%2Eorg%2F2000%2Fsvg%22%3E%3Cpath%20fill%3D%22%2377B227%22%20d%3D%22M1671%20566q0%2040%2D28%2068l%2D724%20724%2D136%20136q%2D28%2028%2D68%2028t%2D68%2D28l%2D136%2D136%2D362%2D362q%2D28%2D28%2D28%2D68t28%2D68l136%2D136q28%2D28%2068%2D28t68%2028l294%20295%20656%2D657q28%2D28%2068%2D28t68%2028l136%20136q28%2028%2028%2068z%22%2F%3E%3C%2Fsvg%3E) left .4em no-repeat;background-size:contain;content:"";position:absolute;top:0;left:0;color:#77b227}.adsense_admin_header{font-size:14px;font-weight:500}#quads-adsense-bg-div{position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.65);z-index:250000}#quads-adsense-container{text-align:center;width:480px;margin:85px auto 0;background-color:#fff;padding:2%;border-radius:2px}#quads-adsense-container h3{margin-top:0}#quads-adsense-container textarea,.quads-ad-toggle-container textarea{width:100%}.quads-ad-toggle-container input{margin-top:7px;margin-bottom:10px}.quads-adsense-code label,input{margin-right:2px}#quads_settings\5b ad2\5d \5b g_data_ad_client\5d{width:200px}.quads-ad-toggle-container label{display:inline-block;margin-right:2px;margin-top:-3px}.quads_adsense_code .quads-add-adsense{margin:20px 5px 20px 0}.quads-label-left{min-width:71px}#quads-label-Type{min-width:67px}.quads-medium-size{width:110px}#quads-msg{display:none;margin:5px;background-color:#c55c5c;color:#fff}.quads-loader,.quads-success-modal{display:block;position:fixed;top:45%;left:25%;width:200px;height:auto;padding:5px 20px;z-index:1002;overflow:auto}.quads-form-table{width:100%}.quads-left-box{width:45%;min-height:100px;float:left;line-height:35px;min-width:300px}@media screen and (max-width:700px){.adsense-size-title{margin-left:0}.quads-left-box{width:45%;min-height:100px;float:none;line-height:35px;min-width:300px}.quads-style img{max-width:50px}}.quads-general-helper,.quads-helper{background-color:#83c11f;width:15px;display:inline-block;top:4px;cursor:pointer}.adsense_admin_header ul li{margin-top:2px;margin-left:20px;list-style-type:square}.quads-helper{border-radius:50%;border:2px solid #fff;height:15px;position:relative;margin-top:-4px;margin-left:2px}.quads-general-helper:after,.quads-helper:after{height:20px;font-family:sans-serif;content:"?";font-size:11px;font-weight:700;left:4px;position:absolute;color:#fff}.quads-helper:after{margin-top:-10px}.quads-general-helper:after{margin-top:-2px}.quads-general-helper{border-radius:50%;border:2px solid #fff;height:15px;position:relative;margin-top:-4px;margin-left:2px}.quads-message{padding:10px;border:1px solid #FBFBFB;border-radius:2px;background-color:#F8F8F8;position:absolute;max-width:500px;z-index:9999;display:none;box-shadow:0 0 5px rgba(0,0,0,.2);font-weight:400;line-height:20px;text-transform:none;font-size:14px}#quads-pro-hover{background-color:#83c11f;padding:20px;min-width:150px;color:#fff;display:block;position:relative;margin-top:-100px;margin-left:50%}#quads-pro-hover-background{width:100%;height:100%;background:rgba(0,0,0,.6)}#quads-open-toggle{clear:both;float:left;margin-top:10px}#quads_settingsadsense_header input[type=number].small-text{width:55px}.quads_adsense_code input.quads-bggrey{background-color:#f5f5f5;color:#939393}.quads-amp-code{color:#939393;height:130px}.quads-chosen-select .chosen-choices li.search-field input{min-height:25px}#quads-validate{margin-top:-20px;display:block;margin-left:2px;margin-bottom:20px;font-weight:700}
assets/css/quads-plugins-admin.min.css CHANGED
@@ -32,6 +32,7 @@
32
  margin:5px;
33
  }
34
 
 
35
  @media screen and (max-width:400px){
36
  #quick-adsense-reloaded-feedback-content {
37
  padding:0px;
32
  margin:5px;
33
  }
34
 
35
+
36
  @media screen and (max-width:400px){
37
  #quick-adsense-reloaded-feedback-content {
38
  padding:0px;
assets/js/ads.js ADDED
@@ -0,0 +1 @@
 
1
+ var wpquads_adblocker_check = true;
assets/js/quads-admin.js CHANGED
@@ -145,7 +145,8 @@ jQuery(document).ready(function ($) {
145
 
146
  // Check current url / settings page
147
  var url = window.location.search;
148
- var search = url.search("page=quads-settings&tab=imexport");
 
149
 
150
  jQuery('#quads-save-result').html("<div id='quads-loader' class='quads-loader'></div>");
151
  jQuery('#quads-loader').append('<p><img src="'+quads.path+'/wp-content/plugins/quick-adsense-reloaded/assets/images/loader1.gif"></p>').show();
@@ -166,8 +167,8 @@ jQuery(document).ready(function ($) {
166
  jQuery('#quads-save-result').hide('fast');
167
  }
168
  });
169
- // Do not preventDefault on import/export tab
170
- if ( search === -1 ){
171
  return false;
172
  }
173
  });
145
 
146
  // Check current url / settings page
147
  var url = window.location.search;
148
+ var tab_imexport = url.search("page=quads-settings&tab=imexport");
149
+ var tab_licenses = url.search("page=quads-settings&tab=licenses");
150
 
151
  jQuery('#quads-save-result').html("<div id='quads-loader' class='quads-loader'></div>");
152
  jQuery('#quads-loader').append('<p><img src="'+quads.path+'/wp-content/plugins/quick-adsense-reloaded/assets/images/loader1.gif"></p>').show();
167
  jQuery('#quads-save-result').hide('fast');
168
  }
169
  });
170
+ // Do not use ajax saving on import/export and licenses tab
171
+ if ( tab_imexport === -1 && tab_licenses ===-1 ){
172
  return false;
173
  }
174
  });
includes/admin/admin-notices.php CHANGED
@@ -29,6 +29,22 @@ function quads_admin_messages() {
29
  quads_theme_notice();
30
 
31
  quads_update_notice();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
  //quads_plugin_deactivated_notice();
34
 
@@ -233,8 +249,82 @@ function quads_update_notice() {
233
  <?php
234
  }
235
  }
236
-
 
 
237
  function quads_hide_notice(){
238
  update_option ('quads_show_update_notice', 'no');
239
  }
240
  add_action('quads_hide_update_notice', 'quads_hide_notice', 10);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  quads_theme_notice();
30
 
31
  quads_update_notice();
32
+
33
+ if (!quads_is_any_ad_activated() && quads_is_admin_page() ){
34
+ echo '<div class="notice notice-warning">'.sprintf(__('<strong>No ads are activated!</strong> You need to assign at least 1 ad to an ad spot. Fix this in <a href="%s">General Settings</a>! Alternatively you need to use a shortcode in your posts or no ads are shown at all.', 'quick-adsense-reloaded'), admin_url().'admin.php?page=quads-settings#quads_settingsgeneral_header').'</div>';
35
+ }
36
+
37
+ if (quads_get_active_ads() === 0 && quads_is_admin_page() ){
38
+ echo '<div class="notice notice-warning">'.sprintf(__('<strong>No ads defined!</strong> You need to create at least one ad code. Fix this in <a href="%s">ADSENSE CODE</a>.', 'quick-adsense-reloaded'), admin_url().'admin.php?page=quads-settings#quads_settingsadsense_header').'</div>';
39
+ }
40
+
41
+ if (!quads_is_post_type_activated() && quads_is_admin_page() ){
42
+ echo '<div class="notice notice-warning">'.sprintf(__('<strong>No ads are shown - No post types selected</strong> You need to select at least 1 post type like <i>blog</i> or <i>page</i>. Fix this in <a href="%s">General Settings</a> or no ads are shown at all.', 'quick-adsense-reloaded'), admin_url().'admin.php?page=quads-settings#quads_settingsgeneral_header').'</div>';
43
+ }
44
+
45
+ if (isset($_GET['quads-action']) && $_GET['quads-action'] === 'validate' && quads_is_admin_page() && quads_is_any_ad_activated() && quads_is_post_type_activated() && quads_get_active_ads() > 0 ){
46
+ echo '<div class="notice notice-success">' . sprintf(__('<strong>No errors detected in WP QUADS settings.</strong> If ads are still not shown read the <a href="%s" target="_blank">troubleshooting guide</a>'), 'http://wpquads.com/docs/adsense-ads-are-not-showing/?utm_source=plugin&utm_campaign=wpquads-settings&utm_medium=website&utm_term=toplink') . '</div>';
47
+ }
48
 
49
  //quads_plugin_deactivated_notice();
50
 
249
  <?php
250
  }
251
  }
252
+ /**
253
+ * Hide Notice and update db option quads_hide_notice
254
+ */
255
  function quads_hide_notice(){
256
  update_option ('quads_show_update_notice', 'no');
257
  }
258
  add_action('quads_hide_update_notice', 'quads_hide_notice', 10);
259
+
260
+ /**
261
+ * Check if any ad is activated and assigned in general settings
262
+ *
263
+ * @global array $quads_options
264
+ * @return boolean
265
+ */
266
+ function quads_is_any_ad_activated() {
267
+ global $quads_options;
268
+
269
+ // Check if custom positions location_settings is empty or does not exists
270
+ $check = array();
271
+ if( isset( $quads_options['location_settings'] ) ) {
272
+ foreach ( $quads_options['location_settings'] as $location_array ) {
273
+ if( isset( $location_array['status'] ) ) {
274
+ $check[] = $location_array['status'];
275
+ }
276
+ }
277
+ }
278
+ //wp_die(print_r($check));
279
+
280
+ if( count( $check ) === 0 &&
281
+ !isset( $quads_options['pos1']['BegnAds'] ) &&
282
+ !isset( $quads_options['pos2']['MiddAds'] ) &&
283
+ !isset( $quads_options['pos3']['EndiAds'] ) &&
284
+ !isset( $quads_options['pos4']['MoreAds'] ) &&
285
+ !isset( $quads_options['pos5']['LapaAds'] ) &&
286
+ !isset( $quads_options['pos6']['Par1Ads'] ) &&
287
+ !isset( $quads_options['pos7']['Par2Ads'] ) &&
288
+ !isset( $quads_options['pos8']['Par3Ads'] ) &&
289
+ !isset( $quads_options['pos9']['Img1Ads'] ) ) {
290
+ return false;
291
+ }
292
+ return true;
293
+ }
294
+
295
+ /**
296
+ * Check if any post type is enabled
297
+ *
298
+ * @global array $quads_options
299
+ * @return boolean
300
+ */
301
+ function quads_is_post_type_activated(){
302
+ global $quads_options;
303
+
304
+ if (empty($quads_options['post_types'])){
305
+ return false;
306
+ }
307
+ return true;
308
+ }
309
+
310
+ /**
311
+ * Check if ad codes are populated
312
+ *
313
+ * @global array $quads_options
314
+ * @return booleantrue if ads are empty
315
+ */
316
+ function quads_ads_empty() {
317
+ global $quads_options;
318
+
319
+ $check = array();
320
+
321
+ for ( $i = 1; $i <= 10; $i++ ) {
322
+ if( !empty( $quads_options['ad' . $i]['code'] ) ) {
323
+ $check[] = 'true';
324
+ }
325
+ }
326
+ if( count( $check ) === 0 ) {
327
+ return true;
328
+ }
329
+ return false;
330
+ }
includes/admin/settings/display-settings.php CHANGED
@@ -1,344 +1,349 @@
1
- <?php
2
- /**
3
- * Admin Options Page
4
- *
5
- * @package QUADS
6
- * @subpackage Admin/Settings
7
- * @copyright Copyright (c) 2015, René Hermenau
8
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
- * @since 1.0
10
- */
11
-
12
- // Exit if accessed directly
13
- if ( ! defined( 'ABSPATH' ) ) exit;
14
-
15
- /* Returns list elements for jQuery tab navigation
16
- * based on header callback
17
- *
18
- * @since 2.1.2
19
- * @todo Use sprintf to sanitize $field['id'] instead using str_replace() Should be much faster?
20
- * @return string
21
- */
22
-
23
- function quads_get_tab_header($page, $section){
24
- global $quads_options;
25
- global $wp_settings_fields;
26
-
27
- if (!isset($wp_settings_fields[$page][$section]))
28
- return;
29
-
30
- echo '<ul>';
31
- foreach ((array) $wp_settings_fields[$page][$section] as $field) {
32
- $sanitizedID = str_replace('[', '', $field['id'] );
33
- $sanitizedID = str_replace(']', '', $sanitizedID );
34
- if ( strpos($field['callback'],'header') !== false && !quads_is_excluded(array('help', 'licenses') ) ) {
35
- echo '<li class="quads-tabs"><a href="#' . $sanitizedID . '">' . $field['title'] .'</a></li>';
36
- }
37
- }
38
- echo '</ul>';
39
- }
40
-
41
- /**
42
- * Check if current page is excluded
43
- *
44
- * @param array $pages
45
- * @return boolean
46
- */
47
- function quads_is_excluded($pages){
48
- if (isset($_GET['tab'])){
49
- $currentpage = $_GET['tab'];
50
- if (isset($currentpage) && in_array($currentpage, $pages))
51
- return true;
52
- }
53
- }
54
-
55
- /**
56
- * Print out the settings fields for a particular settings section
57
- *
58
- * Part of the Settings API. Use this in a settings page to output
59
- * a specific section. Should normally be called by do_settings_sections()
60
- * rather than directly.
61
- *
62
- * @global $wp_settings_fields Storage array of settings fields and their pages/sections
63
- * @return string
64
- *
65
- * @since 2.1.2
66
- *
67
- * @param string $page Slug title of the admin page who's settings fields you want to show.
68
- * @param section $section Slug title of the settings section who's fields you want to show.
69
- *
70
- * Copied from WP Core 4.0 /wp-admin/includes/template.php do_settings_fields()
71
- * We use our own function to be able to create jQuery tabs with easytabs()
72
- *
73
- * We dont use tables here any longer. Are we stuck in the nineties?
74
- * @todo Use sprintf to sanitize $field['id'] instead using str_replace() Should be faster?
75
- * @todo some media queries for better responisbility
76
- */
77
- function quads_do_settings_fields($page, $section) {
78
- global $wp_settings_fields;
79
- $header = false;
80
- $firstHeader = false;
81
-
82
- if (!isset($wp_settings_fields[$page][$section]))
83
- return;
84
-
85
- // Check first if any callback header registered
86
- foreach ((array) $wp_settings_fields[$page][$section] as $field) {
87
- strpos($field['callback'],'header') !== false ? $header = true : $header = false;
88
-
89
- if ($header === true)
90
- break;
91
- }
92
-
93
- foreach ((array) $wp_settings_fields[$page][$section] as $field) {
94
-
95
- $sanitizedID = str_replace('[', '', $field['id'] );
96
- $sanitizedID = str_replace(']', '', $sanitizedID );
97
-
98
- // Check if header has been created previously
99
- if (strpos($field['callback'],'header') !== false && $firstHeader === false) {
100
-
101
- echo '<div id="' . $sanitizedID . '">';
102
- echo '<table class="quads-form-table"><tbody>';
103
- $firstHeader = true;
104
-
105
- } elseif (strpos($field['callback'],'header') !== false && $firstHeader === true) {
106
- // Header has been created previously so we have to close the first opened div
107
- echo '</table></div><div id="' . $sanitizedID . '">';
108
- echo '<table class="quads-form-table"><tbody>';
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
- }
127
-
128
- else {
129
- echo '';
130
- }
131
-
132
-
133
- echo '<tr><td>';
134
- call_user_func($field['callback'], $field['args']);
135
- echo '<tr><td>';
136
-
137
-
138
-
139
- }
140
- echo '</tbody></table>';
141
- if ($header === true){
142
- echo '</div>';
143
- }
144
- }
145
-
146
- /**
147
- * If title is one of these entries do not show it
148
- */
149
- function quads_is_excluded_title($string){
150
- $haystack = array('ad1','ad2','ad3','ad4','ad5','ad6','ad7','ad8','ad9','ad10',
151
- 'ad1_widget',
152
- 'ad2_widget',
153
- 'ad3_widget',
154
- 'ad4_widget',
155
- 'ad5_widget',
156
- 'ad6_widget',
157
- 'ad7_widget',
158
- 'ad8_widget',
159
- 'ad9_widget',
160
- 'ad10_widget'
161
- );
162
-
163
- if (in_array($string, $haystack)){
164
- return true;
165
- }
166
- return false;
167
- }
168
-
169
- /**
170
- * Options Page
171
- *
172
- * Renders the options page contents.
173
- *
174
- * @since 1.0
175
- * @global $quads_options Array of all the QUADS Options
176
- * @return void
177
- */
178
- function quads_options_page() {
179
- global $quads_options;
180
-
181
- $active_tab = isset( $_GET[ 'tab' ] ) && array_key_exists( $_GET['tab'], quads_get_settings_tabs() ) ? $_GET[ 'tab' ] : 'general';
182
-
183
- ob_start();
184
- ?>
185
- <div class="wrap quads_admin">
186
- <h1 style="text-align:center;"> <?php echo QUADS_NAME . ' ' . QUADS_VERSION; ?></h1>
187
- <div class="about-text" style="font-weight: 400;line-height: 1.6em;text-align:center;">
188
- <div class='quads-share-button-container'>
189
- <div class='quads-share-button quads-share-button-twitter' data-share-url="https://wordpress.org/plugins/quick-adsense-reloaded">
190
- <div clas='box'>
191
- <a href="https://twitter.com/share?url=http://wpquads.com&text=WPQUADS+-+The quickest+and+most+easiest+way+to+integrate+AdSense+into+WordPress+websites+@wpquads" target='_blank'>
192
- <span class='quads-share'><?php echo __('Shout out a tweet','quick-adsense-reloaded'); ?></span>
193
- </a>
194
- </div>
195
- </div>
196
- <div class="quads-share-button quads-share-button-facebook" data-share-url="https://wordpress.org/plugins/quick-adsense-reloaded">
197
- <div class="box">
198
- <a href="https://www.facebook.com/sharer/sharer.php?u=http://wpquads.com" target="_blank">
199
- <span class='quads-share'><?php echo __('Share on Facebook','quick-adsense-reloaded'); ?></span>
200
- </a>
201
- </div>
202
- </div>
203
- </div>
204
- </div>
205
- <h2 class="nav-tab-wrapper">
206
- <?php
207
- foreach( quads_get_settings_tabs() as $tab_id => $tab_name ) {
208
-
209
- $tab_url = esc_url(add_query_arg( array(
210
- 'settings-updated' => false,
211
- 'tab' => $tab_id
212
- ) ));
213
-
214
- $active = $active_tab == $tab_id ? ' nav-tab-active' : '';
215
-
216
- echo '<a href="' . esc_url( $tab_url ) . '" title="' . esc_attr( $tab_name ) . '" class="nav-tab' . $active . '">';
217
- echo esc_html( $tab_name );
218
- echo '</a>';
219
- }
220
- ?>
221
- </h2>
222
- <div id="quads_tab_container" class="quads_tab_container">
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 );
230
- ?>
231
- <!--</table>-->
232
-
233
- <?php settings_errors(); ?>
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>
242
- <?php
243
- echo sprintf( __( '<strong>If you like this plugin please do us a BIG favor and give us a 5 star rating <a href="%s" target="_blank">here</a> . If you`re not happy, please open a <a href="%2s" target="_blank">support ticket</a>, so that we can sort it out. Thank you!</strong>', 'quick-adsense-reloaded' ),
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(); ?>
253
- </div><!-- #tab_container-->
254
- <div id="quads-save-result"></div>
255
- <div class="quads-admin-debug"><?php echo quads_get_debug_messages(); ?></div>
256
- <?php echo quads_render_adsense_form(); ?>
257
- </div><!-- .wrap -->
258
- <?php
259
- echo ob_get_clean();
260
- }
261
-
262
- function quads_get_debug_messages(){
263
- global $quads_options;
264
-
265
- if (isset($quads_options['debug_mode'])){
266
- echo '<pre style="clear:both;">';
267
- var_dump($quads_options);
268
- echo '</pre>';
269
- }
270
- }
271
-
272
- /**
273
- * Render ad and return it when plugin is not pro version
274
- * @return string
275
- */
276
- function quads_get_advertising() {
277
-
278
- if ( quads_is_advanced() ){
279
- return '';
280
- }
281
- ob_start();
282
- ?>
283
- <div class="quads-panel-sidebar" style="float:left;min-width: 301px;margin-left: 1px;margin-top:0px;">
284
- <a href="http://wpquads.com/?utm_source=wpquads&utm_medium=banner&utm_term=click-quads&utm_campaign=wpquads" target="_blank">
285
- <img src="<?php echo QUADS_PLUGIN_URL . '/assets/images/quads_banner_250x521_buy.png'; ?>">
286
- </a>
287
- <br>
288
- <a style="display:block;" href="http://demo.clickfraud-monitoring.com/?utm_source=wpquads&utm_medium=banner&utm_term=click-cfm&utm_campaign=wpquads" target="_blank">
289
- <img src="<?php echo QUADS_PLUGIN_URL . '/assets/images/banner_250x296-cfm.png'; ?>">
290
- </a>
291
- </div>
292
- <?php
293
- echo ob_get_clean();
294
- }
295
-
296
- /**
297
- * Render social buttons
298
- *
299
- * @return void
300
- */
301
- function quads_render_social(){
302
- ob_start()?>
303
-
304
- <div class='quads-share-button-container'>
305
- <div class='quads-share-button quads-share-button-twitter' data-share-url="https://wordpress.org/plugins/quick-adsense-reloaded">
306
- <div clas='box'>
307
- <a href="https://twitter.com/share?url=https://wordpress.org/plugins/quick-adsense-reloaded&text=Quick%20AdSense%20reloaded%20-%20a%20brand%20new%20fork%20of%20the%20popular%20AdSense%20Plugin%20Quick%20Adsense!" target='_blank'>
308
- <span class='quads-share'><?php echo __('Tweet','quick-adsense-reloaded'); ?></span>
309
- </a>
310
- </div>
311
- </div>
312
-
313
- <div class="quads-share-button quads-share-button-facebook" data-share-url="https://wordpress.org/plugins/quick-adsense-reloaded">
314
- <div class="box">
315
- <a href="https://www.facebook.com/sharer/sharer.php?u=https://wordpress.org/plugins/quick-adsense-reloaded" target="_blank">
316
- <span class='quads-share'><?php echo __('Share','quick-adsense-reloaded'); ?></span>
317
- </a>
318
- </div>
319
- </div>
320
- </div>
321
-
322
- <?php
323
- echo ob_get_clean();
324
- }
325
-
326
-
327
- /**
328
- * Render AdSense Form
329
- */
330
- function quads_render_adsense_form(){
331
-
332
- ?>
333
- <div id="quads-adsense-bg-div" style="display: none;">
334
- <div id="quads-adsense-container">
335
- <h3><?php _e( 'Copy ad code from AdSense account and paste it here', 'quick-adsense-reloaded' ); ?></h3>
336
- <textarea rows="15" cols="55" id="quads-adsense-form"></textarea><hr />
337
- <button class="button button-primary" id="quads-paste-button"><?php _e( 'Get Code', 'quick-adsense-reloaded' ); ?></button>&nbsp;&nbsp;
338
- <button class="button button-secondary" id="quads-close-button"><?php _e( 'Close', 'quick-adsense-reloaded' ); ?></button>
339
- <div id="quads-msg"></div>
340
- <input type="hidden" id="quads-adsense-id" value="">
341
- </div>
342
- </div>
343
- <?php
344
- }
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin Options Page
4
+ *
5
+ * @package QUADS
6
+ * @subpackage Admin/Settings
7
+ * @copyright Copyright (c) 2015, René Hermenau
8
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
+ * @since 1.0
10
+ */
11
+
12
+ // Exit if accessed directly
13
+ if ( ! defined( 'ABSPATH' ) ) exit;
14
+
15
+ /* Returns list elements for jQuery tab navigation
16
+ * based on header callback
17
+ *
18
+ * @since 2.1.2
19
+ * @todo Use sprintf to sanitize $field['id'] instead using str_replace() Should be much faster?
20
+ * @return string
21
+ */
22
+
23
+ function quads_get_tab_header($page, $section){
24
+ global $quads_options;
25
+ global $wp_settings_fields;
26
+
27
+ if (!isset($wp_settings_fields[$page][$section]))
28
+ return;
29
+
30
+ echo '<ul>';
31
+ foreach ((array) $wp_settings_fields[$page][$section] as $field) {
32
+ $sanitizedID = str_replace('[', '', $field['id'] );
33
+ $sanitizedID = str_replace(']', '', $sanitizedID );
34
+ if ( strpos($field['callback'],'header') !== false && !quads_is_excluded(array('help', 'licenses') ) ) {
35
+ echo '<li class="quads-tabs"><a href="#' . $sanitizedID . '">' . $field['title'] .'</a></li>';
36
+ }
37
+ }
38
+ echo '</ul>';
39
+ }
40
+
41
+ /**
42
+ * Check if current page is excluded
43
+ *
44
+ * @param array $pages
45
+ * @return boolean
46
+ */
47
+ function quads_is_excluded($pages){
48
+ if (isset($_GET['tab'])){
49
+ $currentpage = $_GET['tab'];
50
+ if (isset($currentpage) && in_array($currentpage, $pages))
51
+ return true;
52
+ }
53
+ }
54
+
55
+ /**
56
+ * Print out the settings fields for a particular settings section
57
+ *
58
+ * Part of the Settings API. Use this in a settings page to output
59
+ * a specific section. Should normally be called by do_settings_sections()
60
+ * rather than directly.
61
+ *
62
+ * @global $wp_settings_fields Storage array of settings fields and their pages/sections
63
+ * @return string
64
+ *
65
+ * @since 2.1.2
66
+ *
67
+ * @param string $page Slug title of the admin page who's settings fields you want to show.
68
+ * @param section $section Slug title of the settings section who's fields you want to show.
69
+ *
70
+ * Copied from WP Core 4.0 /wp-admin/includes/template.php do_settings_fields()
71
+ * We use our own function to be able to create jQuery tabs with easytabs()
72
+ *
73
+ * We dont use tables here any longer. Are we stuck in the nineties?
74
+ * @todo Use sprintf to sanitize $field['id'] instead using str_replace() Should be faster?
75
+ * @todo some media queries for better responisbility
76
+ */
77
+ function quads_do_settings_fields($page, $section) {
78
+ global $wp_settings_fields;
79
+ $header = false;
80
+ $firstHeader = false;
81
+
82
+ if (!isset($wp_settings_fields[$page][$section]))
83
+ return;
84
+
85
+ // Check first if any callback header registered
86
+ foreach ((array) $wp_settings_fields[$page][$section] as $field) {
87
+ strpos($field['callback'],'header') !== false ? $header = true : $header = false;
88
+
89
+ if ($header === true)
90
+ break;
91
+ }
92
+
93
+ foreach ((array) $wp_settings_fields[$page][$section] as $field) {
94
+
95
+ $sanitizedID = str_replace('[', '', $field['id'] );
96
+ $sanitizedID = str_replace(']', '', $sanitizedID );
97
+
98
+ // Check if header has been created previously
99
+ if (strpos($field['callback'],'header') !== false && $firstHeader === false) {
100
+
101
+ echo '<div id="' . $sanitizedID . '">';
102
+ echo '<table class="quads-form-table"><tbody>';
103
+ $firstHeader = true;
104
+
105
+ } elseif (strpos($field['callback'],'header') !== false && $firstHeader === true) {
106
+ // Header has been created previously so we have to close the first opened div
107
+ echo '</table></div><div id="' . $sanitizedID . '">';
108
+ echo '<table class="quads-form-table"><tbody>';
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
+ }
127
+
128
+ else {
129
+ echo '';
130
+ }
131
+
132
+
133
+ echo '<tr><td>';
134
+ call_user_func($field['callback'], $field['args']);
135
+ echo '<tr><td>';
136
+
137
+
138
+
139
+ }
140
+ echo '</tbody></table>';
141
+ if ($header === true){
142
+ echo '</div>';
143
+ }
144
+ }
145
+
146
+ /**
147
+ * If title is one of these entries do not show it
148
+ */
149
+ function quads_is_excluded_title($string){
150
+ $haystack = array('ad1','ad2','ad3','ad4','ad5','ad6','ad7','ad8','ad9','ad10',
151
+ 'ad1_widget',
152
+ 'ad2_widget',
153
+ 'ad3_widget',
154
+ 'ad4_widget',
155
+ 'ad5_widget',
156
+ 'ad6_widget',
157
+ 'ad7_widget',
158
+ 'ad8_widget',
159
+ 'ad9_widget',
160
+ 'ad10_widget'
161
+ );
162
+
163
+ if (in_array($string, $haystack)){
164
+ return true;
165
+ }
166
+ return false;
167
+ }
168
+
169
+ /**
170
+ * Options Page
171
+ *
172
+ * Renders the options page contents.
173
+ *
174
+ * @since 1.0
175
+ * @global $quads_options Array of all the QUADS Options
176
+ * @return void
177
+ */
178
+ function quads_options_page() {
179
+ global $quads_options;
180
+
181
+ $active_tab = isset( $_GET[ 'tab' ] ) && array_key_exists( $_GET['tab'], quads_get_settings_tabs() ) ? $_GET[ 'tab' ] : 'general';
182
+
183
+ ob_start();
184
+ ?>
185
+ <div class="wrap quads_admin">
186
+ <h1 style="text-align:center;"> <?php echo QUADS_NAME . ' ' . QUADS_VERSION; ?></h1>
187
+ <div class="about-text" style="font-weight: 400;line-height: 1.6em;text-align:center;">
188
+ <div class='quads-share-button-container'>
189
+ <div class='quads-share-button quads-share-button-twitter' data-share-url="https://wordpress.org/plugins/quick-adsense-reloaded">
190
+ <div clas='box'>
191
+ <a href="https://twitter.com/share?url=http://wpquads.com&text=WPQUADS+-+The quickest+and+most+easiest+way+to+integrate+AdSense+into+WordPress+websites+@wpquads" target='_blank'>
192
+ <span class='quads-share'><?php echo __('Shout out a tweet','quick-adsense-reloaded'); ?></span>
193
+ </a>
194
+ </div>
195
+ </div>
196
+ <div class="quads-share-button quads-share-button-facebook" data-share-url="https://wordpress.org/plugins/quick-adsense-reloaded">
197
+ <div class="box">
198
+ <a href="https://www.facebook.com/sharer/sharer.php?u=http://wpquads.com" target="_blank">
199
+ <span class='quads-share'><?php echo __('Share on Facebook','quick-adsense-reloaded'); ?></span>
200
+ </a>
201
+ </div>
202
+ </div>
203
+ </div>
204
+ </div>
205
+ <h2 class="nav-tab-wrapper">
206
+ <?php
207
+ foreach( quads_get_settings_tabs() as $tab_id => $tab_name ) {
208
+
209
+ $tab_url = esc_url(add_query_arg( array(
210
+ 'settings-updated' => false,
211
+ 'tab' => $tab_id
212
+ ) ));
213
+
214
+ $active = $active_tab == $tab_id ? ' nav-tab-active' : '';
215
+
216
+ echo '<a href="' . esc_url( $tab_url ) . '" title="' . esc_attr( $tab_name ) . '" class="nav-tab' . $active . '">';
217
+ echo esc_html( $tab_name );
218
+ echo '</a>';
219
+ }
220
+ ?>
221
+ </h2>
222
+ <div id="quads_tab_container" class="quads_tab_container">
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 );
230
+ ?>
231
+ <!--</table>-->
232
+
233
+ <?php settings_errors(); ?>
234
+ <?php
235
+ // do not show save button on add-on page
236
+ if ($active_tab !== 'addons'){
237
+ $other_attributes = array( 'id' => 'quads-submit-button' );
238
+ submit_button(null, 'primary', 'quads-save-settings' , true, $other_attributes );
239
+ ?>
240
+ <a href="<?php echo admin_url() . '/admin.php?page=quads-settings&quads-action=validate'; ?> " id="quads-validate"><?php _e('Validate Settings','quick-adsense-reloaded')?></a>
241
+ <?php
242
+ }
243
+ ?>
244
+ </form>
245
+ <?php
246
+ if ($active_tab !== 'addons' && $active_tab !== 'licenses'){
247
+ echo sprintf( __( '<strong>If you like this plugin please do us a BIG favor and give us a 5 star rating <a href="%s" target="_blank">here</a> . If you`re not happy, please open a <a href="%2s" target="_blank">support ticket</a>, so that we can sort it out. Thank you!</strong>', 'quick-adsense-reloaded' ),
248
+ 'https://wordpress.org/support/plugin/quick-adsense-reloaded/reviews/#new-post',
249
+ 'http://wpquads.com/support/'
250
+ );
251
+ 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' ),
252
+ 'http://wpquads.com/docs/adsense-ads-are-not-showing/?utm_source=plugin&utm_campaign=wpquads-settings&utm_medium=website&utm_term=bottomlink'
253
+ );
254
+ }
255
+ ?>
256
+ </div> <!-- new //-->
257
+ <?php quads_get_advertising(); ?>
258
+ </div><!-- #tab_container-->
259
+ <div id="quads-save-result"></div>
260
+ <div class="quads-admin-debug"><?php echo quads_get_debug_messages(); ?></div>
261
+ <?php echo quads_render_adsense_form(); ?>
262
+ </div><!-- .wrap -->
263
+ <?php
264
+ echo ob_get_clean();
265
+ }
266
+
267
+ function quads_get_debug_messages(){
268
+ global $quads_options;
269
+
270
+ if (isset($quads_options['debug_mode'])){
271
+ echo '<pre style="clear:both;">';
272
+ var_dump($quads_options);
273
+ echo '</pre>';
274
+ }
275
+ }
276
+
277
+ /**
278
+ * Render ad and return it when plugin is not pro version
279
+ * @return string
280
+ */
281
+ function quads_get_advertising() {
282
+
283
+ if ( quads_is_advanced() ){
284
+ return '';
285
+ }
286
+ ob_start();
287
+ ?>
288
+ <div class="quads-panel-sidebar" style="float:left;min-width: 301px;margin-left: 1px;margin-top:0px;">
289
+ <a href="http://wpquads.com/?utm_source=wpquads&utm_medium=banner&utm_term=click-quads&utm_campaign=wpquads" target="_blank">
290
+ <img src="<?php echo QUADS_PLUGIN_URL . '/assets/images/quads_banner_250x521_buy.png'; ?>">
291
+ </a>
292
+ <br>
293
+ <a style="display:block;" href="http://demo.clickfraud-monitoring.com/?utm_source=wpquads&utm_medium=banner&utm_term=click-cfm&utm_campaign=wpquads" target="_blank">
294
+ <img src="<?php echo QUADS_PLUGIN_URL . '/assets/images/banner_250x296-cfm.png'; ?>">
295
+ </a>
296
+ </div>
297
+ <?php
298
+ echo ob_get_clean();
299
+ }
300
+
301
+ /**
302
+ * Render social buttons
303
+ *
304
+ * @return void
305
+ */
306
+ function quads_render_social(){
307
+ ob_start()?>
308
+
309
+ <div class='quads-share-button-container'>
310
+ <div class='quads-share-button quads-share-button-twitter' data-share-url="https://wordpress.org/plugins/quick-adsense-reloaded">
311
+ <div clas='box'>
312
+ <a href="https://twitter.com/share?url=https://wordpress.org/plugins/quick-adsense-reloaded&text=Quick%20AdSense%20reloaded%20-%20a%20brand%20new%20fork%20of%20the%20popular%20AdSense%20Plugin%20Quick%20Adsense!" target='_blank'>
313
+ <span class='quads-share'><?php echo __('Tweet','quick-adsense-reloaded'); ?></span>
314
+ </a>
315
+ </div>
316
+ </div>
317
+
318
+ <div class="quads-share-button quads-share-button-facebook" data-share-url="https://wordpress.org/plugins/quick-adsense-reloaded">
319
+ <div class="box">
320
+ <a href="https://www.facebook.com/sharer/sharer.php?u=https://wordpress.org/plugins/quick-adsense-reloaded" target="_blank">
321
+ <span class='quads-share'><?php echo __('Share','quick-adsense-reloaded'); ?></span>
322
+ </a>
323
+ </div>
324
+ </div>
325
+ </div>
326
+
327
+ <?php
328
+ echo ob_get_clean();
329
+ }
330
+
331
+
332
+ /**
333
+ * Render AdSense Form
334
+ */
335
+ function quads_render_adsense_form(){
336
+
337
+ ?>
338
+ <div id="quads-adsense-bg-div" style="display: none;">
339
+ <div id="quads-adsense-container">
340
+ <h3><?php _e( 'Copy ad code from AdSense account and paste it here', 'quick-adsense-reloaded' ); ?></h3>
341
+ <textarea rows="15" cols="55" id="quads-adsense-form"></textarea><hr />
342
+ <button class="button button-primary" id="quads-paste-button"><?php _e( 'Get Code', 'quick-adsense-reloaded' ); ?></button>&nbsp;&nbsp;
343
+ <button class="button button-secondary" id="quads-close-button"><?php _e( 'Close', 'quick-adsense-reloaded' ); ?></button>
344
+ <div id="quads-msg"></div>
345
+ <input type="hidden" id="quads-adsense-id" value="">
346
+ </div>
347
+ </div>
348
+ <?php
349
+ }
includes/admin/settings/register-settings.php CHANGED
@@ -124,7 +124,7 @@ function quads_get_registered_settings() {
124
  'general' => apply_filters( 'quads_settings_general', array(
125
  array(
126
  'id' => 'general_header',
127
- 'name' => '<strong>' . __( 'General Settings', 'quick-adsense-reloaded' ) . '</strong>',
128
  'desc' => __( '', 'quick-adsense-reloaded' ),
129
  'type' => 'header'
130
  ),
@@ -145,6 +145,7 @@ function quads_get_registered_settings() {
145
  7 => '7',
146
  8 => '8',
147
  9 => '9',
 
148
  11 => '11',
149
  12 => '12',
150
  13 => '13',
@@ -159,7 +160,7 @@ function quads_get_registered_settings() {
159
  ),
160
  array(
161
  'id' => 'ad_position',
162
- 'name' => __( 'Position', 'quick-adsense-reloaded' ),
163
  'desc' => __( 'Assign and activate ads on specific ad places', 'quick-adsense-reloaded' ),
164
  'type' => 'ad_position'
165
  ),
@@ -357,21 +358,26 @@ function quads_get_registered_settings() {
357
  'priority' => array(
358
  'id' => 'priority',
359
  'name' => __( 'Load Priority', 'quick-adsense-reloaded' ),
360
- 'desc' => __( 'Do not change this if everything is working fine. It could result in non showing ads! A lower value loads WP QUADS earlier than other Plugins. Use a higher value for loading WP QUADS later. Try to lower the value to a value less than 10 if not all ads are shown. <strong>Default:</strong> 20', 'quick-adsense-reloaded' ),
 
361
  'type' => 'number',
362
  'size' => 'small',
363
  'std' => 20
364
  ),
365
  'create_settings' => array(
366
  'id' => 'create_settings',
367
- 'name' => __( 'Settings link', 'quick-adsense-reloaded' ),
368
- 'desc' => __( 'Make the WPQUADS settings available from <strong>Settings->WPQUADS</strong> This will remove the primary menu button from the admin sidebar', 'quick-adsense-reloaded' ),
 
 
369
  'type' => 'checkbox',
370
  ),
371
  'uninstall_on_delete' => array(
372
  'id' => 'uninstall_on_delete',
373
- 'name' => __( 'Remove Data on Uninstall?', 'quick-adsense-reloaded' ),
374
- 'desc' => __( 'Check this box if you would like <strong>Settings->WPQUADS</strong> to completely remove all of its data when the plugin is deleted.', 'quick-adsense-reloaded' ),
 
 
375
  'type' => 'checkbox'
376
  ),
377
  )
124
  'general' => apply_filters( 'quads_settings_general', array(
125
  array(
126
  'id' => 'general_header',
127
+ 'name' => '<strong>' . __( 'General & Position', 'quick-adsense-reloaded' ) . '</strong>',
128
  'desc' => __( '', 'quick-adsense-reloaded' ),
129
  'type' => 'header'
130
  ),
145
  7 => '7',
146
  8 => '8',
147
  9 => '9',
148
+ 10 => '10',
149
  11 => '11',
150
  12 => '12',
151
  13 => '13',
160
  ),
161
  array(
162
  'id' => 'ad_position',
163
+ 'name' => __( 'Position - Default Ads', 'quick-adsense-reloaded' ),
164
  'desc' => __( 'Assign and activate ads on specific ad places', 'quick-adsense-reloaded' ),
165
  'type' => 'ad_position'
166
  ),
358
  'priority' => array(
359
  'id' => 'priority',
360
  'name' => __( 'Load Priority', 'quick-adsense-reloaded' ),
361
+ //'desc' => __( 'Do not change this until you know what you are doing. Usually the default value 20 is working fine. Changing this value can lead to unexpected results like ads not showing or loaded on wrong order. <strong>Default:</strong> 20', 'quick-adsense-reloaded' ),
362
+ 'helper-desc' => __( 'Do not change this until you know what you are doing. Usually the default value 20 is working fine. Changing this value can lead to unexpected results like ads not showing or loaded on wrong order. <strong>Default:</strong> 20', 'quick-adsense-reloaded' ),
363
  'type' => 'number',
364
  'size' => 'small',
365
  'std' => 20
366
  ),
367
  'create_settings' => array(
368
  'id' => 'create_settings',
369
+ 'name' => __( 'Remove Menue Button', 'quick-adsense-reloaded' ),
370
+ //'desc' => __( 'Make the WPQUADS settings available from <strong>Settings->WPQUADS</strong>. This will remove the primary menu button from the admin sidebar', 'quick-adsense-reloaded' ),
371
+ 'desc' => __('Remove'),
372
+ 'helper-desc' => __( 'Make the WPQUADS settings available from <strong>Settings->WPQUADS</strong>. This will remove the primary menu button from the admin sidebar', 'quick-adsense-reloaded' ),
373
  'type' => 'checkbox',
374
  ),
375
  'uninstall_on_delete' => array(
376
  'id' => 'uninstall_on_delete',
377
+ 'name' => __( 'Delete Data on Uninstall?', 'quick-adsense-reloaded' ),
378
+ //'desc' => __( 'Check this box if you would like <strong>Settings->WPQUADS</strong> to completely remove all of its data when the plugin is deleted.', 'quick-adsense-reloaded' ),
379
+ 'helper-desc' => __( 'Check this box if you would like <strong>Settings->WPQUADS</strong> to completely remove all of its data when the plugin is deleted.', 'quick-adsense-reloaded' ),
380
+ 'desc' => 'Delete',
381
  'type' => 'checkbox'
382
  ),
383
  )
includes/admin/upgrades/upgrade-functions.php CHANGED
@@ -132,7 +132,8 @@ function quads_is_advanced_1_2_7() {
132
  }
133
 
134
  /**
135
- * Convert all post/page setting to new post_type global options array
 
136
  * @global array $quads_options
137
  * @return true if success
138
  */
132
  }
133
 
134
  /**
135
+ * Convert all previous post/page settings to the new post_type global options array which has been introduced in 1.4.0
136
+ *
137
  * @global array $quads_options
138
  * @return true if success
139
  */
includes/api.php CHANGED
@@ -34,7 +34,7 @@
34
 
35
 
36
  /**
37
- * Return ad locations HTML based on new API.
38
  *
39
  * @param $html
40
  * @return string Locations HTML
@@ -120,12 +120,14 @@ function quads_has_ad( $location ) {
120
  return apply_filters( 'quads_has_ad', $result, $location );
121
  }
122
  /**
123
- * Display an ad
124
  *
125
  * @param array $args Displaying options
126
  * @return string|void Ad code or none if echo set to true
127
  */
128
  function quads_ad( $args ) {
 
 
129
  $defaults = array(
130
  'location' => '',
131
  'echo' => true,
@@ -133,14 +135,18 @@ function quads_ad( $args ) {
133
  $args = wp_parse_args( $args, $defaults );
134
  $code = '';
135
 
 
 
 
 
 
136
  if ( quads_has_ad( $args['location'] ) ) {
137
  global $quads_options;
138
 
139
- quads_set_ad_count_custom(); // increase amount of shortcode ads
140
 
141
  $location_settings = quads_get_ad_location_settings( $args['location'] );
142
  $code .= "\n".'<!-- WP QUADS Custom Ad v. ' . QUADS_VERSION .' -->'."\n";
143
- //$code .= $quads_options[ 'ad' . $location_settings['ad'] ]['code'];
144
  $code .= '<div class="quads-location quads-ad' .$location_settings['ad']. '" id="quads-ad' .$location_settings['ad']. '">'."\n";
145
  $code .= quads_render_ad( 'ad' . $location_settings['ad'], $quads_options[ 'ad' . $location_settings['ad'] ]['code'] );
146
  $code .= '</div>';
34
 
35
 
36
  /**
37
+ * Return ad locations HTML based on new API in general settings
38
  *
39
  * @param $html
40
  * @return string Locations HTML
120
  return apply_filters( 'quads_has_ad', $result, $location );
121
  }
122
  /**
123
+ * Display a custom ad
124
  *
125
  * @param array $args Displaying options
126
  * @return string|void Ad code or none if echo set to true
127
  */
128
  function quads_ad( $args ) {
129
+ global $post;
130
+
131
  $defaults = array(
132
  'location' => '',
133
  'echo' => true,
135
  $args = wp_parse_args( $args, $defaults );
136
  $code = '';
137
 
138
+ // All ads are deactivated via post meta settings
139
+ if( quads_check_meta_setting( 'NoAds' ) === '1' ){
140
+ return false;
141
+ }
142
+
143
  if ( quads_has_ad( $args['location'] ) ) {
144
  global $quads_options;
145
 
146
+ quads_set_ad_count_custom(); // increase amount of Custom ads
147
 
148
  $location_settings = quads_get_ad_location_settings( $args['location'] );
149
  $code .= "\n".'<!-- WP QUADS Custom Ad v. ' . QUADS_VERSION .' -->'."\n";
 
150
  $code .= '<div class="quads-location quads-ad' .$location_settings['ad']. '" id="quads-ad' .$location_settings['ad']. '">'."\n";
151
  $code .= quads_render_ad( 'ad' . $location_settings['ad'], $quads_options[ 'ad' . $location_settings['ad'] ]['code'] );
152
  $code .= '</div>';
includes/conditionals.php CHANGED
@@ -70,9 +70,11 @@ function quads_get_total_ad_count(){
70
  $shortcode = isset($visibleShortcodeAds) ? (int)$visibleShortcodeAds : 0;
71
  $content = isset($visibleContentAdsGlobal) ? (int)$visibleContentAdsGlobal : 0;
72
  $custom = isset($ad_count_custom) ? (int)$ad_count_custom : 0;
73
- $widget = isset($ad_count_widget) ? (int)$ad_count_widget : 0;
74
-
75
- //wp_die($ad_count_widget);
 
 
76
  return $shortcode + $content + $custom + $widget;
77
  }
78
 
@@ -89,6 +91,10 @@ function quads_ad_reach_max_count(){
89
  global $quads_options;
90
 
91
  $maxads = isset($quads_options['maxads']) ? $quads_options['maxads'] : 10;
 
 
 
 
92
  if ( quads_get_total_ad_count() >= $maxads ){
93
  return true;
94
  }
70
  $shortcode = isset($visibleShortcodeAds) ? (int)$visibleShortcodeAds : 0;
71
  $content = isset($visibleContentAdsGlobal) ? (int)$visibleContentAdsGlobal : 0;
72
  $custom = isset($ad_count_custom) ? (int)$ad_count_custom : 0;
73
+ //$widget = isset($ad_count_widget) ? (int)$ad_count_widget : 0;
74
+ $widget = quads_get_number_widget_ads();
75
+
76
+ //wp_die($widget);
77
+ //wp_die( $shortcode + $content + $custom + $widget);
78
  return $shortcode + $content + $custom + $widget;
79
  }
80
 
91
  global $quads_options;
92
 
93
  $maxads = isset($quads_options['maxads']) ? $quads_options['maxads'] : 10;
94
+ $maxads = $maxads - quads_get_number_widget_ads();
95
+
96
+ //echo 'Total ads: '. quads_get_total_ad_count() . ' maxads: '. $maxads . '<br>';
97
+
98
  if ( quads_get_total_ad_count() >= $maxads ){
99
  return true;
100
  }
includes/frontend-checks.php ADDED
@@ -0,0 +1,298 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Helper Functions
4
+ *
5
+ * @package QUADS
6
+ * @subpackage INCLUDES
7
+ * @copyright Copyright (c) 2016, René Hermenau
8
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
+ * @author René Hermenau
10
+ * @author Thank you Thomas Maier (advanced ads) for that great inspiration. I borrowed some code. Hope you dont mind:)
11
+ * @since 1.4.3
12
+ */
13
+ // Exit if accessed directly
14
+ if( !defined( 'ABSPATH' ) )
15
+ exit;
16
+
17
+ function quads_frontend_checks_init() {
18
+ if( !is_admin() && is_admin_bar_showing() && current_user_can( 'update_plugins' )
19
+ ) {
20
+ add_action( 'admin_bar_menu', 'quads_add_admin_bar_menu', 1000 );
21
+ add_filter( 'the_content', 'quads_check_the_content_filter' );
22
+ add_filter( 'wp_footer', 'quads_check_adblocker', -101 );
23
+ add_filter( 'quads-ad-output', 'after_ad_output', 10, 2 );
24
+ }
25
+ }
26
+
27
+ add_action( 'init', 'quads_frontend_checks_init' );
28
+
29
+ /**
30
+ * Create WP QUADS List possible error cases in the admin-bar.
31
+ *
32
+ * @param obj $wp_admin_bar WP_Admin_Bar
33
+ */
34
+ function quads_add_admin_bar_menu( $wp_admin_bar ) {
35
+ global $quads_options, $wp_the_query, $post, $wp_scripts, $the_content;
36
+
37
+ $error = false;
38
+
39
+ $wp_admin_bar->add_node( array(
40
+ 'id' => 'quads_ad_check',
41
+ 'title' => __( 'Ad Check', 'quick-adsense-reloaded' ),
42
+ ) );
43
+
44
+ // Hidden by default
45
+ $wp_admin_bar->add_node( array(
46
+ 'parent' => 'quads_ad_check',
47
+ 'id' => 'quads_ad_check_jquery',
48
+ 'title' => __( '- JavaScript / jQuery error', 'quick-adsense-reloaded' ),
49
+ 'href' => 'http://wpquads.com/docs/javascript-issues-breaking-adsense-ads/',
50
+ 'meta' => array(
51
+ 'class' => 'quads-hidden quads_ad_check_warning',
52
+ 'target' => '_blank'
53
+ )
54
+ ) );
55
+
56
+ // Hidden by default
57
+ $wp_admin_bar->add_node( array(
58
+ 'parent' => 'quads_ad_check',
59
+ 'id' => 'quads_ad_check_adblocker_enabled',
60
+ 'title' => __( '- Ad blocker enabled', 'quick-adsense-reloaded' ),
61
+ 'meta' => array(
62
+ 'class' => 'quads-hidden quads_ad_check_warning',
63
+ 'target' => '_blank'
64
+ )
65
+ ) );
66
+ // Hidden by default
67
+ if( $wp_the_query->is_singular() ) {
68
+ // Check if the_content filter is available
69
+ if( !$the_content ) {
70
+ $wp_admin_bar->add_node( array(
71
+ 'parent' => 'quads_ad_check',
72
+ 'id' => 'quads_ad_check_the_content_not_invoked',
73
+ 'title' => __( '- <em>the_content</em> filter does not exist', 'quick-adsense-reloaded' ),
74
+ 'href' => 'http://wpquads.com/docs/the_content-filter-missing/',
75
+ 'meta' => array(
76
+ 'class' => 'quads_ad_check_warning',
77
+ 'target' => '_blank'
78
+ )
79
+ ) );
80
+ $error = true;
81
+ }
82
+ // Hidden by default
83
+ if( !empty( $post->ID ) ) {
84
+ $ad_settings = get_post_meta( $post->ID, '_quads_config_visibility', true );
85
+
86
+ if( !empty( $ad_settings['NoAds'] ) ) {
87
+ $wp_admin_bar->add_node( array(
88
+ 'parent' => 'quads_ad_check',
89
+ 'id' => 'quads_ad_check_disabled_on_page',
90
+ 'title' => __( '- All Ads are disabled on this page', 'quick-adsense-reloaded' ),
91
+ 'href' => get_edit_post_link( $post->ID ) . '#quads-ad-settings',
92
+ 'meta' => array(
93
+ 'class' => 'quads_ad_check_warning',
94
+ 'target' => '_blank'
95
+ )
96
+ ) );
97
+ $error = true;
98
+ }
99
+ if( !empty( $ad_settings['OffDef'] ) ) {
100
+ $wp_admin_bar->add_node( array(
101
+ 'parent' => 'quads_ad_check',
102
+ 'id' => 'quads_ad_check_disabled_in_content',
103
+ 'title' => __( '- Default Ads disabled in content of this page', 'quick-adsense-reloaded' ),
104
+ 'href' => get_edit_post_link( $post->ID ) . '#quads-ad-settings',
105
+ 'meta' => array(
106
+ 'class' => 'quads_ad_check_warning',
107
+ 'target' => '_blank'
108
+ )
109
+ ) );
110
+ $error = true;
111
+ }
112
+ } else {
113
+ $wp_admin_bar->add_node( array(
114
+ 'parent' => 'quads_ad_check',
115
+ 'id' => 'quads_ad_check_post_zero',
116
+ 'title' => __( '- Current post ID is 0 ', 'quick-adsense-reloaded' ),
117
+ 'href' => 'https://wpadvancedads.com/manual/known-plugin-conflicts/#frontend-issue-post-id-empty',
118
+ 'meta' => array(
119
+ 'class' => 'quads_ad_check_warning',
120
+ 'target' => '_blank'
121
+ )
122
+ ) );
123
+ $error = true;
124
+ }
125
+ }
126
+
127
+ if( $wp_the_query->is_404() && !empty( $quads_options['disabled-ads']['404'] ) ) {
128
+ $wp_admin_bar->add_node( array(
129
+ 'parent' => 'quads_ad_check',
130
+ 'id' => 'quads_ad_check_no_404',
131
+ 'title' => __( 'Ads are disabled on 404 pages', 'quick-adsense-reloaded' ),
132
+ 'href' => admin_url( 'admin.php?page=quads-settings' ),
133
+ 'meta' => array(
134
+ 'class' => 'quads_ad_check_warning',
135
+ 'target' => '_blank'
136
+ )
137
+ ) );
138
+ $error = true;
139
+ }
140
+
141
+ if( !$wp_the_query->is_singular() && !empty( $quads_options['disabled-ads']['archives'] ) ) {
142
+ $wp_admin_bar->add_node( array(
143
+ 'parent' => 'quads_ad_check',
144
+ 'id' => 'quads_ad_check_no_archive',
145
+ 'title' => __( 'Ads are disabled on non singular pages', 'quick-adsense-reloaded' ),
146
+ 'href' => admin_url( 'admin.php?page=quads-settings' ),
147
+ 'meta' => array(
148
+ 'class' => 'quads_ad_check_warning',
149
+ 'target' => '_blank'
150
+ )
151
+ ) );
152
+ $error = true;
153
+ }
154
+
155
+ if( !extension_loaded( 'dom' ) ) {
156
+ $wp_admin_bar->add_node( array(
157
+ 'parent' => 'quads_ad_check',
158
+ 'id' => 'quads_ad_check_no_dom_document',
159
+ 'title' => sprintf( __( 'The %s extension(s) is not loaded', 'quick-adsense-reloaded' ), 'dom' ),
160
+ 'href' => 'http://php.net/manual/en/book.dom.php',
161
+ 'meta' => array(
162
+ 'class' => 'quads_ad_check_warning',
163
+ 'target' => '_blank'
164
+ )
165
+ ) );
166
+ $error = true;
167
+ }
168
+
169
+ if( !$error ) {
170
+ $wp_admin_bar->add_node( array(
171
+ 'parent' => 'quads_ad_check',
172
+ 'id' => 'quads_ad_check_fine',
173
+ 'title' => __( 'WP QUADS is working fine', 'quick-adsense-reloaded' ),
174
+ 'href' => false,
175
+ 'meta' => array(
176
+ 'target' => '_blank',
177
+ )
178
+ ) );
179
+ }
180
+
181
+ $wp_admin_bar->add_node( array(
182
+ 'parent' => 'quads_ad_check',
183
+ 'id' => 'quads_ad_check_debug_dfp',
184
+ 'title' => __( 'debug DFP ads', 'quick-adsense-reloaded' ),
185
+ 'href' => esc_url( add_query_arg( 'googfc', '' ) ),
186
+ 'meta' => array(
187
+ 'class' => 'quads-hidden quads_ad_check_debug_dfp_link',
188
+ 'target' => '_blank',
189
+ )
190
+ ) );
191
+
192
+ $wp_admin_bar->add_node( array(
193
+ 'parent' => 'quads_ad_check',
194
+ 'id' => 'quads_ad_check_highlight_ads',
195
+ 'title' => sprintf( '<label><input id="quads_highlight_ads_checkbox" type="checkbox"> %s</label>', __( 'highlight ads', 'quick-adsense-reloaded' ) )
196
+ ) );
197
+ }
198
+
199
+ /**
200
+ * Set variable to 'true' when 'the_content' filter is available.
201
+ *
202
+ * @param string $content
203
+ * @return string $content
204
+ */
205
+ function quads_check_the_content_filter( $content ) {
206
+ global $the_content;
207
+
208
+ $the_content = true;
209
+
210
+ return $content;
211
+ }
212
+
213
+ /**
214
+ * Check conditions and display warning. Conditions: AdBlocker enabled, jQuery is included in header
215
+ */
216
+ function quads_check_adblocker() {
217
+ ?>
218
+ <!--noptimize--><style>.quads-hidden { display: none; } .quads-adminbar-is-warnings { background: #ef4000 ! important; color: #fff !important; }
219
+ .quads-highlight-ads { outline:6px solid #83c11f !important; }</style>
220
+ <script type="text/javascript" src="<?php echo QUADS_PLUGIN_URL . 'assets/js/ads.js' ?>"></script>
221
+ <script>
222
+ (function (d, w) {
223
+ var jquery_not_detected = typeof jQuery === 'undefined';
224
+
225
+ var addEvent = function (obj, type, fn) {
226
+ if (obj.addEventListener)
227
+ obj.addEventListener(type, fn, false);
228
+ else if (obj.attachEvent)
229
+ obj.attachEvent('on' + type, function () {
230
+ return fn.call(obj, window.event);
231
+ });
232
+ };
233
+
234
+ function highlight_ads() {
235
+ try {
236
+ var ad_wrappers = document.querySelectorAll('div[id^="quads-ad"]')
237
+ } catch (e) {
238
+ return;
239
+ }
240
+ for (i = 0; i < ad_wrappers.length; i++) {
241
+ if (this.checked) {
242
+ ad_wrappers[i].className += ' quads-highlight-ads';
243
+ } else {
244
+ ad_wrappers[i].className = ad_wrappers[i].className.replace('quads-highlight-ads', '');
245
+ }
246
+ }
247
+ }
248
+
249
+ addEvent(w, 'load', function () {
250
+ var adblock_item = d.getElementById('wp-admin-bar-quads_ad_check_adblocker_enabled'),
251
+ jQuery_item = d.getElementById('wp-admin-bar-quads_ad_check_jquery'),
252
+ fine_item = d.getElementById('wp-admin-bar-quads_ad_check_fine'),
253
+ hide_fine = false;
254
+
255
+ var highlight_checkbox = d.getElementById('quads_highlight_ads_checkbox');
256
+ if (highlight_checkbox) {
257
+ addEvent(highlight_checkbox, 'change', highlight_ads);
258
+ }
259
+ if (adblock_item && typeof wpquads_adblocker_check === 'undefined' || false === wpquads_adblocker_check) {
260
+ // show quads-hidden item
261
+ adblock_item.className = adblock_item.className.replace(/quads-hidden/, '');
262
+ hide_fine = true;
263
+ }
264
+
265
+ if (jQuery_item && jquery_not_detected) {
266
+ // show quads-hidden item
267
+ jQuery_item.className = jQuery_item.className.replace(/quads-hidden/, '');
268
+ hide_fine = true;
269
+ }
270
+
271
+ if (hide_fine && fine_item) {
272
+ fine_item.className += ' quads-hidden';
273
+ }
274
+
275
+ showCount();
276
+ });
277
+
278
+ var showCount = function () {
279
+ try {
280
+ // select not quads-hidden warning items, exclude the 'fine_item'
281
+ var warning_count = document.querySelectorAll('.quads_ad_check_warning:not(.quads-hidden)').length;
282
+ } catch (e) {
283
+ return;
284
+ }
285
+
286
+ if (warning_count) {
287
+ var header = document.querySelector('#wp-admin-bar-quads_ad_check > div');
288
+
289
+ if (header) {
290
+ header.innerHTML += ' <i>(' + warning_count + ')</i>';
291
+ header.className += ' quads-adminbar-is-warnings';
292
+ }
293
+ }
294
+ };
295
+ })(document, window);
296
+ </script><!--/noptimize-->
297
+ <?php
298
+ }
includes/meta-boxes.php CHANGED
@@ -8,11 +8,12 @@
8
  * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
  * @since 0.9.6
10
  */
11
- function quads_load_meta_box () {
12
  new Quads_Meta_Box();
13
- }
14
- add_action( 'load-post.php', 'quads_load_meta_box' );
15
- add_action( 'load-post-new.php', 'quads_load_meta_box' );
 
16
  /**
17
  * Ads options for a single post
18
  */
@@ -40,7 +41,7 @@ class Quads_Meta_Box {
40
  __('WP QUADS - Hide Ads', 'quick-adsense-reloaded'), // title
41
  array($this, 'render_meta_box'), // render function callback
42
  $post_type, // post_type
43
- 'normal', // context
44
  'default' // priority
45
  );
46
  }
8
  * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
  * @since 0.9.6
10
  */
11
+ //function quads_load_meta_box () {
12
  new Quads_Meta_Box();
13
+ //}
14
+ //add_action( 'load-post.php', 'quads_load_meta_box' );
15
+ //add_action( 'load-post-new.php', 'quads_load_meta_box' );
16
+ //add_action( 'add_meta_boxes', 'quads_load_meta_box' );
17
  /**
18
  * Ads options for a single post
19
  */
41
  __('WP QUADS - Hide Ads', 'quick-adsense-reloaded'), // title
42
  array($this, 'render_meta_box'), // render function callback
43
  $post_type, // post_type
44
+ 'advanced', // context
45
  'default' // priority
46
  );
47
  }
includes/quicktags.php CHANGED
@@ -43,6 +43,8 @@ function quads_get_quicktags_from_content ( $content ) {
43
  }
44
  return $found;
45
  }
 
 
46
  /**
47
  * Removes all quicktags from content
48
  *
43
  }
44
  return $found;
45
  }
46
+
47
+
48
  /**
49
  * Removes all quicktags from content
50
  *
includes/shortcodes.php CHANGED
@@ -32,8 +32,9 @@ function quads_shortcode_display_ad( $atts ) {
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;
@@ -94,8 +95,9 @@ function quads_get_ad($id = 0) {
94
  function quads_check_meta_setting($key){
95
  global $post;
96
 
97
- if ( !isset($post->ID ) )
98
- return false;
 
99
 
100
  $meta_key = '_quads_config_visibility';
101
 
32
 
33
 
34
  //return quads_check_meta_setting('NoAds');
35
+ if( quads_check_meta_setting( 'NoAds' ) === '1' ){
36
  return;
37
+ }
38
 
39
  // The ad id
40
  $id = isset( $atts['id'] ) ? ( int ) $atts['id'] : 0;
95
  function quads_check_meta_setting($key){
96
  global $post;
97
 
98
+ if ( !isset($post->ID ) ){
99
+ return false;
100
+ }
101
 
102
  $meta_key = '_quads_config_visibility';
103
 
includes/template-functions.php CHANGED
@@ -16,20 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) exit;
16
  add_filter('the_content', 'quads_post_settings_to_quicktags', 5);
17
  add_filter('the_content', 'quads_process_content', quads_get_load_priority());
18
 
19
- /**
20
- * Get load priority
21
- *
22
- * @global arr $quads_options
23
- * @return int
24
- */
25
- function quads_get_load_priority(){
26
- global $quads_options;
27
-
28
- if (!empty($quads_options['priority'])){
29
- return intval($quads_options['priority']);
30
- }
31
- return 20;
32
- }
33
 
34
  /**
35
  * Adds quicktags, defined via post meta options, to content.
@@ -79,412 +66,598 @@ function quads_get_visibility_quicktags_str ( $post_id = null ) {
79
  }
80
 
81
  /**
82
- * Main processing for the_content filter
83
- *
84
- * @global arr $quads_options all plugin settings
85
- * @global int $visibleContentAds number of active content ads (reseted internally so we have to use a similar global below for external purposes: $visibleContentAdsGlobal)
86
- * @global arr $AdsId Whitespace trimmed array of ad codes
87
- * @global int $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
 
 
 
 
 
 
 
 
 
 
 
 
96
  *
97
- * @since 0.9.0
 
 
 
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) ) {
105
- $content = quads_clean_tags($content);
106
- return $content;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  }
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'] ) ) ) {
133
- $AdsId[] = $i;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  }
135
  }
136
- // echo '<pre>';
137
- // wp_die(var_dump($AdsId));
138
  }
 
 
 
 
 
 
 
 
139
 
140
- // Ad code array is empty so break here
141
- if( count($AdsId) === 0 ) {
142
- $content = quads_clean_tags($content);
143
- return $content;
144
- };
 
 
 
 
 
 
 
 
 
 
 
145
 
146
- /* ... Tidy up content ... */
147
- // Replace all <p></p> tags with placeholder ##QA-TP1##
148
- // Replace all
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;
163
 
164
- $midd1 = isset($quads_options['pos2']['MiddAds']) ? true : false;
165
- $midd2 = isset($quads_options['pos2']['MiddRnd']) ? $quads_options['pos2']['MiddRnd'] : 0;
 
 
 
 
 
 
 
 
 
 
 
 
166
 
167
- $endi1 = isset($quads_options['pos3']['EndiAds']) ? true : false;
168
- $endi2 = isset($quads_options['pos3']['EndiRnd']) ? $quads_options['pos3']['EndiRnd'] : 0;
169
-
170
- $more1 = isset($quads_options['pos4']['MoreAds']) ? true : false;
171
- $more2 = isset($quads_options['pos4']['MoreRnd']) ? $quads_options['pos4']['MoreRnd'] : 0;
172
-
173
- $lapa1 = isset($quads_options['pos5']['LapaAds']) ? true : false;
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;
194
- $imageCaption = isset($quads_options['pos9']['Img1Con']) ? $quads_options['pos9']['Img1Con'] : false;
195
-
196
 
197
- if ( $begn2 == 0 ) { $b1 = $cusrnd; } else { $b1 = $cusads.$begn2; array_push($AdsIdCus, $begn2); };
198
- if ( $more2 == 0 ) { $r1 = $cusrnd; } else { $r1 = $cusads.$more2; array_push($AdsIdCus, $more2); };
199
- if ( $midd2 == 0 ) { $m1 = $cusrnd; } else { $m1 = $cusads.$midd2; array_push($AdsIdCus, $midd2); };
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
258
- if( $midd1 && strpos($content,'<!--OffMiddle-->')===false) {
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
-
279
- // Check if image ad is "More Tag" one
280
- if( $more1 && strpos($content,'<!--OffAfMore-->')===false) {
281
- $mmr = '<!--'.$r1.'-->';
282
- $postid = get_the_ID();
283
- $content = str_replace('<span id="more-'.$postid.'"></span>', $mmr, $content);
284
- }
285
-
286
- if( $begn1 && strpos($content,'<!--OffBegin-->')===false) {
287
- $content = '<!--'.$b1.'-->'.$content;
288
- }
289
- if( $endi1 && strpos($content,'<!--OffEnd-->')===false) {
290
- $content = $content.'<!--'.$b2.'-->';
291
- }
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
-
303
- // Sanitation
304
- $imgtag = "<img";
305
- $delimiter = ">";
306
- $caption = "[/caption]";
307
- $atag = "</a>";
308
- $content = str_replace("<IMG", $imgtag, $content);
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
335
- */
336
- $content = '<!--EmptyClear-->'.$content."\n".'<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>';
337
- $content = quads_clean_tags($content, true);
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();
355
- if ( quads_ad_reach_max_count() ){
356
- $content = quads_clean_tags($content);
357
- }
358
- }
359
- }
360
  }
361
-
362
- /**
363
- * Replace Quicktags Ads1 to Ads10
364
- **/
365
-
366
- $tcn = count($AdsId); $tt = 0;
367
- for( $i=1; $i<=$tcn; $i++ ) {
368
- if( strpos($content, '<!--Ads'.$AdsId[$tt].'-->')!==false ) {
369
- $content = quads_replace_ads( $content, 'Ads'.$AdsId[$tt], $AdsId[$tt] );
370
- $AdsId = quads_del_element($AdsId, $tt) ;
371
- $visibleContentAds += 1;
372
- quads_set_ad_count_content();
373
- if (quads_ad_reach_max_count()){
374
- $content = quads_clean_tags($content);
375
- return $content;
376
- }
377
-
378
- } else {
379
- $tt += 1;
380
- }
381
- }
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.'-->');
390
-
391
- for( $i=$tcx; $i<=$tcy-1; $i++ ) {
392
- array_push($AdsId, -1);
393
- }
394
- shuffle($AdsId);
395
- for( $i=1; $i<=$tcy; $i++ ) {
396
- $content = quads_replace_ads( $content, $cusrnd, $AdsId[0] );
397
- $AdsId = quads_del_element($AdsId, 0) ;
398
- $visibleContentAds += 1;
399
- quads_set_ad_count_content();
400
- if (quads_ad_reach_max_count()){
401
- $content = quads_clean_tags($content);
402
- return $content;
403
- }
404
- }
405
- }
406
  }
407
-
408
- /*
409
- * Replace RndAds Random Ads
410
- */
411
- if( strpos($content, '<!--RndAds-->')!==false && is_singular() ) {
412
- $AdsIdTmp = array();
413
- shuffle($AdsId);
414
- for( $i=1; $i<=$maxAds-$visibleContentAds; $i++ ) {
415
- if( $i <= count($AdsId) ) {
416
- array_push($AdsIdTmp, $AdsId[$i-1]);
417
- }
418
- }
419
- $tcx = count($AdsIdTmp);
420
- $tcy = substr_count($content, '<!--RndAds-->');
421
- for( $i=$tcx; $i<=$tcy-1; $i++ ) {
422
- array_push($AdsIdTmp, -1);
423
- }
424
- shuffle($AdsIdTmp);
425
- for( $i=1; $i<=$tcy; $i++ ) {
426
- $tmp = $AdsIdTmp[0];
427
- $content = quads_replace_ads( $content, 'RndAds', $AdsIdTmp[0] );
428
- $AdsIdTmp = quads_del_element($AdsIdTmp, 0) ;
429
- if($tmp != -1){
430
- $visibleContentAds += 1;
431
- };
432
- quads_set_ad_count_content();
433
- if (quads_ad_reach_max_count()){
434
- $content = quads_clean_tags($content);
435
- return $content;
436
- }
437
- }
438
- }
439
 
440
- /* ... That's it. DONE :) ... */
441
- $content = quads_clean_tags($content);
442
- // Reset ad_count - Important!!!
443
- $visibleContentAdsGlobal = 0;
444
- return do_shortcode($content);
445
- }
446
  /**
447
- * Revert content into original content without any ad code
448
  *
 
449
  * @global int $visibleContentAds
450
- * @global array $AdsId
451
- * @global array $quads_options
452
- * @global int $ad_count
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
453
  * @param string $content
454
- * @param boolean $trimonly
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
455
  *
456
- * @return string content
 
457
  */
458
- function quads_clean_tags($content, $trimonly = false) {
459
- global $visibleContentAds;
460
- global $AdsId;
461
- global $quads_options;
462
- global $ad_count;
463
-
464
- $tagnames = array('EmptyClear','RndAds','NoAds','OffDef','OffAds','OffWidget','OffBegin','OffMiddle','OffEnd','OffBfMore','OffAfLastPara','CusRnd');
465
 
466
- for($i=1;$i<=10;$i++) {
467
- array_push($tagnames, 'CusAds'.$i);
468
- array_push($tagnames, 'Ads'.$i);
469
- };
470
-
471
-
472
- foreach ($tagnames as $tgn) {
473
- if(strpos($content,'<!--'.$tgn.'-->')!==false || $tgn=='EmptyClear') {
474
- if($trimonly) {
475
- $content = str_replace('<p><!--'.$tgn.'--></p>', '<!--'.$tgn.'-->', $content);
476
- }else{
477
- $content = str_replace(array('<p><!--'.$tgn.'--></p>','<!--'.$tgn.'-->'), '', $content);
478
- $content = str_replace("##QA-TP1##", "<p></p>", $content);
479
- $content = str_replace("##QA-TP2##", "<p>&nbsp;</p>", $content);
480
- }
481
- }
482
- }
483
- if(!$trimonly && (is_single() || is_page()) ) {
484
- $visibleContentAds = 0;
485
- $AdsId = array();
486
- }
487
- return $content;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
488
  }
489
 
490
  /**
@@ -502,7 +675,8 @@ function quads_replace_ads($content, $quicktag, $id) {
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;',
@@ -532,6 +706,417 @@ function quads_replace_ads($content, $quicktag, $id) {
532
  return $cont[0].$adscode.$cont[1];
533
  }
534
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
535
  /**
536
  * Remove element from array
537
  *
16
  add_filter('the_content', 'quads_post_settings_to_quicktags', 5);
17
  add_filter('the_content', 'quads_process_content', quads_get_load_priority());
18
 
19
+
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  /**
22
  * Adds quicktags, defined via post meta options, to content.
66
  }
67
 
68
  /**
69
+ * Get load priority
 
 
 
 
 
 
 
 
 
 
 
70
  *
71
+ * @global arr $quads_options
72
+ * @return int
73
+ */
74
+ function quads_get_load_priority(){
75
+ global $quads_options;
76
+
77
+ if (!empty($quads_options['priority'])){
78
+ return intval($quads_options['priority']);
79
+ }
80
+ return 20;
81
+ }
82
+
83
+ /**
84
  *
85
+ * @global arr $quads_options
86
+ * @global type $adsArray
87
+ * @param type $content
88
+ * @return type
89
  */
90
+ function quads_process_content( $content ) {
91
+ global $quads_options, $adsArray, $adsArrayCus, $visibleContentAds, $ad_count_widget, $visibleShortcodeAds;
92
+
93
 
94
+ // Do not do anything if ads are not allowed
95
+ if( !quads_ad_is_allowed( $content ) ) {
96
+ $content = quads_clean_tags( $content );
97
+ return $content;
98
+ }
99
+
100
+ // Do nothing if maximum ads are reached in post content
101
+ if( $visibleContentAds >= quads_get_max_allowed_post_ads( $content ) ) {
102
+ $content = quads_clean_tags( $content );
103
+ return $content;
104
+ }
105
+
106
+ // placeholder string for random ad
107
+ $cusrnd = 'CusRnd';
108
+
109
+ // placeholder string for custom ad spots
110
+ $cusads = 'CusAds';
111
+
112
+ // Array of ad codes ids
113
+ $adsArray = quads_get_active_ads();
114
+
115
+ if ($adsArray === 0){
116
+ return $content;
117
+ }
118
+
119
+ $content = quads_sanitize_content( $content );
120
+
121
+ $content = quads_filter_default_ads( $content );
122
+
123
+ //wp_die($content);
124
+ /*
125
+ * Tidy up content
126
+ */
127
+ $content = '<!--EmptyClear-->' . $content . "\n" . '<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>';
128
+ $content = quads_clean_tags( $content, true );
129
+
130
+ $content = quads_parse_default_ads($content);
131
 
132
+ $content = quads_parse_quicktags( $content );
133
+
134
+ $content = quads_parse_random_quicktag_ads($content);
135
+
136
+ $content = quads_parse_random_ads( $content );
137
+
138
+ /* ... That's it. DONE :) ... */
139
+ $content = quads_clean_tags( $content );
140
+ // Reset ad_count - Important!!!
141
+ $visibleContentAdsGlobal = 0;
142
+ return do_shortcode( $content );
143
+ }
144
+
145
+
146
+ /**
147
+ * Return number of active widget ads
148
+ * @param string the_content
149
+ * @return int amount of widget ads
150
+ */
151
+ function quads_get_number_widget_ads() {
152
+ $number_widgets = 0;
153
+ $maxWidgets = 10;
154
+ // count active widget ads
155
+ for ( $i = 1; $i <= $maxWidgets; $i++ ) {
156
+ $AdsWidName = 'AdsWidget%d (Quick Adsense Reloaded)';
157
+ $wadsid = sanitize_title( str_replace( array('(', ')'), '', sprintf( $AdsWidName, $i ) ) );
158
+ $number_widgets += (is_active_widget( '', '', $wadsid )) ? 1 : 0;
159
  }
160
+
161
+ return $number_widgets;
162
+ }
 
 
 
 
 
 
 
 
163
 
164
+ /**
165
+ * Get list of valid ad ids's where either the plain text code field or the adsense ad slot and the ad client id is populated.
166
+ * @global arr $quads_options
167
+ */
168
+ function quads_get_active_ads() {
169
+ global $quads_options;
170
 
171
+ // Max amount of different content ads we can have
172
+ $numberAds = 10;
173
+
174
+ $adsArray = array();
175
+
176
+ // Array of ad codes
177
+ for ( $i = 1; $i <= $numberAds; $i++ ) {
178
+ $tmp = isset( $quads_options['ad' . $i]['code'] ) ? trim( $quads_options['ad' . $i]['code'] ) : '';
179
+ // id is valid if there is either the plain text field populated or the adsense ad slot and the ad client id
180
+ if( !empty( $tmp ) || (!empty( $quads_options['ad' . $i]['g_data_ad_slot'] ) && !empty( $quads_options['ad' . $i]['g_data_ad_client'] ) ) ) {
181
+ $adsArray[] = $i;
182
+ }
183
+ }
184
+ //wp_die(count($adsArray));
185
+ return (count($adsArray) > 0) ? $adsArray : 0;
186
+ }
187
+
188
+ /**
189
+ * Get complete array of valid ads
190
+ * @global arr $quads_options
191
+ */
192
+ function quads_get_ad_content() {
193
+ global $quads_options;
194
+
195
+ // Max amount of different content ads we can have
196
+ $numberAds = 10;
197
+
198
+ $adsArray = array();
199
+
200
+ // Array of ad codes
201
+ for ( $i = 1; $i <= $numberAds; $i++ ) {
202
+ $tmp = isset( $quads_options['ad' . $i]['code'] ) ? trim( $quads_options['ad' . $i]['code'] ) : '';
203
+ // id is valid if there is either the plain text field populated or the adsense ad slot and the ad client id
204
+ if( !empty( $tmp ) || (!empty( $quads_options['ad' . $i]['g_data_ad_slot'] ) && !empty( $quads_options['ad' . $i]['g_data_ad_client'] ) ) ) {
205
+ $adsArray[] = $quads_options['ad' . $i];
206
+ }
207
+ }
208
+
209
+ return count($adsArray) ? $adsArray : 0;
210
+ }
211
+
212
+
213
+ /**
214
+ * Get max allowed numbers of ads
215
+ *
216
+ * @param string $content
217
+ * @return int maximum number of ads
218
+ */
219
+ function quads_get_max_allowed_post_ads( $content ) {
220
+ global $quads_options;
221
+
222
+ // Maximum allowed general number of ads
223
+ $maxAds = isset( $quads_options['maxads'] ) ? $quads_options['maxads'] : 10;
224
+
225
+ $numberWidgets = 10;
226
+
227
+ $AdsWidName = 'AdsWidget%d (Quick Adsense Reloaded)';
228
+
229
+ // count number of active widgets and subtract them
230
+ if( strpos( $content, '<!--OffWidget-->' ) === false ) {
231
+ for ( $i = 1; $i <= $numberWidgets; $i++ ) {
232
+ $wadsid = sanitize_title( str_replace( array('(', ')'), '', sprintf( $AdsWidName, $i ) ) );
233
+ $maxAds -= (is_active_widget( '', '', $wadsid )) ? 1 : 0;
234
+ }
235
+ }
236
+ return $maxAds;
237
+ }
238
+
239
+
240
+ /**
241
+ * Filter default ads
242
+ *
243
+ * @global array $quads_options global settings
244
+ * @global array $adsArrayCus List of ad id'S
245
+ * @param string $content
246
+ * @return string content
247
+ */
248
+ function quads_filter_default_ads( $content ) {
249
+ global $quads_options, $adsArrayCus;
250
+
251
+ $off_default_ads = (strpos( $content, '<!--OffDef-->' ) !== false);
252
+
253
+ if( $off_default_ads ) { // If default ads are disabled
254
+ return $content;
255
+ }
256
+
257
+ // Default Ads
258
+ $adsArrayCus = array();
259
+
260
+ // placeholder string for random ad
261
+ $cusrnd = 'CusRnd';
262
+
263
+ // placeholder string for custom ad spots
264
+ $cusads = 'CusAds';
265
+
266
+ // Beginning of Post
267
+ $beginning_position_status = isset( $quads_options['pos1']['BegnAds'] ) ? true : false;
268
+ $beginning_position_ad_id = isset( $quads_options['pos1']['BegnRnd'] ) ? $quads_options['pos1']['BegnRnd'] : 0;
269
+
270
+ // Middle of Post
271
+ $middle_position_status = isset( $quads_options['pos2']['MiddAds'] ) ? true : false;
272
+ $middle_position_ad_id = isset( $quads_options['pos2']['MiddRnd'] ) ? $quads_options['pos2']['MiddRnd'] : 0;
273
+
274
+ // End of Post
275
+ $end_position_status = isset( $quads_options['pos3']['EndiAds'] ) ? true : false;
276
+ $end_position_ad_id = isset( $quads_options['pos3']['EndiRnd'] ) ? $quads_options['pos3']['EndiRnd'] : 0;
277
+
278
+ // After the more tag
279
+ $more_position_status = isset( $quads_options['pos4']['MoreAds'] ) ? true : false;
280
+ $more_position_ad_id = isset( $quads_options['pos4']['MoreRnd'] ) ? $quads_options['pos4']['MoreRnd'] : 0;
281
+
282
+ // Right before the last paragraph
283
+ $last_paragraph_position_status = isset( $quads_options['pos5']['LapaAds'] ) ? true : false;
284
+ $last_paragraph_position_ad_id = isset( $quads_options['pos5']['LapaRnd'] ) ? $quads_options['pos5']['LapaRnd'] : 0;
285
+
286
+ // After Paragraph option 1 - 3
287
+ $number = 3; // number of paragraph ads | default value 3.
288
+ $default = 5; // Position. Let's start with id 5
289
+ for ( $i = 1; $i <= $number; $i++ ) {
290
+ $key = $default + $i; // 6,7,8
291
+
292
+ $paragraph['status'][$i] = isset( $quads_options['pos' . $key]['Par' . $i . 'Ads'] ) ? $quads_options['pos' . $key]['Par' . $i . 'Ads'] : 0; // Status - active | inactive
293
+ $paragraph['id'][$i] = isset( $quads_options['pos' . $key]['Par' . $i . 'Rnd'] ) ? $quads_options['pos' . $key]['Par' . $i . 'Rnd'] : 0; // Ad id
294
+ $paragraph['position'][$i] = isset( $quads_options['pos' . $key]['Par' . $i . 'Nup'] ) ? $quads_options['pos' . $key]['Par' . $i . 'Nup'] : 0; // Paragraph No
295
+ $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
296
+ }
297
+ // After Image ad
298
+ $imageActive = isset( $quads_options['pos9']['Img1Ads'] ) ? $quads_options['pos9']['Img1Ads'] : false;
299
+ $imageAdNo = isset( $quads_options['pos9']['Img1Rnd'] ) ? $quads_options['pos9']['Img1Rnd'] : false;
300
+ $imageNo = isset( $quads_options['pos9']['Img1Nup'] ) ? $quads_options['pos9']['Img1Nup'] : false;
301
+ $imageCaption = isset( $quads_options['pos9']['Img1Con'] ) ? $quads_options['pos9']['Img1Con'] : false;
302
+
303
+
304
+ if( $beginning_position_ad_id == 0 ) {
305
+ $b1 = $cusrnd;
306
+ } else {
307
+ $b1 = $cusads . $beginning_position_ad_id;
308
+ array_push( $adsArrayCus, $beginning_position_ad_id );
309
+ };
310
+
311
+ if( $more_position_ad_id == 0 ) {
312
+ $r1 = $cusrnd;
313
+ } else {
314
+ $r1 = $cusads . $more_position_ad_id;
315
+ array_push( $adsArrayCus, $more_position_ad_id );
316
+ };
317
+
318
+ if( $middle_position_ad_id == 0 ) {
319
+ $m1 = $cusrnd;
320
+ } else {
321
+ $m1 = $cusads . $middle_position_ad_id;
322
+ array_push( $adsArrayCus, $middle_position_ad_id );
323
+ };
324
+ if( $last_paragraph_position_ad_id == 0 ) {
325
+ $g1 = $cusrnd;
326
+ } else {
327
+ $g1 = $cusads . $last_paragraph_position_ad_id;
328
+ array_push( $adsArrayCus, $last_paragraph_position_ad_id );
329
+ };
330
+ if( $end_position_ad_id == 0 ) {
331
+ $b2 = $cusrnd;
332
+ } else {
333
+ $b2 = $cusads . $end_position_ad_id;
334
+ array_push( $adsArrayCus, $end_position_ad_id );
335
+ };
336
+ for ( $i = 1; $i <= $number; $i++ ) {
337
+ if( $paragraph['id'][$i] == 0 ) {
338
+ $paragraph[$i] = $cusrnd;
339
+ } else {
340
+ $paragraph[$i] = $cusads . $paragraph['id'][$i];
341
+ array_push( $adsArrayCus, $paragraph['id'][$i] );
342
  };
343
+ }
344
+ //wp_die(print_r($adsArrayCus));
345
+
346
+ // Create the arguments for filter quads_filter_paragraphs
347
+ $quads_args = array(
348
+ 'paragraph' => $paragraph,
349
+ 'cusads' => $cusads,
350
+ 'cusrnd' => $cusrnd,
351
+ 'AdsIdCus' => $adsArrayCus,
352
+ );
353
+
354
+ // Execute filter to add more paragraph ad spots
355
+ $quads_filtered = apply_filters( 'quads_filter_paragraphs', $quads_args );
356
+
357
+ // The filtered arguments
358
+ $paragraph = $quads_filtered['paragraph'];
359
+
360
+ // filtered list of ad spots
361
+ $adsArrayCus = $quads_filtered['AdsIdCus'];
362
 
363
+ // Create paragraph ads
364
+ $number = 6;
365
+ //$number = 3;
366
+ for ( $i = $number; $i >= 1; $i-- ) {
367
+ if( !empty( $paragraph['status'][$i] ) ) {
368
+ $sch = "</p>";
369
+ $content = str_replace( "</P>", $sch, $content );
370
+ // paragraphs in content
371
+ $paragraphsArray = explode( $sch, $content );
372
+ if( ( int ) $paragraph['position'][$i] < count( $paragraphsArray ) ) {
373
+ $content = implode( $sch, array_slice( $paragraphsArray, 0, $paragraph['position'][$i] ) ) . $sch . '<!--' . $paragraph[$i] . '-->' . implode( $sch, array_slice( $paragraphsArray, $paragraph['position'][$i] ) );
374
+ } elseif( $paragraph['end_post'][$i] ) {
375
+ $content = implode( $sch, $paragraphsArray ) . '<!--' . $paragraph[$i] . '-->';
376
+ }
377
+ }
378
+ }
379
+
380
+ // Check if image ad is random one
381
+ if( $imageAdNo == 0 ) {
382
+ $imageAd = $cusrnd;
383
+ } else {
384
+ $imageAd = $cusads . $imageAdNo;
385
+ array_push( $adsArrayCus, $imageAdNo );
386
+ };
387
+
388
+
389
+ // Beginning of post ad
390
+ if( $beginning_position_status && strpos( $content, '<!--OffBegin-->' ) === false ) {
391
+ $content = '<!--' . $b1 . '-->' . $content;
392
+ }
393
+
394
+ // Check if ad is middle one
395
+ if( $middle_position_status && strpos( $content, '<!--OffMiddle-->' ) === false ) {
396
+ if( substr_count( strtolower( $content ), '</p>' ) >= 2 ) {
397
+ $sch = "</p>";
398
+ $content = str_replace( "</P>", $sch, $content );
399
+ $paragraphsArray = explode( $sch, $content );
400
+ $nn = 0;
401
+ $mm = strlen( $content ) / 2;
402
+ for ( $i = 0; $i < count( $paragraphsArray ); $i++ ) {
403
+ $nn += strlen( $paragraphsArray[$i] ) + 4;
404
+ if( $nn > $mm ) {
405
+ if( ($mm - ($nn - strlen( $paragraphsArray[$i] ))) > ($nn - $mm) && $i + 1 < count( $paragraphsArray ) ) {
406
+ $paragraphsArray[$i + 1] = '<!--' . $m1 . '-->' . $paragraphsArray[$i + 1];
407
+ } else {
408
+ $paragraphsArray[$i] = '<!--' . $m1 . '-->' . $paragraphsArray[$i];
409
+ }
410
+ break;
411
  }
412
  }
413
+ $content = implode( $sch, $paragraphsArray );
 
414
  }
415
+ }
416
+
417
+ // End of Post ad
418
+ if( $end_position_status && strpos( $content, '<!--OffEnd-->' ) === false ) {
419
+ $content = $content . '<!--' . $b2 . '-->';
420
+ }
421
+
422
+
423
 
424
+ // Check if ad is after "More Tag"
425
+ if( $more_position_status && strpos( $content, '<!--OffAfMore-->' ) === false ) {
426
+ $mmr = '<!--' . $r1 . '-->';
427
+ $postid = get_the_ID();
428
+ $content = str_replace( '<span id="more-' . $postid . '"></span>', $mmr, $content );
429
+ }
430
+
431
+ // Right after last paragraph ad
432
+ if( $last_paragraph_position_status && strpos( $content, '<!--OffBfLastPara-->' ) === false ) {
433
+ $sch = "<p>";
434
+ $content = str_replace( "<P>", $sch, $content );
435
+ $paragraphsArray = explode( $sch, $content );
436
+ if( count( $paragraphsArray ) > 2 ) {
437
+ $content = implode( $sch, array_slice( $paragraphsArray, 0, count( $paragraphsArray ) - 1 ) ) . '<!--' . $g1 . '-->' . $sch . $paragraphsArray[count( $paragraphsArray ) - 1];
438
+ }
439
+ }
440
 
441
+ // After Image ad
442
+ if( $imageActive ) {
 
 
 
 
 
 
 
443
 
444
+ // Sanitation
445
+ $imgtag = "<img";
446
+ $delimiter = ">";
447
+ $caption = "[/caption]";
448
+ $atag = "</a>";
449
+ $content = str_replace( "<IMG", $imgtag, $content );
450
+ $content = str_replace( "</A>", $atag, $content );
451
 
452
+ // Start
453
+ $paragraphsArray = explode( $imgtag, $content );
454
+ if( ( int ) $imageNo < count( $paragraphsArray ) ) {
455
+ $paragraphsArrayImages = explode( $delimiter, $paragraphsArray[$imageNo] );
456
+ if( count( $paragraphsArrayImages ) > 1 ) {
457
+ $tss = explode( $caption, $paragraphsArray[$imageNo] );
458
+ $ccp = ( count( $tss ) > 1 ) ? strpos( strtolower( $tss[0] ), '[caption ' ) === false : false;
459
+ $paragraphsArrayAtag = explode( $atag, $paragraphsArray[$imageNo] );
460
+ $cdu = ( count( $paragraphsArrayAtag ) > 1 ) ? strpos( strtolower( $paragraphsArrayAtag[0] ), '<a href' ) === false : false;
461
+ if( $imageCaption && $ccp ) {
462
+ $paragraphsArray[$imageNo] = implode( $caption, array_slice( $tss, 0, 1 ) ) . $caption . "\r\n" . '<!--' . $imageAd . '-->' . "\r\n" . implode( $caption, array_slice( $tss, 1 ) );
463
+ } else if( $cdu ) {
464
+ $paragraphsArray[$imageNo] = implode( $atag, array_slice( $paragraphsArrayAtag, 0, 1 ) ) . $atag . "\r\n" . '<!--' . $imageAd . '-->' . "\r\n" . implode( $atag, array_slice( $paragraphsArrayAtag, 1 ) );
465
+ } else {
466
 
467
+ $paragraphsArray[$imageNo] = implode( $delimiter, array_slice( $paragraphsArrayImages, 0, 1 ) ) . $delimiter . "\r\n" . '<!--' . $imageAd . '-->' . "\r\n" . implode( $delimiter, array_slice( $paragraphsArrayImages, 1 ) );
468
+ }
469
+ }
470
+ $content = implode( $imgtag, $paragraphsArray );
471
+ }
472
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
473
 
474
+ return $content;
475
+ }
476
+ /**
477
+ * Sanitize content and return it cleaned
478
+ *
479
+ * @param string $content
480
+ * @return string
481
+ */
482
+ function quads_sanitize_content($content){
483
+
484
+ /* ... Tidy up content ... */
485
+ // Replace all <p></p> tags with placeholder ##QA-TP1##
486
+ $content = str_replace( "<p></p>", "##QA-TP1##", $content );
 
 
 
 
 
 
 
 
 
487
 
488
+ // Replace all <p>&nbsp;</p> tags with placeholder ##QA-TP2##
489
+ $content = str_replace( "<p>&nbsp;</p>", "##QA-TP2##", $content );
490
+
491
+ return $content;
492
+ }
493
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
494
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
495
 
496
+ /**
497
+ * Parse random ads which are created from quicktag <!--RndAds-->
498
+ *
499
+ * @global array $adsArray
500
+ * @global int $visibleContentAds
501
+ * @return content
502
+ */
503
+ function quads_parse_random_quicktag_ads($content){
504
+ global $adsArray, $visibleContentAds, $quads_options;
505
+
506
+ $maxAds = isset($quads_options['maxads']) ? $quads_options['maxads'] : 10;
507
+ /*
508
+ * Replace RndAds Random Ads
509
+ */
510
+ if( strpos( $content, '<!--RndAds-->' ) !== false && is_singular() ) {
511
+ $adsArrayTmp = array();
512
+ shuffle( $adsArray );
513
+ for ( $i = 1; $i <= $maxAds - $visibleContentAds; $i++ ) {
514
+ if( $i <= count( $adsArray ) ) {
515
+ array_push( $adsArrayTmp, $adsArray[$i - 1] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
516
  }
517
+ }
518
+ $tcx = count( $adsArrayTmp );
519
+ $tcy = substr_count( $content, '<!--RndAds-->' );
520
+ for ( $i = $tcx; $i <= $tcy - 1; $i++ ) {
521
+ array_push( $adsArrayTmp, -1 );
522
+ }
523
+ shuffle( $adsArrayTmp );
524
+ for ( $i = 1; $i <= $tcy; $i++ ) {
525
+ $tmp = $adsArrayTmp[0];
526
+ $content = quads_replace_ads( $content, 'RndAds', $adsArrayTmp[0] );
527
+ $adsArrayTmp = quads_del_element( $adsArrayTmp, 0 );
528
+ if( $tmp != -1 ) {
529
+ $visibleContentAds += 1;
530
+ };
531
+ //quads_set_ad_count_content();
532
+ //if( quads_ad_reach_max_count() ) {
533
+ if( $visibleContentAds >= quads_get_max_allowed_post_ads( $content ) ) {
534
+ $content = quads_clean_tags( $content );
535
+ return $content;
536
+ }
537
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
538
  }
539
+
540
+ return $content;
541
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
542
 
 
 
 
 
 
 
543
  /**
544
+ * Parse random default ads which can be enabled from general settings
545
  *
546
+ * @global array $adsArray
547
  * @global int $visibleContentAds
548
+ * @return string
549
+ */
550
+ function quads_parse_random_ads($content) {
551
+ global $adsRandom, $visibleContentAds;
552
+
553
+ $off_default_ads = (strpos( $content, '<!--OffDef-->' ) !== false);
554
+ if( $off_default_ads ) { // disabled default ads
555
+ return $content;
556
+ }
557
+
558
+ if( strpos( $content, '<!--CusRnd-->' ) !== false && is_singular() ) {
559
+
560
+ $tcx = count( $adsRandom );
561
+ // How often is a random ad appearing in content
562
+ $number_rand_ads = substr_count( $content, '<!--CusRnd-->' );
563
+
564
+ for ( $i = $tcx; $i <= $number_rand_ads - 1; $i++ ) {
565
+ array_push( $adsRandom, -1 );
566
+ }
567
+ shuffle( $adsRandom );
568
+ //wp_die(print_r($adsRandom));
569
+ //wp_die($adsRandom[0]);
570
+ for ( $i = 1; $i <= $number_rand_ads; $i++ ) {
571
+ $content = quads_replace_ads( $content, 'CusRnd', $adsRandom[0] );
572
+ $adsRandom = quads_del_element( $adsRandom, 0 );
573
+ $visibleContentAds += 1;
574
+ //quads_set_ad_count_content();
575
+ //if( quads_ad_reach_max_count() ) {
576
+ if( $visibleContentAds >= quads_get_max_allowed_post_ads( $content ) ) {
577
+ $content = quads_clean_tags( $content );
578
+ return $content;
579
+ }
580
+ }
581
+ }
582
+
583
+ return $content;
584
+ }
585
+
586
+ /**
587
+ * Parse Quicktags
588
+ *
589
+ * @global array $adsArray
590
  * @param string $content
591
+ * @return string
592
+ */
593
+ function quads_parse_quicktags($content){
594
+ global $adsArray, $visibleContentAds;
595
+
596
+ $idx = 0;
597
+ for ( $i = 1; $i <= count( $adsArray ); $i++ ) {
598
+ if( strpos( $content, '<!--Ads' . $adsArray[$idx] . '-->' ) !== false ) {
599
+ $content = quads_replace_ads( $content, 'Ads' . $adsArray[$idx], $adsArray[$idx] );
600
+ $adsArray = quads_del_element( $adsArray, $idx );
601
+ $visibleContentAds += 1;
602
+ //quads_set_ad_count_content();
603
+ //if( quads_ad_reach_max_count() ) {
604
+ if( $visibleContentAds >= quads_get_max_allowed_post_ads( $content ) ) {
605
+ $content = quads_clean_tags( $content );
606
+ return $content;
607
+ }
608
+ } else {
609
+ $idx += 1;
610
+ }
611
+ }
612
+
613
+ return $content;
614
+ }
615
+
616
+ /**
617
+ * Parse default ads Beginning/Middle/End/Paragraph Ads1-10
618
  *
619
+ * @param string $content
620
+ * @return string
621
  */
622
+ function quads_parse_default_ads( $content ) {
623
+ global $adsArrayCus, $adsRandom, $adsArray, $visibleContentAds;
 
 
 
 
 
624
 
625
+ $off_default_ads = (strpos( $content, '<!--OffDef-->' ) !== false);
626
+
627
+ if( $off_default_ads ) { // disabled default ads
628
+ return $content;
629
+ }
630
+ // Create the array which contains the random ads
631
+ $adsRandom = $adsArray;
632
+
633
+ // echo '<pre>';
634
+ // echo 'adsArrayCus';
635
+ // print_r($adsArrayCus);
636
+ // echo 'adsArray';
637
+ // print_r( $adsArray );
638
+ // echo '</pre>';
639
+
640
+ for ( $i = 0; $i <= count( $adsArrayCus ); $i++ ) {
641
+ if( isset( $adsArrayCus[$i] ) && strpos( $content, '<!--CusAds' . $adsArrayCus[$i] . '-->' ) !== false && in_array( $adsArrayCus[$i], $adsArray ) ) {
642
+ $content = quads_replace_ads( $content, 'CusAds' . $adsArrayCus[$i], $adsArrayCus[$i] );
643
+ // Create array $adsRandom for quads_parse_random_ads() parsing functions to make sure that the random function
644
+ // is never using ads that are already used on static ad spots which are generated with quads_parse_default_ads()
645
+ if ($i == 0){
646
+ $adsRandom = quads_del_element($adsRandom, array_search($adsArrayCus[$i], $adsRandom));
647
+ }else{
648
+ $adsRandom = quads_del_element($adsRandom, array_search($adsArrayCus[$i-1], $adsRandom));
649
+ }
650
+
651
+ $visibleContentAds += 1;
652
+ //quads_set_ad_count_content();
653
+ //if( quads_ad_reach_max_count() || $visibleContentAds >= quads_get_max_allowed_post_ads( $content ) ) {
654
+ //wp_die(quads_get_max_allowed_post_ads( $content ));
655
+ if( $visibleContentAds >= quads_get_max_allowed_post_ads( $content ) ) {
656
+ $content = quads_clean_tags( $content );
657
+ }
658
+ }
659
+ }
660
+ return $content;
661
  }
662
 
663
  /**
675
 
676
  if( strpos($content,'<!--'.$quicktag.'-->')===false ) {
677
  return $content;
678
+ }
679
+
680
  if ($id != -1) {
681
  $paragraphsArray = array(
682
  'float:left;margin:%1$dpx %1$dpx %1$dpx 0;',
706
  return $cont[0].$adscode.$cont[1];
707
  }
708
 
709
+ /**
710
+ * Main processing for the_content filter
711
+ *
712
+ * @global arr $quads_options all plugin settings
713
+ * @global int $visibleContentAds number of active content ads (reseted internally so we have to use a similar global below for external purposes: $visibleContentAdsGlobal)
714
+ * @global arr $adsArray Whitespace trimmed array of ad codes
715
+ * @global int $maxWidgets maximum number of ad widgets
716
+ * @global int $maxAds number of maximum available ads
717
+ * @global string $AdsWidName name of widget
718
+ * @global int $visibleContentAdsGlobal number of active content ads
719
+ * @global int $visibleShortcodeAds number of active shortcode ads
720
+ * @global int $ad_count_widget number of active widget ads
721
+ * @param string $content
722
+ *
723
+ * @return string
724
+ *
725
+ * @since 0.9.0
726
+ */
727
+
728
+ //function quads_process_content_old($content){
729
+ // global $quads_options, $visibleContentAds, $adsArray, $maxWidgets, $maxAds, $AdsWidName, $visibleContentAdsGlobal, $visibleShortcodeAds, $ad_count_widget;
730
+ //
731
+ // // Return original content if QUADS is not allowed
732
+ // if ( !quads_ad_is_allowed($content) ) {
733
+ // $content = quads_clean_tags($content);
734
+ // return $content;
735
+ // }
736
+ // // Maximum allowed ads
737
+ // $maxAds = isset($quads_options['maxads']) ? $quads_options['maxads'] : 10;
738
+ //
739
+ // // count active widget ads
740
+ // if (strpos($content,'<!--OffWidget-->')===false) {
741
+ // for($i=1;$i<=$maxWidgets;$i++) {
742
+ // $wadsid = sanitize_title(str_replace(array('(',')'),'',sprintf($AdsWidName,$i)));
743
+ // //$maxAds -= (is_active_widget('', '', $wadsid)) ? 1 : 0 ;
744
+ // $ad_count_widget += (is_active_widget('', '', $wadsid)) ? 1 : 0 ;
745
+ // }
746
+ // }
747
+ //
748
+ // // Return here if max visible ads are exceeded
749
+ // if( $visibleContentAds+$visibleShortcodeAds+$ad_count_widget >= $maxAds ) { // ShownAds === 0 or larger/equal than $maxAds
750
+ // $content = quads_clean_tags($content);
751
+ // return $content;
752
+ // };
753
+ //
754
+ // // Create array of valid id's
755
+ // if( count( $adsArray ) === 0 ) { //
756
+ // for ( $i = 1; $i <= $maxAds; $i++ ) {
757
+ // $tmp = isset($quads_options['ad' . $i]['code']) ? trim( $quads_options['ad' . $i]['code'] ) : '';
758
+ // // id is valid if there is either the plain text field populated or the adsense ad slot and the ad client id
759
+ // if( !empty( $tmp ) || (!empty($quads_options['ad' . $i]['g_data_ad_slot']) && !empty($quads_options['ad' . $i]['g_data_ad_client'] ) ) ) {
760
+ // $adsArray[] = $i;
761
+ // }
762
+ // }
763
+ // }
764
+ //
765
+ // // Ad code array is empty so break here
766
+ // if( count($adsArray) === 0 ) {
767
+ // $content = quads_clean_tags($content);
768
+ // return $content;
769
+ // };
770
+ //
771
+ // /* ... Tidy up content ... */
772
+ // // Replace all <p></p> tags with placeholder ##QA-TP1##
773
+ // $content = str_replace("<p></p>", "##QA-TP1##", $content);
774
+ //
775
+ // // Replace all <p>&nbsp;</p> tags with placeholder ##QA-TP2##
776
+ // $content = str_replace("<p>&nbsp;</p>", "##QA-TP2##", $content);
777
+ //
778
+ // $off_default_ads = (strpos($content,'<!--OffDef-->')!==false);
779
+ // if( !$off_default_ads ) { // disabled default positioned ads
780
+ //
781
+ // $adsArrayCus = array(); // ids of used ads
782
+ //
783
+ // $cusrnd = 'CusRnd'; // placeholder string for random ad
784
+ // $cusads = 'CusAds'; // placeholder string for custom ad spots
785
+ //
786
+ // $beginning_position_status = isset($quads_options['pos1']['BegnAds']) ? true : false;
787
+ // $beginning_position_ad_id = isset($quads_options['pos1']['BegnRnd']) ? $quads_options['pos1']['BegnRnd'] : 0;
788
+ //
789
+ // $middle_position_status = isset($quads_options['pos2']['MiddAds']) ? true : false;
790
+ // $middle_position_ad_id = isset($quads_options['pos2']['MiddRnd']) ? $quads_options['pos2']['MiddRnd'] : 0;
791
+ //
792
+ // $end_position_status = isset($quads_options['pos3']['EndiAds']) ? true : false;
793
+ // $end_position_ad_id = isset($quads_options['pos3']['EndiRnd']) ? $quads_options['pos3']['EndiRnd'] : 0;
794
+ //
795
+ // $more_position_status = isset($quads_options['pos4']['MoreAds']) ? true : false;
796
+ // $more_position_ad_id = isset($quads_options['pos4']['MoreRnd']) ? $quads_options['pos4']['MoreRnd'] : 0;
797
+ //
798
+ // $last_paragraph_position_status = isset($quads_options['pos5']['LapaAds']) ? true : false;
799
+ // $last_paragraph_position_ad_id = isset($quads_options['pos5']['LapaRnd'])? $quads_options['pos5']['LapaRnd'] : 0 ;
800
+ //
801
+ //
802
+ //
803
+ // $number = 3; // number of paragraph ads | default value 3.
804
+ // $default = 5; // Position. Let's start with id 5
805
+ // for($i=1;$i<=$number;$i++) {
806
+ //
807
+ // $key = $default +$i; // 6,7,8
808
+ //
809
+ // $paragraph['status'][$i] = isset($quads_options['pos' . $key]['Par'.$i .'Ads']) ? $quads_options['pos' . $key]['Par'.$i .'Ads'] : 0; // Status - active | inactive
810
+ // $paragraph['id'][$i] = isset($quads_options['pos' . $key]['Par'.$i .'Rnd']) ? $quads_options['pos' . $key]['Par'.$i .'Rnd'] : 0; // Ad id
811
+ // $paragraph['position'][$i] = isset($quads_options['pos' . $key]['Par'.$i .'Nup']) ? $quads_options['pos' . $key]['Par'.$i .'Nup'] : 0; // Paragraph No
812
+ // $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
813
+ //
814
+ // }
815
+ // // Position 9 Ad after Image
816
+ // $imageActive = isset($quads_options['pos9']['Img1Ads']) ? $quads_options['pos9']['Img1Ads'] : false;
817
+ // $imageAdNo = isset($quads_options['pos9']['Img1Rnd']) ? $quads_options['pos9']['Img1Rnd'] : false;
818
+ // $imageNo = isset($quads_options['pos9']['Img1Nup']) ? $quads_options['pos9']['Img1Nup'] : false;
819
+ // $imageCaption = isset($quads_options['pos9']['Img1Con']) ? $quads_options['pos9']['Img1Con'] : false;
820
+ //
821
+ //
822
+ // if ( $beginning_position_ad_id == 0 ) { $b1 = $cusrnd; } else { $b1 = $cusads.$beginning_position_ad_id; array_push($adsArrayCus, $beginning_position_ad_id); };
823
+ // if ( $more_position_ad_id == 0 ) { $r1 = $cusrnd; } else { $r1 = $cusads.$more_position_ad_id; array_push($adsArrayCus, $more_position_ad_id); };
824
+ // if ( $middle_position_ad_id == 0 ) { $m1 = $cusrnd; } else { $m1 = $cusads.$middle_position_ad_id; array_push($adsArrayCus, $middle_position_ad_id); };
825
+ // if ( $last_paragraph_position_ad_id == 0 ) { $g1 = $cusrnd; } else { $g1 = $cusads.$last_paragraph_position_ad_id; array_push($adsArrayCus, $last_paragraph_position_ad_id); };
826
+ // if ( $end_position_ad_id == 0 ) { $b2 = $cusrnd; } else { $b2 = $cusads.$end_position_ad_id; array_push($adsArrayCus, $end_position_ad_id); };
827
+ //
828
+ // for($i=1;$i<=$number;$i++) {
829
+ // if ( $paragraph['id'][$i] == 0 ) {
830
+ // $paragraph[$i] = $cusrnd;
831
+ // } else {
832
+ // $paragraph[$i] = $cusads.$paragraph['id'][$i];
833
+ // array_push($adsArrayCus, $paragraph['id'][$i]);
834
+ //
835
+ // };
836
+ // }
837
+ //
838
+ // // Create the arguments for filter quads_filter_paragraphs
839
+ // $quads_args = array (
840
+ // 'paragraph' => $paragraph,
841
+ // 'cusads' => $cusads,
842
+ // 'cusrnd' => $cusrnd,
843
+ // 'AdsIdCus' => $adsArrayCus,
844
+ //
845
+ // );
846
+ //
847
+ // // Execute filter to add more paragraph ad spots
848
+ // $quads_filtered = apply_filters('quads_filter_paragraphs', $quads_args);
849
+ //
850
+ // // The filtered arguments
851
+ // $paragraph = $quads_filtered['paragraph'];
852
+ //
853
+ // // filtered list of ad spots
854
+ // $adsArrayCus = $quads_filtered['AdsIdCus'];
855
+ //
856
+ // // Create paragraph ads
857
+ // //$number = 6;
858
+ // $number = 3;
859
+ // for($i=$number;$i>=1;$i--) {
860
+ // if ( !empty($paragraph['status'][$i]) ){
861
+ //
862
+ // $sch = "</p>";
863
+ // $content = str_replace("</P>", $sch, $content);
864
+ // // paragraphs in content
865
+ // $paragraphsArray = explode($sch, $content);
866
+ // if ( (int)$paragraph['position'][$i] < count($paragraphsArray) ) {
867
+ // $content = implode($sch, array_slice($paragraphsArray, 0, $paragraph['position'][$i])).$sch .'<!--'.$paragraph[$i].'-->'. implode($sch, array_slice($paragraphsArray, $paragraph['position'][$i]));
868
+ // } elseif ($paragraph['end_post'][$i]) {
869
+ // $content = implode($sch, $paragraphsArray).'<!--'.$paragraph[$i].'-->';
870
+ // }
871
+ // }
872
+ // }
873
+ //
874
+ // // Check if image ad is random one
875
+ // if ( $imageAdNo == 0 ) {
876
+ // $imageAd = $cusrnd;
877
+ // } else {
878
+ // $imageAd = $cusads.$imageAdNo;
879
+ // array_push($adsArrayCus, $imageAdNo);
880
+ // };
881
+ //
882
+ // // Check if ad is middle one
883
+ // if( $middle_position_status && strpos($content,'<!--OffMiddle-->')===false) {
884
+ // if( substr_count(strtolower($content), '</p>')>=2 ) {
885
+ // $sch = "</p>";
886
+ // $content = str_replace("</P>", $sch, $content);
887
+ // $paragraphsArray = explode($sch, $content);
888
+ // $nn = 0; $mm = strlen($content)/2;
889
+ // for($i=0;$i<count($paragraphsArray);$i++) {
890
+ // $nn += strlen($paragraphsArray[$i]) + 4;
891
+ // if($nn>$mm) {
892
+ // if( ($mm - ($nn - strlen($paragraphsArray[$i]))) > ($nn - $mm) && $i+1<count($paragraphsArray) ) {
893
+ // $paragraphsArray[$i+1] = '<!--'.$m1.'-->'.$paragraphsArray[$i+1];
894
+ // } else {
895
+ // $paragraphsArray[$i] = '<!--'.$m1.'-->'.$paragraphsArray[$i];
896
+ // }
897
+ // break;
898
+ // }
899
+ // }
900
+ // $content = implode($sch, $paragraphsArray);
901
+ // }
902
+ // }
903
+ //
904
+ //
905
+ // // Check if image ad is "More Tag" one
906
+ // if( $more_position_status && strpos($content,'<!--OffAfMore-->')===false) {
907
+ // $mmr = '<!--'.$r1.'-->';
908
+ // $postid = get_the_ID();
909
+ // $content = str_replace('<span id="more-'.$postid.'"></span>', $mmr, $content);
910
+ // }
911
+ //
912
+ // if( $beginning_position_status && strpos($content,'<!--OffBegin-->')===false) {
913
+ // $content = '<!--'.$b1.'-->'.$content;
914
+ // }
915
+ // if( $end_position_status && strpos($content,'<!--OffEnd-->')===false) {
916
+ // $content = $content.'<!--'.$b2.'-->';
917
+ // }
918
+ // if( $last_paragraph_position_status && strpos($content,'<!--OffBfLastPara-->')===false){
919
+ // $sch = "<p>";
920
+ // $content = str_replace("<P>", $sch, $content);
921
+ // $paragraphsArray = explode($sch, $content);
922
+ // if ( count($paragraphsArray) > 2 ) {
923
+ // $content = implode($sch, array_slice($paragraphsArray, 0, count($paragraphsArray)-1)) .'<!--'.$g1.'-->'. $sch. $paragraphsArray[count($paragraphsArray)-1];
924
+ // }
925
+ // }
926
+ //
927
+ // if ( $imageActive ){
928
+ //
929
+ // // Sanitation
930
+ // $imgtag = "<img";
931
+ // $delimiter = ">";
932
+ // $caption = "[/caption]";
933
+ // $atag = "</a>";
934
+ // $content = str_replace("<IMG", $imgtag, $content);
935
+ // $content = str_replace("</A>", $atag, $content);
936
+ //
937
+ // // Start
938
+ // $paragraphsArray = explode($imgtag, $content);
939
+ // if ( (int)$imageNo < count($paragraphsArray) ) {
940
+ // $paragraphsArrayImages = explode($delimiter, $paragraphsArray[$imageNo]);
941
+ // if ( count($paragraphsArrayImages) > 1 ) {
942
+ // $tss = explode($caption, $paragraphsArray[$imageNo]);
943
+ // $ccp = ( count($tss) > 1 ) ? strpos(strtolower($tss[0]),'[caption ')===false : false ;
944
+ // $paragraphsArrayAtag = explode($atag, $paragraphsArray[$imageNo]);
945
+ // $cdu = ( count($paragraphsArrayAtag) > 1 ) ? strpos(strtolower($paragraphsArrayAtag[0]),'<a href')===false : false ;
946
+ // if ( $imageCaption && $ccp ) {
947
+ // $paragraphsArray[$imageNo] = implode($caption, array_slice($tss, 0, 1)).$caption. "\r\n".'<!--'.$imageAd.'-->'."\r\n". implode($caption, array_slice($tss, 1));
948
+ // }else if ( $cdu ) {
949
+ // $paragraphsArray[$imageNo] = implode($atag, array_slice($paragraphsArrayAtag, 0, 1)).$atag. "\r\n".'<!--'.$imageAd.'-->'."\r\n". implode($atag, array_slice($paragraphsArrayAtag, 1));
950
+ // }else{
951
+ // $paragraphsArray[$imageNo] = implode($delimiter, array_slice($paragraphsArrayImages, 0, 1)).$delimiter. "\r\n".'<!--'.$imageAd.'-->'."\r\n". implode($delimiter, array_slice($paragraphsArrayImages, 1));
952
+ // }
953
+ // }
954
+ // $content = implode($imgtag, $paragraphsArray);
955
+ // }
956
+ // }
957
+ // } // end disabled default positioned ads
958
+ //
959
+ // /*
960
+ // * Tidy up content
961
+ // */
962
+ // $content = '<!--EmptyClear-->'.$content."\n".'<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>';
963
+ // $content = quads_clean_tags($content, true);
964
+ //
965
+ //
966
+ // /*
967
+ // * Replace Beginning/Middle/End/Paragraph Ads1-10
968
+ // */
969
+ //
970
+ // if( !$off_default_ads ) { // disabled default ads
971
+ // for( $i=1; $i<=count($adsArrayCus); $i++ ) {
972
+ //
973
+ // if( strpos($content,'<!--'.$cusads.$adsArrayCus[$i-1].'-->')!==false && in_array($adsArrayCus[$i-1], $adsArray)) {
974
+ // $content = quads_replace_ads( $content, $cusads.$adsArrayCus[$i], $adsArrayCus[$i] );
975
+ // // Comment this to allow the use of the same ad on several ad spots
976
+ // //$adsArray = quads_del_element($adsArray, array_search($adsArrayCus[$i-1], $adsArray)) ;
977
+ // $visibleContentAds += 1;
978
+ //
979
+ // quads_set_ad_count_content();
980
+ // if ( quads_ad_reach_max_count() ){
981
+ // $content = quads_clean_tags($content);
982
+ // }
983
+ // }
984
+ // }
985
+ // }
986
+ //
987
+ //
988
+ // /**
989
+ // * Replace Quicktags Ads1 to Ads10
990
+ // **/
991
+ //
992
+ // $tcn = count($adsArray); $idx = 0;
993
+ // for( $i=1; $i<=$tcn; $i++ ) {
994
+ // if( strpos($content, '<!--Ads'.$adsArray[$idx].'-->')!==false ) {
995
+ // $content = quads_replace_ads( $content, 'Ads'.$adsArray[$idx], $adsArray[$idx] );
996
+ // $adsArray = quads_del_element($adsArray, $idx) ;
997
+ // $visibleContentAds += 1;
998
+ // quads_set_ad_count_content();
999
+ // if (quads_ad_reach_max_count()){
1000
+ // $content = quads_clean_tags($content);
1001
+ // return $content;
1002
+ // }
1003
+ //
1004
+ // } else {
1005
+ // $idx += 1;
1006
+ // }
1007
+ // }
1008
+ //
1009
+ //
1010
+ //
1011
+ // /* ... Replace Beginning/Middle/End random Ads ... */
1012
+ // if( !$off_default_ads ) {
1013
+ // if( strpos($content, '<!--'.$cusrnd.'-->')!==false && is_singular() ) {
1014
+ // //wp_die($visibleContentAds + ' ' + $visibleShortcodeAds + $ad_count_widget + ' ');
1015
+ //
1016
+ // $tcx = count($adsArray);
1017
+ // $tcy = substr_count($content, '<!--'.$cusrnd.'-->');
1018
+ //
1019
+ // for( $i=$tcx; $i<=$tcy-1; $i++ ) {
1020
+ // array_push($adsArray, -1);
1021
+ // }
1022
+ // shuffle($adsArray);
1023
+ // for( $i=1; $i<=$tcy; $i++ ) {
1024
+ // $content = quads_replace_ads( $content, $cusrnd, $adsArray[0] );
1025
+ // $adsArray = quads_del_element($adsArray, 0) ;
1026
+ // $visibleContentAds += 1;
1027
+ // quads_set_ad_count_content();
1028
+ // if (quads_ad_reach_max_count()){
1029
+ // $content = quads_clean_tags($content);
1030
+ // return $content;
1031
+ // }
1032
+ // }
1033
+ // }
1034
+ // }
1035
+ //
1036
+ // /*
1037
+ // * Replace RndAds Random Ads
1038
+ // */
1039
+ // if( strpos($content, '<!--RndAds-->')!==false && is_singular() ) {
1040
+ // $adsArrayTmp = array();
1041
+ // shuffle($adsArray);
1042
+ // for( $i=1; $i<=$maxAds-$visibleContentAds; $i++ ) {
1043
+ // if( $i <= count($adsArray) ) {
1044
+ // array_push($adsArrayTmp, $adsArray[$i-1]);
1045
+ // }
1046
+ // }
1047
+ // $tcx = count($adsArrayTmp);
1048
+ // $tcy = substr_count($content, '<!--RndAds-->');
1049
+ // for( $i=$tcx; $i<=$tcy-1; $i++ ) {
1050
+ // array_push($adsArrayTmp, -1);
1051
+ // }
1052
+ // shuffle($adsArrayTmp);
1053
+ // for( $i=1; $i<=$tcy; $i++ ) {
1054
+ // $tmp = $adsArrayTmp[0];
1055
+ // $content = quads_replace_ads( $content, 'RndAds', $adsArrayTmp[0] );
1056
+ // $adsArrayTmp = quads_del_element($adsArrayTmp, 0) ;
1057
+ // if($tmp != -1){
1058
+ // $visibleContentAds += 1;
1059
+ // };
1060
+ // quads_set_ad_count_content();
1061
+ // if (quads_ad_reach_max_count()){
1062
+ // $content = quads_clean_tags($content);
1063
+ // return $content;
1064
+ // }
1065
+ // }
1066
+ // }
1067
+ //
1068
+ // /* ... That's it. DONE :) ... */
1069
+ // $content = quads_clean_tags($content);
1070
+ // // Reset ad_count - Important!!!
1071
+ // $visibleContentAdsGlobal = 0;
1072
+ // return do_shortcode($content);
1073
+ // }
1074
+ /**
1075
+ * Revert content into original content without any ad code
1076
+ *
1077
+ * @global int $visibleContentAds
1078
+ * @global array $adsArray
1079
+ * @global array $quads_options
1080
+ * @global int $ad_count
1081
+ * @param string $content
1082
+ * @param boolean $trimonly
1083
+ *
1084
+ * @return string content
1085
+ */
1086
+ function quads_clean_tags($content, $trimonly = false) {
1087
+ global $visibleContentAds;
1088
+ global $adsArray;
1089
+ global $quads_options;
1090
+ global $ad_count;
1091
+
1092
+ $tagnames = array('EmptyClear','RndAds','NoAds','OffDef','OffAds','OffWidget','OffBegin','OffMiddle','OffEnd','OffBfMore','OffAfLastPara','CusRnd');
1093
+
1094
+ for($i=1;$i<=10;$i++) {
1095
+ array_push($tagnames, 'CusAds'.$i);
1096
+ array_push($tagnames, 'Ads'.$i);
1097
+ };
1098
+
1099
+
1100
+ foreach ($tagnames as $tags) {
1101
+ if(strpos($content,'<!--'.$tags.'-->')!==false || $tags=='EmptyClear') {
1102
+ if($trimonly) {
1103
+ $content = str_replace('<p><!--'.$tags.'--></p>', '<!--'.$tags.'-->', $content);
1104
+ }else{
1105
+ $content = str_replace(array('<p><!--'.$tags.'--></p>','<!--'.$tags.'-->'), '', $content);
1106
+ $content = str_replace("##QA-TP1##", "<p></p>", $content);
1107
+ $content = str_replace("##QA-TP2##", "<p>&nbsp;</p>", $content);
1108
+ }
1109
+ }
1110
+ }
1111
+ if(!$trimonly && (is_single() || is_page()) ) {
1112
+ $visibleContentAds = 0;
1113
+ $adsArray = array();
1114
+ }
1115
+ return $content;
1116
+ }
1117
+
1118
+
1119
+
1120
  /**
1121
  * Remove element from array
1122
  *
includes/widgets.php CHANGED
@@ -18,9 +18,8 @@
18
  add_action( 'widgets_init', 'quads_register_widgets', 1 );
19
 
20
  function quads_register_widgets() {
21
-
22
-
23
  global $quads_options;
 
24
  $amountWidgets = 10;
25
  for ( $i = 1; $i <= $amountWidgets; $i++ ) {
26
  if( !empty( $quads_options['ad' . $i . '_widget'] ) ) {
@@ -29,23 +28,6 @@ function quads_register_widgets() {
29
  }
30
  }
31
 
32
- /**
33
- * Check if Ad widgets are visible on homepage
34
- *
35
- * @since 0.9.7
36
- * return true when ad widgets are not visible on frontpage else false
37
- * @deprecated since version 1.3.8
38
- */
39
- //function quads_hide_adwidget_on_homepage() {
40
- // global $quads_options;
41
- //
42
- // $is_active = isset( $quads_options["visibility"]["AppSide"] ) ? $quads_options["visibility"]["AppSide"] : null;
43
- //
44
- // if( is_front_page() && $is_active )
45
- // return true;
46
- //
47
- // return false;
48
- //}
49
 
50
  class quads_widgets_1 extends WP_Widget {
51
 
@@ -77,11 +59,17 @@ class quads_widgets_1 extends WP_Widget {
77
  */
78
  public function widget( $args, $instance ) {
79
  global $quads_options, $ad_count_widget;
 
 
 
 
 
 
80
  extract( $args );
81
 
82
-
83
  $cont = quads_post_settings_to_quicktags( get_the_content() );
84
- if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
 
85
 
86
  //quads_set_ad_count_widget();
87
  //$codetxt = $quads_options['ad' . $this->adsID . '_widget'];
@@ -123,10 +111,16 @@ class quads_widgets_2 extends WP_Widget {
123
 
124
  public function widget( $args, $instance ) {
125
  global $quads_options;
 
 
 
 
 
126
  extract( $args );
127
 
128
  $cont = quads_post_settings_to_quicktags( get_the_content() );
129
- if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
 
130
 
131
  //quads_set_ad_count_widget();
132
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
@@ -167,9 +161,14 @@ class quads_widgets_3 extends WP_Widget {
167
 
168
  public function widget( $args, $instance ) {
169
  global $quads_options;
 
 
 
 
 
170
  extract( $args );
171
  $cont = quads_post_settings_to_quicktags( get_the_content() );
172
- if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
173
 
174
  //quads_set_ad_count_widget();
175
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
@@ -210,10 +209,15 @@ class quads_widgets_4 extends WP_Widget {
210
 
211
  public function widget( $args, $instance ) {
212
  global $quads_options;
213
-
 
 
 
 
 
214
  extract( $args );
215
  $cont = quads_post_settings_to_quicktags( get_the_content() );
216
- if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
217
 
218
  //quads_set_ad_count_widget();
219
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
@@ -255,9 +259,13 @@ class quads_widgets_5 extends WP_Widget {
255
  public function widget( $args, $instance ) {
256
  global $quads_options;
257
 
 
 
 
 
258
  extract( $args );
259
  $cont = quads_post_settings_to_quicktags( get_the_content() );
260
- if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
261
 
262
  //quads_set_ad_count_widget();
263
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
@@ -299,9 +307,14 @@ class quads_widgets_6 extends WP_Widget {
299
  public function widget( $args, $instance ) {
300
  global $quads_options;
301
 
 
 
 
 
 
302
  extract( $args );
303
  $cont = quads_post_settings_to_quicktags( get_the_content() );
304
- if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
305
 
306
  //quads_set_ad_count_widget();
307
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
@@ -343,9 +356,14 @@ class quads_widgets_7 extends WP_Widget {
343
  public function widget( $args, $instance ) {
344
  global $quads_options;
345
 
 
 
 
 
 
346
  extract( $args );
347
  $cont = quads_post_settings_to_quicktags( get_the_content() );
348
- if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
349
 
350
  //quads_set_ad_count_widget();
351
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
@@ -386,10 +404,15 @@ class quads_widgets_8 extends WP_Widget {
386
 
387
  public function widget( $args, $instance ) {
388
  global $quads_options;
389
-
 
 
 
 
 
390
  extract( $args );
391
  $cont = quads_post_settings_to_quicktags( get_the_content() );
392
- if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
393
 
394
  //quads_set_ad_count_widget();
395
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
@@ -430,10 +453,15 @@ class quads_widgets_9 extends WP_Widget {
430
 
431
  public function widget( $args, $instance ) {
432
  global $quads_options;
433
-
 
 
 
 
 
434
  extract( $args );
435
  $cont = quads_post_settings_to_quicktags( get_the_content() );
436
- if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
437
 
438
  //quads_set_ad_count_widget();
439
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
@@ -474,10 +502,15 @@ class quads_widgets_10 extends WP_Widget {
474
 
475
  public function widget( $args, $instance ) {
476
  global $quads_options;
477
-
 
 
 
 
 
478
  extract( $args );
479
  $cont = quads_post_settings_to_quicktags( get_the_content() );
480
- if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
481
 
482
  //quads_set_ad_count_widget();
483
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
18
  add_action( 'widgets_init', 'quads_register_widgets', 1 );
19
 
20
  function quads_register_widgets() {
 
 
21
  global $quads_options;
22
+
23
  $amountWidgets = 10;
24
  for ( $i = 1; $i <= $amountWidgets; $i++ ) {
25
  if( !empty( $quads_options['ad' . $i . '_widget'] ) ) {
28
  }
29
  }
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
  class quads_widgets_1 extends WP_Widget {
33
 
59
  */
60
  public function widget( $args, $instance ) {
61
  global $quads_options, $ad_count_widget;
62
+
63
+ // All widget ads are deactivated via post meta settings
64
+ if( quads_check_meta_setting( 'NoAds' ) === '1' ){
65
+ return false;
66
+ }
67
+
68
  extract( $args );
69
 
 
70
  $cont = quads_post_settings_to_quicktags( get_the_content() );
71
+ //if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
72
+ if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() ) {
73
 
74
  //quads_set_ad_count_widget();
75
  //$codetxt = $quads_options['ad' . $this->adsID . '_widget'];
111
 
112
  public function widget( $args, $instance ) {
113
  global $quads_options;
114
+
115
+ // All widget ads are deactivated via post meta settings
116
+ if( quads_check_meta_setting( 'NoAds' ) === '1' ){
117
+ return false;
118
+ }
119
  extract( $args );
120
 
121
  $cont = quads_post_settings_to_quicktags( get_the_content() );
122
+ //if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() && !quads_ad_reach_max_count() ) {
123
+ if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() ) {
124
 
125
  //quads_set_ad_count_widget();
126
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
161
 
162
  public function widget( $args, $instance ) {
163
  global $quads_options;
164
+
165
+ // All widget ads are deactivated via post meta settings
166
+ if( quads_check_meta_setting( 'NoAds' ) === '1' ){
167
+ return false;
168
+ }
169
  extract( $args );
170
  $cont = quads_post_settings_to_quicktags( get_the_content() );
171
+ if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() ) {
172
 
173
  //quads_set_ad_count_widget();
174
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
209
 
210
  public function widget( $args, $instance ) {
211
  global $quads_options;
212
+
213
+ // All widget ads are deactivated via post meta settings
214
+ if( quads_check_meta_setting( 'NoAds' ) === '1' ){
215
+ return false;
216
+ }
217
+
218
  extract( $args );
219
  $cont = quads_post_settings_to_quicktags( get_the_content() );
220
+ if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() ) {
221
 
222
  //quads_set_ad_count_widget();
223
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
259
  public function widget( $args, $instance ) {
260
  global $quads_options;
261
 
262
+ // All widget ads are deactivated via post meta settings
263
+ if( quads_check_meta_setting( 'NoAds' ) === '1' ){
264
+ return false;
265
+ }
266
  extract( $args );
267
  $cont = quads_post_settings_to_quicktags( get_the_content() );
268
+ if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() ) {
269
 
270
  //quads_set_ad_count_widget();
271
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
307
  public function widget( $args, $instance ) {
308
  global $quads_options;
309
 
310
+ // All widget ads are deactivated via post meta settings
311
+ if( quads_check_meta_setting( 'NoAds' ) === '1' ){
312
+ return false;
313
+ }
314
+
315
  extract( $args );
316
  $cont = quads_post_settings_to_quicktags( get_the_content() );
317
+ if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() ) {
318
 
319
  //quads_set_ad_count_widget();
320
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
356
  public function widget( $args, $instance ) {
357
  global $quads_options;
358
 
359
+ // All widget ads are deactivated via post meta settings
360
+ if( quads_check_meta_setting( 'NoAds' ) === '1' ){
361
+ return false;
362
+ }
363
+
364
  extract( $args );
365
  $cont = quads_post_settings_to_quicktags( get_the_content() );
366
+ if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() ) {
367
 
368
  //quads_set_ad_count_widget();
369
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
404
 
405
  public function widget( $args, $instance ) {
406
  global $quads_options;
407
+
408
+ // All widget ads are deactivated via post meta settings
409
+ if( quads_check_meta_setting( 'NoAds' ) === '1' ){
410
+ return false;
411
+ }
412
+
413
  extract( $args );
414
  $cont = quads_post_settings_to_quicktags( get_the_content() );
415
+ if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() ) {
416
 
417
  //quads_set_ad_count_widget();
418
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
453
 
454
  public function widget( $args, $instance ) {
455
  global $quads_options;
456
+
457
+ // All widget ads are deactivated via post meta settings
458
+ if( quads_check_meta_setting( 'NoAds' ) === '1' ){
459
+ return false;
460
+ }
461
+
462
  extract( $args );
463
  $cont = quads_post_settings_to_quicktags( get_the_content() );
464
+ if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() ) {
465
 
466
  //quads_set_ad_count_widget();
467
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
502
 
503
  public function widget( $args, $instance ) {
504
  global $quads_options;
505
+
506
+ // All widget ads are deactivated via post meta settings
507
+ if( quads_check_meta_setting( 'NoAds' ) === '1' ){
508
+ return false;
509
+ }
510
+
511
  extract( $args );
512
  $cont = quads_post_settings_to_quicktags( get_the_content() );
513
+ if( strpos( $cont, "<!--OffAds-->" ) === false && strpos( $cont, "<!--OffWidget-->" ) === false && quads_ad_is_allowed() ) {
514
 
515
  //quads_set_ad_count_widget();
516
  $code = quads_render_ad( 'ad' . $this->adsID . '_widget', $quads_options['ad' . $this->adsID . '_widget']['code'] );
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.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,7 +35,7 @@ if( !defined( 'ABSPATH' ) )
35
 
36
  // Plugin version
37
  if( !defined( 'QUADS_VERSION' ) ) {
38
- define( 'QUADS_VERSION', '1.4.1' );
39
  }
40
 
41
  // Plugin name
@@ -61,9 +61,9 @@ $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' ) ) :
@@ -202,7 +202,8 @@ if( !class_exists( 'QuickAdsenseReloaded' ) ) :
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';
@@ -302,19 +303,22 @@ if( !class_exists( 'QuickAdsenseReloaded' ) ) :
302
  $current_version = get_option( 'quads_version' );
303
  if( $current_version ) {
304
  update_option( 'quads_version_upgraded_from', $current_version );
305
- } else {
306
- // First time installation
 
 
 
307
  $quads_options['post_types'] = array('post', 'page');
308
  $quads_options['visibility']['AppHome'] = "1";
309
  $quads_options['visibility']['AppCate'] = "1";
310
  $quads_options['visibility']['AppArch'] = "1";
311
  $quads_options['visibility']['AppTags'] = "1";
 
312
 
313
  update_option('quads_settings', $quads_options);
314
  }
315
 
316
  // Update the current version
317
- // Its done from the upgrade-functions.php routine
318
  //update_option( 'quads_version', QUADS_VERSION );
319
 
320
  // Add plugin installation date and variable for rating div
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.4
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.4' );
39
  }
40
 
41
  // Plugin name
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' ) ) :
202
  require_once QUADS_PLUGIN_DIR . 'includes/scripts.php';
203
  require_once QUADS_PLUGIN_DIR . 'includes/automattic-amp-ad.php';
204
  require_once QUADS_PLUGIN_DIR . 'includes/helper-functions.php';
205
+ require_once QUADS_PLUGIN_DIR . 'includes/conditionals.php';
206
+ require_once QUADS_PLUGIN_DIR . 'includes/frontend-checks.php';
207
 
208
  if( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
209
  require_once QUADS_PLUGIN_DIR . 'includes/admin/add-ons.php';
303
  $current_version = get_option( 'quads_version' );
304
  if( $current_version ) {
305
  update_option( 'quads_version_upgraded_from', $current_version );
306
+ }
307
+ // First time installation
308
+ // Get all settings and update them only if they are empty
309
+ $quads_options = get_option('quads_settings');
310
+ if(!$quads_options) {
311
  $quads_options['post_types'] = array('post', 'page');
312
  $quads_options['visibility']['AppHome'] = "1";
313
  $quads_options['visibility']['AppCate'] = "1";
314
  $quads_options['visibility']['AppArch'] = "1";
315
  $quads_options['visibility']['AppTags'] = "1";
316
+ $quads_options['quicktags']['QckTags'] = "1";
317
 
318
  update_option('quads_settings', $quads_options);
319
  }
320
 
321
  // Update the current version
 
322
  //update_option( 'quads_version', QUADS_VERSION );
323
 
324
  // Add plugin installation date and variable for rating div
readme.txt CHANGED
@@ -9,7 +9,7 @@ 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
 
@@ -129,25 +129,40 @@ Alternative Installation:
129
 
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
@@ -373,5 +388,5 @@ Alternative Installation:
373
 
374
  == Upgrade Notice ==
375
 
376
- = 1.3.1 =
377
- 1.3.1 Smaller, Faster, Quicker, Better - WP QUADS<a href="https://wordpress.org/plugins/quick-adsense-reloaded/changelog/" style="color:white;text-decoration: underline;">Complete changelog! </a>
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.4
13
 
14
  Quick Adsense Reloaded! Quickest way to insert Google AdSense & other ads into your website. Google AdSense integration with Google AMP support
15
 
129
 
130
  == Changelog ==
131
 
132
+ = 1.4.4 =
133
+ * Fix: Undefined variable if WP QUADS PRO beta version is used with more than 3 AdSebse paragraph AdSebse spots
134
+ * Fix: Deactivate License button not working
135
+ * Fix: Admin notice if AdSense codes are empty
136
+ * Fix: PHP Warning when AdSense ad codes are empty
137
+ * Fix: Not more than 3 AdSense widgets are shown at the same time
138
 
139
+ = 1.4.3 =
140
  * New: Add filter to add 3 more paragraph AdSense ads placed with WP QUADS PRO
141
+ * New: Add ad health and checking function to detect if there are error in adsense settings
142
  * New: Support link to troubleshooting guide if AdSense ads are not shown
143
  * New: Add floating Save Settings button
144
  * New: Grey out unused AdSense ad spots in general settings
145
  * New: Tested up to Wordpress 4.7.1
146
+ * New: Use up to 20 maximum AdSense ads on one page from a collection of 10 different ads
147
  * New: Allow the use of the same ad on several different ad positions at the same time
148
+ * New: Complete rewrite of the main processing function for easier maintanance
149
 
150
+ * Fix: Settings are lost after updating when db option quads_version is empty
151
  * Fix: AdSense option Hide on device X condition not working width shortcode [quads]
152
  * 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
153
  * Fix: Button Open All Ads only works on second click
154
  * Fix: Hide Sizing Options when ad type is not AdSense
155
+ * Fix: Meta Box option "Hide all ads" is not hiding custom created ads with commercial themes like bimber.
156
 
157
+ * Tweak: Enable quicktags button per default on first time installation
158
+ * Tweak: Performance update. Uses less ressources
159
 
160
 
161
+ = 1.4.2 =
162
+ * Skiped internally
163
+
164
+ = 1.4.1 =
165
+ * Skiped internally
166
 
167
  = 1.4.0 =
168
  * New: Add poll when AdSense plugin is deactivated
388
 
389
  == Upgrade Notice ==
390
 
391
+ = 1.4.3 =
392
+ 1.4.3 This new version brings a ton of improvements and small fixes - WP QUADS<a href="https://wordpress.org/plugins/quick-adsense-reloaded/changelog/" style="color:white;text-decoration: underline;">Complete changelog! </a>