Version Description
- added option and Display Condition to disable ads in content served through the REST API
- made error notices less obstrusive
- code style optimizations
- fixed ad groups form on ad edit page
- fixed potential conflict with autoloader
Download this release
Release Info
Developer | webzunft |
Plugin | Advanced Ads |
Version | 1.17.4 |
Comparing to | |
See all releases |
Code changes from version 1.17.3 to 1.17.4
- admin/assets/js/admin.js +0 -83
- admin/class-advanced-ads-admin.php +32 -52
- admin/includes/class-list-filters.php +8 -9
- admin/includes/class-menu.php +139 -90
- admin/includes/class-meta-box.php +326 -229
- admin/includes/class-notices.php +16 -53
- admin/includes/class-options.php +33 -23
- admin/includes/class-overview-widgets.php +679 -526
- admin/includes/class-settings.php +70 -152
- admin/includes/class-shortcode-creator.php +92 -45
- admin/includes/notices.php +66 -61
- admin/includes/shortcode-creator-l10n.php +19 -12
- admin/views/ad-group.php +48 -33
- admin/views/setting-disable-post-types.php +0 -11
- admin/views/setting-license.php +5 -0
- admin/views/setting-target.php +0 -4
- admin/views/settings-disable-ads.php +0 -25
- admin/views/settings/general/advanced-js.php +25 -0
- admin/views/settings/general/block-bots.php +10 -0
- admin/views/settings/general/content-injection-everywhere.php +2 -0
- admin/views/settings/general/content-injection-level-limitation.php +2 -0
- admin/views/settings/general/content-injection-priority.php +11 -0
- admin/views/settings/general/custom-label.php +12 -0
- admin/views/settings/general/disable-ads.php +37 -0
- admin/views/settings/general/disable-notices.php +11 -0
- admin/views/settings/general/disable-post-types.php +12 -0
- admin/views/settings/general/disable-shortcode-button.php +2 -0
- admin/views/settings/general/editors-manage-ads.php +18 -0
- admin/views/settings/general/frontend-prefix.php +4 -0
- admin/views/settings/general/hide-for-user-role.php +14 -0
- admin/views/settings/general/link-target.php +6 -0
- admin/views/settings/general/uninstall-delete-data.php +4 -0
- admin/views/settings/license/section.php +30 -0
- advanced-ads.php +2 -2
- classes/ad.php +2 -2
- classes/display-conditions.php +15 -0
- classes/frontend_checks.php +47 -73
- classes/plugin.php +111 -148
- classes/utils.php +50 -45
- languages/advanced-ads.pot +483 -477
- lib/composer/ClassLoader.php +2 -2
- lib/composer/autoload_real.php +3 -3
- lib/composer/autoload_static.php +1 -1
- public/class-advanced-ads.php +38 -63
- readme.txt +9 -1
admin/assets/js/admin.js
CHANGED
@@ -1523,86 +1523,3 @@ class AdvancedAdsAdNetwork {
|
|
1523 |
class AdvancedAdsExternalAdUnit {
|
1524 |
|
1525 |
}
|
1526 |
-
|
1527 |
-
// handle AJAX errors mostly caused by other plugins and for all other AJAX errors.
|
1528 |
-
// to reproduce this, enable the following PHP code in a PHP mu-plugin to break all AJAX calls
|
1529 |
-
/* if ( isset( $_REQUEST['action'] ) && wp_doing_ajax() ) {
|
1530 |
-
add_action( 'wp_ajax_' . $_REQUEST['action'], function () {
|
1531 |
-
wp_send_json_error( [ 'I\'m Boss now.' ], 400 );
|
1532 |
-
}, 0 );
|
1533 |
-
}*/
|
1534 |
-
(function () {
|
1535 |
-
var open = XMLHttpRequest.prototype.open,
|
1536 |
-
send = XMLHttpRequest.prototype.send,
|
1537 |
-
// variable to hold our request and response data
|
1538 |
-
request = {},
|
1539 |
-
// array of ajax callbacks that are not prefixed with either `advads_` or `advanced_ads_`.
|
1540 |
-
advadsAdditionalActions = [
|
1541 |
-
'load_ad_parameters_metabox',
|
1542 |
-
'load_visitor_conditions_metabox',
|
1543 |
-
'load_display_conditions_metabox',
|
1544 |
-
],
|
1545 |
-
handleError = function (event) {
|
1546 |
-
request.response = JSON.parse(event.responseText).data;
|
1547 |
-
request.status = event.status;
|
1548 |
-
|
1549 |
-
// check if this is an ajax handler from advanced ads
|
1550 |
-
if (
|
1551 |
-
typeof request.payload.action !== 'undefined' &&
|
1552 |
-
(
|
1553 |
-
request.payload.action.indexOf('advads_') === 0
|
1554 |
-
|| request.payload.action.indexOf('advanced_ads_') === 0
|
1555 |
-
|| advadsAdditionalActions.indexOf(request.payload.action) !== -1
|
1556 |
-
)
|
1557 |
-
) {
|
1558 |
-
// dynamically add an WordPress admin_notice
|
1559 |
-
var notice;
|
1560 |
-
if (!(notice = document.getElementById('advads-ajax-error'))) {
|
1561 |
-
notice = document.createElement('div');
|
1562 |
-
// IE does not support adding multiple classes in one statement.
|
1563 |
-
notice.classList.add('notice');
|
1564 |
-
notice.classList.add('notice-error');
|
1565 |
-
notice.classList.add('advads-admin-notice');
|
1566 |
-
notice.id = 'advads-ajax-error';
|
1567 |
-
|
1568 |
-
var heading = document.querySelector('div.wrap h1:first-of-type, div.wrap h2:first-of-type');
|
1569 |
-
heading.parentNode.insertBefore(notice, heading.nextSibling);
|
1570 |
-
heading.scrollIntoView();
|
1571 |
-
}
|
1572 |
-
|
1573 |
-
notice.innerHTML = '<p>' + window.advadstxt.ajax_error_message + '</p>';
|
1574 |
-
|
1575 |
-
// additionally log the request/response to the browser console
|
1576 |
-
console.log(request.method + ' request to ' + request.url + ' with payload ' + JSON.stringify(request.payload) + ' errored with status: ' + request.status + ' and responded ' + JSON.stringify(request.response));
|
1577 |
-
}
|
1578 |
-
};
|
1579 |
-
|
1580 |
-
// hook into the XHR send to intercept the request data
|
1581 |
-
XMLHttpRequest.prototype.send = function (data) {
|
1582 |
-
if (typeof data === 'string' || data instanceof String) {
|
1583 |
-
request.payload = JSON.parse('{"' + decodeURI(data).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g, '":"') + '"}');
|
1584 |
-
} else {
|
1585 |
-
request.payload = data;
|
1586 |
-
}
|
1587 |
-
|
1588 |
-
// apply original
|
1589 |
-
send.apply(this, arguments);
|
1590 |
-
};
|
1591 |
-
|
1592 |
-
// hook into the XHR open to intercept the response and handle if it errors
|
1593 |
-
XMLHttpRequest.prototype.open = function (method, url) {
|
1594 |
-
request.method = method;
|
1595 |
-
request.url = url;
|
1596 |
-
|
1597 |
-
this.addEventListener('load', function (event) {
|
1598 |
-
// Server errors do not trigger the error event but a load event with a status different than 200
|
1599 |
-
if (this.status !== 200) {
|
1600 |
-
handleError(event.target);
|
1601 |
-
}
|
1602 |
-
});
|
1603 |
-
this.addEventListener('error', handleError);
|
1604 |
-
|
1605 |
-
// apply original
|
1606 |
-
open.apply(this, arguments);
|
1607 |
-
};
|
1608 |
-
})();
|
1523 |
class AdvancedAdsExternalAdUnit {
|
1524 |
|
1525 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
admin/class-advanced-ads-admin.php
CHANGED
@@ -11,13 +11,11 @@
|
|
11 |
* Plugin class. This class should ideally be used to work with the
|
12 |
* administrative side of the WordPress site.
|
13 |
*/
|
14 |
-
|
15 |
class Advanced_Ads_Admin {
|
16 |
|
17 |
/**
|
18 |
* Instance of this class.
|
19 |
*
|
20 |
-
* @since 1.0.0
|
21 |
* @var object
|
22 |
*/
|
23 |
protected static $instance = null;
|
@@ -25,23 +23,20 @@ class Advanced_Ads_Admin {
|
|
25 |
/**
|
26 |
* Instance of admin notice class.
|
27 |
*
|
28 |
-
* @
|
29 |
-
* @var object
|
30 |
*/
|
31 |
protected $notices = null;
|
32 |
|
33 |
/**
|
34 |
* Slug of the settings page
|
35 |
*
|
36 |
-
* @
|
37 |
-
* @var string
|
38 |
*/
|
39 |
public $plugin_screen_hook_suffix = null;
|
40 |
|
41 |
/**
|
42 |
* General plugin slug
|
43 |
*
|
44 |
-
* @since 1.0.0
|
45 |
* @var string
|
46 |
*/
|
47 |
protected $plugin_slug = '';
|
@@ -49,8 +44,6 @@ class Advanced_Ads_Admin {
|
|
49 |
/**
|
50 |
* Initialize the plugin by loading admin scripts & styles and adding a
|
51 |
* settings page and menu.
|
52 |
-
*
|
53 |
-
* @since 1.0.0
|
54 |
*/
|
55 |
private function __construct() {
|
56 |
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
@@ -75,7 +68,6 @@ class Advanced_Ads_Admin {
|
|
75 |
*
|
76 |
* @return mixed 1 on success or string with error message.
|
77 |
* @since version 1.7.16 (early January 2017)
|
78 |
-
*
|
79 |
*/
|
80 |
public function deactivate_license( $addon = '', $plugin_name = '', $options_slug = '' ) {
|
81 |
return Advanced_Ads_Admin_Licenses::get_instance()->deactivate_license( $addon, $plugin_name, $options_slug );
|
@@ -96,10 +88,7 @@ class Advanced_Ads_Admin {
|
|
96 |
* Actions and filter available after all plugins are initialized.
|
97 |
*/
|
98 |
public function wp_plugins_loaded() {
|
99 |
-
|
100 |
-
* Call $plugin_slug from public plugin class.
|
101 |
-
*
|
102 |
-
*/
|
103 |
$plugin = Advanced_Ads::get_instance();
|
104 |
$this->plugin_slug = $plugin->get_plugin_slug();
|
105 |
|
@@ -152,8 +141,6 @@ class Advanced_Ads_Admin {
|
|
152 |
* Return an instance of this class.
|
153 |
*
|
154 |
* @return object A single instance of this class.
|
155 |
-
* @since 1.0.0
|
156 |
-
*
|
157 |
*/
|
158 |
public static function get_instance() {
|
159 |
// If the single instance hasn't been set, set it now.
|
@@ -184,8 +171,6 @@ class Advanced_Ads_Admin {
|
|
184 |
|
185 |
/**
|
186 |
* Register and enqueue admin-specific style sheet.
|
187 |
-
*
|
188 |
-
* @since 1.0.0
|
189 |
*/
|
190 |
public function enqueue_admin_styles() {
|
191 |
wp_enqueue_style( $this->plugin_slug . '-admin-styles', plugins_url( 'assets/css/admin.css', __FILE__ ), array(), ADVADS_VERSION );
|
@@ -197,8 +182,6 @@ class Advanced_Ads_Admin {
|
|
197 |
|
198 |
/**
|
199 |
* Register and enqueue admin-specific JavaScript.
|
200 |
-
*
|
201 |
-
* @since 1.0.0
|
202 |
*/
|
203 |
public function enqueue_admin_scripts() {
|
204 |
|
@@ -246,9 +229,9 @@ class Advanced_Ads_Admin {
|
|
246 |
'hide_inactive_ads' => __( 'Hide inactive ads', 'advanced-ads' ),
|
247 |
'display_conditions_form_name' => Advanced_Ads_Display_Conditions::FORM_NAME, // not meant for translation.
|
248 |
'ajax_error_message' => __( 'There has been an AJAX error caused by another plugin.', 'advanced-ads' )
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
);
|
253 |
|
254 |
wp_localize_script( $this->plugin_slug . '-admin-script', 'advadstxt', $translation_array );
|
@@ -274,7 +257,6 @@ class Advanced_Ads_Admin {
|
|
274 |
* Check if the current screen belongs to Advanced Ads
|
275 |
*
|
276 |
* @return bool true if screen belongs to Advanced Ads
|
277 |
-
* @since 1.6.6
|
278 |
*/
|
279 |
public static function screen_belongs_to_advanced_ads() {
|
280 |
|
@@ -288,7 +270,8 @@ class Advanced_Ads_Admin {
|
|
288 |
}
|
289 |
|
290 |
$advads_pages = apply_filters(
|
291 |
-
'advanced-ads-dashboard-screens',
|
|
|
292 |
'advanced-ads_page_advanced-ads-groups', // ad groups.
|
293 |
'edit-advanced_ads', // ads overview.
|
294 |
'advanced_ads', // ad edit page.
|
@@ -310,8 +293,6 @@ class Advanced_Ads_Admin {
|
|
310 |
|
311 |
/**
|
312 |
* Get action from the params
|
313 |
-
*
|
314 |
-
* @since 1.0.0
|
315 |
*/
|
316 |
public function current_action() {
|
317 |
$request = wp_unslash( $_REQUEST );
|
@@ -338,7 +319,7 @@ class Advanced_Ads_Admin {
|
|
338 |
|
339 |
$gmt = '';
|
340 |
if ( $gmt_offset ) {
|
341 |
-
$gmt
|
342 |
$time_zone = date_create( '2017-10-01T12:00:00' . $gmt )->getTimezone();
|
343 |
}
|
344 |
}
|
@@ -347,9 +328,11 @@ class Advanced_Ads_Admin {
|
|
347 |
}
|
348 |
|
349 |
/**
|
350 |
-
*
|
351 |
*
|
352 |
* @param DateTimeZone $date_time_zone the DateTimeZone object to get literal value from.
|
|
|
|
|
353 |
*/
|
354 |
public static function timezone_get_name( $date_time_zone ) {
|
355 |
if ( $date_time_zone instanceof DateTimeZone ) {
|
@@ -377,21 +360,19 @@ class Advanced_Ads_Admin {
|
|
377 |
public function register_admin_notices() {
|
378 |
|
379 |
/**
|
380 |
-
*
|
381 |
* - we need to use this or some users have half or more of their viewports cluttered with unrelated notices
|
382 |
*/
|
383 |
if ( $this->screen_belongs_to_advanced_ads() ) {
|
384 |
remove_all_actions( 'admin_notices' );
|
385 |
}
|
386 |
|
387 |
-
// register our own notices
|
388 |
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
|
389 |
}
|
390 |
|
391 |
/**
|
392 |
* Initiate the admin notices class
|
393 |
-
*
|
394 |
-
* @since 1.5.3
|
395 |
*/
|
396 |
public function admin_notices() {
|
397 |
// display ad block warning to everyone who can edit ads.
|
@@ -410,8 +391,8 @@ class Advanced_Ads_Admin {
|
|
410 |
// register our own notices on Advanced Ads pages, except from the overview page where they should appear in the notices section.
|
411 |
$screen = get_current_screen();
|
412 |
if ( class_exists( 'Advanced_Ads_Admin_Notices' )
|
413 |
-
|
414 |
-
|
415 |
$this->notices = Advanced_Ads_Admin_Notices::get_instance()->notices;
|
416 |
Advanced_Ads_Admin_Notices::get_instance()->display_notices();
|
417 |
|
@@ -423,10 +404,9 @@ class Advanced_Ads_Admin {
|
|
423 |
/**
|
424 |
* Add links to the plugins list
|
425 |
*
|
426 |
-
* @param
|
427 |
*
|
428 |
* @return array $links
|
429 |
-
* @since 1.6.14
|
430 |
*/
|
431 |
public function add_plugin_links( $links ) {
|
432 |
|
@@ -503,15 +483,15 @@ class Advanced_Ads_Admin {
|
|
503 |
$from = isset( $form['advanced_ads_disable_from'] ) ? $form['advanced_ads_disable_from'] : '';
|
504 |
// the user clicked on the "don’t disable" button or if an address is given in the form then use that one.
|
505 |
if ( isset( $form['advanced_ads_disable_reason'] )
|
506 |
-
|
507 |
-
|
508 |
$email = isset( $form['advanced_ads_disable_reply_email'] ) ? trim( $form['advanced_ads_disable_reply_email'] ) : $current_user->email;
|
509 |
$current_user = wp_get_current_user();
|
510 |
$name = ( $current_user instanceof WP_User ) ? $current_user->user_nicename : '';
|
511 |
$from = $name . ' <' . $email . '>';
|
512 |
-
$is_german = ( preg_match( '/\.de$/', $from ) ||
|
513 |
if ( isset( $form['advanced_ads_disable_text'][0] )
|
514 |
-
|
515 |
// send German text
|
516 |
if ( $is_german ) {
|
517 |
$text .= "\n\n Hilfe ist auf dem Weg.";
|
@@ -569,7 +549,7 @@ class Advanced_Ads_Admin {
|
|
569 |
* @param array $a array to be compared.
|
570 |
* @param array $b array to be compared.
|
571 |
*
|
572 |
-
* @
|
573 |
*/
|
574 |
public static function sort_condition_array_by_label( $a, $b ) {
|
575 |
if ( ! isset( $a['label'] ) || ! isset( $b['label'] ) ) {
|
@@ -582,9 +562,11 @@ class Advanced_Ads_Admin {
|
|
582 |
/**
|
583 |
* Recommend additional add-ons
|
584 |
*
|
585 |
-
* @param object
|
586 |
-
* @param
|
587 |
-
* @param object
|
|
|
|
|
588 |
*/
|
589 |
public function recommend_suitable_add_ons( $result, $action, $args ) {
|
590 |
if ( empty( $args->browse ) ) {
|
@@ -601,7 +583,7 @@ class Advanced_Ads_Admin {
|
|
601 |
|
602 |
// Recommend AdSense In-Feed add-on.
|
603 |
if ( ! is_plugin_active( 'advanced-ads-adsense-in-feed/advanced-ads-in-feed.php' )
|
604 |
-
|
605 |
|
606 |
// Grab all slugs from the api results.
|
607 |
$result_slugs = wp_list_pluck( $result->plugins, 'slug' );
|
@@ -632,8 +614,8 @@ class Advanced_Ads_Admin {
|
|
632 |
|
633 |
// Recommend Genesis Ads add-on.
|
634 |
if ( defined( 'PARENT_THEME_NAME' ) && 'Genesis' === PARENT_THEME_NAME
|
635 |
-
|
636 |
-
|
637 |
|
638 |
// Grab all slugs from the api results.
|
639 |
$result_slugs = wp_list_pluck( $result->plugins, 'slug' );
|
@@ -664,8 +646,8 @@ class Advanced_Ads_Admin {
|
|
664 |
|
665 |
// Recommend WP Bakery (former Visual Composer) add-on.
|
666 |
if ( defined( 'WPB_VC_VERSION' )
|
667 |
-
|
668 |
-
|
669 |
|
670 |
// Grab all slugs from the api results.
|
671 |
$result_slugs = wp_list_pluck( $result->plugins, 'slug' );
|
@@ -730,8 +712,6 @@ class Advanced_Ads_Admin {
|
|
730 |
|
731 |
check_admin_referer( 'advanced-ads-starter-setup' );
|
732 |
|
733 |
-
// remove_query_arg( 'inject-ad-setup' );
|
734 |
-
|
735 |
// start importing the ads.
|
736 |
$xml = file_get_contents( ADVADS_BASE_PATH . 'admin/assets/xml/starter-setup.xml' );
|
737 |
|
11 |
* Plugin class. This class should ideally be used to work with the
|
12 |
* administrative side of the WordPress site.
|
13 |
*/
|
|
|
14 |
class Advanced_Ads_Admin {
|
15 |
|
16 |
/**
|
17 |
* Instance of this class.
|
18 |
*
|
|
|
19 |
* @var object
|
20 |
*/
|
21 |
protected static $instance = null;
|
23 |
/**
|
24 |
* Instance of admin notice class.
|
25 |
*
|
26 |
+
* @var object $notices
|
|
|
27 |
*/
|
28 |
protected $notices = null;
|
29 |
|
30 |
/**
|
31 |
* Slug of the settings page
|
32 |
*
|
33 |
+
* @var string $plugin_screen_hook_suffix
|
|
|
34 |
*/
|
35 |
public $plugin_screen_hook_suffix = null;
|
36 |
|
37 |
/**
|
38 |
* General plugin slug
|
39 |
*
|
|
|
40 |
* @var string
|
41 |
*/
|
42 |
protected $plugin_slug = '';
|
44 |
/**
|
45 |
* Initialize the plugin by loading admin scripts & styles and adding a
|
46 |
* settings page and menu.
|
|
|
|
|
47 |
*/
|
48 |
private function __construct() {
|
49 |
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
68 |
*
|
69 |
* @return mixed 1 on success or string with error message.
|
70 |
* @since version 1.7.16 (early January 2017)
|
|
|
71 |
*/
|
72 |
public function deactivate_license( $addon = '', $plugin_name = '', $options_slug = '' ) {
|
73 |
return Advanced_Ads_Admin_Licenses::get_instance()->deactivate_license( $addon, $plugin_name, $options_slug );
|
88 |
* Actions and filter available after all plugins are initialized.
|
89 |
*/
|
90 |
public function wp_plugins_loaded() {
|
91 |
+
// call $plugin_slug from public plugin class.
|
|
|
|
|
|
|
92 |
$plugin = Advanced_Ads::get_instance();
|
93 |
$this->plugin_slug = $plugin->get_plugin_slug();
|
94 |
|
141 |
* Return an instance of this class.
|
142 |
*
|
143 |
* @return object A single instance of this class.
|
|
|
|
|
144 |
*/
|
145 |
public static function get_instance() {
|
146 |
// If the single instance hasn't been set, set it now.
|
171 |
|
172 |
/**
|
173 |
* Register and enqueue admin-specific style sheet.
|
|
|
|
|
174 |
*/
|
175 |
public function enqueue_admin_styles() {
|
176 |
wp_enqueue_style( $this->plugin_slug . '-admin-styles', plugins_url( 'assets/css/admin.css', __FILE__ ), array(), ADVADS_VERSION );
|
182 |
|
183 |
/**
|
184 |
* Register and enqueue admin-specific JavaScript.
|
|
|
|
|
185 |
*/
|
186 |
public function enqueue_admin_scripts() {
|
187 |
|
229 |
'hide_inactive_ads' => __( 'Hide inactive ads', 'advanced-ads' ),
|
230 |
'display_conditions_form_name' => Advanced_Ads_Display_Conditions::FORM_NAME, // not meant for translation.
|
231 |
'ajax_error_message' => __( 'There has been an AJAX error caused by another plugin.', 'advanced-ads' )
|
232 |
+
. ' '
|
233 |
+
// translators: %1$s is an opening link tag, %2$s is a closing one.
|
234 |
+
. sprintf( __( 'Please contact our %1$ssupport%2$s.', 'advanced-ads' ), '<a href="' . Advanced_Ads_Plugin::support_url( '#utm_source=advanced-ads&utm_medium=link&utm_campaign=broken-ajax' ) . '/" target="_blank">', '</a>' ),
|
235 |
);
|
236 |
|
237 |
wp_localize_script( $this->plugin_slug . '-admin-script', 'advadstxt', $translation_array );
|
257 |
* Check if the current screen belongs to Advanced Ads
|
258 |
*
|
259 |
* @return bool true if screen belongs to Advanced Ads
|
|
|
260 |
*/
|
261 |
public static function screen_belongs_to_advanced_ads() {
|
262 |
|
270 |
}
|
271 |
|
272 |
$advads_pages = apply_filters(
|
273 |
+
'advanced-ads-dashboard-screens',
|
274 |
+
array(
|
275 |
'advanced-ads_page_advanced-ads-groups', // ad groups.
|
276 |
'edit-advanced_ads', // ads overview.
|
277 |
'advanced_ads', // ad edit page.
|
293 |
|
294 |
/**
|
295 |
* Get action from the params
|
|
|
|
|
296 |
*/
|
297 |
public function current_action() {
|
298 |
$request = wp_unslash( $_REQUEST );
|
319 |
|
320 |
$gmt = '';
|
321 |
if ( $gmt_offset ) {
|
322 |
+
$gmt .= $sign . zeroise( $int, 2 ) . ':' . zeroise( 60 * $frac, 2 );
|
323 |
$time_zone = date_create( '2017-10-01T12:00:00' . $gmt )->getTimezone();
|
324 |
}
|
325 |
}
|
328 |
}
|
329 |
|
330 |
/**
|
331 |
+
* Get literal expression of timezone
|
332 |
*
|
333 |
* @param DateTimeZone $date_time_zone the DateTimeZone object to get literal value from.
|
334 |
+
*
|
335 |
+
* @return string time zone.
|
336 |
*/
|
337 |
public static function timezone_get_name( $date_time_zone ) {
|
338 |
if ( $date_time_zone instanceof DateTimeZone ) {
|
360 |
public function register_admin_notices() {
|
361 |
|
362 |
/**
|
363 |
+
* Remove all registered admin_notices from AA screens
|
364 |
* - we need to use this or some users have half or more of their viewports cluttered with unrelated notices
|
365 |
*/
|
366 |
if ( $this->screen_belongs_to_advanced_ads() ) {
|
367 |
remove_all_actions( 'admin_notices' );
|
368 |
}
|
369 |
|
370 |
+
// register our own notices.
|
371 |
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
|
372 |
}
|
373 |
|
374 |
/**
|
375 |
* Initiate the admin notices class
|
|
|
|
|
376 |
*/
|
377 |
public function admin_notices() {
|
378 |
// display ad block warning to everyone who can edit ads.
|
391 |
// register our own notices on Advanced Ads pages, except from the overview page where they should appear in the notices section.
|
392 |
$screen = get_current_screen();
|
393 |
if ( class_exists( 'Advanced_Ads_Admin_Notices' )
|
394 |
+
&& current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads' ) )
|
395 |
+
&& ( ! isset( $screen->id ) || 'toplevel_page_advanced-ads' !== $screen->id ) ) {
|
396 |
$this->notices = Advanced_Ads_Admin_Notices::get_instance()->notices;
|
397 |
Advanced_Ads_Admin_Notices::get_instance()->display_notices();
|
398 |
|
404 |
/**
|
405 |
* Add links to the plugins list
|
406 |
*
|
407 |
+
* @param array $links array of links for the plugins, adapted when the current plugin is found.
|
408 |
*
|
409 |
* @return array $links
|
|
|
410 |
*/
|
411 |
public function add_plugin_links( $links ) {
|
412 |
|
483 |
$from = isset( $form['advanced_ads_disable_from'] ) ? $form['advanced_ads_disable_from'] : '';
|
484 |
// the user clicked on the "don’t disable" button or if an address is given in the form then use that one.
|
485 |
if ( isset( $form['advanced_ads_disable_reason'] )
|
486 |
+
&& 'get help' === $form['advanced_ads_disable_reason']
|
487 |
+
&& ! empty( $form['advanced_ads_disable_reply_email'] ) ) {
|
488 |
$email = isset( $form['advanced_ads_disable_reply_email'] ) ? trim( $form['advanced_ads_disable_reply_email'] ) : $current_user->email;
|
489 |
$current_user = wp_get_current_user();
|
490 |
$name = ( $current_user instanceof WP_User ) ? $current_user->user_nicename : '';
|
491 |
$from = $name . ' <' . $email . '>';
|
492 |
+
$is_german = ( preg_match( '/\.de$/', $from ) || 'de_' === substr( get_locale(), 0, 3 ) || 'de_' === substr( get_user_locale(), 0, 3 ) );
|
493 |
if ( isset( $form['advanced_ads_disable_text'][0] )
|
494 |
+
&& trim( $form['advanced_ads_disable_text'][0] ) !== '' ) { // is a text given then ask for help.
|
495 |
// send German text
|
496 |
if ( $is_german ) {
|
497 |
$text .= "\n\n Hilfe ist auf dem Weg.";
|
549 |
* @param array $a array to be compared.
|
550 |
* @param array $b array to be compared.
|
551 |
*
|
552 |
+
* @return mixed
|
553 |
*/
|
554 |
public static function sort_condition_array_by_label( $a, $b ) {
|
555 |
if ( ! isset( $a['label'] ) || ! isset( $b['label'] ) ) {
|
562 |
/**
|
563 |
* Recommend additional add-ons
|
564 |
*
|
565 |
+
* @param object|WP_Error $result Response object or WP_Error.
|
566 |
+
* @param string $action The type of information being requested from the Plugin Installation API.
|
567 |
+
* @param object $args Plugin API arguments.
|
568 |
+
*
|
569 |
+
* @return object|WP_Error Response object or WP_Error.
|
570 |
*/
|
571 |
public function recommend_suitable_add_ons( $result, $action, $args ) {
|
572 |
if ( empty( $args->browse ) ) {
|
583 |
|
584 |
// Recommend AdSense In-Feed add-on.
|
585 |
if ( ! is_plugin_active( 'advanced-ads-adsense-in-feed/advanced-ads-in-feed.php' )
|
586 |
+
&& ! is_plugin_active_for_network( 'advanced-ads-adsense-in-feed/advanced-ads-in-feed.php' ) ) {
|
587 |
|
588 |
// Grab all slugs from the api results.
|
589 |
$result_slugs = wp_list_pluck( $result->plugins, 'slug' );
|
614 |
|
615 |
// Recommend Genesis Ads add-on.
|
616 |
if ( defined( 'PARENT_THEME_NAME' ) && 'Genesis' === PARENT_THEME_NAME
|
617 |
+
&& ! is_plugin_active( 'advanced-ads-genesis/genesis-ads.php' )
|
618 |
+
&& ! is_plugin_active_for_network( 'advanced-ads-genesis/genesis-ads.php' ) ) {
|
619 |
|
620 |
// Grab all slugs from the api results.
|
621 |
$result_slugs = wp_list_pluck( $result->plugins, 'slug' );
|
646 |
|
647 |
// Recommend WP Bakery (former Visual Composer) add-on.
|
648 |
if ( defined( 'WPB_VC_VERSION' )
|
649 |
+
&& ! is_plugin_active( 'ads-for-visual-composer/advanced-ads-vc.php' )
|
650 |
+
&& ! is_plugin_active_for_network( 'ads-for-visual-composer/advanced-ads-vc.php' ) ) {
|
651 |
|
652 |
// Grab all slugs from the api results.
|
653 |
$result_slugs = wp_list_pluck( $result->plugins, 'slug' );
|
712 |
|
713 |
check_admin_referer( 'advanced-ads-starter-setup' );
|
714 |
|
|
|
|
|
715 |
// start importing the ads.
|
716 |
$xml = file_get_contents( ADVADS_BASE_PATH . 'admin/assets/xml/starter-setup.xml' );
|
717 |
|
admin/includes/class-list-filters.php
CHANGED
@@ -5,7 +5,6 @@
|
|
5 |
* @package WordPress
|
6 |
* @subpackage Advanced Ads Plugin
|
7 |
*/
|
8 |
-
|
9 |
class Advanced_Ads_Ad_List_Filters {
|
10 |
/**
|
11 |
* The unique instance of this class.
|
@@ -113,8 +112,8 @@ class Advanced_Ads_Ad_List_Filters {
|
|
113 |
*/
|
114 |
foreach ( $groups_to_check as $key => $ads ) {
|
115 |
if ( ! isset( $all_filters['all_groups'][ $key ] ) // skip if this group is already known.
|
116 |
-
|
117 |
-
|
118 |
$all_filters['all_groups'][ $key ] = $this->all_groups[ $key ]['name'];
|
119 |
// remove groups that are already selected for the filter.
|
120 |
unset( $groups_to_check[ $key ] );
|
@@ -159,8 +158,8 @@ class Advanced_Ads_Ad_List_Filters {
|
|
159 |
}
|
160 |
|
161 |
if ( isset( $ad_option['type'] ) // could be missing for new ads that are stored only by WP auto-save.
|
162 |
-
|
163 |
-
|
164 |
) {
|
165 |
$all_filters['all_types'][ $ad_option['type'] ] = $advads->ad_types[ $ad_option['type'] ]->title;
|
166 |
}
|
@@ -424,10 +423,10 @@ class Advanced_Ads_Ad_List_Filters {
|
|
424 |
$term = $request['term'];
|
425 |
global $wpdb;
|
426 |
$q = 'SELECT `object_id` FROM `' . $wpdb->prefix . 'term_relationships` WHERE `term_taxonomy_id` = (' .
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
|
432 |
$q = $wpdb->prepare( $q, $term, Advanced_Ads::AD_GROUP_TAXONOMY );
|
433 |
|
5 |
* @package WordPress
|
6 |
* @subpackage Advanced Ads Plugin
|
7 |
*/
|
|
|
8 |
class Advanced_Ads_Ad_List_Filters {
|
9 |
/**
|
10 |
* The unique instance of this class.
|
112 |
*/
|
113 |
foreach ( $groups_to_check as $key => $ads ) {
|
114 |
if ( ! isset( $all_filters['all_groups'][ $key ] ) // skip if this group is already known.
|
115 |
+
&& in_array( $post->ID, $ads, true )
|
116 |
+
&& isset( $this->all_groups[ $key ] ) ) {
|
117 |
$all_filters['all_groups'][ $key ] = $this->all_groups[ $key ]['name'];
|
118 |
// remove groups that are already selected for the filter.
|
119 |
unset( $groups_to_check[ $key ] );
|
158 |
}
|
159 |
|
160 |
if ( isset( $ad_option['type'] ) // could be missing for new ads that are stored only by WP auto-save.
|
161 |
+
&& ! array_key_exists( $ad_option['type'], $all_filters['all_types'] )
|
162 |
+
&& isset( $advads->ad_types[ $ad_option['type'] ] )
|
163 |
) {
|
164 |
$all_filters['all_types'][ $ad_option['type'] ] = $advads->ad_types[ $ad_option['type'] ]->title;
|
165 |
}
|
423 |
$term = $request['term'];
|
424 |
global $wpdb;
|
425 |
$q = 'SELECT `object_id` FROM `' . $wpdb->prefix . 'term_relationships` WHERE `term_taxonomy_id` = (' .
|
426 |
+
'SELECT ' . $wpdb->prefix . 'terms.term_id FROM `' . $wpdb->prefix . 'terms` INNER JOIN ' .
|
427 |
+
$wpdb->prefix . 'term_taxonomy on ' . $wpdb->prefix . 'terms.term_id = ' . $wpdb->prefix . 'term_taxonomy.term_id ' .
|
428 |
+
'WHERE ' . $wpdb->prefix . 'terms.slug = %s AND ' . $wpdb->prefix . 'term_taxonomy.taxonomy = %s' .
|
429 |
+
')';
|
430 |
|
431 |
$q = $wpdb->prepare( $q, $term, Advanced_Ads::AD_GROUP_TAXONOMY );
|
432 |
|
admin/includes/class-menu.php
CHANGED
@@ -1,6 +1,9 @@
|
|
1 |
<?php
|
2 |
-
defined( 'ABSPATH'
|
3 |
|
|
|
|
|
|
|
4 |
class Advanced_Ads_Admin_Menu {
|
5 |
/**
|
6 |
* Instance of this class.
|
@@ -12,18 +15,20 @@ class Advanced_Ads_Admin_Menu {
|
|
12 |
/**
|
13 |
* Slug of the ad group page
|
14 |
*
|
15 |
-
* @since 1.0.0
|
16 |
* @var string
|
17 |
*/
|
18 |
protected $ad_group_hook_suffix = null;
|
19 |
|
|
|
|
|
|
|
20 |
private function __construct() {
|
21 |
-
//
|
22 |
-
add_action( 'admin_menu', array($this, 'add_plugin_admin_menu') );
|
23 |
add_action( 'admin_head', array( $this, 'highlight_menu_item' ) );
|
24 |
|
25 |
$this->plugin_slug = Advanced_Ads::get_instance()->get_plugin_slug();
|
26 |
-
$this->post_type
|
27 |
}
|
28 |
|
29 |
/**
|
@@ -33,8 +38,8 @@ class Advanced_Ads_Admin_Menu {
|
|
33 |
*/
|
34 |
public static function get_instance() {
|
35 |
// If the single instance hasn't been set, set it now.
|
36 |
-
if ( null
|
37 |
-
self::$instance = new self;
|
38 |
}
|
39 |
|
40 |
return self::$instance;
|
@@ -48,111 +53,157 @@ class Advanced_Ads_Admin_Menu {
|
|
48 |
public function add_plugin_admin_menu() {
|
49 |
|
50 |
$has_ads = Advanced_Ads::get_number_of_ads();
|
51 |
-
|
52 |
-
// get number of
|
53 |
$notices = Advanced_Ads_Ad_Health_Notices::get_number_of_notices();
|
54 |
-
|
55 |
-
|
56 |
-
|
|
|
|
|
57 |
add_menu_page(
|
58 |
-
__( 'Overview', 'advanced-ads' ),
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
62 |
);
|
63 |
}
|
64 |
// forward Ads link to new-ad page when there is no ad existing yet.
|
65 |
-
// the target to post-new.php needs the extra "new" or any other attribute, since the original add-ad link was removed by CSS using the exact href attribute as a selector
|
66 |
$target = ( ! $has_ads ) ? 'post-new.php?post_type=' . Advanced_Ads::POST_TYPE_SLUG . '&new=new' : 'edit.php?post_type=' . Advanced_Ads::POST_TYPE_SLUG;
|
67 |
add_submenu_page(
|
68 |
-
$this->plugin_slug,
|
|
|
|
|
|
|
|
|
69 |
);
|
70 |
-
|
71 |
-
// display the main overview page as second item when we don’t have ads yet
|
72 |
-
if( ! $has_ads ){
|
73 |
add_menu_page(
|
74 |
-
__( 'Overview', 'advanced-ads' ),
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
);
|
76 |
|
77 |
add_submenu_page(
|
78 |
-
$this->plugin_slug,
|
|
|
|
|
|
|
|
|
|
|
79 |
);
|
80 |
}
|
81 |
|
82 |
-
// hidden by css; not placed in 'options.php' in order to highlight the correct item, see the 'highlight_menu_item()'
|
83 |
if ( ! current_user_can( 'edit_posts' ) ) {
|
84 |
add_submenu_page(
|
85 |
-
$this->plugin_slug,
|
|
|
|
|
|
|
|
|
86 |
);
|
87 |
}
|
88 |
|
89 |
$this->ad_group_hook_suffix = add_submenu_page(
|
90 |
-
$this->plugin_slug,
|
|
|
|
|
|
|
|
|
|
|
91 |
);
|
92 |
|
93 |
-
// add placements page
|
94 |
add_submenu_page(
|
95 |
-
$this->plugin_slug,
|
|
|
|
|
|
|
|
|
|
|
96 |
);
|
97 |
-
// add settings page
|
98 |
Advanced_Ads_Admin::get_instance()->plugin_screen_hook_suffix = add_submenu_page(
|
99 |
-
$this->plugin_slug,
|
|
|
|
|
|
|
|
|
|
|
100 |
);
|
101 |
-
|
102 |
-
/*add_submenu_page(
|
103 |
-
$this->plugin_slug, __( 'Support', 'advanced-ads' ), __( 'Support', 'advanced-ads' ), Advanced_Ads_Plugin::user_cap( 'advanced_ads_manage_options'), $this->plugin_slug . '-support', array($this, 'display_support_page')
|
104 |
-
);*/
|
105 |
-
|
106 |
/**
|
107 |
-
*
|
108 |
* could break if WordPress changes the API at one point, but it didn’t do that for many years
|
109 |
*/
|
110 |
global $submenu;
|
111 |
-
if(current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_manage_options') ) ){
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
|
|
|
|
117 |
);
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
/*if( $has_ads ){
|
124 |
-
$submenu['advanced-ads'][0][0] .= ' <span class="update-plugins count-' . $notices. '"><span class="update-count">' . $notices . '</span></span>';
|
125 |
} else {
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
|
|
|
|
|
|
|
|
130 |
$submenu['advanced-ads'][] = array(
|
131 |
-
__('Licenses', 'advanced-ads' ) // title
|
132 |
. ' <span class="update-plugins count-1"><span class="update-count">!</span></span>',
|
133 |
-
Advanced_Ads_Plugin::user_cap( 'advanced_ads_manage_options'), // capability
|
134 |
admin_url( 'admin.php?page=advanced-ads-settings#top#licenses' ),
|
135 |
-
__('Licenses', 'advanced-ads' ), // not sure what this is, but it is in the API
|
136 |
);
|
137 |
}
|
138 |
}
|
139 |
|
140 |
-
add_filter(
|
141 |
-
|
142 |
-
|
|
|
|
|
|
|
143 |
|
144 |
-
// allows extensions to insert sub menu pages
|
145 |
do_action( 'advanced-ads-submenu-pages', $this->plugin_slug );
|
146 |
}
|
147 |
|
148 |
/**
|
149 |
* Highlights the 'Advanced Ads->Ads' item in the menu when an ad edit page is open
|
|
|
150 |
* @see the 'parent_file' and the 'submenu_file' filters for reference
|
151 |
*/
|
152 |
public function highlight_menu_item() {
|
153 |
global $parent_file, $submenu_file, $post_type;
|
154 |
if ( $post_type === $this->post_type ) {
|
155 |
-
|
|
|
|
|
|
|
156 |
$submenu_file = 'edit.php?post_type=' . $this->post_type;
|
157 |
}
|
158 |
}
|
@@ -183,11 +234,11 @@ class Advanced_Ads_Admin_Menu {
|
|
183 |
*/
|
184 |
public function display_placements_page() {
|
185 |
$placement_types = Advanced_Ads_Placements::get_placement_types();
|
186 |
-
$placements
|
|
|
187 |
$items = Advanced_Ads_Placements::items_for_select();
|
188 |
-
// load ads and groups for select field
|
189 |
|
190 |
-
// display view
|
191 |
include ADVADS_BASE_PATH . 'admin/views/placements.php';
|
192 |
}
|
193 |
|
@@ -208,74 +259,72 @@ class Advanced_Ads_Admin_Menu {
|
|
208 |
*/
|
209 |
public function ad_group_admin_page() {
|
210 |
|
211 |
-
$taxonomy
|
212 |
$post_type = Advanced_Ads::POST_TYPE_SLUG;
|
213 |
-
$tax
|
214 |
|
215 |
$action = Advanced_Ads_Admin::get_instance()->current_action();
|
216 |
|
217 |
-
// handle new and updated groups
|
218 |
-
if ( 'editedgroup'
|
219 |
$group_id = (int) $_POST['group_id'];
|
220 |
check_admin_referer( 'update-group_' . $group_id );
|
221 |
|
222 |
if ( ! current_user_can( $tax->cap->edit_terms ) ) {
|
223 |
-
wp_die(
|
224 |
|
225 |
-
// handle new groups
|
226 |
-
if ( 0
|
227 |
$ret = wp_insert_term( $_POST['name'], $taxonomy, $_POST );
|
228 |
if ( $ret && ! is_wp_error( $ret ) ) {
|
229 |
-
$forced_message = 1; }
|
230 |
-
else {
|
231 |
$forced_message = 4; }
|
232 |
-
|
233 |
} else {
|
234 |
$tag = get_term( $group_id, $taxonomy );
|
235 |
if ( ! $tag ) {
|
236 |
-
wp_die(
|
237 |
|
238 |
$ret = wp_update_term( $group_id, $taxonomy, $_POST );
|
239 |
if ( $ret && ! is_wp_error( $ret ) ) {
|
240 |
-
$forced_message = 3; }
|
241 |
-
else {
|
242 |
$forced_message = 5; }
|
243 |
}
|
244 |
-
// deleting items
|
245 |
-
} elseif (
|
246 |
$group_id = (int) $_REQUEST['group_id'];
|
247 |
check_admin_referer( 'delete-tag_' . $group_id );
|
248 |
|
249 |
if ( ! current_user_can( $tax->cap->delete_terms ) ) {
|
250 |
-
wp_die(
|
251 |
|
252 |
wp_delete_term( $group_id, $taxonomy );
|
253 |
-
//
|
254 |
-
Advanced_Ads_Group::delete_ad_weights($group_id);
|
255 |
|
256 |
$forced_message = 2;
|
257 |
}
|
258 |
|
259 |
-
// handle views
|
260 |
switch ( $action ) {
|
261 |
-
case 'edit'
|
262 |
$title = $tax->labels->edit_item;
|
263 |
-
if ( isset($_REQUEST['group_id']) ) {
|
264 |
$group_id = absint( $_REQUEST['group_id'] );
|
265 |
-
$tag
|
266 |
} else {
|
267 |
$group_id = 0;
|
268 |
-
$tag
|
269 |
}
|
270 |
|
271 |
include ADVADS_BASE_PATH . 'admin/views/ad-group-edit.php';
|
272 |
break;
|
273 |
|
274 |
-
default
|
275 |
-
$title
|
276 |
$wp_list_table = _get_list_table( 'WP_Terms_List_Table' );
|
277 |
|
278 |
-
// load template
|
279 |
include ADVADS_BASE_PATH . 'admin/views/ad-group.php';
|
280 |
}
|
281 |
}
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || exit;
|
3 |
|
4 |
+
/**
|
5 |
+
* Class Advanced_Ads_Admin_Menu
|
6 |
+
*/
|
7 |
class Advanced_Ads_Admin_Menu {
|
8 |
/**
|
9 |
* Instance of this class.
|
15 |
/**
|
16 |
* Slug of the ad group page
|
17 |
*
|
|
|
18 |
* @var string
|
19 |
*/
|
20 |
protected $ad_group_hook_suffix = null;
|
21 |
|
22 |
+
/**
|
23 |
+
* Advanced_Ads_Admin_Menu constructor.
|
24 |
+
*/
|
25 |
private function __construct() {
|
26 |
+
// add menu items.
|
27 |
+
add_action( 'admin_menu', array( $this, 'add_plugin_admin_menu' ) );
|
28 |
add_action( 'admin_head', array( $this, 'highlight_menu_item' ) );
|
29 |
|
30 |
$this->plugin_slug = Advanced_Ads::get_instance()->get_plugin_slug();
|
31 |
+
$this->post_type = constant( 'Advanced_Ads::POST_TYPE_SLUG' );
|
32 |
}
|
33 |
|
34 |
/**
|
38 |
*/
|
39 |
public static function get_instance() {
|
40 |
// If the single instance hasn't been set, set it now.
|
41 |
+
if ( null === self::$instance ) {
|
42 |
+
self::$instance = new self();
|
43 |
}
|
44 |
|
45 |
return self::$instance;
|
53 |
public function add_plugin_admin_menu() {
|
54 |
|
55 |
$has_ads = Advanced_Ads::get_number_of_ads();
|
56 |
+
|
57 |
+
// get number of Ad Health notices.
|
58 |
$notices = Advanced_Ads_Ad_Health_Notices::get_number_of_notices();
|
59 |
+
// string for Ad Health notice number.
|
60 |
+
$notice_alert = ' <span class="update-plugins count-' . $notices . '"><span class="update-count">' . $notices . '</span></span>';
|
61 |
+
|
62 |
+
// use the overview page only when there is an ad already.
|
63 |
+
if ( $has_ads ) {
|
64 |
add_menu_page(
|
65 |
+
__( 'Overview', 'advanced-ads' ),
|
66 |
+
'Advanced Ads',
|
67 |
+
Advanced_Ads_Plugin::user_cap( 'advanced_ads_see_interface' ),
|
68 |
+
$this->plugin_slug,
|
69 |
+
array( $this, 'display_overview_page' ),
|
70 |
+
'dashicons-chart-line',
|
71 |
+
'58.74'
|
72 |
);
|
73 |
}
|
74 |
// forward Ads link to new-ad page when there is no ad existing yet.
|
75 |
+
// the target to post-new.php needs the extra "new" or any other attribute, since the original add-ad link was removed by CSS using the exact href attribute as a selector.
|
76 |
$target = ( ! $has_ads ) ? 'post-new.php?post_type=' . Advanced_Ads::POST_TYPE_SLUG . '&new=new' : 'edit.php?post_type=' . Advanced_Ads::POST_TYPE_SLUG;
|
77 |
add_submenu_page(
|
78 |
+
$this->plugin_slug,
|
79 |
+
__( 'Ads', 'advanced-ads' ),
|
80 |
+
__( 'Ads', 'advanced-ads' ),
|
81 |
+
Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads' ),
|
82 |
+
$target
|
83 |
);
|
84 |
+
|
85 |
+
// display the main overview page as second item when we don’t have ads yet.
|
86 |
+
if ( ! $has_ads ) {
|
87 |
add_menu_page(
|
88 |
+
__( 'Overview', 'advanced-ads' ),
|
89 |
+
'Advanced Ads',
|
90 |
+
Advanced_Ads_Plugin::user_cap( 'advanced_ads_see_interface' ),
|
91 |
+
$this->plugin_slug,
|
92 |
+
array( $this, 'display_overview_page' ),
|
93 |
+
'dashicons-chart-line',
|
94 |
+
'58.74'
|
95 |
);
|
96 |
|
97 |
add_submenu_page(
|
98 |
+
$this->plugin_slug,
|
99 |
+
__( 'Overview', 'advanced-ads' ),
|
100 |
+
__( 'Overview', 'advanced-ads' ),
|
101 |
+
Advanced_Ads_Plugin::user_cap( 'advanced_ads_see_interface' ),
|
102 |
+
$this->plugin_slug,
|
103 |
+
array( $this, 'display_overview_page' )
|
104 |
);
|
105 |
}
|
106 |
|
107 |
+
// hidden by css; not placed in 'options.php' in order to highlight the correct item, see the 'highlight_menu_item()'.
|
108 |
if ( ! current_user_can( 'edit_posts' ) ) {
|
109 |
add_submenu_page(
|
110 |
+
$this->plugin_slug,
|
111 |
+
__( 'Add New Ad', 'advanced-ads' ),
|
112 |
+
__( 'New Ad', 'advanced-ads' ),
|
113 |
+
Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads' ),
|
114 |
+
'post-new.php?post_type=' . Advanced_Ads::POST_TYPE_SLUG
|
115 |
);
|
116 |
}
|
117 |
|
118 |
$this->ad_group_hook_suffix = add_submenu_page(
|
119 |
+
$this->plugin_slug,
|
120 |
+
__( 'Ad Groups & Rotations', 'advanced-ads' ),
|
121 |
+
__( 'Groups & Rotation', 'advanced-ads' ),
|
122 |
+
Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads' ),
|
123 |
+
$this->plugin_slug . '-groups',
|
124 |
+
array( $this, 'ad_group_admin_page' )
|
125 |
);
|
126 |
|
127 |
+
// add placements page.
|
128 |
add_submenu_page(
|
129 |
+
$this->plugin_slug,
|
130 |
+
__( 'Ad Placements', 'advanced-ads' ),
|
131 |
+
__( 'Placements', 'advanced-ads' ),
|
132 |
+
Advanced_Ads_Plugin::user_cap( 'advanced_ads_manage_placements' ),
|
133 |
+
$this->plugin_slug . '-placements',
|
134 |
+
array( $this, 'display_placements_page' )
|
135 |
);
|
136 |
+
// add settings page.
|
137 |
Advanced_Ads_Admin::get_instance()->plugin_screen_hook_suffix = add_submenu_page(
|
138 |
+
$this->plugin_slug,
|
139 |
+
__( 'Advanced Ads Settings', 'advanced-ads' ),
|
140 |
+
__( 'Settings', 'advanced-ads' ),
|
141 |
+
Advanced_Ads_Plugin::user_cap( 'advanced_ads_manage_options' ),
|
142 |
+
$this->plugin_slug . '-settings',
|
143 |
+
array( $this, 'display_plugin_settings_page' )
|
144 |
);
|
145 |
+
|
|
|
|
|
|
|
|
|
146 |
/**
|
147 |
+
* Since we forward the support link to the settings page, we need to add the menu item manually
|
148 |
* could break if WordPress changes the API at one point, but it didn’t do that for many years
|
149 |
*/
|
150 |
global $submenu;
|
151 |
+
if ( current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_manage_options' ) ) ) {
|
152 |
+
// we have to mute the phpcs warning about overriding superglobals since WordPress does not offer a better way to manipulate menu links.
|
153 |
+
// phpcs:ignore
|
154 |
+
$submenu['advanced-ads'][] = array(
|
155 |
+
__( 'Support', 'advanced-ads' ), // title.
|
156 |
+
Advanced_Ads_Plugin::user_cap( 'advanced_ads_manage_options' ), // capability.
|
157 |
+
admin_url( 'admin.php?page=advanced-ads-settings#top#support' ),
|
158 |
+
__( 'Support', 'advanced-ads' ), // not sure what this is, but it is in the API.
|
159 |
);
|
160 |
+
// manipulate the title of the overview submenu page and add error count.
|
161 |
+
if ( $has_ads ) {
|
162 |
+
// we have to mute the phpcs warning about overriding superglobals since WordPress does not offer a better way to manipulate menu links.
|
163 |
+
// phpcs:ignore
|
164 |
+
$submenu['advanced-ads'][0][0] .= $notice_alert;
|
|
|
|
|
165 |
} else {
|
166 |
+
// we have to mute the phpcs warning about overriding superglobals since WordPress does not offer a better way to manipulate menu links.
|
167 |
+
// phpcs:ignore
|
168 |
+
$submenu['advanced-ads'][1][0] .= $notice_alert;
|
169 |
+
}
|
170 |
+
// link to license tab if they are invalid.
|
171 |
+
if ( Advanced_Ads_Checks::licenses_invalid() ) {
|
172 |
+
// we have to mute the phpcs warning about overriding superglobals since WordPress does not offer a better way to manipulate menu links.
|
173 |
+
// phpcs:ignore
|
174 |
$submenu['advanced-ads'][] = array(
|
175 |
+
__( 'Licenses', 'advanced-ads' ) // title..
|
176 |
. ' <span class="update-plugins count-1"><span class="update-count">!</span></span>',
|
177 |
+
Advanced_Ads_Plugin::user_cap( 'advanced_ads_manage_options' ), // capability.
|
178 |
admin_url( 'admin.php?page=advanced-ads-settings#top#licenses' ),
|
179 |
+
__( 'Licenses', 'advanced-ads' ), // not sure what this is, but it is in the API.
|
180 |
);
|
181 |
}
|
182 |
}
|
183 |
|
184 |
+
add_filter(
|
185 |
+
'option_page_capability_' . ADVADS_SLUG,
|
186 |
+
function () {
|
187 |
+
return Advanced_Ads_Plugin::user_cap( 'advanced_ads_manage_options' );
|
188 |
+
}
|
189 |
+
);
|
190 |
|
191 |
+
// allows extensions to insert sub menu pages.
|
192 |
do_action( 'advanced-ads-submenu-pages', $this->plugin_slug );
|
193 |
}
|
194 |
|
195 |
/**
|
196 |
* Highlights the 'Advanced Ads->Ads' item in the menu when an ad edit page is open
|
197 |
+
*
|
198 |
* @see the 'parent_file' and the 'submenu_file' filters for reference
|
199 |
*/
|
200 |
public function highlight_menu_item() {
|
201 |
global $parent_file, $submenu_file, $post_type;
|
202 |
if ( $post_type === $this->post_type ) {
|
203 |
+
// we have to mute the phpcs warning about overriding superglobals since WordPress does not offer a better way to manipulate menu links.
|
204 |
+
// phpcs:ignore
|
205 |
+
$parent_file = $this->plugin_slug;
|
206 |
+
// phpcs:ignore
|
207 |
$submenu_file = 'edit.php?post_type=' . $this->post_type;
|
208 |
}
|
209 |
}
|
234 |
*/
|
235 |
public function display_placements_page() {
|
236 |
$placement_types = Advanced_Ads_Placements::get_placement_types();
|
237 |
+
$placements = Advanced_Ads::get_ad_placements_array(); // -TODO use model
|
238 |
+
// load ads and groups for select field.
|
239 |
$items = Advanced_Ads_Placements::items_for_select();
|
|
|
240 |
|
241 |
+
// display view.
|
242 |
include ADVADS_BASE_PATH . 'admin/views/placements.php';
|
243 |
}
|
244 |
|
259 |
*/
|
260 |
public function ad_group_admin_page() {
|
261 |
|
262 |
+
$taxonomy = Advanced_Ads::AD_GROUP_TAXONOMY;
|
263 |
$post_type = Advanced_Ads::POST_TYPE_SLUG;
|
264 |
+
$tax = get_taxonomy( $taxonomy );
|
265 |
|
266 |
$action = Advanced_Ads_Admin::get_instance()->current_action();
|
267 |
|
268 |
+
// handle new and updated groups.
|
269 |
+
if ( 'editedgroup' === $action ) {
|
270 |
$group_id = (int) $_POST['group_id'];
|
271 |
check_admin_referer( 'update-group_' . $group_id );
|
272 |
|
273 |
if ( ! current_user_can( $tax->cap->edit_terms ) ) {
|
274 |
+
wp_die( esc_html__( 'Sorry, you are not allowed to access this feature.', 'advanced-ads' ) ); }
|
275 |
|
276 |
+
// handle new groups.
|
277 |
+
if ( 0 === $group_id ) {
|
278 |
$ret = wp_insert_term( $_POST['name'], $taxonomy, $_POST );
|
279 |
if ( $ret && ! is_wp_error( $ret ) ) {
|
280 |
+
$forced_message = 1; } else {
|
|
|
281 |
$forced_message = 4; }
|
282 |
+
// handle group updates.
|
283 |
} else {
|
284 |
$tag = get_term( $group_id, $taxonomy );
|
285 |
if ( ! $tag ) {
|
286 |
+
wp_die( esc_html__( 'You attempted to edit an ad group that doesn’t exist. Perhaps it was deleted?', 'advanced-ads' ) ); }
|
287 |
|
288 |
$ret = wp_update_term( $group_id, $taxonomy, $_POST );
|
289 |
if ( $ret && ! is_wp_error( $ret ) ) {
|
290 |
+
$forced_message = 3; } else {
|
|
|
291 |
$forced_message = 5; }
|
292 |
}
|
293 |
+
// deleting items.
|
294 |
+
} elseif ( 'delete' === $action ) {
|
295 |
$group_id = (int) $_REQUEST['group_id'];
|
296 |
check_admin_referer( 'delete-tag_' . $group_id );
|
297 |
|
298 |
if ( ! current_user_can( $tax->cap->delete_terms ) ) {
|
299 |
+
wp_die( esc_html__( 'Sorry, you are not allowed to access this feature.', 'advanced-ads' ) ); }
|
300 |
|
301 |
wp_delete_term( $group_id, $taxonomy );
|
302 |
+
// delete the weights.
|
303 |
+
Advanced_Ads_Group::delete_ad_weights( $group_id );
|
304 |
|
305 |
$forced_message = 2;
|
306 |
}
|
307 |
|
308 |
+
// handle views.
|
309 |
switch ( $action ) {
|
310 |
+
case 'edit':
|
311 |
$title = $tax->labels->edit_item;
|
312 |
+
if ( isset( $_REQUEST['group_id'] ) ) {
|
313 |
$group_id = absint( $_REQUEST['group_id'] );
|
314 |
+
$tag = get_term( $group_id, $taxonomy, OBJECT, 'edit' );
|
315 |
} else {
|
316 |
$group_id = 0;
|
317 |
+
$tag = false;
|
318 |
}
|
319 |
|
320 |
include ADVADS_BASE_PATH . 'admin/views/ad-group-edit.php';
|
321 |
break;
|
322 |
|
323 |
+
default:
|
324 |
+
$title = $tax->labels->name;
|
325 |
$wp_list_table = _get_list_table( 'WP_Terms_List_Table' );
|
326 |
|
327 |
+
// load template.
|
328 |
include ADVADS_BASE_PATH . 'admin/views/ad-group.php';
|
329 |
}
|
330 |
}
|
admin/includes/class-meta-box.php
CHANGED
@@ -1,32 +1,36 @@
|
|
1 |
<?php
|
2 |
-
defined( 'ABSPATH'
|
3 |
|
|
|
|
|
|
|
4 |
class Advanced_Ads_Admin_Meta_Boxes {
|
5 |
/**
|
6 |
* Instance of this class.
|
7 |
*
|
8 |
-
* @var object
|
9 |
*/
|
10 |
protected static $instance = null;
|
11 |
|
12 |
/**
|
13 |
-
*
|
14 |
*
|
15 |
-
* @
|
16 |
-
* @var array
|
17 |
*/
|
18 |
protected $meta_box_ids = array();
|
19 |
|
20 |
-
|
|
|
|
|
21 |
private function __construct() {
|
22 |
add_action( 'add_meta_boxes_' . Advanced_Ads::POST_TYPE_SLUG, array( $this, 'add_meta_boxes' ) );
|
23 |
-
// add meta box for post types edit pages
|
24 |
add_action( 'add_meta_boxes', array( $this, 'add_post_meta_box' ) );
|
25 |
add_action( 'save_post', array( $this, 'save_post_meta_box' ) );
|
26 |
-
// register dashboard widget
|
27 |
-
add_action( 'wp_dashboard_setup', array($this, 'add_dashboard_widget') );
|
28 |
-
// fixes compatibility issue with WP QUADS PRO
|
29 |
-
add_action( 'quads_meta_box_post_types', array($this, 'fix_wpquadspro_issue'), 11 );
|
30 |
}
|
31 |
|
32 |
/**
|
@@ -36,8 +40,8 @@ class Advanced_Ads_Admin_Meta_Boxes {
|
|
36 |
*/
|
37 |
public static function get_instance() {
|
38 |
// If the single instance hasn't been set, set it now.
|
39 |
-
if ( null
|
40 |
-
self::$instance = new self;
|
41 |
}
|
42 |
|
43 |
return self::$instance;
|
@@ -52,81 +56,124 @@ class Advanced_Ads_Admin_Meta_Boxes {
|
|
52 |
$post_type = Advanced_Ads::POST_TYPE_SLUG;
|
53 |
|
54 |
add_meta_box(
|
55 |
-
'ad-main-box',
|
|
|
|
|
|
|
|
|
|
|
56 |
);
|
57 |
if ( Advanced_Ads_AdSense_Data::get_instance()->is_setup()
|
58 |
-
&& ! Advanced_Ads_AdSense_Data::get_instance()->is_hide_stats() ){
|
59 |
global $post_id;
|
60 |
-
if ($post_id){
|
61 |
$ad = new Advanced_Ads_Ad( $post_id );
|
62 |
|
63 |
-
|
64 |
-
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
}
|
68 |
}
|
69 |
-
// use dynamic filter from to add close class to ad type meta box after saved first time
|
70 |
add_filter( 'postbox_classes_advanced_ads_ad-main-box', array( $this, 'close_ad_type_metabox' ) );
|
71 |
|
72 |
add_meta_box(
|
73 |
-
'ad-parameters-box',
|
|
|
|
|
|
|
|
|
|
|
74 |
);
|
75 |
add_meta_box(
|
76 |
-
'ad-output-box',
|
|
|
|
|
|
|
|
|
|
|
77 |
);
|
78 |
add_meta_box(
|
79 |
-
'ad-display-box',
|
|
|
|
|
|
|
|
|
|
|
80 |
);
|
81 |
add_meta_box(
|
82 |
-
'ad-visitor-box',
|
|
|
|
|
|
|
|
|
|
|
83 |
);
|
84 |
-
if( ! defined( 'AAP_VERSION' ) ){
|
85 |
add_meta_box(
|
86 |
-
'advads-pro-pitch',
|
|
|
|
|
|
|
|
|
|
|
87 |
);
|
88 |
}
|
89 |
-
if( ! defined( 'AAT_VERSION' ) ){
|
90 |
add_meta_box(
|
91 |
-
'advads-tracking-pitch',
|
|
|
|
|
|
|
|
|
|
|
92 |
);
|
93 |
}
|
94 |
|
95 |
-
// register meta box ids
|
96 |
$this->meta_box_ids = array(
|
97 |
-
|
98 |
'advads-gadsense-box',
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
);
|
108 |
|
109 |
-
// force AA meta boxes to never be completely hidden by screen options
|
110 |
add_filter( 'hidden_meta_boxes', array( $this, 'unhide_meta_boxes' ), 10, 2 );
|
111 |
|
112 |
-
$whitelist = apply_filters(
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
|
|
|
|
|
|
119 |
)
|
120 |
-
)
|
121 |
|
122 |
global $wp_meta_boxes;
|
123 |
-
// remove non-white-listed meta boxes
|
124 |
foreach ( array( 'normal', 'advanced', 'side' ) as $context ) {
|
125 |
if ( isset( $wp_meta_boxes[ $post_type ][ $context ] ) ) {
|
126 |
foreach ( array( 'high', 'sorted', 'core', 'default', 'low' ) as $priority ) {
|
127 |
-
if ( isset( $wp_meta_boxes[ $post_type ][ $context ][ $priority ]) ) {
|
128 |
foreach ( (array) $wp_meta_boxes[ $post_type ][ $context ][ $priority ] as $id => $box ) {
|
129 |
-
if ( ! in_array( $id, $whitelist ) )
|
130 |
unset( $wp_meta_boxes[ $post_type ][ $context ][ $priority ][ $id ] );
|
131 |
}
|
132 |
}
|
@@ -137,20 +184,19 @@ class Advanced_Ads_Admin_Meta_Boxes {
|
|
137 |
}
|
138 |
|
139 |
/**
|
140 |
-
*
|
141 |
*
|
142 |
-
* @
|
143 |
-
* @param
|
144 |
-
* @param array $box
|
145 |
* @todo move ad initialization to main function and just global it
|
146 |
*/
|
147 |
-
public function markup_meta_boxes($post, $box) {
|
148 |
$ad = new Advanced_Ads_Ad( $post->ID );
|
149 |
-
|
150 |
switch ( $box['id'] ) {
|
151 |
case 'ad-main-box':
|
152 |
-
$view
|
153 |
-
$hndlelinks = '<a href="' . ADVADS_URL . 'manual/ad-types#utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-ad-type" target="_blank">' . __('Manual', 'advanced-ads') . '</a>';
|
154 |
break;
|
155 |
case 'ad-parameters-box':
|
156 |
$view = 'ad-parameters-metabox.php';
|
@@ -159,14 +205,14 @@ class Advanced_Ads_Admin_Meta_Boxes {
|
|
159 |
$view = 'ad-output-metabox.php';
|
160 |
break;
|
161 |
case 'ad-display-box':
|
162 |
-
$view
|
163 |
-
$hndlelinks
|
164 |
-
$hndlelinks .= '<a href="' . ADVADS_URL . 'manual/display-conditions#utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-display" target="_blank">' . __('Manual', 'advanced-ads') . '</a>';
|
165 |
$videomarkup = '<iframe width="420" height="315" src="https://www.youtube-nocookie.com/embed/wVB6UpeyWNA?rel=0&showinfo=0" frameborder="0" allowfullscreen></iframe>';
|
166 |
break;
|
167 |
case 'ad-visitor-box':
|
168 |
-
$view
|
169 |
-
$hndlelinks = '<a href="' . ADVADS_URL . 'manual/visitor-conditions#utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-visitor" target="_blank">' . __('Manual', 'advanced-ads') . '</a>';
|
170 |
break;
|
171 |
case 'advads-pro-pitch':
|
172 |
$view = 'pitch-bundle.php';
|
@@ -177,51 +223,77 @@ class Advanced_Ads_Admin_Meta_Boxes {
|
|
177 |
// $hndlelinks = '<a href="' . ADVADS_URL . 'manual/visitor-conditions#utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-visitor" target="_blank">' . __('Manual', 'advanced-ads') . '</a>';
|
178 |
break;
|
179 |
case 'advads-gadsense-box':
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
$
|
|
|
|
|
199 |
break;
|
200 |
}
|
201 |
|
202 |
if ( ! isset( $view ) ) {
|
203 |
return;
|
204 |
}
|
205 |
-
// markup moved to handle headline of the metabox
|
206 |
-
if( isset( $hndlelinks ) ){
|
207 |
-
|
208 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
}
|
210 |
-
// show video markup
|
211 |
-
if( isset( $videomarkup ) ){
|
212 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
}
|
214 |
/**
|
215 |
-
*
|
216 |
-
*
|
217 |
-
* elements in $warnings contain [text] and [class] attributes
|
218 |
*/
|
219 |
$warnings = array();
|
220 |
-
// show warning if ad contains https in parameters box
|
221 |
-
|
|
|
222 |
$warnings[] = array(
|
223 |
-
'text'
|
224 |
-
'class' =>'advads-ad-notice-https-missing error'
|
225 |
);
|
226 |
}
|
227 |
|
@@ -230,42 +302,45 @@ class Advanced_Ads_Admin_Meta_Boxes {
|
|
230 |
|
231 |
if ( Advanced_Ads_AdSense_Data::get_instance()->is_page_level_enabled() ) {
|
232 |
$warnings[] = array(
|
233 |
-
'text'
|
234 |
-
'class' => 'advads-auto-ad-in-ad-content hidden error'
|
235 |
);
|
236 |
} else {
|
237 |
$warnings[] = array(
|
238 |
-
'text'
|
239 |
-
'class' => 'advads-auto-ad-in-ad-content hidden error'
|
240 |
);
|
241 |
}
|
242 |
}
|
243 |
-
|
244 |
-
|
245 |
if (
|
246 |
false === strpos( $ad->content, 'enable_page_level_ads' )
|
247 |
&& ! preg_match( '/script[^>]+data-ad-client=/', $ad->content )
|
248 |
) {
|
249 |
$adsense_auto_ads = Advanced_Ads_AdSense_Data::get_instance()->is_page_level_enabled();
|
250 |
-
$warnings[]
|
251 |
'class' => 'advads-adsense-found-in-content error',
|
252 |
-
'text'
|
253 |
-
|
|
|
254 |
'<button class="button-secondary" id="switch-to-adsense-type">',
|
255 |
'</button>'
|
256 |
-
)
|
257 |
);
|
258 |
}
|
259 |
-
|
260 |
-
|
261 |
$warnings = apply_filters( 'advanced-ads-ad-notices', $warnings, $box, $post );
|
262 |
-
echo '<ul id="'
|
263 |
-
foreach( $warnings as $_warning ){
|
264 |
-
if( isset( $_warning['text'] ) ) :
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
|
|
|
|
269 |
endif;
|
270 |
}
|
271 |
echo '</ul>';
|
@@ -273,38 +348,45 @@ class Advanced_Ads_Admin_Meta_Boxes {
|
|
273 |
}
|
274 |
|
275 |
/**
|
276 |
-
*
|
277 |
*
|
278 |
-
* @
|
279 |
-
* @param
|
280 |
-
*
|
|
|
281 |
*/
|
282 |
-
public function unhide_meta_boxes( $hidden, $screen ){
|
283 |
-
// only check on Advanced Ads edit screen
|
284 |
-
if ( ! isset( $screen->id ) || $screen->id
|
285 |
return $hidden;
|
286 |
}
|
287 |
|
288 |
-
// return only hidden elements which are not among the Advanced Ads meta box ids
|
289 |
return array_diff( $hidden, $this->meta_box_ids );
|
290 |
}
|
291 |
|
292 |
/**
|
293 |
-
*
|
294 |
*
|
295 |
-
* @
|
296 |
-
* @param string $post_type current post type
|
297 |
*/
|
298 |
-
public function add_post_meta_box($post_type = ''){
|
299 |
-
// don’t display for non admins
|
300 |
-
if( ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads') ) ) {
|
301 |
return;
|
302 |
}
|
303 |
|
304 |
-
// get public post types
|
305 |
-
$public_post_types = get_post_types(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
|
307 |
-
//limit meta box to public post types
|
308 |
if ( in_array( $post_type, $public_post_types ) ) {
|
309 |
add_meta_box(
|
310 |
'advads-ad-settings',
|
@@ -318,38 +400,38 @@ class Advanced_Ads_Admin_Meta_Boxes {
|
|
318 |
}
|
319 |
|
320 |
/**
|
321 |
-
*
|
322 |
*
|
323 |
-
* @since 1.3.10
|
324 |
* @param WP_Post $post The post object.
|
325 |
*/
|
326 |
public function render_post_meta_box( $post ) {
|
327 |
|
328 |
-
// nonce field to check when we save the values
|
329 |
wp_nonce_field( 'advads_post_meta_box', 'advads_post_meta_box_nonce' );
|
330 |
|
331 |
// retrieve an existing value from the database.
|
332 |
$values = get_post_meta( $post->ID, '_advads_ad_settings', true );
|
333 |
|
334 |
-
// load the view
|
335 |
include ADVADS_BASE_PATH . 'admin/views/post-ad-settings-metabox.php';
|
336 |
|
337 |
do_action( 'advanced_ads_render_post_meta_box', $post, $values );
|
338 |
}
|
339 |
|
340 |
/**
|
341 |
-
*
|
342 |
*
|
343 |
-
* @since 1.3.10
|
344 |
* @param int $post_id The ID of the post being saved.
|
345 |
-
|
|
|
|
|
346 |
public function save_post_meta_box( $post_id ) {
|
347 |
|
348 |
-
if( ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads') ) ) {
|
349 |
-
|
350 |
}
|
351 |
|
352 |
-
// check nonce
|
353 |
if ( ! isset( $_POST['advads_post_meta_box_nonce'] ) ) {
|
354 |
return $post_id; }
|
355 |
|
@@ -359,12 +441,12 @@ class Advanced_Ads_Admin_Meta_Boxes {
|
|
359 |
if ( ! wp_verify_nonce( $nonce, 'advads_post_meta_box' ) ) {
|
360 |
return $post_id; }
|
361 |
|
362 |
-
// don’t save on autosave
|
363 |
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
|
364 |
return $post_id; }
|
365 |
|
366 |
// check the user's permissions.
|
367 |
-
if ( 'page'
|
368 |
if ( ! current_user_can( 'edit_page', $post_id ) ) {
|
369 |
return $post_id; }
|
370 |
} else {
|
@@ -372,171 +454,186 @@ class Advanced_Ads_Admin_Meta_Boxes {
|
|
372 |
return $post_id; }
|
373 |
}
|
374 |
|
375 |
-
//
|
376 |
-
$_data['disable_ads'] = isset($_POST['advanced_ads']['disable_ads']) ? absint( $_POST['advanced_ads']['disable_ads'] ) : 0;
|
377 |
|
378 |
$_data = apply_filters( 'advanced_ads_save_post_meta_box', $_data );
|
379 |
|
380 |
-
//
|
381 |
update_post_meta( $post_id, '_advads_ad_settings', $_data );
|
382 |
}
|
383 |
|
384 |
/**
|
385 |
-
*
|
386 |
*
|
387 |
-
* @
|
388 |
-
* @
|
389 |
-
* @return arr $classes
|
390 |
*/
|
391 |
public function close_ad_type_metabox( $classes = array() ) {
|
392 |
-
|
393 |
-
|
394 |
-
if ( ! in_array( 'closed', $classes ) ) {
|
395 |
-
|
396 |
}
|
397 |
-
|
398 |
$classes = array();
|
399 |
-
|
400 |
-
|
401 |
}
|
402 |
|
403 |
/**
|
404 |
-
*
|
405 |
-
*
|
406 |
-
* @since 1.3.12
|
407 |
*/
|
408 |
-
public function add_dashboard_widget(){
|
409 |
-
// display dashboard widget only to authors and higher roles
|
410 |
-
if( ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_see_interface') ) ) {
|
411 |
-
|
412 |
}
|
413 |
-
add_meta_box( 'advads_dashboard_widget', __( 'Ads Dashboard', 'advanced-ads' ), array($this, 'dashboard_widget_function'), 'dashboard', 'side', 'high' );
|
414 |
}
|
415 |
|
416 |
/**
|
417 |
-
*
|
|
|
|
|
|
|
418 |
*/
|
419 |
-
public static function dashboard_widget_function($post, $callback_args){
|
420 |
-
// get number of ads
|
421 |
$ads_count = Advanced_Ads::get_number_of_ads();
|
422 |
-
if( current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads') ) ) {
|
423 |
echo '<p>';
|
424 |
-
printf(
|
425 |
-
$
|
426 |
-
'
|
427 |
-
|
|
|
|
|
|
|
428 |
echo '</p>';
|
429 |
}
|
430 |
|
431 |
$notice_options = Advanced_Ads_Admin_Notices::get_instance()->options();
|
432 |
-
$_notice
|
433 |
-
if ( ! isset($notice_options['closed'][ $_notice ] ) ) {
|
434 |
-
|
435 |
-
|
436 |
-
|
|
|
|
|
437 |
}
|
438 |
|
439 |
$_notice = 'nl_adsense';
|
440 |
-
if ( ! isset($notice_options['closed'][ $_notice ] ) ) {
|
441 |
-
|
442 |
-
|
443 |
-
|
|
|
|
|
444 |
}
|
445 |
|
446 |
-
//
|
447 |
self::dashboard_cached_rss_widget();
|
448 |
-
|
449 |
-
?><p><a href="<?php echo ADVADS_URL . 'category/tutorials/#utm_source=advanced-ads&utm_medium=link&utm_campaign=dashboard'; ?>" target="_blank"><?php _e('Visit our blog for more articles about ad optimization', 'advanced-ads' ) ?></a></p><?php
|
450 |
|
451 |
-
|
452 |
-
|
453 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
454 |
}
|
455 |
|
456 |
/**
|
457 |
-
*
|
458 |
* built using a lot of https://developer.wordpress.org/reference/functions/wp_dashboard_cached_rss_widget/
|
459 |
*
|
460 |
-
* @since 1.3.12
|
461 |
-
* @param string $widget_id
|
462 |
-
* @param callback $callback
|
463 |
-
* @param array $check_urls RSS feeds
|
464 |
* @return bool False on failure. True on success.
|
465 |
*/
|
466 |
-
static function dashboard_cached_rss_widget() {
|
467 |
-
|
468 |
$cache_key = 'dash_' . md5( 'advads_dashboard_widget' );
|
469 |
|
470 |
-
|
471 |
-
|
472 |
-
|
|
|
|
|
473 |
}
|
474 |
/**
|
475 |
-
*
|
476 |
*/
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
|
|
|
|
481 |
|
482 |
return true;
|
483 |
}
|
484 |
|
485 |
/**
|
486 |
-
*
|
487 |
-
*
|
488 |
-
* @param string $widget_id Widget ID.
|
489 |
*/
|
490 |
-
static function dashboard_widget_function_output(
|
491 |
-
|
492 |
-
check_ajax_referer('advanced-ads-admin-ajax-nonce', 'nonce');
|
493 |
-
|
494 |
$cache_key = 'dash_' . md5( 'advads_dashboard_widget' );
|
495 |
-
|
496 |
$feeds = array(
|
497 |
array(
|
498 |
'link' => ADVADS_URL,
|
499 |
'url' => ADVADS_URL . 'feed/',
|
500 |
'title' => sprintf(
|
501 |
-
// translators: %s is our URL
|
502 |
-
__( 'Latest posts on wpadvancedads.com', 'advanced-ads' ),
|
|
|
|
|
503 |
'items' => 2,
|
504 |
'show_summary' => 1,
|
505 |
'show_author' => 0,
|
506 |
'show_date' => 0,
|
507 |
),
|
508 |
);
|
509 |
-
|
510 |
-
// create output and also cache it
|
511 |
-
|
512 |
ob_start();
|
513 |
-
foreach ( $feeds as $_feed ){
|
514 |
echo '<div class="rss-widget">';
|
515 |
-
echo '<h4>'
|
516 |
wp_widget_rss_output( $_feed['url'], $_feed );
|
517 |
echo '</div>';
|
518 |
}
|
519 |
-
|
520 |
$feed_content = ob_get_clean();
|
521 |
$error_string = '<strong>' . __( 'RSS Error:' ) . '</strong> ';
|
522 |
-
|
523 |
-
// empty the widget content, if we find the error string in it
|
524 |
-
if( strpos( $feed_content, $error_string ) ){
|
525 |
$feed_content = '';
|
526 |
}
|
527 |
-
|
|
|
528 |
echo $feed_content;
|
529 |
-
|
530 |
-
set_transient( $cache_key, $feed_content, 48 * HOUR_IN_SECONDS ); // Default lifetime in cache of 48 hours
|
531 |
die();
|
532 |
}
|
533 |
-
|
534 |
/**
|
535 |
-
*
|
536 |
* they inject their ad optimization meta box into our ad page, even though it is not a public post type
|
537 |
* using they filter, we remove AA from the list of post types they inject this box into
|
|
|
|
|
|
|
538 |
*/
|
539 |
-
function fix_wpquadspro_issue( $allowed_post_types ){
|
540 |
unset( $allowed_post_types['advanced_ads'] );
|
541 |
return $allowed_post_types;
|
542 |
}
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || exit;
|
3 |
|
4 |
+
/**
|
5 |
+
* Class Advanced_Ads_Admin_Meta_Boxes
|
6 |
+
*/
|
7 |
class Advanced_Ads_Admin_Meta_Boxes {
|
8 |
/**
|
9 |
* Instance of this class.
|
10 |
*
|
11 |
+
* @var object $instance
|
12 |
*/
|
13 |
protected static $instance = null;
|
14 |
|
15 |
/**
|
16 |
+
* Meta box ids
|
17 |
*
|
18 |
+
* @var array $meta_box_ids
|
|
|
19 |
*/
|
20 |
protected $meta_box_ids = array();
|
21 |
|
22 |
+
/**
|
23 |
+
* Advanced_Ads_Admin_Meta_Boxes constructor.
|
24 |
+
*/
|
25 |
private function __construct() {
|
26 |
add_action( 'add_meta_boxes_' . Advanced_Ads::POST_TYPE_SLUG, array( $this, 'add_meta_boxes' ) );
|
27 |
+
// add meta box for post types edit pages.
|
28 |
add_action( 'add_meta_boxes', array( $this, 'add_post_meta_box' ) );
|
29 |
add_action( 'save_post', array( $this, 'save_post_meta_box' ) );
|
30 |
+
// register dashboard widget.
|
31 |
+
add_action( 'wp_dashboard_setup', array( $this, 'add_dashboard_widget' ) );
|
32 |
+
// fixes compatibility issue with WP QUADS PRO.
|
33 |
+
add_action( 'quads_meta_box_post_types', array( $this, 'fix_wpquadspro_issue' ), 11 );
|
34 |
}
|
35 |
|
36 |
/**
|
40 |
*/
|
41 |
public static function get_instance() {
|
42 |
// If the single instance hasn't been set, set it now.
|
43 |
+
if ( null === self::$instance ) {
|
44 |
+
self::$instance = new self();
|
45 |
}
|
46 |
|
47 |
return self::$instance;
|
56 |
$post_type = Advanced_Ads::POST_TYPE_SLUG;
|
57 |
|
58 |
add_meta_box(
|
59 |
+
'ad-main-box',
|
60 |
+
__( 'Ad Type', 'advanced-ads' ),
|
61 |
+
array( $this, 'markup_meta_boxes' ),
|
62 |
+
$post_type,
|
63 |
+
'normal',
|
64 |
+
'high'
|
65 |
);
|
66 |
if ( Advanced_Ads_AdSense_Data::get_instance()->is_setup()
|
67 |
+
&& ! Advanced_Ads_AdSense_Data::get_instance()->is_hide_stats() ) {
|
68 |
global $post_id;
|
69 |
+
if ( $post_id ) {
|
70 |
$ad = new Advanced_Ads_Ad( $post_id );
|
71 |
|
72 |
+
add_meta_box(
|
73 |
+
'advads-gadsense-box',
|
74 |
+
__( 'AdSense Earnings', 'advanced-ads' ),
|
75 |
+
array( $this, 'markup_meta_boxes' ),
|
76 |
+
$post_type,
|
77 |
+
'normal',
|
78 |
+
'high'
|
79 |
+
);
|
80 |
|
81 |
}
|
82 |
}
|
83 |
+
// use dynamic filter from to add close class to ad type meta box after saved first time.
|
84 |
add_filter( 'postbox_classes_advanced_ads_ad-main-box', array( $this, 'close_ad_type_metabox' ) );
|
85 |
|
86 |
add_meta_box(
|
87 |
+
'ad-parameters-box',
|
88 |
+
__( 'Ad Parameters', 'advanced-ads' ),
|
89 |
+
array( $this, 'markup_meta_boxes' ),
|
90 |
+
$post_type,
|
91 |
+
'normal',
|
92 |
+
'high'
|
93 |
);
|
94 |
add_meta_box(
|
95 |
+
'ad-output-box',
|
96 |
+
__( 'Layout / Output', 'advanced-ads' ),
|
97 |
+
array( $this, 'markup_meta_boxes' ),
|
98 |
+
$post_type,
|
99 |
+
'normal',
|
100 |
+
'high'
|
101 |
);
|
102 |
add_meta_box(
|
103 |
+
'ad-display-box',
|
104 |
+
__( 'Display Conditions', 'advanced-ads' ),
|
105 |
+
array( $this, 'markup_meta_boxes' ),
|
106 |
+
$post_type,
|
107 |
+
'normal',
|
108 |
+
'high'
|
109 |
);
|
110 |
add_meta_box(
|
111 |
+
'ad-visitor-box',
|
112 |
+
__( 'Visitor Conditions', 'advanced-ads' ),
|
113 |
+
array( $this, 'markup_meta_boxes' ),
|
114 |
+
$post_type,
|
115 |
+
'normal',
|
116 |
+
'high'
|
117 |
);
|
118 |
+
if ( ! defined( 'AAP_VERSION' ) ) {
|
119 |
add_meta_box(
|
120 |
+
'advads-pro-pitch',
|
121 |
+
__( 'Increase your ad revenue', 'advanced-ads' ),
|
122 |
+
array( $this, 'markup_meta_boxes' ),
|
123 |
+
$post_type,
|
124 |
+
'side',
|
125 |
+
'low'
|
126 |
);
|
127 |
}
|
128 |
+
if ( ! defined( 'AAT_VERSION' ) ) {
|
129 |
add_meta_box(
|
130 |
+
'advads-tracking-pitch',
|
131 |
+
__( 'Ad Stats', 'advanced-ads' ),
|
132 |
+
array( $this, 'markup_meta_boxes' ),
|
133 |
+
$post_type,
|
134 |
+
'normal',
|
135 |
+
'low'
|
136 |
);
|
137 |
}
|
138 |
|
139 |
+
// register meta box ids.
|
140 |
$this->meta_box_ids = array(
|
141 |
+
'ad-main-box',
|
142 |
'advads-gadsense-box',
|
143 |
+
'ad-parameters-box',
|
144 |
+
'ad-output-box',
|
145 |
+
'ad-display-box',
|
146 |
+
'ad-visitor-box',
|
147 |
+
'advads-pro-pitch',
|
148 |
+
'advads-tracking-pitch',
|
149 |
+
'revisionsdiv', // revisions – only when activated.
|
150 |
+
'advanced_ads_groupsdiv', // automatically added by ad groups taxonomy.
|
151 |
);
|
152 |
|
153 |
+
// force AA meta boxes to never be completely hidden by screen options.
|
154 |
add_filter( 'hidden_meta_boxes', array( $this, 'unhide_meta_boxes' ), 10, 2 );
|
155 |
|
156 |
+
$whitelist = apply_filters(
|
157 |
+
'advanced-ads-ad-edit-allowed-metaboxes',
|
158 |
+
array_merge(
|
159 |
+
$this->meta_box_ids,
|
160 |
+
array(
|
161 |
+
'submitdiv',
|
162 |
+
'slugdiv',
|
163 |
+
'tracking-ads-box',
|
164 |
+
'ad-layer-ads-box', // deprecated.
|
165 |
+
)
|
166 |
)
|
167 |
+
);
|
168 |
|
169 |
global $wp_meta_boxes;
|
170 |
+
// remove non-white-listed meta boxes.
|
171 |
foreach ( array( 'normal', 'advanced', 'side' ) as $context ) {
|
172 |
if ( isset( $wp_meta_boxes[ $post_type ][ $context ] ) ) {
|
173 |
foreach ( array( 'high', 'sorted', 'core', 'default', 'low' ) as $priority ) {
|
174 |
+
if ( isset( $wp_meta_boxes[ $post_type ][ $context ][ $priority ] ) ) {
|
175 |
foreach ( (array) $wp_meta_boxes[ $post_type ][ $context ][ $priority ] as $id => $box ) {
|
176 |
+
if ( ! in_array( $id, $whitelist ) ) {
|
177 |
unset( $wp_meta_boxes[ $post_type ][ $context ][ $priority ][ $id ] );
|
178 |
}
|
179 |
}
|
184 |
}
|
185 |
|
186 |
/**
|
187 |
+
* Load templates for all meta boxes
|
188 |
*
|
189 |
+
* @param WP_Post $post WP_Post object.
|
190 |
+
* @param array $box meta box information.
|
|
|
191 |
* @todo move ad initialization to main function and just global it
|
192 |
*/
|
193 |
+
public function markup_meta_boxes( $post, $box ) {
|
194 |
$ad = new Advanced_Ads_Ad( $post->ID );
|
195 |
+
|
196 |
switch ( $box['id'] ) {
|
197 |
case 'ad-main-box':
|
198 |
+
$view = 'ad-main-metabox.php';
|
199 |
+
$hndlelinks = '<a href="' . ADVADS_URL . 'manual/ad-types#utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-ad-type" target="_blank">' . __( 'Manual', 'advanced-ads' ) . '</a>';
|
200 |
break;
|
201 |
case 'ad-parameters-box':
|
202 |
$view = 'ad-parameters-metabox.php';
|
205 |
$view = 'ad-output-metabox.php';
|
206 |
break;
|
207 |
case 'ad-display-box':
|
208 |
+
$view = 'conditions/ad-display-metabox.php';
|
209 |
+
$hndlelinks = '<a href="#" class="advads-video-link">' . __( 'Video', 'advanced-ads' ) . '</a>';
|
210 |
+
$hndlelinks .= '<a href="' . ADVADS_URL . 'manual/display-conditions#utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-display" target="_blank">' . __( 'Manual', 'advanced-ads' ) . '</a>';
|
211 |
$videomarkup = '<iframe width="420" height="315" src="https://www.youtube-nocookie.com/embed/wVB6UpeyWNA?rel=0&showinfo=0" frameborder="0" allowfullscreen></iframe>';
|
212 |
break;
|
213 |
case 'ad-visitor-box':
|
214 |
+
$view = 'conditions/ad-visitor-metabox.php';
|
215 |
+
$hndlelinks = '<a href="' . ADVADS_URL . 'manual/visitor-conditions#utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-visitor" target="_blank">' . __( 'Manual', 'advanced-ads' ) . '</a>';
|
216 |
break;
|
217 |
case 'advads-pro-pitch':
|
218 |
$view = 'pitch-bundle.php';
|
223 |
// $hndlelinks = '<a href="' . ADVADS_URL . 'manual/visitor-conditions#utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-visitor" target="_blank">' . __('Manual', 'advanced-ads') . '</a>';
|
224 |
break;
|
225 |
case 'advads-gadsense-box':
|
226 |
+
$unit_code = null;
|
227 |
+
if ( $ad && isset( $ad->type ) && 'adsense' === $ad->type ) {
|
228 |
+
if ( isset( $ad->content ) ) {
|
229 |
+
$json_content = json_decode( $ad->content );
|
230 |
+
// phpcs:ignore
|
231 |
+
if ( isset( $json_content->slotId ) ) {
|
232 |
+
// phpcs:ignore
|
233 |
+
$unit_code = $json_content->slotId;
|
234 |
+
}
|
235 |
+
}
|
236 |
+
}
|
237 |
+
$advads_gadsense_options = array(
|
238 |
+
'dimension_name' => 'AD_UNIT_CODE',
|
239 |
+
'filter_value' => $unit_code,
|
240 |
+
'hide_dimensions' => true,
|
241 |
+
'metabox_selector' => '#advads-gadsense-box',
|
242 |
+
'hidden' => ! $unit_code,
|
243 |
+
);
|
244 |
+
$advads_gadsense_options['hidden'] = ! $unit_code;
|
245 |
+
$view = 'gadsense-dashboard.php';
|
246 |
+
$hndlelinks = '<a href="' . esc_url( admin_url( 'admin.php?page=advanced-ads-settings#top#adsense' ) ) . '" target="_blank">' . __( 'Disable', 'advanced-ads' ) . '</a>';
|
247 |
break;
|
248 |
}
|
249 |
|
250 |
if ( ! isset( $view ) ) {
|
251 |
return;
|
252 |
}
|
253 |
+
// markup moved to handle headline of the metabox.
|
254 |
+
if ( isset( $hndlelinks ) ) {
|
255 |
+
?><span class="advads-hndlelinks hidden">
|
256 |
+
<?php
|
257 |
+
echo wp_kses(
|
258 |
+
$hndlelinks,
|
259 |
+
array(
|
260 |
+
'a' => array(
|
261 |
+
'target' => array(),
|
262 |
+
'href' => array(),
|
263 |
+
'class' => array(),
|
264 |
+
),
|
265 |
+
)
|
266 |
+
);
|
267 |
+
?>
|
268 |
+
</span>
|
269 |
+
<?php
|
270 |
}
|
271 |
+
// show video markup.
|
272 |
+
if ( isset( $videomarkup ) ) {
|
273 |
+
echo '<div class="advads-video-link-container" data-videolink=\'' . wp_kses(
|
274 |
+
$videomarkup,
|
275 |
+
array(
|
276 |
+
'iframe' => array(
|
277 |
+
'width' => array(),
|
278 |
+
'height' => array(),
|
279 |
+
'src' => array(),
|
280 |
+
'frameborder' => array(),
|
281 |
+
'allowfullscreen' => array(),
|
282 |
+
),
|
283 |
+
)
|
284 |
+
) . '\'></div>';
|
285 |
}
|
286 |
/**
|
287 |
+
* List general notices
|
288 |
+
* elements in $warnings contain [text] and [class] attributes.
|
|
|
289 |
*/
|
290 |
$warnings = array();
|
291 |
+
// show warning if ad contains https in parameters box.
|
292 |
+
$https_message = Advanced_Ads_Ad_Debug::is_https_and_http( $ad );
|
293 |
+
if ( 'ad-parameters-box' === $box['id'] && $https_message ) {
|
294 |
$warnings[] = array(
|
295 |
+
'text' => $https_message,
|
296 |
+
'class' => 'advads-ad-notice-https-missing error',
|
297 |
);
|
298 |
}
|
299 |
|
302 |
|
303 |
if ( Advanced_Ads_AdSense_Data::get_instance()->is_page_level_enabled() ) {
|
304 |
$warnings[] = array(
|
305 |
+
'text' => $auto_ads_strings['enabled'],
|
306 |
+
'class' => 'advads-auto-ad-in-ad-content hidden error',
|
307 |
);
|
308 |
} else {
|
309 |
$warnings[] = array(
|
310 |
+
'text' => $auto_ads_strings['disabled'],
|
311 |
+
'class' => 'advads-auto-ad-in-ad-content hidden error',
|
312 |
);
|
313 |
}
|
314 |
}
|
315 |
+
|
316 |
+
if ( 'ad-parameters-box' === $box['id'] && Advanced_Ads_Ad_Type_Adsense::content_is_adsense( $ad->content ) && in_array( $ad->type, array( 'plain', 'content' ), true ) ) {
|
317 |
if (
|
318 |
false === strpos( $ad->content, 'enable_page_level_ads' )
|
319 |
&& ! preg_match( '/script[^>]+data-ad-client=/', $ad->content )
|
320 |
) {
|
321 |
$adsense_auto_ads = Advanced_Ads_AdSense_Data::get_instance()->is_page_level_enabled();
|
322 |
+
$warnings[] = array(
|
323 |
'class' => 'advads-adsense-found-in-content error',
|
324 |
+
'text' => sprintf(
|
325 |
+
// translators: %1$s opening button tag, %2$s closing button tag.
|
326 |
+
esc_html__( 'This looks like an AdSense ad. Switch the ad type to “AdSense ad” to make use of more features. %1$sSwitch to AdSense ad%2$s.', 'advanced' ),
|
327 |
'<button class="button-secondary" id="switch-to-adsense-type">',
|
328 |
'</button>'
|
329 |
+
),
|
330 |
);
|
331 |
}
|
332 |
+
}
|
333 |
+
|
334 |
$warnings = apply_filters( 'advanced-ads-ad-notices', $warnings, $box, $post );
|
335 |
+
echo '<ul id="' . esc_attr( $box['id'] ) . '-notices" class="advads-metabox-notices">';
|
336 |
+
foreach ( $warnings as $_warning ) {
|
337 |
+
if ( isset( $_warning['text'] ) ) :
|
338 |
+
$warning_class = isset( $_warning['class'] ) ? $_warning['class'] : '';
|
339 |
+
echo '<li class="' . esc_attr( $warning_class ) . '">';
|
340 |
+
// skip CodeSniffer because this could be complex HTML.
|
341 |
+
// phpcs:ignore
|
342 |
+
echo $_warning['text'];
|
343 |
+
echo '</li>';
|
344 |
endif;
|
345 |
}
|
346 |
echo '</ul>';
|
348 |
}
|
349 |
|
350 |
/**
|
351 |
+
* Force all AA related meta boxes to stay visible
|
352 |
*
|
353 |
+
* @param array $hidden An array of hidden meta boxes.
|
354 |
+
* @param WP_Screen $screen WP_Screen object of the current screen.
|
355 |
+
*
|
356 |
+
* @return array
|
357 |
*/
|
358 |
+
public function unhide_meta_boxes( $hidden, $screen ) {
|
359 |
+
// only check on Advanced Ads edit screen.
|
360 |
+
if ( ! isset( $screen->id ) || 'advanced_ads' !== $screen->id || ! is_array( $this->meta_box_ids ) ) {
|
361 |
return $hidden;
|
362 |
}
|
363 |
|
364 |
+
// return only hidden elements which are not among the Advanced Ads meta box ids.
|
365 |
return array_diff( $hidden, $this->meta_box_ids );
|
366 |
}
|
367 |
|
368 |
/**
|
369 |
+
* Add a meta box to post type edit screens with ad settings
|
370 |
*
|
371 |
+
* @param string $post_type current post type.
|
|
|
372 |
*/
|
373 |
+
public function add_post_meta_box( $post_type = '' ) {
|
374 |
+
// don’t display for non admins.
|
375 |
+
if ( ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads' ) ) ) {
|
376 |
return;
|
377 |
}
|
378 |
|
379 |
+
// get public post types.
|
380 |
+
$public_post_types = get_post_types(
|
381 |
+
array(
|
382 |
+
'public' => true,
|
383 |
+
'publicly_queryable' => true,
|
384 |
+
),
|
385 |
+
'names',
|
386 |
+
'or'
|
387 |
+
);
|
388 |
|
389 |
+
// limit meta box to public post types.
|
390 |
if ( in_array( $post_type, $public_post_types ) ) {
|
391 |
add_meta_box(
|
392 |
'advads-ad-settings',
|
400 |
}
|
401 |
|
402 |
/**
|
403 |
+
* Render meta box for ad settings on a per post basis
|
404 |
*
|
|
|
405 |
* @param WP_Post $post The post object.
|
406 |
*/
|
407 |
public function render_post_meta_box( $post ) {
|
408 |
|
409 |
+
// nonce field to check when we save the values.
|
410 |
wp_nonce_field( 'advads_post_meta_box', 'advads_post_meta_box_nonce' );
|
411 |
|
412 |
// retrieve an existing value from the database.
|
413 |
$values = get_post_meta( $post->ID, '_advads_ad_settings', true );
|
414 |
|
415 |
+
// load the view.
|
416 |
include ADVADS_BASE_PATH . 'admin/views/post-ad-settings-metabox.php';
|
417 |
|
418 |
do_action( 'advanced_ads_render_post_meta_box', $post, $values );
|
419 |
}
|
420 |
|
421 |
/**
|
422 |
+
* Save the ad meta when the post is saved.
|
423 |
*
|
|
|
424 |
* @param int $post_id The ID of the post being saved.
|
425 |
+
*
|
426 |
+
* @return mixed empty or post ID.
|
427 |
+
*/
|
428 |
public function save_post_meta_box( $post_id ) {
|
429 |
|
430 |
+
if ( ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads' ) ) ) {
|
431 |
+
return;
|
432 |
}
|
433 |
|
434 |
+
// check nonce.
|
435 |
if ( ! isset( $_POST['advads_post_meta_box_nonce'] ) ) {
|
436 |
return $post_id; }
|
437 |
|
441 |
if ( ! wp_verify_nonce( $nonce, 'advads_post_meta_box' ) ) {
|
442 |
return $post_id; }
|
443 |
|
444 |
+
// don’t save on autosave.
|
445 |
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
|
446 |
return $post_id; }
|
447 |
|
448 |
// check the user's permissions.
|
449 |
+
if ( 'page' === $_POST['post_type'] ) {
|
450 |
if ( ! current_user_can( 'edit_page', $post_id ) ) {
|
451 |
return $post_id; }
|
452 |
} else {
|
454 |
return $post_id; }
|
455 |
}
|
456 |
|
457 |
+
// sanitize the user input.
|
458 |
+
$_data['disable_ads'] = isset( $_POST['advanced_ads']['disable_ads'] ) ? absint( $_POST['advanced_ads']['disable_ads'] ) : 0;
|
459 |
|
460 |
$_data = apply_filters( 'advanced_ads_save_post_meta_box', $_data );
|
461 |
|
462 |
+
// update the meta field.
|
463 |
update_post_meta( $post_id, '_advads_ad_settings', $_data );
|
464 |
}
|
465 |
|
466 |
/**
|
467 |
+
* Add "close" class to collapse the ad-type metabox after ad was saved first
|
468 |
*
|
469 |
+
* @param array $classes class attributes.
|
470 |
+
* @return array $classes
|
|
|
471 |
*/
|
472 |
public function close_ad_type_metabox( $classes = array() ) {
|
473 |
+
global $post;
|
474 |
+
if ( isset( $post->ID ) && 'publish' === $post->post_status ) {
|
475 |
+
if ( ! in_array( 'closed', $classes, true ) ) {
|
476 |
+
$classes[] = 'closed';
|
477 |
}
|
478 |
+
} else {
|
479 |
$classes = array();
|
480 |
+
}
|
481 |
+
return $classes;
|
482 |
}
|
483 |
|
484 |
/**
|
485 |
+
* Add dashboard widget with ad stats and additional information
|
|
|
|
|
486 |
*/
|
487 |
+
public function add_dashboard_widget() {
|
488 |
+
// display dashboard widget only to authors and higher roles.
|
489 |
+
if ( ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_see_interface' ) ) ) {
|
490 |
+
return;
|
491 |
}
|
492 |
+
add_meta_box( 'advads_dashboard_widget', __( 'Ads Dashboard', 'advanced-ads' ), array( $this, 'dashboard_widget_function' ), 'dashboard', 'side', 'high' );
|
493 |
}
|
494 |
|
495 |
/**
|
496 |
+
* Display widget functions
|
497 |
+
*
|
498 |
+
* @param WP_Post $post post object.
|
499 |
+
* @param array $callback_args callback arguments.
|
500 |
*/
|
501 |
+
public static function dashboard_widget_function( $post, $callback_args ) {
|
502 |
+
// get number of ads.
|
503 |
$ads_count = Advanced_Ads::get_number_of_ads();
|
504 |
+
if ( current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads' ) ) ) {
|
505 |
echo '<p>';
|
506 |
+
printf(
|
507 |
+
// translators: %1$d is the number of ads, %2$s and %3$s are URLs.
|
508 |
+
wp_kses( __( '%1$d ads – <a href="%2$s">manage</a> - <a href="%3$s">new</a>', 'advanced-ads' ), array( 'a' => array( 'href' => array() ) ) ),
|
509 |
+
absint( $ads_count ),
|
510 |
+
'edit.php?post_type=' . esc_attr( Advanced_Ads::POST_TYPE_SLUG ),
|
511 |
+
'post-new.php?post_type=' . esc_attr( Advanced_Ads::POST_TYPE_SLUG )
|
512 |
+
);
|
513 |
echo '</p>';
|
514 |
}
|
515 |
|
516 |
$notice_options = Advanced_Ads_Admin_Notices::get_instance()->options();
|
517 |
+
$_notice = 'nl_first_steps';
|
518 |
+
if ( ! isset( $notice_options['closed'][ $_notice ] ) ) {
|
519 |
+
?>
|
520 |
+
<div class="advads-admin-notice">
|
521 |
+
<p><button type="button" class="button-primary advads-notices-button-subscribe" data-notice="<?php echo esc_attr( $_notice ); ?>"><?php esc_html_e( 'Get the tutorial via email', 'advanced-ads' ); ?></button></p>
|
522 |
+
</div>
|
523 |
+
<?php
|
524 |
}
|
525 |
|
526 |
$_notice = 'nl_adsense';
|
527 |
+
if ( ! isset( $notice_options['closed'][ $_notice ] ) ) {
|
528 |
+
?>
|
529 |
+
<div class="advads-admin-notice">
|
530 |
+
<p><button type="button" class="button-primary advads-notices-button-subscribe" data-notice="<?php echo esc_attr( $_notice ); ?>"><?php esc_html_e( 'Get AdSense tips via email', 'advanced-ads' ); ?></button></p>
|
531 |
+
</div>
|
532 |
+
<?php
|
533 |
}
|
534 |
|
535 |
+
// RSS feed.
|
536 |
self::dashboard_cached_rss_widget();
|
|
|
|
|
537 |
|
538 |
+
?>
|
539 |
+
<p><a href="<?php echo esc_url( ADVADS_URL . 'category/tutorials/#utm_source=advanced-ads&utm_medium=link&utm_campaign=dashboard' ); ?>" target="_blank"><?php esc_html_e( 'Visit our blog for more articles about ad optimization', 'advanced-ads' ); ?></a></p>
|
540 |
+
<?php
|
541 |
+
|
542 |
+
// add markup for utm variables.
|
543 |
+
// todo: move to js file.
|
544 |
+
?>
|
545 |
+
<script>jQuery('#advads_dashboard_widget .rss-widget a').each(function(){ this.href = this.href + '#utm_source=advanced-ads&utm_medium=rss-link&utm_campaign=dashboard'; })</script>
|
546 |
+
<?php
|
547 |
}
|
548 |
|
549 |
/**
|
550 |
+
* Checks to see if there are feed urls in transient cache; if not, load them
|
551 |
* built using a lot of https://developer.wordpress.org/reference/functions/wp_dashboard_cached_rss_widget/
|
552 |
*
|
|
|
|
|
|
|
|
|
553 |
* @return bool False on failure. True on success.
|
554 |
*/
|
555 |
+
public static function dashboard_cached_rss_widget() {
|
556 |
+
|
557 |
$cache_key = 'dash_' . md5( 'advads_dashboard_widget' );
|
558 |
|
559 |
+
$output = get_transient( $cache_key );
|
560 |
+
if ( false !== ( $output ) ) {
|
561 |
+
// phpcs:ignore
|
562 |
+
echo $output; // complex HTML widget.
|
563 |
+
return true;
|
564 |
}
|
565 |
/**
|
566 |
+
* Only display dummy output which then loads the content via AJAX
|
567 |
*/
|
568 |
+
?>
|
569 |
+
<div id="advads-dashboard-widget-placeholder">
|
570 |
+
<img src="<?php echo esc_url( admin_url( 'images/spinner.gif' ) ); ?>" width="20" height="20" alt="spinner"/>
|
571 |
+
<script>advads_load_dashboard_rss_widget_content();</script>
|
572 |
+
</div>
|
573 |
+
<?php
|
574 |
|
575 |
return true;
|
576 |
}
|
577 |
|
578 |
/**
|
579 |
+
* Create the rss output of the widget
|
|
|
|
|
580 |
*/
|
581 |
+
public static function dashboard_widget_function_output() {
|
582 |
+
|
583 |
+
check_ajax_referer( 'advanced-ads-admin-ajax-nonce', 'nonce' );
|
584 |
+
|
585 |
$cache_key = 'dash_' . md5( 'advads_dashboard_widget' );
|
586 |
+
|
587 |
$feeds = array(
|
588 |
array(
|
589 |
'link' => ADVADS_URL,
|
590 |
'url' => ADVADS_URL . 'feed/',
|
591 |
'title' => sprintf(
|
592 |
+
// translators: %s is our URL.
|
593 |
+
__( 'Latest posts on wpadvancedads.com', 'advanced-ads' ),
|
594 |
+
ADVADS_URL
|
595 |
+
),
|
596 |
'items' => 2,
|
597 |
'show_summary' => 1,
|
598 |
'show_author' => 0,
|
599 |
'show_date' => 0,
|
600 |
),
|
601 |
);
|
602 |
+
|
603 |
+
// create output and also cache it.
|
604 |
+
|
605 |
ob_start();
|
606 |
+
foreach ( $feeds as $_feed ) {
|
607 |
echo '<div class="rss-widget">';
|
608 |
+
echo '<h4>' . esc_html( $_feed['title'] ) . '</h4>';
|
609 |
wp_widget_rss_output( $_feed['url'], $_feed );
|
610 |
echo '</div>';
|
611 |
}
|
612 |
+
|
613 |
$feed_content = ob_get_clean();
|
614 |
$error_string = '<strong>' . __( 'RSS Error:' ) . '</strong> ';
|
615 |
+
|
616 |
+
// empty the widget content, if we find the error string in it.
|
617 |
+
if ( strpos( $feed_content, $error_string ) ) {
|
618 |
$feed_content = '';
|
619 |
}
|
620 |
+
|
621 |
+
// phpcs:ignore
|
622 |
echo $feed_content;
|
623 |
+
|
624 |
+
set_transient( $cache_key, $feed_content, 48 * HOUR_IN_SECONDS ); // Default lifetime in cache of 48 hours.
|
625 |
die();
|
626 |
}
|
627 |
+
|
628 |
/**
|
629 |
+
* Fixes a WP QUADS PRO compatibility issue
|
630 |
* they inject their ad optimization meta box into our ad page, even though it is not a public post type
|
631 |
* using they filter, we remove AA from the list of post types they inject this box into
|
632 |
+
*
|
633 |
+
* @param array $allowed_post_types array of allowed post types.
|
634 |
+
* @return array
|
635 |
*/
|
636 |
+
public function fix_wpquadspro_issue( $allowed_post_types ) {
|
637 |
unset( $allowed_post_types['advanced_ads'] );
|
638 |
return $allowed_post_types;
|
639 |
}
|
admin/includes/class-notices.php
CHANGED
@@ -5,7 +5,6 @@
|
|
5 |
*
|
6 |
* @package WordPress
|
7 |
* @subpackage Advanced Ads Plugin
|
8 |
-
* @since 1.4.5
|
9 |
*/
|
10 |
class Advanced_Ads_Admin_Notices {
|
11 |
|
@@ -17,7 +16,6 @@ class Advanced_Ads_Admin_Notices {
|
|
17 |
/**
|
18 |
* Instance of this class
|
19 |
*
|
20 |
-
* @since 1.5.3
|
21 |
* @var object
|
22 |
*/
|
23 |
protected static $instance = null;
|
@@ -25,7 +23,6 @@ class Advanced_Ads_Admin_Notices {
|
|
25 |
/**
|
26 |
* Options
|
27 |
*
|
28 |
-
* @since 1.5.3
|
29 |
* @var array
|
30 |
*/
|
31 |
protected $options;
|
@@ -33,7 +30,6 @@ class Advanced_Ads_Admin_Notices {
|
|
33 |
/**
|
34 |
* Notices to be displayed
|
35 |
*
|
36 |
-
* @since 1.5.3
|
37 |
* @var array
|
38 |
*/
|
39 |
public $notices = array();
|
@@ -60,12 +56,11 @@ class Advanced_Ads_Admin_Notices {
|
|
60 |
* Return an instance of this class.
|
61 |
*
|
62 |
* @return object A single instance of this class.
|
63 |
-
* @since 1.5.3
|
64 |
*/
|
65 |
public static function get_instance() {
|
66 |
|
67 |
// if the single instance hasn't been set, set it now.
|
68 |
-
if ( null
|
69 |
self::$instance = new self();
|
70 |
}
|
71 |
|
@@ -74,9 +69,6 @@ class Advanced_Ads_Admin_Notices {
|
|
74 |
|
75 |
/**
|
76 |
* Load admin notices
|
77 |
-
*
|
78 |
-
* @since 1.4.5
|
79 |
-
* @updated 1.5.3 moved from admin class here
|
80 |
*/
|
81 |
public function load_notices() {
|
82 |
|
@@ -92,8 +84,6 @@ class Advanced_Ads_Admin_Notices {
|
|
92 |
|
93 |
// don’t check non-critical notices if they are disabled.
|
94 |
if ( ! isset( $plugin_options['disable-notices'] ) ) {
|
95 |
-
// handle version notices.
|
96 |
-
$this->register_version_notices();
|
97 |
// check other notices.
|
98 |
$this->check_notices();
|
99 |
}
|
@@ -104,30 +94,6 @@ class Advanced_Ads_Admin_Notices {
|
|
104 |
}
|
105 |
}
|
106 |
|
107 |
-
/**
|
108 |
-
* Register update notices
|
109 |
-
*
|
110 |
-
* @deprecated since we don’t have any update notices and this logic didn’t work reliably in the past, probably because it was disabled for AJAX calls.
|
111 |
-
*/
|
112 |
-
public function register_version_notices() {
|
113 |
-
if ( defined( 'DOING_AJAX' ) ) {
|
114 |
-
return;
|
115 |
-
}
|
116 |
-
|
117 |
-
$internal_options = $this->plugin->internal_options();
|
118 |
-
$plugin_options = $this->plugin->options();
|
119 |
-
|
120 |
-
// set an artificial older version for updates on installed plugins before the notice logic was invented.
|
121 |
-
if ( ! isset( $internal_options['version'] ) && array() !== $plugin_options ) {
|
122 |
-
$old_version = '1.4.4';
|
123 |
-
} elseif ( isset( $internal_options['version'] ) ) {
|
124 |
-
$old_version = $internal_options['version'];
|
125 |
-
} else {
|
126 |
-
// empty version for new installations.
|
127 |
-
$old_version = 0;
|
128 |
-
}
|
129 |
-
}
|
130 |
-
|
131 |
/**
|
132 |
* Update version number to latest one
|
133 |
*/
|
@@ -174,7 +140,7 @@ class Advanced_Ads_Admin_Notices {
|
|
174 |
|
175 |
// register intro message.
|
176 |
if ( ! $number_of_ads
|
177 |
-
|
178 |
$this->notices[] = 'nl_intro';
|
179 |
} elseif ( $number_of_ads ) {
|
180 |
$key = array_search( 'nl_intro', $this->notices, true );
|
@@ -185,10 +151,10 @@ class Advanced_Ads_Admin_Notices {
|
|
185 |
|
186 |
// ask for a review after 2 days and when 3 ads were created and when not paused.
|
187 |
if ( ! in_array( 'review', $queue, true )
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
) {
|
193 |
$this->notices[] = 'review';
|
194 |
} elseif ( in_array( 'review', $queue, true ) && 3 > $number_of_ads ) {
|
@@ -265,7 +231,8 @@ class Advanced_Ads_Admin_Notices {
|
|
265 |
}
|
266 |
|
267 |
// get queue from options.
|
268 |
-
$
|
|
|
269 |
if ( ! isset( $options['queue'] ) ) {
|
270 |
return;
|
271 |
}
|
@@ -292,7 +259,6 @@ class Advanced_Ads_Admin_Notices {
|
|
292 |
$options['closed'] = $closed;
|
293 |
$options['paused'] = $paused;
|
294 |
|
295 |
-
|
296 |
// only update if changed.
|
297 |
if ( $options_before !== $options ) {
|
298 |
$this->update_options( $options );
|
@@ -306,8 +272,6 @@ class Advanced_Ads_Admin_Notices {
|
|
306 |
* move notice into "paused" with notice as key and timestamp as value
|
307 |
*
|
308 |
* @param string $notice notice to be paused.
|
309 |
-
*
|
310 |
-
* @since 1.8-17
|
311 |
*/
|
312 |
public function hide_notice( $notice ) {
|
313 |
if ( ! isset( $notice ) ) {
|
@@ -315,7 +279,8 @@ class Advanced_Ads_Admin_Notices {
|
|
315 |
}
|
316 |
|
317 |
// get queue from options.
|
318 |
-
$
|
|
|
319 |
if ( ! isset( $options['queue'] ) ) {
|
320 |
return;
|
321 |
}
|
@@ -385,7 +350,7 @@ class Advanced_Ads_Admin_Notices {
|
|
385 |
|
386 |
// don’t display non-global notices on other than plugin related pages.
|
387 |
if ( ( ! isset( $advanced_ads_admin_notices[ $_notice ]['global'] ) || ! $advanced_ads_admin_notices[ $_notice ]['global'] )
|
388 |
-
|
389 |
continue;
|
390 |
}
|
391 |
|
@@ -408,7 +373,7 @@ class Advanced_Ads_Admin_Notices {
|
|
408 |
include ADVADS_BASE_PATH . '/admin/views/notices/error.php';
|
409 |
}
|
410 |
|
411 |
-
if ( ++ $count
|
412 |
break;
|
413 |
}
|
414 |
}
|
@@ -418,7 +383,6 @@ class Advanced_Ads_Admin_Notices {
|
|
418 |
* Return notices options
|
419 |
*
|
420 |
* @return array $options
|
421 |
-
* @since 1.5.3
|
422 |
*/
|
423 |
public function options() {
|
424 |
if ( ! isset( $this->options ) ) {
|
@@ -432,8 +396,6 @@ class Advanced_Ads_Admin_Notices {
|
|
432 |
* Update notices options
|
433 |
*
|
434 |
* @param array $options new options.
|
435 |
-
*
|
436 |
-
* @since 1.5.3
|
437 |
*/
|
438 |
public function update_options( array $options ) {
|
439 |
// do not allow to clear options.
|
@@ -451,7 +413,6 @@ class Advanced_Ads_Admin_Notices {
|
|
451 |
* @param string $notice slug of the subscription notice to send the correct reply.
|
452 |
*
|
453 |
* @return string
|
454 |
-
* @since 1.5.3
|
455 |
*/
|
456 |
public function subscribe( $notice ) {
|
457 |
if ( ! isset( $notice ) ) {
|
@@ -471,7 +432,9 @@ class Advanced_Ads_Admin_Notices {
|
|
471 |
'notice' => $notice,
|
472 |
);
|
473 |
|
474 |
-
$result = wp_remote_post(
|
|
|
|
|
475 |
'method' => 'POST',
|
476 |
'timeout' => 20,
|
477 |
'redirection' => 5,
|
@@ -489,7 +452,7 @@ class Advanced_Ads_Admin_Notices {
|
|
489 |
$this->remove_from_queue( $notice );
|
490 |
|
491 |
// translators: the first %s is an email address, the seconds %s is a URL.
|
492 |
-
return sprintf( __( 'Please check your email (%s) for the confirmation message. If you didn’t receive one or want to use another email address then please use <a href="%s" target="_blank">this form</a> to sign up.', 'advanced-ads' ), $user->user_email, 'http://eepurl.com/bk4z4P' );
|
493 |
}
|
494 |
}
|
495 |
|
5 |
*
|
6 |
* @package WordPress
|
7 |
* @subpackage Advanced Ads Plugin
|
|
|
8 |
*/
|
9 |
class Advanced_Ads_Admin_Notices {
|
10 |
|
16 |
/**
|
17 |
* Instance of this class
|
18 |
*
|
|
|
19 |
* @var object
|
20 |
*/
|
21 |
protected static $instance = null;
|
23 |
/**
|
24 |
* Options
|
25 |
*
|
|
|
26 |
* @var array
|
27 |
*/
|
28 |
protected $options;
|
30 |
/**
|
31 |
* Notices to be displayed
|
32 |
*
|
|
|
33 |
* @var array
|
34 |
*/
|
35 |
public $notices = array();
|
56 |
* Return an instance of this class.
|
57 |
*
|
58 |
* @return object A single instance of this class.
|
|
|
59 |
*/
|
60 |
public static function get_instance() {
|
61 |
|
62 |
// if the single instance hasn't been set, set it now.
|
63 |
+
if ( null === self::$instance ) {
|
64 |
self::$instance = new self();
|
65 |
}
|
66 |
|
69 |
|
70 |
/**
|
71 |
* Load admin notices
|
|
|
|
|
|
|
72 |
*/
|
73 |
public function load_notices() {
|
74 |
|
84 |
|
85 |
// don’t check non-critical notices if they are disabled.
|
86 |
if ( ! isset( $plugin_options['disable-notices'] ) ) {
|
|
|
|
|
87 |
// check other notices.
|
88 |
$this->check_notices();
|
89 |
}
|
94 |
}
|
95 |
}
|
96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
/**
|
98 |
* Update version number to latest one
|
99 |
*/
|
140 |
|
141 |
// register intro message.
|
142 |
if ( ! $number_of_ads
|
143 |
+
&& array() === $options && ! in_array( 'nl_intro', $queue, true ) && ! isset( $closed['nl_intro'] ) ) {
|
144 |
$this->notices[] = 'nl_intro';
|
145 |
} elseif ( $number_of_ads ) {
|
146 |
$key = array_search( 'nl_intro', $this->notices, true );
|
151 |
|
152 |
// ask for a review after 2 days and when 3 ads were created and when not paused.
|
153 |
if ( ! in_array( 'review', $queue, true )
|
154 |
+
&& ! isset( $closed['review'] )
|
155 |
+
&& ( ! isset( $paused['review'] ) || $paused['review'] <= time() )
|
156 |
+
&& 172800 < ( time() - $activation )
|
157 |
+
&& 3 <= $number_of_ads
|
158 |
) {
|
159 |
$this->notices[] = 'review';
|
160 |
} elseif ( in_array( 'review', $queue, true ) && 3 > $number_of_ads ) {
|
231 |
}
|
232 |
|
233 |
// get queue from options.
|
234 |
+
$options = $this->options();
|
235 |
+
$options_before = $options;
|
236 |
if ( ! isset( $options['queue'] ) ) {
|
237 |
return;
|
238 |
}
|
259 |
$options['closed'] = $closed;
|
260 |
$options['paused'] = $paused;
|
261 |
|
|
|
262 |
// only update if changed.
|
263 |
if ( $options_before !== $options ) {
|
264 |
$this->update_options( $options );
|
272 |
* move notice into "paused" with notice as key and timestamp as value
|
273 |
*
|
274 |
* @param string $notice notice to be paused.
|
|
|
|
|
275 |
*/
|
276 |
public function hide_notice( $notice ) {
|
277 |
if ( ! isset( $notice ) ) {
|
279 |
}
|
280 |
|
281 |
// get queue from options.
|
282 |
+
$options = $this->options();
|
283 |
+
$options_before = $options;
|
284 |
if ( ! isset( $options['queue'] ) ) {
|
285 |
return;
|
286 |
}
|
350 |
|
351 |
// don’t display non-global notices on other than plugin related pages.
|
352 |
if ( ( ! isset( $advanced_ads_admin_notices[ $_notice ]['global'] ) || ! $advanced_ads_admin_notices[ $_notice ]['global'] )
|
353 |
+
&& ! Advanced_Ads_Admin::screen_belongs_to_advanced_ads() ) {
|
354 |
continue;
|
355 |
}
|
356 |
|
373 |
include ADVADS_BASE_PATH . '/admin/views/notices/error.php';
|
374 |
}
|
375 |
|
376 |
+
if ( self::MAX_NOTICES === ++ $count ) {
|
377 |
break;
|
378 |
}
|
379 |
}
|
383 |
* Return notices options
|
384 |
*
|
385 |
* @return array $options
|
|
|
386 |
*/
|
387 |
public function options() {
|
388 |
if ( ! isset( $this->options ) ) {
|
396 |
* Update notices options
|
397 |
*
|
398 |
* @param array $options new options.
|
|
|
|
|
399 |
*/
|
400 |
public function update_options( array $options ) {
|
401 |
// do not allow to clear options.
|
413 |
* @param string $notice slug of the subscription notice to send the correct reply.
|
414 |
*
|
415 |
* @return string
|
|
|
416 |
*/
|
417 |
public function subscribe( $notice ) {
|
418 |
if ( ! isset( $notice ) ) {
|
432 |
'notice' => $notice,
|
433 |
);
|
434 |
|
435 |
+
$result = wp_remote_post(
|
436 |
+
'https://wpadvancedads.com/remote/subscribe.php?source=plugin',
|
437 |
+
array(
|
438 |
'method' => 'POST',
|
439 |
'timeout' => 20,
|
440 |
'redirection' => 5,
|
452 |
$this->remove_from_queue( $notice );
|
453 |
|
454 |
// translators: the first %s is an email address, the seconds %s is a URL.
|
455 |
+
return sprintf( __( 'Please check your email (%1$s) for the confirmation message. If you didn’t receive one or want to use another email address then please use <a href="%2$s" target="_blank">this form</a> to sign up.', 'advanced-ads' ), $user->user_email, 'http://eepurl.com/bk4z4P' );
|
456 |
}
|
457 |
}
|
458 |
|
admin/includes/class-options.php
CHANGED
@@ -1,10 +1,9 @@
|
|
1 |
<?php
|
2 |
-
defined( 'ABSPATH'
|
3 |
|
4 |
/**
|
5 |
-
*
|
6 |
*/
|
7 |
-
|
8 |
class Advanced_Ads_Admin_Options {
|
9 |
/**
|
10 |
* Instance of this class.
|
@@ -13,6 +12,9 @@ class Advanced_Ads_Admin_Options {
|
|
13 |
*/
|
14 |
protected static $instance = null;
|
15 |
|
|
|
|
|
|
|
16 |
private function __construct() {
|
17 |
}
|
18 |
|
@@ -23,37 +25,45 @@ class Advanced_Ads_Admin_Options {
|
|
23 |
*/
|
24 |
public static function get_instance() {
|
25 |
// If the single instance hasn't been set, set it now.
|
26 |
-
if ( null
|
27 |
-
self::$instance = new self;
|
28 |
}
|
29 |
|
30 |
return self::$instance;
|
31 |
}
|
32 |
-
|
33 |
/**
|
34 |
-
*
|
35 |
-
*
|
36 |
-
* @param string
|
37 |
-
* @param string
|
38 |
-
* @param string
|
39 |
-
* @param string
|
40 |
-
*
|
41 |
*/
|
42 |
-
public static function render_option( $id, $title, $content, $description = '' ){
|
43 |
-
|
44 |
/**
|
45 |
-
*
|
46 |
* this would allow add-ons to dynamically hide/show only attributes belonging to them, practically not used now
|
47 |
*/
|
48 |
$class = apply_filters( 'advanced-ads-option-class', $id );
|
49 |
?>
|
50 |
-
<div class="advads-option advads-option-<?php echo $class; ?>">
|
51 |
-
|
52 |
-
|
53 |
-
<?php
|
54 |
-
|
55 |
-
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
}
|
58 |
|
59 |
}
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || exit;
|
3 |
|
4 |
/**
|
5 |
+
* Logic to render options for ads, groups and placements
|
6 |
*/
|
|
|
7 |
class Advanced_Ads_Admin_Options {
|
8 |
/**
|
9 |
* Instance of this class.
|
12 |
*/
|
13 |
protected static $instance = null;
|
14 |
|
15 |
+
/**
|
16 |
+
* Advanced_Ads_Admin_Options constructor.
|
17 |
+
*/
|
18 |
private function __construct() {
|
19 |
}
|
20 |
|
25 |
*/
|
26 |
public static function get_instance() {
|
27 |
// If the single instance hasn't been set, set it now.
|
28 |
+
if ( null === self::$instance ) {
|
29 |
+
self::$instance = new self();
|
30 |
}
|
31 |
|
32 |
return self::$instance;
|
33 |
}
|
34 |
+
|
35 |
/**
|
36 |
+
* Create a wrapper for a single option line
|
37 |
+
*
|
38 |
+
* @param string $id internal id of the option wrapper.
|
39 |
+
* @param string $title label of the option.
|
40 |
+
* @param string $content content of the option.
|
41 |
+
* @param string $description description of the option.
|
|
|
42 |
*/
|
43 |
+
public static function render_option( $id, $title, $content, $description = '' ) {
|
44 |
+
|
45 |
/**
|
46 |
+
* This filter allows to extend the class dynamically by add-ons
|
47 |
* this would allow add-ons to dynamically hide/show only attributes belonging to them, practically not used now
|
48 |
*/
|
49 |
$class = apply_filters( 'advanced-ads-option-class', $id );
|
50 |
?>
|
51 |
+
<div class="advads-option advads-option-<?php echo esc_attr( $class ); ?>">
|
52 |
+
<span><?php echo esc_html( $title ); ?></span>
|
53 |
+
<div>
|
54 |
+
<?php
|
55 |
+
// phpcs:ignore
|
56 |
+
echo $content; // could include various HTML elements.
|
57 |
+
?>
|
58 |
+
<?php
|
59 |
+
if ( $description ) :
|
60 |
+
// phpcs:ignore
|
61 |
+
echo '<p class="description">' . $description . '</p>'; // could include various HTML elements.
|
62 |
+
endif;
|
63 |
+
?>
|
64 |
+
</div>
|
65 |
+
</div>
|
66 |
+
<?php
|
67 |
}
|
68 |
|
69 |
}
|
admin/includes/class-overview-widgets.php
CHANGED
@@ -1,33 +1,34 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
* @package WordPress
|
6 |
* @subpackage Advanced Ads Plugin
|
7 |
-
* @since 1.4.3
|
8 |
*/
|
9 |
class Advanced_Ads_Overview_Widgets_Callbacks {
|
10 |
/**
|
11 |
-
*
|
12 |
* with the help of this little bool
|
|
|
|
|
13 |
*/
|
14 |
private static $processed_adsense_stats_js = false;
|
15 |
-
|
16 |
/**
|
17 |
-
*
|
18 |
* one is enough, that's why we need to remember it.
|
|
|
|
|
19 |
*/
|
20 |
private static $gadsense_dashboard_nonce = false;
|
21 |
-
|
22 |
-
|
23 |
/**
|
24 |
-
*
|
25 |
-
*
|
26 |
-
* @since 1.4.3
|
27 |
*/
|
28 |
-
public static function setup_overview_widgets(){
|
29 |
-
|
30 |
-
// initiate i18n notice
|
31 |
new Yoast_I18n_WordPressOrg_v3(
|
32 |
array(
|
33 |
'textdomain' => 'advanced-ads',
|
@@ -35,644 +36,796 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
|
|
35 |
'hook' => 'advanced-ads-overview-below-support',
|
36 |
)
|
37 |
);
|
38 |
-
|
39 |
-
// show errors
|
40 |
-
if( Advanced_Ads_Ad_Health_Notices::notices_enabled()
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
self::add_meta_box(
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
if ( Advanced_Ads_AdSense_Data::get_instance()->is_setup()
|
50 |
-
&& ! Advanced_Ads_AdSense_Data::get_instance()->is_hide_stats() ){
|
51 |
-
$disable_link_markup = '<span class="advads-hndlelinks hndle"><a href="' . esc_url( admin_url( 'admin.php?page=advanced-ads-settings#top#adsense' ) ) . '" target="_blank">' . esc_attr__('Disable', 'advanced-ads') . '</a></span>';
|
52 |
|
53 |
-
self::add_meta_box(
|
54 |
-
'
|
|
|
|
|
|
|
|
|
55 |
}
|
56 |
|
57 |
-
// add widgets for pro add ons
|
58 |
-
self::add_meta_box('advads_overview_addons', __( 'Add-Ons', 'advanced-ads' ), 'full', 'render_addons' );
|
59 |
-
|
60 |
do_action( 'advanced-ads-overview-widgets-after' );
|
61 |
}
|
62 |
-
|
63 |
/**
|
64 |
-
*
|
|
|
|
|
|
|
|
|
|
|
65 |
*/
|
66 |
-
public static function add_meta_box( $id = '', $title = '', $position = 'full', $callback ){
|
67 |
-
|
68 |
ob_start();
|
69 |
-
call_user_func(array('Advanced_Ads_Overview_Widgets_Callbacks', $callback));
|
70 |
do_action( 'advanced-ads-overview-widget-content-' . $id, $id );
|
71 |
$content = ob_get_clean();
|
72 |
-
|
73 |
-
include
|
74 |
-
|
75 |
}
|
76 |
-
|
77 |
/**
|
78 |
-
*
|
79 |
-
*
|
80 |
-
* @since 1.11.x
|
81 |
*/
|
82 |
-
public static function render_notices(){
|
83 |
|
84 |
-
/*?><span class="advads-loader"></span>
|
85 |
-
<script>jQuery( document ).ready( function(){ advads_display_ad_health_notices(); });</script><?php*/
|
86 |
Advanced_Ads_Ad_Health_Notices::get_instance()->render_widget();
|
87 |
-
?><script>jQuery( document ).ready( function(){ advads_ad_health_maybe_remove_list(); });</script
|
88 |
-
|
|
|
89 |
}
|
90 |
-
|
91 |
|
92 |
/**
|
93 |
-
*
|
94 |
-
*
|
95 |
-
* @since 1.5.4
|
96 |
*/
|
97 |
-
public static function render_next_steps(){
|
98 |
|
99 |
$primary_taken = false;
|
100 |
-
|
101 |
-
$model
|
102 |
$recent_ads = $model->get_ads();
|
103 |
-
if ( count( $recent_ads )
|
104 |
-
echo '<p><a class="button button-primary" href="' . admin_url( 'post-new.php?post_type=' . Advanced_Ads::POST_TYPE_SLUG ) .
|
105 |
-
'">' . __( 'Create your first ad', 'advanced-ads' ) . '</a></p>';
|
106 |
// Connect to AdSense
|
107 |
-
echo '<p><a class="button button-primary" href="' . admin_url( 'admin.php?page=advanced-ads-settings#top#adsense' ) .
|
108 |
'">' . esc_attr__( 'Connect to AdSense', 'advanced-ads' ) . '</a></p>';
|
109 |
$primary_taken = true;
|
110 |
endif;
|
111 |
-
|
112 |
$is_subscribed = Advanced_Ads_Admin_Notices::get_instance()->is_subscribed();
|
113 |
$can_subscribe = Advanced_Ads_Admin_Notices::get_instance()->user_can_subscribe();
|
114 |
-
$options
|
115 |
|
116 |
$_notice = 'nl_free_addons';
|
117 |
if ( $can_subscribe ) {
|
118 |
-
|
|
|
119 |
<ul>
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
</ul>
|
124 |
<div class="advads-admin-notice">
|
125 |
<p>
|
126 |
-
<button type="button" class="button-<?php echo ( $primary_taken ) ? 'secondary' : 'primary'; ?> advads-notices-button-subscribe" data-notice="<?php echo $_notice ?>">
|
127 |
-
<?php
|
128 |
</button>
|
129 |
</p>
|
130 |
</div>
|
131 |
<?php
|
132 |
} elseif ( count( $recent_ads ) > 3
|
133 |
-
&& ! isset($options[
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
|
|
141 |
<span class="dashicons dashicons-smiley"></span> <a href="javascript:void(0)" target=_"blank" class="advads-notice-dismiss">
|
142 |
-
|
143 |
-
|
144 |
-
</div
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
|
|
149 |
}
|
150 |
|
151 |
$all_access = Advanced_Ads_Admin_Licenses::get_instance()->get_probably_all_access();
|
152 |
if ( $is_subscribed && ! $all_access ) {
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
/*$_notice = 'nl_adsense';
|
157 |
-
if ( ! isset($options['closed'][ $_notice ] ) ) {
|
158 |
-
?><div class="advads-admin-notice">
|
159 |
-
<p><?php _e( 'Learn more about how and <strong>how much you can earn with AdSense</strong> and Advanced Ads from the dedicated newsletter group.', 'advanced-ads' ); ?></p>
|
160 |
-
<button type="button" class="button-primary advads-notices-button-subscribe" data-notice="<?php echo $_notice ?>"><?php _e('Subscribe me now', 'advanced-ads'); ?></button>
|
161 |
-
</div><?php
|
162 |
}
|
163 |
-
|
164 |
-
$_notice = 'nl_first_steps';
|
165 |
-
if ( ! isset($options['closed'][ $_notice ] ) && ! $is_subscribed ) {
|
166 |
-
?><div class="advads-admin-notice">
|
167 |
-
<p><?php _e( 'Get the first steps and more tutorials to your inbox.', 'advanced-ads' ); ?></p>
|
168 |
-
<button type="button" class="button-primary advads-notices-button-subscribe" data-notice="<?php echo $_notice ?>"><?php _e('Send it now', 'advanced-ads'); ?></button>
|
169 |
-
</div><?php
|
170 |
-
}*/
|
171 |
-
|
172 |
}
|
173 |
|
174 |
/**
|
175 |
-
*
|
176 |
*/
|
177 |
-
public static function render_support(){
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
$displayed_count = count( Advanced_Ads_Ad_Health_Notices::get_instance()->displayed_notices );
|
186 |
-
if(
|
187 |
// translators: %s includes a number and markup like <span class="count">6</span>.
|
188 |
-
|
189 |
-
|
190 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
}
|
192 |
|
193 |
-
|
194 |
-
|
195 |
}
|
196 |
-
|
197 |
/**
|
198 |
-
*
|
199 |
*/
|
200 |
-
public static function render_adsense_stats(){
|
201 |
-
$option_name
|
202 |
-
$filter_value = get_option($option_name, null);
|
203 |
-
if (! $filter_value){
|
204 |
$filter_value = self::get_site_domain();
|
205 |
}
|
206 |
-
if (
|
|
|
|
|
207 |
$advads_gadsense_options = array(
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
);
|
212 |
-
include
|
213 |
}
|
214 |
-
|
215 |
-
|
216 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
self::$processed_adsense_stats_js = true;
|
218 |
-
$nonce
|
219 |
-
|
|
|
220 |
window.gadsenseData = window.gadsenseData || {};
|
221 |
-
gadsenseData['pubId'] = '<?php echo $pub_id; ?>';
|
222 |
-
window.Advanced_Ads_Adsense_Helper.nonce = '<?php echo $nonce
|
223 |
-
</script
|
|
|
224 |
}
|
225 |
-
|
226 |
-
|
227 |
-
|
|
|
|
|
|
|
|
|
|
|
228 |
self::$gadsense_dashboard_nonce = wp_create_nonce( 'advads-gadsense-dashboard' );
|
229 |
}
|
230 |
return self::$gadsense_dashboard_nonce;
|
231 |
}
|
232 |
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
|
|
238 |
$site = get_site_url();
|
239 |
-
preg_match(
|
240 |
-
$domain = count($matches) > 1 ? $matches[2] : null;
|
241 |
return $domain;
|
242 |
}
|
243 |
-
|
244 |
/**
|
245 |
-
*
|
246 |
* it takes an associative options array as parameter to create a summary object,
|
247 |
-
* which can be used to create a json or html response.
|
248 |
-
*
|
|
|
249 |
* @return Advanced_Ads_AdSense_Dashboard_Summary
|
250 |
*/
|
251 |
-
public static function create_dashboard_summary($options){
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
|
|
|
|
|
|
|
|
|
|
263 |
$hide_dimensions = $options['hide_dimensions'];
|
264 |
-
$force_refresh
|
265 |
-
$allow_refresh
|
266 |
-
|
267 |
-
$pub_id
|
268 |
-
$optional_dimension_names = $dimension_name
|
269 |
-
|
270 |
-
$summary = Advanced_Ads_AdSense_Report_Builder::createDashboardSummary($dimension_name, $filter_value,
|
271 |
-
if ($hide_dimensions){
|
272 |
$summary->dimensions = null;
|
273 |
}
|
274 |
$summary->hide_dimensions = $hide_dimensions;
|
275 |
return $summary;
|
276 |
}
|
277 |
/**
|
278 |
-
*
|
279 |
-
*
|
|
|
280 |
* @return array an associative array with ad codes as key and their respective name as value
|
281 |
*/
|
282 |
-
public static function get_ad_code_map($pub_id){
|
283 |
-
$map
|
284 |
-
$ad_units_opts = get_option(Advanced_Ads_AdSense_MAPI::OPTNAME);
|
285 |
-
if (! isset($ad_units_opts['accounts']))
|
286 |
-
|
287 |
-
|
|
|
|
|
288 |
$units = $account['ad_units'];
|
289 |
-
foreach ($units as $unit){
|
290 |
-
$map[$unit['code']] = $unit['name'];
|
291 |
}
|
292 |
}
|
293 |
}
|
294 |
return $map;
|
295 |
}
|
296 |
-
|
297 |
-
|
298 |
/**
|
299 |
-
*
|
300 |
* it prints the relevant data as json, then dies.
|
301 |
*/
|
302 |
-
public static function ajax_gadsense_dashboard(){
|
303 |
-
//
|
304 |
-
|
305 |
-
$
|
306 |
-
|
307 |
-
|
308 |
-
|
|
|
|
|
|
|
|
|
309 |
$errors = array();
|
310 |
-
//
|
311 |
-
if ( ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_manage_options') ) ) {
|
312 |
-
$errors[] =
|
313 |
}
|
314 |
-
// check nonce
|
315 |
-
if (! check_ajax_referer( 'advads-gadsense-dashboard', 'nonce', false)){
|
316 |
-
$errors[] =
|
317 |
}
|
318 |
-
|
319 |
-
//
|
320 |
-
if (count($errors) > 0){
|
321 |
-
$r = array(
|
|
|
|
|
|
|
|
|
|
|
322 |
header( 'Content-Type: application/json' );
|
323 |
-
echo wp_json_encode($r);
|
324 |
die();
|
325 |
}
|
326 |
-
|
327 |
-
|
328 |
$options = array(
|
329 |
-
|
330 |
);
|
331 |
-
if ($dimension_name
|
332 |
-
if ($filter_value){
|
333 |
-
update_option(
|
334 |
}
|
|
|
|
|
335 |
}
|
336 |
-
|
337 |
-
$
|
338 |
}
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
$
|
343 |
-
$summary = self::create_dashboard_summary($options);
|
344 |
$r['summary'] = $summary;
|
345 |
-
|
346 |
header( 'Content-Type: application/json' );
|
347 |
-
echo wp_json_encode($r);
|
348 |
die();
|
349 |
}
|
350 |
-
|
351 |
-
|
352 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
353 |
<?php echo $title; ?>
|
354 |
-
<div class="advanced-ads-stats-box-main"
|
|
|
|
|
|
|
|
|
|
|
355 |
<?php echo $footer; ?>
|
356 |
-
</div
|
|
|
357 |
}
|
358 |
|
359 |
/**
|
360 |
-
*
|
361 |
-
*
|
362 |
-
* @param bool
|
363 |
*/
|
364 |
-
public static function render_addons( $hide_activated = false ){
|
365 |
|
366 |
$link = ADVADS_URL . 'manual/how-to-install-an-add-on/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-install-add-ons';
|
367 |
-
|
|
|
|
|
368 |
|
369 |
$caching_used = Advanced_Ads_Checks::cache();
|
370 |
|
371 |
-
|
372 |
-
|
373 |
-
<
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
// RESPONSIVE
|
507 |
-
if( isset( $installed_plugins['advanced-ads-responsive/responsive-ads.php'] ) && ! class_exists( 'Advanced_Ads_Responsive_Plugin') ){ // is installed, but not active
|
508 |
-
$add_ons['responsive']['link'] = wp_nonce_url( 'plugins.php?action=activate&plugin=advanced-ads-responsive/responsive-ads.php&', 'activate-plugin_advanced-ads-responsive/responsive-ads.php' );
|
509 |
-
$add_ons['responsive']['link_title'] = __( 'Activate now', 'advanced-ads' );
|
510 |
-
$installed_pro_plugins++;
|
511 |
-
} elseif( class_exists( 'Advanced_Ads_Responsive_Plugin') ) {
|
512 |
-
$add_ons['responsive']['link'] = ADVADS_URL . 'add-ons/responsive-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons-manual';
|
513 |
-
$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>';
|
514 |
-
$add_ons['responsive']['installed'] = true;
|
515 |
-
$add_ons['responsive']['order'] = 20;
|
516 |
-
$installed_pro_plugins++;
|
517 |
-
|
518 |
-
// remove the add-on
|
519 |
-
if( $hide_activated ){
|
520 |
-
unset( $add_ons['responsive'] );
|
521 |
-
}
|
522 |
-
}
|
523 |
-
|
524 |
-
// STICKY
|
525 |
-
if( isset( $installed_plugins['advanced-ads-sticky-ads/sticky-ads.php'] ) && ! class_exists( 'Advanced_Ads_Sticky_Plugin') ){ // is installed, but not active
|
526 |
-
$add_ons['sticky']['link'] = wp_nonce_url( 'plugins.php?action=activate&plugin=advanced-ads-sticky-ads/sticky-ads.php&', 'activate-plugin_advanced-ads-sticky-ads/sticky-ads.php' );
|
527 |
-
$add_ons['sticky']['link_title'] = __( 'Activate now', 'advanced-ads' );
|
528 |
-
$installed_pro_plugins++;
|
529 |
-
} elseif( class_exists( 'Advanced_Ads_Sticky_Plugin') ) {
|
530 |
-
$add_ons['sticky']['link'] = ADVADS_URL . 'add-ons/sticky-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons-manual';
|
531 |
-
$add_ons['sticky']['desc'] = '';
|
532 |
-
$add_ons['sticky']['installed'] = true;
|
533 |
-
$add_ons['sticky']['order'] = 20;
|
534 |
-
$installed_pro_plugins++;
|
535 |
-
|
536 |
-
// remove the add-on
|
537 |
-
if( $hide_activated ){
|
538 |
-
unset( $add_ons['sticky'] );
|
539 |
-
}
|
540 |
-
}
|
541 |
-
|
542 |
-
// LAYER
|
543 |
-
if( isset( $installed_plugins['advanced-ads-layer/layer-ads.php'] ) && ! class_exists( 'Advanced_Ads_Layer_Plugin') ){ // is installed, but not active
|
544 |
-
$add_ons['layer']['link'] = wp_nonce_url( 'plugins.php?action=activate&plugin=advanced-ads-layer/layer-ads.php&', 'activate-plugin_advanced-ads-layer/layer-ads.php' );
|
545 |
-
$add_ons['layer']['link_title'] = __( 'Activate now', 'advanced-ads' );
|
546 |
-
$installed_pro_plugins++;
|
547 |
-
} elseif( class_exists( 'Advanced_Ads_Layer_Plugin') ) {
|
548 |
-
$add_ons['layer']['link'] = ADVADS_URL . 'add-ons/popup-and-layer-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons-manual';
|
549 |
-
$add_ons['layer']['desc'] = '';
|
550 |
-
$add_ons['layer']['installed'] = true;
|
551 |
-
$add_ons['layer']['order'] = 20;
|
552 |
-
$installed_pro_plugins++;
|
553 |
-
|
554 |
-
// remove the add-on
|
555 |
-
if( $hide_activated ){
|
556 |
-
unset( $add_ons['layer'] );
|
557 |
-
}
|
558 |
-
}
|
559 |
-
|
560 |
-
// SELLING ADS
|
561 |
-
if( isset( $installed_plugins['advanced-ads-selling/advanced-ads-selling.php'] ) && ! class_exists( 'Advanced_Ads_Selling_Plugin') ){ // is installed, but not active
|
562 |
-
$add_ons['selling']['link'] = wp_nonce_url( 'plugins.php?action=activate&plugin=advanced-ads-selling/advanced-ads-selling.php&', 'activate-plugin_advanced-ads-selling/advanced-ads-selling.php' );
|
563 |
-
$add_ons['selling']['link_title'] = __( 'Activate now', 'advanced-ads' );
|
564 |
-
$installed_pro_plugins++;
|
565 |
-
} elseif( class_exists( 'Advanced_Ads_Selling_Plugin') ) {
|
566 |
-
$add_ons['selling']['link'] = ADVADS_URL . 'add-ons/selling-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons-manual';
|
567 |
-
$add_ons['selling']['desc'] = '';
|
568 |
-
$add_ons['selling']['installed'] = true;
|
569 |
-
$add_ons['selling']['order'] = 20;
|
570 |
-
$installed_pro_plugins++;
|
571 |
-
|
572 |
-
// remove the add-on
|
573 |
-
if( $hide_activated ){
|
574 |
-
unset( $add_ons['selling'] );
|
575 |
-
}
|
576 |
-
}
|
577 |
-
|
578 |
-
// GEO TARGETING
|
579 |
-
if( isset( $installed_plugins['advanced-ads-geo/advanced-ads-geo.php'] ) && ! class_exists( 'Advanced_Ads_Geo_Plugin') ){ // is installed, but not active
|
580 |
-
$add_ons['geo']['link'] = wp_nonce_url( 'plugins.php?action=activate&plugin=advanced-ads-geo/advanced-ads-geo.php&', 'activate-plugin_advanced-ads-geo/advanced-ads-geo.php' );
|
581 |
-
$add_ons['geo']['link_title'] = __( 'Activate now', 'advanced-ads' );
|
582 |
-
$installed_pro_plugins++;
|
583 |
-
} elseif( class_exists( 'Advanced_Ads_Geo_Plugin') ) {
|
584 |
-
$add_ons['geo']['link'] = ADVADS_URL . 'add-ons/geo-targeting/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons-manual';
|
585 |
-
$add_ons['geo']['desc'] = '';
|
586 |
-
$add_ons['geo']['installed'] = true;
|
587 |
-
$add_ons['geo']['order'] = 20;
|
588 |
-
$installed_pro_plugins++;
|
589 |
-
|
590 |
-
// remove the add-on
|
591 |
-
if( $hide_activated ){
|
592 |
-
unset( $add_ons['geo'] );
|
593 |
-
}
|
594 |
-
}
|
595 |
-
|
596 |
-
// SLIDER
|
597 |
-
if( isset( $installed_plugins['advanced-ads-slider/slider.php'] ) && ! class_exists( 'Advanced_Ads_Slider_Plugin') ){ // is installed, but not active
|
598 |
-
$add_ons['slider']['link'] = wp_nonce_url( 'plugins.php?action=activate&plugin=advanced-ads-slider/slider.php&', 'activate-plugin_advanced-ads-slider/slider.php' );
|
599 |
-
$add_ons['slider']['link_title'] = __( 'Activate now', 'advanced-ads' );
|
600 |
-
} elseif( class_exists( 'Advanced_Ads_Slider_Plugin') ) {
|
601 |
-
$add_ons['slider']['link'] = ADVADS_URL . 'add-ons/slider/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons-manual';
|
602 |
-
$add_ons['slider']['desc'] = '';
|
603 |
-
$add_ons['slider']['installed'] = true;
|
604 |
-
$add_ons['slider']['order'] = 20;
|
605 |
-
|
606 |
-
// remove the add-on
|
607 |
-
if( $hide_activated ){
|
608 |
-
unset( $add_ons['slider'] );
|
609 |
-
}
|
610 |
-
}
|
611 |
-
|
612 |
-
// add Genesis Ads, if Genesis based theme was detected
|
613 |
-
if( defined( 'PARENT_THEME_NAME') && 'Genesis' === PARENT_THEME_NAME ) {
|
614 |
-
$add_ons['genesis'] = array(
|
615 |
-
'title' => 'Genesis Ads',
|
616 |
-
'desc' => __( 'Use Genesis specific ad positions.', 'advanced-ads' ),
|
617 |
-
'order' => 2,
|
618 |
-
'class' => 'free',
|
619 |
-
'link' => wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . 'advanced-ads-genesis'), 'install-plugin_' . 'advanced-ads-genesis'),
|
620 |
-
'link_title' => __( 'Install now', 'advanced-ads' ),
|
621 |
-
);
|
622 |
-
// handle install link as long as we can not be sure this is done by the Genesis plugin itself
|
623 |
-
if( isset( $installed_plugins['advanced-ads-genesis/genesis-ads.php'] ) ){ // is installed (active or not)
|
624 |
-
unset( $add_ons['genesis'] );
|
625 |
-
}
|
626 |
-
}
|
627 |
-
|
628 |
-
// add Ads for WPBakery Page Builder (formerly Visual Composer), if VC was detected
|
629 |
-
if( defined( 'WPB_VC_VERSION') ) {
|
630 |
-
$add_ons['visual_composer'] = array(
|
631 |
-
'title' => 'Ads for WPBakery Page Builder (formerly Visual Composer)',
|
632 |
-
'desc' => __( 'Manage ad positions with WPBakery Page Builder (formerly Visual Composer).', 'advanced-ads' ),
|
633 |
-
'order' => 2,
|
634 |
-
'class' => 'free',
|
635 |
-
'link' => wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . 'ads-for-visual-composer'), 'install-plugin_' . 'ads-for-visual-composer'),
|
636 |
-
'link_title' => __( 'Install now', 'advanced-ads' ),
|
637 |
-
);
|
638 |
-
// handle install link as long as we can not be sure this is done by the Genesis plugin itself
|
639 |
-
if( isset( $installed_plugins['ads-for-visual-composer/advanced-ads-vc.php'] ) ){ // is installed (active or not)
|
640 |
-
unset( $add_ons['visual_composer'] );
|
641 |
-
}
|
642 |
-
}
|
643 |
-
|
644 |
-
// only show All Access Pitch if less than 2 add-ons exist
|
645 |
-
if( $installed_pro_plugins < 2 ){
|
646 |
-
$add_ons['bundle'] = array(
|
647 |
-
'title' => 'All Access',
|
648 |
-
'desc' => __( 'Our best deal with all add-ons included.', 'advanced-ads' ),
|
649 |
-
'link' => ADVADS_URL . 'add-ons/all-access/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons',
|
650 |
-
'link_title' => __( 'Get full access', 'advanced-ads' ),
|
651 |
-
'link_primary' => true,
|
652 |
-
'order' => 0,
|
653 |
);
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
672 |
}
|
673 |
-
|
674 |
/**
|
675 |
-
*
|
|
|
|
|
|
|
|
|
|
|
676 |
*/
|
677 |
private static function sort_by_order( $a, $b ) {
|
678 |
return $a['order'] - $b['order'];
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Container class for callbacks for overview widgets
|
4 |
*
|
5 |
* @package WordPress
|
6 |
* @subpackage Advanced Ads Plugin
|
|
|
7 |
*/
|
8 |
class Advanced_Ads_Overview_Widgets_Callbacks {
|
9 |
/**
|
10 |
+
* In case one wants to inject several dashboards into a page, we will prevent executing redundant javascript
|
11 |
* with the help of this little bool
|
12 |
+
*
|
13 |
+
* @var mixed
|
14 |
*/
|
15 |
private static $processed_adsense_stats_js = false;
|
16 |
+
|
17 |
/**
|
18 |
+
* When doing ajax request (refreshing the dashboard), we need to have a nonce.
|
19 |
* one is enough, that's why we need to remember it.
|
20 |
+
*
|
21 |
+
* @var mixed
|
22 |
*/
|
23 |
private static $gadsense_dashboard_nonce = false;
|
24 |
+
|
25 |
+
|
26 |
/**
|
27 |
+
* Register the plugin overview widgets
|
|
|
|
|
28 |
*/
|
29 |
+
public static function setup_overview_widgets() {
|
30 |
+
|
31 |
+
// initiate i18n notice.
|
32 |
new Yoast_I18n_WordPressOrg_v3(
|
33 |
array(
|
34 |
'textdomain' => 'advanced-ads',
|
36 |
'hook' => 'advanced-ads-overview-below-support',
|
37 |
)
|
38 |
);
|
39 |
+
|
40 |
+
// show errors.
|
41 |
+
if ( Advanced_Ads_Ad_Health_Notices::notices_enabled()
|
42 |
+
&& count( Advanced_Ads_Ad_Health_Notices::get_instance()->displayed_notices ) ) {
|
43 |
+
self::add_meta_box( 'advads_overview_notices', false, 'full', 'render_notices' );
|
44 |
+
}
|
45 |
+
|
46 |
+
self::add_meta_box(
|
47 |
+
'advads_overview_news',
|
48 |
+
__( 'Next steps', 'advanced-ads' ),
|
49 |
+
'left',
|
50 |
+
'render_next_steps'
|
51 |
+
);
|
52 |
+
self::add_meta_box(
|
53 |
+
'advads_overview_support',
|
54 |
+
__( 'Manual and Support', 'advanced-ads' ),
|
55 |
+
'right',
|
56 |
+
'render_support'
|
57 |
+
);
|
58 |
if ( Advanced_Ads_AdSense_Data::get_instance()->is_setup()
|
59 |
+
&& ! Advanced_Ads_AdSense_Data::get_instance()->is_hide_stats() ) {
|
60 |
+
$disable_link_markup = '<span class="advads-hndlelinks hndle"><a href="' . esc_url( admin_url( 'admin.php?page=advanced-ads-settings#top#adsense' ) ) . '" target="_blank">' . esc_attr__( 'Disable', 'advanced-ads' ) . '</a></span>';
|
61 |
|
62 |
+
self::add_meta_box(
|
63 |
+
'advads_overview_adsense_stats',
|
64 |
+
__( 'AdSense Earnings', 'advanced-ads' ) . $disable_link_markup,
|
65 |
+
'full',
|
66 |
+
'render_adsense_stats'
|
67 |
+
);
|
68 |
}
|
69 |
|
70 |
+
// add widgets for pro add ons.
|
71 |
+
self::add_meta_box( 'advads_overview_addons', __( 'Add-Ons', 'advanced-ads' ), 'full', 'render_addons' );
|
72 |
+
|
73 |
do_action( 'advanced-ads-overview-widgets-after' );
|
74 |
}
|
75 |
+
|
76 |
/**
|
77 |
+
* Loads a meta box into output
|
78 |
+
*
|
79 |
+
* @param string $id meta box ID.
|
80 |
+
* @param string $title title of the meta box.
|
81 |
+
* @param string $position context in which to show the box.
|
82 |
+
* @param callable $callback function that fills the box with the desired content.
|
83 |
*/
|
84 |
+
public static function add_meta_box( $id = '', $title = '', $position = 'full', $callback ) {
|
85 |
+
|
86 |
ob_start();
|
87 |
+
call_user_func( array( 'Advanced_Ads_Overview_Widgets_Callbacks', $callback ) );
|
88 |
do_action( 'advanced-ads-overview-widget-content-' . $id, $id );
|
89 |
$content = ob_get_clean();
|
90 |
+
|
91 |
+
include ADVADS_BASE_PATH . 'admin/views/overview-widget.php';
|
92 |
+
|
93 |
}
|
94 |
+
|
95 |
/**
|
96 |
+
* Render Ad Health notices widget
|
|
|
|
|
97 |
*/
|
98 |
+
public static function render_notices() {
|
99 |
|
|
|
|
|
100 |
Advanced_Ads_Ad_Health_Notices::get_instance()->render_widget();
|
101 |
+
?><script>jQuery( document ).ready( function(){ advads_ad_health_maybe_remove_list(); });</script>
|
102 |
+
<?php
|
103 |
+
|
104 |
}
|
105 |
+
|
106 |
|
107 |
/**
|
108 |
+
* Render next steps widget
|
|
|
|
|
109 |
*/
|
110 |
+
public static function render_next_steps() {
|
111 |
|
112 |
$primary_taken = false;
|
113 |
+
|
114 |
+
$model = Advanced_Ads::get_instance()->get_model();
|
115 |
$recent_ads = $model->get_ads();
|
116 |
+
if ( count( $recent_ads ) === 0 ) :
|
117 |
+
echo '<p><a class="button button-primary" href="' . esc_url( admin_url( 'post-new.php?post_type=' . Advanced_Ads::POST_TYPE_SLUG ) ) .
|
118 |
+
'">' . esc_html( __( 'Create your first ad', 'advanced-ads' ) ) . '</a></p>';
|
119 |
// Connect to AdSense
|
120 |
+
echo '<p><a class="button button-primary" href="' . esc_url( admin_url( 'admin.php?page=advanced-ads-settings#top#adsense' ) ) .
|
121 |
'">' . esc_attr__( 'Connect to AdSense', 'advanced-ads' ) . '</a></p>';
|
122 |
$primary_taken = true;
|
123 |
endif;
|
124 |
+
|
125 |
$is_subscribed = Advanced_Ads_Admin_Notices::get_instance()->is_subscribed();
|
126 |
$can_subscribe = Advanced_Ads_Admin_Notices::get_instance()->user_can_subscribe();
|
127 |
+
$options = Advanced_Ads_Admin_Notices::get_instance()->options();
|
128 |
|
129 |
$_notice = 'nl_free_addons';
|
130 |
if ( $can_subscribe ) {
|
131 |
+
?>
|
132 |
+
<h3><?php esc_html_e( 'Join the newsletter for more benefits', 'advanced-ads' ); ?></h3>
|
133 |
<ul>
|
134 |
+
<li><?php esc_html_e( 'Get 2 free add-ons', 'advanced-ads' ); ?></li>
|
135 |
+
<li><?php esc_html_e( 'Get the first steps and more tutorials to your inbox', 'advanced-ads' ); ?></li>
|
136 |
+
<li><?php esc_html_e( 'How to earn more with AdSense', 'advanced-ads' ); ?></li>
|
137 |
</ul>
|
138 |
<div class="advads-admin-notice">
|
139 |
<p>
|
140 |
+
<button type="button" class="button-<?php echo ( $primary_taken ) ? 'secondary' : 'primary'; ?> advads-notices-button-subscribe" data-notice="<?php echo esc_attr( $_notice ); ?>">
|
141 |
+
<?php esc_html_e( 'Join now', 'advanced-ads' ); ?>
|
142 |
</button>
|
143 |
</p>
|
144 |
</div>
|
145 |
<?php
|
146 |
} elseif ( count( $recent_ads ) > 3
|
147 |
+
&& ! isset( $options['closed']['review'] ) ) {
|
148 |
+
/**
|
149 |
+
* Ask for a review if the review message was not closed before
|
150 |
+
*/
|
151 |
+
?>
|
152 |
+
<div class="advads-admin-notice" data-notice="review">
|
153 |
+
<p><?php esc_html_e( 'Do you find Advanced Ads useful and would like to keep us motivated? Please help us with a review.', 'advanced-ads' ); ?>
|
154 |
+
<p><span class="dashicons dashicons-external"></span> <strong><a href="https://wordpress.org/support/plugin/advanced-ads/reviews/?rate=5#new-post" target=_"blank">
|
155 |
+
<?php esc_html_e( 'Sure, I’ll rate the plugin', 'advanced-ads' ); ?></a></strong>
|
156 |
<span class="dashicons dashicons-smiley"></span> <a href="javascript:void(0)" target=_"blank" class="advads-notice-dismiss">
|
157 |
+
<?php esc_html_e( 'I already did', 'advanced-ads' ); ?></a>
|
158 |
+
</p>
|
159 |
+
</div>
|
160 |
+
<?php
|
161 |
+
} elseif ( count( $recent_ads ) > 0 ) {
|
162 |
+
// link to manage ads.
|
163 |
+
echo '<p><a class="button button-secondary" href="' . esc_url( admin_url( 'edit.php?post_type=' . Advanced_Ads::POST_TYPE_SLUG ) ) .
|
164 |
+
'">' . esc_html__( 'Manage your ads', 'advanced-ads' ) . '</a></p>';
|
165 |
}
|
166 |
|
167 |
$all_access = Advanced_Ads_Admin_Licenses::get_instance()->get_probably_all_access();
|
168 |
if ( $is_subscribed && ! $all_access ) {
|
169 |
+
?>
|
170 |
+
<a class="button button-primary" href="<?php echo esc_url( ADVADS_URL ); ?>add-ons/all-access/#utm_source=advanced-ads&utm_medium=link&utm_campaign=pitch-bundle" target="_blank"><?php esc_html_e( 'Get the All Access pass', 'advanced-ads' ); ?></a>
|
171 |
+
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
}
|
174 |
|
175 |
/**
|
176 |
+
* Support widget
|
177 |
*/
|
178 |
+
public static function render_support() {
|
179 |
+
?>
|
180 |
+
<ul>
|
181 |
+
<li><a href="<?php echo esc_url( ADVADS_URL . 'manual/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-manual' ); ?>" target="_blank">
|
182 |
+
<?php esc_html_e( 'Manual', 'advanced-ads' ); ?>
|
183 |
+
</a>
|
184 |
+
</li>
|
185 |
+
<li><a href="<?php echo esc_url( ADVADS_URL . 'support/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-support' ); ?>" target="_blank">
|
186 |
+
<?php esc_html_e( 'FAQ and Support', 'advanced-ads' ); ?>
|
187 |
+
</a>
|
188 |
+
</li>
|
189 |
+
<li>
|
190 |
+
<?php
|
191 |
+
printf(
|
192 |
+
wp_kses(
|
193 |
+
// translators: %s is a URL.
|
194 |
+
__( 'Thank the developer with a ★★★★★ review on <a href="%s" target="_blank">wordpress.org</a>', 'advanced-ads' ),
|
195 |
+
array(
|
196 |
+
'a' => array(
|
197 |
+
'href' => array(),
|
198 |
+
'target' => array(),
|
199 |
+
),
|
200 |
+
)
|
201 |
+
),
|
202 |
+
'https://wordpress.org/support/plugin/advanced-ads/reviews/#new-post'
|
203 |
+
);
|
204 |
+
?>
|
205 |
+
</li>
|
206 |
+
</ul>
|
207 |
+
<?php
|
208 |
+
|
209 |
+
$ignored_count = count( Advanced_Ads_Ad_Health_Notices::get_instance()->ignore );
|
210 |
$displayed_count = count( Advanced_Ads_Ad_Health_Notices::get_instance()->displayed_notices );
|
211 |
+
if ( ! $displayed_count && $ignored_count ) {
|
212 |
// translators: %s includes a number and markup like <span class="count">6</span>.
|
213 |
+
?>
|
214 |
+
<p><span class="dashicons dashicons-warning"></span> <a href="<?php echo esc_url( wp_nonce_url( admin_url( 'admin.php?page=advanced-ads&advads-show-hidden-notices=true' ), 'advanced-ads-show-hidden-notices', 'advads_nonce' ) ); ?>">
|
215 |
+
<?php
|
216 |
+
printf(
|
217 |
+
// translators: %s is the number of hidden notices.
|
218 |
+
esc_html__( 'Show %s hidden notices', 'advanced-ads' ),
|
219 |
+
absint( $ignored_count )
|
220 |
+
);
|
221 |
+
?>
|
222 |
+
</a></p>
|
223 |
+
<?php
|
224 |
}
|
225 |
|
226 |
+
do_action( 'advanced-ads-overview-below-support' );
|
227 |
+
|
228 |
}
|
229 |
+
|
230 |
/**
|
231 |
+
* Adsense stats widget
|
232 |
*/
|
233 |
+
public static function render_adsense_stats() {
|
234 |
+
$option_name = 'advanced-ads-adsense-dashboard-filter';
|
235 |
+
$filter_value = get_option( $option_name, null );
|
236 |
+
if ( ! $filter_value ) {
|
237 |
$filter_value = self::get_site_domain();
|
238 |
}
|
239 |
+
if ( '*' === $filter_value ) {
|
240 |
+
$filter_value = null;
|
241 |
+
}
|
242 |
$advads_gadsense_options = array(
|
243 |
+
'dimension_name' => 'DOMAIN_NAME',
|
244 |
+
'allow_refresh' => true,
|
245 |
+
'filter_value' => $filter_value,
|
246 |
);
|
247 |
+
include ADVADS_BASE_PATH . 'admin/views/gadsense-dashboard.php';
|
248 |
}
|
249 |
+
|
250 |
+
/**
|
251 |
+
* JavaScript loaded in AdSense stats widget.
|
252 |
+
*
|
253 |
+
* @param string $pub_id AdSense publisher ID.
|
254 |
+
*
|
255 |
+
* @return string
|
256 |
+
* @todo move to JS file.
|
257 |
+
*/
|
258 |
+
final public static function adsense_stats_js( $pub_id ) {
|
259 |
+
if ( self::$processed_adsense_stats_js ) {
|
260 |
+
return;
|
261 |
+
}
|
262 |
self::$processed_adsense_stats_js = true;
|
263 |
+
$nonce = self::get_adsense_dashboard_nonce();
|
264 |
+
?>
|
265 |
+
<script>
|
266 |
window.gadsenseData = window.gadsenseData || {};
|
267 |
+
gadsenseData['pubId'] = '<?php echo esc_html( $pub_id ); ?>';
|
268 |
+
window.Advanced_Ads_Adsense_Helper.nonce = '<?php echo esc_html( $nonce ); ?>';
|
269 |
+
</script>
|
270 |
+
<?php
|
271 |
}
|
272 |
+
|
273 |
+
/**
|
274 |
+
* Return a nonce used in the AdSense stats widget.
|
275 |
+
*
|
276 |
+
* @return false|mixed|string
|
277 |
+
*/
|
278 |
+
final public static function get_adsense_dashboard_nonce() {
|
279 |
+
if ( ! self::$gadsense_dashboard_nonce ) {
|
280 |
self::$gadsense_dashboard_nonce = wp_create_nonce( 'advads-gadsense-dashboard' );
|
281 |
}
|
282 |
return self::$gadsense_dashboard_nonce;
|
283 |
}
|
284 |
|
285 |
+
/**
|
286 |
+
* Extracts the domain from the site url
|
287 |
+
*
|
288 |
+
* @return string the domain, that was extracted from get_site_url()
|
289 |
+
*/
|
290 |
+
public static function get_site_domain() {
|
291 |
$site = get_site_url();
|
292 |
+
preg_match( '|^([\d\w]+://)?([^/]+)|', $site, $matches );
|
293 |
+
$domain = count( $matches ) > 1 ? $matches[2] : null;
|
294 |
return $domain;
|
295 |
}
|
296 |
+
|
297 |
/**
|
298 |
+
* This method should be used, if you want to render a dashboard summary.
|
299 |
* it takes an associative options array as parameter to create a summary object,
|
300 |
+
* which can be used to create a json or html response.
|
301 |
+
*
|
302 |
+
* @param array $options dashboard options.
|
303 |
* @return Advanced_Ads_AdSense_Dashboard_Summary
|
304 |
*/
|
305 |
+
public static function create_dashboard_summary( $options ) {
|
306 |
+
if ( ! $options ) {
|
307 |
+
$options = array();
|
308 |
+
}
|
309 |
+
$options = array_merge(
|
310 |
+
array(
|
311 |
+
'dimension_name' => null,
|
312 |
+
'filter_value' => null,
|
313 |
+
'hide_dimensions' => false,
|
314 |
+
'force_refresh' => false,
|
315 |
+
'allow_refresh' => true,
|
316 |
+
),
|
317 |
+
$options
|
318 |
+
);
|
319 |
+
|
320 |
+
$dimension_name = $options['dimension_name'];
|
321 |
+
$filter_value = $options['filter_value'];
|
322 |
$hide_dimensions = $options['hide_dimensions'];
|
323 |
+
$force_refresh = $options['force_refresh'];
|
324 |
+
$allow_refresh = $options['allow_refresh'];
|
325 |
+
|
326 |
+
$pub_id = Advanced_Ads_AdSense_Data::get_instance()->get_adsense_id();
|
327 |
+
$optional_dimension_names = 'AD_UNIT_CODE' === $dimension_name ? self::get_ad_code_map( $pub_id ) : null;
|
328 |
+
|
329 |
+
$summary = Advanced_Ads_AdSense_Report_Builder::createDashboardSummary( $dimension_name, $filter_value, 'dashboard', $optional_dimension_names, $force_refresh, $allow_refresh );
|
330 |
+
if ( $hide_dimensions ) {
|
331 |
$summary->dimensions = null;
|
332 |
}
|
333 |
$summary->hide_dimensions = $hide_dimensions;
|
334 |
return $summary;
|
335 |
}
|
336 |
/**
|
337 |
+
* We want to display the name of the ad code insted of the code itself.
|
338 |
+
*
|
339 |
+
* @param string $pub_id the publisher id of the adsense account.
|
340 |
* @return array an associative array with ad codes as key and their respective name as value
|
341 |
*/
|
342 |
+
public static function get_ad_code_map( $pub_id ) {
|
343 |
+
$map = array();
|
344 |
+
$ad_units_opts = get_option( Advanced_Ads_AdSense_MAPI::OPTNAME );
|
345 |
+
if ( ! isset( $ad_units_opts['accounts'] ) ) {
|
346 |
+
return null;
|
347 |
+
}
|
348 |
+
foreach ( $ad_units_opts['accounts'] as $key => $account ) {
|
349 |
+
if ( $key === $pub_id && isset( $account['ad_units'] ) && is_array( $account['ad_units'] ) ) {
|
350 |
$units = $account['ad_units'];
|
351 |
+
foreach ( $units as $unit ) {
|
352 |
+
$map[ $unit['code'] ] = $unit['name'];
|
353 |
}
|
354 |
}
|
355 |
}
|
356 |
return $map;
|
357 |
}
|
358 |
+
|
359 |
+
|
360 |
/**
|
361 |
+
* This method is called when the dashboard data is requested via ajax
|
362 |
* it prints the relevant data as json, then dies.
|
363 |
*/
|
364 |
+
public static function ajax_gadsense_dashboard() {
|
365 |
+
// retrieve our post parameters.
|
366 |
+
// phpcs:ignore
|
367 |
+
$dimension_name = isset( $_POST['dimension_name'] ) ? $_POST['dimension_name'] : 'DOMAIN_NAME';
|
368 |
+
// phpcs:ignore
|
369 |
+
$filter_value = isset( $_POST['filter'] ) ? $_POST['filter'] : null;
|
370 |
+
$dimension_name = sanitize_text_field( $dimension_name );
|
371 |
+
if ( $filter_value ) {
|
372 |
+
$filter_value = sanitize_text_field( $filter_value );
|
373 |
+
}
|
374 |
+
|
375 |
$errors = array();
|
376 |
+
// check nonce and capabilities.
|
377 |
+
if ( ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_manage_options' ) ) ) {
|
378 |
+
$errors[] = 'missing capability';
|
379 |
}
|
380 |
+
// check nonce.
|
381 |
+
if ( ! check_ajax_referer( 'advads-gadsense-dashboard', 'nonce', false ) ) {
|
382 |
+
$errors[] = 'invalid request';
|
383 |
}
|
384 |
+
|
385 |
+
// when there is an error, send it right away.
|
386 |
+
if ( count( $errors ) > 0 ) {
|
387 |
+
$r = array(
|
388 |
+
'summary' => array(
|
389 |
+
'valid' => false,
|
390 |
+
'errors' => $errors,
|
391 |
+
),
|
392 |
+
);
|
393 |
header( 'Content-Type: application/json' );
|
394 |
+
echo wp_json_encode( $r );
|
395 |
die();
|
396 |
}
|
397 |
+
|
|
|
398 |
$options = array(
|
399 |
+
'dimension_name' => $dimension_name,
|
400 |
);
|
401 |
+
if ( 'DOMAIN_NAME' === $dimension_name ) {
|
402 |
+
if ( $filter_value ) {
|
403 |
+
update_option( 'advanced-ads-adsense-dashboard-filter', $filter_value );
|
404 |
}
|
405 |
+
} elseif ( 'AD_UNIT_CODE' === $dimension_name ) {
|
406 |
+
$options['hide_dimensions'] = true;
|
407 |
}
|
408 |
+
if ( $filter_value && '*' === $filter_value ) {
|
409 |
+
$filter_value = null;
|
410 |
}
|
411 |
+
$options['filter_value'] = $filter_value;
|
412 |
+
|
413 |
+
$r = array();
|
414 |
+
$summary = self::create_dashboard_summary( $options );
|
|
|
415 |
$r['summary'] = $summary;
|
416 |
+
|
417 |
header( 'Content-Type: application/json' );
|
418 |
+
echo wp_json_encode( $r );
|
419 |
die();
|
420 |
}
|
421 |
+
|
422 |
+
/**
|
423 |
+
* Render stats box
|
424 |
+
*
|
425 |
+
* @param string $title title of the box.
|
426 |
+
* @param string $main main content.
|
427 |
+
* @param string $footer footer content.
|
428 |
+
*
|
429 |
+
* @deprecated ?
|
430 |
+
*/
|
431 |
+
final public static function render_stats_box( $title, $main, $footer ) {
|
432 |
+
?>
|
433 |
+
<div class="advanced-ads-stats-box flex1">
|
434 |
<?php echo $title; ?>
|
435 |
+
<div class="advanced-ads-stats-box-main">
|
436 |
+
<?php
|
437 |
+
// phpcs:ignore
|
438 |
+
echo $main;
|
439 |
+
?>
|
440 |
+
</div>
|
441 |
<?php echo $footer; ?>
|
442 |
+
</div>
|
443 |
+
<?php
|
444 |
}
|
445 |
|
446 |
/**
|
447 |
+
* Pro addons widget
|
448 |
+
*
|
449 |
+
* @param bool $hide_activated if true, hide activated add-ons.
|
450 |
*/
|
451 |
+
public static function render_addons( $hide_activated = false ) {
|
452 |
|
453 |
$link = ADVADS_URL . 'manual/how-to-install-an-add-on/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-install-add-ons';
|
454 |
+
?>
|
455 |
+
<p><a href="<?php echo esc_url( $link ); ?>" target="_blank"><?php echo esc_attr__( 'How to install and activate an add-on.', 'advanced-ads' ); ?></a></p>
|
456 |
+
<?php
|
457 |
|
458 |
$caching_used = Advanced_Ads_Checks::cache();
|
459 |
|
460 |
+
ob_start();
|
461 |
+
?>
|
462 |
+
<p><?php esc_html_e( 'The solution for professional websites.', 'advanced-ads' ); ?></p><ul class='list'>
|
463 |
+
<li>
|
464 |
+
<?php
|
465 |
+
if ( $caching_used ) :
|
466 |
+
|
467 |
+
?>
|
468 |
+
<strong>
|
469 |
+
<?php
|
470 |
+
endif;
|
471 |
+
esc_html_e( 'support for cached sites', 'advanced-ads' );
|
472 |
+
if ( $caching_used ) :
|
473 |
+
|
474 |
+
?>
|
475 |
+
</strong>
|
476 |
+
<?php
|
477 |
+
endif;
|
478 |
+
?>
|
479 |
+
</li>
|
480 |
+
<?php
|
481 |
+
if ( class_exists( 'bbPress', false ) ) :
|
482 |
+
?>
|
483 |
+
<li>
|
484 |
+
<?php
|
485 |
+
printf(
|
486 |
+
// translators: %s is the name of another plugin.
|
487 |
+
wp_kses( __( 'integrates with <strong>%s</strong>', 'advanced-ads' ), array( 'strong' => array() ) ),
|
488 |
+
'bbPress'
|
489 |
+
);
|
490 |
+
?>
|
491 |
+
</li><?php endif; /* bbPress */ ?>
|
492 |
+
<?php
|
493 |
+
if ( class_exists( 'BuddyPress', false ) ) :
|
494 |
+
?>
|
495 |
+
<li>
|
496 |
+
<?php
|
497 |
+
printf(
|
498 |
+
// translators: %s is the name of another plugin.
|
499 |
+
wp_kses( __( 'integrates with <strong>%s</strong>', 'advanced-ads' ), array( 'strong' => array() ) ),
|
500 |
+
'BuddyPress'
|
501 |
+
);
|
502 |
+
?>
|
503 |
+
</li><?php endif; /* BuddyPress */ ?>
|
504 |
+
<?php
|
505 |
+
if ( defined( 'PMPRO_VERSION' ) ) :
|
506 |
+
?>
|
507 |
+
<li>
|
508 |
+
<?php
|
509 |
+
printf(
|
510 |
+
// translators: %s is the name of another plugin.
|
511 |
+
wp_kses( __( 'integrates with <strong>%s</strong>', 'advanced-ads' ), array( 'strong' => array() ) ),
|
512 |
+
'Paid Memberships Pro'
|
513 |
+
);
|
514 |
+
?>
|
515 |
+
</li><?php endif; /* Paid Memberships Pro */ ?>
|
516 |
+
<?php
|
517 |
+
if ( defined( 'ICL_SITEPRESS_VERSION' ) ) :
|
518 |
+
?>
|
519 |
+
<li>
|
520 |
+
<?php
|
521 |
+
printf(
|
522 |
+
// translators: %s is the name of another plugin.
|
523 |
+
wp_kses( __( 'integrates with <strong>%s</strong>', 'advanced-ads' ), array( 'strong' => array() ) ),
|
524 |
+
'WPML'
|
525 |
+
);
|
526 |
+
?>
|
527 |
+
</li><?php endif; /* WPML */ ?>
|
528 |
+
<li><?php esc_html_e( 'click fraud protection, lazy load, ad-block ads', 'advanced-ads' ); ?></li>
|
529 |
+
<li><?php esc_html_e( '11 more display and visitor conditions', 'advanced-ads' ); ?></li>
|
530 |
+
<li><?php esc_html_e( '6 more placements', 'advanced-ads' ); ?></li>
|
531 |
+
<li><?php esc_html_e( 'placement tests for ad optimization', 'advanced-ads' ); ?></li>
|
532 |
+
<li><?php esc_html_e( 'ad grids and many more advanced features', 'advanced-ads' ); ?></li>
|
533 |
+
</ul>
|
534 |
+
<?php
|
535 |
+
$pro_content = ob_get_clean();
|
536 |
+
|
537 |
+
$add_ons = array(
|
538 |
+
'tracking' => array(
|
539 |
+
'title' => 'Tracking',
|
540 |
+
'desc' => __( 'Analyze clicks and impressions of your ads locally or in Google Analytics, share reports, and limit ads to a specific number of impressions or clicks.', 'advanced-ads' ),
|
541 |
+
'link' => ADVADS_URL . 'add-ons/tracking/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons',
|
542 |
+
'order' => 4,
|
543 |
+
),
|
544 |
+
'responsive' => array(
|
545 |
+
'title' => 'Responsive, AMP and Mobile ads',
|
546 |
+
'desc' => __( 'Display ads based on the device or the size of your visitor’s browser, and control ads on AMP pages.', 'advanced-ads' ),
|
547 |
+
'link' => ADVADS_URL . 'add-ons/responsive-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons',
|
548 |
+
'order' => 4,
|
549 |
+
),
|
550 |
+
'pro' => array(
|
551 |
+
'title' => 'Advanced Ads Pro',
|
552 |
+
'desc' => $pro_content,
|
553 |
+
'link' => ADVADS_URL . 'add-ons/advanced-ads-pro/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons',
|
554 |
+
'order' => 4,
|
555 |
+
'class' => 'recommended',
|
556 |
+
),
|
557 |
+
'selling' => array(
|
558 |
+
'title' => 'Selling Ads',
|
559 |
+
'desc' => __( 'Earn more money and let advertisers pay for ad space directly on the frontend of your site.', 'advanced-ads' ),
|
560 |
+
'link' => ADVADS_URL . 'add-ons/selling-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons',
|
561 |
+
'order' => 5,
|
562 |
+
),
|
563 |
+
'geo' => array(
|
564 |
+
'title' => 'Geo Targeting',
|
565 |
+
'desc' => __( 'Target visitors with ads that match their geo location and make more money with regional campaigns.', 'advanced-ads' ),
|
566 |
+
'link' => ADVADS_URL . 'add-ons/geo-targeting/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons',
|
567 |
+
'order' => 5,
|
568 |
+
),
|
569 |
+
'sticky' => array(
|
570 |
+
'title' => 'Sticky ads',
|
571 |
+
'desc' => __( 'Increase click rates on your ads by placing them in sticky positions above, next or below your site.', 'advanced-ads' ),
|
572 |
+
'link' => ADVADS_URL . 'add-ons/sticky-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons',
|
573 |
+
'order' => 5,
|
574 |
+
),
|
575 |
+
'layer' => array(
|
576 |
+
'title' => 'PopUps and Layers',
|
577 |
+
'desc' => __( 'Users will never miss an ad or other information in a PopUp. Choose when it shows up and for how long a user can close it.', 'advanced-ads' ),
|
578 |
+
'link' => ADVADS_URL . 'add-ons/popup-and-layer-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons',
|
579 |
+
'order' => 5,
|
580 |
+
),
|
581 |
+
'slider' => array(
|
582 |
+
'title' => 'Ad Slider',
|
583 |
+
'desc' => __( 'Create a beautiful and simple slider from your ads to show more information on less space.', 'advanced-ads' ),
|
584 |
+
'link' => ADVADS_URL . 'add-ons/slider/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons',
|
585 |
+
'order' => 5,
|
586 |
+
),
|
587 |
+
'adsense-in-feed' => array(
|
588 |
+
'title' => 'AdSense In-feed',
|
589 |
+
'desc' => __( 'Place AdSense In-feed ads between posts on homepage, category, and archive pages.', 'advanced-ads' ),
|
590 |
+
'class' => 'free',
|
591 |
+
'link' => wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=advanced-ads-adsense-in-feed' ), 'install-plugin_advanced-ads-adsense-in-feed' ),
|
592 |
+
'link_title' => __( 'Install now', 'advanced-ads' ),
|
593 |
+
'order' => 9,
|
594 |
+
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
595 |
);
|
596 |
+
|
597 |
+
// get all installed plugins; installed is not activated.
|
598 |
+
$installed_plugins = get_plugins();
|
599 |
+
$installed_pro_plugins = 0;
|
600 |
+
|
601 |
+
// handle AdSense In-feed if already installed or not activated.
|
602 |
+
if ( isset( $installed_plugins['advanced-ads-adsense-in-feed/advanced-ads-in-feed.php'] ) ) { // is installed, but not active.
|
603 |
+
// remove plugin from the list.
|
604 |
+
unset( $add_ons['adsense-in-feed'] );
|
605 |
+
}
|
606 |
+
|
607 |
+
// PRO.
|
608 |
+
if ( isset( $installed_plugins['advanced-ads-pro/advanced-ads-pro.php'] ) && ! class_exists( 'Advanced_Ads_Pro' ) ) { // is installed, but not active.
|
609 |
+
$add_ons['pro']['link'] = wp_nonce_url( 'plugins.php?action=activate&plugin=advanced-ads-pro/advanced-ads-pro.php&', 'activate-plugin_advanced-ads-pro/advanced-ads-pro.php' );
|
610 |
+
$add_ons['pro']['link_title'] = __( 'Activate now', 'advanced-ads' );
|
611 |
+
$installed_pro_plugins++;
|
612 |
+
} elseif ( class_exists( 'Advanced_Ads_Pro' ) ) {
|
613 |
+
$add_ons['pro']['link'] = ADVADS_URL . 'add-ons/advanced-ads-pro/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons-manual';
|
614 |
+
$add_ons['pro']['desc'] = '';
|
615 |
+
$add_ons['pro']['installed'] = true;
|
616 |
+
$add_ons['pro']['order'] = 20;
|
617 |
+
$installed_pro_plugins++;
|
618 |
+
|
619 |
+
// remove the add-on.
|
620 |
+
if ( $hide_activated ) {
|
621 |
+
unset( $add_ons['pro'] );
|
622 |
+
}
|
623 |
+
}
|
624 |
+
|
625 |
+
// TRACKING.
|
626 |
+
if ( isset( $installed_plugins['advanced-ads-tracking/tracking.php'] ) && ! class_exists( 'Advanced_Ads_Tracking_Plugin' ) ) { // is installed, but not active.
|
627 |
+
$add_ons['tracking']['link'] = wp_nonce_url( 'plugins.php?action=activate&plugin=advanced-ads-tracking/tracking.php&', 'activate-plugin_advanced-ads-tracking/tracking.php' );
|
628 |
+
$add_ons['tracking']['link_title'] = __( 'Activate now', 'advanced-ads' );
|
629 |
+
$installed_pro_plugins++;
|
630 |
+
} elseif ( class_exists( 'Advanced_Ads_Tracking_Plugin', false ) &&
|
631 |
+
method_exists( Advanced_Ads_Tracking_Plugin::get_instance(), 'get_tracking_method' ) ) {
|
632 |
+
$add_ons['tracking']['link'] = ADVADS_URL . 'add-ons/tracking/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons-manual';
|
633 |
+
if ( 'ga' !== Advanced_Ads_Tracking_Plugin::get_instance()->get_tracking_method() ) {
|
634 |
+
|
635 |
+
// don’t show Tracking link if Analytics method is enabled.
|
636 |
+
$add_ons['tracking']['desc'] = '<a href="' . admin_url( '/admin.php?page=advanced-ads-stats' ) . '">' . __( 'Visit your ad stats', 'advanced-ads' ) . '</a>';
|
637 |
+
} else {
|
638 |
+
$add_ons['tracking']['desc'] = '';
|
639 |
+
}
|
640 |
+
$add_ons['tracking']['installed'] = true;
|
641 |
+
$add_ons['tracking']['order'] = 20;
|
642 |
+
$installed_pro_plugins++;
|
643 |
+
|
644 |
+
// remove the add-on.
|
645 |
+
if ( $hide_activated ) {
|
646 |
+
unset( $add_ons['tracking'] );
|
647 |
+
}
|
648 |
+
}
|
649 |
+
|
650 |
+
// RESPONSIVE.
|
651 |
+
if ( isset( $installed_plugins['advanced-ads-responsive/responsive-ads.php'] ) && ! class_exists( 'Advanced_Ads_Responsive_Plugin' ) ) { // is installed, but not active.
|
652 |
+
$add_ons['responsive']['link'] = wp_nonce_url( 'plugins.php?action=activate&plugin=advanced-ads-responsive/responsive-ads.php&', 'activate-plugin_advanced-ads-responsive/responsive-ads.php' );
|
653 |
+
$add_ons['responsive']['link_title'] = __( 'Activate now', 'advanced-ads' );
|
654 |
+
$installed_pro_plugins++;
|
655 |
+
} elseif ( class_exists( 'Advanced_Ads_Responsive_Plugin' ) ) {
|
656 |
+
$add_ons['responsive']['link'] = ADVADS_URL . 'add-ons/responsive-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons-manual';
|
657 |
+
$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>';
|
658 |
+
$add_ons['responsive']['installed'] = true;
|
659 |
+
$add_ons['responsive']['order'] = 20;
|
660 |
+
$installed_pro_plugins++;
|
661 |
+
|
662 |
+
// remove the add-on.
|
663 |
+
if ( $hide_activated ) {
|
664 |
+
unset( $add_ons['responsive'] );
|
665 |
+
}
|
666 |
+
}
|
667 |
+
|
668 |
+
// STICKY.
|
669 |
+
if ( isset( $installed_plugins['advanced-ads-sticky-ads/sticky-ads.php'] ) && ! class_exists( 'Advanced_Ads_Sticky_Plugin' ) ) { // is installed, but not active.
|
670 |
+
$add_ons['sticky']['link'] = wp_nonce_url( 'plugins.php?action=activate&plugin=advanced-ads-sticky-ads/sticky-ads.php&', 'activate-plugin_advanced-ads-sticky-ads/sticky-ads.php' );
|
671 |
+
$add_ons['sticky']['link_title'] = __( 'Activate now', 'advanced-ads' );
|
672 |
+
$installed_pro_plugins++;
|
673 |
+
} elseif ( class_exists( 'Advanced_Ads_Sticky_Plugin' ) ) {
|
674 |
+
$add_ons['sticky']['link'] = ADVADS_URL . 'add-ons/sticky-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons-manual';
|
675 |
+
$add_ons['sticky']['desc'] = '';
|
676 |
+
$add_ons['sticky']['installed'] = true;
|
677 |
+
$add_ons['sticky']['order'] = 20;
|
678 |
+
$installed_pro_plugins++;
|
679 |
+
|
680 |
+
// remove the add-on.
|
681 |
+
if ( $hide_activated ) {
|
682 |
+
unset( $add_ons['sticky'] );
|
683 |
+
}
|
684 |
+
}
|
685 |
+
|
686 |
+
// LAYER.
|
687 |
+
if ( isset( $installed_plugins['advanced-ads-layer/layer-ads.php'] ) && ! class_exists( 'Advanced_Ads_Layer_Plugin' ) ) { // is installed, but not active.
|
688 |
+
$add_ons['layer']['link'] = wp_nonce_url( 'plugins.php?action=activate&plugin=advanced-ads-layer/layer-ads.php&', 'activate-plugin_advanced-ads-layer/layer-ads.php' );
|
689 |
+
$add_ons['layer']['link_title'] = __( 'Activate now', 'advanced-ads' );
|
690 |
+
$installed_pro_plugins++;
|
691 |
+
} elseif ( class_exists( 'Advanced_Ads_Layer_Plugin' ) ) {
|
692 |
+
$add_ons['layer']['link'] = ADVADS_URL . 'add-ons/popup-and-layer-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons-manual';
|
693 |
+
$add_ons['layer']['desc'] = '';
|
694 |
+
$add_ons['layer']['installed'] = true;
|
695 |
+
$add_ons['layer']['order'] = 20;
|
696 |
+
$installed_pro_plugins++;
|
697 |
+
|
698 |
+
// remove the add-on.
|
699 |
+
if ( $hide_activated ) {
|
700 |
+
unset( $add_ons['layer'] );
|
701 |
+
}
|
702 |
+
}
|
703 |
+
|
704 |
+
// SELLING ADS.
|
705 |
+
if ( isset( $installed_plugins['advanced-ads-selling/advanced-ads-selling.php'] ) && ! class_exists( 'Advanced_Ads_Selling_Plugin' ) ) { // is installed, but not active.
|
706 |
+
$add_ons['selling']['link'] = wp_nonce_url( 'plugins.php?action=activate&plugin=advanced-ads-selling/advanced-ads-selling.php&', 'activate-plugin_advanced-ads-selling/advanced-ads-selling.php' );
|
707 |
+
$add_ons['selling']['link_title'] = __( 'Activate now', 'advanced-ads' );
|
708 |
+
$installed_pro_plugins++;
|
709 |
+
} elseif ( class_exists( 'Advanced_Ads_Selling_Plugin' ) ) {
|
710 |
+
$add_ons['selling']['link'] = ADVADS_URL . 'add-ons/selling-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons-manual';
|
711 |
+
$add_ons['selling']['desc'] = '';
|
712 |
+
$add_ons['selling']['installed'] = true;
|
713 |
+
$add_ons['selling']['order'] = 20;
|
714 |
+
$installed_pro_plugins++;
|
715 |
+
|
716 |
+
// remove the add-on.
|
717 |
+
if ( $hide_activated ) {
|
718 |
+
unset( $add_ons['selling'] );
|
719 |
+
}
|
720 |
+
}
|
721 |
+
|
722 |
+
// GEO TARGETING.
|
723 |
+
if ( isset( $installed_plugins['advanced-ads-geo/advanced-ads-geo.php'] ) && ! class_exists( 'Advanced_Ads_Geo_Plugin' ) ) { // is installed, but not active.
|
724 |
+
$add_ons['geo']['link'] = wp_nonce_url( 'plugins.php?action=activate&plugin=advanced-ads-geo/advanced-ads-geo.php&', 'activate-plugin_advanced-ads-geo/advanced-ads-geo.php' );
|
725 |
+
$add_ons['geo']['link_title'] = __( 'Activate now', 'advanced-ads' );
|
726 |
+
$installed_pro_plugins++;
|
727 |
+
} elseif ( class_exists( 'Advanced_Ads_Geo_Plugin' ) ) {
|
728 |
+
$add_ons['geo']['link'] = ADVADS_URL . 'add-ons/geo-targeting/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons-manual';
|
729 |
+
$add_ons['geo']['desc'] = '';
|
730 |
+
$add_ons['geo']['installed'] = true;
|
731 |
+
$add_ons['geo']['order'] = 20;
|
732 |
+
$installed_pro_plugins++;
|
733 |
+
|
734 |
+
// remove the add-on.
|
735 |
+
if ( $hide_activated ) {
|
736 |
+
unset( $add_ons['geo'] );
|
737 |
+
}
|
738 |
+
}
|
739 |
+
|
740 |
+
// SLIDER.
|
741 |
+
if ( isset( $installed_plugins['advanced-ads-slider/slider.php'] ) && ! class_exists( 'Advanced_Ads_Slider_Plugin' ) ) { // is installed, but not active.
|
742 |
+
$add_ons['slider']['link'] = wp_nonce_url( 'plugins.php?action=activate&plugin=advanced-ads-slider/slider.php&', 'activate-plugin_advanced-ads-slider/slider.php' );
|
743 |
+
$add_ons['slider']['link_title'] = __( 'Activate now', 'advanced-ads' );
|
744 |
+
} elseif ( class_exists( 'Advanced_Ads_Slider_Plugin' ) ) {
|
745 |
+
$add_ons['slider']['link'] = ADVADS_URL . 'add-ons/slider/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons-manual';
|
746 |
+
$add_ons['slider']['desc'] = '';
|
747 |
+
$add_ons['slider']['installed'] = true;
|
748 |
+
$add_ons['slider']['order'] = 20;
|
749 |
+
|
750 |
+
// remove the add-on.
|
751 |
+
if ( $hide_activated ) {
|
752 |
+
unset( $add_ons['slider'] );
|
753 |
+
}
|
754 |
+
}
|
755 |
+
|
756 |
+
// add Genesis Ads, if Genesis based theme was detected.
|
757 |
+
if ( defined( 'PARENT_THEME_NAME' ) && 'Genesis' === PARENT_THEME_NAME ) {
|
758 |
+
$add_ons['genesis'] = array(
|
759 |
+
'title' => 'Genesis Ads',
|
760 |
+
'desc' => __( 'Use Genesis specific ad positions.', 'advanced-ads' ),
|
761 |
+
'order' => 2,
|
762 |
+
'class' => 'free',
|
763 |
+
'link' => wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=advanced-ads-genesis' ), 'install-plugin_advanced-ads-genesis' ),
|
764 |
+
'link_title' => __( 'Install now', 'advanced-ads' ),
|
765 |
+
);
|
766 |
+
// handle install link as long as we can not be sure this is done by the Genesis plugin itself.
|
767 |
+
if ( isset( $installed_plugins['advanced-ads-genesis/genesis-ads.php'] ) ) { // is installed (active or not).
|
768 |
+
unset( $add_ons['genesis'] );
|
769 |
+
}
|
770 |
+
}
|
771 |
+
|
772 |
+
// add Ads for WPBakery Page Builder (formerly Visual Composer), if VC was detected.
|
773 |
+
if ( defined( 'WPB_VC_VERSION' ) ) {
|
774 |
+
$add_ons['visual_composer'] = array(
|
775 |
+
'title' => 'Ads for WPBakery Page Builder (formerly Visual Composer)',
|
776 |
+
'desc' => __( 'Manage ad positions with WPBakery Page Builder (formerly Visual Composer).', 'advanced-ads' ),
|
777 |
+
'order' => 2,
|
778 |
+
'class' => 'free',
|
779 |
+
'link' => wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=ads-for-visual-composer' ), 'install-plugin_ads-for-visual-composer' ),
|
780 |
+
'link_title' => __( 'Install now', 'advanced-ads' ),
|
781 |
+
);
|
782 |
+
// handle install link as long as we can not be sure this is done by the Genesis plugin itself.
|
783 |
+
if ( isset( $installed_plugins['ads-for-visual-composer/advanced-ads-vc.php'] ) ) { // is installed (active or not).
|
784 |
+
unset( $add_ons['visual_composer'] );
|
785 |
+
}
|
786 |
+
}
|
787 |
+
|
788 |
+
// only show All Access Pitch if less than 2 add-ons exist.
|
789 |
+
if ( $installed_pro_plugins < 2 ) {
|
790 |
+
$add_ons['bundle'] = array(
|
791 |
+
'title' => 'All Access',
|
792 |
+
'desc' => __( 'Our best deal with all add-ons included.', 'advanced-ads' ),
|
793 |
+
'link' => ADVADS_URL . 'add-ons/all-access/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons',
|
794 |
+
'link_title' => __( 'Get full access', 'advanced-ads' ),
|
795 |
+
'link_primary' => true,
|
796 |
+
'order' => 0,
|
797 |
+
);
|
798 |
+
}
|
799 |
+
|
800 |
+
// allow add-ons to manipulate the output.
|
801 |
+
$add_ons = apply_filters( 'advanced-ads-overview-add-ons', $add_ons );
|
802 |
+
|
803 |
+
uasort( $add_ons, array( 'self', 'sort_by_order' ) );
|
804 |
+
|
805 |
+
?>
|
806 |
+
<table class="widefat striped">
|
807 |
+
<?php
|
808 |
+
foreach ( $add_ons as $_addon ) :
|
809 |
+
if ( isset( $_addon['installed'] ) ) {
|
810 |
+
$link_title = __( 'Visit the manual', 'advanced-ads' );
|
811 |
+
$_addon['title'] = '<span class="dashicons dashicons-yes" style="color: green; font-size: 1.5em;"></span> ' . $_addon['title'];
|
812 |
+
} else {
|
813 |
+
$link_title = isset( $_addon['link_title'] ) ? $_addon['link_title'] : __( 'Get this add-on', 'advanced-ads' );
|
814 |
+
}
|
815 |
+
include ADVADS_BASE_PATH . 'admin/views/overview-addons-line.php';
|
816 |
+
endforeach;
|
817 |
+
?>
|
818 |
+
</table>
|
819 |
+
<?php
|
820 |
}
|
821 |
+
|
822 |
/**
|
823 |
+
* Sort by installed add-ons
|
824 |
+
*
|
825 |
+
* @param array $a argument a.
|
826 |
+
* @param array $b argument b.
|
827 |
+
*
|
828 |
+
* @return int
|
829 |
*/
|
830 |
private static function sort_by_order( $a, $b ) {
|
831 |
return $a['order'] - $b['order'];
|
admin/includes/class-settings.php
CHANGED
@@ -1,6 +1,9 @@
|
|
1 |
<?php
|
2 |
defined( 'ABSPATH' ) || exit;
|
3 |
|
|
|
|
|
|
|
4 |
class Advanced_Ads_Admin_Settings {
|
5 |
/**
|
6 |
* Instance of this class.
|
@@ -24,7 +27,7 @@ class Advanced_Ads_Admin_Settings {
|
|
24 |
*/
|
25 |
public static function get_instance() {
|
26 |
// If the single instance hasn't been set, set it now.
|
27 |
-
if ( null
|
28 |
self::$instance = new self();
|
29 |
}
|
30 |
|
@@ -171,7 +174,7 @@ class Advanced_Ads_Admin_Settings {
|
|
171 |
'advanced_ads_setting_section_disable_ads'
|
172 |
);
|
173 |
// dummy setting field to hide ads for post types.
|
174 |
-
if( !defined( 'AAP_VERSION' ) ) {
|
175 |
add_settings_field(
|
176 |
'disable-by-post-types-pro',
|
177 |
__( 'Disable ads for post types', 'advanced-ads' ),
|
@@ -258,7 +261,7 @@ class Advanced_Ads_Admin_Settings {
|
|
258 |
* Add license tab
|
259 |
*
|
260 |
* @param array $tabs setting tabs.
|
261 |
-
|
262 |
*/
|
263 |
public function license_tab( array $tabs ) {
|
264 |
|
@@ -275,13 +278,15 @@ class Advanced_Ads_Admin_Settings {
|
|
275 |
/**
|
276 |
* Add pro pitch tab
|
277 |
*
|
278 |
-
* @
|
|
|
|
|
279 |
*/
|
280 |
public function pro_pitch_tab( array $tabs ) {
|
281 |
|
282 |
$tabs['pro_pitch'] = array(
|
283 |
'page' => 'advanced-ads-settings-pro-pitch-page',
|
284 |
-
//'group' => ADVADS_SLUG . '-pro-pitch',
|
285 |
'tabid' => 'pro-pitch',
|
286 |
'title' => __( 'Pro', 'advanced-ads' ),
|
287 |
);
|
@@ -292,7 +297,9 @@ class Advanced_Ads_Admin_Settings {
|
|
292 |
/**
|
293 |
* Add tracking pitch tab
|
294 |
*
|
295 |
-
* array $tabs setting tabs
|
|
|
|
|
296 |
*/
|
297 |
public function tracking_pitch_tab( array $tabs ) {
|
298 |
|
@@ -307,8 +314,6 @@ class Advanced_Ads_Admin_Settings {
|
|
307 |
|
308 |
/**
|
309 |
* Render settings section
|
310 |
-
*
|
311 |
-
* @since 1.1.1
|
312 |
*/
|
313 |
public function render_settings_section_callback() {
|
314 |
// for whatever purpose there might come.
|
@@ -316,8 +321,6 @@ class Advanced_Ads_Admin_Settings {
|
|
316 |
|
317 |
/**
|
318 |
* Render "Disable Ads" settings section
|
319 |
-
*
|
320 |
-
* @since 1.12
|
321 |
*/
|
322 |
public function render_settings_section_disable_ads_callback() {
|
323 |
// for whatever purpose there might come.
|
@@ -325,8 +328,6 @@ class Advanced_Ads_Admin_Settings {
|
|
325 |
|
326 |
/**
|
327 |
* Render "Content Injection" settings section
|
328 |
-
*
|
329 |
-
* @since 1.12
|
330 |
*/
|
331 |
public function render_settings_section_output_callback() {
|
332 |
// for whatever purpose there might come.
|
@@ -334,29 +335,20 @@ class Advanced_Ads_Admin_Settings {
|
|
334 |
|
335 |
/**
|
336 |
* Render "Content Injection" settings section
|
337 |
-
*
|
338 |
-
* @since 1.12
|
339 |
*/
|
340 |
public function render_settings_section_injection_callback() {
|
341 |
// for whatever purpose there might come.
|
342 |
}
|
343 |
|
344 |
/**
|
345 |
-
*
|
346 |
-
*
|
347 |
-
* @since 1.5.1
|
348 |
*/
|
349 |
public function render_settings_licenses_section_callback() {
|
350 |
-
|
351 |
-
echo ' ' . sprintf( __( 'See also <a href="%s" target="_blank">Issues and questions about licenses</a>.', 'advanced-ads' ), ADVADS_URL . 'manual-category/purchase-licenses/#utm_source=advanced-ads&utm_medium=link&utm_campaign=settings-licenses' ) . '</p>';
|
352 |
-
// nonce field
|
353 |
-
echo '<input type="hidden" id="advads-licenses-ajax-referrer" value="' . wp_create_nonce( "advads_ajax_license_nonce" ) . '"/>';
|
354 |
}
|
355 |
|
356 |
/**
|
357 |
-
*
|
358 |
-
*
|
359 |
-
* @since 1.8.12
|
360 |
*/
|
361 |
public function render_settings_licenses_pitch_section_callback() {
|
362 |
|
@@ -366,9 +358,7 @@ class Advanced_Ads_Admin_Settings {
|
|
366 |
}
|
367 |
|
368 |
/**
|
369 |
-
*
|
370 |
-
*
|
371 |
-
* @since 1.8.12
|
372 |
*/
|
373 |
public function render_settings_pro_pitch_section_callback() {
|
374 |
echo '<br/>';
|
@@ -376,9 +366,7 @@ class Advanced_Ads_Admin_Settings {
|
|
376 |
}
|
377 |
|
378 |
/**
|
379 |
-
*
|
380 |
-
*
|
381 |
-
* @since 1.8.12
|
382 |
*/
|
383 |
public function render_settings_tracking_pitch_section_callback() {
|
384 |
echo '<br/>';
|
@@ -386,9 +374,7 @@ class Advanced_Ads_Admin_Settings {
|
|
386 |
}
|
387 |
|
388 |
/**
|
389 |
-
*
|
390 |
-
*
|
391 |
-
* @since 1.3.11
|
392 |
*/
|
393 |
public function render_settings_disable_ads() {
|
394 |
$options = Advanced_Ads::get_instance()->options();
|
@@ -399,15 +385,14 @@ class Advanced_Ads_Admin_Settings {
|
|
399 |
$disable_archives = isset( $options['disabled-ads']['archives'] ) ? 1 : 0;
|
400 |
$disable_secondary = isset( $options['disabled-ads']['secondary'] ) ? 1 : 0;
|
401 |
$disable_feed = ( ! isset( $options['disabled-ads']['feed'] ) || $options['disabled-ads']['feed'] ) ? 1 : 0;
|
|
|
402 |
|
403 |
// load the template.
|
404 |
-
include ADVADS_BASE_PATH . 'admin/views/settings
|
405 |
}
|
406 |
|
407 |
/**
|
408 |
-
*
|
409 |
-
*
|
410 |
-
* @since 1.1.1
|
411 |
*/
|
412 |
public function render_settings_hide_for_users() {
|
413 |
$options = Advanced_Ads::get_instance()->options();
|
@@ -420,139 +405,96 @@ class Advanced_Ads_Admin_Settings {
|
|
420 |
global $wp_roles;
|
421 |
$roles = $wp_roles->get_names();
|
422 |
|
423 |
-
|
424 |
-
foreach ( $roles as $_role => $_display_name ) {
|
425 |
-
$checked = in_array( $_role, $hide_for_roles, true );
|
426 |
-
echo '<label><input type="checkbox" value="' . esc_attr( $_role ) . '" name="' . ADVADS_SLUG . '[hide-for-user-role][]" '
|
427 |
-
. checked( $checked, true, false ) . '>' . esc_html( $_display_name ) . '</label>';
|
428 |
-
}
|
429 |
-
echo '</div>';
|
430 |
-
|
431 |
-
echo '<p class="description">' . esc_html__( 'Choose the roles a user must have in order to not see any ads.', 'advanced-ads' ) . '</p>';
|
432 |
}
|
433 |
|
434 |
/**
|
435 |
-
*
|
436 |
-
*
|
437 |
-
* @since 1.2.3
|
438 |
*/
|
439 |
public function render_settings_advanced_js() {
|
440 |
$options = Advanced_Ads::get_instance()->options();
|
441 |
$checked = ( ! empty( $options['advanced-js'] ) ) ? 1 : 0;
|
442 |
|
443 |
-
|
444 |
-
if ( ! $checked && apply_filters( 'advanced-ads-activate-advanced-js', $checked ) ) {
|
445 |
-
echo '<p>' . __( '<strong>notice: </strong>the file is currently enabled by an add-on that needs it.', 'advanced-ads' ) . '</p>';
|
446 |
-
}
|
447 |
-
echo '<input id="advanced-ads-advanced-js" type="checkbox" value="1" name="' . ADVADS_SLUG . '[advanced-js]" ' . checked( $checked, 1, false ) . '>';
|
448 |
-
echo '<p class="description">' . sprintf( __( 'Enable advanced JavaScript functions (<a href="%s" target="_blank">here</a>). Some features and add-ons might override this setting if they need features from this file.', 'advanced-ads' ), ADVADS_URL . 'javascript-functions/#utm_source=advanced-ads&utm_medium=link&utm_campaign=settings' ) . '</p>';
|
449 |
}
|
450 |
|
451 |
/**
|
452 |
-
*
|
453 |
-
*
|
454 |
-
* @since 1.4.1
|
455 |
*/
|
456 |
public function render_settings_content_injection_everywhere() {
|
457 |
$options = Advanced_Ads::get_instance()->options();
|
458 |
|
459 |
if ( ! isset( $options['content-injection-everywhere'] ) ) {
|
460 |
$everywhere = 0;
|
461 |
-
} elseif ( $options['content-injection-everywhere']
|
462 |
$everywhere = - 1;
|
463 |
} else {
|
464 |
$everywhere = absint( $options['content-injection-everywhere'] );
|
465 |
}
|
466 |
|
467 |
-
|
468 |
-
echo '<p class="description">' . __( 'Some plugins and themes trigger ad injections where it shouldn’t happen. Therefore, Advanced Ads ignores injected placements on non-singular pages and outside the loop. However, this can cause problems with some themes. Set this option to -1 in order to enable unlimited ad injection at your own risk, set it to 0 to keep it disabled or choose a positive number to enable the injection only in the first x posts on your archive pages.', 'advanced-ads' ) . '</p>';
|
469 |
-
|
470 |
}
|
471 |
|
472 |
/**
|
473 |
-
*
|
474 |
-
*
|
475 |
-
* @since 1.4.1
|
476 |
*/
|
477 |
public function render_settings_content_injection_priority() {
|
478 |
$options = Advanced_Ads::get_instance()->options();
|
479 |
$priority = ( isset( $options['content-injection-priority'] ) ) ? intval( $options['content-injection-priority'] ) : 100;
|
480 |
|
481 |
-
|
482 |
-
echo '<p class="description">';
|
483 |
-
if ( $priority < 11 ) {
|
484 |
-
echo '<span class="advads-error-message">' . __( 'Please check your post content. A priority of 10 and below might cause issues (wpautop function might run twice).', 'advanced-ads' ) . '</span><br />';
|
485 |
-
}
|
486 |
-
_e( 'Play with this value in order to change the priority of the injected ads compared to other auto injected elements in the post content.', 'advanced-ads' );
|
487 |
-
echo '</p>';
|
488 |
}
|
489 |
|
490 |
/**
|
491 |
-
*
|
492 |
-
*
|
493 |
-
* @since 1.7.22
|
494 |
*/
|
495 |
public function render_settings_content_injection_level_limitation() {
|
496 |
$options = Advanced_Ads::get_instance()->options();
|
497 |
$checked = ( ! empty( $options['content-injection-level-disabled'] ) ) ? 1 : 0;
|
498 |
|
499 |
-
|
500 |
-
echo '<p class="description">' . __( 'Advanced Ads ignores paragraphs and other elements in containers when injecting ads into the post content. Check this option to ignore this limitation and ads might show up again.', 'advanced-ads' ) . '</p>';
|
501 |
}
|
502 |
|
503 |
/**
|
504 |
-
*
|
505 |
-
*
|
506 |
-
* @since 1.4.9
|
507 |
*/
|
508 |
public function render_settings_block_bots() {
|
509 |
$options = Advanced_Ads::get_instance()->options();
|
510 |
$checked = ( ! empty( $options['block-bots'] ) ) ? 1 : 0;
|
511 |
|
512 |
-
|
513 |
-
if ( Advanced_Ads::get_instance()->is_bot() ) {
|
514 |
-
echo '<span class="advads-error-message">' . __( 'You look like a bot', 'advanced-ads' ) . '</a>. </span>';
|
515 |
-
}
|
516 |
-
echo '<span class="description"><a href="' . ADVADS_URL . 'hide-ads-from-bots/#utm_source=advanced-ads&utm_medium=link&utm_campaign=settings" target="blank">' . __( 'Read this first', 'advanced-ads' ) . '</a></span>';
|
517 |
-
echo '<p class="description">' . __( 'Hide ads from crawlers, bots and empty user agents.', 'advanced-ads' ) . '</p>';
|
518 |
}
|
519 |
|
520 |
/**
|
521 |
-
*
|
522 |
-
*
|
523 |
-
* @since 1.13.5
|
524 |
*/
|
525 |
-
public function render_settings_disable_post_types(){
|
526 |
-
|
527 |
-
$post_types
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
528 |
$type_label_counts = array_count_values( wp_list_pluck( $post_types, 'label' ) );
|
529 |
|
530 |
-
|
531 |
-
|
532 |
-
require ADVADS_BASE_PATH . '/admin/views/setting-disable-post-types.php';
|
533 |
}
|
534 |
|
535 |
/**
|
536 |
-
*
|
537 |
-
*
|
538 |
-
* @since 1.5.3
|
539 |
-
* @updated 1.13 disable Ad Health as well
|
540 |
*/
|
541 |
public function render_settings_disabled_notices() {
|
542 |
$options = Advanced_Ads::get_instance()->options();
|
543 |
$checked = ( ! empty( $options['disable-notices'] ) ) ? 1 : 0;
|
544 |
|
545 |
-
|
546 |
-
echo '<p class="description">' . sprintf(
|
547 |
-
// translators: %1$s is a starting <a> tag and %2$s a closing one.
|
548 |
-
__( 'Disable %1$sAd Health%2$s in frontend and backend, warnings and internal notices like tips, tutorials, email newsletters and update notices.', 'advanced-ads' ), '<a href="'
|
549 |
-
. ADVADS_URL . 'manual/ad-health/#utm_source=advanced-ads&utm_medium=link&utm_campaign=settings-ad-health" target="_blank"> ', '</a>' ) . '</p>';
|
550 |
}
|
551 |
|
552 |
/**
|
553 |
-
*
|
554 |
-
*
|
555 |
-
* @since 1.6.8
|
556 |
*/
|
557 |
public function render_settings_front_prefix() {
|
558 |
$options = Advanced_Ads::get_instance()->options();
|
@@ -560,54 +502,35 @@ class Advanced_Ads_Admin_Settings {
|
|
560 |
$prefix = Advanced_Ads_Plugin::get_instance()->get_frontend_prefix();
|
561 |
$old_prefix = ( isset( $options['id-prefix'] ) ) ? esc_attr( $options['id-prefix'] ) : '';
|
562 |
|
563 |
-
|
564 |
-
// deprecated
|
565 |
-
echo '<input type="hidden" value="' . $old_prefix . '" name="' . ADVADS_SLUG . '[id-prefix]" />';
|
566 |
-
echo '<p class="description">' . __( 'Prefix of class or id attributes in the frontend. Change it if you don’t want <strong>ad blockers</strong> to mark these blocks as ads.<br/>You might need to <strong>rewrite css rules afterwards</strong>.', 'advanced-ads' ) . '</p>';
|
567 |
}
|
568 |
|
569 |
/**
|
570 |
-
*
|
571 |
-
*
|
572 |
-
* @since 1.6.14
|
573 |
*/
|
574 |
public function render_settings_editors_manage_ads() {
|
575 |
$options = Advanced_Ads::get_instance()->options();
|
576 |
|
577 |
-
// is false by default if no options where previously set
|
578 |
if ( isset( $options['editors-manage-ads'] ) && $options['editors-manage-ads'] ) {
|
579 |
$allow = true;
|
580 |
} else {
|
581 |
$allow = false;
|
582 |
}
|
583 |
|
584 |
-
|
585 |
-
echo '<p class="description">' . __( 'Allow editors to also manage and publish ads.', 'advanced-ads' ) .
|
586 |
-
' ' . sprintf( __( 'You can assign different ad-related roles on a user basis with <a href="%s" target="_blank">Advanced Ads Pro</a>.', 'advanced-ads' ), ADVADS_URL . 'add-ons/advanced-ads-pro/#utm_source=advanced-ads&utm_medium=link&utm_campaign=settings' ) . '</p>';
|
587 |
}
|
588 |
|
589 |
/**
|
590 |
-
*
|
591 |
-
*
|
592 |
*/
|
593 |
public function render_settings_add_custom_label() {
|
594 |
$options = Advanced_Ads::get_instance()->options();
|
595 |
|
596 |
$enabled = isset( $options['custom-label']['enabled'] );
|
597 |
-
$label = ! empty
|
598 |
-
|
599 |
-
|
600 |
-
<fieldset>
|
601 |
-
<input type="checkbox" <?php checked( $enabled, true ); ?> value="1"
|
602 |
-
name="<?php echo ADVADS_SLUG . '[custom-label][enabled]'; ?>"/>
|
603 |
-
<input id="advads-custom-label" type="text" value="<?php echo $label; ?>"
|
604 |
-
name="<?php echo ADVADS_SLUG . '[custom-label][text]'; ?>"/>
|
605 |
-
</fieldset>
|
606 |
-
<p class="description"><?php _e( 'Displayed above ads.', 'advanced-ads' ); ?> <a target="_blank"
|
607 |
-
href="<?php echo ADVADS_URL . 'manual/advertisement-label/#utm_source=advanced-ads&utm_medium=link&utm_campaign=settings-advertisement-label' ?>"><?php _e( 'Manual', 'advanced-ads' ); ?></a>
|
608 |
-
</p>
|
609 |
-
|
610 |
-
<?php
|
611 |
}
|
612 |
|
613 |
/**
|
@@ -627,7 +550,7 @@ class Advanced_Ads_Admin_Settings {
|
|
627 |
}
|
628 |
|
629 |
$target = isset( $options['target-blank'] ) ? $options['target-blank'] : 0;
|
630 |
-
include ADVADS_BASE_PATH . 'admin/views/
|
631 |
}
|
632 |
|
633 |
/**
|
@@ -635,12 +558,9 @@ class Advanced_Ads_Admin_Settings {
|
|
635 |
*/
|
636 |
public function render_settings_uninstall_delete_data() {
|
637 |
$options = Advanced_Ads::get_instance()->options();
|
638 |
-
$enabled = ! empty( $options['uninstall-delete-data'] );
|
639 |
|
640 |
-
|
641 |
-
name="<?php echo ADVADS_SLUG; ?>[uninstall-delete-data]" <?php checked( $enabled, 1 ); ?>>
|
642 |
-
<p class="description"><?php _e( 'Clean up all data related to Advanced Ads when removing the plugin.', 'advanced-ads' ); ?></p>
|
643 |
-
<?php
|
644 |
}
|
645 |
|
646 |
/**
|
@@ -651,21 +571,19 @@ class Advanced_Ads_Admin_Settings {
|
|
651 |
|
652 |
$checked = ! empty( $options['disable-shortcode-button'] );
|
653 |
|
654 |
-
|
655 |
-
echo '<p class="description">' . __( 'Disable shortcode button in visual editor.', 'advanced-ads' ) . '</p>';
|
656 |
}
|
657 |
|
658 |
/**
|
659 |
-
*
|
660 |
*
|
661 |
-
* @
|
662 |
*
|
663 |
-
* @
|
664 |
*/
|
665 |
public function sanitize_settings( $options ) {
|
666 |
|
667 |
-
// sanitize whatever option one wants to sanitize
|
668 |
-
|
669 |
if ( isset( $options['front-prefix'] ) ) {
|
670 |
$options['front-prefix'] = sanitize_html_class( $options['front-prefix'], Advanced_Ads_Plugin::DEFAULT_FRONTEND_PREFIX );
|
671 |
}
|
@@ -673,9 +591,9 @@ class Advanced_Ads_Admin_Settings {
|
|
673 |
$options = apply_filters( 'advanced-ads-sanitize-settings', $options );
|
674 |
|
675 |
// check if editors can edit ads now and set the rights
|
676 |
-
// else, remove that right
|
677 |
$editor_role = get_role( 'editor' );
|
678 |
-
if ( null
|
679 |
return $options;
|
680 |
}
|
681 |
if ( isset( $options['editors-manage-ads'] ) && $options['editors-manage-ads'] ) {
|
@@ -690,14 +608,14 @@ class Advanced_Ads_Admin_Settings {
|
|
690 |
$editor_role->remove_cap( 'advanced_ads_place_ads' );
|
691 |
}
|
692 |
|
693 |
-
// we need 3 states: ! isset, 1, 0
|
694 |
$options['disabled-ads']['feed'] = isset( $options['disabled-ads']['feed'] ) ? 1 : 0;
|
695 |
|
696 |
if ( isset( $options['content-injection-everywhere'] ) ) {
|
697 |
-
if ( $options['content-injection-everywhere']
|
698 |
unset( $options['content-injection-everywhere'] );
|
699 |
} elseif ( $options['content-injection-everywhere'] <= - 1 ) {
|
700 |
-
$options['content-injection-everywhere'] =
|
701 |
} else {
|
702 |
$options['content-injection-everywhere'] = absint( $options['content-injection-everywhere'] );
|
703 |
}
|
1 |
<?php
|
2 |
defined( 'ABSPATH' ) || exit;
|
3 |
|
4 |
+
/**
|
5 |
+
* Class Advanced_Ads_Admin_Settings
|
6 |
+
*/
|
7 |
class Advanced_Ads_Admin_Settings {
|
8 |
/**
|
9 |
* Instance of this class.
|
27 |
*/
|
28 |
public static function get_instance() {
|
29 |
// If the single instance hasn't been set, set it now.
|
30 |
+
if ( null === self::$instance ) {
|
31 |
self::$instance = new self();
|
32 |
}
|
33 |
|
174 |
'advanced_ads_setting_section_disable_ads'
|
175 |
);
|
176 |
// dummy setting field to hide ads for post types.
|
177 |
+
if ( ! defined( 'AAP_VERSION' ) ) {
|
178 |
add_settings_field(
|
179 |
'disable-by-post-types-pro',
|
180 |
__( 'Disable ads for post types', 'advanced-ads' ),
|
261 |
* Add license tab
|
262 |
*
|
263 |
* @param array $tabs setting tabs.
|
264 |
+
* @return array
|
265 |
*/
|
266 |
public function license_tab( array $tabs ) {
|
267 |
|
278 |
/**
|
279 |
* Add pro pitch tab
|
280 |
*
|
281 |
+
* @param array $tabs setting tabs.
|
282 |
+
*
|
283 |
+
* @return array $tabs
|
284 |
*/
|
285 |
public function pro_pitch_tab( array $tabs ) {
|
286 |
|
287 |
$tabs['pro_pitch'] = array(
|
288 |
'page' => 'advanced-ads-settings-pro-pitch-page',
|
289 |
+
// 'group' => ADVADS_SLUG . '-pro-pitch',
|
290 |
'tabid' => 'pro-pitch',
|
291 |
'title' => __( 'Pro', 'advanced-ads' ),
|
292 |
);
|
297 |
/**
|
298 |
* Add tracking pitch tab
|
299 |
*
|
300 |
+
* @param array $tabs setting tabs.
|
301 |
+
*
|
302 |
+
* @return array $tabs
|
303 |
*/
|
304 |
public function tracking_pitch_tab( array $tabs ) {
|
305 |
|
314 |
|
315 |
/**
|
316 |
* Render settings section
|
|
|
|
|
317 |
*/
|
318 |
public function render_settings_section_callback() {
|
319 |
// for whatever purpose there might come.
|
321 |
|
322 |
/**
|
323 |
* Render "Disable Ads" settings section
|
|
|
|
|
324 |
*/
|
325 |
public function render_settings_section_disable_ads_callback() {
|
326 |
// for whatever purpose there might come.
|
328 |
|
329 |
/**
|
330 |
* Render "Content Injection" settings section
|
|
|
|
|
331 |
*/
|
332 |
public function render_settings_section_output_callback() {
|
333 |
// for whatever purpose there might come.
|
335 |
|
336 |
/**
|
337 |
* Render "Content Injection" settings section
|
|
|
|
|
338 |
*/
|
339 |
public function render_settings_section_injection_callback() {
|
340 |
// for whatever purpose there might come.
|
341 |
}
|
342 |
|
343 |
/**
|
344 |
+
* Render licenses settings section
|
|
|
|
|
345 |
*/
|
346 |
public function render_settings_licenses_section_callback() {
|
347 |
+
include ADVADS_BASE_PATH . 'admin/views/settings/license/section.php';
|
|
|
|
|
|
|
348 |
}
|
349 |
|
350 |
/**
|
351 |
+
* Render licenses pithces settings section
|
|
|
|
|
352 |
*/
|
353 |
public function render_settings_licenses_pitch_section_callback() {
|
354 |
|
358 |
}
|
359 |
|
360 |
/**
|
361 |
+
* Render pro pitch settings section
|
|
|
|
|
362 |
*/
|
363 |
public function render_settings_pro_pitch_section_callback() {
|
364 |
echo '<br/>';
|
366 |
}
|
367 |
|
368 |
/**
|
369 |
+
* Render tracking pitch settings section
|
|
|
|
|
370 |
*/
|
371 |
public function render_settings_tracking_pitch_section_callback() {
|
372 |
echo '<br/>';
|
374 |
}
|
375 |
|
376 |
/**
|
377 |
+
* Options to disable ads
|
|
|
|
|
378 |
*/
|
379 |
public function render_settings_disable_ads() {
|
380 |
$options = Advanced_Ads::get_instance()->options();
|
385 |
$disable_archives = isset( $options['disabled-ads']['archives'] ) ? 1 : 0;
|
386 |
$disable_secondary = isset( $options['disabled-ads']['secondary'] ) ? 1 : 0;
|
387 |
$disable_feed = ( ! isset( $options['disabled-ads']['feed'] ) || $options['disabled-ads']['feed'] ) ? 1 : 0;
|
388 |
+
$disable_rest_api = isset( $options['disabled-ads']['rest-api'] ) ? 1 : 0;
|
389 |
|
390 |
// load the template.
|
391 |
+
include ADVADS_BASE_PATH . 'admin/views/settings/general/disable-ads.php';
|
392 |
}
|
393 |
|
394 |
/**
|
395 |
+
* Render setting to hide ads from logged in users
|
|
|
|
|
396 |
*/
|
397 |
public function render_settings_hide_for_users() {
|
398 |
$options = Advanced_Ads::get_instance()->options();
|
405 |
global $wp_roles;
|
406 |
$roles = $wp_roles->get_names();
|
407 |
|
408 |
+
include ADVADS_BASE_PATH . 'admin/views/settings/general/hide-for-user-role.php';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
409 |
}
|
410 |
|
411 |
/**
|
412 |
+
* Render setting to display advanced js file
|
|
|
|
|
413 |
*/
|
414 |
public function render_settings_advanced_js() {
|
415 |
$options = Advanced_Ads::get_instance()->options();
|
416 |
$checked = ( ! empty( $options['advanced-js'] ) ) ? 1 : 0;
|
417 |
|
418 |
+
include ADVADS_BASE_PATH . 'admin/views/settings/general/advanced-js.php';
|
|
|
|
|
|
|
|
|
|
|
419 |
}
|
420 |
|
421 |
/**
|
422 |
+
* Render setting for content injection protection
|
|
|
|
|
423 |
*/
|
424 |
public function render_settings_content_injection_everywhere() {
|
425 |
$options = Advanced_Ads::get_instance()->options();
|
426 |
|
427 |
if ( ! isset( $options['content-injection-everywhere'] ) ) {
|
428 |
$everywhere = 0;
|
429 |
+
} elseif ( 'true' === $options['content-injection-everywhere'] ) {
|
430 |
$everywhere = - 1;
|
431 |
} else {
|
432 |
$everywhere = absint( $options['content-injection-everywhere'] );
|
433 |
}
|
434 |
|
435 |
+
include ADVADS_BASE_PATH . 'admin/views/settings/general/content-injection-everywhere.php';
|
|
|
|
|
436 |
}
|
437 |
|
438 |
/**
|
439 |
+
* Render setting for content injection priority
|
|
|
|
|
440 |
*/
|
441 |
public function render_settings_content_injection_priority() {
|
442 |
$options = Advanced_Ads::get_instance()->options();
|
443 |
$priority = ( isset( $options['content-injection-priority'] ) ) ? intval( $options['content-injection-priority'] ) : 100;
|
444 |
|
445 |
+
include ADVADS_BASE_PATH . 'admin/views/settings/general/content-injection-priority.php';
|
|
|
|
|
|
|
|
|
|
|
|
|
446 |
}
|
447 |
|
448 |
/**
|
449 |
+
* Render setting to disable content injection level limitation
|
|
|
|
|
450 |
*/
|
451 |
public function render_settings_content_injection_level_limitation() {
|
452 |
$options = Advanced_Ads::get_instance()->options();
|
453 |
$checked = ( ! empty( $options['content-injection-level-disabled'] ) ) ? 1 : 0;
|
454 |
|
455 |
+
include ADVADS_BASE_PATH . 'admin/views/settings/general/content-injection-level-limitation.php';
|
|
|
456 |
}
|
457 |
|
458 |
/**
|
459 |
+
* Render setting for blocking bots
|
|
|
|
|
460 |
*/
|
461 |
public function render_settings_block_bots() {
|
462 |
$options = Advanced_Ads::get_instance()->options();
|
463 |
$checked = ( ! empty( $options['block-bots'] ) ) ? 1 : 0;
|
464 |
|
465 |
+
include ADVADS_BASE_PATH . 'admin/views/settings/general/block-bots.php';
|
|
|
|
|
|
|
|
|
|
|
466 |
}
|
467 |
|
468 |
/**
|
469 |
+
* Render setting to disable ads by post types
|
|
|
|
|
470 |
*/
|
471 |
+
public function render_settings_disable_post_types() {
|
472 |
+
|
473 |
+
$post_types = get_post_types(
|
474 |
+
array(
|
475 |
+
'public' => true,
|
476 |
+
'publicly_queryable' => true,
|
477 |
+
),
|
478 |
+
'objects',
|
479 |
+
'or'
|
480 |
+
);
|
481 |
$type_label_counts = array_count_values( wp_list_pluck( $post_types, 'label' ) );
|
482 |
|
483 |
+
require ADVADS_BASE_PATH . '/admin/views/settings/general/disable-post-types.php';
|
|
|
|
|
484 |
}
|
485 |
|
486 |
/**
|
487 |
+
* Render setting to disable notices and Ad Health
|
|
|
|
|
|
|
488 |
*/
|
489 |
public function render_settings_disabled_notices() {
|
490 |
$options = Advanced_Ads::get_instance()->options();
|
491 |
$checked = ( ! empty( $options['disable-notices'] ) ) ? 1 : 0;
|
492 |
|
493 |
+
require ADVADS_BASE_PATH . '/admin/views/settings/general/disable-notices.php';
|
|
|
|
|
|
|
|
|
494 |
}
|
495 |
|
496 |
/**
|
497 |
+
* Render setting for frontend prefix
|
|
|
|
|
498 |
*/
|
499 |
public function render_settings_front_prefix() {
|
500 |
$options = Advanced_Ads::get_instance()->options();
|
502 |
$prefix = Advanced_Ads_Plugin::get_instance()->get_frontend_prefix();
|
503 |
$old_prefix = ( isset( $options['id-prefix'] ) ) ? esc_attr( $options['id-prefix'] ) : '';
|
504 |
|
505 |
+
require ADVADS_BASE_PATH . '/admin/views/settings/general/frontend-prefix.php';
|
|
|
|
|
|
|
506 |
}
|
507 |
|
508 |
/**
|
509 |
+
* Render setting to allow editors to manage ads
|
|
|
|
|
510 |
*/
|
511 |
public function render_settings_editors_manage_ads() {
|
512 |
$options = Advanced_Ads::get_instance()->options();
|
513 |
|
514 |
+
// is false by default if no options where previously set.
|
515 |
if ( isset( $options['editors-manage-ads'] ) && $options['editors-manage-ads'] ) {
|
516 |
$allow = true;
|
517 |
} else {
|
518 |
$allow = false;
|
519 |
}
|
520 |
|
521 |
+
require ADVADS_BASE_PATH . '/admin/views/settings/general/editors-manage-ads.php';
|
|
|
|
|
522 |
}
|
523 |
|
524 |
/**
|
525 |
+
* Render setting to add an "Advertisement" label before ads
|
|
|
526 |
*/
|
527 |
public function render_settings_add_custom_label() {
|
528 |
$options = Advanced_Ads::get_instance()->options();
|
529 |
|
530 |
$enabled = isset( $options['custom-label']['enabled'] );
|
531 |
+
$label = ! empty( $options['custom-label']['text'] ) ? esc_html( $options['custom-label']['text'] ) : _x( 'Advertisements', 'label before ads', 'advanced-ads' );
|
532 |
+
|
533 |
+
require ADVADS_BASE_PATH . '/admin/views/settings/general/custom-label.php';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
534 |
}
|
535 |
|
536 |
/**
|
550 |
}
|
551 |
|
552 |
$target = isset( $options['target-blank'] ) ? $options['target-blank'] : 0;
|
553 |
+
include ADVADS_BASE_PATH . 'admin/views/settings/general/link-target.php';
|
554 |
}
|
555 |
|
556 |
/**
|
558 |
*/
|
559 |
public function render_settings_uninstall_delete_data() {
|
560 |
$options = Advanced_Ads::get_instance()->options();
|
561 |
+
$enabled = ! empty( $options['uninstall-delete-data'] );
|
562 |
|
563 |
+
include ADVADS_BASE_PATH . 'admin/views/settings/general/uninstall-delete-data.php';
|
|
|
|
|
|
|
564 |
}
|
565 |
|
566 |
/**
|
571 |
|
572 |
$checked = ! empty( $options['disable-shortcode-button'] );
|
573 |
|
574 |
+
include ADVADS_BASE_PATH . 'admin/views/settings/general/disable-shortcode-button.php';
|
|
|
575 |
}
|
576 |
|
577 |
/**
|
578 |
+
* Sanitize plugin settings
|
579 |
*
|
580 |
+
* @param array $options all the options.
|
581 |
*
|
582 |
+
* @return array sanitized options.
|
583 |
*/
|
584 |
public function sanitize_settings( $options ) {
|
585 |
|
586 |
+
// sanitize whatever option one wants to sanitize.
|
|
|
587 |
if ( isset( $options['front-prefix'] ) ) {
|
588 |
$options['front-prefix'] = sanitize_html_class( $options['front-prefix'], Advanced_Ads_Plugin::DEFAULT_FRONTEND_PREFIX );
|
589 |
}
|
591 |
$options = apply_filters( 'advanced-ads-sanitize-settings', $options );
|
592 |
|
593 |
// check if editors can edit ads now and set the rights
|
594 |
+
// else, remove that right.
|
595 |
$editor_role = get_role( 'editor' );
|
596 |
+
if ( null === $editor_role ) {
|
597 |
return $options;
|
598 |
}
|
599 |
if ( isset( $options['editors-manage-ads'] ) && $options['editors-manage-ads'] ) {
|
608 |
$editor_role->remove_cap( 'advanced_ads_place_ads' );
|
609 |
}
|
610 |
|
611 |
+
// we need 3 states: ! isset, 1, 0.
|
612 |
$options['disabled-ads']['feed'] = isset( $options['disabled-ads']['feed'] ) ? 1 : 0;
|
613 |
|
614 |
if ( isset( $options['content-injection-everywhere'] ) ) {
|
615 |
+
if ( 0 == $options['content-injection-everywhere'] ) {
|
616 |
unset( $options['content-injection-everywhere'] );
|
617 |
} elseif ( $options['content-injection-everywhere'] <= - 1 ) {
|
618 |
+
$options['content-injection-everywhere'] = 'true';
|
619 |
} else {
|
620 |
$options['content-injection-everywhere'] = absint( $options['content-injection-everywhere'] );
|
621 |
}
|
admin/includes/class-shortcode-creator.php
CHANGED
@@ -1,18 +1,20 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
*/
|
6 |
class Advanced_Ads_Shortcode_Creator {
|
7 |
/**
|
8 |
-
*
|
9 |
*
|
10 |
* @var object
|
11 |
*/
|
12 |
protected static $instance = null;
|
13 |
|
|
|
|
|
|
|
14 |
private function __construct() {
|
15 |
-
add_action( 'init', array
|
16 |
}
|
17 |
|
18 |
/**
|
@@ -22,17 +24,20 @@ class Advanced_Ads_Shortcode_Creator {
|
|
22 |
*/
|
23 |
public static function get_instance() {
|
24 |
// If the single instance hasn't been set, set it now.
|
25 |
-
if ( null
|
26 |
-
self::$instance = new self;
|
27 |
}
|
28 |
|
29 |
return self::$instance;
|
30 |
}
|
31 |
|
|
|
|
|
|
|
32 |
public function init() {
|
33 |
$options = Advanced_Ads::get_instance()->options();
|
34 |
|
35 |
-
if ( 'true'
|
36 |
|| ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_place_ads' ) )
|
37 |
|| defined( 'ADVANCED_ADS_DISABLE_SHORTCODE_BUTTON' )
|
38 |
|| ! empty( $options['disable-shortcode-button'] )
|
@@ -41,6 +46,7 @@ class Advanced_Ads_Shortcode_Creator {
|
|
41 |
}
|
42 |
|
43 |
add_filter( 'mce_external_plugins', array( $this, 'add_plugin' ) );
|
|
|
44 |
add_filter( 'mce_buttons', array( $this, 'register_buttons' ) );
|
45 |
add_filter( 'mce_external_languages', array( $this, 'add_l10n' ) );
|
46 |
add_action( 'wp_ajax_advads_content_for_shortcode_creator', array( $this, 'get_content_for_shortcode_creator' ) );
|
@@ -50,26 +56,37 @@ class Advanced_Ads_Shortcode_Creator {
|
|
50 |
}
|
51 |
|
52 |
/**
|
53 |
-
*
|
54 |
*
|
|
|
|
|
|
|
55 |
*/
|
56 |
public function add_plugin( $plugin_array ) {
|
|
|
|
|
|
|
57 |
$plugin_array['advads_shortcode'] = ADVADS_BASE_URL . 'admin/assets/js/shortcode.js';
|
58 |
return $plugin_array;
|
59 |
}
|
60 |
|
61 |
/**
|
62 |
-
*
|
|
|
|
|
63 |
*
|
|
|
64 |
*/
|
65 |
public function register_buttons( $buttons ) {
|
|
|
|
|
|
|
66 |
$buttons[] = 'advads_shortcode_button';
|
67 |
return $buttons;
|
68 |
}
|
69 |
|
70 |
/**
|
71 |
-
*
|
72 |
-
*
|
73 |
*/
|
74 |
public function get_content_for_shortcode_creator() {
|
75 |
if ( ! ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ) ) ) {
|
@@ -79,81 +96,110 @@ class Advanced_Ads_Shortcode_Creator {
|
|
79 |
$items = self::items_for_select(); ?>
|
80 |
|
81 |
<select id="advads-select-for-shortcode">
|
82 |
-
<option value=""><?php
|
83 |
<?php if ( isset( $items['ads'] ) ) : ?>
|
84 |
-
<optgroup label="<?php
|
85 |
<?php foreach ( $items['ads'] as $_item_id => $_item_title ) : ?>
|
86 |
-
<option value="<?php echo $_item_id; ?>"><?php echo $_item_title; ?></option>
|
87 |
<?php endforeach; ?>
|
88 |
</optgroup>
|
89 |
<?php endif; ?>
|
90 |
<?php if ( isset( $items['groups'] ) ) : ?>
|
91 |
-
<optgroup label="<?php
|
92 |
<?php foreach ( $items['groups'] as $_item_id => $_item_title ) : ?>
|
93 |
-
<option value="<?php echo $_item_id; ?>"><?php echo $_item_title; ?></option>
|
94 |
<?php endforeach; ?>
|
95 |
</optgroup>
|
96 |
-
<?php endif; ?>
|
97 |
<?php if ( isset( $items['placements'] ) ) : ?>
|
98 |
-
<optgroup label="<?php
|
99 |
<?php foreach ( $items['placements'] as $_item_id => $_item_title ) : ?>
|
100 |
-
<option value="<?php echo $_item_id; ?>"><?php echo $_item_title; ?></option>
|
101 |
<?php endforeach; ?>
|
102 |
</optgroup>
|
103 |
-
<?php endif; ?>
|
104 |
-
</select
|
|
|
105 |
exit();
|
106 |
}
|
107 |
|
108 |
/**
|
109 |
-
*
|
110 |
*
|
111 |
-
* @return
|
112 |
*/
|
113 |
-
public static function items_for_select(){
|
114 |
$select = array();
|
115 |
-
$model
|
116 |
-
|
117 |
-
// load all ads
|
118 |
-
$ads = $model->get_ads(
|
119 |
-
|
120 |
-
|
|
|
|
|
|
|
|
|
|
|
121 |
}
|
122 |
|
123 |
-
// load all ad groups
|
124 |
$groups = $model->get_ad_groups();
|
125 |
-
foreach ( $groups as $_group ){
|
126 |
-
$select['groups']['group_' . $_group->term_id] = $_group->name;
|
127 |
}
|
128 |
|
129 |
-
// load all placements
|
130 |
$placements = $model->get_ad_placements_array();
|
131 |
ksort( $placements );
|
132 |
foreach ( $placements as $key => $_placement ) {
|
133 |
-
$select['placements']['placement_' . $key] = $_placement['name'];
|
134 |
}
|
135 |
|
136 |
return $select;
|
137 |
}
|
138 |
|
139 |
/**
|
140 |
-
*
|
|
|
|
|
|
|
|
|
141 |
*/
|
142 |
public function add_l10n( $mce_external_languages ) {
|
143 |
-
|
|
|
|
|
|
|
144 |
return $mce_external_languages;
|
145 |
}
|
146 |
|
147 |
/**
|
148 |
* Add a warning above TinyMCE editor.
|
149 |
*
|
150 |
-
* @param string $output
|
|
|
|
|
151 |
*/
|
152 |
public function add_addblocker_warning( $output ) {
|
153 |
-
ob_start();
|
154 |
-
|
155 |
-
|
156 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
</div>
|
158 |
<?php
|
159 |
return ob_get_clean() . $output;
|
@@ -162,15 +208,16 @@ class Advanced_Ads_Shortcode_Creator {
|
|
162 |
/**
|
163 |
* Show a warning above TinyMCE editor when an adblock is enabled.
|
164 |
*/
|
165 |
-
public function maybe_show_adblocker_warning() {
|
|
|
166 |
<script>
|
167 |
(function(){
|
168 |
if ( 'undefined' === typeof advanced_ads_adblocker_test ) {
|
169 |
try {
|
170 |
-
|
171 |
} catch ( e ) { return; }
|
172 |
for ( var i = 0; i < messages.length; i++ ) {
|
173 |
-
|
174 |
}
|
175 |
}
|
176 |
})();
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Shortcode generator for TinyMCE editor
|
|
|
4 |
*/
|
5 |
class Advanced_Ads_Shortcode_Creator {
|
6 |
/**
|
7 |
+
* Instance of this class.
|
8 |
*
|
9 |
* @var object
|
10 |
*/
|
11 |
protected static $instance = null;
|
12 |
|
13 |
+
/**
|
14 |
+
* Advanced_Ads_Shortcode_Creator constructor.
|
15 |
+
*/
|
16 |
private function __construct() {
|
17 |
+
add_action( 'init', array( $this, 'init' ) );
|
18 |
}
|
19 |
|
20 |
/**
|
24 |
*/
|
25 |
public static function get_instance() {
|
26 |
// If the single instance hasn't been set, set it now.
|
27 |
+
if ( null === self::$instance ) {
|
28 |
+
self::$instance = new self();
|
29 |
}
|
30 |
|
31 |
return self::$instance;
|
32 |
}
|
33 |
|
34 |
+
/**
|
35 |
+
* Call needed hooks and functions
|
36 |
+
*/
|
37 |
public function init() {
|
38 |
$options = Advanced_Ads::get_instance()->options();
|
39 |
|
40 |
+
if ( 'true' !== get_user_option( 'rich_editing' )
|
41 |
|| ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_place_ads' ) )
|
42 |
|| defined( 'ADVANCED_ADS_DISABLE_SHORTCODE_BUTTON' )
|
43 |
|| ! empty( $options['disable-shortcode-button'] )
|
46 |
}
|
47 |
|
48 |
add_filter( 'mce_external_plugins', array( $this, 'add_plugin' ) );
|
49 |
+
|
50 |
add_filter( 'mce_buttons', array( $this, 'register_buttons' ) );
|
51 |
add_filter( 'mce_external_languages', array( $this, 'add_l10n' ) );
|
52 |
add_action( 'wp_ajax_advads_content_for_shortcode_creator', array( $this, 'get_content_for_shortcode_creator' ) );
|
56 |
}
|
57 |
|
58 |
/**
|
59 |
+
* Add the plugin to array of external TinyMCE plugins
|
60 |
*
|
61 |
+
* @param array $plugin_array array with TinyMCE plugins.
|
62 |
+
*
|
63 |
+
* @return array
|
64 |
*/
|
65 |
public function add_plugin( $plugin_array ) {
|
66 |
+
if ( ! is_array( $plugin_array ) ) {
|
67 |
+
$plugin_array = array();
|
68 |
+
}
|
69 |
$plugin_array['advads_shortcode'] = ADVADS_BASE_URL . 'admin/assets/js/shortcode.js';
|
70 |
return $plugin_array;
|
71 |
}
|
72 |
|
73 |
/**
|
74 |
+
* Add button to tinyMCE window
|
75 |
+
*
|
76 |
+
* @param array $buttons array with existing buttons.
|
77 |
*
|
78 |
+
* @return array
|
79 |
*/
|
80 |
public function register_buttons( $buttons ) {
|
81 |
+
if ( ! is_array( $buttons ) ) {
|
82 |
+
$buttons = array();
|
83 |
+
}
|
84 |
$buttons[] = 'advads_shortcode_button';
|
85 |
return $buttons;
|
86 |
}
|
87 |
|
88 |
/**
|
89 |
+
* Prints html select field for shortcode creator
|
|
|
90 |
*/
|
91 |
public function get_content_for_shortcode_creator() {
|
92 |
if ( ! ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ) ) ) {
|
96 |
$items = self::items_for_select(); ?>
|
97 |
|
98 |
<select id="advads-select-for-shortcode">
|
99 |
+
<option value=""><?php esc_html_e( '--empty--', 'advanced-ads' ); ?></option>
|
100 |
<?php if ( isset( $items['ads'] ) ) : ?>
|
101 |
+
<optgroup label="<?php esc_html_e( 'Ads', 'advanced-ads' ); ?>">
|
102 |
<?php foreach ( $items['ads'] as $_item_id => $_item_title ) : ?>
|
103 |
+
<option value="<?php echo esc_attr( $_item_id ); ?>"><?php echo esc_html( $_item_title ); ?></option>
|
104 |
<?php endforeach; ?>
|
105 |
</optgroup>
|
106 |
<?php endif; ?>
|
107 |
<?php if ( isset( $items['groups'] ) ) : ?>
|
108 |
+
<optgroup label="<?php esc_html_e( 'Ad Groups', 'advanced-ads' ); ?>">
|
109 |
<?php foreach ( $items['groups'] as $_item_id => $_item_title ) : ?>
|
110 |
+
<option value="<?php echo esc_attr( $_item_id ); ?>"><?php echo esc_html( $_item_title ); ?></option>
|
111 |
<?php endforeach; ?>
|
112 |
</optgroup>
|
113 |
+
<?php endif; ?>
|
114 |
<?php if ( isset( $items['placements'] ) ) : ?>
|
115 |
+
<optgroup label="<?php esc_html_e( 'Placements', 'advanced-ads' ); ?>">
|
116 |
<?php foreach ( $items['placements'] as $_item_id => $_item_title ) : ?>
|
117 |
+
<option value="<?php echo esc_attr( $_item_id ); ?>"><?php echo esc_html( $_item_title ); ?></option>
|
118 |
<?php endforeach; ?>
|
119 |
</optgroup>
|
120 |
+
<?php endif; ?>
|
121 |
+
</select>
|
122 |
+
<?php
|
123 |
exit();
|
124 |
}
|
125 |
|
126 |
/**
|
127 |
+
* Get items for item select field
|
128 |
*
|
129 |
+
* @return array $select items for select field.
|
130 |
*/
|
131 |
+
public static function items_for_select() {
|
132 |
$select = array();
|
133 |
+
$model = Advanced_Ads::get_instance()->get_model();
|
134 |
+
|
135 |
+
// load all ads.
|
136 |
+
$ads = $model->get_ads(
|
137 |
+
array(
|
138 |
+
'orderby' => 'title',
|
139 |
+
'order' => 'ASC',
|
140 |
+
)
|
141 |
+
);
|
142 |
+
foreach ( $ads as $_ad ) {
|
143 |
+
$select['ads'][ 'ad_' . $_ad->ID ] = $_ad->post_title;
|
144 |
}
|
145 |
|
146 |
+
// load all ad groups.
|
147 |
$groups = $model->get_ad_groups();
|
148 |
+
foreach ( $groups as $_group ) {
|
149 |
+
$select['groups'][ 'group_' . $_group->term_id ] = $_group->name;
|
150 |
}
|
151 |
|
152 |
+
// load all placements.
|
153 |
$placements = $model->get_ad_placements_array();
|
154 |
ksort( $placements );
|
155 |
foreach ( $placements as $key => $_placement ) {
|
156 |
+
$select['placements'][ 'placement_' . $key ] = $_placement['name'];
|
157 |
}
|
158 |
|
159 |
return $select;
|
160 |
}
|
161 |
|
162 |
/**
|
163 |
+
* Add localisation
|
164 |
+
*
|
165 |
+
* @param array $mce_external_languages localization template.
|
166 |
+
*
|
167 |
+
* @return array
|
168 |
*/
|
169 |
public function add_l10n( $mce_external_languages ) {
|
170 |
+
if ( ! is_array( $mce_external_languages ) ) {
|
171 |
+
$mce_external_languages = array();
|
172 |
+
}
|
173 |
+
$mce_external_languages['advads_shortcode'] = ADVADS_BASE_PATH . 'admin/includes/shortcode-creator-l10n.php';
|
174 |
return $mce_external_languages;
|
175 |
}
|
176 |
|
177 |
/**
|
178 |
* Add a warning above TinyMCE editor.
|
179 |
*
|
180 |
+
* @param string $output editor's HTML markup.
|
181 |
+
*
|
182 |
+
* @return string
|
183 |
*/
|
184 |
public function add_addblocker_warning( $output ) {
|
185 |
+
ob_start();
|
186 |
+
?>
|
187 |
+
<div style="display: none; margin: 10px 8px; color: red;" class="advanced-ads-shortcode-button-warning">
|
188 |
+
<?php
|
189 |
+
printf(
|
190 |
+
wp_kses(
|
191 |
+
// translators: %s is a URL.
|
192 |
+
__( 'Please, either switch off your ad blocker or disable the shortcode button in the <a href="%s" target="_blank">settings</a>.', 'advanced-ads' ),
|
193 |
+
array(
|
194 |
+
'a' => array(
|
195 |
+
'href' => array(),
|
196 |
+
'target' => array(),
|
197 |
+
),
|
198 |
+
)
|
199 |
+
),
|
200 |
+
esc_url( admin_url( 'admin.php?page=advanced-ads-settings' ) )
|
201 |
+
);
|
202 |
+
?>
|
203 |
</div>
|
204 |
<?php
|
205 |
return ob_get_clean() . $output;
|
208 |
/**
|
209 |
* Show a warning above TinyMCE editor when an adblock is enabled.
|
210 |
*/
|
211 |
+
public function maybe_show_adblocker_warning() {
|
212 |
+
?>
|
213 |
<script>
|
214 |
(function(){
|
215 |
if ( 'undefined' === typeof advanced_ads_adblocker_test ) {
|
216 |
try {
|
217 |
+
var messages = document.querySelectorAll( '.advanced-ads-shortcode-button-warning' )
|
218 |
} catch ( e ) { return; }
|
219 |
for ( var i = 0; i < messages.length; i++ ) {
|
220 |
+
messages[ i ].style.display = 'block';
|
221 |
}
|
222 |
}
|
223 |
})();
|
admin/includes/notices.php
CHANGED
@@ -1,66 +1,71 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*/
|
5 |
-
$advanced_ads_admin_notices = apply_filters(
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
'
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
'nl_first_steps' => array(
|
14 |
-
'type' => 'subscribe',
|
15 |
-
'text' => __( 'Thank you for activating <strong>Advanced Ads</strong>. Would you like to receive the first steps via email?', 'advanced-ads' ),
|
16 |
-
'confirm_text' => __( 'Yes, send it', 'advanced-ads' ),
|
17 |
-
'global' => true,
|
18 |
-
),
|
19 |
-
// free add-ons.
|
20 |
-
'nl_free_addons' => array(
|
21 |
-
'type' => 'subscribe',
|
22 |
-
'text' => __( 'Thank you for using <strong>Advanced Ads</strong>. Stay informed and receive <strong>2 free add-ons</strong> for joining the newsletter.', 'advanced-ads' ),
|
23 |
-
'confirm_text' => __( 'Add me now', 'advanced-ads' ),
|
24 |
-
'global' => true,
|
25 |
-
),
|
26 |
-
// adsense newsletter group.
|
27 |
-
'nl_adsense' => array(
|
28 |
-
'type' => 'subscribe',
|
29 |
-
'text' => __( 'Learn more about how and <strong>how much you can earn with AdSense</strong> and Advanced Ads from my dedicated newsletter.', 'advanced-ads' ),
|
30 |
-
'confirm_text' => __( 'Subscribe me now', 'advanced-ads' ),
|
31 |
-
'global' => true,
|
32 |
-
),
|
33 |
-
// missing license codes.
|
34 |
-
'license_invalid' => array(
|
35 |
-
'type' => 'plugin_error',
|
36 |
-
'text' => __( 'One or more license keys for <strong>Advanced Ads add-ons are invalid or missing</strong>.', 'advanced-ads' ) . ' ' . sprintf( __( 'Please add valid license keys <a href="%s">here</a>.', 'advanced-ads' ), get_admin_url( 1, 'admin.php?page=advanced-ads-settings#top#licenses' ) ),
|
37 |
-
),
|
38 |
-
// please review.
|
39 |
-
'review' => array(
|
40 |
-
'type' => 'info',
|
41 |
-
//'text' => '<img src="' . ADVADS_BASE_URL . 'admin/assets/img/thomas.png" alt="Thomas" width="80" height="115" class="advads-review-image"/>'
|
42 |
-
'text' => '<div style="float: left; font-size: 4em; line-height: 1em; margin-right: 0.5em;">' . Advanced_Ads::get_number_of_ads() . '</div>'
|
43 |
-
. '<div style="float:left;">'
|
44 |
-
. '<p>' . __( '… ads created using <strong>Advanced Ads</strong>.', 'advanced-ads' ) . '</p>'
|
45 |
-
. '<p>' . __( 'Do you find the plugin useful and would like to thank us for updates, fixing bugs and improving your ad setup?', 'advanced-ads' ) . '</p>'
|
46 |
-
. '<p>' .
|
47 |
-
// translators: this belongs to our message asking the user for a review. You can find a nice equivalent in your own language
|
48 |
-
__( 'When you give 5-stars, an actual person does a little happy dance!', 'advanced-ads' ) . '</p>'
|
49 |
-
. '<p>'
|
50 |
-
. '<span class="dashicons dashicons-external"></span> <strong><a href="https://wordpress.org/support/plugin/advanced-ads/reviews/?rate=5#new-post" target=_"blank">' . __( 'Sure, I appreciate your work', 'advanced-ads' ) . '</a></strong>'
|
51 |
-
. ' <span class="dashicons dashicons-sos"></span> <a href="' . ADVADS_URL . 'support/#utm_source=advanced-ads&utm_medium=link&utm_campaign=notice-review" target=_"blank">' . __( 'Yes, but help me first to solve a problem, please', 'advanced-ads' ) . '</a>'
|
52 |
-
. '</p></div>',
|
53 |
-
'global' => false,
|
54 |
-
),
|
55 |
-
// Black Friday 2019 promotion.
|
56 |
-
'bf2019' => array(
|
57 |
-
'type' => 'info',
|
58 |
-
'text' => sprintf(
|
59 |
-
// translators: %s is a link. `30%%` is correct, please use exactly that value so that it shows "30%".
|
60 |
-
__( 'Our Black Friday / Cyber Monday Offer: <span style="font-weight: bold; font-size: 1.4em; color: green;">-30%%</span> on all add-ons and All Access.<a class="button button-primary" target="_blank" href="%s">Get All Access</a>', 'advanced-ads' ),
|
61 |
-
ADVADS_URL . 'checkout/?edd_action=add_to_cart&download_id=95170&edd_options[price_id]=1&discount=BFCM2019#utm_source=advanced-ads&utm_medium=link&utm_campaign=bfcm-2019'
|
62 |
),
|
63 |
-
|
64 |
-
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Array with admin notices
|
4 |
*/
|
5 |
+
$advanced_ads_admin_notices = apply_filters(
|
6 |
+
'advanced-ads-notices',
|
7 |
+
array(
|
8 |
+
// email tutorial.
|
9 |
+
'nl_intro' => array(
|
10 |
+
'type' => 'info',
|
11 |
+
'text' => Advanced_Ads_Admin_Notices::get_instance()->get_welcome_panel(),
|
12 |
+
'global' => true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
),
|
14 |
+
// email tutorial.
|
15 |
+
'nl_first_steps' => array(
|
16 |
+
'type' => 'subscribe',
|
17 |
+
'text' => __( 'Thank you for activating <strong>Advanced Ads</strong>. Would you like to receive the first steps via email?', 'advanced-ads' ),
|
18 |
+
'confirm_text' => __( 'Yes, send it', 'advanced-ads' ),
|
19 |
+
'global' => true,
|
20 |
+
),
|
21 |
+
// free add-ons.
|
22 |
+
'nl_free_addons' => array(
|
23 |
+
'type' => 'subscribe',
|
24 |
+
'text' => __( 'Thank you for using <strong>Advanced Ads</strong>. Stay informed and receive <strong>2 free add-ons</strong> for joining the newsletter.', 'advanced-ads' ),
|
25 |
+
'confirm_text' => __( 'Add me now', 'advanced-ads' ),
|
26 |
+
'global' => true,
|
27 |
+
),
|
28 |
+
// adsense newsletter group.
|
29 |
+
'nl_adsense' => array(
|
30 |
+
'type' => 'subscribe',
|
31 |
+
'text' => __( 'Learn more about how and <strong>how much you can earn with AdSense</strong> and Advanced Ads from my dedicated newsletter.', 'advanced-ads' ),
|
32 |
+
'confirm_text' => __( 'Subscribe me now', 'advanced-ads' ),
|
33 |
+
'global' => true,
|
34 |
+
),
|
35 |
+
// missing license codes.
|
36 |
+
'license_invalid' => array(
|
37 |
+
'type' => 'plugin_error',
|
38 |
+
'text' => __( 'One or more license keys for <strong>Advanced Ads add-ons are invalid or missing</strong>.', 'advanced-ads' ) . ' '
|
39 |
+
// translators: %s is a URL.
|
40 |
+
. sprintf( __( 'Please add valid license keys <a href="%s">here</a>.', 'advanced-ads' ), get_admin_url( 1, 'admin.php?page=advanced-ads-settings#top#licenses' ) ),
|
41 |
+
),
|
42 |
+
// please review.
|
43 |
+
'review' => array(
|
44 |
+
'type' => 'info',
|
45 |
+
// 'text' => '<img src="' . ADVADS_BASE_URL . 'admin/assets/img/thomas.png" alt="Thomas" width="80" height="115" class="advads-review-image"/>'
|
46 |
+
'text' => '<div style="float: left; font-size: 4em; line-height: 1em; margin-right: 0.5em;">' . Advanced_Ads::get_number_of_ads() . '</div>'
|
47 |
+
. '<div style="float:left;">'
|
48 |
+
. '<p>' . __( '… ads created using <strong>Advanced Ads</strong>.', 'advanced-ads' ) . '</p>'
|
49 |
+
. '<p>' . __( 'Do you find the plugin useful and would like to thank us for updates, fixing bugs and improving your ad setup?', 'advanced-ads' ) . '</p>'
|
50 |
+
. '<p>' .
|
51 |
+
// translators: this belongs to our message asking the user for a review. You can find a nice equivalent in your own language.
|
52 |
+
__( 'When you give 5-stars, an actual person does a little happy dance!', 'advanced-ads' ) . '</p>'
|
53 |
+
. '<p>'
|
54 |
+
. '<span class="dashicons dashicons-external"></span> <strong><a href="https://wordpress.org/support/plugin/advanced-ads/reviews/?rate=5#new-post" target=_"blank">' . __( 'Sure, I appreciate your work', 'advanced-ads' ) . '</a></strong>'
|
55 |
+
. ' <span class="dashicons dashicons-sos"></span> <a href="' . ADVADS_URL . 'support/#utm_source=advanced-ads&utm_medium=link&utm_campaign=notice-review" target=_"blank">' . __( 'Yes, but help me first to solve a problem, please', 'advanced-ads' ) . '</a>'
|
56 |
+
. '</p></div>',
|
57 |
+
'global' => false,
|
58 |
+
),
|
59 |
+
// Black Friday 2019 promotion.
|
60 |
+
'bf2019' => array(
|
61 |
+
'type' => 'info',
|
62 |
+
'text' => sprintf(
|
63 |
+
// translators: %s is a link. `30%%` is correct, please use exactly that value so that it shows "30%".
|
64 |
+
__( 'Our Black Friday / Cyber Monday Offer: <span style="font-weight: bold; font-size: 1.4em; color: green;">-30%%</span> on all add-ons and All Access.<a class="button button-primary" target="_blank" href="%s">Get All Access</a>', 'advanced-ads' ),
|
65 |
+
ADVADS_URL . 'checkout/?edd_action=add_to_cart&download_id=95170&edd_options[price_id]=1&discount=BFCM2019#utm_source=advanced-ads&utm_medium=link&utm_campaign=bfcm-2019'
|
66 |
+
),
|
67 |
+
'global' => true,
|
68 |
+
),
|
69 |
+
)
|
70 |
+
);
|
71 |
|
admin/includes/shortcode-creator-l10n.php
CHANGED
@@ -1,20 +1,27 @@
|
|
1 |
<?php
|
2 |
-
if ( ! defined( 'ABSPATH' ) )
|
3 |
-
|
|
|
4 |
|
5 |
-
if ( ! class_exists( '_WP_Editors' ) )
|
6 |
-
|
|
|
7 |
|
|
|
|
|
|
|
|
|
|
|
8 |
function advads_shortcode_creator_l10n() {
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
|
17 |
-
|
18 |
}
|
19 |
|
20 |
$strings = advads_shortcode_creator_l10n();
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit;
|
4 |
+
}
|
5 |
|
6 |
+
if ( ! class_exists( '_WP_Editors' ) ) {
|
7 |
+
require ABSPATH . WPINC . '/class-wp-editor.php';
|
8 |
+
}
|
9 |
|
10 |
+
/**
|
11 |
+
* Handle localization of the shortcode in the classic editor.
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
function advads_shortcode_creator_l10n() {
|
16 |
+
$strings = array(
|
17 |
+
'title' => _x( 'Add an ad', 'shortcode creator', 'advanced-ads' ),
|
18 |
+
'ok' => _x( 'Add shortcode', 'shortcode creator', 'advanced-ads' ),
|
19 |
+
'cancel' => _x( 'Cancel', 'shortcode creator', 'advanced-ads' ),
|
20 |
+
);
|
21 |
+
$locale = _WP_Editors::$mce_locale;
|
22 |
+
$translated = 'tinyMCE.addI18n("' . $locale . '.advads_shortcode", ' . wp_json_encode( $strings ) . ");\n";
|
23 |
|
24 |
+
return $translated;
|
25 |
}
|
26 |
|
27 |
$strings = advads_shortcode_creator_l10n();
|
admin/views/ad-group.php
CHANGED
@@ -7,48 +7,52 @@
|
|
7 |
* @license GPL-2.0+
|
8 |
* @link https://wpadvancedads.com
|
9 |
* @copyright since 2013 Thomas Maier, Advanced Ads GmbH
|
10 |
-
*
|
11 |
*/
|
12 |
|
13 |
$ad_groups_list = new Advanced_Ads_Groups_List();
|
14 |
|
15 |
// create new group.
|
16 |
if ( isset( $_REQUEST['advads-group-add-nonce'] ) ) {
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
25 |
}
|
26 |
// save updated groups.
|
27 |
if ( isset( $_REQUEST['advads-group-update-nonce'] ) ) {
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
|
|
36 |
}
|
37 |
|
38 |
$last_edited_group_id = 0;
|
39 |
-
if (isset( $_REQUEST['advads-last-edited-group'] )){
|
40 |
$last_edited_group_id = $_REQUEST['advads-last-edited-group'];
|
41 |
?>
|
42 |
<script>
|
43 |
var body = document.getElementsByTagName("body")[0];
|
44 |
body.addEventListener("load", function(){
|
45 |
-
jQuery('#advads-ad-group-<?php echo $last_edited_group_id?>').get(0).scrollIntoView(false);
|
46 |
}, true);
|
47 |
</script>
|
48 |
-
<?php
|
49 |
}
|
50 |
|
51 |
-
|
|
|
52 |
<h1 class="wp-heading-inline">
|
53 |
<?php
|
54 |
echo esc_html( $title );
|
@@ -59,28 +63,39 @@ if (isset( $_REQUEST['advads-last-edited-group'] )){
|
|
59 |
if ( ! empty( $_REQUEST['s'] ) ) {
|
60 |
printf( '<span class="subtitle">' . __( 'Search results for “%s”', 'advanced-ads' ) . '</span>', esc_html( wp_unslash( $_REQUEST['s'] ) ) );
|
61 |
} else {
|
62 |
-
|
|
|
63 |
}
|
64 |
?>
|
65 |
<form id="advads-new-group-form" action="" method="post" style="display:none;">
|
66 |
<?php wp_nonce_field( 'add-advads-groups', 'advads-group-add-nonce' ); ?>
|
67 |
-
|
68 |
<input class="button button-primary" type="submit" value="<?php esc_attr_e( 'save', 'advanced-ads' ); ?>"/>
|
69 |
</form>
|
70 |
<p><?php 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' ); ?></p>
|
71 |
-
<p
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
<?php if ( isset( $message ) ) : ?>
|
79 |
-
<div id="message" class="updated"><p><?php echo $message; ?></p></div>
|
80 |
<?php
|
81 |
$_SERVER['REQUEST_URI'] = esc_url( remove_query_arg( array( 'message' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
|
82 |
endif;
|
83 |
-
?>
|
84 |
<div id="ajax-response"></div>
|
85 |
|
86 |
<div id="col-container">
|
@@ -99,7 +114,7 @@ if (isset( $_REQUEST['advads-last-edited-group'] )){
|
|
99 |
<?php $ad_groups_list->render_header(); ?>
|
100 |
<?php $ad_groups_list->render_rows(); ?>
|
101 |
</table>
|
102 |
-
<input type="hidden" name="advads-last-edited-group" id="advads-last-edited-group" value="<?php echo $last_edited_group_id
|
103 |
<div class="tablenav bottom">
|
104 |
<?php submit_button( __( 'Update Groups', 'advanced-ads' ) ); ?>
|
105 |
</div>
|
7 |
* @license GPL-2.0+
|
8 |
* @link https://wpadvancedads.com
|
9 |
* @copyright since 2013 Thomas Maier, Advanced Ads GmbH
|
|
|
10 |
*/
|
11 |
|
12 |
$ad_groups_list = new Advanced_Ads_Groups_List();
|
13 |
|
14 |
// create new group.
|
15 |
if ( isset( $_REQUEST['advads-group-add-nonce'] ) ) {
|
16 |
+
$create_result = $ad_groups_list->create_group();
|
17 |
+
// display error message.
|
18 |
+
if ( is_wp_error( $create_result ) ) {
|
19 |
+
// potential error comes from WP_Error and is no user input.
|
20 |
+
// phpcs:ignore
|
21 |
+
$error_string = $create_result->get_error_message();
|
22 |
+
echo '<div id="message" class="error"><p>' . esc_html( $error_string ) . '</p></div>';
|
23 |
+
} else {
|
24 |
+
echo '<div id="message" class="updated"><p>' . esc_html__( 'Ad Group successfully created', 'advanced-ads' ) . '</p></div>';
|
25 |
+
}
|
26 |
}
|
27 |
// save updated groups.
|
28 |
if ( isset( $_REQUEST['advads-group-update-nonce'] ) ) {
|
29 |
+
$udpate_result = $ad_groups_list->update_groups();
|
30 |
+
// display error message.
|
31 |
+
if ( is_wp_error( $udpate_result ) ) {
|
32 |
+
$error_string = $udpate_result->get_error_message();
|
33 |
+
// potential error comes from WP_Error and is no user input.
|
34 |
+
// phpcs:ignore
|
35 |
+
echo '<div id="message" class="error"><p>' . $error_string . '</p></div>';
|
36 |
+
} else {
|
37 |
+
echo '<div id="message" class="updated"><p>' . esc_html__( 'Ad Groups successfully updated', 'advanced-ads' ) . '</p></div>';
|
38 |
+
}
|
39 |
}
|
40 |
|
41 |
$last_edited_group_id = 0;
|
42 |
+
if ( isset( $_REQUEST['advads-last-edited-group'] ) ) {
|
43 |
$last_edited_group_id = $_REQUEST['advads-last-edited-group'];
|
44 |
?>
|
45 |
<script>
|
46 |
var body = document.getElementsByTagName("body")[0];
|
47 |
body.addEventListener("load", function(){
|
48 |
+
jQuery('#advads-ad-group-<?php echo esc_attr( $last_edited_group_id ); ?>').get(0).scrollIntoView(false);
|
49 |
}, true);
|
50 |
</script>
|
51 |
+
<?php
|
52 |
}
|
53 |
|
54 |
+
?>
|
55 |
+
<div class="wrap nosubsub">
|
56 |
<h1 class="wp-heading-inline">
|
57 |
<?php
|
58 |
echo esc_html( $title );
|
63 |
if ( ! empty( $_REQUEST['s'] ) ) {
|
64 |
printf( '<span class="subtitle">' . __( 'Search results for “%s”', 'advanced-ads' ) . '</span>', esc_html( wp_unslash( $_REQUEST['s'] ) ) );
|
65 |
} else {
|
66 |
+
$group_page_url = Advanced_Ads_Groups_List::group_page_url( array( 'action' => 'edit' ) );
|
67 |
+
echo ' <a href="' . esc_url( $group_page_url ) . '" id="advads-new-ad-group-link" class="add-new-h2">' . esc_html( $tax->labels->add_new_item ) . '</a>';
|
68 |
}
|
69 |
?>
|
70 |
<form id="advads-new-group-form" action="" method="post" style="display:none;">
|
71 |
<?php wp_nonce_field( 'add-advads-groups', 'advads-group-add-nonce' ); ?>
|
72 |
+
<input type="text" name="advads-group-name" placeholder="<?php esc_attr_e( 'Group title', 'advanced-ads' ); ?>"/>
|
73 |
<input class="button button-primary" type="submit" value="<?php esc_attr_e( 'save', 'advanced-ads' ); ?>"/>
|
74 |
</form>
|
75 |
<p><?php 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' ); ?></p>
|
76 |
+
<p>
|
77 |
+
<?php
|
78 |
+
printf(
|
79 |
+
wp_kses(
|
80 |
+
// translators: %s is a URL.
|
81 |
+
__( 'Find more information about ad groups in the <a href="%s" target="_blank">manual</a>.', 'advanced-ads' ),
|
82 |
+
array(
|
83 |
+
'a' => array(
|
84 |
+
'href' => array(),
|
85 |
+
'target' => array(),
|
86 |
+
),
|
87 |
+
)
|
88 |
+
),
|
89 |
+
esc_url( ADVADS_URL ) . 'manual/ad-groups/#utm_source=advanced-ads&utm_medium=link&utm_campaign=groups'
|
90 |
+
);
|
91 |
+
?>
|
92 |
+
</p>
|
93 |
<?php if ( isset( $message ) ) : ?>
|
94 |
+
<div id="message" class="updated"><p><?php echo esc_html( $message ); ?></p></div>
|
95 |
<?php
|
96 |
$_SERVER['REQUEST_URI'] = esc_url( remove_query_arg( array( 'message' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
|
97 |
endif;
|
98 |
+
?>
|
99 |
<div id="ajax-response"></div>
|
100 |
|
101 |
<div id="col-container">
|
114 |
<?php $ad_groups_list->render_header(); ?>
|
115 |
<?php $ad_groups_list->render_rows(); ?>
|
116 |
</table>
|
117 |
+
<input type="hidden" name="advads-last-edited-group" id="advads-last-edited-group" value="<?php echo esc_attr( $last_edited_group_id ); ?>"/>
|
118 |
<div class="tablenav bottom">
|
119 |
<?php submit_button( __( 'Update Groups', 'advanced-ads' ) ); ?>
|
120 |
</div>
|
admin/views/setting-disable-post-types.php
DELETED
@@ -1,11 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
foreach ( $post_types as $_type_id => $_type ) {
|
3 |
-
|
4 |
-
if ( $type_label_counts[ $_type->label ] < 2 ) {
|
5 |
-
$_label = $_type->label;
|
6 |
-
} else {
|
7 |
-
$_label = sprintf( '%s (%s)', $_type->label, $_type_id );
|
8 |
-
}
|
9 |
-
?>
|
10 |
-
<label style="margin-right: 1em;"><input type="checkbox" disabled="disabled"><?php esc_html_e( $_label ); ?></label><?php
|
11 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
admin/views/setting-license.php
CHANGED
@@ -1,4 +1,9 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
2 |
$errortext = false;
|
3 |
$expires = Advanced_Ads_Admin_Licenses::get_instance()->get_license_expires( $options_slug );
|
4 |
$expired = false;
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Template for license fields.
|
4 |
+
*
|
5 |
+
* Do not move since it could be used by add-ons.
|
6 |
+
*/
|
7 |
$errortext = false;
|
8 |
$expires = Advanced_Ads_Admin_Licenses::get_instance()->get_license_expires( $options_slug );
|
9 |
$expired = false;
|
admin/views/setting-target.php
DELETED
@@ -1,4 +0,0 @@
|
|
1 |
-
<input name="<?php echo ADVADS_SLUG; ?>[target-blank]" type="checkbox" value="1" <?php
|
2 |
-
checked( 1, $target );
|
3 |
-
?>/>
|
4 |
-
<p class="description"><?php _e( 'Open programatically created links in a new window (use <code>target="_blank"</code>)', 'advanced-ads' ); ?></p>
|
|
|
|
|
|
|
|
admin/views/settings-disable-ads.php
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
<label><input id="advanced-ads-disable-ads-all" type="checkbox" value="1" name="<?php echo ADVADS_SLUG ?>[disabled-ads][all]" <?php
|
2 |
-
checked( $disable_all, 1 ); ?>><?php _e( 'Disable all ads in frontend', 'advanced-ads' ); ?></label>
|
3 |
-
<p class="description"><?php _e( 'Use this option to disable all ads in the frontend, but still be able to use the plugin.', 'advanced-ads' ); ?></p>
|
4 |
-
|
5 |
-
<label><input id="advanced-ads-disable-ads-404" type="checkbox" value="1" name="<?php
|
6 |
-
echo ADVADS_SLUG; ?>[disabled-ads][404]" <?php
|
7 |
-
checked( $disable_404, 1 );
|
8 |
-
?>><?php _e( 'Disable ads on 404 error pages', 'advanced-ads' ); ?></label>
|
9 |
-
|
10 |
-
<br/><label><input id="advanced-ads-disable-ads-archives" type="checkbox" value="1" name="<?php echo ADVADS_SLUG; ?>[disabled-ads][archives]" <?php
|
11 |
-
checked( $disable_archives, 1 );
|
12 |
-
?>><?php _e( 'Disable ads on non-singular pages', 'advanced-ads' ); ?></label>
|
13 |
-
<p class="description"><?php _e( 'e.g. archive pages like categories, tags, authors, front page (if a list)', 'advanced-ads' ); ?></p>
|
14 |
-
<label><input id="advanced-ads-disable-ads-secondary" type="checkbox" value="1" name="<?php
|
15 |
-
echo ADVADS_SLUG;
|
16 |
-
?>[disabled-ads][secondary]" <?php
|
17 |
-
checked( $disable_secondary, 1 );
|
18 |
-
?>><?php _e( 'Disable ads on secondary queries', 'advanced-ads' ); ?></label>
|
19 |
-
<p class="description"><?php _e( 'Secondary queries are custom queries of posts outside the main query of a page. Try this option if you see ads injected on places where they shouldn’t appear.', 'advanced-ads' ); ?></p>
|
20 |
-
|
21 |
-
<label><input id="advanced-ads-disable-ads-feed" type="checkbox" value="1" name="<?php
|
22 |
-
echo ADVADS_SLUG;
|
23 |
-
?>[disabled-ads][feed]" <?php
|
24 |
-
checked( $disable_feed, 1 );
|
25 |
-
?>><?php _e( 'Disable ads in RSS Feed', 'advanced-ads' ); ?></label>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
admin/views/settings/general/advanced-js.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// display notice if js file was overridden.
|
3 |
+
if ( ! $checked && apply_filters( 'advanced-ads-activate-advanced-js', $checked ) ) :
|
4 |
+
?><p><?php esc_html_e( 'The file is currently enabled by an add-on that needs it.', 'advanced-ads' ); ?></p>
|
5 |
+
<?php
|
6 |
+
endif;
|
7 |
+
?>
|
8 |
+
<input id="advanced-ads-advanced-js" type="checkbox" value="1" name="<?php echo esc_attr( ADVADS_SLUG ); ?>[advanced-js]" <?php checked( $checked, 1 ); ?>>
|
9 |
+
<p class="description">
|
10 |
+
<?php
|
11 |
+
printf(
|
12 |
+
wp_kses(
|
13 |
+
// translators: %s is a URL.
|
14 |
+
__( 'Enable advanced JavaScript functions (<a href="%s" target="_blank">here</a>). Some features and add-ons might override this setting if they need features from this file.', 'advanced-ads' ),
|
15 |
+
array(
|
16 |
+
'a' => array(
|
17 |
+
'href' => array(),
|
18 |
+
'taret' => array(),
|
19 |
+
),
|
20 |
+
)
|
21 |
+
),
|
22 |
+
esc_url( ADVADS_URL . 'javascript-functions/#utm_source=advanced-ads&utm_medium=link&utm_campaign=settings' )
|
23 |
+
);
|
24 |
+
?>
|
25 |
+
</p>
|
admin/views/settings/general/block-bots.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<input id="advanced-ads-block-bots" type="checkbox" value="1" name="<?php echo esc_attr( ADVADS_SLUG ); ?>[block-bots]" <?php checked( $checked, 1 ); ?>>
|
2 |
+
<?php
|
3 |
+
if ( Advanced_Ads::get_instance()->is_bot() ) :
|
4 |
+
?>
|
5 |
+
<span class="advads-error-message"><?php esc_html_e( 'You look like a bot', 'advanced-ads' ); ?></span>
|
6 |
+
<?php
|
7 |
+
endif;
|
8 |
+
?>
|
9 |
+
<span class="description"><a href="<?php echo esc_url( ADVADS_URL . 'hide-ads-from-bots/#utm_source=advanced-ads&utm_medium=link&utm_campaign=settings' ); ?>" target="blank"><?php esc_html_e( 'Read this first', 'advanced-ads' ); ?></a></span>
|
10 |
+
<p class="description"><?php esc_html_e( 'Hide ads from crawlers, bots and empty user agents.', 'advanced-ads' ); ?></p>
|
admin/views/settings/general/content-injection-everywhere.php
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
<input id="advanced-ads-injection-everywhere" type="number" value="<?php echo esc_attr( $everywhere ); ?>" min="-1" name="<?php echo esc_attr( ADVADS_SLUG ); ?>[content-injection-everywhere]">
|
2 |
+
<p class="description"><?php esc_html_e( 'Some plugins and themes trigger ad injections where it shouldn’t happen. Therefore, Advanced Ads ignores injected placements on non-singular pages and outside the loop. However, this can cause problems with some themes. Set this option to -1 in order to enable unlimited ad injection at your own risk, set it to 0 to keep it disabled or choose a positive number to enable the injection only in the first x posts on your archive pages.', 'advanced-ads' ); ?></p>
|
admin/views/settings/general/content-injection-level-limitation.php
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
<input id="advanced-ads-content-injection-level-disabled" type="checkbox" value="1" name="<?php echo esc_attr( ADVADS_SLUG ); ?>[content-injection-level-disabled]" <?php checked( $checked, 1 ); ?>>
|
2 |
+
<p class="description"><?php esc_html_e( 'Advanced Ads ignores paragraphs and other elements in containers when injecting ads into the post content. Check this option to ignore this limitation and ads might show up again.', 'advanced-ads' ); ?></p>
|
admin/views/settings/general/content-injection-priority.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<input id="advanced-ads-content-injection-priority" type="number" value="<?php echo esc_attr( $priority ); ?>" name="<?php echo esc_attr( ADVADS_SLUG ); ?>[content-injection-priority]" size="3"/>
|
2 |
+
<p class="description">
|
3 |
+
<?php
|
4 |
+
if ( $priority < 11 ) :
|
5 |
+
?>
|
6 |
+
<span class="advads-error-message"><?php esc_html_e( 'Please check your post content. A priority of 10 and below might cause issues (wpautop function might run twice).', 'advanced-ads' ); ?></span><br />
|
7 |
+
<?php
|
8 |
+
endif;
|
9 |
+
esc_html_e( 'Play with this value in order to change the priority of the injected ads compared to other auto injected elements in the post content.', 'advanced-ads' );
|
10 |
+
?>
|
11 |
+
</p>
|
admin/views/settings/general/custom-label.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<fieldset>
|
2 |
+
<input type="checkbox" <?php checked( $enabled, true ); ?> value="1"
|
3 |
+
name="<?php echo esc_attr( ADVADS_SLUG ); ?>[custom-label][enabled]"/>
|
4 |
+
<input id="advads-custom-label" type="text" value="<?php echo esc_html( $label ); ?>"
|
5 |
+
name="<?php echo esc_attr( ADVADS_SLUG ); ?>[custom-label][text]"/>
|
6 |
+
</fieldset>
|
7 |
+
<p class="description"><?php esc_html_e( 'Displayed above ads.', 'advanced-ads' ); ?> <a target="_blank" href="<?php echo esc_url( ADVADS_URL . 'manual/advertisement-label/#utm_source=advanced-ads&utm_medium=link&utm_campaign=settings-advertisement-label' ); ?>">
|
8 |
+
<?php
|
9 |
+
esc_html_e( 'Manual', 'advanced-ads' );
|
10 |
+
?>
|
11 |
+
</a>
|
12 |
+
</p>
|
admin/views/settings/general/disable-ads.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<label><input id="advanced-ads-disable-ads-all" type="checkbox" value="1" name="<?php echo esc_attr( ADVADS_SLUG ); ?>[disabled-ads][all]"
|
2 |
+
<?php
|
3 |
+
checked( $disable_all, 1 );
|
4 |
+
?>
|
5 |
+
><?php esc_html_e( 'Disable all ads in frontend', 'advanced-ads' ); ?></label>
|
6 |
+
<p class="description"><?php esc_html_e( 'Use this option to disable all ads in the frontend, but still be able to use the plugin.', 'advanced-ads' ); ?></p>
|
7 |
+
|
8 |
+
<label><input id="advanced-ads-disable-ads-404" type="checkbox" value="1" name="<?php echo esc_attr( ADVADS_SLUG ); ?>[disabled-ads][404]"
|
9 |
+
<?php
|
10 |
+
checked( $disable_404, 1 );
|
11 |
+
?>
|
12 |
+
><?php esc_html_e( 'Disable ads on 404 error pages', 'advanced-ads' ); ?></label>
|
13 |
+
|
14 |
+
<br/><label><input id="advanced-ads-disable-ads-archives" type="checkbox" value="1" name="<?php echo esc_attr( ADVADS_SLUG ); ?>[disabled-ads][archives]"
|
15 |
+
<?php
|
16 |
+
checked( $disable_archives, 1 );
|
17 |
+
?>
|
18 |
+
><?php esc_html_e( 'Disable ads on non-singular pages', 'advanced-ads' ); ?></label>
|
19 |
+
<p class="description"><?php esc_html_e( 'e.g. archive pages like categories, tags, authors, front page (if a list)', 'advanced-ads' ); ?></p>
|
20 |
+
<label><input id="advanced-ads-disable-ads-secondary" type="checkbox" value="1" name="<?php echo esc_attr( ADVADS_SLUG ); ?>[disabled-ads][secondary]"
|
21 |
+
<?php
|
22 |
+
checked( $disable_secondary, 1 );
|
23 |
+
?>
|
24 |
+
><?php esc_html_e( 'Disable ads on secondary queries', 'advanced-ads' ); ?></label>
|
25 |
+
<p class="description"><?php esc_html_e( 'Secondary queries are custom queries of posts outside the main query of a page. Try this option if you see ads injected on places where they shouldn’t appear.', 'advanced-ads' ); ?></p>
|
26 |
+
|
27 |
+
<label><input id="advanced-ads-disable-ads-feed" type="checkbox" value="1" name="<?php echo esc_attr( ADVADS_SLUG ); ?>[disabled-ads][feed]"
|
28 |
+
<?php
|
29 |
+
checked( $disable_feed, 1 );
|
30 |
+
?>
|
31 |
+
><?php esc_html_e( 'Disable ads in RSS Feed', 'advanced-ads' ); ?></label>
|
32 |
+
|
33 |
+
<br/><label><input id="advanced-ads-disable-ads-rest-api" type="checkbox" value="1" name="<?php echo esc_attr( ADVADS_SLUG ); ?>[disabled-ads][rest-api]"
|
34 |
+
<?php
|
35 |
+
checked( $disable_rest_api, 1 );
|
36 |
+
?>
|
37 |
+
><?php esc_html_e( 'Disable ads in REST API', 'advanced-ads' ); ?></label>
|
admin/views/settings/general/disable-notices.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<input id="advanced-ads-disabled-notices" type="checkbox" value="1" name="<?php echo esc_attr( ADVADS_SLUG ); ?>[disable-notices]" <?php checked( $checked, 1 ); ?>>
|
2 |
+
<p class="description">
|
3 |
+
<?php
|
4 |
+
printf(
|
5 |
+
// translators: %1$s is a starting <a> tag and %2$s a closing one.
|
6 |
+
esc_html__( 'Disable %1$sAd Health%2$s in frontend and backend, warnings and internal notices like tips, tutorials, email newsletters and update notices.', 'advanced-ads' ),
|
7 |
+
'<a href="' . esc_url( ADVADS_URL ) . 'manual/ad-health/#utm_source=advanced-ads&utm_medium=link&utm_campaign=settings-ad-health" target="_blank">',
|
8 |
+
'</a>'
|
9 |
+
);
|
10 |
+
?>
|
11 |
+
</p>
|
admin/views/settings/general/disable-post-types.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<p><a href="<?php echo esc_url( ADVADS_URL . 'add-ons/advanced-ads-pro/#utm_source=advanced-ads&utm_medium=link&utm_campaign=pitch-pro-disable-post-type' ); ?>" target="_blank"><?php esc_html_e( 'Pro feature', 'advanced-ads' ); ?></a></p>
|
2 |
+
<?php
|
3 |
+
foreach ( $post_types as $_type_id => $_type ) :
|
4 |
+
if ( $type_label_counts[ $_type->label ] < 2 ) {
|
5 |
+
$_label = $_type->label;
|
6 |
+
} else {
|
7 |
+
$_label = sprintf( '%s (%s)', $_type->label, $_type_id );
|
8 |
+
}
|
9 |
+
?>
|
10 |
+
<label style="margin-right: 1em;"><input type="checkbox" disabled="disabled"><?php echo esc_html( $_label ); ?></label>
|
11 |
+
<?php
|
12 |
+
endforeach;
|
admin/views/settings/general/disable-shortcode-button.php
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
<input id="advanced-ads-disable-shortcode-button" type="checkbox" <?php checked( $checked, true ); ?> name="<?php echo esc_attr( ADVADS_SLUG ); ?>[disable-shortcode-button]" />
|
2 |
+
<p class="description"><?php esc_html_e( 'Disable shortcode button in visual editor.', 'advanced-ads' ); ?></p>
|
admin/views/settings/general/editors-manage-ads.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<input id="advanced-ads-editors-manage-ads" type="checkbox" <?php checked( $allow, true ); ?> name="<?php echo esc_attr( ADVADS_SLUG ); ?>[editors-manage-ads]" />
|
2 |
+
<p class="description"><?php esc_html_e( 'Allow editors to also manage and publish ads.', 'advanced-ads' ); ?>
|
3 |
+
<?php
|
4 |
+
printf(
|
5 |
+
wp_kses(
|
6 |
+
// translators: %s is a URL.
|
7 |
+
__( 'You can assign different ad-related roles on a user basis with <a href="%s" target="_blank">Advanced Ads Pro</a>.', 'advanced-ads' ),
|
8 |
+
array(
|
9 |
+
'a' => array(
|
10 |
+
'href' => array(),
|
11 |
+
'target' => array(),
|
12 |
+
),
|
13 |
+
)
|
14 |
+
),
|
15 |
+
esc_url( ADVADS_URL . 'add-ons/advanced-ads-pro/#utm_source=advanced-ads&utm_medium=link&utm_campaign=settings' )
|
16 |
+
);
|
17 |
+
?>
|
18 |
+
</p>
|
admin/views/settings/general/frontend-prefix.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<input id="advanced-ads-front-prefix" type="text" value="<?php echo esc_attr( $prefix ); ?>" name="<?php echo esc_attr( ADVADS_SLUG ); ?>[front-prefix]" />
|
2 |
+
<?php // deprecated. ?>
|
3 |
+
<input type="hidden" value="<?php echo esc_attr( $old_prefix ); ?>" name="<?php echo esc_attr( ADVADS_SLUG ); ?>[id-prefix]" />
|
4 |
+
<p class="description"><?php esc_html_e( 'Prefix of class and id attributes for elements created in the frontend.', 'advanced-ads' ); ?></p>
|
admin/views/settings/general/hide-for-user-role.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div id="advads-settings-hide-by-user-role"><?php
|
2 |
+
foreach ( $roles as $_role => $_display_name ) :
|
3 |
+
$checked = in_array( $_role, $hide_for_roles, true );
|
4 |
+
?><label>
|
5 |
+
<input type="checkbox" value="<?php echo esc_attr( $_role ); ?>" name="<?php echo esc_attr( ADVADS_SLUG ); ?>[hide-for-user-role][]"
|
6 |
+
<?php
|
7 |
+
checked( $checked, true );
|
8 |
+
?>
|
9 |
+
><?php echo esc_html( $_display_name ); ?></label>
|
10 |
+
<?php
|
11 |
+
endforeach;
|
12 |
+
?>
|
13 |
+
</div>
|
14 |
+
<p class="description"><?php esc_html_e( 'Choose the roles a user must have in order to not see any ads.', 'advanced-ads' ); ?></p>
|
admin/views/settings/general/link-target.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<input name="<?php echo esc_attr( ADVADS_SLUG ); ?>[target-blank]" type="checkbox" value="1"
|
2 |
+
<?php
|
3 |
+
checked( 1, $target );
|
4 |
+
?>
|
5 |
+
/>
|
6 |
+
<p class="description"><?php echo wp_kses( __( 'Open programatically created links in a new window (use <code>target="_blank"</code>)', 'advanced-ads' ), array( 'code' => array() ) ); ?></p>
|
admin/views/settings/general/uninstall-delete-data.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<input type="checkbox" value="1"
|
2 |
+
name="<?php echo esc_attr( ADVADS_SLUG ); ?>[uninstall-delete-data]" <?php checked( $enabled, 1 ); ?>>
|
3 |
+
<p class="description"><?php esc_html_e( 'Clean up all data related to Advanced Ads when removing the plugin.', 'advanced-ads' ); ?></p>
|
4 |
+
<?php
|
admin/views/settings/license/section.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<p><?php printf(
|
2 |
+
wp_kses(
|
3 |
+
// translators: %s is a URL.
|
4 |
+
__( 'Enter license keys for our powerful <a href="%s" target="_blank">add-ons</a>.', 'advanced-ads' ),
|
5 |
+
array(
|
6 |
+
'a' => array(
|
7 |
+
'href' => array(),
|
8 |
+
'target' => array(),
|
9 |
+
),
|
10 |
+
)
|
11 |
+
),
|
12 |
+
esc_url( ADVADS_URL . 'add-ons/#utm_source=advanced-ads&utm_medium=link&utm_campaign=settings-licenses' )
|
13 |
+
);
|
14 |
+
?> <?php
|
15 |
+
printf(
|
16 |
+
wp_kses(
|
17 |
+
// translators: %s is a URL.
|
18 |
+
__( 'See also <a href="%s" target="_blank">Issues and questions about licenses</a>.', 'advanced-ads' ),
|
19 |
+
array(
|
20 |
+
'a' => array(
|
21 |
+
'href' => array(),
|
22 |
+
'target' => array(),
|
23 |
+
),
|
24 |
+
)
|
25 |
+
),
|
26 |
+
esc_url( ADVADS_URL . 'manual-category/purchase-licenses/#utm_source=advanced-ads&utm_medium=link&utm_campaign=settings-licenses' )
|
27 |
+
);
|
28 |
+
?>
|
29 |
+
</p>
|
30 |
+
<input type="hidden" id="advads-licenses-ajax-referrer" value="<?php echo esc_attr( wp_create_nonce( 'advads_ajax_license_nonce' ) ); ?>"/>
|
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.17.
|
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.17.
|
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.17.4
|
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.17.4' );
|
43 |
|
44 |
// Autoloading, modules and functions.
|
45 |
|
classes/ad.php
CHANGED
@@ -585,9 +585,9 @@ class Advanced_Ads_Ad {
|
|
585 |
$options['description'] = $this->description;
|
586 |
|
587 |
// sanitize container ID option.
|
588 |
-
$options['output']['wrapper-id'] = sanitize_key( $options['output']['wrapper-id'] );
|
589 |
|
590 |
-
// filter to manipulate options or add more to be saved
|
591 |
$options = apply_filters( 'advanced-ads-save-options', $options, $this );
|
592 |
|
593 |
update_post_meta( $this->id, self::$options_meta_field, $options );
|
585 |
$options['description'] = $this->description;
|
586 |
|
587 |
// sanitize container ID option.
|
588 |
+
$options['output']['wrapper-id'] = isset( $options['output']['wrapper-id'] ) ? sanitize_key( $options['output']['wrapper-id'] ) : '';
|
589 |
|
590 |
+
// filter to manipulate options or add more to be saved.
|
591 |
$options = apply_filters( 'advanced-ads-save-options', $options, $this );
|
592 |
|
593 |
update_post_meta( $this->id, self::$options_meta_field, $options );
|
classes/display-conditions.php
CHANGED
@@ -61,6 +61,7 @@ class Advanced_Ads_Display_Conditions {
|
|
61 |
'is_attachment',
|
62 |
'is_main_query',
|
63 |
'is_feed',
|
|
|
64 |
);
|
65 |
|
66 |
/**
|
@@ -763,6 +764,11 @@ class Advanced_Ads_Display_Conditions {
|
|
763 |
'description' => __( 'allow ads in RSS Feed', 'advanced-ads' ),
|
764 |
'type' => 'radio',
|
765 |
),
|
|
|
|
|
|
|
|
|
|
|
766 |
)
|
767 |
);
|
768 |
}
|
@@ -1073,6 +1079,10 @@ class Advanced_Ads_Display_Conditions {
|
|
1073 |
return false;
|
1074 |
}
|
1075 |
|
|
|
|
|
|
|
|
|
1076 |
// check home page.
|
1077 |
if ( ( ( isset( $query['is_front_page'] ) && $query['is_front_page'] )
|
1078 |
|| ( isset( $query['is_home'] ) && $query['is_home'] ) )
|
@@ -1315,6 +1325,11 @@ class Advanced_Ads_Display_Conditions {
|
|
1315 |
$args['wp_the_query']['is_main_query'] = Advanced_Ads::get_instance()->is_main_query();
|
1316 |
}
|
1317 |
|
|
|
|
|
|
|
|
|
|
|
1318 |
// `<!-- nextpage -->` tags.
|
1319 |
if ( ! isset( $args['wp_the_query']['page'] ) ) {
|
1320 |
$args['wp_the_query']['page'] = isset( $wp_the_query->query_vars['page'] ) && $wp_the_query->query_vars['page'] ? $wp_the_query->query_vars['page'] : 1;
|
61 |
'is_attachment',
|
62 |
'is_main_query',
|
63 |
'is_feed',
|
64 |
+
'is_rest_api',
|
65 |
);
|
66 |
|
67 |
/**
|
764 |
'description' => __( 'allow ads in RSS Feed', 'advanced-ads' ),
|
765 |
'type' => 'radio',
|
766 |
),
|
767 |
+
'is_rest_api' => array(
|
768 |
+
'label' => __( 'REST API', 'advanced-ads' ),
|
769 |
+
'description' => __( 'allow ads in REST API', 'advanced-ads' ),
|
770 |
+
'type' => 'radio',
|
771 |
+
),
|
772 |
)
|
773 |
);
|
774 |
}
|
1079 |
return false;
|
1080 |
}
|
1081 |
|
1082 |
+
if ( isset( $query['is_rest_api'] ) && $query['is_rest_api'] && ! in_array( 'is_rest_api', $options['value'], true ) ) {
|
1083 |
+
return false;
|
1084 |
+
}
|
1085 |
+
|
1086 |
// check home page.
|
1087 |
if ( ( ( isset( $query['is_front_page'] ) && $query['is_front_page'] )
|
1088 |
|| ( isset( $query['is_home'] ) && $query['is_home'] ) )
|
1325 |
$args['wp_the_query']['is_main_query'] = Advanced_Ads::get_instance()->is_main_query();
|
1326 |
}
|
1327 |
|
1328 |
+
// REST API.
|
1329 |
+
if ( ! isset( $args['wp_the_query']['is_rest_api'] ) ) {
|
1330 |
+
$args['wp_the_query']['is_rest_api'] = defined( 'REST_REQUEST' ) && REST_REQUEST;
|
1331 |
+
}
|
1332 |
+
|
1333 |
// `<!-- nextpage -->` tags.
|
1334 |
if ( ! isset( $args['wp_the_query']['page'] ) ) {
|
1335 |
$args['wp_the_query']['page'] = isset( $wp_the_query->query_vars['page'] ) && $wp_the_query->query_vars['page'] ? $wp_the_query->query_vars['page'] : 1;
|
classes/frontend_checks.php
CHANGED
@@ -1,5 +1,10 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
|
|
|
|
3 |
class Advanced_Ads_Frontend_Checks {
|
4 |
/**
|
5 |
* True if 'the_content' was invoked, false otherwise.
|
@@ -37,14 +42,14 @@ class Advanced_Ads_Frontend_Checks {
|
|
37 |
/**
|
38 |
* Notify ads loaded with AJAX.
|
39 |
*
|
40 |
-
* @param array $args
|
41 |
* @return array $args
|
42 |
*/
|
43 |
public function ad_select_args_callback( $args ) {
|
44 |
$args['frontend-check'] = true;
|
45 |
return $args;
|
46 |
}
|
47 |
-
|
48 |
/**
|
49 |
* Enqueue scripts
|
50 |
* needs to add ajaxurl in case no other plugin is doing that
|
@@ -62,19 +67,19 @@ class Advanced_Ads_Frontend_Checks {
|
|
62 |
/**
|
63 |
* List current ad situation on the page in the admin-bar.
|
64 |
*
|
65 |
-
* @param
|
66 |
*/
|
67 |
public function add_admin_bar_menu( $wp_admin_bar ) {
|
68 |
global $wp_the_query, $post, $wp_scripts;
|
69 |
|
70 |
$options = Advanced_Ads_Plugin::get_instance()->options();
|
71 |
-
|
72 |
-
// load AdSense related options
|
73 |
$adsense_options = Advanced_Ads_AdSense_Data::get_instance()->get_options();
|
74 |
|
75 |
// check if jQuery is loaded in the header
|
76 |
// Hidden, will be shown using js.
|
77 |
-
// message removed after we fixed all issues we know of
|
78 |
/*$wp_admin_bar->add_node( array(
|
79 |
'parent' => 'advanced_ads_ad_health',
|
80 |
'id' => 'advanced_ads_ad_health_jquery',
|
@@ -85,7 +90,7 @@ class Advanced_Ads_Frontend_Checks {
|
|
85 |
'target' => '_blank'
|
86 |
)
|
87 |
) );*/
|
88 |
-
|
89 |
// check if AdSense loads Auto Ads ads
|
90 |
// Hidden, will be shown using js.
|
91 |
if( ! isset( $adsense_options['violation-warnings-disable'] ) ) {
|
@@ -100,8 +105,8 @@ class Advanced_Ads_Frontend_Checks {
|
|
100 |
)
|
101 |
) );
|
102 |
}
|
103 |
-
|
104 |
-
// check if current user was identified as a bot
|
105 |
if( Advanced_Ads::get_instance()->is_bot() ) {
|
106 |
$nodes[] = array( 'type' => 1, 'data' => array(
|
107 |
'parent' => 'advanced_ads_ad_health',
|
@@ -141,25 +146,6 @@ class Advanced_Ads_Frontend_Checks {
|
|
141 |
) );
|
142 |
}
|
143 |
|
144 |
-
/*
|
145 |
-
if ( $this->has_many_the_content && $this->has_the_content_placements() ) {
|
146 |
-
$nodes[] = array( 'type' => 1, 'data' => array(
|
147 |
-
'parent' => 'advanced_ads_ad_health',
|
148 |
-
'id' => 'advanced_ads_ad_health_nested_the_content',
|
149 |
-
'title' => sprintf(
|
150 |
-
// translators: %s is a filter hook, here `the_content`
|
151 |
-
__( '<strong>%s</strong> filter found multiple times.', 'advanced-ads' ),
|
152 |
-
'the_content' ),
|
153 |
-
'href' => ADVADS_URL . 'manual/ad-health/#the_content_filter_found_multiple_times',
|
154 |
-
'meta' => array(
|
155 |
-
'class' => 'advanced_ads_ad_health_warning',
|
156 |
-
'target' => '_blank'
|
157 |
-
)
|
158 |
-
) );
|
159 |
-
Advanced_Ads_Ad_Health_Notices::get_instance()->add( 'nested_the_content_filters' );
|
160 |
-
}
|
161 |
-
*/
|
162 |
-
|
163 |
if ( ! empty( $post->ID ) ) {
|
164 |
$ad_settings = get_post_meta( $post->ID, '_advads_ad_settings', true );
|
165 |
|
@@ -265,7 +251,7 @@ class Advanced_Ads_Frontend_Checks {
|
|
265 |
'target' => '_blank'
|
266 |
)
|
267 |
) );
|
268 |
-
|
269 |
// warn if an AdSense ad seems to be hidden
|
270 |
if( ! isset( $adsense_options['violation-warnings-disable'] ) ) {
|
271 |
$nodes[] = array( 'type' => 2, 'data' => array(
|
@@ -294,7 +280,7 @@ class Advanced_Ads_Frontend_Checks {
|
|
294 |
'target' => '_blank'
|
295 |
)
|
296 |
) );
|
297 |
-
|
298 |
// warn if consent was not given
|
299 |
$privacy_state = Advanced_Ads_Privacy::get_instance()->get_state();
|
300 |
if( 'not_needed' !== $privacy_state ) {
|
@@ -309,7 +295,7 @@ class Advanced_Ads_Frontend_Checks {
|
|
309 |
)
|
310 |
) );
|
311 |
}
|
312 |
-
|
313 |
$nodes[] = array( 'type' => 3, 'data' => array(
|
314 |
'parent' => 'advanced_ads_ad_health',
|
315 |
'id' => 'advanced_ads_ad_health_gam_debug',
|
@@ -332,7 +318,7 @@ class Advanced_Ads_Frontend_Checks {
|
|
332 |
),
|
333 |
) );
|
334 |
|
335 |
-
// link to highlight ads and jump from one ad to the next
|
336 |
$nodes[] = array( 'type' => 3, 'amp' => false, 'data' => array(
|
337 |
'parent' => 'advanced_ads_ad_health',
|
338 |
'id' => 'advanced_ads_ad_health_highlight_ads',
|
@@ -345,16 +331,16 @@ class Advanced_Ads_Frontend_Checks {
|
|
345 |
/**
|
346 |
* Add new node.
|
347 |
*
|
348 |
-
* @param array $node An array that contains:
|
349 |
* 'type' => 1 - warning, 2 - hidden warning that will be shown using JS, 3 - info message
|
350 |
-
* 'data': @see WP_Admin_Bar->add_node
|
351 |
-
* @param
|
352 |
*/
|
353 |
$nodes = apply_filters( 'advanced-ads-ad-health-nodes', $nodes );
|
354 |
|
355 |
usort( $nodes, array( $this, 'sort_nodes' ) );
|
356 |
|
357 |
-
// load number of already detected notices
|
358 |
$notices = Advanced_Ads_Ad_Health_Notices::get_number_of_notices();
|
359 |
|
360 |
if ( ! advads_is_amp() ) {
|
@@ -363,7 +349,7 @@ class Advanced_Ads_Frontend_Checks {
|
|
363 |
$warnings = $this->count_visible_warnings( $nodes, array( 1 ) );
|
364 |
}
|
365 |
|
366 |
-
$issues = $
|
367 |
|
368 |
$this->add_header_nodes( $wp_admin_bar, $issues, $notices );
|
369 |
|
@@ -396,9 +382,9 @@ class Advanced_Ads_Frontend_Checks {
|
|
396 |
/**
|
397 |
* Add header nodes.
|
398 |
*
|
399 |
-
* @param
|
400 |
-
* @param int
|
401 |
-
* @param int
|
402 |
*/
|
403 |
private function add_header_nodes( $wp_admin_bar, $issues, $notices ) {
|
404 |
$wp_admin_bar->add_node( array(
|
@@ -494,13 +480,13 @@ class Advanced_Ads_Frontend_Checks {
|
|
494 |
}
|
495 |
|
496 |
/**
|
497 |
-
* Check conditions and display warning.
|
498 |
-
*
|
499 |
* AdBlocker enabled,
|
500 |
* jQuery is included in header
|
501 |
* AdSense Quick Start ads are running
|
502 |
*/
|
503 |
-
public function footer_checks() {
|
504 |
ob_start();
|
505 |
?><!-- Advanced Ads: <?php _e( 'the following code is used for automatic error detection and only visible to admins', 'advanced-ads' ); ?>-->
|
506 |
<style>.hidden { display: none; }
|
@@ -510,18 +496,18 @@ class Advanced_Ads_Frontend_Checks {
|
|
510 |
#wpadminbar .advanced-ads-issue-counter { background-color: #d54e21; display: none; padding: 1px 7px 1px 6px!important; border-radius: 50%; color: #fff; }
|
511 |
#wpadminbar .advads-adminbar-is-warnings .advanced-ads-issue-counter { display: inline; }
|
512 |
.advanced-ads-highlight-ads { outline:4px solid blue !important; }
|
513 |
-
|
514 |
-
.advads-frontend-notice { display: none; position: fixed; top: 0; z-index: 1000; left: 50%; max-width: 500px; margin-left: -250px; padding: 30px 10px 10px 10px; border: 0px solid #0074a2; border-top: 0; border-radius: 0px 0px 5px 5px; box-shadow: 0px 0px 15px rgba(0,0,0,0.3); background: #ffffff; background: rgba(255,255,255,0.95); font-size: 16px; font-family: Arial, Verdana, sans-serif; line-height: 1.5em; color: #444444; }
|
515 |
-
|
516 |
.advads-frontend-notice a, .advads-frontend-notice a:link { color: #0074a2; text-decoration: none; }
|
517 |
.advads-frontend-notice ul { }
|
518 |
.advads-frontend-notice ul li { line-height: 1.5em; }
|
519 |
-
|
520 |
.advads-frontend-notice .advads-close-notice { position: absolute; top: 5px; right: 0; display: block; font-size: 20px; width: 30px; height: 30px; line-height: 30px; text-decoration: none; text-align: center; font-weight: bold; color: #444444; cursor: pointer; }
|
521 |
.advads-frontend-notice .advads-notice-var1 { font-size: 14px; font-style: italic; text-align: center; text-align: 1.3em; }
|
522 |
.advads-frontend-notice .advads-frontend-notice-choice { text-align: center; }
|
523 |
.advads-frontend-notice .advads-frontend-notice-choice:after { display: block; content: " "; clear: both; }
|
524 |
-
|
525 |
/* CSS Smilies */
|
526 |
.advads-smiley { position: relative; display: inline-block; border: 4px solid #0074a2; border-radius: 50px; width: 65px; height: 65px; background: #ffffff; cursor: pointer; margin: 0px 15px 5px 0px; }
|
527 |
.advads-smiley:hover { transform: scale(0.90); transition: all linear 0.3s; }
|
@@ -533,11 +519,11 @@ class Advanced_Ads_Frontend_Checks {
|
|
533 |
/* CSS smiley: negative */
|
534 |
.advads-smiley-negative { /* border-color: #9a2d18; */ }
|
535 |
.advads-smiley-negative .mouth { top: 50%; border: 5px solid #0074a2; width: 60%px; height: 60%; transform: rotate(-45deg); border-bottom-color: transparent; border-left-color: transparent; border-radius: 50%; }
|
536 |
-
|
537 |
/* CSS smiley: positive */
|
538 |
.advads-smiley-positive { /* border-color: #1e610f; */ }
|
539 |
.advads-smiley-positive .mouth { top: 25%; border: 5px solid #0074a2; width: 60%px; height: 60%; transform: rotate(-45deg); border-top-color: transparent; border-right-color: transparent; border-radius: 50%; }
|
540 |
-
|
541 |
/* CSS smiley: neutral */
|
542 |
.advads-smiley-laugh .mouth { top: 25%; border-radius: 50%; }
|
543 |
|
@@ -553,7 +539,6 @@ class Advanced_Ads_Frontend_Checks {
|
|
553 |
}
|
554 |
|
555 |
$adsense_options = Advanced_Ads_AdSense_Data::get_instance()->get_options();
|
556 |
-
$notices = Advanced_Ads_Ad_Health_Notices::get_number_of_notices();
|
557 |
ob_start();
|
558 |
?><script type="text/javascript" src="<?php echo ADVADS_BASE_URL . 'admin/assets/js/advertisement.js' ?>"></script>
|
559 |
<script>
|
@@ -561,8 +546,7 @@ class Advanced_Ads_Frontend_Checks {
|
|
561 |
showCount: function() {
|
562 |
try {
|
563 |
// Count only warnings that have the 'advanced_ads_ad_health_warning' class.
|
564 |
-
|
565 |
-
var warning_count = document.querySelectorAll( '.advanced_ads_ad_health_warning:not(.hidden)' ).length + <?php echo $notices; ?>;
|
566 |
var fine_item = document.getElementById( 'wp-admin-bar-advanced_ads_ad_health_fine' );
|
567 |
} catch ( e ) { return; }
|
568 |
|
@@ -617,7 +601,7 @@ class Advanced_Ads_Frontend_Checks {
|
|
617 |
|
618 |
/**
|
619 |
* Add item to Ad Health notices in the backend
|
620 |
-
*
|
621 |
* @param key of the notice
|
622 |
* @param attr
|
623 |
* @returns {undefined}
|
@@ -751,7 +735,7 @@ class Advanced_Ads_Frontend_Checks {
|
|
751 |
|
752 |
advanced_ads_frontend_checks.showCount();
|
753 |
});
|
754 |
-
|
755 |
<?php if( ! isset( $adsense_options['violation-warnings-disable'] ) ) : ?>
|
756 |
// show warning if AdSense ad is hidden
|
757 |
// show hint if AdSense Auto ads are enabled
|
@@ -772,25 +756,15 @@ class Advanced_Ads_Frontend_Checks {
|
|
772 |
var autoads_ads = document.querySelectorAll('.google-auto-placed');
|
773 |
var autoads_code_enabled = document.querySelectorAll('#wp-admin-bar-advanced_ads_ad_health_auto_ads_found:not(.hidden)').length;
|
774 |
<?php /* jQuery( '<p class="advads-autoads-hint" style="background-color:#0085ba;color:#fff;font-size:0.8em;padding:5px;"><?php
|
775 |
-
printf(__( 'This ad was automatically placed here by AdSense. <a href="%s" target="_blank" style="color:#fff;border-color:#fff;">Click here to learn more</a>.', 'advanced-ads' ), ADVADS_URL . 'adsense-in-random-positions-auto-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=frontend-autoads-ads' );
|
776 |
?></p>' ).prependTo( autoads_ads ); */ ?>
|
777 |
// show Auto Ads warning in Ad Health bar if relevant
|
778 |
-
<?php $frontend_notices = Advanced_Ads_Plugin::show_to_new_users( 1580126400, 'a' ) ? get_option( 'advanced-ads-frontend-notices' ) : array( 'notices' => array( 'auto-ads-with-ads' => true, 'auto-ads-without-ads' => true ) ); ?>
|
779 |
if( autoads_ads.length ){
|
780 |
var advads_autoads_link = document.querySelector( '#wp-admin-bar-advanced_ads_autoads_displayed.hidden' );
|
781 |
if ( advads_autoads_link ) {
|
782 |
advads_autoads_link.className = advads_autoads_link.className.replace( 'hidden', '' );
|
783 |
}
|
784 |
advanced_ads_frontend_checks.showCount();
|
785 |
-
<?php if( ! isset( $frontend_notices['notices']['auto-ads-with-ads'] ) ) : ?>
|
786 |
-
// show notice about Auto ads existing on the site
|
787 |
-
advads_frontend_notice( 'auto-ads-with-ads' );
|
788 |
-
<?php endif; ?>
|
789 |
-
} else if ( autoads_code_enabled ) {
|
790 |
-
<?php if( ! isset( $frontend_notices['notices']['auto-ads-without-ads'] ) ) : ?>
|
791 |
-
// show notice about Auto ads code without any ads placed
|
792 |
-
advads_frontend_notice( 'auto-ads-without-ads' );
|
793 |
-
<?php endif; ?>
|
794 |
}
|
795 |
}
|
796 |
|
@@ -819,7 +793,7 @@ class Advanced_Ads_Frontend_Checks {
|
|
819 |
'</div>' +
|
820 |
'<p class="advads-notice-var1"><?php esc_attr_e( 'PS: This is a one-time check from your friendly Advanced Ads plugin. It is only visible to you.', 'advanced-ads' ); ?></p>';
|
821 |
// dynamically add the number of Auto ads found.
|
822 |
-
content = content.replace( 'AUTO_ADS_NUM', autoads_ads.length );
|
823 |
break;
|
824 |
case 'auto-ads-without-ads' :
|
825 |
<?php $current_user = get_current_user(); $current_user_nicename = isset( $current_user->user_nicename ) ? $current_user->user_nicename : 'admin'; ?>
|
@@ -982,8 +956,8 @@ class Advanced_Ads_Frontend_Checks {
|
|
982 |
/**
|
983 |
* Check if the 'Header Code' placement can be used to delived the ad.
|
984 |
*
|
985 |
-
* @param string
|
986 |
-
* @param
|
987 |
* @return bool
|
988 |
*/
|
989 |
public static function can_use_head_placement( $content, Advanced_Ads_Ad $ad ) {
|
@@ -991,10 +965,10 @@ class Advanced_Ads_Frontend_Checks {
|
|
991 |
if ( ! $ad->is_head_placement ) {
|
992 |
return true;
|
993 |
}
|
994 |
-
|
995 |
-
// strip linebreaks, because, a line break after a comment is identified as a text node
|
996 |
$content = preg_replace( "/\r|\n/", "", $content );
|
997 |
-
|
998 |
if ( ! $dom = self::get_ad_dom( $content ) ) {
|
999 |
return true;
|
1000 |
}
|
@@ -1004,7 +978,7 @@ class Advanced_Ads_Frontend_Checks {
|
|
1004 |
$count = $body->childNodes->length;
|
1005 |
for ( $i = 0; $i < $count; $i++ ) {
|
1006 |
$node = $body->childNodes->item( $i );
|
1007 |
-
|
1008 |
if ( XML_TEXT_NODE === $node->nodeType ) {
|
1009 |
return false;
|
1010 |
}
|
1 |
<?php
|
2 |
|
3 |
+
/**
|
4 |
+
* Class Advanced_Ads_Frontend_Checks
|
5 |
+
*
|
6 |
+
* Handle Ad Health and other notifications and checks in the frontend.
|
7 |
+
*/
|
8 |
class Advanced_Ads_Frontend_Checks {
|
9 |
/**
|
10 |
* True if 'the_content' was invoked, false otherwise.
|
42 |
/**
|
43 |
* Notify ads loaded with AJAX.
|
44 |
*
|
45 |
+
* @param array $args ad arguments.
|
46 |
* @return array $args
|
47 |
*/
|
48 |
public function ad_select_args_callback( $args ) {
|
49 |
$args['frontend-check'] = true;
|
50 |
return $args;
|
51 |
}
|
52 |
+
|
53 |
/**
|
54 |
* Enqueue scripts
|
55 |
* needs to add ajaxurl in case no other plugin is doing that
|
67 |
/**
|
68 |
* List current ad situation on the page in the admin-bar.
|
69 |
*
|
70 |
+
* @param object $wp_admin_bar WP_Admin_Bar.
|
71 |
*/
|
72 |
public function add_admin_bar_menu( $wp_admin_bar ) {
|
73 |
global $wp_the_query, $post, $wp_scripts;
|
74 |
|
75 |
$options = Advanced_Ads_Plugin::get_instance()->options();
|
76 |
+
|
77 |
+
// load AdSense related options.
|
78 |
$adsense_options = Advanced_Ads_AdSense_Data::get_instance()->get_options();
|
79 |
|
80 |
// check if jQuery is loaded in the header
|
81 |
// Hidden, will be shown using js.
|
82 |
+
// message removed after we fixed all issues we know of.
|
83 |
/*$wp_admin_bar->add_node( array(
|
84 |
'parent' => 'advanced_ads_ad_health',
|
85 |
'id' => 'advanced_ads_ad_health_jquery',
|
90 |
'target' => '_blank'
|
91 |
)
|
92 |
) );*/
|
93 |
+
|
94 |
// check if AdSense loads Auto Ads ads
|
95 |
// Hidden, will be shown using js.
|
96 |
if( ! isset( $adsense_options['violation-warnings-disable'] ) ) {
|
105 |
)
|
106 |
) );
|
107 |
}
|
108 |
+
|
109 |
+
// check if current user was identified as a bot.
|
110 |
if( Advanced_Ads::get_instance()->is_bot() ) {
|
111 |
$nodes[] = array( 'type' => 1, 'data' => array(
|
112 |
'parent' => 'advanced_ads_ad_health',
|
146 |
) );
|
147 |
}
|
148 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
if ( ! empty( $post->ID ) ) {
|
150 |
$ad_settings = get_post_meta( $post->ID, '_advads_ad_settings', true );
|
151 |
|
251 |
'target' => '_blank'
|
252 |
)
|
253 |
) );
|
254 |
+
|
255 |
// warn if an AdSense ad seems to be hidden
|
256 |
if( ! isset( $adsense_options['violation-warnings-disable'] ) ) {
|
257 |
$nodes[] = array( 'type' => 2, 'data' => array(
|
280 |
'target' => '_blank'
|
281 |
)
|
282 |
) );
|
283 |
+
|
284 |
// warn if consent was not given
|
285 |
$privacy_state = Advanced_Ads_Privacy::get_instance()->get_state();
|
286 |
if( 'not_needed' !== $privacy_state ) {
|
295 |
)
|
296 |
) );
|
297 |
}
|
298 |
+
|
299 |
$nodes[] = array( 'type' => 3, 'data' => array(
|
300 |
'parent' => 'advanced_ads_ad_health',
|
301 |
'id' => 'advanced_ads_ad_health_gam_debug',
|
318 |
),
|
319 |
) );
|
320 |
|
321 |
+
// link to highlight ads and jump from one ad to the next.
|
322 |
$nodes[] = array( 'type' => 3, 'amp' => false, 'data' => array(
|
323 |
'parent' => 'advanced_ads_ad_health',
|
324 |
'id' => 'advanced_ads_ad_health_highlight_ads',
|
331 |
/**
|
332 |
* Add new node.
|
333 |
*
|
334 |
+
* @param array $node An array that contains:
|
335 |
* 'type' => 1 - warning, 2 - hidden warning that will be shown using JS, 3 - info message
|
336 |
+
* 'data': @see WP_Admin_Bar->add_node
|
337 |
+
* @param object $wp_admin_bar
|
338 |
*/
|
339 |
$nodes = apply_filters( 'advanced-ads-ad-health-nodes', $nodes );
|
340 |
|
341 |
usort( $nodes, array( $this, 'sort_nodes' ) );
|
342 |
|
343 |
+
// load number of already detected notices.
|
344 |
$notices = Advanced_Ads_Ad_Health_Notices::get_number_of_notices();
|
345 |
|
346 |
if ( ! advads_is_amp() ) {
|
349 |
$warnings = $this->count_visible_warnings( $nodes, array( 1 ) );
|
350 |
}
|
351 |
|
352 |
+
$issues = $warnings;
|
353 |
|
354 |
$this->add_header_nodes( $wp_admin_bar, $issues, $notices );
|
355 |
|
382 |
/**
|
383 |
* Add header nodes.
|
384 |
*
|
385 |
+
* @param object $wp_admin_bar WP_Admin_Bar object.
|
386 |
+
* @param int $issues Number of all issues.
|
387 |
+
* @param int $notices Number of notices.
|
388 |
*/
|
389 |
private function add_header_nodes( $wp_admin_bar, $issues, $notices ) {
|
390 |
$wp_admin_bar->add_node( array(
|
480 |
}
|
481 |
|
482 |
/**
|
483 |
+
* Check conditions and display warning.
|
484 |
+
* Conditions:
|
485 |
* AdBlocker enabled,
|
486 |
* jQuery is included in header
|
487 |
* AdSense Quick Start ads are running
|
488 |
*/
|
489 |
+
public function footer_checks() {
|
490 |
ob_start();
|
491 |
?><!-- Advanced Ads: <?php _e( 'the following code is used for automatic error detection and only visible to admins', 'advanced-ads' ); ?>-->
|
492 |
<style>.hidden { display: none; }
|
496 |
#wpadminbar .advanced-ads-issue-counter { background-color: #d54e21; display: none; padding: 1px 7px 1px 6px!important; border-radius: 50%; color: #fff; }
|
497 |
#wpadminbar .advads-adminbar-is-warnings .advanced-ads-issue-counter { display: inline; }
|
498 |
.advanced-ads-highlight-ads { outline:4px solid blue !important; }
|
499 |
+
|
500 |
+
.advads-frontend-notice { display: none; position: fixed; top: 0; z-index: 1000; left: 50%; max-width: 500px; margin-left: -250px; padding: 30px 10px 10px 10px; border: 0px solid #0074a2; border-top: 0; border-radius: 0px 0px 5px 5px; box-shadow: 0px 0px 15px rgba(0,0,0,0.3); background: #ffffff; background: rgba(255,255,255,0.95); font-size: 16px; font-family: Arial, Verdana, sans-serif; line-height: 1.5em; color: #444444; }
|
501 |
+
|
502 |
.advads-frontend-notice a, .advads-frontend-notice a:link { color: #0074a2; text-decoration: none; }
|
503 |
.advads-frontend-notice ul { }
|
504 |
.advads-frontend-notice ul li { line-height: 1.5em; }
|
505 |
+
|
506 |
.advads-frontend-notice .advads-close-notice { position: absolute; top: 5px; right: 0; display: block; font-size: 20px; width: 30px; height: 30px; line-height: 30px; text-decoration: none; text-align: center; font-weight: bold; color: #444444; cursor: pointer; }
|
507 |
.advads-frontend-notice .advads-notice-var1 { font-size: 14px; font-style: italic; text-align: center; text-align: 1.3em; }
|
508 |
.advads-frontend-notice .advads-frontend-notice-choice { text-align: center; }
|
509 |
.advads-frontend-notice .advads-frontend-notice-choice:after { display: block; content: " "; clear: both; }
|
510 |
+
|
511 |
/* CSS Smilies */
|
512 |
.advads-smiley { position: relative; display: inline-block; border: 4px solid #0074a2; border-radius: 50px; width: 65px; height: 65px; background: #ffffff; cursor: pointer; margin: 0px 15px 5px 0px; }
|
513 |
.advads-smiley:hover { transform: scale(0.90); transition: all linear 0.3s; }
|
519 |
/* CSS smiley: negative */
|
520 |
.advads-smiley-negative { /* border-color: #9a2d18; */ }
|
521 |
.advads-smiley-negative .mouth { top: 50%; border: 5px solid #0074a2; width: 60%px; height: 60%; transform: rotate(-45deg); border-bottom-color: transparent; border-left-color: transparent; border-radius: 50%; }
|
522 |
+
|
523 |
/* CSS smiley: positive */
|
524 |
.advads-smiley-positive { /* border-color: #1e610f; */ }
|
525 |
.advads-smiley-positive .mouth { top: 25%; border: 5px solid #0074a2; width: 60%px; height: 60%; transform: rotate(-45deg); border-top-color: transparent; border-right-color: transparent; border-radius: 50%; }
|
526 |
+
|
527 |
/* CSS smiley: neutral */
|
528 |
.advads-smiley-laugh .mouth { top: 25%; border-radius: 50%; }
|
529 |
|
539 |
}
|
540 |
|
541 |
$adsense_options = Advanced_Ads_AdSense_Data::get_instance()->get_options();
|
|
|
542 |
ob_start();
|
543 |
?><script type="text/javascript" src="<?php echo ADVADS_BASE_URL . 'admin/assets/js/advertisement.js' ?>"></script>
|
544 |
<script>
|
546 |
showCount: function() {
|
547 |
try {
|
548 |
// Count only warnings that have the 'advanced_ads_ad_health_warning' class.
|
549 |
+
var warning_count = document.querySelectorAll( '.advanced_ads_ad_health_warning:not(.hidden)' ).length;
|
|
|
550 |
var fine_item = document.getElementById( 'wp-admin-bar-advanced_ads_ad_health_fine' );
|
551 |
} catch ( e ) { return; }
|
552 |
|
601 |
|
602 |
/**
|
603 |
* Add item to Ad Health notices in the backend
|
604 |
+
*
|
605 |
* @param key of the notice
|
606 |
* @param attr
|
607 |
* @returns {undefined}
|
735 |
|
736 |
advanced_ads_frontend_checks.showCount();
|
737 |
});
|
738 |
+
|
739 |
<?php if( ! isset( $adsense_options['violation-warnings-disable'] ) ) : ?>
|
740 |
// show warning if AdSense ad is hidden
|
741 |
// show hint if AdSense Auto ads are enabled
|
756 |
var autoads_ads = document.querySelectorAll('.google-auto-placed');
|
757 |
var autoads_code_enabled = document.querySelectorAll('#wp-admin-bar-advanced_ads_ad_health_auto_ads_found:not(.hidden)').length;
|
758 |
<?php /* jQuery( '<p class="advads-autoads-hint" style="background-color:#0085ba;color:#fff;font-size:0.8em;padding:5px;"><?php
|
759 |
+
printf(__( 'This ad was automatically placed here by AdSense. <a href="%s" target="_blank" style="color:#fff;border-color:#fff;">Click here to learn more</a>.', 'advanced-ads' ), ADVADS_URL . 'adsense-in-random-positions-auto-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=frontend-autoads-ads' );
|
760 |
?></p>' ).prependTo( autoads_ads ); */ ?>
|
761 |
// show Auto Ads warning in Ad Health bar if relevant
|
|
|
762 |
if( autoads_ads.length ){
|
763 |
var advads_autoads_link = document.querySelector( '#wp-admin-bar-advanced_ads_autoads_displayed.hidden' );
|
764 |
if ( advads_autoads_link ) {
|
765 |
advads_autoads_link.className = advads_autoads_link.className.replace( 'hidden', '' );
|
766 |
}
|
767 |
advanced_ads_frontend_checks.showCount();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
768 |
}
|
769 |
}
|
770 |
|
793 |
'</div>' +
|
794 |
'<p class="advads-notice-var1"><?php esc_attr_e( 'PS: This is a one-time check from your friendly Advanced Ads plugin. It is only visible to you.', 'advanced-ads' ); ?></p>';
|
795 |
// dynamically add the number of Auto ads found.
|
796 |
+
content = content.replace( 'AUTO_ADS_NUM', autoads_ads.length );
|
797 |
break;
|
798 |
case 'auto-ads-without-ads' :
|
799 |
<?php $current_user = get_current_user(); $current_user_nicename = isset( $current_user->user_nicename ) ? $current_user->user_nicename : 'admin'; ?>
|
956 |
/**
|
957 |
* Check if the 'Header Code' placement can be used to delived the ad.
|
958 |
*
|
959 |
+
* @param string $content Ad content.
|
960 |
+
* @param Advanced_Ads_Ad $ad Advanced_Ads_Ad.
|
961 |
* @return bool
|
962 |
*/
|
963 |
public static function can_use_head_placement( $content, Advanced_Ads_Ad $ad ) {
|
965 |
if ( ! $ad->is_head_placement ) {
|
966 |
return true;
|
967 |
}
|
968 |
+
|
969 |
+
// strip linebreaks, because, a line break after a comment is identified as a text node.
|
970 |
$content = preg_replace( "/\r|\n/", "", $content );
|
971 |
+
|
972 |
if ( ! $dom = self::get_ad_dom( $content ) ) {
|
973 |
return true;
|
974 |
}
|
978 |
$count = $body->childNodes->length;
|
979 |
for ( $i = 0; $i < $count; $i++ ) {
|
980 |
$node = $body->childNodes->item( $i );
|
981 |
+
|
982 |
if ( XML_TEXT_NODE === $node->nodeType ) {
|
983 |
return false;
|
984 |
}
|
classes/plugin.php
CHANGED
@@ -1,45 +1,43 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
*
|
5 |
*
|
6 |
* - posttypes
|
7 |
* - taxonomy
|
8 |
* - textdomain
|
9 |
-
*
|
10 |
-
* @since 1.5.0
|
11 |
*/
|
12 |
class Advanced_Ads_Plugin {
|
13 |
/**
|
|
|
14 |
*
|
15 |
-
* @var Advanced_Ads_Plugin
|
16 |
*/
|
17 |
protected static $instance;
|
18 |
|
19 |
/**
|
|
|
20 |
*
|
21 |
-
* @var Advanced_Ads_Model
|
22 |
*/
|
23 |
protected $model;
|
24 |
|
25 |
/**
|
26 |
-
*
|
27 |
*
|
28 |
-
* @
|
29 |
-
* @var array (if loaded)
|
30 |
*/
|
31 |
protected $options;
|
32 |
|
33 |
/**
|
34 |
-
*
|
35 |
*
|
36 |
-
* @
|
37 |
-
* @var array (if loaded)
|
38 |
*/
|
39 |
protected $internal_options;
|
40 |
|
41 |
/**
|
42 |
-
*
|
43 |
* can be changed by options
|
44 |
*
|
45 |
* @var Advanced_Ads_Plugin
|
@@ -47,12 +45,15 @@ class Advanced_Ads_Plugin {
|
|
47 |
const DEFAULT_FRONTEND_PREFIX = 'advads-';
|
48 |
|
49 |
/**
|
|
|
50 |
*
|
51 |
-
* @var
|
52 |
*/
|
53 |
private $frontend_prefix;
|
54 |
|
55 |
-
|
|
|
|
|
56 |
private function __construct() {
|
57 |
register_activation_hook( ADVADS_BASE, array( $this, 'activate' ) );
|
58 |
register_deactivation_hook( ADVADS_BASE, array( $this, 'deactivate' ) );
|
@@ -63,31 +64,36 @@ class Advanced_Ads_Plugin {
|
|
63 |
}
|
64 |
|
65 |
/**
|
|
|
66 |
*
|
67 |
* @return Advanced_Ads_Plugin
|
68 |
*/
|
69 |
public static function get_instance() {
|
70 |
// If the single instance hasn't been set, set it now.
|
71 |
if ( null === self::$instance ) {
|
72 |
-
self::$instance = new self;
|
73 |
}
|
74 |
|
75 |
return self::$instance;
|
76 |
}
|
77 |
|
78 |
/**
|
|
|
79 |
*
|
80 |
-
* @param Advanced_Ads_Model $model
|
81 |
*/
|
82 |
public function set_model( Advanced_Ads_Model $model ) {
|
83 |
$this->model = $model;
|
84 |
}
|
85 |
|
|
|
|
|
|
|
86 |
public function wp_plugins_loaded() {
|
87 |
-
// Load plugin text domain
|
88 |
$this->load_plugin_textdomain();
|
89 |
|
90 |
-
// activate plugin when new blog is added on multisites // -TODO this is admin-only
|
91 |
add_action( 'wpmu_new_blog', array( $this, 'activate_new_site' ) );
|
92 |
|
93 |
// Load public-facing style sheet and JavaScript.
|
@@ -95,21 +101,21 @@ class Advanced_Ads_Plugin {
|
|
95 |
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
96 |
add_action( 'wp_head', array( $this, 'print_head_scripts' ), 7 );
|
97 |
|
98 |
-
// add short codes
|
99 |
add_shortcode( 'the_ad', array( $this, 'shortcode_display_ad' ) );
|
100 |
add_shortcode( 'the_ad_group', array( $this, 'shortcode_display_ad_group' ) );
|
101 |
add_shortcode( 'the_ad_placement', array( $this, 'shortcode_display_ad_placement' ) );
|
102 |
|
103 |
-
// remove default ad group menu item // -TODO only for admin
|
104 |
add_action( 'admin_menu', array( $this, 'remove_taxonomy_menu_item' ) );
|
105 |
-
// load widgets
|
106 |
add_action( 'widgets_init', array( $this, 'widget_init' ) );
|
107 |
|
108 |
-
// load display conditions
|
109 |
Advanced_Ads_Display_Conditions::get_instance();
|
110 |
-
new Advanced_Ads_Frontend_Checks;
|
111 |
-
new Advanced_Ads_Compatibility;
|
112 |
-
Advanced_Ads_Ad_Health_Notices::get_instance(); // load to fetch notices
|
113 |
}
|
114 |
|
115 |
/**
|
@@ -132,8 +138,6 @@ class Advanced_Ads_Plugin {
|
|
132 |
|
133 |
/**
|
134 |
* Register and enqueue public-facing style sheet.
|
135 |
-
*
|
136 |
-
* @since 1.0.0
|
137 |
*/
|
138 |
public function enqueue_styles() {
|
139 |
// wp_enqueue_style( $this->get_plugin_slug() . '-plugin-styles', plugins_url('assets/css/public.css', __FILE__), array(), ADVADS_VERSION);
|
@@ -142,8 +146,7 @@ class Advanced_Ads_Plugin {
|
|
142 |
/**
|
143 |
* Return the plugin slug.
|
144 |
*
|
145 |
-
* @return
|
146 |
-
* @since 1.0.0
|
147 |
*/
|
148 |
public function get_plugin_slug() {
|
149 |
return ADVADS_SLUG;
|
@@ -151,8 +154,6 @@ class Advanced_Ads_Plugin {
|
|
151 |
|
152 |
/**
|
153 |
* Register and enqueues public-facing JavaScript files.
|
154 |
-
*
|
155 |
-
* @since 1.0.0
|
156 |
*/
|
157 |
public function enqueue_scripts() {
|
158 |
if ( advads_is_amp() ) {
|
@@ -168,8 +169,6 @@ class Advanced_Ads_Plugin {
|
|
168 |
|
169 |
/**
|
170 |
* Print public-facing JavaScript in the HTML head.
|
171 |
-
*
|
172 |
-
* @since untagged
|
173 |
*/
|
174 |
public function print_head_scripts() {
|
175 |
/**
|
@@ -179,7 +178,10 @@ class Advanced_Ads_Plugin {
|
|
179 |
* } );
|
180 |
*/
|
181 |
|
182 |
-
|
|
|
|
|
|
|
183 |
|
184 |
if ( advads_is_amp() ) {
|
185 |
return;
|
@@ -189,26 +191,34 @@ class Advanced_Ads_Plugin {
|
|
189 |
?>
|
190 |
<script>
|
191 |
//@formatter:off
|
192 |
-
<?php
|
|
|
193 |
readfile( ADVADS_BASE_PATH . 'public/assets/js/ready.js' );
|
194 |
-
} else {
|
|
|
195 |
advanced_ads_ready=function(){var fns=[],listener,doc=typeof document==="object"&&document,hack=doc&&doc.documentElement.doScroll,domContentLoaded="DOMContentLoaded",loaded=doc&&(hack?/^loaded|^c/:/^loaded|^i|^c/).test(doc.readyState);if(!loaded&&doc){listener=function(){doc.removeEventListener(domContentLoaded,listener);window.removeEventListener("load",listener);loaded=1;while(listener=fns.shift())listener()};doc.addEventListener(domContentLoaded,listener);window.addEventListener("load",listener)}return function(fn){loaded?setTimeout(fn,0):fns.push(fn)}}();
|
196 |
-
|
197 |
}
|
198 |
-
|
199 |
|
200 |
// Output privacy options.
|
201 |
$privacy_options = Advanced_Ads_Privacy::get_instance()->options();
|
202 |
if ( ! empty( $privacy_options['enabled'] ) ) {
|
203 |
-
printf( '(advads_options = window.advads_options || {} )["privacy"] = %s;',
|
204 |
}
|
205 |
|
206 |
-
|
|
|
|
|
|
|
|
|
207 |
echo Advanced_Ads_Utils::get_inline_asset( ob_get_clean() );
|
208 |
|
209 |
-
|
210 |
}
|
211 |
|
|
|
|
|
|
|
212 |
public function widget_init() {
|
213 |
register_widget( 'Advanced_Ads_Widget' );
|
214 |
}
|
@@ -217,8 +227,6 @@ class Advanced_Ads_Plugin {
|
|
217 |
* Fired when a new site is activated with a WPMU environment.
|
218 |
*
|
219 |
* @param int $blog_id ID of the new blog.
|
220 |
-
*
|
221 |
-
* @since 1.0.0
|
222 |
*/
|
223 |
public function activate_new_site( $blog_id ) {
|
224 |
|
@@ -233,8 +241,6 @@ class Advanced_Ads_Plugin {
|
|
233 |
|
234 |
/**
|
235 |
* Fired for each blog when the plugin is activated.
|
236 |
-
*
|
237 |
-
* @since 1.0.0
|
238 |
*/
|
239 |
protected function single_activate() {
|
240 |
// $this->post_types_rewrite_flush();
|
@@ -244,8 +250,6 @@ class Advanced_Ads_Plugin {
|
|
244 |
|
245 |
/**
|
246 |
* Fired for each blog when the plugin is deactivated.
|
247 |
-
*
|
248 |
-
* @since 1.0.0
|
249 |
*/
|
250 |
protected function single_deactivate() {
|
251 |
// -TODO inform modules
|
@@ -254,11 +258,8 @@ class Advanced_Ads_Plugin {
|
|
254 |
|
255 |
/**
|
256 |
* Load the plugin text domain for translation.
|
257 |
-
*
|
258 |
-
* @since 1.0.0
|
259 |
*/
|
260 |
public function load_plugin_textdomain() {
|
261 |
-
// $locale = apply_filters('advanced-ads-plugin-locale', get_locale(), $domain);
|
262 |
load_plugin_textdomain( 'advanced-ads', false, ADVADS_BASE_DIR . '/languages' );
|
263 |
}
|
264 |
|
@@ -269,14 +270,12 @@ class Advanced_Ads_Plugin {
|
|
269 |
* "Network Activate" action, false if
|
270 |
* WPMU is disabled or plugin is
|
271 |
* activated on an individual blog.
|
272 |
-
*
|
273 |
-
* @since 1.0.0
|
274 |
*/
|
275 |
public function activate( $network_wide ) {
|
276 |
if ( function_exists( 'is_multisite' ) && is_multisite() ) {
|
277 |
|
278 |
if ( $network_wide ) {
|
279 |
-
//
|
280 |
global $wpdb;
|
281 |
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs}" );
|
282 |
$original_blog_id = $wpdb->blogid;
|
@@ -298,20 +297,18 @@ class Advanced_Ads_Plugin {
|
|
298 |
/**
|
299 |
* Fired when the plugin is deactivated.
|
300 |
*
|
301 |
-
* @param boolean $network_wide
|
302 |
*
|
303 |
* True if WPMU superadmin uses
|
304 |
* "Network Deactivate" action, false if
|
305 |
* WPMU is disabled or plugin is
|
306 |
* deactivated on an individual blog.
|
307 |
-
*
|
308 |
-
* @since 1.0.0
|
309 |
*/
|
310 |
public function deactivate( $network_wide ) {
|
311 |
if ( function_exists( 'is_multisite' ) && is_multisite() ) {
|
312 |
|
313 |
if ( $network_wide ) {
|
314 |
-
//
|
315 |
global $wpdb;
|
316 |
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs}" );
|
317 |
$original_blog_id = $wpdb->blogid;
|
@@ -331,80 +328,65 @@ class Advanced_Ads_Plugin {
|
|
331 |
}
|
332 |
|
333 |
/**
|
334 |
-
*
|
335 |
-
*
|
336 |
-
* @since 1.0.0
|
337 |
-
* @link http://codex.wordpress.org/Function_Reference/register_post_type#Flushing_Rewrite_on_Activation
|
338 |
-
*/
|
339 |
-
/*public function post_types_rewrite_flush(){
|
340 |
-
// load custom post type
|
341 |
-
Advanced_Ads::get_instance()->create_post_types();
|
342 |
-
// flush rewrite rules
|
343 |
-
flush_rewrite_rules();
|
344 |
-
}*/
|
345 |
-
|
346 |
-
/**
|
347 |
-
* remove WP tag edit page for the ad group taxonomy
|
348 |
* needed, because we can’t remove it with `show_ui` without also removing the meta box
|
349 |
-
*
|
350 |
-
* @since 1.0.0
|
351 |
*/
|
352 |
public function remove_taxonomy_menu_item() {
|
353 |
remove_submenu_page( 'edit.php?post_type=advanced_ads', 'edit-tags.php?taxonomy=advanced_ads_groups&post_type=advanced_ads' );
|
354 |
}
|
355 |
|
356 |
/**
|
357 |
-
*
|
358 |
*
|
359 |
-
* @param
|
360 |
*
|
361 |
-
* @
|
362 |
*/
|
363 |
public function shortcode_display_ad( $atts ) {
|
364 |
$atts = is_array( $atts ) ? $atts : array();
|
365 |
$id = isset( $atts['id'] ) ? (int) $atts['id'] : 0;
|
366 |
$atts = $this->prepare_shortcode_atts( $atts );
|
367 |
|
368 |
-
// use the public available function here
|
369 |
return get_ad( $id, $atts );
|
370 |
}
|
371 |
|
372 |
/**
|
373 |
-
*
|
374 |
*
|
375 |
-
* @param
|
376 |
*
|
377 |
-
* @
|
378 |
*/
|
379 |
public function shortcode_display_ad_group( $atts ) {
|
380 |
$atts = is_array( $atts ) ? $atts : array();
|
381 |
$id = isset( $atts['id'] ) ? (int) $atts['id'] : 0;
|
382 |
$atts = $this->prepare_shortcode_atts( $atts );
|
383 |
|
384 |
-
// use the public available function here
|
385 |
return get_ad_group( $id, $atts );
|
386 |
}
|
387 |
|
388 |
/**
|
389 |
-
*
|
390 |
*
|
391 |
-
* @param
|
392 |
*
|
393 |
-
* @
|
394 |
*/
|
395 |
public function shortcode_display_ad_placement( $atts ) {
|
396 |
$atts = is_array( $atts ) ? $atts : array();
|
397 |
$id = isset( $atts['id'] ) ? (string) $atts['id'] : '';
|
398 |
$atts = $this->prepare_shortcode_atts( $atts );
|
399 |
|
400 |
-
// use the public available function here
|
401 |
return get_ad_placement( $id, $atts );
|
402 |
}
|
403 |
|
404 |
/**
|
405 |
* Prepare shortcode attributes.
|
406 |
*
|
407 |
-
* @param array $atts array with strings
|
408 |
*
|
409 |
* @return array
|
410 |
*/
|
@@ -433,7 +415,14 @@ class Advanced_Ads_Plugin {
|
|
433 |
$cur_lvl[ $last ] = $data;
|
434 |
}
|
435 |
|
436 |
-
$result = array_diff_key(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
437 |
}
|
438 |
|
439 |
// Ad type: 'content' and a shortcode inside.
|
@@ -450,8 +439,6 @@ class Advanced_Ads_Plugin {
|
|
450 |
* these are the options updated by the user
|
451 |
*
|
452 |
* @return array $options
|
453 |
-
* @since 1.0.1
|
454 |
-
* @todo parse default options
|
455 |
*/
|
456 |
public function options() {
|
457 |
// we can’t store options if WPML String Translations is enabled, or it would not translate the "Ad Label" option.
|
@@ -463,15 +450,13 @@ class Advanced_Ads_Plugin {
|
|
463 |
}
|
464 |
|
465 |
/**
|
466 |
-
*
|
467 |
-
*
|
468 |
-
* @param array $options new options
|
469 |
*
|
470 |
-
* @
|
471 |
*/
|
472 |
public function update_options( array $options ) {
|
473 |
-
// do not allow to clear options
|
474 |
-
if (
|
475 |
return;
|
476 |
}
|
477 |
|
@@ -480,30 +465,28 @@ class Advanced_Ads_Plugin {
|
|
480 |
}
|
481 |
|
482 |
/**
|
483 |
-
*
|
484 |
* these are options set by the plugin
|
485 |
*
|
486 |
* @return array $options
|
487 |
-
* @since 1.0.1
|
488 |
-
* @todo parse default options
|
489 |
*/
|
490 |
public function internal_options() {
|
491 |
if ( ! isset( $this->internal_options ) ) {
|
492 |
$defaults = array(
|
493 |
'version' => ADVADS_VERSION,
|
494 |
-
'installed' => time(), // when was this installed
|
495 |
);
|
496 |
$this->internal_options = get_option( ADVADS_SLUG . '-internal', array() );
|
497 |
|
498 |
-
// save defaults
|
499 |
-
if ( $this->internal_options
|
500 |
$this->internal_options = $defaults;
|
501 |
$this->update_internal_options( $this->internal_options );
|
502 |
|
503 |
-
|
504 |
}
|
505 |
|
506 |
-
// for versions installed prior to 1.5.3 set installed date for now
|
507 |
if ( ! isset( $this->internal_options['installed'] ) ) {
|
508 |
$this->internal_options['installed'] = time();
|
509 |
$this->update_internal_options( $this->internal_options );
|
@@ -514,15 +497,13 @@ class Advanced_Ads_Plugin {
|
|
514 |
}
|
515 |
|
516 |
/**
|
517 |
-
*
|
518 |
*
|
519 |
-
* @param array $options new internal options
|
520 |
-
*
|
521 |
-
* @since 1.5.1
|
522 |
*/
|
523 |
public function update_internal_options( array $options ) {
|
524 |
-
// do not allow to clear options
|
525 |
-
if (
|
526 |
return;
|
527 |
}
|
528 |
|
@@ -531,9 +512,7 @@ class Advanced_Ads_Plugin {
|
|
531 |
}
|
532 |
|
533 |
/**
|
534 |
-
*
|
535 |
-
*
|
536 |
-
* @since 1.6.8.2
|
537 |
*/
|
538 |
public function get_frontend_prefix() {
|
539 |
if ( ! $this->frontend_prefix ) {
|
@@ -541,11 +520,11 @@ class Advanced_Ads_Plugin {
|
|
541 |
|
542 |
if ( ! isset( $options['front-prefix'] ) ) {
|
543 |
if ( isset( $options['id-prefix'] ) ) {
|
544 |
-
// deprecated: keeps widgets working that previously received an id based on the front-prefix
|
545 |
$frontend_prefix = esc_attr( $options['id-prefix'] );
|
546 |
} else {
|
547 |
$host = parse_url( get_home_url(), PHP_URL_HOST );
|
548 |
-
$frontend_prefix = preg_match( '/[A-Za-z][A-Za-z0-9_]{4}/', $host, $result ) ? $result[0] . '-' :
|
549 |
}
|
550 |
} else {
|
551 |
$frontend_prefix = esc_attr( $options['front-prefix'] );
|
@@ -561,9 +540,7 @@ class Advanced_Ads_Plugin {
|
|
561 |
}
|
562 |
|
563 |
/**
|
564 |
-
*
|
565 |
-
*
|
566 |
-
* @since 1.6.10.2
|
567 |
*/
|
568 |
public function get_content_injection_priority() {
|
569 |
$options = $this->options();
|
@@ -572,38 +549,27 @@ class Advanced_Ads_Plugin {
|
|
572 |
}
|
573 |
|
574 |
/**
|
575 |
-
*
|
576 |
*
|
577 |
-
* @param
|
578 |
*
|
579 |
-
* @return
|
580 |
-
* @since 1.6.14
|
581 |
*/
|
582 |
public static function user_cap( $capability = 'manage_options' ) {
|
583 |
|
584 |
global $advanced_ads_capabilities;
|
585 |
|
586 |
-
// admins can do everything
|
587 |
-
// is also a fallback if no option or more specific capability is given
|
588 |
if ( current_user_can( 'manage_options' ) ) {
|
589 |
return 'manage_options';
|
590 |
}
|
591 |
|
592 |
return apply_filters( 'advanced-ads-capability', $capability );
|
593 |
-
|
594 |
-
// check, if capability is mapped to an existing WP capability
|
595 |
-
/*if( isset( $advanced_ads_capabilities[ $capability ] ) ){
|
596 |
-
return apply_filters( 'advanced-ads-capability', $advanced_ads_capabilities[ $capability ], $capability );
|
597 |
-
} else {
|
598 |
-
// if not, use 'manage_posts' capability
|
599 |
-
return apply_filters( 'advanced-ads-capability', 'manage_options', $capability );
|
600 |
-
}*/
|
601 |
-
|
602 |
}
|
603 |
|
604 |
/**
|
605 |
* Create roles and capabilities
|
606 |
-
*
|
607 |
*/
|
608 |
public function create_capabilities() {
|
609 |
if ( $role = get_role( 'administrator' ) ) {
|
@@ -617,7 +583,6 @@ class Advanced_Ads_Plugin {
|
|
617 |
|
618 |
/**
|
619 |
* Remove roles and capabilities
|
620 |
-
*
|
621 |
*/
|
622 |
public function remove_capabilities() {
|
623 |
if ( $role = get_role( 'administrator' ) ) {
|
@@ -642,13 +607,13 @@ class Advanced_Ads_Plugin {
|
|
642 |
Advanced_Ads::get_instance()->create_post_types();
|
643 |
|
644 |
if ( ! is_multisite() ) {
|
645 |
-
|
646 |
} else {
|
647 |
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs}" );
|
648 |
|
649 |
foreach ( $blog_ids as $blog_id ) {
|
650 |
switch_to_blog( $blog_id );
|
651 |
-
|
652 |
}
|
653 |
switch_to_blog( $main_blog_id );
|
654 |
}
|
@@ -662,7 +627,6 @@ class Advanced_Ads_Plugin {
|
|
662 |
|
663 |
/**
|
664 |
* Fired for each blog when the plugin is uninstalled.
|
665 |
-
*
|
666 |
*/
|
667 |
protected function uninstall_single() {
|
668 |
global $wpdb;
|
@@ -677,7 +641,7 @@ class Advanced_Ads_Plugin {
|
|
677 |
array( '%s' )
|
678 |
);
|
679 |
|
680 |
-
$wpdb->query( "DELETE FROM {$wpdb->postmeta} WHERE post_id IN( "
|
681 |
}
|
682 |
|
683 |
// Groups.
|
@@ -725,12 +689,12 @@ class Advanced_Ads_Plugin {
|
|
725 |
*/
|
726 |
public static function any_activated_add_on() {
|
727 |
return ( defined( 'AAP_VERSION' ) // Advanced Ads Pro.
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
);
|
735 |
}
|
736 |
|
@@ -743,8 +707,7 @@ class Advanced_Ads_Plugin {
|
|
743 |
*/
|
744 |
public static function support_url( $utm = '' ) {
|
745 |
|
746 |
-
|
747 |
-
// $utm = empty( $utm ) ? '#utm_source=advanced-ads&utm_medium=link&utm_campaign=disable-support' : $utm;
|
748 |
if ( self::any_activated_add_on() ) {
|
749 |
$url = ADVADS_URL . 'support/' . $utm . '-with-addons';
|
750 |
} else {
|
@@ -758,7 +721,7 @@ class Advanced_Ads_Plugin {
|
|
758 |
* Create a random group
|
759 |
*
|
760 |
* @param string $url optional parameter.
|
761 |
-
* @param string $ex
|
762 |
*
|
763 |
* @return bool
|
764 |
*/
|
@@ -809,7 +772,7 @@ class Advanced_Ads_Plugin {
|
|
809 |
|
810 |
// allow admins to see the change in any case.
|
811 |
if ( current_user_can( self::user_cap( 'advanced_ads_manage_options' ) )
|
812 |
-
|
813 |
return true;
|
814 |
}
|
815 |
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* WordPress integration and definitions:
|
5 |
*
|
6 |
* - posttypes
|
7 |
* - taxonomy
|
8 |
* - textdomain
|
|
|
|
|
9 |
*/
|
10 |
class Advanced_Ads_Plugin {
|
11 |
/**
|
12 |
+
* Instance of Advanced_Ads_Plugin
|
13 |
*
|
14 |
+
* @var object Advanced_Ads_Plugin
|
15 |
*/
|
16 |
protected static $instance;
|
17 |
|
18 |
/**
|
19 |
+
* Instance of Advanced_Ads_Model
|
20 |
*
|
21 |
+
* @var object Advanced_Ads_Model
|
22 |
*/
|
23 |
protected $model;
|
24 |
|
25 |
/**
|
26 |
+
* Plugin options
|
27 |
*
|
28 |
+
* @var array $options
|
|
|
29 |
*/
|
30 |
protected $options;
|
31 |
|
32 |
/**
|
33 |
+
* Interal plugin options – set by the plugin
|
34 |
*
|
35 |
+
* @var array $internal_options
|
|
|
36 |
*/
|
37 |
protected $internal_options;
|
38 |
|
39 |
/**
|
40 |
+
* Default prefix of selectors (id, class) in the frontend
|
41 |
* can be changed by options
|
42 |
*
|
43 |
* @var Advanced_Ads_Plugin
|
45 |
const DEFAULT_FRONTEND_PREFIX = 'advads-';
|
46 |
|
47 |
/**
|
48 |
+
* Frontend prefix for classes and IDs
|
49 |
*
|
50 |
+
* @var string $frontend_prefix
|
51 |
*/
|
52 |
private $frontend_prefix;
|
53 |
|
54 |
+
/**
|
55 |
+
* Advanced_Ads_Plugin constructor.
|
56 |
+
*/
|
57 |
private function __construct() {
|
58 |
register_activation_hook( ADVADS_BASE, array( $this, 'activate' ) );
|
59 |
register_deactivation_hook( ADVADS_BASE, array( $this, 'deactivate' ) );
|
64 |
}
|
65 |
|
66 |
/**
|
67 |
+
* Get instance of Advanced_Ads_Plugin
|
68 |
*
|
69 |
* @return Advanced_Ads_Plugin
|
70 |
*/
|
71 |
public static function get_instance() {
|
72 |
// If the single instance hasn't been set, set it now.
|
73 |
if ( null === self::$instance ) {
|
74 |
+
self::$instance = new self();
|
75 |
}
|
76 |
|
77 |
return self::$instance;
|
78 |
}
|
79 |
|
80 |
/**
|
81 |
+
* Get instance of Advanced_Ads_Model
|
82 |
*
|
83 |
+
* @param Advanced_Ads_Model $model model to access data.
|
84 |
*/
|
85 |
public function set_model( Advanced_Ads_Model $model ) {
|
86 |
$this->model = $model;
|
87 |
}
|
88 |
|
89 |
+
/**
|
90 |
+
* Execute various hooks after WordPress and all plugins are available
|
91 |
+
*/
|
92 |
public function wp_plugins_loaded() {
|
93 |
+
// Load plugin text domain.
|
94 |
$this->load_plugin_textdomain();
|
95 |
|
96 |
+
// activate plugin when new blog is added on multisites // -TODO this is admin-only.
|
97 |
add_action( 'wpmu_new_blog', array( $this, 'activate_new_site' ) );
|
98 |
|
99 |
// Load public-facing style sheet and JavaScript.
|
101 |
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
102 |
add_action( 'wp_head', array( $this, 'print_head_scripts' ), 7 );
|
103 |
|
104 |
+
// add short codes.
|
105 |
add_shortcode( 'the_ad', array( $this, 'shortcode_display_ad' ) );
|
106 |
add_shortcode( 'the_ad_group', array( $this, 'shortcode_display_ad_group' ) );
|
107 |
add_shortcode( 'the_ad_placement', array( $this, 'shortcode_display_ad_placement' ) );
|
108 |
|
109 |
+
// remove default ad group menu item // -TODO only for admin.
|
110 |
add_action( 'admin_menu', array( $this, 'remove_taxonomy_menu_item' ) );
|
111 |
+
// load widgets.
|
112 |
add_action( 'widgets_init', array( $this, 'widget_init' ) );
|
113 |
|
114 |
+
// load display conditions.
|
115 |
Advanced_Ads_Display_Conditions::get_instance();
|
116 |
+
new Advanced_Ads_Frontend_Checks();
|
117 |
+
new Advanced_Ads_Compatibility();
|
118 |
+
Advanced_Ads_Ad_Health_Notices::get_instance(); // load to fetch notices.
|
119 |
}
|
120 |
|
121 |
/**
|
138 |
|
139 |
/**
|
140 |
* Register and enqueue public-facing style sheet.
|
|
|
|
|
141 |
*/
|
142 |
public function enqueue_styles() {
|
143 |
// wp_enqueue_style( $this->get_plugin_slug() . '-plugin-styles', plugins_url('assets/css/public.css', __FILE__), array(), ADVADS_VERSION);
|
146 |
/**
|
147 |
* Return the plugin slug.
|
148 |
*
|
149 |
+
* @return string plugin slug variable.
|
|
|
150 |
*/
|
151 |
public function get_plugin_slug() {
|
152 |
return ADVADS_SLUG;
|
154 |
|
155 |
/**
|
156 |
* Register and enqueues public-facing JavaScript files.
|
|
|
|
|
157 |
*/
|
158 |
public function enqueue_scripts() {
|
159 |
if ( advads_is_amp() ) {
|
169 |
|
170 |
/**
|
171 |
* Print public-facing JavaScript in the HTML head.
|
|
|
|
|
172 |
*/
|
173 |
public function print_head_scripts() {
|
174 |
/**
|
178 |
* } );
|
179 |
*/
|
180 |
|
181 |
+
$attribution = self::show_to_new_users( 1583841600, 'a' ) ? '<!-- managing ads with Advanced Ads ' . ADVADS_VERSION . '– %s -->' : '<!-- managing ads with Advanced Ads – %s -->';
|
182 |
+
// escaping would break HTML comment tags so we disable checks here.
|
183 |
+
// phpcs:ignore
|
184 |
+
echo apply_filters( 'advanced-ads-attribution', sprintf( $attribution, ADVADS_URL ) );
|
185 |
|
186 |
if ( advads_is_amp() ) {
|
187 |
return;
|
191 |
?>
|
192 |
<script>
|
193 |
//@formatter:off
|
194 |
+
<?php
|
195 |
+
if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
|
196 |
readfile( ADVADS_BASE_PATH . 'public/assets/js/ready.js' );
|
197 |
+
} else {
|
198 |
+
?>
|
199 |
advanced_ads_ready=function(){var fns=[],listener,doc=typeof document==="object"&&document,hack=doc&&doc.documentElement.doScroll,domContentLoaded="DOMContentLoaded",loaded=doc&&(hack?/^loaded|^c/:/^loaded|^i|^c/).test(doc.readyState);if(!loaded&&doc){listener=function(){doc.removeEventListener(domContentLoaded,listener);window.removeEventListener("load",listener);loaded=1;while(listener=fns.shift())listener()};doc.addEventListener(domContentLoaded,listener);window.addEventListener("load",listener)}return function(fn){loaded?setTimeout(fn,0):fns.push(fn)}}();
|
200 |
+
<?php
|
201 |
}
|
202 |
+
// @formatter:on
|
203 |
|
204 |
// Output privacy options.
|
205 |
$privacy_options = Advanced_Ads_Privacy::get_instance()->options();
|
206 |
if ( ! empty( $privacy_options['enabled'] ) ) {
|
207 |
+
printf( '(advads_options = window.advads_options || {} )["privacy"] = %s;', wp_json_encode( $privacy_options ) );
|
208 |
}
|
209 |
|
210 |
+
?>
|
211 |
+
</script>
|
212 |
+
<?php
|
213 |
+
// escaping would break our HTML here.
|
214 |
+
// phpcs:ignore
|
215 |
echo Advanced_Ads_Utils::get_inline_asset( ob_get_clean() );
|
216 |
|
|
|
217 |
}
|
218 |
|
219 |
+
/**
|
220 |
+
* Register the Advanced Ads widget
|
221 |
+
*/
|
222 |
public function widget_init() {
|
223 |
register_widget( 'Advanced_Ads_Widget' );
|
224 |
}
|
227 |
* Fired when a new site is activated with a WPMU environment.
|
228 |
*
|
229 |
* @param int $blog_id ID of the new blog.
|
|
|
|
|
230 |
*/
|
231 |
public function activate_new_site( $blog_id ) {
|
232 |
|
241 |
|
242 |
/**
|
243 |
* Fired for each blog when the plugin is activated.
|
|
|
|
|
244 |
*/
|
245 |
protected function single_activate() {
|
246 |
// $this->post_types_rewrite_flush();
|
250 |
|
251 |
/**
|
252 |
* Fired for each blog when the plugin is deactivated.
|
|
|
|
|
253 |
*/
|
254 |
protected function single_deactivate() {
|
255 |
// -TODO inform modules
|
258 |
|
259 |
/**
|
260 |
* Load the plugin text domain for translation.
|
|
|
|
|
261 |
*/
|
262 |
public function load_plugin_textdomain() {
|
|
|
263 |
load_plugin_textdomain( 'advanced-ads', false, ADVADS_BASE_DIR . '/languages' );
|
264 |
}
|
265 |
|
270 |
* "Network Activate" action, false if
|
271 |
* WPMU is disabled or plugin is
|
272 |
* activated on an individual blog.
|
|
|
|
|
273 |
*/
|
274 |
public function activate( $network_wide ) {
|
275 |
if ( function_exists( 'is_multisite' ) && is_multisite() ) {
|
276 |
|
277 |
if ( $network_wide ) {
|
278 |
+
// get all blog ids.
|
279 |
global $wpdb;
|
280 |
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs}" );
|
281 |
$original_blog_id = $wpdb->blogid;
|
297 |
/**
|
298 |
* Fired when the plugin is deactivated.
|
299 |
*
|
300 |
+
* @param boolean $network_wide true if Advanced Ads should be disabled network-wide.
|
301 |
*
|
302 |
* True if WPMU superadmin uses
|
303 |
* "Network Deactivate" action, false if
|
304 |
* WPMU is disabled or plugin is
|
305 |
* deactivated on an individual blog.
|
|
|
|
|
306 |
*/
|
307 |
public function deactivate( $network_wide ) {
|
308 |
if ( function_exists( 'is_multisite' ) && is_multisite() ) {
|
309 |
|
310 |
if ( $network_wide ) {
|
311 |
+
// get all blog ids.
|
312 |
global $wpdb;
|
313 |
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs}" );
|
314 |
$original_blog_id = $wpdb->blogid;
|
328 |
}
|
329 |
|
330 |
/**
|
331 |
+
* Remove WP tag edit page for the ad group taxonomy
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
332 |
* needed, because we can’t remove it with `show_ui` without also removing the meta box
|
|
|
|
|
333 |
*/
|
334 |
public function remove_taxonomy_menu_item() {
|
335 |
remove_submenu_page( 'edit.php?post_type=advanced_ads', 'edit-tags.php?taxonomy=advanced_ads_groups&post_type=advanced_ads' );
|
336 |
}
|
337 |
|
338 |
/**
|
339 |
+
* Shortcode to include ad in frontend
|
340 |
*
|
341 |
+
* @param array $atts shortcode attributes.
|
342 |
*
|
343 |
+
* @return string ad content.
|
344 |
*/
|
345 |
public function shortcode_display_ad( $atts ) {
|
346 |
$atts = is_array( $atts ) ? $atts : array();
|
347 |
$id = isset( $atts['id'] ) ? (int) $atts['id'] : 0;
|
348 |
$atts = $this->prepare_shortcode_atts( $atts );
|
349 |
|
350 |
+
// use the public available function here.
|
351 |
return get_ad( $id, $atts );
|
352 |
}
|
353 |
|
354 |
/**
|
355 |
+
* Shortcode to include ad from an ad group in frontend
|
356 |
*
|
357 |
+
* @param array $atts shortcode attributes.
|
358 |
*
|
359 |
+
* @return string ad group content.
|
360 |
*/
|
361 |
public function shortcode_display_ad_group( $atts ) {
|
362 |
$atts = is_array( $atts ) ? $atts : array();
|
363 |
$id = isset( $atts['id'] ) ? (int) $atts['id'] : 0;
|
364 |
$atts = $this->prepare_shortcode_atts( $atts );
|
365 |
|
366 |
+
// use the public available function here.
|
367 |
return get_ad_group( $id, $atts );
|
368 |
}
|
369 |
|
370 |
/**
|
371 |
+
* Shortcode to display content of an ad placement in frontend
|
372 |
*
|
373 |
+
* @param array $atts shortcode attributes.
|
374 |
*
|
375 |
+
* @return string ad placement content.
|
376 |
*/
|
377 |
public function shortcode_display_ad_placement( $atts ) {
|
378 |
$atts = is_array( $atts ) ? $atts : array();
|
379 |
$id = isset( $atts['id'] ) ? (string) $atts['id'] : '';
|
380 |
$atts = $this->prepare_shortcode_atts( $atts );
|
381 |
|
382 |
+
// use the public available function here.
|
383 |
return get_ad_placement( $id, $atts );
|
384 |
}
|
385 |
|
386 |
/**
|
387 |
* Prepare shortcode attributes.
|
388 |
*
|
389 |
+
* @param array $atts array with strings.
|
390 |
*
|
391 |
* @return array
|
392 |
*/
|
415 |
$cur_lvl[ $last ] = $data;
|
416 |
}
|
417 |
|
418 |
+
$result = array_diff_key(
|
419 |
+
$result,
|
420 |
+
array(
|
421 |
+
'id' => false,
|
422 |
+
'blog_id' => false,
|
423 |
+
'ad_args' => false,
|
424 |
+
)
|
425 |
+
);
|
426 |
}
|
427 |
|
428 |
// Ad type: 'content' and a shortcode inside.
|
439 |
* these are the options updated by the user
|
440 |
*
|
441 |
* @return array $options
|
|
|
|
|
442 |
*/
|
443 |
public function options() {
|
444 |
// we can’t store options if WPML String Translations is enabled, or it would not translate the "Ad Label" option.
|
450 |
}
|
451 |
|
452 |
/**
|
453 |
+
* Update plugin options (not for settings page, but if automatic options are needed)
|
|
|
|
|
454 |
*
|
455 |
+
* @param array $options new options.
|
456 |
*/
|
457 |
public function update_options( array $options ) {
|
458 |
+
// do not allow to clear options.
|
459 |
+
if ( array() === $options ) {
|
460 |
return;
|
461 |
}
|
462 |
|
465 |
}
|
466 |
|
467 |
/**
|
468 |
+
* Return internal plugin options
|
469 |
* these are options set by the plugin
|
470 |
*
|
471 |
* @return array $options
|
|
|
|
|
472 |
*/
|
473 |
public function internal_options() {
|
474 |
if ( ! isset( $this->internal_options ) ) {
|
475 |
$defaults = array(
|
476 |
'version' => ADVADS_VERSION,
|
477 |
+
'installed' => time(), // when was this installed.
|
478 |
);
|
479 |
$this->internal_options = get_option( ADVADS_SLUG . '-internal', array() );
|
480 |
|
481 |
+
// save defaults.
|
482 |
+
if ( array() === $this->internal_options ) {
|
483 |
$this->internal_options = $defaults;
|
484 |
$this->update_internal_options( $this->internal_options );
|
485 |
|
486 |
+
self::get_instance()->create_capabilities();
|
487 |
}
|
488 |
|
489 |
+
// for versions installed prior to 1.5.3 set installed date for now.
|
490 |
if ( ! isset( $this->internal_options['installed'] ) ) {
|
491 |
$this->internal_options['installed'] = time();
|
492 |
$this->update_internal_options( $this->internal_options );
|
497 |
}
|
498 |
|
499 |
/**
|
500 |
+
* Update internal plugin options
|
501 |
*
|
502 |
+
* @param array $options new internal options.
|
|
|
|
|
503 |
*/
|
504 |
public function update_internal_options( array $options ) {
|
505 |
+
// do not allow to clear options.
|
506 |
+
if ( array() === $options ) {
|
507 |
return;
|
508 |
}
|
509 |
|
512 |
}
|
513 |
|
514 |
/**
|
515 |
+
* Get prefix used for frontend elements
|
|
|
|
|
516 |
*/
|
517 |
public function get_frontend_prefix() {
|
518 |
if ( ! $this->frontend_prefix ) {
|
520 |
|
521 |
if ( ! isset( $options['front-prefix'] ) ) {
|
522 |
if ( isset( $options['id-prefix'] ) ) {
|
523 |
+
// deprecated: keeps widgets working that previously received an id based on the front-prefix.
|
524 |
$frontend_prefix = esc_attr( $options['id-prefix'] );
|
525 |
} else {
|
526 |
$host = parse_url( get_home_url(), PHP_URL_HOST );
|
527 |
+
$frontend_prefix = preg_match( '/[A-Za-z][A-Za-z0-9_]{4}/', $host, $result ) ? $result[0] . '-' : self::DEFAULT_FRONTEND_PREFIX;
|
528 |
}
|
529 |
} else {
|
530 |
$frontend_prefix = esc_attr( $options['front-prefix'] );
|
540 |
}
|
541 |
|
542 |
/**
|
543 |
+
* Get priority used for injection inside content
|
|
|
|
|
544 |
*/
|
545 |
public function get_content_injection_priority() {
|
546 |
$options = $this->options();
|
549 |
}
|
550 |
|
551 |
/**
|
552 |
+
* Returns the capability needed to perform an action
|
553 |
*
|
554 |
+
* @param string $capability a capability to check, can be internal to Advanced Ads.
|
555 |
*
|
556 |
+
* @return string $capability a valid WordPress capability.
|
|
|
557 |
*/
|
558 |
public static function user_cap( $capability = 'manage_options' ) {
|
559 |
|
560 |
global $advanced_ads_capabilities;
|
561 |
|
562 |
+
// admins can do everything.
|
563 |
+
// is also a fallback if no option or more specific capability is given.
|
564 |
if ( current_user_can( 'manage_options' ) ) {
|
565 |
return 'manage_options';
|
566 |
}
|
567 |
|
568 |
return apply_filters( 'advanced-ads-capability', $capability );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
569 |
}
|
570 |
|
571 |
/**
|
572 |
* Create roles and capabilities
|
|
|
573 |
*/
|
574 |
public function create_capabilities() {
|
575 |
if ( $role = get_role( 'administrator' ) ) {
|
583 |
|
584 |
/**
|
585 |
* Remove roles and capabilities
|
|
|
586 |
*/
|
587 |
public function remove_capabilities() {
|
588 |
if ( $role = get_role( 'administrator' ) ) {
|
607 |
Advanced_Ads::get_instance()->create_post_types();
|
608 |
|
609 |
if ( ! is_multisite() ) {
|
610 |
+
self::get_instance()->uninstall_single();
|
611 |
} else {
|
612 |
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs}" );
|
613 |
|
614 |
foreach ( $blog_ids as $blog_id ) {
|
615 |
switch_to_blog( $blog_id );
|
616 |
+
self::get_instance()->uninstall_single();
|
617 |
}
|
618 |
switch_to_blog( $main_blog_id );
|
619 |
}
|
627 |
|
628 |
/**
|
629 |
* Fired for each blog when the plugin is uninstalled.
|
|
|
630 |
*/
|
631 |
protected function uninstall_single() {
|
632 |
global $wpdb;
|
641 |
array( '%s' )
|
642 |
);
|
643 |
|
644 |
+
$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->postmeta} WHERE post_id IN( %s )", implode( ',', $post_ids ) ) );
|
645 |
}
|
646 |
|
647 |
// Groups.
|
689 |
*/
|
690 |
public static function any_activated_add_on() {
|
691 |
return ( defined( 'AAP_VERSION' ) // Advanced Ads Pro.
|
692 |
+
|| defined( 'AASA_VERSION' ) // Selling Ads.
|
693 |
+
|| defined( 'AAT_VERSION' ) // Tracking.
|
694 |
+
|| defined( 'AASADS_VERSION' ) // Sticky Ads.
|
695 |
+
|| defined( 'AAR_VERSION' ) // Responsive Ads.
|
696 |
+
|| defined( 'AAPLDS_VERSION' ) // PopUp and Layer Ads.
|
697 |
+
|| defined( 'AAGT_SLUG' ) // Geo-Targeting.
|
698 |
);
|
699 |
}
|
700 |
|
707 |
*/
|
708 |
public static function support_url( $utm = '' ) {
|
709 |
|
710 |
+
$utm = empty( $utm ) ? '#utm_source=advanced-ads&utm_medium=link&utm_campaign=support' : $utm;
|
|
|
711 |
if ( self::any_activated_add_on() ) {
|
712 |
$url = ADVADS_URL . 'support/' . $utm . '-with-addons';
|
713 |
} else {
|
721 |
* Create a random group
|
722 |
*
|
723 |
* @param string $url optional parameter.
|
724 |
+
* @param string $ex group.
|
725 |
*
|
726 |
* @return bool
|
727 |
*/
|
772 |
|
773 |
// allow admins to see the change in any case.
|
774 |
if ( current_user_can( self::user_cap( 'advanced_ads_manage_options' ) )
|
775 |
+
&& isset( $_REQUEST['advads-ignore-timestamp'] ) ) {
|
776 |
return true;
|
777 |
}
|
778 |
|
classes/utils.php
CHANGED
@@ -1,26 +1,30 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
2 |
class Advanced_Ads_Utils {
|
3 |
/**
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
public static function merge_deep_array( array $arrays, $preserve_integer_keys =
|
21 |
$result = array();
|
22 |
foreach ( $arrays as $array ) {
|
23 |
-
if ( ! is_array( $array ) ) {
|
|
|
24 |
|
25 |
foreach ( $array as $key => $value ) {
|
26 |
// Renumber integer keys as array_merge_recursive() does unless
|
@@ -28,13 +32,11 @@ class Advanced_Ads_Utils {
|
|
28 |
// converts array keys that are integer strings (e.g., '1') to integers.
|
29 |
if ( is_integer( $key ) && ! $preserve_integer_keys ) {
|
30 |
$result[] = $value;
|
31 |
-
}
|
32 |
-
|
33 |
-
elseif ( isset( $result[ $key ] ) && is_array( $result[ $key ] ) && is_array( $value ) ) {
|
34 |
$result[ $key ] = self::merge_deep_array( array( $result[ $key ], $value ), $preserve_integer_keys );
|
35 |
-
}
|
36 |
-
|
37 |
-
else {
|
38 |
$result[ $key ] = $value;
|
39 |
}
|
40 |
}
|
@@ -45,28 +47,28 @@ class Advanced_Ads_Utils {
|
|
45 |
/**
|
46 |
* Convert array of html attributes to string.
|
47 |
*
|
48 |
-
* @param array $data
|
49 |
* @return string
|
50 |
* @since untagged
|
51 |
*/
|
52 |
public static function build_html_attributes( $data ) {
|
53 |
$result = '';
|
54 |
-
foreach ( $data as $_html_attr => $_values ){
|
55 |
-
if (
|
56 |
$_style_values_string = '';
|
57 |
-
foreach ( $_values as $_style_attr => $_style_values ){
|
58 |
if ( is_array( $_style_values ) ) {
|
59 |
-
$_style_values_string .= $_style_attr . ': ' .implode( ' ', $_style_values ). '; ';
|
60 |
-
else {
|
61 |
-
$_style_values_string .= $_style_attr . ': '
|
|
|
62 |
}
|
63 |
$result .= " style=\"$_style_values_string\"";
|
64 |
} else {
|
65 |
if ( is_array( $_values ) ) {
|
66 |
-
$_values_string = esc_attr( implode( ' ', $_values ) ); }
|
67 |
-
else {
|
68 |
$_values_string = esc_attr( $_values ); }
|
69 |
-
|
70 |
}
|
71 |
}
|
72 |
return $result;
|
@@ -75,11 +77,11 @@ class Advanced_Ads_Utils {
|
|
75 |
/**
|
76 |
* Get inline asset.
|
77 |
*
|
78 |
-
* @param
|
79 |
-
* @return
|
80 |
*/
|
81 |
public static function get_inline_asset( $content ) {
|
82 |
-
|
83 |
return '<!--noptimize-->' . $content . '<!--/noptimize-->';
|
84 |
}
|
85 |
// WP Fastest Cache Premium: "Render Blocking Js" feature.
|
@@ -93,14 +95,14 @@ class Advanced_Ads_Utils {
|
|
93 |
/**
|
94 |
* Get nested ads of an ad or a group.
|
95 |
*
|
96 |
-
* @param
|
97 |
-
* @param
|
98 |
* @return array of Advanced_Ads_Ad objects.
|
99 |
*/
|
100 |
public static function get_nested_ads( $id, $type ) {
|
101 |
$result = array();
|
102 |
|
103 |
-
switch( $type ) {
|
104 |
case 'placement':
|
105 |
$placements = Advanced_Ads::get_ad_placements_array();
|
106 |
if ( isset( $placements[ $id ]['item'] ) ) {
|
@@ -110,7 +112,7 @@ class Advanced_Ads_Utils {
|
|
110 |
}
|
111 |
}
|
112 |
case 'ad':
|
113 |
-
$ad
|
114 |
$result[] = $ad;
|
115 |
if ( 'group' === $ad->type && ! empty( $ad->output['group_id'] ) ) {
|
116 |
$result = array_merge( $result, self::get_nested_ads( $ad->output['group_id'], 'group' ) );
|
@@ -118,7 +120,7 @@ class Advanced_Ads_Utils {
|
|
118 |
break;
|
119 |
case 'group':
|
120 |
$group = new Advanced_Ads_Group( $id );
|
121 |
-
$ads
|
122 |
foreach ( $ads as $ad ) {
|
123 |
$result = array_merge( $result, self::get_nested_ads( $ad->ID, 'ad' ) );
|
124 |
}
|
@@ -137,10 +139,10 @@ class Advanced_Ads_Utils {
|
|
137 |
global $wp_roles;
|
138 |
|
139 |
$roles_or_caps = (array) $roles_or_caps;
|
140 |
-
$roles
|
141 |
|
142 |
foreach ( $roles_or_caps as $cap ) {
|
143 |
-
if ( $wp_roles->is_role( $cap ) ){
|
144 |
$roles[] = $cap;
|
145 |
continue;
|
146 |
}
|
@@ -175,6 +177,8 @@ class Advanced_Ads_Utils {
|
|
175 |
/**
|
176 |
* Check if the Elementor preview mode is used.
|
177 |
*
|
|
|
|
|
178 |
* @return bool
|
179 |
*/
|
180 |
private static function is_elementor_preview_or_edit() {
|
@@ -211,9 +215,10 @@ class Advanced_Ads_Utils {
|
|
211 |
}
|
212 |
}
|
213 |
} catch ( Exception $e ) {
|
|
|
214 |
}
|
215 |
}
|
216 |
return false;
|
217 |
}
|
218 |
}
|
219 |
-
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Class Advanced_Ads_Utils
|
4 |
+
*/
|
5 |
class Advanced_Ads_Utils {
|
6 |
/**
|
7 |
+
* Merges multiple arrays, recursively, and returns the merged array.
|
8 |
+
*
|
9 |
+
* This function is similar to PHP's array_merge_recursive() function, but it
|
10 |
+
* handles non-array values differently. When merging values that are not both
|
11 |
+
* arrays, the latter value replaces the former rather than merging with it.
|
12 |
+
*
|
13 |
+
* Example:
|
14 |
+
* $link_options_1 = array( 'fragment' => 'x', 'class' => array( 'a', 'b' ) );
|
15 |
+
* $link_options_2 = array( 'fragment' => 'y', 'class' => array( 'c', 'd' ) );
|
16 |
+
* // This results in array( 'fragment' => 'y', 'class' => array( 'a', 'b', 'c', 'd' ) ).
|
17 |
+
*
|
18 |
+
* @param array $arrays An arrays of arrays to merge.
|
19 |
+
* @param bool $preserve_integer_keys (optional) If given, integer keys will be preserved and merged instead of appended.
|
20 |
+
* @return array The merged array.
|
21 |
+
* @copyright Copyright 2001 - 2013 Drupal contributors. License: GPL-2.0+. Drupal is a registered trademark of Dries Buytaert.
|
22 |
+
*/
|
23 |
+
public static function merge_deep_array( array $arrays, $preserve_integer_keys = false ) {
|
24 |
$result = array();
|
25 |
foreach ( $arrays as $array ) {
|
26 |
+
if ( ! is_array( $array ) ) {
|
27 |
+
continue; }
|
28 |
|
29 |
foreach ( $array as $key => $value ) {
|
30 |
// Renumber integer keys as array_merge_recursive() does unless
|
32 |
// converts array keys that are integer strings (e.g., '1') to integers.
|
33 |
if ( is_integer( $key ) && ! $preserve_integer_keys ) {
|
34 |
$result[] = $value;
|
35 |
+
} elseif ( isset( $result[ $key ] ) && is_array( $result[ $key ] ) && is_array( $value ) ) {
|
36 |
+
// recurse when both values are arrays.
|
|
|
37 |
$result[ $key ] = self::merge_deep_array( array( $result[ $key ], $value ), $preserve_integer_keys );
|
38 |
+
} else {
|
39 |
+
// otherwise, use the latter value, overriding any previous value.
|
|
|
40 |
$result[ $key ] = $value;
|
41 |
}
|
42 |
}
|
47 |
/**
|
48 |
* Convert array of html attributes to string.
|
49 |
*
|
50 |
+
* @param array $data attributes.
|
51 |
* @return string
|
52 |
* @since untagged
|
53 |
*/
|
54 |
public static function build_html_attributes( $data ) {
|
55 |
$result = '';
|
56 |
+
foreach ( $data as $_html_attr => $_values ) {
|
57 |
+
if ( 'style' === $_html_attr ) {
|
58 |
$_style_values_string = '';
|
59 |
+
foreach ( $_values as $_style_attr => $_style_values ) {
|
60 |
if ( is_array( $_style_values ) ) {
|
61 |
+
$_style_values_string .= $_style_attr . ': ' . implode( ' ', $_style_values ) . '; ';
|
62 |
+
} else {
|
63 |
+
$_style_values_string .= $_style_attr . ': ' . $_style_values . '; ';
|
64 |
+
}
|
65 |
}
|
66 |
$result .= " style=\"$_style_values_string\"";
|
67 |
} else {
|
68 |
if ( is_array( $_values ) ) {
|
69 |
+
$_values_string = esc_attr( implode( ' ', $_values ) ); } else {
|
|
|
70 |
$_values_string = esc_attr( $_values ); }
|
71 |
+
$result .= " $_html_attr=\"$_values_string\"";
|
72 |
}
|
73 |
}
|
74 |
return $result;
|
77 |
/**
|
78 |
* Get inline asset.
|
79 |
*
|
80 |
+
* @param string $content existing content.
|
81 |
+
* @return string $content
|
82 |
*/
|
83 |
public static function get_inline_asset( $content ) {
|
84 |
+
if ( Advanced_Ads_Checks::active_autoptimize() || Advanced_Ads_Checks::active_wp_rocket() ) {
|
85 |
return '<!--noptimize-->' . $content . '<!--/noptimize-->';
|
86 |
}
|
87 |
// WP Fastest Cache Premium: "Render Blocking Js" feature.
|
95 |
/**
|
96 |
* Get nested ads of an ad or a group.
|
97 |
*
|
98 |
+
* @param string $id Id.
|
99 |
+
* @param string $type Type (placement, ad or group).
|
100 |
* @return array of Advanced_Ads_Ad objects.
|
101 |
*/
|
102 |
public static function get_nested_ads( $id, $type ) {
|
103 |
$result = array();
|
104 |
|
105 |
+
switch ( $type ) {
|
106 |
case 'placement':
|
107 |
$placements = Advanced_Ads::get_ad_placements_array();
|
108 |
if ( isset( $placements[ $id ]['item'] ) ) {
|
112 |
}
|
113 |
}
|
114 |
case 'ad':
|
115 |
+
$ad = new Advanced_Ads_Ad( $id );
|
116 |
$result[] = $ad;
|
117 |
if ( 'group' === $ad->type && ! empty( $ad->output['group_id'] ) ) {
|
118 |
$result = array_merge( $result, self::get_nested_ads( $ad->output['group_id'], 'group' ) );
|
120 |
break;
|
121 |
case 'group':
|
122 |
$group = new Advanced_Ads_Group( $id );
|
123 |
+
$ads = $group->get_all_ads();
|
124 |
foreach ( $ads as $ad ) {
|
125 |
$result = array_merge( $result, self::get_nested_ads( $ad->ID, 'ad' ) );
|
126 |
}
|
139 |
global $wp_roles;
|
140 |
|
141 |
$roles_or_caps = (array) $roles_or_caps;
|
142 |
+
$roles = array();
|
143 |
|
144 |
foreach ( $roles_or_caps as $cap ) {
|
145 |
+
if ( $wp_roles->is_role( $cap ) ) {
|
146 |
$roles[] = $cap;
|
147 |
continue;
|
148 |
}
|
177 |
/**
|
178 |
* Check if the Elementor preview mode is used.
|
179 |
*
|
180 |
+
* @deprecated
|
181 |
+
*
|
182 |
* @return bool
|
183 |
*/
|
184 |
private static function is_elementor_preview_or_edit() {
|
215 |
}
|
216 |
}
|
217 |
} catch ( Exception $e ) {
|
218 |
+
// not much we can do here.
|
219 |
}
|
220 |
}
|
221 |
return false;
|
222 |
}
|
223 |
}
|
224 |
+
|
languages/advanced-ads.pot
CHANGED
@@ -3,7 +3,7 @@ msgid ""
|
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: Advanved Ads\n"
|
5 |
"Report-Msgid-Bugs-To: http://wordpress.org/plugins/plugin-name\n"
|
6 |
-
"POT-Creation-Date: 2020-
|
7 |
"POT-Revision-Date: Wed Jul 13 2016 13:23:05 GMT+0200 (CEST)\n"
|
8 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
9 |
"Last-Translator: Thomas Maier <post@webzunft.de>\n"
|
@@ -24,7 +24,7 @@ msgstr ""
|
|
24 |
"X-Poedit-SearchPath-0: ."
|
25 |
|
26 |
#. %1$s is an anchor (link) opening tag, %2$s is the closing tag.
|
27 |
-
#: classes/ad-health-notices.php:
|
28 |
#: modules/gadsense/includes/class-mapi.php:1513
|
29 |
#, php-format
|
30 |
msgid "Learn more about AdSense account issues %1$shere%2$s."
|
@@ -155,305 +155,306 @@ msgstr ""
|
|
155 |
msgid "Original size: %s"
|
156 |
msgstr ""
|
157 |
|
158 |
-
#: classes/ad_ajax_callbacks.php:
|
159 |
#, php-format
|
160 |
msgid ""
|
161 |
"An error occurred. Please use <a href=\"%s\" target=\"_blank\">this form</a> "
|
162 |
"to sign up."
|
163 |
msgstr ""
|
164 |
|
165 |
-
#: classes/ad_placements.php:
|
166 |
msgid "Manual Placement"
|
167 |
msgstr ""
|
168 |
|
169 |
-
#: classes/ad_placements.php:
|
170 |
msgid "Manual placement to use as function or shortcode."
|
171 |
msgstr ""
|
172 |
|
173 |
-
#: classes/ad_placements.php:
|
174 |
msgid "Header Code"
|
175 |
msgstr ""
|
176 |
|
177 |
-
#: classes/ad_placements.php:
|
178 |
msgid ""
|
179 |
"Injected in Header (before closing </head> Tag, often not visible)."
|
180 |
msgstr ""
|
181 |
|
182 |
-
#: classes/ad_placements.php:
|
183 |
msgid "Footer Code"
|
184 |
msgstr ""
|
185 |
|
186 |
-
#: classes/ad_placements.php:
|
187 |
msgid "Injected in Footer (before closing </body> Tag)."
|
188 |
msgstr ""
|
189 |
|
190 |
-
#: classes/ad_placements.php:
|
191 |
msgid "Before Content"
|
192 |
msgstr ""
|
193 |
|
194 |
-
#: classes/ad_placements.php:
|
195 |
msgid "Injected before the post content."
|
196 |
msgstr ""
|
197 |
|
198 |
-
#: classes/ad_placements.php:
|
199 |
msgid "After Content"
|
200 |
msgstr ""
|
201 |
|
202 |
-
#: classes/ad_placements.php:
|
203 |
msgid "Injected after the post content."
|
204 |
msgstr ""
|
205 |
|
206 |
-
#: classes/ad_placements.php:
|
207 |
msgid "Content"
|
208 |
msgstr ""
|
209 |
|
210 |
-
#: classes/ad_placements.php:
|
211 |
msgid ""
|
212 |
"Injected into the content. You can choose the paragraph after which the ad "
|
213 |
"content is displayed."
|
214 |
msgstr ""
|
215 |
|
216 |
-
#: classes/ad_placements.php:
|
217 |
msgid "Sidebar Widget"
|
218 |
msgstr ""
|
219 |
|
220 |
-
#: classes/ad_placements.php:
|
221 |
msgid ""
|
222 |
"Create a sidebar widget with an ad. Can be placed and used like any other "
|
223 |
"widget."
|
224 |
msgstr ""
|
225 |
|
226 |
-
#: classes/ad_placements.php:
|
227 |
#, php-format
|
228 |
msgid "paragraph (%s)"
|
229 |
msgstr ""
|
230 |
|
231 |
-
#: classes/ad_placements.php:
|
232 |
#, php-format
|
233 |
msgid "paragraph without image (%s)"
|
234 |
msgstr ""
|
235 |
|
236 |
-
#: classes/ad_placements.php:
|
237 |
#, php-format
|
238 |
msgid "headline 2 (%s)"
|
239 |
msgstr ""
|
240 |
|
241 |
-
#: classes/ad_placements.php:
|
242 |
#, php-format
|
243 |
msgid "headline 3 (%s)"
|
244 |
msgstr ""
|
245 |
|
246 |
-
#: classes/ad_placements.php:
|
247 |
#, php-format
|
248 |
msgid "headline 4 (%s)"
|
249 |
msgstr ""
|
250 |
|
251 |
-
#: classes/ad_placements.php:
|
252 |
#, php-format
|
253 |
msgid "Set <em>%s</em> to show more ads"
|
254 |
msgstr ""
|
255 |
|
256 |
-
#: classes/ad_placements.php:
|
257 |
msgid "Disable level limitation"
|
258 |
msgstr ""
|
259 |
|
260 |
-
#: classes/frontend_checks.php:
|
261 |
msgid "Random AdSense ads"
|
262 |
msgstr ""
|
263 |
|
264 |
-
#: classes/frontend_checks.php:
|
|
|
265 |
msgid "You look like a bot"
|
266 |
msgstr ""
|
267 |
|
268 |
-
#: classes/frontend_checks.php:
|
269 |
msgid "Ad blocker enabled"
|
270 |
msgstr ""
|
271 |
|
272 |
-
#: classes/frontend_checks.php:
|
273 |
#, php-format
|
274 |
msgid "<em>%s</em> filter does not exist"
|
275 |
msgstr ""
|
276 |
|
277 |
-
#: classes/frontend_checks.php:
|
278 |
msgid "Ads are disabled on this page"
|
279 |
msgstr ""
|
280 |
|
281 |
-
#: classes/frontend_checks.php:
|
282 |
msgid "Ads are disabled in the content of this page"
|
283 |
msgstr ""
|
284 |
|
285 |
-
#: classes/frontend_checks.php:
|
286 |
msgid "the current post ID is 0 "
|
287 |
msgstr ""
|
288 |
|
289 |
-
#: classes/frontend_checks.php:
|
290 |
msgid "Ads are disabled on all pages"
|
291 |
msgstr ""
|
292 |
|
293 |
-
#: classes/frontend_checks.php:
|
294 |
msgid "Ads are disabled on 404 pages"
|
295 |
msgstr ""
|
296 |
|
297 |
-
#: classes/frontend_checks.php:
|
298 |
msgid "Ads are disabled on non singular pages"
|
299 |
msgstr ""
|
300 |
|
301 |
-
#: classes/frontend_checks.php:
|
302 |
#: admin/includes/ad-health-notices.php:145
|
303 |
msgid ""
|
304 |
"Your website is using HTTPS, but the ad code contains HTTP and might not "
|
305 |
"work."
|
306 |
msgstr ""
|
307 |
|
308 |
-
#: classes/frontend_checks.php:
|
309 |
#, php-format
|
310 |
msgid "Ad IDs: %s"
|
311 |
msgstr ""
|
312 |
|
313 |
-
#: classes/frontend_checks.php:
|
314 |
#, php-format
|
315 |
msgid "Visible ads should not use the Header placement: %s"
|
316 |
msgstr ""
|
317 |
|
318 |
-
#: classes/frontend_checks.php:
|
319 |
msgid "AdSense violation"
|
320 |
msgstr ""
|
321 |
|
322 |
-
#: classes/frontend_checks.php:
|
323 |
msgid "Ad is hidden"
|
324 |
msgstr ""
|
325 |
|
326 |
-
#: classes/frontend_checks.php:
|
327 |
#, php-format
|
328 |
msgid "IDs: %s"
|
329 |
msgstr ""
|
330 |
|
331 |
-
#: classes/frontend_checks.php:
|
332 |
#, php-format
|
333 |
msgid "The following responsive AdSense ads are not showing up: %s"
|
334 |
msgstr ""
|
335 |
|
336 |
-
#: classes/frontend_checks.php:
|
337 |
msgid "Consent not given"
|
338 |
msgstr ""
|
339 |
|
340 |
-
#: classes/frontend_checks.php:
|
341 |
msgid "Debug Google Ad Manager"
|
342 |
msgstr ""
|
343 |
|
344 |
-
#: classes/frontend_checks.php:
|
345 |
msgid "Auto ads code found"
|
346 |
msgstr ""
|
347 |
|
348 |
-
#: classes/frontend_checks.php:
|
349 |
msgid "highlight ads"
|
350 |
msgstr ""
|
351 |
|
352 |
-
#: classes/frontend_checks.php:
|
353 |
msgid "Ad Health"
|
354 |
msgstr ""
|
355 |
|
356 |
-
#: classes/frontend_checks.php:
|
357 |
#, php-format
|
358 |
msgid "Show %d more notifications"
|
359 |
msgstr ""
|
360 |
|
361 |
-
#: classes/frontend_checks.php:
|
362 |
msgid "Everything is fine"
|
363 |
msgstr ""
|
364 |
|
365 |
-
#: classes/frontend_checks.php:
|
366 |
msgid "Get help"
|
367 |
msgstr ""
|
368 |
|
369 |
-
#: classes/frontend_checks.php:
|
370 |
msgid ""
|
371 |
"the following code is used for automatic error detection and only visible to "
|
372 |
"admins"
|
373 |
msgstr ""
|
374 |
|
375 |
-
#: classes/frontend_checks.php:
|
376 |
#, php-format
|
377 |
msgid "Hi %s"
|
378 |
msgstr ""
|
379 |
|
380 |
-
#: classes/frontend_checks.php:
|
381 |
#, php-format
|
382 |
msgid "Advanced Ads detected AdSense Auto ads (%sx) on this page."
|
383 |
msgstr ""
|
384 |
|
385 |
-
#: classes/frontend_checks.php:
|
386 |
msgid "Is that correct?"
|
387 |
msgstr ""
|
388 |
|
389 |
-
#: classes/frontend_checks.php:
|
390 |
msgid "All is fine"
|
391 |
msgstr ""
|
392 |
|
393 |
-
#: classes/frontend_checks.php:
|
394 |
msgid "Something is off"
|
395 |
msgstr ""
|
396 |
|
397 |
-
#: classes/frontend_checks.php:
|
398 |
msgid ""
|
399 |
"PS: This is a one-time check from your friendly Advanced Ads plugin. It is "
|
400 |
"only visible to you."
|
401 |
msgstr ""
|
402 |
|
403 |
-
#: classes/frontend_checks.php:
|
404 |
msgid ""
|
405 |
"Advanced Ads detected the AdSense Auto ads code and <strong>no ads on this "
|
406 |
"page</strong>."
|
407 |
msgstr ""
|
408 |
|
409 |
-
#: classes/frontend_checks.php:
|
410 |
msgid "This is fine"
|
411 |
msgstr ""
|
412 |
|
413 |
-
#: classes/frontend_checks.php:
|
414 |
msgid "I expected something else"
|
415 |
msgstr ""
|
416 |
|
417 |
-
#: classes/frontend_checks.php:
|
418 |
msgid ""
|
419 |
"PS: this is a one-time check from your friendly Advanced Ads plugin. It is "
|
420 |
"only visible to you."
|
421 |
msgstr ""
|
422 |
|
423 |
-
#: classes/frontend_checks.php:
|
424 |
msgid "Just click on your problem to learn more from our knowledge base."
|
425 |
msgstr ""
|
426 |
|
427 |
-
#: classes/frontend_checks.php:
|
428 |
msgid "I want to disable AdSense Auto ads"
|
429 |
msgstr ""
|
430 |
|
431 |
-
#: classes/frontend_checks.php:
|
432 |
msgid "I don’t see any Auto ads"
|
433 |
msgstr ""
|
434 |
|
435 |
-
#: classes/frontend_checks.php:
|
436 |
msgid "I only see blank space"
|
437 |
msgstr ""
|
438 |
|
439 |
-
#: classes/frontend_checks.php:
|
440 |
msgid "I want to change the position of the ads"
|
441 |
msgstr ""
|
442 |
|
443 |
-
#: classes/frontend_checks.php:
|
444 |
#: modules/gadsense/includes/class-network-adsense.php:202
|
445 |
msgid "Display Auto ads only on specific pages"
|
446 |
msgstr ""
|
447 |
|
448 |
-
#: classes/frontend_checks.php:
|
449 |
msgid "How to look for the Auto ads code"
|
450 |
msgstr ""
|
451 |
|
452 |
-
#: classes/frontend_checks.php:
|
453 |
msgid "I have another question or problem"
|
454 |
msgstr ""
|
455 |
|
456 |
-
#: classes/frontend_checks.php:
|
457 |
msgid "Closing the message"
|
458 |
msgstr ""
|
459 |
|
@@ -542,16 +543,16 @@ msgstr ""
|
|
542 |
msgid "browser width"
|
543 |
msgstr ""
|
544 |
|
545 |
-
#: classes/visitor-conditions.php:311 classes/display-conditions.php:
|
546 |
-
#: admin/class-advanced-ads-admin.php:
|
547 |
#: modules/gadsense/admin/views/external-ads-links.php:17
|
548 |
#: modules/gadsense/admin/views/external-ads-links.php:22
|
549 |
#: modules/gadsense/admin/views/external-ads-links.php:29
|
550 |
msgid "or"
|
551 |
msgstr ""
|
552 |
|
553 |
-
#: classes/visitor-conditions.php:311 classes/display-conditions.php:
|
554 |
-
#: admin/class-advanced-ads-admin.php:
|
555 |
msgid "and"
|
556 |
msgstr ""
|
557 |
|
@@ -565,159 +566,167 @@ msgid ""
|
|
565 |
"image upload or styling, but also simple text/html mode for scripts and code."
|
566 |
msgstr ""
|
567 |
|
568 |
-
#: classes/display-conditions.php:
|
569 |
msgid "post type"
|
570 |
msgstr ""
|
571 |
|
572 |
-
#: classes/display-conditions.php:
|
573 |
msgid "Choose the public post types on which to display the ad."
|
574 |
msgstr ""
|
575 |
|
576 |
-
#: classes/display-conditions.php:
|
577 |
msgid "specific pages"
|
578 |
msgstr ""
|
579 |
|
580 |
-
#: classes/display-conditions.php:
|
581 |
msgid ""
|
582 |
"Choose on which individual posts, pages and public post type pages you want "
|
583 |
"to display or hide ads."
|
584 |
msgstr ""
|
585 |
|
586 |
-
#: classes/display-conditions.php:
|
587 |
msgid "general conditions"
|
588 |
msgstr ""
|
589 |
|
590 |
-
#: classes/display-conditions.php:
|
591 |
msgid "author"
|
592 |
msgstr ""
|
593 |
|
594 |
-
#: classes/display-conditions.php:
|
595 |
msgid "content age"
|
596 |
msgstr ""
|
597 |
|
598 |
-
#: classes/display-conditions.php:
|
599 |
msgid "Display ads based on age of the page."
|
600 |
msgstr ""
|
601 |
|
602 |
-
#: classes/display-conditions.php:
|
603 |
msgid "taxonomy"
|
604 |
msgstr ""
|
605 |
|
606 |
-
#: classes/display-conditions.php:
|
607 |
msgid "Display ads based on the taxonomy of an archive page."
|
608 |
msgstr ""
|
609 |
|
610 |
-
#: classes/display-conditions.php:
|
611 |
#, php-format
|
612 |
msgid "archive: %s"
|
613 |
msgstr ""
|
614 |
|
615 |
-
#: classes/display-conditions.php:
|
616 |
msgid "parent page"
|
617 |
msgstr ""
|
618 |
|
619 |
-
#: classes/display-conditions.php:
|
620 |
msgid "post meta"
|
621 |
msgstr ""
|
622 |
|
623 |
-
#: classes/display-conditions.php:
|
624 |
msgid "page template"
|
625 |
msgstr ""
|
626 |
|
627 |
-
#: classes/display-conditions.php:
|
628 |
msgid "url parameters"
|
629 |
msgstr ""
|
630 |
|
631 |
-
#: classes/display-conditions.php:
|
632 |
msgid "accelerated mobile pages"
|
633 |
msgstr ""
|
634 |
|
635 |
-
#: classes/display-conditions.php:
|
636 |
msgctxt "display the terms search field on ad edit page"
|
637 |
msgid "add more terms"
|
638 |
msgstr ""
|
639 |
|
640 |
-
#: classes/display-conditions.php:
|
641 |
msgid "term name or id"
|
642 |
msgstr ""
|
643 |
|
644 |
-
#: classes/display-conditions.php:
|
645 |
msgid "title or id"
|
646 |
msgstr ""
|
647 |
|
648 |
-
#: classes/display-conditions.php:
|
649 |
msgid "Home Page"
|
650 |
msgstr ""
|
651 |
|
652 |
-
#: classes/display-conditions.php:
|
653 |
msgid "show on Home page"
|
654 |
msgstr ""
|
655 |
|
656 |
-
#: classes/display-conditions.php:
|
657 |
msgid "Singular Pages"
|
658 |
msgstr ""
|
659 |
|
660 |
-
#: classes/display-conditions.php:
|
661 |
msgid "show on singular pages/posts"
|
662 |
msgstr ""
|
663 |
|
664 |
-
#: classes/display-conditions.php:
|
665 |
msgid "Archive Pages"
|
666 |
msgstr ""
|
667 |
|
668 |
-
#: classes/display-conditions.php:
|
669 |
msgid "show on any type of archive page (category, tag, author and date)"
|
670 |
msgstr ""
|
671 |
|
672 |
-
#: classes/display-conditions.php:
|
673 |
msgid "Search Results"
|
674 |
msgstr ""
|
675 |
|
676 |
-
#: classes/display-conditions.php:
|
677 |
msgid "show on search result pages"
|
678 |
msgstr ""
|
679 |
|
680 |
-
#: classes/display-conditions.php:
|
681 |
msgid "404 Page"
|
682 |
msgstr ""
|
683 |
|
684 |
-
#: classes/display-conditions.php:
|
685 |
msgid "show on 404 error page"
|
686 |
msgstr ""
|
687 |
|
688 |
-
#: classes/display-conditions.php:
|
689 |
msgid "Attachment Pages"
|
690 |
msgstr ""
|
691 |
|
692 |
-
#: classes/display-conditions.php:
|
693 |
msgid "show on attachment pages"
|
694 |
msgstr ""
|
695 |
|
696 |
-
#: classes/display-conditions.php:
|
697 |
msgid "Secondary Queries"
|
698 |
msgstr ""
|
699 |
|
700 |
-
#: classes/display-conditions.php:
|
701 |
msgid "allow ads in secondary queries"
|
702 |
msgstr ""
|
703 |
|
704 |
-
#: classes/display-conditions.php:
|
705 |
msgid "RSS Feed"
|
706 |
msgstr ""
|
707 |
|
708 |
-
#: classes/display-conditions.php:
|
709 |
msgid "allow ads in RSS Feed"
|
710 |
msgstr ""
|
711 |
|
712 |
-
#: classes/display-conditions.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
713 |
msgid "older than"
|
714 |
msgstr ""
|
715 |
|
716 |
-
#: classes/display-conditions.php:
|
717 |
msgid "younger than"
|
718 |
msgstr ""
|
719 |
|
720 |
-
#: classes/display-conditions.php:
|
721 |
msgid "days"
|
722 |
msgstr ""
|
723 |
|
@@ -754,11 +763,11 @@ msgid "main query"
|
|
754 |
msgstr ""
|
755 |
|
756 |
#: classes/ad-debug.php:118 classes/ad-debug.php:167 classes/ad-debug.php:169
|
757 |
-
#: public/class-advanced-ads.php:
|
758 |
msgid "Ad"
|
759 |
msgstr ""
|
760 |
|
761 |
-
#: classes/ad-debug.php:121 public/class-advanced-ads.php:
|
762 |
msgctxt "ad group singular name"
|
763 |
msgid "Ad Group"
|
764 |
msgstr ""
|
@@ -767,11 +776,11 @@ msgstr ""
|
|
767 |
msgid "Placement"
|
768 |
msgstr ""
|
769 |
|
770 |
-
#: classes/ad-debug.php:152 admin/includes/class-meta-box.php:
|
771 |
msgid "Display Conditions"
|
772 |
msgstr ""
|
773 |
|
774 |
-
#: classes/ad-debug.php:239 admin/includes/class-meta-box.php:
|
775 |
msgid "Visitor Conditions"
|
776 |
msgstr ""
|
777 |
|
@@ -783,27 +792,27 @@ msgstr ""
|
|
783 |
msgid "Title:"
|
784 |
msgstr ""
|
785 |
|
786 |
-
#: classes/widget.php:76 admin/includes/class-shortcode-creator.php:
|
787 |
#: modules/gutenberg/includes/class-gutenberg.php:77
|
788 |
msgid "--empty--"
|
789 |
msgstr ""
|
790 |
|
791 |
-
#: classes/widget.php:78 admin/includes/class-menu.php:
|
792 |
-
#: admin/includes/class-shortcode-creator.php:
|
793 |
#: modules/gutenberg/includes/class-gutenberg.php:81
|
794 |
#: modules/import-export/views/page.php:25
|
795 |
msgid "Placements"
|
796 |
msgstr ""
|
797 |
|
798 |
-
#: classes/widget.php:85 admin/includes/class-shortcode-creator.php:
|
799 |
#: admin/views/placements-item.php:4 admin/views/placement-form.php:45
|
800 |
#: modules/gutenberg/includes/class-gutenberg.php:80
|
801 |
msgid "Ad Groups"
|
802 |
msgstr ""
|
803 |
|
804 |
-
#: classes/widget.php:92 public/class-advanced-ads.php:
|
805 |
-
#: admin/includes/class-menu.php:
|
806 |
-
#: admin/includes/class-shortcode-creator.php:
|
807 |
#: admin/views/placements-item.php:16 admin/views/ad-group-list-form-row.php:90
|
808 |
#: admin/views/placement-form.php:52 admin/views/ad-group-list-header.php:17
|
809 |
#: modules/gutenberg/includes/class-gutenberg.php:79
|
@@ -845,144 +854,144 @@ msgstr ""
|
|
845 |
msgid "Individual Posts, Pages and Public Post Types"
|
846 |
msgstr ""
|
847 |
|
848 |
-
#: admin/class-advanced-ads-admin.php:
|
849 |
msgid "After which paragraph?"
|
850 |
msgstr ""
|
851 |
|
852 |
-
#: admin/class-advanced-ads-admin.php:
|
853 |
msgid "Today"
|
854 |
msgstr ""
|
855 |
|
856 |
-
#: admin/class-advanced-ads-admin.php:
|
857 |
msgid "Yesterday"
|
858 |
msgstr ""
|
859 |
|
860 |
-
#: admin/class-advanced-ads-admin.php:
|
861 |
msgid "This Month"
|
862 |
msgstr ""
|
863 |
|
864 |
#. 1: The number of days.
|
865 |
-
#: admin/class-advanced-ads-admin.php:
|
866 |
#, php-format
|
867 |
msgid "Last %1$d days"
|
868 |
msgstr ""
|
869 |
|
870 |
-
#: admin/class-advanced-ads-admin.php:
|
871 |
msgid "All"
|
872 |
msgstr ""
|
873 |
|
874 |
-
#: admin/class-advanced-ads-admin.php:
|
875 |
msgid ""
|
876 |
"There were no results returned for this ad. Please make sure it is active, "
|
877 |
"generating impressions and double check your ad parameters."
|
878 |
msgstr ""
|
879 |
|
880 |
-
#: admin/class-advanced-ads-admin.php:
|
881 |
#: modules/gadsense/admin/views/external-ads-list.php:33
|
882 |
msgid "Show inactive ads"
|
883 |
msgstr ""
|
884 |
|
885 |
-
#: admin/class-advanced-ads-admin.php:
|
886 |
msgid "Hide inactive ads"
|
887 |
msgstr ""
|
888 |
|
889 |
-
#: admin/class-advanced-ads-admin.php:
|
890 |
msgid "There has been an AJAX error caused by another plugin."
|
891 |
msgstr ""
|
892 |
|
893 |
#. %1$s is an opening link tag, %2$s is a closing one.
|
894 |
-
#: admin/class-advanced-ads-admin.php:
|
895 |
#, php-format
|
896 |
msgid "Please contact our %1$ssupport%2$s."
|
897 |
msgstr ""
|
898 |
|
899 |
-
#: admin/class-advanced-ads-admin.php:
|
900 |
#, php-format
|
901 |
msgid "time of %s"
|
902 |
msgstr ""
|
903 |
|
904 |
-
#: admin/class-advanced-ads-admin.php:
|
905 |
-
#: admin/includes/class-menu.php:
|
906 |
msgid "Support"
|
907 |
msgstr ""
|
908 |
|
909 |
-
#: admin/class-advanced-ads-admin.php:
|
910 |
-
#: admin/includes/class-overview-widgets.php:
|
911 |
msgid "Add-Ons"
|
912 |
msgstr ""
|
913 |
|
914 |
-
#: admin/class-advanced-ads-admin.php:
|
915 |
-
#: admin/includes/class-overview-widgets.php:
|
916 |
#, php-format
|
917 |
msgid ""
|
918 |
"Thank the developer with a ★★★★★ review on <a "
|
919 |
"href=\"%s\" target=\"_blank\">wordpress.org</a>"
|
920 |
msgstr ""
|
921 |
|
922 |
-
#: public/class-advanced-ads.php:
|
923 |
msgid "Advanced Ads Error following:"
|
924 |
msgstr ""
|
925 |
|
926 |
-
#: public/class-advanced-ads.php:
|
927 |
#, php-format
|
928 |
msgid "Advanced Ads Error: %s"
|
929 |
msgstr ""
|
930 |
|
931 |
-
#: public/class-advanced-ads.php:
|
932 |
msgctxt "ad group general name"
|
933 |
msgid "Ad Groups & Rotations"
|
934 |
msgstr ""
|
935 |
|
936 |
-
#: public/class-advanced-ads.php:
|
937 |
msgid "Search Ad Groups"
|
938 |
msgstr ""
|
939 |
|
940 |
-
#: public/class-advanced-ads.php:
|
941 |
msgid "All Ad Groups"
|
942 |
msgstr ""
|
943 |
|
944 |
-
#: public/class-advanced-ads.php:
|
945 |
msgid "Parent Ad Groups"
|
946 |
msgstr ""
|
947 |
|
948 |
-
#: public/class-advanced-ads.php:
|
949 |
msgid "Parent Ad Groups:"
|
950 |
msgstr ""
|
951 |
|
952 |
-
#: public/class-advanced-ads.php:
|
953 |
msgid "Edit Ad Group"
|
954 |
msgstr ""
|
955 |
|
956 |
-
#: public/class-advanced-ads.php:
|
957 |
msgid "Update Ad Group"
|
958 |
msgstr ""
|
959 |
|
960 |
-
#: public/class-advanced-ads.php:
|
961 |
msgid "Add New Ad Group"
|
962 |
msgstr ""
|
963 |
|
964 |
-
#: public/class-advanced-ads.php:
|
965 |
msgid "New Ad Groups Name"
|
966 |
msgstr ""
|
967 |
|
968 |
-
#: public/class-advanced-ads.php:
|
969 |
msgid "Groups"
|
970 |
msgstr ""
|
971 |
|
972 |
-
#: public/class-advanced-ads.php:
|
973 |
msgid "No Ad Group found"
|
974 |
msgstr ""
|
975 |
|
976 |
-
#: public/class-advanced-ads.php:
|
977 |
-
#: admin/includes/class-menu.php:
|
978 |
msgid "New Ad"
|
979 |
msgstr ""
|
980 |
|
981 |
-
#: public/class-advanced-ads.php:
|
982 |
msgid "Add New Ad"
|
983 |
msgstr ""
|
984 |
|
985 |
-
#: public/class-advanced-ads.php:
|
986 |
#: admin/includes/class-ad-groups-list.php:339
|
987 |
#: modules/import-export/classes/import.php:146
|
988 |
#: modules/import-export/classes/import.php:186
|
@@ -990,35 +999,35 @@ msgstr ""
|
|
990 |
msgid "Edit"
|
991 |
msgstr ""
|
992 |
|
993 |
-
#: public/class-advanced-ads.php:
|
994 |
msgid "Edit Ad"
|
995 |
msgstr ""
|
996 |
|
997 |
-
#: public/class-advanced-ads.php:
|
998 |
msgid "View"
|
999 |
msgstr ""
|
1000 |
|
1001 |
-
#: public/class-advanced-ads.php:
|
1002 |
msgid "View the Ad"
|
1003 |
msgstr ""
|
1004 |
|
1005 |
-
#: public/class-advanced-ads.php:
|
1006 |
msgid "Search Ads"
|
1007 |
msgstr ""
|
1008 |
|
1009 |
-
#: public/class-advanced-ads.php:
|
1010 |
msgid "No Ads found"
|
1011 |
msgstr ""
|
1012 |
|
1013 |
-
#: public/class-advanced-ads.php:
|
1014 |
msgid "No Ads found in Trash"
|
1015 |
msgstr ""
|
1016 |
|
1017 |
-
#: public/class-advanced-ads.php:
|
1018 |
msgid "Parent Ad"
|
1019 |
msgstr ""
|
1020 |
|
1021 |
-
#: public/class-advanced-ads.php:
|
1022 |
msgctxt "label above ads"
|
1023 |
msgid "Advertisements"
|
1024 |
msgstr ""
|
@@ -1072,13 +1081,13 @@ msgid ""
|
|
1072 |
"disguise."
|
1073 |
msgstr ""
|
1074 |
|
1075 |
-
#: admin/includes/ad-health-notices.php:99 admin/includes/notices.php:
|
1076 |
msgid ""
|
1077 |
"One or more license keys for <strong>Advanced Ads add-ons are invalid or "
|
1078 |
"missing</strong>."
|
1079 |
msgstr ""
|
1080 |
|
1081 |
-
#: admin/includes/ad-health-notices.php:102 admin/includes/notices.php:
|
1082 |
#, php-format
|
1083 |
msgid "Please add valid license keys <a href=\"%s\">here</a>."
|
1084 |
msgstr ""
|
@@ -1248,62 +1257,62 @@ msgid ""
|
|
1248 |
"again to fix this."
|
1249 |
msgstr ""
|
1250 |
|
1251 |
-
#: admin/includes/notices.php:
|
1252 |
msgid ""
|
1253 |
"Thank you for activating <strong>Advanced Ads</strong>. Would you like to "
|
1254 |
"receive the first steps via email?"
|
1255 |
msgstr ""
|
1256 |
|
1257 |
-
#: admin/includes/notices.php:
|
1258 |
msgid "Yes, send it"
|
1259 |
msgstr ""
|
1260 |
|
1261 |
-
#: admin/includes/notices.php:
|
1262 |
msgid ""
|
1263 |
"Thank you for using <strong>Advanced Ads</strong>. Stay informed and receive "
|
1264 |
"<strong>2 free add-ons</strong> for joining the newsletter."
|
1265 |
msgstr ""
|
1266 |
|
1267 |
-
#: admin/includes/notices.php:
|
1268 |
msgid "Add me now"
|
1269 |
msgstr ""
|
1270 |
|
1271 |
-
#: admin/includes/notices.php:
|
1272 |
msgid ""
|
1273 |
"Learn more about how and <strong>how much you can earn with AdSense</strong> "
|
1274 |
"and Advanced Ads from my dedicated newsletter."
|
1275 |
msgstr ""
|
1276 |
|
1277 |
-
#: admin/includes/notices.php:
|
1278 |
#: admin/views/notices/inline.php:3
|
1279 |
msgid "Subscribe me now"
|
1280 |
msgstr ""
|
1281 |
|
1282 |
-
#: admin/includes/notices.php:
|
1283 |
msgid "… ads created using <strong>Advanced Ads</strong>."
|
1284 |
msgstr ""
|
1285 |
|
1286 |
-
#: admin/includes/notices.php:
|
1287 |
msgid ""
|
1288 |
"Do you find the plugin useful and would like to thank us for updates, fixing "
|
1289 |
"bugs and improving your ad setup?"
|
1290 |
msgstr ""
|
1291 |
|
1292 |
#. this belongs to our message asking the user for a review. You can find a nice equivalent in your own language
|
1293 |
-
#: admin/includes/notices.php:
|
1294 |
msgid "When you give 5-stars, an actual person does a little happy dance!"
|
1295 |
msgstr ""
|
1296 |
|
1297 |
-
#: admin/includes/notices.php:
|
1298 |
msgid "Sure, I appreciate your work"
|
1299 |
msgstr ""
|
1300 |
|
1301 |
-
#: admin/includes/notices.php:
|
1302 |
msgid "Yes, but help me first to solve a problem, please"
|
1303 |
msgstr ""
|
1304 |
|
1305 |
#. %s is a link. `30%%` is correct, please use exactly that value so that it shows "30%".
|
1306 |
-
#: admin/includes/notices.php:
|
1307 |
#, php-format
|
1308 |
msgid ""
|
1309 |
"Our Black Friday / Cyber Monday Offer: <span style=\"font-weight: bold; font-"
|
@@ -1312,89 +1321,92 @@ msgid ""
|
|
1312 |
"Access</a>"
|
1313 |
msgstr ""
|
1314 |
|
1315 |
-
#: admin/includes/class-list-filters.php:
|
1316 |
#: modules/gadsense/admin/admin.php:25
|
1317 |
#: modules/gadsense/admin/views/adsense-ad-parameters.php:109
|
1318 |
msgid "Responsive"
|
1319 |
msgstr ""
|
1320 |
|
1321 |
-
#: admin/includes/class-list-filters.php:
|
1322 |
msgid "expired"
|
1323 |
msgstr ""
|
1324 |
|
1325 |
-
#: admin/includes/class-list-filters.php:
|
1326 |
msgid "any expiry date"
|
1327 |
msgstr ""
|
1328 |
|
1329 |
-
#: admin/includes/class-meta-box.php:
|
1330 |
msgid "Ad Type"
|
1331 |
msgstr ""
|
1332 |
|
1333 |
-
#: admin/includes/class-meta-box.php:
|
1334 |
-
#: admin/includes/class-overview-widgets.php:
|
1335 |
msgid "AdSense Earnings"
|
1336 |
msgstr ""
|
1337 |
|
1338 |
-
#: admin/includes/class-meta-box.php:
|
1339 |
msgid "Ad Parameters"
|
1340 |
msgstr ""
|
1341 |
|
1342 |
-
#: admin/includes/class-meta-box.php:
|
1343 |
msgid "Layout / Output"
|
1344 |
msgstr ""
|
1345 |
|
1346 |
-
#: admin/includes/class-meta-box.php:
|
1347 |
msgid "Increase your ad revenue"
|
1348 |
msgstr ""
|
1349 |
|
1350 |
-
#: admin/includes/class-meta-box.php:
|
1351 |
msgid "Ad Stats"
|
1352 |
msgstr ""
|
1353 |
|
1354 |
-
#: admin/includes/class-meta-box.php:
|
1355 |
-
#: admin/includes/class-meta-box.php:
|
|
|
1356 |
#: admin/views/ad-output-metabox.php:82
|
|
|
1357 |
#: modules/privacy/admin/views/setting-enable.php:2
|
1358 |
#: modules/ads-txt/admin/views/setting-create.php:11
|
1359 |
msgid "Manual"
|
1360 |
msgstr ""
|
1361 |
|
1362 |
-
#: admin/includes/class-meta-box.php:
|
1363 |
msgid "Video"
|
1364 |
msgstr ""
|
1365 |
|
1366 |
-
#: admin/includes/class-meta-box.php:
|
1367 |
-
#: admin/includes/class-overview-widgets.php:
|
1368 |
msgid "Disable"
|
1369 |
msgstr ""
|
1370 |
|
1371 |
-
#: admin/includes/class-meta-box.php:
|
1372 |
msgid "Ad Settings"
|
1373 |
msgstr ""
|
1374 |
|
1375 |
-
#: admin/includes/class-meta-box.php:
|
1376 |
msgid "Ads Dashboard"
|
1377 |
msgstr ""
|
1378 |
|
1379 |
-
|
|
|
1380 |
#, php-format
|
1381 |
-
msgid "%d ads – <a href=\"%s\">manage</a> - <a href=\"%s\">new</a>"
|
1382 |
msgstr ""
|
1383 |
|
1384 |
-
#: admin/includes/class-meta-box.php:
|
1385 |
msgid "Get the tutorial via email"
|
1386 |
msgstr ""
|
1387 |
|
1388 |
-
#: admin/includes/class-meta-box.php:
|
1389 |
msgid "Get AdSense tips via email"
|
1390 |
msgstr ""
|
1391 |
|
1392 |
-
#: admin/includes/class-meta-box.php:
|
1393 |
msgid "Visit our blog for more articles about ad optimization"
|
1394 |
msgstr ""
|
1395 |
|
1396 |
#. %s is our URL
|
1397 |
-
#: admin/includes/class-meta-box.php:
|
1398 |
msgid "Latest posts on wpadvancedads.com"
|
1399 |
msgstr ""
|
1400 |
|
@@ -1410,7 +1422,7 @@ msgstr ""
|
|
1410 |
msgid "Error while trying to register the license. Please contact support."
|
1411 |
msgstr ""
|
1412 |
|
1413 |
-
#: admin/includes/class-licenses.php:115 admin/views/setting-license.php:
|
1414 |
msgid "Please enter a valid license key"
|
1415 |
msgstr ""
|
1416 |
|
@@ -1469,273 +1481,163 @@ msgid ""
|
|
1469 |
"."
|
1470 |
msgstr ""
|
1471 |
|
1472 |
-
#: admin/includes/shortcode-creator-l10n.php:
|
1473 |
msgctxt "shortcode creator"
|
1474 |
msgid "Add an ad"
|
1475 |
msgstr ""
|
1476 |
|
1477 |
-
#: admin/includes/shortcode-creator-l10n.php:
|
1478 |
msgctxt "shortcode creator"
|
1479 |
msgid "Add shortcode"
|
1480 |
msgstr ""
|
1481 |
|
1482 |
-
#: admin/includes/shortcode-creator-l10n.php:
|
1483 |
msgctxt "shortcode creator"
|
1484 |
msgid "Cancel"
|
1485 |
msgstr ""
|
1486 |
|
1487 |
-
#: admin/includes/class-notices.php:
|
1488 |
#, php-format
|
1489 |
msgid ""
|
1490 |
"You don’t seem to have an email address. Please use <a href=\"%s\" "
|
1491 |
"target=\"_blank\">this form</a> to sign up."
|
1492 |
msgstr ""
|
1493 |
|
1494 |
-
#: admin/includes/class-notices.php:
|
1495 |
msgid ""
|
1496 |
"How embarrassing. The email server seems to be down. Please try again later."
|
1497 |
msgstr ""
|
1498 |
|
1499 |
-
|
|
|
1500 |
#, php-format
|
1501 |
msgid ""
|
1502 |
-
"Please check your email (%s) for the confirmation message. If you didn’t "
|
1503 |
"receive one or want to use another email address then please use <a "
|
1504 |
-
"href=\"%s\" target=\"_blank\">this form</a> to sign up."
|
1505 |
msgstr ""
|
1506 |
|
1507 |
-
#: admin/includes/class-menu.php:
|
1508 |
-
#: admin/includes/class-menu.php:
|
1509 |
msgid "Overview"
|
1510 |
msgstr ""
|
1511 |
|
1512 |
-
#: admin/includes/class-menu.php:
|
1513 |
msgid "Ad Groups & Rotations"
|
1514 |
msgstr ""
|
1515 |
|
1516 |
-
#: admin/includes/class-menu.php:
|
1517 |
msgid "Groups & Rotation"
|
1518 |
msgstr ""
|
1519 |
|
1520 |
-
#: admin/includes/class-menu.php:
|
1521 |
msgid "Ad Placements"
|
1522 |
msgstr ""
|
1523 |
|
1524 |
-
#: admin/includes/class-menu.php:
|
1525 |
msgid "Advanced Ads Settings"
|
1526 |
msgstr ""
|
1527 |
|
1528 |
-
#: admin/includes/class-menu.php:
|
1529 |
msgid "Settings"
|
1530 |
msgstr ""
|
1531 |
|
1532 |
-
#: admin/includes/class-menu.php:
|
1533 |
-
#: admin/includes/class-settings.php:
|
1534 |
msgid "Licenses"
|
1535 |
msgstr ""
|
1536 |
|
1537 |
-
#: admin/includes/class-menu.php:
|
1538 |
msgid "Sorry, you are not allowed to access this feature."
|
1539 |
msgstr ""
|
1540 |
|
1541 |
-
#: admin/includes/class-menu.php:
|
1542 |
msgid ""
|
1543 |
"You attempted to edit an ad group that doesn’t exist. Perhaps it was "
|
1544 |
"deleted?"
|
1545 |
msgstr ""
|
1546 |
|
1547 |
-
#: admin/includes/class-settings.php:
|
1548 |
msgid "Admin"
|
1549 |
msgstr ""
|
1550 |
|
1551 |
-
#: admin/includes/class-settings.php:
|
1552 |
msgid "Disable ads"
|
1553 |
msgstr ""
|
1554 |
|
1555 |
-
#: admin/includes/class-settings.php:
|
1556 |
msgid "Content injection"
|
1557 |
msgstr ""
|
1558 |
|
1559 |
-
#: admin/includes/class-settings.php:
|
1560 |
msgid "Hide ads for user roles"
|
1561 |
msgstr ""
|
1562 |
|
1563 |
-
#: admin/includes/class-settings.php:
|
1564 |
msgid "Unlimited ad injection"
|
1565 |
msgstr ""
|
1566 |
|
1567 |
-
#: admin/includes/class-settings.php:
|
1568 |
msgid "Priority of content injection filter"
|
1569 |
msgstr ""
|
1570 |
|
1571 |
-
#: admin/includes/class-settings.php:
|
1572 |
msgid "Hide ads from bots"
|
1573 |
msgstr ""
|
1574 |
|
1575 |
-
#: admin/includes/class-settings.php:
|
1576 |
msgid "Disable ads for post types"
|
1577 |
msgstr ""
|
1578 |
|
1579 |
-
#: admin/includes/class-settings.php:
|
1580 |
msgid "Disable Ad Health and other notices"
|
1581 |
msgstr ""
|
1582 |
|
1583 |
-
#: admin/includes/class-settings.php:
|
1584 |
msgid "ID prefix"
|
1585 |
msgstr ""
|
1586 |
|
1587 |
-
#: admin/includes/class-settings.php:
|
1588 |
msgid "Allow editors to manage ads"
|
1589 |
msgstr ""
|
1590 |
|
1591 |
-
#: admin/includes/class-settings.php:
|
1592 |
msgid "Ad label"
|
1593 |
msgstr ""
|
1594 |
|
1595 |
-
#: admin/includes/class-settings.php:
|
1596 |
msgid "Open links in a new window"
|
1597 |
msgstr ""
|
1598 |
|
1599 |
-
#: admin/includes/class-settings.php:
|
1600 |
msgid "Use advanced JavaScript"
|
1601 |
msgstr ""
|
1602 |
|
1603 |
-
#: admin/includes/class-settings.php:
|
1604 |
msgid "Delete data on uninstall"
|
1605 |
msgstr ""
|
1606 |
|
1607 |
-
#: admin/includes/class-settings.php:
|
1608 |
msgid "Disable shortcode button"
|
1609 |
msgstr ""
|
1610 |
|
1611 |
-
#: admin/includes/class-settings.php:
|
1612 |
msgid "Pro"
|
1613 |
msgstr ""
|
1614 |
|
1615 |
-
#: admin/includes/class-settings.php:
|
1616 |
msgid "Tracking"
|
1617 |
msgstr ""
|
1618 |
|
1619 |
-
#: admin/includes/class-settings.php:
|
1620 |
-
#, php-format
|
1621 |
-
msgid ""
|
1622 |
-
"Enter license keys for our powerful <a href=\"%s\" target=\"_blank\">add-"
|
1623 |
-
"ons</a>."
|
1624 |
-
msgstr ""
|
1625 |
-
|
1626 |
-
#: admin/includes/class-settings.php:351
|
1627 |
-
#, php-format
|
1628 |
-
msgid ""
|
1629 |
-
"See also <a href=\"%s\" target=\"_blank\">Issues and questions about "
|
1630 |
-
"licenses</a>."
|
1631 |
-
msgstr ""
|
1632 |
-
|
1633 |
-
#: admin/includes/class-settings.php:363
|
1634 |
msgid "Are you missing something?"
|
1635 |
msgstr ""
|
1636 |
|
1637 |
-
#: admin/includes/class-settings.php:
|
1638 |
-
msgid "Choose the roles a user must have in order to not see any ads."
|
1639 |
-
msgstr ""
|
1640 |
-
|
1641 |
-
#: admin/includes/class-settings.php:445
|
1642 |
-
msgid ""
|
1643 |
-
"<strong>notice: </strong>the file is currently enabled by an add-on that "
|
1644 |
-
"needs it."
|
1645 |
-
msgstr ""
|
1646 |
-
|
1647 |
-
#: admin/includes/class-settings.php:448
|
1648 |
-
#, php-format
|
1649 |
-
msgid ""
|
1650 |
-
"Enable advanced JavaScript functions (<a href=\"%s\" target=\"_blank\">"
|
1651 |
-
"here</a>). Some features and add-ons might override this setting if they "
|
1652 |
-
"need features from this file."
|
1653 |
-
msgstr ""
|
1654 |
-
|
1655 |
-
#: admin/includes/class-settings.php:468
|
1656 |
-
msgid ""
|
1657 |
-
"Some plugins and themes trigger ad injections where it shouldn’t happen. "
|
1658 |
-
"Therefore, Advanced Ads ignores injected placements on non-singular pages "
|
1659 |
-
"and outside the loop. However, this can cause problems with some themes. Set "
|
1660 |
-
"this option to -1 in order to enable unlimited ad injection at your own risk,"
|
1661 |
-
" set it to 0 to keep it disabled or choose a positive number to enable the "
|
1662 |
-
"injection only in the first x posts on your archive pages."
|
1663 |
-
msgstr ""
|
1664 |
-
|
1665 |
-
#: admin/includes/class-settings.php:484
|
1666 |
-
msgid ""
|
1667 |
-
"Please check your post content. A priority of 10 and below might cause "
|
1668 |
-
"issues (wpautop function might run twice)."
|
1669 |
-
msgstr ""
|
1670 |
-
|
1671 |
-
#: admin/includes/class-settings.php:486
|
1672 |
-
msgid ""
|
1673 |
-
"Play with this value in order to change the priority of the injected ads "
|
1674 |
-
"compared to other auto injected elements in the post content."
|
1675 |
-
msgstr ""
|
1676 |
-
|
1677 |
-
#: admin/includes/class-settings.php:500
|
1678 |
-
msgid ""
|
1679 |
-
"Advanced Ads ignores paragraphs and other elements in containers when "
|
1680 |
-
"injecting ads into the post content. Check this option to ignore this "
|
1681 |
-
"limitation and ads might show up again."
|
1682 |
-
msgstr ""
|
1683 |
-
|
1684 |
-
#: admin/includes/class-settings.php:516
|
1685 |
-
msgid "Read this first"
|
1686 |
-
msgstr ""
|
1687 |
-
|
1688 |
-
#: admin/includes/class-settings.php:517
|
1689 |
-
msgid "Hide ads from crawlers, bots and empty user agents."
|
1690 |
-
msgstr ""
|
1691 |
-
|
1692 |
-
#: admin/includes/class-settings.php:530
|
1693 |
-
msgid "Pro feature"
|
1694 |
-
msgstr ""
|
1695 |
-
|
1696 |
-
#. %1$s is a starting <a> tag and %2$s a closing one
|
1697 |
-
#: admin/includes/class-settings.php:548
|
1698 |
-
#, php-format
|
1699 |
-
msgid ""
|
1700 |
-
"Disable %1$sAd Health%2$s in frontend and backend, warnings and internal "
|
1701 |
-
"notices like tips, tutorials, email newsletters and update notices."
|
1702 |
-
msgstr ""
|
1703 |
-
|
1704 |
-
#: admin/includes/class-settings.php:566
|
1705 |
-
msgid ""
|
1706 |
-
"Prefix of class or id attributes in the frontend. Change it if you don’t "
|
1707 |
-
"want <strong>ad blockers</strong> to mark these blocks as ads.<br/>You might "
|
1708 |
-
"need to <strong>rewrite css rules afterwards</strong>."
|
1709 |
-
msgstr ""
|
1710 |
-
|
1711 |
-
#: admin/includes/class-settings.php:585
|
1712 |
-
msgid "Allow editors to also manage and publish ads."
|
1713 |
-
msgstr ""
|
1714 |
-
|
1715 |
-
#: admin/includes/class-settings.php:586
|
1716 |
-
#, php-format
|
1717 |
-
msgid ""
|
1718 |
-
"You can assign different ad-related roles on a user basis with <a "
|
1719 |
-
"href=\"%s\" target=\"_blank\">Advanced Ads Pro</a>."
|
1720 |
-
msgstr ""
|
1721 |
-
|
1722 |
-
#: admin/includes/class-settings.php:597
|
1723 |
msgctxt "label before ads"
|
1724 |
msgid "Advertisements"
|
1725 |
msgstr ""
|
1726 |
|
1727 |
-
#: admin/includes/class-settings.php:606
|
1728 |
-
msgid "Displayed above ads."
|
1729 |
-
msgstr ""
|
1730 |
-
|
1731 |
-
#: admin/includes/class-settings.php:642
|
1732 |
-
msgid "Clean up all data related to Advanced Ads when removing the plugin."
|
1733 |
-
msgstr ""
|
1734 |
-
|
1735 |
-
#: admin/includes/class-settings.php:655
|
1736 |
-
msgid "Disable shortcode button in visual editor."
|
1737 |
-
msgstr ""
|
1738 |
-
|
1739 |
#: admin/includes/class-ad-groups-list.php:172
|
1740 |
msgid "Ad weight"
|
1741 |
msgstr ""
|
@@ -1818,229 +1720,223 @@ msgstr ""
|
|
1818 |
msgid "No ad group created"
|
1819 |
msgstr ""
|
1820 |
|
1821 |
-
#: admin/includes/class-shortcode-creator.php:
|
1822 |
#, php-format
|
1823 |
msgid ""
|
1824 |
"Please, either switch off your ad blocker or disable the shortcode button in "
|
1825 |
"the <a href=\"%s\" target=\"_blank\">settings</a>."
|
1826 |
msgstr ""
|
1827 |
|
1828 |
-
#: admin/includes/class-overview-widgets.php:
|
1829 |
msgid "Next steps"
|
1830 |
msgstr ""
|
1831 |
|
1832 |
-
#: admin/includes/class-overview-widgets.php:
|
1833 |
msgid "Manual and Support"
|
1834 |
msgstr ""
|
1835 |
|
1836 |
-
#: admin/includes/class-overview-widgets.php:
|
1837 |
#: admin/views/notices/welcome-panel.php:15
|
1838 |
msgid "Create your first ad"
|
1839 |
msgstr ""
|
1840 |
|
1841 |
-
#: admin/includes/class-overview-widgets.php:
|
1842 |
#: modules/gadsense/admin/views/adsense-account.php:71
|
1843 |
#: modules/gadsense/admin/views/adsense-account.php:93
|
1844 |
msgid "Connect to AdSense"
|
1845 |
msgstr ""
|
1846 |
|
1847 |
-
#: admin/includes/class-overview-widgets.php:
|
1848 |
msgid "Join the newsletter for more benefits"
|
1849 |
msgstr ""
|
1850 |
|
1851 |
-
#: admin/includes/class-overview-widgets.php:
|
1852 |
msgid "Get 2 free add-ons"
|
1853 |
msgstr ""
|
1854 |
|
1855 |
-
#: admin/includes/class-overview-widgets.php:
|
1856 |
msgid "Get the first steps and more tutorials to your inbox"
|
1857 |
msgstr ""
|
1858 |
|
1859 |
-
#: admin/includes/class-overview-widgets.php:
|
1860 |
msgid "How to earn more with AdSense"
|
1861 |
msgstr ""
|
1862 |
|
1863 |
-
#: admin/includes/class-overview-widgets.php:
|
1864 |
msgid "Join now"
|
1865 |
msgstr ""
|
1866 |
|
1867 |
-
#: admin/includes/class-overview-widgets.php:
|
1868 |
msgid ""
|
1869 |
"Do you find Advanced Ads useful and would like to keep us motivated? Please "
|
1870 |
"help us with a review."
|
1871 |
msgstr ""
|
1872 |
|
1873 |
-
#: admin/includes/class-overview-widgets.php:
|
1874 |
msgid "Sure, I’ll rate the plugin"
|
1875 |
msgstr ""
|
1876 |
|
1877 |
-
#: admin/includes/class-overview-widgets.php:
|
1878 |
msgid "I already did"
|
1879 |
msgstr ""
|
1880 |
|
1881 |
-
#: admin/includes/class-overview-widgets.php:
|
1882 |
msgid "Manage your ads"
|
1883 |
msgstr ""
|
1884 |
|
1885 |
-
#: admin/includes/class-overview-widgets.php:
|
1886 |
msgid "Get the All Access pass"
|
1887 |
msgstr ""
|
1888 |
|
1889 |
-
#: admin/includes/class-overview-widgets.php:
|
1890 |
-
|
1891 |
-
msgid "<a href=\"%s\" target=\"_blank\">Manual</a>"
|
1892 |
-
msgstr ""
|
1893 |
-
|
1894 |
-
#: admin/includes/class-overview-widgets.php:180
|
1895 |
-
#, php-format
|
1896 |
-
msgid "<a href=\"%s\" target=\"_blank\">FAQ and Support</a>"
|
1897 |
msgstr ""
|
1898 |
|
1899 |
#. %s includes a number and markup like <span class="count">6</span>.
|
1900 |
-
#: admin/includes/class-overview-widgets.php:
|
1901 |
#: admin/views/overview-notices.php:17
|
1902 |
#, php-format
|
1903 |
msgid "Show %s hidden notices"
|
1904 |
msgstr ""
|
1905 |
|
1906 |
-
#: admin/includes/class-overview-widgets.php:
|
1907 |
msgid "How to install and activate an add-on."
|
1908 |
msgstr ""
|
1909 |
|
1910 |
-
#: admin/includes/class-overview-widgets.php:
|
1911 |
msgid "The solution for professional websites."
|
1912 |
msgstr ""
|
1913 |
|
1914 |
-
#: admin/includes/class-overview-widgets.php:
|
1915 |
#: admin/views/pitch-pro-tab.php:7
|
1916 |
msgid "support for cached sites"
|
1917 |
msgstr ""
|
1918 |
|
1919 |
-
#: admin/includes/class-overview-widgets.php:
|
1920 |
-
#: admin/includes/class-overview-widgets.php:
|
1921 |
-
#: admin/includes/class-overview-widgets.php:
|
1922 |
-
#: admin/includes/class-overview-widgets.php:
|
1923 |
#, php-format
|
1924 |
msgid "integrates with <strong>%s</strong>"
|
1925 |
msgstr ""
|
1926 |
|
1927 |
-
#: admin/includes/class-overview-widgets.php:
|
1928 |
msgid "click fraud protection, lazy load, ad-block ads"
|
1929 |
msgstr ""
|
1930 |
|
1931 |
-
#: admin/includes/class-overview-widgets.php:
|
1932 |
#: admin/views/pitch-pro-tab.php:8
|
1933 |
msgid "11 more display and visitor conditions"
|
1934 |
msgstr ""
|
1935 |
|
1936 |
-
#: admin/includes/class-overview-widgets.php:
|
1937 |
#: admin/views/pitch-pro-tab.php:9
|
1938 |
msgid "6 more placements"
|
1939 |
msgstr ""
|
1940 |
|
1941 |
-
#: admin/includes/class-overview-widgets.php:
|
1942 |
#: admin/views/pitch-pro-tab.php:10
|
1943 |
msgid "placement tests for ad optimization"
|
1944 |
msgstr ""
|
1945 |
|
1946 |
-
#: admin/includes/class-overview-widgets.php:
|
1947 |
#: admin/views/pitch-pro-tab.php:11
|
1948 |
msgid "ad grids and many more advanced features"
|
1949 |
msgstr ""
|
1950 |
|
1951 |
-
#: admin/includes/class-overview-widgets.php:
|
1952 |
msgid ""
|
1953 |
"Analyze clicks and impressions of your ads locally or in Google Analytics, "
|
1954 |
"share reports, and limit ads to a specific number of impressions or clicks."
|
1955 |
msgstr ""
|
1956 |
|
1957 |
-
#: admin/includes/class-overview-widgets.php:
|
1958 |
msgid ""
|
1959 |
"Display ads based on the device or the size of your visitor’s browser, and "
|
1960 |
"control ads on AMP pages."
|
1961 |
msgstr ""
|
1962 |
|
1963 |
-
#: admin/includes/class-overview-widgets.php:
|
1964 |
msgid ""
|
1965 |
"Earn more money and let advertisers pay for ad space directly on the "
|
1966 |
"frontend of your site."
|
1967 |
msgstr ""
|
1968 |
|
1969 |
-
#: admin/includes/class-overview-widgets.php:
|
1970 |
msgid ""
|
1971 |
"Target visitors with ads that match their geo location and make more money "
|
1972 |
"with regional campaigns."
|
1973 |
msgstr ""
|
1974 |
|
1975 |
-
#: admin/includes/class-overview-widgets.php:
|
1976 |
msgid ""
|
1977 |
"Increase click rates on your ads by placing them in sticky positions above, "
|
1978 |
"next or below your site."
|
1979 |
msgstr ""
|
1980 |
|
1981 |
-
#: admin/includes/class-overview-widgets.php:
|
1982 |
msgid ""
|
1983 |
"Users will never miss an ad or other information in a PopUp. Choose when it "
|
1984 |
"shows up and for how long a user can close it."
|
1985 |
msgstr ""
|
1986 |
|
1987 |
-
#: admin/includes/class-overview-widgets.php:
|
1988 |
msgid ""
|
1989 |
"Create a beautiful and simple slider from your ads to show more information "
|
1990 |
"on less space."
|
1991 |
msgstr ""
|
1992 |
|
1993 |
-
#: admin/includes/class-overview-widgets.php:
|
1994 |
msgid ""
|
1995 |
"Place AdSense In-feed ads between posts on homepage, category, and archive "
|
1996 |
"pages."
|
1997 |
msgstr ""
|
1998 |
|
1999 |
-
#: admin/includes/class-overview-widgets.php:
|
2000 |
-
#: admin/includes/class-overview-widgets.php:
|
2001 |
-
#: admin/includes/class-overview-widgets.php:
|
2002 |
msgid "Install now"
|
2003 |
msgstr ""
|
2004 |
|
2005 |
-
#: admin/includes/class-overview-widgets.php:
|
2006 |
-
#: admin/includes/class-overview-widgets.php:
|
2007 |
-
#: admin/includes/class-overview-widgets.php:
|
2008 |
-
#: admin/includes/class-overview-widgets.php:
|
2009 |
-
#: admin/includes/class-overview-widgets.php:
|
2010 |
-
#: admin/includes/class-overview-widgets.php:
|
2011 |
-
#: admin/includes/class-overview-widgets.php:
|
2012 |
-
#: admin/includes/class-overview-widgets.php:
|
2013 |
msgid "Activate now"
|
2014 |
msgstr ""
|
2015 |
|
2016 |
-
#: admin/includes/class-overview-widgets.php:
|
2017 |
msgid "Visit your ad stats"
|
2018 |
msgstr ""
|
2019 |
|
2020 |
-
#: admin/includes/class-overview-widgets.php:
|
2021 |
msgid "Use Genesis specific ad positions."
|
2022 |
msgstr ""
|
2023 |
|
2024 |
-
#: admin/includes/class-overview-widgets.php:
|
2025 |
msgid ""
|
2026 |
"Manage ad positions with WPBakery Page Builder (formerly Visual Composer)."
|
2027 |
msgstr ""
|
2028 |
|
2029 |
-
#: admin/includes/class-overview-widgets.php:
|
2030 |
msgid "Our best deal with all add-ons included."
|
2031 |
msgstr ""
|
2032 |
|
2033 |
-
#: admin/includes/class-overview-widgets.php:
|
2034 |
msgid "Get full access"
|
2035 |
msgstr ""
|
2036 |
|
2037 |
-
#: admin/includes/class-overview-widgets.php:
|
2038 |
#: admin/views/conditions/ad-display-metabox.php:37
|
2039 |
#: admin/views/conditions/ad-visitor-metabox.php:37
|
2040 |
msgid "Visit the manual"
|
2041 |
msgstr ""
|
2042 |
|
2043 |
-
#: admin/includes/class-overview-widgets.php:
|
2044 |
msgid "Get this add-on"
|
2045 |
msgstr ""
|
2046 |
|
@@ -2193,44 +2089,6 @@ msgstr ""
|
|
2193 |
msgid "Stop Wizard and show all options"
|
2194 |
msgstr ""
|
2195 |
|
2196 |
-
#: admin/views/settings-disable-ads.php:2
|
2197 |
-
msgid "Disable all ads in frontend"
|
2198 |
-
msgstr ""
|
2199 |
-
|
2200 |
-
#: admin/views/settings-disable-ads.php:3
|
2201 |
-
msgid ""
|
2202 |
-
"Use this option to disable all ads in the frontend, but still be able to use "
|
2203 |
-
"the plugin."
|
2204 |
-
msgstr ""
|
2205 |
-
|
2206 |
-
#: admin/views/settings-disable-ads.php:8
|
2207 |
-
msgid "Disable ads on 404 error pages"
|
2208 |
-
msgstr ""
|
2209 |
-
|
2210 |
-
#: admin/views/settings-disable-ads.php:12
|
2211 |
-
msgid "Disable ads on non-singular pages"
|
2212 |
-
msgstr ""
|
2213 |
-
|
2214 |
-
#: admin/views/settings-disable-ads.php:13
|
2215 |
-
msgid ""
|
2216 |
-
"e.g. archive pages like categories, tags, authors, front page (if a list)"
|
2217 |
-
msgstr ""
|
2218 |
-
|
2219 |
-
#: admin/views/settings-disable-ads.php:18
|
2220 |
-
msgid "Disable ads on secondary queries"
|
2221 |
-
msgstr ""
|
2222 |
-
|
2223 |
-
#: admin/views/settings-disable-ads.php:19
|
2224 |
-
msgid ""
|
2225 |
-
"Secondary queries are custom queries of posts outside the main query of a "
|
2226 |
-
"page. Try this option if you see ads injected on places where they shouldn’t "
|
2227 |
-
"appear."
|
2228 |
-
msgstr ""
|
2229 |
-
|
2230 |
-
#: admin/views/settings-disable-ads.php:25
|
2231 |
-
msgid "Disable ads in RSS Feed"
|
2232 |
-
msgstr ""
|
2233 |
-
|
2234 |
#: admin/views/ad-group-edit.php:18
|
2235 |
msgid "You did not select an item for editing."
|
2236 |
msgstr ""
|
@@ -2605,28 +2463,28 @@ msgstr ""
|
|
2605 |
msgid "reserve this space"
|
2606 |
msgstr ""
|
2607 |
|
2608 |
-
#: admin/views/ad-group.php:
|
2609 |
msgid "Ad Group successfully created"
|
2610 |
msgstr ""
|
2611 |
|
2612 |
-
#: admin/views/ad-group.php:
|
2613 |
msgid "Ad Groups successfully updated"
|
2614 |
msgstr ""
|
2615 |
|
2616 |
-
#: admin/views/ad-group.php:
|
2617 |
#, php-format
|
2618 |
msgid "Search results for “%s”"
|
2619 |
msgstr ""
|
2620 |
|
2621 |
-
#: admin/views/ad-group.php:
|
2622 |
msgid "Group title"
|
2623 |
msgstr ""
|
2624 |
|
2625 |
-
#: admin/views/ad-group.php:
|
2626 |
msgid "save"
|
2627 |
msgstr ""
|
2628 |
|
2629 |
-
#: admin/views/ad-group.php:
|
2630 |
msgid ""
|
2631 |
"Ad Groups are a very flexible method to bundle ads. You can use them to "
|
2632 |
"display random ads in the frontend or run split tests, but also just for "
|
@@ -2634,14 +2492,14 @@ msgid ""
|
|
2634 |
"ad can belong to multiple ad groups."
|
2635 |
msgstr ""
|
2636 |
|
2637 |
-
#: admin/views/ad-group.php:
|
2638 |
#, php-format
|
2639 |
msgid ""
|
2640 |
"Find more information about ad groups in the <a href=\"%s\" "
|
2641 |
"target=\"_blank\">manual</a>."
|
2642 |
msgstr ""
|
2643 |
|
2644 |
-
#: admin/views/ad-group.php:
|
2645 |
msgid "Update Groups"
|
2646 |
msgstr ""
|
2647 |
|
@@ -2957,56 +2815,50 @@ msgstr ""
|
|
2957 |
msgid "Details"
|
2958 |
msgstr ""
|
2959 |
|
2960 |
-
#: admin/views/setting-license.php:
|
2961 |
msgid "Your license expired."
|
2962 |
msgstr ""
|
2963 |
|
2964 |
-
#: admin/views/setting-license.php:
|
2965 |
msgid "Update expiry date"
|
2966 |
msgstr ""
|
2967 |
|
2968 |
-
#: admin/views/setting-license.php:
|
2969 |
#, php-format
|
2970 |
msgid ""
|
2971 |
"Click on %2$s if you renewed it or have a subscription or <a href=\"%1$s\" "
|
2972 |
"class=\"advads-renewal-link\" target=\"_blank\">renew your license</a>."
|
2973 |
msgstr ""
|
2974 |
|
2975 |
-
#: admin/views/setting-license.php:
|
2976 |
#, php-format
|
2977 |
msgid "(%d days left)"
|
2978 |
msgstr ""
|
2979 |
|
2980 |
-
#: admin/views/setting-license.php:
|
2981 |
msgid "License key"
|
2982 |
msgstr ""
|
2983 |
|
2984 |
-
#: admin/views/setting-license.php:
|
2985 |
msgid "Deactivate License"
|
2986 |
msgstr ""
|
2987 |
|
2988 |
-
#: admin/views/setting-license.php:
|
2989 |
msgid "Update License"
|
2990 |
msgstr ""
|
2991 |
|
2992 |
-
#: admin/views/setting-license.php:
|
2993 |
msgid "Activate License"
|
2994 |
msgstr ""
|
2995 |
|
2996 |
-
#: admin/views/setting-license.php:
|
2997 |
msgid "License key invalid"
|
2998 |
msgstr ""
|
2999 |
|
3000 |
-
#: admin/views/setting-license.php:
|
3001 |
msgid "active"
|
3002 |
msgstr ""
|
3003 |
|
3004 |
-
#: admin/views/setting-target.php:4
|
3005 |
-
msgid ""
|
3006 |
-
"Open programatically created links in a new window (use <code>"
|
3007 |
-
"target=\"_blank\"</code>)"
|
3008 |
-
msgstr ""
|
3009 |
-
|
3010 |
#: admin/views/placements-ad-label-position.php:24
|
3011 |
msgid ""
|
3012 |
"Check this if you don't want the following elements to float around the ad. "
|
@@ -3863,6 +3715,160 @@ msgstr ""
|
|
3863 |
msgid "Could not find the existing ads.txt file"
|
3864 |
msgstr ""
|
3865 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3866 |
#: modules/gadsense/admin/views/adsense-account.php:29
|
3867 |
msgid "AdSense warnings"
|
3868 |
msgstr ""
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: Advanved Ads\n"
|
5 |
"Report-Msgid-Bugs-To: http://wordpress.org/plugins/plugin-name\n"
|
6 |
+
"POT-Creation-Date: 2020-03-09 11:01+0000\n"
|
7 |
"POT-Revision-Date: Wed Jul 13 2016 13:23:05 GMT+0200 (CEST)\n"
|
8 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
9 |
"Last-Translator: Thomas Maier <post@webzunft.de>\n"
|
24 |
"X-Poedit-SearchPath-0: ."
|
25 |
|
26 |
#. %1$s is an anchor (link) opening tag, %2$s is the closing tag.
|
27 |
+
#: classes/ad-health-notices.php:865
|
28 |
#: modules/gadsense/includes/class-mapi.php:1513
|
29 |
#, php-format
|
30 |
msgid "Learn more about AdSense account issues %1$shere%2$s."
|
155 |
msgid "Original size: %s"
|
156 |
msgstr ""
|
157 |
|
158 |
+
#: classes/ad_ajax_callbacks.php:246
|
159 |
#, php-format
|
160 |
msgid ""
|
161 |
"An error occurred. Please use <a href=\"%s\" target=\"_blank\">this form</a> "
|
162 |
"to sign up."
|
163 |
msgstr ""
|
164 |
|
165 |
+
#: classes/ad_placements.php:46
|
166 |
msgid "Manual Placement"
|
167 |
msgstr ""
|
168 |
|
169 |
+
#: classes/ad_placements.php:47
|
170 |
msgid "Manual placement to use as function or shortcode."
|
171 |
msgstr ""
|
172 |
|
173 |
+
#: classes/ad_placements.php:56
|
174 |
msgid "Header Code"
|
175 |
msgstr ""
|
176 |
|
177 |
+
#: classes/ad_placements.php:57
|
178 |
msgid ""
|
179 |
"Injected in Header (before closing </head> Tag, often not visible)."
|
180 |
msgstr ""
|
181 |
|
182 |
+
#: classes/ad_placements.php:61
|
183 |
msgid "Footer Code"
|
184 |
msgstr ""
|
185 |
|
186 |
+
#: classes/ad_placements.php:62
|
187 |
msgid "Injected in Footer (before closing </body> Tag)."
|
188 |
msgstr ""
|
189 |
|
190 |
+
#: classes/ad_placements.php:67 admin/views/placement-injection-top.php:49
|
191 |
msgid "Before Content"
|
192 |
msgstr ""
|
193 |
|
194 |
+
#: classes/ad_placements.php:68
|
195 |
msgid "Injected before the post content."
|
196 |
msgstr ""
|
197 |
|
198 |
+
#: classes/ad_placements.php:78 admin/views/placement-injection-top.php:51
|
199 |
msgid "After Content"
|
200 |
msgstr ""
|
201 |
|
202 |
+
#: classes/ad_placements.php:79
|
203 |
msgid "Injected after the post content."
|
204 |
msgstr ""
|
205 |
|
206 |
+
#: classes/ad_placements.php:89 admin/views/placement-injection-top.php:50
|
207 |
msgid "Content"
|
208 |
msgstr ""
|
209 |
|
210 |
+
#: classes/ad_placements.php:90
|
211 |
msgid ""
|
212 |
"Injected into the content. You can choose the paragraph after which the ad "
|
213 |
"content is displayed."
|
214 |
msgstr ""
|
215 |
|
216 |
+
#: classes/ad_placements.php:100
|
217 |
msgid "Sidebar Widget"
|
218 |
msgstr ""
|
219 |
|
220 |
+
#: classes/ad_placements.php:101
|
221 |
msgid ""
|
222 |
"Create a sidebar widget with an ad. Can be placed and used like any other "
|
223 |
"widget."
|
224 |
msgstr ""
|
225 |
|
226 |
+
#: classes/ad_placements.php:289
|
227 |
#, php-format
|
228 |
msgid "paragraph (%s)"
|
229 |
msgstr ""
|
230 |
|
231 |
+
#: classes/ad_placements.php:291
|
232 |
#, php-format
|
233 |
msgid "paragraph without image (%s)"
|
234 |
msgstr ""
|
235 |
|
236 |
+
#: classes/ad_placements.php:293
|
237 |
#, php-format
|
238 |
msgid "headline 2 (%s)"
|
239 |
msgstr ""
|
240 |
|
241 |
+
#: classes/ad_placements.php:295
|
242 |
#, php-format
|
243 |
msgid "headline 3 (%s)"
|
244 |
msgstr ""
|
245 |
|
246 |
+
#: classes/ad_placements.php:297
|
247 |
#, php-format
|
248 |
msgid "headline 4 (%s)"
|
249 |
msgstr ""
|
250 |
|
251 |
+
#: classes/ad_placements.php:860
|
252 |
#, php-format
|
253 |
msgid "Set <em>%s</em> to show more ads"
|
254 |
msgstr ""
|
255 |
|
256 |
+
#: classes/ad_placements.php:861 admin/includes/class-settings.php:163
|
257 |
msgid "Disable level limitation"
|
258 |
msgstr ""
|
259 |
|
260 |
+
#: classes/frontend_checks.php:100
|
261 |
msgid "Random AdSense ads"
|
262 |
msgstr ""
|
263 |
|
264 |
+
#: classes/frontend_checks.php:114
|
265 |
+
#: admin/views/settings/general/block-bots.php:5
|
266 |
msgid "You look like a bot"
|
267 |
msgstr ""
|
268 |
|
269 |
+
#: classes/frontend_checks.php:128
|
270 |
msgid "Ad blocker enabled"
|
271 |
msgstr ""
|
272 |
|
273 |
+
#: classes/frontend_checks.php:140
|
274 |
#, php-format
|
275 |
msgid "<em>%s</em> filter does not exist"
|
276 |
msgstr ""
|
277 |
|
278 |
+
#: classes/frontend_checks.php:156
|
279 |
msgid "Ads are disabled on this page"
|
280 |
msgstr ""
|
281 |
|
282 |
+
#: classes/frontend_checks.php:169
|
283 |
msgid "Ads are disabled in the content of this page"
|
284 |
msgstr ""
|
285 |
|
286 |
+
#: classes/frontend_checks.php:181
|
287 |
msgid "the current post ID is 0 "
|
288 |
msgstr ""
|
289 |
|
290 |
+
#: classes/frontend_checks.php:195
|
291 |
msgid "Ads are disabled on all pages"
|
292 |
msgstr ""
|
293 |
|
294 |
+
#: classes/frontend_checks.php:208
|
295 |
msgid "Ads are disabled on 404 pages"
|
296 |
msgstr ""
|
297 |
|
298 |
+
#: classes/frontend_checks.php:221
|
299 |
msgid "Ads are disabled on non singular pages"
|
300 |
msgstr ""
|
301 |
|
302 |
+
#: classes/frontend_checks.php:234 classes/ad-debug.php:272
|
303 |
#: admin/includes/ad-health-notices.php:145
|
304 |
msgid ""
|
305 |
"Your website is using HTTPS, but the ad code contains HTTP and might not "
|
306 |
"work."
|
307 |
msgstr ""
|
308 |
|
309 |
+
#: classes/frontend_checks.php:235
|
310 |
#, php-format
|
311 |
msgid "Ad IDs: %s"
|
312 |
msgstr ""
|
313 |
|
314 |
+
#: classes/frontend_checks.php:247 admin/includes/ad-health-notices.php:121
|
315 |
#, php-format
|
316 |
msgid "Visible ads should not use the Header placement: %s"
|
317 |
msgstr ""
|
318 |
|
319 |
+
#: classes/frontend_checks.php:261 admin/includes/ad-health-notices.php:135
|
320 |
msgid "AdSense violation"
|
321 |
msgstr ""
|
322 |
|
323 |
+
#: classes/frontend_checks.php:262 admin/includes/ad-health-notices.php:136
|
324 |
msgid "Ad is hidden"
|
325 |
msgstr ""
|
326 |
|
327 |
+
#: classes/frontend_checks.php:263
|
328 |
#, php-format
|
329 |
msgid "IDs: %s"
|
330 |
msgstr ""
|
331 |
|
332 |
+
#: classes/frontend_checks.php:276
|
333 |
#, php-format
|
334 |
msgid "The following responsive AdSense ads are not showing up: %s"
|
335 |
msgstr ""
|
336 |
|
337 |
+
#: classes/frontend_checks.php:290
|
338 |
msgid "Consent not given"
|
339 |
msgstr ""
|
340 |
|
341 |
+
#: classes/frontend_checks.php:302
|
342 |
msgid "Debug Google Ad Manager"
|
343 |
msgstr ""
|
344 |
|
345 |
+
#: classes/frontend_checks.php:313
|
346 |
msgid "Auto ads code found"
|
347 |
msgstr ""
|
348 |
|
349 |
+
#: classes/frontend_checks.php:325
|
350 |
msgid "highlight ads"
|
351 |
msgstr ""
|
352 |
|
353 |
+
#: classes/frontend_checks.php:392
|
354 |
msgid "Ad Health"
|
355 |
msgstr ""
|
356 |
|
357 |
+
#: classes/frontend_checks.php:406
|
358 |
#, php-format
|
359 |
msgid "Show %d more notifications"
|
360 |
msgstr ""
|
361 |
|
362 |
+
#: classes/frontend_checks.php:423
|
363 |
msgid "Everything is fine"
|
364 |
msgstr ""
|
365 |
|
366 |
+
#: classes/frontend_checks.php:434 admin/includes/class-ad-type.php:863
|
367 |
msgid "Get help"
|
368 |
msgstr ""
|
369 |
|
370 |
+
#: classes/frontend_checks.php:491
|
371 |
msgid ""
|
372 |
"the following code is used for automatic error detection and only visible to "
|
373 |
"admins"
|
374 |
msgstr ""
|
375 |
|
376 |
+
#: classes/frontend_checks.php:789 classes/frontend_checks.php:801
|
377 |
#, php-format
|
378 |
msgid "Hi %s"
|
379 |
msgstr ""
|
380 |
|
381 |
+
#: classes/frontend_checks.php:789
|
382 |
#, php-format
|
383 |
msgid "Advanced Ads detected AdSense Auto ads (%sx) on this page."
|
384 |
msgstr ""
|
385 |
|
386 |
+
#: classes/frontend_checks.php:789 classes/frontend_checks.php:801
|
387 |
msgid "Is that correct?"
|
388 |
msgstr ""
|
389 |
|
390 |
+
#: classes/frontend_checks.php:791
|
391 |
msgid "All is fine"
|
392 |
msgstr ""
|
393 |
|
394 |
+
#: classes/frontend_checks.php:792
|
395 |
msgid "Something is off"
|
396 |
msgstr ""
|
397 |
|
398 |
+
#: classes/frontend_checks.php:794
|
399 |
msgid ""
|
400 |
"PS: This is a one-time check from your friendly Advanced Ads plugin. It is "
|
401 |
"only visible to you."
|
402 |
msgstr ""
|
403 |
|
404 |
+
#: classes/frontend_checks.php:801
|
405 |
msgid ""
|
406 |
"Advanced Ads detected the AdSense Auto ads code and <strong>no ads on this "
|
407 |
"page</strong>."
|
408 |
msgstr ""
|
409 |
|
410 |
+
#: classes/frontend_checks.php:803
|
411 |
msgid "This is fine"
|
412 |
msgstr ""
|
413 |
|
414 |
+
#: classes/frontend_checks.php:804
|
415 |
msgid "I expected something else"
|
416 |
msgstr ""
|
417 |
|
418 |
+
#: classes/frontend_checks.php:806
|
419 |
msgid ""
|
420 |
"PS: this is a one-time check from your friendly Advanced Ads plugin. It is "
|
421 |
"only visible to you."
|
422 |
msgstr ""
|
423 |
|
424 |
+
#: classes/frontend_checks.php:809 classes/frontend_checks.php:817
|
425 |
msgid "Just click on your problem to learn more from our knowledge base."
|
426 |
msgstr ""
|
427 |
|
428 |
+
#: classes/frontend_checks.php:810
|
429 |
msgid "I want to disable AdSense Auto ads"
|
430 |
msgstr ""
|
431 |
|
432 |
+
#: classes/frontend_checks.php:811 classes/frontend_checks.php:818
|
433 |
msgid "I don’t see any Auto ads"
|
434 |
msgstr ""
|
435 |
|
436 |
+
#: classes/frontend_checks.php:812
|
437 |
msgid "I only see blank space"
|
438 |
msgstr ""
|
439 |
|
440 |
+
#: classes/frontend_checks.php:813
|
441 |
msgid "I want to change the position of the ads"
|
442 |
msgstr ""
|
443 |
|
444 |
+
#: classes/frontend_checks.php:814
|
445 |
#: modules/gadsense/includes/class-network-adsense.php:202
|
446 |
msgid "Display Auto ads only on specific pages"
|
447 |
msgstr ""
|
448 |
|
449 |
+
#: classes/frontend_checks.php:819
|
450 |
msgid "How to look for the Auto ads code"
|
451 |
msgstr ""
|
452 |
|
453 |
+
#: classes/frontend_checks.php:820
|
454 |
msgid "I have another question or problem"
|
455 |
msgstr ""
|
456 |
|
457 |
+
#: classes/frontend_checks.php:823
|
458 |
msgid "Closing the message"
|
459 |
msgstr ""
|
460 |
|
543 |
msgid "browser width"
|
544 |
msgstr ""
|
545 |
|
546 |
+
#: classes/visitor-conditions.php:311 classes/display-conditions.php:290
|
547 |
+
#: admin/class-advanced-ads-admin.php:215
|
548 |
#: modules/gadsense/admin/views/external-ads-links.php:17
|
549 |
#: modules/gadsense/admin/views/external-ads-links.php:22
|
550 |
#: modules/gadsense/admin/views/external-ads-links.php:29
|
551 |
msgid "or"
|
552 |
msgstr ""
|
553 |
|
554 |
+
#: classes/visitor-conditions.php:311 classes/display-conditions.php:290
|
555 |
+
#: admin/class-advanced-ads-admin.php:216
|
556 |
msgid "and"
|
557 |
msgstr ""
|
558 |
|
566 |
"image upload or styling, but also simple text/html mode for scripts and code."
|
567 |
msgstr ""
|
568 |
|
569 |
+
#: classes/display-conditions.php:89
|
570 |
msgid "post type"
|
571 |
msgstr ""
|
572 |
|
573 |
+
#: classes/display-conditions.php:90 includes/array_ad_conditions.php:40
|
574 |
msgid "Choose the public post types on which to display the ad."
|
575 |
msgstr ""
|
576 |
|
577 |
+
#: classes/display-conditions.php:96
|
578 |
msgid "specific pages"
|
579 |
msgstr ""
|
580 |
|
581 |
+
#: classes/display-conditions.php:97 includes/array_ad_conditions.php:58
|
582 |
msgid ""
|
583 |
"Choose on which individual posts, pages and public post type pages you want "
|
584 |
"to display or hide ads."
|
585 |
msgstr ""
|
586 |
|
587 |
+
#: classes/display-conditions.php:103
|
588 |
msgid "general conditions"
|
589 |
msgstr ""
|
590 |
|
591 |
+
#: classes/display-conditions.php:109
|
592 |
msgid "author"
|
593 |
msgstr ""
|
594 |
|
595 |
+
#: classes/display-conditions.php:115
|
596 |
msgid "content age"
|
597 |
msgstr ""
|
598 |
|
599 |
+
#: classes/display-conditions.php:116
|
600 |
msgid "Display ads based on age of the page."
|
601 |
msgstr ""
|
602 |
|
603 |
+
#: classes/display-conditions.php:122
|
604 |
msgid "taxonomy"
|
605 |
msgstr ""
|
606 |
|
607 |
+
#: classes/display-conditions.php:123
|
608 |
msgid "Display ads based on the taxonomy of an archive page."
|
609 |
msgstr ""
|
610 |
|
611 |
+
#: classes/display-conditions.php:171
|
612 |
#, php-format
|
613 |
msgid "archive: %s"
|
614 |
msgstr ""
|
615 |
|
616 |
+
#: classes/display-conditions.php:260
|
617 |
msgid "parent page"
|
618 |
msgstr ""
|
619 |
|
620 |
+
#: classes/display-conditions.php:261
|
621 |
msgid "post meta"
|
622 |
msgstr ""
|
623 |
|
624 |
+
#: classes/display-conditions.php:262
|
625 |
msgid "page template"
|
626 |
msgstr ""
|
627 |
|
628 |
+
#: classes/display-conditions.php:263
|
629 |
msgid "url parameters"
|
630 |
msgstr ""
|
631 |
|
632 |
+
#: classes/display-conditions.php:266
|
633 |
msgid "accelerated mobile pages"
|
634 |
msgstr ""
|
635 |
|
636 |
+
#: classes/display-conditions.php:594
|
637 |
msgctxt "display the terms search field on ad edit page"
|
638 |
msgid "add more terms"
|
639 |
msgstr ""
|
640 |
|
641 |
+
#: classes/display-conditions.php:598
|
642 |
msgid "term name or id"
|
643 |
msgstr ""
|
644 |
|
645 |
+
#: classes/display-conditions.php:674
|
646 |
msgid "title or id"
|
647 |
msgstr ""
|
648 |
|
649 |
+
#: classes/display-conditions.php:728 includes/array_ad_conditions.php:63
|
650 |
msgid "Home Page"
|
651 |
msgstr ""
|
652 |
|
653 |
+
#: classes/display-conditions.php:729 includes/array_ad_conditions.php:64
|
654 |
msgid "show on Home page"
|
655 |
msgstr ""
|
656 |
|
657 |
+
#: classes/display-conditions.php:733 includes/array_ad_conditions.php:68
|
658 |
msgid "Singular Pages"
|
659 |
msgstr ""
|
660 |
|
661 |
+
#: classes/display-conditions.php:734 includes/array_ad_conditions.php:69
|
662 |
msgid "show on singular pages/posts"
|
663 |
msgstr ""
|
664 |
|
665 |
+
#: classes/display-conditions.php:738 includes/array_ad_conditions.php:73
|
666 |
msgid "Archive Pages"
|
667 |
msgstr ""
|
668 |
|
669 |
+
#: classes/display-conditions.php:739 includes/array_ad_conditions.php:74
|
670 |
msgid "show on any type of archive page (category, tag, author and date)"
|
671 |
msgstr ""
|
672 |
|
673 |
+
#: classes/display-conditions.php:743 includes/array_ad_conditions.php:78
|
674 |
msgid "Search Results"
|
675 |
msgstr ""
|
676 |
|
677 |
+
#: classes/display-conditions.php:744 includes/array_ad_conditions.php:79
|
678 |
msgid "show on search result pages"
|
679 |
msgstr ""
|
680 |
|
681 |
+
#: classes/display-conditions.php:748 includes/array_ad_conditions.php:83
|
682 |
msgid "404 Page"
|
683 |
msgstr ""
|
684 |
|
685 |
+
#: classes/display-conditions.php:749 includes/array_ad_conditions.php:84
|
686 |
msgid "show on 404 error page"
|
687 |
msgstr ""
|
688 |
|
689 |
+
#: classes/display-conditions.php:753 includes/array_ad_conditions.php:88
|
690 |
msgid "Attachment Pages"
|
691 |
msgstr ""
|
692 |
|
693 |
+
#: classes/display-conditions.php:754 includes/array_ad_conditions.php:89
|
694 |
msgid "show on attachment pages"
|
695 |
msgstr ""
|
696 |
|
697 |
+
#: classes/display-conditions.php:758 includes/array_ad_conditions.php:93
|
698 |
msgid "Secondary Queries"
|
699 |
msgstr ""
|
700 |
|
701 |
+
#: classes/display-conditions.php:759 includes/array_ad_conditions.php:94
|
702 |
msgid "allow ads in secondary queries"
|
703 |
msgstr ""
|
704 |
|
705 |
+
#: classes/display-conditions.php:763
|
706 |
msgid "RSS Feed"
|
707 |
msgstr ""
|
708 |
|
709 |
+
#: classes/display-conditions.php:764
|
710 |
msgid "allow ads in RSS Feed"
|
711 |
msgstr ""
|
712 |
|
713 |
+
#: classes/display-conditions.php:768
|
714 |
+
msgid "REST API"
|
715 |
+
msgstr ""
|
716 |
+
|
717 |
+
#: classes/display-conditions.php:769
|
718 |
+
msgid "allow ads in REST API"
|
719 |
+
msgstr ""
|
720 |
+
|
721 |
+
#: classes/display-conditions.php:804
|
722 |
msgid "older than"
|
723 |
msgstr ""
|
724 |
|
725 |
+
#: classes/display-conditions.php:805
|
726 |
msgid "younger than"
|
727 |
msgstr ""
|
728 |
|
729 |
+
#: classes/display-conditions.php:807
|
730 |
msgid "days"
|
731 |
msgstr ""
|
732 |
|
763 |
msgstr ""
|
764 |
|
765 |
#: classes/ad-debug.php:118 classes/ad-debug.php:167 classes/ad-debug.php:169
|
766 |
+
#: public/class-advanced-ads.php:716 admin/views/ad-group-list-ads.php:13
|
767 |
msgid "Ad"
|
768 |
msgstr ""
|
769 |
|
770 |
+
#: classes/ad-debug.php:121 public/class-advanced-ads.php:680
|
771 |
msgctxt "ad group singular name"
|
772 |
msgid "Ad Group"
|
773 |
msgstr ""
|
776 |
msgid "Placement"
|
777 |
msgstr ""
|
778 |
|
779 |
+
#: classes/ad-debug.php:152 admin/includes/class-meta-box.php:104
|
780 |
msgid "Display Conditions"
|
781 |
msgstr ""
|
782 |
|
783 |
+
#: classes/ad-debug.php:239 admin/includes/class-meta-box.php:112
|
784 |
msgid "Visitor Conditions"
|
785 |
msgstr ""
|
786 |
|
792 |
msgid "Title:"
|
793 |
msgstr ""
|
794 |
|
795 |
+
#: classes/widget.php:76 admin/includes/class-shortcode-creator.php:99
|
796 |
#: modules/gutenberg/includes/class-gutenberg.php:77
|
797 |
msgid "--empty--"
|
798 |
msgstr ""
|
799 |
|
800 |
+
#: classes/widget.php:78 admin/includes/class-menu.php:131
|
801 |
+
#: admin/includes/class-shortcode-creator.php:115 admin/views/placements.php:36
|
802 |
#: modules/gutenberg/includes/class-gutenberg.php:81
|
803 |
#: modules/import-export/views/page.php:25
|
804 |
msgid "Placements"
|
805 |
msgstr ""
|
806 |
|
807 |
+
#: classes/widget.php:85 admin/includes/class-shortcode-creator.php:108
|
808 |
#: admin/views/placements-item.php:4 admin/views/placement-form.php:45
|
809 |
#: modules/gutenberg/includes/class-gutenberg.php:80
|
810 |
msgid "Ad Groups"
|
811 |
msgstr ""
|
812 |
|
813 |
+
#: classes/widget.php:92 public/class-advanced-ads.php:715
|
814 |
+
#: admin/includes/class-menu.php:79 admin/includes/class-menu.php:80
|
815 |
+
#: admin/includes/class-shortcode-creator.php:101
|
816 |
#: admin/views/placements-item.php:16 admin/views/ad-group-list-form-row.php:90
|
817 |
#: admin/views/placement-form.php:52 admin/views/ad-group-list-header.php:17
|
818 |
#: modules/gutenberg/includes/class-gutenberg.php:79
|
854 |
msgid "Individual Posts, Pages and Public Post Types"
|
855 |
msgstr ""
|
856 |
|
857 |
+
#: admin/class-advanced-ads-admin.php:217
|
858 |
msgid "After which paragraph?"
|
859 |
msgstr ""
|
860 |
|
861 |
+
#: admin/class-advanced-ads-admin.php:219
|
862 |
msgid "Today"
|
863 |
msgstr ""
|
864 |
|
865 |
+
#: admin/class-advanced-ads-admin.php:220
|
866 |
msgid "Yesterday"
|
867 |
msgstr ""
|
868 |
|
869 |
+
#: admin/class-advanced-ads-admin.php:221
|
870 |
msgid "This Month"
|
871 |
msgstr ""
|
872 |
|
873 |
#. 1: The number of days.
|
874 |
+
#: admin/class-advanced-ads-admin.php:223
|
875 |
#, php-format
|
876 |
msgid "Last %1$d days"
|
877 |
msgstr ""
|
878 |
|
879 |
+
#: admin/class-advanced-ads-admin.php:226
|
880 |
msgid "All"
|
881 |
msgstr ""
|
882 |
|
883 |
+
#: admin/class-advanced-ads-admin.php:227
|
884 |
msgid ""
|
885 |
"There were no results returned for this ad. Please make sure it is active, "
|
886 |
"generating impressions and double check your ad parameters."
|
887 |
msgstr ""
|
888 |
|
889 |
+
#: admin/class-advanced-ads-admin.php:228
|
890 |
#: modules/gadsense/admin/views/external-ads-list.php:33
|
891 |
msgid "Show inactive ads"
|
892 |
msgstr ""
|
893 |
|
894 |
+
#: admin/class-advanced-ads-admin.php:229
|
895 |
msgid "Hide inactive ads"
|
896 |
msgstr ""
|
897 |
|
898 |
+
#: admin/class-advanced-ads-admin.php:231
|
899 |
msgid "There has been an AJAX error caused by another plugin."
|
900 |
msgstr ""
|
901 |
|
902 |
#. %1$s is an opening link tag, %2$s is a closing one.
|
903 |
+
#: admin/class-advanced-ads-admin.php:234
|
904 |
#, php-format
|
905 |
msgid "Please contact our %1$ssupport%2$s."
|
906 |
msgstr ""
|
907 |
|
908 |
+
#: admin/class-advanced-ads-admin.php:347
|
909 |
#, php-format
|
910 |
msgid "time of %s"
|
911 |
msgstr ""
|
912 |
|
913 |
+
#: admin/class-advanced-ads-admin.php:418 admin/includes/class-menu.php:155
|
914 |
+
#: admin/includes/class-menu.php:158 admin/views/settings.php:28
|
915 |
msgid "Support"
|
916 |
msgstr ""
|
917 |
|
918 |
+
#: admin/class-advanced-ads-admin.php:422
|
919 |
+
#: admin/includes/class-overview-widgets.php:71
|
920 |
msgid "Add-Ons"
|
921 |
msgstr ""
|
922 |
|
923 |
+
#: admin/class-advanced-ads-admin.php:693
|
924 |
+
#: admin/includes/class-overview-widgets.php:194
|
925 |
#, php-format
|
926 |
msgid ""
|
927 |
"Thank the developer with a ★★★★★ review on <a "
|
928 |
"href=\"%s\" target=\"_blank\">wordpress.org</a>"
|
929 |
msgstr ""
|
930 |
|
931 |
+
#: public/class-advanced-ads.php:369
|
932 |
msgid "Advanced Ads Error following:"
|
933 |
msgstr ""
|
934 |
|
935 |
+
#: public/class-advanced-ads.php:373
|
936 |
#, php-format
|
937 |
msgid "Advanced Ads Error: %s"
|
938 |
msgstr ""
|
939 |
|
940 |
+
#: public/class-advanced-ads.php:679
|
941 |
msgctxt "ad group general name"
|
942 |
msgid "Ad Groups & Rotations"
|
943 |
msgstr ""
|
944 |
|
945 |
+
#: public/class-advanced-ads.php:681
|
946 |
msgid "Search Ad Groups"
|
947 |
msgstr ""
|
948 |
|
949 |
+
#: public/class-advanced-ads.php:682
|
950 |
msgid "All Ad Groups"
|
951 |
msgstr ""
|
952 |
|
953 |
+
#: public/class-advanced-ads.php:683
|
954 |
msgid "Parent Ad Groups"
|
955 |
msgstr ""
|
956 |
|
957 |
+
#: public/class-advanced-ads.php:684
|
958 |
msgid "Parent Ad Groups:"
|
959 |
msgstr ""
|
960 |
|
961 |
+
#: public/class-advanced-ads.php:685
|
962 |
msgid "Edit Ad Group"
|
963 |
msgstr ""
|
964 |
|
965 |
+
#: public/class-advanced-ads.php:686
|
966 |
msgid "Update Ad Group"
|
967 |
msgstr ""
|
968 |
|
969 |
+
#: public/class-advanced-ads.php:687
|
970 |
msgid "Add New Ad Group"
|
971 |
msgstr ""
|
972 |
|
973 |
+
#: public/class-advanced-ads.php:688
|
974 |
msgid "New Ad Groups Name"
|
975 |
msgstr ""
|
976 |
|
977 |
+
#: public/class-advanced-ads.php:689 modules/import-export/views/page.php:24
|
978 |
msgid "Groups"
|
979 |
msgstr ""
|
980 |
|
981 |
+
#: public/class-advanced-ads.php:690
|
982 |
msgid "No Ad Group found"
|
983 |
msgstr ""
|
984 |
|
985 |
+
#: public/class-advanced-ads.php:717 public/class-advanced-ads.php:721
|
986 |
+
#: admin/includes/class-menu.php:112 admin/views/ad-group-list-ads.php:28
|
987 |
msgid "New Ad"
|
988 |
msgstr ""
|
989 |
|
990 |
+
#: public/class-advanced-ads.php:718 admin/includes/class-menu.php:111
|
991 |
msgid "Add New Ad"
|
992 |
msgstr ""
|
993 |
|
994 |
+
#: public/class-advanced-ads.php:719
|
995 |
#: admin/includes/class-ad-groups-list.php:339
|
996 |
#: modules/import-export/classes/import.php:146
|
997 |
#: modules/import-export/classes/import.php:186
|
999 |
msgid "Edit"
|
1000 |
msgstr ""
|
1001 |
|
1002 |
+
#: public/class-advanced-ads.php:720
|
1003 |
msgid "Edit Ad"
|
1004 |
msgstr ""
|
1005 |
|
1006 |
+
#: public/class-advanced-ads.php:722
|
1007 |
msgid "View"
|
1008 |
msgstr ""
|
1009 |
|
1010 |
+
#: public/class-advanced-ads.php:723
|
1011 |
msgid "View the Ad"
|
1012 |
msgstr ""
|
1013 |
|
1014 |
+
#: public/class-advanced-ads.php:724
|
1015 |
msgid "Search Ads"
|
1016 |
msgstr ""
|
1017 |
|
1018 |
+
#: public/class-advanced-ads.php:725
|
1019 |
msgid "No Ads found"
|
1020 |
msgstr ""
|
1021 |
|
1022 |
+
#: public/class-advanced-ads.php:726
|
1023 |
msgid "No Ads found in Trash"
|
1024 |
msgstr ""
|
1025 |
|
1026 |
+
#: public/class-advanced-ads.php:727
|
1027 |
msgid "Parent Ad"
|
1028 |
msgstr ""
|
1029 |
|
1030 |
+
#: public/class-advanced-ads.php:866
|
1031 |
msgctxt "label above ads"
|
1032 |
msgid "Advertisements"
|
1033 |
msgstr ""
|
1081 |
"disguise."
|
1082 |
msgstr ""
|
1083 |
|
1084 |
+
#: admin/includes/ad-health-notices.php:99 admin/includes/notices.php:38
|
1085 |
msgid ""
|
1086 |
"One or more license keys for <strong>Advanced Ads add-ons are invalid or "
|
1087 |
"missing</strong>."
|
1088 |
msgstr ""
|
1089 |
|
1090 |
+
#: admin/includes/ad-health-notices.php:102 admin/includes/notices.php:40
|
1091 |
#, php-format
|
1092 |
msgid "Please add valid license keys <a href=\"%s\">here</a>."
|
1093 |
msgstr ""
|
1257 |
"again to fix this."
|
1258 |
msgstr ""
|
1259 |
|
1260 |
+
#: admin/includes/notices.php:17
|
1261 |
msgid ""
|
1262 |
"Thank you for activating <strong>Advanced Ads</strong>. Would you like to "
|
1263 |
"receive the first steps via email?"
|
1264 |
msgstr ""
|
1265 |
|
1266 |
+
#: admin/includes/notices.php:18
|
1267 |
msgid "Yes, send it"
|
1268 |
msgstr ""
|
1269 |
|
1270 |
+
#: admin/includes/notices.php:24
|
1271 |
msgid ""
|
1272 |
"Thank you for using <strong>Advanced Ads</strong>. Stay informed and receive "
|
1273 |
"<strong>2 free add-ons</strong> for joining the newsletter."
|
1274 |
msgstr ""
|
1275 |
|
1276 |
+
#: admin/includes/notices.php:25
|
1277 |
msgid "Add me now"
|
1278 |
msgstr ""
|
1279 |
|
1280 |
+
#: admin/includes/notices.php:31
|
1281 |
msgid ""
|
1282 |
"Learn more about how and <strong>how much you can earn with AdSense</strong> "
|
1283 |
"and Advanced Ads from my dedicated newsletter."
|
1284 |
msgstr ""
|
1285 |
|
1286 |
+
#: admin/includes/notices.php:32 admin/views/notices/subscribe.php:3
|
1287 |
#: admin/views/notices/inline.php:3
|
1288 |
msgid "Subscribe me now"
|
1289 |
msgstr ""
|
1290 |
|
1291 |
+
#: admin/includes/notices.php:48
|
1292 |
msgid "… ads created using <strong>Advanced Ads</strong>."
|
1293 |
msgstr ""
|
1294 |
|
1295 |
+
#: admin/includes/notices.php:49
|
1296 |
msgid ""
|
1297 |
"Do you find the plugin useful and would like to thank us for updates, fixing "
|
1298 |
"bugs and improving your ad setup?"
|
1299 |
msgstr ""
|
1300 |
|
1301 |
#. this belongs to our message asking the user for a review. You can find a nice equivalent in your own language
|
1302 |
+
#: admin/includes/notices.php:52
|
1303 |
msgid "When you give 5-stars, an actual person does a little happy dance!"
|
1304 |
msgstr ""
|
1305 |
|
1306 |
+
#: admin/includes/notices.php:54
|
1307 |
msgid "Sure, I appreciate your work"
|
1308 |
msgstr ""
|
1309 |
|
1310 |
+
#: admin/includes/notices.php:55
|
1311 |
msgid "Yes, but help me first to solve a problem, please"
|
1312 |
msgstr ""
|
1313 |
|
1314 |
#. %s is a link. `30%%` is correct, please use exactly that value so that it shows "30%".
|
1315 |
+
#: admin/includes/notices.php:64
|
1316 |
#, php-format
|
1317 |
msgid ""
|
1318 |
"Our Black Friday / Cyber Monday Offer: <span style=\"font-weight: bold; font-"
|
1321 |
"Access</a>"
|
1322 |
msgstr ""
|
1323 |
|
1324 |
+
#: admin/includes/class-list-filters.php:142
|
1325 |
#: modules/gadsense/admin/admin.php:25
|
1326 |
#: modules/gadsense/admin/views/adsense-ad-parameters.php:109
|
1327 |
msgid "Responsive"
|
1328 |
msgstr ""
|
1329 |
|
1330 |
+
#: admin/includes/class-list-filters.php:151
|
1331 |
msgid "expired"
|
1332 |
msgstr ""
|
1333 |
|
1334 |
+
#: admin/includes/class-list-filters.php:155
|
1335 |
msgid "any expiry date"
|
1336 |
msgstr ""
|
1337 |
|
1338 |
+
#: admin/includes/class-meta-box.php:60
|
1339 |
msgid "Ad Type"
|
1340 |
msgstr ""
|
1341 |
|
1342 |
+
#: admin/includes/class-meta-box.php:74
|
1343 |
+
#: admin/includes/class-overview-widgets.php:64
|
1344 |
msgid "AdSense Earnings"
|
1345 |
msgstr ""
|
1346 |
|
1347 |
+
#: admin/includes/class-meta-box.php:88
|
1348 |
msgid "Ad Parameters"
|
1349 |
msgstr ""
|
1350 |
|
1351 |
+
#: admin/includes/class-meta-box.php:96 admin/includes/class-settings.php:69
|
1352 |
msgid "Layout / Output"
|
1353 |
msgstr ""
|
1354 |
|
1355 |
+
#: admin/includes/class-meta-box.php:121
|
1356 |
msgid "Increase your ad revenue"
|
1357 |
msgstr ""
|
1358 |
|
1359 |
+
#: admin/includes/class-meta-box.php:131
|
1360 |
msgid "Ad Stats"
|
1361 |
msgstr ""
|
1362 |
|
1363 |
+
#: admin/includes/class-meta-box.php:199 admin/includes/class-meta-box.php:210
|
1364 |
+
#: admin/includes/class-meta-box.php:215
|
1365 |
+
#: admin/includes/class-overview-widgets.php:182
|
1366 |
#: admin/views/ad-output-metabox.php:82
|
1367 |
+
#: admin/views/settings/general/custom-label.php:9
|
1368 |
#: modules/privacy/admin/views/setting-enable.php:2
|
1369 |
#: modules/ads-txt/admin/views/setting-create.php:11
|
1370 |
msgid "Manual"
|
1371 |
msgstr ""
|
1372 |
|
1373 |
+
#: admin/includes/class-meta-box.php:209
|
1374 |
msgid "Video"
|
1375 |
msgstr ""
|
1376 |
|
1377 |
+
#: admin/includes/class-meta-box.php:246
|
1378 |
+
#: admin/includes/class-overview-widgets.php:60
|
1379 |
msgid "Disable"
|
1380 |
msgstr ""
|
1381 |
|
1382 |
+
#: admin/includes/class-meta-box.php:393
|
1383 |
msgid "Ad Settings"
|
1384 |
msgstr ""
|
1385 |
|
1386 |
+
#: admin/includes/class-meta-box.php:492 admin/views/overview.php:6
|
1387 |
msgid "Ads Dashboard"
|
1388 |
msgstr ""
|
1389 |
|
1390 |
+
#. %1$d is the number of ads, %2$s and %3$s are URLs.
|
1391 |
+
#: admin/includes/class-meta-box.php:508
|
1392 |
#, php-format
|
1393 |
+
msgid "%1$d ads – <a href=\"%2$s\">manage</a> - <a href=\"%3$s\">new</a>"
|
1394 |
msgstr ""
|
1395 |
|
1396 |
+
#: admin/includes/class-meta-box.php:521
|
1397 |
msgid "Get the tutorial via email"
|
1398 |
msgstr ""
|
1399 |
|
1400 |
+
#: admin/includes/class-meta-box.php:530
|
1401 |
msgid "Get AdSense tips via email"
|
1402 |
msgstr ""
|
1403 |
|
1404 |
+
#: admin/includes/class-meta-box.php:539
|
1405 |
msgid "Visit our blog for more articles about ad optimization"
|
1406 |
msgstr ""
|
1407 |
|
1408 |
#. %s is our URL
|
1409 |
+
#: admin/includes/class-meta-box.php:593
|
1410 |
msgid "Latest posts on wpadvancedads.com"
|
1411 |
msgstr ""
|
1412 |
|
1422 |
msgid "Error while trying to register the license. Please contact support."
|
1423 |
msgstr ""
|
1424 |
|
1425 |
+
#: admin/includes/class-licenses.php:115 admin/views/setting-license.php:65
|
1426 |
msgid "Please enter a valid license key"
|
1427 |
msgstr ""
|
1428 |
|
1481 |
"."
|
1482 |
msgstr ""
|
1483 |
|
1484 |
+
#: admin/includes/shortcode-creator-l10n.php:17
|
1485 |
msgctxt "shortcode creator"
|
1486 |
msgid "Add an ad"
|
1487 |
msgstr ""
|
1488 |
|
1489 |
+
#: admin/includes/shortcode-creator-l10n.php:18
|
1490 |
msgctxt "shortcode creator"
|
1491 |
msgid "Add shortcode"
|
1492 |
msgstr ""
|
1493 |
|
1494 |
+
#: admin/includes/shortcode-creator-l10n.php:19
|
1495 |
msgctxt "shortcode creator"
|
1496 |
msgid "Cancel"
|
1497 |
msgstr ""
|
1498 |
|
1499 |
+
#: admin/includes/class-notices.php:427
|
1500 |
#, php-format
|
1501 |
msgid ""
|
1502 |
"You don’t seem to have an email address. Please use <a href=\"%s\" "
|
1503 |
"target=\"_blank\">this form</a> to sign up."
|
1504 |
msgstr ""
|
1505 |
|
1506 |
+
#: admin/includes/class-notices.php:448
|
1507 |
msgid ""
|
1508 |
"How embarrassing. The email server seems to be down. Please try again later."
|
1509 |
msgstr ""
|
1510 |
|
1511 |
+
#. the first %s is an email address, the seconds %s is a URL.
|
1512 |
+
#: admin/includes/class-notices.php:455
|
1513 |
#, php-format
|
1514 |
msgid ""
|
1515 |
+
"Please check your email (%1$s) for the confirmation message. If you didn’t "
|
1516 |
"receive one or want to use another email address then please use <a "
|
1517 |
+
"href=\"%2$s\" target=\"_blank\">this form</a> to sign up."
|
1518 |
msgstr ""
|
1519 |
|
1520 |
+
#: admin/includes/class-menu.php:65 admin/includes/class-menu.php:88
|
1521 |
+
#: admin/includes/class-menu.php:99 admin/includes/class-menu.php:100
|
1522 |
msgid "Overview"
|
1523 |
msgstr ""
|
1524 |
|
1525 |
+
#: admin/includes/class-menu.php:120
|
1526 |
msgid "Ad Groups & Rotations"
|
1527 |
msgstr ""
|
1528 |
|
1529 |
+
#: admin/includes/class-menu.php:121
|
1530 |
msgid "Groups & Rotation"
|
1531 |
msgstr ""
|
1532 |
|
1533 |
+
#: admin/includes/class-menu.php:130
|
1534 |
msgid "Ad Placements"
|
1535 |
msgstr ""
|
1536 |
|
1537 |
+
#: admin/includes/class-menu.php:139
|
1538 |
msgid "Advanced Ads Settings"
|
1539 |
msgstr ""
|
1540 |
|
1541 |
+
#: admin/includes/class-menu.php:140
|
1542 |
msgid "Settings"
|
1543 |
msgstr ""
|
1544 |
|
1545 |
+
#: admin/includes/class-menu.php:175 admin/includes/class-menu.php:179
|
1546 |
+
#: admin/includes/class-settings.php:272
|
1547 |
msgid "Licenses"
|
1548 |
msgstr ""
|
1549 |
|
1550 |
+
#: admin/includes/class-menu.php:274 admin/includes/class-menu.php:299
|
1551 |
msgid "Sorry, you are not allowed to access this feature."
|
1552 |
msgstr ""
|
1553 |
|
1554 |
+
#: admin/includes/class-menu.php:286
|
1555 |
msgid ""
|
1556 |
"You attempted to edit an ad group that doesn’t exist. Perhaps it was "
|
1557 |
"deleted?"
|
1558 |
msgstr ""
|
1559 |
|
1560 |
+
#: admin/includes/class-settings.php:53
|
1561 |
msgid "Admin"
|
1562 |
msgstr ""
|
1563 |
|
1564 |
+
#: admin/includes/class-settings.php:61 admin/includes/class-settings.php:131
|
1565 |
msgid "Disable ads"
|
1566 |
msgstr ""
|
1567 |
|
1568 |
+
#: admin/includes/class-settings.php:77
|
1569 |
msgid "Content injection"
|
1570 |
msgstr ""
|
1571 |
|
1572 |
+
#: admin/includes/class-settings.php:139
|
1573 |
msgid "Hide ads for user roles"
|
1574 |
msgstr ""
|
1575 |
|
1576 |
+
#: admin/includes/class-settings.php:147
|
1577 |
msgid "Unlimited ad injection"
|
1578 |
msgstr ""
|
1579 |
|
1580 |
+
#: admin/includes/class-settings.php:155
|
1581 |
msgid "Priority of content injection filter"
|
1582 |
msgstr ""
|
1583 |
|
1584 |
+
#: admin/includes/class-settings.php:171
|
1585 |
msgid "Hide ads from bots"
|
1586 |
msgstr ""
|
1587 |
|
1588 |
+
#: admin/includes/class-settings.php:180
|
1589 |
msgid "Disable ads for post types"
|
1590 |
msgstr ""
|
1591 |
|
1592 |
+
#: admin/includes/class-settings.php:189
|
1593 |
msgid "Disable Ad Health and other notices"
|
1594 |
msgstr ""
|
1595 |
|
1596 |
+
#: admin/includes/class-settings.php:197
|
1597 |
msgid "ID prefix"
|
1598 |
msgstr ""
|
1599 |
|
1600 |
+
#: admin/includes/class-settings.php:205
|
1601 |
msgid "Allow editors to manage ads"
|
1602 |
msgstr ""
|
1603 |
|
1604 |
+
#: admin/includes/class-settings.php:213
|
1605 |
msgid "Ad label"
|
1606 |
msgstr ""
|
1607 |
|
1608 |
+
#: admin/includes/class-settings.php:222
|
1609 |
msgid "Open links in a new window"
|
1610 |
msgstr ""
|
1611 |
|
1612 |
+
#: admin/includes/class-settings.php:230
|
1613 |
msgid "Use advanced JavaScript"
|
1614 |
msgstr ""
|
1615 |
|
1616 |
+
#: admin/includes/class-settings.php:240
|
1617 |
msgid "Delete data on uninstall"
|
1618 |
msgstr ""
|
1619 |
|
1620 |
+
#: admin/includes/class-settings.php:250
|
1621 |
msgid "Disable shortcode button"
|
1622 |
msgstr ""
|
1623 |
|
1624 |
+
#: admin/includes/class-settings.php:291
|
1625 |
msgid "Pro"
|
1626 |
msgstr ""
|
1627 |
|
1628 |
+
#: admin/includes/class-settings.php:309 admin/views/pitch-tracking.php:2
|
1629 |
msgid "Tracking"
|
1630 |
msgstr ""
|
1631 |
|
1632 |
+
#: admin/includes/class-settings.php:355
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1633 |
msgid "Are you missing something?"
|
1634 |
msgstr ""
|
1635 |
|
1636 |
+
#: admin/includes/class-settings.php:531
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1637 |
msgctxt "label before ads"
|
1638 |
msgid "Advertisements"
|
1639 |
msgstr ""
|
1640 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1641 |
#: admin/includes/class-ad-groups-list.php:172
|
1642 |
msgid "Ad weight"
|
1643 |
msgstr ""
|
1720 |
msgid "No ad group created"
|
1721 |
msgstr ""
|
1722 |
|
1723 |
+
#: admin/includes/class-shortcode-creator.php:192
|
1724 |
#, php-format
|
1725 |
msgid ""
|
1726 |
"Please, either switch off your ad blocker or disable the shortcode button in "
|
1727 |
"the <a href=\"%s\" target=\"_blank\">settings</a>."
|
1728 |
msgstr ""
|
1729 |
|
1730 |
+
#: admin/includes/class-overview-widgets.php:48
|
1731 |
msgid "Next steps"
|
1732 |
msgstr ""
|
1733 |
|
1734 |
+
#: admin/includes/class-overview-widgets.php:54
|
1735 |
msgid "Manual and Support"
|
1736 |
msgstr ""
|
1737 |
|
1738 |
+
#: admin/includes/class-overview-widgets.php:118
|
1739 |
#: admin/views/notices/welcome-panel.php:15
|
1740 |
msgid "Create your first ad"
|
1741 |
msgstr ""
|
1742 |
|
1743 |
+
#: admin/includes/class-overview-widgets.php:121
|
1744 |
#: modules/gadsense/admin/views/adsense-account.php:71
|
1745 |
#: modules/gadsense/admin/views/adsense-account.php:93
|
1746 |
msgid "Connect to AdSense"
|
1747 |
msgstr ""
|
1748 |
|
1749 |
+
#: admin/includes/class-overview-widgets.php:132
|
1750 |
msgid "Join the newsletter for more benefits"
|
1751 |
msgstr ""
|
1752 |
|
1753 |
+
#: admin/includes/class-overview-widgets.php:134
|
1754 |
msgid "Get 2 free add-ons"
|
1755 |
msgstr ""
|
1756 |
|
1757 |
+
#: admin/includes/class-overview-widgets.php:135
|
1758 |
msgid "Get the first steps and more tutorials to your inbox"
|
1759 |
msgstr ""
|
1760 |
|
1761 |
+
#: admin/includes/class-overview-widgets.php:136
|
1762 |
msgid "How to earn more with AdSense"
|
1763 |
msgstr ""
|
1764 |
|
1765 |
+
#: admin/includes/class-overview-widgets.php:141
|
1766 |
msgid "Join now"
|
1767 |
msgstr ""
|
1768 |
|
1769 |
+
#: admin/includes/class-overview-widgets.php:153
|
1770 |
msgid ""
|
1771 |
"Do you find Advanced Ads useful and would like to keep us motivated? Please "
|
1772 |
"help us with a review."
|
1773 |
msgstr ""
|
1774 |
|
1775 |
+
#: admin/includes/class-overview-widgets.php:155
|
1776 |
msgid "Sure, I’ll rate the plugin"
|
1777 |
msgstr ""
|
1778 |
|
1779 |
+
#: admin/includes/class-overview-widgets.php:157
|
1780 |
msgid "I already did"
|
1781 |
msgstr ""
|
1782 |
|
1783 |
+
#: admin/includes/class-overview-widgets.php:164
|
1784 |
msgid "Manage your ads"
|
1785 |
msgstr ""
|
1786 |
|
1787 |
+
#: admin/includes/class-overview-widgets.php:170
|
1788 |
msgid "Get the All Access pass"
|
1789 |
msgstr ""
|
1790 |
|
1791 |
+
#: admin/includes/class-overview-widgets.php:186
|
1792 |
+
msgid "FAQ and Support"
|
|
|
|
|
|
|
|
|
|
|
|
|
1793 |
msgstr ""
|
1794 |
|
1795 |
#. %s includes a number and markup like <span class="count">6</span>.
|
1796 |
+
#: admin/includes/class-overview-widgets.php:218
|
1797 |
#: admin/views/overview-notices.php:17
|
1798 |
#, php-format
|
1799 |
msgid "Show %s hidden notices"
|
1800 |
msgstr ""
|
1801 |
|
1802 |
+
#: admin/includes/class-overview-widgets.php:455
|
1803 |
msgid "How to install and activate an add-on."
|
1804 |
msgstr ""
|
1805 |
|
1806 |
+
#: admin/includes/class-overview-widgets.php:462
|
1807 |
msgid "The solution for professional websites."
|
1808 |
msgstr ""
|
1809 |
|
1810 |
+
#: admin/includes/class-overview-widgets.php:471
|
1811 |
#: admin/views/pitch-pro-tab.php:7
|
1812 |
msgid "support for cached sites"
|
1813 |
msgstr ""
|
1814 |
|
1815 |
+
#: admin/includes/class-overview-widgets.php:487
|
1816 |
+
#: admin/includes/class-overview-widgets.php:499
|
1817 |
+
#: admin/includes/class-overview-widgets.php:511
|
1818 |
+
#: admin/includes/class-overview-widgets.php:523
|
1819 |
#, php-format
|
1820 |
msgid "integrates with <strong>%s</strong>"
|
1821 |
msgstr ""
|
1822 |
|
1823 |
+
#: admin/includes/class-overview-widgets.php:528
|
1824 |
msgid "click fraud protection, lazy load, ad-block ads"
|
1825 |
msgstr ""
|
1826 |
|
1827 |
+
#: admin/includes/class-overview-widgets.php:529
|
1828 |
#: admin/views/pitch-pro-tab.php:8
|
1829 |
msgid "11 more display and visitor conditions"
|
1830 |
msgstr ""
|
1831 |
|
1832 |
+
#: admin/includes/class-overview-widgets.php:530
|
1833 |
#: admin/views/pitch-pro-tab.php:9
|
1834 |
msgid "6 more placements"
|
1835 |
msgstr ""
|
1836 |
|
1837 |
+
#: admin/includes/class-overview-widgets.php:531
|
1838 |
#: admin/views/pitch-pro-tab.php:10
|
1839 |
msgid "placement tests for ad optimization"
|
1840 |
msgstr ""
|
1841 |
|
1842 |
+
#: admin/includes/class-overview-widgets.php:532
|
1843 |
#: admin/views/pitch-pro-tab.php:11
|
1844 |
msgid "ad grids and many more advanced features"
|
1845 |
msgstr ""
|
1846 |
|
1847 |
+
#: admin/includes/class-overview-widgets.php:540
|
1848 |
msgid ""
|
1849 |
"Analyze clicks and impressions of your ads locally or in Google Analytics, "
|
1850 |
"share reports, and limit ads to a specific number of impressions or clicks."
|
1851 |
msgstr ""
|
1852 |
|
1853 |
+
#: admin/includes/class-overview-widgets.php:546
|
1854 |
msgid ""
|
1855 |
"Display ads based on the device or the size of your visitor’s browser, and "
|
1856 |
"control ads on AMP pages."
|
1857 |
msgstr ""
|
1858 |
|
1859 |
+
#: admin/includes/class-overview-widgets.php:559
|
1860 |
msgid ""
|
1861 |
"Earn more money and let advertisers pay for ad space directly on the "
|
1862 |
"frontend of your site."
|
1863 |
msgstr ""
|
1864 |
|
1865 |
+
#: admin/includes/class-overview-widgets.php:565
|
1866 |
msgid ""
|
1867 |
"Target visitors with ads that match their geo location and make more money "
|
1868 |
"with regional campaigns."
|
1869 |
msgstr ""
|
1870 |
|
1871 |
+
#: admin/includes/class-overview-widgets.php:571
|
1872 |
msgid ""
|
1873 |
"Increase click rates on your ads by placing them in sticky positions above, "
|
1874 |
"next or below your site."
|
1875 |
msgstr ""
|
1876 |
|
1877 |
+
#: admin/includes/class-overview-widgets.php:577
|
1878 |
msgid ""
|
1879 |
"Users will never miss an ad or other information in a PopUp. Choose when it "
|
1880 |
"shows up and for how long a user can close it."
|
1881 |
msgstr ""
|
1882 |
|
1883 |
+
#: admin/includes/class-overview-widgets.php:583
|
1884 |
msgid ""
|
1885 |
"Create a beautiful and simple slider from your ads to show more information "
|
1886 |
"on less space."
|
1887 |
msgstr ""
|
1888 |
|
1889 |
+
#: admin/includes/class-overview-widgets.php:589
|
1890 |
msgid ""
|
1891 |
"Place AdSense In-feed ads between posts on homepage, category, and archive "
|
1892 |
"pages."
|
1893 |
msgstr ""
|
1894 |
|
1895 |
+
#: admin/includes/class-overview-widgets.php:592
|
1896 |
+
#: admin/includes/class-overview-widgets.php:764
|
1897 |
+
#: admin/includes/class-overview-widgets.php:780
|
1898 |
msgid "Install now"
|
1899 |
msgstr ""
|
1900 |
|
1901 |
+
#: admin/includes/class-overview-widgets.php:610
|
1902 |
+
#: admin/includes/class-overview-widgets.php:628
|
1903 |
+
#: admin/includes/class-overview-widgets.php:653
|
1904 |
+
#: admin/includes/class-overview-widgets.php:671
|
1905 |
+
#: admin/includes/class-overview-widgets.php:689
|
1906 |
+
#: admin/includes/class-overview-widgets.php:707
|
1907 |
+
#: admin/includes/class-overview-widgets.php:725
|
1908 |
+
#: admin/includes/class-overview-widgets.php:743
|
1909 |
msgid "Activate now"
|
1910 |
msgstr ""
|
1911 |
|
1912 |
+
#: admin/includes/class-overview-widgets.php:636
|
1913 |
msgid "Visit your ad stats"
|
1914 |
msgstr ""
|
1915 |
|
1916 |
+
#: admin/includes/class-overview-widgets.php:760
|
1917 |
msgid "Use Genesis specific ad positions."
|
1918 |
msgstr ""
|
1919 |
|
1920 |
+
#: admin/includes/class-overview-widgets.php:776
|
1921 |
msgid ""
|
1922 |
"Manage ad positions with WPBakery Page Builder (formerly Visual Composer)."
|
1923 |
msgstr ""
|
1924 |
|
1925 |
+
#: admin/includes/class-overview-widgets.php:792
|
1926 |
msgid "Our best deal with all add-ons included."
|
1927 |
msgstr ""
|
1928 |
|
1929 |
+
#: admin/includes/class-overview-widgets.php:794
|
1930 |
msgid "Get full access"
|
1931 |
msgstr ""
|
1932 |
|
1933 |
+
#: admin/includes/class-overview-widgets.php:810
|
1934 |
#: admin/views/conditions/ad-display-metabox.php:37
|
1935 |
#: admin/views/conditions/ad-visitor-metabox.php:37
|
1936 |
msgid "Visit the manual"
|
1937 |
msgstr ""
|
1938 |
|
1939 |
+
#: admin/includes/class-overview-widgets.php:813
|
1940 |
msgid "Get this add-on"
|
1941 |
msgstr ""
|
1942 |
|
2089 |
msgid "Stop Wizard and show all options"
|
2090 |
msgstr ""
|
2091 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2092 |
#: admin/views/ad-group-edit.php:18
|
2093 |
msgid "You did not select an item for editing."
|
2094 |
msgstr ""
|
2463 |
msgid "reserve this space"
|
2464 |
msgstr ""
|
2465 |
|
2466 |
+
#: admin/views/ad-group.php:24
|
2467 |
msgid "Ad Group successfully created"
|
2468 |
msgstr ""
|
2469 |
|
2470 |
+
#: admin/views/ad-group.php:37
|
2471 |
msgid "Ad Groups successfully updated"
|
2472 |
msgstr ""
|
2473 |
|
2474 |
+
#: admin/views/ad-group.php:64
|
2475 |
#, php-format
|
2476 |
msgid "Search results for “%s”"
|
2477 |
msgstr ""
|
2478 |
|
2479 |
+
#: admin/views/ad-group.php:72
|
2480 |
msgid "Group title"
|
2481 |
msgstr ""
|
2482 |
|
2483 |
+
#: admin/views/ad-group.php:73
|
2484 |
msgid "save"
|
2485 |
msgstr ""
|
2486 |
|
2487 |
+
#: admin/views/ad-group.php:75
|
2488 |
msgid ""
|
2489 |
"Ad Groups are a very flexible method to bundle ads. You can use them to "
|
2490 |
"display random ads in the frontend or run split tests, but also just for "
|
2492 |
"ad can belong to multiple ad groups."
|
2493 |
msgstr ""
|
2494 |
|
2495 |
+
#: admin/views/ad-group.php:81
|
2496 |
#, php-format
|
2497 |
msgid ""
|
2498 |
"Find more information about ad groups in the <a href=\"%s\" "
|
2499 |
"target=\"_blank\">manual</a>."
|
2500 |
msgstr ""
|
2501 |
|
2502 |
+
#: admin/views/ad-group.php:119
|
2503 |
msgid "Update Groups"
|
2504 |
msgstr ""
|
2505 |
|
2815 |
msgid "Details"
|
2816 |
msgstr ""
|
2817 |
|
2818 |
+
#: admin/views/setting-license.php:10
|
2819 |
msgid "Your license expired."
|
2820 |
msgstr ""
|
2821 |
|
2822 |
+
#: admin/views/setting-license.php:18
|
2823 |
msgid "Update expiry date"
|
2824 |
msgstr ""
|
2825 |
|
2826 |
+
#: admin/views/setting-license.php:23
|
2827 |
#, php-format
|
2828 |
msgid ""
|
2829 |
"Click on %2$s if you renewed it or have a subscription or <a href=\"%1$s\" "
|
2830 |
"class=\"advads-renewal-link\" target=\"_blank\">renew your license</a>."
|
2831 |
msgstr ""
|
2832 |
|
2833 |
+
#: admin/views/setting-license.php:35
|
2834 |
#, php-format
|
2835 |
msgid "(%d days left)"
|
2836 |
msgstr ""
|
2837 |
|
2838 |
+
#: admin/views/setting-license.php:39
|
2839 |
msgid "License key"
|
2840 |
msgstr ""
|
2841 |
|
2842 |
+
#: admin/views/setting-license.php:56
|
2843 |
msgid "Deactivate License"
|
2844 |
msgstr ""
|
2845 |
|
2846 |
+
#: admin/views/setting-license.php:62
|
2847 |
msgid "Update License"
|
2848 |
msgstr ""
|
2849 |
|
2850 |
+
#: admin/views/setting-license.php:62
|
2851 |
msgid "Activate License"
|
2852 |
msgstr ""
|
2853 |
|
2854 |
+
#: admin/views/setting-license.php:67
|
2855 |
msgid "License key invalid"
|
2856 |
msgstr ""
|
2857 |
|
2858 |
+
#: admin/views/setting-license.php:75
|
2859 |
msgid "active"
|
2860 |
msgstr ""
|
2861 |
|
|
|
|
|
|
|
|
|
|
|
|
|
2862 |
#: admin/views/placements-ad-label-position.php:24
|
2863 |
msgid ""
|
2864 |
"Check this if you don't want the following elements to float around the ad. "
|
3715 |
msgid "Could not find the existing ads.txt file"
|
3716 |
msgstr ""
|
3717 |
|
3718 |
+
#: admin/views/settings/license/section.php:4
|
3719 |
+
#, php-format
|
3720 |
+
msgid ""
|
3721 |
+
"Enter license keys for our powerful <a href=\"%s\" target=\"_blank\">add-"
|
3722 |
+
"ons</a>."
|
3723 |
+
msgstr ""
|
3724 |
+
|
3725 |
+
#: admin/views/settings/license/section.php:18
|
3726 |
+
#, php-format
|
3727 |
+
msgid ""
|
3728 |
+
"See also <a href=\"%s\" target=\"_blank\">Issues and questions about "
|
3729 |
+
"licenses</a>."
|
3730 |
+
msgstr ""
|
3731 |
+
|
3732 |
+
#: admin/views/settings/general/content-injection-everywhere.php:2
|
3733 |
+
msgid ""
|
3734 |
+
"Some plugins and themes trigger ad injections where it shouldn’t happen. "
|
3735 |
+
"Therefore, Advanced Ads ignores injected placements on non-singular pages "
|
3736 |
+
"and outside the loop. However, this can cause problems with some themes. Set "
|
3737 |
+
"this option to -1 in order to enable unlimited ad injection at your own risk,"
|
3738 |
+
" set it to 0 to keep it disabled or choose a positive number to enable the "
|
3739 |
+
"injection only in the first x posts on your archive pages."
|
3740 |
+
msgstr ""
|
3741 |
+
|
3742 |
+
#: admin/views/settings/general/editors-manage-ads.php:2
|
3743 |
+
msgid "Allow editors to also manage and publish ads."
|
3744 |
+
msgstr ""
|
3745 |
+
|
3746 |
+
#: admin/views/settings/general/editors-manage-ads.php:7
|
3747 |
+
#, php-format
|
3748 |
+
msgid ""
|
3749 |
+
"You can assign different ad-related roles on a user basis with <a "
|
3750 |
+
"href=\"%s\" target=\"_blank\">Advanced Ads Pro</a>."
|
3751 |
+
msgstr ""
|
3752 |
+
|
3753 |
+
#: admin/views/settings/general/content-injection-level-limitation.php:2
|
3754 |
+
msgid ""
|
3755 |
+
"Advanced Ads ignores paragraphs and other elements in containers when "
|
3756 |
+
"injecting ads into the post content. Check this option to ignore this "
|
3757 |
+
"limitation and ads might show up again."
|
3758 |
+
msgstr ""
|
3759 |
+
|
3760 |
+
#: admin/views/settings/general/disable-shortcode-button.php:2
|
3761 |
+
msgid "Disable shortcode button in visual editor."
|
3762 |
+
msgstr ""
|
3763 |
+
|
3764 |
+
#: admin/views/settings/general/link-target.php:6
|
3765 |
+
msgid ""
|
3766 |
+
"Open programatically created links in a new window (use <code>"
|
3767 |
+
"target=\"_blank\"</code>)"
|
3768 |
+
msgstr ""
|
3769 |
+
|
3770 |
+
#: admin/views/settings/general/disable-ads.php:5
|
3771 |
+
msgid "Disable all ads in frontend"
|
3772 |
+
msgstr ""
|
3773 |
+
|
3774 |
+
#: admin/views/settings/general/disable-ads.php:6
|
3775 |
+
msgid ""
|
3776 |
+
"Use this option to disable all ads in the frontend, but still be able to use "
|
3777 |
+
"the plugin."
|
3778 |
+
msgstr ""
|
3779 |
+
|
3780 |
+
#: admin/views/settings/general/disable-ads.php:12
|
3781 |
+
msgid "Disable ads on 404 error pages"
|
3782 |
+
msgstr ""
|
3783 |
+
|
3784 |
+
#: admin/views/settings/general/disable-ads.php:18
|
3785 |
+
msgid "Disable ads on non-singular pages"
|
3786 |
+
msgstr ""
|
3787 |
+
|
3788 |
+
#: admin/views/settings/general/disable-ads.php:19
|
3789 |
+
msgid ""
|
3790 |
+
"e.g. archive pages like categories, tags, authors, front page (if a list)"
|
3791 |
+
msgstr ""
|
3792 |
+
|
3793 |
+
#: admin/views/settings/general/disable-ads.php:24
|
3794 |
+
msgid "Disable ads on secondary queries"
|
3795 |
+
msgstr ""
|
3796 |
+
|
3797 |
+
#: admin/views/settings/general/disable-ads.php:25
|
3798 |
+
msgid ""
|
3799 |
+
"Secondary queries are custom queries of posts outside the main query of a "
|
3800 |
+
"page. Try this option if you see ads injected on places where they shouldn’t "
|
3801 |
+
"appear."
|
3802 |
+
msgstr ""
|
3803 |
+
|
3804 |
+
#: admin/views/settings/general/disable-ads.php:31
|
3805 |
+
msgid "Disable ads in RSS Feed"
|
3806 |
+
msgstr ""
|
3807 |
+
|
3808 |
+
#: admin/views/settings/general/disable-ads.php:37
|
3809 |
+
msgid "Disable ads in REST API"
|
3810 |
+
msgstr ""
|
3811 |
+
|
3812 |
+
#: admin/views/settings/general/block-bots.php:9
|
3813 |
+
msgid "Read this first"
|
3814 |
+
msgstr ""
|
3815 |
+
|
3816 |
+
#: admin/views/settings/general/block-bots.php:10
|
3817 |
+
msgid "Hide ads from crawlers, bots and empty user agents."
|
3818 |
+
msgstr ""
|
3819 |
+
|
3820 |
+
#. %1$s is a starting <a> tag and %2$s a closing one
|
3821 |
+
#: admin/views/settings/general/disable-notices.php:6
|
3822 |
+
#, php-format
|
3823 |
+
msgid ""
|
3824 |
+
"Disable %1$sAd Health%2$s in frontend and backend, warnings and internal "
|
3825 |
+
"notices like tips, tutorials, email newsletters and update notices."
|
3826 |
+
msgstr ""
|
3827 |
+
|
3828 |
+
#: admin/views/settings/general/uninstall-delete-data.php:3
|
3829 |
+
msgid "Clean up all data related to Advanced Ads when removing the plugin."
|
3830 |
+
msgstr ""
|
3831 |
+
|
3832 |
+
#: admin/views/settings/general/disable-post-types.php:1
|
3833 |
+
msgid "Pro feature"
|
3834 |
+
msgstr ""
|
3835 |
+
|
3836 |
+
#: admin/views/settings/general/hide-for-user-role.php:14
|
3837 |
+
msgid "Choose the roles a user must have in order to not see any ads."
|
3838 |
+
msgstr ""
|
3839 |
+
|
3840 |
+
#: admin/views/settings/general/custom-label.php:7
|
3841 |
+
msgid "Displayed above ads."
|
3842 |
+
msgstr ""
|
3843 |
+
|
3844 |
+
#: admin/views/settings/general/advanced-js.php:4
|
3845 |
+
msgid "The file is currently enabled by an add-on that needs it."
|
3846 |
+
msgstr ""
|
3847 |
+
|
3848 |
+
#: admin/views/settings/general/advanced-js.php:14
|
3849 |
+
#, php-format
|
3850 |
+
msgid ""
|
3851 |
+
"Enable advanced JavaScript functions (<a href=\"%s\" target=\"_blank\">"
|
3852 |
+
"here</a>). Some features and add-ons might override this setting if they "
|
3853 |
+
"need features from this file."
|
3854 |
+
msgstr ""
|
3855 |
+
|
3856 |
+
#: admin/views/settings/general/content-injection-priority.php:6
|
3857 |
+
msgid ""
|
3858 |
+
"Please check your post content. A priority of 10 and below might cause "
|
3859 |
+
"issues (wpautop function might run twice)."
|
3860 |
+
msgstr ""
|
3861 |
+
|
3862 |
+
#: admin/views/settings/general/content-injection-priority.php:9
|
3863 |
+
msgid ""
|
3864 |
+
"Play with this value in order to change the priority of the injected ads "
|
3865 |
+
"compared to other auto injected elements in the post content."
|
3866 |
+
msgstr ""
|
3867 |
+
|
3868 |
+
#: admin/views/settings/general/frontend-prefix.php:4
|
3869 |
+
msgid "Prefix of class and id attributes for elements created in the frontend."
|
3870 |
+
msgstr ""
|
3871 |
+
|
3872 |
#: modules/gadsense/admin/views/adsense-account.php:29
|
3873 |
msgid "AdSense warnings"
|
3874 |
msgstr ""
|
lib/composer/ClassLoader.php
CHANGED
@@ -10,12 +10,12 @@
|
|
10 |
* file that was distributed with this source code.
|
11 |
*/
|
12 |
|
13 |
-
namespace
|
14 |
|
15 |
/**
|
16 |
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
17 |
*
|
18 |
-
* $loader = new \
|
19 |
*
|
20 |
* // register classes with namespaces
|
21 |
* $loader->add('Symfony\Component', __DIR__.'/component');
|
10 |
* file that was distributed with this source code.
|
11 |
*/
|
12 |
|
13 |
+
namespace AdvancedAds\Autoload;
|
14 |
|
15 |
/**
|
16 |
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
17 |
*
|
18 |
+
* $loader = new \AdvancedAds\Autoload\ClassLoader();
|
19 |
*
|
20 |
* // register classes with namespaces
|
21 |
* $loader->add('Symfony\Component', __DIR__.'/component');
|
lib/composer/autoload_real.php
CHANGED
@@ -8,7 +8,7 @@ class ComposerAutoloaderInit_advanced_ads
|
|
8 |
|
9 |
public static function loadClassLoader($class)
|
10 |
{
|
11 |
-
if ('
|
12 |
require __DIR__ . '/ClassLoader.php';
|
13 |
}
|
14 |
}
|
@@ -20,14 +20,14 @@ class ComposerAutoloaderInit_advanced_ads
|
|
20 |
}
|
21 |
|
22 |
spl_autoload_register(array('ComposerAutoloaderInit_advanced_ads', 'loadClassLoader'), true, true);
|
23 |
-
self::$loader = $loader = new \
|
24 |
spl_autoload_unregister(array('ComposerAutoloaderInit_advanced_ads', 'loadClassLoader'));
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
-
call_user_func(\
|
31 |
} else {
|
32 |
$classMap = require __DIR__ . '/autoload_classmap.php';
|
33 |
if ($classMap) {
|
8 |
|
9 |
public static function loadClassLoader($class)
|
10 |
{
|
11 |
+
if ('AdvancedAds\Autoload\ClassLoader' === $class) {
|
12 |
require __DIR__ . '/ClassLoader.php';
|
13 |
}
|
14 |
}
|
20 |
}
|
21 |
|
22 |
spl_autoload_register(array('ComposerAutoloaderInit_advanced_ads', 'loadClassLoader'), true, true);
|
23 |
+
self::$loader = $loader = new \AdvancedAds\Autoload\ClassLoader();
|
24 |
spl_autoload_unregister(array('ComposerAutoloaderInit_advanced_ads', 'loadClassLoader'));
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
+
call_user_func(\AdvancedAds\Autoload\ComposerStaticInit_advanced_ads::getInitializer($loader));
|
31 |
} else {
|
32 |
$classMap = require __DIR__ . '/autoload_classmap.php';
|
33 |
if ($classMap) {
|
lib/composer/autoload_static.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_static.php @generated by Composer
|
4 |
|
5 |
-
namespace
|
6 |
|
7 |
class ComposerStaticInit_advanced_ads
|
8 |
{
|
2 |
|
3 |
// autoload_static.php @generated by Composer
|
4 |
|
5 |
+
namespace AdvancedAds\Autoload;
|
6 |
|
7 |
class ComposerStaticInit_advanced_ads
|
8 |
{
|
public/class-advanced-ads.php
CHANGED
@@ -21,7 +21,6 @@ class Advanced_Ads {
|
|
21 |
/**
|
22 |
* Post type slug
|
23 |
*
|
24 |
-
* @since 1.0.0
|
25 |
* @var string
|
26 |
*/
|
27 |
const POST_TYPE_SLUG = 'advanced_ads';
|
@@ -29,7 +28,6 @@ class Advanced_Ads {
|
|
29 |
/**
|
30 |
* Ad group slug
|
31 |
*
|
32 |
-
* @since 1.0.0
|
33 |
* @var string
|
34 |
*/
|
35 |
const AD_GROUP_TAXONOMY = 'advanced_ads_groups';
|
@@ -37,7 +35,6 @@ class Advanced_Ads {
|
|
37 |
/**
|
38 |
* Instance of this class.
|
39 |
*
|
40 |
-
* @since 1.0.0
|
41 |
* @var object
|
42 |
*/
|
43 |
private static $instance = null;
|
@@ -59,7 +56,6 @@ class Advanced_Ads {
|
|
59 |
/**
|
60 |
* Plugin options
|
61 |
*
|
62 |
-
* @since 1.0.1
|
63 |
* @var array (if loaded)
|
64 |
*/
|
65 |
protected $options = false;
|
@@ -67,7 +63,6 @@ class Advanced_Ads {
|
|
67 |
/**
|
68 |
* Interal plugin options – set by the plugin
|
69 |
*
|
70 |
-
* @since 1.4.5
|
71 |
* @var array (if loaded)
|
72 |
*/
|
73 |
protected $internal_options = false;
|
@@ -82,7 +77,6 @@ class Advanced_Ads {
|
|
82 |
/**
|
83 |
* List of bots and crawlers to exclude from ad impressions
|
84 |
*
|
85 |
-
* @since 1.4.9
|
86 |
* @var array list of bots
|
87 |
*/
|
88 |
protected $bots = array( 'bot', 'spider', 'crawler', 'scraper', 'parser', '008', 'Accoona-AI-Agent', 'ADmantX', 'alexa', 'appie', 'Apple-PubSub', 'Arachmo', 'Ask Jeeves', 'avira\.com', 'B-l-i-t-z-B-O-T', 'boitho\.com-dc', 'BUbiNG', 'Cerberian Drtrs', 'Charlotte', 'cosmos', 'Covario IDS', 'curl', 'DataparkSearch', 'DDG-Android', 'expo9', 'facebookexternalhit', 'Feedfetcher-Google', 'FindLinks', 'Firefly', 'froogle', 'Genieo', 'heritrix', 'Holmes', 'htdig', 'https://developers\.google\.com', 'ia_archiver', 'ichiro', 'igdeSpyder', 'InfoSeek', 'inktomi', 'Kraken', 'L\.webis', 'Larbin', 'Linguee', 'LinkWalker', 'looksmart', 'lwp-trivial', 'mabontland', 'Mnogosearch', 'mogimogi', 'Morning Paper', 'MVAClient', 'NationalDirectory', 'NetResearchServer', 'NewsGator', 'NG-Search', 'Nusearch', 'NutchCVS', 'Nymesis', 'oegp', 'Orbiter', 'Peew', 'Pompos', 'PostPost', 'proximic', 'PycURL', 'Qseero', 'rabaz', 'Radian6', 'Reeder', 'savetheworldheritage', 'SBIder', 'Scooter', 'ScoutJet', 'Scrubby', 'SearchSight', 'semanticdiscovery', 'Sensis', 'ShopWiki', 'silk', 'Snappy', 'Spade', 'Sqworm', 'StackRambler', 'TechnoratiSnoop', 'TECNOSEEK', 'Teoma', 'Thumbnail\.CZ', 'TinEye', 'truwoGPS', 'updated', 'Vagabondo', 'voltron', 'Vortex', 'voyager', 'VYU2', 'WebBug', 'webcollage', 'WebIndex', 'Websquash\.com', 'WeSEE:Ads', 'wf84', 'Wget', 'WomlpeFactory', 'WordPress', 'yacy', 'Yahoo! Slurp', 'Yahoo! Slurp China', 'YahooSeeker', 'YahooSeeker-Testing', 'YandexBot', 'YandexMedia', 'YandexBlogs', 'YandexNews', 'YandexCalendar', 'YandexImages', 'Yeti', 'yoogliFetchAgent', 'Zao', 'ZyBorg', 'okhttp', 'ips-agent', 'ltx71', 'Optimizer', 'Daum', 'Qwantify' );
|
@@ -148,7 +142,6 @@ class Advanced_Ads {
|
|
148 |
/**
|
149 |
* Return an instance of this class.
|
150 |
*
|
151 |
-
* @since 1.0.0
|
152 |
* @return Advanced_Ads A single instance of this class.
|
153 |
*/
|
154 |
public static function get_instance() {
|
@@ -180,12 +173,11 @@ class Advanced_Ads {
|
|
180 |
/**
|
181 |
* Initialize the plugin by setting localization and loading public scripts
|
182 |
* and styles.
|
183 |
-
*
|
184 |
-
* @since 1.0.0
|
185 |
*/
|
186 |
public function wp_plugins_loaded() {
|
187 |
// register hook for global constants.
|
188 |
add_action( 'wp', array( $this, 'set_disabled_constant' ) );
|
|
|
189 |
|
190 |
// setup default ad types.
|
191 |
add_filter( 'advanced-ads-ad-types', array( $this, 'setup_default_ad_types' ), 5 );
|
@@ -195,7 +187,7 @@ class Advanced_Ads {
|
|
195 |
|
196 |
// add meta robots noindex, nofollow to images, which are part of 'Image ad' ad type.
|
197 |
add_action( 'wp_head', array( $this, 'noindex_attachment_images' ) );
|
198 |
-
|
199 |
// use custom CSS or other custom header code.
|
200 |
add_action( 'wp_head', array( $this, 'custom_header_code' ) );
|
201 |
|
@@ -213,8 +205,6 @@ class Advanced_Ads {
|
|
213 |
|
214 |
/**
|
215 |
* Init / load plugin specific functions and settings
|
216 |
-
*
|
217 |
-
* @since 1.0.0
|
218 |
*/
|
219 |
public function wp_init() {
|
220 |
// load ad post types.
|
@@ -229,8 +219,6 @@ class Advanced_Ads {
|
|
229 |
* description => publically readable description
|
230 |
* editor => kind of editor: text (normal text field), content (WP content field), none (no content field)
|
231 |
* will display text field, if left empty
|
232 |
-
*
|
233 |
-
* @since 1.0.0
|
234 |
*/
|
235 |
public function set_ad_types() {
|
236 |
|
@@ -259,8 +247,6 @@ class Advanced_Ads {
|
|
259 |
|
260 |
/**
|
261 |
* Set global constant that prevents ads from being displayed on the current page view
|
262 |
-
*
|
263 |
-
* @since 1.3.10
|
264 |
*/
|
265 |
public function set_disabled_constant() {
|
266 |
|
@@ -278,6 +264,14 @@ class Advanced_Ads {
|
|
278 |
return;
|
279 |
}
|
280 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
281 |
// check if ads are disabled from 404 pages.
|
282 |
if ( $wp_the_query->is_404() && ! empty( $options['disabled-ads']['404'] ) ) {
|
283 |
define( 'ADVADS_ADS_DISABLED', true );
|
@@ -342,8 +336,7 @@ class Advanced_Ads {
|
|
342 |
/**
|
343 |
* Return the plugin slug.
|
344 |
*
|
345 |
-
* @
|
346 |
-
* @return Plugin slug variable.
|
347 |
*/
|
348 |
public function get_plugin_slug() {
|
349 |
return $this->plugin->get_plugin_slug();
|
@@ -352,8 +345,8 @@ class Advanced_Ads {
|
|
352 |
/**
|
353 |
* Add plain and content ad types to the default ads of the plugin using a filter
|
354 |
*
|
355 |
-
* @param
|
356 |
-
* @
|
357 |
*/
|
358 |
public function setup_default_ad_types( $types ) {
|
359 |
$types['plain'] = new Advanced_Ads_Ad_Type_Plain(); /* plain text and php code */
|
@@ -368,7 +361,6 @@ class Advanced_Ads {
|
|
368 |
* Log error messages when debug is enabled
|
369 |
*
|
370 |
* @param string $message error message.
|
371 |
-
* @since 1.0.0
|
372 |
* @link http://www.smashingmagazine.com/2011/03/08/ten-things-every-wordpress-plugin-developer-should-know/
|
373 |
*/
|
374 |
public static function log( $message ) {
|
@@ -404,8 +396,6 @@ class Advanced_Ads {
|
|
404 |
|
405 |
/**
|
406 |
* Injected ad into header
|
407 |
-
*
|
408 |
-
* @since 1.1.0
|
409 |
*/
|
410 |
public function inject_header() {
|
411 |
$placements = get_option( 'advads-ads-placements', array() );
|
@@ -413,6 +403,8 @@ class Advanced_Ads {
|
|
413 |
foreach ( $placements as $_placement_id => $_placement ) {
|
414 |
if ( isset( $_placement['type'] ) && 'header' === $_placement['type'] ) {
|
415 |
$_options = isset( $_placement['options'] ) ? $_placement['options'] : array();
|
|
|
|
|
416 |
echo Advanced_Ads_Select::get_instance()->get_ad_by_method( $_placement_id, Advanced_Ads_Select::PLACEMENT, $_options );
|
417 |
}
|
418 |
}
|
@@ -430,6 +422,8 @@ class Advanced_Ads {
|
|
430 |
foreach ( $placements as $_placement_id => $_placement ) {
|
431 |
if ( isset( $_placement['type'] ) && 'footer' === $_placement['type'] ) {
|
432 |
$_options = isset( $_placement['options'] ) ? $_placement['options'] : array();
|
|
|
|
|
433 |
echo Advanced_Ads_Select::get_instance()->get_ad_by_method( $_placement_id, Advanced_Ads_Select::PLACEMENT, $_options );
|
434 |
}
|
435 |
}
|
@@ -440,8 +434,9 @@ class Advanced_Ads {
|
|
440 |
* Injected ad into content (before and after)
|
441 |
* Displays ALL ads
|
442 |
*
|
443 |
-
* @
|
444 |
-
*
|
|
|
445 |
*/
|
446 |
public function inject_content( $content = '' ) {
|
447 |
$options = $this->plugin->options();
|
@@ -451,18 +446,6 @@ class Advanced_Ads {
|
|
451 |
return $content;
|
452 |
}
|
453 |
|
454 |
-
if ( $this->has_many_the_content() ) {
|
455 |
-
if ( current_user_can( 'advanced_ads_place_ads' ) ) {
|
456 |
-
global $wp;
|
457 |
-
Advanced_Ads::log( sprintf( 'More then one `the_content` in the stack (%s): %s, %s',
|
458 |
-
ADVADS_URL . 'manual/ad-health/#the_content_filter_found_multiple_times',
|
459 |
-
isset( $wp->request ) ? $wp->request : '',
|
460 |
-
wp_debug_backtrace_summary() )
|
461 |
-
);
|
462 |
-
}
|
463 |
-
return $content;
|
464 |
-
}
|
465 |
-
|
466 |
// Check if ads are disabled in secondary queries.
|
467 |
if ( ! empty( $options['disabled-ads']['secondary'] ) ) {
|
468 |
// this function was called by ajax (in secondary query).
|
@@ -485,7 +468,9 @@ class Advanced_Ads {
|
|
485 |
array(
|
486 |
'public' => true,
|
487 |
'publicly_queryable' => true,
|
488 |
-
),
|
|
|
|
|
489 |
);
|
490 |
|
491 |
// make sure that no ad is injected into another ad.
|
@@ -544,9 +529,8 @@ class Advanced_Ads {
|
|
544 |
* Load all ads based on WP_Query conditions
|
545 |
*
|
546 |
* @deprecated 1.4.8 use model class
|
547 |
-
* @
|
548 |
-
* @
|
549 |
-
* @return arr $ads array with post objects
|
550 |
*/
|
551 |
public static function get_ads( $args = array() ) {
|
552 |
return self::get_instance()->get_model()->get_ads( $args );
|
@@ -556,9 +540,8 @@ class Advanced_Ads {
|
|
556 |
* Load all ad groups
|
557 |
*
|
558 |
* @deprecated 1.4.8 use model class
|
559 |
-
* @
|
560 |
-
* @
|
561 |
-
* @return arr $groups array with ad groups
|
562 |
* @link http://codex.wordpress.org/Function_Reference/get_terms
|
563 |
*/
|
564 |
public static function get_ad_groups( $args = array() ) {
|
@@ -568,9 +551,8 @@ class Advanced_Ads {
|
|
568 |
/**
|
569 |
* Get the array with ad placements
|
570 |
*
|
571 |
-
* @since 1.1.0
|
572 |
* @deprecated 1.4.8 use model
|
573 |
-
* @return
|
574 |
*/
|
575 |
public static function get_ad_placements_array() {
|
576 |
return self::get_instance()->get_model()->get_ad_placements_array();
|
@@ -589,7 +571,6 @@ class Advanced_Ads {
|
|
589 |
/**
|
590 |
* General check if ads can be displayed for the whole page impression
|
591 |
*
|
592 |
-
* @since 1.4.9
|
593 |
* @return bool true, if ads can be displayed.
|
594 |
* @todo move this to set_disabled_constant().
|
595 |
*/
|
@@ -669,8 +650,6 @@ class Advanced_Ads {
|
|
669 |
|
670 |
/**
|
671 |
* Registers ad post type and group taxonomies
|
672 |
-
*
|
673 |
-
* @since 1.0.0
|
674 |
*/
|
675 |
public function create_post_types() {
|
676 |
if ( 1 !== did_action( 'init' ) && 1 !== did_action( 'uninstall_' . ADVADS_BASE ) ) {
|
@@ -693,7 +672,6 @@ class Advanced_Ads {
|
|
693 |
/**
|
694 |
* Defines the parameters for the ad post type taxonomy
|
695 |
*
|
696 |
-
* @since 1.0.0
|
697 |
* @return array
|
698 |
*/
|
699 |
protected function get_group_taxonomy_params() {
|
@@ -730,7 +708,6 @@ class Advanced_Ads {
|
|
730 |
/**
|
731 |
* Defines the parameters for the custom post type
|
732 |
*
|
733 |
-
* @since 1.0.0
|
734 |
* @return array
|
735 |
*/
|
736 |
protected function get_post_type_params() {
|
@@ -800,8 +777,8 @@ class Advanced_Ads {
|
|
800 |
global $post;
|
801 |
|
802 |
if ( is_attachment() && is_object( $post ) && isset( $post->post_parent ) ) {
|
803 |
-
$post_parent
|
804 |
-
$parent_is_ad = $post_parent && self::POST_TYPE_SLUG
|
805 |
// if the image was not attached to any post and if at least one image ad contains the image. Needed for backward compatibility.
|
806 |
$parent_is_image_ad = ( empty( $post->post_parent ) && 0 < get_post_meta( get_the_ID(), '_advanced-ads_parent_id', true ) );
|
807 |
|
@@ -810,19 +787,17 @@ class Advanced_Ads {
|
|
810 |
}
|
811 |
}
|
812 |
}
|
813 |
-
|
814 |
/**
|
815 |
* Show custom CSS in the header
|
816 |
-
*
|
817 |
-
* @since 1.10.8
|
818 |
*/
|
819 |
public function custom_header_code(){
|
820 |
if ( ! defined( 'ADVANCED_ADS_DISABLE_EDIT_BAR' ) && current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads') ) ){
|
821 |
?><style>
|
822 |
div.advads-edit-bar{position:relative;top:0;left:0;height:0;display:none;z-index:10000;animation:advads-edit-appear 2s linear 1;}
|
823 |
-
|
824 |
0% {opacity: 0.0;pointer-events: none;}
|
825 |
-
|
826 |
100% {opacity: 1.0;}
|
827 |
}
|
828 |
a.advads-edit-button{position:absolute;top:0;left:0;text-decoration:none !important;box-shadow:none;border-bottom:none;color:#0074a2;margin-top:-5px;}
|
@@ -937,18 +912,18 @@ class Advanced_Ads {
|
|
937 |
* Makes sense only when a hooked to `the_content` function that produces an inner `the_content` has
|
938 |
* lesser priority then `$this->plugin->get_content_injection_priority()`.
|
939 |
*
|
940 |
-
* @param string Post content.
|
941 |
-
*
|
|
|
942 |
*/
|
943 |
-
function set_was_in_the_loop( $content ) {
|
944 |
-
if (
|
945 |
$this->was_in_the_loop = $this->was_in_the_loop || in_the_loop();
|
946 |
} else {
|
947 |
// Next top level `the_content`, forget that the loop started.
|
948 |
$this->was_in_the_loop = false;
|
949 |
}
|
950 |
|
951 |
-
|
952 |
return $content;
|
953 |
}
|
954 |
}
|
21 |
/**
|
22 |
* Post type slug
|
23 |
*
|
|
|
24 |
* @var string
|
25 |
*/
|
26 |
const POST_TYPE_SLUG = 'advanced_ads';
|
28 |
/**
|
29 |
* Ad group slug
|
30 |
*
|
|
|
31 |
* @var string
|
32 |
*/
|
33 |
const AD_GROUP_TAXONOMY = 'advanced_ads_groups';
|
35 |
/**
|
36 |
* Instance of this class.
|
37 |
*
|
|
|
38 |
* @var object
|
39 |
*/
|
40 |
private static $instance = null;
|
56 |
/**
|
57 |
* Plugin options
|
58 |
*
|
|
|
59 |
* @var array (if loaded)
|
60 |
*/
|
61 |
protected $options = false;
|
63 |
/**
|
64 |
* Interal plugin options – set by the plugin
|
65 |
*
|
|
|
66 |
* @var array (if loaded)
|
67 |
*/
|
68 |
protected $internal_options = false;
|
77 |
/**
|
78 |
* List of bots and crawlers to exclude from ad impressions
|
79 |
*
|
|
|
80 |
* @var array list of bots
|
81 |
*/
|
82 |
protected $bots = array( 'bot', 'spider', 'crawler', 'scraper', 'parser', '008', 'Accoona-AI-Agent', 'ADmantX', 'alexa', 'appie', 'Apple-PubSub', 'Arachmo', 'Ask Jeeves', 'avira\.com', 'B-l-i-t-z-B-O-T', 'boitho\.com-dc', 'BUbiNG', 'Cerberian Drtrs', 'Charlotte', 'cosmos', 'Covario IDS', 'curl', 'DataparkSearch', 'DDG-Android', 'expo9', 'facebookexternalhit', 'Feedfetcher-Google', 'FindLinks', 'Firefly', 'froogle', 'Genieo', 'heritrix', 'Holmes', 'htdig', 'https://developers\.google\.com', 'ia_archiver', 'ichiro', 'igdeSpyder', 'InfoSeek', 'inktomi', 'Kraken', 'L\.webis', 'Larbin', 'Linguee', 'LinkWalker', 'looksmart', 'lwp-trivial', 'mabontland', 'Mnogosearch', 'mogimogi', 'Morning Paper', 'MVAClient', 'NationalDirectory', 'NetResearchServer', 'NewsGator', 'NG-Search', 'Nusearch', 'NutchCVS', 'Nymesis', 'oegp', 'Orbiter', 'Peew', 'Pompos', 'PostPost', 'proximic', 'PycURL', 'Qseero', 'rabaz', 'Radian6', 'Reeder', 'savetheworldheritage', 'SBIder', 'Scooter', 'ScoutJet', 'Scrubby', 'SearchSight', 'semanticdiscovery', 'Sensis', 'ShopWiki', 'silk', 'Snappy', 'Spade', 'Sqworm', 'StackRambler', 'TechnoratiSnoop', 'TECNOSEEK', 'Teoma', 'Thumbnail\.CZ', 'TinEye', 'truwoGPS', 'updated', 'Vagabondo', 'voltron', 'Vortex', 'voyager', 'VYU2', 'WebBug', 'webcollage', 'WebIndex', 'Websquash\.com', 'WeSEE:Ads', 'wf84', 'Wget', 'WomlpeFactory', 'WordPress', 'yacy', 'Yahoo! Slurp', 'Yahoo! Slurp China', 'YahooSeeker', 'YahooSeeker-Testing', 'YandexBot', 'YandexMedia', 'YandexBlogs', 'YandexNews', 'YandexCalendar', 'YandexImages', 'Yeti', 'yoogliFetchAgent', 'Zao', 'ZyBorg', 'okhttp', 'ips-agent', 'ltx71', 'Optimizer', 'Daum', 'Qwantify' );
|
142 |
/**
|
143 |
* Return an instance of this class.
|
144 |
*
|
|
|
145 |
* @return Advanced_Ads A single instance of this class.
|
146 |
*/
|
147 |
public static function get_instance() {
|
173 |
/**
|
174 |
* Initialize the plugin by setting localization and loading public scripts
|
175 |
* and styles.
|
|
|
|
|
176 |
*/
|
177 |
public function wp_plugins_loaded() {
|
178 |
// register hook for global constants.
|
179 |
add_action( 'wp', array( $this, 'set_disabled_constant' ) );
|
180 |
+
add_action( 'rest_api_init', array( $this, 'set_disabled_constant' ) );
|
181 |
|
182 |
// setup default ad types.
|
183 |
add_filter( 'advanced-ads-ad-types', array( $this, 'setup_default_ad_types' ), 5 );
|
187 |
|
188 |
// add meta robots noindex, nofollow to images, which are part of 'Image ad' ad type.
|
189 |
add_action( 'wp_head', array( $this, 'noindex_attachment_images' ) );
|
190 |
+
|
191 |
// use custom CSS or other custom header code.
|
192 |
add_action( 'wp_head', array( $this, 'custom_header_code' ) );
|
193 |
|
205 |
|
206 |
/**
|
207 |
* Init / load plugin specific functions and settings
|
|
|
|
|
208 |
*/
|
209 |
public function wp_init() {
|
210 |
// load ad post types.
|
219 |
* description => publically readable description
|
220 |
* editor => kind of editor: text (normal text field), content (WP content field), none (no content field)
|
221 |
* will display text field, if left empty
|
|
|
|
|
222 |
*/
|
223 |
public function set_ad_types() {
|
224 |
|
247 |
|
248 |
/**
|
249 |
* Set global constant that prevents ads from being displayed on the current page view
|
|
|
|
|
250 |
*/
|
251 |
public function set_disabled_constant() {
|
252 |
|
264 |
return;
|
265 |
}
|
266 |
|
267 |
+
// Check if ads are disabled in REST API.
|
268 |
+
if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
|
269 |
+
if ( ! empty( $options['disabled-ads']['rest-api'] ) ) {
|
270 |
+
define( 'ADVADS_ADS_DISABLED', true );
|
271 |
+
}
|
272 |
+
return;
|
273 |
+
}
|
274 |
+
|
275 |
// check if ads are disabled from 404 pages.
|
276 |
if ( $wp_the_query->is_404() && ! empty( $options['disabled-ads']['404'] ) ) {
|
277 |
define( 'ADVADS_ADS_DISABLED', true );
|
336 |
/**
|
337 |
* Return the plugin slug.
|
338 |
*
|
339 |
+
* @return string Plugin slug variable.
|
|
|
340 |
*/
|
341 |
public function get_plugin_slug() {
|
342 |
return $this->plugin->get_plugin_slug();
|
345 |
/**
|
346 |
* Add plain and content ad types to the default ads of the plugin using a filter
|
347 |
*
|
348 |
+
* @param array $types array with ad types.
|
349 |
+
* @return array
|
350 |
*/
|
351 |
public function setup_default_ad_types( $types ) {
|
352 |
$types['plain'] = new Advanced_Ads_Ad_Type_Plain(); /* plain text and php code */
|
361 |
* Log error messages when debug is enabled
|
362 |
*
|
363 |
* @param string $message error message.
|
|
|
364 |
* @link http://www.smashingmagazine.com/2011/03/08/ten-things-every-wordpress-plugin-developer-should-know/
|
365 |
*/
|
366 |
public static function log( $message ) {
|
396 |
|
397 |
/**
|
398 |
* Injected ad into header
|
|
|
|
|
399 |
*/
|
400 |
public function inject_header() {
|
401 |
$placements = get_option( 'advads-ads-placements', array() );
|
403 |
foreach ( $placements as $_placement_id => $_placement ) {
|
404 |
if ( isset( $_placement['type'] ) && 'header' === $_placement['type'] ) {
|
405 |
$_options = isset( $_placement['options'] ) ? $_placement['options'] : array();
|
406 |
+
// injecting ad code so we don’t run escaping here.
|
407 |
+
// phpcs:ignore
|
408 |
echo Advanced_Ads_Select::get_instance()->get_ad_by_method( $_placement_id, Advanced_Ads_Select::PLACEMENT, $_options );
|
409 |
}
|
410 |
}
|
422 |
foreach ( $placements as $_placement_id => $_placement ) {
|
423 |
if ( isset( $_placement['type'] ) && 'footer' === $_placement['type'] ) {
|
424 |
$_options = isset( $_placement['options'] ) ? $_placement['options'] : array();
|
425 |
+
// injecting ad code so we don’t run escaping here.
|
426 |
+
// phpcs:ignore
|
427 |
echo Advanced_Ads_Select::get_instance()->get_ad_by_method( $_placement_id, Advanced_Ads_Select::PLACEMENT, $_options );
|
428 |
}
|
429 |
}
|
434 |
* Injected ad into content (before and after)
|
435 |
* Displays ALL ads
|
436 |
*
|
437 |
+
* @param string $content post content.
|
438 |
+
*
|
439 |
+
* @return string
|
440 |
*/
|
441 |
public function inject_content( $content = '' ) {
|
442 |
$options = $this->plugin->options();
|
446 |
return $content;
|
447 |
}
|
448 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
449 |
// Check if ads are disabled in secondary queries.
|
450 |
if ( ! empty( $options['disabled-ads']['secondary'] ) ) {
|
451 |
// this function was called by ajax (in secondary query).
|
468 |
array(
|
469 |
'public' => true,
|
470 |
'publicly_queryable' => true,
|
471 |
+
),
|
472 |
+
'names',
|
473 |
+
'or'
|
474 |
);
|
475 |
|
476 |
// make sure that no ad is injected into another ad.
|
529 |
* Load all ads based on WP_Query conditions
|
530 |
*
|
531 |
* @deprecated 1.4.8 use model class
|
532 |
+
* @param array $args WP_Query arguments that are more specific that default.
|
533 |
+
* @return array $ads array with post objects
|
|
|
534 |
*/
|
535 |
public static function get_ads( $args = array() ) {
|
536 |
return self::get_instance()->get_model()->get_ads( $args );
|
540 |
* Load all ad groups
|
541 |
*
|
542 |
* @deprecated 1.4.8 use model class
|
543 |
+
* @param array $args array with options.
|
544 |
+
* @return array $groups array with ad groups
|
|
|
545 |
* @link http://codex.wordpress.org/Function_Reference/get_terms
|
546 |
*/
|
547 |
public static function get_ad_groups( $args = array() ) {
|
551 |
/**
|
552 |
* Get the array with ad placements
|
553 |
*
|
|
|
554 |
* @deprecated 1.4.8 use model
|
555 |
+
* @return array $ad_placements
|
556 |
*/
|
557 |
public static function get_ad_placements_array() {
|
558 |
return self::get_instance()->get_model()->get_ad_placements_array();
|
571 |
/**
|
572 |
* General check if ads can be displayed for the whole page impression
|
573 |
*
|
|
|
574 |
* @return bool true, if ads can be displayed.
|
575 |
* @todo move this to set_disabled_constant().
|
576 |
*/
|
650 |
|
651 |
/**
|
652 |
* Registers ad post type and group taxonomies
|
|
|
|
|
653 |
*/
|
654 |
public function create_post_types() {
|
655 |
if ( 1 !== did_action( 'init' ) && 1 !== did_action( 'uninstall_' . ADVADS_BASE ) ) {
|
672 |
/**
|
673 |
* Defines the parameters for the ad post type taxonomy
|
674 |
*
|
|
|
675 |
* @return array
|
676 |
*/
|
677 |
protected function get_group_taxonomy_params() {
|
708 |
/**
|
709 |
* Defines the parameters for the custom post type
|
710 |
*
|
|
|
711 |
* @return array
|
712 |
*/
|
713 |
protected function get_post_type_params() {
|
777 |
global $post;
|
778 |
|
779 |
if ( is_attachment() && is_object( $post ) && isset( $post->post_parent ) ) {
|
780 |
+
$post_parent = get_post( $post->post_parent );
|
781 |
+
$parent_is_ad = $post_parent && self::POST_TYPE_SLUG === $post_parent->post_type;
|
782 |
// if the image was not attached to any post and if at least one image ad contains the image. Needed for backward compatibility.
|
783 |
$parent_is_image_ad = ( empty( $post->post_parent ) && 0 < get_post_meta( get_the_ID(), '_advanced-ads_parent_id', true ) );
|
784 |
|
787 |
}
|
788 |
}
|
789 |
}
|
790 |
+
|
791 |
/**
|
792 |
* Show custom CSS in the header
|
|
|
|
|
793 |
*/
|
794 |
public function custom_header_code(){
|
795 |
if ( ! defined( 'ADVANCED_ADS_DISABLE_EDIT_BAR' ) && current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads') ) ){
|
796 |
?><style>
|
797 |
div.advads-edit-bar{position:relative;top:0;left:0;height:0;display:none;z-index:10000;animation:advads-edit-appear 2s linear 1;}
|
798 |
+
@keyframes advads-edit-appear {
|
799 |
0% {opacity: 0.0;pointer-events: none;}
|
800 |
+
66% {opacity: 0.0;}
|
801 |
100% {opacity: 1.0;}
|
802 |
}
|
803 |
a.advads-edit-button{position:absolute;top:0;left:0;text-decoration:none !important;box-shadow:none;border-bottom:none;color:#0074a2;margin-top:-5px;}
|
912 |
* Makes sense only when a hooked to `the_content` function that produces an inner `the_content` has
|
913 |
* lesser priority then `$this->plugin->get_content_injection_priority()`.
|
914 |
*
|
915 |
+
* @param string $content Post content (unchanged).
|
916 |
+
*
|
917 |
+
* @return string
|
918 |
*/
|
919 |
+
public function set_was_in_the_loop( $content ) {
|
920 |
+
if ( self::get_instance()->has_many_the_content() ) {
|
921 |
$this->was_in_the_loop = $this->was_in_the_loop || in_the_loop();
|
922 |
} else {
|
923 |
// Next top level `the_content`, forget that the loop started.
|
924 |
$this->was_in_the_loop = false;
|
925 |
}
|
926 |
|
|
|
927 |
return $content;
|
928 |
}
|
929 |
}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: ads, ad manager, ad rotation, adsense, banner
|
|
4 |
Requires at least: 4.6
|
5 |
Tested up to: 5.3
|
6 |
Requires PHP: 5.6
|
7 |
-
Stable tag: 1.17.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -304,6 +304,14 @@ Yes. Advanced Ads is based on WordPress standards and therefore easily customiza
|
|
304 |
|
305 |
== Changelog ==
|
306 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
307 |
= 1.17.3 =
|
308 |
|
309 |
* prevented content injection into specific elements where ads cause issues
|
4 |
Requires at least: 4.6
|
5 |
Tested up to: 5.3
|
6 |
Requires PHP: 5.6
|
7 |
+
Stable tag: 1.17.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
304 |
|
305 |
== Changelog ==
|
306 |
|
307 |
+
= 1.17.4 =
|
308 |
+
|
309 |
+
* added option and Display Condition to disable ads in content served through the REST API
|
310 |
+
* made error notices less obstrusive
|
311 |
+
* code style optimizations
|
312 |
+
* fixed ad groups form on ad edit page
|
313 |
+
* fixed potential conflict with autoloader
|
314 |
+
|
315 |
= 1.17.3 =
|
316 |
|
317 |
* prevented content injection into specific elements where ads cause issues
|