Version Description
- added missing files to repository
Download this release
Release Info
Developer | webzunft |
Plugin | Advanced Ads |
Version | 1.6.2.1 |
Comparing to | |
See all releases |
Code changes from version 1.6.2 to 1.6.2.1
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.6.2
|
16 |
* Author: Thomas Maier
|
17 |
* Author URI: http://webgilde.com
|
18 |
* Text Domain: advanced-ads
|
@@ -38,7 +38,7 @@ define( 'ADVADS_BASE_DIR', dirname( plugin_basename( __FILE__ ) ) ); // director
|
|
38 |
// general and global slug, e.g. to store options in WP, textdomain
|
39 |
define( 'ADVADS_SLUG', 'advanced-ads' );
|
40 |
define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
|
41 |
-
define( 'ADVADS_VERSION', '1.6.2' );
|
42 |
|
43 |
/*----------------------------------------------------------------------------*
|
44 |
* 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.6.2.1
|
16 |
* Author: Thomas Maier
|
17 |
* Author URI: http://webgilde.com
|
18 |
* Text Domain: advanced-ads
|
38 |
// general and global slug, e.g. to store options in WP, textdomain
|
39 |
define( 'ADVADS_SLUG', 'advanced-ads' );
|
40 |
define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
|
41 |
+
define( 'ADVADS_VERSION', '1.6.2.1' );
|
42 |
|
43 |
/*----------------------------------------------------------------------------*
|
44 |
* Autoloading, modules and functions
|
modules/gadsense/admin/assets/js/new-ad.js
CHANGED
@@ -65,7 +65,6 @@
|
|
65 |
var theContent = $( '<div />' ).html( rawContent );
|
66 |
var adByGoogle = theContent.find( 'ins' );
|
67 |
theAd.slotId = adByGoogle.attr( 'data-ad-slot' );
|
68 |
-
theAd.pubId = '';
|
69 |
if ('undefined' != typeof(adByGoogle.attr( 'data-ad-client' ))) {
|
70 |
theAd.pubId = adByGoogle.attr( 'data-ad-client' ).substr( 3 );
|
71 |
}
|
@@ -96,6 +95,7 @@
|
|
96 |
*/
|
97 |
function setDetailsFromAdCode(theAd) {
|
98 |
$( '#unit-code' ).val( theAd.slotId );
|
|
|
99 |
if ('normal' == theAd.type) {
|
100 |
$( '#unit-type' ).val( 'normal' );
|
101 |
$( '#advanced-ads-ad-parameters-size input[name="advanced_ad[width]"]' ).val( theAd.width );
|
@@ -108,9 +108,7 @@
|
|
108 |
$( '#advanced-ads-ad-parameters-size input[name="advanced_ad[height]"]' ).val( '' );
|
109 |
}
|
110 |
var storedPubId = gadsenseData.pubId;
|
111 |
-
if (''
|
112 |
-
$( '#adsense-ad-param-error' ).text( gadsenseData.msg.missingPubId );
|
113 |
-
} else if (theAd.pubId != storedPubId) {
|
114 |
$( '#adsense-ad-param-error' ).text( gadsenseData.msg.pubIdMismatch );
|
115 |
} else {
|
116 |
$( '#adsense-ad-param-error' ).empty();
|
65 |
var theContent = $( '<div />' ).html( rawContent );
|
66 |
var adByGoogle = theContent.find( 'ins' );
|
67 |
theAd.slotId = adByGoogle.attr( 'data-ad-slot' );
|
|
|
68 |
if ('undefined' != typeof(adByGoogle.attr( 'data-ad-client' ))) {
|
69 |
theAd.pubId = adByGoogle.attr( 'data-ad-client' ).substr( 3 );
|
70 |
}
|
95 |
*/
|
96 |
function setDetailsFromAdCode(theAd) {
|
97 |
$( '#unit-code' ).val( theAd.slotId );
|
98 |
+
$( '#advads-adsense-pub-id' ).val( theAd.pubId );
|
99 |
if ('normal' == theAd.type) {
|
100 |
$( '#unit-type' ).val( 'normal' );
|
101 |
$( '#advanced-ads-ad-parameters-size input[name="advanced_ad[width]"]' ).val( theAd.width );
|
108 |
$( '#advanced-ads-ad-parameters-size input[name="advanced_ad[height]"]' ).val( '' );
|
109 |
}
|
110 |
var storedPubId = gadsenseData.pubId;
|
111 |
+
if ('' !== storedPubId && theAd.pubId != storedPubId) {
|
|
|
|
|
112 |
$( '#adsense-ad-param-error' ).text( gadsenseData.msg.pubIdMismatch );
|
113 |
} else {
|
114 |
$( '#adsense-ad-param-error' ).empty();
|
modules/gadsense/admin/class-gadsense-admin.php
CHANGED
@@ -18,6 +18,7 @@ class Gadsense_Admin {
|
|
18 |
add_action( 'admin_print_scripts', array($this, 'print_scripts') );
|
19 |
add_action( 'admin_init', array($this, 'init') );
|
20 |
add_filter( 'advanced-ads-list-ad-size', array($this, 'ad_details_column'), 10, 2 );
|
|
|
21 |
}
|
22 |
|
23 |
public function ad_details_column($size, $the_ad) {
|
@@ -42,8 +43,7 @@ class Gadsense_Admin {
|
|
42 |
pubId : '<?php echo $pub_id; ?>',
|
43 |
msg : {
|
44 |
unknownAd : '<?php esc_attr_e( "The ad details couldn't be retrieved from the ad code", ADVADS_SLUG ); ?>',
|
45 |
-
pubIdMismatch : '<?php _e( 'Warning : The AdSense account from this code does not match the one set with the Advanced Ads Plugin. This ad might cause troubles when used in the front end.', ADVADS_SLUG ); ?>'
|
46 |
-
missingPubId : '<?php _e( 'Warning : You have not yet entered an AdSense account ID. The plugin won’t work without that', ADVADS_SLUG ); ?>',
|
47 |
}
|
48 |
};
|
49 |
</script>
|
@@ -281,4 +281,34 @@ class Gadsense_Admin {
|
|
281 |
return $tabs;
|
282 |
}
|
283 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
}
|
18 |
add_action( 'admin_print_scripts', array($this, 'print_scripts') );
|
19 |
add_action( 'admin_init', array($this, 'init') );
|
20 |
add_filter( 'advanced-ads-list-ad-size', array($this, 'ad_details_column'), 10, 2 );
|
21 |
+
add_filter( 'advanced-ads-ad-settings-pre-save', array($this, 'sanitize_ad_settings') );
|
22 |
}
|
23 |
|
24 |
public function ad_details_column($size, $the_ad) {
|
43 |
pubId : '<?php echo $pub_id; ?>',
|
44 |
msg : {
|
45 |
unknownAd : '<?php esc_attr_e( "The ad details couldn't be retrieved from the ad code", ADVADS_SLUG ); ?>',
|
46 |
+
pubIdMismatch : '<?php _e( 'Warning : The AdSense account from this code does not match the one set with the Advanced Ads Plugin. This ad might cause troubles when used in the front end.', ADVADS_SLUG ); ?>'
|
|
|
47 |
}
|
48 |
};
|
49 |
</script>
|
281 |
return $tabs;
|
282 |
}
|
283 |
|
284 |
+
/**
|
285 |
+
* sanitize ad settings
|
286 |
+
* save publisher id from new ad unit if not given in main options
|
287 |
+
*
|
288 |
+
* @since 1.6.2
|
289 |
+
* @param arr $ad_settings_post
|
290 |
+
* @return arr $ad_settings_post
|
291 |
+
*/
|
292 |
+
public function sanitize_ad_settings( array $ad_settings_post ){
|
293 |
+
|
294 |
+
// check ad type
|
295 |
+
if( ! isset( $ad_settings_post['type'] ) || 'adsense' !== $ad_settings_post['type'] ){
|
296 |
+
return $ad_settings_post;
|
297 |
+
}
|
298 |
+
|
299 |
+
// save AdSense publisher ID if given and remove it from options
|
300 |
+
if ( ! empty($ad_settings_post['output']['adsense-pub-id']) ) {
|
301 |
+
// get options
|
302 |
+
$adsense_options = get_option( 'advanced-ads-adsense', array() );
|
303 |
+
$adsense_options['adsense-id'] = $ad_settings_post['output']['adsense-pub-id'];
|
304 |
+
|
305 |
+
// save adsense options including publisher id
|
306 |
+
update_option( 'advanced-ads-adsense', $adsense_options );
|
307 |
+
|
308 |
+
}
|
309 |
+
unset( $ad_settings_post['output']['adsense-pub-id'] );
|
310 |
+
|
311 |
+
return $ad_settings_post;
|
312 |
+
}
|
313 |
+
|
314 |
}
|
modules/gadsense/admin/views/adsense-ad-parameters.php
CHANGED
@@ -23,6 +23,17 @@ if ( $is_responsive ) {
|
|
23 |
<?php _e( 'Ad Slot ID', ADVADS_SLUG ); ?> :
|
24 |
<input type="text" name="unit-code" id="unit-code" value="<?php echo $unit_code; ?>" />
|
25 |
</label>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
<label>
|
27 |
<?php _e( 'Type', ADVADS_SLUG ); ?> :
|
28 |
<select name="unit-type" id="unit-type">
|
23 |
<?php _e( 'Ad Slot ID', ADVADS_SLUG ); ?> :
|
24 |
<input type="text" name="unit-code" id="unit-code" value="<?php echo $unit_code; ?>" />
|
25 |
</label>
|
26 |
+
<input type="hidden" name="advanced_ad[output][adsense-pub-id]" id="advads-adsense-pub-id" value="" />
|
27 |
+
<?php if( $pub_id ) : ?>
|
28 |
+
<p><?php printf(__( 'Publisher ID: %s', ADVADS_SLUG ), $pub_id ); ?></p>
|
29 |
+
<?php endif; ?>
|
30 |
+
<?php if( $pub_id_errors ) : ?>
|
31 |
+
<p><span class="advads-error-message">
|
32 |
+
<?php echo $pub_id_errors; ?>
|
33 |
+
</span><?php
|
34 |
+
printf(__( 'Please <a href="%s" target="_blank">change it here</a>.', ADVADS_SLUG ), admin_url( 'admin.php?page=advanced-ads-settings#top#adsense' ));
|
35 |
+
?></p>
|
36 |
+
<?php endif; ?>
|
37 |
<label>
|
38 |
<?php _e( 'Type', ADVADS_SLUG ); ?> :
|
39 |
<select name="unit-type" id="unit-type">
|
modules/gadsense/includes/class-ad-type-adsense.php
CHANGED
@@ -65,7 +65,13 @@ class Advanced_Ads_Ad_Type_Adsense extends Advanced_Ads_Ad_Type_Abstract {
|
|
65 |
);
|
66 |
|
67 |
$db = Gadsense_Data::get_instance();
|
68 |
-
$pub_id = $db->get_adsense_id();
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
if ( ! empty($content) ) {
|
71 |
$json_content = $content;
|
65 |
);
|
66 |
|
67 |
$db = Gadsense_Data::get_instance();
|
68 |
+
$pub_id = trim( $db->get_adsense_id() );
|
69 |
+
|
70 |
+
// check pub_id for errors
|
71 |
+
$pub_id_errors = false;
|
72 |
+
if( $pub_id !== '' && 0 !== strpos( $pub_id, 'pub-' )){
|
73 |
+
$pub_id_errors = __( 'The Publisher ID has an incorrect format. (must start with "pub-")', ADVADS_SLUG );
|
74 |
+
}
|
75 |
|
76 |
if ( ! empty($content) ) {
|
77 |
$json_content = $content;
|
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, adsense, display, banner, advertisements, adverts, advert, monetization
|
5 |
Requires at least: WP 3.5, PHP 5.3
|
6 |
Tested up to: 4.2.2
|
7 |
-
Stable tag: 1.6.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -175,6 +175,10 @@ There is no revenue share. Advanced Ads doesn’t alter your ad codes in a way t
|
|
175 |
|
176 |
== Changelog ==
|
177 |
|
|
|
|
|
|
|
|
|
178 |
= 1.6.2 =
|
179 |
|
180 |
* display dashboard widget only to authors and higher roles
|
4 |
Tags: ads, ad, adsense, display, banner, advertisements, adverts, advert, monetization
|
5 |
Requires at least: WP 3.5, PHP 5.3
|
6 |
Tested up to: 4.2.2
|
7 |
+
Stable tag: 1.6.2.1
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
175 |
|
176 |
== Changelog ==
|
177 |
|
178 |
+
= 1.6.2.1 =
|
179 |
+
|
180 |
+
* added missing files to repository
|
181 |
+
|
182 |
= 1.6.2 =
|
183 |
|
184 |
* display dashboard widget only to authors and higher roles
|