Version Description
- use the same ad block disguise settings for all sites in a multisite
- update to advanced.js to allow injection into hidden elements
- fixed group options being overridden, when filtered groups are being saved
- fixed missing attribute for responsive Matched Content ads
- fixed issue with MarketPress license check
Download this release
Release Info
Developer | webzunft |
Plugin | Advanced Ads |
Version | 1.7.18 |
Comparing to | |
See all releases |
Code changes from version 1.7.17 to 1.7.18
- admin/includes/class-ad-groups-list.php +5 -2
- advanced-ads.php +2 -2
- modules/ad-blocker/admin/admin.php +42 -65
- modules/ad-blocker/admin/views/setting-use-adblocker.php +6 -0
- modules/ad-blocker/classes/plugin.php +24 -51
- modules/ad-blocker/main.php +1 -2
- modules/gadsense/admin/assets/js/new-ad.js +13 -1
- modules/gadsense/admin/views/adsense-ad-parameters.php +3 -1
- modules/gadsense/includes/class-ad-type-adsense.php +12 -9
- modules/marketpress-license/main.php +1 -1
- public/assets/js/advanced.js +1 -1
- public/assets/js/advanced.orig.js +3 -1
- readme.txt +12 -3
admin/includes/class-ad-groups-list.php
CHANGED
@@ -338,8 +338,11 @@ class Advanced_Ads_Groups_List {
|
|
338 |
return new WP_Error( 'invalid_ad_group_rights', __( 'You don’t have permission to change the ad groups', 'advanced-ads' ) );
|
339 |
}
|
340 |
|
341 |
-
|
342 |
-
|
|
|
|
|
|
|
343 |
// empty weights
|
344 |
update_option( 'advads-ad-weights', array() );
|
345 |
|
338 |
return new WP_Error( 'invalid_ad_group_rights', __( 'You don’t have permission to change the ad groups', 'advanced-ads' ) );
|
339 |
}
|
340 |
|
341 |
+
/** empty group settings
|
342 |
+
* edit: emptying disabled, because when only a few groups are saved (e.g. when filtered by search), options are reset
|
343 |
+
* todo: needs a solution that also removes options when the group is removed
|
344 |
+
*/
|
345 |
+
// update_option( 'advads-ad-groups', array() );
|
346 |
// empty weights
|
347 |
update_option( 'advads-ad-weights', array() );
|
348 |
|
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.7.
|
16 |
* Author: Thomas Maier
|
17 |
* Author URI: http://webgilde.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, textdomain
|
40 |
define( 'ADVADS_SLUG', 'advanced-ads' );
|
41 |
define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
|
42 |
-
define( 'ADVADS_VERSION', '1.7.
|
43 |
|
44 |
/*----------------------------------------------------------------------------*
|
45 |
* Autoloading, modules and functions
|
12 |
* Plugin Name: Advanced Ads
|
13 |
* Plugin URI: https://wpadvancedads.com
|
14 |
* Description: Manage and optimize your ads in WordPress
|
15 |
+
* Version: 1.7.18
|
16 |
* Author: Thomas Maier
|
17 |
* Author URI: http://webgilde.com
|
18 |
* Text Domain: advanced-ads
|
39 |
// general and global slug, e.g. to store options in WP, textdomain
|
40 |
define( 'ADVADS_SLUG', 'advanced-ads' );
|
41 |
define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
|
42 |
+
define( 'ADVADS_VERSION', '1.7.18' );
|
43 |
|
44 |
/*----------------------------------------------------------------------------*
|
45 |
* Autoloading, modules and functions
|
modules/ad-blocker/admin/admin.php
CHANGED
@@ -11,7 +11,6 @@ class Advanced_Ads_Ad_Blocker_Admin
|
|
11 |
/**
|
12 |
* module options
|
13 |
*
|
14 |
-
* @since 1.0.0
|
15 |
* @var array (if loaded)
|
16 |
*/
|
17 |
protected $options;
|
@@ -44,27 +43,23 @@ class Advanced_Ads_Ad_Blocker_Admin
|
|
44 |
*/
|
45 |
protected $error_messages;
|
46 |
|
47 |
-
/**
|
48 |
-
* path where the rebuild_form is located
|
49 |
-
*
|
50 |
-
* @var string
|
51 |
-
*/
|
52 |
-
private $form_url = 'admin.php?page=advanced-ads-settings#top#general';
|
53 |
-
|
54 |
/**
|
55 |
* Initialize the module
|
56 |
*
|
57 |
-
* @since 1.0.0
|
58 |
*/
|
59 |
-
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
// Get the most recent options values
|
62 |
$this->options = Advanced_Ads_Ad_Blocker::get_instance()->options();
|
|
|
63 |
|
64 |
-
$this->upload_dir = Advanced_Ads_Ad_Blocker::get_instance()->get_upload_directory();
|
65 |
-
|
66 |
-
// add module settings to Advanced Ads settings page
|
67 |
-
add_action( 'advanced-ads-settings-init', array( $this, 'settings_init' ), 9, 1 );
|
68 |
// add rebuild asset form
|
69 |
add_filter( 'advanced-ads-settings-tab-after-form', array( $this, 'add_asset_rebuild_form_wrap' ) );
|
70 |
|
@@ -78,11 +73,9 @@ class Advanced_Ads_Ad_Blocker_Admin
|
|
78 |
/**
|
79 |
* Return an instance of Advanced_Ads_Ad_Blocker
|
80 |
*
|
81 |
-
* @since 1.0.0
|
82 |
* @return Advanced_Ads_Ad_Blocker_Admin
|
83 |
*/
|
84 |
-
public static function get_instance()
|
85 |
-
{
|
86 |
// If the single instance hasn't been set, set it now.
|
87 |
if (null === self::$instance)
|
88 |
{
|
@@ -92,6 +85,32 @@ class Advanced_Ads_Ad_Blocker_Admin
|
|
92 |
return self::$instance;
|
93 |
}
|
94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
/**
|
96 |
* Render the ad-blocker rebuild assets form wrapper with rebuild assets form inside
|
97 |
*
|
@@ -150,10 +169,9 @@ class Advanced_Ads_Ad_Blocker_Admin
|
|
150 |
/**
|
151 |
* Perform processing of the rebuild_form, sent by user
|
152 |
*
|
153 |
-
* @
|
154 |
-
* @return true on success, false in case of wrong credentials, WP_Error in case of error
|
155 |
**/
|
156 |
-
private function process_form(
|
157 |
// at this point we do not need ftp/ssh credentials anymore
|
158 |
$form_post_fields = array_intersect_key( $_POST, array( 'advads_ab_assign_new_folder' => false ) );
|
159 |
|
@@ -170,25 +188,6 @@ class Advanced_Ads_Ad_Blocker_Admin
|
|
170 |
return true;
|
171 |
}
|
172 |
|
173 |
-
/**
|
174 |
-
* Add settings to settings page
|
175 |
-
*
|
176 |
-
* @since 1.0.0
|
177 |
-
* @param string $hook settings page hook
|
178 |
-
*/
|
179 |
-
public function settings_init( $hook )
|
180 |
-
{
|
181 |
-
//register_setting( ADVADS_AB_SLUG, ADVADS_AB_SLUG, array( $this, 'sanitize_settings' ) );
|
182 |
-
|
183 |
-
add_settings_field(
|
184 |
-
'use-adblocker',
|
185 |
-
__( 'Ad blocker fix', 'advanced-ads' ),
|
186 |
-
array( $this, 'render_settings_use_adblocker' ),
|
187 |
-
$hook,
|
188 |
-
'advanced_ads_setting_section'
|
189 |
-
);
|
190 |
-
}
|
191 |
-
|
192 |
/**
|
193 |
* Catch the update options before it's submitted to the database
|
194 |
*
|
@@ -258,7 +257,7 @@ class Advanced_Ads_Ad_Blocker_Admin
|
|
258 |
|
259 |
}
|
260 |
|
261 |
-
$is_rebuild_needed =
|
262 |
|
263 |
// we have an error while the method is being executed
|
264 |
update_option( ADVADS_AB_SLUG, $new_options_error );
|
@@ -310,7 +309,6 @@ class Advanced_Ads_Ad_Blocker_Admin
|
|
310 |
/**
|
311 |
* Copy all assets (JS/CSS) to the magic directory
|
312 |
*
|
313 |
-
* @since 1.0.0
|
314 |
* @param string $folder_name destination folder
|
315 |
* @param bool $need_assign_new_name true if we need to assign new random names to assets
|
316 |
* @return bool/array - bool false on failure, array lookup table on success
|
@@ -358,11 +356,10 @@ class Advanced_Ads_Ad_Blocker_Admin
|
|
358 |
|
359 |
// lookup_table contains associations between the original path of the asset and it path within our magic folder
|
360 |
// i.e: [advanced-ads-layer/admin/assets/css/admin.css] => array( path => /12/34/56/78/1347107783.css, size => 99 )
|
|
|
361 |
if ( $need_assign_new_name ) {
|
362 |
-
$assets = $this->get_assets( true );
|
363 |
$lookup_table = array();
|
364 |
} else {
|
365 |
-
$assets = $this->get_assets( false );
|
366 |
$lookup_table = isset( $this->options['lookup_table'] ) ? $this->options['lookup_table'] : array();
|
367 |
}
|
368 |
|
@@ -469,10 +466,9 @@ class Advanced_Ads_Ad_Blocker_Admin
|
|
469 |
/**
|
470 |
* Returns new or modified assets and their sizes
|
471 |
*
|
472 |
-
* @param bool $all true for all assets, false for modified or new assets
|
473 |
* @return array
|
474 |
*/
|
475 |
-
public function get_assets(
|
476 |
$new_files_info = $this->recursive_search_assets( trailingslashit( WP_PLUGIN_DIR ) . 'advanced-ads*' );
|
477 |
|
478 |
if ( ! isset( $this->options['lookup_table'] ) || ! isset( $this->upload_dir['basedir'] ) || ! isset( $this->options['folder_name'] ) ) {
|
@@ -530,25 +526,6 @@ class Advanced_Ads_Ad_Blocker_Admin
|
|
530 |
|
531 |
}
|
532 |
|
533 |
-
/**
|
534 |
-
* Renders the settings page for this module
|
535 |
-
*
|
536 |
-
* @since 1.0.0
|
537 |
-
*/
|
538 |
-
public function render_settings(){}
|
539 |
-
|
540 |
-
/**
|
541 |
-
* render setting to enable/disable adblocker
|
542 |
-
*
|
543 |
-
*/
|
544 |
-
public function render_settings_use_adblocker() {
|
545 |
-
$advads_options = Advanced_Ads::get_instance()->options();
|
546 |
-
$checked = ( ! empty( $advads_options['use-adblocker'] ) ) ? 1 : 0;
|
547 |
-
|
548 |
-
echo '<input id="advanced-ads-use-adblocker" type="checkbox" value="1" name="' . ADVADS_SLUG . '[use-adblocker]" ' . checked( $checked, 1, false ) . '>';
|
549 |
-
echo '<p class="description">' . __( 'Prevents ad block software from breaking your website when blocking asset files (.js, .css).', 'advanced-ads' ) . '</p>';
|
550 |
-
}
|
551 |
-
|
552 |
/**
|
553 |
* Generate unique name
|
554 |
*
|
11 |
/**
|
12 |
* module options
|
13 |
*
|
|
|
14 |
* @var array (if loaded)
|
15 |
*/
|
16 |
protected $options;
|
43 |
*/
|
44 |
protected $error_messages;
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
/**
|
47 |
* Initialize the module
|
48 |
*
|
|
|
49 |
*/
|
50 |
+
private function __construct() {
|
51 |
+
// add module settings to Advanced Ads settings page
|
52 |
+
add_action( 'advanced-ads-settings-init', array( $this, 'settings_init' ), 9, 1 );
|
53 |
+
|
54 |
+
$is_main_site = is_main_site( get_current_blog_id() );
|
55 |
+
if ( ! $is_main_site ) {
|
56 |
+
return;
|
57 |
+
}
|
58 |
+
|
59 |
// Get the most recent options values
|
60 |
$this->options = Advanced_Ads_Ad_Blocker::get_instance()->options();
|
61 |
+
$this->upload_dir = $this->options['upload_dir'];
|
62 |
|
|
|
|
|
|
|
|
|
63 |
// add rebuild asset form
|
64 |
add_filter( 'advanced-ads-settings-tab-after-form', array( $this, 'add_asset_rebuild_form_wrap' ) );
|
65 |
|
73 |
/**
|
74 |
* Return an instance of Advanced_Ads_Ad_Blocker
|
75 |
*
|
|
|
76 |
* @return Advanced_Ads_Ad_Blocker_Admin
|
77 |
*/
|
78 |
+
public static function get_instance() {
|
|
|
79 |
// If the single instance hasn't been set, set it now.
|
80 |
if (null === self::$instance)
|
81 |
{
|
85 |
return self::$instance;
|
86 |
}
|
87 |
|
88 |
+
/**
|
89 |
+
* Add settings to settings page.
|
90 |
+
*
|
91 |
+
* @param string $hook settings page hook
|
92 |
+
*/
|
93 |
+
public function settings_init( $hook ) {
|
94 |
+
add_settings_field(
|
95 |
+
'use-adblocker',
|
96 |
+
__( 'Ad blocker fix', 'advanced-ads' ),
|
97 |
+
array( $this, 'render_settings_use_adblocker' ),
|
98 |
+
$hook,
|
99 |
+
'advanced_ads_setting_section'
|
100 |
+
);
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Render setting to enable/disable adblocker.
|
105 |
+
*/
|
106 |
+
public function render_settings_use_adblocker() {
|
107 |
+
$advads_options = Advanced_Ads::get_instance()->options();
|
108 |
+
$is_main_site = is_main_site( get_current_blog_id() );
|
109 |
+
$checked = ( ! empty( $advads_options['use-adblocker'] ) ) ? 1 : 0;
|
110 |
+
|
111 |
+
include ADVADS_AB_BASE_PATH . 'admin/views/setting-use-adblocker.php';
|
112 |
+
}
|
113 |
+
|
114 |
/**
|
115 |
* Render the ad-blocker rebuild assets form wrapper with rebuild assets form inside
|
116 |
*
|
169 |
/**
|
170 |
* Perform processing of the rebuild_form, sent by user
|
171 |
*
|
172 |
+
* @return true on success, WP_Error in case of error
|
|
|
173 |
**/
|
174 |
+
private function process_form() {
|
175 |
// at this point we do not need ftp/ssh credentials anymore
|
176 |
$form_post_fields = array_intersect_key( $_POST, array( 'advads_ab_assign_new_folder' => false ) );
|
177 |
|
188 |
return true;
|
189 |
}
|
190 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
/**
|
192 |
* Catch the update options before it's submitted to the database
|
193 |
*
|
257 |
|
258 |
}
|
259 |
|
260 |
+
$is_rebuild_needed = count( $this->get_assets() );
|
261 |
|
262 |
// we have an error while the method is being executed
|
263 |
update_option( ADVADS_AB_SLUG, $new_options_error );
|
309 |
/**
|
310 |
* Copy all assets (JS/CSS) to the magic directory
|
311 |
*
|
|
|
312 |
* @param string $folder_name destination folder
|
313 |
* @param bool $need_assign_new_name true if we need to assign new random names to assets
|
314 |
* @return bool/array - bool false on failure, array lookup table on success
|
356 |
|
357 |
// lookup_table contains associations between the original path of the asset and it path within our magic folder
|
358 |
// i.e: [advanced-ads-layer/admin/assets/css/admin.css] => array( path => /12/34/56/78/1347107783.css, size => 99 )
|
359 |
+
$assets = $this->get_assets();
|
360 |
if ( $need_assign_new_name ) {
|
|
|
361 |
$lookup_table = array();
|
362 |
} else {
|
|
|
363 |
$lookup_table = isset( $this->options['lookup_table'] ) ? $this->options['lookup_table'] : array();
|
364 |
}
|
365 |
|
466 |
/**
|
467 |
* Returns new or modified assets and their sizes
|
468 |
*
|
|
|
469 |
* @return array
|
470 |
*/
|
471 |
+
public function get_assets() {
|
472 |
$new_files_info = $this->recursive_search_assets( trailingslashit( WP_PLUGIN_DIR ) . 'advanced-ads*' );
|
473 |
|
474 |
if ( ! isset( $this->options['lookup_table'] ) || ! isset( $this->upload_dir['basedir'] ) || ! isset( $this->options['folder_name'] ) ) {
|
526 |
|
527 |
}
|
528 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
529 |
/**
|
530 |
* Generate unique name
|
531 |
*
|
modules/ad-blocker/admin/views/setting-use-adblocker.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if ( $is_main_site ): ?>
|
2 |
+
<input id="advanced-ads-use-adblocker" type="checkbox" value="1" name="<?php echo ADVADS_SLUG; ?>[use-adblocker]" <?php checked( $checked, 1, true ); ?>>
|
3 |
+
<?php else: ?>
|
4 |
+
<?php _e( 'The ad block disguise can only be set by the super admin on the main site in the network.', 'advanced-ads' ); ?>
|
5 |
+
<?php endif ?>
|
6 |
+
<p class="description"><?php _e( 'Prevents ad block software from breaking your website when blocking asset files (.js, .css).', 'advanced-ads' ); ?></p>
|
modules/ad-blocker/classes/plugin.php
CHANGED
@@ -11,31 +11,19 @@ class Advanced_Ads_Ad_Blocker
|
|
11 |
/**
|
12 |
* module options
|
13 |
*
|
14 |
-
* @since 1.0.0
|
15 |
* @var array (if loaded)
|
16 |
*/
|
17 |
protected $options;
|
18 |
|
19 |
-
/**
|
20 |
-
* upload directory
|
21 |
-
*
|
22 |
-
* @var array (if loaded), false on failure
|
23 |
-
*/
|
24 |
-
protected $upload_dir;
|
25 |
-
|
26 |
/**
|
27 |
* Initialize the module
|
28 |
-
*
|
29 |
-
* @since 1.0.0
|
30 |
*/
|
31 |
-
private function __construct()
|
32 |
-
{
|
33 |
-
$advads_options = Advanced_Ads::get_instance()->options();
|
34 |
$options = $this->options();
|
35 |
-
if ( ! empty ( $
|
36 |
-
! empty ( $
|
37 |
-
! empty ( $
|
38 |
-
$
|
39 |
) {
|
40 |
add_action( 'plugins_loaded', array( $this, 'wp_plugins_loaded' ) );
|
41 |
}
|
@@ -47,8 +35,7 @@ class Advanced_Ads_Ad_Blocker
|
|
47 |
* @return Advanced_Ads_Ad_Blocker
|
48 |
* @since 1.0.0
|
49 |
*/
|
50 |
-
public static function get_instance()
|
51 |
-
{
|
52 |
// If the single instance hasn't been set, set it now.
|
53 |
if ( null === self::$instance )
|
54 |
{
|
@@ -63,8 +50,7 @@ class Advanced_Ads_Ad_Blocker
|
|
63 |
*
|
64 |
* @since 1.0.0
|
65 |
*/
|
66 |
-
public function wp_plugins_loaded()
|
67 |
-
{
|
68 |
add_action( 'wp_enqueue_scripts', array( $this, 'edit_script_output' ), 101 );
|
69 |
}
|
70 |
|
@@ -73,8 +59,7 @@ class Advanced_Ads_Ad_Blocker
|
|
73 |
*
|
74 |
* @since 1.0.0
|
75 |
*/
|
76 |
-
public function edit_script_output()
|
77 |
-
{
|
78 |
global $wp_scripts, $wp_styles;
|
79 |
|
80 |
// Get all plugin options
|
@@ -105,7 +90,7 @@ class Advanced_Ads_Ad_Blocker
|
|
105 |
|
106 |
public function clean_up_filename( $file ) {
|
107 |
$options = $this->options();
|
108 |
-
$upload_dir = $
|
109 |
$url = str_replace( WP_PLUGIN_URL, '', $file );
|
110 |
if ( isset( $options['lookup_table'][ $url ] ) && is_array( $options['lookup_table'][ $url ] ) && isset( $options['lookup_table'][ $url ]['path'] ) ) {
|
111 |
return trailingslashit( $upload_dir['baseurl'] ) . trailingslashit( $options['folder_name'] ) . $options['lookup_table'][ $url ]['path'];
|
@@ -118,49 +103,37 @@ class Advanced_Ads_Ad_Blocker
|
|
118 |
/**
|
119 |
* Return module options
|
120 |
*
|
121 |
-
* @since 1.0.0
|
122 |
* @return array $options
|
123 |
*/
|
124 |
-
public function options()
|
125 |
-
{
|
126 |
if ( ! isset( $this->options ) ) {
|
127 |
if ( function_exists( 'is_multisite' ) && is_multisite() ) {
|
128 |
global $current_site;
|
129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
} else {
|
131 |
$this->options = get_option( ADVADS_AB_SLUG, array() );
|
|
|
|
|
132 |
}
|
133 |
|
134 |
if ( ! $this->options ) {
|
135 |
$this->options = array();
|
136 |
}
|
137 |
-
}
|
138 |
-
return $this->options;
|
139 |
-
}
|
140 |
-
|
141 |
-
/**
|
142 |
-
* Return path information on the currently configured uploads directory
|
143 |
-
*
|
144 |
-
* @return array, that have indices 'basedir' and 'baseurl', or false on failure
|
145 |
-
*/
|
146 |
-
public function get_upload_directory()
|
147 |
-
{
|
148 |
-
if ( ! isset( $this->upload_dir ) ) {
|
149 |
-
if ( function_exists( 'is_multisite' ) && is_multisite() ) {
|
150 |
-
global $current_site;
|
151 |
-
switch_to_blog( $current_site->blog_id );
|
152 |
-
$upload_dir = wp_upload_dir();
|
153 |
-
restore_current_blog();
|
154 |
-
} else {
|
155 |
-
$upload_dir = wp_upload_dir();
|
156 |
-
}
|
157 |
|
|
|
158 |
if ( $upload_dir['error'] ) {
|
159 |
-
$this->upload_dir = false;
|
160 |
} else {
|
161 |
-
|
|
|
162 |
}
|
163 |
}
|
164 |
-
return $this->
|
165 |
}
|
166 |
}
|
11 |
/**
|
12 |
* module options
|
13 |
*
|
|
|
14 |
* @var array (if loaded)
|
15 |
*/
|
16 |
protected $options;
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
/**
|
19 |
* Initialize the module
|
|
|
|
|
20 |
*/
|
21 |
+
private function __construct() {
|
|
|
|
|
22 |
$options = $this->options();
|
23 |
+
if ( ! empty ( $options['use-adblocker'] ) &&
|
24 |
+
! empty ( $options['folder_name'] ) &&
|
25 |
+
! empty ( $options['module_can_work'] ) &&
|
26 |
+
$options['upload_dir']
|
27 |
) {
|
28 |
add_action( 'plugins_loaded', array( $this, 'wp_plugins_loaded' ) );
|
29 |
}
|
35 |
* @return Advanced_Ads_Ad_Blocker
|
36 |
* @since 1.0.0
|
37 |
*/
|
38 |
+
public static function get_instance() {
|
|
|
39 |
// If the single instance hasn't been set, set it now.
|
40 |
if ( null === self::$instance )
|
41 |
{
|
50 |
*
|
51 |
* @since 1.0.0
|
52 |
*/
|
53 |
+
public function wp_plugins_loaded() {
|
|
|
54 |
add_action( 'wp_enqueue_scripts', array( $this, 'edit_script_output' ), 101 );
|
55 |
}
|
56 |
|
59 |
*
|
60 |
* @since 1.0.0
|
61 |
*/
|
62 |
+
public function edit_script_output() {
|
|
|
63 |
global $wp_scripts, $wp_styles;
|
64 |
|
65 |
// Get all plugin options
|
90 |
|
91 |
public function clean_up_filename( $file ) {
|
92 |
$options = $this->options();
|
93 |
+
$upload_dir = $options['upload_dir'];
|
94 |
$url = str_replace( WP_PLUGIN_URL, '', $file );
|
95 |
if ( isset( $options['lookup_table'][ $url ] ) && is_array( $options['lookup_table'][ $url ] ) && isset( $options['lookup_table'][ $url ]['path'] ) ) {
|
96 |
return trailingslashit( $upload_dir['baseurl'] ) . trailingslashit( $options['folder_name'] ) . $options['lookup_table'][ $url ]['path'];
|
103 |
/**
|
104 |
* Return module options
|
105 |
*
|
|
|
106 |
* @return array $options
|
107 |
*/
|
108 |
+
public function options() {
|
|
|
109 |
if ( ! isset( $this->options ) ) {
|
110 |
if ( function_exists( 'is_multisite' ) && is_multisite() ) {
|
111 |
global $current_site;
|
112 |
+
switch_to_blog( $current_site->blog_id );
|
113 |
+
|
114 |
+
$this->options = get_option( ADVADS_AB_SLUG, array() );
|
115 |
+
$advads_options = Advanced_Ads::get_instance()->options();
|
116 |
+
$upload_dir = wp_upload_dir();
|
117 |
+
|
118 |
+
restore_current_blog();
|
119 |
} else {
|
120 |
$this->options = get_option( ADVADS_AB_SLUG, array() );
|
121 |
+
$advads_options = Advanced_Ads::get_instance()->options();
|
122 |
+
$upload_dir = wp_upload_dir();
|
123 |
}
|
124 |
|
125 |
if ( ! $this->options ) {
|
126 |
$this->options = array();
|
127 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
|
129 |
+
$this->options['use-adblocker'] = ! empty( $advads_options['use-adblocker'] );
|
130 |
if ( $upload_dir['error'] ) {
|
131 |
+
$this->options['upload_dir'] = false;
|
132 |
} else {
|
133 |
+
// array, that has indices 'basedir' and 'baseurl'
|
134 |
+
$this->options['upload_dir'] = $upload_dir;
|
135 |
}
|
136 |
}
|
137 |
+
return $this->options;
|
138 |
}
|
139 |
}
|
modules/ad-blocker/main.php
CHANGED
@@ -14,9 +14,8 @@ if ( class_exists( 'Advanced_Ads', false ) ) {
|
|
14 |
Advanced_Ads_Ad_Blocker::get_instance();
|
15 |
|
16 |
$is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
|
17 |
-
$is_main_blog = is_main_site( get_current_blog_id() );
|
18 |
|
19 |
-
if ( is_admin() && ! $is_ajax
|
20 |
Advanced_Ads_Ad_Blocker_Admin::get_instance();
|
21 |
}
|
22 |
}
|
14 |
Advanced_Ads_Ad_Blocker::get_instance();
|
15 |
|
16 |
$is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
|
|
|
17 |
|
18 |
+
if ( is_admin() && ! $is_ajax ) {
|
19 |
Advanced_Ads_Ad_Blocker_Admin::get_instance();
|
20 |
}
|
21 |
}
|
modules/gadsense/admin/assets/js/new-ad.js
CHANGED
@@ -79,6 +79,12 @@
|
|
79 |
theAd.type = 'responsive';
|
80 |
return theAd;
|
81 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
}
|
83 |
return false;
|
84 |
}
|
@@ -100,6 +106,12 @@
|
|
100 |
$( '#advanced-ads-ad-parameters-size input[name="advanced_ad[width]"]' ).val( '' );
|
101 |
$( '#advanced-ads-ad-parameters-size input[name="advanced_ad[height]"]' ).val( '' );
|
102 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
var storedPubId = gadsenseData.pubId;
|
104 |
if ('' !== storedPubId && theAd.pubId != storedPubId) {
|
105 |
$( '#adsense-ad-param-error' ).text( gadsenseData.msg.pubIdMismatch );
|
@@ -139,7 +151,7 @@
|
|
139 |
|
140 |
function advads_update_adsense_type(){
|
141 |
var type = $( '#unit-type' ).val();
|
142 |
-
if ('responsive' == type) {
|
143 |
$( '#advanced-ads-ad-parameters-size' ).css( 'display', 'none' );
|
144 |
$( '#advanced-ads-ad-parameters-size' ).prev('.label').css( 'display', 'none' );
|
145 |
$( '#advanced-ads-ad-parameters-size' ).next('.hr').css( 'display', 'none' );
|
79 |
theAd.type = 'responsive';
|
80 |
return theAd;
|
81 |
}
|
82 |
+
|
83 |
+
if ('undefined' != typeof(theAd.format) && 'autorelaxed' == theAd.format) {
|
84 |
+
/* Responsive Matched Content */
|
85 |
+
theAd.type = 'matched-content';
|
86 |
+
return theAd;
|
87 |
+
}
|
88 |
}
|
89 |
return false;
|
90 |
}
|
106 |
$( '#advanced-ads-ad-parameters-size input[name="advanced_ad[width]"]' ).val( '' );
|
107 |
$( '#advanced-ads-ad-parameters-size input[name="advanced_ad[height]"]' ).val( '' );
|
108 |
}
|
109 |
+
if ('matched-content' == theAd.type) {
|
110 |
+
$( '#unit-type' ).val( 'matched-content' );
|
111 |
+
$( '#ad-resize-type' ).val( 'auto' );
|
112 |
+
$( '#advanced-ads-ad-parameters-size input[name="advanced_ad[width]"]' ).val( '' );
|
113 |
+
$( '#advanced-ads-ad-parameters-size input[name="advanced_ad[height]"]' ).val( '' );
|
114 |
+
}
|
115 |
var storedPubId = gadsenseData.pubId;
|
116 |
if ('' !== storedPubId && theAd.pubId != storedPubId) {
|
117 |
$( '#adsense-ad-param-error' ).text( gadsenseData.msg.pubIdMismatch );
|
151 |
|
152 |
function advads_update_adsense_type(){
|
153 |
var type = $( '#unit-type' ).val();
|
154 |
+
if ('responsive' == type || 'matched-content' == type) {
|
155 |
$( '#advanced-ads-ad-parameters-size' ).css( 'display', 'none' );
|
156 |
$( '#advanced-ads-ad-parameters-size' ).prev('.label').css( 'display', 'none' );
|
157 |
$( '#advanced-ads-ad-parameters-size' ).next('.hr').css( 'display', 'none' );
|
modules/gadsense/admin/views/adsense-ad-parameters.php
CHANGED
@@ -3,8 +3,9 @@ if ( ! defined( 'WPINC' ) ) {
|
|
3 |
die();
|
4 |
}
|
5 |
$is_responsive = ('responsive' == $unit_type) ? true : false;
|
|
|
6 |
$use_manual_css = ('manual' == $unit_resize) ? true : false;
|
7 |
-
if ( $is_responsive ) {
|
8 |
echo '<style type="text/css"> #advanced-ads-ad-parameters-size {display: none;} </style>';
|
9 |
}
|
10 |
|
@@ -49,6 +50,7 @@ if( $pub_id_errors ) : ?>
|
|
49 |
<select name="unit-type" id="unit-type">
|
50 |
<option value="normal" <?php selected( $unit_type, 'normal' ); ?>><?php _e( 'Normal', 'advanced-ads' ); ?></option>
|
51 |
<option value="responsive" <?php selected( $unit_type, 'responsive' ); ?>><?php _e( 'Responsive', 'advanced-ads' ); ?></option>
|
|
|
52 |
</select>
|
53 |
</div>
|
54 |
<hr/>
|
3 |
die();
|
4 |
}
|
5 |
$is_responsive = ('responsive' == $unit_type) ? true : false;
|
6 |
+
$is_matched_content = ('matched-content' == $unit_type) ? true : false;
|
7 |
$use_manual_css = ('manual' == $unit_resize) ? true : false;
|
8 |
+
if ( $is_responsive || $is_matched_content ) {
|
9 |
echo '<style type="text/css"> #advanced-ads-ad-parameters-size {display: none;} </style>';
|
10 |
}
|
11 |
|
50 |
<select name="unit-type" id="unit-type">
|
51 |
<option value="normal" <?php selected( $unit_type, 'normal' ); ?>><?php _e( 'Normal', 'advanced-ads' ); ?></option>
|
52 |
<option value="responsive" <?php selected( $unit_type, 'responsive' ); ?>><?php _e( 'Responsive', 'advanced-ads' ); ?></option>
|
53 |
+
<option value="matched-content" <?php selected( $unit_type, 'matched-content' ); ?>><?php _e( 'Responsive (Matched Content)', 'advanced-ads' ); ?></option>
|
54 |
</select>
|
55 |
</div>
|
56 |
<hr/>
|
modules/gadsense/includes/class-ad-type-adsense.php
CHANGED
@@ -84,12 +84,13 @@ class Advanced_Ads_Ad_Type_Adsense extends Advanced_Ads_Ad_Type_Abstract {
|
|
84 |
$content->json = $json_content;
|
85 |
$unit_type = $content->unitType;
|
86 |
$unit_code = $content->slotId;
|
87 |
-
|
|
|
88 |
// Normal ad unit
|
89 |
$unit_width = $ad->width;
|
90 |
$unit_height = $ad->height;
|
91 |
} else {
|
92 |
-
// Responsive
|
93 |
$unit_resize = (isset($content->resize)) ? $content->resize : 'auto';
|
94 |
if ( 'auto' != $unit_resize ) {
|
95 |
$extra_params = apply_filters( 'advanced-ads-gadsense-ad-param-data', $extra_params, $content, $ad );
|
@@ -179,7 +180,7 @@ class Advanced_Ads_Ad_Type_Adsense extends Advanced_Ads_Ad_Type_Abstract {
|
|
179 |
|
180 |
$output = '';
|
181 |
|
182 |
-
if ( 'responsive' != $content->unitType ) {
|
183 |
$output .= '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' . "\n";
|
184 |
$output .= '<ins class="adsbygoogle" ';
|
185 |
$output .= 'style="display:inline-block;width:' . $ad->width . 'px;height:' . $ad->height . 'px;" ' . "\n";
|
@@ -190,7 +191,7 @@ class Advanced_Ads_Ad_Type_Adsense extends Advanced_Ads_Ad_Type_Abstract {
|
|
190 |
$output .= '</script>' . "\n";
|
191 |
} else {
|
192 |
if ( ! isset($content->resize) || 'auto' == $content->resize ) {
|
193 |
-
$this->append_defaut_responsive_content( $output, $pub_id, $content
|
194 |
} else {
|
195 |
/**
|
196 |
* At this point, the ad is responsive ($ad->content->unitType == responsive)
|
@@ -205,20 +206,22 @@ class Advanced_Ads_Ad_Type_Adsense extends Advanced_Ads_Ad_Type_Abstract {
|
|
205 |
* If the output has not been modified, perform a default responsive output.
|
206 |
* A simple did_action check isn't sufficient, some hooks may be attached and fired but didn't touch the output
|
207 |
*/
|
208 |
-
$this->append_defaut_responsive_content( $output, $pub_id, $content
|
209 |
}
|
210 |
}
|
211 |
}
|
212 |
return $output;
|
213 |
}
|
214 |
|
215 |
-
protected function append_defaut_responsive_content(&$output, $pub_id, $
|
|
|
216 |
$output .= '<ins class="adsbygoogle" ';
|
217 |
$output .= 'style="display:block;" ';
|
218 |
$output .= 'data-ad-client="ca-' . $pub_id . '" ' . "\n";
|
219 |
-
$output .= 'data-ad-slot="' . $
|
220 |
-
$output .= 'data-ad-format="
|
221 |
-
$output .= '
|
|
|
222 |
$output .= '<script> ' . "\n";
|
223 |
$output .= apply_filters( 'advanced-ads-gadsense-responsive-adsbygoogle', '(adsbygoogle = window.adsbygoogle || []).push({}); ' . "\n");
|
224 |
$output .= '</script>' . "\n";
|
84 |
$content->json = $json_content;
|
85 |
$unit_type = $content->unitType;
|
86 |
$unit_code = $content->slotId;
|
87 |
+
|
88 |
+
if ( 'responsive' != $content->unitType && 'matched-content' != $content->unitType ) {
|
89 |
// Normal ad unit
|
90 |
$unit_width = $ad->width;
|
91 |
$unit_height = $ad->height;
|
92 |
} else {
|
93 |
+
// Responsive && matched content
|
94 |
$unit_resize = (isset($content->resize)) ? $content->resize : 'auto';
|
95 |
if ( 'auto' != $unit_resize ) {
|
96 |
$extra_params = apply_filters( 'advanced-ads-gadsense-ad-param-data', $extra_params, $content, $ad );
|
180 |
|
181 |
$output = '';
|
182 |
|
183 |
+
if ( 'responsive' != $content->unitType && 'matched-content' != $content->unitType ) {
|
184 |
$output .= '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' . "\n";
|
185 |
$output .= '<ins class="adsbygoogle" ';
|
186 |
$output .= 'style="display:inline-block;width:' . $ad->width . 'px;height:' . $ad->height . 'px;" ' . "\n";
|
191 |
$output .= '</script>' . "\n";
|
192 |
} else {
|
193 |
if ( ! isset($content->resize) || 'auto' == $content->resize ) {
|
194 |
+
$this->append_defaut_responsive_content( $output, $pub_id, $content );
|
195 |
} else {
|
196 |
/**
|
197 |
* At this point, the ad is responsive ($ad->content->unitType == responsive)
|
206 |
* If the output has not been modified, perform a default responsive output.
|
207 |
* A simple did_action check isn't sufficient, some hooks may be attached and fired but didn't touch the output
|
208 |
*/
|
209 |
+
$this->append_defaut_responsive_content( $output, $pub_id, $content );
|
210 |
}
|
211 |
}
|
212 |
}
|
213 |
return $output;
|
214 |
}
|
215 |
|
216 |
+
protected function append_defaut_responsive_content(&$output, $pub_id, $content) {
|
217 |
+
$output .= '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' . "\n";
|
218 |
$output .= '<ins class="adsbygoogle" ';
|
219 |
$output .= 'style="display:block;" ';
|
220 |
$output .= 'data-ad-client="ca-' . $pub_id . '" ' . "\n";
|
221 |
+
$output .= 'data-ad-slot="' . $content->slotId . '" ' . "\n";
|
222 |
+
$output .= 'data-ad-format="';
|
223 |
+
$output .= ( 'matched-content' == $content->unitType )? 'autorelaxed' : 'auto';
|
224 |
+
$output .= '"></ins>' . "\n";
|
225 |
$output .= '<script> ' . "\n";
|
226 |
$output .= apply_filters( 'advanced-ads-gadsense-responsive-adsbygoogle', '(adsbygoogle = window.adsbygoogle || []).push({}); ' . "\n");
|
227 |
$output .= '</script>' . "\n";
|
modules/marketpress-license/main.php
CHANGED
@@ -47,7 +47,7 @@ if ( class_exists( 'Advanced_Ads', false ) ) {
|
|
47 |
function marketpress_advanced_license_manager ( $return_value, $method_name, $plugin_name, $options_slug, $license_key ) {
|
48 |
|
49 |
// Remove class from method name
|
50 |
-
$method_name = str_replace( '
|
51 |
|
52 |
switch ( $method_name ) {
|
53 |
|
47 |
function marketpress_advanced_license_manager ( $return_value, $method_name, $plugin_name, $options_slug, $license_key ) {
|
48 |
|
49 |
// Remove class from method name
|
50 |
+
$method_name = str_replace( 'Advanced_Ads_Admin_Licenses::', '', $method_name );
|
51 |
|
52 |
switch ( $method_name ) {
|
53 |
|
public/assets/js/advanced.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
advads={supports_localstorage:function(){try{return"localStorage"in window&&null!==window.localStorage}catch(a){return!1}},max_per_session:function(a,b){var c=1;if(void 0!==b&&0!==parseInt(b)||(b=1),this.cookie_exists(a)){if(this.get_cookie(a)>=b)return!0;c+=parseInt(this.get_cookie(a))}return this.set_cookie(a,c),!1},count_up:function(a,b){var c=1;this.cookie_exists(a)&&(c+=parseInt(this.get_cookie(a))),this.set_cookie(a,c)},set_cookie_exists:function(a){return!!get_cookie(a)||(set_cookie(a,"",0),!1)},get_cookie:function(a){var b,c,d,e=document.cookie.split(";");for(b=0;b<e.length;b++)if(c=e[b].substr(0,e[b].indexOf("=")),d=e[b].substr(e[b].indexOf("=")+1),c=c.replace(/^\s+|\s+$/g,""),c===a)return unescape(d)},set_cookie:function(a,b,c,d,e,f){var g=24*c*60*60;this.set_cookie_sec(a,b,g,d,e,f)},set_cookie_sec:function(a,b,c,d,e,f){var g=new Date;g.setSeconds(g.getSeconds()+parseInt(c)),document.cookie=a+"="+escape(b)+(null==c?"":"; expires="+g.toUTCString())+(null==d?"; path=/":"; path="+d)+(null==e?"":"; domain="+e)+(null==f?"":"; secure")},cookie_exists:function(a){var b=this.get_cookie(a);return null!==b&&""!==b&&void 0!==b},move:function(a,b,c){var d=jQuery(a);if("undefined"==typeof c&&(c={}),"undefined"==typeof c.css&&(c.css={}),"undefined"==typeof c.method&&(c.method="prependTo"),""===b&&"undefined"!=typeof c.target)switch(c.target){case"wrapper":var e="left";"undefined"!=typeof c.offset&&(e=c.offset),b=this.find_wrapper(a,e)}switch(b=jQuery(b).filter(":visible"),c.method){case"insertBefore":d.insertBefore(b);break;case"insertAfter":d.insertAfter(b);break;case"appendTo":d.appendTo(b);break;case"prependTo":d.prependTo(b);break;default:d.prependTo(b)}},fix_element:function(a,b){var c=jQuery(a),d=c.parent();"static"!==d.css("position")&&""!==d.css("position")||d.css("position","relative"),"undefined"!=typeof b&&b.is_invisible&&c.show();var e=parseInt(c.offset().top),f=parseInt(c.offset().left);"undefined"!=typeof b&&b.is_invisible&&c.hide(),c.css("position","fixed").css("top",e+"px").css("left",f+"px")},find_wrapper:function(a,b){var c;return jQuery("body").children().each(function(d,e){if(e.id!==a.substring(1)){var f=jQuery(e);if("right"===b&&f.offset().left+jQuery(f).width()<jQuery(window).width()||"left"===b&&f.offset().left>0)return"static"!==f.css("position")&&""!==f.css("position")||f.css("position","relative"),c=e,!1}}),c},center_fixed_element:function(a){var b=jQuery(a),c=jQuery(window).width()/2-parseInt(b.css("width"))/2;b.css("left",c+"px")},center_vertically:function(a){var b=jQuery(a),c=jQuery(window).height()/2-parseInt(b.css("height"))/2;b.css("top",c+"px")},close:function(a){var b=jQuery(a);b.remove()}},jQuery(document).ready(function(){if(advads.supports_localstorage()&&localStorage.getItem("advads_frontend_picker")){var a,b=jQuery("<div id='advads-picker-overlay'>"),c=[document.body,document.documentElement,document];b.css({position:"absolute",border:"solid 2px #428bca",backgroundColor:"rgba(66,139,202,0.5)",boxSizing:"border-box",zIndex:1e6,pointerEvents:"none"}).prependTo("body"),jQuery(document).mousemove(function(d){if(d.target!==a){if(~c.indexOf(d.target))return a=null,void b.hide();var e=jQuery(d.target),f=e.offset(),g=e.outerWidth(),h=e.outerHeight();a=d.target,b.css({top:f.top,left:f.left,width:g,height:h}).show(),console.log(jQuery(a).getPath())}}),jQuery(document).click(function(b){var c=jQuery(a).getPath();localStorage.setItem("advads_frontend_element",c),window.location=localStorage.getItem("advads_prev_url")})}}),jQuery.fn.extend({getPath:function(a,b){if("undefined"==typeof a&&(a=""),"undefined"==typeof b&&(b=0),this.is("html"))return"html > "+a;if(3===b)return a;var c=this.get(0).nodeName.toLowerCase(),d=this.attr("id"),e=this.attr("class");return b+=1,"undefined"==typeof d||/\d/.test(d)?"undefined"!=typeof e&&(e=e.split(/[\s\n]+/),e=jQuery.grep(e,function(a,b){return!/\d/.test(a)}),e.length&&(c+="."+e.slice(0,2).join("."))):c+="#"+d,this.siblings(c).length&&(c+=":eq("+this.siblings(c).addBack().not("#advads-picker-overlay").index(this)+")"),""===a?this.parent().getPath(c,b):this.parent().getPath(c+" > "+a,b)}});
|
1 |
+
advads={supports_localstorage:function(){try{return"localStorage"in window&&null!==window.localStorage}catch(a){return!1}},max_per_session:function(a,b){var c=1;if(void 0!==b&&0!==parseInt(b)||(b=1),this.cookie_exists(a)){if(this.get_cookie(a)>=b)return!0;c+=parseInt(this.get_cookie(a))}return this.set_cookie(a,c),!1},count_up:function(a,b){var c=1;this.cookie_exists(a)&&(c+=parseInt(this.get_cookie(a))),this.set_cookie(a,c)},set_cookie_exists:function(a){return!!get_cookie(a)||(set_cookie(a,"",0),!1)},get_cookie:function(a){var b,c,d,e=document.cookie.split(";");for(b=0;b<e.length;b++)if(c=e[b].substr(0,e[b].indexOf("=")),d=e[b].substr(e[b].indexOf("=")+1),c=c.replace(/^\s+|\s+$/g,""),c===a)return unescape(d)},set_cookie:function(a,b,c,d,e,f){var g=24*c*60*60;this.set_cookie_sec(a,b,g,d,e,f)},set_cookie_sec:function(a,b,c,d,e,f){var g=new Date;g.setSeconds(g.getSeconds()+parseInt(c)),document.cookie=a+"="+escape(b)+(null==c?"":"; expires="+g.toUTCString())+(null==d?"; path=/":"; path="+d)+(null==e?"":"; domain="+e)+(null==f?"":"; secure")},cookie_exists:function(a){var b=this.get_cookie(a);return null!==b&&""!==b&&void 0!==b},move:function(a,b,c){var d=jQuery(a);if("undefined"==typeof c&&(c={}),"undefined"==typeof c.css&&(c.css={}),"undefined"==typeof c.method&&(c.method="prependTo"),""===b&&"undefined"!=typeof c.target)switch(c.target){case"wrapper":var e="left";"undefined"!=typeof c.offset&&(e=c.offset),b=this.find_wrapper(a,e)}switch("undefined"==typeof c.moveintohidden&&(b=jQuery(b).filter(":visible")),c.method){case"insertBefore":d.insertBefore(b);break;case"insertAfter":d.insertAfter(b);break;case"appendTo":d.appendTo(b);break;case"prependTo":d.prependTo(b);break;default:d.prependTo(b)}},fix_element:function(a,b){var c=jQuery(a),d=c.parent();"static"!==d.css("position")&&""!==d.css("position")||d.css("position","relative"),"undefined"!=typeof b&&b.is_invisible&&c.show();var e=parseInt(c.offset().top),f=parseInt(c.offset().left);"undefined"!=typeof b&&b.is_invisible&&c.hide(),c.css("position","fixed").css("top",e+"px").css("left",f+"px")},find_wrapper:function(a,b){var c;return jQuery("body").children().each(function(d,e){if(e.id!==a.substring(1)){var f=jQuery(e);if("right"===b&&f.offset().left+jQuery(f).width()<jQuery(window).width()||"left"===b&&f.offset().left>0)return"static"!==f.css("position")&&""!==f.css("position")||f.css("position","relative"),c=e,!1}}),c},center_fixed_element:function(a){var b=jQuery(a),c=jQuery(window).width()/2-parseInt(b.css("width"))/2;b.css("left",c+"px")},center_vertically:function(a){var b=jQuery(a),c=jQuery(window).height()/2-parseInt(b.css("height"))/2;b.css("top",c+"px")},close:function(a){var b=jQuery(a);b.remove()}},jQuery(document).ready(function(){if(advads.supports_localstorage()&&localStorage.getItem("advads_frontend_picker")){var a,b=jQuery("<div id='advads-picker-overlay'>"),c=[document.body,document.documentElement,document];b.css({position:"absolute",border:"solid 2px #428bca",backgroundColor:"rgba(66,139,202,0.5)",boxSizing:"border-box",zIndex:1e6,pointerEvents:"none"}).prependTo("body"),jQuery(document).mousemove(function(d){if(d.target!==a){if(~c.indexOf(d.target))return a=null,void b.hide();var e=jQuery(d.target),f=e.offset(),g=e.outerWidth(),h=e.outerHeight();a=d.target,b.css({top:f.top,left:f.left,width:g,height:h}).show(),console.log(jQuery(a).getPath())}}),jQuery(document).click(function(b){var c=jQuery(a).getPath();localStorage.setItem("advads_frontend_element",c),window.location=localStorage.getItem("advads_prev_url")})}}),jQuery.fn.extend({getPath:function(a,b){if("undefined"==typeof a&&(a=""),"undefined"==typeof b&&(b=0),this.is("html"))return"html > "+a;if(3===b)return a;var c=this.get(0).nodeName.toLowerCase(),d=this.attr("id"),e=this.attr("class");return b+=1,"undefined"==typeof d||/\d/.test(d)?"undefined"!=typeof e&&(e=e.split(/[\s\n]+/),e=jQuery.grep(e,function(a,b){return!/\d/.test(a)}),e.length&&(c+="."+e.slice(0,2).join("."))):c+="#"+d,this.siblings(c).length&&(c+=":eq("+this.siblings(c).addBack().not("#advads-picker-overlay").index(this)+")"),""===a?this.parent().getPath(c,b):this.parent().getPath(c+" > "+a,b)}});
|
public/assets/js/advanced.orig.js
CHANGED
@@ -165,7 +165,9 @@ advads = {
|
|
165 |
}
|
166 |
|
167 |
// use only visible elements
|
168 |
-
|
|
|
|
|
169 |
|
170 |
// switch insert method
|
171 |
switch( options.method ){
|
165 |
}
|
166 |
|
167 |
// use only visible elements
|
168 |
+
if( typeof options.moveintohidden === 'undefined' ){
|
169 |
+
target = jQuery( target ).filter(':visible');
|
170 |
+
}
|
171 |
|
172 |
// switch insert method
|
173 |
switch( options.method ){
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link:https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id
|
|
4 |
Tags: ads, ad, ad inserter, ad injection, ad manager, ads manager, ad widget, adrotate, adsense, advertise, advertisements, advertising, adverts, advert, amazon, banner, banners, buysellads, chitika, clickbank, dfp, doubleclick, geotarget, geolocation, geo location, google dfp, monetization, widget
|
5 |
Requires at least: WP 4.2, PHP 5.3
|
6 |
Tested up to: 4.7.2
|
7 |
-
Stable tag: 1.7.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -31,7 +31,7 @@ Advanced Ads is a simple ad manager made by a publisher for publishers. Based on
|
|
31 |
choose between different ad types that enable you to:
|
32 |
|
33 |
* insert code for ad and affiliate networks (e.g., AdSense, Chitika, Amazon, BuySellAds, DoubleClick)
|
34 |
-
* dedicated support for Google AdSense banners
|
35 |
* display images and image banners
|
36 |
* use shortcodes within ads (to also deliver advertisements from other ad plugins like AdRotate or Simple Ads Manager)
|
37 |
* create content rich ads with the tinymc editor
|
@@ -69,7 +69,7 @@ show ads based on conditions like
|
|
69 |
global conditions:
|
70 |
|
71 |
* disable all ads in the frontend (e.g. when your ad network breaks down)
|
72 |
-
* disable all ads on 404 pages (e.g.
|
73 |
* disable all ads on non-singular pages
|
74 |
* disable all ads in secondary queries
|
75 |
* disable all ads in the feed
|
@@ -112,6 +112,7 @@ You can also use it to insert additional ad network tags into header or footer o
|
|
112 |
|
113 |
= Google AdSense =
|
114 |
|
|
|
115 |
* switch sizes of an ad
|
116 |
* switch between normal and responsive ads
|
117 |
* optional limit to 3 AdSense banners according to AdSense terms of service
|
@@ -208,6 +209,14 @@ There is no revenue share. Advanced Ads doesn’t alter your ad codes in a way t
|
|
208 |
|
209 |
== Changelog ==
|
210 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
= 1.7.17 =
|
212 |
|
213 |
* add `ADVANCED_ADS_DISABLE_SHORTCODE_BUTTON` constant to wp-config.php in order to remove the shortcode button from the TinyMCE interface
|
4 |
Tags: ads, ad, ad inserter, ad injection, ad manager, ads manager, ad widget, adrotate, adsense, advertise, advertisements, advertising, adverts, advert, amazon, banner, banners, buysellads, chitika, clickbank, dfp, doubleclick, geotarget, geolocation, geo location, google dfp, monetization, widget
|
5 |
Requires at least: WP 4.2, PHP 5.3
|
6 |
Tested up to: 4.7.2
|
7 |
+
Stable tag: 1.7.18
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
31 |
choose between different ad types that enable you to:
|
32 |
|
33 |
* insert code for ad and affiliate networks (e.g., AdSense, Chitika, Amazon, BuySellAds, DoubleClick)
|
34 |
+
* dedicated support for all types of Google AdSense banners
|
35 |
* display images and image banners
|
36 |
* use shortcodes within ads (to also deliver advertisements from other ad plugins like AdRotate or Simple Ads Manager)
|
37 |
* create content rich ads with the tinymc editor
|
69 |
global conditions:
|
70 |
|
71 |
* disable all ads in the frontend (e.g. when your ad network breaks down)
|
72 |
+
* disable all ads on 404 pages (e.g. recommended for AdSense)
|
73 |
* disable all ads on non-singular pages
|
74 |
* disable all ads in secondary queries
|
75 |
* disable all ads in the feed
|
112 |
|
113 |
= Google AdSense =
|
114 |
|
115 |
+
* supports all ad units, including display ads, link units, and matched content
|
116 |
* switch sizes of an ad
|
117 |
* switch between normal and responsive ads
|
118 |
* optional limit to 3 AdSense banners according to AdSense terms of service
|
209 |
|
210 |
== Changelog ==
|
211 |
|
212 |
+
= 1.7.18 =
|
213 |
+
|
214 |
+
* use the same ad block disguise settings for all sites in a multisite
|
215 |
+
* update to advanced.js to allow injection into hidden elements
|
216 |
+
* fixed group options being overridden, when filtered groups are being saved
|
217 |
+
* fixed missing attribute for responsive Matched Content ads
|
218 |
+
* fixed issue with MarketPress license check
|
219 |
+
|
220 |
= 1.7.17 =
|
221 |
|
222 |
* add `ADVANCED_ADS_DISABLE_SHORTCODE_BUTTON` constant to wp-config.php in order to remove the shortcode button from the TinyMCE interface
|