Advanced Ads - Version 1.39.0

Version Description

(December 14, 2022) =

  • Improvement: add PeepSo ad type image
  • Improvement: add fallback ad type image for unknown ad types
  • Fix: remove unused jQuery UI assets
  • Fix: prevent uncaught TypeError on Placements search
  • Fix: add the site URL to the export filename
  • Fix: prevent duplicate queries due to circular functions calls in capability checks
Download this release

Release Info

Developer advancedads
Plugin Icon 128x128 Advanced Ads
Version 1.39.0
Comparing to
See all releases

Code changes from version 1.38.0 to 1.39.0

Files changed (50) hide show
  1. admin/assets/css/admin.css +24 -5
  2. admin/assets/img/ad-types/empty.svg +1 -0
  3. admin/assets/img/ad-types/peepso.svg +1 -0
  4. admin/assets/jquery-ui/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  5. admin/assets/jquery-ui/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  6. admin/assets/jquery-ui/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  7. admin/assets/jquery-ui/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  8. admin/assets/jquery-ui/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  9. admin/assets/jquery-ui/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  10. admin/assets/jquery-ui/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  11. admin/assets/jquery-ui/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  12. admin/assets/jquery-ui/images/ui-icons_222222_256x240.png +0 -0
  13. admin/assets/jquery-ui/images/ui-icons_2e83ff_256x240.png +0 -0
  14. admin/assets/jquery-ui/images/ui-icons_454545_256x240.png +0 -0
  15. admin/assets/jquery-ui/images/ui-icons_888888_256x240.png +0 -0
  16. admin/assets/jquery-ui/images/ui-icons_cd0a0a_256x240.png +0 -0
  17. admin/assets/jquery-ui/jquery-ui.min.css +0 -7
  18. admin/assets/js/admin.js +49 -37
  19. admin/assets/js/admin.min.js +1 -0
  20. admin/assets/js/dialog-advads-modal.js +280 -0
  21. admin/assets/js/ui.js +2 -1
  22. admin/class-advanced-ads-admin.php +22 -2
  23. admin/includes/ad-authors.php +1 -1
  24. admin/includes/class-ad-groups-list.php +26 -0
  25. admin/includes/class-admin-upgrades.php +1 -1
  26. admin/includes/class-menu.php +1 -16
  27. admin/includes/class-overview-widgets.php +1 -1
  28. admin/views/ad-group-list-form-row.php +60 -50
  29. admin/views/ad-group-list-row.php +15 -11
  30. admin/views/ad-group.php +10 -11
  31. admin/views/group-form.php +5 -2
  32. admin/views/modal.php +23 -22
  33. admin/views/placement-form.php +3 -3
  34. admin/views/placements.php +43 -38
  35. admin/views/upgrades/pro-placements.php +24 -20
  36. advanced-ads.php +2 -2
  37. changelog.txt +9 -0
  38. classes/Advanced_Ads_Modal.php +46 -0
  39. classes/ad-model.php +6 -6
  40. classes/ad.php +1 -1
  41. classes/ad_placements.php +8 -2
  42. classes/ad_type_abstract.php +17 -11
  43. languages/advanced-ads.pot +150 -133
  44. lib/composer/autoload_classmap.php +3 -0
  45. lib/composer/autoload_psr4.php +1 -0
  46. lib/composer/autoload_static.php +19 -0
  47. modules/import-export/classes/export.php +10 -1
  48. readme.txt +8 -7
  49. src/Placement_Type.php +149 -0
  50. src/Placement_Type_Options.php +81 -0
admin/assets/css/admin.css CHANGED
@@ -672,21 +672,34 @@ body.rtl #mapi-archived-ads { left: 78px; right:auto; }
672
  -moz-transition: opacity 400ms ease-in;
673
  transition: opacity 400ms ease-in;
674
  }
675
- .advads-modal:target {
 
676
  display: table;
677
  opacity: 1;
678
  pointer-events: auto;
679
  z-index: 9999;
680
  }
 
 
 
 
 
 
 
 
 
681
  .advads-modal-content {
682
  background-color: #fefefe;
683
  border: 1px solid #888;
684
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
 
 
 
 
 
685
  animation-name: advads-modal-animatetop;
686
  animation-duration: 0.4s;
687
  position: relative;
688
- margin: 0 auto;
689
- height: 100%;
690
  padding: 1em;
691
  padding-bottom: 0;
692
  overflow-y: scroll;
@@ -710,6 +723,11 @@ body.rtl #mapi-archived-ads { left: 78px; right:auto; }
710
  bottom: 0;
711
  }
712
 
 
 
 
 
 
713
  .advads-modal h2, .advads-modal h3 {
714
  font-size: 1.3em;
715
  margin: 1em 0;
@@ -727,12 +745,14 @@ body.rtl #mapi-archived-ads { left: 78px; right:auto; }
727
  }
728
  .advads-modal-close {
729
  color: #aaa;
730
- float: right;
731
  font-size: 28px;
732
  font-weight: bold;
733
  line-height: 50px;
734
  text-decoration: none;
735
  }
 
 
 
736
  .advads-modal-close:hover,
737
  .advads-modal-close:focus {
738
  color: black;
@@ -1173,7 +1193,6 @@ tr.advads-clickable-row:hover{
1173
  .advads-modal-content {
1174
  height: 75%;
1175
  margin: 5% auto;
1176
- max-height: 57em;
1177
  max-width: 66em;
1178
  width: 85%;
1179
  }
672
  -moz-transition: opacity 400ms ease-in;
673
  transition: opacity 400ms ease-in;
674
  }
675
+ .advads-modal:target,
676
+ .advads-modal[open] {
677
  display: table;
678
  opacity: 1;
679
  pointer-events: auto;
680
  z-index: 9999;
681
  }
682
+
683
+ dialog.advads-modal {
684
+ padding: 0;
685
+ border: 0;
686
+ margin: 0;
687
+ max-width: 100vw;
688
+ max-height: 100vh;
689
+ }
690
+
691
  .advads-modal-content {
692
  background-color: #fefefe;
693
  border: 1px solid #888;
694
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
695
+ box-sizing: border-box;
696
+ margin: calc(5vh + var(--wp-admin--admin-bar--height, 0px)) auto 5vh;
697
+ max-width: 66em;
698
+ max-height: calc(90vh - var(--wp-admin--admin-bar--height, 0px));
699
+ height: auto;
700
  animation-name: advads-modal-animatetop;
701
  animation-duration: 0.4s;
702
  position: relative;
 
 
703
  padding: 1em;
704
  padding-bottom: 0;
705
  overflow-y: scroll;
723
  bottom: 0;
724
  }
725
 
726
+ .advads-modal-footer .tablenav {
727
+ display: flex;
728
+ justify-content: space-between;
729
+ }
730
+
731
  .advads-modal h2, .advads-modal h3 {
732
  font-size: 1.3em;
733
  margin: 1em 0;
745
  }
746
  .advads-modal-close {
747
  color: #aaa;
 
748
  font-size: 28px;
749
  font-weight: bold;
750
  line-height: 50px;
751
  text-decoration: none;
752
  }
753
+ .advads-modal-header .advads-modal-close {
754
+ float: right;
755
+ }
756
  .advads-modal-close:hover,
757
  .advads-modal-close:focus {
758
  color: black;
1193
  .advads-modal-content {
1194
  height: 75%;
1195
  margin: 5% auto;
 
1196
  max-width: 66em;
1197
  width: 85%;
1198
  }
admin/assets/img/ad-types/empty.svg ADDED
@@ -0,0 +1 @@
 
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" overflow="visible"><path fill="#fff" d="M19.875 99C9.467 99 1 90.532 1 80.125V2a1 1 0 0 1 1-1h78.125C90.532 1 99 9.467 99 19.875V98a1 1 0 0 1-1 1H19.875z"/><path d="M80.125 2C89.984 2 98 10.016 98 19.875V98H19.875C10.016 98 2 89.977 2 80.125V2h78.125m0-2H2a2 2 0 0 0-2 2v78.125C0 91.084 8.916 100 19.875 100H98a2 2 0 0 0 2-2V19.875C100 8.916 91.084 0 80.125 0h0z" fill="#0074a2"/></svg>
admin/assets/img/ad-types/peepso.svg ADDED
@@ -0,0 +1 @@
 
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" overflow="visible"><path fill="#fff" d="M19.878 99C9.469 99 1 90.531 1 80.121V2a1 1 0 0 1 1-1h78.122C90.531 1 99 9.468 99 19.876V98a1 1 0 0 1-1 1H19.878z"/><path d="M80.122 2C89.98 2 98 10.019 98 19.876V98H19.878C10.02 98 2 89.979 2 80.121V2h78.122m0-2H2a2 2 0 0 0-2 2v78.121C0 91.082 8.917 100 19.878 100H98a2 2 0 0 0 2-2V19.876C100 8.917 91.083 0 80.122 0h0zM50.411 55.861c1.435.222 3.24.331 4.949.798 2.482.68 3.622 2.562 3.035 4.997-1.252 5.185-1.897 10.42-1.931 15.755-.007.888-.534 2.03-1.206 2.611-3.519 3.031-6.922 2.975-10.427.065-.716-.593-1.27-1.815-1.27-2.75.003-5.169-.686-10.235-1.799-15.271-.716-3.236.656-5.172 3.943-5.708 1.429-.235 2.89-.311 4.706-.497zm29.819-8.174c1.436.223 3.24.332 4.95.798 2.481.68 3.622 2.561 3.035 4.997a68.72 68.72 0 0 0-1.932 15.755c-.006.888-.533 2.031-1.206 2.61-3.519 3.032-6.922 2.975-10.427.066-.716-.593-1.27-1.815-1.27-2.75.004-5.169-.687-10.234-1.799-15.271-.716-3.236.656-5.172 3.942-5.708 1.434-.235 2.893-.311 4.707-.497zm-59.765 0c1.436.223 3.241.332 4.95.798 2.482.68 3.621 2.561 3.035 4.997a68.61 68.61 0 0 0-1.931 15.755 3.9 3.9 0 0 1-1.206 2.61c-3.52 3.032-6.922 2.975-10.427.066-.717-.593-1.269-1.815-1.269-2.75.003-5.169-.688-10.234-1.8-15.271-.716-3.236.656-5.172 3.942-5.708 1.429-.235 2.887-.311 4.706-.497zm36.586 6.418c1.825-2.197 3.035-4.447 3.016-7.25-.024-3.188-1.283-5.749-3.665-7.783-2.607-2.227-2.024-6.312 1.315-7.126 2.721-.663 5.652-.597 8.484-.577 1.279.01 2.593.603 3.822 1.097.86.348 1.175 1.021.701 2.047-1.072 2.326-.742 4.712-.464 7.207.262 2.356-.368 4.818-.656 7.227l-.709 4.698c-.082.523-.036 1.226-.354 1.531-2.217 2.127-6.222 3.436-9.251.719-.649-.591-1.378-1.108-2.239-1.79zm-14.098.041c-1.223.934-2.264 2.004-3.526 2.637-2.879 1.448-5.549.37-7.765-1.408-.369-.295-.458-1.037-.512-1.59-.105-1.098.018-2.221-.162-3.3l-1.209-5.981c-.162-1.183.166-2.425.105-3.631-.105-2.081-.115-4.214-.609-6.215-.298-1.213-.113-1.892.858-2.287 1.173-.477 2.441-.98 3.677-1 2.667-.046 5.355.08 8.002.388 1.558.182 2.866 1.14 3.175 2.83.328 1.802.186 3.376-1.551 4.728-4.059 3.164-4.643 9.168-1.53 13.405l1.047 1.424zm-22.886-8.347c-4.184-.013-7.315-3.147-7.302-7.31.014-4.075 3.283-7.329 7.365-7.325 4.032.003 7.342 3.336 7.332 7.388-.009 4.086-3.246 7.26-7.395 7.247zm67.162-7.286c.007 4.195-3.085 7.286-7.286 7.29-4.168 0-7.402-3.168-7.408-7.26-.007-4.009 3.353-7.365 7.379-7.375 4.104-.014 7.308 3.203 7.315 7.345zm-29.926 8.303c0 4.161-3.19 7.352-7.339 7.342-4.022-.01-7.236-3.218-7.279-7.266-.046-4.148 3.138-7.372 7.289-7.386 4.211-.013 7.329 3.102 7.329 7.31zm5.901-29.098c3.3-.046 6.1 2.684 6.072 5.927-.022 3.165-2.77 5.901-5.943 5.921-3.168.021-5.954-2.716-5.98-5.875-.027-3.196 2.646-5.926 5.851-5.973zm-20.562 6.06c-.07 3.194-2.84 5.848-6.027 5.775-3.26-.076-5.789-2.71-5.746-5.994.045-3.31 2.618-5.871 5.882-5.841 3.306.03 5.963 2.761 5.891 6.06z" fill="#0074a2"/></svg>
admin/assets/jquery-ui/images/ui-bg_flat_0_aaaaaa_40x100.png DELETED
Binary file
admin/assets/jquery-ui/images/ui-bg_flat_75_ffffff_40x100.png DELETED
Binary file
admin/assets/jquery-ui/images/ui-bg_glass_55_fbf9ee_1x400.png DELETED
Binary file
admin/assets/jquery-ui/images/ui-bg_glass_65_ffffff_1x400.png DELETED
Binary file
admin/assets/jquery-ui/images/ui-bg_glass_75_dadada_1x400.png DELETED
Binary file
admin/assets/jquery-ui/images/ui-bg_glass_75_e6e6e6_1x400.png DELETED
Binary file
admin/assets/jquery-ui/images/ui-bg_glass_95_fef1ec_1x400.png DELETED
Binary file
admin/assets/jquery-ui/images/ui-bg_highlight-soft_75_cccccc_1x100.png DELETED
Binary file
admin/assets/jquery-ui/images/ui-icons_222222_256x240.png DELETED
Binary file
admin/assets/jquery-ui/images/ui-icons_2e83ff_256x240.png DELETED
Binary file
admin/assets/jquery-ui/images/ui-icons_454545_256x240.png DELETED
Binary file
admin/assets/jquery-ui/images/ui-icons_888888_256x240.png DELETED
Binary file
admin/assets/jquery-ui/images/ui-icons_cd0a0a_256x240.png DELETED
Binary file
admin/assets/jquery-ui/jquery-ui.min.css DELETED
@@ -1,7 +0,0 @@
1
- /*! jQuery UI - v1.11.4 - 2015-03-11
2
- * http://jqueryui.com
3
- * Includes: core.css, accordion.css, autocomplete.css, button.css, datepicker.css, dialog.css, draggable.css, menu.css, progressbar.css, resizable.css, selectable.css, selectmenu.css, slider.css, sortable.css, spinner.css, tabs.css, tooltip.css, theme.css
4
- * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana%2CArial%2Csans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=highlight_soft&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=flat&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=glass&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=glass&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=glass&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=glass&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=glass&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
5
- * Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
6
-
7
- .ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-clearfix{min-height:0}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-accordion .ui-accordion-header{display:block;cursor:pointer;position:relative;margin:2px 0 0 0;padding:.5em .5em .5em .7em;min-height:0;font-size:100%}.ui-accordion .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-icons .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-header .ui-accordion-header-icon{position:absolute;left:.5em;top:50%;margin-top:-8px}.ui-accordion .ui-accordion-content{padding:1em 2.2em;border-top:0;overflow:auto}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-button{display:inline-block;position:relative;padding:0;line-height:normal;margin-right:.1em;cursor:pointer;vertical-align:middle;text-align:center;overflow:visible}.ui-button,.ui-button:link,.ui-button:visited,.ui-button:hover,.ui-button:active{text-decoration:none}.ui-button-icon-only{width:2.2em}button.ui-button-icon-only{width:2.4em}.ui-button-icons-only{width:3.4em}button.ui-button-icons-only{width:3.7em}.ui-button .ui-button-text{display:block;line-height:normal}.ui-button-text-only .ui-button-text{padding:.4em 1em}.ui-button-icon-only .ui-button-text,.ui-button-icons-only .ui-button-text{padding:.4em;text-indent:-9999999px}.ui-button-text-icon-primary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 1em .4em 2.1em}.ui-button-text-icon-secondary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 2.1em .4em 1em}.ui-button-text-icons .ui-button-text{padding-left:2.1em;padding-right:2.1em}input.ui-button{padding:.4em 1em}.ui-button-icon-only .ui-icon,.ui-button-text-icon-primary .ui-icon,.ui-button-text-icon-secondary .ui-icon,.ui-button-text-icons .ui-icon,.ui-button-icons-only .ui-icon{position:absolute;top:50%;margin-top:-8px}.ui-button-icon-only .ui-icon{left:50%;margin-left:-8px}.ui-button-text-icon-primary .ui-button-icon-primary,.ui-button-text-icons .ui-button-icon-primary,.ui-button-icons-only .ui-button-icon-primary{left:.5em}.ui-button-text-icon-secondary .ui-button-icon-secondary,.ui-button-text-icons .ui-button-icon-secondary,.ui-button-icons-only .ui-button-icon-secondary{right:.5em}.ui-buttonset{margin-right:7px}.ui-buttonset .ui-button{margin-left:0;margin-right:-.3em}input.ui-button::-moz-focus-inner,button.ui-button::-moz-focus-inner{border:0;padding:0}.ui-datepicker{width:17em;padding:.2em .2em 0;display:none}.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}.ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em}.ui-datepicker .ui-datepicker-prev-hover,.ui-datepicker .ui-datepicker-next-hover{top:1px}.ui-datepicker .ui-datepicker-prev{left:2px}.ui-datepicker .ui-datepicker-next{right:2px}.ui-datepicker .ui-datepicker-prev-hover{left:1px}.ui-datepicker .ui-datepicker-next-hover{right:1px}.ui-datepicker .ui-datepicker-prev span,.ui-datepicker .ui-datepicker-next span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:45%}.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:bold;border:0}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td span,.ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.ui-datepicker.ui-datepicker-multi{width:auto}.ui-datepicker-multi .ui-datepicker-group{float:left}.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}.ui-datepicker-row-break{clear:both;width:100%;font-size:0}.ui-datepicker-rtl{direction:rtl}.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,.ui-datepicker-rtl .ui-datepicker-group{float:right}.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-dialog{overflow:hidden;position:absolute;top:0;left:0;padding:.2em;outline:0}.ui-dialog .ui-dialog-titlebar{padding:.4em 1em;position:relative}.ui-dialog .ui-dialog-title{float:left;margin:.1em 0;white-space:nowrap;width:90%;overflow:hidden;text-overflow:ellipsis}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:20px;margin:-10px 0 0 0;padding:1px;height:20px}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:none;overflow:auto}.ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin-top:.5em;padding:.3em 1em .5em .4em}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer}.ui-dialog .ui-resizable-se{width:12px;height:12px;right:-5px;bottom:-5px;background-position:16px 16px}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-draggable-handle{-ms-touch-action:none;touch-action:none}.ui-menu{list-style:none;padding:0;margin:0;display:block;outline:none}.ui-menu .ui-menu{position:absolute}.ui-menu .ui-menu-item{position:relative;margin:0;padding:3px 1em 3px .4em;cursor:pointer;min-height:0;list-style-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7")}.ui-menu .ui-menu-divider{margin:5px 0;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-state-focus,.ui-menu .ui-state-active{margin:-1px}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item{padding-left:2em}.ui-menu .ui-icon{position:absolute;top:0;bottom:0;left:.2em;margin:auto 0}.ui-menu .ui-menu-icon{left:auto;right:0}.ui-progressbar{height:2em;text-align:left;overflow:hidden}.ui-progressbar .ui-progressbar-value{margin:-1px;height:100%}.ui-progressbar .ui-progressbar-overlay{background:url("data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc+w9XgU2FB3lOyQRWET2IFGiU9m1frDVpxZZc6bfHwv4c1YXP6k1Vdy292Fb6UkuvFtXpvWSzA+HycXJHUXiGYIiMg2R6W459gnWGfHNdjIqDWVqemH2ekpObkpOlppWUqZiqr6edqqWQAAIfkECQEAAQAsAAAAACgAKAAAApSMgZnGfaqcg1E2uuzDmmHUBR8Qil95hiPKqWn3aqtLsS18y7G1SzNeowWBENtQd+T1JktP05nzPTdJZlR6vUxNWWjV+vUWhWNkWFwxl9VpZRedYcflIOLafaa28XdsH/ynlcc1uPVDZxQIR0K25+cICCmoqCe5mGhZOfeYSUh5yJcJyrkZWWpaR8doJ2o4NYq62lAAACH5BAkBAAEALAAAAAAoACgAAAKVDI4Yy22ZnINRNqosw0Bv7i1gyHUkFj7oSaWlu3ovC8GxNso5fluz3qLVhBVeT/Lz7ZTHyxL5dDalQWPVOsQWtRnuwXaFTj9jVVh8pma9JjZ4zYSj5ZOyma7uuolffh+IR5aW97cHuBUXKGKXlKjn+DiHWMcYJah4N0lYCMlJOXipGRr5qdgoSTrqWSq6WFl2ypoaUAAAIfkECQEAAQAsAAAAACgAKAAAApaEb6HLgd/iO7FNWtcFWe+ufODGjRfoiJ2akShbueb0wtI50zm02pbvwfWEMWBQ1zKGlLIhskiEPm9R6vRXxV4ZzWT2yHOGpWMyorblKlNp8HmHEb/lCXjcW7bmtXP8Xt229OVWR1fod2eWqNfHuMjXCPkIGNileOiImVmCOEmoSfn3yXlJWmoHGhqp6ilYuWYpmTqKUgAAIfkECQEAAQAsAAAAACgAKAAAApiEH6kb58biQ3FNWtMFWW3eNVcojuFGfqnZqSebuS06w5V80/X02pKe8zFwP6EFWOT1lDFk8rGERh1TTNOocQ61Hm4Xm2VexUHpzjymViHrFbiELsefVrn6XKfnt2Q9G/+Xdie499XHd2g4h7ioOGhXGJboGAnXSBnoBwKYyfioubZJ2Hn0RuRZaflZOil56Zp6iioKSXpUAAAh+QQJAQABACwAAAAAKAAoAAACkoQRqRvnxuI7kU1a1UU5bd5tnSeOZXhmn5lWK3qNTWvRdQxP8qvaC+/yaYQzXO7BMvaUEmJRd3TsiMAgswmNYrSgZdYrTX6tSHGZO73ezuAw2uxuQ+BbeZfMxsexY35+/Qe4J1inV0g4x3WHuMhIl2jXOKT2Q+VU5fgoSUI52VfZyfkJGkha6jmY+aaYdirq+lQAACH5BAkBAAEALAAAAAAoACgAAAKWBIKpYe0L3YNKToqswUlvznigd4wiR4KhZrKt9Upqip61i9E3vMvxRdHlbEFiEXfk9YARYxOZZD6VQ2pUunBmtRXo1Lf8hMVVcNl8JafV38aM2/Fu5V16Bn63r6xt97j09+MXSFi4BniGFae3hzbH9+hYBzkpuUh5aZmHuanZOZgIuvbGiNeomCnaxxap2upaCZsq+1kAACH5BAkBAAEALAAAAAAoACgAAAKXjI8By5zf4kOxTVrXNVlv1X0d8IGZGKLnNpYtm8Lr9cqVeuOSvfOW79D9aDHizNhDJidFZhNydEahOaDH6nomtJjp1tutKoNWkvA6JqfRVLHU/QUfau9l2x7G54d1fl995xcIGAdXqMfBNadoYrhH+Mg2KBlpVpbluCiXmMnZ2Sh4GBqJ+ckIOqqJ6LmKSllZmsoq6wpQAAAh+QQJAQABACwAAAAAKAAoAAAClYx/oLvoxuJDkU1a1YUZbJ59nSd2ZXhWqbRa2/gF8Gu2DY3iqs7yrq+xBYEkYvFSM8aSSObE+ZgRl1BHFZNr7pRCavZ5BW2142hY3AN/zWtsmf12p9XxxFl2lpLn1rseztfXZjdIWIf2s5dItwjYKBgo9yg5pHgzJXTEeGlZuenpyPmpGQoKOWkYmSpaSnqKileI2FAAACH5BAkBAAEALAAAAAAoACgAAAKVjB+gu+jG4kORTVrVhRlsnn2dJ3ZleFaptFrb+CXmO9OozeL5VfP99HvAWhpiUdcwkpBH3825AwYdU8xTqlLGhtCosArKMpvfa1mMRae9VvWZfeB2XfPkeLmm18lUcBj+p5dnN8jXZ3YIGEhYuOUn45aoCDkp16hl5IjYJvjWKcnoGQpqyPlpOhr3aElaqrq56Bq7VAAAOw==");height:100%;filter:alpha(opacity=25);opacity:0.25}.ui-progressbar-indeterminate .ui-progressbar-value{background-image:none}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:0.1px;display:block;-ms-touch-action:none;touch-action:none}.ui-resizable-disabled .ui-resizable-handle,.ui-resizable-autohide .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-selectable{-ms-touch-action:none;touch-action:none}.ui-selectable-helper{position:absolute;z-index:100;border:1px dotted black}.ui-selectmenu-menu{padding:0;margin:0;position:absolute;top:0;left:0;display:none}.ui-selectmenu-menu .ui-menu{overflow:auto;overflow-x:hidden;padding-bottom:1px}.ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup{font-size:1em;font-weight:bold;line-height:1.5;padding:2px 0.4em;margin:0.5em 0 0 0;height:auto;border:0}.ui-selectmenu-open{display:block}.ui-selectmenu-button{display:inline-block;overflow:hidden;position:relative;text-decoration:none;cursor:pointer}.ui-selectmenu-button span.ui-icon{right:0.5em;left:auto;margin-top:-8px;position:absolute;top:50%}.ui-selectmenu-button span.ui-selectmenu-text{text-align:left;padding:0.4em 2.1em 0.4em 1em;display:block;line-height:1.4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-slider{position:relative;text-align:left}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:1.2em;height:1.2em;cursor:default;-ms-touch-action:none;touch-action:none}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0}.ui-slider.ui-state-disabled .ui-slider-handle,.ui-slider.ui-state-disabled .ui-slider-range{filter:inherit}.ui-slider-horizontal{height:.8em}.ui-slider-horizontal .ui-slider-handle{top:-.3em;margin-left:-.6em}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}.ui-sortable-handle{-ms-touch-action:none;touch-action:none}.ui-spinner{position:relative;display:inline-block;overflow:hidden;padding:0;vertical-align:middle}.ui-spinner-input{border:none;background:none;color:inherit;padding:0;margin:.2em 0;vertical-align:middle;margin-left:.4em;margin-right:22px}.ui-spinner-button{width:16px;height:50%;font-size:.5em;padding:0;margin:0;text-align:center;position:absolute;cursor:default;display:block;overflow:hidden;right:0}.ui-spinner a.ui-spinner-button{border-top:none;border-bottom:none;border-right:none}.ui-spinner .ui-icon{position:absolute;margin-top:-8px;top:50%;left:0}.ui-spinner-up{top:0}.ui-spinner-down{bottom:0}.ui-spinner .ui-icon-triangle-1-s{background-position:-65px -16px}.ui-tabs{position:relative;padding:.2em}.ui-tabs .ui-tabs-nav{margin:0;padding:.2em .2em 0}.ui-tabs .ui-tabs-nav li{list-style:none;float:left;position:relative;top:0;margin:1px .2em 0 0;border-bottom-width:0;padding:0;white-space:nowrap}.ui-tabs .ui-tabs-nav .ui-tabs-anchor{float:left;padding:.5em 1em;text-decoration:none}.ui-tabs .ui-tabs-nav li.ui-tabs-active{margin-bottom:-1px;padding-bottom:1px}.ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor{cursor:text}.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor{cursor:pointer}.ui-tabs .ui-tabs-panel{display:block;border-width:0;padding:1em 1.4em;background:none}.ui-tooltip{padding:8px;position:absolute;z-index:9999;max-width:300px;-webkit-box-shadow:0 0 5px #aaa;box-shadow:0 0 5px #aaa}body .ui-tooltip{border-width:2px}.ui-widget{font-family:Verdana,Arial,sans-serif;font-size:1.1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Verdana,Arial,sans-serif;font-size:1em}.ui-widget-content{border:1px solid #aaa;background:#fff url("images/ui-bg_flat_75_ffffff_40x100.png") 50% 50% repeat-x;color:#222}.ui-widget-content a{color:#222}.ui-widget-header{border:1px solid #aaa;background:#ccc url("images/ui-bg_highlight-soft_75_cccccc_1x100.png") 50% 50% repeat-x;color:#222;font-weight:bold}.ui-widget-header a{color:#222}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:1px solid #d3d3d3;background:#e6e6e6 url("images/ui-bg_glass_75_e6e6e6_1x400.png") 50% 50% repeat-x;font-weight:normal;color:#555}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#555;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus{border:1px solid #999;background:#dadada url("images/ui-bg_glass_75_dadada_1x400.png") 50% 50% repeat-x;font-weight:normal;color:#212121}.ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited,.ui-state-focus a,.ui-state-focus a:hover,.ui-state-focus a:link,.ui-state-focus a:visited{color:#212121;text-decoration:none}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:1px solid #aaa;background:#fff url("images/ui-bg_glass_65_ffffff_1x400.png") 50% 50% repeat-x;font-weight:normal;color:#212121}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#212121;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #fcefa1;background:#fbf9ee url("images/ui-bg_glass_55_fbf9ee_1x400.png") 50% 50% repeat-x;color:#363636}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#363636}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #cd0a0a;background:#fef1ec url("images/ui-bg_glass_95_fef1ec_1x400.png") 50% 50% repeat-x;color:#cd0a0a}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#cd0a0a}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#cd0a0a}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.ui-icon{width:16px;height:16px}.ui-icon,.ui-widget-content .ui-icon{background-image:url("images/ui-icons_222222_256x240.png")}.ui-widget-header .ui-icon{background-image:url("images/ui-icons_222222_256x240.png")}.ui-state-default .ui-icon{background-image:url("images/ui-icons_888888_256x240.png")}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon{background-image:url("images/ui-icons_454545_256x240.png")}.ui-state-active .ui-icon{background-image:url("images/ui-icons_454545_256x240.png")}.ui-state-highlight .ui-icon{background-image:url("images/ui-icons_2e83ff_256x240.png")}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url("images/ui-icons_cd0a0a_256x240.png")}.ui-icon-blank{background-position:16px 16px}.ui-icon-carat-1-n{background-position:0 0}.ui-icon-carat-1-ne{background-position:-16px 0}.ui-icon-carat-1-e{background-position:-32px 0}.ui-icon-carat-1-se{background-position:-48px 0}.ui-icon-carat-1-s{background-position:-64px 0}.ui-icon-carat-1-sw{background-position:-80px 0}.ui-icon-carat-1-w{background-position:-96px 0}.ui-icon-carat-1-nw{background-position:-112px 0}.ui-icon-carat-2-n-s{background-position:-128px 0}.ui-icon-carat-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-64px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-64px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:0 -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:4px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:4px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:4px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:4px}.ui-widget-overlay{background:#aaa url("images/ui-bg_flat_0_aaaaaa_40x100.png") 50% 50% repeat-x;opacity:.3;filter:Alpha(Opacity=30)}.ui-widget-shadow{margin:-8px 0 0 -8px;padding:8px;background:#aaa url("images/ui-bg_flat_0_aaaaaa_40x100.png") 50% 50% repeat-x;opacity:.3;filter:Alpha(Opacity=30);border-radius:8px}
 
 
 
 
 
 
 
admin/assets/js/admin.js CHANGED
@@ -116,43 +116,42 @@ jQuery( document ).ready( function ( $ ) {
116
  /**
117
  * Logic for placement list
118
  */
119
- // filter placement by type
120
- jQuery( '.advads_filter_placement_type' ).on( 'change', function () {
121
- var selectedValue = jQuery( this ).val();
122
- if ( selectedValue === '0' ) {
123
- jQuery( '.advads-placements-table tbody > tr' ).show();
124
- } else {
125
- jQuery( '.advads-placements-table tbody > tr' ).each( function () {
126
- if ( jQuery( this ).data( 'order' )['type'] !== selectedValue ) {
127
- jQuery( this ).hide();
128
- } else {
129
- jQuery( this ).show();
 
 
 
 
 
130
  }
131
- } );
132
- }
133
- } );
134
 
135
- // search placement by name
136
- jQuery( '.advads_search_placement_name' ).on( 'keyup', function () {
137
- jQuery( '.advads_filter_placement_type option[value=\'0\']' ).attr( 'selected', true );
138
- var value = this.value;
139
- jQuery( '.advads-placements-table' ).find( 'tr' ).each( function ( index ) {
140
- if ( ! index ) {
141
- return;
142
- }
143
- var name = jQuery( this ).data( 'order' )['name'];
144
- if ( typeof name !== 'undefined' ) {
145
- jQuery( this ).toggle( name.toLowerCase().indexOf( value.toLowerCase() ) !== - 1 );
146
- }
147
  } );
148
- } );
149
 
150
- // save placement edit modal
151
- jQuery( '.advanced-ads-placement-row .advads-modal-close-action' ).on( 'click', function () {
152
- // Change url hash, so that the modal doesn't load after refresh again.
153
- window.location.hash = '#close';
154
- jQuery( '#advanced-ads-placements-form' ).submit();
155
- } );
156
 
157
  jQuery( '.advads-delete-tag' ).each( function () {
158
  jQuery( this ).on( 'click', function () {
@@ -474,6 +473,15 @@ jQuery( document ).ready( function ( $ ) {
474
  // only occur, when the settings of a placement are expanded (let's just assume this means editing)
475
  $( 'form#advanced-ads-placements-form .advads-modal' ).on( 'mouseover', set_touched_placement )
476
 
 
 
 
 
 
 
 
 
 
477
  // on submit remove placements that were untouched
478
  $( 'form#advanced-ads-placements-form' ).on( 'submit', function () {
479
  var grouprows = jQuery( 'form#advanced-ads-placements-form tr.advanced-ads-placement-row' )
@@ -517,6 +525,11 @@ jQuery( document ).ready( function ( $ ) {
517
  $( '.advads-form-type' ).advads_tooltip( {
518
  content: function () {
519
  return jQuery( this ).find( '.advads-form-description' ).html()
 
 
 
 
 
520
  }
521
  } )
522
 
@@ -691,7 +704,6 @@ function modal_submit_form( event, ID, modalID, validation = '' ) {
691
  event.preventDefault();
692
  return;
693
  }
694
- window.location.hash = '#close';
695
  document.getElementById( ID ).submit();
696
  }
697
 
@@ -699,11 +711,11 @@ function modal_submit_form( event, ID, modalID, validation = '' ) {
699
  * Store the action hash in settings form action
700
  * thanks for Yoast SEO for this idea
701
  */
702
- function advads_set_tab_hashes () {
703
  // iterate through forms
704
  jQuery( '#advads-tabs' ).find( 'a' ).each( function () {
705
- var id = jQuery( this ).attr( 'id' ).replace( '-tab', '' )
706
- var optiontab = jQuery( '#' + id )
707
 
708
  var form = optiontab.children( '.advads-settings-tab-main-form' )
709
  if ( form.length ) {
116
  /**
117
  * Logic for placement list
118
  */
119
+ ( () => {
120
+ let selectedValue = '0';
121
+ let searchTerm = '';
122
+ const placementRows = jQuery( '.advads-placements-table tbody tr' );
123
+ const showHidePlacementRow = callback => {
124
+ placementRows.each( ( index, element ) => {
125
+ const $row = jQuery( element );
126
+ const rowData = $row.data( 'order' );
127
+
128
+ if (
129
+ typeof rowData === 'undefined'
130
+ || typeof rowData['type'] === 'undefined'
131
+ || typeof rowData['name'] === 'undefined'
132
+ ) {
133
+ $row.show();
134
+ return;
135
  }
 
 
 
136
 
137
+ $row.toggle(
138
+ ( selectedValue === '0' || rowData['type'] === selectedValue )
139
+ && ( searchTerm === '' || rowData['name'].toLowerCase().indexOf( searchTerm.toLowerCase() ) !== - 1 )
140
+ );
141
+ } );
142
+ };
143
+ // filter placement by type
144
+ jQuery( '.advads_filter_placement_type' ).on( 'change', function () {
145
+ selectedValue = jQuery( this ).val();
146
+ showHidePlacementRow();
 
 
147
  } );
 
148
 
149
+ // search placement by name
150
+ jQuery( '.advads_search_placement_name' ).on( 'keyup', function () {
151
+ searchTerm = this.value;
152
+ showHidePlacementRow();
153
+ } );
154
+ } )();
155
 
156
  jQuery( '.advads-delete-tag' ).each( function () {
157
  jQuery( this ).on( 'click', function () {
473
  // only occur, when the settings of a placement are expanded (let's just assume this means editing)
474
  $( 'form#advanced-ads-placements-form .advads-modal' ).on( 'mouseover', set_touched_placement )
475
 
476
+ // if the modal is canceled, remove the "touched" data again, since the user discarded any changes.
477
+ $( document ).on( 'advads-modal-canceled', event => {
478
+ const $placementRow = $( '#' + event.detail.modal_id ).parents( '.advanced-ads-placement-row' );
479
+ if ( ! $placementRow.length ) {
480
+ return;
481
+ }
482
+ $placementRow.data( 'touched', false );
483
+ } );
484
+
485
  // on submit remove placements that were untouched
486
  $( 'form#advanced-ads-placements-form' ).on( 'submit', function () {
487
  var grouprows = jQuery( 'form#advanced-ads-placements-form tr.advanced-ads-placement-row' )
525
  $( '.advads-form-type' ).advads_tooltip( {
526
  content: function () {
527
  return jQuery( this ).find( '.advads-form-description' ).html()
528
+ },
529
+ parent: ( $target ) => {
530
+ const modal = $target.parents( '.advads-modal' );
531
+
532
+ return modal.length ? '#'+modal[0].id : 'body';
533
  }
534
  } )
535
 
704
  event.preventDefault();
705
  return;
706
  }
 
707
  document.getElementById( ID ).submit();
708
  }
709
 
711
  * Store the action hash in settings form action
712
  * thanks for Yoast SEO for this idea
713
  */
714
+ function advads_set_tab_hashes() {
715
  // iterate through forms
716
  jQuery( '#advads-tabs' ).find( 'a' ).each( function () {
717
+ var id = jQuery( this ).attr( 'id' ).replace( '-tab', '' );
718
+ var optiontab = jQuery( '#' + id );
719
 
720
  var form = optiontab.children( '.advads-settings-tab-main-form' )
721
  if ( form.length ) {
admin/assets/js/admin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ function modal_submit_form(e,a,d,t=""){""===t||window[t](d)?document.getElementById(a).submit():e.preventDefault()}function advads_set_tab_hashes(){jQuery("#advads-tabs").find("a").each((function(){var e=jQuery(this).attr("id").replace("-tab",""),a=jQuery("#"+e).children(".advads-settings-tab-main-form");if(a.length){var d=a.attr("action").split("#")[0];a.attr("action",d+jQuery(this).attr("href"))}}))}function advads_scroll_to_element(e){var a=jQuery("#wpadminbar").height();jQuery("html, body").animate({scrollTop:jQuery(e).offset().top-a},1e3)}function advads_toggle(e){jQuery(e).slideToggle()}function advads_toggle_box(e,a){jQuery(e).is(":checked")?jQuery(a).slideDown():jQuery(a).slideUp()}function advads_toggle_box_enable(e,a){jQuery(e).is(":checked")?jQuery(a).find("input").removeAttr("disabled",""):jQuery(a).find("input").attr("disabled","disabled")}function advads_validate_new_form(e){return jQuery(".advads-form-type input:checked").length?(jQuery(".advads-form-type-error").hide(),""==jQuery(".advads-form-name").val()?(jQuery(".advads-form-name-error").show(),!1):(jQuery(".advads-form-name-error").hide(),!0)):(jQuery(".advads-form-type-error").show(),!1)}function advads_group_edit_submit(e){return jQuery(".advads-ad-group-form").filter(((a,d)=>!jQuery(d).parents(e).length)).remove(),!0}function advads_maybe_textarea_to_tinymce(e){var a=jQuery("#advads-ad-content-plain"),d=a.val(),t="advanced-ads-tinymce",n=jQuery("#"+t),s=jQuery("#advanced-ads-tinymce-wrapper");if("content"!==e)return n.prop("name",t),s.hide(),!1;if("object"==typeof tinyMCE&&null!==tinyMCE.get(t)){if(d){var o=window.wp;o&&o.editor&&o.editor.autop&&tinyMCE.get(t).getParam("wpautop",!0)&&(d=o.editor.autop(d)),tinyMCE.get(t).setContent(d)}a.remove(),n.prop("name",a.prop("name")),s.show()}else n.length&&(n.val(d),a.remove(),n.prop("name",a.prop("name")),s.show())}function advads_show_adsense_auto_ads_warning(){$msg=jQuery(".advads-auto-ad-in-ad-content").show(),$msg.on("click","button",(function(){$msg.hide(),jQuery.ajax({type:"POST",url:ajaxurl,data:{action:"advads-adsense-enable-pla",nonce:advadsglobal.ajax_nonce}}).done((function(e){$msg.show().html(advadstxt.page_level_ads_enabled)})).fail((function(e,a){$msg.show()}))}))}function advads_ads_txt_find_issues(){var e=jQuery("#advads-ads-txt-notice-wrapper"),a=jQuery("#advads-ads-txt-notice-refresh"),d=jQuery(".advads-ads-txt-action");function t(a){d.toggle(!a),a&&e.html('<span class="spinner advads-spinner"></span>')}function n(a){e.html(a.notices),t(!1)}function s(a){e.html('<p class="advads-notice-inline advads-error">'+jQuery("#advads-ads-txt-notice-error").text().replace("%s",parseInt(a.status,10)),NaN),t(!1)}function o(e){t(!0),jQuery.ajax({type:"POST",url:ajaxurl,data:{action:"advads-ads-txt",nonce:advadsglobal.ajax_nonce,type:e}}).done(n).fail(s)}e.length&&(e.find("ul").length||o("get_notices"),a.on("click",(function(){o("get_notices")})),jQuery(document).on("click","#advads-ads-txt-remove-real",(function(e){e.preventDefault();var a={data:{action:"advads-ads-txt",nonce:advadsglobal.ajax_nonce,type:"remove_real_file"},done:function(e){e.additional_content&&jQuery("#advads-ads-txt-additional-content").val(e.additional_content),n(e)},fail:s,before_send:function(){t(!0)}};advanced_ads_admin.filesystem.ajax(a)})),jQuery(document).on("click","#advads-ads-txt-create-real",(function(e){e.preventDefault();var a={data:{action:"advads-ads-txt",nonce:advadsglobal.ajax_nonce,type:"create_real_file"},done:n,fail:s,before_send:function(){t(!0)}};advanced_ads_admin.filesystem.ajax(a)})))}jQuery(document).ready((function(e){function a(e){e.each((function(){var e=jQuery(this);e.parents(".advads-ad-group-form").find(".advads-option:not(.static)").hide();var a=e.val();e.parents(".advads-ad-group-form").find(".advads-group-type-"+a).show()}))}function d(a=!0){var d=e("button.advads-license-activate, button.advads-license-deactivate");a?d.attr("disabled","disabled"):d.removeAttr("disabled")}e(document).on("click","#switch-to-adsense-type",(function(a){a.preventDefault(),AdvancedAdsAdmin.AdImporter.adsenseCode=Advanced_Ads_Admin.get_ad_source_editor_text(),e("#advanced-ad-type-adsense").trigger("click"),e(this).closest("li").addClass("hidden")})),e(document).on("change","#advanced-ad-type input",(function(){!function(a){jQuery("#advanced-ad-type input").prop("disabled",!0),e("#advanced-ads-tinymce-wrapper").hide(),e("#advanced-ads-ad-parameters").html('<span class="spinner advads-ad-parameters-spinner advads-spinner"></span>'),e.ajax({type:"POST",url:ajaxurl,data:{action:"load_ad_parameters_metabox",ad_type:a,ad_id:e("#post_ID").val(),nonce:advadsglobal.ajax_nonce},success:function(d,t,n){d&&(e("#advanced-ads-ad-parameters").html(d).trigger("paramloaded"),advads_maybe_textarea_to_tinymce(a))},error:function(a,d,t){e("#advanced-ads-ad-parameters").html(t)}}).always((function(e,a,d){jQuery('#advanced-ad-type input[name^="advanced_ad"]').prop("disabled",!1)}))}(e(this).val())})),e("#advads-ad-injection-box .advads-ad-injection-button").on("click",(function(){var a=this.dataset.placementType,d=this.dataset.placementSlug,t={};if(a||d){if(a&&"post_content"===a){var n=prompt(advadstxt.after_paragraph_promt,1);null!==n&&(t.index=parseInt(n,10))}e("#advads-ad-injection-box .advads-loader").show(),e("#advads-ad-injection-box-placements").hide(),e("body").animate({scrollTop:e("#advads-ad-injection-box").offset().top-40},1,"linear"),e.ajax({type:"POST",url:ajaxurl,data:{action:"advads-ad-injection-content",placement_type:a,placement_slug:d,ad_id:e("#post_ID").val(),options:t,nonce:advadsglobal.ajax_nonce},success:function(a,d,t){a?(e("#advads-ad-injection-box *").hide(),e("#advads-ad-injection-message-placement-created .advads-placement-link").attr("href",e("#advads-ad-injection-message-placement-created a").attr("href")+a),e("#advads-ad-injection-message-placement-created, #advads-ad-injection-message-placement-created *").show()):e("#advads-ad-injection-box").html("an error occured")},error:function(a,d,t){e("#advads-ad-injection-box").html(t)}}).always((function(e,a,d){}))}})),e(".advads-buttonset").advads_buttonset(),e.fn.accordion&&e(".advads-accordion").accordion({active:!1,collapsible:!0}),e(".advads-ad-list-tooltip").advads_tooltip({content:function(){return jQuery(this).find(".advads-ad-list-tooltip-content").html()}}),e(".post-type-advanced_ads .wp-list-table thead th:last-of-type").append('<span class="dashicons dashicons-edit"></span>').on("click",(function(){e("#show-settings-link").trigger("click")})),jQuery(".advads_filter_placement_type").on("change",(function(){var e=jQuery(this).val();"0"===e?jQuery(".advads-placements-table tbody > tr").show():jQuery(".advads-placements-table tbody > tr").each((function(){jQuery(this).data("order").type!==e?jQuery(this).hide():jQuery(this).show()}))})),jQuery(".advads_search_placement_name").on("keyup",(function(){jQuery(".advads_filter_placement_type option[value='0']").attr("selected",!0);var e=this.value;jQuery(".advads-placements-table").find("tr").each((function(a){if(a){var d=jQuery(this).data("order").name;void 0!==d&&jQuery(this).toggle(-1!==d.toLowerCase().indexOf(e.toLowerCase()))}}))})),jQuery(".advads-delete-tag").each((function(){jQuery(this).on("click",(function(){if(!0===confirm(window.advadstxt.delete_placement_confirmation)){var e=jQuery(this).parents(".advanced-ads-placement-row");e.find(".advads-placements-item-delete").prop("checked",!0),e.data("touched",!0),jQuery("#advanced-ads-placements-form").submit()}}))})),jQuery(".advads-sort").on("click",(function(e){var a=jQuery(this),d=a.data("orderby"),t=jQuery(".advads-placements-table"),n=jQuery("> tbody > tr",t);jQuery("> thead th > a",t).each((function(){jQuery(this).removeClass("advads-placement-sorted")})),a.addClass("advads-placement-sorted"),n.sort((function(e,a){let t=jQuery(e).data("order"),n=jQuery(a).data("order");return"type"===d?t["words-between-repeats"]!==n["words-between-repeats"]?t["words-between-repeats"]?1:-1:t.order===n.order?t["post-content-index"]&&n["post-content-index"]&&t["post-content-index"]!==n["post-content-index"]?t["post-content-index"]<n["post-content-index"]?-1:1:t.name.localeCompare(n.name,void 0,{numeric:!0}):t.order-n.order:t.name.localeCompare(n.name,void 0,{numeric:!0})})),jQuery.each(n,(function(e,a){t.append(a)}));var s=window.location.pathname+window.location.search;-1!==s.indexOf("orderby=")?s=s.replace(/\borderby=[0-9a-zA-Z_@.#+-]{1,50}\b/,"orderby="+d):s+="&orderby="+d,window.history.replaceState({orderby:d},document.title,s),e.preventDefault()})),e("#advads-output-wrapper-id").on("keyup",(function(){var a=e(this).val();/^[a-z-0-9]*$/.test(a)?e(".advads-output-wrapper-id-error").addClass("hidden"):e(".advads-output-wrapper-id-error").removeClass("hidden")})),e(".advads-group-add-ad button").on("click",(function(){var a=e(this).closest(".advads-ad-group-form"),d=a.find(".advads-group-add-ad-list-ads option:selected");$weight_selector=a.find(".advads-group-add-ad-list-weights").last(),$ad_table=a.find(".advads-group-ads tbody"),d.length&&$weight_selector.length&&!$ad_table.find('[name="'+d.val()+'"]').length&&$ad_table.append(e("<tr></tr>").append(e("<td></td>").html(d.text()),e("<td></td>").append($weight_selector.clone().val($weight_selector.val()).prop("name",d.val())),'<td><button type="button" class="advads-remove-ad-from-group button">x</button></td>'))})),e("#advads-ad-group-list").on("click",".advads-remove-ad-from-group",(function(){var a=e(this).closest("tr");a.data("ad-id")&&e("#advads-ad-group-list form").append('<input type="hidden" name="advads-groups-removed-ads[]" value="'+a.data("ad-id")+'"><input type="hidden" name="advads-groups-removed-ads-gid[]" value="'+a.data("group-id")+'">'),a.remove()})),e(".advads-ad-group-type input").on("click",(function(){a(e(this))})),a(e(".advads-ad-group-type input:checked")),e(".advads-ad-group-list-ads").each((function(){5<=e(this).find("li").length&&e(this).find("li:gt(2)").hide()})),e(".advads-group-ads-list-show-more").on("click",(function(){jQuery(this).hide().parents(".advads-ad-group-list-ads").find("li").show()})),e(".advads-settings-tab-main-form .advads-license-key").on("blur",(function(){var a=e(this).val();if(""!==a){var d=e(".advads-settings-tab-main-form .advads-license-key"),t=[];d.each((function(a,d){""===e(d).val()&&t.push(d)})),d.length===t.length+1&&e.each(t,(function(d,t){e(t).val(a)}))}})),e(".advads-license-activate").on("click",(function(){var a=e(this);if(this.dataset.addon){d(!0);var t={action:"advads-activate-license",addon:this.dataset.addon,pluginname:this.dataset.pluginname,optionslug:this.dataset.optionslug,license:e(this).parents("td").find(".advads-license-key").val(),security:e("#advads-licenses-ajax-referrer").val()};e('<span class="spinner advads-spinner"></span>').insertAfter(a),e.post(ajaxurl,t,(function(t){e("span.spinner").remove();var n=a.parents("td");if("1"===t)n.find(".advads-license-activate-error").remove(),n.find(".advads-license-deactivate").show(),a.fadeOut(),n.find(".advads-license-activate-active").fadeIn(),n.find("input").prop("readonly","readonly"),d(!1);else if("ex"===t){var s=n.find("input.advads-license-key"),o=n.find("a.advads-renewal-link");if(s&&o){var r=s.val(),i=o.prop("href");o.prop("href",i.replace("%LICENSE_KEY%",r))}n.find(".advads-license-activate-error").remove(),n.find(".advads-license-expired-error").show(),d(!1)}else n.find(".advads-license-activate-error").show().html(t),d(!1)}))}})),e(".advads-license-deactivate").on("click",(function(){var a=e(this);if(this.dataset.addon){d(!0);var t={action:"advads-deactivate-license",addon:this.dataset.addon,pluginname:this.dataset.pluginname,optionslug:this.dataset.optionslug,security:e("#advads-licenses-ajax-referrer").val()};e('<span class="spinner advads-spinner"></span>').insertAfter(a),e.post(ajaxurl,t,(function(t){e("span.spinner").remove(),"1"===t?(a.siblings(".advads-license-activate-error").hide(),a.siblings(".advads-license-activate-active").hide(),a.siblings(".advads-license-activate").show(),a.siblings("input").prop("readonly",!1),a.fadeOut(),d(!1)):"ex"===t?(a.siblings(".advads-license-activate-error").hide(),a.siblings(".advads-license-activate-active").hide(),a.siblings(".advads-license-expired-error").show(),a.siblings("input").prop("readonly",!1),a.fadeOut(),d(!1)):(a.siblings(".advads-license-activate-error").show().html(t),a.siblings(".advads-license-activate-active").hide(),d(!1))}))}})),e("body:not(.post-type-advanced_ads ) #advads-show-filters").on("click",(function(){const a=e(this).find(".dashicons").hasClass("dashicons-arrow-up");e(".advads-toggle-with-filters-button").toggleClass("hidden",a),e("#advads-show-filters .dashicons").toggleClass("dashicons-filter",a),e("#advads-show-filters .dashicons").toggleClass("dashicons-arrow-up",!a)})),e('.post-type-advanced_ads .check-column input[type="checkbox"]').on("change",(function(){e(".post-type-advanced_ads .tablenav.bottom .bulkactions").toggleClass("fixed",0<e('.post-type-advanced_ads .check-column input[type="checkbox"]:checked').length)})),e("#advads-show-screen-options").on("click",(function(){e("#show-settings-link").trigger("click")})),e('<button type="button" class="button advads-button-secondary">'+advadstxt.close+"</button>").appendTo(e(".post-type-advanced_ads #adv-settings .submit")).on("click",(function(){e("#show-settings-link").trigger("click")}));var t,n=function(){var a=e(this).closest("tr.advanced-ads-placement-row");a&&a.data("touched",!0)};function s(a){"custom"===e(a).find("option:selected").val()?e(a).next(".advads-placements-content-custom-xpath").show():e(a).next(".advads-placements-content-custom-xpath").hide()}e("form#advanced-ads-placements-form input, #advanced-ads-placements-form select").on("change",n),e("form#advanced-ads-placements-form button").on("click",n),e("form#advanced-ads-placements-form .advads-modal").on("mouseover",n),e(document).on("advads-modal-canceled",(a=>{const d=e("#"+a.detail.modal_id).parents(".advanced-ads-placement-row");d.length&&d.data("touched",!1)})),e("form#advanced-ads-placements-form").on("submit",(function(){jQuery("form#advanced-ads-placements-form tr.advanced-ads-placement-row");jQuery("form#advanced-ads-placements-form tr.advanced-ads-placement-row").each((function(e,a){(a=jQuery(a)).data("touched")||a.find("input, select").each((function(e,a){(a=jQuery(a)).prop("disabled",!0)}))}))})),e(".advads-placements-content-tag").each((function(){s(this)})),e(".advads-placements-content-tag").on("change",(function(){s(this)})),e(".advads-form-type").advads_tooltip({content:function(){return jQuery(this).find(".advads-form-description").html()},parent:e=>{const a=e.parents(".advads-modal");return a.length?"#"+a[0].id:"body"}}),e("body").on("click",".advads_image_upload",(function(a){a.preventDefault();var d=e(this);t||(t=wp.media.frames.file_frame=wp.media({id:"advads_type_image_wp_media",title:d.data("uploaderTitle"),button:{text:d.data("uploaderButtonText")},library:{type:"image"},multiple:!1})).on("select",(function(){t.state().get("selection").each((function(a,d){if(a=a.toJSON(),0===d){e("#advads-image-id").val(a.id),e('#advanced-ads-ad-parameters-size input[name="advanced_ad[width]"]').val(a.width),e('#advanced-ads-ad-parameters-size input[name="advanced_ad[height]"]').val(a.height);var t='<img width="'+a.width+'" height="'+a.height+'" title="'+a.title+'" alt="'+a.alt+'" src="'+a.url+'"/>';e("#advads-image-preview").html(t),e("#advads-image-edit-link").attr("href",a.editLink),e("#advads-image-edit-link").removeClass("hidden"),e("#advanced-ads-ad-parameters-size input[type=number]:first").trigger("change")}}))})),t.open()})),window.formfield="",e("#advanced-ads-use-adblocker").on("change",(function(){advads_toggle_box(this,"#advads-adblocker-wrapper")}));var o=e("#advads-adblocker-wrapper"),r=e("#advads-adblocker-rebuild");r.prop("disabled",!1),e(document).on("click","#advads-adblocker-rebuild",(function(a){a.preventDefault();var d=e("#advanced-ads-rebuild-assets-form");d.prev(".error").remove(),r.prop("disabled",!0).after('<span class="spinner advads-spinner"></span>');var t={data:{action:"advads-adblock-rebuild-assets",nonce:advadsglobal.ajax_nonce},done:function(a){o.html(a),r=e("#advads-adblocker-rebuild")},fail:function(e,a,t){d.before('<div class="error"><p>'+a+": "+t+"</p></div>"),r.prop("disabled",!1).next(".advads-spinner").remove()},on_modal_close:function(){r.prop("disabled",!1).next(".advads-spinner").remove()}};e('[name="advads_ab_assign_new_folder"]').is(":checked")&&(t.data.advads_ab_assign_new_folder=!0),advanced_ads_admin.filesystem.ajax(t)})),e("#advanced-ads-ad-parameters").on("change","#advanced-ads-ad-parameters-size input[type=number]",(function(){e("#advanced-ads-ad-parameters-size input[type=number]").filter((function(){return parseInt(this.value,10)>0})).length>=1?e("#advads-wrapper-add-sizes").prop("disabled",!1):e("#advads-wrapper-add-sizes").prop("disabled",!0).prop("checked",!1)})),e("#advanced-ads-ad-parameters").on("paramloaded",(function(){e("#advanced-ads-ad-parameters-size input[type=number]:first").trigger("change")})),e("#advanced-ads-ad-parameters-size input[type=number]:first").trigger("change"),e(".advads-hndlelinks").each((function(){e(this).appendTo(e(this).parents(".postbox").find("h2.hndle")),e(this).removeClass("hidden")})),e(".advads-video-link").on("click",(function(a){a.preventDefault();var d=e(a.target).parents(".postbox").find(".advads-video-link-container");d.html(d.data("videolink"))})),e(".advads-video-link-inline").on("click",(function(a){a.preventDefault();var d=e(this).parents("div").siblings(".advads-video-link-container");d.html(d.data("videolink"))})),jQuery(".advads_import_type").on("change",(function(){"xml_content"===this.value?(jQuery("#advads_xml_file").hide(),jQuery("#advads_xml_content").show()):(jQuery("#advads_xml_file").show(),jQuery("#advads_xml_content").hide())}));var i=jQuery("textarea[name=advanced_ad\\[content\\]]").text()||"";(-1!==i.indexOf("enable_page_level_ads")||/script[^>]+(?:data-ad-client=|adsbygoogle\.js\?client=)/.test(i))&&advads_show_adsense_auto_ads_warning(),advads_ads_txt_find_issues(),jQuery(".advanced-ads-adsense-dashboard").each((function(e,a){Advanced_Ads_Adsense_Report_Helper&&Advanced_Ads_Adsense_Report_Helper.init(a)}))})),window.advanced_ads_admin=window.advanced_ads_admin||{},advanced_ads_admin.filesystem={_locked_job:!1,_requestForCredentialsModalToggle:function(){this.$filesystemModal.toggle(),jQuery("body").toggleClass("modal-open")},_init:function(){this._init=function(){};var e=this;e.$filesystemModal=jQuery("#advanced-ads-rfc-dialog"),e.$filesystemModal.on("submit","form",(function(a){a.preventDefault(),e.ajax(e._locked_job,!0),e._requestForCredentialsModalToggle()})),e.$filesystemModal.on("click",'[data-js-action="close"]',(function(){jQuery.isPlainObject(e._locked_job)&&e._locked_job.on_modal_close&&e._locked_job.on_modal_close(),e._locked_job=!1,e._requestForCredentialsModalToggle()}))},ajax:function(e,a){if(this._init(),!a&&this.$filesystemModal.length>0)return this._requestForCredentialsModalToggle(),this.$filesystemModal.find("input:enabled:first").focus(),void(this._locked_job=e);var d={method:"POST",url:window.ajaxurl,data:{username:jQuery("#username").val(),password:jQuery("#password").val(),hostname:jQuery("#hostname").val(),connection_type:jQuery('input[name="connection_type"]:checked').val(),public_key:jQuery("#public_key").val(),private_key:jQuery("#private_key").val(),_fs_nonce:jQuery("#_fs_nonce").val()}};e.before_send&&e.before_send(),d.data=jQuery.extend(d.data,e.data);var t=jQuery.ajax(d);e.done&&t.done(e.done),e.fail&&t.fail(e.fail)}},window.Advanced_Ads_Admin=window.Advanced_Ads_Admin||{init_ad_source_editor:function(){},get_ad_source_editor_text:function(){var e=void 0;if(Advanced_Ads_Admin.editor&&Advanced_Ads_Admin.editor.codemirror&&(e=Advanced_Ads_Admin.editor.codemirror.getValue()),!e){var a=jQuery("#advads-ad-content-plain");a&&(e=a.val())}return e},set_ad_source_editor_text:function(e){Advanced_Ads_Admin.editor&&Advanced_Ads_Admin.editor.codemirror?Advanced_Ads_Admin.editor.codemirror.setValue(e):jQuery("#advads-ad-content-plain").val(e)},check_ad_source:function(){var e=Advanced_Ads_Admin.get_ad_source_editor_text();const a=jQuery("#advads-parameters-php-warning"),d=jQuery("#advads-allow-php-warning");a.hide(),d.hide(),jQuery("#advads-parameters-php").prop("checked")&&(/<\?(?:php|=)/.test(e)?d.show():a.show()),jQuery("#advads-parameters-shortcodes").prop("checked")&&!/\[[^\]]+\]/.test(e)?jQuery("#advads-parameters-shortcodes-warning").show():jQuery("#advads-parameters-shortcodes-warning").hide()},reassign_ad:function(e){let a=jQuery("#post_author_override");a.length||(a=jQuery("#post_author")),a.val(e).queue((()=>{jQuery("#post").submit()}))},toggle_placements_visibility:function(e,a){var d=jQuery(e).next(".advads-placements-advanced-options");if(void 0!==a?!a:d.is(":visible"))d.hide(),jQuery("#advads-last-edited-placement").val("");else{var t=jQuery(e).parents(".advads-placements-table-options").find(".advads-placement-slug").val();d.show(),jQuery("#advads-last-edited-placement").val(t);var n=jQuery(e).closest("tr.advanced-ads-placement-row");n&&n.data("touched",!0)}},get_cookie:function(e){var a,d,t,n=document.cookie.split(";");for(a=0;a<n.length;a++)if(d=n[a].substr(0,n[a].indexOf("=")),t=n[a].substr(n[a].indexOf("=")+1),(d=d.replace(/^\s+|\s+$/g,""))===e)return unescape(t)},set_cookie:function(e,a,d,t,n,s){var o=null==d?null:24*d*60*60;this.set_cookie_sec(e,a,o,t,n,s)},set_cookie_sec:function(e,a,d,t,n,s){var o=new Date;o.setSeconds(o.getSeconds()+parseInt(d)),document.cookie=e+"="+escape(a)+(null==d?"":"; expires="+o.toUTCString())+(null==t?"; path=/":"; path="+t)+(null==n?"":"; domain="+n)+(null==s?"":"; secure")}},window.AdvancedAdsAdmin||(window.AdvancedAdsAdmin={}),window.AdvancedAdsAdmin.AdImporter||(window.AdvancedAdsAdmin.AdImporter={highlightSelectedRowInExternalAdsList:function(e){void 0===e&&(e=AdvancedAdsAdmin.AdImporter.adNetwork.hideIdle);const a=jQuery("#mapi-table-wrap tbody");jQuery("#mapi-toggle-idle");(e?jQuery("#mapi-table-wrap tbody tr[data-active=1]").length:jQuery("#mapi-table-wrap tbody tr").length)>8?jQuery("#mapi-table-wrap").addClass("overflow"):jQuery("#mapi-table-wrap").removeClass("overflow");const d=AdvancedAdsAdmin.AdImporter.getSelectedRow();a.find("tr").removeClass("selected error"),d&&d.show();const t=a.find("tr:visible");return t.filter(":odd").css("background-color","#FFFFFF"),t.filter(":even").css("background-color","#F9F9F9"),d&&(d.css("background-color",""),d.addClass("selected"),this.scrollToSelectedRow(d)),d||!1},scrollToSelectedRow(e){const a=jQuery("#mapi-table-wrap"),d=a.height(),t=a.scrollTop();if(!e)return void a.animate({scrollTop:0},200);let n=e.position().top,s=+n+e.height();(n<t||s>t||n>t+d)&&(s>a.children("table").height()-d&&(n=s),n<d&&(n=0),a.animate({scrollTop:n},200))},getSelectedRow(){const e=AdvancedAdsAdmin.AdImporter.adNetwork.getSelectedId(),a=jQuery("#mapi-table-wrap tbody");if(e){const d=a.find('tr[data-slotid="'+e+'"]');if(d.length)return d}return null},openExternalAdsList:function(){const e=AdvancedAdsAdmin.AdImporter.adNetwork;if(e.openSelector(),jQuery(".mapi-insert-code").css("display","inline"),jQuery(".mapi-open-selector").css("display","none"),jQuery(".mapi-close-selector-link").css("display","inline"),jQuery(".advads-adsense-code").css("display","none"),jQuery("#remote-ad-unsupported-ad-type").css("display","none"),AdvancedAdsAdmin.AdImporter.highlightSelectedRowInExternalAdsList(e.hideIdle),e.getCustomInputs().css("display","none"),jQuery("#mapi-wrap").css("display","block"),!e.fetchedExternalAds){e.fetchedExternalAds=!0;0==jQuery("#mapi-table-wrap tbody tr[data-slotid]").length&&AdvancedAdsAdmin.AdImporter.refreshAds()}jQuery("#wpwrap").trigger("advads-mapi-adlist-opened")},onChangedAdType:function(){AdvancedAdsAdmin.AdImporter.adNetwork&&(AdvancedAdsAdmin.AdImporter.adNetwork.onBlur(),AdvancedAdsAdmin.AdImporter.adNetwork=null)},setup:function(e){AdvancedAdsAdmin.AdImporter.adNetwork=e,e.onSelected(),AdvancedAdsAdmin.AdImporter.isSetup?AdvancedAdsAdmin.AdImporter.highlightSelectedRowInExternalAdsList():(AdvancedAdsAdmin.AdImporter.isSetup=!0,jQuery(document).on("click",".prevent-default",(function(e){e.preventDefault()})),jQuery(document).on("click",".mapi-insert-code",(function(e){e.preventDefault(),jQuery("#remote-ad-unsupported-ad-type").css("display","none"),jQuery(".advads-adsense-code").show(),jQuery(".mapi-open-selector").css("display","inline"),jQuery(".mapi-close-selector-link").css("display","inline"),jQuery(".mapi-insert-code").css("display","none"),jQuery("#mapi-wrap").css("display","none"),AdvancedAdsAdmin.AdImporter.adNetwork.getCustomInputs().css("display","none")})),jQuery(document).on("click",".mapi-open-selector a",(function(){AdvancedAdsAdmin.AdImporter.openExternalAdsList()})),jQuery(document).on("click","#mapi-close-selector,.mapi-close-selector-link",(function(){jQuery("#remote-ad-unsupported-ad-type").css("display","none"),AdvancedAdsAdmin.AdImporter.manualSetup()})),jQuery(document).on("click",".mapiaction",(function(e){switch(jQuery(this).attr("data-mapiaction")){case"updateList":AdvancedAdsAdmin.AdImporter.refreshAds();break;case"getCode":if(jQuery(this).hasClass("disabled"))break;var a=jQuery(this).attr("data-slotid");AdvancedAdsAdmin.AdImporter.adNetwork.selectAdFromList(a);break;case"updateCode":a=jQuery(this).attr("data-slotid");AdvancedAdsAdmin.AdImporter.adNetwork.updateAdFromList(a);break;case"toggleidle":if(void 0===AdvancedAdsAdmin.AdImporter.adNetwork.getMapiAction||"function"!=typeof AdvancedAdsAdmin.AdImporter.adNetwork.getMapiAction("toggleidle")){AdvancedAdsAdmin.AdImporter.adNetwork.hideIdle=!AdvancedAdsAdmin.AdImporter.adNetwork.hideIdle,AdvancedAdsAdmin.AdImporter.toggleIdleAds(AdvancedAdsAdmin.AdImporter.adNetwork.hideIdle);const e=jQuery("#mapi-notice-inactive");e.length&&e.toggle(AdvancedAdsAdmin.AdImporter.adNetwork.hideIdle);break}AdvancedAdsAdmin.AdImporter.adNetwork.getMapiAction("toggleidle")(e,this)}})),AdvancedAdsAdmin.AdImporter.adNetwork.onDomReady())},manualSetup(){jQuery(".mapi-open-selector,.advads-adsense-show-code").css("display","inline"),jQuery(".mapi-insert-code").css("display","inline"),jQuery(".mapi-close-selector-link").css("display","none"),jQuery("#mapi-wrap").css("display","none"),AdvancedAdsAdmin.AdImporter.adNetwork.getCustomInputs().css("display","block"),"in-feed"!==jQuery("#unit-type").val()&&jQuery(".advads-adsense-layout-key").css("display","none").next("div").css("display","none"),AdvancedAdsAdmin.AdImporter.adNetwork.onManualSetup()},setRemoteErrorMessage(e){e?jQuery("#remote-ad-code-msg").html(e):jQuery("#remote-ad-code-msg").empty()},closeAdSelector:function(){setTimeout((function(){jQuery("#mapi-wrap").animate({height:0},360,(function(){jQuery(".mapi-open-selector,.advads-adsense-show-code").css("display","inline"),jQuery(".mapi-close-selector-link").css("display","none"),jQuery("#mapi-wrap").css({display:"none",height:"auto"});AdvancedAdsAdmin.AdImporter.adNetwork.getCustomInputs().css("display","block")}))}),80)},unitIsNotSupported:function(e){jQuery("#remote-ad-unsupported-ad-type").css("display","block"),AdsenseMAPI.unsupportedUnits[e]=1,jQuery("#unit-code").val(""),jQuery("#unit-type").val("normal"),jQuery("#ad-layout-key").val(""),jQuery('tr[data-slotid^="ca-"]').removeClass("selected error");var a=jQuery('tr[data-slotid="'+e+'"]');a.addClass("selected error").css("background-color",""),this.scrollToSelectedRow(a)},unitIsSupported:function(e){if(jQuery("#remote-ad-unsupported-ad-type").css("display","none"),void 0!==AdsenseMAPI.unsupportedUnits[e]&&delete AdsenseMAPI.unsupportedUnits[e],jQuery('i[data-mapiaction="getCode"][data-slotid="'+e+'"]').removeClass("disabled"),jQuery('tr[data-slotid="'+e+'"] .unittype a').length){var a=jQuery('tr[data-slotid="'+e+'"] .unittype'),d=jQuery('tr[data-slotid="'+e+'"] .unittype a').attr("data-type");a.text(d)}if(jQuery('tr[data-slotid="'+e+'"] .unitsize a').length){a=jQuery('tr[data-slotid="'+e+'"] .unitsize'),d=jQuery('tr[data-slotid="'+e+'"] .unitsize a').attr("data-size");a.text(d)}},emptyMapiSelector:function(e){const a='<div class="advads-notice-inline advads-error"><p>'+e+"</p></div>";jQuery("#mapi-loading-overlay").css("display","none"),jQuery("#mapi-wrap").html(jQuery(a))},refreshAds:function(){const e=AdvancedAdsAdmin.AdImporter.adNetwork;jQuery("#mapi-loading-overlay").css("display","block"),jQuery.ajax({type:"post",url:ajaxurl,data:e.getRefreshAdsParameters(),success:function(e,a,d){void 0!==e.html?(jQuery("#mapi-wrap").replaceWith(jQuery(e.html)),AdvancedAdsAdmin.AdImporter.openExternalAdsList()):void 0!==e.msg&&AdvancedAdsAdmin.AdImporter.emptyMapiSelector(e.msg),void 0!==e.raw&&e.raw,jQuery("#mapi-loading-overlay").css("display","none")},error:function(e,a,d){jQuery("#mapi-loading-overlay").css("display","none")}})},toggleIdleAds:function(e){void 0===e&&(e=!0),AdvancedAdsAdmin.AdImporter.highlightSelectedRowInExternalAdsList(e)}});class AdvancedAdsAdNetwork{constructor(e){this.id=e,this.units=[],this.vars=window[e+"AdvancedAdsJS"],this.hideIdle=!0,this.fetchedExternalAds=!1}onSelected(){console.error("Please override onSelected.")}onBlur(){console.error("Please override onBlur.")}openSelector(){console.error("Please override openSelector.")}getSelectedId(){console.error("Please override getSelectedId.")}selectAdFromList(e){console.error("Please override selectAdFromList.")}updateAdFromList(e){console.error("Please override updateAdFromList.")}getRefreshAdsParameters(){console.error("Please override getRefreshAdsParameters.")}getCustomInputs(){console.error("Please override getCustomInputs.")}onDomReady(){console.error("Please override onDomReady.")}onManualSetup(){}}class AdvancedAdsExternalAdUnit{}jQuery(document).ready((function(){jQuery(document).on("click",".advads-tr-remove",(function(){jQuery(this).closest("tr").remove()}))})),void 0===jQuery.escapeSelector&&(jQuery.escapeSelector=function(e){return e.replace(/([$%&()*+,./:;<=>?@\[\\\]^{|}~])/g,"\\$1")});const modal=e=>{function a(){this.addedNodes=[],this.removedNodes=[]}let d=!1,t=new a,n=new a;const s=()=>window.location.hash.replace("#",""),o=new MutationObserver((e=>{for(const a of e){for(const e of a.removedNodes){const a=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;a.nextNode();)if("INPUT"===a.currentNode.tagName||"SELECT"===a.currentNode.tagName){const e=n.addedNodes.indexOf(a.currentNode.name);e>-1?n.addedNodes.splice(e,1):n.removedNodes.push(a.currentNode.name)}}for(const e of a.addedNodes){if(e.nodeType===Node.TEXT_NODE)continue;const a=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;a.nextNode();)"INPUT"!==a.currentNode.tagName&&"SELECT"!==a.currentNode.tagName||n.addedNodes.push(a.currentNode.name)}}})),r=()=>{e.showModal(),n=new a,o.observe(e,{childList:!0,subtree:!0})},i=()=>{s()===e.id&&r()},c=()=>{if(!d||!((e,a)=>{for(const d in a)if(!e.hasOwnProperty(d)||e[d].toString()!==a[d].toString())return!0;return!1})(t,n))return!0;if(window.confirm(window.advadstxt.confirmation)){if(n.addedNodes.length||n.removedNodes.length)return window.location.reload(),!0;for(const a in n){const d=e.querySelector('[name="'+a+'"]');null!==d&&("checkbox"===d.type?d.checked=t[a]:"radio"===d.type?e.querySelector('[name="'+a+'"][value="'+t[a]+'"]').checked=!0:d.value=t[a])}return!0}return!1};i(),window.addEventListener("hashchange",(()=>{i(),"close"===s()&&c()&&e.close()})),document.querySelectorAll('a[href$="#'+e.id+'"]').forEach((e=>{e.addEventListener("click",(e=>{e.preventDefault(),r()}))})),e.addEventListener("cancel",(a=>{a.preventDefault(),c()&&(e.close(),o.disconnect(),document.dispatchEvent(new CustomEvent("advads-modal-canceled",{detail:{modal_id:e.id}})))})),e.addEventListener("close",(a=>{s()===e.id&&(window.location.hash="")}));try{e.querySelector("form").addEventListener("submit",(()=>{window.location.hash=""})),d=!0}catch(a){let t;try{t=e.querySelector("button.advads-modal-close-action").form,d=!0}catch(e){}try{e.querySelectorAll("input").forEach((e=>{e.addEventListener("keydown",(e=>{"Enter"===e.key&&(void 0===t?e.preventDefault():t.submit())}))}))}catch(e){}}if(d){const a=e=>"checkbox"===e.type?e.checked:("radio"===e.type&&e.checked,e.value);e.querySelectorAll("input, select").forEach((e=>{e.name.length&&(t[e.name]=a(e),e.addEventListener("change",(d=>{n[e.name]=a(e)})))}))}e.querySelectorAll(".advads-modal-close, .advads-modal-close-background").forEach((a=>{a.addEventListener("click",(a=>{a.preventDefault(),e.dispatchEvent(new Event("cancel"))}))}));try{e.querySelector("a.advads-modal-close-action").addEventListener("click",(a=>{a.preventDefault(),e.close()}))}catch(e){}};window.addEventListener("DOMContentLoaded",(()=>{try{if("function"!=typeof document.querySelector(".advads-modal[id^=modal-]").showModal)return}catch(e){return}[...document.getElementsByClassName("advads-modal")].forEach(modal)}));
admin/assets/js/dialog-advads-modal.js ADDED
@@ -0,0 +1,280 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact -- PHPCS can't handle es5 short functions
2
+ const modal = element => {
3
+
4
+ function FormValues() {
5
+ this.addedNodes = [];
6
+ this.removedNodes = [];
7
+ };
8
+
9
+ let hasForm = false,
10
+ initialFormValues = new FormValues(),
11
+ changedFormValues = new FormValues();
12
+
13
+ /**
14
+ * Remove the pound sign from the location hash.
15
+ *
16
+ * @return {string}
17
+ */
18
+ const getId = () => window.location.hash.replace( '#', '' );
19
+
20
+ const mutationObserver = new MutationObserver( mutations => {
21
+ for ( const mutation of mutations ) {
22
+ for ( const removedNode of mutation.removedNodes ) {
23
+ const nodes = document.createTreeWalker( removedNode, NodeFilter.SHOW_ELEMENT );
24
+ while ( nodes.nextNode() ) {
25
+ if ( nodes.currentNode.tagName === 'INPUT' || nodes.currentNode.tagName === 'SELECT' ) {
26
+ const index = changedFormValues.addedNodes.indexOf( nodes.currentNode.name );
27
+ if ( index > - 1 ) {
28
+ changedFormValues.addedNodes.splice( index, 1 );
29
+ } else {
30
+ changedFormValues.removedNodes.push( nodes.currentNode.name );
31
+ }
32
+ }
33
+ }
34
+ }
35
+ for ( const addedNode of mutation.addedNodes ) {
36
+ if ( addedNode.nodeType === Node.TEXT_NODE ) {
37
+ continue;
38
+ }
39
+
40
+ const nodes = document.createTreeWalker( addedNode, NodeFilter.SHOW_ELEMENT );
41
+ while ( nodes.nextNode() ) {
42
+ if ( nodes.currentNode.tagName === 'INPUT' || nodes.currentNode.tagName === 'SELECT' ) {
43
+ changedFormValues.addedNodes.push( nodes.currentNode.name );
44
+ }
45
+ }
46
+ }
47
+ }
48
+ } );
49
+
50
+ const showModal = () => {
51
+ element.showModal();
52
+ changedFormValues = new FormValues();
53
+ mutationObserver.observe( element, {childList: true, subtree: true} );
54
+ };
55
+
56
+ /**
57
+ * If the current hash matches the modal id attribute, open it.
58
+ */
59
+ const showIfHashMatches = () => {
60
+ if ( getId() === element.id ) {
61
+ showModal();
62
+ }
63
+ };
64
+
65
+ /**
66
+ * Check if there are inputs that have been changed and if their value is different.
67
+ *
68
+ * @param {Object} reference The initial values when the modal loaded, indexed by name attribute.
69
+ * @param {Object} changed The input values that were changed, indexed by name.
70
+ *
71
+ * @return {boolean}
72
+ */
73
+ const hasChanged = ( reference, changed ) => {
74
+ for ( const name in changed ) {
75
+ if ( ! reference.hasOwnProperty( name ) || reference[name].toString() !== changed[name].toString() ) {
76
+ return true;
77
+ }
78
+ }
79
+
80
+ return false;
81
+ };
82
+
83
+ /**
84
+ * If the modal is associated with a form and any values have changed, ask for confirmation to navigate away.
85
+ * Returns true if the user agrees with termination, false otherwise.
86
+ *
87
+ * @return {boolean}
88
+ */
89
+ const terminationNotice = () => {
90
+ if ( ! hasForm || ! hasChanged( initialFormValues, changedFormValues ) ) {
91
+ return true;
92
+ }
93
+
94
+ // ask user for confirmation.
95
+ if ( window.confirm( window.advadstxt.confirmation ) ) {
96
+ // if we have added or removed nodes, we need to reload the page.
97
+ if ( changedFormValues.addedNodes.length || changedFormValues.removedNodes.length ) {
98
+ window.location.reload();
99
+ return true;
100
+ }
101
+
102
+ // otherwise, we'll replace the values with the previous values.
103
+ for ( const name in changedFormValues ) {
104
+ const input = element.querySelector( '[name="' + name + '"]' );
105
+ if ( input === null ) {
106
+ continue;
107
+ }
108
+
109
+ if ( input.type === 'checkbox' ) {
110
+ input.checked = initialFormValues[name];
111
+ } else if ( input.type === 'radio' ) {
112
+ element.querySelector( '[name="' + name + '"][value="' + initialFormValues[name] + '"]' ).checked = true;
113
+ } else {
114
+ input.value = initialFormValues[name];
115
+ }
116
+ }
117
+
118
+ return true;
119
+ }
120
+
121
+ return false;
122
+ };
123
+
124
+ // Check whether to open modal on page load.
125
+ showIfHashMatches();
126
+
127
+ /**
128
+ * Listen to the hashchange event, to check if the current modal needs to be opened.
129
+ */
130
+ window.addEventListener( 'hashchange', () => {
131
+ showIfHashMatches();
132
+ if ( getId() === 'close' && terminationNotice() ) {
133
+ element.close();
134
+ }
135
+ } );
136
+
137
+ /**
138
+ * Attach a click listener to all links referencing this modal and prevent their default action.
139
+ * By changing the hash on every click, we also create a history entry.
140
+ */
141
+ document.querySelectorAll( 'a[href$="#' + element.id + '"]' ).forEach( link => {
142
+ link.addEventListener( 'click', e => {
143
+ e.preventDefault();
144
+ showModal();
145
+ } );
146
+ } );
147
+
148
+ /**
149
+ * On the cancel event, check for termination notice and fire a custom event.
150
+ */
151
+ element.addEventListener( 'cancel', event => {
152
+ event.preventDefault();
153
+ if ( terminationNotice() ) {
154
+ element.close();
155
+
156
+ mutationObserver.disconnect();
157
+
158
+ document.dispatchEvent( new CustomEvent( 'advads-modal-canceled', {
159
+ detail: {
160
+ modal_id: element.id
161
+ }
162
+ } ) );
163
+ }
164
+ } );
165
+
166
+ /**
167
+ * On the close event, i.e., a form got submit, empty the hash to prevent form from reopening.
168
+ */
169
+ element.addEventListener( 'close', event => {
170
+ if ( getId() === element.id ) {
171
+ window.location.hash = '';
172
+ }
173
+ } );
174
+
175
+ try {
176
+ // try if there is a form inside the modal, otherwise continue in catch.
177
+ element.querySelector( 'form' ).addEventListener( 'submit', () => {
178
+ window.location.hash = '';
179
+ } );
180
+ hasForm = true;
181
+ } catch ( e ) {
182
+ let targetForm;
183
+ try {
184
+ targetForm = element.querySelector( 'button.advads-modal-close-action' ).form;
185
+ hasForm = true;
186
+ } catch ( e ) {
187
+ }
188
+ try {
189
+ /**
190
+ * Listen for the keydown event in all inputs.
191
+ * If the enter key is pressed and the modal has a form, submit it, else do nothing.
192
+ */
193
+ element.querySelectorAll( 'input' ).forEach( input => {
194
+ input.addEventListener( 'keydown', e => {
195
+ if ( e.key !== 'Enter' ) {
196
+ return;
197
+ }
198
+
199
+ if ( typeof targetForm !== 'undefined' ) {
200
+ targetForm.submit();
201
+ return;
202
+ }
203
+
204
+ // if there are inputs, but there is no form associated with them, do nothing.
205
+ e.preventDefault();
206
+ } );
207
+ } );
208
+ } catch ( e ) {
209
+
210
+ }
211
+ }
212
+
213
+ if ( hasForm ) {
214
+ /**
215
+ * Collect input values.
216
+ * Checkboxes are true/false.
217
+ * Radio buttons are true false on the saved value.
218
+ *
219
+ * @param {Node} input
220
+ * @return {*}
221
+ */
222
+ const checkbox = input => {
223
+ if ( input.type === 'checkbox' ) {
224
+ return input.checked;
225
+ }
226
+ if ( input.type === 'radio' && input.checked ) {
227
+ return input.value;
228
+ }
229
+
230
+ return input.value;
231
+ };
232
+
233
+ /**
234
+ * Collect inputs in this modal and save their initial and changed values (if any).
235
+ */
236
+ element.querySelectorAll( 'input, select' ).forEach( input => {
237
+ if ( ! input.name.length ) {
238
+ return;
239
+ }
240
+
241
+ initialFormValues[input.name] = checkbox( input );
242
+
243
+ input.addEventListener( 'change', event => {
244
+ changedFormValues[input.name] = checkbox( input );
245
+ } );
246
+ } );
247
+ }
248
+
249
+ /**
250
+ * On the cancel buttons, check termination notice and close the modal.
251
+ */
252
+ element.querySelectorAll( '.advads-modal-close, .advads-modal-close-background' ).forEach( button => {
253
+ button.addEventListener( 'click', e => {
254
+ e.preventDefault();
255
+ element.dispatchEvent( new Event( 'cancel' ) );
256
+ } );
257
+ } );
258
+
259
+ try {
260
+ /**
261
+ * If the save button is not a `<button>` element. Close the form without changing the hash.
262
+ */
263
+ element.querySelector( 'a.advads-modal-close-action' ).addEventListener( 'click', e => {
264
+ e.preventDefault();
265
+ element.close();
266
+ } );
267
+ } catch ( e ) {
268
+ }
269
+ };
270
+
271
+ window.addEventListener( 'DOMContentLoaded', () => {
272
+ try {
273
+ if ( typeof document.querySelector( '.advads-modal[id^=modal-]' ).showModal !== 'function' ) {
274
+ return;
275
+ }
276
+ } catch ( e ) {
277
+ return;
278
+ }
279
+ [...document.getElementsByClassName( 'advads-modal' )].forEach( modal );
280
+ } );
admin/assets/js/ui.js CHANGED
@@ -115,8 +115,9 @@
115
  var content = options.content.call( $target )
116
  if ( content ) {
117
  tooltip = $( '<div>' ).addClass( 'advads-tooltip' );
 
118
  $( '<div>' ).addClass( 'advads-tooltip-content' ).appendTo( tooltip );
119
- tooltip.appendTo( 'body' );
120
  tooltip.find( '.advads-tooltip-content' ).html( content );
121
 
122
  position = $target.offset();
115
  var content = options.content.call( $target )
116
  if ( content ) {
117
  tooltip = $( '<div>' ).addClass( 'advads-tooltip' );
118
+ const parent = typeof options.parent === 'function' ? options.parent.call( this, $target ) : 'body';
119
  $( '<div>' ).addClass( 'advads-tooltip-content' ).appendTo( tooltip );
120
+ tooltip.appendTo( parent );
121
  tooltip.find( '.advads-tooltip-content' ).html( content );
122
 
123
  position = $target.offset();
admin/class-advanced-ads-admin.php CHANGED
@@ -212,10 +212,11 @@ class Advanced_Ads_Admin {
212
 
213
  if ( self::screen_belongs_to_advanced_ads() ) {
214
  wp_register_script( $this->plugin_slug . '-ui-scripts', plugins_url( 'assets/js/ui.js', __FILE__ ), [ 'jquery' ], ADVADS_VERSION, false );
215
- wp_register_script( $this->plugin_slug . '-admin-script', plugins_url( 'assets/js/admin.js', __FILE__ ), [ 'jquery', $this->plugin_slug . '-ui-scripts', 'jquery-ui-autocomplete' ], ADVADS_VERSION, false );
216
  wp_register_script( $this->plugin_slug . '-conditions-script', plugins_url( 'assets/js/conditions.js', __FILE__ ), [ 'jquery', $this->plugin_slug . '-ui-scripts' ], ADVADS_VERSION, false );
217
  wp_register_script( $this->plugin_slug . '-wizard-script', plugins_url( 'assets/js/wizard.js', __FILE__ ), [ 'jquery' ], ADVADS_VERSION, false );
218
 
 
 
219
  // just register this script for later inclusion on ad group list page.
220
  wp_register_script( 'inline-edit-group-ads', plugins_url( 'assets/js/inline-edit-group-ads.js', __FILE__ ), [ 'jquery' ], ADVADS_VERSION, false );
221
 
@@ -239,6 +240,7 @@ class Advanced_Ads_Admin {
239
  'display_conditions_form_name' => Advanced_Ads_Display_Conditions::FORM_NAME, // not meant for translation.
240
  'delete_placement_confirmation' => __( 'Permanently delete this placement?', 'advanced-ads' ),
241
  'close' => __( 'Close', 'advanced-ads' ),
 
242
  ];
243
 
244
  wp_localize_script( $this->plugin_slug . '-admin-script', 'advadstxt', $translation_array );
@@ -275,6 +277,24 @@ class Advanced_Ads_Admin {
275
  }
276
  }
277
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
278
  /**
279
  * Check if the current screen belongs to Advanced Ads
280
  *
@@ -812,7 +832,7 @@ class Advanced_Ads_Admin {
812
  $new_button_label = __( 'New Ad Group', 'advanced-ads' );
813
  $new_button_href = '#modal-group-new';
814
  $new_button_id = 'advads-new-ad-group-link';
815
- $manual_url = 'manual/rotate-ad/';
816
  $show_filter_button = empty( $_GET['s'] );
817
  $reset_href = ! $show_filter_button ? esc_url( admin_url( 'admin.php?page=advanced-ads-groups' ) ) : '';
818
  break;
212
 
213
  if ( self::screen_belongs_to_advanced_ads() ) {
214
  wp_register_script( $this->plugin_slug . '-ui-scripts', plugins_url( 'assets/js/ui.js', __FILE__ ), [ 'jquery' ], ADVADS_VERSION, false );
 
215
  wp_register_script( $this->plugin_slug . '-conditions-script', plugins_url( 'assets/js/conditions.js', __FILE__ ), [ 'jquery', $this->plugin_slug . '-ui-scripts' ], ADVADS_VERSION, false );
216
  wp_register_script( $this->plugin_slug . '-wizard-script', plugins_url( 'assets/js/wizard.js', __FILE__ ), [ 'jquery' ], ADVADS_VERSION, false );
217
 
218
+ $this->enqueue_main_admin_script();
219
+
220
  // just register this script for later inclusion on ad group list page.
221
  wp_register_script( 'inline-edit-group-ads', plugins_url( 'assets/js/inline-edit-group-ads.js', __FILE__ ), [ 'jquery' ], ADVADS_VERSION, false );
222
 
240
  'display_conditions_form_name' => Advanced_Ads_Display_Conditions::FORM_NAME, // not meant for translation.
241
  'delete_placement_confirmation' => __( 'Permanently delete this placement?', 'advanced-ads' ),
242
  'close' => __( 'Close', 'advanced-ads' ),
243
+ 'confirmation' => __( 'Data you have entered has not been saved. Are you sure you want to discard your changes?', 'advanced-ads' ),
244
  ];
245
 
246
  wp_localize_script( $this->plugin_slug . '-admin-script', 'advadstxt', $translation_array );
277
  }
278
  }
279
 
280
+ /**
281
+ * Enqueue the minified version of the admin script, or the parts if SCRIPT_DEBUG is defined and true.
282
+ *
283
+ * @return void
284
+ */
285
+ private function enqueue_main_admin_script() {
286
+ $dependencies = array( 'jquery', $this->plugin_slug . '-ui-scripts', 'jquery-ui-autocomplete' );
287
+
288
+ if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
289
+ wp_enqueue_script( $this->plugin_slug . '-admin-script', plugins_url( 'assets/js/admin.js', __FILE__ ), $dependencies, ADVADS_VERSION, false );
290
+ wp_enqueue_script( $this->plugin_slug . '-admin-script-dialog', plugins_url( 'assets/js/dialog-advads-modal.js', __FILE__ ), $dependencies, ADVADS_VERSION, false );
291
+
292
+ return;
293
+ }
294
+
295
+ wp_enqueue_script( $this->plugin_slug . '-admin-script', plugins_url( 'assets/js/admin.min.js', __FILE__ ), $dependencies, ADVADS_VERSION, false );
296
+ }
297
+
298
  /**
299
  * Check if the current screen belongs to Advanced Ads
300
  *
832
  $new_button_label = __( 'New Ad Group', 'advanced-ads' );
833
  $new_button_href = '#modal-group-new';
834
  $new_button_id = 'advads-new-ad-group-link';
835
+ $manual_url = 'manual/ad-groups/';
836
  $show_filter_button = empty( $_GET['s'] );
837
  $reset_href = ! $show_filter_button ? esc_url( admin_url( 'admin.php?page=advanced-ads-groups' ) ) : '';
838
  break;
admin/includes/ad-authors.php CHANGED
@@ -147,7 +147,7 @@ class Advanced_Ads_Ad_Authors {
147
  }
148
 
149
  $author_id = (int) get_post_field( 'post_author', $post_id );
150
- if ( ! user_can( $author_id, $cap, $args ) ) {
151
  $author_id = $user_id;
152
  }
153
 
147
  }
148
 
149
  $author_id = (int) get_post_field( 'post_author', $post_id );
150
+ if ( $author_id !== $user_id && ! user_can( $author_id, $cap, $post_id ) ) {
151
  $author_id = $user_id;
152
  }
153
 
admin/includes/class-ad-groups-list.php CHANGED
@@ -327,6 +327,32 @@ class Advanced_Ads_Groups_List {
327
  return $select;
328
  }
329
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
330
  /**
331
  * Return ad group types
332
  *
327
  return $select;
328
  }
329
 
330
+ /**
331
+ * Return all ad group types from premium products.
332
+ *
333
+ * @return array
334
+ */
335
+ public function get_ad_group_types_premium() {
336
+ $group_types_premium = [];
337
+ if ( ! defined( 'AAP_VERSION' ) ) {
338
+ $group_types_premium['grid'] = [
339
+ 'title' => __( 'Grid', 'advanced-ads' ),
340
+ 'description' => '',
341
+ 'image' => ADVADS_BASE_URL . 'admin/assets/img/groups/grid.svg',
342
+ ];
343
+ }
344
+ // Slider
345
+ if ( ! defined( 'AAS_VERSION' ) ) {
346
+ $group_types_premium['slider'] = [
347
+ 'title' => __( 'Ad Slider', 'advanced-ads' ),
348
+ 'description' => '',
349
+ 'image' => ADVADS_BASE_URL . 'admin/assets/img/groups/slider.svg',
350
+ ];
351
+ }
352
+
353
+ return $group_types_premium;
354
+ }
355
+
356
  /**
357
  * Return ad group types
358
  *
admin/includes/class-admin-upgrades.php CHANGED
@@ -81,7 +81,7 @@ class Advanced_Ads_Admin_Upgrades {
81
  public static function pro_feature_link( $utm_campaign = '' ) {
82
  self::upgrade_link(
83
  __( 'Pro Feature', 'advanced-ads' ),
84
- ADVADS_URL . 'add-ons/advanced-ads-pro/',
85
  $utm_campaign
86
  );
87
  }
81
  public static function pro_feature_link( $utm_campaign = '' ) {
82
  self::upgrade_link(
83
  __( 'Pro Feature', 'advanced-ads' ),
84
+ ADVADS_URL . 'advanced-ads-pro/',
85
  $utm_campaign
86
  );
87
  }
admin/includes/class-menu.php CHANGED
@@ -366,23 +366,8 @@ class Advanced_Ads_Admin_Menu {
366
  // load the ad group list after groups might have been deleted
367
  $ad_groups_list = new Advanced_Ads_Groups_List();
368
  $group_types = $ad_groups_list->get_ad_group_types();
 
369
  $is_search = ! empty( $_GET['s'] );
370
- $group_types_premium = [];
371
- if ( ! defined( 'AAP_VERSION' ) ) {
372
- $group_types_premium['grid'] = [
373
- 'title' => __( 'Grid', 'advanced-ads' ),
374
- 'description' => '',
375
- 'image' => ADVADS_BASE_URL . 'admin/assets/img/groups/grid.svg',
376
- ];
377
- }
378
- // Slider
379
- if ( ! defined( 'AAS_VERSION' ) ) {
380
- $group_types_premium['slider'] = [
381
- 'title' => __( 'Ad Slider', 'advanced-ads' ),
382
- 'description' => '',
383
- 'image' => ADVADS_BASE_URL . 'admin/assets/img/groups/slider.svg',
384
- ];
385
- }
386
  // load template.
387
  include ADVADS_BASE_PATH . 'admin/views/ad-group.php';
388
  }
366
  // load the ad group list after groups might have been deleted
367
  $ad_groups_list = new Advanced_Ads_Groups_List();
368
  $group_types = $ad_groups_list->get_ad_group_types();
369
+ $group_types_premium = $ad_groups_list->get_ad_group_types_premium();
370
  $is_search = ! empty( $_GET['s'] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
371
  // load template.
372
  include ADVADS_BASE_PATH . 'admin/views/ad-group.php';
373
  }
admin/includes/class-overview-widgets.php CHANGED
@@ -556,7 +556,7 @@ endif;
556
  $installed_pro_plugins++;
557
  } elseif ( class_exists( 'Advanced_Ads_Responsive_Plugin' ) ) {
558
  $add_ons['responsive']['link'] = ADVADS_URL . 'manual/responsive-ads-documentation/?utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons-manual';
559
- $add_ons['responsive']['desc'] = '<a href="' . admin_url( 'admin.php?page=responsive-ads-list' ) . '">' . __( 'List of responsive ads by browser width', 'advanced-ads-responsive' ) . '</a>';
560
  $add_ons['responsive']['installed'] = true;
561
  $add_ons['responsive']['order'] = 20;
562
  $installed_pro_plugins++;
556
  $installed_pro_plugins++;
557
  } elseif ( class_exists( 'Advanced_Ads_Responsive_Plugin' ) ) {
558
  $add_ons['responsive']['link'] = ADVADS_URL . 'manual/responsive-ads-documentation/?utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons-manual';
559
+ $add_ons['responsive']['desc'] = '<a href="' . admin_url( 'admin.php?page=responsive-ads-list' ) . '">' . __( 'List of responsive ads by browser width', 'advanced-ads' ) . '</a>';
560
  $add_ons['responsive']['installed'] = true;
561
  $add_ons['responsive']['order'] = 20;
562
  $installed_pro_plugins++;
admin/views/ad-group-list-form-row.php CHANGED
@@ -15,63 +15,73 @@
15
  */
16
  ?>
17
  <div class="advads-ad-group-form">
18
- <?php
19
- // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- the output is already escaped
20
- echo $hints_html;
21
- ob_start();
22
- ?>
23
- <input type="hidden" class="advads-group-id" name="advads-groups[<?php echo absint( $group->id ); ?>][id]" value="<?php echo absint( $group->id ); ?>"/>
24
- <input type="text" name="advads-groups[<?php echo absint( $group->id ); ?>][name]" value="<?php echo esc_attr( $group->name ); ?>"/>
25
- <?php
26
- $option_content = ob_get_clean();
27
-
28
- Advanced_Ads_Admin_Options::render_option(
29
- 'group-name static',
30
- __( 'Name', 'advanced-ads' ),
31
- $option_content
32
- );
33
-
34
- // group type.
35
- ob_start();
36
- ?>
37
- <div class="advads-ad-group-type">
38
- <?php
39
- if ( $missing_type_error ) :
40
- ?>
41
- <p class="advads-notice-inline advads-error"><?php echo esc_html( $missing_type_error ); ?></p>
42
  <?php
43
- endif;
44
- foreach ( $this->types as $_type_key => $_type ) :
 
45
  ?>
46
- <label title="<?php echo esc_html( $_type['description'] ); ?>"><input type="radio" name="advads-groups[<?php echo absint( $group->id ); ?>][type]" value="<?php echo esc_attr( $_type_key ); ?>" <?php checked( $group->type, $_type_key ); ?>/>
47
- <?php echo esc_html( $_type['title'] ); ?>
48
- </label>
49
  <?php
50
- endforeach;
51
- ?>
52
- </div>
53
- <?php
54
- $option_content = ob_get_clean();
55
 
56
- Advanced_Ads_Admin_Options::render_option(
57
- 'group-type static',
58
- esc_attr__( 'Type', 'advanced-ads' ),
59
- $option_content
60
- );
61
 
62
- // group number.
63
- ob_start();
64
- ?>
65
- <select name="advads-groups[<?php echo absint( $group->id ); ?>][ad_count]">
66
- <?php
67
- $max = ( count( $ad_form_rows ) >= 10 ) ? count( $ad_form_rows ) + 2 : 10;
68
- for ( $i = 1; $i <= $max; $i++ ) :
69
  ?>
70
- <option <?php selected( $group->ad_count, $i ); ?>><?php echo absint( $i ); ?></option>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  <?php
72
- endfor;
73
- ?>
74
- <option <?php selected( $group->ad_count, 'all' ); ?> value="all"><?php echo esc_attr_x( 'all', 'option to display all ads in an ad groups', 'advanced-ads' ); ?></option>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  </select>
76
  <?php
77
  $option_content = ob_get_clean();
15
  */
16
  ?>
17
  <div class="advads-ad-group-form">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  <?php
19
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- the output is already escaped
20
+ echo $hints_html;
21
+ ob_start();
22
  ?>
23
+ <input type="hidden" class="advads-group-id" name="advads-groups[<?php echo (int) $group->id; ?>][id]" value="<?php echo (int) $group->id; ?>"/>
24
+ <input type="text" name="advads-groups[<?php echo (int) $group->id; ?>][name]" value="<?php echo esc_attr( $group->name ); ?>"/>
 
25
  <?php
26
+ $option_content = ob_get_clean();
 
 
 
 
27
 
28
+ Advanced_Ads_Admin_Options::render_option(
29
+ 'group-name static',
30
+ __( 'Name', 'advanced-ads' ),
31
+ $option_content
32
+ );
33
 
34
+ // group type.
35
+ ob_start();
 
 
 
 
 
36
  ?>
37
+ <div class="advads-ad-group-type">
38
+ <?php
39
+ if ( $missing_type_error ) :
40
+ ?>
41
+ <p class="advads-notice-inline advads-error"><?php echo esc_html( $missing_type_error ); ?></p>
42
+ <?php
43
+ endif;
44
+ foreach ( $this->types as $_type_key => $_type ) :
45
+ ?>
46
+ <label title="<?php echo esc_html( $_type['description'] ); ?>">
47
+ <input type="radio" name="advads-groups[<?php echo (int) $group->id; ?>][type]" value="<?php echo esc_attr( $_type_key ); ?>" <?php checked( $group->type, $_type_key ); ?>/>
48
+ <?php echo esc_html( $_type['title'] ); ?>
49
+ </label>
50
+ <?php endforeach; ?>
51
+ <?php foreach ( $this->get_ad_group_types_premium() as $key => $group_type ) : ?>
52
+ <label title="<?php echo esc_html( $group_type['description'] ); ?>">
53
+ <input type="radio" name="advads-groups[<?php echo (int) $group->id; ?>][type]" value="<?php echo esc_attr( $key ); ?>" disabled/>
54
+ <?php echo esc_html( $group_type['title'] ); ?>
55
+ </label>
56
+ <?php endforeach; ?>
57
+ <?php if ( ! empty( $this->get_ad_group_types_premium() ) ) : ?>
58
+ <label>
59
+ <?php Advanced_Ads_Admin_Upgrades::upgrade_link( __( 'Get all group types with All Access', 'advanced-ads' ), ADVADS_URL . 'add-ons/all-access/', 'upgrades-pro-groups' ); ?>
60
+ </label>
61
+ <?php endif; ?>
62
+ </div>
63
  <?php
64
+ $option_content = ob_get_clean();
65
+
66
+ Advanced_Ads_Admin_Options::render_option(
67
+ 'group-type static',
68
+ esc_attr__( 'Type', 'advanced-ads' ),
69
+ $option_content
70
+ );
71
+
72
+ // group number.
73
+ ob_start();
74
+ ?>
75
+ <select name="advads-groups[<?php echo (int) $group->id; ?>][ad_count]">
76
+ <?php
77
+ $max = ( count( $ad_form_rows ) >= 10 ) ? count( $ad_form_rows ) + 2 : 10;
78
+ for ( $i = 1; $i <= $max; $i++ ) :
79
+ ?>
80
+ <option <?php selected( $group->ad_count, $i ); ?>><?php echo esc_html( $i ); ?></option>
81
+ <?php
82
+ endfor;
83
+ ?>
84
+ <option <?php selected( $group->ad_count, 'all' ); ?> value="all"><?php echo esc_attr_x( 'all', 'option to display all ads in an ad groups', 'advanced-ads' ); ?></option>
85
  </select>
86
  <?php
87
  $option_content = ob_get_clean();
admin/views/ad-group-list-row.php CHANGED
@@ -35,17 +35,19 @@
35
  echo $this->render_action_links( $group );
36
 
37
  // edit form modal
38
- $modal_slug = 'group-edit-' . $group->id;
39
  ob_start();
40
  require ADVADS_BASE_PATH . 'admin/views/ad-group-list-form-row.php';
41
- $modal_content = ob_get_clean();
42
- $modal_title = esc_html__( 'Edit', 'advanced-ads' ) . ' ' . $group->name;
43
- $close_action = esc_html__( 'Save', 'advanced-ads' ) . ' ' . $group->name;
44
- $close_form = 'advads-form-groups';
45
- $close_validation = 'advads_group_edit_submit';
46
- require ADVADS_BASE_PATH . 'admin/views/modal.php';
 
 
 
 
47
 
48
- $modal_slug = esc_attr( $group->id . '-usage' );
49
  ob_start();
50
  // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- the output is already escaped
51
  echo $hints_html;
@@ -58,9 +60,11 @@
58
  </div>
59
  <?php
60
  $modal_content = ob_get_clean();
61
- $modal_title = esc_html__( 'Usage', 'advanced-ads' );
62
- $close_action = '';
63
- require ADVADS_BASE_PATH . 'admin/views/modal.php';
 
 
64
 
65
  if ( $missing_type_error ) :
66
  ?>
35
  echo $this->render_action_links( $group );
36
 
37
  // edit form modal
 
38
  ob_start();
39
  require ADVADS_BASE_PATH . 'admin/views/ad-group-list-form-row.php';
40
+ $modal_content = ob_get_clean();
41
+
42
+ new Advanced_Ads_Modal( array(
43
+ 'modal_slug' => 'group-edit-' . $group->id,
44
+ 'modal_content' => $modal_content,
45
+ 'modal_title' => __( 'Edit', 'advanced-ads' ) . ' ' . $group->name,
46
+ 'close_action' => __( 'Save', 'advanced-ads' ) . ' ' . $group->name,
47
+ 'close_form' => 'advads-form-groups',
48
+ 'close_validation' => 'advads_group_edit_submit',
49
+ ) );
50
 
 
51
  ob_start();
52
  // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- the output is already escaped
53
  echo $hints_html;
60
  </div>
61
  <?php
62
  $modal_content = ob_get_clean();
63
+ new Advanced_Ads_Modal( array(
64
+ 'modal_slug' => $group->id . '-usage',
65
+ 'modal_content' => $modal_content,
66
+ 'modal_title' => __( 'Usage', 'advanced-ads' ),
67
+ ) );
68
 
69
  if ( $missing_type_error ) :
70
  ?>
admin/views/ad-group.php CHANGED
@@ -48,10 +48,7 @@ if ( isset( $_REQUEST['advads-group-update-nonce'] ) ) {
48
  </div>
49
  <div class="wrap nosubsub">
50
  <h2 style="display: none;"><!-- There needs to be an empty H2 headline at the top of the page so that WordPress can properly position admin notifications --></h2>
51
- <?php
52
- $modal_slug = 'group-new';
53
- ob_start();
54
- ?>
55
  <p>
56
  <?php
57
  esc_attr_e( 'Ad Groups are a very flexible method to bundle ads. You can use them to display random ads in the frontend or run split tests, but also just for informational purposes. Not only can an Ad Groups have multiple ads, but an ad can belong to multiple ad groups.', 'advanced-ads' );
@@ -60,13 +57,15 @@ if ( isset( $_REQUEST['advads-group-update-nonce'] ) ) {
60
  </p>
61
  <?php
62
  require ADVADS_BASE_PATH . 'admin/views/group-form.php';
63
- $modal_content = ob_get_clean();
64
- $modal_title = esc_html__( 'New Ad Group', 'advanced-ads' );
65
- $close_action = esc_html__( 'Save New Group', 'advanced-ads' );
66
- $close_form = 'advads-group-new-form';
67
- $close_validation = 'advads_validate_new_form';
68
- $modal_path = ADVADS_BASE_PATH . 'admin/views/modal.php';
69
- include $modal_path;
 
 
70
  ?>
71
  <?php if ( isset( $message ) ) : ?>
72
  <div id="message" class="updated"><p><?php echo esc_html( $message ); ?></p></div>
48
  </div>
49
  <div class="wrap nosubsub">
50
  <h2 style="display: none;"><!-- There needs to be an empty H2 headline at the top of the page so that WordPress can properly position admin notifications --></h2>
51
+ <?php ob_start(); ?>
 
 
 
52
  <p>
53
  <?php
54
  esc_attr_e( 'Ad Groups are a very flexible method to bundle ads. You can use them to display random ads in the frontend or run split tests, but also just for informational purposes. Not only can an Ad Groups have multiple ads, but an ad can belong to multiple ad groups.', 'advanced-ads' );
57
  </p>
58
  <?php
59
  require ADVADS_BASE_PATH . 'admin/views/group-form.php';
60
+ $modal_slug = 'group-new';
61
+ new Advanced_Ads_Modal( array(
62
+ 'modal_slug' => $modal_slug,
63
+ 'modal_content' => ob_get_clean(),
64
+ 'modal_title' => __( 'New Ad Group', 'advanced-ads' ),
65
+ 'close_action' => __( 'Save New Group', 'advanced-ads' ),
66
+ 'close_form' => 'advads-group-new-form',
67
+ 'close_validation' => 'advads_validate_new_form',
68
+ ) );
69
  ?>
70
  <?php if ( isset( $message ) ) : ?>
71
  <div id="message" class="updated"><p><?php echo esc_html( $message ); ?></p></div>
admin/views/group-form.php CHANGED
@@ -22,9 +22,7 @@
22
  </div>
23
  <?php endforeach; ?>
24
  </div>
25
- <div class="clear"></div>
26
  <?php if ( $group_types_premium ) : ?>
27
- <h4><?php Advanced_Ads_Admin_Upgrades::upgrade_link( __( 'Pro Feature', 'advanced-ads' ), ADVADS_URL . 'manual/ad-groups/', 'upgrades-pro-groups' ); ?></h4>
28
  <div class="advads-form-types">
29
  <?php foreach ( $group_types_premium as $key => $group_type ) : ?>
30
  <div class="advads-form-type">
@@ -40,6 +38,11 @@
40
  <?php endforeach; ?>
41
  </div>
42
  <div class="clear"></div>
 
 
 
 
 
43
  <?php endif; ?>
44
  <div class="clear"></div>
45
  <p class="advads-notice-inline advads-error advads-form-type-error"><?php esc_html_e( 'Please select a type.', 'advanced-ads' ); ?></p>
22
  </div>
23
  <?php endforeach; ?>
24
  </div>
 
25
  <?php if ( $group_types_premium ) : ?>
 
26
  <div class="advads-form-types">
27
  <?php foreach ( $group_types_premium as $key => $group_type ) : ?>
28
  <div class="advads-form-type">
38
  <?php endforeach; ?>
39
  </div>
40
  <div class="clear"></div>
41
+ <?php if ( ! empty( $group_types_premium ) ) : ?>
42
+ <h4>
43
+ <?php Advanced_Ads_Admin_Upgrades::upgrade_link( __( 'Get all group types with All Access', 'advanced-ads' ), ADVADS_URL . 'add-ons/all-access/', 'upgrades-pro-groups' ); ?>
44
+ </h4>
45
+ <?php endif; ?>
46
  <?php endif; ?>
47
  <div class="clear"></div>
48
  <p class="advads-notice-inline advads-error advads-form-type-error"><?php esc_html_e( 'Please select a type.', 'advanced-ads' ); ?></p>
admin/views/modal.php CHANGED
@@ -9,12 +9,6 @@
9
  * @var string $close_form Add a form ID. This form will be submitted after clicking the close and action button.
10
  * @var string $close_validation A JavaScript validation function. The function has to return true or the form won't be submitted.
11
  */
12
- $modal_slug = isset( $modal_slug ) ? $modal_slug : '';
13
- $modal_content = isset( $modal_content ) ? $modal_content : '';
14
- $modal_title = isset( $modal_title ) ? $modal_title : '';
15
- $close_action = isset( $close_action ) ? $close_action : '';
16
- $close_form = isset( $close_form ) ? $close_form : '';
17
- $close_validation = isset( $close_validation ) ? $close_validation : '';
18
  ?>
19
  <?php if ( $close_action && $close_form ) : ?>
20
  <script>
@@ -25,16 +19,13 @@ $close_validation = isset( $close_validation ) ? $close_validation : '';
25
  } );
26
  </script>
27
  <?php endif; ?>
28
- <div id="modal-<?php echo esc_attr( $modal_slug ); ?>" class="advads-modal"
29
- data-modal-id="<?php echo esc_attr( $modal_slug ); ?>">
30
  <a href="#close" class="advads-modal-close-background">Close</a>
31
  <div class="advads-modal-content">
32
  <div class="advads-modal-header">
33
- <a href="#close" class="advads-modal-close">&times;</a>
34
  <h2>
35
- <?php
36
- echo esc_html( $modal_title );
37
- ?>
38
  </h2>
39
  </div>
40
  <div class="advads-modal-body">
@@ -45,18 +36,28 @@ $close_validation = isset( $close_validation ) ? $close_validation : '';
45
  </div>
46
  <div class="advads-modal-footer">
47
  <div class="tablenav bottom">
48
- <a href="#close" type="button" title="<?php esc_html_e( 'Close', 'advanced-ads' ); ?>"
49
- class="button button-secondary advads-modal-close"><?php esc_html_e( 'Close', 'advanced-ads' ); ?></a>
 
 
50
  <?php if ( $close_action ) : ?>
51
- <a href="#close" type="button" title="<?php esc_attr_e( 'Close and save', 'advanced-ads' ); ?>"
52
- class="button button-primary advads-modal-close-action">
53
- <?php
54
- // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- close action may contain custom html like button bar, image or span tag e.g.
55
- echo $close_action;
56
- ?>
57
- </a>
 
 
 
 
 
 
 
 
58
  <?php endif; ?>
59
  </div>
60
  </div>
61
  </div>
62
- </div>
9
  * @var string $close_form Add a form ID. This form will be submitted after clicking the close and action button.
10
  * @var string $close_validation A JavaScript validation function. The function has to return true or the form won't be submitted.
11
  */
 
 
 
 
 
 
12
  ?>
13
  <?php if ( $close_action && $close_form ) : ?>
14
  <script>
19
  } );
20
  </script>
21
  <?php endif; ?>
22
+ <dialog id="modal-<?php echo esc_attr( $modal_slug ); ?>" class="advads-modal" data-modal-id="<?php echo esc_attr( $modal_slug ); ?>" autofocus>
 
23
  <a href="#close" class="advads-modal-close-background">Close</a>
24
  <div class="advads-modal-content">
25
  <div class="advads-modal-header">
26
+ <a href="#close" class="advads-modal-close" title="<?php esc_html_e( 'Cancel', 'advanced-ads' ); ?>">&times;</a>
27
  <h2>
28
+ <?php echo esc_html( $modal_title ); ?>
 
 
29
  </h2>
30
  </div>
31
  <div class="advads-modal-body">
36
  </div>
37
  <div class="advads-modal-footer">
38
  <div class="tablenav bottom">
39
+ <a href="#close" class="button button-secondary advads-modal-close">
40
+ <?php esc_html_e( 'Cancel', 'advanced-ads' ); ?>
41
+ </a>
42
+
43
  <?php if ( $close_action ) : ?>
44
+ <?php if ( $close_form ) : ?>
45
+ <button type="submit" form="<?php echo esc_attr( $close_form ); ?>" class="button button-primary advads-modal-close-action">
46
+ <?php
47
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- close action may contain custom html like button bar, image or span tag e.g.
48
+ echo $close_action;
49
+ ?>
50
+ </button>
51
+ <?php else : ?>
52
+ <a href="#close" class="button button-primary advads-modal-close-action">
53
+ <?php
54
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- close action may contain custom html like button bar, image or span tag e.g.
55
+ echo $close_action;
56
+ ?>
57
+ </a>
58
+ <?php endif; ?>
59
  <?php endif; ?>
60
  </div>
61
  </div>
62
  </div>
63
+ </dialog>
admin/views/placement-form.php CHANGED
@@ -24,15 +24,15 @@
24
  ?>
25
  </p>
26
  <?php require_once 'placement-types.php'; ?>
27
- <div class="clear"></div>
28
  <?php
29
 
30
  // show Pro placements if Pro is not activated.
31
  if ( ! defined( 'AAP_VERSION' ) ) :
32
- include ADVADS_BASE_PATH . 'admin/views/upgrades/pro-placements.php';
 
33
  ?>
34
  <div class="clear"></div>
35
- <?php
36
  endif;
37
  ?>
38
  <p class="advads-notice-inline advads-error advads-form-type-error"><?php esc_html_e( 'Please select a type.', 'advanced-ads' ); ?></p>
24
  ?>
25
  </p>
26
  <?php require_once 'placement-types.php'; ?>
 
27
  <?php
28
 
29
  // show Pro placements if Pro is not activated.
30
  if ( ! defined( 'AAP_VERSION' ) ) :
31
+ include ADVADS_BASE_PATH . 'admin/views/upgrades/pro-placements.php';
32
+ else :
33
  ?>
34
  <div class="clear"></div>
35
+ <?php
36
  endif;
37
  ?>
38
  <p class="advads-notice-inline advads-error advads-form-type-error"><?php esc_html_e( 'Please select a type.', 'advanced-ads' ); ?></p>
admin/views/placements.php CHANGED
@@ -33,15 +33,15 @@ $quick_actions['delete'] = '<a style="cursor: pointer;" class="advads-delete-tag
33
  $modal_slug = 'placement-new';
34
  ob_start();
35
  include ADVADS_BASE_PATH . 'admin/views/placement-form.php';
36
- $modal_content = ob_get_clean();
37
- $modal_title = esc_html__( 'New Placement', 'advanced-ads' );
38
- $close_action = esc_html__( 'Save New Placement', 'advanced-ads' );
39
- $close_form = 'advads-placements-new-form';
40
- $close_validation = 'advads_validate_new_form';
41
- $modal_path = ADVADS_BASE_PATH . 'admin/views/modal.php';
42
- if ( file_exists( $modal_path ) ) {
43
- include $modal_path;
44
- }
45
 
46
  if ( isset( $placements ) && is_array( $placements ) && count( $placements ) ) :
47
  $existing_types = array_unique( array_column( $placements, 'type' ) );
@@ -178,24 +178,6 @@ $quick_actions['delete'] = '<a style="cursor: pointer;" class="advads-delete-tag
178
 
179
  // Show Pro features if Pro is not actiavated.
180
  if ( ! defined( 'AAP_VERSION' ) ) {
181
- // Display Conditions for placements.
182
- Advanced_Ads_Admin_Options::render_option(
183
- 'placement-display-conditions',
184
- __( 'Display Conditions', 'advanced-ads' ),
185
- 'is_pro_pitch',
186
- __( 'Use display conditions for placements.', 'advanced-ads' ) .
187
- ' ' . __( 'The free version provides conditions on the ad edit page.', 'advanced-ads' )
188
- );
189
-
190
- // Visitor Condition for placements.
191
- Advanced_Ads_Admin_Options::render_option(
192
- 'placement-visitor-conditions',
193
- __( 'Visitor Conditions', 'advanced-ads' ),
194
- 'is_pro_pitch',
195
- __( 'Use visitor conditions for placements.', 'advanced-ads' ) .
196
- ' ' . __( 'The free version provides conditions on the ad edit page.', 'advanced-ads' )
197
- );
198
-
199
  // Minimum Content Length.
200
  Advanced_Ads_Admin_Options::render_option(
201
  'placement-content-minimum-length',
@@ -213,6 +195,28 @@ $quick_actions['delete'] = '<a style="cursor: pointer;" class="advads-delete-tag
213
  );
214
  }
215
  endif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
  do_action( 'advanced-ads-placement-options-after-advanced', $_placement_slug, $_placement );
217
  $advanced_options = ob_get_clean();
218
  ?>
@@ -222,17 +226,18 @@ $quick_actions['delete'] = '<a style="cursor: pointer;" class="advads-delete-tag
222
  <?php self::render_order_data( $placement_types, $_placement ); ?>>
223
 
224
  <td class="column-primary">
225
- <?php if ( $advanced_options ) : ?>
226
- <?php
227
- $modal_slug = esc_attr( $_placement_slug );
228
- $modal_content = $advanced_options;
229
- // Translators: 1: "Options", 2: the name of a placement.
230
- $modal_title = sprintf( '%1$s: %2$s', __( 'Options', 'advanced-ads' ), esc_html( $_placement['name'] ) );
231
- $close_action = esc_html__( 'Close and save', 'advanced-ads' );
232
- include ADVADS_BASE_PATH . 'admin/views/modal.php';
233
- ?>
234
-
235
- <?php endif; ?>
 
236
  <?php if ( $type_missing ) : // Type is not given. ?>
237
  <p class="advads-notice-inline advads-error">
238
  <?php
33
  $modal_slug = 'placement-new';
34
  ob_start();
35
  include ADVADS_BASE_PATH . 'admin/views/placement-form.php';
36
+
37
+ new Advanced_Ads_Modal( array(
38
+ 'modal_slug' => $modal_slug,
39
+ 'modal_content' => ob_get_clean(),
40
+ 'modal_title' => __( 'New Placement', 'advanced-ads' ),
41
+ 'close_action' => __( 'Save New Placement', 'advanced-ads' ),
42
+ 'close_form' => 'advads-placements-new-form',
43
+ 'close_validation' => 'advads_validate_new_form',
44
+ ) );
45
 
46
  if ( isset( $placements ) && is_array( $placements ) && count( $placements ) ) :
47
  $existing_types = array_unique( array_column( $placements, 'type' ) );
178
 
179
  // Show Pro features if Pro is not actiavated.
180
  if ( ! defined( 'AAP_VERSION' ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
  // Minimum Content Length.
182
  Advanced_Ads_Admin_Options::render_option(
183
  'placement-content-minimum-length',
195
  );
196
  }
197
  endif;
198
+
199
+ // show the conditions pitch on the `head` placement as well.
200
+ if ( ! defined( 'AAP_VERSION' ) ) {
201
+ // Display Conditions for placements.
202
+ Advanced_Ads_Admin_Options::render_option(
203
+ 'placement-display-conditions',
204
+ __( 'Display Conditions', 'advanced-ads' ),
205
+ 'is_pro_pitch',
206
+ __( 'Use display conditions for placements.', 'advanced-ads' ) .
207
+ ' ' . __( 'The free version provides conditions on the ad edit page.', 'advanced-ads' )
208
+ );
209
+
210
+ // Visitor Condition for placements.
211
+ Advanced_Ads_Admin_Options::render_option(
212
+ 'placement-visitor-conditions',
213
+ __( 'Visitor Conditions', 'advanced-ads' ),
214
+ 'is_pro_pitch',
215
+ __( 'Use visitor conditions for placements.', 'advanced-ads' ) .
216
+ ' ' . __( 'The free version provides conditions on the ad edit page.', 'advanced-ads' )
217
+ );
218
+ }
219
+
220
  do_action( 'advanced-ads-placement-options-after-advanced', $_placement_slug, $_placement );
221
  $advanced_options = ob_get_clean();
222
  ?>
226
  <?php self::render_order_data( $placement_types, $_placement ); ?>>
227
 
228
  <td class="column-primary">
229
+ <?php
230
+ if ( $advanced_options ) {
231
+ new Advanced_Ads_Modal( array(
232
+ 'modal_slug' => $_placement_slug,
233
+ 'modal_content' => $advanced_options,
234
+ /* translators: 1: "Options", 2: the name of a placement. */
235
+ 'modal_title' => sprintf( '%1$s: %2$s', __( 'Options', 'advanced-ads' ), $_placement['name'] ),
236
+ 'close_form' => 'advanced-ads-placements-form',
237
+ 'close_action' => __( 'Close and save', 'advanced-ads' ),
238
+ ) );
239
+ }
240
+ ?>
241
  <?php if ( $type_missing ) : // Type is not given. ?>
242
  <p class="advads-notice-inline advads-error">
243
  <?php
admin/views/upgrades/pro-placements.php CHANGED
@@ -60,25 +60,29 @@ if ( class_exists( 'bbPress', false ) ) {
60
  ];
61
  }
62
 
63
- ?><h4><?php Advanced_Ads_Admin_Upgrades::pro_feature_link( 'upgrades-pro-placements' ); ?></h4>
64
- <?php
65
- if ( is_array( $pro_placements ) ) :
66
- foreach ( $pro_placements as $_key => $_place ) :
67
- if ( isset( $_place['image'] ) ) :
68
- $image = '<img src="' . $_place['image'] . '" alt="' . $_place['title'] . '"/>';
69
- else :
70
- $image = '<strong>' . $_place['title'] . '</strong><br/><p class="description">' . $_place['description'] . '</p>';
71
- endif;
72
- ?>
73
- <div class="advads-form-type"><label class="advads-button advads-pro-link"><span class="advads-button-text">
74
- <?php
75
- // phpcs:ignore
76
- echo $image;
77
- ?>
78
- </span></label>
 
79
  <p class="advads-form-description">
80
- <strong><?php echo esc_html( $_place['title'] ); ?></strong><br/><?php echo esc_html( $_place['description'] ); ?></p>
 
 
81
  </div>
82
- <?php
83
- endforeach;
84
- endif;
 
60
  ];
61
  }
62
 
63
+ ?>
64
+ <?php
65
+ if ( is_array( $pro_placements ) ) :
66
+ foreach ( $pro_placements as $key => $placement ) :
67
+ ?>
68
+ <div class="advads-form-type">
69
+ <label class="advads-button advads-pro-link">
70
+ <span class="advads-button-text">
71
+ <?php
72
+ if ( isset( $placement['image'] ) ) {
73
+ echo '<img src="' . esc_attr( $placement['image'] ) . '" alt="' . esc_attr( $placement['title'] ) . '"/>';
74
+ } else {
75
+ echo '<strong>' . esc_html( $placement['title'] ) . '</strong><br/><p class="description">' . esc_html( $placement['description'] ) . '</p>';
76
+ }
77
+ ?>
78
+ </span>
79
+ </label>
80
  <p class="advads-form-description">
81
+ <strong><?php echo esc_html( $placement['title'] ); ?></strong>
82
+ <br/><?php echo esc_html( $placement['description'] ); ?>
83
+ </p>
84
  </div>
85
+ <?php endforeach; ?>
86
+ <div class="clear"></div>
87
+ <h4><?php Advanced_Ads_Admin_Upgrades::upgrade_link( __( 'Get all placements with All Access', 'advanced-ads' ), ADVADS_URL . 'add-ons/all-access/', 'upgrades-pro-placements' ); ?></h4>
88
+ <?php endif; ?>
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.38.0
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.38.0' );
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.39.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.39.0' );
43
 
44
  // Autoloading, modules and functions.
45
 
changelog.txt CHANGED
@@ -1,5 +1,14 @@
1
  == Changelog ==
2
 
 
 
 
 
 
 
 
 
 
3
  = 1.38.0 (November 22, 2022) =
4
 
5
  - Improvement: add support for multibyte cookies in "advads.get/set_cookie" functions
1
  == Changelog ==
2
 
3
+ = 1.39.0 (December 14, 2022) =
4
+
5
+ - Improvement: add PeepSo ad type image
6
+ - Improvement: add fallback ad type image for unknown ad types
7
+ - Fix: remove unused jQuery UI assets
8
+ - Fix: prevent uncaught `TypeError` on Placements search
9
+ - Fix: add the site URL to the export filename
10
+ - Fix: prevent duplicate queries due to circular functions calls in capability checks
11
+
12
  = 1.38.0 (November 22, 2022) =
13
 
14
  - Improvement: add support for multibyte cookies in "advads.get/set_cookie" functions
classes/Advanced_Ads_Modal.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Basic Modal class to separate concerns.
5
+ */
6
+ class Advanced_Ads_Modal {
7
+ /**
8
+ * Default values for the view file.
9
+ *
10
+ * @var array
11
+ */
12
+ private $view_arguments = array(
13
+ 'modal_slug' => '',
14
+ 'modal_content' => '',
15
+ 'modal_title' => '',
16
+ 'close_action' => '',
17
+ 'close_form' => '',
18
+ 'close_validation' => '',
19
+ );
20
+
21
+ /**
22
+ * Modal constructor.
23
+ *
24
+ * @param array $arguments The passed view arguments, overwriting the default values.
25
+ * @param bool $render Whether to render the modal from the constructor. Defaults to true.
26
+ */
27
+ public function __construct( array $arguments, $render = true ) {
28
+ $this->view_arguments = array_intersect_key( wp_parse_args( array_map( 'strval', $arguments ), $this->view_arguments ), $this->view_arguments );
29
+
30
+ if ( $render ) {
31
+ $this->render();
32
+ }
33
+ }
34
+
35
+ /**
36
+ * Render the modal.
37
+ *
38
+ * @return void
39
+ */
40
+ public function render() {
41
+ // phpcs:ignore WordPress.PHP.DontExtract.extract_extract -- we have ensured, the array only contains the variables defined by the defaults. Variables are documented and escaped in the view file.
42
+ extract( $this->view_arguments, EXTR_OVERWRITE );
43
+
44
+ require ADVADS_BASE_PATH . 'admin/views/modal.php';
45
+ }
46
+ }
classes/ad-model.php CHANGED
@@ -86,14 +86,14 @@ class Advanced_Ads_Model {
86
  * @return array $ads array with post objects.
87
  */
88
  public function get_ads( $args = [] ) {
 
 
 
 
89
  // add default WP_Query arguments.
90
- $args['post_type'] = Advanced_Ads::POST_TYPE_SLUG;
91
- $args['posts_per_page'] = -1;
92
- if ( empty( $args['post_status'] ) ) {
93
- $args['post_status'] = [ 'publish', 'future' ]; }
94
- $ads = new WP_Query( $args );
95
 
96
- return $ads->posts;
97
  }
98
 
99
  /**
86
  * @return array $ads array with post objects.
87
  */
88
  public function get_ads( $args = [] ) {
89
+ $args = wp_parse_args( $args, [
90
+ 'posts_per_page' => -1,
91
+ 'post_status' => [ 'publish', 'future' ],
92
+ ] );
93
  // add default WP_Query arguments.
94
+ $args['post_type'] = Advanced_Ads::POST_TYPE_SLUG;
 
 
 
 
95
 
96
+ return ( new WP_Query( $args ) )->posts;
97
  }
98
 
99
  /**
classes/ad.php CHANGED
@@ -83,7 +83,7 @@ class Advanced_Ads_Ad {
83
  /**
84
  * Object of current ad type
85
  *
86
- * @var object $type_obj object of the current ad type.
87
  */
88
  protected $type_obj;
89
 
83
  /**
84
  * Object of current ad type
85
  *
86
+ * @var Advanced_Ads_Ad_Type_Abstract $type_obj object of the current ad type.
87
  */
88
  protected $type_obj;
89
 
classes/ad_placements.php CHANGED
@@ -37,7 +37,7 @@ class Advanced_Ads_Placements {
37
  /**
38
  * Get placement types
39
  *
40
- * @return array $types array with placement types
41
  * @since 1.2.1
42
  */
43
  public static function get_placement_types() {
@@ -115,7 +115,13 @@ class Advanced_Ads_Placements {
115
  ],
116
  ];
117
 
118
- return apply_filters( 'advanced-ads-placement-types', $types );
 
 
 
 
 
 
119
  }
120
 
121
  /**
37
  /**
38
  * Get placement types
39
  *
40
+ * @return \Advanced_Ads\Placement_Type[] $types array with placement types
41
  * @since 1.2.1
42
  */
43
  public static function get_placement_types() {
115
  ],
116
  ];
117
 
118
+ $types = (array) apply_filters( 'advanced-ads-placement-types', $types );
119
+
120
+ foreach ( $types as $type => $definition ) {
121
+ $types[ $type ] = new \Advanced_Ads\Placement_Type( $type, $definition );
122
+ }
123
+
124
+ return $types;
125
  }
126
 
127
  /**
classes/ad_type_abstract.php CHANGED
@@ -64,12 +64,18 @@ class Advanced_Ads_Ad_Type_Abstract {
64
  }
65
 
66
  /**
67
- * Render icon on the ad overview list
68
  *
69
  * @param Advanced_Ads_Ad $ad ad object.
 
 
70
  */
71
  public function render_icon( Advanced_Ads_Ad $ad ) {
72
- printf( '<img src="%sadmin/assets/img/ad-types/%s.svg" width="50" height="50"/>', esc_url( ADVADS_BASE_URL ), esc_attr( $ad->type ) );
 
 
 
 
73
  }
74
 
75
  /**
@@ -122,20 +128,22 @@ class Advanced_Ads_Ad_Type_Abstract {
122
  /**
123
  * Prepare the ads frontend output
124
  *
125
- * @param obj $ad ad object
126
- * @return str $content ad content prepared for frontend output
 
127
  * @since 1.0.0
128
  */
129
- public function prepare_output($ad){
130
  return $ad->content;
131
  }
132
 
133
  /**
134
  * Process shortcodes.
135
  *
136
- * @param str $output Ad content.
137
- * @return obj Advanced_Ads_Ad
138
- * @return bool force_aa Whether to force Advanced ads shortcodes processing.
 
139
  */
140
  protected function do_shortcode( $output, Advanced_Ads_Ad $ad ) {
141
  $ad_options = $ad->options();
@@ -147,8 +155,6 @@ class Advanced_Ads_Ad_Type_Abstract {
147
  $output = preg_replace( '/\[(the_ad_group|the_ad_placement|the_ad)/', '[$1 ad_args="' . urlencode( json_encode( $ad_args ) ) . '"', $output );
148
  }
149
 
150
- $output = do_shortcode( $output );
151
- return $output;
152
  }
153
-
154
  }
64
  }
65
 
66
  /**
67
+ * Render icon on the ad overview list.
68
  *
69
  * @param Advanced_Ads_Ad $ad ad object.
70
+ *
71
+ * @return void
72
  */
73
  public function render_icon( Advanced_Ads_Ad $ad ) {
74
+ $icon_path = sprintf( 'admin/assets/img/ad-types/%s.svg', esc_attr( $ad->type ) );
75
+ if ( ! file_exists( ADVADS_BASE_PATH . $icon_path ) ) {
76
+ $icon_path = 'admin/assets/img/ad-types/empty.svg';
77
+ }
78
+ printf( '<img src="%s" width="50" height="50"/>', esc_url( ADVADS_BASE_URL . $icon_path ) );
79
  }
80
 
81
  /**
128
  /**
129
  * Prepare the ads frontend output
130
  *
131
+ * @param Advanced_Ads_Ad $ad The current ad object.
132
+ *
133
+ * @return string $content ad content prepared for frontend output
134
  * @since 1.0.0
135
  */
136
+ public function prepare_output( $ad ) {
137
  return $ad->content;
138
  }
139
 
140
  /**
141
  * Process shortcodes.
142
  *
143
+ * @param string $output Ad content.
144
+ * @param Advanced_Ads_Ad $ad The current ad object.
145
+ *
146
+ * @return string
147
  */
148
  protected function do_shortcode( $output, Advanced_Ads_Ad $ad ) {
149
  $ad_options = $ad->options();
155
  $output = preg_replace( '/\[(the_ad_group|the_ad_placement|the_ad)/', '[$1 ad_args="' . urlencode( json_encode( $ad_args ) ) . '"', $output );
156
  }
157
 
158
+ return do_shortcode( $output );
 
159
  }
 
160
  }
languages/advanced-ads.pot CHANGED
@@ -2,16 +2,16 @@
2
  # This file is distributed under the GPL-2.0+.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Advanced Ads 1.37.2\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: 2022-11-22T08:44:07+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
- "X-Generator: WP-CLI 2.7.1\n"
15
  "X-Domain: advanced-ads\n"
16
 
17
  #. Plugin Name of the plugin
@@ -32,7 +32,7 @@ msgstr ""
32
  msgid "Thomas Maier, Advanced Ads GmbH"
33
  msgstr ""
34
 
35
- #: admin/class-advanced-ads-admin.php:224
36
  #: classes/display-conditions.php:317
37
  #: classes/visitor-conditions.php:310
38
  #: modules/gadsense/admin/views/external-ads-links.php:17
@@ -41,92 +41,94 @@ msgstr ""
41
  msgid "or"
42
  msgstr ""
43
 
44
- #: admin/class-advanced-ads-admin.php:225
45
  #: classes/display-conditions.php:317
46
  #: classes/visitor-conditions.php:310
47
  msgid "and"
48
  msgstr ""
49
 
50
- #: admin/class-advanced-ads-admin.php:226
51
  msgid "After which paragraph?"
52
  msgstr ""
53
 
54
- #: admin/class-advanced-ads-admin.php:228
55
  #: modules/gadsense/includes/class-adsense-report.php:159
56
  msgid "Today"
57
  msgstr ""
58
 
59
- #: admin/class-advanced-ads-admin.php:229
60
  #: modules/gadsense/includes/class-adsense-report.php:160
61
  msgid "Yesterday"
62
  msgstr ""
63
 
64
- #: admin/class-advanced-ads-admin.php:230
65
  #: modules/gadsense/includes/class-adsense-report.php:163
66
  msgid "This Month"
67
  msgstr ""
68
 
69
  #. translators: 1: The number of days.
70
- #: admin/class-advanced-ads-admin.php:232
71
  #: modules/gadsense/includes/class-adsense-report.php:162
72
  #: modules/gadsense/includes/class-adsense-report.php:165
73
  msgid "Last %1$d days"
74
  msgstr ""
75
 
76
- #: admin/class-advanced-ads-admin.php:235
77
  #: modules/gadsense/admin/views/adsense-report.php:24
78
  msgid "All"
79
  msgstr ""
80
 
81
- #: admin/class-advanced-ads-admin.php:236
82
  msgid "There were no results returned for this ad. Please make sure it is active, generating impressions and double check your ad parameters."
83
  msgstr ""
84
 
85
- #: admin/class-advanced-ads-admin.php:237
86
  msgid "Show inactive ads"
87
  msgstr ""
88
 
89
- #: admin/class-advanced-ads-admin.php:238
90
  msgid "Hide inactive ads"
91
  msgstr ""
92
 
93
- #: admin/class-advanced-ads-admin.php:240
94
  msgid "Permanently delete this placement?"
95
  msgstr ""
96
 
97
- #: admin/class-advanced-ads-admin.php:241
98
- #: admin/views/modal.php:48
99
- #: admin/views/modal.php:49
100
- #: admin/views/placements.php:319
101
- #: admin/views/placements.php:320
102
  msgid "Close"
103
  msgstr ""
104
 
105
- #: admin/class-advanced-ads-admin.php:420
 
 
 
 
106
  #: admin/includes/class-menu.php:166
107
  #: admin/includes/class-menu.php:169
108
  #: admin/views/settings.php:29
109
  msgid "Support"
110
  msgstr ""
111
 
112
- #: admin/class-advanced-ads-admin.php:425
113
  #: admin/includes/class-overview-widgets.php:72
114
  msgid "Add-Ons"
115
  msgstr ""
116
 
117
- #: admin/class-advanced-ads-admin.php:427
118
  msgid "See Pro Features"
119
  msgstr ""
120
 
121
  #. translators: %s is the URL to add a new review, https://wordpress.org/support/plugin/advanced-ads/reviews/#new-post
122
  #. translators: %s is a URL.
123
- #: admin/class-advanced-ads-admin.php:701
124
  #: admin/includes/class-overview-widgets.php:191
125
  msgid "Thank the developer with a &#9733;&#9733;&#9733;&#9733;&#9733; review on <a href=\"%s\" target=\"_blank\">wordpress.org</a>"
126
  msgstr ""
127
 
128
- #: admin/class-advanced-ads-admin.php:796
129
- #: admin/class-advanced-ads-admin.php:802
130
  #: admin/includes/class-menu.php:123
131
  #: admin/views/ad-group-list-ads.php:36
132
  #: public/class-advanced-ads.php:798
@@ -134,31 +136,31 @@ msgstr ""
134
  msgid "New Ad"
135
  msgstr ""
136
 
137
- #: admin/class-advanced-ads-admin.php:801
138
  msgid "Your Ads"
139
  msgstr ""
140
 
141
- #: admin/class-advanced-ads-admin.php:811
142
  msgid "Your Groups"
143
  msgstr ""
144
 
145
- #: admin/class-advanced-ads-admin.php:812
146
  #: admin/views/ad-group.php:64
147
  #: public/class-advanced-ads.php:762
148
  msgid "New Ad Group"
149
  msgstr ""
150
 
151
- #: admin/class-advanced-ads-admin.php:820
152
  msgid "Your Placements"
153
  msgstr ""
154
 
155
- #: admin/class-advanced-ads-admin.php:821
156
- #: admin/views/placements.php:37
157
- #: admin/views/placements.php:464
158
  msgid "New Placement"
159
  msgstr ""
160
 
161
- #: admin/class-advanced-ads-admin.php:827
162
  #: admin/includes/class-menu.php:150
163
  msgid "Advanced Ads Settings"
164
  msgstr ""
@@ -180,7 +182,7 @@ msgstr ""
180
  #. translators: %s is a list of PHP extensions.
181
  #. Translators: %s is a name of a module.
182
  #: admin/includes/ad-health-notices.php:54
183
- #: admin/views/placements.php:387
184
  msgid "Missing PHP extensions could cause issues. Please ask your hosting provider to enable them: %s"
185
  msgstr ""
186
 
@@ -352,25 +354,33 @@ msgid_plural "Up to %d ads displayed"
352
  msgstr[0] ""
353
  msgstr[1] ""
354
 
355
- #: admin/includes/class-ad-groups-list.php:338
 
 
 
 
 
 
 
 
356
  msgid "Random ads"
357
  msgstr ""
358
 
359
- #: admin/includes/class-ad-groups-list.php:339
360
  msgid "Display random ads based on ad weight"
361
  msgstr ""
362
 
363
- #: admin/includes/class-ad-groups-list.php:343
364
  msgid "Ordered ads"
365
  msgstr ""
366
 
367
- #: admin/includes/class-ad-groups-list.php:344
368
  msgid "Display ads with the highest ad weight first"
369
  msgstr ""
370
 
371
- #: admin/includes/class-ad-groups-list.php:379
372
- #: admin/views/ad-group-list-row.php:42
373
- #: admin/views/placements.php:273
374
  #: modules/import-export/classes/import.php:153
375
  #: modules/import-export/classes/import.php:193
376
  #: modules/import-export/classes/import.php:595
@@ -378,32 +388,32 @@ msgstr ""
378
  msgid "Edit"
379
  msgstr ""
380
 
381
- #: admin/includes/class-ad-groups-list.php:380
382
  #: admin/views/placements.php:131
383
  msgid "show usage"
384
  msgstr ""
385
 
386
- #: admin/includes/class-ad-groups-list.php:389
387
  #: admin/views/placements.php:10
388
  msgid "Delete"
389
  msgstr ""
390
 
391
- #: admin/includes/class-ad-groups-list.php:411
392
- #: admin/includes/class-ad-groups-list.php:490
393
  msgid "Invalid Ad Group"
394
  msgstr ""
395
 
396
- #: admin/includes/class-ad-groups-list.php:416
397
- #: admin/includes/class-ad-groups-list.php:495
398
  msgid "You don’t have permission to change the ad groups"
399
  msgstr ""
400
 
401
- #: admin/includes/class-ad-groups-list.php:459
402
  msgid "No ad group created"
403
  msgstr ""
404
 
405
  #: admin/includes/class-ad-type.php:133
406
- #: admin/views/ad-group-list-form-row.php:58
407
  #: admin/views/ad-group-list-header.php:13
408
  #: admin/views/placements.php:56
409
  #: modules/gadsense/admin/views/adsense-ad-parameters.php:105
@@ -536,7 +546,6 @@ msgid "Upgrade"
536
  msgstr ""
537
 
538
  #: admin/includes/class-admin-upgrades.php:83
539
- #: admin/views/group-form.php:27
540
  msgid "Pro Feature"
541
  msgstr ""
542
 
@@ -654,7 +663,7 @@ msgstr ""
654
  #: admin/includes/class-menu.php:90
655
  #: admin/includes/class-menu.php:91
656
  #: admin/includes/class-shortcode-creator.php:212
657
- #: admin/views/ad-group-list-form-row.php:93
658
  #: admin/views/ad-group-list-header.php:16
659
  #: admin/views/placement-form.php:61
660
  #: admin/views/placements-item.php:26
@@ -709,14 +718,6 @@ msgstr ""
709
  msgid "You attempted to edit an ad group that doesn&#8217;t exist. Perhaps it was deleted?"
710
  msgstr ""
711
 
712
- #: admin/includes/class-menu.php:373
713
- msgid "Grid"
714
- msgstr ""
715
-
716
- #: admin/includes/class-menu.php:381
717
- msgid "Ad Slider"
718
- msgstr ""
719
-
720
  #: admin/includes/class-meta-box.php:61
721
  msgid "Ad Type"
722
  msgstr ""
@@ -727,8 +728,8 @@ msgid "AdSense Earnings"
727
  msgstr ""
728
 
729
  #: admin/includes/class-meta-box.php:89
730
- #: admin/views/ad-group-list-row.php:61
731
- #: admin/views/placements.php:305
732
  msgid "Usage"
733
  msgstr ""
734
 
@@ -742,15 +743,15 @@ msgid "Layout / Output"
742
  msgstr ""
743
 
744
  #: admin/includes/class-meta-box.php:114
745
- #: admin/views/placements.php:184
746
- #: admin/views/placements.php:428
747
  #: classes/ad-debug.php:152
748
  msgid "Display Conditions"
749
  msgstr ""
750
 
751
  #: admin/includes/class-meta-box.php:122
752
- #: admin/views/placements.php:193
753
- #: admin/views/placements.php:436
754
  #: classes/ad-debug.php:239
755
  msgid "Visitor Conditions"
756
  msgstr ""
@@ -767,7 +768,7 @@ msgstr ""
767
  #: admin/includes/class-meta-box.php:231
768
  #: admin/includes/class-meta-box.php:236
769
  #: admin/includes/class-overview-widgets.php:179
770
- #: admin/views/ad-group.php:59
771
  #: admin/views/ad-main-metabox.php:29
772
  #: admin/views/ad-output-metabox.php:43
773
  #: admin/views/conditions/condition-device.php:22
@@ -1005,6 +1006,10 @@ msgstr ""
1005
  msgid "Visit your ad statistics"
1006
  msgstr ""
1007
 
 
 
 
 
1008
  #: admin/includes/class-overview-widgets.php:662
1009
  msgid "Use Genesis specific ad positions."
1010
  msgstr ""
@@ -1282,7 +1287,7 @@ msgid "Update"
1282
  msgstr ""
1283
 
1284
  #: admin/views/ad-group-list-ads.php:20
1285
- #: admin/views/placements.php:346
1286
  #: classes/ad-debug.php:118
1287
  #: classes/ad-debug.php:167
1288
  #: classes/ad-debug.php:169
@@ -1299,16 +1304,21 @@ msgstr ""
1299
  msgid "add"
1300
  msgstr ""
1301
 
1302
- #: admin/views/ad-group-list-form-row.php:74
 
 
 
 
 
1303
  msgctxt "option to display all ads in an ad groups"
1304
  msgid "all"
1305
  msgstr ""
1306
 
1307
- #: admin/views/ad-group-list-form-row.php:81
1308
  msgid "Visible ads"
1309
  msgstr ""
1310
 
1311
- #: admin/views/ad-group-list-form-row.php:83
1312
  msgid "Number of ads that are visible at the same time"
1313
  msgstr ""
1314
 
@@ -1316,27 +1326,27 @@ msgstr ""
1316
  msgid "Details"
1317
  msgstr ""
1318
 
1319
- #: admin/views/ad-group-list-row.php:43
1320
  msgid "Save"
1321
  msgstr ""
1322
 
1323
- #: admin/views/ad-group-list-row.php:54
1324
- #: admin/views/placements.php:309
1325
  msgid "shortcode"
1326
  msgstr ""
1327
 
1328
- #: admin/views/ad-group-list-row.php:56
1329
- #: admin/views/placements.php:312
1330
  msgid "template (PHP)"
1331
  msgstr ""
1332
 
1333
  #. translators: %s is the name of a group type
1334
- #: admin/views/ad-group-list-row.php:79
1335
  msgid "Type: %s"
1336
  msgstr ""
1337
 
1338
  #. translators: %s is the ID of an ad group
1339
- #: admin/views/ad-group-list-row.php:87
1340
  msgid "ID: %s"
1341
  msgstr ""
1342
 
@@ -1348,7 +1358,7 @@ msgstr ""
1348
  msgid "Ad Groups successfully updated"
1349
  msgstr ""
1350
 
1351
- #: admin/views/ad-group.php:57
1352
  msgid "Ad Groups are a very flexible method to bundle ads. You can use them to display random ads in the frontend or run split tests, but also just for informational purposes. Not only can an Ad Groups have multiple ads, but an ad can belong to multiple ad groups."
1353
  msgstr ""
1354
 
@@ -1356,7 +1366,7 @@ msgstr ""
1356
  msgid "Save New Group"
1357
  msgstr ""
1358
 
1359
- #: admin/views/ad-group.php:104
1360
  #: public/class-advanced-ads.php:765
1361
  msgid "No Ad Group found"
1362
  msgstr ""
@@ -1743,20 +1753,20 @@ msgstr ""
1743
  msgid "Choose the type"
1744
  msgstr ""
1745
 
1746
- #: admin/views/group-form.php:45
1747
  #: admin/views/placement-form.php:38
1748
  msgid "Please select a type."
1749
  msgstr ""
1750
 
1751
- #: admin/views/group-form.php:47
1752
  msgid "Choose a name"
1753
  msgstr ""
1754
 
1755
- #: admin/views/group-form.php:48
1756
  msgid "Group title"
1757
  msgstr ""
1758
 
1759
- #: admin/views/group-form.php:49
1760
  #: admin/views/placement-form.php:49
1761
  msgid "Please enter a name."
1762
  msgstr ""
@@ -1773,10 +1783,9 @@ msgstr ""
1773
  msgid "See all Add-ons"
1774
  msgstr ""
1775
 
1776
- #. Translators: 1: "Options", 2: the name of a placement.
1777
- #: admin/views/modal.php:51
1778
- #: admin/views/placements.php:231
1779
- msgid "Close and save"
1780
  msgstr ""
1781
 
1782
  #: admin/views/notices/adblock.php:4
@@ -1989,7 +1998,7 @@ msgstr ""
1989
  #: admin/views/placements-ad-label-position.php:12
1990
  #: admin/views/placements-ad-label.php:9
1991
  #: admin/views/placements-ad-label.php:11
1992
- #: admin/views/placements.php:268
1993
  #: modules/gadsense/includes/class-network-adsense.php:321
1994
  msgid "default"
1995
  msgstr ""
@@ -2061,7 +2070,7 @@ msgstr ""
2061
  msgid "Placements are physically places in your theme and posts. You can use them if you plan to change ads and ad groups on the same place without the need to change your templates."
2062
  msgstr ""
2063
 
2064
- #: admin/views/placements.php:38
2065
  msgid "Save New Placement"
2066
  msgstr ""
2067
 
@@ -2093,89 +2102,93 @@ msgstr ""
2093
  msgid "Inline CSS"
2094
  msgstr ""
2095
 
2096
- #: admin/views/placements.php:186
2097
- msgid "Use display conditions for placements."
2098
  msgstr ""
2099
 
2100
- #: admin/views/placements.php:187
2101
- #: admin/views/placements.php:196
2102
- msgid "The free version provides conditions on the ad edit page."
2103
  msgstr ""
2104
 
2105
- #: admin/views/placements.php:195
2106
- msgid "Use visitor conditions for placements."
2107
  msgstr ""
2108
 
2109
- #: admin/views/placements.php:202
2110
- msgid "Minimum Content Length"
2111
  msgstr ""
2112
 
2113
- #: admin/views/placements.php:204
2114
- msgid "Minimum length of content before automatically injected ads are allowed in them."
2115
  msgstr ""
2116
 
2117
- #: admin/views/placements.php:210
2118
- msgid "Words Between Ads"
 
2119
  msgstr ""
2120
 
2121
- #: admin/views/placements.php:212
2122
- msgid "A minimum amount of words between automatically injected ads."
2123
  msgstr ""
2124
 
2125
- #. Translators: 1: "Options", 2: the name of a placement.
2126
- #: admin/views/placements.php:230
2127
  #: modules/import-export/views/page.php:26
2128
  msgid "Options"
2129
  msgstr ""
2130
 
 
 
 
 
2131
  #. Translators: %s is the name of a placement.
2132
- #: admin/views/placements.php:242
2133
  msgid "Placement type \"%s\" is missing and was reset to \"default\".<br/>Please check if the responsible add-on is activated."
2134
  msgstr ""
2135
 
2136
- #: admin/views/placements.php:347
2137
  msgid "Group"
2138
  msgstr ""
2139
 
2140
- #: admin/views/placements.php:363
2141
  msgid "after"
2142
  msgstr ""
2143
 
2144
- #: admin/views/placements.php:364
2145
  msgid "before"
2146
  msgstr ""
2147
 
2148
- #: admin/views/placements.php:377
2149
  msgid "position"
2150
  msgstr ""
2151
 
2152
- #: admin/views/placements.php:383
2153
  msgid "Important Notice"
2154
  msgstr ""
2155
 
2156
  #. Translators: %s is a URL.
2157
- #: admin/views/placements.php:406
2158
  msgid "Tutorial: <a href=\"%s\" target=\"_blank\">How to place visible ads in the header of your website</a>."
2159
  msgstr ""
2160
 
2161
- #: admin/views/placements.php:422
2162
  msgid "show all options"
2163
  msgstr ""
2164
 
2165
- #: admin/views/placements.php:445
2166
  msgid "edit conditions"
2167
  msgstr ""
2168
 
2169
- #: admin/views/placements.php:455
2170
  msgctxt "checkbox to remove placement"
2171
  msgid "delete"
2172
  msgstr ""
2173
 
2174
- #: admin/views/placements.php:462
2175
  msgid "Save Placements"
2176
  msgstr ""
2177
 
2178
- #: admin/views/placements.php:464
2179
  msgid "Create a new placement"
2180
  msgstr ""
2181
 
@@ -2511,6 +2524,10 @@ msgstr ""
2511
  msgid "Display ads in content created with bbPress."
2512
  msgstr ""
2513
 
 
 
 
 
2514
  #: admin/views/upgrades/pro-tab.php:2
2515
  msgid "Advanced Ads Pro – test and optimize your ad performance"
2516
  msgstr ""
@@ -2663,70 +2680,70 @@ msgid "Injected in Footer (before closing &lt;/body&gt; Tag)."
2663
  msgstr ""
2664
 
2665
  #. translators: %s is an html tag.
2666
- #: classes/ad_placements.php:300
2667
  msgid "paragraph (%s)"
2668
  msgstr ""
2669
 
2670
  #. translators: %s is an html tag.
2671
- #: classes/ad_placements.php:302
2672
  msgid "paragraph without image (%s)"
2673
  msgstr ""
2674
 
2675
  #. translators: %s is an html tag.
2676
- #: classes/ad_placements.php:304
2677
  msgid "headline 2 (%s)"
2678
  msgstr ""
2679
 
2680
  #. translators: %s is an html tag.
2681
- #: classes/ad_placements.php:306
2682
  msgid "headline 3 (%s)"
2683
  msgstr ""
2684
 
2685
  #. translators: %s is an html tag.
2686
- #: classes/ad_placements.php:308
2687
  msgid "headline 4 (%s)"
2688
  msgstr ""
2689
 
2690
  #. translators: %s is an html tag.
2691
- #: classes/ad_placements.php:310
2692
  msgid "any headline (%s)"
2693
  msgstr ""
2694
 
2695
  #. translators: %s is an html tag.
2696
- #: classes/ad_placements.php:312
2697
  msgid "image (%s)"
2698
  msgstr ""
2699
 
2700
  #. translators: %s is an html tag.
2701
- #: classes/ad_placements.php:314
2702
  msgid "table (%s)"
2703
  msgstr ""
2704
 
2705
  #. translators: %s is an html tag.
2706
- #: classes/ad_placements.php:316
2707
  msgid "list item (%s)"
2708
  msgstr ""
2709
 
2710
  #. translators: %s is an html tag.
2711
- #: classes/ad_placements.php:318
2712
  msgid "quote (%s)"
2713
  msgstr ""
2714
 
2715
  #. translators: %s is an html tag.
2716
- #: classes/ad_placements.php:320
2717
  msgid "iframe (%s)"
2718
  msgstr ""
2719
 
2720
  #. translators: %s is an html tag.
2721
- #: classes/ad_placements.php:322
2722
  msgid "container (%s)"
2723
  msgstr ""
2724
 
2725
- #: classes/ad_placements.php:324
2726
  msgid "any element"
2727
  msgstr ""
2728
 
2729
- #: classes/ad_placements.php:326
2730
  msgctxt "for the \"custom\" content placement option"
2731
  msgid "custom"
2732
  msgstr ""
2
  # This file is distributed under the GPL-2.0+.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Advanced Ads 1.38.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: 2022-12-14T10:33:34+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
+ "X-Generator: WP-CLI 2.6.0\n"
15
  "X-Domain: advanced-ads\n"
16
 
17
  #. Plugin Name of the plugin
32
  msgid "Thomas Maier, Advanced Ads GmbH"
33
  msgstr ""
34
 
35
+ #: admin/class-advanced-ads-admin.php:225
36
  #: classes/display-conditions.php:317
37
  #: classes/visitor-conditions.php:310
38
  #: modules/gadsense/admin/views/external-ads-links.php:17
41
  msgid "or"
42
  msgstr ""
43
 
44
+ #: admin/class-advanced-ads-admin.php:226
45
  #: classes/display-conditions.php:317
46
  #: classes/visitor-conditions.php:310
47
  msgid "and"
48
  msgstr ""
49
 
50
+ #: admin/class-advanced-ads-admin.php:227
51
  msgid "After which paragraph?"
52
  msgstr ""
53
 
54
+ #: admin/class-advanced-ads-admin.php:229
55
  #: modules/gadsense/includes/class-adsense-report.php:159
56
  msgid "Today"
57
  msgstr ""
58
 
59
+ #: admin/class-advanced-ads-admin.php:230
60
  #: modules/gadsense/includes/class-adsense-report.php:160
61
  msgid "Yesterday"
62
  msgstr ""
63
 
64
+ #: admin/class-advanced-ads-admin.php:231
65
  #: modules/gadsense/includes/class-adsense-report.php:163
66
  msgid "This Month"
67
  msgstr ""
68
 
69
  #. translators: 1: The number of days.
70
+ #: admin/class-advanced-ads-admin.php:233
71
  #: modules/gadsense/includes/class-adsense-report.php:162
72
  #: modules/gadsense/includes/class-adsense-report.php:165
73
  msgid "Last %1$d days"
74
  msgstr ""
75
 
76
+ #: admin/class-advanced-ads-admin.php:236
77
  #: modules/gadsense/admin/views/adsense-report.php:24
78
  msgid "All"
79
  msgstr ""
80
 
81
+ #: admin/class-advanced-ads-admin.php:237
82
  msgid "There were no results returned for this ad. Please make sure it is active, generating impressions and double check your ad parameters."
83
  msgstr ""
84
 
85
+ #: admin/class-advanced-ads-admin.php:238
86
  msgid "Show inactive ads"
87
  msgstr ""
88
 
89
+ #: admin/class-advanced-ads-admin.php:239
90
  msgid "Hide inactive ads"
91
  msgstr ""
92
 
93
+ #: admin/class-advanced-ads-admin.php:241
94
  msgid "Permanently delete this placement?"
95
  msgstr ""
96
 
97
+ #: admin/class-advanced-ads-admin.php:242
98
+ #: admin/views/placements.php:324
99
+ #: admin/views/placements.php:325
 
 
100
  msgid "Close"
101
  msgstr ""
102
 
103
+ #: admin/class-advanced-ads-admin.php:243
104
+ msgid "Data you have entered has not been saved. Are you sure you want to discard your changes?"
105
+ msgstr ""
106
+
107
+ #: admin/class-advanced-ads-admin.php:440
108
  #: admin/includes/class-menu.php:166
109
  #: admin/includes/class-menu.php:169
110
  #: admin/views/settings.php:29
111
  msgid "Support"
112
  msgstr ""
113
 
114
+ #: admin/class-advanced-ads-admin.php:445
115
  #: admin/includes/class-overview-widgets.php:72
116
  msgid "Add-Ons"
117
  msgstr ""
118
 
119
+ #: admin/class-advanced-ads-admin.php:447
120
  msgid "See Pro Features"
121
  msgstr ""
122
 
123
  #. translators: %s is the URL to add a new review, https://wordpress.org/support/plugin/advanced-ads/reviews/#new-post
124
  #. translators: %s is a URL.
125
+ #: admin/class-advanced-ads-admin.php:721
126
  #: admin/includes/class-overview-widgets.php:191
127
  msgid "Thank the developer with a &#9733;&#9733;&#9733;&#9733;&#9733; review on <a href=\"%s\" target=\"_blank\">wordpress.org</a>"
128
  msgstr ""
129
 
130
+ #: admin/class-advanced-ads-admin.php:816
131
+ #: admin/class-advanced-ads-admin.php:822
132
  #: admin/includes/class-menu.php:123
133
  #: admin/views/ad-group-list-ads.php:36
134
  #: public/class-advanced-ads.php:798
136
  msgid "New Ad"
137
  msgstr ""
138
 
139
+ #: admin/class-advanced-ads-admin.php:821
140
  msgid "Your Ads"
141
  msgstr ""
142
 
143
+ #: admin/class-advanced-ads-admin.php:831
144
  msgid "Your Groups"
145
  msgstr ""
146
 
147
+ #: admin/class-advanced-ads-admin.php:832
148
  #: admin/views/ad-group.php:64
149
  #: public/class-advanced-ads.php:762
150
  msgid "New Ad Group"
151
  msgstr ""
152
 
153
+ #: admin/class-advanced-ads-admin.php:840
154
  msgid "Your Placements"
155
  msgstr ""
156
 
157
+ #: admin/class-advanced-ads-admin.php:841
158
+ #: admin/views/placements.php:40
159
+ #: admin/views/placements.php:469
160
  msgid "New Placement"
161
  msgstr ""
162
 
163
+ #: admin/class-advanced-ads-admin.php:847
164
  #: admin/includes/class-menu.php:150
165
  msgid "Advanced Ads Settings"
166
  msgstr ""
182
  #. translators: %s is a list of PHP extensions.
183
  #. Translators: %s is a name of a module.
184
  #: admin/includes/ad-health-notices.php:54
185
+ #: admin/views/placements.php:392
186
  msgid "Missing PHP extensions could cause issues. Please ask your hosting provider to enable them: %s"
187
  msgstr ""
188
 
354
  msgstr[0] ""
355
  msgstr[1] ""
356
 
357
+ #: admin/includes/class-ad-groups-list.php:339
358
+ msgid "Grid"
359
+ msgstr ""
360
+
361
+ #: admin/includes/class-ad-groups-list.php:347
362
+ msgid "Ad Slider"
363
+ msgstr ""
364
+
365
+ #: admin/includes/class-ad-groups-list.php:364
366
  msgid "Random ads"
367
  msgstr ""
368
 
369
+ #: admin/includes/class-ad-groups-list.php:365
370
  msgid "Display random ads based on ad weight"
371
  msgstr ""
372
 
373
+ #: admin/includes/class-ad-groups-list.php:369
374
  msgid "Ordered ads"
375
  msgstr ""
376
 
377
+ #: admin/includes/class-ad-groups-list.php:370
378
  msgid "Display ads with the highest ad weight first"
379
  msgstr ""
380
 
381
+ #: admin/includes/class-ad-groups-list.php:405
382
+ #: admin/views/ad-group-list-row.php:45
383
+ #: admin/views/placements.php:278
384
  #: modules/import-export/classes/import.php:153
385
  #: modules/import-export/classes/import.php:193
386
  #: modules/import-export/classes/import.php:595
388
  msgid "Edit"
389
  msgstr ""
390
 
391
+ #: admin/includes/class-ad-groups-list.php:406
392
  #: admin/views/placements.php:131
393
  msgid "show usage"
394
  msgstr ""
395
 
396
+ #: admin/includes/class-ad-groups-list.php:415
397
  #: admin/views/placements.php:10
398
  msgid "Delete"
399
  msgstr ""
400
 
401
+ #: admin/includes/class-ad-groups-list.php:437
402
+ #: admin/includes/class-ad-groups-list.php:516
403
  msgid "Invalid Ad Group"
404
  msgstr ""
405
 
406
+ #: admin/includes/class-ad-groups-list.php:442
407
+ #: admin/includes/class-ad-groups-list.php:521
408
  msgid "You don’t have permission to change the ad groups"
409
  msgstr ""
410
 
411
+ #: admin/includes/class-ad-groups-list.php:485
412
  msgid "No ad group created"
413
  msgstr ""
414
 
415
  #: admin/includes/class-ad-type.php:133
416
+ #: admin/views/ad-group-list-form-row.php:68
417
  #: admin/views/ad-group-list-header.php:13
418
  #: admin/views/placements.php:56
419
  #: modules/gadsense/admin/views/adsense-ad-parameters.php:105
546
  msgstr ""
547
 
548
  #: admin/includes/class-admin-upgrades.php:83
 
549
  msgid "Pro Feature"
550
  msgstr ""
551
 
663
  #: admin/includes/class-menu.php:90
664
  #: admin/includes/class-menu.php:91
665
  #: admin/includes/class-shortcode-creator.php:212
666
+ #: admin/views/ad-group-list-form-row.php:103
667
  #: admin/views/ad-group-list-header.php:16
668
  #: admin/views/placement-form.php:61
669
  #: admin/views/placements-item.php:26
718
  msgid "You attempted to edit an ad group that doesn&#8217;t exist. Perhaps it was deleted?"
719
  msgstr ""
720
 
 
 
 
 
 
 
 
 
721
  #: admin/includes/class-meta-box.php:61
722
  msgid "Ad Type"
723
  msgstr ""
728
  msgstr ""
729
 
730
  #: admin/includes/class-meta-box.php:89
731
+ #: admin/views/ad-group-list-row.php:66
732
+ #: admin/views/placements.php:310
733
  msgid "Usage"
734
  msgstr ""
735
 
743
  msgstr ""
744
 
745
  #: admin/includes/class-meta-box.php:114
746
+ #: admin/views/placements.php:204
747
+ #: admin/views/placements.php:433
748
  #: classes/ad-debug.php:152
749
  msgid "Display Conditions"
750
  msgstr ""
751
 
752
  #: admin/includes/class-meta-box.php:122
753
+ #: admin/views/placements.php:213
754
+ #: admin/views/placements.php:441
755
  #: classes/ad-debug.php:239
756
  msgid "Visitor Conditions"
757
  msgstr ""
768
  #: admin/includes/class-meta-box.php:231
769
  #: admin/includes/class-meta-box.php:236
770
  #: admin/includes/class-overview-widgets.php:179
771
+ #: admin/views/ad-group.php:56
772
  #: admin/views/ad-main-metabox.php:29
773
  #: admin/views/ad-output-metabox.php:43
774
  #: admin/views/conditions/condition-device.php:22
1006
  msgid "Visit your ad statistics"
1007
  msgstr ""
1008
 
1009
+ #: admin/includes/class-overview-widgets.php:559
1010
+ msgid "List of responsive ads by browser width"
1011
+ msgstr ""
1012
+
1013
  #: admin/includes/class-overview-widgets.php:662
1014
  msgid "Use Genesis specific ad positions."
1015
  msgstr ""
1287
  msgstr ""
1288
 
1289
  #: admin/views/ad-group-list-ads.php:20
1290
+ #: admin/views/placements.php:351
1291
  #: classes/ad-debug.php:118
1292
  #: classes/ad-debug.php:167
1293
  #: classes/ad-debug.php:169
1304
  msgid "add"
1305
  msgstr ""
1306
 
1307
+ #: admin/views/ad-group-list-form-row.php:59
1308
+ #: admin/views/group-form.php:43
1309
+ msgid "Get all group types with All Access"
1310
+ msgstr ""
1311
+
1312
+ #: admin/views/ad-group-list-form-row.php:84
1313
  msgctxt "option to display all ads in an ad groups"
1314
  msgid "all"
1315
  msgstr ""
1316
 
1317
+ #: admin/views/ad-group-list-form-row.php:91
1318
  msgid "Visible ads"
1319
  msgstr ""
1320
 
1321
+ #: admin/views/ad-group-list-form-row.php:93
1322
  msgid "Number of ads that are visible at the same time"
1323
  msgstr ""
1324
 
1326
  msgid "Details"
1327
  msgstr ""
1328
 
1329
+ #: admin/views/ad-group-list-row.php:46
1330
  msgid "Save"
1331
  msgstr ""
1332
 
1333
+ #: admin/views/ad-group-list-row.php:56
1334
+ #: admin/views/placements.php:314
1335
  msgid "shortcode"
1336
  msgstr ""
1337
 
1338
+ #: admin/views/ad-group-list-row.php:58
1339
+ #: admin/views/placements.php:317
1340
  msgid "template (PHP)"
1341
  msgstr ""
1342
 
1343
  #. translators: %s is the name of a group type
1344
+ #: admin/views/ad-group-list-row.php:83
1345
  msgid "Type: %s"
1346
  msgstr ""
1347
 
1348
  #. translators: %s is the ID of an ad group
1349
+ #: admin/views/ad-group-list-row.php:91
1350
  msgid "ID: %s"
1351
  msgstr ""
1352
 
1358
  msgid "Ad Groups successfully updated"
1359
  msgstr ""
1360
 
1361
+ #: admin/views/ad-group.php:54
1362
  msgid "Ad Groups are a very flexible method to bundle ads. You can use them to display random ads in the frontend or run split tests, but also just for informational purposes. Not only can an Ad Groups have multiple ads, but an ad can belong to multiple ad groups."
1363
  msgstr ""
1364
 
1366
  msgid "Save New Group"
1367
  msgstr ""
1368
 
1369
+ #: admin/views/ad-group.php:103
1370
  #: public/class-advanced-ads.php:765
1371
  msgid "No Ad Group found"
1372
  msgstr ""
1753
  msgid "Choose the type"
1754
  msgstr ""
1755
 
1756
+ #: admin/views/group-form.php:48
1757
  #: admin/views/placement-form.php:38
1758
  msgid "Please select a type."
1759
  msgstr ""
1760
 
1761
+ #: admin/views/group-form.php:50
1762
  msgid "Choose a name"
1763
  msgstr ""
1764
 
1765
+ #: admin/views/group-form.php:51
1766
  msgid "Group title"
1767
  msgstr ""
1768
 
1769
+ #: admin/views/group-form.php:52
1770
  #: admin/views/placement-form.php:49
1771
  msgid "Please enter a name."
1772
  msgstr ""
1783
  msgid "See all Add-ons"
1784
  msgstr ""
1785
 
1786
+ #: admin/views/modal.php:26
1787
+ #: admin/views/modal.php:40
1788
+ msgid "Cancel"
 
1789
  msgstr ""
1790
 
1791
  #: admin/views/notices/adblock.php:4
1998
  #: admin/views/placements-ad-label-position.php:12
1999
  #: admin/views/placements-ad-label.php:9
2000
  #: admin/views/placements-ad-label.php:11
2001
+ #: admin/views/placements.php:273
2002
  #: modules/gadsense/includes/class-network-adsense.php:321
2003
  msgid "default"
2004
  msgstr ""
2070
  msgid "Placements are physically places in your theme and posts. You can use them if you plan to change ads and ad groups on the same place without the need to change your templates."
2071
  msgstr ""
2072
 
2073
+ #: admin/views/placements.php:41
2074
  msgid "Save New Placement"
2075
  msgstr ""
2076
 
2102
  msgid "Inline CSS"
2103
  msgstr ""
2104
 
2105
+ #: admin/views/placements.php:184
2106
+ msgid "Minimum Content Length"
2107
  msgstr ""
2108
 
2109
+ #: admin/views/placements.php:186
2110
+ msgid "Minimum length of content before automatically injected ads are allowed in them."
 
2111
  msgstr ""
2112
 
2113
+ #: admin/views/placements.php:192
2114
+ msgid "Words Between Ads"
2115
  msgstr ""
2116
 
2117
+ #: admin/views/placements.php:194
2118
+ msgid "A minimum amount of words between automatically injected ads."
2119
  msgstr ""
2120
 
2121
+ #: admin/views/placements.php:206
2122
+ msgid "Use display conditions for placements."
2123
  msgstr ""
2124
 
2125
+ #: admin/views/placements.php:207
2126
+ #: admin/views/placements.php:216
2127
+ msgid "The free version provides conditions on the ad edit page."
2128
  msgstr ""
2129
 
2130
+ #: admin/views/placements.php:215
2131
+ msgid "Use visitor conditions for placements."
2132
  msgstr ""
2133
 
2134
+ #. translators: 1: "Options", 2: the name of a placement.
2135
+ #: admin/views/placements.php:235
2136
  #: modules/import-export/views/page.php:26
2137
  msgid "Options"
2138
  msgstr ""
2139
 
2140
+ #: admin/views/placements.php:237
2141
+ msgid "Close and save"
2142
+ msgstr ""
2143
+
2144
  #. Translators: %s is the name of a placement.
2145
+ #: admin/views/placements.php:247
2146
  msgid "Placement type \"%s\" is missing and was reset to \"default\".<br/>Please check if the responsible add-on is activated."
2147
  msgstr ""
2148
 
2149
+ #: admin/views/placements.php:352
2150
  msgid "Group"
2151
  msgstr ""
2152
 
2153
+ #: admin/views/placements.php:368
2154
  msgid "after"
2155
  msgstr ""
2156
 
2157
+ #: admin/views/placements.php:369
2158
  msgid "before"
2159
  msgstr ""
2160
 
2161
+ #: admin/views/placements.php:382
2162
  msgid "position"
2163
  msgstr ""
2164
 
2165
+ #: admin/views/placements.php:388
2166
  msgid "Important Notice"
2167
  msgstr ""
2168
 
2169
  #. Translators: %s is a URL.
2170
+ #: admin/views/placements.php:411
2171
  msgid "Tutorial: <a href=\"%s\" target=\"_blank\">How to place visible ads in the header of your website</a>."
2172
  msgstr ""
2173
 
2174
+ #: admin/views/placements.php:427
2175
  msgid "show all options"
2176
  msgstr ""
2177
 
2178
+ #: admin/views/placements.php:450
2179
  msgid "edit conditions"
2180
  msgstr ""
2181
 
2182
+ #: admin/views/placements.php:460
2183
  msgctxt "checkbox to remove placement"
2184
  msgid "delete"
2185
  msgstr ""
2186
 
2187
+ #: admin/views/placements.php:467
2188
  msgid "Save Placements"
2189
  msgstr ""
2190
 
2191
+ #: admin/views/placements.php:469
2192
  msgid "Create a new placement"
2193
  msgstr ""
2194
 
2524
  msgid "Display ads in content created with bbPress."
2525
  msgstr ""
2526
 
2527
+ #: admin/views/upgrades/pro-placements.php:87
2528
+ msgid "Get all placements with All Access"
2529
+ msgstr ""
2530
+
2531
  #: admin/views/upgrades/pro-tab.php:2
2532
  msgid "Advanced Ads Pro – test and optimize your ad performance"
2533
  msgstr ""
2680
  msgstr ""
2681
 
2682
  #. translators: %s is an html tag.
2683
+ #: classes/ad_placements.php:306
2684
  msgid "paragraph (%s)"
2685
  msgstr ""
2686
 
2687
  #. translators: %s is an html tag.
2688
+ #: classes/ad_placements.php:308
2689
  msgid "paragraph without image (%s)"
2690
  msgstr ""
2691
 
2692
  #. translators: %s is an html tag.
2693
+ #: classes/ad_placements.php:310
2694
  msgid "headline 2 (%s)"
2695
  msgstr ""
2696
 
2697
  #. translators: %s is an html tag.
2698
+ #: classes/ad_placements.php:312
2699
  msgid "headline 3 (%s)"
2700
  msgstr ""
2701
 
2702
  #. translators: %s is an html tag.
2703
+ #: classes/ad_placements.php:314
2704
  msgid "headline 4 (%s)"
2705
  msgstr ""
2706
 
2707
  #. translators: %s is an html tag.
2708
+ #: classes/ad_placements.php:316
2709
  msgid "any headline (%s)"
2710
  msgstr ""
2711
 
2712
  #. translators: %s is an html tag.
2713
+ #: classes/ad_placements.php:318
2714
  msgid "image (%s)"
2715
  msgstr ""
2716
 
2717
  #. translators: %s is an html tag.
2718
+ #: classes/ad_placements.php:320
2719
  msgid "table (%s)"
2720
  msgstr ""
2721
 
2722
  #. translators: %s is an html tag.
2723
+ #: classes/ad_placements.php:322
2724
  msgid "list item (%s)"
2725
  msgstr ""
2726
 
2727
  #. translators: %s is an html tag.
2728
+ #: classes/ad_placements.php:324
2729
  msgid "quote (%s)"
2730
  msgstr ""
2731
 
2732
  #. translators: %s is an html tag.
2733
+ #: classes/ad_placements.php:326
2734
  msgid "iframe (%s)"
2735
  msgstr ""
2736
 
2737
  #. translators: %s is an html tag.
2738
+ #: classes/ad_placements.php:328
2739
  msgid "container (%s)"
2740
  msgstr ""
2741
 
2742
+ #: classes/ad_placements.php:330
2743
  msgid "any element"
2744
  msgstr ""
2745
 
2746
+ #: classes/ad_placements.php:332
2747
  msgctxt "for the \"custom\" content placement option"
2748
  msgid "custom"
2749
  msgstr ""
lib/composer/autoload_classmap.php CHANGED
@@ -9,6 +9,8 @@ return array(
9
  'ADVADS_SL_Plugin_Updater' => $baseDir . '/classes/EDD_SL_Plugin_Updater.php',
10
  'Advads_Ad' => $baseDir . '/classes/ad.php',
11
  'Advanced_Ads' => $baseDir . '/public/class-advanced-ads.php',
 
 
12
  'Advanced_Ads_Ad' => $baseDir . '/classes/ad.php',
13
  'Advanced_Ads_Ad_Ajax_Callbacks' => $baseDir . '/classes/ad_ajax_callbacks.php',
14
  'Advanced_Ads_Ad_Authors' => $baseDir . '/admin/includes/ad-authors.php',
@@ -46,6 +48,7 @@ return array(
46
  'Advanced_Ads_Groups_List' => $baseDir . '/admin/includes/class-ad-groups-list.php',
47
  'Advanced_Ads_In_Content_Injector' => $baseDir . '/classes/in-content-injector.php',
48
  'Advanced_Ads_Inline_Css' => $baseDir . '/classes/inline-css.php',
 
49
  'Advanced_Ads_Model' => $baseDir . '/classes/ad-model.php',
50
  'Advanced_Ads_Overview_Widgets_Callbacks' => $baseDir . '/admin/includes/class-overview-widgets.php',
51
  'Advanced_Ads_Placements' => $baseDir . '/classes/ad_placements.php',
9
  'ADVADS_SL_Plugin_Updater' => $baseDir . '/classes/EDD_SL_Plugin_Updater.php',
10
  'Advads_Ad' => $baseDir . '/classes/ad.php',
11
  'Advanced_Ads' => $baseDir . '/public/class-advanced-ads.php',
12
+ 'Advanced_Ads\\Placement_Type' => $baseDir . '/src/Placement_Type.php',
13
+ 'Advanced_Ads\\Placement_Type_Options' => $baseDir . '/src/Placement_Type_Options.php',
14
  'Advanced_Ads_Ad' => $baseDir . '/classes/ad.php',
15
  'Advanced_Ads_Ad_Ajax_Callbacks' => $baseDir . '/classes/ad_ajax_callbacks.php',
16
  'Advanced_Ads_Ad_Authors' => $baseDir . '/admin/includes/ad-authors.php',
48
  'Advanced_Ads_Groups_List' => $baseDir . '/admin/includes/class-ad-groups-list.php',
49
  'Advanced_Ads_In_Content_Injector' => $baseDir . '/classes/in-content-injector.php',
50
  'Advanced_Ads_Inline_Css' => $baseDir . '/classes/inline-css.php',
51
+ 'Advanced_Ads_Modal' => $baseDir . '/classes/Advanced_Ads_Modal.php',
52
  'Advanced_Ads_Model' => $baseDir . '/classes/ad-model.php',
53
  'Advanced_Ads_Overview_Widgets_Callbacks' => $baseDir . '/admin/includes/class-overview-widgets.php',
54
  'Advanced_Ads_Placements' => $baseDir . '/classes/ad_placements.php',
lib/composer/autoload_psr4.php CHANGED
@@ -6,4 +6,5 @@ $vendorDir = dirname(__DIR__);
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
 
9
  );
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
+ 'Advanced_Ads\\' => array($baseDir . '/src'),
10
  );
lib/composer/autoload_static.php CHANGED
@@ -6,10 +6,26 @@ namespace AdvancedAds\Composer\Autoload;
6
 
7
  class ComposerStaticInit_advanced_ads
8
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  public static $classMap = array (
10
  'ADVADS_SL_Plugin_Updater' => __DIR__ . '/../..' . '/classes/EDD_SL_Plugin_Updater.php',
11
  'Advads_Ad' => __DIR__ . '/../..' . '/classes/ad.php',
12
  'Advanced_Ads' => __DIR__ . '/../..' . '/public/class-advanced-ads.php',
 
 
13
  'Advanced_Ads_Ad' => __DIR__ . '/../..' . '/classes/ad.php',
14
  'Advanced_Ads_Ad_Ajax_Callbacks' => __DIR__ . '/../..' . '/classes/ad_ajax_callbacks.php',
15
  'Advanced_Ads_Ad_Authors' => __DIR__ . '/../..' . '/admin/includes/ad-authors.php',
@@ -47,6 +63,7 @@ class ComposerStaticInit_advanced_ads
47
  'Advanced_Ads_Groups_List' => __DIR__ . '/../..' . '/admin/includes/class-ad-groups-list.php',
48
  'Advanced_Ads_In_Content_Injector' => __DIR__ . '/../..' . '/classes/in-content-injector.php',
49
  'Advanced_Ads_Inline_Css' => __DIR__ . '/../..' . '/classes/inline-css.php',
 
50
  'Advanced_Ads_Model' => __DIR__ . '/../..' . '/classes/ad-model.php',
51
  'Advanced_Ads_Overview_Widgets_Callbacks' => __DIR__ . '/../..' . '/admin/includes/class-overview-widgets.php',
52
  'Advanced_Ads_Placements' => __DIR__ . '/../..' . '/classes/ad_placements.php',
@@ -65,6 +82,8 @@ class ComposerStaticInit_advanced_ads
65
  public static function getInitializer(ClassLoader $loader)
66
  {
67
  return \Closure::bind(function () use ($loader) {
 
 
68
  $loader->classMap = ComposerStaticInit_advanced_ads::$classMap;
69
 
70
  }, null, ClassLoader::class);
6
 
7
  class ComposerStaticInit_advanced_ads
8
  {
9
+ public static $prefixLengthsPsr4 = array (
10
+ 'A' =>
11
+ array (
12
+ 'Advanced_Ads\\' => 13,
13
+ ),
14
+ );
15
+
16
+ public static $prefixDirsPsr4 = array (
17
+ 'Advanced_Ads\\' =>
18
+ array (
19
+ 0 => __DIR__ . '/../..' . '/src',
20
+ ),
21
+ );
22
+
23
  public static $classMap = array (
24
  'ADVADS_SL_Plugin_Updater' => __DIR__ . '/../..' . '/classes/EDD_SL_Plugin_Updater.php',
25
  'Advads_Ad' => __DIR__ . '/../..' . '/classes/ad.php',
26
  'Advanced_Ads' => __DIR__ . '/../..' . '/public/class-advanced-ads.php',
27
+ 'Advanced_Ads\\Placement_Type' => __DIR__ . '/../..' . '/src/Placement_Type.php',
28
+ 'Advanced_Ads\\Placement_Type_Options' => __DIR__ . '/../..' . '/src/Placement_Type_Options.php',
29
  'Advanced_Ads_Ad' => __DIR__ . '/../..' . '/classes/ad.php',
30
  'Advanced_Ads_Ad_Ajax_Callbacks' => __DIR__ . '/../..' . '/classes/ad_ajax_callbacks.php',
31
  'Advanced_Ads_Ad_Authors' => __DIR__ . '/../..' . '/admin/includes/ad-authors.php',
63
  'Advanced_Ads_Groups_List' => __DIR__ . '/../..' . '/admin/includes/class-ad-groups-list.php',
64
  'Advanced_Ads_In_Content_Injector' => __DIR__ . '/../..' . '/classes/in-content-injector.php',
65
  'Advanced_Ads_Inline_Css' => __DIR__ . '/../..' . '/classes/inline-css.php',
66
+ 'Advanced_Ads_Modal' => __DIR__ . '/../..' . '/classes/Advanced_Ads_Modal.php',
67
  'Advanced_Ads_Model' => __DIR__ . '/../..' . '/classes/ad-model.php',
68
  'Advanced_Ads_Overview_Widgets_Callbacks' => __DIR__ . '/../..' . '/admin/includes/class-overview-widgets.php',
69
  'Advanced_Ads_Placements' => __DIR__ . '/../..' . '/classes/ad_placements.php',
82
  public static function getInitializer(ClassLoader $loader)
83
  {
84
  return \Closure::bind(function () use ($loader) {
85
+ $loader->prefixLengthsPsr4 = ComposerStaticInit_advanced_ads::$prefixLengthsPsr4;
86
+ $loader->prefixDirsPsr4 = ComposerStaticInit_advanced_ads::$prefixDirsPsr4;
87
  $loader->classMap = ComposerStaticInit_advanced_ads::$classMap;
88
 
89
  }, null, ClassLoader::class);
modules/import-export/classes/export.php CHANGED
@@ -193,7 +193,16 @@ class Advanced_Ads_Export {
193
  error_log( print_r( $export, true) );
194
  }
195
 
196
- $filename = 'advanced-ads-' . date( 'Y-m-d' ) . '.xml';
 
 
 
 
 
 
 
 
 
197
 
198
  try {
199
  $encoded = Advanced_Ads_XmlEncoder::get_instance()->encode( $export, [ 'encoding' => get_option( 'blog_charset' ) ] );
193
  error_log( print_r( $export, true) );
194
  }
195
 
196
+ // add the root domain and the current date to the filename.
197
+ $filename = sprintf(
198
+ '%s-advanced-ads-export-%s.xml',
199
+ sanitize_title( preg_replace(
200
+ '#^(?:[^:]+:)?//(?:www\.)?([^/]+)#',
201
+ '$1',
202
+ get_bloginfo( 'url' )
203
+ ) ),
204
+ gmdate( 'Y-m-d' )
205
+ );
206
 
207
  try {
208
  $encoded = Advanced_Ads_XmlEncoder::get_instance()->encode( $export, [ 'encoding' => get_option( 'blog_charset' ) ] );
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: ads, adsense, amp, ads.txt, ad rotations, ad blocker, amazon, banner, clic
4
  Requires at least: 4.9
5
  Tested up to: 6.1
6
  Requires PHP: 7.2
7
- Stable tag: 1.38.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -334,10 +334,11 @@ Yes. You can use plenty of [hooks](https://wpadvancedads.com/codex/) to customiz
334
 
335
  == Changelog ==
336
 
337
- = 1.38.0 (November 22, 2022) =
338
 
339
- - Improvement: add support for multibyte cookies in "advads.get/set_cookie" functions
340
- - Improvement: update routine to remove all data on uninstall
341
- - Improvement: unify the behavior and look of the group and placement lists
342
- - Fix: serialize post meta in conditions to do string comparisons
343
- - Fix: ensure the filters for placements work
 
4
  Requires at least: 4.9
5
  Tested up to: 6.1
6
  Requires PHP: 7.2
7
+ {Stable tag: }1.39.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
334
 
335
  == Changelog ==
336
 
337
+ = 1.39.0 (December 14, 2022) =
338
 
339
+ - Improvement: add PeepSo ad type image
340
+ - Improvement: add fallback ad type image for unknown ad types
341
+ - Fix: remove unused jQuery UI assets
342
+ - Fix: prevent uncaught `TypeError` on Placements search
343
+ - Fix: add the site URL to the export filename
344
+ - Fix: prevent duplicate queries due to circular functions calls in capability checks
src/Placement_Type.php ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Advanced_Ads;
4
+
5
+ /**
6
+ * Class wrapper for placement types array.
7
+ *
8
+ * @property-read string $title
9
+ * @property-read string $description
10
+ * @property-read string $image
11
+ * @property-read float $order
12
+ * @property-read Placement_Type_Options $options
13
+ */
14
+ class Placement_Type extends \ArrayObject {
15
+
16
+ /**
17
+ * Placement type title.
18
+ *
19
+ * @var string
20
+ */
21
+ private $title;
22
+
23
+ /**
24
+ * Placement type description.
25
+ *
26
+ * @var string
27
+ */
28
+ private $description = '';
29
+
30
+ /**
31
+ * Admin UI image src.
32
+ *
33
+ * @var string
34
+ */
35
+ private $image = '';
36
+
37
+ /**
38
+ * Admin UI order for new placements.
39
+ *
40
+ * @var float
41
+ */
42
+ private $order;
43
+
44
+ /**
45
+ * A class to resolve the placement type options.
46
+ *
47
+ * @var Placement_Type_Options
48
+ */
49
+ private $options;
50
+
51
+ /**
52
+ * The placement type.
53
+ *
54
+ * @var string
55
+ */
56
+ private $type;
57
+
58
+ /**
59
+ * Assign simple placement definitions to properties.
60
+ * Instantiate Placement_Type_Options class.
61
+ *
62
+ * @param string $type The type of placement.
63
+ * @param array $placement_definition The definition options for the placement.
64
+ */
65
+ public function __construct( $type, array $placement_definition ) {
66
+ $this->type = $type;
67
+
68
+ if ( array_key_exists( 'title', $placement_definition ) ) {
69
+ $this->title = $placement_definition['title'];
70
+ }
71
+
72
+ if ( array_key_exists( 'description', $placement_definition ) ) {
73
+ $this->description = $placement_definition['description'];
74
+ }
75
+
76
+ if ( array_key_exists( 'image', $placement_definition ) ) {
77
+ $this->image = $placement_definition['image'];
78
+ }
79
+
80
+ if ( array_key_exists( 'order', $placement_definition ) ) {
81
+ $this->order = (float) $placement_definition['order'];
82
+ }
83
+
84
+ if ( ! array_key_exists( 'options', $placement_definition ) || ! is_array( $placement_definition['options'] ) ) {
85
+ $placement_definition['options'] = [];
86
+ }
87
+
88
+ $this->options = new Placement_Type_Options( $placement_definition['options'] );
89
+
90
+ parent::__construct( $placement_definition );
91
+ }
92
+
93
+ /**
94
+ * Magic catch to have readonly properties.
95
+ *
96
+ * @param string $name The name of the requested property.
97
+ *
98
+ * @return mixed
99
+ * @noinspection MagicMethodsValidityInspection -- no setter as we only want readonly properties
100
+ */
101
+ public function __get( $name ) {
102
+ if ( property_exists( $this, $name ) ) {
103
+ return $this->{$name};
104
+ }
105
+
106
+ return null;
107
+ }
108
+
109
+ /**
110
+ * Check if the provided ad type is allowed (or at least not excluded).
111
+ * If an ad type is both allowed and forbidden, the allow-list takes precedence.
112
+ *
113
+ * @param string $type Ad type.
114
+ *
115
+ * @return bool
116
+ */
117
+ public function is_ad_type_allowed( $type ) {
118
+ return $this->is_abstract_allowed( $type, 'ad' );
119
+ }
120
+
121
+ /**
122
+ * Check if the provided ad group type is allowed.
123
+ *
124
+ * @param string $type Ad group type.
125
+ *
126
+ * @return bool
127
+ */
128
+ public function is_group_type_allowed( $type ) {
129
+ return $this->is_abstract_allowed( $type, 'group' );
130
+ }
131
+
132
+ /**
133
+ * Abstraction of comparing whether type is allowed or excluded.
134
+ *
135
+ * @param string $type Specific Advanced_Ads_Ad::$type or Advanced_Ads_Ad_Group::$type.
136
+ * @param string $class Overall classification, one of `ad` or `group`.
137
+ *
138
+ * @return bool
139
+ */
140
+ private function is_abstract_allowed( $type, $class ) {
141
+ $allowed = $this->options->offsetGet( 'allowed_' . $class . '_types' );
142
+
143
+ if ( $allowed === null ) {
144
+ return ! in_array( $type, $this->options->offsetGet( 'excluded_' . $class . '_types' ), true );
145
+ }
146
+
147
+ return in_array( $type, $allowed, true );
148
+ }
149
+ }
src/Placement_Type_Options.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Advanced_Ads;
4
+
5
+ /**
6
+ * The placement type options are stored in an array, this wraps them so we can operate on them.
7
+ */
8
+ class Placement_Type_Options extends \ArrayObject {
9
+ /**
10
+ * Whether to show the positioning options.
11
+ *
12
+ * @var bool
13
+ */
14
+ private $show_position = false;
15
+
16
+ /**
17
+ * Whether to show lazy loading.
18
+ *
19
+ * @var bool
20
+ */
21
+ private $show_lazy_load = false;
22
+
23
+ /**
24
+ * Whether to show content options.
25
+ *
26
+ * @var bool
27
+ */
28
+ private $uses_the_content = false;
29
+
30
+ /**
31
+ * Whether this placement is available in AMP.
32
+ *
33
+ * @var bool
34
+ */
35
+ private $amp = false;
36
+
37
+ /**
38
+ * Array of allowed ad types for this placement. Default null.
39
+ *
40
+ * @var null|string[]
41
+ */
42
+ private $allowed_ad_types = null;
43
+
44
+ /**
45
+ * Array of excluded ad types for this placement.
46
+ *
47
+ * @var string[]
48
+ */
49
+ private $excluded_ad_types = [];
50
+
51
+ /**
52
+ * Array of allowed ad group types for this placement.
53
+ *
54
+ * @var null|string[]
55
+ */
56
+ private $allowed_group_types = null;
57
+
58
+ /**
59
+ * Array of excluded ad groups for this placement.
60
+ *
61
+ * @var string[]
62
+ */
63
+ private $excluded_group_types = [];
64
+
65
+ /**
66
+ * Overload offsetGet in order to get the default value for the option.
67
+ *
68
+ * @param string $key The array offset to search for.
69
+ *
70
+ * @return false|mixed
71
+ */
72
+ public function &offsetGet( $key ) {
73
+ if ( ! $this->offsetExists( $key ) && property_exists( $this, $key ) ) {
74
+ return $this->{$key};
75
+ }
76
+
77
+ $value = parent::offsetGet( $key );
78
+
79
+ return $value;
80
+ }
81
+ }