Version Description
- Improvement: update AdSense API to V2
- Improvement: unify layout of backend notices
- Improvement: move some descriptions into tooltips
- Improvement: move ad blocker fix options to the related setting
- Fix: correct uppercase CSS rule for labels in backend
- Fix: remove usage link for every type except manual placement
- Fix: correct sorting of placements by type on placement list page
- Fix: bad language in Analytics Adblock Counter option
Download this release
Release Info
Developer | advancedads |
Plugin | Advanced Ads |
Version | 1.29.0 |
Comparing to | |
See all releases |
Code changes from version 1.28.0 to 1.29.0
- admin/assets/css/admin.css +184 -45
- admin/assets/img/logo.svg +1 -0
- admin/assets/js/admin.js +12 -24
- admin/includes/class-meta-box.php +3 -7
- admin/includes/class-notices.php +1 -1
- admin/includes/class-overview-widgets.php +18 -120
- admin/views/ad-info-after-textarea.php +1 -1
- admin/views/ad-main-metabox.php +6 -8
- admin/views/ad-output-metabox.php +8 -4
- admin/views/conditions/condition-author.php +1 -1
- admin/views/conditions/display-conditions-list.php +1 -1
- admin/views/conditions/no-option.php +1 -1
- admin/views/conditions/not-selected.php +1 -1
- admin/views/conditions/visitor-conditions-form-top.php +1 -1
- admin/views/gadsense-dashboard.php +10 -28
- admin/views/notices/error.php +1 -1
- admin/views/notices/info.php +1 -1
- admin/views/notices/inline.php +1 -1
- admin/views/overview-notice-row.php +1 -1
- admin/views/placement-form.php +2 -2
- admin/views/placements.php +8 -7
- admin/views/setting-license.php +1 -1
- admin/views/settings/general/block-bots.php +1 -1
- admin/views/settings/general/content-injection-priority.php +1 -1
- admin/views/settings/general/disable-ads.php +6 -5
- admin/views/support-callout.php +1 -1
- advanced-ads.php +2 -2
- classes/ad_type_plain.php +9 -8
- classes/frontend_checks.php +1 -1
- languages/advanced-ads.pot +233 -224
- modules/ad-blocker/admin/views/rebuild_form.php +8 -8
- modules/adblock-finder/admin/views/setting-ga.php +2 -2
- modules/ads-txt/admin/class-advanced-ads-ads-txt-admin.php +1 -1
- modules/ads-txt/admin/views/setting-additional-content.php +6 -1
- modules/gadsense/admin/admin.php +4 -4
- modules/gadsense/admin/assets/js/adsense.js +887 -991
- modules/gadsense/admin/assets/js/connect-adsense.js +79 -92
- modules/gadsense/admin/assets/js/mapi-settings.js +7 -5
- modules/gadsense/admin/views/adsense-account.php +24 -40
- modules/gadsense/admin/views/adsense-ad-parameters.php +2 -2
- modules/gadsense/admin/views/adsense-report.php +37 -0
- modules/gadsense/admin/views/connect-adsense.php +1 -1
- modules/gadsense/admin/views/external-ads-links.php +1 -1
- modules/gadsense/admin/views/external-ads-list.php +18 -25
- modules/gadsense/config.php +10 -8
- modules/gadsense/includes/adsense-report-api.php +163 -0
- modules/gadsense/includes/adsense-report-data.php +287 -0
- modules/gadsense/includes/class-adsense-report.php +103 -560
- modules/gadsense/includes/class-mapi.php +283 -337
- modules/gadsense/includes/class-network-adsense.php +2 -4
- modules/import-export/views/page.php +1 -1
- modules/privacy/admin/views/setting-general.php +2 -2
- readme.txt +15 -4
admin/assets/css/admin.css
CHANGED
@@ -29,14 +29,14 @@
|
|
29 |
#advads_overview_notices .advads-loader { position: absolute; top: 0; left: 0; right: 0; bottom: 0; height: 100%; width: 100%; margin: 0 auto; opacity: 0.5; background-color: #fff; background-position: center; }
|
30 |
#advads_overview_notices #advads-support-callout p { clear: both; margin-bottom: 0; }
|
31 |
.advads-ad-health-notices { overflow: hidden; }
|
32 |
-
.advads-ad-health-notices li { padding: 10px; overflow: hidden; box-shadow: 0 1px 2px 0 rgba( 0, 0, 0, 0.2 ); border-left:
|
33 |
.advads-ad-health-notices li > span { float: left; display: block; }
|
34 |
.advads-ad-health-notices li > span.date { display: none; float: right; margin: 0 1em; color: #666; font-style: italic; }
|
35 |
.advads-ad-health-notices li:hover span.date { display: block; }
|
36 |
.advads-ad-health-notices li > button { float: right; }
|
37 |
.advads-ad-health-notices li > button + button { margin-right: 10px; }
|
38 |
.advads-ad-health-notices li a { color: inherit; }
|
39 |
-
.advads-ad-health-notices-problem li {
|
40 |
.adsvads-ad-health-notices-show-hidden { text-align: right; cursor: pointer; margin-right: 10px; }
|
41 |
|
42 |
/**
|
@@ -92,7 +92,6 @@ h2.hndle .advads-hndlelinks a + a, #advads_overview_adsense_stats .advads-hndlel
|
|
92 |
.advads-metabox-notices .error { color: #dc3232; }
|
93 |
.advads-metabox-notices .warning, .advads-message-warning { color: #de8400; }
|
94 |
|
95 |
-
#ad-main-box { overflow: hidden; }
|
96 |
.post-type-advanced_ads #poststuff .meta-box-sortables .inside {
|
97 |
margin: 0;
|
98 |
padding: 0;
|
@@ -128,7 +127,7 @@ h2.hndle .advads-hndlelinks a + a, #advads_overview_adsense_stats .advads-hndlel
|
|
128 |
.advads-conditions-table .advanced-ads-display-condition-set label { float: left; margin-right: -1px; }
|
129 |
.advads-conditions-table .advads-button { font-size: inherit; }
|
130 |
#advads-visitor-conditions-new select,
|
131 |
-
.advads-conditions-new select { text-transform:
|
132 |
.advads-display-conditions-remove + h5 { display: inline-block; margin-top: 0; margin-left: 1em; }
|
133 |
select + .advads-conditions-single { display: inline-block; }
|
134 |
.advads-conditions-table { border-collapse: collapse; width: 100%; max-width: 850px; }
|
@@ -142,7 +141,7 @@ select + .advads-conditions-single { display: inline-block; }
|
|
142 |
.advads-conditions-connector { text-align: center; }
|
143 |
.advads-conditions-table > tbody > .advads-conditions-connector-and { background: none; }
|
144 |
.advads-conditions-connector label { text-transform: uppercase; background: #fff; border: 1px solid #aaa; color: #555; }
|
145 |
-
.advads-conditions-type { text-transform:
|
146 |
.advads-conditions-table .advads-conditions-connector .advads-error-message { display: none; }
|
147 |
|
148 |
.post-type-advanced_ads #advads-ad-content-plain { width: 100%; }
|
@@ -172,14 +171,16 @@ select + .advads-conditions-single { padding-left: 10px }
|
|
172 |
|
173 |
/* option lists */
|
174 |
.advads-option-list { overflow: hidden; }
|
175 |
-
.advads-option-list > .label { display: block; padding: 10px; font-weight: bold;
|
|
|
176 |
.advads-option-list > .label + div { display: block; padding: 10px; }
|
177 |
.advads-option-list > .label + div.hidden { display: none; }
|
178 |
.advads-option-list > hr { clear: both; float: none; display: block; }
|
179 |
.advads-option-list div[style*="display: none"] + hr { display: none; }
|
180 |
|
181 |
.advads-option { clear: both; float: none; display: block; overflow: hidden; }
|
182 |
-
.advads-option > span { display: block; float: left; width: 10em; padding: 10px; font-weight: bold;
|
|
|
183 |
.advads-option > span + div { padding: 10px; overflow: hidden; margin-left: 10em; }
|
184 |
.advads-option > span + div > label + input[type="radio"] { margin-left: 1em; }
|
185 |
.advads-option > span + div label + label { margin-left: 1em; }
|
@@ -225,6 +226,7 @@ select + .advads-conditions-single { padding-left: 10px }
|
|
225 |
.aa-select-list thead th { font-weight: 700; }
|
226 |
.aa-select-list tbody .dashicons.disabled { color: #939393; }
|
227 |
.aa-select-list .aa-select-list-update { font-size: 20px; padding: 13px; position: absolute; top: 0; right: 47px; }
|
|
|
228 |
.aa-select-list .aa-select-list-header { font-weight: 700; display: inline-block; font-size: 13px; line-height: 1.5em; }
|
229 |
.aa-select-list .aa-select-list-header span { display: inline-block; padding: 8px 9px; }
|
230 |
.aa-select-list-table-wrap { position: relative; }
|
@@ -234,8 +236,7 @@ select + .advads-conditions-single { padding-left: 10px }
|
|
234 |
.aa-select-list-loading-overlay { position:absolute; background-color:rgba(255,255,255,.75); top:0; right:0; bottom:0; left:0; text-align:center; z-index: 1; display:none; }
|
235 |
@media( min-width: 783px ) { .aa-select-list { padding-top: 38px; } .aa-select-list .aa-select-list-update { padding: 9px; right: 39px; } }
|
236 |
|
237 |
-
#advads-support-callout
|
238 |
-
#advads-support-callout a { text-decoration: none; }
|
239 |
|
240 |
/* Ad option tables */
|
241 |
.advads-ad-parameters-option-list-min-width input { width: 5em; border: none; text-align: right; }
|
@@ -280,7 +281,7 @@ fieldset.advads-group-add-ad { margin-top: 1em; }
|
|
280 |
.advads-placements-new-form .advads-placement-type label { display: inline-block; width: 140px; text-align: center; border: 0; padding: 0; }
|
281 |
.advads-placements-new-form .advads-buttonset .advads-button.advads-ui-state-active { outline: 8px solid #2ea2cc; border: 0; }
|
282 |
.advads-placements-new-form .advads-placement-type label .description { padding: 10px; }
|
283 |
-
.advads-placements-new-form .advads-error
|
284 |
.advads-placements-table { min-width: 80%; border-collapse: collapse; background: #fff; }
|
285 |
.advads-placements-table > tbody > tr { border-top: 1px solid #ddd; }
|
286 |
.advads-placements-table tbody tr td:first-child { width: 200px; }
|
@@ -333,8 +334,6 @@ a.advads-placement-sorted {
|
|
333 |
tr:hover .on-hover { display: block; }
|
334 |
.advads-admin-notice { overflow: hidden; }
|
335 |
.advads-admin-notice .button-primary { margin-left: 1em; }
|
336 |
-
.advads-admin-notice-inline { padding: 1px 12px; border: 1px solid #0074a2; border-left-width: 4px; }
|
337 |
-
.advads-admin-notice-inline p { margin: 0.5em 0; padding: 2px; }
|
338 |
.advads-review-image { margin-right: 10px; margin-bottom: 10px; float: left; }
|
339 |
.advads-spinner { float: none; visibility: visible; }
|
340 |
.advads-wide-input { width: 30em; }
|
@@ -350,7 +349,6 @@ tr:hover .on-hover { display: block; }
|
|
350 |
WELCOME PANEL
|
351 |
*/
|
352 |
.advads-admin-notice[data-notice="nl_intro"] { border: 4px solid #0073aa; }
|
353 |
-
.advads-admin-notice .notice-dismiss:before { color: #0073aa !important; } /* needed, because some other CSS seems to override it into white */
|
354 |
.advads-admin-notice .notice-dismiss { text-decoration: none; }
|
355 |
#aa-welcome-panel h2 { margin: 0; font-size: 21px; font-weight: 400; line-height: 1.2; }
|
356 |
#aa-welcome-panel h3 { margin: 1.33em 0; font-size: 16px; }
|
@@ -376,7 +374,8 @@ tr:hover .on-hover { display: block; }
|
|
376 |
.aa-select-list tbody [data-mapiaction="getCode"] { color: #46b450; }
|
377 |
.aa-select-list tbody .disabled[data-mapiaction="getCode"] { color: #a7a7a7; cursor: default; }
|
378 |
.aa-select-list tbody [data-mapiaction="updateCode"] { color: #0085ba; }
|
379 |
-
#mapi-
|
|
|
380 |
#remote-ad-unsupported-ad-type { background-color: #f0f0f0; padding: 8px; border: 1px solid #d6d6d6; }
|
381 |
#remote-ad-unsupported-ad-type ul { list-style-type: disc; padding-left: 20px }
|
382 |
#remote-ad-unsupported-ad-type[style*="display: block"] + p { display: none; }
|
@@ -410,7 +409,7 @@ tr:hover .on-hover { display: block; }
|
|
410 |
border-left-width: 4px;
|
411 |
padding: .75em;
|
412 |
margin: 1em 0;
|
413 |
-
|
414 |
}
|
415 |
|
416 |
/**
|
@@ -532,27 +531,27 @@ a.advads-modal-close-background {
|
|
532 |
- PLUGIN LIST
|
533 |
-*/
|
534 |
#advanced-ads-feedback-overlay {
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
}
|
545 |
#advanced-ads-feedback-content {
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
}
|
557 |
#advanced-ads-feedback-overlay-close-button { position: absolute; top: 10px; right: 10px; cursor: pointer; }
|
558 |
#advanced-ads-feedback-content textarea:not(.advanced_ads_disable_help_text),
|
@@ -568,13 +567,112 @@ a.advads-modal-close-background {
|
|
568 |
/**
|
569 |
- GENERAL
|
570 |
-*/
|
571 |
-
.advads-error-message { color: #dc3232 !important; }
|
572 |
-
.advads-error-message a { color: #dc3232; text-decoration: underline; }
|
573 |
.advads-success-message { color: green !important; }
|
574 |
.advads-hidden { display: none; }
|
575 |
.advads-loader { display: block; width: 43px; height: 11px; background: url(../img/loader.gif) no-repeat; }
|
576 |
.advads-loader.hidden { display: none; }
|
577 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
578 |
/* Image Ad */
|
579 |
#advads_type_image_wp_media .media-sidebar .setting:not([data-setting="title"]):not([data-setting="alt"]),
|
580 |
/* fields added via the `attachment_fields_to_edit` filter */
|
@@ -605,12 +703,12 @@ a.advads-modal-close-background {
|
|
605 |
|
606 |
/* Fix Safari autofill: https://stackoverflow.com/questions/38663578/how-to-hide-autofill-safari-icon-in-input-field */
|
607 |
.post-type-advanced_ads input::-webkit-contacts-auto-fill-button {
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
}
|
615 |
|
616 |
/* Pro Pitch List */
|
@@ -624,9 +722,9 @@ a.advads-manual-icon { text-decoration: none; }
|
|
624 |
div.advads-flex{
|
625 |
display: flex;
|
626 |
align-items: top;
|
627 |
-
|
628 |
flex-direction: row;
|
629 |
-
|
630 |
flex-flow: row wrap;
|
631 |
align-content: flex-end;
|
632 |
}
|
@@ -643,6 +741,18 @@ div.advads-stats-box{
|
|
643 |
margin:4pt;
|
644 |
padding:4pt;
|
645 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
646 |
div.advads-stats-box div.advads-stats-box-main{
|
647 |
font-weight: bold;
|
648 |
font-size: 18px;
|
@@ -652,6 +762,10 @@ div.advads-stats-dd-container {
|
|
652 |
float:right;
|
653 |
text-align:right;
|
654 |
}
|
|
|
|
|
|
|
|
|
655 |
div.advads-stats-dd-button{
|
656 |
font-weight:bold;
|
657 |
font-size: 14px;
|
@@ -674,6 +788,9 @@ div.advads-stats-dd-item{
|
|
674 |
text-align:right;
|
675 |
min-width: 280px;
|
676 |
}
|
|
|
|
|
|
|
677 |
div.advads-stats-select{
|
678 |
border: none;
|
679 |
}
|
@@ -682,8 +799,23 @@ div.advads-stats-dd-item-selected{
|
|
682 |
color: #ffffff;
|
683 |
font-weight: bold;
|
684 |
}
|
685 |
-
|
|
|
686 |
display: none;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
687 |
}
|
688 |
|
689 |
tr.advads-clickable-row:hover{
|
@@ -793,3 +925,10 @@ tr.advads-clickable-row:hover{
|
|
793 |
input.advads-has-sub-settings:checked ~ .advads-sub-settings {
|
794 |
display: block;
|
795 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
#advads_overview_notices .advads-loader { position: absolute; top: 0; left: 0; right: 0; bottom: 0; height: 100%; width: 100%; margin: 0 auto; opacity: 0.5; background-color: #fff; background-position: center; }
|
30 |
#advads_overview_notices #advads-support-callout p { clear: both; margin-bottom: 0; }
|
31 |
.advads-ad-health-notices { overflow: hidden; }
|
32 |
+
.advads-ad-health-notices li { padding: 10px; overflow: hidden; box-shadow: 0 1px 2px 0 rgba( 0, 0, 0, 0.2 ); border-left-color: #dc3232; }
|
33 |
.advads-ad-health-notices li > span { float: left; display: block; }
|
34 |
.advads-ad-health-notices li > span.date { display: none; float: right; margin: 0 1em; color: #666; font-style: italic; }
|
35 |
.advads-ad-health-notices li:hover span.date { display: block; }
|
36 |
.advads-ad-health-notices li > button { float: right; }
|
37 |
.advads-ad-health-notices li > button + button { margin-right: 10px; }
|
38 |
.advads-ad-health-notices li a { color: inherit; }
|
39 |
+
.advads-ad-health-notices-problem li:before { content: "\f534"; color: #dc3232; }
|
40 |
.adsvads-ad-health-notices-show-hidden { text-align: right; cursor: pointer; margin-right: 10px; }
|
41 |
|
42 |
/**
|
92 |
.advads-metabox-notices .error { color: #dc3232; }
|
93 |
.advads-metabox-notices .warning, .advads-message-warning { color: #de8400; }
|
94 |
|
|
|
95 |
.post-type-advanced_ads #poststuff .meta-box-sortables .inside {
|
96 |
margin: 0;
|
97 |
padding: 0;
|
127 |
.advads-conditions-table .advanced-ads-display-condition-set label { float: left; margin-right: -1px; }
|
128 |
.advads-conditions-table .advads-button { font-size: inherit; }
|
129 |
#advads-visitor-conditions-new select,
|
130 |
+
.advads-conditions-new select:first-letter { text-transform: uppercase; }
|
131 |
.advads-display-conditions-remove + h5 { display: inline-block; margin-top: 0; margin-left: 1em; }
|
132 |
select + .advads-conditions-single { display: inline-block; }
|
133 |
.advads-conditions-table { border-collapse: collapse; width: 100%; max-width: 850px; }
|
141 |
.advads-conditions-connector { text-align: center; }
|
142 |
.advads-conditions-table > tbody > .advads-conditions-connector-and { background: none; }
|
143 |
.advads-conditions-connector label { text-transform: uppercase; background: #fff; border: 1px solid #aaa; color: #555; }
|
144 |
+
.advads-conditions-type:first-letter { text-transform: uppercase; }
|
145 |
.advads-conditions-table .advads-conditions-connector .advads-error-message { display: none; }
|
146 |
|
147 |
.post-type-advanced_ads #advads-ad-content-plain { width: 100%; }
|
171 |
|
172 |
/* option lists */
|
173 |
.advads-option-list { overflow: hidden; }
|
174 |
+
.advads-option-list > .label { display: block; padding: 10px; font-weight: bold; color: #444; text-align: left; font-size: 100%; }
|
175 |
+
.advads-option-list > .label:first-letter { text-transform: uppercase; }
|
176 |
.advads-option-list > .label + div { display: block; padding: 10px; }
|
177 |
.advads-option-list > .label + div.hidden { display: none; }
|
178 |
.advads-option-list > hr { clear: both; float: none; display: block; }
|
179 |
.advads-option-list div[style*="display: none"] + hr { display: none; }
|
180 |
|
181 |
.advads-option { clear: both; float: none; display: block; overflow: hidden; }
|
182 |
+
.advads-option > span { display: block; float: left; width: 10em; padding: 10px; font-weight: bold; }
|
183 |
+
.advads-option > span:first-letter { text-transform: uppercase; }
|
184 |
.advads-option > span + div { padding: 10px; overflow: hidden; margin-left: 10em; }
|
185 |
.advads-option > span + div > label + input[type="radio"] { margin-left: 1em; }
|
186 |
.advads-option > span + div label + label { margin-left: 1em; }
|
226 |
.aa-select-list thead th { font-weight: 700; }
|
227 |
.aa-select-list tbody .dashicons.disabled { color: #939393; }
|
228 |
.aa-select-list .aa-select-list-update { font-size: 20px; padding: 13px; position: absolute; top: 0; right: 47px; }
|
229 |
+
body.rtl .aa-select-list .aa-select-list-update { left: 47px; right: auto;}
|
230 |
.aa-select-list .aa-select-list-header { font-weight: 700; display: inline-block; font-size: 13px; line-height: 1.5em; }
|
231 |
.aa-select-list .aa-select-list-header span { display: inline-block; padding: 8px 9px; }
|
232 |
.aa-select-list-table-wrap { position: relative; }
|
236 |
.aa-select-list-loading-overlay { position:absolute; background-color:rgba(255,255,255,.75); top:0; right:0; bottom:0; left:0; text-align:center; z-index: 1; display:none; }
|
237 |
@media( min-width: 783px ) { .aa-select-list { padding-top: 38px; } .aa-select-list .aa-select-list-update { padding: 9px; right: 39px; } }
|
238 |
|
239 |
+
#advads-support-callout a { text-decoration: none; color: inherit; }
|
|
|
240 |
|
241 |
/* Ad option tables */
|
242 |
.advads-ad-parameters-option-list-min-width input { width: 5em; border: none; text-align: right; }
|
281 |
.advads-placements-new-form .advads-placement-type label { display: inline-block; width: 140px; text-align: center; border: 0; padding: 0; }
|
282 |
.advads-placements-new-form .advads-buttonset .advads-button.advads-ui-state-active { outline: 8px solid #2ea2cc; border: 0; }
|
283 |
.advads-placements-new-form .advads-placement-type label .description { padding: 10px; }
|
284 |
+
.advads-placements-new-form .advads-notice-inline.advads-error { display: none; }
|
285 |
.advads-placements-table { min-width: 80%; border-collapse: collapse; background: #fff; }
|
286 |
.advads-placements-table > tbody > tr { border-top: 1px solid #ddd; }
|
287 |
.advads-placements-table tbody tr td:first-child { width: 200px; }
|
334 |
tr:hover .on-hover { display: block; }
|
335 |
.advads-admin-notice { overflow: hidden; }
|
336 |
.advads-admin-notice .button-primary { margin-left: 1em; }
|
|
|
|
|
337 |
.advads-review-image { margin-right: 10px; margin-bottom: 10px; float: left; }
|
338 |
.advads-spinner { float: none; visibility: visible; }
|
339 |
.advads-wide-input { width: 30em; }
|
349 |
WELCOME PANEL
|
350 |
*/
|
351 |
.advads-admin-notice[data-notice="nl_intro"] { border: 4px solid #0073aa; }
|
|
|
352 |
.advads-admin-notice .notice-dismiss { text-decoration: none; }
|
353 |
#aa-welcome-panel h2 { margin: 0; font-size: 21px; font-weight: 400; line-height: 1.2; }
|
354 |
#aa-welcome-panel h3 { margin: 1.33em 0; font-size: 16px; }
|
374 |
.aa-select-list tbody [data-mapiaction="getCode"] { color: #46b450; }
|
375 |
.aa-select-list tbody .disabled[data-mapiaction="getCode"] { color: #a7a7a7; cursor: default; }
|
376 |
.aa-select-list tbody [data-mapiaction="updateCode"] { color: #0085ba; }
|
377 |
+
#mapi-archived-ads { font-size: 20px; padding: 9px; position: absolute; top: 0; right: 78px; color: #72777c; cursor: pointer; }
|
378 |
+
body.rtl #mapi-archived-ads { left: 78px; right:auto; }
|
379 |
#remote-ad-unsupported-ad-type { background-color: #f0f0f0; padding: 8px; border: 1px solid #d6d6d6; }
|
380 |
#remote-ad-unsupported-ad-type ul { list-style-type: disc; padding-left: 20px }
|
381 |
#remote-ad-unsupported-ad-type[style*="display: block"] + p { display: none; }
|
409 |
border-left-width: 4px;
|
410 |
padding: .75em;
|
411 |
margin: 1em 0;
|
412 |
+
display: none;
|
413 |
}
|
414 |
|
415 |
/**
|
531 |
- PLUGIN LIST
|
532 |
-*/
|
533 |
#advanced-ads-feedback-overlay {
|
534 |
+
/* Height & width depends on how you want to reveal the overlay (see JS below) */
|
535 |
+
height: 100%;
|
536 |
+
width: 100%;
|
537 |
+
position: fixed; /* Stay in place */
|
538 |
+
z-index: 10000; /* Sit on top */
|
539 |
+
left: 0;
|
540 |
+
top: 0;
|
541 |
+
background-color: rgb(120,120,120); /* Black fallback color */
|
542 |
+
background-color: rgba(0,0,0, 0.5); /* Black w/opacity */
|
543 |
}
|
544 |
#advanced-ads-feedback-content {
|
545 |
+
position: relative;
|
546 |
+
top: 25%; /* 25% from the top */
|
547 |
+
width: 500px;
|
548 |
+
max-width: 100%;
|
549 |
+
margin: auto;
|
550 |
+
margin-top: 30px; /* 30px top margin to avoid conflict with the close button on smaller screens */
|
551 |
+
max-height: 50%;
|
552 |
+
padding: 20px;
|
553 |
+
background-color: #fff;
|
554 |
+
overflow-y: scroll;
|
555 |
}
|
556 |
#advanced-ads-feedback-overlay-close-button { position: absolute; top: 10px; right: 10px; cursor: pointer; }
|
557 |
#advanced-ads-feedback-content textarea:not(.advanced_ads_disable_help_text),
|
567 |
/**
|
568 |
- GENERAL
|
569 |
-*/
|
|
|
|
|
570 |
.advads-success-message { color: green !important; }
|
571 |
.advads-hidden { display: none; }
|
572 |
.advads-loader { display: block; width: 43px; height: 11px; background: url(../img/loader.gif) no-repeat; }
|
573 |
.advads-loader.hidden { display: none; }
|
574 |
|
575 |
+
/* Tooltips for help */
|
576 |
+
.advads-help {
|
577 |
+
position: relative;
|
578 |
+
color: #dcdcde;
|
579 |
+
}
|
580 |
+
.advads-help:before {
|
581 |
+
content: "\f223";
|
582 |
+
font-family: dashicons;
|
583 |
+
display: inline-block;
|
584 |
+
line-height: 1;
|
585 |
+
text-decoration: inherit;
|
586 |
+
-webkit-font-smoothing: antialiased;
|
587 |
+
-moz-osx-font-smoothing: grayscale;
|
588 |
+
width: 20px;
|
589 |
+
height: 20px;
|
590 |
+
font-size: 20px;
|
591 |
+
vertical-align: top;
|
592 |
+
text-align: center;
|
593 |
+
transition: color 0.1s ease-in;
|
594 |
+
}
|
595 |
+
div:hover > .advads-help:before,
|
596 |
+
p:hover > .advads-help:before,
|
597 |
+
td:hover > .advads-help:before, /* for settings page */
|
598 |
+
li:hover > .advads-help:before {
|
599 |
+
color: #0474A2;
|
600 |
+
}
|
601 |
+
.advads-help .advads-tooltip {
|
602 |
+
display: none;
|
603 |
+
width: 300px;
|
604 |
+
}
|
605 |
+
.advads-help:hover .advads-tooltip {
|
606 |
+
display: block;
|
607 |
+
left: 20px;
|
608 |
+
}
|
609 |
+
|
610 |
+
/* Advanced Ads Icon */
|
611 |
+
.advads-icon {
|
612 |
+
display: inline-block;
|
613 |
+
width: 20px;
|
614 |
+
height: 20px;
|
615 |
+
background: url(../img/logo.svg);
|
616 |
+
}
|
617 |
+
|
618 |
+
/* WP Admin notifications branded for Advanced Ads */
|
619 |
+
.advads-notice,
|
620 |
+
.post-type-advanced_ads .notice {
|
621 |
+
border-left-color: #1B183A;
|
622 |
+
}
|
623 |
+
.wp-core-ui .notice.advads-notice .button, .wp-core-ui .notice.advads-notice p button {
|
624 |
+
background-color: #0474A2;
|
625 |
+
border-color: #0474A2;
|
626 |
+
color: #FFF;
|
627 |
+
}
|
628 |
+
|
629 |
+
.advads-notice .notice-dismiss:before,
|
630 |
+
.post-type-advanced_ads .notice-dismiss:before {
|
631 |
+
color: #1B183A;
|
632 |
+
}
|
633 |
+
.notice .advads-icon, .advads-notice .advads-icon {
|
634 |
+
position: relative;
|
635 |
+
top: 4px;
|
636 |
+
margin-right: 5px;
|
637 |
+
}
|
638 |
+
|
639 |
+
/* Notification blocks */
|
640 |
+
.advads-notice-block {
|
641 |
+
padding-left: 4em;
|
642 |
+
}
|
643 |
+
.advads-notice-block:before {
|
644 |
+
font-family: dashicons;
|
645 |
+
color: #0474A2;
|
646 |
+
position: absolute;
|
647 |
+
top: 25px; left: 16px;
|
648 |
+
margin-right: 5px;
|
649 |
+
display: inline-block;
|
650 |
+
line-height: 1;
|
651 |
+
font-size: 20px;
|
652 |
+
vertical-align: top;
|
653 |
+
}
|
654 |
+
|
655 |
+
/* Inline Notifications */
|
656 |
+
.advads-notice-inline:before {
|
657 |
+
font-family: dashicons;
|
658 |
+
color: #0474A2;
|
659 |
+
float: left;
|
660 |
+
margin-right: 5px;
|
661 |
+
line-height: 1;
|
662 |
+
font-size: 20px;
|
663 |
+
vertical-align: top;
|
664 |
+
}
|
665 |
+
.advads-error:before {
|
666 |
+
content: "\f534";
|
667 |
+
color: #dc3232;
|
668 |
+
}
|
669 |
+
.advads-idea:before {
|
670 |
+
content: "\f339";
|
671 |
+
}
|
672 |
+
.advads-manual:before {
|
673 |
+
content: "\f118";
|
674 |
+
}
|
675 |
+
|
676 |
/* Image Ad */
|
677 |
#advads_type_image_wp_media .media-sidebar .setting:not([data-setting="title"]):not([data-setting="alt"]),
|
678 |
/* fields added via the `attachment_fields_to_edit` filter */
|
703 |
|
704 |
/* Fix Safari autofill: https://stackoverflow.com/questions/38663578/how-to-hide-autofill-safari-icon-in-input-field */
|
705 |
.post-type-advanced_ads input::-webkit-contacts-auto-fill-button {
|
706 |
+
visibility: hidden;
|
707 |
+
display: none !important;
|
708 |
+
pointer-events: none;
|
709 |
+
height: 0;
|
710 |
+
width: 0;
|
711 |
+
margin: 0;
|
712 |
}
|
713 |
|
714 |
/* Pro Pitch List */
|
722 |
div.advads-flex{
|
723 |
display: flex;
|
724 |
align-items: top;
|
725 |
+
justify-content: top;
|
726 |
flex-direction: row;
|
727 |
+
flex-wrap: wrap;
|
728 |
flex-flow: row wrap;
|
729 |
align-content: flex-end;
|
730 |
}
|
741 |
margin:4pt;
|
742 |
padding:4pt;
|
743 |
}
|
744 |
+
div.advads-stats-box .advads-stats-age {
|
745 |
+
clear: right;
|
746 |
+
float: right;
|
747 |
+
text-align: right;
|
748 |
+
color: #bbbbbb;
|
749 |
+
margin-top: 5px;
|
750 |
+
}
|
751 |
+
body.rtl div.advads-stats-box .advads-stats-age {
|
752 |
+
clear: left;
|
753 |
+
float: left;
|
754 |
+
text-align: left;
|
755 |
+
}
|
756 |
div.advads-stats-box div.advads-stats-box-main{
|
757 |
font-weight: bold;
|
758 |
font-size: 18px;
|
762 |
float:right;
|
763 |
text-align:right;
|
764 |
}
|
765 |
+
body.rtl div.advads-stats-dd-container {
|
766 |
+
float:left;
|
767 |
+
text-align:left;
|
768 |
+
}
|
769 |
div.advads-stats-dd-button{
|
770 |
font-weight:bold;
|
771 |
font-size: 14px;
|
788 |
text-align:right;
|
789 |
min-width: 280px;
|
790 |
}
|
791 |
+
body.rtl div.advads-stats-dd-item{
|
792 |
+
text-align:left;
|
793 |
+
}
|
794 |
div.advads-stats-select{
|
795 |
border: none;
|
796 |
}
|
799 |
color: #ffffff;
|
800 |
font-weight: bold;
|
801 |
}
|
802 |
+
|
803 |
+
#advads_overview_adsense_stats .advads-stats-dd-button .advads-stats-dd-items {
|
804 |
display: none;
|
805 |
+
right: 0px;
|
806 |
+
width: 300px;
|
807 |
+
position: absolute;
|
808 |
+
font-weight: normal;
|
809 |
+
}
|
810 |
+
body.rtl #advads_overview_adsense_stats .advads-stats-dd-button .advads-stats-dd-items {
|
811 |
+
left: 0px;
|
812 |
+
right: auto;
|
813 |
+
}
|
814 |
+
#advads_overview_adsense_stats .advads-stats-dd-button .advads-stats-dd-items .current-filter {
|
815 |
+
font-weight: 700;
|
816 |
+
background-color: #0073aa;
|
817 |
+
color: #ffffff;
|
818 |
+
font-weight: bold;
|
819 |
}
|
820 |
|
821 |
tr.advads-clickable-row:hover{
|
925 |
input.advads-has-sub-settings:checked ~ .advads-sub-settings {
|
926 |
display: block;
|
927 |
}
|
928 |
+
|
929 |
+
/**
|
930 |
+
* DEPRECATED
|
931 |
+
*/
|
932 |
+
/* use "advads-notice-inline advads-error" classes instead */
|
933 |
+
.advads-error-message { color: #dc3232 !important; }
|
934 |
+
.advads-error-message a { color: #dc3232; text-decoration: underline; }
|
admin/assets/img/logo.svg
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0" y="0" viewBox="0 0 351.7 352" xml:space="preserve"><path d="M252.2 149.6v125.1h-174.9v-174.9H202.4c-5.2-11.8-8-24.7-8-38.5s3-26.7 8-38.5h-37.7H0v267.9l8.8 8.8 -8.8-8.8C0 324.5 27.5 352 61.3 352l0 0h103.4 164.5V149.3c-11.8 5.2-25 8.3-38.8 8.3C276.9 157.6 264 154.6 252.2 149.6z" fill="#1C1B3A"/><circle cx="290.4" cy="61.3" r="61.3" fill="#0E75A4"/></svg>
|
admin/assets/js/admin.js
CHANGED
@@ -199,7 +199,7 @@ jQuery( document ).ready( function ( $ ) {
|
|
199 |
} );
|
200 |
} );
|
201 |
|
202 |
-
// sort placement by type or name
|
203 |
jQuery( '.advads-sort' ).on( 'click', function ( e ) {
|
204 |
var sort = jQuery( this );
|
205 |
var order = sort.data( 'order' );
|
@@ -213,6 +213,9 @@ jQuery( document ).ready( function ( $ ) {
|
|
213 |
rows.sort( function ( a, b ) {
|
214 |
var keyA = jQuery( a ).data( order );
|
215 |
var keyB = jQuery( b ).data( order );
|
|
|
|
|
|
|
216 |
return ( keyA.localeCompare( keyB ) );
|
217 |
} );
|
218 |
jQuery.each( rows, function ( index, row ) {
|
@@ -235,9 +238,9 @@ jQuery( document ).ready( function ( $ ) {
|
|
235 |
$( '#advads-output-wrapper-id' ).on( 'keyup', function () {
|
236 |
var id_value = $( this ).val()
|
237 |
if ( /^[a-z-0-9]*$/.test( id_value ) ) {
|
238 |
-
$( '.advads-output-wrapper-id-error' ).
|
239 |
} else {
|
240 |
-
$( '.advads-output-wrapper-id-error' ).
|
241 |
}
|
242 |
} )
|
243 |
|
@@ -667,12 +670,13 @@ jQuery( document ).ready( function ( $ ) {
|
|
667 |
advads_show_adsense_auto_ads_warning()
|
668 |
}
|
669 |
|
670 |
-
//advads_ads_txt_check_third_party();
|
671 |
advads_ads_txt_find_issues()
|
672 |
|
673 |
jQuery( '.advanced-ads-adsense-dashboard' ).each( function ( key, elm ) {
|
674 |
-
|
675 |
-
|
|
|
|
|
676 |
} )
|
677 |
|
678 |
/**
|
@@ -862,7 +866,8 @@ function advads_ads_txt_find_issues () {
|
|
862 |
}
|
863 |
|
864 |
function fail ( jqXHR ) {
|
865 |
-
$wrapper.html(
|
|
|
866 |
+ jQuery( '#advads-ads-txt-notice-error' ).text().replace( '%s', parseInt( jqXHR.status, 10 ) ),
|
867 |
+'</p>'
|
868 |
)
|
@@ -1161,23 +1166,6 @@ if ( ! window.AdvancedAdsAdmin.AdImporter ) window.AdvancedAdsAdmin.AdImporter =
|
|
1161 |
if ( nbUnits > 8 ) jQuery( '#mapi-table-wrap' ).addClass( 'overflow' )
|
1162 |
else jQuery( '#mapi-table-wrap' ).removeClass( 'overflow' )
|
1163 |
|
1164 |
-
// hide inactive ads, but always show the selected one (if any)
|
1165 |
-
if ( hideInactive ) {
|
1166 |
-
btn.removeClass( 'dashicons-hidden' )
|
1167 |
-
btn.addClass( 'dashicons-visibility' )
|
1168 |
-
btn.attr( 'title', advadstxt.show_inactive_ads )
|
1169 |
-
tbody.find( 'tr[data-slotid]' ).each( function ( k, v ) {
|
1170 |
-
v = jQuery( v )
|
1171 |
-
if ( v.data( 'active' ) ) v.show()
|
1172 |
-
else v.hide()
|
1173 |
-
} )
|
1174 |
-
} else {
|
1175 |
-
btn.removeClass( 'dashicons-visibility' )
|
1176 |
-
btn.addClass( 'dashicons-hidden' )
|
1177 |
-
btn.attr( 'title', advadstxt.hide_inactive_ads )
|
1178 |
-
tbody.find( 'tr[data-slotid]' ).show()
|
1179 |
-
}
|
1180 |
-
|
1181 |
const selectedRow = AdvancedAdsAdmin.AdImporter.getSelectedRow()
|
1182 |
tbody.find( 'tr' ).removeClass( 'selected error' );
|
1183 |
if ( selectedRow ) {
|
199 |
} );
|
200 |
} );
|
201 |
|
202 |
+
// sort placement by type order or name
|
203 |
jQuery( '.advads-sort' ).on( 'click', function ( e ) {
|
204 |
var sort = jQuery( this );
|
205 |
var order = sort.data( 'order' );
|
213 |
rows.sort( function ( a, b ) {
|
214 |
var keyA = jQuery( a ).data( order );
|
215 |
var keyB = jQuery( b ).data( order );
|
216 |
+
if ( order === 'ordertype' ) {
|
217 |
+
return keyA - keyB;
|
218 |
+
}
|
219 |
return ( keyA.localeCompare( keyB ) );
|
220 |
} );
|
221 |
jQuery.each( rows, function ( index, row ) {
|
238 |
$( '#advads-output-wrapper-id' ).on( 'keyup', function () {
|
239 |
var id_value = $( this ).val()
|
240 |
if ( /^[a-z-0-9]*$/.test( id_value ) ) {
|
241 |
+
$( '.advads-output-wrapper-id-error' ).addClass( 'hidden' )
|
242 |
} else {
|
243 |
+
$( '.advads-output-wrapper-id-error' ).removeClass( 'hidden' )
|
244 |
}
|
245 |
} )
|
246 |
|
670 |
advads_show_adsense_auto_ads_warning()
|
671 |
}
|
672 |
|
|
|
673 |
advads_ads_txt_find_issues()
|
674 |
|
675 |
jQuery( '.advanced-ads-adsense-dashboard' ).each( function ( key, elm ) {
|
676 |
+
if ( Advanced_Ads_Adsense_Report_Helper ) {
|
677 |
+
Advanced_Ads_Adsense_Report_Helper.init( elm );
|
678 |
+
}
|
679 |
+
} );
|
680 |
} )
|
681 |
|
682 |
/**
|
866 |
}
|
867 |
|
868 |
function fail ( jqXHR ) {
|
869 |
+
$wrapper.html(
|
870 |
+
'<p class="advads-notice-inline advads-error">'
|
871 |
+ jQuery( '#advads-ads-txt-notice-error' ).text().replace( '%s', parseInt( jqXHR.status, 10 ) ),
|
872 |
+'</p>'
|
873 |
)
|
1166 |
if ( nbUnits > 8 ) jQuery( '#mapi-table-wrap' ).addClass( 'overflow' )
|
1167 |
else jQuery( '#mapi-table-wrap' ).removeClass( 'overflow' )
|
1168 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1169 |
const selectedRow = AdvancedAdsAdmin.AdImporter.getSelectedRow()
|
1170 |
tbody.find( 'tr' ).removeClass( 'selected error' );
|
1171 |
if ( selectedRow ) {
|
admin/includes/class-meta-box.php
CHANGED
@@ -244,13 +244,9 @@ class Advanced_Ads_Admin_Meta_Boxes {
|
|
244 |
}
|
245 |
}
|
246 |
}
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
'hide_dimensions' => true,
|
251 |
-
'metabox_selector' => '#advads-gadsense-box',
|
252 |
-
'hidden' => ! $unit_code,
|
253 |
-
);
|
254 |
$advads_gadsense_options['hidden'] = ! $unit_code;
|
255 |
$view = 'gadsense-dashboard.php';
|
256 |
$hndlelinks = '<a href="' . esc_url( admin_url( 'admin.php?page=advanced-ads-settings#top#adsense' ) ) . '" target="_blank">' . __( 'Disable', 'advanced-ads' ) . '</a>';
|
244 |
}
|
245 |
}
|
246 |
}
|
247 |
+
|
248 |
+
$report_type = 'unit';
|
249 |
+
$report_filter = $unit_code;
|
|
|
|
|
|
|
|
|
250 |
$advads_gadsense_options['hidden'] = ! $unit_code;
|
251 |
$view = 'gadsense-dashboard.php';
|
252 |
$hndlelinks = '<a href="' . esc_url( admin_url( 'admin.php?page=advanced-ads-settings#top#adsense' ) ) . '" target="_blank">' . __( 'Disable', 'advanced-ads' ) . '</a>';
|
admin/includes/class-notices.php
CHANGED
@@ -337,7 +337,7 @@ class Advanced_Ads_Admin_Notices {
|
|
337 |
$screen = get_current_screen();
|
338 |
if ( isset( $screen->id ) && $screen->id === 'advanced_ads' ) {
|
339 |
$intro_key = array_search( 'nl_intro', $this->notices, true );
|
340 |
-
if ( $intro_key ) {
|
341 |
unset( $this->notices[ $intro_key ] );
|
342 |
}
|
343 |
}
|
337 |
$screen = get_current_screen();
|
338 |
if ( isset( $screen->id ) && $screen->id === 'advanced_ads' ) {
|
339 |
$intro_key = array_search( 'nl_intro', $this->notices, true );
|
340 |
+
if ( $intro_key !== false ) {
|
341 |
unset( $this->notices[ $intro_key ] );
|
342 |
}
|
343 |
}
|
admin/includes/class-overview-widgets.php
CHANGED
@@ -227,19 +227,15 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
|
|
227 |
* Adsense stats widget
|
228 |
*/
|
229 |
public static function render_adsense_stats() {
|
230 |
-
$
|
231 |
-
$filter_value = get_option( $option_name, null );
|
232 |
if ( ! $filter_value ) {
|
233 |
$filter_value = self::get_site_domain();
|
234 |
}
|
235 |
if ( '*' === $filter_value ) {
|
236 |
-
$filter_value =
|
237 |
}
|
238 |
-
$
|
239 |
-
|
240 |
-
'allow_refresh' => true,
|
241 |
-
'filter_value' => $filter_value,
|
242 |
-
);
|
243 |
include ADVADS_BASE_PATH . 'admin/views/gadsense-dashboard.php';
|
244 |
}
|
245 |
|
@@ -261,7 +257,7 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
|
|
261 |
<script>
|
262 |
window.gadsenseData = window.gadsenseData || {};
|
263 |
gadsenseData['pubId'] = '<?php echo esc_html( $pub_id ); ?>';
|
264 |
-
window.
|
265 |
</script>
|
266 |
<?php
|
267 |
}
|
@@ -290,129 +286,31 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
|
|
290 |
return $domain;
|
291 |
}
|
292 |
|
293 |
-
/**
|
294 |
-
* This method should be used, if you want to render a dashboard summary.
|
295 |
-
* it takes an associative options array as parameter to create a summary object,
|
296 |
-
* which can be used to create a json or html response.
|
297 |
-
*
|
298 |
-
* @param array $options dashboard options.
|
299 |
-
* @return Advanced_Ads_AdSense_Dashboard_Summary
|
300 |
-
*/
|
301 |
-
public static function create_dashboard_summary( $options ) {
|
302 |
-
if ( ! $options ) {
|
303 |
-
$options = array();
|
304 |
-
}
|
305 |
-
$options = array_merge(
|
306 |
-
array(
|
307 |
-
'dimension_name' => null,
|
308 |
-
'filter_value' => null,
|
309 |
-
'hide_dimensions' => false,
|
310 |
-
'force_refresh' => false,
|
311 |
-
'allow_refresh' => true,
|
312 |
-
),
|
313 |
-
$options
|
314 |
-
);
|
315 |
-
|
316 |
-
$dimension_name = $options['dimension_name'];
|
317 |
-
$filter_value = $options['filter_value'];
|
318 |
-
$hide_dimensions = $options['hide_dimensions'];
|
319 |
-
$force_refresh = $options['force_refresh'];
|
320 |
-
$allow_refresh = $options['allow_refresh'];
|
321 |
-
|
322 |
-
$pub_id = Advanced_Ads_AdSense_Data::get_instance()->get_adsense_id();
|
323 |
-
$optional_dimension_names = 'AD_UNIT_CODE' === $dimension_name ? self::get_ad_code_map( $pub_id ) : null;
|
324 |
-
|
325 |
-
$summary = Advanced_Ads_AdSense_Report_Builder::createDashboardSummary( $dimension_name, $filter_value, 'dashboard', $optional_dimension_names, $force_refresh, $allow_refresh );
|
326 |
-
if ( $hide_dimensions ) {
|
327 |
-
$summary->dimensions = null;
|
328 |
-
}
|
329 |
-
$summary->hide_dimensions = $hide_dimensions;
|
330 |
-
return $summary;
|
331 |
-
}
|
332 |
-
/**
|
333 |
-
* We want to display the name of the ad code insted of the code itself.
|
334 |
-
*
|
335 |
-
* @param string $pub_id the publisher id of the adsense account.
|
336 |
-
* @return array an associative array with ad codes as key and their respective name as value
|
337 |
-
*/
|
338 |
-
public static function get_ad_code_map( $pub_id ) {
|
339 |
-
$map = array();
|
340 |
-
$ad_units_opts = get_option( Advanced_Ads_AdSense_MAPI::OPTNAME );
|
341 |
-
if ( ! isset( $ad_units_opts['accounts'] ) ) {
|
342 |
-
return null;
|
343 |
-
}
|
344 |
-
foreach ( $ad_units_opts['accounts'] as $key => $account ) {
|
345 |
-
if ( $key === $pub_id && isset( $account['ad_units'] ) && is_array( $account['ad_units'] ) ) {
|
346 |
-
$units = $account['ad_units'];
|
347 |
-
foreach ( $units as $unit ) {
|
348 |
-
$map[ $unit['code'] ] = $unit['name'];
|
349 |
-
}
|
350 |
-
}
|
351 |
-
}
|
352 |
-
return $map;
|
353 |
-
}
|
354 |
-
|
355 |
-
|
356 |
/**
|
357 |
* This method is called when the dashboard data is requested via ajax
|
358 |
* it prints the relevant data as json, then dies.
|
359 |
*/
|
360 |
public static function ajax_gadsense_dashboard() {
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
// phpcs:ignore
|
365 |
-
$filter_value = isset( $_POST['filter'] ) ? $_POST['filter'] : null;
|
366 |
-
$dimension_name = sanitize_text_field( $dimension_name );
|
367 |
-
if ( $filter_value ) {
|
368 |
-
$filter_value = sanitize_text_field( $filter_value );
|
369 |
}
|
|
|
370 |
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
$errors[] = 'missing capability';
|
375 |
-
}
|
376 |
-
// check nonce.
|
377 |
-
if ( ! check_ajax_referer( 'advads-gadsense-dashboard', 'nonce', false ) ) {
|
378 |
-
$errors[] = 'invalid request';
|
379 |
}
|
380 |
|
381 |
-
|
382 |
-
if ( count( $errors ) > 0 ) {
|
383 |
-
$r = array(
|
384 |
-
'summary' => array(
|
385 |
-
'valid' => false,
|
386 |
-
'errors' => $errors,
|
387 |
-
),
|
388 |
-
);
|
389 |
-
header( 'Content-Type: application/json' );
|
390 |
-
echo wp_json_encode( $r );
|
391 |
-
die();
|
392 |
-
}
|
393 |
|
394 |
-
$
|
395 |
-
|
396 |
-
|
397 |
-
if ( 'DOMAIN_NAME' === $dimension_name ) {
|
398 |
-
if ( $filter_value ) {
|
399 |
-
update_option( 'advanced-ads-adsense-dashboard-filter', $filter_value );
|
400 |
-
}
|
401 |
-
} elseif ( 'AD_UNIT_CODE' === $dimension_name ) {
|
402 |
-
$options['hide_dimensions'] = true;
|
403 |
-
}
|
404 |
-
if ( $filter_value && '*' === $filter_value ) {
|
405 |
-
$filter_value = null;
|
406 |
}
|
407 |
-
$options['filter_value'] = $filter_value;
|
408 |
-
|
409 |
-
$r = array();
|
410 |
-
$summary = self::create_dashboard_summary( $options );
|
411 |
-
$r['summary'] = $summary;
|
412 |
|
413 |
-
|
414 |
-
|
415 |
-
die();
|
416 |
}
|
417 |
|
418 |
/**
|
227 |
* Adsense stats widget
|
228 |
*/
|
229 |
public static function render_adsense_stats() {
|
230 |
+
$filter_value = get_option( 'advanced-ads-adsense-dashboard-filter', '' );
|
|
|
231 |
if ( ! $filter_value ) {
|
232 |
$filter_value = self::get_site_domain();
|
233 |
}
|
234 |
if ( '*' === $filter_value ) {
|
235 |
+
$filter_value = '';
|
236 |
}
|
237 |
+
$report_type = 'domain';
|
238 |
+
$report_filter = $filter_value;
|
|
|
|
|
|
|
239 |
include ADVADS_BASE_PATH . 'admin/views/gadsense-dashboard.php';
|
240 |
}
|
241 |
|
257 |
<script>
|
258 |
window.gadsenseData = window.gadsenseData || {};
|
259 |
gadsenseData['pubId'] = '<?php echo esc_html( $pub_id ); ?>';
|
260 |
+
window.Advanced_Ads_Adsense_Report_Helper.nonce = '<?php echo esc_html( $nonce ); ?>';
|
261 |
</script>
|
262 |
<?php
|
263 |
}
|
286 |
return $domain;
|
287 |
}
|
288 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
289 |
/**
|
290 |
* This method is called when the dashboard data is requested via ajax
|
291 |
* it prints the relevant data as json, then dies.
|
292 |
*/
|
293 |
public static function ajax_gadsense_dashboard() {
|
294 |
+
$post_data = wp_unslash( $_POST );
|
295 |
+
if ( wp_verify_nonce( $post_data['nonce'], 'advads-gadsense-dashboard' ) === false ) {
|
296 |
+
wp_send_json_error( 'Unauthorized request', 401 );
|
|
|
|
|
|
|
|
|
|
|
297 |
}
|
298 |
+
$report = new Advanced_Ads_AdSense_Report( $post_data['type'], $post_data['filter'] );
|
299 |
|
300 |
+
if ( $report->get_data()->is_valid() ) {
|
301 |
+
// There is valid data
|
302 |
+
wp_send_json_success( array( 'html' => $report->get_markup() ) );
|
|
|
|
|
|
|
|
|
|
|
303 |
}
|
304 |
|
305 |
+
$got_fresh_report = $report->get_fresh_report();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
|
307 |
+
if ( $got_fresh_report === true ) {
|
308 |
+
// we got new data from Google;
|
309 |
+
wp_send_json_success( array( 'html' => $report->get_markup() ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
310 |
}
|
|
|
|
|
|
|
|
|
|
|
311 |
|
312 |
+
// Send markup with error info.
|
313 |
+
wp_send_json_success( array( 'html' => '<div class="error"><p>' . $got_fresh_report . '</p></div>' ) );
|
|
|
314 |
}
|
315 |
|
316 |
/**
|
admin/views/ad-info-after-textarea.php
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
|
13 |
if ( defined( 'WP_DEBUG' ) && WP_DEBUG &&
|
14 |
( $error = Advanced_Ads_Admin_Ad_Type::check_ad_dom_is_not_valid( $ad ) ) ) : ?>
|
15 |
-
<p class="advads-error
|
16 |
<?php
|
17 |
esc_html_e( 'The code of this ad might not work properly with the Content placement.', 'advanced-ads' );
|
18 |
?>
|
12 |
|
13 |
if ( defined( 'WP_DEBUG' ) && WP_DEBUG &&
|
14 |
( $error = Advanced_Ads_Admin_Ad_Type::check_ad_dom_is_not_valid( $ad ) ) ) : ?>
|
15 |
+
<p class="advads-notice-inline advads-error">
|
16 |
<?php
|
17 |
esc_html_e( 'The code of this ad might not work properly with the Content placement.', 'advanced-ads' );
|
18 |
?>
|
admin/views/ad-main-metabox.php
CHANGED
@@ -17,16 +17,17 @@
|
|
17 |
<?php
|
18 |
if ( ! empty( $_type->description ) ) :
|
19 |
?>
|
20 |
-
<span class="
|
21 |
<?php
|
22 |
echo esc_html( $_type->description );
|
|
|
|
|
|
|
|
|
23 |
if ( ! empty( $_type->upgrade_url ) ) :
|
24 |
echo ' ';
|
25 |
Advanced_Ads_Admin_Upgrades::upgrade_link( __( 'Manual', 'advanced-ads' ), $_type->upgrade_url, 'upgrade-ad-type-' . $_type->ID );
|
26 |
endif;
|
27 |
-
?>
|
28 |
-
</span>
|
29 |
-
<?php
|
30 |
endif;
|
31 |
?>
|
32 |
</li>
|
@@ -39,7 +40,7 @@
|
|
39 |
<?php
|
40 |
if ( ! empty( $_type->description ) ) :
|
41 |
?>
|
42 |
-
<span class="
|
43 |
</li>
|
44 |
<?php
|
45 |
endif;
|
@@ -59,9 +60,6 @@ function advads_update_ad_type_headline(){
|
|
59 |
var advads_selected_type = jQuery('#advanced-ad-type input:checked + label').text();
|
60 |
var advads_selected_id = jQuery('#advanced-ad-type input:checked').attr('id');
|
61 |
jQuery('#ad-main-box h2').html( advads_main_metabox_title + ': ' + advads_selected_type );
|
62 |
-
// if (advads_selected_id === "advanced-ad-type-adsense") jQuery('#advads-gadsense-box').show();
|
63 |
-
// else jQuery('#advads-gadsense-box').hide();
|
64 |
-
jQuery('#advads-gadsense-box').hide();
|
65 |
}
|
66 |
advads_update_ad_type_headline();
|
67 |
</script>
|
17 |
<?php
|
18 |
if ( ! empty( $_type->description ) ) :
|
19 |
?>
|
20 |
+
<span class="advads-help"><span class="advads-tooltip">
|
21 |
<?php
|
22 |
echo esc_html( $_type->description );
|
23 |
+
?>
|
24 |
+
</span></span>
|
25 |
+
<?php
|
26 |
+
// the URL needs to be placed outside the tooltip
|
27 |
if ( ! empty( $_type->upgrade_url ) ) :
|
28 |
echo ' ';
|
29 |
Advanced_Ads_Admin_Upgrades::upgrade_link( __( 'Manual', 'advanced-ads' ), $_type->upgrade_url, 'upgrade-ad-type-' . $_type->ID );
|
30 |
endif;
|
|
|
|
|
|
|
31 |
endif;
|
32 |
?>
|
33 |
</li>
|
40 |
<?php
|
41 |
if ( ! empty( $_type->description ) ) :
|
42 |
?>
|
43 |
+
<span class="advads-help"><span class="advads-tooltip"><?php echo esc_html( $_type->description ); ?></span></span><?php endif; ?>
|
44 |
</li>
|
45 |
<?php
|
46 |
endif;
|
60 |
var advads_selected_type = jQuery('#advanced-ad-type input:checked + label').text();
|
61 |
var advads_selected_id = jQuery('#advanced-ad-type input:checked').attr('id');
|
62 |
jQuery('#ad-main-box h2').html( advads_main_metabox_title + ': ' + advads_selected_type );
|
|
|
|
|
|
|
63 |
}
|
64 |
advads_update_ad_type_headline();
|
65 |
</script>
|
admin/views/ad-output-metabox.php
CHANGED
@@ -39,20 +39,24 @@
|
|
39 |
<label><?php esc_html_e( 'right:', 'advanced-ads' ); ?> <input type="number" value="<?php echo ( isset( $margin['right'] ) ) ? esc_attr( $margin['right'] ) : ''; ?>" name="advanced_ad[output][margin][right]"/>px</label>
|
40 |
<label><?php esc_html_e( 'bottom:', 'advanced-ads' ); ?> <input type="number" value="<?php echo ( isset( $margin['bottom'] ) ) ? esc_attr( $margin['bottom'] ) : ''; ?>" name="advanced_ad[output][margin][bottom]"/>px</label>
|
41 |
<label><?php esc_html_e( 'left:', 'advanced-ads' ); ?> <input type="number" value="<?php echo ( isset( $margin['left'] ) ) ? esc_attr( $margin['left'] ) : ''; ?>" name="advanced_ad[output][margin][left]"/>px</label>
|
42 |
-
<p class="description"><?php esc_html_e( 'tip: use this to add a margin around the ad', 'advanced-ads' ); ?></p>
|
43 |
</div>
|
44 |
<hr class="advads-hide-in-wizard"/>
|
45 |
<label class='label advads-hide-in-wizard' for="advads-output-wrapper-id"><?php esc_html_e( 'container ID', 'advanced-ads' ); ?></label>
|
46 |
<div class="advads-hide-in-wizard">
|
47 |
<input type="text" id="advads-output-wrapper-id" name="advanced_ad[output][wrapper-id]" value="<?php echo esc_attr( $wrapper_id ); ?>"/>
|
48 |
-
<
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
50 |
</div>
|
51 |
<hr class="advads-hide-in-wizard"/>
|
52 |
<label class='label advads-hide-in-wizard' for="advads-output-wrapper-class"><?php esc_html_e( 'container classes', 'advanced-ads' ); ?></label>
|
53 |
<div class="advads-hide-in-wizard">
|
54 |
<input type="text" id="advads-output-wrapper-class" name="advanced_ad[output][wrapper-class]" value="<?php echo esc_attr( $wrapper_class ); ?>"/>
|
55 |
-
|
56 |
</div>
|
57 |
<hr class="advads-hide-in-wizard"/>
|
58 |
<label for="advads-output-debugmode" class="label advads-hide-in-wizard"><?php esc_html_e( 'Enable debug mode', 'advanced-ads' ); ?></label>
|
39 |
<label><?php esc_html_e( 'right:', 'advanced-ads' ); ?> <input type="number" value="<?php echo ( isset( $margin['right'] ) ) ? esc_attr( $margin['right'] ) : ''; ?>" name="advanced_ad[output][margin][right]"/>px</label>
|
40 |
<label><?php esc_html_e( 'bottom:', 'advanced-ads' ); ?> <input type="number" value="<?php echo ( isset( $margin['bottom'] ) ) ? esc_attr( $margin['bottom'] ) : ''; ?>" name="advanced_ad[output][margin][bottom]"/>px</label>
|
41 |
<label><?php esc_html_e( 'left:', 'advanced-ads' ); ?> <input type="number" value="<?php echo ( isset( $margin['left'] ) ) ? esc_attr( $margin['left'] ) : ''; ?>" name="advanced_ad[output][margin][left]"/>px</label>
|
|
|
42 |
</div>
|
43 |
<hr class="advads-hide-in-wizard"/>
|
44 |
<label class='label advads-hide-in-wizard' for="advads-output-wrapper-id"><?php esc_html_e( 'container ID', 'advanced-ads' ); ?></label>
|
45 |
<div class="advads-hide-in-wizard">
|
46 |
<input type="text" id="advads-output-wrapper-id" name="advanced_ad[output][wrapper-id]" value="<?php echo esc_attr( $wrapper_id ); ?>"/>
|
47 |
+
<span class="advads-help">
|
48 |
+
<span class="advads-tooltip">
|
49 |
+
<?php esc_html_e( 'Specify the id of the ad container. Leave blank for random or no id.', 'advanced-ads' ); ?>
|
50 |
+
<?php esc_html_e( 'An id-like string with only letters in lower case, numbers, and hyphens.', 'advanced-ads' ); ?>
|
51 |
+
</span>
|
52 |
+
</span>
|
53 |
+
<p class="advads-notice-inline advads-error advads-output-wrapper-id-error hidden"><?php esc_attr_e( 'An id-like string with only letters in lower case, numbers, and hyphens.', 'advanced-ads' ); ?></p>
|
54 |
</div>
|
55 |
<hr class="advads-hide-in-wizard"/>
|
56 |
<label class='label advads-hide-in-wizard' for="advads-output-wrapper-class"><?php esc_html_e( 'container classes', 'advanced-ads' ); ?></label>
|
57 |
<div class="advads-hide-in-wizard">
|
58 |
<input type="text" id="advads-output-wrapper-class" name="advanced_ad[output][wrapper-class]" value="<?php echo esc_attr( $wrapper_class ); ?>"/>
|
59 |
+
<span class="advads-help"><span class="advads-tooltip"><?php esc_html_e( 'Specify one or more classes for the container. Separate multiple classes with a space', 'advanced-ads' ); ?>.</span></span>
|
60 |
</div>
|
61 |
<hr class="advads-hide-in-wizard"/>
|
62 |
<label for="advads-output-debugmode" class="label advads-hide-in-wizard"><?php esc_html_e( 'Enable debug mode', 'advanced-ads' ); ?></label>
|
admin/views/conditions/condition-author.php
CHANGED
@@ -33,7 +33,7 @@
|
|
33 |
<?php
|
34 |
if ( count( $authors ) >= $max_authors ) :
|
35 |
?>
|
36 |
-
<p class="advads-error
|
37 |
<?php
|
38 |
printf(
|
39 |
wp_kses(
|
33 |
<?php
|
34 |
if ( count( $authors ) >= $max_authors ) :
|
35 |
?>
|
36 |
+
<p class="advads-notice-inline advads-error">
|
37 |
<?php
|
38 |
printf(
|
39 |
wp_kses(
|
admin/views/conditions/display-conditions-list.php
CHANGED
@@ -47,7 +47,7 @@
|
|
47 |
echo Advanced_Ads_Display_Conditions::render_connector_option( $i, $connector, $form_name );
|
48 |
if ( $show_or_force_warning || $show_is_not_or_warning ) {
|
49 |
?>
|
50 |
-
<p class="advads-error
|
51 |
<?php
|
52 |
if ( $show_or_force_warning ) {
|
53 |
esc_attr_e( 'Forced to OR.', 'advanced-ads' );
|
47 |
echo Advanced_Ads_Display_Conditions::render_connector_option( $i, $connector, $form_name );
|
48 |
if ( $show_or_force_warning || $show_is_not_or_warning ) {
|
49 |
?>
|
50 |
+
<p class="advads-notice-inline advads-error" style="display: block;">
|
51 |
<?php
|
52 |
if ( $show_or_force_warning ) {
|
53 |
esc_attr_e( 'Forced to OR.', 'advanced-ads' );
|
admin/views/conditions/no-option.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* @var WP_Taxonomy $taxonomy
|
4 |
*/
|
5 |
?>
|
6 |
-
<p class="advads-conditions-not-selected advads-
|
7 |
<?php
|
8 |
printf(
|
9 |
// translators: %s is a name of a taxonomy.
|
3 |
* @var WP_Taxonomy $taxonomy
|
4 |
*/
|
5 |
?>
|
6 |
+
<p class="advads-conditions-not-selected advads-notice-inline advads-idea">
|
7 |
<?php
|
8 |
printf(
|
9 |
// translators: %s is a name of a taxonomy.
|
admin/views/conditions/not-selected.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
<p class="advads-conditions-not-selected advads-error
|
2 |
<?php echo esc_html_x( 'Please select some items.', 'Error message shown when no display condition term is selected', 'advanced-ads' ); ?>
|
3 |
</p>
|
1 |
+
<p class="advads-conditions-not-selected advads-notice-inline advads-error">
|
2 |
<?php echo esc_html_x( 'Please select some items.', 'Error message shown when no display condition term is selected', 'advanced-ads' ); ?>
|
3 |
</p>
|
admin/views/conditions/visitor-conditions-form-top.php
CHANGED
@@ -6,7 +6,7 @@ if ( $empty_options ) :
|
|
6 |
elseif ( Advanced_Ads_Checks::cache() && ! defined( 'AAP_VERSION' ) ) :
|
7 |
?>
|
8 |
<p>
|
9 |
-
<span class="advads-
|
10 |
<?php
|
11 |
printf(
|
12 |
wp_kses(
|
6 |
elseif ( Advanced_Ads_Checks::cache() && ! defined( 'AAP_VERSION' ) ) :
|
7 |
?>
|
8 |
<p>
|
9 |
+
<span class="advads-notice-inline advads-idea"><?php esc_html_e( 'It seems that a caching plugin is activated.', 'advanced-ads' ); ?></span>
|
10 |
<?php
|
11 |
printf(
|
12 |
wp_kses(
|
admin/views/gadsense-dashboard.php
CHANGED
@@ -1,36 +1,18 @@
|
|
1 |
<?php
|
|
|
2 |
$pub_id = Advanced_Ads_AdSense_Data::get_instance()->get_adsense_id();
|
3 |
if ( $pub_id ) {
|
4 |
-
if ( ! $advads_gadsense_options ) {
|
5 |
-
$advads_gadsense_options = array();
|
6 |
-
}
|
7 |
-
$advads_gadsense_options = array_merge(
|
8 |
-
array(
|
9 |
-
'dimension_name' => null,
|
10 |
-
'filter_value' => null,
|
11 |
-
'hide_dimensions' => false,
|
12 |
-
'metabox_selector' => null,
|
13 |
-
'hidden' => null,
|
14 |
-
),
|
15 |
-
$advads_gadsense_options
|
16 |
-
);
|
17 |
-
$div_tag_extras = '';
|
18 |
-
if ( $advads_gadsense_options['metabox_selector'] ) {
|
19 |
-
$div_tag_extras .= 'data-metabox_selector="' . $advads_gadsense_options['metabox_selector'] . '""';
|
20 |
-
}
|
21 |
-
|
22 |
-
$summary = Advanced_Ads_Overview_Widgets_Callbacks::create_dashboard_summary( $advads_gadsense_options );
|
23 |
Advanced_Ads_Overview_Widgets_Callbacks::adsense_stats_js( $pub_id );
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
?>
|
31 |
-
<div class="advanced-ads-adsense-dashboard" data-refresh='<?php echo json_encode($summary)?>' <?php echo $div_tag_extras?>></div><?php
|
32 |
-
}
|
33 |
-
else {
|
34 |
echo esc_html__( 'There is an error in your AdSense setup.', 'advanced-ads' );
|
35 |
}
|
36 |
?>
|
1 |
<?php
|
2 |
+
|
3 |
$pub_id = Advanced_Ads_AdSense_Data::get_instance()->get_adsense_id();
|
4 |
if ( $pub_id ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
Advanced_Ads_Overview_Widgets_Callbacks::adsense_stats_js( $pub_id );
|
6 |
+
$arguments = array(
|
7 |
+
'type' => $report_type,
|
8 |
+
'filter' => $report_filter,
|
9 |
+
);
|
10 |
+
$report = new Advanced_Ads_AdSense_Report( $report_type, $report_filter );
|
11 |
|
12 |
+
echo '<div class="advanced-ads-adsense-dashboard" data-arguments="' . esc_js( wp_json_encode( $arguments ) ) . '">';
|
13 |
+
echo wp_kses_post( $report->get_markup() );
|
14 |
+
echo '</div>';
|
15 |
+
} else {
|
|
|
|
|
|
|
|
|
|
|
16 |
echo esc_html__( 'There is an error in your AdSense setup.', 'advanced-ads' );
|
17 |
}
|
18 |
?>
|
admin/views/notices/error.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<div class="notice notice-error advads-admin-notice is-dismissible" data-notice="<?php echo $_notice; ?>"><p><?php echo $text; ?></p></div>
|
1 |
+
<div class="notice notice-error advads-notice advads-admin-notice is-dismissible" data-notice="<?php echo $_notice; ?>"><p><?php echo $text; ?></p></div>
|
admin/views/notices/info.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<div class="notice notice-info advads-admin-notice message is-dismissible" data-notice="<?php echo $_notice; ?>">
|
2 |
<p><?php echo $text; ?></p>
|
3 |
<a href="
|
4 |
<?php
|
1 |
+
<div class="notice notice-info advads-notice advads-admin-notice message is-dismissible" data-notice="<?php echo esc_attr( $_notice ); ?>">
|
2 |
<p><?php echo $text; ?></p>
|
3 |
<a href="
|
4 |
<?php
|
admin/views/notices/inline.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<div class="notice notice-info advads-
|
2 |
<p><?php echo $text; ?>
|
3 |
<button type="button" class="button-primary advads-notices-button-subscribe"><?php echo isset( $notice['confirm_text'] ) ? $notice['confirm_text'] : __( 'Subscribe me now', 'advanced-ads' ); ?></button>
|
4 |
</p>
|
1 |
+
<div class="notice notice-info advads-notice is-dismissible" data-notice="<?php echo esc_attr( $_notice ); ?>">
|
2 |
<p><?php echo $text; ?>
|
3 |
<button type="button" class="button-primary advads-notices-button-subscribe"><?php echo isset( $notice['confirm_text'] ) ? $notice['confirm_text'] : __( 'Subscribe me now', 'advanced-ads' ); ?></button>
|
4 |
</p>
|
admin/views/overview-notice-row.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* @var string $date date string
|
10 |
*/
|
11 |
?>
|
12 |
-
<li data-notice="<?php echo esc_attr( $_notice_key ); ?>" <?php echo $is_hidden ? 'style="display: none;"' : ''; ?>>
|
13 |
<span>
|
14 |
<?php
|
15 |
// phpcs:ignore
|
9 |
* @var string $date date string
|
10 |
*/
|
11 |
?>
|
12 |
+
<li class="advads-notice-inline" data-notice="<?php echo esc_attr( $_notice_key ); ?>" <?php echo $is_hidden ? 'style="display: none;"' : ''; ?>>
|
13 |
<span>
|
14 |
<?php
|
15 |
// phpcs:ignore
|
admin/views/placement-form.php
CHANGED
@@ -66,13 +66,13 @@
|
|
66 |
<?php
|
67 |
endif;
|
68 |
?>
|
69 |
-
<p class="advads-
|
70 |
<br/>
|
71 |
<h3>2. <?php esc_html_e( 'Choose a Name', 'advanced-ads' ); ?></h3>
|
72 |
<p class="description"><?php esc_html_e( 'The name of the placement is only visible to you. Tip: choose a descriptive one, e.g. <em>Below Post Headline</em>.', 'advanced-ads' ); ?></p>
|
73 |
<p><input name="advads[placement][name]" class="advads-new-placement-name" type="text" value=""
|
74 |
placeholder="<?php esc_html_e( 'Placement Name', 'advanced-ads' ); ?>"/></p>
|
75 |
-
<p class="advads-
|
76 |
<h3>3. <?php esc_html_e( 'Choose the Ad or Group', 'advanced-ads' ); ?></h3>
|
77 |
<p class="description"><?php esc_html_e( 'The ad or group that should be displayed.', 'advanced-ads' ); ?></p>
|
78 |
<p><select name="advads[placement][item]">
|
66 |
<?php
|
67 |
endif;
|
68 |
?>
|
69 |
+
<p class="advads-notice-inline advads-error advads-placement-type-error"><?php esc_html_e( 'Please select a placement type.', 'advanced-ads' ); ?></p>
|
70 |
<br/>
|
71 |
<h3>2. <?php esc_html_e( 'Choose a Name', 'advanced-ads' ); ?></h3>
|
72 |
<p class="description"><?php esc_html_e( 'The name of the placement is only visible to you. Tip: choose a descriptive one, e.g. <em>Below Post Headline</em>.', 'advanced-ads' ); ?></p>
|
73 |
<p><input name="advads[placement][name]" class="advads-new-placement-name" type="text" value=""
|
74 |
placeholder="<?php esc_html_e( 'Placement Name', 'advanced-ads' ); ?>"/></p>
|
75 |
+
<p class="advads-notice-inline advads-error advads-placement-name-error"><?php esc_html_e( 'Please enter a name for your placement.', 'advanced-ads' ); ?></p>
|
76 |
<h3>3. <?php esc_html_e( 'Choose the Ad or Group', 'advanced-ads' ); ?></h3>
|
77 |
<p class="description"><?php esc_html_e( 'The ad or group that should be displayed.', 'advanced-ads' ); ?></p>
|
78 |
<p><select name="advads[placement][item]">
|
admin/views/placements.php
CHANGED
@@ -100,8 +100,8 @@ $quick_actions['delete'] = '<a style="cursor: pointer;" class="advads-delete-tag
|
|
100 |
if ( $column['key'] === 'type_name' ) :
|
101 |
list ( $order_type, $name ) = explode( '/', $column_display_name );
|
102 |
|
103 |
-
printf( '<th class="column-primary"><a href="#" class="advads-sort ' . ( $orderby === '
|
104 |
-
data-order="
|
105 |
data-order="name" data-dir="asc" style="margin-left:9px;">%3$s %2$s<a/></th>', esc_html( $order_type ), '<span class="advads-placement-sorting-indicator"></span>', esc_html( $name ) );
|
106 |
else :
|
107 |
echo '<th>' . esc_html( $column_display_name ) . '</th>';
|
@@ -122,11 +122,12 @@ $quick_actions['delete'] = '<a style="cursor: pointer;" class="advads-delete-tag
|
|
122 |
<tbody>
|
123 |
<?php
|
124 |
// Sort placements.
|
125 |
-
$placements
|
126 |
$display_conditions = Advanced_Ads_Display_Conditions::get_instance();
|
127 |
$visitor_conditions = Advanced_Ads_Visitor_Conditions::get_instance();
|
128 |
|
129 |
foreach ( $placements as $_placement_slug => $_placement ) :
|
|
|
130 |
$type_missing = false;
|
131 |
if ( isset( $_placement['type'] ) && ! isset( $placement_types[ $_placement['type'] ] ) ) {
|
132 |
$missed_type = $_placement['type'];
|
@@ -134,7 +135,7 @@ $quick_actions['delete'] = '<a style="cursor: pointer;" class="advads-delete-tag
|
|
134 |
$type_missing = true;
|
135 |
}
|
136 |
if ( ! isset( $_placement['type'] ) || $_placement['type'] === 'default' ) {
|
137 |
-
$_placement['type']
|
138 |
$quick_actions['usage'] = '<a href="#modal-' . esc_attr( $_placement_slug ) . '-usage" class="usage-modal-link">' . esc_html__( 'show usage', 'advanced-ads' ) . '</a>';
|
139 |
}
|
140 |
|
@@ -218,8 +219,8 @@ $quick_actions['delete'] = '<a style="cursor: pointer;" class="advads-delete-tag
|
|
218 |
|
219 |
<tr id="single-placement-<?php echo esc_attr( $_placement_slug ); ?>"
|
220 |
class="advanced-ads-placement-row"
|
|
|
221 |
data-type="<?php echo esc_attr( $_placement['type'] ); ?>"
|
222 |
-
data-typename="<?php echo esc_html( $placement_types[ $_placement['type'] ]['title'] ); ?>"
|
223 |
data-name="<?php echo esc_html( $_placement['name'] ); ?>">
|
224 |
<td class="column-primary">
|
225 |
<?php if ( $advanced_options ) : ?>
|
@@ -233,7 +234,7 @@ $quick_actions['delete'] = '<a style="cursor: pointer;" class="advads-delete-tag
|
|
233 |
|
234 |
<?php endif; ?>
|
235 |
<?php if ( $type_missing ) : // Type is not given. ?>
|
236 |
-
<p class="advads-error
|
237 |
<?php
|
238 |
printf(
|
239 |
wp_kses(
|
@@ -380,7 +381,7 @@ $quick_actions['delete'] = '<a style="cursor: pointer;" class="advads-delete-tag
|
|
380 |
|
381 |
if ( ! extension_loaded( 'dom' ) ) :
|
382 |
?>
|
383 |
-
<p><span class="advads-error
|
384 |
<?php
|
385 |
printf(
|
386 |
// Translators: %s is a name of a module.
|
100 |
if ( $column['key'] === 'type_name' ) :
|
101 |
list ( $order_type, $name ) = explode( '/', $column_display_name );
|
102 |
|
103 |
+
printf( '<th class="column-primary"><a href="#" class="advads-sort ' . ( $orderby === 'ordertype' ? 'advads-placement-sorted' : '' ) . '"
|
104 |
+
data-order="ordertype" data-dir="asc">%1$s %2$s</a> / <a href="#" class="advads-sort ' . ( $orderby === 'name' ? 'advads-placement-sorted' : '' ) . '"
|
105 |
data-order="name" data-dir="asc" style="margin-left:9px;">%3$s %2$s<a/></th>', esc_html( $order_type ), '<span class="advads-placement-sorting-indicator"></span>', esc_html( $name ) );
|
106 |
else :
|
107 |
echo '<th>' . esc_html( $column_display_name ) . '</th>';
|
122 |
<tbody>
|
123 |
<?php
|
124 |
// Sort placements.
|
125 |
+
$placements = Advanced_Ads_Placements::sort( $placements, $orderby );
|
126 |
$display_conditions = Advanced_Ads_Display_Conditions::get_instance();
|
127 |
$visitor_conditions = Advanced_Ads_Visitor_Conditions::get_instance();
|
128 |
|
129 |
foreach ( $placements as $_placement_slug => $_placement ) :
|
130 |
+
unset( $quick_actions['usage'] );
|
131 |
$type_missing = false;
|
132 |
if ( isset( $_placement['type'] ) && ! isset( $placement_types[ $_placement['type'] ] ) ) {
|
133 |
$missed_type = $_placement['type'];
|
135 |
$type_missing = true;
|
136 |
}
|
137 |
if ( ! isset( $_placement['type'] ) || $_placement['type'] === 'default' ) {
|
138 |
+
$_placement['type'] = 'default';
|
139 |
$quick_actions['usage'] = '<a href="#modal-' . esc_attr( $_placement_slug ) . '-usage" class="usage-modal-link">' . esc_html__( 'show usage', 'advanced-ads' ) . '</a>';
|
140 |
}
|
141 |
|
219 |
|
220 |
<tr id="single-placement-<?php echo esc_attr( $_placement_slug ); ?>"
|
221 |
class="advanced-ads-placement-row"
|
222 |
+
data-ordertype="<?php echo esc_attr( isset( $placement_types[ $_placement['type'] ]['order'] ) ? $placement_types[ $_placement['type'] ]['order'] : 100 ); ?>"
|
223 |
data-type="<?php echo esc_attr( $_placement['type'] ); ?>"
|
|
|
224 |
data-name="<?php echo esc_html( $_placement['name'] ); ?>">
|
225 |
<td class="column-primary">
|
226 |
<?php if ( $advanced_options ) : ?>
|
234 |
|
235 |
<?php endif; ?>
|
236 |
<?php if ( $type_missing ) : // Type is not given. ?>
|
237 |
+
<p class="advads-notice-inline advads-error">
|
238 |
<?php
|
239 |
printf(
|
240 |
wp_kses(
|
381 |
|
382 |
if ( ! extension_loaded( 'dom' ) ) :
|
383 |
?>
|
384 |
+
<p><span class="advads-notice-inline advads-error"><?php esc_html_e( 'Important Notice', 'advanced-ads' ); ?>: </span>
|
385 |
<?php
|
386 |
printf(
|
387 |
// Translators: %s is a name of a module.
|
admin/views/setting-license.php
CHANGED
@@ -95,7 +95,7 @@ if ( '' === trim( $license_key ) ) {
|
|
95 |
echo $errortext;
|
96 |
?>
|
97 |
</span>
|
98 |
-
<span class="advads-license-expired-error advads-error
|
99 |
<?php
|
100 |
// phpcs:ignore
|
101 |
echo $expired_error;
|
95 |
echo $errortext;
|
96 |
?>
|
97 |
</span>
|
98 |
+
<span class="advads-license-expired-error advads-notice-inline advads-error" style="display: none;">
|
99 |
<?php
|
100 |
// phpcs:ignore
|
101 |
echo $expired_error;
|
admin/views/settings/general/block-bots.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<?php
|
3 |
if ( Advanced_Ads::get_instance()->is_bot() ) :
|
4 |
?>
|
5 |
-
<span class="advads-error
|
6 |
<?php
|
7 |
endif;
|
8 |
?>
|
2 |
<?php
|
3 |
if ( Advanced_Ads::get_instance()->is_bot() ) :
|
4 |
?>
|
5 |
+
<span class="advads-notice-inline advads-error"><?php esc_html_e( 'You look like a bot', 'advanced-ads' ); ?></span>
|
6 |
<?php
|
7 |
endif;
|
8 |
?>
|
admin/views/settings/general/content-injection-priority.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
<?php
|
4 |
if ( $priority < 11 ) :
|
5 |
?>
|
6 |
-
<span class="advads-error
|
7 |
<?php
|
8 |
endif;
|
9 |
esc_html_e( 'Play with this value in order to change the priority of the injected ads compared to other auto injected elements in the post content.', 'advanced-ads' );
|
3 |
<?php
|
4 |
if ( $priority < 11 ) :
|
5 |
?>
|
6 |
+
<span class="advads-notice-inline advads-error"><?php esc_html_e( 'Please check your post content. A priority of 10 and below might cause issues (wpautop function might run twice).', 'advanced-ads' ); ?></span><br />
|
7 |
<?php
|
8 |
endif;
|
9 |
esc_html_e( 'Play with this value in order to change the priority of the injected ads compared to other auto injected elements in the post content.', 'advanced-ads' );
|
admin/views/settings/general/disable-ads.php
CHANGED
@@ -3,8 +3,8 @@
|
|
3 |
checked( $disable_all, 1 );
|
4 |
?>
|
5 |
><?php esc_html_e( 'Disable all ads in frontend', 'advanced-ads' ); ?></label>
|
6 |
-
<
|
7 |
-
|
8 |
<label><input id="advanced-ads-disable-ads-404" type="checkbox" value="1" name="<?php echo esc_attr( ADVADS_SLUG ); ?>[disabled-ads][404]"
|
9 |
<?php
|
10 |
checked( $disable_404, 1 );
|
@@ -16,14 +16,15 @@
|
|
16 |
checked( $disable_archives, 1 );
|
17 |
?>
|
18 |
><?php esc_html_e( 'Disable ads on non-singular pages', 'advanced-ads' ); ?></label>
|
19 |
-
<
|
|
|
20 |
<label><input id="advanced-ads-disable-ads-secondary" type="checkbox" value="1" name="<?php echo esc_attr( ADVADS_SLUG ); ?>[disabled-ads][secondary]"
|
21 |
<?php
|
22 |
checked( $disable_secondary, 1 );
|
23 |
?>
|
24 |
><?php esc_html_e( 'Disable ads on secondary queries', 'advanced-ads' ); ?></label>
|
25 |
-
<
|
26 |
-
|
27 |
<label><input id="advanced-ads-disable-ads-feed" type="checkbox" value="1" name="<?php echo esc_attr( ADVADS_SLUG ); ?>[disabled-ads][feed]"
|
28 |
<?php
|
29 |
checked( $disable_feed, 1 );
|
3 |
checked( $disable_all, 1 );
|
4 |
?>
|
5 |
><?php esc_html_e( 'Disable all ads in frontend', 'advanced-ads' ); ?></label>
|
6 |
+
<span class="advads-help"><span class="advads-tooltip"><?php esc_html_e( 'Use this option to disable all ads in the frontend, but still be able to use the plugin.', 'advanced-ads' ); ?></span></span>
|
7 |
+
<br/>
|
8 |
<label><input id="advanced-ads-disable-ads-404" type="checkbox" value="1" name="<?php echo esc_attr( ADVADS_SLUG ); ?>[disabled-ads][404]"
|
9 |
<?php
|
10 |
checked( $disable_404, 1 );
|
16 |
checked( $disable_archives, 1 );
|
17 |
?>
|
18 |
><?php esc_html_e( 'Disable ads on non-singular pages', 'advanced-ads' ); ?></label>
|
19 |
+
<span class="advads-help"><span class="advads-tooltip"><?php esc_html_e( 'e.g. archive pages like categories, tags, authors, front page (if a list)', 'advanced-ads' ); ?></span></span>
|
20 |
+
<br/>
|
21 |
<label><input id="advanced-ads-disable-ads-secondary" type="checkbox" value="1" name="<?php echo esc_attr( ADVADS_SLUG ); ?>[disabled-ads][secondary]"
|
22 |
<?php
|
23 |
checked( $disable_secondary, 1 );
|
24 |
?>
|
25 |
><?php esc_html_e( 'Disable ads on secondary queries', 'advanced-ads' ); ?></label>
|
26 |
+
<span class="advads-help"><span class="advads-tooltip"><?php esc_html_e( 'Secondary queries are custom queries of posts outside the main query of a page. Try this option if you see ads injected on places where they shouldn’t appear.', 'advanced-ads' ); ?></span></span>
|
27 |
+
<br/>
|
28 |
<label><input id="advanced-ads-disable-ads-feed" type="checkbox" value="1" name="<?php echo esc_attr( ADVADS_SLUG ); ?>[disabled-ads][feed]"
|
29 |
<?php
|
30 |
checked( $disable_feed, 1 );
|
admin/views/support-callout.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<div id="advads-support-callout">
|
2 |
-
<p>
|
3 |
<a href="<?php echo esc_url( Advanced_Ads_Plugin::support_url( '#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-notices-support' ) ); ?>" target="_blank"><strong><?php esc_html_e( 'Problems or questions?', 'advanced-ads' ); ?></strong>
|
4 |
<?php esc_html_e( 'Save time and get personal support.', 'advanced-ads' ); ?> <strong style="text-decoration: underline;"><?php esc_html_e( 'Ask your question!', 'advanced-ads' ); ?></strong>
|
5 |
</a>
|
1 |
<div id="advads-support-callout">
|
2 |
+
<p class="advads-notice-inline advads-idea">
|
3 |
<a href="<?php echo esc_url( Advanced_Ads_Plugin::support_url( '#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-notices-support' ) ); ?>" target="_blank"><strong><?php esc_html_e( 'Problems or questions?', 'advanced-ads' ); ?></strong>
|
4 |
<?php esc_html_e( 'Save time and get personal support.', 'advanced-ads' ); ?> <strong style="text-decoration: underline;"><?php esc_html_e( 'Ask your question!', 'advanced-ads' ); ?></strong>
|
5 |
</a>
|
advanced-ads.php
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
* Plugin Name: Advanced Ads
|
13 |
* Plugin URI: https://wpadvancedads.com
|
14 |
* Description: Manage and optimize your ads in WordPress
|
15 |
-
* Version: 1.
|
16 |
* Author: Thomas Maier, Advanced Ads GmbH
|
17 |
* Author URI: https://wpadvancedads.com
|
18 |
* Text Domain: advanced-ads
|
@@ -39,7 +39,7 @@ define( 'ADVADS_BASE_DIR', dirname( ADVADS_BASE ) ); // directory of the plugin
|
|
39 |
// general and global slug, e.g. to store options in WP.
|
40 |
define( 'ADVADS_SLUG', 'advanced-ads' );
|
41 |
define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
|
42 |
-
define( 'ADVADS_VERSION', '1.
|
43 |
|
44 |
// Autoloading, modules and functions.
|
45 |
|
12 |
* Plugin Name: Advanced Ads
|
13 |
* Plugin URI: https://wpadvancedads.com
|
14 |
* Description: Manage and optimize your ads in WordPress
|
15 |
+
* Version: 1.29.0
|
16 |
* Author: Thomas Maier, Advanced Ads GmbH
|
17 |
* Author URI: https://wpadvancedads.com
|
18 |
* Text Domain: advanced-ads
|
39 |
// general and global slug, e.g. to store options in WP.
|
40 |
define( 'ADVADS_SLUG', 'advanced-ads' );
|
41 |
define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
|
42 |
+
define( 'ADVADS_VERSION', '1.29.0' );
|
43 |
|
44 |
// Autoloading, modules and functions.
|
45 |
|
classes/ad_type_plain.php
CHANGED
@@ -93,6 +93,8 @@ class Advanced_Ads_Ad_Type_Plain extends Advanced_Ads_Ad_Type_Abstract {
|
|
93 |
<input id="advads-parameters-php" type="checkbox" name="advanced_ad[output][allow_php]"
|
94 |
value="1" <?php checked( 1, $allow_php ); ?>
|
95 |
onChange="Advanced_Ads_Admin.check_ad_source();"/>
|
|
|
|
|
96 |
<?php
|
97 |
echo wp_kses(
|
98 |
__( 'Execute PHP code (wrapped in <code><?php ?></code>)', 'advanced-ads' ),
|
@@ -101,8 +103,10 @@ class Advanced_Ads_Ad_Type_Plain extends Advanced_Ads_Ad_Type_Abstract {
|
|
101 |
)
|
102 |
);
|
103 |
?>
|
104 |
-
|
105 |
-
|
|
|
|
|
106 |
</div>
|
107 |
<hr/>
|
108 |
<?php
|
@@ -118,7 +122,7 @@ class Advanced_Ads_Ad_Type_Plain extends Advanced_Ads_Ad_Type_Abstract {
|
|
118 |
$allow_shortcodes = ! empty( $ad->output['allow_shortcodes'] );
|
119 |
?>
|
120 |
<label class="label"
|
121 |
-
for="advads-parameters-shortcodes"><?php esc_html_e( '
|
122 |
<div>
|
123 |
<input id="advads-parameters-shortcodes" type="checkbox" name="advanced_ad[output][allow_shortcodes]"
|
124 |
value="1"
|
@@ -126,11 +130,8 @@ class Advanced_Ads_Ad_Type_Plain extends Advanced_Ads_Ad_Type_Abstract {
|
|
126 |
checked( 1, $allow_shortcodes );
|
127 |
?>
|
128 |
onChange="Advanced_Ads_Admin.check_ad_source();"/>
|
129 |
-
|
130 |
-
esc_html_e( '
|
131 |
-
?>
|
132 |
-
<div class="advads-error-message" id="advads-parameters-shortcodes-warning"
|
133 |
-
style="display:none;"><?php esc_html_e( 'No shortcode detected in your code.', 'advanced-ads' ); ?><?php esc_html_e( 'Uncheck this checkbox for improved performance.', 'advanced-ads' ); ?></div>
|
134 |
</div>
|
135 |
<hr/>
|
136 |
<?php
|
93 |
<input id="advads-parameters-php" type="checkbox" name="advanced_ad[output][allow_php]"
|
94 |
value="1" <?php checked( 1, $allow_php ); ?>
|
95 |
onChange="Advanced_Ads_Admin.check_ad_source();"/>
|
96 |
+
<span class="advads-help">
|
97 |
+
<span class="advads-tooltip">
|
98 |
<?php
|
99 |
echo wp_kses(
|
100 |
__( 'Execute PHP code (wrapped in <code><?php ?></code>)', 'advanced-ads' ),
|
103 |
)
|
104 |
);
|
105 |
?>
|
106 |
+
</span>
|
107 |
+
</span>
|
108 |
+
<p class="advads-notice-inline advads-error" id="advads-parameters-php-warning"
|
109 |
+
style="display:none;"><?php esc_html_e( 'No PHP tag detected in your code.', 'advanced-ads' ); ?> <?php esc_html_e( 'Uncheck this checkbox for improved performance.', 'advanced-ads' ); ?></p>
|
110 |
</div>
|
111 |
<hr/>
|
112 |
<?php
|
122 |
$allow_shortcodes = ! empty( $ad->output['allow_shortcodes'] );
|
123 |
?>
|
124 |
<label class="label"
|
125 |
+
for="advads-parameters-shortcodes"><?php esc_html_e( 'Execute shortcodes', 'advanced-ads' ); ?></label>
|
126 |
<div>
|
127 |
<input id="advads-parameters-shortcodes" type="checkbox" name="advanced_ad[output][allow_shortcodes]"
|
128 |
value="1"
|
130 |
checked( 1, $allow_shortcodes );
|
131 |
?>
|
132 |
onChange="Advanced_Ads_Admin.check_ad_source();"/>
|
133 |
+
<p class="advads-notice-inline advads-error" id="advads-parameters-shortcodes-warning"
|
134 |
+
style="display:none;"><?php esc_html_e( 'No shortcode detected in your code.', 'advanced-ads' ); ?> <?php esc_html_e( 'Uncheck this checkbox for improved performance.', 'advanced-ads' ); ?></p>
|
|
|
|
|
|
|
135 |
</div>
|
136 |
<hr/>
|
137 |
<?php
|
classes/frontend_checks.php
CHANGED
@@ -564,7 +564,7 @@ class Advanced_Ads_Frontend_Checks {
|
|
564 |
#wp-admin-bar-advanced_ads_ad_health-default .advanced_ads_ad_health_highlight_ads div:hover { color: #00b9eb; cursor: pointer; }
|
565 |
#wpadminbar .advanced-ads-issue-counter { background-color: #d54e21; display: none; padding: 1px 7px 1px 6px!important; border-radius: 50%; color: #fff; }
|
566 |
#wpadminbar .advads-adminbar-is-warnings .advanced-ads-issue-counter { display: inline; }
|
567 |
-
.advanced-ads-highlight-ads { outline:4px solid
|
568 |
|
569 |
.advads-frontend-notice { display: none; position: fixed; top: 0; z-index: 1000; left: 50%; max-width: 500px; margin-left: -250px; padding: 30px 10px 10px 10px; border: 0px solid #0074a2; border-top: 0; border-radius: 0px 0px 5px 5px; box-shadow: 0px 0px 15px rgba(0,0,0,0.3); background: #ffffff; background: rgba(255,255,255,0.95); font-size: 16px; font-family: Arial, Verdana, sans-serif; line-height: 1.5em; color: #444444; }
|
570 |
|
564 |
#wp-admin-bar-advanced_ads_ad_health-default .advanced_ads_ad_health_highlight_ads div:hover { color: #00b9eb; cursor: pointer; }
|
565 |
#wpadminbar .advanced-ads-issue-counter { background-color: #d54e21; display: none; padding: 1px 7px 1px 6px!important; border-radius: 50%; color: #fff; }
|
566 |
#wpadminbar .advads-adminbar-is-warnings .advanced-ads-issue-counter { display: inline; }
|
567 |
+
.advanced-ads-highlight-ads { outline:4px solid #0474A2 !important; }
|
568 |
|
569 |
.advads-frontend-notice { display: none; position: fixed; top: 0; z-index: 1000; left: 50%; max-width: 500px; margin-left: -250px; padding: 30px 10px 10px 10px; border: 0px solid #0074a2; border-top: 0; border-radius: 0px 0px 5px 5px; box-shadow: 0px 0px 15px rgba(0,0,0,0.3); background: #ffffff; background: rgba(255,255,255,0.95); font-size: 16px; font-family: Arial, Verdana, sans-serif; line-height: 1.5em; color: #444444; }
|
570 |
|
languages/advanced-ads.pot
CHANGED
@@ -1,17 +1,17 @@
|
|
1 |
# Copyright (C) 2021 Thomas Maier, Advanced Ads GmbH
|
2 |
-
# This file is distributed under the
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Advanced Ads 1.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/advanced-ads/\n"
|
7 |
"Last-Translator: Thomas Maier <post@webzunft.de>\n"
|
8 |
"Language-Team: webgilde <support@wpadvancedads.com>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"POT-Creation-Date: 2021-
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
-
"X-Generator: WP-CLI 2.
|
15 |
"X-Domain: advanced-ads\n"
|
16 |
|
17 |
#. Plugin Name of the plugin
|
@@ -52,23 +52,29 @@ msgid "After which paragraph?"
|
|
52 |
msgstr ""
|
53 |
|
54 |
#: admin/class-advanced-ads-admin.php:220
|
|
|
55 |
msgid "Today"
|
56 |
msgstr ""
|
57 |
|
58 |
#: admin/class-advanced-ads-admin.php:221
|
|
|
59 |
msgid "Yesterday"
|
60 |
msgstr ""
|
61 |
|
62 |
#: admin/class-advanced-ads-admin.php:222
|
|
|
63 |
msgid "This Month"
|
64 |
msgstr ""
|
65 |
|
66 |
#. translators: 1: The number of days.
|
67 |
#: admin/class-advanced-ads-admin.php:224
|
|
|
|
|
68 |
msgid "Last %1$d days"
|
69 |
msgstr ""
|
70 |
|
71 |
#: admin/class-advanced-ads-admin.php:227
|
|
|
72 |
msgid "All"
|
73 |
msgstr ""
|
74 |
|
@@ -77,7 +83,6 @@ msgid "There were no results returned for this ad. Please make sure it is active
|
|
77 |
msgstr ""
|
78 |
|
79 |
#: admin/class-advanced-ads-admin.php:229
|
80 |
-
#: modules/gadsense/admin/views/external-ads-list.php:29
|
81 |
msgid "Show inactive ads"
|
82 |
msgstr ""
|
83 |
|
@@ -121,7 +126,7 @@ msgstr ""
|
|
121 |
#. translators: %s is a list of PHP extensions.
|
122 |
#. Translators: %s is a name of a module.
|
123 |
#: admin/includes/ad-health-notices.php:54
|
124 |
-
#: admin/views/placements.php:
|
125 |
msgid "Missing PHP extensions could cause issues. Please ask your hosting provider to enable them: %s"
|
126 |
msgstr ""
|
127 |
|
@@ -170,7 +175,7 @@ msgstr ""
|
|
170 |
|
171 |
#: admin/includes/ad-health-notices.php:135
|
172 |
#: admin/includes/ad-health-notices.php:142
|
173 |
-
#: modules/gadsense/includes/class-mapi.php:
|
174 |
msgid "Last AdSense account connection attempt failed."
|
175 |
msgstr ""
|
176 |
|
@@ -307,7 +312,7 @@ msgid "Display ads with the highest ad weight first"
|
|
307 |
msgstr ""
|
308 |
|
309 |
#: admin/includes/class-ad-groups-list.php:339
|
310 |
-
#: admin/views/placements.php:
|
311 |
#: modules/import-export/classes/import.php:153
|
312 |
#: modules/import-export/classes/import.php:193
|
313 |
#: modules/import-export/classes/import.php:595
|
@@ -316,7 +321,7 @@ msgid "Edit"
|
|
316 |
msgstr ""
|
317 |
|
318 |
#: admin/includes/class-ad-groups-list.php:340
|
319 |
-
#: admin/views/placements.php:
|
320 |
msgid "Usage"
|
321 |
msgstr ""
|
322 |
|
@@ -453,7 +458,7 @@ msgid "Pro Feature"
|
|
453 |
msgstr ""
|
454 |
|
455 |
#: admin/includes/class-admin-upgrades.php:107
|
456 |
-
#: admin/includes/class-overview-widgets.php:
|
457 |
msgid "A quick and error-free way of implementing ad units from your Google Ad Manager account."
|
458 |
msgstr ""
|
459 |
|
@@ -638,15 +643,15 @@ msgid "Layout / Output"
|
|
638 |
msgstr ""
|
639 |
|
640 |
#: admin/includes/class-meta-box.php:104
|
641 |
-
#: admin/views/placements.php:
|
642 |
-
#: admin/views/placements.php:
|
643 |
#: classes/ad-debug.php:152
|
644 |
msgid "Display Conditions"
|
645 |
msgstr ""
|
646 |
|
647 |
#: admin/includes/class-meta-box.php:112
|
648 |
-
#: admin/views/placements.php:
|
649 |
-
#: admin/views/placements.php:
|
650 |
#: classes/ad-debug.php:239
|
651 |
msgid "Visitor Conditions"
|
652 |
msgstr ""
|
@@ -663,8 +668,8 @@ msgstr ""
|
|
663 |
#: admin/includes/class-meta-box.php:220
|
664 |
#: admin/includes/class-meta-box.php:225
|
665 |
#: admin/includes/class-overview-widgets.php:179
|
666 |
-
#: admin/views/ad-main-metabox.php:
|
667 |
-
#: admin/views/ad-output-metabox.php:
|
668 |
#: admin/views/settings/general/custom-label.php:10
|
669 |
#: modules/ads-txt/admin/views/setting-create.php:11
|
670 |
#: modules/privacy/admin/views/setting-general.php:34
|
@@ -675,39 +680,39 @@ msgstr ""
|
|
675 |
msgid "Video"
|
676 |
msgstr ""
|
677 |
|
678 |
-
#: admin/includes/class-meta-box.php:
|
679 |
#: admin/includes/class-overview-widgets.php:61
|
680 |
msgid "Disable"
|
681 |
msgstr ""
|
682 |
|
683 |
-
#: admin/includes/class-meta-box.php:
|
684 |
msgid "Ad Settings"
|
685 |
msgstr ""
|
686 |
|
687 |
-
#: admin/includes/class-meta-box.php:
|
688 |
#: admin/views/overview.php:8
|
689 |
msgid "Ads Dashboard"
|
690 |
msgstr ""
|
691 |
|
692 |
#. translators: %1$d is the number of ads, %2$s and %3$s are URLs.
|
693 |
-
#: admin/includes/class-meta-box.php:
|
694 |
msgid "%1$d ads – <a href=\"%2$s\">manage</a> - <a href=\"%3$s\">new</a>"
|
695 |
msgstr ""
|
696 |
|
697 |
-
#: admin/includes/class-meta-box.php:
|
698 |
msgid "Get the tutorial via email"
|
699 |
msgstr ""
|
700 |
|
701 |
-
#: admin/includes/class-meta-box.php:
|
702 |
msgid "Get AdSense tips via email"
|
703 |
msgstr ""
|
704 |
|
705 |
-
#: admin/includes/class-meta-box.php:
|
706 |
msgid "Visit our blog for more articles about ad optimization"
|
707 |
msgstr ""
|
708 |
|
709 |
#. translators: %s is our URL.
|
710 |
-
#: admin/includes/class-meta-box.php:
|
711 |
msgid "Latest posts on wpadvancedads.com"
|
712 |
msgstr ""
|
713 |
|
@@ -740,8 +745,8 @@ msgid "Create your first ad"
|
|
740 |
msgstr ""
|
741 |
|
742 |
#: admin/includes/class-overview-widgets.php:118
|
743 |
-
#: modules/gadsense/admin/views/adsense-account.php:
|
744 |
-
#: modules/gadsense/admin/views/adsense-account.php:
|
745 |
msgid "Connect to AdSense"
|
746 |
msgstr ""
|
747 |
|
@@ -796,133 +801,133 @@ msgstr ""
|
|
796 |
msgid "Show %s hidden notices"
|
797 |
msgstr ""
|
798 |
|
799 |
-
#: admin/includes/class-overview-widgets.php:
|
800 |
msgid "How to download, install and activate an add-on."
|
801 |
msgstr ""
|
802 |
|
803 |
-
#: admin/includes/class-overview-widgets.php:
|
804 |
msgid "The solution for professional websites."
|
805 |
msgstr ""
|
806 |
|
807 |
-
#: admin/includes/class-overview-widgets.php:
|
808 |
#: admin/views/upgrades/pro-tab.php:7
|
809 |
msgid "support for cached sites"
|
810 |
msgstr ""
|
811 |
|
812 |
#. translators: %s is the name of another plugin.
|
813 |
-
#: admin/includes/class-overview-widgets.php:
|
814 |
-
#: admin/includes/class-overview-widgets.php:
|
815 |
-
#: admin/includes/class-overview-widgets.php:
|
816 |
-
#: admin/includes/class-overview-widgets.php:
|
817 |
msgid "integrates with <strong>%s</strong>"
|
818 |
msgstr ""
|
819 |
|
820 |
-
#: admin/includes/class-overview-widgets.php:
|
821 |
msgid "click fraud protection, lazy load, ad-block ads"
|
822 |
msgstr ""
|
823 |
|
824 |
-
#: admin/includes/class-overview-widgets.php:
|
825 |
#: admin/views/upgrades/pro-tab.php:8
|
826 |
msgid "11 more display and visitor conditions"
|
827 |
msgstr ""
|
828 |
|
829 |
-
#: admin/includes/class-overview-widgets.php:
|
830 |
#: admin/views/upgrades/pro-tab.php:9
|
831 |
msgid "6 more placements"
|
832 |
msgstr ""
|
833 |
|
834 |
-
#: admin/includes/class-overview-widgets.php:
|
835 |
#: admin/views/upgrades/pro-tab.php:10
|
836 |
msgid "placement tests for ad optimization"
|
837 |
msgstr ""
|
838 |
|
839 |
-
#: admin/includes/class-overview-widgets.php:
|
840 |
#: admin/views/upgrades/pro-tab.php:11
|
841 |
msgid "ad grids and many more advanced features"
|
842 |
msgstr ""
|
843 |
|
844 |
-
#: admin/includes/class-overview-widgets.php:
|
845 |
msgid "Analyze clicks and impressions of your ads locally or in Google Analytics, share reports, and limit ads to a specific number of impressions or clicks."
|
846 |
msgstr ""
|
847 |
|
848 |
-
#: admin/includes/class-overview-widgets.php:
|
849 |
msgid "Display ads based on the device or the size of your visitor’s browser, and control ads on AMP pages."
|
850 |
msgstr ""
|
851 |
|
852 |
-
#: admin/includes/class-overview-widgets.php:
|
853 |
msgid "Increase click rates on your ads by placing them in sticky positions above, next or below your site."
|
854 |
msgstr ""
|
855 |
|
856 |
-
#: admin/includes/class-overview-widgets.php:
|
857 |
msgid "Users will never miss an ad or other information in a PopUp. Choose when it shows up and for how long a user can close it."
|
858 |
msgstr ""
|
859 |
|
860 |
-
#: admin/includes/class-overview-widgets.php:
|
861 |
msgid "Target visitors with ads that match their geo location and make more money with regional campaigns."
|
862 |
msgstr ""
|
863 |
|
864 |
-
#: admin/includes/class-overview-widgets.php:
|
865 |
msgid "Earn more money and let advertisers pay for ad space directly on the frontend of your site."
|
866 |
msgstr ""
|
867 |
|
868 |
-
#: admin/includes/class-overview-widgets.php:
|
869 |
msgid "Create a beautiful and simple slider from your ads to show more information on less space."
|
870 |
msgstr ""
|
871 |
|
872 |
-
#: admin/includes/class-overview-widgets.php:
|
873 |
msgid "Place AdSense In-feed ads between posts on homepage, category, and archive pages."
|
874 |
msgstr ""
|
875 |
|
876 |
-
#: admin/includes/class-overview-widgets.php:
|
877 |
-
#: admin/includes/class-overview-widgets.php:
|
878 |
-
#: admin/includes/class-overview-widgets.php:
|
879 |
msgid "Install now"
|
880 |
msgstr ""
|
881 |
|
882 |
-
#: admin/includes/class-overview-widgets.php:
|
883 |
-
#: admin/includes/class-overview-widgets.php:
|
884 |
-
#: admin/includes/class-overview-widgets.php:
|
885 |
-
#: admin/includes/class-overview-widgets.php:
|
886 |
-
#: admin/includes/class-overview-widgets.php:
|
887 |
-
#: admin/includes/class-overview-widgets.php:
|
888 |
-
#: admin/includes/class-overview-widgets.php:
|
889 |
-
#: admin/includes/class-overview-widgets.php:
|
890 |
-
#: admin/includes/class-overview-widgets.php:
|
891 |
msgid "Activate now"
|
892 |
msgstr ""
|
893 |
|
894 |
-
#: admin/includes/class-overview-widgets.php:
|
895 |
msgid "Visit your ad statistics"
|
896 |
msgstr ""
|
897 |
|
898 |
-
#: admin/includes/class-overview-widgets.php:
|
899 |
msgid "Use Genesis specific ad positions."
|
900 |
msgstr ""
|
901 |
|
902 |
-
#: admin/includes/class-overview-widgets.php:
|
903 |
msgid "Manage ad positions with WPBakery Page Builder (formerly Visual Composer)."
|
904 |
msgstr ""
|
905 |
|
906 |
-
#: admin/includes/class-overview-widgets.php:
|
907 |
msgid "Our best deal with all add-ons included."
|
908 |
msgstr ""
|
909 |
|
910 |
-
#: admin/includes/class-overview-widgets.php:
|
911 |
-
#: admin/includes/class-overview-widgets.php:
|
912 |
msgid "Get full access"
|
913 |
msgstr ""
|
914 |
|
915 |
-
#: admin/includes/class-overview-widgets.php:
|
916 |
msgid "A one-time payment for four years of support and updates. The package saves you up to 70% compared to individually purchasing our add-ons."
|
917 |
msgstr ""
|
918 |
|
919 |
-
#: admin/includes/class-overview-widgets.php:
|
920 |
#: admin/views/conditions/ad-display-metabox.php:37
|
921 |
#: admin/views/conditions/ad-visitor-metabox.php:37
|
922 |
msgid "Visit the manual"
|
923 |
msgstr ""
|
924 |
|
925 |
-
#: admin/includes/class-overview-widgets.php:
|
926 |
msgid "Get this add-on"
|
927 |
msgstr ""
|
928 |
|
@@ -1147,7 +1152,8 @@ msgid "Slug"
|
|
1147 |
msgstr ""
|
1148 |
|
1149 |
#: admin/views/ad-group-edit.php:58
|
1150 |
-
#: admin/views/ad-output-metabox.php:
|
|
|
1151 |
msgid "An id-like string with only letters in lower case, numbers, and hyphens."
|
1152 |
msgstr ""
|
1153 |
|
@@ -1165,7 +1171,7 @@ msgid "Update"
|
|
1165 |
msgstr ""
|
1166 |
|
1167 |
#: admin/views/ad-group-list-ads.php:20
|
1168 |
-
#: admin/views/placements.php:
|
1169 |
#: classes/ad-debug.php:118
|
1170 |
#: classes/ad-debug.php:167
|
1171 |
#: classes/ad-debug.php:169
|
@@ -1192,7 +1198,7 @@ msgstr ""
|
|
1192 |
|
1193 |
#: admin/views/ad-group-list-form-row.php:56
|
1194 |
#: admin/views/placements.php:64
|
1195 |
-
#: admin/views/placements.php:
|
1196 |
#: modules/gadsense/admin/views/adsense-ad-parameters.php:105
|
1197 |
msgid "Type"
|
1198 |
msgstr ""
|
@@ -1221,7 +1227,7 @@ msgstr ""
|
|
1221 |
|
1222 |
#: admin/views/ad-group-list-row.php:22
|
1223 |
#: admin/views/ad-info.php:7
|
1224 |
-
#: admin/views/placements.php:
|
1225 |
msgid "shortcode"
|
1226 |
msgstr ""
|
1227 |
|
@@ -1381,8 +1387,8 @@ msgstr ""
|
|
1381 |
#: admin/views/placements-ad-label-position.php:13
|
1382 |
#: admin/views/placements-ad-label.php:9
|
1383 |
#: admin/views/placements-ad-label.php:11
|
1384 |
-
#: admin/views/placements.php:
|
1385 |
-
#: modules/gadsense/includes/class-network-adsense.php:
|
1386 |
msgid "default"
|
1387 |
msgstr ""
|
1388 |
|
@@ -1428,43 +1434,39 @@ msgstr ""
|
|
1428 |
msgid "left:"
|
1429 |
msgstr ""
|
1430 |
|
1431 |
-
#: admin/views/ad-output-metabox.php:
|
1432 |
-
msgid "tip: use this to add a margin around the ad"
|
1433 |
-
msgstr ""
|
1434 |
-
|
1435 |
-
#: admin/views/ad-output-metabox.php:45
|
1436 |
msgid "container ID"
|
1437 |
msgstr ""
|
1438 |
|
1439 |
-
#: admin/views/ad-output-metabox.php:
|
1440 |
msgid "Specify the id of the ad container. Leave blank for random or no id."
|
1441 |
msgstr ""
|
1442 |
|
1443 |
-
#: admin/views/ad-output-metabox.php:
|
1444 |
msgid "container classes"
|
1445 |
msgstr ""
|
1446 |
|
1447 |
-
#: admin/views/ad-output-metabox.php:
|
1448 |
msgid "Specify one or more classes for the container. Separate multiple classes with a space"
|
1449 |
msgstr ""
|
1450 |
|
1451 |
-
#: admin/views/ad-output-metabox.php:
|
1452 |
msgid "Enable debug mode"
|
1453 |
msgstr ""
|
1454 |
|
1455 |
-
#: admin/views/ad-output-metabox.php:
|
1456 |
msgid "Display only once"
|
1457 |
msgstr ""
|
1458 |
|
1459 |
-
#: admin/views/ad-output-metabox.php:
|
1460 |
msgid "Display the ad only once per page"
|
1461 |
msgstr ""
|
1462 |
|
1463 |
-
#: admin/views/ad-output-metabox.php:
|
1464 |
msgid "Custom Code"
|
1465 |
msgstr ""
|
1466 |
|
1467 |
-
#: admin/views/ad-output-metabox.php:
|
1468 |
msgid "Place your own code below the ad"
|
1469 |
msgstr ""
|
1470 |
|
@@ -1712,19 +1714,19 @@ msgstr ""
|
|
1712 |
msgid "Disabling the plugin now…"
|
1713 |
msgstr ""
|
1714 |
|
1715 |
-
#: admin/views/gadsense-dashboard.php:
|
1716 |
msgid "There is an error in your AdSense setup."
|
1717 |
msgstr ""
|
1718 |
|
1719 |
#: admin/views/modal.php:36
|
1720 |
#: admin/views/modal.php:37
|
1721 |
-
#: admin/views/placements.php:319
|
1722 |
#: admin/views/placements.php:320
|
|
|
1723 |
msgid "Close"
|
1724 |
msgstr ""
|
1725 |
|
1726 |
#: admin/views/modal.php:39
|
1727 |
-
#: admin/views/placements.php:
|
1728 |
msgid "Close and save"
|
1729 |
msgstr ""
|
1730 |
|
@@ -1995,12 +1997,12 @@ msgid "Placements updated"
|
|
1995 |
msgstr ""
|
1996 |
|
1997 |
#: admin/views/placements.php:25
|
1998 |
-
#: admin/views/placements.php:
|
1999 |
msgid "Create a new placement"
|
2000 |
msgstr ""
|
2001 |
|
2002 |
#: admin/views/placements.php:26
|
2003 |
-
#: admin/views/placements.php:
|
2004 |
msgid "New Placement"
|
2005 |
msgstr ""
|
2006 |
|
@@ -2021,100 +2023,100 @@ msgstr ""
|
|
2021 |
msgid "Delivery"
|
2022 |
msgstr ""
|
2023 |
|
2024 |
-
#: admin/views/placements.php:
|
2025 |
msgid "show usage"
|
2026 |
msgstr ""
|
2027 |
|
2028 |
-
#: admin/views/placements.php:
|
2029 |
msgid "ad label"
|
2030 |
msgstr ""
|
2031 |
|
2032 |
-
#: admin/views/placements.php:
|
2033 |
msgid "Inline CSS"
|
2034 |
msgstr ""
|
2035 |
|
2036 |
-
#: admin/views/placements.php:
|
2037 |
msgid "Use display conditions for placements."
|
2038 |
msgstr ""
|
2039 |
|
2040 |
-
#: admin/views/placements.php:
|
2041 |
-
#: admin/views/placements.php:
|
2042 |
msgid "The free version provides conditions on the ad edit page."
|
2043 |
msgstr ""
|
2044 |
|
2045 |
-
#: admin/views/placements.php:
|
2046 |
msgid "Use visitor conditions for placements."
|
2047 |
msgstr ""
|
2048 |
|
2049 |
-
#: admin/views/placements.php:
|
2050 |
msgid "Minimum Content Length"
|
2051 |
msgstr ""
|
2052 |
|
2053 |
-
#: admin/views/placements.php:
|
2054 |
msgid "Minimum length of content before automatically injected ads are allowed in them."
|
2055 |
msgstr ""
|
2056 |
|
2057 |
-
#: admin/views/placements.php:
|
2058 |
msgid "Words Between Ads"
|
2059 |
msgstr ""
|
2060 |
|
2061 |
-
#: admin/views/placements.php:
|
2062 |
msgid "A minimum amount of words between automatically injected ads."
|
2063 |
msgstr ""
|
2064 |
|
2065 |
-
#: admin/views/placements.php:
|
2066 |
#: modules/import-export/views/page.php:26
|
2067 |
msgid "Options"
|
2068 |
msgstr ""
|
2069 |
|
2070 |
#. Translators: %s is the name of a placement.
|
2071 |
-
#: admin/views/placements.php:
|
2072 |
msgid "Placement type \"%s\" is missing and was reset to \"default\".<br/>Please check if the responsible add-on is activated."
|
2073 |
msgstr ""
|
2074 |
|
2075 |
-
#: admin/views/placements.php:
|
2076 |
msgid "template (PHP)"
|
2077 |
msgstr ""
|
2078 |
|
2079 |
-
#: admin/views/placements.php:
|
2080 |
msgid "Group"
|
2081 |
msgstr ""
|
2082 |
|
2083 |
-
#: admin/views/placements.php:
|
2084 |
msgid "after"
|
2085 |
msgstr ""
|
2086 |
|
2087 |
-
#: admin/views/placements.php:
|
2088 |
msgid "before"
|
2089 |
msgstr ""
|
2090 |
|
2091 |
-
#: admin/views/placements.php:
|
2092 |
msgid "position"
|
2093 |
msgstr ""
|
2094 |
|
2095 |
-
#: admin/views/placements.php:
|
2096 |
msgid "Important Notice"
|
2097 |
msgstr ""
|
2098 |
|
2099 |
#. Translators: %s is a URL.
|
2100 |
-
#: admin/views/placements.php:
|
2101 |
msgid "Tutorial: <a href=\"%s\" target=\"_blank\">How to place visible ads in the header of your website</a>."
|
2102 |
msgstr ""
|
2103 |
|
2104 |
-
#: admin/views/placements.php:
|
2105 |
msgid "show all options"
|
2106 |
msgstr ""
|
2107 |
|
2108 |
-
#: admin/views/placements.php:
|
2109 |
msgid "edit conditions"
|
2110 |
msgstr ""
|
2111 |
|
2112 |
-
#: admin/views/placements.php:
|
2113 |
msgctxt "checkbox to remove placement"
|
2114 |
msgid "delete"
|
2115 |
msgstr ""
|
2116 |
|
2117 |
-
#: admin/views/placements.php:
|
2118 |
msgid "Save Placements"
|
2119 |
msgstr ""
|
2120 |
|
@@ -2242,19 +2244,19 @@ msgstr ""
|
|
2242 |
msgid "e.g. archive pages like categories, tags, authors, front page (if a list)"
|
2243 |
msgstr ""
|
2244 |
|
2245 |
-
#: admin/views/settings/general/disable-ads.php:
|
2246 |
msgid "Disable ads on secondary queries"
|
2247 |
msgstr ""
|
2248 |
|
2249 |
-
#: admin/views/settings/general/disable-ads.php:
|
2250 |
msgid "Secondary queries are custom queries of posts outside the main query of a page. Try this option if you see ads injected on places where they shouldn’t appear."
|
2251 |
msgstr ""
|
2252 |
|
2253 |
-
#: admin/views/settings/general/disable-ads.php:
|
2254 |
msgid "Disable ads in RSS Feed"
|
2255 |
msgstr ""
|
2256 |
|
2257 |
-
#: admin/views/settings/general/disable-ads.php:
|
2258 |
msgid "Disable ads in REST API"
|
2259 |
msgstr ""
|
2260 |
|
@@ -2532,7 +2534,7 @@ msgstr ""
|
|
2532 |
|
2533 |
#. translators: %1$s is an anchor (link) opening tag, %2$s is the closing tag.
|
2534 |
#: classes/ad-health-notices.php:865
|
2535 |
-
#: modules/gadsense/includes/class-mapi.php:
|
2536 |
msgid "Learn more about AdSense account issues %1$shere%2$s."
|
2537 |
msgstr ""
|
2538 |
|
@@ -2737,28 +2739,24 @@ msgstr ""
|
|
2737 |
msgid "Allow PHP"
|
2738 |
msgstr ""
|
2739 |
|
2740 |
-
#: classes/ad_type_plain.php:
|
2741 |
msgid "Execute PHP code (wrapped in <code><?php ?></code>)"
|
2742 |
msgstr ""
|
2743 |
|
2744 |
-
#: classes/ad_type_plain.php:
|
2745 |
msgid "No PHP tag detected in your code."
|
2746 |
msgstr ""
|
2747 |
|
2748 |
-
#: classes/ad_type_plain.php:
|
2749 |
-
#: classes/ad_type_plain.php:
|
2750 |
msgid "Uncheck this checkbox for improved performance."
|
2751 |
msgstr ""
|
2752 |
|
2753 |
-
#: classes/ad_type_plain.php:
|
2754 |
-
msgid "Allow shortcodes"
|
2755 |
-
msgstr ""
|
2756 |
-
|
2757 |
-
#: classes/ad_type_plain.php:130
|
2758 |
msgid "Execute shortcodes"
|
2759 |
msgstr ""
|
2760 |
|
2761 |
-
#: classes/ad_type_plain.php:
|
2762 |
msgid "No shortcode detected in your code."
|
2763 |
msgstr ""
|
2764 |
|
@@ -3136,7 +3134,7 @@ msgid "I want to change the position of the ads"
|
|
3136 |
msgstr ""
|
3137 |
|
3138 |
#: classes/frontend_checks.php:882
|
3139 |
-
#: modules/gadsense/includes/class-network-adsense.php:
|
3140 |
msgid "Display Auto ads only on specific pages"
|
3141 |
msgstr ""
|
3142 |
|
@@ -3346,12 +3344,12 @@ msgstr ""
|
|
3346 |
msgid "Ad blocker counter"
|
3347 |
msgstr ""
|
3348 |
|
3349 |
-
#: modules/adblock-finder/admin/views/setting-ga.php:
|
3350 |
msgid "Google Analytics Tracking ID"
|
3351 |
msgstr ""
|
3352 |
|
3353 |
#: modules/adblock-finder/admin/views/setting-ga.php:14
|
3354 |
-
msgid "
|
3355 |
msgstr ""
|
3356 |
|
3357 |
#. translators: 1: is an example id for Universal Analytics <code>UA-123456-1</code>, 2: is an example id for GA4 '<code>G-A12BC3D456</code>'
|
@@ -3379,8 +3377,9 @@ msgstr ""
|
|
3379 |
msgid "Move the content of the existing ads.txt file into Advanced Ads and remove it."
|
3380 |
msgstr ""
|
3381 |
|
|
|
3382 |
#: modules/ads-txt/admin/class-advanced-ads-ads-txt-admin.php:224
|
3383 |
-
#: modules/ads-txt/admin/views/setting-additional-content.php:
|
3384 |
msgid "An error occured: %s."
|
3385 |
msgstr ""
|
3386 |
|
@@ -3414,11 +3413,11 @@ msgstr ""
|
|
3414 |
msgid "Additional records to add to the file, one record per line. AdSense is added automatically."
|
3415 |
msgstr ""
|
3416 |
|
3417 |
-
#: modules/ads-txt/admin/views/setting-additional-content.php:
|
3418 |
msgid "Check for problems"
|
3419 |
msgstr ""
|
3420 |
|
3421 |
-
#: modules/ads-txt/admin/views/setting-additional-content.php:
|
3422 |
msgid "Preview"
|
3423 |
msgstr ""
|
3424 |
|
@@ -3458,59 +3457,59 @@ msgid "AdSense warnings"
|
|
3458 |
msgstr ""
|
3459 |
|
3460 |
#: modules/gadsense/admin/views/adsense-account.php:30
|
3461 |
-
#: modules/gadsense/admin/views/adsense-account.php:
|
3462 |
msgid "dismiss"
|
3463 |
msgstr ""
|
3464 |
|
3465 |
-
#: modules/gadsense/admin/views/adsense-account.php:
|
3466 |
msgid "Revoke API acccess"
|
3467 |
msgstr ""
|
3468 |
|
3469 |
-
#: modules/gadsense/admin/views/adsense-account.php:
|
3470 |
msgid "Account holder name"
|
3471 |
msgstr ""
|
3472 |
|
3473 |
-
#: modules/gadsense/admin/views/adsense-account.php:
|
3474 |
#: modules/gadsense/includes/class-ad-type-adsense.php:91
|
3475 |
msgid "The Publisher ID has an incorrect format. (must start with \"pub-\")"
|
3476 |
msgstr ""
|
3477 |
|
3478 |
-
#: modules/gadsense/admin/views/adsense-account.php:
|
3479 |
msgid "Your AdSense Publisher ID <em>(pub-xxxxxxxxxxxxxx)</em>"
|
3480 |
msgstr ""
|
3481 |
|
3482 |
-
#: modules/gadsense/admin/views/adsense-account.php:
|
3483 |
msgid "Yes, I have an AdSense account"
|
3484 |
msgstr ""
|
3485 |
|
3486 |
-
#: modules/gadsense/admin/views/adsense-account.php:
|
3487 |
msgid "Configure everything manually"
|
3488 |
msgstr ""
|
3489 |
|
3490 |
-
#: modules/gadsense/admin/views/adsense-account.php:
|
3491 |
msgid "No, I still don't have an AdSense account"
|
3492 |
msgstr ""
|
3493 |
|
3494 |
-
#: modules/gadsense/admin/views/adsense-account.php:
|
3495 |
msgid "Get a free AdSense account"
|
3496 |
msgstr ""
|
3497 |
|
3498 |
#. translators: %1$s is an opening a tag, %2$s is the closing one
|
3499 |
-
#: modules/gadsense/admin/views/adsense-account.php:
|
3500 |
-
#: modules/gadsense/admin/views/adsense-account.php:
|
3501 |
msgid "See all %1$srecommended ad networks%2$s."
|
3502 |
msgstr ""
|
3503 |
|
3504 |
-
#: modules/gadsense/admin/views/adsense-account.php:
|
3505 |
msgid "How to choose specific positions for AdSense ad units"
|
3506 |
msgstr ""
|
3507 |
|
3508 |
#. translators: %1$s is the opening link tag to our manual; %2$s is the appropriate closing link tag; %3$s is the opening link tag to our help forum; %4$s is the appropriate closing link tag
|
3509 |
-
#: modules/gadsense/admin/views/adsense-account.php:
|
3510 |
msgid "Problems with AdSense? Check out the %1$smanual%2$s or %3$sask here%4$s."
|
3511 |
msgstr ""
|
3512 |
|
3513 |
-
#: modules/gadsense/admin/views/adsense-account.php:
|
3514 |
#: modules/gadsense/admin/views/external-ads-links.php:38
|
3515 |
msgid "Can not connect AdSense account. PHP version is too low."
|
3516 |
msgstr ""
|
@@ -3643,8 +3642,16 @@ msgstr ""
|
|
3643 |
msgid "Connect to %1$s"
|
3644 |
msgstr ""
|
3645 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3646 |
#: modules/gadsense/admin/views/external-ads-list.php:30
|
3647 |
-
#: modules/gadsense/admin/views/external-ads-list.php:
|
3648 |
msgid "Update the ad units list"
|
3649 |
msgstr ""
|
3650 |
|
@@ -3666,48 +3673,44 @@ msgid "Size"
|
|
3666 |
msgstr ""
|
3667 |
|
3668 |
#: modules/gadsense/admin/views/external-ads-list.php:61
|
3669 |
-
msgid "No
|
3670 |
-
msgstr ""
|
3671 |
-
|
3672 |
-
#: modules/gadsense/admin/views/external-ads-list.php:63
|
3673 |
-
msgid "Show all ad units"
|
3674 |
msgstr ""
|
3675 |
|
3676 |
-
#: modules/gadsense/admin/views/external-ads-list.php:
|
3677 |
-
msgid "
|
3678 |
msgstr ""
|
3679 |
|
3680 |
-
#: modules/gadsense/admin/views/external-ads-list.php:
|
3681 |
msgid "Get the code for this ad"
|
3682 |
msgstr ""
|
3683 |
|
3684 |
-
#: modules/gadsense/admin/views/external-ads-list.php:
|
3685 |
msgid "Ad can't be imported, click for details"
|
3686 |
msgstr ""
|
3687 |
|
3688 |
-
#: modules/gadsense/admin/views/external-ads-list.php:
|
3689 |
msgid "Unrecognized ad code"
|
3690 |
msgstr ""
|
3691 |
|
3692 |
-
#: modules/gadsense/admin/views/external-ads-list.php:
|
3693 |
msgid "This ad type can currently not be imported from AdSense."
|
3694 |
msgstr ""
|
3695 |
|
3696 |
-
#: modules/gadsense/admin/views/external-ads-list.php:
|
3697 |
msgid "You can proceed with one of the following solutions"
|
3698 |
msgstr ""
|
3699 |
|
3700 |
#. Translators: 1: opening tag for AdSense account link 2: opening tag for a link to insert ad code 3: closing a tag
|
3701 |
-
#: modules/gadsense/admin/views/external-ads-list.php:
|
3702 |
msgid "%1$sCopy the code from your AdSense account%3$s and %2$sinsert a new AdSense code here%3$s."
|
3703 |
msgstr ""
|
3704 |
|
3705 |
#. Translators: 1: opening tag for a link to create an ad manually 2: closing a tag
|
3706 |
-
#: modules/gadsense/admin/views/external-ads-list.php:
|
3707 |
msgid "%1$sCreate an AdSense code manually%2$s: Select the <em>Normal</em> or <em>Responsive</em> type and the size."
|
3708 |
msgstr ""
|
3709 |
|
3710 |
-
#: modules/gadsense/admin/views/external-ads-list.php:
|
3711 |
msgid "Choose a different ad from your AdSense account above."
|
3712 |
msgstr ""
|
3713 |
|
@@ -3715,6 +3718,17 @@ msgstr ""
|
|
3715 |
msgid "Enable AMP Auto ads"
|
3716 |
msgstr ""
|
3717 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3718 |
#: modules/gadsense/includes/class-ad-type-adsense.php:34
|
3719 |
msgid "AdSense ad"
|
3720 |
msgstr ""
|
@@ -3727,134 +3741,129 @@ msgstr ""
|
|
3727 |
msgid "Your AdSense Publisher ID is missing."
|
3728 |
msgstr ""
|
3729 |
|
3730 |
-
#: modules/gadsense/includes/class-adsense-report.php:
|
3731 |
-
|
3732 |
-
msgid "Invalid response from AdSense."
|
3733 |
-
msgstr ""
|
3734 |
-
|
3735 |
-
#: modules/gadsense/includes/class-adsense-report.php:311
|
3736 |
-
#: modules/gadsense/includes/class-adsense-report.php:336
|
3737 |
-
msgid "You could try to re-connect under Advanced Ads > Settings > AdSense."
|
3738 |
-
msgstr ""
|
3739 |
-
|
3740 |
-
#: modules/gadsense/includes/class-adsense-report.php:499
|
3741 |
-
#: modules/gadsense/includes/class-adsense-report.php:525
|
3742 |
-
msgid "Never"
|
3743 |
msgstr ""
|
3744 |
|
3745 |
#: modules/gadsense/includes/class-gadsense-data.php:40
|
3746 |
msgid "Auto"
|
3747 |
msgstr ""
|
3748 |
|
3749 |
-
|
|
|
3750 |
msgid "Error while retrieving ad code for \"%s\"."
|
3751 |
msgstr ""
|
3752 |
|
3753 |
-
|
|
|
3754 |
msgid "Invalid response while retrieving ad code for \"%s\"."
|
3755 |
msgstr ""
|
3756 |
|
3757 |
#. translators: the publisher ID.
|
3758 |
-
#: modules/gadsense/includes/class-mapi.php:
|
3759 |
-
#: modules/gadsense/includes/class-mapi.php:
|
3760 |
msgid "Error while retrieving adUnits list for \"%s\"."
|
3761 |
msgstr ""
|
3762 |
|
3763 |
#. translators: %s is the publisher ID.
|
3764 |
-
#: modules/gadsense/includes/class-mapi.php:
|
3765 |
msgid "Invalid response while retrieving adUnits list for \"%s\"."
|
3766 |
msgstr ""
|
3767 |
|
3768 |
-
#: modules/gadsense/includes/class-mapi.php:
|
3769 |
msgid "Reason:"
|
3770 |
msgstr ""
|
3771 |
|
3772 |
-
#: modules/gadsense/includes/class-mapi.php:
|
3773 |
msgid "Message:"
|
3774 |
msgstr ""
|
3775 |
|
3776 |
#. translators: %1$s is the AdSense publisher ID; %2$s a starting a tag to the AdSense ad unit list and %3$s the closing link.
|
3777 |
-
#: modules/gadsense/includes/class-mapi.php:
|
3778 |
msgid "The account \"%1$s\" does not seem to have any ad units. Please create some %2$shere%3$s."
|
3779 |
msgstr ""
|
3780 |
|
3781 |
-
#: modules/gadsense/includes/class-mapi.php:
|
3782 |
msgid "It seems that some changes have been made in the Advanced Ads settings. Please refresh this page."
|
3783 |
msgstr ""
|
3784 |
|
3785 |
-
#: modules/gadsense/includes/class-mapi.php:
|
3786 |
msgid "Advanced Ads does not have access to your account (<code>%s</code>) anymore."
|
3787 |
msgstr ""
|
3788 |
|
3789 |
-
#: modules/gadsense/includes/class-mapi.php:
|
3790 |
msgid "error while renewing access token for \"%s\""
|
3791 |
msgstr ""
|
3792 |
|
3793 |
#. translators: %s AdSense account ID
|
3794 |
-
#: modules/gadsense/includes/class-mapi.php:
|
3795 |
msgid "invalid response received while renewing access token for \"%s\""
|
3796 |
msgstr ""
|
3797 |
|
3798 |
-
#: modules/gadsense/includes/class-mapi.php:
|
3799 |
msgid "You could try to connect again under Advanced Ads > Settings > AdSense."
|
3800 |
msgstr ""
|
3801 |
|
3802 |
-
#: modules/gadsense/includes/class-mapi.php:
|
3803 |
msgid "This ad code is from a different AdSense Account"
|
3804 |
msgstr ""
|
3805 |
|
3806 |
-
#: modules/gadsense/includes/class-mapi.php:
|
3807 |
msgid "Invalid response body while retrieving account alerts"
|
3808 |
msgstr ""
|
3809 |
|
3810 |
-
#: modules/gadsense/includes/class-mapi.php:
|
3811 |
msgid "error while retrieving account alerts"
|
3812 |
msgstr ""
|
3813 |
|
3814 |
-
#: modules/gadsense/includes/class-mapi.php:
|
3815 |
msgid "No token provided. Token data needed to get account details."
|
3816 |
msgstr ""
|
3817 |
|
3818 |
-
#: modules/gadsense/includes/class-mapi.php:
|
3819 |
-
|
|
|
3820 |
msgstr ""
|
3821 |
|
3822 |
-
#: modules/gadsense/includes/class-mapi.php:
|
3823 |
-
#: modules/gadsense/includes/class-
|
|
|
3824 |
msgctxt "AdSense ad type"
|
3825 |
msgid "Matched Content"
|
3826 |
msgstr ""
|
3827 |
|
3828 |
-
#: modules/gadsense/includes/class-mapi.php:
|
3829 |
-
#: modules/gadsense/includes/class-
|
|
|
3830 |
msgctxt "AdSense ad type"
|
3831 |
msgid "In-article"
|
3832 |
msgstr ""
|
3833 |
|
3834 |
-
#: modules/gadsense/includes/class-mapi.php:
|
3835 |
-
#: modules/gadsense/includes/class-
|
|
|
3836 |
msgctxt "AdSense ad type"
|
3837 |
msgid "In-feed"
|
3838 |
msgstr ""
|
3839 |
|
3840 |
-
#: modules/gadsense/includes/class-mapi.php:
|
3841 |
-
#: modules/gadsense/includes/class-network-adsense.php:
|
3842 |
msgctxt "AdSense ad type"
|
3843 |
msgid "Display"
|
3844 |
msgstr ""
|
3845 |
|
3846 |
-
#: modules/gadsense/includes/class-mapi.php:
|
3847 |
-
#: modules/gadsense/includes/class-network-adsense.php:
|
3848 |
msgctxt "AdSense ad type"
|
3849 |
msgid "Link"
|
3850 |
msgstr ""
|
3851 |
|
3852 |
-
#: modules/gadsense/includes/class-mapi.php:
|
3853 |
msgid "There are one or more warnings about the currently linked AdSense account. You can view them <a href=\"%s\">here</a>"
|
3854 |
msgstr ""
|
3855 |
|
3856 |
#. translators: 1:A link to the settings page translators: 2:The name of an ad network
|
3857 |
-
#: modules/gadsense/includes/class-mapi.php:
|
3858 |
msgid "Please try to <a href=\"%1$s\" target=\"_blank\">reconnect to your %2$s account</a>."
|
3859 |
msgstr ""
|
3860 |
|
@@ -3892,62 +3901,62 @@ msgid "Full width responsive ads on mobile"
|
|
3892 |
msgstr ""
|
3893 |
|
3894 |
#. Translators: $d a number of ads.
|
3895 |
-
#: modules/gadsense/includes/class-network-adsense.php:
|
3896 |
msgid "Limit to %d AdSense ads"
|
3897 |
msgstr ""
|
3898 |
|
3899 |
-
#: modules/gadsense/includes/class-network-adsense.php:
|
3900 |
msgid "There is no explicit limit for AdSense ads anymore, but you can still use this setting to prevent too many AdSense ads to show accidentally on your site."
|
3901 |
msgstr ""
|
3902 |
|
3903 |
-
#: modules/gadsense/includes/class-network-adsense.php:
|
3904 |
msgid "Due to technical restrictions, the limit does not work on placements with cache-busting enabled."
|
3905 |
msgstr ""
|
3906 |
|
3907 |
-
#: modules/gadsense/includes/class-network-adsense.php:
|
3908 |
msgid "Enable this box if you don’t want Google Auto ads to place anchor ads at the top of your page."
|
3909 |
msgstr ""
|
3910 |
|
3911 |
-
#: modules/gadsense/includes/class-network-adsense.php:
|
3912 |
msgid "Enable this option to stop loading stats from AdSense into your WordPress backend."
|
3913 |
msgstr ""
|
3914 |
|
3915 |
-
#: modules/gadsense/includes/class-network-adsense.php:
|
3916 |
msgid "Insert the AdSense header code to enable Auto ads and verify your website."
|
3917 |
msgstr ""
|
3918 |
|
3919 |
-
#: modules/gadsense/includes/class-network-adsense.php:
|
3920 |
msgid "Why are ads appearing in random positions?"
|
3921 |
msgstr ""
|
3922 |
|
3923 |
#. translators: this is the text for a link to a sub-page in an AdSense account
|
3924 |
-
#: modules/gadsense/includes/class-network-adsense.php:
|
3925 |
msgid "Adjust Auto ads options"
|
3926 |
msgstr ""
|
3927 |
|
3928 |
-
#: modules/gadsense/includes/class-network-adsense.php:
|
3929 |
msgid "Disable warnings about potential violations of the AdSense terms."
|
3930 |
msgstr ""
|
3931 |
|
3932 |
#. translators: %s is a URL.
|
3933 |
-
#: modules/gadsense/includes/class-network-adsense.php:
|
3934 |
msgid "Our <a href=\"%s\" target=\"_blank\">Ad Health</a> feature monitors if AdSense is implemented correctly on your site. It also considers ads not managed with Advanced Ads. Enable this option to remove these checks"
|
3935 |
msgstr ""
|
3936 |
|
3937 |
-
#: modules/gadsense/includes/class-network-adsense.php:
|
3938 |
msgid "Enable this option in case your theme adds an unfortunate background color to AdSense ads."
|
3939 |
msgstr ""
|
3940 |
|
3941 |
-
#: modules/gadsense/includes/class-network-adsense.php:
|
3942 |
msgid "enable"
|
3943 |
msgstr ""
|
3944 |
|
3945 |
-
#: modules/gadsense/includes/class-network-adsense.php:
|
3946 |
msgid "disable"
|
3947 |
msgstr ""
|
3948 |
|
3949 |
#. translators: %s is a URL.
|
3950 |
-
#: modules/gadsense/includes/class-network-adsense.php:
|
3951 |
msgid "Whether your responsive ad unit may expand to <a href='%s' target='blank'>use the full width</a> of your visitor's mobile device screen"
|
3952 |
msgstr ""
|
3953 |
|
1 |
# Copyright (C) 2021 Thomas Maier, Advanced Ads GmbH
|
2 |
+
# This file is distributed under the same license as the Advanced Ads plugin.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Advanced Ads 1.29.0\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/advanced-ads/\n"
|
7 |
"Last-Translator: Thomas Maier <post@webzunft.de>\n"
|
8 |
"Language-Team: webgilde <support@wpadvancedads.com>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"POT-Creation-Date: 2021-10-05T10:37:17+02:00\n"
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
+
"X-Generator: WP-CLI 2.4.0\n"
|
15 |
"X-Domain: advanced-ads\n"
|
16 |
|
17 |
#. Plugin Name of the plugin
|
52 |
msgstr ""
|
53 |
|
54 |
#: admin/class-advanced-ads-admin.php:220
|
55 |
+
#: modules/gadsense/includes/class-adsense-report.php:126
|
56 |
msgid "Today"
|
57 |
msgstr ""
|
58 |
|
59 |
#: admin/class-advanced-ads-admin.php:221
|
60 |
+
#: modules/gadsense/includes/class-adsense-report.php:127
|
61 |
msgid "Yesterday"
|
62 |
msgstr ""
|
63 |
|
64 |
#: admin/class-advanced-ads-admin.php:222
|
65 |
+
#: modules/gadsense/includes/class-adsense-report.php:130
|
66 |
msgid "This Month"
|
67 |
msgstr ""
|
68 |
|
69 |
#. translators: 1: The number of days.
|
70 |
#: admin/class-advanced-ads-admin.php:224
|
71 |
+
#: modules/gadsense/includes/class-adsense-report.php:129
|
72 |
+
#: modules/gadsense/includes/class-adsense-report.php:132
|
73 |
msgid "Last %1$d days"
|
74 |
msgstr ""
|
75 |
|
76 |
#: admin/class-advanced-ads-admin.php:227
|
77 |
+
#: modules/gadsense/admin/views/adsense-report.php:24
|
78 |
msgid "All"
|
79 |
msgstr ""
|
80 |
|
83 |
msgstr ""
|
84 |
|
85 |
#: admin/class-advanced-ads-admin.php:229
|
|
|
86 |
msgid "Show inactive ads"
|
87 |
msgstr ""
|
88 |
|
126 |
#. translators: %s is a list of PHP extensions.
|
127 |
#. Translators: %s is a name of a module.
|
128 |
#: admin/includes/ad-health-notices.php:54
|
129 |
+
#: admin/views/placements.php:388
|
130 |
msgid "Missing PHP extensions could cause issues. Please ask your hosting provider to enable them: %s"
|
131 |
msgstr ""
|
132 |
|
175 |
|
176 |
#: admin/includes/ad-health-notices.php:135
|
177 |
#: admin/includes/ad-health-notices.php:142
|
178 |
+
#: modules/gadsense/includes/class-mapi.php:98
|
179 |
msgid "Last AdSense account connection attempt failed."
|
180 |
msgstr ""
|
181 |
|
312 |
msgstr ""
|
313 |
|
314 |
#: admin/includes/class-ad-groups-list.php:339
|
315 |
+
#: admin/views/placements.php:275
|
316 |
#: modules/import-export/classes/import.php:153
|
317 |
#: modules/import-export/classes/import.php:193
|
318 |
#: modules/import-export/classes/import.php:595
|
321 |
msgstr ""
|
322 |
|
323 |
#: admin/includes/class-ad-groups-list.php:340
|
324 |
+
#: admin/views/placements.php:306
|
325 |
msgid "Usage"
|
326 |
msgstr ""
|
327 |
|
458 |
msgstr ""
|
459 |
|
460 |
#: admin/includes/class-admin-upgrades.php:107
|
461 |
+
#: admin/includes/class-overview-widgets.php:453
|
462 |
msgid "A quick and error-free way of implementing ad units from your Google Ad Manager account."
|
463 |
msgstr ""
|
464 |
|
643 |
msgstr ""
|
644 |
|
645 |
#: admin/includes/class-meta-box.php:104
|
646 |
+
#: admin/views/placements.php:184
|
647 |
+
#: admin/views/placements.php:429
|
648 |
#: classes/ad-debug.php:152
|
649 |
msgid "Display Conditions"
|
650 |
msgstr ""
|
651 |
|
652 |
#: admin/includes/class-meta-box.php:112
|
653 |
+
#: admin/views/placements.php:193
|
654 |
+
#: admin/views/placements.php:437
|
655 |
#: classes/ad-debug.php:239
|
656 |
msgid "Visitor Conditions"
|
657 |
msgstr ""
|
668 |
#: admin/includes/class-meta-box.php:220
|
669 |
#: admin/includes/class-meta-box.php:225
|
670 |
#: admin/includes/class-overview-widgets.php:179
|
671 |
+
#: admin/views/ad-main-metabox.php:29
|
672 |
+
#: admin/views/ad-output-metabox.php:65
|
673 |
#: admin/views/settings/general/custom-label.php:10
|
674 |
#: modules/ads-txt/admin/views/setting-create.php:11
|
675 |
#: modules/privacy/admin/views/setting-general.php:34
|
680 |
msgid "Video"
|
681 |
msgstr ""
|
682 |
|
683 |
+
#: admin/includes/class-meta-box.php:252
|
684 |
#: admin/includes/class-overview-widgets.php:61
|
685 |
msgid "Disable"
|
686 |
msgstr ""
|
687 |
|
688 |
+
#: admin/includes/class-meta-box.php:422
|
689 |
msgid "Ad Settings"
|
690 |
msgstr ""
|
691 |
|
692 |
+
#: admin/includes/class-meta-box.php:521
|
693 |
#: admin/views/overview.php:8
|
694 |
msgid "Ads Dashboard"
|
695 |
msgstr ""
|
696 |
|
697 |
#. translators: %1$d is the number of ads, %2$s and %3$s are URLs.
|
698 |
+
#: admin/includes/class-meta-box.php:537
|
699 |
msgid "%1$d ads – <a href=\"%2$s\">manage</a> - <a href=\"%3$s\">new</a>"
|
700 |
msgstr ""
|
701 |
|
702 |
+
#: admin/includes/class-meta-box.php:550
|
703 |
msgid "Get the tutorial via email"
|
704 |
msgstr ""
|
705 |
|
706 |
+
#: admin/includes/class-meta-box.php:559
|
707 |
msgid "Get AdSense tips via email"
|
708 |
msgstr ""
|
709 |
|
710 |
+
#: admin/includes/class-meta-box.php:568
|
711 |
msgid "Visit our blog for more articles about ad optimization"
|
712 |
msgstr ""
|
713 |
|
714 |
#. translators: %s is our URL.
|
715 |
+
#: admin/includes/class-meta-box.php:622
|
716 |
msgid "Latest posts on wpadvancedads.com"
|
717 |
msgstr ""
|
718 |
|
745 |
msgstr ""
|
746 |
|
747 |
#: admin/includes/class-overview-widgets.php:118
|
748 |
+
#: modules/gadsense/admin/views/adsense-account.php:73
|
749 |
+
#: modules/gadsense/admin/views/adsense-account.php:95
|
750 |
msgid "Connect to AdSense"
|
751 |
msgstr ""
|
752 |
|
801 |
msgid "Show %s hidden notices"
|
802 |
msgstr ""
|
803 |
|
804 |
+
#: admin/includes/class-overview-widgets.php:348
|
805 |
msgid "How to download, install and activate an add-on."
|
806 |
msgstr ""
|
807 |
|
808 |
+
#: admin/includes/class-overview-widgets.php:356
|
809 |
msgid "The solution for professional websites."
|
810 |
msgstr ""
|
811 |
|
812 |
+
#: admin/includes/class-overview-widgets.php:365
|
813 |
#: admin/views/upgrades/pro-tab.php:7
|
814 |
msgid "support for cached sites"
|
815 |
msgstr ""
|
816 |
|
817 |
#. translators: %s is the name of another plugin.
|
818 |
+
#: admin/includes/class-overview-widgets.php:381
|
819 |
+
#: admin/includes/class-overview-widgets.php:393
|
820 |
+
#: admin/includes/class-overview-widgets.php:405
|
821 |
+
#: admin/includes/class-overview-widgets.php:417
|
822 |
msgid "integrates with <strong>%s</strong>"
|
823 |
msgstr ""
|
824 |
|
825 |
+
#: admin/includes/class-overview-widgets.php:422
|
826 |
msgid "click fraud protection, lazy load, ad-block ads"
|
827 |
msgstr ""
|
828 |
|
829 |
+
#: admin/includes/class-overview-widgets.php:423
|
830 |
#: admin/views/upgrades/pro-tab.php:8
|
831 |
msgid "11 more display and visitor conditions"
|
832 |
msgstr ""
|
833 |
|
834 |
+
#: admin/includes/class-overview-widgets.php:424
|
835 |
#: admin/views/upgrades/pro-tab.php:9
|
836 |
msgid "6 more placements"
|
837 |
msgstr ""
|
838 |
|
839 |
+
#: admin/includes/class-overview-widgets.php:425
|
840 |
#: admin/views/upgrades/pro-tab.php:10
|
841 |
msgid "placement tests for ad optimization"
|
842 |
msgstr ""
|
843 |
|
844 |
+
#: admin/includes/class-overview-widgets.php:426
|
845 |
#: admin/views/upgrades/pro-tab.php:11
|
846 |
msgid "ad grids and many more advanced features"
|
847 |
msgstr ""
|
848 |
|
849 |
+
#: admin/includes/class-overview-widgets.php:441
|
850 |
msgid "Analyze clicks and impressions of your ads locally or in Google Analytics, share reports, and limit ads to a specific number of impressions or clicks."
|
851 |
msgstr ""
|
852 |
|
853 |
+
#: admin/includes/class-overview-widgets.php:447
|
854 |
msgid "Display ads based on the device or the size of your visitor’s browser, and control ads on AMP pages."
|
855 |
msgstr ""
|
856 |
|
857 |
+
#: admin/includes/class-overview-widgets.php:459
|
858 |
msgid "Increase click rates on your ads by placing them in sticky positions above, next or below your site."
|
859 |
msgstr ""
|
860 |
|
861 |
+
#: admin/includes/class-overview-widgets.php:465
|
862 |
msgid "Users will never miss an ad or other information in a PopUp. Choose when it shows up and for how long a user can close it."
|
863 |
msgstr ""
|
864 |
|
865 |
+
#: admin/includes/class-overview-widgets.php:471
|
866 |
msgid "Target visitors with ads that match their geo location and make more money with regional campaigns."
|
867 |
msgstr ""
|
868 |
|
869 |
+
#: admin/includes/class-overview-widgets.php:477
|
870 |
msgid "Earn more money and let advertisers pay for ad space directly on the frontend of your site."
|
871 |
msgstr ""
|
872 |
|
873 |
+
#: admin/includes/class-overview-widgets.php:483
|
874 |
msgid "Create a beautiful and simple slider from your ads to show more information on less space."
|
875 |
msgstr ""
|
876 |
|
877 |
+
#: admin/includes/class-overview-widgets.php:489
|
878 |
msgid "Place AdSense In-feed ads between posts on homepage, category, and archive pages."
|
879 |
msgstr ""
|
880 |
|
881 |
+
#: admin/includes/class-overview-widgets.php:492
|
882 |
+
#: admin/includes/class-overview-widgets.php:682
|
883 |
+
#: admin/includes/class-overview-widgets.php:698
|
884 |
msgid "Install now"
|
885 |
msgstr ""
|
886 |
|
887 |
+
#: admin/includes/class-overview-widgets.php:510
|
888 |
+
#: admin/includes/class-overview-widgets.php:528
|
889 |
+
#: admin/includes/class-overview-widgets.php:553
|
890 |
+
#: admin/includes/class-overview-widgets.php:571
|
891 |
+
#: admin/includes/class-overview-widgets.php:589
|
892 |
+
#: admin/includes/class-overview-widgets.php:607
|
893 |
+
#: admin/includes/class-overview-widgets.php:625
|
894 |
+
#: admin/includes/class-overview-widgets.php:643
|
895 |
+
#: admin/includes/class-overview-widgets.php:661
|
896 |
msgid "Activate now"
|
897 |
msgstr ""
|
898 |
|
899 |
+
#: admin/includes/class-overview-widgets.php:536
|
900 |
msgid "Visit your ad statistics"
|
901 |
msgstr ""
|
902 |
|
903 |
+
#: admin/includes/class-overview-widgets.php:678
|
904 |
msgid "Use Genesis specific ad positions."
|
905 |
msgstr ""
|
906 |
|
907 |
+
#: admin/includes/class-overview-widgets.php:694
|
908 |
msgid "Manage ad positions with WPBakery Page Builder (formerly Visual Composer)."
|
909 |
msgstr ""
|
910 |
|
911 |
+
#: admin/includes/class-overview-widgets.php:710
|
912 |
msgid "Our best deal with all add-ons included."
|
913 |
msgstr ""
|
914 |
|
915 |
+
#: admin/includes/class-overview-widgets.php:712
|
916 |
+
#: admin/includes/class-overview-widgets.php:728
|
917 |
msgid "Get full access"
|
918 |
msgstr ""
|
919 |
|
920 |
+
#: admin/includes/class-overview-widgets.php:726
|
921 |
msgid "A one-time payment for four years of support and updates. The package saves you up to 70% compared to individually purchasing our add-ons."
|
922 |
msgstr ""
|
923 |
|
924 |
+
#: admin/includes/class-overview-widgets.php:744
|
925 |
#: admin/views/conditions/ad-display-metabox.php:37
|
926 |
#: admin/views/conditions/ad-visitor-metabox.php:37
|
927 |
msgid "Visit the manual"
|
928 |
msgstr ""
|
929 |
|
930 |
+
#: admin/includes/class-overview-widgets.php:747
|
931 |
msgid "Get this add-on"
|
932 |
msgstr ""
|
933 |
|
1152 |
msgstr ""
|
1153 |
|
1154 |
#: admin/views/ad-group-edit.php:58
|
1155 |
+
#: admin/views/ad-output-metabox.php:50
|
1156 |
+
#: admin/views/ad-output-metabox.php:53
|
1157 |
msgid "An id-like string with only letters in lower case, numbers, and hyphens."
|
1158 |
msgstr ""
|
1159 |
|
1171 |
msgstr ""
|
1172 |
|
1173 |
#: admin/views/ad-group-list-ads.php:20
|
1174 |
+
#: admin/views/placements.php:347
|
1175 |
#: classes/ad-debug.php:118
|
1176 |
#: classes/ad-debug.php:167
|
1177 |
#: classes/ad-debug.php:169
|
1198 |
|
1199 |
#: admin/views/ad-group-list-form-row.php:56
|
1200 |
#: admin/views/placements.php:64
|
1201 |
+
#: admin/views/placements.php:257
|
1202 |
#: modules/gadsense/admin/views/adsense-ad-parameters.php:105
|
1203 |
msgid "Type"
|
1204 |
msgstr ""
|
1227 |
|
1228 |
#: admin/views/ad-group-list-row.php:22
|
1229 |
#: admin/views/ad-info.php:7
|
1230 |
+
#: admin/views/placements.php:310
|
1231 |
msgid "shortcode"
|
1232 |
msgstr ""
|
1233 |
|
1387 |
#: admin/views/placements-ad-label-position.php:13
|
1388 |
#: admin/views/placements-ad-label.php:9
|
1389 |
#: admin/views/placements-ad-label.php:11
|
1390 |
+
#: admin/views/placements.php:269
|
1391 |
+
#: modules/gadsense/includes/class-network-adsense.php:321
|
1392 |
msgid "default"
|
1393 |
msgstr ""
|
1394 |
|
1434 |
msgid "left:"
|
1435 |
msgstr ""
|
1436 |
|
1437 |
+
#: admin/views/ad-output-metabox.php:44
|
|
|
|
|
|
|
|
|
1438 |
msgid "container ID"
|
1439 |
msgstr ""
|
1440 |
|
1441 |
+
#: admin/views/ad-output-metabox.php:49
|
1442 |
msgid "Specify the id of the ad container. Leave blank for random or no id."
|
1443 |
msgstr ""
|
1444 |
|
1445 |
+
#: admin/views/ad-output-metabox.php:56
|
1446 |
msgid "container classes"
|
1447 |
msgstr ""
|
1448 |
|
1449 |
+
#: admin/views/ad-output-metabox.php:59
|
1450 |
msgid "Specify one or more classes for the container. Separate multiple classes with a space"
|
1451 |
msgstr ""
|
1452 |
|
1453 |
+
#: admin/views/ad-output-metabox.php:62
|
1454 |
msgid "Enable debug mode"
|
1455 |
msgstr ""
|
1456 |
|
1457 |
+
#: admin/views/ad-output-metabox.php:70
|
1458 |
msgid "Display only once"
|
1459 |
msgstr ""
|
1460 |
|
1461 |
+
#: admin/views/ad-output-metabox.php:73
|
1462 |
msgid "Display the ad only once per page"
|
1463 |
msgstr ""
|
1464 |
|
1465 |
+
#: admin/views/ad-output-metabox.php:81
|
1466 |
msgid "Custom Code"
|
1467 |
msgstr ""
|
1468 |
|
1469 |
+
#: admin/views/ad-output-metabox.php:84
|
1470 |
msgid "Place your own code below the ad"
|
1471 |
msgstr ""
|
1472 |
|
1714 |
msgid "Disabling the plugin now…"
|
1715 |
msgstr ""
|
1716 |
|
1717 |
+
#: admin/views/gadsense-dashboard.php:16
|
1718 |
msgid "There is an error in your AdSense setup."
|
1719 |
msgstr ""
|
1720 |
|
1721 |
#: admin/views/modal.php:36
|
1722 |
#: admin/views/modal.php:37
|
|
|
1723 |
#: admin/views/placements.php:320
|
1724 |
+
#: admin/views/placements.php:321
|
1725 |
msgid "Close"
|
1726 |
msgstr ""
|
1727 |
|
1728 |
#: admin/views/modal.php:39
|
1729 |
+
#: admin/views/placements.php:231
|
1730 |
msgid "Close and save"
|
1731 |
msgstr ""
|
1732 |
|
1997 |
msgstr ""
|
1998 |
|
1999 |
#: admin/views/placements.php:25
|
2000 |
+
#: admin/views/placements.php:465
|
2001 |
msgid "Create a new placement"
|
2002 |
msgstr ""
|
2003 |
|
2004 |
#: admin/views/placements.php:26
|
2005 |
+
#: admin/views/placements.php:467
|
2006 |
msgid "New Placement"
|
2007 |
msgstr ""
|
2008 |
|
2023 |
msgid "Delivery"
|
2024 |
msgstr ""
|
2025 |
|
2026 |
+
#: admin/views/placements.php:139
|
2027 |
msgid "show usage"
|
2028 |
msgstr ""
|
2029 |
|
2030 |
+
#: admin/views/placements.php:163
|
2031 |
msgid "ad label"
|
2032 |
msgstr ""
|
2033 |
|
2034 |
+
#: admin/views/placements.php:175
|
2035 |
msgid "Inline CSS"
|
2036 |
msgstr ""
|
2037 |
|
2038 |
+
#: admin/views/placements.php:186
|
2039 |
msgid "Use display conditions for placements."
|
2040 |
msgstr ""
|
2041 |
|
2042 |
+
#: admin/views/placements.php:187
|
2043 |
+
#: admin/views/placements.php:196
|
2044 |
msgid "The free version provides conditions on the ad edit page."
|
2045 |
msgstr ""
|
2046 |
|
2047 |
+
#: admin/views/placements.php:195
|
2048 |
msgid "Use visitor conditions for placements."
|
2049 |
msgstr ""
|
2050 |
|
2051 |
+
#: admin/views/placements.php:202
|
2052 |
msgid "Minimum Content Length"
|
2053 |
msgstr ""
|
2054 |
|
2055 |
+
#: admin/views/placements.php:204
|
2056 |
msgid "Minimum length of content before automatically injected ads are allowed in them."
|
2057 |
msgstr ""
|
2058 |
|
2059 |
+
#: admin/views/placements.php:210
|
2060 |
msgid "Words Between Ads"
|
2061 |
msgstr ""
|
2062 |
|
2063 |
+
#: admin/views/placements.php:212
|
2064 |
msgid "A minimum amount of words between automatically injected ads."
|
2065 |
msgstr ""
|
2066 |
|
2067 |
+
#: admin/views/placements.php:230
|
2068 |
#: modules/import-export/views/page.php:26
|
2069 |
msgid "Options"
|
2070 |
msgstr ""
|
2071 |
|
2072 |
#. Translators: %s is the name of a placement.
|
2073 |
+
#: admin/views/placements.php:242
|
2074 |
msgid "Placement type \"%s\" is missing and was reset to \"default\".<br/>Please check if the responsible add-on is activated."
|
2075 |
msgstr ""
|
2076 |
|
2077 |
+
#: admin/views/placements.php:313
|
2078 |
msgid "template (PHP)"
|
2079 |
msgstr ""
|
2080 |
|
2081 |
+
#: admin/views/placements.php:348
|
2082 |
msgid "Group"
|
2083 |
msgstr ""
|
2084 |
|
2085 |
+
#: admin/views/placements.php:364
|
2086 |
msgid "after"
|
2087 |
msgstr ""
|
2088 |
|
2089 |
+
#: admin/views/placements.php:365
|
2090 |
msgid "before"
|
2091 |
msgstr ""
|
2092 |
|
2093 |
+
#: admin/views/placements.php:378
|
2094 |
msgid "position"
|
2095 |
msgstr ""
|
2096 |
|
2097 |
+
#: admin/views/placements.php:384
|
2098 |
msgid "Important Notice"
|
2099 |
msgstr ""
|
2100 |
|
2101 |
#. Translators: %s is a URL.
|
2102 |
+
#: admin/views/placements.php:407
|
2103 |
msgid "Tutorial: <a href=\"%s\" target=\"_blank\">How to place visible ads in the header of your website</a>."
|
2104 |
msgstr ""
|
2105 |
|
2106 |
+
#: admin/views/placements.php:423
|
2107 |
msgid "show all options"
|
2108 |
msgstr ""
|
2109 |
|
2110 |
+
#: admin/views/placements.php:446
|
2111 |
msgid "edit conditions"
|
2112 |
msgstr ""
|
2113 |
|
2114 |
+
#: admin/views/placements.php:456
|
2115 |
msgctxt "checkbox to remove placement"
|
2116 |
msgid "delete"
|
2117 |
msgstr ""
|
2118 |
|
2119 |
+
#: admin/views/placements.php:463
|
2120 |
msgid "Save Placements"
|
2121 |
msgstr ""
|
2122 |
|
2244 |
msgid "e.g. archive pages like categories, tags, authors, front page (if a list)"
|
2245 |
msgstr ""
|
2246 |
|
2247 |
+
#: admin/views/settings/general/disable-ads.php:25
|
2248 |
msgid "Disable ads on secondary queries"
|
2249 |
msgstr ""
|
2250 |
|
2251 |
+
#: admin/views/settings/general/disable-ads.php:26
|
2252 |
msgid "Secondary queries are custom queries of posts outside the main query of a page. Try this option if you see ads injected on places where they shouldn’t appear."
|
2253 |
msgstr ""
|
2254 |
|
2255 |
+
#: admin/views/settings/general/disable-ads.php:32
|
2256 |
msgid "Disable ads in RSS Feed"
|
2257 |
msgstr ""
|
2258 |
|
2259 |
+
#: admin/views/settings/general/disable-ads.php:38
|
2260 |
msgid "Disable ads in REST API"
|
2261 |
msgstr ""
|
2262 |
|
2534 |
|
2535 |
#. translators: %1$s is an anchor (link) opening tag, %2$s is the closing tag.
|
2536 |
#: classes/ad-health-notices.php:865
|
2537 |
+
#: modules/gadsense/includes/class-mapi.php:1648
|
2538 |
msgid "Learn more about AdSense account issues %1$shere%2$s."
|
2539 |
msgstr ""
|
2540 |
|
2739 |
msgid "Allow PHP"
|
2740 |
msgstr ""
|
2741 |
|
2742 |
+
#: classes/ad_type_plain.php:100
|
2743 |
msgid "Execute PHP code (wrapped in <code><?php ?></code>)"
|
2744 |
msgstr ""
|
2745 |
|
2746 |
+
#: classes/ad_type_plain.php:109
|
2747 |
msgid "No PHP tag detected in your code."
|
2748 |
msgstr ""
|
2749 |
|
2750 |
+
#: classes/ad_type_plain.php:109
|
2751 |
+
#: classes/ad_type_plain.php:134
|
2752 |
msgid "Uncheck this checkbox for improved performance."
|
2753 |
msgstr ""
|
2754 |
|
2755 |
+
#: classes/ad_type_plain.php:125
|
|
|
|
|
|
|
|
|
2756 |
msgid "Execute shortcodes"
|
2757 |
msgstr ""
|
2758 |
|
2759 |
+
#: classes/ad_type_plain.php:134
|
2760 |
msgid "No shortcode detected in your code."
|
2761 |
msgstr ""
|
2762 |
|
3134 |
msgstr ""
|
3135 |
|
3136 |
#: classes/frontend_checks.php:882
|
3137 |
+
#: modules/gadsense/includes/class-network-adsense.php:224
|
3138 |
msgid "Display Auto ads only on specific pages"
|
3139 |
msgstr ""
|
3140 |
|
3344 |
msgid "Ad blocker counter"
|
3345 |
msgstr ""
|
3346 |
|
3347 |
+
#: modules/adblock-finder/admin/views/setting-ga.php:10
|
3348 |
msgid "Google Analytics Tracking ID"
|
3349 |
msgstr ""
|
3350 |
|
3351 |
#: modules/adblock-finder/admin/views/setting-ga.php:14
|
3352 |
+
msgid "Do you want to know how many of your visitors are using an ad blocker? Enter your Google Analytics property ID above to count them."
|
3353 |
msgstr ""
|
3354 |
|
3355 |
#. translators: 1: is an example id for Universal Analytics <code>UA-123456-1</code>, 2: is an example id for GA4 '<code>G-A12BC3D456</code>'
|
3377 |
msgid "Move the content of the existing ads.txt file into Advanced Ads and remove it."
|
3378 |
msgstr ""
|
3379 |
|
3380 |
+
#. translators: %s is replaced with an error message.
|
3381 |
#: modules/ads-txt/admin/class-advanced-ads-ads-txt-admin.php:224
|
3382 |
+
#: modules/ads-txt/admin/views/setting-additional-content.php:32
|
3383 |
msgid "An error occured: %s."
|
3384 |
msgstr ""
|
3385 |
|
3413 |
msgid "Additional records to add to the file, one record per line. AdSense is added automatically."
|
3414 |
msgstr ""
|
3415 |
|
3416 |
+
#: modules/ads-txt/admin/views/setting-additional-content.php:35
|
3417 |
msgid "Check for problems"
|
3418 |
msgstr ""
|
3419 |
|
3420 |
+
#: modules/ads-txt/admin/views/setting-additional-content.php:36
|
3421 |
msgid "Preview"
|
3422 |
msgstr ""
|
3423 |
|
3457 |
msgstr ""
|
3458 |
|
3459 |
#: modules/gadsense/admin/views/adsense-account.php:30
|
3460 |
+
#: modules/gadsense/admin/views/adsense-account.php:64
|
3461 |
msgid "dismiss"
|
3462 |
msgstr ""
|
3463 |
|
3464 |
+
#: modules/gadsense/admin/views/adsense-account.php:76
|
3465 |
msgid "Revoke API acccess"
|
3466 |
msgstr ""
|
3467 |
|
3468 |
+
#: modules/gadsense/admin/views/adsense-account.php:82
|
3469 |
msgid "Account holder name"
|
3470 |
msgstr ""
|
3471 |
|
3472 |
+
#: modules/gadsense/admin/views/adsense-account.php:85
|
3473 |
#: modules/gadsense/includes/class-ad-type-adsense.php:91
|
3474 |
msgid "The Publisher ID has an incorrect format. (must start with \"pub-\")"
|
3475 |
msgstr ""
|
3476 |
|
3477 |
+
#: modules/gadsense/admin/views/adsense-account.php:87
|
3478 |
msgid "Your AdSense Publisher ID <em>(pub-xxxxxxxxxxxxxx)</em>"
|
3479 |
msgstr ""
|
3480 |
|
3481 |
+
#: modules/gadsense/admin/views/adsense-account.php:94
|
3482 |
msgid "Yes, I have an AdSense account"
|
3483 |
msgstr ""
|
3484 |
|
3485 |
+
#: modules/gadsense/admin/views/adsense-account.php:96
|
3486 |
msgid "Configure everything manually"
|
3487 |
msgstr ""
|
3488 |
|
3489 |
+
#: modules/gadsense/admin/views/adsense-account.php:99
|
3490 |
msgid "No, I still don't have an AdSense account"
|
3491 |
msgstr ""
|
3492 |
|
3493 |
+
#: modules/gadsense/admin/views/adsense-account.php:100
|
3494 |
msgid "Get a free AdSense account"
|
3495 |
msgstr ""
|
3496 |
|
3497 |
#. translators: %1$s is an opening a tag, %2$s is the closing one
|
3498 |
+
#: modules/gadsense/admin/views/adsense-account.php:106
|
3499 |
+
#: modules/gadsense/admin/views/adsense-account.php:197
|
3500 |
msgid "See all %1$srecommended ad networks%2$s."
|
3501 |
msgstr ""
|
3502 |
|
3503 |
+
#: modules/gadsense/admin/views/adsense-account.php:171
|
3504 |
msgid "How to choose specific positions for AdSense ad units"
|
3505 |
msgstr ""
|
3506 |
|
3507 |
#. translators: %1$s is the opening link tag to our manual; %2$s is the appropriate closing link tag; %3$s is the opening link tag to our help forum; %4$s is the appropriate closing link tag
|
3508 |
+
#: modules/gadsense/admin/views/adsense-account.php:179
|
3509 |
msgid "Problems with AdSense? Check out the %1$smanual%2$s or %3$sask here%4$s."
|
3510 |
msgstr ""
|
3511 |
|
3512 |
+
#: modules/gadsense/admin/views/adsense-account.php:211
|
3513 |
#: modules/gadsense/admin/views/external-ads-links.php:38
|
3514 |
msgid "Can not connect AdSense account. PHP version is too low."
|
3515 |
msgstr ""
|
3642 |
msgid "Connect to %1$s"
|
3643 |
msgstr ""
|
3644 |
|
3645 |
+
#: modules/gadsense/admin/views/external-ads-list.php:29
|
3646 |
+
msgid "Hide archived ads"
|
3647 |
+
msgstr ""
|
3648 |
+
|
3649 |
+
#: modules/gadsense/admin/views/external-ads-list.php:29
|
3650 |
+
msgid "Show archived ads"
|
3651 |
+
msgstr ""
|
3652 |
+
|
3653 |
#: modules/gadsense/admin/views/external-ads-list.php:30
|
3654 |
+
#: modules/gadsense/admin/views/external-ads-list.php:63
|
3655 |
msgid "Update the ad units list"
|
3656 |
msgstr ""
|
3657 |
|
3673 |
msgstr ""
|
3674 |
|
3675 |
#: modules/gadsense/admin/views/external-ads-list.php:61
|
3676 |
+
msgid "No ad units found"
|
|
|
|
|
|
|
|
|
3677 |
msgstr ""
|
3678 |
|
3679 |
+
#: modules/gadsense/admin/views/external-ads-list.php:83
|
3680 |
+
msgid "Archived"
|
3681 |
msgstr ""
|
3682 |
|
3683 |
+
#: modules/gadsense/admin/views/external-ads-list.php:92
|
3684 |
msgid "Get the code for this ad"
|
3685 |
msgstr ""
|
3686 |
|
3687 |
+
#: modules/gadsense/admin/views/external-ads-list.php:97
|
3688 |
msgid "Ad can't be imported, click for details"
|
3689 |
msgstr ""
|
3690 |
|
3691 |
+
#: modules/gadsense/admin/views/external-ads-list.php:109
|
3692 |
msgid "Unrecognized ad code"
|
3693 |
msgstr ""
|
3694 |
|
3695 |
+
#: modules/gadsense/admin/views/external-ads-list.php:115
|
3696 |
msgid "This ad type can currently not be imported from AdSense."
|
3697 |
msgstr ""
|
3698 |
|
3699 |
+
#: modules/gadsense/admin/views/external-ads-list.php:118
|
3700 |
msgid "You can proceed with one of the following solutions"
|
3701 |
msgstr ""
|
3702 |
|
3703 |
#. Translators: 1: opening tag for AdSense account link 2: opening tag for a link to insert ad code 3: closing a tag
|
3704 |
+
#: modules/gadsense/admin/views/external-ads-list.php:124
|
3705 |
msgid "%1$sCopy the code from your AdSense account%3$s and %2$sinsert a new AdSense code here%3$s."
|
3706 |
msgstr ""
|
3707 |
|
3708 |
#. Translators: 1: opening tag for a link to create an ad manually 2: closing a tag
|
3709 |
+
#: modules/gadsense/admin/views/external-ads-list.php:130
|
3710 |
msgid "%1$sCreate an AdSense code manually%2$s: Select the <em>Normal</em> or <em>Responsive</em> type and the size."
|
3711 |
msgstr ""
|
3712 |
|
3713 |
+
#: modules/gadsense/admin/views/external-ads-list.php:137
|
3714 |
msgid "Choose a different ad from your AdSense account above."
|
3715 |
msgstr ""
|
3716 |
|
3718 |
msgid "Enable AMP Auto ads"
|
3719 |
msgstr ""
|
3720 |
|
3721 |
+
#. translators: AdSense ID.
|
3722 |
+
#: modules/gadsense/includes/adsense-report-api.php:129
|
3723 |
+
msgid "Error while retrieving report for \"%s\"."
|
3724 |
+
msgstr ""
|
3725 |
+
|
3726 |
+
#. translators: AdSense ID.
|
3727 |
+
#: modules/gadsense/includes/adsense-report-api.php:140
|
3728 |
+
#: modules/gadsense/includes/adsense-report-api.php:149
|
3729 |
+
msgid "Invalid response while retrieving report for \"%s\"."
|
3730 |
+
msgstr ""
|
3731 |
+
|
3732 |
#: modules/gadsense/includes/class-ad-type-adsense.php:34
|
3733 |
msgid "AdSense ad"
|
3734 |
msgstr ""
|
3741 |
msgid "Your AdSense Publisher ID is missing."
|
3742 |
msgstr ""
|
3743 |
|
3744 |
+
#: modules/gadsense/includes/class-adsense-report.php:82
|
3745 |
+
msgid "No valid tokens"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3746 |
msgstr ""
|
3747 |
|
3748 |
#: modules/gadsense/includes/class-gadsense-data.php:40
|
3749 |
msgid "Auto"
|
3750 |
msgstr ""
|
3751 |
|
3752 |
+
#. translators: %s: ad unit ID.
|
3753 |
+
#: modules/gadsense/includes/class-mapi.php:371
|
3754 |
msgid "Error while retrieving ad code for \"%s\"."
|
3755 |
msgstr ""
|
3756 |
|
3757 |
+
#. translators: %s: ad unit ID.
|
3758 |
+
#: modules/gadsense/includes/class-mapi.php:399
|
3759 |
msgid "Invalid response while retrieving ad code for \"%s\"."
|
3760 |
msgstr ""
|
3761 |
|
3762 |
#. translators: the publisher ID.
|
3763 |
+
#: modules/gadsense/includes/class-mapi.php:458
|
3764 |
+
#: modules/gadsense/includes/class-mapi.php:528
|
3765 |
msgid "Error while retrieving adUnits list for \"%s\"."
|
3766 |
msgstr ""
|
3767 |
|
3768 |
#. translators: %s is the publisher ID.
|
3769 |
+
#: modules/gadsense/includes/class-mapi.php:466
|
3770 |
msgid "Invalid response while retrieving adUnits list for \"%s\"."
|
3771 |
msgstr ""
|
3772 |
|
3773 |
+
#: modules/gadsense/includes/class-mapi.php:474
|
3774 |
msgid "Reason:"
|
3775 |
msgstr ""
|
3776 |
|
3777 |
+
#: modules/gadsense/includes/class-mapi.php:475
|
3778 |
msgid "Message:"
|
3779 |
msgstr ""
|
3780 |
|
3781 |
#. translators: %1$s is the AdSense publisher ID; %2$s a starting a tag to the AdSense ad unit list and %3$s the closing link.
|
3782 |
+
#: modules/gadsense/includes/class-mapi.php:489
|
3783 |
msgid "The account \"%1$s\" does not seem to have any ad units. Please create some %2$shere%3$s."
|
3784 |
msgstr ""
|
3785 |
|
3786 |
+
#: modules/gadsense/includes/class-mapi.php:606
|
3787 |
msgid "It seems that some changes have been made in the Advanced Ads settings. Please refresh this page."
|
3788 |
msgstr ""
|
3789 |
|
3790 |
+
#: modules/gadsense/includes/class-mapi.php:613
|
3791 |
msgid "Advanced Ads does not have access to your account (<code>%s</code>) anymore."
|
3792 |
msgstr ""
|
3793 |
|
3794 |
+
#: modules/gadsense/includes/class-mapi.php:657
|
3795 |
msgid "error while renewing access token for \"%s\""
|
3796 |
msgstr ""
|
3797 |
|
3798 |
#. translators: %s AdSense account ID
|
3799 |
+
#: modules/gadsense/includes/class-mapi.php:684
|
3800 |
msgid "invalid response received while renewing access token for \"%s\""
|
3801 |
msgstr ""
|
3802 |
|
3803 |
+
#: modules/gadsense/includes/class-mapi.php:686
|
3804 |
msgid "You could try to connect again under Advanced Ads > Settings > AdSense."
|
3805 |
msgstr ""
|
3806 |
|
3807 |
+
#: modules/gadsense/includes/class-mapi.php:755
|
3808 |
msgid "This ad code is from a different AdSense Account"
|
3809 |
msgstr ""
|
3810 |
|
3811 |
+
#: modules/gadsense/includes/class-mapi.php:992
|
3812 |
msgid "Invalid response body while retrieving account alerts"
|
3813 |
msgstr ""
|
3814 |
|
3815 |
+
#: modules/gadsense/includes/class-mapi.php:1001
|
3816 |
msgid "error while retrieving account alerts"
|
3817 |
msgstr ""
|
3818 |
|
3819 |
+
#: modules/gadsense/includes/class-mapi.php:1118
|
3820 |
msgid "No token provided. Token data needed to get account details."
|
3821 |
msgstr ""
|
3822 |
|
3823 |
+
#: modules/gadsense/includes/class-mapi.php:1138
|
3824 |
+
#: modules/gadsense/includes/class-mapi.php:1142
|
3825 |
+
msgid "No AdSense account data found."
|
3826 |
msgstr ""
|
3827 |
|
3828 |
+
#: modules/gadsense/includes/class-mapi.php:1394
|
3829 |
+
#: modules/gadsense/includes/class-mapi.php:1412
|
3830 |
+
#: modules/gadsense/includes/class-network-adsense.php:514
|
3831 |
msgctxt "AdSense ad type"
|
3832 |
msgid "Matched Content"
|
3833 |
msgstr ""
|
3834 |
|
3835 |
+
#: modules/gadsense/includes/class-mapi.php:1397
|
3836 |
+
#: modules/gadsense/includes/class-mapi.php:1415
|
3837 |
+
#: modules/gadsense/includes/class-network-adsense.php:515
|
3838 |
msgctxt "AdSense ad type"
|
3839 |
msgid "In-article"
|
3840 |
msgstr ""
|
3841 |
|
3842 |
+
#: modules/gadsense/includes/class-mapi.php:1399
|
3843 |
+
#: modules/gadsense/includes/class-mapi.php:1418
|
3844 |
+
#: modules/gadsense/includes/class-network-adsense.php:516
|
3845 |
msgctxt "AdSense ad type"
|
3846 |
msgid "In-feed"
|
3847 |
msgstr ""
|
3848 |
|
3849 |
+
#: modules/gadsense/includes/class-mapi.php:1406
|
3850 |
+
#: modules/gadsense/includes/class-network-adsense.php:517
|
3851 |
msgctxt "AdSense ad type"
|
3852 |
msgid "Display"
|
3853 |
msgstr ""
|
3854 |
|
3855 |
+
#: modules/gadsense/includes/class-mapi.php:1409
|
3856 |
+
#: modules/gadsense/includes/class-network-adsense.php:518
|
3857 |
msgctxt "AdSense ad type"
|
3858 |
msgid "Link"
|
3859 |
msgstr ""
|
3860 |
|
3861 |
+
#: modules/gadsense/includes/class-mapi.php:1615
|
3862 |
msgid "There are one or more warnings about the currently linked AdSense account. You can view them <a href=\"%s\">here</a>"
|
3863 |
msgstr ""
|
3864 |
|
3865 |
#. translators: 1:A link to the settings page translators: 2:The name of an ad network
|
3866 |
+
#: modules/gadsense/includes/class-mapi.php:1702
|
3867 |
msgid "Please try to <a href=\"%1$s\" target=\"_blank\">reconnect to your %2$s account</a>."
|
3868 |
msgstr ""
|
3869 |
|
3901 |
msgstr ""
|
3902 |
|
3903 |
#. Translators: $d a number of ads.
|
3904 |
+
#: modules/gadsense/includes/class-network-adsense.php:163
|
3905 |
msgid "Limit to %d AdSense ads"
|
3906 |
msgstr ""
|
3907 |
|
3908 |
+
#: modules/gadsense/includes/class-network-adsense.php:170
|
3909 |
msgid "There is no explicit limit for AdSense ads anymore, but you can still use this setting to prevent too many AdSense ads to show accidentally on your site."
|
3910 |
msgstr ""
|
3911 |
|
3912 |
+
#: modules/gadsense/includes/class-network-adsense.php:177
|
3913 |
msgid "Due to technical restrictions, the limit does not work on placements with cache-busting enabled."
|
3914 |
msgstr ""
|
3915 |
|
3916 |
+
#: modules/gadsense/includes/class-network-adsense.php:191
|
3917 |
msgid "Enable this box if you don’t want Google Auto ads to place anchor ads at the top of your page."
|
3918 |
msgstr ""
|
3919 |
|
3920 |
+
#: modules/gadsense/includes/class-network-adsense.php:205
|
3921 |
msgid "Enable this option to stop loading stats from AdSense into your WordPress backend."
|
3922 |
msgstr ""
|
3923 |
|
3924 |
+
#: modules/gadsense/includes/class-network-adsense.php:221
|
3925 |
msgid "Insert the AdSense header code to enable Auto ads and verify your website."
|
3926 |
msgstr ""
|
3927 |
|
3928 |
+
#: modules/gadsense/includes/class-network-adsense.php:225
|
3929 |
msgid "Why are ads appearing in random positions?"
|
3930 |
msgstr ""
|
3931 |
|
3932 |
#. translators: this is the text for a link to a sub-page in an AdSense account
|
3933 |
+
#: modules/gadsense/includes/class-network-adsense.php:232
|
3934 |
msgid "Adjust Auto ads options"
|
3935 |
msgstr ""
|
3936 |
|
3937 |
+
#: modules/gadsense/includes/class-network-adsense.php:277
|
3938 |
msgid "Disable warnings about potential violations of the AdSense terms."
|
3939 |
msgstr ""
|
3940 |
|
3941 |
#. translators: %s is a URL.
|
3942 |
+
#: modules/gadsense/includes/class-network-adsense.php:283
|
3943 |
msgid "Our <a href=\"%s\" target=\"_blank\">Ad Health</a> feature monitors if AdSense is implemented correctly on your site. It also considers ads not managed with Advanced Ads. Enable this option to remove these checks"
|
3944 |
msgstr ""
|
3945 |
|
3946 |
+
#: modules/gadsense/includes/class-network-adsense.php:308
|
3947 |
msgid "Enable this option in case your theme adds an unfortunate background color to AdSense ads."
|
3948 |
msgstr ""
|
3949 |
|
3950 |
+
#: modules/gadsense/includes/class-network-adsense.php:322
|
3951 |
msgid "enable"
|
3952 |
msgstr ""
|
3953 |
|
3954 |
+
#: modules/gadsense/includes/class-network-adsense.php:323
|
3955 |
msgid "disable"
|
3956 |
msgstr ""
|
3957 |
|
3958 |
#. translators: %s is a URL.
|
3959 |
+
#: modules/gadsense/includes/class-network-adsense.php:330
|
3960 |
msgid "Whether your responsive ad unit may expand to <a href='%s' target='blank'>use the full width</a> of your visitor's mobile device screen"
|
3961 |
msgstr ""
|
3962 |
|
modules/ad-blocker/admin/views/rebuild_form.php
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
<h3 class="title"><?php _e( 'Ad blocker file folder', 'advanced-ads' ); ?></h3>
|
2 |
-
<?php
|
3 |
$button_attrs = ( isset( $button_attrs ) ) ? $button_attrs : array();
|
4 |
|
5 |
if ( ! empty( $message ) && isset( $success ) ): ?>
|
6 |
<div class="<?php echo $success ? 'updated' : 'error'; ?> notice is-dismissible"><p><?php echo $message;?></p></div>
|
7 |
-
<?php endif;
|
8 |
|
9 |
if ( ! $this->upload_dir ): ?>
|
10 |
-
<p class="advads-error
|
11 |
<?php
|
12 |
else: ?>
|
13 |
<form id="advanced-ads-rebuild-assets-form" method="post" action="">
|
@@ -31,19 +31,19 @@
|
|
31 |
<th scope="row"><?php _e( 'Rename assets', 'advanced-ads' ); ?></th>
|
32 |
<td>
|
33 |
<input type="checkbox" name="advads_ab_assign_new_folder">
|
34 |
-
<p class="description"><?php _e( 'Check if you want to change the names of the assets', 'advanced-ads' ); ?></p>
|
35 |
</td>
|
36 |
</tr>
|
37 |
</tbody>
|
38 |
</table>
|
39 |
<?php
|
40 |
-
else: ?>
|
41 |
<p><?php
|
42 |
-
$folder = ! empty( $this->options['folder_name'] ) ? trailingslashit( $this->upload_dir['basedir'] ) . $this->options['folder_name'] : $this->upload_dir['basedir'];
|
43 |
-
printf( __( 'Please, rebuild the asset folder. All assets will be located in <strong>%s</strong>', 'advanced-ads' ), $folder ); ?></p>
|
44 |
<?php
|
45 |
endif;
|
46 |
submit_button( __( 'Rebuild asset folder', 'advanced-ads' ), 'primary', 'submit', true, $button_attrs ); ?>
|
47 |
</form>
|
48 |
<?php
|
49 |
-
endif; ?>
|
1 |
<h3 class="title"><?php _e( 'Ad blocker file folder', 'advanced-ads' ); ?></h3>
|
2 |
+
<?php
|
3 |
$button_attrs = ( isset( $button_attrs ) ) ? $button_attrs : array();
|
4 |
|
5 |
if ( ! empty( $message ) && isset( $success ) ): ?>
|
6 |
<div class="<?php echo $success ? 'updated' : 'error'; ?> notice is-dismissible"><p><?php echo $message;?></p></div>
|
7 |
+
<?php endif;
|
8 |
|
9 |
if ( ! $this->upload_dir ): ?>
|
10 |
+
<p class="advads-notice-inline advads-error"><?php esc_html_e( 'Upload folder is not writable', 'advanced-ads' ); ?></p>
|
11 |
<?php
|
12 |
else: ?>
|
13 |
<form id="advanced-ads-rebuild-assets-form" method="post" action="">
|
31 |
<th scope="row"><?php _e( 'Rename assets', 'advanced-ads' ); ?></th>
|
32 |
<td>
|
33 |
<input type="checkbox" name="advads_ab_assign_new_folder">
|
34 |
+
<p class="description"><?php _e( 'Check if you want to change the names of the assets', 'advanced-ads' ); ?></p>
|
35 |
</td>
|
36 |
</tr>
|
37 |
</tbody>
|
38 |
</table>
|
39 |
<?php
|
40 |
+
else: ?>
|
41 |
<p><?php
|
42 |
+
$folder = ! empty( $this->options['folder_name'] ) ? trailingslashit( $this->upload_dir['basedir'] ) . $this->options['folder_name'] : $this->upload_dir['basedir'];
|
43 |
+
printf( __( 'Please, rebuild the asset folder. All assets will be located in <strong>%s</strong>', 'advanced-ads' ), $folder ); ?></p>
|
44 |
<?php
|
45 |
endif;
|
46 |
submit_button( __( 'Rebuild asset folder', 'advanced-ads' ), 'primary', 'submit', true, $button_attrs ); ?>
|
47 |
</form>
|
48 |
<?php
|
49 |
+
endif; ?>
|
modules/adblock-finder/admin/views/setting-ga.php
CHANGED
@@ -6,12 +6,12 @@
|
|
6 |
*/
|
7 |
?>
|
8 |
<label>
|
9 |
-
<?php esc_html_e( 'Google Analytics Tracking ID', 'advanced-ads' ); ?><br/>
|
10 |
<input type="text" name="<?php echo esc_attr( ADVADS_SLUG ); ?>[ga-UID]" value="<?php echo esc_attr( $ga_uid ); ?>"/>
|
|
|
11 |
</label>
|
12 |
|
13 |
<p class="description">
|
14 |
-
<?php esc_html_e( '
|
15 |
<br>
|
16 |
<?php
|
17 |
printf(
|
6 |
*/
|
7 |
?>
|
8 |
<label>
|
|
|
9 |
<input type="text" name="<?php echo esc_attr( ADVADS_SLUG ); ?>[ga-UID]" value="<?php echo esc_attr( $ga_uid ); ?>"/>
|
10 |
+
<?php esc_html_e( 'Google Analytics Tracking ID', 'advanced-ads' ); ?>
|
11 |
</label>
|
12 |
|
13 |
<p class="description">
|
14 |
+
<?php esc_html_e( 'Do you want to know how many of your visitors are using an ad blocker? Enter your Google Analytics property ID above to count them.', 'advanced-ads' ); ?>
|
15 |
<br>
|
16 |
<?php
|
17 |
printf(
|
modules/ads-txt/admin/class-advanced-ads-ads-txt-admin.php
CHANGED
@@ -349,7 +349,7 @@ class Advanced_Ads_Ads_Txt_Admin {
|
|
349 |
if ( 'remove_real_file' === $_REQUEST['type'] ) {
|
350 |
$remove = $this->remove_real_file();
|
351 |
if ( is_wp_error( $remove ) ) {
|
352 |
-
$action_notices[] = array( 'advads-ads-txt-updated advads-error
|
353 |
} else {
|
354 |
$action_notices[] = array( 'advads-ads-txt-updated', __( 'The ads.txt is now managed with Advanced Ads.', 'advanced-ads' ) );
|
355 |
$options = $this->strategy->get_options();
|
349 |
if ( 'remove_real_file' === $_REQUEST['type'] ) {
|
350 |
$remove = $this->remove_real_file();
|
351 |
if ( is_wp_error( $remove ) ) {
|
352 |
+
$action_notices[] = array( 'advads-ads-txt-updated advads-notice-inline advads-error', $remove->get_error_message() );
|
353 |
} else {
|
354 |
$action_notices[] = array( 'advads-ads-txt-updated', __( 'The ads.txt is now managed with Advanced Ads.', 'advanced-ads' ) );
|
355 |
$options = $this->strategy->get_options();
|
modules/ads-txt/admin/views/setting-additional-content.php
CHANGED
@@ -26,6 +26,11 @@
|
|
26 |
echo $notices;
|
27 |
?>
|
28 |
</div>
|
29 |
-
<p class="advads-
|
|
|
|
|
|
|
|
|
|
|
30 |
<button class="button advads-ads-txt-action" type="button" id="advads-ads-txt-notice-refresh"><?php esc_html_e( 'Check for problems', 'advanced-ads' ); ?></button>
|
31 |
<a href="<?php echo esc_url( $link ); ?>" class="button" target="_blank"><?php esc_html_e( 'Preview', 'advanced-ads' ); ?></button>
|
26 |
echo $notices;
|
27 |
?>
|
28 |
</div>
|
29 |
+
<p class="advads-notice-inline advads-error hidden" id="advads-ads-txt-notice-error">
|
30 |
+
<?php
|
31 |
+
// translators: %s is replaced with an error message.
|
32 |
+
esc_html_e( 'An error occured: %s.', 'advanced-ads' );
|
33 |
+
?>
|
34 |
+
</p>
|
35 |
<button class="button advads-ads-txt-action" type="button" id="advads-ads-txt-notice-refresh"><?php esc_html_e( 'Check for problems', 'advanced-ads' ); ?></button>
|
36 |
<a href="<?php echo esc_url( $link ); ?>" class="button" target="_blank"><?php esc_html_e( 'Preview', 'advanced-ads' ); ?></button>
|
modules/gadsense/admin/admin.php
CHANGED
@@ -186,7 +186,7 @@ class Advanced_Ads_AdSense_Admin {
|
|
186 |
__( 'Responsive AdSense ads don’t work reliably with <em>Position</em> set to left or right. Either switch the <em>Type</em> to "normal" or follow <a href="%s" target="_blank">this tutorial</a> if you want the ad to be wrapped in text.', 'advanced-ads' ),
|
187 |
ADVADS_URL . 'adsense-responsive-custom-sizes/#utm_source=advanced-ads&utm_medium=link&utm_campaign=adsense-custom-sizes-tutorial'
|
188 |
),
|
189 |
-
'class' => 'advads-ad-notice-responsive-position error hidden',
|
190 |
);
|
191 |
// Show hint about AdSense In-feed add-on.
|
192 |
if ( ! class_exists( 'Advanced_Ads_In_Feed', false ) ) {
|
@@ -199,7 +199,7 @@ class Advanced_Ads_AdSense_Admin {
|
|
199 |
'install-plugin_advanced-ads-adsense-in-feed'
|
200 |
)
|
201 |
),
|
202 |
-
'class' => 'advads-ad-notice-in-feed-add-on hidden',
|
203 |
);
|
204 |
}
|
205 |
break;
|
@@ -213,7 +213,7 @@ class Advanced_Ads_AdSense_Admin {
|
|
213 |
*/
|
214 |
public static function enqueue_connect_adsense() {
|
215 |
if ( ! wp_script_is( 'advads/connect-adsense', 'registered' ) ) {
|
216 |
-
wp_enqueue_script( 'advads/connect-adsense', GADSENSE_BASE_URL . 'admin/assets/js/connect-adsense.js', array( 'jquery' ),
|
217 |
}
|
218 |
if ( ! has_action( 'admin_footer', array( 'Advanced_Ads_AdSense_Admin', 'print_connect_adsense' ) ) ) {
|
219 |
add_action( 'admin_footer', array( 'Advanced_Ads_AdSense_Admin', 'print_connect_adsense' ) );
|
@@ -255,7 +255,7 @@ class Advanced_Ads_AdSense_Admin {
|
|
255 |
*
|
256 |
* @param bool $hide_idle_ads Whether to hide idle ads.
|
257 |
*/
|
258 |
-
public static function get_mapi_ad_selector( $hide_idle_ads = true
|
259 |
global $closeable, $use_dashicons, $network, $ad_units, $display_slot_id;
|
260 |
$closeable = true;
|
261 |
$use_dashicons = false;
|
186 |
__( 'Responsive AdSense ads don’t work reliably with <em>Position</em> set to left or right. Either switch the <em>Type</em> to "normal" or follow <a href="%s" target="_blank">this tutorial</a> if you want the ad to be wrapped in text.', 'advanced-ads' ),
|
187 |
ADVADS_URL . 'adsense-responsive-custom-sizes/#utm_source=advanced-ads&utm_medium=link&utm_campaign=adsense-custom-sizes-tutorial'
|
188 |
),
|
189 |
+
'class' => 'advads-ad-notice-responsive-position advads-notice-inline advads-error hidden',
|
190 |
);
|
191 |
// Show hint about AdSense In-feed add-on.
|
192 |
if ( ! class_exists( 'Advanced_Ads_In_Feed', false ) ) {
|
199 |
'install-plugin_advanced-ads-adsense-in-feed'
|
200 |
)
|
201 |
),
|
202 |
+
'class' => 'advads-ad-notice-in-feed-add-on advads-notice-inline advads-idea hidden',
|
203 |
);
|
204 |
}
|
205 |
break;
|
213 |
*/
|
214 |
public static function enqueue_connect_adsense() {
|
215 |
if ( ! wp_script_is( 'advads/connect-adsense', 'registered' ) ) {
|
216 |
+
wp_enqueue_script( 'advads/connect-adsense', GADSENSE_BASE_URL . 'admin/assets/js/connect-adsense.js', array( 'jquery' ), ADVADS_VERSION );
|
217 |
}
|
218 |
if ( ! has_action( 'admin_footer', array( 'Advanced_Ads_AdSense_Admin', 'print_connect_adsense' ) ) ) {
|
219 |
add_action( 'admin_footer', array( 'Advanced_Ads_AdSense_Admin', 'print_connect_adsense' ) );
|
255 |
*
|
256 |
* @param bool $hide_idle_ads Whether to hide idle ads.
|
257 |
*/
|
258 |
+
public static function get_mapi_ad_selector( $hide_idle_ads = true ) {
|
259 |
global $closeable, $use_dashicons, $network, $ad_units, $display_slot_id;
|
260 |
$closeable = true;
|
261 |
$use_dashicons = false;
|
modules/gadsense/admin/assets/js/adsense.js
CHANGED
@@ -8,632 +8,606 @@
|
|
8 |
* in case you come across a missing method originating from the deleted new-ad.js,
|
9 |
* please just make the methods static and create a wrapper function like the one below
|
10 |
*/
|
11 |
-
window.gadsenseFormatAdContent = function() {
|
12 |
-
|
13 |
};
|
14 |
|
15 |
-
class AdvancedAdsNetworkAdsense extends AdvancedAdsAdNetwork{
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
that.preventCloseAdSelector = true;
|
609 |
-
|
610 |
-
// save the manually added ad code to the AdSense settings
|
611 |
-
wp.ajax.post('advads-mapi-save-manual-code', {
|
612 |
-
raw_code: encodeURIComponent(rawContent),
|
613 |
-
parsed_code: parseResult,
|
614 |
-
nonce: AdsenseMAPI.nonce
|
615 |
-
})
|
616 |
-
.fail(function (r) {
|
617 |
-
var $notice = jQuery('<div>').addClass('notice notice-error').html(jQuery('<p>').text(r.responseJSON.data.message));
|
618 |
-
jQuery('#post').before($notice);
|
619 |
-
jQuery('body html').animate({
|
620 |
-
scrollTop: $notice.offset().top
|
621 |
-
}, 200);
|
622 |
-
});
|
623 |
-
}
|
624 |
-
else{
|
625 |
-
// no adsense ad with this slot id was found
|
626 |
-
// switches to manual ad setup view
|
627 |
-
that.preventCloseAdSelector = false;
|
628 |
-
AdvancedAdsAdmin.AdImporter.manualSetup();
|
629 |
-
}
|
630 |
-
});
|
631 |
-
|
632 |
-
jQuery(document).on('gadsenseUnitChanged', function () {
|
633 |
-
var $row = jQuery('tr[data-slotid$="' + jQuery('#unit-code').val() + '"]'),
|
634 |
type = window.adsenseAdvancedAdsJS.ad_types.display;
|
635 |
|
636 |
-
switch (jQuery('#unit-type').val()) {
|
637 |
case 'matched-content':
|
638 |
type = window.adsenseAdvancedAdsJS.ad_types.matched_content;
|
639 |
break;
|
@@ -649,391 +623,313 @@ class AdvancedAdsNetworkAdsense extends AdvancedAdsAdNetwork{
|
|
649 |
break;
|
650 |
}
|
651 |
|
652 |
-
$row.children('.unittype').text(type);
|
653 |
-
});
|
654 |
|
655 |
-
|
656 |
-
|
657 |
-
|
|
|
|
|
|
|
|
|
|
|
658 |
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
this.updateAdsenseType();
|
668 |
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
} catch (ex) {}
|
673 |
-
}
|
674 |
|
675 |
jQuery( '#wpwrap' ).on(
|
676 |
'advads-mapi-adlist-opened',
|
677 |
-
function (ev) {
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
window.AdvancedAdsAdmin.AdImporter.toggleIdleAds( true );
|
683 |
-
} else {
|
684 |
-
// Idle ads are present in the table. Adjust AdNetwork and AdImporter default values accordingly.
|
685 |
-
that.hideIdle = false;
|
686 |
-
window.AdvancedAdsAdmin.AdImporter.toggleIdleAds( false );
|
687 |
-
}
|
688 |
}
|
|
|
689 |
}
|
690 |
);
|
691 |
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
slot: slot,
|
724 |
-
code: code,
|
725 |
-
action: 'advads-mapi-reconstructed-code',
|
726 |
-
},
|
727 |
-
success: function( resp, status, XHR ) {
|
728 |
-
jQuery( '#mapi-loading-overlay' ).css( 'display', 'none' );
|
729 |
-
},
|
730 |
-
error: function( req, status, err ) {
|
731 |
-
jQuery( '#mapi-loading-overlay' ).css( 'display', 'none' );
|
732 |
-
},
|
733 |
-
});
|
734 |
-
}
|
735 |
-
}
|
736 |
-
|
737 |
-
mapiMayBeSaveAdCode(){
|
738 |
-
// MAPI not set up
|
739 |
-
if ( 'undefined' == typeof AdsenseMAPI.hasToken ) return;
|
740 |
-
var slotId = jQuery( '#unit-code' ).val();
|
741 |
-
if ( !slotId ) return;
|
742 |
-
|
743 |
-
var type = jQuery( '#unit-type' ).val();
|
744 |
-
var width = jQuery( '#advanced-ads-ad-parameters-size input[name="advanced_ad[width]"]' ).val().trim();
|
745 |
-
var height = jQuery( '#advanced-ads-ad-parameters-size input[name="advanced_ad[height]"]' ).val().trim();
|
746 |
-
var layout = jQuery( '#ad-layout' ).val();
|
747 |
-
var layoutKey = jQuery( '#ad-layout-key' ).val();
|
748 |
-
|
749 |
-
var code = false;
|
750 |
-
|
751 |
-
switch ( type ) {
|
752 |
-
case 'in-feed':
|
753 |
-
code = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' +
|
754 |
-
'<ins class="adsbygoogle" ' +
|
755 |
-
'style="display:block;" ' +
|
756 |
-
'data-ad-client="ca-' + AdsenseMAPI.pubId + '" ' +
|
757 |
-
'data-ad-slot="' + slotId + '" ' +
|
758 |
-
'data-ad-layout-key="' + layoutKey + '" ';
|
759 |
-
code += 'data-ad-format="fluid"></ins>' +
|
760 |
-
'<script>' +
|
761 |
-
'(adsbygoogle = window.adsbygoogle || []).push({});' +
|
762 |
-
'</script>';
|
763 |
-
break;
|
764 |
-
case 'in-article':
|
765 |
-
code = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' +
|
766 |
-
'<ins class="adsbygoogle" ' +
|
767 |
-
'style="display:block;text-align:center;" ' +
|
768 |
-
'data-ad-client="ca-' + AdsenseMAPI.pubId + '" ' +
|
769 |
-
'data-ad-slot="' + slotId + '" ' +
|
770 |
-
'data-ad-layout="in-article" ' +
|
771 |
-
'data-ad-format="fluid"></ins>' +
|
772 |
-
'<script>' +
|
773 |
-
'(adsbygoogle = window.adsbygoogle || []).push({});' +
|
774 |
-
'</script>';
|
775 |
-
break;
|
776 |
-
case 'matched-content':
|
777 |
-
code = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' +
|
778 |
-
'<ins class="adsbygoogle" ' +
|
779 |
-
'style="display:block;" ' +
|
780 |
-
'data-ad-client="ca-' + AdsenseMAPI.pubId + '" ' +
|
781 |
-
'data-ad-slot="' + slotId + '" ' +
|
782 |
-
'data-ad-format="autorelaxed"></ins>' +
|
783 |
-
'<script>' +
|
784 |
-
'(adsbygoogle = window.adsbygoogle || []).push({});' +
|
785 |
-
'</script>';
|
786 |
-
break;
|
787 |
-
case 'link-responsive':
|
788 |
-
code = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' +
|
789 |
-
'<ins class="adsbygoogle" ' +
|
790 |
-
'style="display:block;" ' +
|
791 |
-
'data-ad-client="ca-' + AdsenseMAPI.pubId + '" ' +
|
792 |
-
'data-ad-slot="' + slotId + '" ' +
|
793 |
-
'data-ad-format="link"></ins>' +
|
794 |
-
'<script>' +
|
795 |
-
'(adsbygoogle = window.adsbygoogle || []).push({});' +
|
796 |
-
'</script>';
|
797 |
-
break;
|
798 |
-
case 'link':
|
799 |
-
code = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' +
|
800 |
-
'<ins class="adsbygoogle" ' +
|
801 |
-
'style="display:block;width:' + width + 'px;height:' + height + 'px" ' +
|
802 |
-
'data-ad-client="ca-' + AdsenseMAPI.pubId + '" ' +
|
803 |
-
'data-ad-slot="' + slotId + '" ' +
|
804 |
-
'data-ad-format="link"></ins>' +
|
805 |
-
'<script>' +
|
806 |
-
'(adsbygoogle = window.adsbygoogle || []).push({});' +
|
807 |
-
'</script>';
|
808 |
-
break;
|
809 |
-
case 'responsive':
|
810 |
-
code = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' +
|
811 |
-
'<ins class="adsbygoogle" ' +
|
812 |
-
'style="display:block;" ' +
|
813 |
-
'data-ad-client="ca-' + AdsenseMAPI.pubId + '" ' +
|
814 |
-
'data-ad-slot="' + slotId + '" ' +
|
815 |
-
'data-ad-format="auto"></ins>' +
|
816 |
-
'<script>' +
|
817 |
-
'(adsbygoogle = window.adsbygoogle || []).push({});' +
|
818 |
-
'</script>';
|
819 |
-
break;
|
820 |
-
case 'normal':
|
821 |
-
code = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' +
|
822 |
-
'<ins class="adsbygoogle" ' +
|
823 |
-
'style="display:inline-block;width:' + width + 'px;height:' + height + 'px" ' +
|
824 |
-
'data-ad-client="ca-' + AdsenseMAPI.pubId + '" ' +
|
825 |
-
'data-ad-slot="' + slotId + '"></ins>' +
|
826 |
-
'<script>' +
|
827 |
-
'(adsbygoogle = window.adsbygoogle || []).push({});' +
|
828 |
-
'</script>';
|
829 |
-
break;
|
830 |
-
default:
|
831 |
-
}
|
832 |
-
|
833 |
-
if ( code ) {
|
834 |
-
this.mapiSaveAdCode( code, slotId );
|
835 |
-
}
|
836 |
-
|
837 |
-
}
|
838 |
-
|
839 |
-
getMapiAction(action) {
|
840 |
-
var that = this;
|
841 |
-
if ('toggleidle' == action) {
|
842 |
-
return function(ev, el){
|
843 |
-
that.hideIdle = ! that.hideIdle;
|
844 |
-
AdvancedAdsAdmin.AdImporter.refreshAds();
|
845 |
}
|
846 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
847 |
return null;
|
848 |
}
|
849 |
}
|
850 |
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
// const selected = summary.dimension || dimensions['*'];
|
912 |
-
const dd = Advanced_Ads_Adsense_Helper.build_dropdown(summary.filter_value, dimensions);
|
913 |
-
dd.onclick = function(val){
|
914 |
-
Advanced_Ads_Adsense_Helper.request_dashboard(elm, {dimension_name: summary.dimension_name, filter: val});
|
915 |
-
};
|
916 |
-
container.append(dd.elm);
|
917 |
-
}
|
918 |
-
if (summary.age){
|
919 |
-
container.append(jQuery('<div style="clear: right; float:right; text-align:right; color:#bbbbbb; margin-top:5px;">' + summary.age + '</div>'));
|
920 |
-
}
|
921 |
-
|
922 |
-
// when there is no filter value, this usually means that there is no data for this ad
|
923 |
-
// i used to display a general error message (advadstxt.no_results), but this looks too much like an error
|
924 |
-
// and that's why we will ignore it for now and simply display a bunch of zeroes
|
925 |
-
// if (summary.filterValueExists != undefined && ! summary.filterValueExists){
|
926 |
-
// summary.valid = false;
|
927 |
-
// summary.errors = summary.errors || [];
|
928 |
-
// summary.errors.push(advadstxt.no_results);
|
929 |
-
// }
|
930 |
-
|
931 |
-
const dflex = jQuery('<div class="advads-flex"/>')
|
932 |
-
container.append(dflex);
|
933 |
-
|
934 |
-
if (summary.errors) {
|
935 |
-
const derrors = jQuery('<ul class="advads-error-message"/>')
|
936 |
-
container.append(derrors);
|
937 |
-
for (let i in summary.errors) {
|
938 |
-
const msg = advadstxt.error_message.replace('\%1$s', summary.errors[i]);
|
939 |
-
derrors.append(jQuery('<li>' + msg + '</li>'));
|
940 |
-
}
|
941 |
-
}
|
942 |
-
else {
|
943 |
-
if (!summary.valid || !summary.earningsToday) {
|
944 |
-
// we might have some old data floating around...
|
945 |
-
if (Advanced_Ads_Adsense_Helper.lastSummary) {
|
946 |
-
summary = Advanced_Ads_Adsense_Helper.lastSummary;
|
947 |
-
} else {
|
948 |
-
summary.earningsToday = summary.earningsYesterday = summary.earnings7Days = summary.earningsThisMonth = summary.earnings28Days = '...';
|
949 |
-
}
|
950 |
-
} else if (summary.valid) {
|
951 |
-
// remember the summary to be able to quickly fall back in case of a future error
|
952 |
-
Advanced_Ads_Adsense_Helper.lastSummary = summary;
|
953 |
-
}
|
954 |
-
dflex.append(Advanced_Ads_Adsense_Helper.build_dashboard_item(advadstxt.today, summary.earningsToday));
|
955 |
-
dflex.append(Advanced_Ads_Adsense_Helper.build_dashboard_item(advadstxt.yesterday, summary.earningsYesterday));
|
956 |
-
dflex.append(Advanced_Ads_Adsense_Helper.build_dashboard_item(advadstxt.last_n_days.replace('\%1$d', 7), summary.earnings7Days));
|
957 |
-
dflex.append(Advanced_Ads_Adsense_Helper.build_dashboard_item(advadstxt.this_month, summary.earningsThisMonth));
|
958 |
-
dflex.append(Advanced_Ads_Adsense_Helper.build_dashboard_item(advadstxt.last_n_days.replace('\%1$d', 28), summary.earnings28Days));
|
959 |
-
}
|
960 |
-
return container;
|
961 |
-
},
|
962 |
-
|
963 |
-
build_dashboard_item: function(title, main){
|
964 |
-
const d = jQuery('<div class="advads-flex1 advads-stats-box"/>');
|
965 |
-
d.append(jQuery('<div>' + title + '</div>'));
|
966 |
-
d.append(jQuery('<div class="advads-stats-box-main">' + main + '</div>'));
|
967 |
-
return d;
|
968 |
-
},
|
969 |
-
|
970 |
-
process_dashboard: function(elm){
|
971 |
-
let elmData = jQuery(elm).data('refresh');
|
972 |
-
if (elmData){
|
973 |
-
try {
|
974 |
-
elmData = typeof (elmData) === 'string' ? JSON.parse(elmData) : elmData;
|
975 |
-
}
|
976 |
-
catch (e){
|
977 |
-
elmData = null;
|
978 |
-
}
|
979 |
-
}
|
980 |
-
if (elmData) {
|
981 |
-
Advanced_Ads_Adsense_Helper.render_dashboard(elm, elmData);
|
982 |
-
}
|
983 |
-
const requires_refresh = !elmData || elmData.requires_refresh;
|
984 |
-
if (requires_refresh){
|
985 |
-
const extraData = {};
|
986 |
-
if (elmData){
|
987 |
-
if (elmData.dimension_name) extraData.dimension_name = elmData.dimension_name;
|
988 |
-
if (elmData.filter_value) extraData.filter = elmData.filter_value;
|
989 |
-
}
|
990 |
-
Advanced_Ads_Adsense_Helper.request_dashboard(elm, extraData);
|
991 |
-
}
|
992 |
-
},
|
993 |
-
|
994 |
-
render_dashboard: function(elm, summary){
|
995 |
-
jQuery(elm).html('').append(Advanced_Ads_Adsense_Helper.build_dashboard(summary, elm));
|
996 |
-
Advanced_Ads_Adsense_Helper.loading_spinner(elm, false);
|
997 |
-
const metabox_selector = jQuery(elm).data('metabox_selector');
|
998 |
-
if (metabox_selector) {
|
999 |
-
if (summary.hidden) {
|
1000 |
-
jQuery(metabox_selector).hide();
|
1001 |
-
} else {
|
1002 |
-
jQuery(metabox_selector).show();
|
1003 |
-
}
|
1004 |
-
}
|
1005 |
-
},
|
1006 |
-
|
1007 |
-
request_dashboard: function(elm, extraData){
|
1008 |
-
const data = {
|
1009 |
-
nonce: Advanced_Ads_Adsense_Helper.nonce,
|
1010 |
-
action: 'advads_gadsense_dashboard',
|
1011 |
-
account: gadsenseData.pubId
|
1012 |
-
};
|
1013 |
-
if (extraData) for (let i in extraData) data[i] = extraData[i];
|
1014 |
-
Advanced_Ads_Adsense_Helper.loading_spinner(elm, true);
|
1015 |
-
Advanced_Ads_Adsense_Helper.process_request(data, function(response){
|
1016 |
-
Advanced_Ads_Adsense_Helper.render_dashboard(elm, response.summary);
|
1017 |
-
jQuery(elm).data('refresh', response.summary);
|
1018 |
-
});
|
1019 |
-
},
|
1020 |
-
|
1021 |
-
process_request: function(data, success){
|
1022 |
-
jQuery.ajax({
|
1023 |
-
type: 'post',
|
1024 |
-
url: ajaxurl,
|
1025 |
-
data: data,
|
1026 |
-
success: function(response,status,XHR){
|
1027 |
-
if (response.errors && response.errors.length > 0){
|
1028 |
-
let txt = "";
|
1029 |
-
for (let i in response.errors) txt += response.errors[i] + "\n";
|
1030 |
-
console.log("Error while processing AdSense stats: " + txt);
|
1031 |
-
}
|
1032 |
-
success(response,status,XHR);
|
1033 |
-
},
|
1034 |
-
error: function(request,status,err){
|
1035 |
-
},
|
1036 |
-
});
|
1037 |
-
},
|
1038 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1039 |
};
|
8 |
* in case you come across a missing method originating from the deleted new-ad.js,
|
9 |
* please just make the methods static and create a wrapper function like the one below
|
10 |
*/
|
11 |
+
window.gadsenseFormatAdContent = function () {
|
12 |
+
AdvancedAdsNetworkAdsense.gadsenseFormatAdContent();
|
13 |
};
|
14 |
|
15 |
+
class AdvancedAdsNetworkAdsense extends AdvancedAdsAdNetwork {
|
16 |
+
constructor( codes ) {
|
17 |
+
super( 'adsense' );
|
18 |
+
this.name = 'adsense';
|
19 |
+
this.codes = codes;
|
20 |
+
this.parseCodeBtnClicked = false;
|
21 |
+
this.preventCloseAdSelector = false;
|
22 |
+
// this.adUnitName = null;
|
23 |
+
// the legacy code of gadsense executes a script inside a php template and will may not have been executed
|
24 |
+
// at this stage. the AdvancedAdsAdNetwork class already knows the publisher id, so we will overwrite
|
25 |
+
// the field in gadsenseData to be up to date at all times.
|
26 |
+
// TODO: the use of gadsenseData.pubId could be removed from this class in favor of this.vars.pubId
|
27 |
+
gadsenseData.pubId = this.vars.pubId;
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Legacy method
|
32 |
+
*
|
33 |
+
* Format the post content field
|
34 |
+
*/
|
35 |
+
static gadsenseFormatAdContent() {
|
36 |
+
const slotId = jQuery( '#ad-parameters-box #unit-code' ).val();
|
37 |
+
const unitType = jQuery( '#ad-parameters-box #unit-type' ).val();
|
38 |
+
const publisherId = jQuery( '#advads-adsense-pub-id' ).val() ? jQuery( '#advads-adsense-pub-id' ).val() : gadsenseData.pubId;
|
39 |
+
let adContent = {
|
40 |
+
slotId: slotId,
|
41 |
+
unitType: unitType,
|
42 |
+
pubId: publisherId
|
43 |
+
};
|
44 |
+
if ( unitType === 'responsive' ) {
|
45 |
+
let resize = jQuery( '#ad-parameters-box #ad-resize-type' ).val();
|
46 |
+
if ( resize === '0' ) {
|
47 |
+
resize = 'auto';
|
48 |
+
}
|
49 |
+
adContent.resize = resize;
|
50 |
+
}
|
51 |
+
if ( unitType === 'in-feed' ) {
|
52 |
+
adContent.layout_key = jQuery( '#ad-parameters-box #ad-layout-key' ).val();
|
53 |
+
}
|
54 |
+
if ( typeof adContent.resize !== 'undefined' && adContent.resize !== 'auto' ) {
|
55 |
+
jQuery( document ).trigger( 'gadsenseFormatAdResponsive', [adContent] );
|
56 |
+
}
|
57 |
+
jQuery( document ).trigger( 'gadsenseFormatAdContent', [adContent] );
|
58 |
+
|
59 |
+
if ( 'undefined' != typeof ( window.gadsenseAdContent ) ) {
|
60 |
+
adContent = window.gadsenseAdContent;
|
61 |
+
delete( window.gadsenseAdContent );
|
62 |
+
}
|
63 |
+
jQuery( '#advads-ad-content-adsense' ).val( JSON.stringify( adContent, false, 2 ) );
|
64 |
+
|
65 |
+
}
|
66 |
+
|
67 |
+
openSelector() {
|
68 |
+
|
69 |
+
}
|
70 |
+
|
71 |
+
closeAdSelector() {
|
72 |
+
if ( this.preventCloseAdSelector ) {
|
73 |
+
return;
|
74 |
+
}
|
75 |
+
AdvancedAdsAdmin.AdImporter.closeAdSelector();
|
76 |
+
}
|
77 |
+
|
78 |
+
getSelectedId() {
|
79 |
+
const pubId = gadsenseData.pubId || false;
|
80 |
+
const slotId = jQuery( '#unit-code' ).val().trim();
|
81 |
+
return pubId && slotId ? 'ca-' + pubId + ':' + slotId : null;
|
82 |
+
}
|
83 |
+
|
84 |
+
selectAdFromList( slotId ) {
|
85 |
+
this.preventCloseAdSelector = true;
|
86 |
+
this.onSelectAd( slotId );
|
87 |
+
AdvancedAdsAdmin.AdImporter.openExternalAdsList();
|
88 |
+
|
89 |
+
const report = Advanced_Ads_Adsense_Report_Helper.getReportObject();
|
90 |
+
if ( report ) {
|
91 |
+
report.filter = slotId.split( ':' )[1];
|
92 |
+
report.updateHtmlAttr();
|
93 |
+
report.refresh();
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
updateAdFromList( slotId ) {
|
98 |
+
this.getRemoteCode( slotId );
|
99 |
+
}
|
100 |
+
|
101 |
+
getRefreshAdsParameters() {
|
102 |
+
return {
|
103 |
+
nonce: AdsenseMAPI.nonce,
|
104 |
+
action: 'advanced_ads_get_ad_units_adsense',
|
105 |
+
account: gadsenseData.pubId,
|
106 |
+
inactive: ! this.hideIdle
|
107 |
+
};
|
108 |
+
}
|
109 |
+
|
110 |
+
onManualSetup() {
|
111 |
+
jQuery( '.advads-adsense-code' ).css( 'display', 'none' );
|
112 |
+
jQuery( '#remote-ad-unsupported-ad-type' ).css( 'display', 'none' );
|
113 |
+
this.undoReadOnly();
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Parse the code of an adsense ad and adjust the GUI
|
118 |
+
* call it, when an ad unit was selected.
|
119 |
+
* returns the parsed obj or false, when the ad code could not be parsed
|
120 |
+
*/
|
121 |
+
processAdCode( code ) {
|
122 |
+
const parsed = this.parseAdContentFailsafe( code );
|
123 |
+
if ( parsed ) {
|
124 |
+
this.undoReadOnly();
|
125 |
+
this.setDetailsFromAdCode( parsed );
|
126 |
+
this.makeReadOnly();
|
127 |
+
jQuery( '#remote-ad-code-error' ).hide();
|
128 |
+
jQuery( '#remote-ad-unsupported-ad-type' ).hide();
|
129 |
+
this.closeAdSelector();
|
130 |
+
} else {
|
131 |
+
jQuery( '#remote-ad-code-error' ).show();
|
132 |
+
}
|
133 |
+
return parsed;
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Clone of legacy method
|
138 |
+
*
|
139 |
+
* @param slotID
|
140 |
+
*/
|
141 |
+
onSelectAd( slotID ) {
|
142 |
+
if ( typeof this.codes[slotID] !== 'undefined' ) {
|
143 |
+
this.getSavedDetails( slotID );
|
144 |
+
} else {
|
145 |
+
this.getRemoteCode( slotID );
|
146 |
+
}
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Legacy method
|
151 |
+
*
|
152 |
+
* @param slotID
|
153 |
+
*/
|
154 |
+
getSavedDetails( slotID ) {
|
155 |
+
if ( typeof this.codes[slotID] !== 'undefined' ) {
|
156 |
+
var code = this.codes[slotID];
|
157 |
+
var parsed = this.processAdCode( code );
|
158 |
+
if ( parsed !== false) {
|
159 |
+
jQuery( '#remote-ad-unsupported-ad-type' ).css( 'display', 'none' );
|
160 |
+
this.closeAdSelector();
|
161 |
+
this.preventCloseAdSelector = false;
|
162 |
+
}
|
163 |
+
}
|
164 |
+
}
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Legacy method
|
168 |
+
*
|
169 |
+
* @param slotID
|
170 |
+
*/
|
171 |
+
getRemoteCode( slotID ) {
|
172 |
+
if ( slotID === '' ) {
|
173 |
+
return;
|
174 |
+
}
|
175 |
+
jQuery( '#mapi-loading-overlay' ).css( 'display', 'block' );
|
176 |
+
const self = this;
|
177 |
+
jQuery.ajax( {
|
178 |
+
type: 'post',
|
179 |
+
url: ajaxurl,
|
180 |
+
data: {
|
181 |
+
nonce: AdsenseMAPI.nonce,
|
182 |
+
action: 'advads_mapi_get_adCode',
|
183 |
+
unit: slotID
|
184 |
+
},
|
185 |
+
success: function ( response ) {
|
186 |
+
jQuery( '#mapi-loading-overlay' ).css( 'display', 'none' );
|
187 |
+
if ( typeof response.code !== 'undefined' ) {
|
188 |
+
jQuery( '#remote-ad-code-msg' ).empty();
|
189 |
+
var parsed = self.processAdCode( response.code );
|
190 |
+
if ( parsed !== false ) {
|
191 |
+
self.codes[slotID] = response.code;
|
192 |
+
AdvancedAdsAdmin.AdImporter.unitIsSupported( slotID );
|
193 |
+
}
|
194 |
+
AdvancedAdsAdmin.AdImporter.highlightSelectedRowInExternalAdsList();
|
195 |
+
jQuery( '[data-slotid="' + slotID + '"]' ).children( '.unittype' ).text( response.type );
|
196 |
+
self.closeAdSelector();
|
197 |
+
|
198 |
+
} else {
|
199 |
+
if ( typeof response.raw !== 'undefined' ) {
|
200 |
+
jQuery( '#remote-ad-code-msg' ).html( response.raw );
|
201 |
+
} else if ( typeof response.msg !== 'undefined' ) {
|
202 |
+
if ( typeof response.reload !== 'undefined' ) {
|
203 |
+
AdvancedAdsAdmin.AdImporter.emptyMapiSelector( response.msg );
|
204 |
+
} else {
|
205 |
+
if ( response.msg === 'doesNotSupportAdUnitType' ) {
|
206 |
+
AdvancedAdsAdmin.AdImporter.unitIsNotSupported( slotID );
|
207 |
+
} else {
|
208 |
+
jQuery( '#remote-ad-code-msg' ).html( response.msg );
|
209 |
+
}
|
210 |
+
}
|
211 |
+
if ( typeof response.raw !== 'undefined' ) {
|
212 |
+
console.log( response.raw );
|
213 |
+
}
|
214 |
+
}
|
215 |
+
}
|
216 |
+
},
|
217 |
+
error: function () {
|
218 |
+
jQuery( '#mapi-loading-overlay' ).css( 'display', 'none' );
|
219 |
+
|
220 |
+
}
|
221 |
+
} );
|
222 |
+
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Legacy method
|
227 |
+
*
|
228 |
+
* Parse ad content.
|
229 |
+
*
|
230 |
+
* @return {!Object}
|
231 |
+
*/
|
232 |
+
parseAdContent( content ) {
|
233 |
+
var rawContent = ( 'undefined' != typeof ( content ) ) ? content.trim() : '';
|
234 |
+
var theAd = {};
|
235 |
+
var theContent = jQuery( '<div />' ).html( rawContent );
|
236 |
+
var adByGoogle = theContent.find( 'ins' );
|
237 |
+
theAd.slotId = adByGoogle.attr( 'data-ad-slot' ) || '';
|
238 |
+
if ( 'undefined' != typeof ( adByGoogle.attr( 'data-ad-client' ) ) ) {
|
239 |
+
theAd.pubId = adByGoogle.attr( 'data-ad-client' ).substr( 3 );
|
240 |
+
}
|
241 |
+
|
242 |
+
if ( undefined !== theAd.slotId && '' != theAd.pubId ) {
|
243 |
+
theAd.display = adByGoogle.css( 'display' );
|
244 |
+
theAd.format = adByGoogle.attr( 'data-ad-format' );
|
245 |
+
theAd.layout = adByGoogle.attr( 'data-ad-layout' ); // for In-feed and In-article
|
246 |
+
theAd.layout_key = adByGoogle.attr( 'data-ad-layout-key' ); // for InFeed
|
247 |
+
theAd.style = adByGoogle.attr( 'style' ) || '';
|
248 |
+
|
249 |
+
/* normal ad */
|
250 |
+
if ( 'undefined' == typeof ( theAd.format ) && - 1 != theAd.style.indexOf( 'width' ) ) {
|
251 |
+
theAd.type = 'normal';
|
252 |
+
theAd.width = adByGoogle.css( 'width' ).replace( 'px', '' );
|
253 |
+
theAd.height = adByGoogle.css( 'height' ).replace( 'px', '' );
|
254 |
+
} else if ( 'undefined' != typeof ( theAd.format ) && 'auto' == theAd.format ) {
|
255 |
+
// Responsive ad, auto resize.
|
256 |
+
theAd.type = 'responsive';
|
257 |
+
} else if ( 'undefined' != typeof ( theAd.format ) && 'link' == theAd.format ) {
|
258 |
+
// Older link unit format; for new ads the format type is no longer needed; link units are created through the AdSense panel
|
259 |
+
if ( - 1 != theAd.style.indexOf( 'width' ) ) {
|
260 |
+
// is fixed size
|
261 |
+
theAd.width = adByGoogle.css( 'width' ).replace( 'px', '' );
|
262 |
+
theAd.height = adByGoogle.css( 'height' ).replace( 'px', '' );
|
263 |
+
theAd.type = 'link';
|
264 |
+
} else {
|
265 |
+
// is responsive
|
266 |
+
theAd.type = 'link-responsive';
|
267 |
+
}
|
268 |
+
} else if ( 'undefined' != typeof ( theAd.format ) && 'autorelaxed' == theAd.format ) {
|
269 |
+
// Responsive Matched Content
|
270 |
+
theAd.type = 'matched-content';
|
271 |
+
} else if ( 'undefined' != typeof ( theAd.format ) && 'fluid' == theAd.format ) {
|
272 |
+
// In-article & In-feed ads.
|
273 |
+
if ( 'undefined' != typeof ( theAd.layout ) && 'in-article' == theAd.layout ) {
|
274 |
+
// In-article
|
275 |
+
theAd.type = 'in-article';
|
276 |
+
} else {
|
277 |
+
// In-feed
|
278 |
+
theAd.type = 'in-feed';
|
279 |
+
}
|
280 |
+
}
|
281 |
+
}
|
282 |
+
|
283 |
+
/**
|
284 |
+
* Synchronous code
|
285 |
+
*/
|
286 |
+
if ( rawContent.indexOf( 'google_ad_slot' ) !== -1 ) {
|
287 |
+
var adClient = rawContent.match( /google_ad_client ?= ?["']([^'"]+)/ );
|
288 |
+
var adSlot = rawContent.match( /google_ad_slot ?= ?["']([^'"]+)/ );
|
289 |
+
var adFormat = rawContent.match( /google_ad_format ?= ?["']([^'"]+)/ );
|
290 |
+
var adWidth = rawContent.match( /google_ad_width ?= ?([\d]+)/ );
|
291 |
+
var adHeight = rawContent.match( /google_ad_height ?= ?([\d]+)/ );
|
292 |
+
|
293 |
+
theAd = {};
|
294 |
+
|
295 |
+
theAd.pubId = adClient[1].substr( 3 );
|
296 |
+
|
297 |
+
if ( adSlot !== null ) {
|
298 |
+
theAd.slotId = adSlot[1];
|
299 |
+
}
|
300 |
+
if ( adFormat !== null ) {
|
301 |
+
theAd.format = adFormat[1];
|
302 |
+
}
|
303 |
+
if ( adWidth !== null ) {
|
304 |
+
theAd.width = parseInt( adWidth[1] );
|
305 |
+
}
|
306 |
+
if ( adHeight !== null ) {
|
307 |
+
theAd.height = parseInt( adHeight[1] );
|
308 |
+
}
|
309 |
+
|
310 |
+
if ( typeof theAd.format === 'undefined' ) {
|
311 |
+
theAd.type = 'normal';
|
312 |
+
}
|
313 |
+
|
314 |
+
}
|
315 |
+
|
316 |
+
if ( theAd.slotId === '' && gadsenseData.pubId && gadsenseData.pubId !== '' ) {
|
317 |
+
theAd.type = jQuery( '#unit-type' ).val();
|
318 |
+
}
|
319 |
+
|
320 |
+
/* Page-Level ad */
|
321 |
+
if ( rawContent.indexOf( 'enable_page_level_ads' ) !== - 1 || /script[^>]+data-ad-client=/.test( rawContent ) ) {
|
322 |
+
theAd = {'parse_message': 'pageLevelAd'};
|
323 |
+
} else if ( ! theAd.type ) {
|
324 |
+
/* Unknown ad */
|
325 |
+
theAd = {'parse_message': 'unknownAd'};
|
326 |
+
}
|
327 |
+
|
328 |
+
jQuery( document ).trigger( 'gadsenseParseAdContent', [theAd, adByGoogle] );
|
329 |
+
return theAd;
|
330 |
+
}
|
331 |
+
|
332 |
+
parseAdContentFailsafe( code ) {
|
333 |
+
if ( typeof code === 'string' ) {
|
334 |
+
try {
|
335 |
+
code = JSON.parse( code );
|
336 |
+
} catch ( e ) {
|
337 |
+
return this.parseAdContent( code );
|
338 |
+
}
|
339 |
+
}
|
340 |
+
|
341 |
+
return code;
|
342 |
+
}
|
343 |
+
|
344 |
+
/**
|
345 |
+
* Handle result of parsing content.
|
346 |
+
*
|
347 |
+
* Legacy method
|
348 |
+
*/
|
349 |
+
handleParseResult( parseResult ) {
|
350 |
+
jQuery( '#pastecode-msg' ).empty();
|
351 |
+
switch ( parseResult.parse_message ) {
|
352 |
+
case 'pageLevelAd' :
|
353 |
+
advads_show_adsense_auto_ads_warning();
|
354 |
+
break;
|
355 |
+
case 'unknownAd' :
|
356 |
+
// Not recognized ad code
|
357 |
+
if ( this.parseCodeBtnClicked && 'post-new.php' == gadsenseData.pagenow ) {
|
358 |
+
// do not show if just after switching to AdSense ad type on ad creation
|
359 |
+
jQuery( '#pastecode-msg' ).append( jQuery( '<p />' ).css( 'color', 'red' ).html( gadsenseData.msg.unknownAd ) );
|
360 |
+
}
|
361 |
+
break;
|
362 |
+
default:
|
363 |
+
this.setDetailsFromAdCode( parseResult );
|
364 |
+
if ( 'undefined' != typeof AdsenseMAPI && 'undefined' != typeof AdsenseMAPI.hasToken && parseResult.pubId == AdsenseMAPI.pubId ) {
|
365 |
+
var content = jQuery( '#advanced-ads-ad-parameters input[name="advanced_ad[content]"]' ).val();
|
366 |
+
this.mapiSaveAdCode( content, parseResult.slotId );
|
367 |
+
this.makeReadOnly();
|
368 |
+
}
|
369 |
+
jQuery( '.advads-adsense-code' ).hide();
|
370 |
+
jQuery( '.advads-adsense-show-code' ).show();
|
371 |
+
jQuery( '.mapi-insert-code' ).show();
|
372 |
+
const customInputs = this.getCustomInputs();
|
373 |
+
customInputs.show();
|
374 |
+
}
|
375 |
+
}
|
376 |
+
|
377 |
+
/**
|
378 |
+
* Legacy method
|
379 |
+
*
|
380 |
+
* Set ad parameters fields from the result of parsing ad code
|
381 |
+
*/
|
382 |
+
setDetailsFromAdCode( theAd ) {
|
383 |
+
this.undoReadOnly();
|
384 |
+
jQuery( '#unit-code' ).val( theAd.slotId );
|
385 |
+
jQuery( '#advads-adsense-pub-id' ).val( theAd.pubId );
|
386 |
+
if ( theAd.type === 'normal' ) {
|
387 |
+
jQuery( '#unit-type' ).val( 'normal' );
|
388 |
+
jQuery( '#advanced-ads-ad-parameters-size input[name="advanced_ad[width]"]' ).val( theAd.width );
|
389 |
+
jQuery( '#advanced-ads-ad-parameters-size input[name="advanced_ad[height]"]' ).val( theAd.height );
|
390 |
+
} else if ( theAd.type === 'responsive' ) {
|
391 |
+
jQuery( '#unit-type' ).val( 'responsive' );
|
392 |
+
jQuery( '#ad-resize-type' ).val( 'auto' );
|
393 |
+
jQuery( '#advanced-ads-ad-parameters-size input[name="advanced_ad[width]"]' ).val( '' );
|
394 |
+
jQuery( '#advanced-ads-ad-parameters-size input[name="advanced_ad[height]"]' ).val( '' );
|
395 |
+
} else if ( theAd.type === 'link') {
|
396 |
+
jQuery( '#unit-type' ).val( 'link' );
|
397 |
+
jQuery( '#advanced-ads-ad-parameters-size input[name="advanced_ad[width]"]' ).val( theAd.width );
|
398 |
+
jQuery( '#advanced-ads-ad-parameters-size input[name="advanced_ad[height]"]' ).val( theAd.height );
|
399 |
+
} else if ( theAd.type === 'link-responsive' ) {
|
400 |
+
jQuery( '#unit-type' ).val( 'link-responsive' );
|
401 |
+
jQuery( '#ad-resize-type' ).val( 'auto' );
|
402 |
+
jQuery( '#advanced-ads-ad-parameters-size input[name="advanced_ad[width]"]' ).val( '' );
|
403 |
+
jQuery( '#advanced-ads-ad-parameters-size input[name="advanced_ad[height]"]' ).val( '' );
|
404 |
+
} else if ( theAd.type === 'matched-content' ) {
|
405 |
+
jQuery( '#unit-type' ).val( 'matched-content' );
|
406 |
+
jQuery( '#ad-resize-type' ).val( 'auto' );
|
407 |
+
jQuery( '#advanced-ads-ad-parameters-size input[name="advanced_ad[width]"]' ).val( '' );
|
408 |
+
jQuery( '#advanced-ads-ad-parameters-size input[name="advanced_ad[height]"]' ).val( '' );
|
409 |
+
}
|
410 |
+
if ( theAd.type === 'in-article' ) {
|
411 |
+
jQuery( '#unit-type' ).val( 'in-article' );
|
412 |
+
jQuery( '#advanced-ads-ad-parameters-size input[name="advanced_ad[width]"]' ).val( '' );
|
413 |
+
jQuery( '#advanced-ads-ad-parameters-size input[name="advanced_ad[height]"]' ).val( '' );
|
414 |
+
} else if ( theAd.type === 'in-feed' ) {
|
415 |
+
jQuery( '#unit-type' ).val( 'in-feed' );
|
416 |
+
jQuery( '#ad-layout-key' ).val( theAd.layout_key );
|
417 |
+
jQuery( '#advanced-ads-ad-parameters-size input[name="advanced_ad[width]"]' ).val( '' );
|
418 |
+
jQuery( '#advanced-ads-ad-parameters-size input[name="advanced_ad[height]"]' ).val( '' );
|
419 |
+
}
|
420 |
+
var storedPubId = gadsenseData.pubId;
|
421 |
+
|
422 |
+
if ( '' !== storedPubId && theAd.pubId != storedPubId && '' != theAd.slotId ) {
|
423 |
+
jQuery( '#adsense-ad-param-error' ).text( gadsenseData.msg.pubIdMismatch );
|
424 |
+
} else {
|
425 |
+
jQuery( '#adsense-ad-param-error' ).empty();
|
426 |
+
}
|
427 |
+
jQuery( document ).trigger( 'this.setDetailsFromAdCode', [theAd] );
|
428 |
+
jQuery( '#unit-type' ).trigger( 'change' );
|
429 |
+
}
|
430 |
+
|
431 |
+
/**
|
432 |
+
* Legacy method
|
433 |
+
*/
|
434 |
+
updateAdsenseType() {
|
435 |
+
var type = jQuery( '#unit-type' ).val();
|
436 |
+
jQuery( '.advads-adsense-layout' ).hide();
|
437 |
+
jQuery( '.advads-adsense-layout' ).next( 'div' ).hide();
|
438 |
+
jQuery( '.advads-adsense-layout-key' ).hide();
|
439 |
+
jQuery( '.advads-adsense-layout-key' ).next( 'div' ).hide();
|
440 |
+
jQuery( '.advads-ad-notice-in-feed-add-on' ).hide();
|
441 |
+
if ( type === 'responsive' || type === 'link-responsive' || type === 'matched-content' ) {
|
442 |
+
jQuery( '#advanced-ads-ad-parameters-size' ).hide();
|
443 |
+
jQuery( '#advanced-ads-ad-parameters-size' ).prev( '.label' ).hide();
|
444 |
+
jQuery( '#advanced-ads-ad-parameters-size' ).next( '.hr' ).hide();
|
445 |
+
jQuery( '.clearfix-before' ).show();
|
446 |
+
} else if ( type === 'in-feed' ) {
|
447 |
+
jQuery( '.advads-adsense-layout' ).hide();
|
448 |
+
jQuery( '.advads-adsense-layout' ).next( 'div' ).hide();
|
449 |
+
jQuery( '.advads-adsense-layout-key' ).show();
|
450 |
+
jQuery( '.advads-adsense-layout-key' ).next( 'div' ).show();
|
451 |
+
jQuery( '.advads-adsense-layout-key' ).next( 'div' ).show();
|
452 |
+
jQuery( '#advanced-ads-ad-parameters-size' ).hide();
|
453 |
+
jQuery( '#advanced-ads-ad-parameters-size' ).prev( '.label' ).hide();
|
454 |
+
jQuery( '#advanced-ads-ad-parameters-size' ).next( '.hr' ).hide();
|
455 |
+
// show add-on notice
|
456 |
+
jQuery( '.advads-ad-notice-in-feed-add-on' ).show();
|
457 |
+
jQuery( '.clearfix-before' ).show();
|
458 |
+
} else if ( type === 'in-article' ) {
|
459 |
+
jQuery( '#advanced-ads-ad-parameters-size' ).hide();
|
460 |
+
jQuery( '#advanced-ads-ad-parameters-size' ).prev( '.label' ).hide();
|
461 |
+
jQuery( '#advanced-ads-ad-parameters-size' ).next( '.hr' ).hide();
|
462 |
+
jQuery( '.clearfix-before' ).show();
|
463 |
+
} else if ( type === 'normal' || type === 'link' ) {
|
464 |
+
jQuery( '#advanced-ads-ad-parameters-size' ).show()
|
465 |
+
jQuery( '#advanced-ads-ad-parameters-size' ).prev( '.label' ).show();
|
466 |
+
jQuery( '#advanced-ads-ad-parameters-size' ).next( '.hr' ).show();
|
467 |
+
jQuery( '.clearfix-before' ).hide();
|
468 |
+
|
469 |
+
if ( ! jQuery( '[name="advanced_ad\[width\]"]' ).val() ) {
|
470 |
+
jQuery( '[name="advanced_ad\[width\]"]' ).val( '300' );
|
471 |
+
}
|
472 |
+
if ( ! jQuery( '[name="advanced_ad\[height\]"]' ).val() ) {
|
473 |
+
jQuery( '[name="advanced_ad\[height\]"]' ).val( '250' );
|
474 |
+
}
|
475 |
+
}
|
476 |
+
jQuery( document ).trigger( 'gadsenseUnitChanged' );
|
477 |
+
AdvancedAdsNetworkAdsense.gadsenseFormatAdContent();
|
478 |
+
|
479 |
+
this.show_float_warnings( type );
|
480 |
+
}
|
481 |
+
|
482 |
+
/**
|
483 |
+
* Legacy method
|
484 |
+
*
|
485 |
+
* Show / hide position warning.
|
486 |
+
*/
|
487 |
+
show_float_warnings( unit_type ) {
|
488 |
+
var resize_type = jQuery( '#ad-resize-type' ).val();
|
489 |
+
var position = jQuery( '#advanced-ad-output-position input[name="advanced_ad[output][position]"]:checked' ).val();
|
490 |
+
|
491 |
+
if (
|
492 |
+
( ['link-responsive', 'matched-content', 'in-article', 'in-feed'].indexOf( unit_type ) !== - 1
|
493 |
+
|| ( unit_type === 'responsive' && resize_type !== 'manual' )
|
494 |
+
)
|
495 |
+
&& ( position === 'left' || position === 'right' )
|
496 |
+
) {
|
497 |
+
jQuery( '#ad-parameters-box-notices .advads-ad-notice-responsive-position' ).show();
|
498 |
+
} else {
|
499 |
+
jQuery( '#ad-parameters-box-notices .advads-ad-notice-responsive-position' ).hide();
|
500 |
+
}
|
501 |
+
}
|
502 |
+
|
503 |
+
/**
|
504 |
+
* Legacy method - adds readonly to relevant inputs
|
505 |
+
*/
|
506 |
+
makeReadOnly() {
|
507 |
+
jQuery( '#unit-type option:not(:selected)' ).prop( 'disabled', true );
|
508 |
+
}
|
509 |
+
|
510 |
+
/**
|
511 |
+
* Legacy method - removes readonly from relevant inputs (original name getSlotAndType_jq)
|
512 |
+
*/
|
513 |
+
undoReadOnly() {
|
514 |
+
jQuery( '#unit-code,#ad-layout,#ad-layout-key,[name="advanced_ad[width]"],[name="advanced_ad[height]"]' ).prop( 'readonly', false );
|
515 |
+
jQuery( '#unit-type option:not(:selected)' ).prop( 'disabled', false );
|
516 |
+
}
|
517 |
+
|
518 |
+
getCustomInputs() {
|
519 |
+
var $div1 = jQuery( '#unit-code' ).closest( 'div' );
|
520 |
+
var $label1 = $div1.prev();
|
521 |
+
var $hr1 = $div1.next();
|
522 |
+
var $label2 = $hr1.next();
|
523 |
+
var $div2 = $label2.next();
|
524 |
+
var $layoutKey = jQuery( '#ad-layout-key' ).closest( 'div' );
|
525 |
+
var $layoutKeyLabel = $layoutKey.prev( '#advads-adsense-layout-key' );
|
526 |
+
|
527 |
+
var $elems = $div1.add( $label1 ).add( $hr1 ).add( $label2 ).add( $div2 ).add( $layoutKey ).add( $layoutKeyLabel );
|
528 |
+
return $elems;
|
529 |
+
}
|
530 |
+
|
531 |
+
onBlur() {
|
532 |
+
|
533 |
+
}
|
534 |
+
|
535 |
+
onSelected() {
|
536 |
+
// Handle a click from the "Switch to AdSense ad" button.
|
537 |
+
if ( AdvancedAdsAdmin.AdImporter.adsenseCode ) {
|
538 |
+
this.parseCodeBtnClicked = true;
|
539 |
+
const parseResult = this.parseAdContent( AdvancedAdsAdmin.AdImporter.adsenseCode );
|
540 |
+
AdvancedAdsAdmin.AdImporter.adsenseCode = null;
|
541 |
+
this.handleParseResult( parseResult );
|
542 |
+
} else {
|
543 |
+
// When you are not connected to adsense, or if the ad was edited manually open the manual setup view.
|
544 |
+
let switchToManualSetup = ! this.vars.connected;
|
545 |
+
if ( ! switchToManualSetup ) {
|
546 |
+
const parsedAd = this.parseAdContentFailsafe( this.codes[this.getSelectedId()] );
|
547 |
+
if ( parsedAd ) {
|
548 |
+
// We need to check if the type of the ad is different from the default. this marks a manually setup ad.
|
549 |
+
if ( jQuery( '#unit-type' ).val() !== parsedAd.type ) {
|
550 |
+
// This ad was manually setup. don't open the selector, but switch to manual select.
|
551 |
+
switchToManualSetup = true;
|
552 |
+
|
553 |
+
}
|
554 |
+
}
|
555 |
+
}
|
556 |
+
if ( switchToManualSetup ) {
|
557 |
+
AdvancedAdsAdmin.AdImporter.manualSetup();
|
558 |
+
} else if ( AdvancedAdsAdmin.AdImporter.highlightSelectedRowInExternalAdsList() || ! this.getSelectedId() ) {
|
559 |
+
AdvancedAdsAdmin.AdImporter.openExternalAdsList();
|
560 |
+
}
|
561 |
+
}
|
562 |
+
|
563 |
+
}
|
564 |
+
|
565 |
+
onDomReady() {
|
566 |
+
const self = this;
|
567 |
+
jQuery( document ).on( 'click', '.advads-adsense-close-code', function ( ev ) {
|
568 |
+
ev.preventDefault();
|
569 |
+
self.onSelected();
|
570 |
+
} );
|
571 |
+
|
572 |
+
jQuery( document ).on( 'click', '.advads-adsense-submit-code', function ( ev ) {
|
573 |
+
ev.preventDefault();
|
574 |
+
self.parseCodeBtnClicked = true;
|
575 |
+
var rawContent = jQuery( '.advads-adsense-content' ).val();
|
576 |
+
var parseResult = self.parseAdContent( rawContent );
|
577 |
+
self.handleParseResult( parseResult );
|
578 |
+
if ( AdvancedAdsAdmin.AdImporter.highlightSelectedRowInExternalAdsList() ) {
|
579 |
+
AdvancedAdsAdmin.AdImporter.openExternalAdsList();
|
580 |
+
self.preventCloseAdSelector = true;
|
581 |
+
|
582 |
+
// save the manually added ad code to the AdSense settings
|
583 |
+
wp.ajax.post( 'advads-mapi-save-manual-code', {
|
584 |
+
raw_code: encodeURIComponent( rawContent ),
|
585 |
+
parsed_code: parseResult,
|
586 |
+
nonce: AdsenseMAPI.nonce
|
587 |
+
} )
|
588 |
+
.fail( function ( r ) {
|
589 |
+
var $notice = jQuery( '<div>' ).addClass( 'notice notice-error' ).html( jQuery( '<p>' ).text( r.responseJSON.data.message ) );
|
590 |
+
jQuery( '#post' ).before( $notice );
|
591 |
+
jQuery( 'body html' ).animate(
|
592 |
+
{
|
593 |
+
scrollTop: $notice.offset().top
|
594 |
+
},
|
595 |
+
200
|
596 |
+
);
|
597 |
+
} );
|
598 |
+
} else {
|
599 |
+
// No adsense ad with this slot id was found.
|
600 |
+
// Switches to manual ad setup view.
|
601 |
+
self.preventCloseAdSelector = false;
|
602 |
+
AdvancedAdsAdmin.AdImporter.manualSetup();
|
603 |
+
}
|
604 |
+
} );
|
605 |
+
|
606 |
+
jQuery( document ).on( 'gadsenseUnitChanged', function () {
|
607 |
+
var $row = jQuery( 'tr[data-slotid$="' + jQuery( '#unit-code' ).val() + '"]' ),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
608 |
type = window.adsenseAdvancedAdsJS.ad_types.display;
|
609 |
|
610 |
+
switch ( jQuery( '#unit-type' ).val() ) {
|
611 |
case 'matched-content':
|
612 |
type = window.adsenseAdvancedAdsJS.ad_types.matched_content;
|
613 |
break;
|
623 |
break;
|
624 |
}
|
625 |
|
626 |
+
$row.children( '.unittype' ).text( type );
|
627 |
+
} );
|
628 |
|
629 |
+
jQuery( document ).on( 'change', '#unit-type, #unit-code, #ad-layout-key', function () {
|
630 |
+
self.checkAdSlotId( this );
|
631 |
+
} );
|
632 |
+
|
633 |
+
let inputCode = jQuery( '#unit-code' );
|
634 |
+
if ( inputCode ) {
|
635 |
+
this.checkAdSlotId( inputCode[0] );
|
636 |
+
}
|
637 |
|
638 |
+
jQuery( document ).on( 'change', '#ad-resize-type', function ( ev ) {
|
639 |
+
self.show_float_warnings( 'responsive' );
|
640 |
+
} );
|
641 |
+
this.updateAdsenseType();
|
642 |
|
643 |
+
if ( typeof AdsenseMAPI.hasToken !== 'undefined' ) {
|
644 |
+
this.mapiMayBeSaveAdCode();
|
645 |
+
}
|
|
|
646 |
|
647 |
+
jQuery( document ).on( 'click', '#mapi-archived-ads', function () {
|
648 |
+
self.showArchivedAds( jQuery( this ).hasClass( 'dashicons-visibility' ) );
|
649 |
+
} );
|
|
|
|
|
650 |
|
651 |
jQuery( '#wpwrap' ).on(
|
652 |
'advads-mapi-adlist-opened',
|
653 |
+
function ( ev ) {
|
654 |
+
// Update ad unit list to v2 data the first time the ad list is opened.
|
655 |
+
if ( jQuery( '#mapi-force-v2-list-update' ).length ) {
|
656 |
+
jQuery( '#mapi-wrap i[data-mapiaction="updateList"]' ).trigger( 'click' );
|
657 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
658 |
}
|
659 |
+
self.showArchivedAds();
|
660 |
}
|
661 |
);
|
662 |
|
663 |
+
this.onSelected();
|
664 |
+
}
|
665 |
+
|
666 |
+
showArchivedAds( show ) {
|
667 |
+
if ( typeof show === 'undefined' ) {
|
668 |
+
show = false;
|
669 |
+
}
|
670 |
+
let icon = jQuery( '#mapi-archived-ads' );
|
671 |
+
let title = icon.attr( 'title' );
|
672 |
+
let altTitle = icon.attr( 'data-alt-title' );
|
673 |
+
if ( show ) {
|
674 |
+
jQuery( '#mapi-table-wrap tbody tr[data-archived="1"]' ).show();
|
675 |
+
icon.removeClass( 'dashicons-visibility' ).addClass( 'dashicons-hidden' ).attr( 'title', altTitle ).attr( 'data-alt-title', title );
|
676 |
+
} else {
|
677 |
+
jQuery( '#mapi-table-wrap tbody tr[data-archived="1"]' ).not( '.selected' ).hide();
|
678 |
+
icon.removeClass( 'dashicons-hidden' ).addClass( 'dashicons-visibility' ).attr( 'title', altTitle ).attr( 'data-alt-title', title );
|
679 |
+
}
|
680 |
+
}
|
681 |
+
|
682 |
+
checkAdSlotId( elm ) {
|
683 |
+
if ( jQuery( elm ).attr( 'id' ) === 'unit-code' ) {
|
684 |
+
var val = jQuery( elm ).val();
|
685 |
+
if ( val ) {
|
686 |
+
val = val.trim();
|
687 |
+
}
|
688 |
+
if ( val.length > 0 && ( gadsenseData.pubId && - 1 != val.indexOf( gadsenseData.pubId.substr( 4 ) ) ) ) {
|
689 |
+
// if ( val.length > 0 && -1 != val.indexOf( gadsenseData.pubId.substr( 4 ) ) ) {
|
690 |
+
jQuery( '#advads-pubid-in-slot' ).css( 'display', 'block' );
|
691 |
+
jQuery( elm ).css( 'background-color', 'rgba(255, 235, 59, 0.33)' );
|
692 |
+
this.updateAdsenseType();
|
693 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
694 |
}
|
695 |
}
|
696 |
+
jQuery( '#unit-code' ).css( 'background-color', '#fff' );
|
697 |
+
jQuery( '#advads-pubid-in-slot' ).css( 'display', 'none' );
|
698 |
+
this.updateAdsenseType();
|
699 |
+
}
|
700 |
+
|
701 |
+
mapiSaveAdCode( code, slot ) {
|
702 |
+
if ( typeof AdsenseMAPI.hasToken !== 'undefined' && typeof this.codes['ca-' + AdsenseMAPI.pubId + ':' + slot] === 'undefined' ) {
|
703 |
+
this.codes['ca-' + AdsenseMAPI.pubId + ':' + slot] = code;
|
704 |
+
jQuery( '#mapi-loading-overlay' ).css( 'display', 'block' );
|
705 |
+
jQuery.ajax( {
|
706 |
+
type: 'post',
|
707 |
+
url: ajaxurl,
|
708 |
+
data: {
|
709 |
+
nonce: AdsenseMAPI.nonce,
|
710 |
+
slot: slot,
|
711 |
+
code: code,
|
712 |
+
action: 'advads-mapi-reconstructed-code'
|
713 |
+
},
|
714 |
+
success: function ( resp, status, XHR ) {
|
715 |
+
jQuery( '#mapi-loading-overlay' ).css( 'display', 'none' );
|
716 |
+
},
|
717 |
+
error: function ( req, status, err ) {
|
718 |
+
jQuery( '#mapi-loading-overlay' ).css( 'display', 'none' );
|
719 |
+
}
|
720 |
+
} );
|
721 |
+
}
|
722 |
+
}
|
723 |
+
|
724 |
+
mapiMayBeSaveAdCode() {
|
725 |
+
// MAPI not set up
|
726 |
+
if ( typeof AdsenseMAPI.hasToken === 'undefined' ) {
|
727 |
+
return;
|
728 |
+
}
|
729 |
+
var slotId = jQuery( '#unit-code' ).val();
|
730 |
+
if ( ! slotId ) {
|
731 |
+
return;
|
732 |
+
}
|
733 |
+
|
734 |
+
var type = jQuery( '#unit-type' ).val();
|
735 |
+
var width = jQuery( '#advanced-ads-ad-parameters-size input[name="advanced_ad[width]"]' ).val().trim();
|
736 |
+
var height = jQuery( '#advanced-ads-ad-parameters-size input[name="advanced_ad[height]"]' ).val().trim();
|
737 |
+
var layout = jQuery( '#ad-layout' ).val();
|
738 |
+
var layoutKey = jQuery( '#ad-layout-key' ).val();
|
739 |
+
|
740 |
+
var code = false;
|
741 |
+
|
742 |
+
switch ( type ) {
|
743 |
+
case 'in-feed':
|
744 |
+
code = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' +
|
745 |
+
'<ins class="adsbygoogle" ' +
|
746 |
+
'style="display:block;" ' +
|
747 |
+
'data-ad-client="ca-' + AdsenseMAPI.pubId + '" ' +
|
748 |
+
'data-ad-slot="' + slotId + '" ' +
|
749 |
+
'data-ad-layout-key="' + layoutKey + '" ';
|
750 |
+
code += 'data-ad-format="fluid"></ins>' +
|
751 |
+
'<script>' +
|
752 |
+
'(adsbygoogle = window.adsbygoogle || []).push({});' +
|
753 |
+
'</script>';
|
754 |
+
break;
|
755 |
+
case 'in-article':
|
756 |
+
code = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' +
|
757 |
+
'<ins class="adsbygoogle" ' +
|
758 |
+
'style="display:block;text-align:center;" ' +
|
759 |
+
'data-ad-client="ca-' + AdsenseMAPI.pubId + '" ' +
|
760 |
+
'data-ad-slot="' + slotId + '" ' +
|
761 |
+
'data-ad-layout="in-article" ' +
|
762 |
+
'data-ad-format="fluid"></ins>' +
|
763 |
+
'<script>' +
|
764 |
+
'(adsbygoogle = window.adsbygoogle || []).push({});' +
|
765 |
+
'</script>';
|
766 |
+
break;
|
767 |
+
case 'matched-content':
|
768 |
+
code = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' +
|
769 |
+
'<ins class="adsbygoogle" ' +
|
770 |
+
'style="display:block;" ' +
|
771 |
+
'data-ad-client="ca-' + AdsenseMAPI.pubId + '" ' +
|
772 |
+
'data-ad-slot="' + slotId + '" ' +
|
773 |
+
'data-ad-format="autorelaxed"></ins>' +
|
774 |
+
'<script>' +
|
775 |
+
'(adsbygoogle = window.adsbygoogle || []).push({});' +
|
776 |
+
'</script>';
|
777 |
+
break;
|
778 |
+
case 'link-responsive':
|
779 |
+
code = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' +
|
780 |
+
'<ins class="adsbygoogle" ' +
|
781 |
+
'style="display:block;" ' +
|
782 |
+
'data-ad-client="ca-' + AdsenseMAPI.pubId + '" ' +
|
783 |
+
'data-ad-slot="' + slotId + '" ' +
|
784 |
+
'data-ad-format="link"></ins>' +
|
785 |
+
'<script>' +
|
786 |
+
'(adsbygoogle = window.adsbygoogle || []).push({});' +
|
787 |
+
'</script>';
|
788 |
+
break;
|
789 |
+
case 'link':
|
790 |
+
code = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' +
|
791 |
+
'<ins class="adsbygoogle" ' +
|
792 |
+
'style="display:block;width:' + width + 'px;height:' + height + 'px" ' +
|
793 |
+
'data-ad-client="ca-' + AdsenseMAPI.pubId + '" ' +
|
794 |
+
'data-ad-slot="' + slotId + '" ' +
|
795 |
+
'data-ad-format="link"></ins>' +
|
796 |
+
'<script>' +
|
797 |
+
'(adsbygoogle = window.adsbygoogle || []).push({});' +
|
798 |
+
'</script>';
|
799 |
+
break;
|
800 |
+
case 'responsive':
|
801 |
+
code = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' +
|
802 |
+
'<ins class="adsbygoogle" ' +
|
803 |
+
'style="display:block;" ' +
|
804 |
+
'data-ad-client="ca-' + AdsenseMAPI.pubId + '" ' +
|
805 |
+
'data-ad-slot="' + slotId + '" ' +
|
806 |
+
'data-ad-format="auto"></ins>' +
|
807 |
+
'<script>' +
|
808 |
+
'(adsbygoogle = window.adsbygoogle || []).push({});' +
|
809 |
+
'</script>';
|
810 |
+
break;
|
811 |
+
case 'normal':
|
812 |
+
code = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' +
|
813 |
+
'<ins class="adsbygoogle" ' +
|
814 |
+
'style="display:inline-block;width:' + width + 'px;height:' + height + 'px" ' +
|
815 |
+
'data-ad-client="ca-' + AdsenseMAPI.pubId + '" ' +
|
816 |
+
'data-ad-slot="' + slotId + '"></ins>' +
|
817 |
+
'<script>' +
|
818 |
+
'(adsbygoogle = window.adsbygoogle || []).push({});' +
|
819 |
+
'</script>';
|
820 |
+
break;
|
821 |
+
default:
|
822 |
+
}
|
823 |
+
|
824 |
+
if ( code ) {
|
825 |
+
this.mapiSaveAdCode( code, slotId );
|
826 |
+
}
|
827 |
+
|
828 |
+
}
|
829 |
+
|
830 |
+
getMapiAction( action ) {
|
831 |
+
var self = this;
|
832 |
+
if ( action === 'toggleidle' ) {
|
833 |
+
return function ( ev, el ) {
|
834 |
+
self.hideIdle = ! self.hideIdle;
|
835 |
+
AdvancedAdsAdmin.AdImporter.refreshAds();
|
836 |
+
};
|
837 |
+
}
|
838 |
return null;
|
839 |
}
|
840 |
}
|
841 |
|
842 |
+
// Creates a Advanced_Ads_Adsense_Report_UI instance on the fly
|
843 |
+
window.Advanced_Ads_Adsense_Report_Helper = window.Advanced_Ads_Adsense_Report_Helper || {
|
844 |
+
init: function ( element ) {
|
845 |
+
if ( jQuery( element ).attr( 'data-arguments' ) ) {
|
846 |
+
try {
|
847 |
+
let reportArgs = JSON.parse( jQuery( element ).attr( 'data-arguments' ) );
|
848 |
+
jQuery( element ).data( 'advadsAdsenseReport', new Advanced_Ads_Adsense_Report_UI( element, reportArgs ) );
|
849 |
+
} catch ( ex ) {
|
850 |
+
console.error( 'Cannot parse report arguments' );
|
851 |
+
}
|
852 |
+
}
|
853 |
+
},
|
854 |
+
getReportObject: function () {
|
855 |
+
let reportElem = jQuery( '.advanced-ads-adsense-dashboard' );
|
856 |
+
if ( reportElem.length ) {
|
857 |
+
let report = reportElem.data( 'advadsAdsenseReport' );
|
858 |
+
if ( typeof report.refresh === 'function' ) {
|
859 |
+
return report;
|
860 |
+
}
|
861 |
+
}
|
862 |
+
return false;
|
863 |
+
}
|
864 |
+
};
|
865 |
+
|
866 |
+
class Advanced_Ads_Adsense_Report_UI {
|
867 |
+
constructor( el, args ) {
|
868 |
+
this.$el = jQuery( el );
|
869 |
+
this.type = args.type;
|
870 |
+
this.filter = args.filter;
|
871 |
+
this.init();
|
872 |
+
this.refreshing = false;
|
873 |
+
}
|
874 |
+
|
875 |
+
// Update arguments attributes before refreshing.
|
876 |
+
updateHtmlAttr() {
|
877 |
+
this.$el.attr( 'data-arguments', JSON.stringify( {type: 'domain', filter: self.filter} ) );
|
878 |
+
}
|
879 |
+
|
880 |
+
// Get markup for the current arguments.
|
881 |
+
refresh() {
|
882 |
+
let self = this;
|
883 |
+
this.$el.html( '<p style="text-align:center;"><span class="report-need-refresh spinner advads-ad-parameters-spinner advads-spinner"></span></p>' );
|
884 |
+
jQuery.ajax( {
|
885 |
+
type: 'POST',
|
886 |
+
url: ajaxurl,
|
887 |
+
data: {
|
888 |
+
nonce: window.Advanced_Ads_Adsense_Report_Helper.nonce,
|
889 |
+
type: this.type,
|
890 |
+
filter: this.filter,
|
891 |
+
action: 'advads_adsense_report_refresh'
|
892 |
+
},
|
893 |
+
success: function ( response ) {
|
894 |
+
if ( response.success && response.data && response.data.html ) {
|
895 |
+
self.$el.html( response.data.html );
|
896 |
+
}
|
897 |
+
}, error: function ( request, status, error ) {
|
898 |
+
console.log( 'Refreshing rerpot error: ' + error );
|
899 |
+
}
|
900 |
+
} );
|
901 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
902 |
|
903 |
+
// Initialization - events binding.
|
904 |
+
init() {
|
905 |
+
if ( this.$el.find( '.report-need-refresh' ).length ) {
|
906 |
+
this.refresh();
|
907 |
+
}
|
908 |
+
let self = this;
|
909 |
+
|
910 |
+
// Hide dropdown on click on everything but the dropdown and its children.
|
911 |
+
jQuery( document ).on( 'click', '#wpwrap', function () {
|
912 |
+
const dd = jQuery( '#advads_overview_adsense_stats .advads-stats-dd-button .advads-stats-dd-items' );
|
913 |
+
if ( dd.is( ':visible' ) ) {
|
914 |
+
dd.hide();
|
915 |
+
}
|
916 |
+
} );
|
917 |
+
|
918 |
+
// Show the dropdown.
|
919 |
+
jQuery( document ).on( 'click', '#advads_overview_adsense_stats .advads-stats-dd-button', function ( ev ) {
|
920 |
+
// Stop bubbling. Prevents hiding the dropdown.
|
921 |
+
ev.stopPropagation();
|
922 |
+
const dd = jQuery( this ).find( '.advads-stats-dd-items' );
|
923 |
+
if ( ! dd.is( ':visible' ) ) {
|
924 |
+
dd.show();
|
925 |
+
}
|
926 |
+
} );
|
927 |
+
|
928 |
+
// Dropdown item clicked.
|
929 |
+
jQuery( document ).on( 'click', '.advads-stats-dd-button .advads-stats-dd-item', function () {
|
930 |
+
self.filter = jQuery( this ).attr( 'data-domain' );
|
931 |
+
self.updateHtmlAttr();
|
932 |
+
self.refresh();
|
933 |
+
} );
|
934 |
+
}
|
935 |
};
|
modules/gadsense/admin/assets/js/connect-adsense.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
;(function($){
|
2 |
-
|
3 |
// Unique instance of "advadsMapiConnectClass"
|
4 |
var INSTANCE = null;
|
5 |
-
|
6 |
var advadsMapiConnectClass = function( content, options ) {
|
7 |
this.options = {};
|
8 |
this.modal = $( '#gadsense-modal' );
|
@@ -12,20 +12,19 @@
|
|
12 |
}
|
13 |
this.setOptions( options );
|
14 |
this.init();
|
15 |
-
|
16 |
|
17 |
this.show( content );
|
18 |
return this;
|
19 |
};
|
20 |
-
|
21 |
advadsMapiConnectClass.prototype = {
|
22 |
-
|
23 |
constructor: advadsMapiConnectClass,
|
24 |
-
|
25 |
// Set options, for re-use of existing instance for a different purpose.
|
26 |
setOptions: function( options ) {
|
27 |
var defaultOptions = {
|
28 |
-
autoads: false,
|
29 |
onSuccess: false,
|
30 |
onError: false,
|
31 |
};
|
@@ -34,7 +33,7 @@
|
|
34 |
}
|
35 |
this.options = $.extend( {}, defaultOptions, options);
|
36 |
},
|
37 |
-
|
38 |
// Tasks to do after a successful connection.
|
39 |
exit: function(){
|
40 |
if ( this.options.onSuccess ) {
|
@@ -45,10 +44,10 @@
|
|
45 |
this.hide();
|
46 |
}
|
47 |
},
|
48 |
-
|
49 |
// Submit OAuth2 code for account connection.
|
50 |
submitOAuthCode: function( code ) {
|
51 |
-
|
52 |
var that = this;
|
53 |
if ( '' == code ) return;
|
54 |
$( '.gadsense-overlay' ).css( 'display', 'block' );
|
@@ -58,7 +57,7 @@
|
|
58 |
code: code,
|
59 |
nonce: AdsenseMAPI.nonce,
|
60 |
};
|
61 |
-
|
62 |
$.ajax({
|
63 |
url: ajaxurl,
|
64 |
type: 'post',
|
@@ -68,13 +67,10 @@
|
|
68 |
if ( response.status && true === response.status && response['token_data'] ) {
|
69 |
that.getAccountDetails( response['token_data'] );
|
70 |
} else {
|
71 |
-
|
72 |
-
* Connection error handling.
|
73 |
-
*/
|
74 |
console.log( response );
|
75 |
$( '.gadsense-overlay' ).css( 'display', 'none' );
|
76 |
$( '#mapi-code' ).val( '' );
|
77 |
-
$( '#mapi-autoads' ).prop( 'checked', false );
|
78 |
$( '#gadsense-modal-content-inner .dashicons-dismiss' ).trigger( 'click' );
|
79 |
}
|
80 |
},
|
@@ -82,19 +78,19 @@
|
|
82 |
$( '#gadsense-loading-overlay' ).css( 'display', 'none' );
|
83 |
},
|
84 |
});
|
85 |
-
|
86 |
},
|
87 |
-
|
88 |
// Initialization - mostly binding events.
|
89 |
init: function(){
|
90 |
-
|
91 |
var that = this;
|
92 |
-
|
93 |
// Close the modal and hide errors.
|
94 |
$( document ).on( 'click', '#gadsense-modal .dashicons-dismiss', function(){
|
95 |
that.hide();
|
96 |
} );
|
97 |
-
|
98 |
// Account selection
|
99 |
$( document ).on( 'click', '.gadsense-modal-content-inner[data-content="account-selector"] button', function( ev ) {
|
100 |
var adsenseID = $( '#mapi-select-account' ).val();
|
@@ -102,7 +98,7 @@
|
|
102 |
var tokenString = $( '.gadsense-modal-content-inner[data-content="account-selector"] input.token-data' ).val();
|
103 |
var details = false;
|
104 |
var detailsString = $( '.gadsense-modal-content-inner[data-content="account-selector"] input.accounts-details' ).val();
|
105 |
-
|
106 |
try {
|
107 |
tokenData = JSON.parse( tokenString );
|
108 |
} catch ( Ex ) {
|
@@ -111,21 +107,17 @@
|
|
111 |
try {
|
112 |
details = JSON.parse( detailsString );
|
113 |
} catch ( Ex ) {
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
account : details[ adsenseID ],
|
122 |
'token_data': tokenData,
|
123 |
};
|
124 |
-
|
125 |
-
if ( $( '#mapi-autoads' ).prop( 'checked' ) ) {
|
126 |
-
data['autoads'] = 1;
|
127 |
-
}
|
128 |
-
|
129 |
$.ajax({
|
130 |
url: ajaxurl,
|
131 |
type: 'post',
|
@@ -142,60 +134,55 @@
|
|
142 |
},
|
143 |
});
|
144 |
}
|
145 |
-
|
146 |
} );
|
147 |
-
|
148 |
},
|
149 |
-
|
150 |
// Get account info based on a newly obtained token.
|
151 |
getAccountDetails: function( tokenData ){
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
},
|
195 |
-
});
|
196 |
-
|
197 |
-
},
|
198 |
-
|
199 |
// Switch between frames in the modal container.
|
200 |
switchContent: function( content ) {
|
201 |
if ( this.modal.find( '.gadsense-modal-content-inner[data-content="' + content + '"]' ).length ) {
|
@@ -205,30 +192,30 @@
|
|
205 |
$( '.gadsense-overlay' ).css( 'display', 'none' );
|
206 |
}
|
207 |
},
|
208 |
-
|
209 |
// Show the modal frame with a given content.
|
210 |
show: function( content ) {
|
211 |
if ( 'undefined' == typeof content ) {
|
212 |
content = 'confirm-code';
|
213 |
}
|
214 |
this.switchContent( content );
|
215 |
-
|
216 |
if ( 'open-google' == content ) {
|
217 |
window.location.href = AdsenseMAPI.oAuth2;
|
218 |
} else {
|
219 |
this.modal.css( 'display', 'block' );
|
220 |
}
|
221 |
},
|
222 |
-
|
223 |
// Hide the modal frame
|
224 |
hide: function(){
|
225 |
window.location.href = this.modal.attr( 'data-return' );
|
226 |
},
|
227 |
-
|
228 |
};
|
229 |
-
|
230 |
window.advadsMapiConnectClass = advadsMapiConnectClass;
|
231 |
-
|
232 |
// Shortcut function.
|
233 |
window.advadsMapiConnect = function( content, options ) {
|
234 |
if ( 'undefined' == typeof content || ! content ) {
|
@@ -243,15 +230,15 @@
|
|
243 |
INSTANCE.show( content, options );
|
244 |
}
|
245 |
}
|
246 |
-
|
247 |
$(function(){
|
248 |
// Move the the pop-up outside of any form.
|
249 |
$( '#wpwrap' ).append( $( '#gadsense-modal' ) );
|
250 |
-
|
251 |
if ( $( '#advads-adsense-oauth-code' ).length ) {
|
252 |
INSTANCE = new advadsMapiConnectClass( 'confirm-code', {} );
|
253 |
INSTANCE.submitOAuthCode( $( '#advads-adsense-oauth-code' ).val() );
|
254 |
}
|
255 |
});
|
256 |
-
|
257 |
})(window.jQuery);
|
1 |
;(function($){
|
2 |
+
|
3 |
// Unique instance of "advadsMapiConnectClass"
|
4 |
var INSTANCE = null;
|
5 |
+
|
6 |
var advadsMapiConnectClass = function( content, options ) {
|
7 |
this.options = {};
|
8 |
this.modal = $( '#gadsense-modal' );
|
12 |
}
|
13 |
this.setOptions( options );
|
14 |
this.init();
|
15 |
+
|
16 |
|
17 |
this.show( content );
|
18 |
return this;
|
19 |
};
|
20 |
+
|
21 |
advadsMapiConnectClass.prototype = {
|
22 |
+
|
23 |
constructor: advadsMapiConnectClass,
|
24 |
+
|
25 |
// Set options, for re-use of existing instance for a different purpose.
|
26 |
setOptions: function( options ) {
|
27 |
var defaultOptions = {
|
|
|
28 |
onSuccess: false,
|
29 |
onError: false,
|
30 |
};
|
33 |
}
|
34 |
this.options = $.extend( {}, defaultOptions, options);
|
35 |
},
|
36 |
+
|
37 |
// Tasks to do after a successful connection.
|
38 |
exit: function(){
|
39 |
if ( this.options.onSuccess ) {
|
44 |
this.hide();
|
45 |
}
|
46 |
},
|
47 |
+
|
48 |
// Submit OAuth2 code for account connection.
|
49 |
submitOAuthCode: function( code ) {
|
50 |
+
|
51 |
var that = this;
|
52 |
if ( '' == code ) return;
|
53 |
$( '.gadsense-overlay' ).css( 'display', 'block' );
|
57 |
code: code,
|
58 |
nonce: AdsenseMAPI.nonce,
|
59 |
};
|
60 |
+
|
61 |
$.ajax({
|
62 |
url: ajaxurl,
|
63 |
type: 'post',
|
67 |
if ( response.status && true === response.status && response['token_data'] ) {
|
68 |
that.getAccountDetails( response['token_data'] );
|
69 |
} else {
|
70 |
+
// Connection error handling.
|
|
|
|
|
71 |
console.log( response );
|
72 |
$( '.gadsense-overlay' ).css( 'display', 'none' );
|
73 |
$( '#mapi-code' ).val( '' );
|
|
|
74 |
$( '#gadsense-modal-content-inner .dashicons-dismiss' ).trigger( 'click' );
|
75 |
}
|
76 |
},
|
78 |
$( '#gadsense-loading-overlay' ).css( 'display', 'none' );
|
79 |
},
|
80 |
});
|
81 |
+
|
82 |
},
|
83 |
+
|
84 |
// Initialization - mostly binding events.
|
85 |
init: function(){
|
86 |
+
|
87 |
var that = this;
|
88 |
+
|
89 |
// Close the modal and hide errors.
|
90 |
$( document ).on( 'click', '#gadsense-modal .dashicons-dismiss', function(){
|
91 |
that.hide();
|
92 |
} );
|
93 |
+
|
94 |
// Account selection
|
95 |
$( document ).on( 'click', '.gadsense-modal-content-inner[data-content="account-selector"] button', function( ev ) {
|
96 |
var adsenseID = $( '#mapi-select-account' ).val();
|
98 |
var tokenString = $( '.gadsense-modal-content-inner[data-content="account-selector"] input.token-data' ).val();
|
99 |
var details = false;
|
100 |
var detailsString = $( '.gadsense-modal-content-inner[data-content="account-selector"] input.accounts-details' ).val();
|
101 |
+
|
102 |
try {
|
103 |
tokenData = JSON.parse( tokenString );
|
104 |
} catch ( Ex ) {
|
107 |
try {
|
108 |
details = JSON.parse( detailsString );
|
109 |
} catch ( Ex ) {
|
110 |
+
console.error( 'Bad account details : ' + detailsString );
|
111 |
+
}
|
112 |
+
if ( details ) {
|
113 |
+
$( '.gadsense-overlay' ).css( 'display', 'block' );
|
114 |
+
var data = {
|
115 |
+
action: 'advads_gadsense_mapi_select_account',
|
116 |
+
nonce: AdsenseMAPI.nonce,
|
117 |
account : details[ adsenseID ],
|
118 |
'token_data': tokenData,
|
119 |
};
|
120 |
+
|
|
|
|
|
|
|
|
|
121 |
$.ajax({
|
122 |
url: ajaxurl,
|
123 |
type: 'post',
|
134 |
},
|
135 |
});
|
136 |
}
|
137 |
+
|
138 |
} );
|
139 |
+
|
140 |
},
|
141 |
+
|
142 |
// Get account info based on a newly obtained token.
|
143 |
getAccountDetails: function( tokenData ){
|
144 |
+
var data = {
|
145 |
+
action: 'advads_gadsense_mapi_get_details',
|
146 |
+
nonce: AdsenseMAPI.nonce
|
147 |
+
};
|
148 |
+
data.token_data = tokenData;
|
149 |
+
|
150 |
+
$.ajax( {
|
151 |
+
url: ajaxurl,
|
152 |
+
type: 'post',
|
153 |
+
data: data,
|
154 |
+
success: function ( response ) {
|
155 |
+
if ( response.success && true === response.success ) {
|
156 |
+
if ( response.data && response.data.reload ) {
|
157 |
+
INSTANCE.exit();
|
158 |
+
} else if ( response.data && response.data.token_data ) {
|
159 |
+
INSTANCE.switchContent( 'account-selector' );
|
160 |
+
INSTANCE.frame.find( 'select' ).html( response.data.html );
|
161 |
+
INSTANCE.frame.find( 'input.token-data' ).val( JSON.stringify( response.data.token_data ) );
|
162 |
+
INSTANCE.frame.find( 'input.accounts-details' ).val( JSON.stringify( response.data.details ) );
|
163 |
+
} else {
|
164 |
+
INSTANCE.switchContent( 'error' );
|
165 |
+
INSTANCE.frame.find( '.error-message' ).text( JSON.stringify( response ) );
|
166 |
+
}
|
167 |
+
} else {
|
168 |
+
if ( response.data.error ) {
|
169 |
+
INSTANCE.switchContent( 'error' );
|
170 |
+
INSTANCE.frame.find( '.error-message' ).text( response.data.error );
|
171 |
+
if ( 'undefined' != typeof AdsenseMAPI.connectErrorMsg[response.data.error] ) {
|
172 |
+
INSTANCE.frame.find( '.error-description' ).html( AdsenseMAPI.connectErrorMsg[response.data.error] );
|
173 |
+
}
|
174 |
+
} else if ( response.data.message ) {
|
175 |
+
INSTANCE.frame.find( '.error-message' ).text( response.data.message );
|
176 |
+
}
|
177 |
+
}
|
178 |
+
},
|
179 |
+
error: function ( request, status, error ) {
|
180 |
+
$( '#gadsense-loading-overlay' ).css( 'display', 'none' );
|
181 |
+
}
|
182 |
+
} );
|
183 |
+
|
184 |
+
},
|
185 |
+
|
|
|
|
|
|
|
|
|
|
|
186 |
// Switch between frames in the modal container.
|
187 |
switchContent: function( content ) {
|
188 |
if ( this.modal.find( '.gadsense-modal-content-inner[data-content="' + content + '"]' ).length ) {
|
192 |
$( '.gadsense-overlay' ).css( 'display', 'none' );
|
193 |
}
|
194 |
},
|
195 |
+
|
196 |
// Show the modal frame with a given content.
|
197 |
show: function( content ) {
|
198 |
if ( 'undefined' == typeof content ) {
|
199 |
content = 'confirm-code';
|
200 |
}
|
201 |
this.switchContent( content );
|
202 |
+
|
203 |
if ( 'open-google' == content ) {
|
204 |
window.location.href = AdsenseMAPI.oAuth2;
|
205 |
} else {
|
206 |
this.modal.css( 'display', 'block' );
|
207 |
}
|
208 |
},
|
209 |
+
|
210 |
// Hide the modal frame
|
211 |
hide: function(){
|
212 |
window.location.href = this.modal.attr( 'data-return' );
|
213 |
},
|
214 |
+
|
215 |
};
|
216 |
+
|
217 |
window.advadsMapiConnectClass = advadsMapiConnectClass;
|
218 |
+
|
219 |
// Shortcut function.
|
220 |
window.advadsMapiConnect = function( content, options ) {
|
221 |
if ( 'undefined' == typeof content || ! content ) {
|
230 |
INSTANCE.show( content, options );
|
231 |
}
|
232 |
}
|
233 |
+
|
234 |
$(function(){
|
235 |
// Move the the pop-up outside of any form.
|
236 |
$( '#wpwrap' ).append( $( '#gadsense-modal' ) );
|
237 |
+
|
238 |
if ( $( '#advads-adsense-oauth-code' ).length ) {
|
239 |
INSTANCE = new advadsMapiConnectClass( 'confirm-code', {} );
|
240 |
INSTANCE.submitOAuthCode( $( '#advads-adsense-oauth-code' ).val() );
|
241 |
}
|
242 |
});
|
243 |
+
|
244 |
})(window.jQuery);
|
modules/gadsense/admin/assets/js/mapi-settings.js
CHANGED
@@ -12,7 +12,8 @@
|
|
12 |
var $div = $( '#mapi-account-alerts' );
|
13 |
$div.empty();
|
14 |
if ( alerts.length ) {
|
15 |
-
|
|
|
16 |
var $ul = $( '<ul />' );
|
17 |
for ( var id in alerts.alerts ) {
|
18 |
var msg = alerts.alerts[id].message;
|
@@ -22,7 +23,8 @@
|
|
22 |
$ul.append( $( '<li />' ).html( msg + ' ' +
|
23 |
'<a href="#" class="mapi-dismiss-alert" data-id="' + id + '">' + $div.attr( 'data-dismiss' ) + '</a>' ) );
|
24 |
}
|
25 |
-
|
|
|
26 |
}
|
27 |
}
|
28 |
|
@@ -31,7 +33,7 @@
|
|
31 |
} );
|
32 |
|
33 |
$( document ).on( 'click', '#dissmiss-connect-error', function() {
|
34 |
-
$( '#mapi-connect-errors' ).empty();
|
35 |
$.ajax({
|
36 |
url: ajaxurl,
|
37 |
type: 'get',
|
@@ -41,7 +43,7 @@
|
|
41 |
}
|
42 |
});
|
43 |
} );
|
44 |
-
|
45 |
$( document ).on( 'keypress', '#adsense input[type="text"]', function( ev ) {
|
46 |
if ( $( this ).hasClass( 'preventDefault' ) ) {
|
47 |
ev.preventDefault();
|
@@ -135,7 +137,7 @@
|
|
135 |
printAlerts( response );
|
136 |
}
|
137 |
} );
|
138 |
-
|
139 |
$( function(){
|
140 |
if ( '' === $( '#adsense-id' ).val().trim() && $('#adsense-manual-config').is(':visible') ) {
|
141 |
$( '#adsense #submit' ).parent().css( 'display', 'none' );
|
12 |
var $div = $( '#mapi-account-alerts' );
|
13 |
$div.empty();
|
14 |
if ( alerts.length ) {
|
15 |
+
var $alertBox = $( '<div class="card advads-notice-block advads-error"/>' );
|
16 |
+
$alertBox.append( $( '<h3 />' ).text( $div.attr( 'data-heading' ) ) );
|
17 |
var $ul = $( '<ul />' );
|
18 |
for ( var id in alerts.alerts ) {
|
19 |
var msg = alerts.alerts[id].message;
|
23 |
$ul.append( $( '<li />' ).html( msg + ' ' +
|
24 |
'<a href="#" class="mapi-dismiss-alert" data-id="' + id + '">' + $div.attr( 'data-dismiss' ) + '</a>' ) );
|
25 |
}
|
26 |
+
$alertBox.append( $ul );
|
27 |
+
$div.append( $alertBox );
|
28 |
}
|
29 |
}
|
30 |
|
33 |
} );
|
34 |
|
35 |
$( document ).on( 'click', '#dissmiss-connect-error', function() {
|
36 |
+
$( '#mapi-connect-errors' ).empty();
|
37 |
$.ajax({
|
38 |
url: ajaxurl,
|
39 |
type: 'get',
|
43 |
}
|
44 |
});
|
45 |
} );
|
46 |
+
|
47 |
$( document ).on( 'keypress', '#adsense input[type="text"]', function( ev ) {
|
48 |
if ( $( this ).hasClass( 'preventDefault' ) ) {
|
49 |
ev.preventDefault();
|
137 |
printAlerts( response );
|
138 |
}
|
139 |
} );
|
140 |
+
|
141 |
$( function(){
|
142 |
if ( '' === $( '#adsense-id' ).val().trim() && $('#adsense-manual-config').is(':visible') ) {
|
143 |
$( '#adsense #submit' ).parent().css( 'display', 'none' );
|
modules/gadsense/admin/views/adsense-account.php
CHANGED
@@ -36,32 +36,34 @@ $alerts_advads_messages = Advanced_Ads_Adsense_MAPI::get_adsense_alert_messages(
|
|
36 |
?>
|
37 |
<div id="mapi-account-alerts" data-heading="<?php echo esc_attr( $alerts_heading ); ?>" data-dismiss="<?php echo esc_attr( $alerts_dismiss ); ?>">
|
38 |
<?php if ( is_array( $alerts ) && isset( $alerts['items'] ) && is_array( $alerts['items'] ) && $alerts['items'] ) : ?>
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
|
|
44 |
<?php else : ?>
|
45 |
<li><?php echo wp_kses( $alert['message'], array( 'a' => array( 'href' => true, 'target' => true, 'class' => true ) ) ); ?> <a href="#" class="mapi-dismiss-alert" data-id="<?php echo esc_attr( $alert_id ); ?>"><?php echo esc_html( $alerts_dismiss ); ?></a></li>
|
46 |
<?php endif; ?>
|
47 |
-
|
48 |
-
|
49 |
-
|
|
|
50 |
</div>
|
51 |
<div id="mapi-connect-errors">
|
52 |
<?php if ( !empty( $mapi_options['connect_error'] ) ) {
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
}
|
66 |
?>
|
67 |
</div>
|
@@ -80,7 +82,7 @@ $alerts_advads_messages = Advanced_Ads_Adsense_MAPI::get_adsense_alert_messages(
|
|
80 |
<p class="description"><?php esc_html_e( 'Account holder name', 'advanced-ads' ); echo ': <strong>' . esc_html( $mapi_account_details['name'] ) . '</strong>'; ?></p>
|
81 |
<?php else : ?>
|
82 |
<?php if ( 0 !== strpos( $adsense_id, 'pub-' ) ) : ?>
|
83 |
-
<p class="advads-error
|
84 |
<?php else : ?>
|
85 |
<p class="description"><?php _e( 'Your AdSense Publisher ID <em>(pub-xxxxxxxxxxxxxx)</em>', 'advanced-ads' ) ?></p>
|
86 |
<?php endif; ?>
|
@@ -206,7 +208,7 @@ else : ?>
|
|
206 |
?>
|
207 |
</p><?php endif; ?>
|
208 |
<?php if ( ! Advanced_Ads_Checks::php_version_minimum() ) : ?>
|
209 |
-
<p class="advads-error
|
210 |
<?php endif; ?>
|
211 |
<div id="mapi-alerts-overlay">
|
212 |
<div style="position:relative;text-align:center;display:table;width:100%;height:100%;">
|
@@ -235,25 +237,7 @@ else : ?>
|
|
235 |
display: none;
|
236 |
}
|
237 |
#mapi-account-alerts, #mapi-connect-errors {
|
238 |
-
background-color: #ffecd1;
|
239 |
margin-bottom: .5em;
|
240 |
-
color: #c52f00;
|
241 |
-
}
|
242 |
-
#mapi-account-alerts p {
|
243 |
-
font-weight: bold;
|
244 |
-
padding: .5em
|
245 |
-
}
|
246 |
-
#mapi-connect-errors p {
|
247 |
-
padding: .5em;
|
248 |
-
}
|
249 |
-
#mapi-connect-errors p span {
|
250 |
-
font-weight: bold;
|
251 |
-
}
|
252 |
-
#mapi-account-alerts ul {
|
253 |
-
list-style-type: disc;
|
254 |
-
margin: .5em;
|
255 |
-
margin-left: 2em;
|
256 |
-
padding: .5em;
|
257 |
}
|
258 |
#dissmiss-connect-error {
|
259 |
cursor: pointer;
|
36 |
?>
|
37 |
<div id="mapi-account-alerts" data-heading="<?php echo esc_attr( $alerts_heading ); ?>" data-dismiss="<?php echo esc_attr( $alerts_dismiss ); ?>">
|
38 |
<?php if ( is_array( $alerts ) && isset( $alerts['items'] ) && is_array( $alerts['items'] ) && $alerts['items'] ) : ?>
|
39 |
+
<div class="card advads-notice-block advads-error">
|
40 |
+
<h3><?php echo esc_html( $alerts_heading ); ?></h3>
|
41 |
+
<ul>
|
42 |
+
<?php foreach ( $alerts['items'] as $alert_id => $alert ) : ?>
|
43 |
+
<?php $internal_id = isset( $alert['id'] ) ? $alert['id'] : str_replace( '-', '_', strtoupper( $alert['type'] ) ); ?>
|
44 |
+
<?php if ( isset( $alerts_advads_messages[ $internal_id ] ) ) : ?>
|
45 |
+
<li><?php echo wp_kses( $alerts_advads_messages[ $internal_id ], array( 'a' => array( 'href' => true, 'target' => true, 'class' => true ) ) ); ?> <a href="#" class="mapi-dismiss-alert" data-id="<?php echo esc_attr( $alert_id ); ?>"><?php echo esc_html( $alerts_dismiss ); ?></a></li>
|
46 |
<?php else : ?>
|
47 |
<li><?php echo wp_kses( $alert['message'], array( 'a' => array( 'href' => true, 'target' => true, 'class' => true ) ) ); ?> <a href="#" class="mapi-dismiss-alert" data-id="<?php echo esc_attr( $alert_id ); ?>"><?php echo esc_html( $alerts_dismiss ); ?></a></li>
|
48 |
<?php endif; ?>
|
49 |
+
<?php endforeach; ?>
|
50 |
+
</ul>
|
51 |
+
</div>
|
52 |
+
<?php endif; ?>
|
53 |
</div>
|
54 |
<div id="mapi-connect-errors">
|
55 |
<?php if ( !empty( $mapi_options['connect_error'] ) ) {
|
56 |
+
$message = isset( $mapi_options['connect_error']['message'] ) ? $mapi_options['connect_error']['message'] : '';
|
57 |
+
if ( isset( $connection_error_messages[ $mapi_options['connect_error']['reason'] ] ) ) {
|
58 |
+
$message = $connection_error_messages[ $mapi_options['connect_error']['reason'] ];
|
59 |
+
}
|
60 |
+
if ( ! empty( $message ) ) {
|
61 |
+
echo '<p class="advads-notice-inline advads-error">' . wp_kses_post( $message );
|
62 |
+
echo '<i id="dissmiss-connect-error" class="dashicons dashicons-dismiss align';
|
63 |
+
echo is_rtl() ? 'left' : 'right';
|
64 |
+
echo '" title=" ' . esc_attr( __( 'dismiss', 'advanced-ads' ) ) . '"></i>';
|
65 |
+
echo '</p>';
|
66 |
+
}
|
|
|
67 |
}
|
68 |
?>
|
69 |
</div>
|
82 |
<p class="description"><?php esc_html_e( 'Account holder name', 'advanced-ads' ); echo ': <strong>' . esc_html( $mapi_account_details['name'] ) . '</strong>'; ?></p>
|
83 |
<?php else : ?>
|
84 |
<?php if ( 0 !== strpos( $adsense_id, 'pub-' ) ) : ?>
|
85 |
+
<p class="advads-notice-inline advads-error"><?php esc_html_e( 'The Publisher ID has an incorrect format. (must start with "pub-")', 'advanced-ads' ); ?></p>
|
86 |
<?php else : ?>
|
87 |
<p class="description"><?php _e( 'Your AdSense Publisher ID <em>(pub-xxxxxxxxxxxxxx)</em>', 'advanced-ads' ) ?></p>
|
88 |
<?php endif; ?>
|
208 |
?>
|
209 |
</p><?php endif; ?>
|
210 |
<?php if ( ! Advanced_Ads_Checks::php_version_minimum() ) : ?>
|
211 |
+
<p class="advads-notice-inline advads-error"><?php esc_html_e( 'Can not connect AdSense account. PHP version is too low.', 'advanced-ads' ); ?></p>
|
212 |
<?php endif; ?>
|
213 |
<div id="mapi-alerts-overlay">
|
214 |
<div style="position:relative;text-align:center;display:table;width:100%;height:100%;">
|
237 |
display: none;
|
238 |
}
|
239 |
#mapi-account-alerts, #mapi-connect-errors {
|
|
|
240 |
margin-bottom: .5em;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
}
|
242 |
#dissmiss-connect-error {
|
243 |
cursor: pointer;
|
modules/gadsense/admin/views/adsense-ad-parameters.php
CHANGED
@@ -86,7 +86,7 @@ include(ADVADS_BASE_PATH . '/modules/gadsense/admin/views/external-ads-links.php
|
|
86 |
<?php if( $unit_pubid ) : ?>
|
87 |
<?php printf(__( 'Publisher ID: %s', 'advanced-ads' ), $unit_pubid ); ?>
|
88 |
<?php endif; ?>
|
89 |
-
<p id="advads-pubid-in-slot" class="advads-
|
90 |
<?php echo ! ( 0 === strpos( $pub_id, 'pub-' ) && false !== strpos( $unit_code, substr( $pub_id, 4 ) ) ) ? 'style="display:none"' : ''; ?>
|
91 |
><?php _e( 'The ad slot ID is either a number or empty and not the same as the publisher ID.', 'advanced-ads' ) ?></p>
|
92 |
</div>
|
@@ -96,7 +96,7 @@ $unit_code_markup = ob_get_clean();
|
|
96 |
echo apply_filters( 'advanced-ads-gadsense-unit-code-markup', $unit_code_markup, $unit_code );
|
97 |
if( $pub_id_errors ) : ?>
|
98 |
<p>
|
99 |
-
<span class="advads-error
|
100 |
<?php echo $pub_id_errors; ?>
|
101 |
</span>
|
102 |
<?php printf(__( 'Please <a href="%s" target="_blank">change it here</a>.', 'advanced-ads' ), admin_url( 'admin.php?page=advanced-ads-settings#top#adsense' )); ?>
|
86 |
<?php if( $unit_pubid ) : ?>
|
87 |
<?php printf(__( 'Publisher ID: %s', 'advanced-ads' ), $unit_pubid ); ?>
|
88 |
<?php endif; ?>
|
89 |
+
<p id="advads-pubid-in-slot" class="advads-notice-inline advads-error"
|
90 |
<?php echo ! ( 0 === strpos( $pub_id, 'pub-' ) && false !== strpos( $unit_code, substr( $pub_id, 4 ) ) ) ? 'style="display:none"' : ''; ?>
|
91 |
><?php _e( 'The ad slot ID is either a number or empty and not the same as the publisher ID.', 'advanced-ads' ) ?></p>
|
92 |
</div>
|
96 |
echo apply_filters( 'advanced-ads-gadsense-unit-code-markup', $unit_code_markup, $unit_code );
|
97 |
if( $pub_id_errors ) : ?>
|
98 |
<p>
|
99 |
+
<span class="advads-notice-inline advads-error">
|
100 |
<?php echo $pub_id_errors; ?>
|
101 |
</span>
|
102 |
<?php printf(__( 'Please <a href="%s" target="_blank">change it here</a>.', 'advanced-ads' ), admin_url( 'admin.php?page=advanced-ads-settings#top#adsense' )); ?>
|
modules/gadsense/admin/views/adsense-report.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* AdSense report markup.
|
4 |
+
*
|
5 |
+
* @var Advanced_Ads_AdSense_Report $this report instance.
|
6 |
+
* @var array $report_domains domain names included in the report.
|
7 |
+
* @var string $report_filter ad unit or domain name to filter the output with.
|
8 |
+
* @var array $sums daily sums of earnings.
|
9 |
+
* @var string $earning_cells markup for each earning period.
|
10 |
+
*/
|
11 |
+
$time_zone = Advanced_Ads_Utils::get_wp_timezone();
|
12 |
+
$data_timestamp = date_create( '@' . $this->get_data()->get_timestamp() );
|
13 |
+
$data_timestamp->setTimezone( $time_zone );
|
14 |
+
|
15 |
+
?>
|
16 |
+
<div class="advads-flex">
|
17 |
+
<?php echo wp_kses_post( $earning_cells ); ?>
|
18 |
+
<div class="advads-flex1 advads-stats-box">
|
19 |
+
<?php if ( $this->type === 'domain' ) : // Adds the dropdown list of domain names. ?>
|
20 |
+
<div class="advads-stats-dd-container">
|
21 |
+
<div class="advads-stats-dd-button"><span class="dashicons dashicons-admin-multisite"></span>
|
22 |
+
<div class="advads-stats-dd-items">
|
23 |
+
<div class="advads-stats-dd-item<?php echo in_array( $report_filter, array( '*', '' ), true ) ? ' current-filter' : ''; ?>" data-domain="*">
|
24 |
+
<?php esc_html_e( 'All', 'advanced-ads' ); ?>
|
25 |
+
</div><!-- .advads-stats-dd-item -->
|
26 |
+
<?php foreach ( $report_domains as $domain_name ) : ?>
|
27 |
+
<div class="advads-stats-dd-item<?php echo ( $domain_name === $report_filter ) ? ' current-filter' : ''; ?>" data-domain="<?php echo esc_attr( $domain_name ); ?>">
|
28 |
+
<?php echo esc_html( $domain_name ); ?>
|
29 |
+
</div><!-- .advads-stats-dd-item -->
|
30 |
+
<?php endforeach; ?>
|
31 |
+
</div><!-- .advads-stats-dd-items -->
|
32 |
+
</div><!-- .advads-stats-dd-button -->
|
33 |
+
</div><!-- .advads-stats-dd-container -->
|
34 |
+
<?php endif; ?>
|
35 |
+
<div class="advads-stats-age"><?php echo esc_html( $data_timestamp->format( get_option( 'time_format' ) ) ); ?></div>
|
36 |
+
</div><!-- .advads-stats-box-->
|
37 |
+
</div><!-- .advads-flex -->
|
modules/gadsense/admin/views/connect-adsense.php
CHANGED
@@ -55,7 +55,7 @@ if ( isset( $_get['oauth'] ) && '1' == $_get['oauth'] && isset( $_get['api'] ) &
|
|
55 |
<div class="gadsense-modal-content-inner" data-content="error" style="display:none;">
|
56 |
<i class="dashicons dashicons-dismiss"></i>
|
57 |
<h3><?php esc_html_e( 'Cannot access your account information.', 'advanced-ads' ); ?></h3>
|
58 |
-
<p class="error-message
|
59 |
<p class="error-description" style="font-size:1.1em;"></p>
|
60 |
</div>
|
61 |
<div class="gadsense-modal-content-inner" data-content="account-selector" style="display:none;">
|
55 |
<div class="gadsense-modal-content-inner" data-content="error" style="display:none;">
|
56 |
<i class="dashicons dashicons-dismiss"></i>
|
57 |
<h3><?php esc_html_e( 'Cannot access your account information.', 'advanced-ads' ); ?></h3>
|
58 |
+
<p class="error-message advads-notice-inline advads-error"></p>
|
59 |
<p class="error-description" style="font-size:1.1em;"></p>
|
60 |
</div>
|
61 |
<div class="gadsense-modal-content-inner" data-content="account-selector" style="display:none;">
|
modules/gadsense/admin/views/external-ads-links.php
CHANGED
@@ -35,6 +35,6 @@ $is_account_connected = $network->is_account_connected();
|
|
35 |
<?php endif; ?>
|
36 |
</p>
|
37 |
<?php if ( $is_account_connected && ! Advanced_Ads_Checks::php_version_minimum() ) : ?>
|
38 |
-
<p class="advads-error
|
39 |
<?php endif; ?>
|
40 |
|
35 |
<?php endif; ?>
|
36 |
</p>
|
37 |
<?php if ( $is_account_connected && ! Advanced_Ads_Checks::php_version_minimum() ) : ?>
|
38 |
+
<p class="advads-notice-inline advads-error"><?php esc_html_e( 'Can not connect AdSense account. PHP version is too low.', 'advanced-ads' ); ?></p>
|
39 |
<?php endif; ?>
|
40 |
|
modules/gadsense/admin/views/external-ads-list.php
CHANGED
@@ -26,7 +26,7 @@ if ( ! isset( $ad_units ) ) {
|
|
26 |
<?php if ($closeable): ?>
|
27 |
<button type="button" id="mapi-close-selector" class="notice-dismiss"></button>
|
28 |
<?php endif;?>
|
29 |
-
|
30 |
<i class="aa-select-list-update dashicons dashicons-update mapiaction" data-mapiaction="updateList" style="color:#0085ba;cursor:pointer;font-size:20px;" title="<?php esc_attr_e( 'Update the ad units list', 'advanced-ads' ); ?>"></i>
|
31 |
<div id="mapi-loading-overlay" class="aa-select-list-loading-overlay">
|
32 |
<img alt="..." src="<?php echo ADVADS_BASE_URL . 'admin/assets/img/loader.gif'; ?>" style="margin-top:8em;" />
|
@@ -55,17 +55,6 @@ if ( ! isset( $ad_units ) ) {
|
|
55 |
</tr>
|
56 |
</thead>
|
57 |
<tbody>
|
58 |
-
<?php if ( $load_inactive_button ) : ?>
|
59 |
-
<tr id="mapi-notice-inactive">
|
60 |
-
<td colspan="5" style="text-align:center;">
|
61 |
-
<?php esc_attr_e( 'No active ad units found', 'advanced-ads' ); ?>
|
62 |
-
<button type="button" class="mapiaction icon-button" data-mapiaction="toggleidle">
|
63 |
-
<?php esc_attr_e( 'Show all ad units', 'advanced-ads' ); ?>
|
64 |
-
<i class="dashicons dashicons-visibility" style="font-size:20px;"></i>
|
65 |
-
</button>
|
66 |
-
</td>
|
67 |
-
</tr>
|
68 |
-
<?php else : ?>
|
69 |
<?php if ( empty( $ad_units ) ) : ?>
|
70 |
<tr id="mapi-notice-noads">
|
71 |
<td colspan="5" style="text-align:center;">
|
@@ -77,17 +66,22 @@ if ( ! isset( $ad_units ) ) {
|
|
77 |
</td>
|
78 |
</tr>
|
79 |
<?php else :
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
|
|
|
|
85 |
<?php foreach ( $sorted_adunits as $unit ) : ?>
|
86 |
-
<tr class="advads-clickable-row mapiaction" data-mapiaction="getCode" data-slotid="<?php echo esc_attr( $unit->id ); ?>" data-active="<?php echo esc_attr( $unit->active ); ?>">
|
87 |
-
<td><?php echo $unit->name; ?></td>
|
88 |
<?php if ( $display_slot_id ) : ?>
|
89 |
<td class="unitcode">
|
90 |
-
<?php
|
|
|
|
|
|
|
91 |
</td>
|
92 |
<?php endif; ?>
|
93 |
<td class="unittype">
|
@@ -108,18 +102,17 @@ if ( ! isset( $ad_units ) ) {
|
|
108 |
</td>
|
109 |
</tr>
|
110 |
<?php endforeach; ?>
|
111 |
-
|
112 |
-
<?php endif; ?>
|
113 |
</tbody>
|
114 |
</table>
|
115 |
</div>
|
116 |
-
<p class="advads-error
|
117 |
<p class="advads-error-message" id="remote-ad-code-msg"></p>
|
118 |
</div>
|
119 |
|
120 |
<div style="display:none;" id="remote-ad-unsupported-ad-type">
|
121 |
-
<h3 class="advads-error
|
122 |
-
|
123 |
</h3>
|
124 |
<p>
|
125 |
<?php esc_html_e( 'You can proceed with one of the following solutions', 'advanced-ads' ); ?>:
|
26 |
<?php if ($closeable): ?>
|
27 |
<button type="button" id="mapi-close-selector" class="notice-dismiss"></button>
|
28 |
<?php endif;?>
|
29 |
+
<i id="mapi-archived-ads" title="<?php esc_attr_e( 'Hide archived ads', 'advanced-ads' ); ?>" data-alt-title="<?php esc_attr_e( 'Show archived ads', 'advanced-ads' ); ?>" class="dashicons dashicons-hidden"></i>
|
30 |
<i class="aa-select-list-update dashicons dashicons-update mapiaction" data-mapiaction="updateList" style="color:#0085ba;cursor:pointer;font-size:20px;" title="<?php esc_attr_e( 'Update the ad units list', 'advanced-ads' ); ?>"></i>
|
31 |
<div id="mapi-loading-overlay" class="aa-select-list-loading-overlay">
|
32 |
<img alt="..." src="<?php echo ADVADS_BASE_URL . 'admin/assets/img/loader.gif'; ?>" style="margin-top:8em;" />
|
55 |
</tr>
|
56 |
</thead>
|
57 |
<tbody>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
<?php if ( empty( $ad_units ) ) : ?>
|
59 |
<tr id="mapi-notice-noads">
|
60 |
<td colspan="5" style="text-align:center;">
|
66 |
</td>
|
67 |
</tr>
|
68 |
<?php else :
|
69 |
+
// Force a refresh the first time the ad list is opened after an update.
|
70 |
+
echo ! isset( $ad_units[0]->raw['nameV2'] ) ? '<input type="hidden" id="mapi-force-v2-list-update" value="" />' : '';
|
71 |
+
foreach ( $ad_units as $ad_unit ) {
|
72 |
+
$ad_unit->is_supported = $network->is_supported( $ad_unit );
|
73 |
+
}
|
74 |
+
$sorted_adunits = Advanced_Ads_Ad_Network_Ad_Unit::sort_ad_units( $ad_units, $external_ad_unit_id );
|
75 |
+
?>
|
76 |
<?php foreach ( $sorted_adunits as $unit ) : ?>
|
77 |
+
<tr <?php echo $unit->raw['status'] === 'ARCHIVED' ? 'data-archived="1"' : ''; ?> class="advads-clickable-row mapiaction" data-mapiaction="getCode" data-slotid="<?php echo esc_attr( $unit->id ); ?>" data-active="<?php echo esc_attr( $unit->active ); ?>">
|
78 |
+
<td><?php echo esc_html( $unit->name ); ?></td>
|
79 |
<?php if ( $display_slot_id ) : ?>
|
80 |
<td class="unitcode">
|
81 |
+
<?php
|
82 |
+
echo '<span>' . esc_html( $unit->slot_id ) . '</span>';
|
83 |
+
echo $unit->raw['status'] === 'ARCHIVED' ? ' <code>' . esc_html__( 'Archived', 'advanced-ads' ) . '</code>' : '';
|
84 |
+
?>
|
85 |
</td>
|
86 |
<?php endif; ?>
|
87 |
<td class="unittype">
|
102 |
</td>
|
103 |
</tr>
|
104 |
<?php endforeach; ?>
|
105 |
+
<?php endif; ?>
|
|
|
106 |
</tbody>
|
107 |
</table>
|
108 |
</div>
|
109 |
+
<p class="advads-notice-inline advads-error" id="remote-ad-code-error" style="display:none;"><strong><?php esc_attr_e( 'Unrecognized ad code', 'advanced-ads' ); ?></strong></p>
|
110 |
<p class="advads-error-message" id="remote-ad-code-msg"></p>
|
111 |
</div>
|
112 |
|
113 |
<div style="display:none;" id="remote-ad-unsupported-ad-type">
|
114 |
+
<h3 class="advads-notice-inline advads-error">
|
115 |
+
<?php esc_html_e( 'This ad type can currently not be imported from AdSense.', 'advanced-ads' ); ?>
|
116 |
</h3>
|
117 |
<p>
|
118 |
<?php esc_html_e( 'You can proceed with one of the following solutions', 'advanced-ads' ); ?>:
|
modules/gadsense/config.php
CHANGED
@@ -6,14 +6,16 @@ $path = dirname( __FILE__ );
|
|
6 |
|
7 |
return array(
|
8 |
'classmap' => array(
|
9 |
-
'Advanced_Ads_Ad_Type_Adsense'
|
10 |
-
'Advanced_Ads_AdSense_Data'
|
11 |
-
'Advanced_Ads_AdSense_MAPI'
|
12 |
-
'Advanced_Ads_AdSense_Admin'
|
13 |
-
'Advanced_Ads_AdSense_Public'
|
14 |
-
'
|
|
|
|
|
15 |
|
16 |
-
|
17 |
),
|
18 |
'textdomain' => null,
|
19 |
-
);
|
6 |
|
7 |
return array(
|
8 |
'classmap' => array(
|
9 |
+
'Advanced_Ads_Ad_Type_Adsense' => $path . '/includes/class-ad-type-adsense.php',
|
10 |
+
'Advanced_Ads_AdSense_Data' => $path . '/includes/class-gadsense-data.php',
|
11 |
+
'Advanced_Ads_AdSense_MAPI' => $path . '/includes/class-mapi.php',
|
12 |
+
'Advanced_Ads_AdSense_Admin' => $path . '/admin/admin.php',
|
13 |
+
'Advanced_Ads_AdSense_Public' => $path . '/public/public.php',
|
14 |
+
'Advanced_Ads_AdSense_Report' => $path . '/includes/class-adsense-report.php',
|
15 |
+
'Advanced_Ads_AdSense_Report_Data' => $path . '/includes/adsense-report-data.php',
|
16 |
+
'Advanced_Ads_AdSense_Report_Api' => $path . '/includes/adsense-report-api.php',
|
17 |
|
18 |
+
'Advanced_Ads_Network_Adsense' => $path . '/includes/class-network-adsense.php',
|
19 |
),
|
20 |
'textdomain' => null,
|
21 |
+
);
|
modules/gadsense/includes/adsense-report-api.php
ADDED
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Retrieve report data from Google.
|
5 |
+
*/
|
6 |
+
class Advanced_Ads_AdSense_Report_Api {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Report endpoint.
|
10 |
+
*
|
11 |
+
* @var string
|
12 |
+
*/
|
13 |
+
const ENDPOINT_URL = 'https://adsense.googleapis.com/v2/accounts/%pubid%/reports:generate?startDate.year=%SY%&startDate.month=%SM%&startDate.day=%SD%'
|
14 |
+
. '&endDate.year=%EY%&endDate.day=%ED%&endDate.month=%EM%&dimensions=%DIM%&dimensions=DATE&metrics=ESTIMATED_EARNINGS&reportingTimeZone=ACCOUNT_TIME_ZONE';
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Version of the AdSense Management API in use (for getting fresh data).
|
18 |
+
*
|
19 |
+
* @var string
|
20 |
+
*/
|
21 |
+
const API_VERSION = '2.0';
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Report type
|
25 |
+
*
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
+
private $type;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* The API access token or an error array.
|
32 |
+
*
|
33 |
+
* @var array|string
|
34 |
+
*/
|
35 |
+
private $access_token;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* The current connected AdSense account.
|
39 |
+
*
|
40 |
+
* @var string
|
41 |
+
*/
|
42 |
+
private $publisher_id;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Instance constructor.
|
46 |
+
*
|
47 |
+
* @param string $type report type.
|
48 |
+
*/
|
49 |
+
public function __construct( $type ) {
|
50 |
+
$publisher_id = Advanced_Ads_AdSense_Data::get_instance()->get_adsense_id();
|
51 |
+
$this->type = $type;
|
52 |
+
$this->access_token = Advanced_Ads_AdSense_MAPI::get_access_token( $publisher_id );
|
53 |
+
$this->publisher_id = $publisher_id;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Checks if the current setup has an access token.
|
58 |
+
*
|
59 |
+
* @return bool true if there is a token.
|
60 |
+
*/
|
61 |
+
public function has_token() {
|
62 |
+
return is_string( $this->access_token );
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Get access token related error message.
|
67 |
+
*
|
68 |
+
* @return array Array of error messages.
|
69 |
+
*/
|
70 |
+
public function get_token_error() {
|
71 |
+
return is_string( $this->access_token ) ? array() : $this->access_token;
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Check if there is an error related to access tokens.
|
76 |
+
*
|
77 |
+
* @return bool true if any error happened when requesting an access token.
|
78 |
+
*/
|
79 |
+
public function has_token_error() {
|
80 |
+
return ! is_string( $this->access_token );
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Perform the actual call to Google for fresh data.
|
85 |
+
*
|
86 |
+
* @return array associative array with the response or with error data in case of failure.
|
87 |
+
*/
|
88 |
+
public function call_google() {
|
89 |
+
$dimension = $this->type === 'unit' ? 'AD_UNIT_ID' : 'DOMAIN_NAME';
|
90 |
+
$today = date_create( 'now' );
|
91 |
+
$start_date = date_create( 'now' )->sub( date_interval_create_from_date_string( '28 days' ) );
|
92 |
+
|
93 |
+
// Replace placeholder in the endpoint with actual arguments.
|
94 |
+
$url = str_replace(
|
95 |
+
array(
|
96 |
+
'%pubid%',
|
97 |
+
'%DIM%',
|
98 |
+
'%SY%',
|
99 |
+
'%SM%',
|
100 |
+
'%SD%',
|
101 |
+
'%EY%',
|
102 |
+
'%EM%',
|
103 |
+
'%ED%',
|
104 |
+
),
|
105 |
+
array(
|
106 |
+
$this->publisher_id,
|
107 |
+
$dimension,
|
108 |
+
$start_date->format( 'Y' ),
|
109 |
+
$start_date->format( 'n' ),
|
110 |
+
$start_date->format( 'j' ),
|
111 |
+
$today->format( 'Y' ),
|
112 |
+
$today->format( 'n' ),
|
113 |
+
$today->format( 'j' ),
|
114 |
+
),
|
115 |
+
self::ENDPOINT_URL
|
116 |
+
);
|
117 |
+
|
118 |
+
$headers = array(
|
119 |
+
'Authorization' => 'Bearer ' . $this->access_token,
|
120 |
+
);
|
121 |
+
|
122 |
+
$response = wp_remote_get( $url, array( 'headers' => $headers ) );
|
123 |
+
Advanced_Ads_AdSense_MAPI::log( 'Fetched AdSense Report from ' . $url );
|
124 |
+
|
125 |
+
if ( is_wp_error( $response ) ) {
|
126 |
+
return array(
|
127 |
+
'status' => false,
|
128 |
+
// translators: AdSense ID.
|
129 |
+
'msg' => sprintf( esc_html__( 'Error while retrieving report for "%s".', 'advanced-ads' ), $this->publisher_id ),
|
130 |
+
'raw' => $response->get_error_message(),
|
131 |
+
);
|
132 |
+
}
|
133 |
+
|
134 |
+
$response_body = json_decode( $response['body'], true );
|
135 |
+
|
136 |
+
if ( $response_body === null ) {
|
137 |
+
return array(
|
138 |
+
'status' => false,
|
139 |
+
// translators: AdSense ID.
|
140 |
+
'msg' => sprintf( esc_html__( 'Invalid response while retrieving report for "%s".', 'advanced-ads' ), $this->publisher_id ),
|
141 |
+
'raw' => $response['body'],
|
142 |
+
);
|
143 |
+
}
|
144 |
+
|
145 |
+
if ( ! isset( $response_body['totalMatchedRows'] ) ) {
|
146 |
+
return array(
|
147 |
+
'status' => false,
|
148 |
+
// translators: AdSense ID.
|
149 |
+
'msg' => sprintf( esc_html__( 'Invalid response while retrieving report for "%s".', 'advanced-ads' ), $this->publisher_id ),
|
150 |
+
'raw' => $response['body'],
|
151 |
+
);
|
152 |
+
}
|
153 |
+
|
154 |
+
$response_body['api_version'] = self::API_VERSION;
|
155 |
+
$response_body['timestamp'] = time();
|
156 |
+
|
157 |
+
return array(
|
158 |
+
'status' => true,
|
159 |
+
'response_body' => $response_body,
|
160 |
+
);
|
161 |
+
}
|
162 |
+
|
163 |
+
}
|
modules/gadsense/includes/adsense-report-data.php
ADDED
@@ -0,0 +1,287 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Handle all report data received from Google
|
5 |
+
*/
|
6 |
+
class Advanced_Ads_AdSense_Report_Data implements Serializable {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Cached data life span.
|
10 |
+
*
|
11 |
+
* @var integer
|
12 |
+
*/
|
13 |
+
const CACHE_DURATION = 3600;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* DB option name for report by domain.
|
17 |
+
*
|
18 |
+
* @var string
|
19 |
+
*/
|
20 |
+
const DOMAIN_OPTION = 'advanced_ads_adsense_report_domain';
|
21 |
+
|
22 |
+
/**
|
23 |
+
* DB option name for report by ad unit.
|
24 |
+
*
|
25 |
+
* @var string
|
26 |
+
*/
|
27 |
+
const UNIT_OPTION = 'advanced_ads_adsense_report_unit';
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Daily earnings.
|
31 |
+
*
|
32 |
+
* @var null|array
|
33 |
+
*/
|
34 |
+
private $earnings;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Report type. 'unit' or 'domain'.
|
38 |
+
*
|
39 |
+
* @var null|string
|
40 |
+
*/
|
41 |
+
private $type;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* UNIX timestamp at which the data was obtained from Google.
|
45 |
+
*
|
46 |
+
* @var int
|
47 |
+
*/
|
48 |
+
private $timestamp = 0;
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Currency used in the report.
|
52 |
+
*
|
53 |
+
* @var string
|
54 |
+
*/
|
55 |
+
private $currency = '';
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Version of Google AdSense Management API used.
|
59 |
+
*
|
60 |
+
* @var string
|
61 |
+
*/
|
62 |
+
private $version = '';
|
63 |
+
|
64 |
+
/**
|
65 |
+
* List of domain names found in the report data.
|
66 |
+
*
|
67 |
+
* @var array
|
68 |
+
*/
|
69 |
+
private $domains = array();
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Instance constructor.
|
73 |
+
*
|
74 |
+
* @param string $type report type.
|
75 |
+
*/
|
76 |
+
public function __construct( $type = 'unit' ) {
|
77 |
+
$this->type = $type;
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Get all domains.
|
82 |
+
*
|
83 |
+
* @return array the domain list.
|
84 |
+
*/
|
85 |
+
public function get_domains() {
|
86 |
+
return $this->domains;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Get the report timestamp.
|
91 |
+
*
|
92 |
+
* @return int data timestamp.
|
93 |
+
*/
|
94 |
+
public function get_timestamp() {
|
95 |
+
return $this->timestamp;
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Get the currency used in the report.
|
100 |
+
*
|
101 |
+
* @return string the currency code.
|
102 |
+
*/
|
103 |
+
public function get_currency() {
|
104 |
+
return $this->currency;
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Returns serialized object properties.
|
109 |
+
*
|
110 |
+
* @return string the serialized data.
|
111 |
+
*/
|
112 |
+
public function serialize() {
|
113 |
+
return serialize( array(
|
114 |
+
'earnings' => $this->earnings,
|
115 |
+
'type' => $this->type,
|
116 |
+
'timestamp' => $this->timestamp,
|
117 |
+
'currency' => $this->currency,
|
118 |
+
'domains' => $this->domains,
|
119 |
+
) );
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Set object properties from serialized data string.
|
124 |
+
*
|
125 |
+
* @param string $data serilaized data from DB.
|
126 |
+
*/
|
127 |
+
public function unserialize( $data ) {
|
128 |
+
try {
|
129 |
+
$unwrapped = unserialize( $data );
|
130 |
+
} catch ( Exception $ex ) {
|
131 |
+
$unwrapped = array();
|
132 |
+
}
|
133 |
+
|
134 |
+
$this->earnings = isset( $unwrapped['earnings'] ) ? $unwrapped['earnings'] : null;
|
135 |
+
$this->type = isset( $unwrapped['type'] ) ? $unwrapped['type'] : null;
|
136 |
+
$this->timestamp = isset( $unwrapped['timestamp'] ) ? $unwrapped['timestamp'] : 0;
|
137 |
+
$this->currency = isset( $unwrapped['currency'] ) ? $unwrapped['currency'] : '';
|
138 |
+
$this->domains = isset( $unwrapped['domains'] ) ? $unwrapped['domains'] : array();
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Update object properties and DB record from a API response.
|
143 |
+
*
|
144 |
+
* @param array $response API call response from Google.
|
145 |
+
*/
|
146 |
+
public function update_data_from_response( $response ) {
|
147 |
+
$headers = array();
|
148 |
+
$this->version = $response['api_version'];
|
149 |
+
$this->timestamp = $response['timestamp'];
|
150 |
+
foreach ( $response['headers'] as $header ) {
|
151 |
+
if ( $header['type'] === 'METRIC_CURRENCY' ) {
|
152 |
+
$this->currency = $header['currencyCode'];
|
153 |
+
}
|
154 |
+
$headers[] = $header['name'];
|
155 |
+
}
|
156 |
+
$earnings = array();
|
157 |
+
|
158 |
+
if ( ! empty( $response['rows'] ) ) {
|
159 |
+
foreach ( $response['rows'] as $row ) {
|
160 |
+
$earning = new StdClass();
|
161 |
+
foreach ( $row['cells'] as $index => $cell ) {
|
162 |
+
switch ( $headers[ $index ] ) {
|
163 |
+
case 'DATE':
|
164 |
+
$earning->date = new DateTime( $cell['value'] );
|
165 |
+
break;
|
166 |
+
case 'ESTIMATED_EARNINGS':
|
167 |
+
$earning->estimated_earning = (float) $cell['value'];
|
168 |
+
break;
|
169 |
+
default: // "DOMAIN_NAME" or "AD_UNIT_ID".
|
170 |
+
$earning->{strtolower( $headers[ $index ] )} = $cell['value'];
|
171 |
+
if ( $headers[ $index ] === 'DOMAIN_NAME' && ! in_array( $cell['value'], $this->domains, true ) ) {
|
172 |
+
$this->domains[] = $cell['value'];
|
173 |
+
}
|
174 |
+
}
|
175 |
+
}
|
176 |
+
$earnings[] = $earning;
|
177 |
+
}
|
178 |
+
}
|
179 |
+
$this->earnings = $earnings;
|
180 |
+
$option_name = $this->type === 'unit' ? self::UNIT_OPTION : self::DOMAIN_OPTION;
|
181 |
+
|
182 |
+
// Delete old options entries.
|
183 |
+
delete_option( 'advanced_ads_adsense_report_DATE_AD_UNIT_CODE_EARNINGS_dashboard' );
|
184 |
+
delete_option( 'advanced_ads_adsense_report_DATE_DOMAIN_NAME_EARNINGS_dashboard' );
|
185 |
+
|
186 |
+
// Save the data instance in DB.
|
187 |
+
update_option( $option_name, $this );
|
188 |
+
}
|
189 |
+
|
190 |
+
/**
|
191 |
+
* Returns a data object constructed from saved data. Constructs a new one if there is no usable data.
|
192 |
+
*
|
193 |
+
* @param string $type report type.
|
194 |
+
*
|
195 |
+
* @return Advanced_Ads_AdSense_Report_Data
|
196 |
+
*/
|
197 |
+
public static function get_data_from_options( $type ) {
|
198 |
+
$option_name = $type === 'unit' ? self::UNIT_OPTION : self::DOMAIN_OPTION;
|
199 |
+
$option = get_option( $option_name, false );
|
200 |
+
if ( $option === false ) {
|
201 |
+
return new self( $type );
|
202 |
+
}
|
203 |
+
try {
|
204 |
+
$unserialized = unserialize( $option );
|
205 |
+
if ( $unserialized instanceof self ) {
|
206 |
+
return $unserialized;
|
207 |
+
}
|
208 |
+
|
209 |
+
return new self( $type );
|
210 |
+
} catch ( Exception $ex ) {
|
211 |
+
return new self( $type );
|
212 |
+
}
|
213 |
+
}
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Checks if cached data need to be updated.
|
217 |
+
*
|
218 |
+
* @return bool true if the stored data has not expired yet.
|
219 |
+
*/
|
220 |
+
public function is_valid() {
|
221 |
+
return $this->timestamp + self::CACHE_DURATION > time();
|
222 |
+
}
|
223 |
+
|
224 |
+
/**
|
225 |
+
* Get the earnings sums for display.
|
226 |
+
*
|
227 |
+
* @param string $filter filter sums by a given domain name or ad unit.
|
228 |
+
*
|
229 |
+
* @return int[]
|
230 |
+
*/
|
231 |
+
public function get_sums( $filter = '' ) {
|
232 |
+
$today = new DateTime();
|
233 |
+
$yesterday = date_create()->sub( date_interval_create_from_date_string( '1 day' ) );
|
234 |
+
$prev7 = date_create()->sub( date_interval_create_from_date_string( '7 days' ) );
|
235 |
+
$prev28 = date_create()->sub( date_interval_create_from_date_string( '28 days' ) );
|
236 |
+
$sums = array(
|
237 |
+
'today' => 0,
|
238 |
+
'yesterday' => 0,
|
239 |
+
'7days' => 0,
|
240 |
+
'this_month' => 0,
|
241 |
+
'28days' => 0,
|
242 |
+
);
|
243 |
+
|
244 |
+
// Unit type reports should always have the ad unit id specified.
|
245 |
+
if ( $filter === '' && $this->type === 'unit' ) {
|
246 |
+
return $sums;
|
247 |
+
}
|
248 |
+
|
249 |
+
foreach ( $this->earnings as $value ) {
|
250 |
+
if ( ! empty( $filter ) && $this->type === 'unit' && false === strpos( $value->ad_unit_id, $filter ) ) {
|
251 |
+
continue;
|
252 |
+
}
|
253 |
+
if ( $this->date_ymd( $value->date ) === $this->date_ymd( $today ) ) {
|
254 |
+
$sums['today'] += $value->estimated_earning;
|
255 |
+
}
|
256 |
+
if ( $this->date_ymd( $value->date ) === $this->date_ymd( $yesterday ) ) {
|
257 |
+
$sums['yesterday'] += $value->estimated_earning;
|
258 |
+
}
|
259 |
+
if ( $this->date_ymd( $value->date ) >= $this->date_ymd( $prev7 ) ) {
|
260 |
+
$sums['7days'] += $value->estimated_earning;
|
261 |
+
}
|
262 |
+
if ( $this->date_ymd( $value->date ) >= $this->date_ymd( $prev28 ) ) {
|
263 |
+
$sums['28days'] += $value->estimated_earning;
|
264 |
+
}
|
265 |
+
if ( $value->date->format( 'm' ) === $today->format( 'm' ) ) {
|
266 |
+
$sums['this_month'] += $value->estimated_earning;
|
267 |
+
}
|
268 |
+
}
|
269 |
+
|
270 |
+
return $sums;
|
271 |
+
}
|
272 |
+
|
273 |
+
/**
|
274 |
+
* Get an integer representation of a DateTime object to be used in date comparison.
|
275 |
+
*
|
276 |
+
* @param DateTime $date the DateTime object.
|
277 |
+
*
|
278 |
+
* @return int
|
279 |
+
*/
|
280 |
+
private function date_ymd( $date ) {
|
281 |
+
if ( $date instanceof DateTime ) {
|
282 |
+
return (int) $date->format( 'Ymd' );
|
283 |
+
}
|
284 |
+
|
285 |
+
return 0;
|
286 |
+
}
|
287 |
+
}
|
modules/gadsense/includes/class-adsense-report.php
CHANGED
@@ -1,600 +1,143 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* Class
|
5 |
-
|
6 |
-
|
7 |
-
public $name;
|
8 |
-
public function __construct($name){
|
9 |
-
$this->name = $name;
|
10 |
-
}
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Class Advanced_Ads_AdSense_Report_Dimension
|
15 |
-
*/
|
16 |
-
class Advanced_Ads_AdSense_Report_Dimension extends Advanced_Ads_Adsense_Report_Column{
|
17 |
-
public function __construct($name){
|
18 |
-
parent::__construct($name);
|
19 |
-
}
|
20 |
-
}
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Class Advanced_Ads_AdSense_Report_Metric
|
24 |
-
*/
|
25 |
-
class Advanced_Ads_AdSense_Report_Metric extends Advanced_Ads_Adsense_Report_Column{
|
26 |
-
public function __construct($name){
|
27 |
-
parent::__construct($name);
|
28 |
-
}
|
29 |
-
}
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Class Advanced_Ads_Adsense_Dimensional_Data
|
33 |
-
*/
|
34 |
-
class Advanced_Ads_Adsense_Dimensional_Data{
|
35 |
-
|
36 |
-
}
|
37 |
-
/**
|
38 |
-
* Represents the response that will be sent to the javascript frontend
|
39 |
-
* after a report has been requested
|
40 |
-
* this holds all the plot & trace info
|
41 |
*/
|
42 |
-
class
|
43 |
-
public $plots = array();
|
44 |
-
}
|
45 |
|
46 |
-
/**
|
47 |
-
* Class Advanced_Ads_AdSense_Report_Builder
|
48 |
-
*/
|
49 |
-
class Advanced_Ads_AdSense_Report_Builder{
|
50 |
/**
|
51 |
-
*
|
52 |
-
*
|
|
|
53 |
*/
|
54 |
-
|
55 |
-
private $dimensions = array();
|
56 |
-
private $metrics = array();
|
57 |
-
private $dt_start;
|
58 |
-
private $dt_end;
|
59 |
-
private $overwrite_dt_identifier;
|
60 |
-
private $store_as_transient = false;
|
61 |
-
|
62 |
-
public function addDimension($name){
|
63 |
-
$dim = new Advanced_Ads_AdSense_Report_Dimension($name);
|
64 |
-
$this->dimensions[] = $dim;
|
65 |
-
}
|
66 |
-
public function addMetric($name){
|
67 |
-
$dim = new Advanced_Ads_AdSense_Report_Metric($name);
|
68 |
-
$this->metrics[] = $dim;
|
69 |
-
}
|
70 |
-
public function setDaterange($dt_start, $dt_end){
|
71 |
-
$this->dt_start = $dt_start;
|
72 |
-
$this->dt_end = $dt_end;
|
73 |
-
}
|
74 |
-
public function setOverwriteDaterangeIdentifier($id){
|
75 |
-
$this->overwrite_dt_identifier = $id;
|
76 |
-
}
|
77 |
-
public function setStoreAsTransient($store_as_transient_bool){
|
78 |
-
$this->store_as_transient = $store_as_transient_bool;
|
79 |
-
}
|
80 |
-
public function setDaterangeByDays($nbDays, $dt_end = null){
|
81 |
-
if (! $dt_end) $dt_end = (new DateTime())->format("Y-m-d");
|
82 |
-
$dt = new DateTime($dt_end);
|
83 |
-
$dt->sub(new DateInterval("P" . $nbDays . "D"));
|
84 |
-
$this->setDaterange($dt->format("Y-m-d"), $dt_end);
|
85 |
-
}
|
86 |
|
87 |
-
public function getUrl($pubId){
|
88 |
-
$url = 'https://www.googleapis.com/adsense/v1.4/accounts/' . $pubId . '/reports';
|
89 |
-
$url .= "?startDate=$this->dt_start&endDate=$this->dt_end";
|
90 |
-
foreach ($this->dimensions as $dim){
|
91 |
-
$url .= "&dimension=$dim->name";
|
92 |
-
}
|
93 |
-
foreach ($this->metrics as $metric){
|
94 |
-
$url .= "&metric=$metric->name";
|
95 |
-
}
|
96 |
-
$url.="&useTimezoneReporting=true";
|
97 |
-
return $url;
|
98 |
-
}
|
99 |
/**
|
100 |
-
*
|
|
|
|
|
101 |
*/
|
102 |
-
|
103 |
-
$id = "advanced_ads_adsense_report_";
|
104 |
-
foreach ($this->dimensions as $dim){
|
105 |
-
$id .= $dim->name . "_";
|
106 |
-
}
|
107 |
-
foreach ($this->metrics as $metric){
|
108 |
-
$id .= $metric->name . "_";
|
109 |
-
}
|
110 |
-
if ($this->overwrite_dt_identifier){
|
111 |
-
$id .= $this->overwrite_dt_identifier;
|
112 |
-
}
|
113 |
-
else{
|
114 |
-
$id.= $this->dt_start . "_" . $this->dt_end;
|
115 |
-
}
|
116 |
-
return $id;
|
117 |
-
}
|
118 |
-
|
119 |
-
public function request_raw(){
|
120 |
-
//gather the data for the request
|
121 |
-
$gadsense_data = Advanced_Ads_AdSense_Data::get_instance();
|
122 |
-
$pub_id = trim($gadsense_data->get_adsense_id());
|
123 |
-
$access_token = Advanced_Ads_AdSense_MAPI::get_access_token($pub_id);
|
124 |
-
//build the url and request it
|
125 |
-
$url = $this->getUrl($pub_id);
|
126 |
-
return $this->process_request($url, $access_token);
|
127 |
-
}
|
128 |
-
|
129 |
-
public static function get_age_in_seconds($updated_at){
|
130 |
-
// when upgrading from a previous version of AA to V1.14.2+ a refresh of the adsense dashboard
|
131 |
-
// within one hour, might raise a notice when users are running their site in dev mode
|
132 |
-
// originally updated_at was a DateTime, it is a simple timestamp now, so we need to catch
|
133 |
-
// the DateTimes and replace them with numbers.
|
134 |
-
if (!$updated_at || ! is_integer($updated_at) ){
|
135 |
-
//trigger a reload, by setting it to a low, failsafe value
|
136 |
-
$updated_at = 0;
|
137 |
-
}
|
138 |
-
return (new DateTime())->getTimestamp() - $updated_at;
|
139 |
-
}
|
140 |
-
|
141 |
-
public function build($plotter, $type, $forceRefresh = false, $allowRefresh = true){
|
142 |
-
$transient_id = $this->getIdentifier();
|
143 |
-
$response = $this->get_option($transient_id);
|
144 |
-
// $wants_refresh = $forceRefresh || $response == null || ! isset($response['body']) || ! isset($response['body']->rows);
|
145 |
-
$wants_refresh = $forceRefresh || $response == null || ! isset($response['body']);
|
146 |
-
if ($response){
|
147 |
-
$age_in_seconds = self::get_age_in_seconds($response['updatedAt']);
|
148 |
-
if ($age_in_seconds >= self::TRANSIENT_VALIDITY) $wants_refresh = true;
|
149 |
-
|
150 |
-
}
|
151 |
-
if ($wants_refresh){
|
152 |
-
if ($allowRefresh){
|
153 |
-
|
154 |
-
$response = $this->request_raw();
|
155 |
-
if (is_array($response) && isset($response['body']) && isset($response['headers'])){
|
156 |
-
// remove all but body and header
|
157 |
-
foreach ($response as $key => $val){
|
158 |
-
if ($key != "body" && $key != "header"){
|
159 |
-
unset($response[$key]);
|
160 |
-
}
|
161 |
-
}
|
162 |
-
$response['updatedAt'] = (new DateTime())->getTimestamp();
|
163 |
-
//set_transient($transient_id, $response, self::TRANSIENT_VALIDITY);
|
164 |
-
//update_option($transient_id, $response);
|
165 |
-
$this->save_option($transient_id, $response);
|
166 |
-
}
|
167 |
-
}
|
168 |
-
}
|
169 |
-
else if (! $forceRefresh){
|
170 |
-
$response = $this->get_option($transient_id); // just a little fallback. it actually should never happen.
|
171 |
-
}
|
172 |
-
if ($response){
|
173 |
-
return new Advanced_Ads_AdSense_Report($response, $plotter, $type);
|
174 |
-
}
|
175 |
-
return null;
|
176 |
-
}
|
177 |
-
|
178 |
-
public function request_report($plotter, $type){
|
179 |
-
$response = $this->request_raw();
|
180 |
-
try{
|
181 |
-
$report = $this->build($plotter, $type, true);
|
182 |
-
if ($response){
|
183 |
-
$response = $report->generateResponse();
|
184 |
-
return $response;
|
185 |
-
}
|
186 |
-
}
|
187 |
-
catch(Exception $ex){}
|
188 |
-
return null;
|
189 |
-
}
|
190 |
-
|
191 |
-
private function get_option($id){
|
192 |
-
if ($this->store_as_transient) {
|
193 |
-
return get_transient($id);
|
194 |
-
}
|
195 |
-
else{
|
196 |
-
return get_option($id);
|
197 |
-
}
|
198 |
-
}
|
199 |
-
private function save_option($id, $value){
|
200 |
-
if ($this->store_as_transient) {
|
201 |
-
set_transient($id, $value, self::TRANSIENT_VALIDITY);
|
202 |
-
}
|
203 |
-
else{
|
204 |
-
update_option($id, $value);
|
205 |
-
}
|
206 |
-
}
|
207 |
-
|
208 |
-
private function process_request($url, $access_token){
|
209 |
-
if ( ! isset( $access_token['msg'] ) ) {
|
210 |
-
$headers = array(
|
211 |
-
'Authorization' => 'Bearer ' . $access_token,
|
212 |
-
);
|
213 |
-
$adsense_data = wp_remote_get( $url, array( 'headers' => $headers ) );
|
214 |
-
Advanced_Ads_AdSense_MAPI::log("Fetched AdSense Report from $url");
|
215 |
-
return $adsense_data;
|
216 |
-
} else {
|
217 |
-
return -1;
|
218 |
-
}
|
219 |
-
}
|
220 |
|
221 |
/**
|
222 |
-
*
|
|
|
|
|
223 |
*/
|
224 |
-
|
225 |
-
$builder = new Advanced_Ads_AdSense_Report_Builder();
|
226 |
-
$builder->setDaterangeByDays(30);
|
227 |
-
$builder->addDimension("DATE");
|
228 |
-
$builder->addDimension($secondary_dimension_name);
|
229 |
-
$builder->addMetric("EARNINGS");
|
230 |
-
$builder->setOverwriteDaterangeIdentifier($overwrite_dt_identifier);
|
231 |
-
$report = $builder->build("plotly", "lines", $force_refresh, $allow_refresh);
|
232 |
-
$summary = Advanced_Ads_AdSense_Dashboard_Summary::create($report, $filter_value, $optional_dimension_names);
|
233 |
-
$summary->dimension_name = $secondary_dimension_name;
|
234 |
-
return $summary;
|
235 |
-
}
|
236 |
-
}
|
237 |
-
|
238 |
-
/**
|
239 |
-
* Class Advanced_Ads_AdSense_Report
|
240 |
-
*/
|
241 |
-
class Advanced_Ads_AdSense_Report{
|
242 |
-
public $valid;
|
243 |
-
public $errors;
|
244 |
-
public $dimensions;
|
245 |
-
public $dimensionalData;
|
246 |
-
public $metrics;
|
247 |
-
public $columns;
|
248 |
-
public $plotGenerator;
|
249 |
-
public $secondaryDimension;
|
250 |
-
|
251 |
-
function __construct($json_response, $plotter='jqplot', $type='lines'){
|
252 |
-
$this->plotter = $plotter;
|
253 |
-
$this->type = $type;
|
254 |
-
$this->process_json_response($json_response);
|
255 |
-
// $this->plotGenerator = $plotter === 'jqplot'
|
256 |
-
// ? new Advanced_Ads_AdSense_Plot_Generator_Jqplot($this)
|
257 |
-
// : new Advanced_Ads_AdSense_Plot_Generator_Plotly($this);
|
258 |
-
}
|
259 |
|
260 |
/**
|
261 |
-
*
|
262 |
*
|
263 |
-
* @param
|
264 |
-
* @
|
265 |
*/
|
266 |
-
|
267 |
-
$
|
268 |
-
$errors = array();
|
269 |
-
if ($json_response && is_array($json_response)){
|
270 |
-
$body = isset($json_response['body']) ? json_decode($json_response['body']) : null;
|
271 |
-
if ($body && isset($body->headers) && is_array($body->headers)){
|
272 |
-
try{
|
273 |
-
$headers = $body->headers;
|
274 |
-
$dimensions = array();
|
275 |
-
$metrics = array();
|
276 |
-
foreach ($headers as $header){
|
277 |
-
$name = $header->name;
|
278 |
-
$type = $header->type;
|
279 |
-
if ($type === "DIMENSION"){
|
280 |
-
$object = new Advanced_Ads_AdSense_Report_Dimension($name);
|
281 |
-
$dimensions[] = $object;
|
282 |
-
}
|
283 |
-
else if ($type === "METRIC_TALLY"){
|
284 |
-
$object = new Advanced_Ads_AdSense_Report_Metric($name);
|
285 |
-
$metrics[] = $object;
|
286 |
-
}
|
287 |
-
else if ($type === "METRIC_RATIO"){
|
288 |
-
$object = new Advanced_Ads_AdSense_Report_Metric($name);
|
289 |
-
$metrics[] = $object;
|
290 |
-
}
|
291 |
-
else if ($type === "METRIC_CURRENCY"){
|
292 |
-
$object = new Advanced_Ads_AdSense_Report_Metric($name);
|
293 |
-
$object->currency = $header->currency;
|
294 |
-
$metrics[] = $object;
|
295 |
-
}
|
296 |
-
else{
|
297 |
-
throw new RuntimeException("Unknown Header Type: $type");
|
298 |
-
}
|
299 |
-
$columns[] = $object;
|
300 |
-
}
|
301 |
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
$this->columns = $columns;
|
308 |
-
$this->secondaryDimension = count($dimensions) > 1 ? $dimensions[1] : null;
|
309 |
-
$this->updatedAt = isset($json_response['updatedAt']) ? $json_response['updatedAt'] : null;
|
310 |
-
} else {
|
311 |
-
throw new RuntimeException( __( 'Invalid response from AdSense.', 'advanced-ads' ) . ' ' . __( 'You could try to re-connect under Advanced Ads > Settings > AdSense.', 'advanced-ads' ) );
|
312 |
-
}
|
313 |
-
}
|
314 |
-
catch (Exception $ex){
|
315 |
-
$valid = false;
|
316 |
-
}
|
317 |
-
}
|
318 |
-
else{
|
319 |
-
if ($body->error && $body->error->errors && is_array($body->error->errors) && count($body->error->errors)){
|
320 |
-
foreach ($body->error->errors as $err){
|
321 |
-
$hint = Advanced_Ads_AdSense_MAPI::get_adsense_error_hint($err->reason);
|
322 |
-
if ($hint){
|
323 |
-
$errors[] = $err->message . " (" . $err->reason .").<br>" . $hint;
|
324 |
-
}
|
325 |
-
else{
|
326 |
-
$errors[] = $err->message . " (" . $err->reason .")";
|
327 |
-
}
|
328 |
-
}
|
329 |
-
}
|
330 |
-
//$errors[] = "Missing or incomplete response from AdSense 1231231231ssssssssssssssssssss.";
|
331 |
}
|
332 |
}
|
333 |
-
$this->valid = $valid;
|
334 |
-
if (! $valid && count($errors) == 0){
|
335 |
-
// Display a default error message.
|
336 |
-
$errors[] = __( 'Invalid response from AdSense.', 'advanced-ads' ) . ' ' . __( 'You could try to re-connect under Advanced Ads > Settings > AdSense.', 'advanced-ads' );
|
337 |
-
}
|
338 |
-
$this->errors = $errors;
|
339 |
-
}
|
340 |
|
341 |
-
|
342 |
-
|
343 |
-
$filtered = array();
|
344 |
-
foreach ($this->body->rows as $row) {
|
345 |
-
if (preg_match($pattern, $row[$column_index])) {
|
346 |
-
$filtered[] = $row;
|
347 |
-
}
|
348 |
-
}
|
349 |
-
$this->body->rows = $filtered;
|
350 |
-
}
|
351 |
}
|
352 |
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
if (in_array($row[$dimension_index], $dimension_values)){
|
368 |
-
$dict[$row[$key_column_index]] = $row[$value_column_index];
|
369 |
}
|
370 |
-
|
371 |
-
|
372 |
-
}
|
373 |
-
|
374 |
-
public function getDistinctValuesByDimension($dimension_index){
|
375 |
-
$map = array();
|
376 |
-
$vals = array();
|
377 |
-
if (isset($this->body) && isset($this->body->rows)) {
|
378 |
-
foreach ($this->body->rows as $row) {
|
379 |
-
$key = $row[$dimension_index];
|
380 |
-
if (!isset($map[$key])) {
|
381 |
-
$map[$key] = 1;
|
382 |
-
$vals[] = $key;
|
383 |
-
}
|
384 |
-
}
|
385 |
-
}
|
386 |
-
return $vals;
|
387 |
-
}
|
388 |
-
|
389 |
-
public function generateResponse(){
|
390 |
-
$response = new Advanced_Ads_Adsense_Report_Response();
|
391 |
-
$response->plots = $this->generatePlots();
|
392 |
-
$response->plotter = $this->plotter;
|
393 |
-
$response->errors = $this->errors;
|
394 |
-
return $response;
|
395 |
-
}
|
396 |
-
|
397 |
-
private function createDimensionalData(){
|
398 |
-
$data = array();
|
399 |
-
if ($this->secondaryDimension != null){
|
400 |
-
// extract the dimensional data
|
401 |
-
foreach ($this->body->rows as $row){
|
402 |
-
$key = $row[1];
|
403 |
-
if (! isset($data[$key])){
|
404 |
-
$data[$key] = array();
|
405 |
-
}
|
406 |
-
$data[$key][] = $row;
|
407 |
}
|
408 |
}
|
409 |
-
|
410 |
-
|
411 |
-
$data['default'][] = $row;
|
412 |
-
}
|
413 |
}
|
414 |
-
return $data;
|
415 |
-
}
|
416 |
-
|
417 |
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
$
|
422 |
-
|
423 |
-
|
424 |
|
425 |
-
|
426 |
-
//$plots[] = $this->generatePlot();
|
427 |
-
return $plots;
|
428 |
}
|
429 |
|
430 |
-
|
431 |
-
|
|
|
|
|
|
|
|
|
|
|
432 |
}
|
433 |
-
}
|
434 |
-
|
435 |
-
class Advanced_Ads_AdSense_Dashboard_Summary{
|
436 |
-
private function __construct(){}
|
437 |
-
|
438 |
-
/**
|
439 |
-
* @param $report Advanced_Ads_AdSense_Report
|
440 |
-
* @param $filter_value string A value for the filter (e.g. domain name)
|
441 |
-
* @param $optional_dimension_names array an array with optional dimension names.
|
442 |
-
* @return Advanced_Ads_AdSense_Dashboard_Summary
|
443 |
-
*/
|
444 |
-
public static final function create($report, $filter_value, $optional_dimension_names){
|
445 |
-
//TODO: check for validity
|
446 |
-
$summary = new Advanced_Ads_AdSense_Dashboard_Summary();
|
447 |
-
if ($report && $report->valid){
|
448 |
-
$colDimension = 1;
|
449 |
-
$colEarnings = 2;
|
450 |
-
$summary->nb_rows = isset($report->body) && isset($report->body->rows) ? count($report->body->rows) : 0;
|
451 |
-
$summary->dimension = $optional_dimension_names;
|
452 |
-
$summary->filter_value = $filter_value;
|
453 |
-
$dimension_values = $report->getDistinctValuesByDimension(1);
|
454 |
-
|
455 |
-
$dims = array();
|
456 |
-
foreach ($dimension_values as $dim){
|
457 |
-
$name = ($optional_dimension_names && isset($optional_dimension_names[$dim]))
|
458 |
-
? $optional_dimension_names[$dim] : $dim;
|
459 |
-
$dims[$dim] = $name;
|
460 |
-
}
|
461 |
-
$summary->dimensions = $dims;
|
462 |
-
$summary->dimension_name = $report->secondaryDimension->name;
|
463 |
-
if ($filter_value){
|
464 |
-
// prevent values that don't exist as a dimension.
|
465 |
-
// this allows for a proper fallback in the main dashboard that tries to find the domain of the blog
|
466 |
-
// if it does not match, it will not display a bunch of zeroes but the sum of earnings of all domains
|
467 |
-
// we also make sure this only happens for the DOMAIN_NAME dimension, and not for others
|
468 |
-
$apply_filter = true;
|
469 |
-
|
470 |
-
$filter_value_exists_in_dimension = false;
|
471 |
-
foreach ($dims as $key => $name){
|
472 |
-
if ($key == $filter_value) {
|
473 |
-
$filter_value_exists_in_dimension = true;
|
474 |
-
break;
|
475 |
-
}
|
476 |
-
}
|
477 |
-
$summary->filterValueExists = $filter_value_exists_in_dimension;
|
478 |
-
if ($summary->dimension_name == "DOMAIN_NAME"){
|
479 |
-
$apply_filter = $filter_value_exists_in_dimension;
|
480 |
-
if (! $filter_value_exists_in_dimension)
|
481 |
-
$filter_value = null;
|
482 |
-
$summary->filter_value = $filter_value;
|
483 |
-
}
|
484 |
-
|
485 |
-
if ($apply_filter){
|
486 |
-
$report->filterRowsByPattern($colDimension, '/' . $filter_value . '$/');
|
487 |
-
}
|
488 |
-
}
|
489 |
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
if (! $report->updatedAt) $summary->age = __("Never", "advanced-ads");
|
500 |
-
else{
|
501 |
-
$tz = self::get_timezone();
|
502 |
-
$date = new DateTime('now', $tz);
|
503 |
-
$date_format = get_option( 'date_format' );
|
504 |
-
$today_str = $date->format($date_format);
|
505 |
-
|
506 |
-
$date = new DateTime();
|
507 |
-
$date->setTimestamp($report->updatedAt);
|
508 |
-
$date->setTimezone($tz);
|
509 |
-
|
510 |
-
if (! is_a($date, 'DateTime')) {
|
511 |
-
$date = new DateTime('now', $tz);
|
512 |
-
}
|
513 |
-
$is_today = $date->format($date_format) === $today_str;
|
514 |
-
if ($is_today) $summary->age = $date->format( get_option( 'time_format' ));
|
515 |
-
else $summary->age = $date->format($date_format);
|
516 |
-
}
|
517 |
-
$summary->valid = $report->valid;
|
518 |
}
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
$
|
526 |
}
|
527 |
|
528 |
-
|
|
|
529 |
}
|
530 |
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
private static final function sum($report, $col_index, $nb_days, $offset_days = 0){
|
558 |
-
$dim = self::createDateDimensionValues($nb_days, $offset_days);
|
559 |
-
return self::sumDim($report, $col_index, $dim);
|
560 |
-
}
|
561 |
-
private static final function sumDim($report, $colIndex, $dim){
|
562 |
-
// $dict = $report->getDictByDimensionValues($dim, 0, $colIndex, 0);
|
563 |
-
// return round(array_sum($dict),2) . " €";
|
564 |
-
$rows = $report->getRowsByDimensionValues($dim, 0);
|
565 |
-
$sum = 0.0;
|
566 |
-
foreach ($rows as $row){
|
567 |
-
$sum += $row[$colIndex];
|
568 |
-
}
|
569 |
-
$sum = number_format(round($sum, 2), 2);
|
570 |
-
if (isset($report->columns[$colIndex]) && isset($report->columns[$colIndex]->currency))
|
571 |
-
$sum .= " " . $report->columns[$colIndex]->currency;
|
572 |
-
return $sum;
|
573 |
-
}
|
574 |
-
private static final function createDateDimensionValues($nbDays, $offsetDays = 0){
|
575 |
-
$dim = array();
|
576 |
-
$dt = new DateTime();
|
577 |
-
for ($i=0; $i<$offsetDays; $i++){
|
578 |
-
$dt = $dt->sub(new DateInterval("P1D"));
|
579 |
-
}
|
580 |
-
for ($i=0; $i<$nbDays; $i++){
|
581 |
-
$dim[] = $dt->format("Y-m-d");
|
582 |
-
$dt = $dt->sub(new DateInterval("P1D"));
|
583 |
-
}
|
584 |
-
return $dim;
|
585 |
-
}
|
586 |
-
private static final function createDateDimensionValuesCurrentMonth(){
|
587 |
-
$dim = array();
|
588 |
-
$dt = new DateTime();
|
589 |
-
$month = $dt->format("m");
|
590 |
-
$m = $month;
|
591 |
-
while ($m == $month){
|
592 |
-
$dim[] = $dt->format("Y-m-d");
|
593 |
-
$dt = $dt->sub(new DateInterval("P1D"));
|
594 |
-
$m = $dt->format("m");
|
595 |
-
}
|
596 |
-
return $dim;
|
597 |
}
|
598 |
}
|
599 |
-
|
600 |
-
?>
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* Class Advanced_Ads_AdSense_Report
|
5 |
+
*
|
6 |
+
* Displays AdSense earnings on the ad overview page or the ad edit page.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
*/
|
8 |
+
class Advanced_Ads_AdSense_Report {
|
|
|
|
|
9 |
|
|
|
|
|
|
|
|
|
10 |
/**
|
11 |
+
* Domain name or ad unit to filter data with before display.
|
12 |
+
*
|
13 |
+
* @var string
|
14 |
*/
|
15 |
+
private $filter;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
/**
|
18 |
+
* Report type. 'unit' or 'domain'.
|
19 |
+
*
|
20 |
+
* @var string
|
21 |
*/
|
22 |
+
private $type;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
/**
|
25 |
+
* Object representing the current report data.
|
26 |
+
*
|
27 |
+
* @var Advanced_Ads_AdSense_Report_Data
|
28 |
*/
|
29 |
+
private $data_object;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
/**
|
32 |
+
* Instance constructor.
|
33 |
*
|
34 |
+
* @param string $type report type.
|
35 |
+
* @param string $filter report filter.
|
36 |
*/
|
37 |
+
public function __construct( $type = 'unit', $filter = '' ) {
|
38 |
+
$this->type = $type;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
+
if ( $type === 'domain' && ! empty( $filter ) ) {
|
41 |
+
update_option( 'advanced-ads-adsense-dashboard-filter', $filter );
|
42 |
+
// Backward compatibility: "*" was used to display data for all domains if API version prior to 2.0
|
43 |
+
if ( $filter === '*' ) {
|
44 |
+
$filter = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
}
|
46 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
+
$this->filter = $filter;
|
49 |
+
$this->data_object = Advanced_Ads_AdSense_Report_Data::get_data_from_options( $type );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
}
|
51 |
|
52 |
+
/**
|
53 |
+
* Tries to get fresh data from Google.
|
54 |
+
*
|
55 |
+
* @return bool|string true if new data was obtained, an error message otherwise.
|
56 |
+
*/
|
57 |
+
public function get_fresh_report() {
|
58 |
+
$api_helper = new Advanced_Ads_AdSense_Report_Api( $this->type );
|
59 |
+
$error = array();
|
60 |
+
if ( $api_helper->has_token() ) {
|
61 |
+
$response = $api_helper->call_google();
|
62 |
+
if ( $response['status'] === true ) {
|
63 |
+
$this->data_object->update_data_from_response( $response['response_body'] );
|
64 |
+
|
65 |
+
return true;
|
|
|
|
|
66 |
}
|
67 |
+
if ( isset( $response['msg'] ) ) {
|
68 |
+
$error['msg'] = $response['msg'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
}
|
70 |
}
|
71 |
+
if ( $api_helper->has_token_error() ) {
|
72 |
+
$error = $api_helper->get_token_error();
|
|
|
|
|
73 |
}
|
|
|
|
|
|
|
74 |
|
75 |
+
if ( isset( $error['msg'] ) ) {
|
76 |
+
return wp_kses_post( $error['msg'] );
|
77 |
+
}
|
78 |
+
if ( isset( $error['raw'] ) ) {
|
79 |
+
return wp_kses_post( $error['raw'] );
|
80 |
+
}
|
81 |
|
82 |
+
return esc_html__( 'No valid tokens', 'advanced-ads' );
|
|
|
|
|
83 |
}
|
84 |
|
85 |
+
/**
|
86 |
+
* Returns the report data object.
|
87 |
+
*
|
88 |
+
* @return Advanced_Ads_AdSense_Report_Data
|
89 |
+
*/
|
90 |
+
public function get_data() {
|
91 |
+
return $this->data_object;
|
92 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
|
94 |
+
/**
|
95 |
+
* Build an return the HTML markup for display.
|
96 |
+
*
|
97 |
+
* @return string the final markup.
|
98 |
+
*/
|
99 |
+
public function get_markup() {
|
100 |
+
if ( ! $this->get_data()->is_valid() ) {
|
101 |
+
return '<p style="text-align:center;"><span class="report-need-refresh spinner advads-ad-parameters-spinner advads-spinner"></span></p>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
}
|
103 |
+
ob_start();
|
104 |
+
$report_filter = $this->filter;
|
105 |
+
$report_domains = $this->data_object->get_domains();
|
106 |
+
$sums = $this->data_object->get_sums( $this->filter );
|
107 |
+
$earning_cells = '';
|
108 |
+
foreach ( $sums as $index => $sum ) {
|
109 |
+
$earning_cells .= $this->get_earning_cell( $sum, $index );
|
110 |
}
|
111 |
|
112 |
+
require_once GADSENSE_BASE_PATH . '/admin/views/adsense-report.php';
|
113 |
+
return ob_get_clean();
|
114 |
}
|
115 |
|
116 |
+
/**
|
117 |
+
* Build and return the HTML markup for a given period.
|
118 |
+
*
|
119 |
+
* @param float $sum the earning for that period.
|
120 |
+
* @param string $index the period identifier.
|
121 |
+
*
|
122 |
+
* @return string HTML of the individual cell.
|
123 |
+
*/
|
124 |
+
private function get_earning_cell( $sum, $index ) {
|
125 |
+
$period_strings = array(
|
126 |
+
'today' => esc_html__( 'Today', 'advanced-ads' ),
|
127 |
+
'yesterday' => esc_html__( 'Yesterday', 'advanced-ads' ),
|
128 |
+
/* translators: 1: The number of days. */
|
129 |
+
'7days' => sprintf( esc_html__( 'Last %1$d days', 'advanced-ads' ), 7 ),
|
130 |
+
'this_month' => esc_html__( 'This Month', 'advanced-ads' ),
|
131 |
+
/* translators: 1: The number of days. */
|
132 |
+
'28days' => sprintf( esc_html__( 'Last %1$d days', 'advanced-ads' ), 28 ),
|
133 |
+
);
|
134 |
+
|
135 |
+
$markup = '<div class="advads-flex1 advads-stats-box"><div>' . $period_strings[ $index ] . '</div>';
|
136 |
+
$markup .= '<div class="advads-stats-box-main">';
|
137 |
+
$markup .= number_format_i18n( ceil( 100 * $sum ) / 100, 2 );
|
138 |
+
$markup .= ' ' . $this->get_data()->get_currency();
|
139 |
+
$markup .= '</div></div>';
|
140 |
+
|
141 |
+
return $markup;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
}
|
143 |
}
|
|
|
|
modules/gadsense/includes/class-mapi.php
CHANGED
@@ -7,7 +7,7 @@ class Advanced_Ads_AdSense_MAPI {
|
|
7 |
|
8 |
const OPTNAME = 'advanced-ads-adsense-mapi';
|
9 |
|
10 |
-
const ALERTS_URL = 'https://
|
11 |
|
12 |
const CID = '400595147946-3ot506jh20qld7bqmg1l87ms4vn2uok5.apps.googleusercontent.com';
|
13 |
|
@@ -39,6 +39,9 @@ class Advanced_Ads_AdSense_MAPI {
|
|
39 |
'alerts' => array(),
|
40 |
);
|
41 |
|
|
|
|
|
|
|
42 |
private function __construct() {
|
43 |
|
44 |
add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
|
@@ -54,7 +57,7 @@ class Advanced_Ads_AdSense_MAPI {
|
|
54 |
add_action( 'wp_ajax_advads-mapi-get-alerts', array( $this, 'ajax_get_account_alerts' ) );
|
55 |
add_action( 'wp_ajax_advads-mapi-dismiss-alert', array( $this, 'ajax_dismiss_alert' ) );
|
56 |
add_action( 'wp_ajax_advads-mapi-dismiss-connect-error', array( $this, 'ajax_dismiss_connect_error' ) );
|
57 |
-
add_action( '
|
58 |
|
59 |
add_action( 'admin_footer', array( $this, 'admin_footer' ) );
|
60 |
|
@@ -127,11 +130,18 @@ class Advanced_Ads_AdSense_MAPI {
|
|
127 |
$item_ids = array();
|
128 |
|
129 |
foreach ( $alerts['items'] as $internal_id => $item ) {
|
130 |
-
$
|
131 |
-
|
132 |
-
|
|
|
133 |
} else {
|
134 |
-
$health_class->add(
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
}
|
136 |
|
137 |
}
|
@@ -316,101 +326,124 @@ class Advanced_Ads_AdSense_MAPI {
|
|
316 |
}
|
317 |
|
318 |
/**
|
319 |
-
*
|
|
|
|
|
320 |
*
|
321 |
-
* @return
|
322 |
*/
|
323 |
-
public function get_ad_code( $
|
324 |
-
$gadsense_data = Advanced_Ads_AdSense_Data::get_instance();
|
325 |
-
$adsense_id = $gadsense_data->get_adsense_id();
|
326 |
$options = self::get_option();
|
327 |
-
|
328 |
$gadsense_data = Advanced_Ads_AdSense_Data::get_instance();
|
329 |
$adsense_id = $gadsense_data->get_adsense_id();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
330 |
|
331 |
-
|
332 |
-
|
|
|
|
|
|
|
|
|
333 |
|
334 |
if ( ! isset( $access_token['msg'] ) ) {
|
335 |
$headers = array(
|
336 |
'Authorization' => 'Bearer ' . $access_token,
|
337 |
);
|
338 |
$response = wp_remote_get( $url, array( 'headers' => $headers ) );
|
339 |
-
self::log( 'Get ad code for ad Unit [' . $
|
340 |
|
341 |
if ( is_wp_error( $response ) ) {
|
342 |
return array(
|
343 |
'status' => false,
|
344 |
-
|
|
|
345 |
'raw' => $response->get_error_message(),
|
346 |
);
|
347 |
-
}
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
} else {
|
361 |
-
$options['unsupported_units'][ $adUnit ] = 1;
|
362 |
-
}
|
363 |
-
update_option( self::OPTNAME, $options );
|
364 |
-
return array(
|
365 |
-
'status' => false,
|
366 |
-
'msg' => 'doesNotSupportAdUnitType',
|
367 |
-
);
|
368 |
-
} else {
|
369 |
-
return array(
|
370 |
-
'status' => false,
|
371 |
-
'msg' => sprintf( esc_html__( 'Invalid response while retrieving ad code for "%s".', 'advanced-ads' ), $adUnit ),
|
372 |
-
'raw' => $response['body'],
|
373 |
-
);
|
374 |
-
}
|
375 |
-
} else {
|
376 |
-
$options['ad_codes'][ $adUnit ] = $adCode['adCode'];
|
377 |
-
if ( isset( $options['unsupported_units'][ $adUnit ] ) ) {
|
378 |
-
unset( $options['unsupported_units'][ $adUnit ] );
|
379 |
}
|
380 |
update_option( self::OPTNAME, $options );
|
381 |
-
|
|
|
|
|
|
|
|
|
382 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
383 |
}
|
384 |
-
|
385 |
-
|
386 |
-
|
|
|
|
|
|
|
|
|
387 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
388 |
}
|
389 |
|
390 |
/**
|
391 |
* Get/Update ad unit list for a given client
|
392 |
*
|
393 |
* @param [string] $account The publisher ID.
|
394 |
-
* @param [bool] $inactive Whether to include inactive ads.
|
395 |
*/
|
396 |
-
public static function get_ad_units( $account
|
397 |
-
$
|
398 |
-
$url = 'https://www.googleapis.com/adsense/v1.4/accounts/' . $account . '/adclients/ca-' . $account . '/adunits';
|
399 |
-
|
400 |
-
if ( true === $inactive ) {
|
401 |
-
$url .= '?includeInactive=true';
|
402 |
-
} else {
|
403 |
-
$url .= '?includeInactive=false';
|
404 |
-
}
|
405 |
-
|
406 |
$access_token = self::get_access_token( $account );
|
407 |
-
|
408 |
-
$
|
409 |
-
|
410 |
-
$per_page = 350;
|
411 |
-
$page = 1;
|
412 |
-
|
413 |
-
$url .= '&maxResults=' . $per_page;
|
414 |
|
415 |
if ( ! isset( $access_token['msg'] ) ) {
|
416 |
$headers = array(
|
@@ -420,19 +453,15 @@ class Advanced_Ads_AdSense_MAPI {
|
|
420 |
self::log( 'Get ad units list for ca-' . $account );
|
421 |
|
422 |
if ( is_wp_error( $response ) ) {
|
423 |
-
|
424 |
return array(
|
425 |
'status' => false,
|
426 |
'msg' => sprintf( esc_html__( 'Error while retrieving adUnits list for "%s".', 'advanced-ads' ), $account ),
|
427 |
'raw' => $response->get_error_message(),
|
428 |
);
|
429 |
-
|
430 |
} else {
|
431 |
-
|
432 |
$resp_body = json_decode( $response['body'], true );
|
433 |
|
434 |
-
if (
|
435 |
-
|
436 |
// translators: %s is the publisher ID.
|
437 |
$error_message = sprintf( esc_html__( 'Invalid response while retrieving adUnits list for "%s".', 'advanced-ads' ), $account );
|
438 |
// check the response for errors and display them for better problem solving.
|
@@ -446,52 +475,36 @@ class Advanced_Ads_AdSense_MAPI {
|
|
446 |
$error_message .= __( 'Message:', 'advanced-ads' ) . ' "' . $err['message'] . '"</p>';
|
447 |
}
|
448 |
}
|
449 |
-
|
450 |
return array(
|
451 |
'status' => false,
|
452 |
'msg' => $error_message,
|
453 |
'raw' => $response['body'],
|
454 |
);
|
455 |
-
|
456 |
} else {
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
'
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
$account,
|
470 |
-
'<a href="https://www.google.com/adsense/new/u/0/' . $account . '/main/myads-viewall-adunits?product=SELF_SERVICE_CONTENT_ADS" target="_blank">',
|
471 |
-
'</a>'
|
472 |
-
),
|
473 |
-
'raw' => $response['body'],
|
474 |
-
);
|
475 |
-
|
476 |
-
}
|
477 |
-
|
478 |
} else {
|
479 |
-
|
480 |
-
/**
|
481 |
-
* There are more than $per_page items in the account.
|
482 |
-
*/
|
483 |
if ( isset( $resp_body['nextPageToken'] ) ) {
|
484 |
-
|
485 |
$page_token = $resp_body['nextPageToken'];
|
486 |
-
|
487 |
$new_ad_units = array();
|
488 |
-
foreach ( $resp_body['
|
|
|
489 |
$new_ad_units[ $item['id'] ] = $item;
|
490 |
}
|
491 |
|
492 |
// While there is a next page of results do . . .
|
493 |
while ( $page_token ) {
|
494 |
-
|
495 |
$access_token = self::get_access_token( $account );
|
496 |
|
497 |
if ( isset( $access_token['msg'] ) ) {
|
@@ -508,34 +521,20 @@ class Advanced_Ads_AdSense_MAPI {
|
|
508 |
$page++;
|
509 |
|
510 |
if ( is_wp_error( $response ) ) {
|
511 |
-
|
512 |
-
/**
|
513 |
-
* An error occurred. Abort.
|
514 |
-
*/
|
515 |
return array(
|
516 |
'status' => false,
|
517 |
// translators: the publisher ID.
|
518 |
'msg' => sprintf( esc_html__( 'Error while retrieving adUnits list for "%s".', 'advanced-ads' ), $account ),
|
519 |
'raw' => $response->get_error_message(),
|
520 |
);
|
521 |
-
|
522 |
} else {
|
523 |
-
|
524 |
$resp_body = json_decode( $response['body'], true );
|
525 |
-
if
|
526 |
-
|
527 |
-
// There is still a next page.
|
528 |
-
$page_token = $resp_body['nextPageToken'];
|
529 |
-
|
530 |
-
} else {
|
531 |
-
|
532 |
-
// No more page to load, exit the WHILE loop.
|
533 |
-
$page_token = false;
|
534 |
-
|
535 |
-
}
|
536 |
-
|
537 |
// Add items from this page into the final result.
|
538 |
-
foreach ( $resp_body['
|
|
|
539 |
$new_ad_units[ $item['id'] ] = $item;
|
540 |
}
|
541 |
}
|
@@ -544,27 +543,25 @@ class Advanced_Ads_AdSense_MAPI {
|
|
544 |
$options['accounts'][ $account ]['ad_units'] = $new_ad_units;
|
545 |
update_option( self::OPTNAME, $options );
|
546 |
return true;
|
547 |
-
|
548 |
} else {
|
549 |
-
|
550 |
-
// Results fit into a single page (of $per_page items).
|
551 |
$new_ad_units = array();
|
552 |
-
|
|
|
|
|
553 |
$new_ad_units[ $item['id'] ] = $item;
|
554 |
}
|
555 |
|
556 |
$options['accounts'][ $account ]['ad_units'] = $new_ad_units;
|
557 |
update_option( self::OPTNAME, $options );
|
558 |
return true;
|
559 |
-
|
560 |
}
|
561 |
}
|
562 |
}
|
563 |
}
|
564 |
-
} else {
|
565 |
-
// return the original error info
|
566 |
-
return $access_token;
|
567 |
}
|
|
|
|
|
568 |
}
|
569 |
|
570 |
/**
|
@@ -820,12 +817,13 @@ class Advanced_Ads_AdSense_MAPI {
|
|
820 |
* Get ad code for a given unit
|
821 |
*/
|
822 |
public function ajax_get_adCode() {
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
$
|
|
|
827 |
if ( false !== wp_verify_nonce( $nonce, 'advads-mapi' ) ) {
|
828 |
-
$unit = stripslashes( $
|
829 |
|
830 |
if ( ! self::use_user_app() ) {
|
831 |
$quota = $this->get_quota();
|
@@ -955,23 +953,21 @@ class Advanced_Ads_AdSense_MAPI {
|
|
955 |
);
|
956 |
$response = wp_remote_get( $url, array( 'headers' => $headers ) );
|
957 |
|
958 |
-
|
959 |
|
960 |
-
|
961 |
-
|
962 |
$alerts = json_decode( $response['body'], true );
|
963 |
|
964 |
-
|
965 |
-
|
966 |
$items = array();
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
}
|
974 |
-
}
|
975 |
|
976 |
// filter alerts that are not relevant to the user
|
977 |
$items = self::filter_account_alerts( $items );
|
@@ -1022,33 +1018,6 @@ class Advanced_Ads_AdSense_MAPI {
|
|
1022 |
die;
|
1023 |
}
|
1024 |
|
1025 |
-
// /**
|
1026 |
-
// * Show / Hide idle ads on the ad list table.
|
1027 |
-
// */
|
1028 |
-
// public function ajax_toggle_idle_ads() {
|
1029 |
-
// if ( ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads' ) ) ) {
|
1030 |
-
// die;
|
1031 |
-
// }
|
1032 |
-
//
|
1033 |
-
// $nonce = isset( $_POST['nonce'] ) ? $_POST['nonce'] : '';
|
1034 |
-
// if ( false !== wp_verify_nonce( $nonce, 'advads-mapi' ) ) {
|
1035 |
-
//
|
1036 |
-
// $hide = (bool)$_POST['hide'];
|
1037 |
-
//
|
1038 |
-
// ob_start();
|
1039 |
-
// Advanced_Ads_AdSense_Admin::get_mapi_ad_selector( $hide );
|
1040 |
-
// $ad_selector = ob_get_clean();
|
1041 |
-
//
|
1042 |
-
// $response = array(
|
1043 |
-
// 'status' => true,
|
1044 |
-
// 'html' => $ad_selector,
|
1045 |
-
// );
|
1046 |
-
// header( 'Content-Type: application/json' );
|
1047 |
-
// echo wp_json_encode( $response );
|
1048 |
-
// }
|
1049 |
-
// die;
|
1050 |
-
// }
|
1051 |
-
|
1052 |
/**
|
1053 |
* Get / Update the ad unit list for a given ad client. The corresponding <select /> input used in the ad selector is passed as a fied of an array
|
1054 |
*/
|
@@ -1059,8 +1028,7 @@ class Advanced_Ads_AdSense_MAPI {
|
|
1059 |
$nonce = isset( $_POST['nonce'] ) ? $_POST['nonce'] : '';
|
1060 |
if ( false !== wp_verify_nonce( $nonce, 'advads-mapi' ) && isset( $_POST['account'] ) ) {
|
1061 |
$account = stripslashes( $_POST['account'] );
|
1062 |
-
$
|
1063 |
-
$units = self::get_ad_units( $account, $inactive );
|
1064 |
|
1065 |
if ( true === $units ) {
|
1066 |
$options = self::get_option();
|
@@ -1085,25 +1053,8 @@ class Advanced_Ads_AdSense_MAPI {
|
|
1085 |
$response['quotaMsg'] = $quota_msg;
|
1086 |
}
|
1087 |
} else {
|
1088 |
-
|
1089 |
-
|
1090 |
-
// load markup with inactive ads button in the table.
|
1091 |
-
ob_start();
|
1092 |
-
Advanced_Ads_AdSense_Admin::get_mapi_ad_selector( true, true );
|
1093 |
-
$ad_selector = ob_get_clean();
|
1094 |
-
|
1095 |
-
$response = array(
|
1096 |
-
'status' => true,
|
1097 |
-
'html' => $ad_selector,
|
1098 |
-
);
|
1099 |
-
|
1100 |
-
} else {
|
1101 |
-
/**
|
1102 |
-
* Return the error info [arr]
|
1103 |
-
*/
|
1104 |
-
$response = $units;
|
1105 |
-
}
|
1106 |
-
|
1107 |
}
|
1108 |
header( 'Content-Type: application/json' );
|
1109 |
echo wp_json_encode( $response );
|
@@ -1118,155 +1069,126 @@ class Advanced_Ads_AdSense_MAPI {
|
|
1118 |
if ( ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_manage_options' ) ) ) {
|
1119 |
die;
|
1120 |
}
|
1121 |
-
$
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
if ( $token_data && $account ) {
|
1127 |
-
|
1128 |
-
self::save_token_from_data( $token_data, $account, array( 'autoads' => isset( $_POST['autoads'] ) ) );
|
1129 |
-
|
1130 |
-
header( 'Content-Type: application/json' );
|
1131 |
-
echo json_encode(
|
1132 |
-
array(
|
1133 |
-
'status' => true,
|
1134 |
-
'adsense_id' => $account['id'],
|
1135 |
-
)
|
1136 |
-
);
|
1137 |
|
1138 |
-
|
|
|
1139 |
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
}
|
1144 |
-
header( 'Content-Type: application/json' );
|
1145 |
-
echo json_encode(
|
1146 |
-
array(
|
1147 |
-
'status' => false,
|
1148 |
-
'error_msg' => $error,
|
1149 |
-
)
|
1150 |
-
);
|
1151 |
-
|
1152 |
-
}
|
1153 |
}
|
1154 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1155 |
}
|
1156 |
|
1157 |
/**
|
1158 |
* Get AdSense account details from a new access token.
|
1159 |
*/
|
1160 |
public function ajax_get_account_details() {
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
$
|
1165 |
-
|
1166 |
|
1167 |
-
|
1168 |
-
|
|
|
1169 |
|
1170 |
-
|
|
|
|
|
1171 |
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
|
1181 |
-
|
|
|
1182 |
|
1183 |
-
|
1184 |
-
$response = wp_remote_get( $url, array( 'headers' => $headers ) );
|
1185 |
|
1186 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1187 |
|
1188 |
-
|
1189 |
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
'status' => false,
|
1194 |
-
'error_msg' => $response->get_error_message(),
|
1195 |
-
)
|
1196 |
-
);
|
1197 |
|
|
|
|
|
1198 |
} else {
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
$options = self::get_option();
|
1204 |
$options['connect_error'] = array();
|
1205 |
update_option( self::OPTNAME, $options );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1206 |
|
1207 |
-
|
1208 |
-
|
1209 |
-
$
|
1210 |
-
|
1211 |
-
|
1212 |
-
header( 'Content-Type: application/json' );
|
1213 |
-
echo json_encode(
|
1214 |
-
array(
|
1215 |
-
'status' => true,
|
1216 |
-
'adsense_id' => $adsense_id,
|
1217 |
-
)
|
1218 |
-
);
|
1219 |
-
|
1220 |
-
} else {
|
1221 |
-
$html = '';
|
1222 |
-
$details = array();
|
1223 |
-
foreach ( $accounts['items'] as $item ) {
|
1224 |
-
$html .= '<option value="' . esc_attr( $item['id'] ) . '">' . $item['name'] . ' [' . $item['id'] . ']</option>';
|
1225 |
-
$details[ $item['id'] ] = $item;
|
1226 |
-
}
|
1227 |
-
header( 'Content-Type: application/json' );
|
1228 |
-
echo json_encode(
|
1229 |
-
array(
|
1230 |
-
'status' => true,
|
1231 |
-
'html' => $html,
|
1232 |
-
'details' => $details,
|
1233 |
-
'token_data' => $token_data,
|
1234 |
-
)
|
1235 |
-
);
|
1236 |
-
|
1237 |
-
}
|
1238 |
-
} else {
|
1239 |
-
if ( isset( $accounts['error'] ) ) {
|
1240 |
-
$msg = esc_html__( 'An error occurred while requesting account details.', 'advanced-ads' );
|
1241 |
-
if ( isset( $accounts['error']['message'] ) ) {
|
1242 |
-
$msg = $accounts['error']['message'];
|
1243 |
-
}
|
1244 |
-
|
1245 |
-
$options = self::get_option();
|
1246 |
-
$options['connect_error'] = array(
|
1247 |
-
'message' => $msg,
|
1248 |
);
|
1249 |
-
|
1250 |
-
if ( isset( $accounts['error']['errors'][0]['reason'] ) ) {
|
1251 |
-
$options['connect_error']['reason'] = $accounts['error']['errors'][0]['reason'];
|
1252 |
-
}
|
1253 |
-
|
1254 |
-
update_option( self::OPTNAME, $options );
|
1255 |
-
|
1256 |
-
header( 'Content-Type: application/json' );
|
1257 |
-
echo json_encode(
|
1258 |
-
array(
|
1259 |
-
'status' => false,
|
1260 |
-
'error_msg' => $msg,
|
1261 |
-
'raw' => $accounts['error'],
|
1262 |
-
)
|
1263 |
-
);
|
1264 |
-
|
1265 |
}
|
|
|
|
|
|
|
|
|
|
|
1266 |
}
|
|
|
1267 |
}
|
1268 |
}
|
1269 |
-
die;
|
1270 |
}
|
1271 |
|
1272 |
/**
|
@@ -1346,10 +1268,12 @@ class Advanced_Ads_AdSense_MAPI {
|
|
1346 |
|
1347 |
/**
|
1348 |
* Enqueue admin scripts
|
|
|
|
|
1349 |
*/
|
1350 |
public function admin_scripts( $hook ) {
|
1351 |
if ( 'advanced-ads_page_advanced-ads-settings' == $hook ) {
|
1352 |
-
wp_enqueue_script( 'gasense/mapi/settings', GADSENSE_BASE_URL . 'admin/assets/js/mapi-settings.js', array( 'jquery' ), ADVADS_VERSION );
|
1353 |
}
|
1354 |
}
|
1355 |
|
@@ -1476,18 +1400,33 @@ class Advanced_Ads_AdSense_MAPI {
|
|
1476 |
}
|
1477 |
}
|
1478 |
}
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1483 |
}
|
1484 |
} elseif ( 'size' === $format ) {
|
1485 |
// size.
|
1486 |
-
$str = $ad_unit->display_size;
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
$str =
|
1491 |
} else {
|
1492 |
$str = '';
|
1493 |
}
|
@@ -1528,11 +1467,13 @@ class Advanced_Ads_AdSense_MAPI {
|
|
1528 |
|
1529 |
/**
|
1530 |
* Save token obtained from confirmation code
|
|
|
|
|
|
|
1531 |
*/
|
1532 |
-
public static function save_token_from_data( $token, $details
|
1533 |
-
|
1534 |
$options = self::get_option();
|
1535 |
-
$adsense_id = $details['id'];
|
1536 |
|
1537 |
if ( ! isset( $options['accounts'][ $adsense_id ] ) ) {
|
1538 |
$options['accounts'][ $adsense_id ] = self::$empty_account_data;
|
@@ -1552,13 +1493,15 @@ class Advanced_Ads_AdSense_MAPI {
|
|
1552 |
'token_type' => $token['token_type'],
|
1553 |
);
|
1554 |
}
|
1555 |
-
$options['accounts'][ $adsense_id ]['details'] =
|
|
|
|
|
|
|
1556 |
update_option( self::OPTNAME, $options );
|
1557 |
|
1558 |
$gadsense_data = Advanced_Ads_AdSense_Data::get_instance();
|
1559 |
$gadsense_options = $gadsense_data->get_options();
|
1560 |
$gadsense_options['adsense-id'] = $adsense_id;
|
1561 |
-
$gadsense_options['page-level-enabled'] = isset( $args['autoads'] ) && $args['autoads'];
|
1562 |
update_option( GADSENSE_OPT_NAME, $gadsense_options );
|
1563 |
|
1564 |
}
|
@@ -1612,7 +1555,10 @@ class Advanced_Ads_AdSense_MAPI {
|
|
1612 |
|
1613 |
// remove alerts based on specific IDs
|
1614 |
foreach ( $alert_items as $internal_id => $item ) {
|
1615 |
-
if (
|
|
|
|
|
|
|
1616 |
unset( $alert_items[ $internal_id ] );
|
1617 |
}
|
1618 |
}
|
7 |
|
8 |
const OPTNAME = 'advanced-ads-adsense-mapi';
|
9 |
|
10 |
+
const ALERTS_URL = 'https://adsense.googleapis.com/v2/accounts/PUBID/alerts';
|
11 |
|
12 |
const CID = '400595147946-3ot506jh20qld7bqmg1l87ms4vn2uok5.apps.googleusercontent.com';
|
13 |
|
39 |
'alerts' => array(),
|
40 |
);
|
41 |
|
42 |
+
/**
|
43 |
+
* Instance constructor
|
44 |
+
*/
|
45 |
private function __construct() {
|
46 |
|
47 |
add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
|
57 |
add_action( 'wp_ajax_advads-mapi-get-alerts', array( $this, 'ajax_get_account_alerts' ) );
|
58 |
add_action( 'wp_ajax_advads-mapi-dismiss-alert', array( $this, 'ajax_dismiss_alert' ) );
|
59 |
add_action( 'wp_ajax_advads-mapi-dismiss-connect-error', array( $this, 'ajax_dismiss_connect_error' ) );
|
60 |
+
add_action( 'wp_ajax_advads_adsense_report_refresh', array( 'Advanced_Ads_Overview_Widgets_Callbacks', 'ajax_gadsense_dashboard' ) );
|
61 |
|
62 |
add_action( 'admin_footer', array( $this, 'admin_footer' ) );
|
63 |
|
130 |
$item_ids = array();
|
131 |
|
132 |
foreach ( $alerts['items'] as $internal_id => $item ) {
|
133 |
+
$item_id = isset( $item['id'] ) ? $item['id'] : str_replace( '-', '_', strtoupper( $item['type'] ) );
|
134 |
+
$item_ids[] = $item_id;
|
135 |
+
if ( isset( $alerts_advads_messages[ $item_id ] ) ) {
|
136 |
+
$health_class->add( 'adsense_alert_' . $item_id );
|
137 |
} else {
|
138 |
+
$health_class->add(
|
139 |
+
'adsense_alert_' . $item_id,
|
140 |
+
array(
|
141 |
+
'text' => $item['message'] . ' ' . self::get_adsense_error_link( $item_id ),
|
142 |
+
'type' => 'problem',
|
143 |
+
)
|
144 |
+
);
|
145 |
}
|
146 |
|
147 |
}
|
326 |
}
|
327 |
|
328 |
/**
|
329 |
+
* Get ad code from Google fpr a given ad unit
|
330 |
+
*
|
331 |
+
* @param string $ad_unit the ad unit to get the ad code for.
|
332 |
*
|
333 |
+
* @return array response to send back to the browser.
|
334 |
*/
|
335 |
+
public function get_ad_code( $ad_unit ) {
|
|
|
|
|
336 |
$options = self::get_option();
|
|
|
337 |
$gadsense_data = Advanced_Ads_AdSense_Data::get_instance();
|
338 |
$adsense_id = $gadsense_data->get_adsense_id();
|
339 |
+
$unit_id = explode( ':', $ad_unit )[1];
|
340 |
+
$url = 'https://adsense.googleapis.com/v2/accounts/' . $adsense_id . '/adclients/ca-' . $adsense_id . '/adunits/' . $unit_id . '/adcode';
|
341 |
+
$access_token = self::get_access_token( $adsense_id );
|
342 |
+
|
343 |
+
foreach ( Advanced_Ads_Network_Adsense::get_instance()->get_external_ad_units() as $unit ) {
|
344 |
+
if (
|
345 |
+
isset( $unit->raw )
|
346 |
+
&& in_array( $unit->raw['contentAdsSettings']['type'], array( 'ARTICLE', 'FEED', 'MATCHED_CONTENT' ), true )
|
347 |
+
&& $ad_unit === $unit->id
|
348 |
+
&& ! array_key_exists( $ad_unit, $options['ad_codes'] )
|
349 |
+
) {
|
350 |
+
$options['unsupported_units'][ $ad_unit ] = 1;
|
351 |
+
update_option( self::OPTNAME, $options );
|
352 |
|
353 |
+
return array(
|
354 |
+
'status' => false,
|
355 |
+
'msg' => 'doesNotSupportAdUnitType',
|
356 |
+
);
|
357 |
+
}
|
358 |
+
}
|
359 |
|
360 |
if ( ! isset( $access_token['msg'] ) ) {
|
361 |
$headers = array(
|
362 |
'Authorization' => 'Bearer ' . $access_token,
|
363 |
);
|
364 |
$response = wp_remote_get( $url, array( 'headers' => $headers ) );
|
365 |
+
self::log( 'Get ad code for ad Unit [' . $ad_unit . ']' );
|
366 |
|
367 |
if ( is_wp_error( $response ) ) {
|
368 |
return array(
|
369 |
'status' => false,
|
370 |
+
// translators: %s: ad unit ID.
|
371 |
+
'msg' => sprintf( esc_html__( 'Error while retrieving ad code for "%s".', 'advanced-ads' ), $ad_unit ),
|
372 |
'raw' => $response->get_error_message(),
|
373 |
);
|
374 |
+
}
|
375 |
+
$ad_code = json_decode( $response['body'], true );
|
376 |
+
if ( $ad_code === null || ! isset( $ad_code['adCode'] ) ) {
|
377 |
+
if ( $ad_code['error']
|
378 |
+
&& $ad_code['error']['errors']
|
379 |
+
&& isset( $ad_code['error']['errors'][0] )
|
380 |
+
&& isset( $ad_code['error']['errors'][0]['reason'] )
|
381 |
+
&& $ad_code['error']['errors'][0]['reason'] === 'doesNotSupportAdUnitType'
|
382 |
+
) {
|
383 |
+
if ( array_key_exists( $ad_unit, $options['ad_codes'] ) && array_key_exists( $ad_unit, $options['unsupported_units'] ) ) {
|
384 |
+
unset( $options['unsupported_units'][ $ad_unit ] );
|
385 |
+
} else {
|
386 |
+
$options['unsupported_units'][ $ad_unit ] = 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
387 |
}
|
388 |
update_option( self::OPTNAME, $options );
|
389 |
+
|
390 |
+
return array(
|
391 |
+
'status' => false,
|
392 |
+
'msg' => 'doesNotSupportAdUnitType',
|
393 |
+
);
|
394 |
}
|
395 |
+
|
396 |
+
return array(
|
397 |
+
'status' => false,
|
398 |
+
// translators: %s: ad unit ID.
|
399 |
+
'msg' => sprintf( esc_html__( 'Invalid response while retrieving ad code for "%s".', 'advanced-ads' ), $ad_unit ),
|
400 |
+
'raw' => $response['body'],
|
401 |
+
);
|
402 |
}
|
403 |
+
$options['ad_codes'][ $ad_unit ] = $ad_code['adCode'];
|
404 |
+
if ( isset( $options['unsupported_units'][ $ad_unit ] ) ) {
|
405 |
+
unset( $options['unsupported_units'][ $ad_unit ] );
|
406 |
+
}
|
407 |
+
update_option( self::OPTNAME, $options );
|
408 |
+
|
409 |
+
return $ad_code['adCode'];
|
410 |
}
|
411 |
+
|
412 |
+
// return the original error info
|
413 |
+
return $access_token;
|
414 |
+
}
|
415 |
+
|
416 |
+
/**
|
417 |
+
* Convert ad unit data to v1.4 format to match the current UI and logics
|
418 |
+
*
|
419 |
+
* @param array $ad_unit ad unit in MAPI v2 format.
|
420 |
+
*
|
421 |
+
* @return array the ad unit in MAPI v1.4 format.
|
422 |
+
*/
|
423 |
+
public static function convert_ad_unit_format( $ad_unit ) {
|
424 |
+
$chunks = explode( '/', $ad_unit['name'] );
|
425 |
+
|
426 |
+
return array(
|
427 |
+
'name' => $ad_unit['displayName'],
|
428 |
+
'nameV2' => $ad_unit['name'],
|
429 |
+
'id' => $ad_unit['reportingDimensionId'],
|
430 |
+
'code' => $chunks[ count( $chunks ) - 1 ],
|
431 |
+
'status' => $ad_unit['state'],
|
432 |
+
'contentAdsSettings' => $ad_unit['contentAdsSettings'],
|
433 |
+
'reportingDimensionId' => $ad_unit['reportingDimensionId'],
|
434 |
+
);
|
435 |
}
|
436 |
|
437 |
/**
|
438 |
* Get/Update ad unit list for a given client
|
439 |
*
|
440 |
* @param [string] $account The publisher ID.
|
|
|
441 |
*/
|
442 |
+
public static function get_ad_units( $account ) {
|
443 |
+
$url = 'https://adsense.googleapis.com/v2/accounts/' . $account . '/adclients/ca-' . $account . '/adunits?pageSize=350';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
444 |
$access_token = self::get_access_token( $account );
|
445 |
+
$options = self::get_option();
|
446 |
+
$page = 1;
|
|
|
|
|
|
|
|
|
|
|
447 |
|
448 |
if ( ! isset( $access_token['msg'] ) ) {
|
449 |
$headers = array(
|
453 |
self::log( 'Get ad units list for ca-' . $account );
|
454 |
|
455 |
if ( is_wp_error( $response ) ) {
|
|
|
456 |
return array(
|
457 |
'status' => false,
|
458 |
'msg' => sprintf( esc_html__( 'Error while retrieving adUnits list for "%s".', 'advanced-ads' ), $account ),
|
459 |
'raw' => $response->get_error_message(),
|
460 |
);
|
|
|
461 |
} else {
|
|
|
462 |
$resp_body = json_decode( $response['body'], true );
|
463 |
|
464 |
+
if ( $resp_body === null || ! isset( $resp_body['adUnits'] ) ) {
|
|
|
465 |
// translators: %s is the publisher ID.
|
466 |
$error_message = sprintf( esc_html__( 'Invalid response while retrieving adUnits list for "%s".', 'advanced-ads' ), $account );
|
467 |
// check the response for errors and display them for better problem solving.
|
475 |
$error_message .= __( 'Message:', 'advanced-ads' ) . ' "' . $err['message'] . '"</p>';
|
476 |
}
|
477 |
}
|
|
|
478 |
return array(
|
479 |
'status' => false,
|
480 |
'msg' => $error_message,
|
481 |
'raw' => $response['body'],
|
482 |
);
|
|
|
483 |
} else {
|
484 |
+
if ( empty( $resp_body['adUnits'] ) ) {
|
485 |
+
return array(
|
486 |
+
'status' => false,
|
487 |
+
'msg' => sprintf(
|
488 |
+
// translators: %1$s is the AdSense publisher ID; %2$s a starting a tag to the AdSense ad unit list and %3$s the closing link.
|
489 |
+
esc_html__( 'The account "%1$s" does not seem to have any ad units. Please create some %2$shere%3$s.', 'advanced-ads' ),
|
490 |
+
$account,
|
491 |
+
'<a href="https://www.google.com/adsense/new/u/0/' . $account . '/main/myads-viewall-adunits?product=SELF_SERVICE_CONTENT_ADS" target="_blank">',
|
492 |
+
'</a>'
|
493 |
+
),
|
494 |
+
'raw' => $response['body'],
|
495 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
496 |
} else {
|
497 |
+
// There are more than 350 items in the account.
|
|
|
|
|
|
|
498 |
if ( isset( $resp_body['nextPageToken'] ) ) {
|
|
|
499 |
$page_token = $resp_body['nextPageToken'];
|
|
|
500 |
$new_ad_units = array();
|
501 |
+
foreach ( $resp_body['adUnits'] as $item ) {
|
502 |
+
$item = self::convert_ad_unit_format( $item );
|
503 |
$new_ad_units[ $item['id'] ] = $item;
|
504 |
}
|
505 |
|
506 |
// While there is a next page of results do . . .
|
507 |
while ( $page_token ) {
|
|
|
508 |
$access_token = self::get_access_token( $account );
|
509 |
|
510 |
if ( isset( $access_token['msg'] ) ) {
|
521 |
$page++;
|
522 |
|
523 |
if ( is_wp_error( $response ) ) {
|
524 |
+
// An error occurred. Abort.
|
|
|
|
|
|
|
525 |
return array(
|
526 |
'status' => false,
|
527 |
// translators: the publisher ID.
|
528 |
'msg' => sprintf( esc_html__( 'Error while retrieving adUnits list for "%s".', 'advanced-ads' ), $account ),
|
529 |
'raw' => $response->get_error_message(),
|
530 |
);
|
|
|
531 |
} else {
|
|
|
532 |
$resp_body = json_decode( $response['body'], true );
|
533 |
+
// Update page token if there are ad units left.
|
534 |
+
$page_token = isset( $resp_body['nextPageToken'] ) ? $resp_body['nextPageToken'] : false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
535 |
// Add items from this page into the final result.
|
536 |
+
foreach ( $resp_body['adUnits'] as $item ) {
|
537 |
+
$item = self::convert_ad_unit_format( $item );
|
538 |
$new_ad_units[ $item['id'] ] = $item;
|
539 |
}
|
540 |
}
|
543 |
$options['accounts'][ $account ]['ad_units'] = $new_ad_units;
|
544 |
update_option( self::OPTNAME, $options );
|
545 |
return true;
|
|
|
546 |
} else {
|
547 |
+
// Results fit into a single page (of 350 items).
|
|
|
548 |
$new_ad_units = array();
|
549 |
+
|
550 |
+
foreach ( $resp_body['adUnits'] as $item ) {
|
551 |
+
$item = self::convert_ad_unit_format( $item );
|
552 |
$new_ad_units[ $item['id'] ] = $item;
|
553 |
}
|
554 |
|
555 |
$options['accounts'][ $account ]['ad_units'] = $new_ad_units;
|
556 |
update_option( self::OPTNAME, $options );
|
557 |
return true;
|
|
|
558 |
}
|
559 |
}
|
560 |
}
|
561 |
}
|
|
|
|
|
|
|
562 |
}
|
563 |
+
// return the original error info
|
564 |
+
return $access_token;
|
565 |
}
|
566 |
|
567 |
/**
|
817 |
* Get ad code for a given unit
|
818 |
*/
|
819 |
public function ajax_get_adCode() {
|
820 |
+
if ( ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads' ) ) ) {
|
821 |
+
wp_send_json_error( 'Unauthorized', 401 );
|
822 |
+
}
|
823 |
+
$post_data = wp_unslash( $_POST );
|
824 |
+
$nonce = isset( $post_data['nonce'] ) ? $post_data['nonce'] : '';
|
825 |
if ( false !== wp_verify_nonce( $nonce, 'advads-mapi' ) ) {
|
826 |
+
$unit = stripslashes( $post_data['unit'] );
|
827 |
|
828 |
if ( ! self::use_user_app() ) {
|
829 |
$quota = $this->get_quota();
|
953 |
);
|
954 |
$response = wp_remote_get( $url, array( 'headers' => $headers ) );
|
955 |
|
956 |
+
$this->log( 'Get AdSense alerts for ' . $account );
|
957 |
|
958 |
+
// the HTTP response is not an error.
|
959 |
+
if ( ! is_wp_error( $response ) ) {
|
960 |
$alerts = json_decode( $response['body'], true );
|
961 |
|
962 |
+
// the response body is valid.
|
963 |
+
if ( is_array( $alerts ) && isset( $alerts['alerts'] ) ) {
|
964 |
$items = array();
|
965 |
+
foreach ( $alerts['alerts'] as $item ) {
|
966 |
+
// Do not store alerts of type "INFO".
|
967 |
+
if ( strcasecmp( $item['severity'], 'INFO' ) !== 0 ) {
|
968 |
+
$items[ wp_generate_password( 6, false ) ] = $item;
|
969 |
+
}
|
970 |
+
}
|
|
|
|
|
971 |
|
972 |
// filter alerts that are not relevant to the user
|
973 |
$items = self::filter_account_alerts( $items );
|
1018 |
die;
|
1019 |
}
|
1020 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1021 |
/**
|
1022 |
* Get / Update the ad unit list for a given ad client. The corresponding <select /> input used in the ad selector is passed as a fied of an array
|
1023 |
*/
|
1028 |
$nonce = isset( $_POST['nonce'] ) ? $_POST['nonce'] : '';
|
1029 |
if ( false !== wp_verify_nonce( $nonce, 'advads-mapi' ) && isset( $_POST['account'] ) ) {
|
1030 |
$account = stripslashes( $_POST['account'] );
|
1031 |
+
$units = self::get_ad_units( $account );
|
|
|
1032 |
|
1033 |
if ( true === $units ) {
|
1034 |
$options = self::get_option();
|
1053 |
$response['quotaMsg'] = $quota_msg;
|
1054 |
}
|
1055 |
} else {
|
1056 |
+
// Return the error info array.
|
1057 |
+
$response = $units;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1058 |
}
|
1059 |
header( 'Content-Type: application/json' );
|
1060 |
echo wp_json_encode( $response );
|
1069 |
if ( ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_manage_options' ) ) ) {
|
1070 |
die;
|
1071 |
}
|
1072 |
+
$post_data = wp_unslash( $_POST );
|
1073 |
+
$nonce = isset( $post_data['nonce'] ) ? $post_data['nonce'] : '';
|
1074 |
+
if ( ! wp_verify_nonce( $nonce, 'advads-mapi' ) ) {
|
1075 |
+
die( 'Unauthorized request' );
|
1076 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1077 |
|
1078 |
+
$token_data = wp_unslash( $post_data['token_data'] );
|
1079 |
+
$account = wp_unslash( $post_data['account'] );
|
1080 |
|
1081 |
+
if ( $token_data && $account ) {
|
1082 |
+
self::save_token_from_data( $token_data, $account );
|
1083 |
+
wp_send_json( array( 'status' => true ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1084 |
}
|
1085 |
+
$error = 'Token data missing';
|
1086 |
+
if ( $token_data ) {
|
1087 |
+
$error = 'No account provided';
|
1088 |
+
}
|
1089 |
+
wp_send_json( array(
|
1090 |
+
'status' => false,
|
1091 |
+
'error_msg' => $error,
|
1092 |
+
) );
|
1093 |
+
|
1094 |
}
|
1095 |
|
1096 |
/**
|
1097 |
* Get AdSense account details from a new access token.
|
1098 |
*/
|
1099 |
public function ajax_get_account_details() {
|
1100 |
+
if ( ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_manage_options' ) ) ) {
|
1101 |
+
wp_send_json_error( 'Unauthorized', 401 );
|
1102 |
+
}
|
1103 |
+
$post_data = wp_unslash( $_POST );
|
1104 |
+
$nonce = isset( $post_data['nonce'] ) ? $post_data['nonce'] : '';
|
1105 |
|
1106 |
+
if ( ! wp_verify_nonce( $nonce, 'advads-mapi' ) ) {
|
1107 |
+
die( 'invalid authorization' );
|
1108 |
+
}
|
1109 |
|
1110 |
+
$url = 'https://adsense.googleapis.com/v2/accounts';
|
1111 |
+
$list_child_url = 'https://adsense.googleapis.com/v2/accounts/%pubid%:listChildAccounts';
|
1112 |
+
$token_data = wp_unslash( $post_data['token_data'] );
|
1113 |
|
1114 |
+
if ( ! is_array( $token_data ) ) {
|
1115 |
+
wp_send_json(
|
1116 |
+
array(
|
1117 |
+
'status' => false,
|
1118 |
+
'error_msg' => esc_html__( 'No token provided. Token data needed to get account details.', 'advanced-ads' ),
|
1119 |
+
)
|
1120 |
+
);
|
1121 |
+
}
|
1122 |
|
1123 |
+
$headers = array( 'Authorization' => 'Bearer ' . $token_data['access_token'] );
|
1124 |
+
$response = wp_remote_get( $url, array( 'headers' => $headers ) );
|
1125 |
|
1126 |
+
self::log( 'Get account details from new access token' );
|
|
|
1127 |
|
1128 |
+
if ( is_wp_error( $response ) ) {
|
1129 |
+
wp_send_json( array(
|
1130 |
+
'status' => false,
|
1131 |
+
'error_msg' => $response->get_error_message(),
|
1132 |
+
) );
|
1133 |
+
}
|
1134 |
+
if ( trim( $response['body'] ) === '{}' ) {
|
1135 |
+
// Empty, disapproved or other reason.
|
1136 |
+
$options = self::get_option();
|
1137 |
+
$options['connect_error'] = array(
|
1138 |
+
'message' => esc_html__( 'No AdSense account data found.', 'advanced-ads' ),
|
1139 |
+
'reason' => 'noAdsenseData',
|
1140 |
+
);
|
1141 |
+
update_option( self::OPTNAME, $options );
|
1142 |
+
wp_send_json_error( array( 'error' => esc_html__( 'No AdSense account data found.', 'advanced-ads' ) ), 404 );
|
1143 |
+
}
|
1144 |
|
1145 |
+
$accounts = json_decode( trim( $response['body'] ), true );
|
1146 |
|
1147 |
+
if ( isset( $accounts['accounts'] ) ) {
|
1148 |
+
$pub_id = explode( '/', $accounts['accounts'][0]['name'] )[1];
|
1149 |
+
$child_accounts = wp_remote_get( str_replace( '%pubid%', $pub_id, $list_child_url ), array( 'headers' => $headers ) );
|
|
|
|
|
|
|
|
|
1150 |
|
1151 |
+
if ( is_wp_error( $child_accounts ) ) {
|
1152 |
+
wp_send_json_error( $child_accounts, 500 );
|
1153 |
} else {
|
1154 |
+
$accounts_list = json_decode( trim( $child_accounts['body'] ), true );
|
1155 |
+
if ( trim( $child_accounts['body'] ) === '{}' ) {
|
1156 |
+
// Standard AdSense account.
|
1157 |
+
$options = self::get_option();
|
|
|
1158 |
$options['connect_error'] = array();
|
1159 |
update_option( self::OPTNAME, $options );
|
1160 |
+
self::save_token_from_data( $token_data, $accounts['accounts'][0] );
|
1161 |
+
wp_send_json_success( array(
|
1162 |
+
'reload' => true,
|
1163 |
+
) );
|
1164 |
+
}
|
1165 |
+
if ( $accounts_list !== null ) {
|
1166 |
+
// Network account.
|
1167 |
+
$details = array();
|
1168 |
+
$html = '';
|
1169 |
+
$details[ $pub_id ] = array(
|
1170 |
+
'id' => $pub_id,
|
1171 |
+
'name' => $accounts['accounts'][0]['displayName'],
|
1172 |
+
);
|
1173 |
+
$html .= sprintf( '<option value="%1$s">%2$s [%3$s]</option>', esc_attr( $pub_id ), esc_html( $accounts['accounts'][0]['displayName'] ), esc_html( $pub_id ) );
|
1174 |
|
1175 |
+
foreach ( $accounts_list['accounts'] as $item ) {
|
1176 |
+
$account_id = explode( '/', $item['name'] )[1];
|
1177 |
+
$details[ $account_id ] = array(
|
1178 |
+
'id' => $account_id,
|
1179 |
+
'name' => $item['displayName'],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1180 |
);
|
1181 |
+
$html .= sprintf( '<option value="%1$s">%2$s [%3$s]</option>', esc_attr( $account_id ), esc_html( $item['displayName'] ), esc_html( $account_id ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1182 |
}
|
1183 |
+
wp_send_json_success( array(
|
1184 |
+
'details' => $details,
|
1185 |
+
'html' => $html,
|
1186 |
+
'token_data' => $token_data,
|
1187 |
+
) );
|
1188 |
}
|
1189 |
+
wp_send_json_error( array( 'message' => 'unexpected response - get child accounts' ) );
|
1190 |
}
|
1191 |
}
|
|
|
1192 |
}
|
1193 |
|
1194 |
/**
|
1268 |
|
1269 |
/**
|
1270 |
* Enqueue admin scripts
|
1271 |
+
*
|
1272 |
+
* @param string $hook current page hook.
|
1273 |
*/
|
1274 |
public function admin_scripts( $hook ) {
|
1275 |
if ( 'advanced-ads_page_advanced-ads-settings' == $hook ) {
|
1276 |
+
wp_enqueue_script( 'gasense/mapi/settings', GADSENSE_BASE_URL . 'admin/assets/js/mapi-settings.js', array( 'jquery', 'wp-util' ), ADVADS_VERSION );
|
1277 |
}
|
1278 |
}
|
1279 |
|
1400 |
}
|
1401 |
}
|
1402 |
}
|
1403 |
+
|
1404 |
+
switch ( $str ) {
|
1405 |
+
case 'DISPLAY':
|
1406 |
+
$str = _x( 'Display', 'AdSense ad type', 'advanced-ads' );
|
1407 |
+
break;
|
1408 |
+
case 'LINK':
|
1409 |
+
$str = _x( 'Link', 'AdSense ad type', 'advanced-ads' );
|
1410 |
+
break;
|
1411 |
+
case 'MATCHED_CONTENT':
|
1412 |
+
$str = _x( 'Matched Content', 'AdSense ad type', 'advanced-ads' );
|
1413 |
+
break;
|
1414 |
+
case 'ARTICLE':
|
1415 |
+
$str = _x( 'In-article', 'AdSense ad type', 'advanced-ads' );
|
1416 |
+
break;
|
1417 |
+
case 'FEED':
|
1418 |
+
$str = _x( 'In-feed', 'AdSense ad type', 'advanced-ads' );
|
1419 |
+
break;
|
1420 |
+
case 'TYPE_UNSPECIFIED':
|
1421 |
+
default:
|
1422 |
}
|
1423 |
} elseif ( 'size' === $format ) {
|
1424 |
// size.
|
1425 |
+
$str = $ad_unit->display_size === '1x3' ? 'Responsive' : $ad_unit->display_size;
|
1426 |
+
if ( strpos( $str, 'SIZE_' ) === 0 ) {
|
1427 |
+
$str = str_replace( '_', 'x', substr( $str, 5 ) );
|
1428 |
+
}
|
1429 |
+
$str = ucfirst( strtolower( $str ) );
|
1430 |
} else {
|
1431 |
$str = '';
|
1432 |
}
|
1467 |
|
1468 |
/**
|
1469 |
* Save token obtained from confirmation code
|
1470 |
+
*
|
1471 |
+
* @param string $token access token data.
|
1472 |
+
* @param array $details selected account details.
|
1473 |
*/
|
1474 |
+
public static function save_token_from_data( $token, $details ) {
|
|
|
1475 |
$options = self::get_option();
|
1476 |
+
$adsense_id = isset( $details['id'] ) ? $details['id'] : explode( '/', $details['name'] )[1];
|
1477 |
|
1478 |
if ( ! isset( $options['accounts'][ $adsense_id ] ) ) {
|
1479 |
$options['accounts'][ $adsense_id ] = self::$empty_account_data;
|
1493 |
'token_type' => $token['token_type'],
|
1494 |
);
|
1495 |
}
|
1496 |
+
$options['accounts'][ $adsense_id ]['details'] = array(
|
1497 |
+
'id' => $adsense_id,
|
1498 |
+
'name' => isset( $details['displayName'] ) ? $details['displayName'] : $details['name'],
|
1499 |
+
);
|
1500 |
update_option( self::OPTNAME, $options );
|
1501 |
|
1502 |
$gadsense_data = Advanced_Ads_AdSense_Data::get_instance();
|
1503 |
$gadsense_options = $gadsense_data->get_options();
|
1504 |
$gadsense_options['adsense-id'] = $adsense_id;
|
|
|
1505 |
update_option( GADSENSE_OPT_NAME, $gadsense_options );
|
1506 |
|
1507 |
}
|
1555 |
|
1556 |
// remove alerts based on specific IDs
|
1557 |
foreach ( $alert_items as $internal_id => $item ) {
|
1558 |
+
if (
|
1559 |
+
( isset( $item['id'] ) && in_array( $item['id'], $disabled_adsense_alerts, true ) )
|
1560 |
+
|| ( isset( $item['type'] ) && in_array( str_replace( '-', '_', strtoupper( $item['type'] ) ), $disabled_adsense_alerts, true ) )
|
1561 |
+
) {
|
1562 |
unset( $alert_items[ $internal_id ] );
|
1563 |
}
|
1564 |
}
|
modules/gadsense/includes/class-network-adsense.php
CHANGED
@@ -126,8 +126,6 @@ class Advanced_Ads_Network_Adsense extends Advanced_Ads_Ad_Network {
|
|
126 |
);
|
127 |
}
|
128 |
|
129 |
-
|
130 |
-
|
131 |
/**
|
132 |
* Render AdSense settings section
|
133 |
*/
|
@@ -176,7 +174,7 @@ class Advanced_Ads_Network_Adsense extends Advanced_Ads_Ad_Network {
|
|
176 |
if ( defined( 'AAP_VERSION' ) ) :
|
177 |
// Give warning when cache-busting in Pro is active.
|
178 |
?>
|
179 |
-
<p class="advads-error
|
180 |
<?php
|
181 |
endif;
|
182 |
}
|
@@ -239,7 +237,7 @@ class Advanced_Ads_Network_Adsense extends Advanced_Ads_Ad_Network {
|
|
239 |
?>
|
240 |
</ul>
|
241 |
<?php if ( Advanced_Ads_Compatibility::borlabs_cookie_adsense_auto_ads_code_exists() ) : ?>
|
242 |
-
<p class="advads-error
|
243 |
<?php require GADSENSE_BASE_PATH . 'admin/views/borlabs-cookie-auto-ads-warning.php'; ?>
|
244 |
</p>
|
245 |
<?php endif; ?>
|
126 |
);
|
127 |
}
|
128 |
|
|
|
|
|
129 |
/**
|
130 |
* Render AdSense settings section
|
131 |
*/
|
174 |
if ( defined( 'AAP_VERSION' ) ) :
|
175 |
// Give warning when cache-busting in Pro is active.
|
176 |
?>
|
177 |
+
<p class="advads-notice-inline advads-error"><?php esc_html_e( 'Due to technical restrictions, the limit does not work on placements with cache-busting enabled.', 'advanced-ads' ); ?></p>
|
178 |
<?php
|
179 |
endif;
|
180 |
}
|
237 |
?>
|
238 |
</ul>
|
239 |
<?php if ( Advanced_Ads_Compatibility::borlabs_cookie_adsense_auto_ads_code_exists() ) : ?>
|
240 |
+
<p class="advads-notice-inline advads-error">
|
241 |
<?php require GADSENSE_BASE_PATH . 'admin/views/borlabs-cookie-auto-ads-warning.php'; ?>
|
242 |
</p>
|
243 |
<?php endif; ?>
|
modules/import-export/views/page.php
CHANGED
@@ -48,7 +48,7 @@ class_exists( 'Advanced_Ads', false ) || exit();
|
|
48 |
<div id="advads_xml_file">
|
49 |
<?php
|
50 |
if ( ! empty( $upload_dir['error'] ) ) : ?>
|
51 |
-
<p class="advads-error
|
52 |
<?php _e( 'Before you can upload your import file, you will need to fix the following error:', 'advanced-ads' ); ?>
|
53 |
<strong><?php echo $upload_dir['error']; ?>guu</strong>
|
54 |
</p>
|
48 |
<div id="advads_xml_file">
|
49 |
<?php
|
50 |
if ( ! empty( $upload_dir['error'] ) ) : ?>
|
51 |
+
<p class="advads-notice-inline advads-error">
|
52 |
<?php _e( 'Before you can upload your import file, you will need to fix the following error:', 'advanced-ads' ); ?>
|
53 |
<strong><?php echo $upload_dir['error']; ?>guu</strong>
|
54 |
</p>
|
modules/privacy/admin/views/setting-general.php
CHANGED
@@ -61,7 +61,7 @@
|
|
61 |
|
62 |
<?php if ( apply_filters( 'advanced-ads-privacy-custom-show-warning', ! empty( $checked ) && Advanced_Ads_Checks::cache() ) ) : ?>
|
63 |
<p class="description" style="margin: 5px 0 10px 23px;">
|
64 |
-
<span class="advads-error
|
65 |
<br>
|
66 |
<?php
|
67 |
esc_html_e( 'Your users’ consent might get cached and show ads to users who didn’t give their consent yet. ', 'advanced-ads' );
|
@@ -93,7 +93,7 @@
|
|
93 |
$tracking_admin = Advanced_Ads_Tracking_Admin::get_instance();
|
94 |
if ( $tracking_admin->has_tcf_conflict() ) :
|
95 |
?>
|
96 |
-
<p class="
|
97 |
<?php echo esc_html( $tracking_admin->get_tcf_conflict_notice() ); ?>
|
98 |
</p>
|
99 |
<?php
|
61 |
|
62 |
<?php if ( apply_filters( 'advanced-ads-privacy-custom-show-warning', ! empty( $checked ) && Advanced_Ads_Checks::cache() ) ) : ?>
|
63 |
<p class="description" style="margin: 5px 0 10px 23px;">
|
64 |
+
<span class="advads-notice-inline advads-error"><?php esc_html_e( 'It seems that a caching plugin is activated.', 'advanced-ads' ); ?></span>
|
65 |
<br>
|
66 |
<?php
|
67 |
esc_html_e( 'Your users’ consent might get cached and show ads to users who didn’t give their consent yet. ', 'advanced-ads' );
|
93 |
$tracking_admin = Advanced_Ads_Tracking_Admin::get_instance();
|
94 |
if ( $tracking_admin->has_tcf_conflict() ) :
|
95 |
?>
|
96 |
+
<p class="advads-notice-inline advads-error">
|
97 |
<?php echo esc_html( $tracking_admin->get_tcf_conflict_notice() ); ?>
|
98 |
</p>
|
99 |
<?php
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: ads, ad manager, ad rotation, adsense, banner
|
|
4 |
Requires at least: 4.9
|
5 |
Tested up to: 5.8
|
6 |
Requires PHP: 5.6
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -100,7 +100,7 @@ Placements to insert ads in pre-defined positions in your theme and content. [Li
|
|
100 |
* ads at the top or bottom of the post content
|
101 |
* ads before closing `</head>` tag
|
102 |
* ads in the footer
|
103 |
-
*
|
104 |
* many more ad positions with [add-ons](https://wpadvancedads.com/add-ons/)
|
105 |
* automatic insertion of any kind of code into header or footer, not only advertising
|
106 |
|
@@ -167,8 +167,8 @@ Localizations: Arabic, Chinese, Czech, Danish, Dutch, English, French, German, H
|
|
167 |
> * [Geo Targeting](https://wpadvancedads.com/add-ons/geo-targeting/) – display ads based on the geo location of the visitor
|
168 |
> * [Sticky Ads](https://wpadvancedads.com/add-ons/sticky-ads/) – increase click rates with fixed, sticky, and anchor ads
|
169 |
> * [Fixed Widget for WordPress](https://wordpress.org/plugins/q2w3-fixed-widget/) – turn sidebar widgets into performant fixed sticky ads
|
170 |
-
> * [PopUp and Layer Ads](https://wpadvancedads.com/add-ons/popup-and-layer-ads/) – display ads and other content in layers and
|
171 |
-
> * [Selling Ads](https://wpadvancedads.com/add-ons/selling-ads/) - allows you to sell ads on your website fully automated, including payments and advertiser profiles
|
172 |
> * [Ad Slider](https://wpadvancedads.com/add-ons/slider/) – create a simple slider from your ads
|
173 |
|
174 |
If you have problems with Advanced Ads, please reach out to [our support](https://wordpress.org/support/plugin/advanced-ads) or open a [new topic](https://wordpress.org/support/plugin/advanced-ads/#new-topic-0) in our forums on wordpress.org
|
@@ -322,6 +322,17 @@ Yes. You can use plenty of [hooks](https://wpadvancedads.com/codex/) to customiz
|
|
322 |
|
323 |
== Changelog ==
|
324 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
325 |
= 1.28.0 =
|
326 |
|
327 |
- Improvement: add an `inline` attribute to the `the_ad` shortcode that allows the user to change the wrapper from `div` to `span`
|
4 |
Requires at least: 4.9
|
5 |
Tested up to: 5.8
|
6 |
Requires PHP: 5.6
|
7 |
+
Stable tag: 1.29.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
100 |
* ads at the top or bottom of the post content
|
101 |
* ads before closing `</head>` tag
|
102 |
* ads in the footer
|
103 |
+
* create [split tests and A/B testing](https://wpadvancedads.com/ab-testing-wordpress/)
|
104 |
* many more ad positions with [add-ons](https://wpadvancedads.com/add-ons/)
|
105 |
* automatic insertion of any kind of code into header or footer, not only advertising
|
106 |
|
167 |
> * [Geo Targeting](https://wpadvancedads.com/add-ons/geo-targeting/) – display ads based on the geo location of the visitor
|
168 |
> * [Sticky Ads](https://wpadvancedads.com/add-ons/sticky-ads/) – increase click rates with fixed, sticky, and anchor ads
|
169 |
> * [Fixed Widget for WordPress](https://wordpress.org/plugins/q2w3-fixed-widget/) – turn sidebar widgets into performant fixed sticky ads
|
170 |
+
> * [PopUp and Layer Ads](https://wpadvancedads.com/add-ons/popup-and-layer-ads/) – display ads and other content in layers, popups, and interstitials
|
171 |
+
> * [Selling Ads](https://wpadvancedads.com/add-ons/selling-ads/) - allows you to sell ads on your website fully automated, including payments and advertiser profiles
|
172 |
> * [Ad Slider](https://wpadvancedads.com/add-ons/slider/) – create a simple slider from your ads
|
173 |
|
174 |
If you have problems with Advanced Ads, please reach out to [our support](https://wordpress.org/support/plugin/advanced-ads) or open a [new topic](https://wordpress.org/support/plugin/advanced-ads/#new-topic-0) in our forums on wordpress.org
|
322 |
|
323 |
== Changelog ==
|
324 |
|
325 |
+
= 1.29.0 =
|
326 |
+
|
327 |
+
- Improvement: update AdSense API to V2
|
328 |
+
- Improvement: unify layout of backend notices
|
329 |
+
- Improvement: move some descriptions into tooltips
|
330 |
+
- Improvement: move ad blocker fix options to the related setting
|
331 |
+
- Fix: correct uppercase CSS rule for labels in backend
|
332 |
+
- Fix: remove usage link for every type except manual placement
|
333 |
+
- Fix: correct sorting of placements by type on placement list page
|
334 |
+
- Fix: bad language in Analytics Adblock Counter option
|
335 |
+
|
336 |
= 1.28.0 =
|
337 |
|
338 |
- Improvement: add an `inline` attribute to the `the_ad` shortcode that allows the user to change the wrapper from `div` to `span`
|