Version Description
- fixed wrong links on overview page
- consider the "all" option for display conditions
- moved category archive ids display condition to new layout
- extended category archive ids to all category archive pages
- prevent a display condition option to be included and excluded at the same time
- optimized layout of overview page
- fix for php prior to 5.3
Download this release
Release Info
Developer | webzunft |
Plugin | Advanced Ads |
Version | 1.2.5 |
Comparing to | |
See all releases |
Code changes from version 1.2.4 to 1.2.5
- admin/assets/css/admin.css +10 -1
- admin/assets/js/admin.js +25 -0
- admin/includes/class-display-condition-callbacks.php +80 -2
- admin/views/ad-display-metabox.php +2 -1
- admin/views/ad-group.php +1 -0
- admin/views/overview.php +95 -72
- advanced-ads.php +1 -1
- classes/ad.php +67 -51
- includes/array_ad_conditions.php +1 -0
- public/class-advanced-ads.php +2 -2
- readme.txt +12 -2
admin/assets/css/admin.css
CHANGED
@@ -1,3 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
/**
|
2 |
* AD EDIT PAGE
|
3 |
*/
|
@@ -67,4 +75,5 @@
|
|
67 |
GENERAL ELEMENTS
|
68 |
*/
|
69 |
.advads-toggle-link { cursor: pointer; }
|
70 |
-
.advads-content-half { float: left; margin-right: 5%; width: 45%; min-width: 300px; }
|
|
1 |
+
/**
|
2 |
+
* OVERVIEW PAGE
|
3 |
+
*/
|
4 |
+
|
5 |
+
.advads-content-wrapper { display: table; width: 100%; }
|
6 |
+
.advads-content-left { display: table-cell; min-width: 500px; vertical-align: top; }
|
7 |
+
.advads-content-right { display: table-cell; width: 250px; padding: 0 0 0 20px; vertical-align: top; }
|
8 |
+
|
9 |
/**
|
10 |
* AD EDIT PAGE
|
11 |
*/
|
75 |
GENERAL ELEMENTS
|
76 |
*/
|
77 |
.advads-toggle-link { cursor: pointer; }
|
78 |
+
.advads-content-half { float: left; margin-right: 5%; width: 45%; min-width: 300px; }
|
79 |
+
.advads-box { margin-bottom: 20px; padding: 10px; background: #fff; border: solid 1px; }
|
admin/assets/js/admin.js
CHANGED
@@ -51,6 +51,15 @@ jQuery(document).ready(function($) {
|
|
51 |
advads_toggle_single_display_conditions(this);
|
52 |
});
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
});
|
55 |
|
56 |
/**
|
@@ -112,4 +121,20 @@ function advads_toggle_single_display_conditions(checkbox){
|
|
112 |
} else {
|
113 |
jQuery(checkbox).parents('.advanced-ad-display-condition').find('.advads-conditions-single').removeClass('disabled').find('input').removeAttr('disabled');
|
114 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
}
|
51 |
advads_toggle_single_display_conditions(this);
|
52 |
});
|
53 |
|
54 |
+
// toggle single display condition checkboxes that have a counterpart
|
55 |
+
$('.advads-conditions-single input[type="checkbox"]').click(function(){
|
56 |
+
advads_toggle_single_display_condition_checkbox(this);
|
57 |
+
});
|
58 |
+
// toggle single display condition checkboxes that have a counterpart on load
|
59 |
+
$('.advads-conditions-single input[type="checkbox"]').each(function(){
|
60 |
+
advads_toggle_single_display_condition_checkbox(this);
|
61 |
+
});
|
62 |
+
|
63 |
});
|
64 |
|
65 |
/**
|
121 |
} else {
|
122 |
jQuery(checkbox).parents('.advanced-ad-display-condition').find('.advads-conditions-single').removeClass('disabled').find('input').removeAttr('disabled');
|
123 |
}
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* toggle display condition checkboxes
|
128 |
+
* @param {string} checkbox element
|
129 |
+
*/
|
130 |
+
function advads_toggle_single_display_condition_checkbox(checkbox){
|
131 |
+
// get the counterpart (same value, but not current element)
|
132 |
+
var counterpart = jQuery(checkbox).parents('.advads-conditions-single').find('input[type="checkbox"][value="'+ checkbox.value +'"]').not(checkbox);
|
133 |
+
// toggle counterpart
|
134 |
+
if(jQuery(checkbox).is(':checked')){
|
135 |
+
counterpart.attr('checked', false);
|
136 |
+
counterpart.attr('disabled', 'disabled');
|
137 |
+
} else {
|
138 |
+
counterpart.removeAttr('disabled');
|
139 |
+
}
|
140 |
}
|
admin/includes/class-display-condition-callbacks.php
CHANGED
@@ -27,8 +27,8 @@ class AdvAds_Display_Condition_Callbacks {
|
|
27 |
?><h4><label class="advads-conditions-all"><input type="checkbox" name="advanced_ad[conditions][posttypes][all]" value="1" <?php checked($_all, 1); ?>><?php
|
28 |
_e('Display on all public <strong>post types</strong>.', ADVADS_SLUG); ?></label></h4><?php
|
29 |
$post_types = get_post_types(array('public' => true, 'publicly_queryable' => true), 'object', 'or');
|
30 |
-
?><
|
31 |
-
<
|
32 |
// backward compatibility
|
33 |
// TODO: remove in a later version
|
34 |
$_includes = (!empty($ad->conditions['posttypes']['include']) && is_string($ad->conditions['posttypes']['include'])) ? explode(',', $ad->conditions['posttypes']['include']) : array();
|
@@ -131,4 +131,82 @@ class AdvAds_Display_Condition_Callbacks {
|
|
131 |
endforeach;
|
132 |
?></table></div><?php
|
133 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
}
|
27 |
?><h4><label class="advads-conditions-all"><input type="checkbox" name="advanced_ad[conditions][posttypes][all]" value="1" <?php checked($_all, 1); ?>><?php
|
28 |
_e('Display on all public <strong>post types</strong>.', ADVADS_SLUG); ?></label></h4><?php
|
29 |
$post_types = get_post_types(array('public' => true, 'publicly_queryable' => true), 'object', 'or');
|
30 |
+
?><div class="advads-conditions-single">
|
31 |
+
<p class="description"><?php _e('Choose the public post types on which to display the ad.', ADVADS_SLUG); ?></p><?php
|
32 |
// backward compatibility
|
33 |
// TODO: remove in a later version
|
34 |
$_includes = (!empty($ad->conditions['posttypes']['include']) && is_string($ad->conditions['posttypes']['include'])) ? explode(',', $ad->conditions['posttypes']['include']) : array();
|
131 |
endforeach;
|
132 |
?></table></div><?php
|
133 |
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* render display condition for taxonomy/term archive pages
|
137 |
+
*
|
138 |
+
* @param obj $ad ad object
|
139 |
+
* @since 1.2.5
|
140 |
+
*/
|
141 |
+
public static function category_archives($ad = false){
|
142 |
+
|
143 |
+
// set defaults
|
144 |
+
if(is_object($ad)){
|
145 |
+
$_all = (isset($ad->conditions['categoryarchiveids']['all'])) ? 1 : 0;
|
146 |
+
if(!$_all && empty($ad->conditions['categoryarchiveids']['include']) && empty($ad->conditions['categoryarchiveids']['exclude'])){
|
147 |
+
$_all = 1;
|
148 |
+
}
|
149 |
+
}
|
150 |
+
|
151 |
+
if(!empty($ad->conditions['categoryarchiveids']['include'])){
|
152 |
+
// backward compatibility
|
153 |
+
// TODO: remove in a later version; this should already be an array
|
154 |
+
if(is_string($ad->conditions['categoryarchiveids']['include'])){
|
155 |
+
$_includes = explode(',', $ad->conditions['categoryarchiveids']['include']);
|
156 |
+
} else {
|
157 |
+
$_includes = $ad->conditions['categoryarchiveids']['include'];
|
158 |
+
}
|
159 |
+
} else {
|
160 |
+
$_includes = array();
|
161 |
+
}
|
162 |
+
|
163 |
+
?><h4><label class="advads-conditions-all"><input type="checkbox" name="advanced_ad[conditions][categoryarchiveids][all]" value="1" <?php checked($_all, 1); ?>><?php
|
164 |
+
_e('Display on all <strong>category archive pages</strong>.', ADVADS_SLUG); ?></label></h4><?php
|
165 |
+
$taxonomies = get_taxonomies(array('public' => true, 'publicly_queryable' => true), 'objects', 'or');
|
166 |
+
?><p class="description"><?php _e('Choose the terms from public categories, tags and other taxonomies on which’s archive page ads can appear', ADVADS_SLUG); ?></p>
|
167 |
+
<div class="advads-conditions-single"><table><?php
|
168 |
+
foreach($taxonomies as $_tax):
|
169 |
+
if($_tax->name === 'advanced_ads_groups') continue; // exclude adv ads groups
|
170 |
+
$terms = get_terms($_tax->name, array());
|
171 |
+
if ( !empty( $terms ) && !is_wp_error( $terms ) ):
|
172 |
+
?><tr><th><?php echo $_tax->label; ?></th><?php
|
173 |
+
?><td><?php
|
174 |
+
foreach($terms as $_term) :
|
175 |
+
?><label><input type="checkbox" name="advanced_ad[conditions][categoryarchiveids][include][]" value="<?php echo $_term->term_id; ?>" <?php
|
176 |
+
checked(in_array($_term->term_id, $_includes), true); ?>><?php echo $_term->name; ?></label><?php
|
177 |
+
endforeach;
|
178 |
+
?></td></tr><?php
|
179 |
+
endif;
|
180 |
+
endforeach;
|
181 |
+
?></table><?php
|
182 |
+
|
183 |
+
if(!empty($ad->conditions['categoryarchiveids']['exclude'])){
|
184 |
+
// backward compatibility
|
185 |
+
// TODO: remove in a later version; this should already be an array
|
186 |
+
if(is_string($ad->conditions['categoryarchiveids']['exclude'])){
|
187 |
+
$_excludes = explode(',', $ad->conditions['categoryarchiveids']['exclude']);
|
188 |
+
} else {
|
189 |
+
$_excludes = $ad->conditions['categoryarchiveids']['exclude'];
|
190 |
+
}
|
191 |
+
} else {
|
192 |
+
$_excludes = array();
|
193 |
+
}
|
194 |
+
|
195 |
+
?><h5 class="header"><?php _e('Hide from here', ADVADS_SLUG); ?></h5><p class="description"><?php _e('Choose the terms from public categories, tags and other taxonomies on which’s archive pages ads are hidden.', ADVADS_SLUG); ?></p>
|
196 |
+
<table><?php
|
197 |
+
foreach($taxonomies as $_tax):
|
198 |
+
if($_tax->name === 'advanced_ads_groups') continue; // exclude adv ads groups
|
199 |
+
$terms = get_terms($_tax->name, array());
|
200 |
+
if ( !empty( $terms ) && !is_wp_error( $terms ) ):
|
201 |
+
?><tr><th><?php echo $_tax->label; ?></th><?php
|
202 |
+
?><td><?php
|
203 |
+
foreach($terms as $_term) :
|
204 |
+
?><label><input type="checkbox" name="advanced_ad[conditions][categoryarchiveids][exclude][]" value="<?php echo $_term->term_id; ?>" <?php
|
205 |
+
checked(in_array($_term->term_id, $_excludes), true); ?>><?php echo $_term->name; ?></label><?php
|
206 |
+
endforeach;
|
207 |
+
?></td></tr><?php
|
208 |
+
endif;
|
209 |
+
endforeach;
|
210 |
+
?></table></div><?php
|
211 |
+
}
|
212 |
}
|
admin/views/ad-display-metabox.php
CHANGED
@@ -24,7 +24,8 @@ require_once(ADVADS_BASE_PATH . 'admin/includes/class-display-condition-callback
|
|
24 |
if(!isset($_condition['callback'])) continue;
|
25 |
?><div class="advanced-ad-display-condition">
|
26 |
<?php if(is_array($_condition['callback']) && method_exists($_condition['callback'][0], $_condition['callback'][1])) {
|
27 |
-
$_condition['callback'][0]
|
|
|
28 |
}
|
29 |
?></div><?php
|
30 |
endforeach;
|
24 |
if(!isset($_condition['callback'])) continue;
|
25 |
?><div class="advanced-ad-display-condition">
|
26 |
<?php if(is_array($_condition['callback']) && method_exists($_condition['callback'][0], $_condition['callback'][1])) {
|
27 |
+
call_user_func(array($_condition['callback'][0], $_condition['callback'][1]), $ad); // works also in php below 5.3
|
28 |
+
// $_condition['callback'][0]::$_condition['callback'][1]($ad); // works only in php 5.3 and above
|
29 |
}
|
30 |
?></div><?php
|
31 |
endforeach;
|
admin/views/ad-group.php
CHANGED
@@ -58,6 +58,7 @@ if (isset($_REQUEST['message']) && ( $msg = (int) $_REQUEST['message'] ) || isse
|
|
58 |
}
|
59 |
?>
|
60 |
</h2>
|
|
|
61 |
<?php if ($message) : ?>
|
62 |
<div id="message" class="updated"><p><?php echo $message; ?></p></div>
|
63 |
<?php
|
58 |
}
|
59 |
?>
|
60 |
</h2>
|
61 |
+
<p><?php _e('Ad Groups are a very flexible method to bundle ads. You can use them to display random ads in the frontend or run split tests, but also just for informational purposes. Not only can an Ad Groups have multiple ads, but an ad can belong to multiple ad groups.', ADVADS_SLUG); ?></p>
|
62 |
<?php if ($message) : ?>
|
63 |
<div id="message" class="updated"><p><?php echo $message; ?></p></div>
|
64 |
<?php
|
admin/views/overview.php
CHANGED
@@ -5,77 +5,100 @@
|
|
5 |
?><div class="wrap">
|
6 |
<?php screen_icon(); ?>
|
7 |
<h1><?php echo esc_html(get_admin_page_title()); ?></h1>
|
8 |
-
<div class="advads-content-
|
9 |
-
<
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
</div>
|
18 |
-
<div class="advads-content-half">
|
19 |
-
<?php if(count($recent_ads) > 0) : ?>
|
20 |
-
<h4><?php _e('recent ads', ADVADS_SLUG); ?></h4>
|
21 |
-
<ul>
|
22 |
-
<?php foreach($recent_ads as $_index => $_ad) : ?>
|
23 |
-
<li><a href="<?php echo get_edit_post_link($_ad->ID); ?>"><?php echo $_ad->post_title; ?></a></li><?php
|
24 |
-
if($_index == 2) break;
|
25 |
-
?>
|
26 |
-
<?php endforeach; ?>
|
27 |
-
</ul>
|
28 |
-
<?php endif; ?>
|
29 |
-
</div>
|
30 |
-
<br class="clear"/>
|
31 |
-
<div class="advads-content-half">
|
32 |
-
<h2><?php _e('Groups', ADVADS_SLUG); ?></h2>
|
33 |
-
<p class="description"><?php _e('Ad Groups contain ads and are currently used to rotate multiple ads on a single spot.', ADVADS_SLUG); ?></p>
|
34 |
-
<p><?php printf(__('You have %d groups.', ADVADS_SLUG), count($groups)); ?> <?php
|
35 |
-
printf(__('<a href="%s">Manage</a> them.', ADVADS_SLUG),
|
36 |
-
'edit.php?post_type='. Advanced_Ads::POST_TYPE_SLUG .'&page=advanced-ads-groups');
|
37 |
-
?></p>
|
38 |
-
</div>
|
39 |
-
<div class="advads-content-half">
|
40 |
-
<?php if(count($groups) > 0) : ?>
|
41 |
-
<h4><?php _e('recent groups', ADVADS_SLUG); ?></h4>
|
42 |
-
<ul>
|
43 |
-
<?php foreach($groups as $_index => $_group) : ?>
|
44 |
-
<li><?php echo $_group->name; ?></li><?php
|
45 |
-
if($_index == 2) break;
|
46 |
-
?>
|
47 |
-
<?php endforeach; ?>
|
48 |
-
</ul>
|
49 |
-
<?php endif; ?>
|
50 |
-
</div>
|
51 |
-
<br class="clear"/>
|
52 |
-
<div class="advads-content-half">
|
53 |
-
<h2><?php _e('Placements', ADVADS_SLUG); ?></h2>
|
54 |
-
<p class="description"><?php _e('Ad Placements are the best way to manage where to display ads and groups.', ADVADS_SLUG); ?></p>
|
55 |
-
<p><?php printf(__('You have %d placements.', ADVADS_SLUG), count($placements)); ?> <?php
|
56 |
-
printf(__('<a href="%s">Manage</a> them.', ADVADS_SLUG),
|
57 |
-
'edit.php?post_type='. Advanced_Ads::POST_TYPE_SLUG .'&page=advanced-ads-placements');
|
58 |
-
?></p>
|
59 |
-
</div>
|
60 |
-
<div class="advads-content-half">
|
61 |
-
<?php if(count($placements) > 0) : ?>
|
62 |
-
<h4><?php _e('recent placements', ADVADS_SLUG); ?></h4>
|
63 |
-
<ul>
|
64 |
-
<?php $_i = 0; foreach($placements as $_index => $_placement) : ?>
|
65 |
-
<li><?php echo $_placement['name']; ?></li><?php
|
66 |
-
if($_i++ == 2) break;
|
67 |
-
?>
|
68 |
-
<?php endforeach; ?>
|
69 |
-
</ul>
|
70 |
-
<?php endif; ?>
|
71 |
-
</div>
|
72 |
-
<br class="clear"/>
|
73 |
-
<h2><?php _e('Manual and Support', ADVADS_SLUG); ?></h2>
|
74 |
-
<p><?php _e('Need some help? These are your options', ADVADS_SLUG); ?></p>
|
75 |
-
<ul>
|
76 |
-
<li><?php printf(__('Visit the <a href="%s">plugin homepage</a>', ADVADS_SLUG), 'http://wpadvancedads.com/advancedads/'); ?></li>
|
77 |
-
<li><?php printf(__('Have a look into the <a href="%s">manual</a>', ADVADS_SLUG), 'http://wpadvancedads.com/advancedads/manual/'); ?></li>
|
78 |
-
<li><?php printf(__('Ask a question to other users in the <a href="%s">wordpress.org forum</a>', ADVADS_SLUG), 'http://wordpress.org/plugins/advanced-ads/'); ?></li>
|
79 |
-
<li><?php printf(__('<a href="%s">Hire the developer</a>', ADVADS_SLUG), 'http://webgilde.com/en/contact/'); ?></li>
|
80 |
-
</ul>
|
81 |
</div>
|
5 |
?><div class="wrap">
|
6 |
<?php screen_icon(); ?>
|
7 |
<h1><?php echo esc_html(get_admin_page_title()); ?></h1>
|
8 |
+
<div class="advads-content-wrapper">
|
9 |
+
<div class="advads-content-left">
|
10 |
+
<div class="advads-box">
|
11 |
+
<div class="advads-content-half">
|
12 |
+
<h2><?php _e('Ads', ADVADS_SLUG); ?></h2>
|
13 |
+
<p class="description"><?php _e('Ads are the smallest unit, containing the content or a single ad to be displayed.', ADVADS_SLUG); ?></p>
|
14 |
+
<p><?php printf(__('You have published %d ads.', ADVADS_SLUG), count($recent_ads));?> <?php
|
15 |
+
printf(__('<a href="%s">Manage</a> them or <a href="%s">create</a> a new one', ADVADS_SLUG),
|
16 |
+
'edit.php?post_type='. Advanced_Ads::POST_TYPE_SLUG,
|
17 |
+
'post-new.php?post_type='. Advanced_Ads::POST_TYPE_SLUG);
|
18 |
+
?>
|
19 |
+
</p>
|
20 |
+
</div>
|
21 |
+
<div class="advads-content-half">
|
22 |
+
<?php if(count($recent_ads) > 0) : ?>
|
23 |
+
<h4><?php _e('recent ads', ADVADS_SLUG); ?></h4>
|
24 |
+
<ul>
|
25 |
+
<?php foreach($recent_ads as $_index => $_ad) : ?>
|
26 |
+
<li><a href="<?php echo get_edit_post_link($_ad->ID); ?>"><?php echo $_ad->post_title; ?></a></li><?php
|
27 |
+
if($_index == 2) break;
|
28 |
+
?>
|
29 |
+
<?php endforeach; ?>
|
30 |
+
</ul>
|
31 |
+
<?php endif; ?>
|
32 |
+
</div>
|
33 |
+
<br class="clear"/>
|
34 |
+
</div>
|
35 |
+
<div class="advads-box">
|
36 |
+
<div class="advads-content-half">
|
37 |
+
<h2><?php _e('Groups', ADVADS_SLUG); ?></h2>
|
38 |
+
<p class="description"><?php _e('Ad Groups contain ads and are currently used to rotate multiple ads on a single spot.', ADVADS_SLUG); ?></p>
|
39 |
+
<p><?php printf(__('You have %d groups.', ADVADS_SLUG), count($groups)); ?> <?php
|
40 |
+
printf(__('<a href="%s">Manage</a> them.', ADVADS_SLUG),
|
41 |
+
'admin.php?page=advanced-ads-groups');
|
42 |
+
?></p>
|
43 |
+
</div>
|
44 |
+
<div class="advads-content-half">
|
45 |
+
<?php if(count($groups) > 0) : ?>
|
46 |
+
<h4><?php _e('recent groups', ADVADS_SLUG); ?></h4>
|
47 |
+
<ul>
|
48 |
+
<?php foreach($groups as $_index => $_group) : ?>
|
49 |
+
<li><?php echo $_group->name; ?></li><?php
|
50 |
+
if($_index == 2) break;
|
51 |
+
?>
|
52 |
+
<?php endforeach; ?>
|
53 |
+
</ul>
|
54 |
+
<?php endif; ?>
|
55 |
+
</div>
|
56 |
+
<br class="clear"/>
|
57 |
+
</div>
|
58 |
+
<div class="advads-box">
|
59 |
+
<div class="advads-content-half">
|
60 |
+
<h2><?php _e('Placements', ADVADS_SLUG); ?></h2>
|
61 |
+
<p class="description"><?php _e('Ad Placements are the best way to manage where to display ads and groups.', ADVADS_SLUG); ?></p>
|
62 |
+
<p><?php printf(__('You have %d placements.', ADVADS_SLUG), count($placements)); ?> <?php
|
63 |
+
printf(__('<a href="%s">Manage</a> them.', ADVADS_SLUG),
|
64 |
+
'admin.php?page=advanced-ads-placements');
|
65 |
+
?></p>
|
66 |
+
</div>
|
67 |
+
<div class="advads-content-half">
|
68 |
+
<?php if(count($placements) > 0) : ?>
|
69 |
+
<h4><?php _e('recent placements', ADVADS_SLUG); ?></h4>
|
70 |
+
<ul>
|
71 |
+
<?php $_i = 0; foreach($placements as $_index => $_placement) : ?>
|
72 |
+
<li><?php echo $_placement['name']; ?></li><?php
|
73 |
+
if($_i++ == 2) break;
|
74 |
+
?>
|
75 |
+
<?php endforeach; ?>
|
76 |
+
</ul>
|
77 |
+
<?php endif; ?>
|
78 |
+
</div>
|
79 |
+
<br class="clear"/>
|
80 |
+
</div>
|
81 |
+
</div>
|
82 |
+
<div class="advads-content-right">
|
83 |
+
<div class="advads-box">
|
84 |
+
<h3><?php _e('Manual and Support', ADVADS_SLUG); ?></h3>
|
85 |
+
<p><?php _e('Need some help? These are your options', ADVADS_SLUG); ?></p>
|
86 |
+
<ul>
|
87 |
+
<li><?php printf(__('Visit the <a href="%s">plugin homepage</a>', ADVADS_SLUG), 'http://wpadvancedads.com/advancedads/'); ?></li>
|
88 |
+
<li><?php printf(__('Have a look into the <a href="%s">manual</a>', ADVADS_SLUG), 'http://wpadvancedads.com/advancedads/manual/'); ?></li>
|
89 |
+
<li><?php printf(__('Ask a question to other users in the <a href="%s">wordpress.org forum</a>', ADVADS_SLUG), 'http://wordpress.org/plugins/advanced-ads/'); ?></li>
|
90 |
+
<li><?php printf(__('<a href="%s">Hire the developer</a>', ADVADS_SLUG), 'http://webgilde.com/en/contact/'); ?></li>
|
91 |
+
</ul>
|
92 |
+
</div>
|
93 |
+
<div class="advads-box">
|
94 |
+
<h3><?php _e('Add-ons', ADVADS_SLUG); ?></h3>
|
95 |
+
<p><?php _e('Want to boost your ad income? Try these add-ons', ADVADS_SLUG); ?></p>
|
96 |
+
<ul>
|
97 |
+
<li><a href="http://wpadvancedads.com/responsive-ads/?utm_campaign=advads&utm_medium=plugin&utm_source=overview" target="_blank">Responsive Ads</a></li>
|
98 |
+
<li><a href="http://wpadvancedads.com/layer-ads/?utm_campaign=advads&utm_medium=plugin&utm_source=overview" target="_blank">PopUp and Layer Ads</a></li>
|
99 |
+
<li><a href="http://wpadvancedads.com/sticky-ads/?utm_campaign=advads&utm_medium=plugin&utm_source=overview" target="_blank">Sticky Ads</a></li>
|
100 |
+
</ul>
|
101 |
+
</div>
|
102 |
+
</div>
|
103 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
</div>
|
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.2.
|
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.2.5
|
16 |
* Author: Thomas Maier
|
17 |
* Author URI: http://webgilde.com
|
18 |
* Text Domain: advanced-ads
|
classes/ad.php
CHANGED
@@ -253,7 +253,9 @@ class Advads_Ad {
|
|
253 |
* @return bool $can_display true if can be displayed in frontend
|
254 |
*/
|
255 |
public function can_display_by_conditions(){
|
256 |
-
global $post;
|
|
|
|
|
257 |
|
258 |
if(empty($this->options['conditions']) ||
|
259 |
!is_array($this->options['conditions'])) return true;
|
@@ -286,70 +288,84 @@ class Advads_Ad {
|
|
286 |
// check for category ids
|
287 |
case 'categoryids' :
|
288 |
// included
|
289 |
-
if(
|
290 |
-
if(
|
291 |
-
|
292 |
-
|
293 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
}
|
295 |
-
// check
|
296 |
-
if(
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
// check if currently in a post (not post page, but also posts in loops)
|
309 |
-
if(is_array($category_ids) && isset($post->ID)
|
310 |
-
&& in_category($category_ids, $post) ) {
|
311 |
-
// being only in one excluded category is enough to not display the ad
|
312 |
-
return false;
|
313 |
}
|
314 |
}
|
315 |
break;
|
316 |
// check for included category archive ids
|
317 |
// @link http://codex.wordpress.org/Conditional_Tags#A_Category_Page
|
318 |
case 'categoryarchiveids' :
|
319 |
-
if(
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
329 |
}
|
330 |
break;
|
331 |
// check for included post types
|
332 |
case 'posttypes' :
|
333 |
// display everywhere, if include not set (= all is checked)
|
334 |
// TODO remove condition check for string; deprecated since 1.2.2
|
335 |
-
if(
|
336 |
-
if(
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
|
|
|
|
344 |
}
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
}
|
354 |
}
|
355 |
break;
|
253 |
* @return bool $can_display true if can be displayed in frontend
|
254 |
*/
|
255 |
public function can_display_by_conditions(){
|
256 |
+
global $post, $wp_query;
|
257 |
+
|
258 |
+
$query = $wp_query->get_queried_object();
|
259 |
|
260 |
if(empty($this->options['conditions']) ||
|
261 |
!is_array($this->options['conditions'])) return true;
|
288 |
// check for category ids
|
289 |
case 'categoryids' :
|
290 |
// included
|
291 |
+
if(is_archive() && empty($_cond_value['all'])){
|
292 |
+
if(!empty($_cond_value['include'])){
|
293 |
+
if(is_string($_cond_value['include'])){
|
294 |
+
$category_ids = explode(',', $_cond_value['include']);
|
295 |
+
} else {
|
296 |
+
$category_ids = $_cond_value['include'];
|
297 |
+
}
|
298 |
+
// check if currently in a post (not post page, but also posts in loops)
|
299 |
+
if(is_array($category_ids) && isset($post->ID)
|
300 |
+
&& !in_category($category_ids, $post)) {
|
301 |
+
return false;
|
302 |
+
}
|
303 |
}
|
304 |
+
// check for excluded category ids
|
305 |
+
if(!empty($_cond_value['exclude'])){
|
306 |
+
if(is_string($_cond_value['exclude'])){
|
307 |
+
$category_ids = explode(',', $_cond_value['exclude']);
|
308 |
+
} else {
|
309 |
+
$category_ids = $_cond_value['exclude'];
|
310 |
+
}
|
311 |
+
// check if currently in a post (not post page, but also posts in loops)
|
312 |
+
if(is_array($category_ids) && isset($post->ID)
|
313 |
+
&& in_category($category_ids, $post) ) {
|
314 |
+
// being only in one excluded category is enough to not display the ad
|
315 |
+
return false;
|
316 |
+
}
|
|
|
|
|
|
|
|
|
|
|
317 |
}
|
318 |
}
|
319 |
break;
|
320 |
// check for included category archive ids
|
321 |
// @link http://codex.wordpress.org/Conditional_Tags#A_Category_Page
|
322 |
case 'categoryarchiveids' :
|
323 |
+
if(isset($query->term_id) && empty($_cond_value['all'])){
|
324 |
+
if(!empty($_cond_value['include'])){
|
325 |
+
if(is_string($_cond_value['include'])){
|
326 |
+
$category_ids = explode(',', $_cond_value['include']);
|
327 |
+
} else {
|
328 |
+
$category_ids = $_cond_value['include'];
|
329 |
+
}
|
330 |
+
if(is_array($category_ids) && !in_array($query->term_id, $category_ids))
|
331 |
+
return false;
|
332 |
+
}
|
333 |
+
// check for excluded category archive ids
|
334 |
+
if(!empty($_cond_value['exclude'])){
|
335 |
+
if(is_string($_cond_value['exclude'])){
|
336 |
+
$category_ids = explode(',', $_cond_value['exclude']);
|
337 |
+
} else {
|
338 |
+
$category_ids = $_cond_value['exclude'];
|
339 |
+
}
|
340 |
+
if(is_array($category_ids) && in_array($query->term_id, $category_ids))
|
341 |
+
return false;
|
342 |
+
}
|
343 |
}
|
344 |
break;
|
345 |
// check for included post types
|
346 |
case 'posttypes' :
|
347 |
// display everywhere, if include not set (= all is checked)
|
348 |
// TODO remove condition check for string; deprecated since 1.2.2
|
349 |
+
if(empty($_cond_value['all'])){
|
350 |
+
if(!empty($_cond_value['include'])){
|
351 |
+
if(is_string($_cond_value['include'])){
|
352 |
+
$post_types = explode(',', $_cond_value['include']);
|
353 |
+
} else {
|
354 |
+
$post_types = $_cond_value['include'];
|
355 |
+
}
|
356 |
+
// check if currently in a post (not post page, but also posts in loops)
|
357 |
+
if(is_array($post_types) && !in_array(get_post_type(), $post_types)) {
|
358 |
+
return false;
|
359 |
+
}
|
360 |
}
|
361 |
+
// check for excluded post types
|
362 |
+
// TODO remove in a later version, deprecated since 1.2.2
|
363 |
+
if(!empty($_cond_value['exclude'])){
|
364 |
+
$post_types = explode(',', $_cond_value['exclude']);
|
365 |
+
// check if currently in a post (not post page, but also posts in loops)
|
366 |
+
if(is_array($post_types) && in_array(get_post_type(), $post_types)) {
|
367 |
+
return false;
|
368 |
+
}
|
369 |
}
|
370 |
}
|
371 |
break;
|
includes/array_ad_conditions.php
CHANGED
@@ -43,6 +43,7 @@ $advanced_ads_ad_conditions = array(
|
|
43 |
'label' => __('Category Archives', $advanced_ads_slug),
|
44 |
'description' => __('comma seperated IDs of category archives', $advanced_ads_slug),
|
45 |
'type' => 'idfield',
|
|
|
46 |
),
|
47 |
'is_front_page' => array(
|
48 |
'label' => __('Home Page', $advanced_ads_slug),
|
43 |
'label' => __('Category Archives', $advanced_ads_slug),
|
44 |
'description' => __('comma seperated IDs of category archives', $advanced_ads_slug),
|
45 |
'type' => 'idfield',
|
46 |
+
'callback' => array('AdvAds_Display_Condition_Callbacks', 'category_archives')
|
47 |
),
|
48 |
'is_front_page' => array(
|
49 |
'label' => __('Home Page', $advanced_ads_slug),
|
public/class-advanced-ads.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* @author Thomas Maier <thomas.maier@webgilde.com>
|
8 |
* @license GPL-2.0+
|
9 |
* @link http://webgilde.com
|
10 |
-
* @copyright 2013 Thomas Maier, webgilde GmbH
|
11 |
*/
|
12 |
|
13 |
/**
|
@@ -25,7 +25,7 @@ class Advanced_Ads {
|
|
25 |
* @var string
|
26 |
*/
|
27 |
|
28 |
-
const VERSION = '1.2.
|
29 |
|
30 |
/**
|
31 |
* post type slug
|
7 |
* @author Thomas Maier <thomas.maier@webgilde.com>
|
8 |
* @license GPL-2.0+
|
9 |
* @link http://webgilde.com
|
10 |
+
* @copyright 2013-2014 Thomas Maier, webgilde GmbH
|
11 |
*/
|
12 |
|
13 |
/**
|
25 |
* @var string
|
26 |
*/
|
27 |
|
28 |
+
const VERSION = '1.2.5';
|
29 |
|
30 |
/**
|
31 |
* post type slug
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: webzunft
|
3 |
Donate link:https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5RRRCEBGN3UT2
|
4 |
Tags: ads, ad, adsense, display, banner, advertisements, adverts, advert, monetization
|
5 |
-
Requires at least: 3.5
|
6 |
Tested up to: 4.0.0
|
7 |
-
Stable tag: 1.2.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -134,6 +134,16 @@ There is no revenue share. Advanced Ads doesn’t alter your ad codes in a way t
|
|
134 |
|
135 |
== Changelog ==
|
136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
= 1.2.4 =
|
138 |
|
139 |
* fixed wrong links for ad groups and debug page
|
2 |
Contributors: webzunft
|
3 |
Donate link:https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5RRRCEBGN3UT2
|
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.0.0
|
7 |
+
Stable tag: 1.2.5
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
134 |
|
135 |
== Changelog ==
|
136 |
|
137 |
+
= 1.2.5 =
|
138 |
+
|
139 |
+
* fixed wrong links on overview page
|
140 |
+
* consider the "all" option for display conditions
|
141 |
+
* moved category archive ids display condition to new layout
|
142 |
+
* extended category archive ids to all category archive pages
|
143 |
+
* prevent a display condition option to be included and excluded at the same time
|
144 |
+
* optimized layout of overview page
|
145 |
+
* fix for php prior to 5.3
|
146 |
+
|
147 |
= 1.2.4 =
|
148 |
|
149 |
* fixed wrong links for ad groups and debug page
|