Version Description
- added tab menu fr settings
- allow to set ad weights for pending, future and private ads
- improvements to groups overview based on group types
- fixed switching ad types
- fixed individual post conditions not showing up
- fixed update message being displayed for new installations
- other fixes under the hood
- new hooks:
advanced-ads-setting-tabs
,advanced-ads-adsense-settings-init
- removed hooks:
advanced-ads-gadsense-after-id-changed
Download this release
Release Info
Developer | webzunft |
Plugin | Advanced Ads |
Version | 1.5.1 |
Comparing to | |
See all releases |
Code changes from version 1.5.0.1 to 1.5.1
- admin/assets/css/admin.css +8 -1
- admin/assets/js/admin.js +25 -1
- admin/class-advanced-ads-admin.php +80 -44
- admin/includes/class-ad-groups-list.php +46 -8
- admin/includes/class-display-condition-callbacks.php +3 -1
- admin/views/settings.php +35 -16
- advanced-ads.php +1 -1
- classes/ad-select.php +3 -4
- classes/ad.php +1 -1
- classes/ad_group.php +7 -5
- classes/plugin.php +37 -5
- composer.json +0 -1
- modules/gadsense/admin/class-gadsense-admin.php +123 -3
- modules/gadsense/includes/class-gadsense-data.php +26 -32
- modules/gadsense/main.php +1 -1
- public/class-advanced-ads.php +3 -3
- readme.txt +13 -3
admin/assets/css/admin.css
CHANGED
@@ -96,6 +96,7 @@
|
|
96 |
#advads-ad-group-list tbody tr:nth-child(4n+1) { background: #f9f9f9; }
|
97 |
.advads-ad-group-list-ads li { margin: 0; padding: 3px 0; }
|
98 |
.advads-ad-group-list-ads li:hover { background: #eee; }
|
|
|
99 |
.advads-ad-group-list-ads span { float: right; }
|
100 |
.advads-group-row .row-actions a { cursor: pointer; }
|
101 |
.advads-group-row .advads-usage { margin-top: 1em; }
|
@@ -135,4 +136,10 @@ tr:hover .on-hover { display: block; }
|
|
135 |
-*/
|
136 |
#pastecode-div { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.65); z-index: 250000; }
|
137 |
#pastecode-container { width: 480px; margin: 85px auto 0 auto; background-color: #fff; padding: 2%; overflow-x : scroll; overflow-y : scroll; border: 5px solid #dcdcdc; border-radius: 5px; }
|
138 |
-
#adsense-ad-param-error { color: red; font-weight: bold; }
|
|
|
|
|
|
|
|
|
|
|
|
96 |
#advads-ad-group-list tbody tr:nth-child(4n+1) { background: #f9f9f9; }
|
97 |
.advads-ad-group-list-ads li { margin: 0; padding: 3px 0; }
|
98 |
.advads-ad-group-list-ads li:hover { background: #eee; }
|
99 |
+
.advads-ad-group-list-ads i { margin-left: 1em; font-style: italic; }
|
100 |
.advads-ad-group-list-ads span { float: right; }
|
101 |
.advads-group-row .row-actions a { cursor: pointer; }
|
102 |
.advads-group-row .advads-usage { margin-top: 1em; }
|
136 |
-*/
|
137 |
#pastecode-div { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.65); z-index: 250000; }
|
138 |
#pastecode-container { width: 480px; margin: 85px auto 0 auto; background-color: #fff; padding: 2%; overflow-x : scroll; overflow-y : scroll; border: 5px solid #dcdcdc; border-radius: 5px; }
|
139 |
+
#adsense-ad-param-error { color: red; font-weight: bold; }
|
140 |
+
|
141 |
+
/**
|
142 |
+
- TABS
|
143 |
+
-*/
|
144 |
+
.advads-tab { display: none; }
|
145 |
+
.advads-tab.active { display: block; }
|
admin/assets/js/admin.js
CHANGED
@@ -153,7 +153,32 @@ jQuery( document ).ready(function ($) {
|
|
153 |
usagediv.show();
|
154 |
}
|
155 |
});
|
|
|
|
|
|
|
|
|
156 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
});
|
158 |
|
159 |
/**
|
@@ -299,7 +324,6 @@ function advads_toggle_single_display_condition_checkbox(checkbox) {
|
|
299 |
counterpart.attr( 'checked', false );
|
300 |
counterpart.attr( 'disabled', 'disabled' );
|
301 |
// mark label
|
302 |
-
console.log(jQuery('label[for="'+counterpart.attr('id')+'"]'));
|
303 |
jQuery('label[for="'+counterpart.attr('id')+'"]').addClass('ui-button-disabled').addClass('ui-state-disabled');
|
304 |
} else {
|
305 |
counterpart.removeAttr( 'disabled' );
|
153 |
usagediv.show();
|
154 |
}
|
155 |
});
|
156 |
+
// menu tabs
|
157 |
+
$('#advads-tabs').find('a').click(function () {
|
158 |
+
$('#advads-tabs').find('a').removeClass('nav-tab-active');
|
159 |
+
$('.advads-tab').removeClass('active');
|
160 |
|
161 |
+
var id = jQuery(this).attr('id').replace('-tab', '');
|
162 |
+
jQuery('#' + id).addClass('active');
|
163 |
+
jQuery(this).addClass('nav-tab-active');
|
164 |
+
});
|
165 |
+
|
166 |
+
// activate specific or first tab
|
167 |
+
var active_tab = window.location.hash.replace('#top#', '');
|
168 |
+
if (active_tab == '' || active_tab == '#_=_') {
|
169 |
+
active_tab = $('.advads-tab').attr('id');
|
170 |
+
}
|
171 |
+
$('#' + active_tab).addClass('active');
|
172 |
+
$('#' + active_tab + '-tab').addClass('nav-tab-active');
|
173 |
+
$('.nav-tab-active').click();
|
174 |
+
|
175 |
+
/**
|
176 |
+
* SETTINGS PAGE
|
177 |
+
*/
|
178 |
+
// render button sets on settings page
|
179 |
+
$(function() {
|
180 |
+
$( ".advads-settings-buttonset" ).buttonset();
|
181 |
+
});
|
182 |
});
|
183 |
|
184 |
/**
|
324 |
counterpart.attr( 'checked', false );
|
325 |
counterpart.attr( 'disabled', 'disabled' );
|
326 |
// mark label
|
|
|
327 |
jQuery('label[for="'+counterpart.attr('id')+'"]').addClass('ui-button-disabled').addClass('ui-state-disabled');
|
328 |
} else {
|
329 |
counterpart.removeAttr( 'disabled' );
|
admin/class-advanced-ads-admin.php
CHANGED
@@ -656,9 +656,11 @@ class Advanced_Ads_Admin {
|
|
656 |
$hook = $this->plugin_screen_hook_suffix;
|
657 |
|
658 |
// register settings
|
659 |
-
register_setting(
|
|
|
|
|
660 |
|
661 |
-
//
|
662 |
add_settings_section(
|
663 |
'advanced_ads_setting_section',
|
664 |
__( 'General', ADVADS_SLUG ),
|
@@ -666,6 +668,14 @@ class Advanced_Ads_Admin {
|
|
666 |
$hook
|
667 |
);
|
668 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
669 |
// add setting fields to disable ads
|
670 |
add_settings_field(
|
671 |
'disable-ads',
|
@@ -720,6 +730,15 @@ class Advanced_Ads_Admin {
|
|
720 |
// for whatever purpose there might come
|
721 |
}
|
722 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
723 |
/**
|
724 |
* options to disable ads
|
725 |
*
|
@@ -807,6 +826,19 @@ class Advanced_Ads_Admin {
|
|
807 |
. __( 'Disabling this option only makes sense if your ads contain content you want to display to bots (like search engines) or your site is cached and bots could create a cached version without the ads.', ADVADS_SLUG ) . '</p>';
|
808 |
}
|
809 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
810 |
/**
|
811 |
* add heading for extra column of ads list
|
812 |
* remove the date column
|
@@ -1063,46 +1095,50 @@ class Advanced_Ads_Admin {
|
|
1063 |
}
|
1064 |
}
|
1065 |
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
|
|
|
|
|
|
|
|
1108 |
}
|
656 |
$hook = $this->plugin_screen_hook_suffix;
|
657 |
|
658 |
// register settings
|
659 |
+
register_setting( ADVADS_SLUG, ADVADS_SLUG, array($this, 'sanitize_settings') );
|
660 |
+
// register license settings
|
661 |
+
register_setting( ADVADS_SLUG . '-licenses', ADVADS_SLUG . '-licenses');
|
662 |
|
663 |
+
// general settings section
|
664 |
add_settings_section(
|
665 |
'advanced_ads_setting_section',
|
666 |
__( 'General', ADVADS_SLUG ),
|
668 |
$hook
|
669 |
);
|
670 |
|
671 |
+
// licenses section
|
672 |
+
add_settings_section(
|
673 |
+
'advanced_ads_settings_license_section',
|
674 |
+
__('Licenses', ADVADS_SLUG),
|
675 |
+
array($this, 'render_settings_licenses_section_callback'),
|
676 |
+
'advanced-ads-settings-license-page'
|
677 |
+
);
|
678 |
+
|
679 |
// add setting fields to disable ads
|
680 |
add_settings_field(
|
681 |
'disable-ads',
|
730 |
// for whatever purpose there might come
|
731 |
}
|
732 |
|
733 |
+
/**
|
734 |
+
* render licenses settings section
|
735 |
+
*
|
736 |
+
* @since 1.5.1
|
737 |
+
*/
|
738 |
+
public function render_settings_licenses_section_callback(){
|
739 |
+
echo '<p>'. __('Enter license keys for our powerful add-ons.', ADVADS_SLUG) .'</p>';
|
740 |
+
}
|
741 |
+
|
742 |
/**
|
743 |
* options to disable ads
|
744 |
*
|
826 |
. __( 'Disabling this option only makes sense if your ads contain content you want to display to bots (like search engines) or your site is cached and bots could create a cached version without the ads.', ADVADS_SLUG ) . '</p>';
|
827 |
}
|
828 |
|
829 |
+
/**
|
830 |
+
* sanitize plugin settings
|
831 |
+
*
|
832 |
+
* @since 1.5.1
|
833 |
+
* @param array $options all the options
|
834 |
+
*/
|
835 |
+
public function sanitize_settings($options){
|
836 |
+
|
837 |
+
// sanitize whatever option one wants to sanitize
|
838 |
+
|
839 |
+
return $options;
|
840 |
+
}
|
841 |
+
|
842 |
/**
|
843 |
* add heading for extra column of ads list
|
844 |
* remove the date column
|
1095 |
}
|
1096 |
}
|
1097 |
|
1098 |
+
/**
|
1099 |
+
* checks needed when the plugin was updated
|
1100 |
+
*
|
1101 |
+
* @since 1.4.5
|
1102 |
+
*/
|
1103 |
+
public function update_version_logic(){
|
1104 |
+
$plugin = Advanced_Ads_Plugin::get_instance();
|
1105 |
+
$options = $plugin->internal_options();
|
1106 |
+
$user_options = $plugin->options();
|
1107 |
+
|
1108 |
+
$new_options = $options;
|
1109 |
+
|
1110 |
+
// check, if current notices were deleted
|
1111 |
+
// TODO: there is probably a better hook for that
|
1112 |
+
if ( isset( $_GET['advads-remove-notices'] ) ) {
|
1113 |
+
// TODO could as well use internal options instead of $_SESSION
|
1114 |
+
// get options and clear the notices option
|
1115 |
+
$new_options['version_notices'] = array();
|
1116 |
+
if ( isset($_SESSION['advanced_ads_version_notices'] ) ) {
|
1117 |
+
unset( $_SESSION['advanced_ads_version_notices'] );
|
1118 |
+
}
|
1119 |
+
}
|
1120 |
+
|
1121 |
+
// use an artifical older version for updates on installed plugins before the notice logic was invented
|
1122 |
+
if( ! isset( $options['version'] ) && $user_options !== array() ){
|
1123 |
+
$old_version = '1.4.4';
|
1124 |
+
} else {
|
1125 |
+
// set empty version for new installations
|
1126 |
+
$old_version = 0;
|
1127 |
+
}
|
1128 |
+
$version = Advanced_Ads::VERSION;
|
1129 |
+
$updated_versions = isset( $new_options['version_notices'] ) ? $new_options['version_notices'] : array();
|
1130 |
+
|
1131 |
+
// handle update notices
|
1132 |
+
new AdvAds_Admin_Notices( $old_version, $version, $updated_versions );
|
1133 |
+
|
1134 |
+
$new_options['version'] = $version;
|
1135 |
+
if ( isset( $_SESSION['advanced_ads_version_notices'] ) ) {
|
1136 |
+
$new_options['version_notices'] = $_SESSION['advanced_ads_version_notices'];
|
1137 |
+
}
|
1138 |
+
|
1139 |
+
// save options, if version information changed
|
1140 |
+
if ( $options !== $new_options ) {
|
1141 |
+
$plugin->update_internal_options( $new_options );
|
1142 |
+
}
|
1143 |
+
}
|
1144 |
}
|
admin/includes/class-ad-groups-list.php
CHANGED
@@ -104,9 +104,10 @@ class AdvAds_Groups_List {
|
|
104 |
// query ads
|
105 |
$ads = $this->get_ads($group);
|
106 |
$weights = $group->get_ad_weights();
|
|
|
|
|
107 |
|
108 |
// The Loop
|
109 |
-
$ad_form_rows = array();
|
110 |
if ( $ads->post_count ) {
|
111 |
foreach($ads->posts as $_ad) {
|
112 |
$row = '';
|
@@ -118,8 +119,10 @@ class AdvAds_Groups_List {
|
|
118 |
$row .= '<option ' . selected( $ad_weight, $i, false ) . '>' . $i . '</option>';
|
119 |
}
|
120 |
$row .= '</select></td></tr>';
|
121 |
-
$ad_form_rows[] = $row;
|
122 |
}
|
|
|
|
|
123 |
}
|
124 |
// Restore original Post Data
|
125 |
wp_reset_postdata();
|
@@ -139,18 +142,36 @@ class AdvAds_Groups_List {
|
|
139 |
|
140 |
$weights = $group->get_ad_weights();
|
141 |
$weight_sum = array_sum( $weights );
|
|
|
|
|
142 |
|
143 |
// The Loop
|
144 |
if ( $ads->have_posts() ) {
|
145 |
-
echo '<ul>';
|
146 |
while ( $ads->have_posts() ) {
|
147 |
$ads->the_post();
|
148 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
$_weight = (isset($weights[get_the_ID()])) ? $weights[get_the_ID()] : Advads_Ad_Group::MAX_AD_GROUP_WEIGHT;
|
150 |
-
|
151 |
-
|
|
|
|
|
152 |
}
|
153 |
-
|
|
|
|
|
|
|
|
|
154 |
if($group->ad_count > 1) echo '<p>' . sprintf(__('up to %d ads displayed', ADVADS_SLUG), $group->ad_count) . '</p>';
|
155 |
} else {
|
156 |
_e('No ads assigned', ADVADS_SLUG);
|
@@ -159,6 +180,23 @@ class AdvAds_Groups_List {
|
|
159 |
wp_reset_postdata();
|
160 |
}
|
161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
/**
|
163 |
* get ads for this group
|
164 |
*
|
@@ -168,7 +206,7 @@ class AdvAds_Groups_List {
|
|
168 |
public function get_ads($group){
|
169 |
$args = array(
|
170 |
'post_type' => $this->post_type,
|
171 |
-
'post_status' => 'publish',
|
172 |
'taxonomy' => $group->taxonomy,
|
173 |
'term' => $group->slug
|
174 |
);
|
104 |
// query ads
|
105 |
$ads = $this->get_ads($group);
|
106 |
$weights = $group->get_ad_weights();
|
107 |
+
$ad_form_rows = $weights;
|
108 |
+
arsort($ad_form_rows);
|
109 |
|
110 |
// The Loop
|
|
|
111 |
if ( $ads->post_count ) {
|
112 |
foreach($ads->posts as $_ad) {
|
113 |
$row = '';
|
119 |
$row .= '<option ' . selected( $ad_weight, $i, false ) . '>' . $i . '</option>';
|
120 |
}
|
121 |
$row .= '</select></td></tr>';
|
122 |
+
$ad_form_rows[$_ad->ID] = $row;
|
123 |
}
|
124 |
+
|
125 |
+
$ad_form_rows = $this->remove_empty_weights($ad_form_rows);
|
126 |
}
|
127 |
// Restore original Post Data
|
128 |
wp_reset_postdata();
|
142 |
|
143 |
$weights = $group->get_ad_weights();
|
144 |
$weight_sum = array_sum( $weights );
|
145 |
+
$ads_output = $weights;
|
146 |
+
arsort($ads_output);
|
147 |
|
148 |
// The Loop
|
149 |
if ( $ads->have_posts() ) {
|
150 |
+
echo ($group->type == 'default' && $weight_sum) ? '<ul>' : '<ol>';
|
151 |
while ( $ads->have_posts() ) {
|
152 |
$ads->the_post();
|
153 |
+
$line_output = '<li><a href="' . get_edit_post_link(get_the_ID()) . '">' . get_the_title() . '</a>';
|
154 |
+
|
155 |
+
$status = get_post_status();
|
156 |
+
switch($status){
|
157 |
+
case 'future' :
|
158 |
+
$line_output .= '<i>(' . __('scheduled', ADVADS_SLUG) . ')</i>';
|
159 |
+
break;
|
160 |
+
case 'pending' :
|
161 |
+
$line_output .= '<i>(' . __('pending', ADVADS_SLUG) . ')</i>';
|
162 |
+
break;
|
163 |
+
}
|
164 |
$_weight = (isset($weights[get_the_ID()])) ? $weights[get_the_ID()] : Advads_Ad_Group::MAX_AD_GROUP_WEIGHT;
|
165 |
+
if($group->type == 'default' && $weight_sum) {
|
166 |
+
$line_output .= '<span class="ad-weight" title="'.__('Ad weight', ADVADS_SLUG).'">' . number_format(($_weight / $weight_sum) * 100) .'%</span></li>';
|
167 |
+
}
|
168 |
+
$ads_output[get_the_ID()] = $line_output;
|
169 |
}
|
170 |
+
|
171 |
+
$ads_output = $this->remove_empty_weights($ads_output);
|
172 |
+
|
173 |
+
echo implode('', $ads_output);
|
174 |
+
echo ($group->type == 'default' && $weight_sum) ? '</ul>' : '</ol>';
|
175 |
if($group->ad_count > 1) echo '<p>' . sprintf(__('up to %d ads displayed', ADVADS_SLUG), $group->ad_count) . '</p>';
|
176 |
} else {
|
177 |
_e('No ads assigned', ADVADS_SLUG);
|
180 |
wp_reset_postdata();
|
181 |
}
|
182 |
|
183 |
+
/**
|
184 |
+
* remove entries from the ad weight array that are just id
|
185 |
+
*
|
186 |
+
* @since 1.5.1
|
187 |
+
* @param arr $ads_output array with any output other that an integer
|
188 |
+
* @return arr $ads_output array with ad output
|
189 |
+
*/
|
190 |
+
private function remove_empty_weights(array $ads_output){
|
191 |
+
|
192 |
+
foreach($ads_output as $key => $value){
|
193 |
+
if(is_int($value))
|
194 |
+
unset($ads_output[$key]);
|
195 |
+
}
|
196 |
+
|
197 |
+
return $ads_output;
|
198 |
+
}
|
199 |
+
|
200 |
/**
|
201 |
* get ads for this group
|
202 |
*
|
206 |
public function get_ads($group){
|
207 |
$args = array(
|
208 |
'post_type' => $this->post_type,
|
209 |
+
'post_status' => array('publish', 'pending', 'future', 'private'),
|
210 |
'taxonomy' => $group->taxonomy,
|
211 |
'term' => $group->slug
|
212 |
);
|
admin/includes/class-display-condition-callbacks.php
CHANGED
@@ -230,7 +230,7 @@ if ( ! empty($ad->conditions['categoryarchiveids']['exclude']) ){
|
|
230 |
|
231 |
if ( is_object( $ad ) ){
|
232 |
$_all = (isset($ad->conditions['postids']['all'])) ? 1 : 0;
|
233 |
-
if ( ! $_all && empty($ad->conditions['postids']['
|
234 |
$_all = 1;
|
235 |
}
|
236 |
}
|
@@ -293,6 +293,8 @@ if ( ! empty($ad->conditions['categoryarchiveids']['exclude']) ){
|
|
293 |
} else {
|
294 |
$_postids = $ad->conditions['postids']['exclude'];
|
295 |
}
|
|
|
|
|
296 |
} else {
|
297 |
$_postids = array();
|
298 |
}
|
230 |
|
231 |
if ( is_object( $ad ) ){
|
232 |
$_all = (isset($ad->conditions['postids']['all'])) ? 1 : 0;
|
233 |
+
if ( ! $_all && empty($ad->conditions['postids']['method']) ){
|
234 |
$_all = 1;
|
235 |
}
|
236 |
}
|
293 |
} else {
|
294 |
$_postids = $ad->conditions['postids']['exclude'];
|
295 |
}
|
296 |
+
} elseif( isset($ad->conditions['postids']['ids']) && is_array($ad->conditions['postids']['ids'])) {
|
297 |
+
$_postids = $ad->conditions['postids']['ids'];
|
298 |
} else {
|
299 |
$_postids = array();
|
300 |
}
|
admin/views/settings.php
CHANGED
@@ -2,26 +2,45 @@
|
|
2 |
/**
|
3 |
* the view for the settings page
|
4 |
*/
|
5 |
-
?>
|
6 |
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
<?php screen_icon(); ?>
|
9 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
<form method="POST" action="options.php">
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
do_settings_sections( $this->plugin_screen_hook_suffix );
|
15 |
|
16 |
-
do_action( 'advanced-ads-settings-form' );
|
17 |
-
submit_button();
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
do_action( 'advanced-ads-additional-settings-form' );
|
24 |
-
?>
|
25 |
<ul>
|
26 |
<li><a href="/wp-admin/admin.php?page=advanced-ads-debug"><?php _e( 'Debug Page', ADVADS_SLUG ); ?></a></li>
|
27 |
<li><a href="http://wordpress.org/plugins/advanced-ads/" title="<?php _e( 'Advanced Ads on WordPress.org', ADVADS_SLUG ); ?>"><?php _e( 'Advanced Ads on wp.org', ADVADS_SLUG ); ?></a></li>
|
2 |
/**
|
3 |
* the view for the settings page
|
4 |
*/
|
|
|
5 |
|
6 |
+
// array with setting tabs for frontend
|
7 |
+
$setting_tabs = apply_filters('advanced-ads-setting-tabs', array(
|
8 |
+
'general' => array(
|
9 |
+
'page' => $this->plugin_screen_hook_suffix,
|
10 |
+
'group' => ADVADS_SLUG,
|
11 |
+
'tabid' => 'general',
|
12 |
+
'title' => __( 'General', ADVADS_SLUG )
|
13 |
+
),
|
14 |
+
'licenses' => array(
|
15 |
+
'page' => 'advanced-ads-settings-license-page',
|
16 |
+
'group' => ADVADS_SLUG . '-licenses',
|
17 |
+
'tabid' => 'licenses',
|
18 |
+
'title' => __( 'Licenses', ADVADS_SLUG )
|
19 |
+
)
|
20 |
+
));
|
21 |
+
?><div class="wrap">
|
22 |
<?php screen_icon(); ?>
|
23 |
+
<h2><?php echo esc_html( get_admin_page_title() ); ?></h2>
|
24 |
+
<?php settings_errors(); ?>
|
25 |
+
<h2 class="nav-tab-wrapper" id="advads-tabs">
|
26 |
+
<?php foreach($setting_tabs as $_setting_tab_id => $_setting_tab) : ?>
|
27 |
+
<a class="nav-tab" id="<?php echo $_setting_tab_id; ?>-tab"
|
28 |
+
href="#top#<?php echo $_setting_tab_id; ?>"><?php echo $_setting_tab['title']; ?></a>
|
29 |
+
<?php endforeach; ?>
|
30 |
+
</h2>
|
31 |
+
<?php foreach($setting_tabs as $_setting_tab_id => $_setting_tab) : ?>
|
32 |
<form method="POST" action="options.php">
|
33 |
+
<div id="<?php echo $_setting_tab_id; ?>" class="advads-tab"><?php
|
34 |
+
settings_fields( $_setting_tab['group'] );
|
35 |
+
do_settings_sections( $_setting_tab['page'] );
|
|
|
36 |
|
37 |
+
do_action( 'advanced-ads-settings-form', $_setting_tab_id, $_setting_tab );
|
38 |
+
submit_button(__('Save settings on this page', ADVADS_SLUG));
|
39 |
+
?></div></form>
|
40 |
+
<?php endforeach; ?>
|
41 |
+
<?php
|
42 |
+
do_action( 'advanced-ads-additional-settings-form' );
|
43 |
+
?>
|
|
|
|
|
44 |
<ul>
|
45 |
<li><a href="/wp-admin/admin.php?page=advanced-ads-debug"><?php _e( 'Debug Page', ADVADS_SLUG ); ?></a></li>
|
46 |
<li><a href="http://wordpress.org/plugins/advanced-ads/" title="<?php _e( 'Advanced Ads on WordPress.org', ADVADS_SLUG ); ?>"><?php _e( 'Advanced Ads on wp.org', ADVADS_SLUG ); ?></a></li>
|
advanced-ads.php
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
* Plugin Name: Advanced Ads
|
13 |
* Plugin URI: http://wpadvancedads.com
|
14 |
* Description: Manage and optimize your ads in WordPress
|
15 |
-
* Version: 1.5.
|
16 |
* Author: Thomas Maier
|
17 |
* Author URI: http://webgilde.com
|
18 |
* Text Domain: advanced-ads
|
12 |
* Plugin Name: Advanced Ads
|
13 |
* Plugin URI: http://wpadvancedads.com
|
14 |
* Description: Manage and optimize your ads in WordPress
|
15 |
+
* Version: 1.5.1
|
16 |
* Author: Thomas Maier
|
17 |
* Author URI: http://webgilde.com
|
18 |
* Text Domain: advanced-ads
|
classes/ad-select.php
CHANGED
@@ -69,12 +69,11 @@ class Advanced_Ads_Select {
|
|
69 |
*/
|
70 |
public function get_ad_arguments( $method, $id, $args = array() )
|
71 |
{
|
72 |
-
|
73 |
|
74 |
-
|
75 |
-
|
76 |
|
77 |
-
// -TODO add hook: document, review existing use cases
|
78 |
$args = apply_filters( 'advanced-ads-ad-select-args', $args );
|
79 |
|
80 |
return $args;
|
69 |
*/
|
70 |
public function get_ad_arguments( $method, $id, $args = array() )
|
71 |
{
|
72 |
+
$args = (array) $args;
|
73 |
|
74 |
+
if ( ! isset($args['method']) ) $args['method'] = $method;
|
75 |
+
if ( ! isset($args['id']) ) $args['id'] = $id;
|
76 |
|
|
|
77 |
$args = apply_filters( 'advanced-ads-ad-select-args', $args );
|
78 |
|
79 |
return $args;
|
classes/ad.php
CHANGED
@@ -571,7 +571,7 @@ class Advads_Ad {
|
|
571 |
// update global settings
|
572 |
$this->update_general_ad_conditions( $conditions );
|
573 |
|
574 |
-
|
575 |
|
576 |
}
|
577 |
|
571 |
// update global settings
|
572 |
$this->update_general_ad_conditions( $conditions );
|
573 |
|
574 |
+
update_post_meta( $this->id, self::$options_meta_field, $options );
|
575 |
|
576 |
}
|
577 |
|
classes/ad_group.php
CHANGED
@@ -307,14 +307,16 @@ class Advads_Ad_Group {
|
|
307 |
if ( $this->ad_weights == 0 ) {
|
308 |
$weights = get_option( 'advads-ad-weights', array() );
|
309 |
if ( isset($weights[$this->id]) ) {
|
310 |
-
|
311 |
}
|
312 |
-
} elseif ( is_array( $this->ad_weights ) ) { // return ad weigths if not empty
|
313 |
-
return $this->ad_weights;
|
314 |
}
|
315 |
|
316 |
-
// return
|
317 |
-
|
|
|
|
|
|
|
|
|
318 |
}
|
319 |
|
320 |
/**
|
307 |
if ( $this->ad_weights == 0 ) {
|
308 |
$weights = get_option( 'advads-ad-weights', array() );
|
309 |
if ( isset($weights[$this->id]) ) {
|
310 |
+
$this->ad_weights = $weights[$this->id];
|
311 |
}
|
|
|
|
|
312 |
}
|
313 |
|
314 |
+
// return ad weights ordered by weight
|
315 |
+
if(!is_array($this->ad_weights)) {
|
316 |
+
return array();
|
317 |
+
} else {
|
318 |
+
return $this->ad_weights;
|
319 |
+
}
|
320 |
}
|
321 |
|
322 |
/**
|
classes/plugin.php
CHANGED
@@ -29,7 +29,7 @@ class Advanced_Ads_Plugin {
|
|
29 |
* @since 1.0.1
|
30 |
* @var array (if loaded)
|
31 |
*/
|
32 |
-
protected $options
|
33 |
|
34 |
/**
|
35 |
* interal plugin options – set by the plugin
|
@@ -37,7 +37,7 @@ class Advanced_Ads_Plugin {
|
|
37 |
* @since 1.4.5
|
38 |
* @var array (if loaded)
|
39 |
*/
|
40 |
-
protected $internal_options
|
41 |
|
42 |
private function __construct() {
|
43 |
register_activation_hook( dirname( __FILE__ ), array( $this, 'activate' ) );
|
@@ -53,7 +53,7 @@ class Advanced_Ads_Plugin {
|
|
53 |
public static function get_instance() {
|
54 |
// If the single instance hasn't been set, set it now.
|
55 |
if ( null === self::$instance ) {
|
56 |
-
|
57 |
}
|
58 |
|
59 |
return self::$instance;
|
@@ -310,13 +310,29 @@ class Advanced_Ads_Plugin {
|
|
310 |
* @todo parse default options
|
311 |
*/
|
312 |
public function options() {
|
313 |
-
if (
|
314 |
$this->options = get_option( ADVADS_SLUG, array() );
|
315 |
}
|
316 |
|
317 |
return $this->options;
|
318 |
}
|
319 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
320 |
/**
|
321 |
* return internal plugin options
|
322 |
* these are options set by the plugin
|
@@ -326,10 +342,26 @@ class Advanced_Ads_Plugin {
|
|
326 |
* @todo parse default options
|
327 |
*/
|
328 |
public function internal_options() {
|
329 |
-
if (
|
330 |
$this->internal_options = get_option( ADVADS_SLUG . '-internal', array() );
|
331 |
}
|
332 |
|
333 |
return $this->internal_options;
|
334 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
335 |
}
|
29 |
* @since 1.0.1
|
30 |
* @var array (if loaded)
|
31 |
*/
|
32 |
+
protected $options;
|
33 |
|
34 |
/**
|
35 |
* interal plugin options – set by the plugin
|
37 |
* @since 1.4.5
|
38 |
* @var array (if loaded)
|
39 |
*/
|
40 |
+
protected $internal_options;
|
41 |
|
42 |
private function __construct() {
|
43 |
register_activation_hook( dirname( __FILE__ ), array( $this, 'activate' ) );
|
53 |
public static function get_instance() {
|
54 |
// If the single instance hasn't been set, set it now.
|
55 |
if ( null === self::$instance ) {
|
56 |
+
self::$instance = new self;
|
57 |
}
|
58 |
|
59 |
return self::$instance;
|
310 |
* @todo parse default options
|
311 |
*/
|
312 |
public function options() {
|
313 |
+
if ( ! isset( $this->options ) ) {
|
314 |
$this->options = get_option( ADVADS_SLUG, array() );
|
315 |
}
|
316 |
|
317 |
return $this->options;
|
318 |
}
|
319 |
|
320 |
+
/**
|
321 |
+
* update plugin options (not for settings page, but if automatic options are needed)
|
322 |
+
*
|
323 |
+
* @since 1.5.1
|
324 |
+
* @param array $options new options
|
325 |
+
*/
|
326 |
+
public function update_options( array $options ) {
|
327 |
+
// do not allow to clear options
|
328 |
+
if ( $options === array() ) {
|
329 |
+
return;
|
330 |
+
}
|
331 |
+
|
332 |
+
$this->options = $options;
|
333 |
+
update_option( ADVADS_SLUG, $options );
|
334 |
+
}
|
335 |
+
|
336 |
/**
|
337 |
* return internal plugin options
|
338 |
* these are options set by the plugin
|
342 |
* @todo parse default options
|
343 |
*/
|
344 |
public function internal_options() {
|
345 |
+
if ( ! isset( $this->internal_options ) ) {
|
346 |
$this->internal_options = get_option( ADVADS_SLUG . '-internal', array() );
|
347 |
}
|
348 |
|
349 |
return $this->internal_options;
|
350 |
}
|
351 |
+
|
352 |
+
/**
|
353 |
+
* update internal plugin options
|
354 |
+
*
|
355 |
+
* @since 1.5.1
|
356 |
+
* @param array $options new internal options
|
357 |
+
*/
|
358 |
+
public function update_internal_options( array $options ) {
|
359 |
+
// do not allow to clear options
|
360 |
+
if ( $options === array() ) {
|
361 |
+
return;
|
362 |
+
}
|
363 |
+
|
364 |
+
$this->internal_options = $options;
|
365 |
+
update_option( ADVADS_SLUG . '-internal', $options );
|
366 |
+
}
|
367 |
}
|
composer.json
CHANGED
@@ -11,7 +11,6 @@
|
|
11 |
"homepage": "https://wordpress.org/plugins/advanced-ads/",
|
12 |
"license": "GPL-2.0+",
|
13 |
"type": "wordpress-plugin",
|
14 |
-
"homepage": "http://webgilde.com",
|
15 |
"support": {
|
16 |
"forum": "https://wordpress.org/support/plugin/advanced-ads"
|
17 |
},
|
11 |
"homepage": "https://wordpress.org/plugins/advanced-ads/",
|
12 |
"license": "GPL-2.0+",
|
13 |
"type": "wordpress-plugin",
|
|
|
14 |
"support": {
|
15 |
"forum": "https://wordpress.org/support/plugin/advanced-ads"
|
16 |
},
|
modules/gadsense/admin/class-gadsense-admin.php
CHANGED
@@ -6,10 +6,14 @@ class Gadsense_Admin {
|
|
6 |
private $nonce;
|
7 |
private static $instance = null;
|
8 |
protected $notice = null;
|
|
|
9 |
|
10 |
private function __construct() {
|
11 |
$this->data = Gadsense_Data::get_instance();
|
12 |
-
add_action( 'advanced-ads-
|
|
|
|
|
|
|
13 |
add_action( 'admin_enqueue_scripts', array($this, 'enqueue_scripts') );
|
14 |
add_action( 'admin_print_scripts', array($this, 'print_scripts') );
|
15 |
add_action( 'admin_init', array($this, 'init') );
|
@@ -157,8 +161,124 @@ class Gadsense_Admin {
|
|
157 |
return self::$instance;
|
158 |
}
|
159 |
|
160 |
-
public function
|
161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
}
|
163 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
}
|
6 |
private $nonce;
|
7 |
private static $instance = null;
|
8 |
protected $notice = null;
|
9 |
+
private $settings_page_hook = 'advanced-ads-adsense-settings-page';
|
10 |
|
11 |
private function __construct() {
|
12 |
$this->data = Gadsense_Data::get_instance();
|
13 |
+
add_action( 'advanced-ads-settings-init', array($this, 'settings_init') );
|
14 |
+
// add_action( 'advanced-ads-additional-settings-form', array($this, 'settings_init') );
|
15 |
+
add_filter('advanced-ads-setting-tabs', array($this, 'setting_tabs'));
|
16 |
+
|
17 |
add_action( 'admin_enqueue_scripts', array($this, 'enqueue_scripts') );
|
18 |
add_action( 'admin_print_scripts', array($this, 'print_scripts') );
|
19 |
add_action( 'admin_init', array($this, 'init') );
|
161 |
return self::$instance;
|
162 |
}
|
163 |
|
164 |
+
public function settings_init() {
|
165 |
+
|
166 |
+
// get settings page hook
|
167 |
+
$hook = $this->settings_page_hook;
|
168 |
+
|
169 |
+
register_setting( ADVADS_SLUG . '-adsense', ADVADS_SLUG . '-adsense', array($this, 'sanitize_settings') );
|
170 |
+
|
171 |
+
// add new section
|
172 |
+
add_settings_section(
|
173 |
+
'advanced_ads_adsense_setting_section',
|
174 |
+
__( 'AdSense', ADVADS_SLUG ),
|
175 |
+
array($this, 'render_settings_section_callback'),
|
176 |
+
$hook
|
177 |
+
);
|
178 |
+
|
179 |
+
// add setting field to disable ads
|
180 |
+
add_settings_field(
|
181 |
+
'adsense-id',
|
182 |
+
__( 'AdSense ID', ADVADS_SLUG ),
|
183 |
+
array($this, 'render_settings_adsense_id'),
|
184 |
+
$hook,
|
185 |
+
'advanced_ads_adsense_setting_section'
|
186 |
+
);
|
187 |
+
|
188 |
+
// add setting field for adsense limit
|
189 |
+
add_settings_field(
|
190 |
+
'adsense-limit',
|
191 |
+
__( 'Limit to 3 ads', ADVADS_SLUG ),
|
192 |
+
array($this, 'render_settings_adsense_limit'),
|
193 |
+
$hook,
|
194 |
+
'advanced_ads_adsense_setting_section'
|
195 |
+
);
|
196 |
+
|
197 |
+
// hook for additional settings from add-ons
|
198 |
+
do_action( 'advanced-ads-adsense-settings-init', $hook );
|
199 |
+
|
200 |
+
// require GADSENSE_BASE_PATH . 'admin/views/admin-page.php';
|
201 |
+
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* render adsense settings section
|
205 |
+
*
|
206 |
+
* @since 1.5.1
|
207 |
+
*/
|
208 |
+
public function render_settings_section_callback(){
|
209 |
+
// for whatever purpose there might come
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* render adsense id setting
|
214 |
+
*
|
215 |
+
* @since 1.5.1
|
216 |
+
*/
|
217 |
+
public function render_settings_adsense_id(){
|
218 |
+
$adsense_id = $this->data->get_adsense_id();
|
219 |
+
|
220 |
+
?><input type="text" name="<?php echo GADSENSE_OPT_NAME; ?>[adsense-id]" id="adsense-id" size="32" value="<?php echo $adsense_id; ?>" />
|
221 |
+
<p class="description"><?php _e( 'Your AdSense Publisher ID <em>(pub-xxxxxxxxxxxxxx)</em>', ADVADS_SLUG ) ?></p><?php
|
222 |
+
}
|
223 |
+
|
224 |
+
/**
|
225 |
+
* render adsense limit setting
|
226 |
+
*
|
227 |
+
* @since 1.5.1
|
228 |
+
*/
|
229 |
+
public function render_settings_adsense_limit(){
|
230 |
+
$limit_per_page = $this->data->get_limit_per_page();
|
231 |
+
|
232 |
+
?><input type="checkbox" name="<?php echo GADSENSE_OPT_NAME; ?>[limit-per-page]" value="1" <?php checked( $limit_per_page ); ?> />
|
233 |
+
<?php printf( __( 'Limit to %d AdSense ads', ADVADS_SLUG ), 3 ); ?>
|
234 |
+
<p class="description">
|
235 |
+
<?php
|
236 |
+
printf(
|
237 |
+
__( 'Currently, Google AdSense <a target="_blank" href="%s" title="Terms Of Service">TOS</a> imposes a limit of %d display ads per page. You can disable this limitation at your own risks.', ADVADS_SLUG ),
|
238 |
+
esc_url( 'https://www.google.com/adsense/terms' ), 3
|
239 |
+
); ?><br/><?php
|
240 |
+
_e( 'Notice: Advanced Ads only considers the AdSense ad type for this limit.', ADVADS_SLUG );
|
241 |
}
|
242 |
|
243 |
+
/**
|
244 |
+
* sanitize adsense settings
|
245 |
+
*
|
246 |
+
* @since 1.5.1
|
247 |
+
* @param array $options all the options
|
248 |
+
*/
|
249 |
+
public function sanitize_settings($options){
|
250 |
+
|
251 |
+
// sanitize whatever option one wants to sanitize
|
252 |
+
if(isset($options['adsense-id']) && $options['adsense-id'] != ''){
|
253 |
+
if(0 !== strpos( $options['adsense-id'], 'pub-' )){
|
254 |
+
// add settings error
|
255 |
+
add_settings_error(
|
256 |
+
'adsense-limit',
|
257 |
+
'settings_updated',
|
258 |
+
__( 'The Publisher ID has an incorrect format. (must start with "pub-")', ADVADS_SLUG ));
|
259 |
+
}
|
260 |
+
}
|
261 |
+
|
262 |
+
return $options;
|
263 |
+
}
|
264 |
+
|
265 |
+
/**
|
266 |
+
* add adsense setting tab
|
267 |
+
*
|
268 |
+
* @since 1.5.1
|
269 |
+
* @param arr $tabs existing setting tabs
|
270 |
+
* @return arr $tabs setting tabs with AdSense tab attached
|
271 |
+
*/
|
272 |
+
public function setting_tabs(array $tabs){
|
273 |
+
|
274 |
+
$tabs['adsense'] = array(
|
275 |
+
'page' => $this->settings_page_hook,
|
276 |
+
'group' => ADVADS_SLUG . '-adsense',
|
277 |
+
'tabid' => 'adsense',
|
278 |
+
'title' => __( 'AdSense', ADVADS_SLUG )
|
279 |
+
);
|
280 |
+
|
281 |
+
return $tabs;
|
282 |
+
}
|
283 |
+
|
284 |
}
|
modules/gadsense/includes/class-gadsense-data.php
CHANGED
@@ -9,23 +9,32 @@ class Gadsense_Data {
|
|
9 |
private $resizing;
|
10 |
|
11 |
private function __construct() {
|
12 |
-
$options = get_option( GADSENSE_OPT_NAME, array() );
|
13 |
-
$update = false;
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
}
|
|
|
|
|
|
|
|
|
|
|
29 |
$this->options = $options;
|
30 |
|
31 |
// Resizing method for responsive ads
|
@@ -34,30 +43,15 @@ class Gadsense_Data {
|
|
34 |
);
|
35 |
}
|
36 |
|
37 |
-
|
38 |
-
* SETTERS
|
39 |
-
*/
|
40 |
-
public function set_adsense_id($id) {
|
41 |
-
$old_id = $this->options['adsense_id'];
|
42 |
-
$this->options['adsense_id'] = $id;
|
43 |
-
update_option( GADSENSE_OPT_NAME, $this->options );
|
44 |
-
do_action( 'advanced-ads-gadsense-after-id-changed', $id, $old_id );
|
45 |
-
}
|
46 |
-
|
47 |
-
public function set_limit_per_page($value = true) {
|
48 |
-
$this->options['limit_ads_per_page'] = $value;
|
49 |
-
update_option( GADSENSE_OPT_NAME, $this->options );
|
50 |
-
}
|
51 |
-
|
52 |
-
/**
|
53 |
* GETTERS
|
54 |
*/
|
55 |
public function get_adsense_id() {
|
56 |
-
return $this->options['
|
57 |
}
|
58 |
|
59 |
public function get_limit_per_page() {
|
60 |
-
return $this->options['
|
61 |
}
|
62 |
|
63 |
public function get_responsive_sizing() {
|
9 |
private $resizing;
|
10 |
|
11 |
private function __construct() {
|
|
|
|
|
12 |
|
13 |
+
$options = get_option(GADSENSE_OPT_NAME, array());
|
14 |
+
|
15 |
+
// AdSense publisher id
|
16 |
+
if ( ! isset($options['adsense-id']) ) {
|
17 |
+
// check if there is still an old setting
|
18 |
+
// 'gadsense_options' was renamed
|
19 |
+
$old_options = get_option( 'gadsense_options', array() );
|
20 |
+
if ( isset($old_options['adsense_id']) ) {
|
21 |
+
$options['adsense-id'] = $old_options['adsense_id'];
|
22 |
+
$options['limit-per-page'] = $old_options['limit_ads_per_page'];
|
23 |
|
24 |
+
// remove old options
|
25 |
+
delete_option('gadsense_options');
|
26 |
+
} else {
|
27 |
+
$options['adsense-id'] = '';
|
28 |
+
$options['limit-per-page'] = true;
|
29 |
+
}
|
30 |
+
|
31 |
+
update_option(GADSENSE_OPT_NAME, $options);
|
32 |
}
|
33 |
+
|
34 |
+
if ( !isset($options['limit-per-page']) ) {
|
35 |
+
$options['limit-per-page'] = '';
|
36 |
+
}
|
37 |
+
|
38 |
$this->options = $options;
|
39 |
|
40 |
// Resizing method for responsive ads
|
43 |
);
|
44 |
}
|
45 |
|
46 |
+
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
* GETTERS
|
48 |
*/
|
49 |
public function get_adsense_id() {
|
50 |
+
return $this->options['adsense-id'];
|
51 |
}
|
52 |
|
53 |
public function get_limit_per_page() {
|
54 |
+
return $this->options['limit-per-page'];
|
55 |
}
|
56 |
|
57 |
public function get_responsive_sizing() {
|
modules/gadsense/main.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
if ( class_exists( 'Advanced_Ads', false ) ) {
|
4 |
define( 'GADSENSE_BASE_PATH', plugin_dir_path( __FILE__ ) );
|
5 |
define( 'GADSENSE_BASE_URL', plugins_url( basename( ADVADS_BASE_PATH ) . '/modules/' . basename( GADSENSE_BASE_PATH ) . '/' ) );
|
6 |
-
define( 'GADSENSE_OPT_NAME', '
|
7 |
|
8 |
/**
|
9 |
* initialize ad type and add it to the plugins ad types
|
3 |
if ( class_exists( 'Advanced_Ads', false ) ) {
|
4 |
define( 'GADSENSE_BASE_PATH', plugin_dir_path( __FILE__ ) );
|
5 |
define( 'GADSENSE_BASE_URL', plugins_url( basename( ADVADS_BASE_PATH ) . '/modules/' . basename( GADSENSE_BASE_PATH ) . '/' ) );
|
6 |
+
define( 'GADSENSE_OPT_NAME', ADVADS_SLUG . '-adsense' );
|
7 |
|
8 |
/**
|
9 |
* initialize ad type and add it to the plugins ad types
|
public/class-advanced-ads.php
CHANGED
@@ -25,7 +25,7 @@ class Advanced_Ads {
|
|
25 |
* @var string
|
26 |
*/
|
27 |
|
28 |
-
const VERSION = '1.5.
|
29 |
|
30 |
/**
|
31 |
* post type slug
|
@@ -114,8 +114,8 @@ class Advanced_Ads {
|
|
114 |
// only when not doing ajax
|
115 |
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
116 |
Advanced_Ads_Ajax::get_instance();
|
117 |
-
|
118 |
-
|
119 |
}
|
120 |
|
121 |
/**
|
25 |
* @var string
|
26 |
*/
|
27 |
|
28 |
+
const VERSION = '1.5.1';
|
29 |
|
30 |
/**
|
31 |
* post type slug
|
114 |
// only when not doing ajax
|
115 |
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
116 |
Advanced_Ads_Ajax::get_instance();
|
117 |
+
}
|
118 |
+
add_action( 'plugins_loaded', array( $this, 'wp_plugins_loaded' ) );
|
119 |
}
|
120 |
|
121 |
/**
|
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
|
7 |
-
Stable tag: 1.5.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -174,11 +174,21 @@ There is no revenue share. Advanced Ads doesn’t alter your ad codes in a way t
|
|
174 |
|
175 |
== Changelog ==
|
176 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
= 1.5.0 =
|
178 |
|
179 |
* major changes in the code base to support upcoming features
|
180 |
-
* PLEASE TEST and report any bugs
|
181 |
-
|
182 |
* further interface cleanup
|
183 |
* fully implemented autoloading
|
184 |
* added composer definitions
|
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
|
7 |
+
Stable tag: 1.5.1
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
174 |
|
175 |
== Changelog ==
|
176 |
|
177 |
+
= 1.5.1 =
|
178 |
+
|
179 |
+
* added tab menu für settings
|
180 |
+
* allow to set ad weights for pending, future and private ads
|
181 |
+
* improvements to groups overview based on group types
|
182 |
+
* fixed switching ad types
|
183 |
+
* fixed individual post conditions not showing up
|
184 |
+
* fixed update message being displayed for new installations
|
185 |
+
* other fixes under the hood
|
186 |
+
* new hooks: `advanced-ads-setting-tabs`, `advanced-ads-adsense-settings-init`
|
187 |
+
* removed hooks: `advanced-ads-gadsense-after-id-changed`
|
188 |
+
|
189 |
= 1.5.0 =
|
190 |
|
191 |
* major changes in the code base to support upcoming features
|
|
|
|
|
192 |
* further interface cleanup
|
193 |
* fully implemented autoloading
|
194 |
* added composer definitions
|