Version Description
- removed wrapper for header injection placement
- removed deprecated code used for ad based content injections
- ordered ads by title in ads list
- removed broken pagination from ad groups list. now, all ad groups are displayed
- order ad groups by name when no other order is specified
- fixed search for ad groups in ad groups list
- PHP is not automatically allowed for new plain text ad codes anymore
- add an internal description and notes to your ads
Download this release
Release Info
Developer | webzunft |
Plugin | Advanced Ads |
Version | 1.3.18 |
Comparing to | |
See all releases |
Code changes from version 1.3.17 to 1.3.18
- admin/assets/css/admin.css +2 -0
- admin/assets/js/admin.js +23 -21
- admin/class-advanced-ads-admin.php +31 -65
- admin/includes/class-ad-groups-list-table.php +1 -9
- admin/views/ad-group.php +0 -1
- admin/views/ad-inject-metabox.php +0 -33
- admin/views/ad_info.php +11 -1
- advanced-ads.php +1 -1
- classes/ad.php +2 -0
- classes/ad_placements.php +8 -3
- classes/ad_type_plain.php +28 -9
- public/class-advanced-ads.php +0 -90
- readme.txt +14 -2
admin/assets/css/admin.css
CHANGED
@@ -31,6 +31,8 @@
|
|
31 |
margin: 0;
|
32 |
padding: 10px 10px 5px;
|
33 |
}
|
|
|
|
|
34 |
#advanced-ad-type .description {
|
35 |
display: block;
|
36 |
margin-left: 24px;
|
31 |
margin: 0;
|
32 |
padding: 10px 10px 5px;
|
33 |
}
|
34 |
+
.post-type-advanced_ads #advads-ad-description p { font-style: italic; }
|
35 |
+
.post-type-advanced_ads #advads-ad-description textarea { display: none; width: 100%; height: 10em; }
|
36 |
#advanced-ad-type .description {
|
37 |
display: block;
|
38 |
margin-left: 24px;
|
admin/assets/js/admin.js
CHANGED
@@ -68,27 +68,29 @@ jQuery(document).ready(function ($) {
|
|
68 |
});
|
69 |
// register autocomplete to display condition posts
|
70 |
var response = [];
|
71 |
-
$("#advads-display-conditions-individual-post").
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
|
|
|
|
92 |
|
93 |
// remove individual posts from the display conditions post list
|
94 |
$(document).on('click', '.advads-conditions-postids-list .remove', function(e){
|
68 |
});
|
69 |
// register autocomplete to display condition posts
|
70 |
var response = [];
|
71 |
+
if($("#advads-display-conditions-individual-post").length){
|
72 |
+
$("#advads-display-conditions-individual-post").autocomplete({
|
73 |
+
source: function(request, callback){
|
74 |
+
var searchParam = request.term;
|
75 |
+
advads_post_search(searchParam, callback);
|
76 |
+
},
|
77 |
+
minLength: 2,
|
78 |
+
select: function( event, ui ) {
|
79 |
+
// append new line with input fields
|
80 |
+
var newline = $('<li></li>');
|
81 |
+
$('<a class="remove" href="#">remove</a>').appendTo(newline);
|
82 |
+
$('<span>' + ui.item.label + '</span><input type="hidden" name="advanced_ad[conditions][postids][ids][]" value="'+ ui.item.value +'">').appendTo(newline);
|
83 |
+
newline.insertBefore('.advads-conditions-postids-list .show-search');
|
84 |
+
|
85 |
+
// show / hide other elements
|
86 |
+
$('#advads-display-conditions-individual-post').hide();
|
87 |
+
$('.advads-conditions-postids-list .show-search a').show();
|
88 |
+
},
|
89 |
+
close: function( event, ui ) {
|
90 |
+
$('#advads-display-conditions-individual-post').val('');
|
91 |
+
}
|
92 |
+
});
|
93 |
+
};
|
94 |
|
95 |
// remove individual posts from the display conditions post list
|
96 |
$(document).on('click', '.advads-conditions-postids-list .remove', function(e){
|
admin/class-advanced-ads-admin.php
CHANGED
@@ -91,9 +91,10 @@ class Advanced_Ads_Admin {
|
|
91 |
// save ads post type
|
92 |
add_action('save_post', array($this, 'save_ad'));
|
93 |
|
94 |
-
// handling
|
95 |
-
add_filter('
|
96 |
-
add_filter('
|
|
|
97 |
|
98 |
// settings handling
|
99 |
add_action('admin_init', array($this, 'settings_init'));
|
@@ -176,24 +177,7 @@ class Advanced_Ads_Admin {
|
|
176 |
*/
|
177 |
public function admin_notices()
|
178 |
{
|
179 |
-
|
180 |
-
// display notice in case there are still old ad injections
|
181 |
-
$old_injections = get_option('advads-ads-injections', array());
|
182 |
-
|
183 |
-
// display ad before the content
|
184 |
-
if(isset($old_injections) && count($old_injections) > 0){
|
185 |
-
$_injection_ids = array();
|
186 |
-
foreach($old_injections as $_inj){
|
187 |
-
$_injection_ids = array_merge($_injection_ids, $_inj);
|
188 |
-
}
|
189 |
-
$ad_links = array();
|
190 |
-
foreach($_injection_ids as $_inj_id){
|
191 |
-
$ad_links[] = '<a href="' . get_edit_post_link($_inj_id) . '">'.$_inj_id.'</a>';
|
192 |
-
}
|
193 |
-
?>
|
194 |
-
<div class="error"><p><?php printf(__('Advanced Ads Update: Auto injections are now managed through placements. Please convert these ads with auto injections: %s', ADVADS_SLUG), implode(', ', $ad_links));?></p></div>
|
195 |
-
<?php
|
196 |
-
}
|
197 |
}
|
198 |
|
199 |
/**
|
@@ -415,6 +399,8 @@ class Advanced_Ads_Admin {
|
|
415 |
if (!isset($post->post_type) || $post->post_type != $this->post_type) {
|
416 |
return;
|
417 |
}
|
|
|
|
|
418 |
require_once('views/ad_info.php');
|
419 |
}
|
420 |
|
@@ -439,9 +425,6 @@ class Advanced_Ads_Admin {
|
|
439 |
add_meta_box(
|
440 |
'ad-visitor-box', __('Visitor Conditions', ADVADS_SLUG), array($this, 'markup_meta_boxes'), Advanced_Ads::POST_TYPE_SLUG, 'normal', 'high'
|
441 |
);
|
442 |
-
add_meta_box(
|
443 |
-
'ad-inject-box', __('Auto injection', ADVADS_SLUG), array($this, 'markup_meta_boxes'), Advanced_Ads::POST_TYPE_SLUG, 'normal', 'high'
|
444 |
-
);
|
445 |
}
|
446 |
|
447 |
/**
|
@@ -494,9 +477,6 @@ class Advanced_Ads_Admin {
|
|
494 |
case 'ad-visitor-box':
|
495 |
$view = 'ad-visitor-metabox.php';
|
496 |
break;
|
497 |
-
case 'ad-inject-box':
|
498 |
-
$view = 'ad-inject-metabox.php';
|
499 |
-
break;
|
500 |
}
|
501 |
|
502 |
if (empty($view))
|
@@ -541,11 +521,6 @@ class Advanced_Ads_Admin {
|
|
541 |
} else {
|
542 |
$ad->set_option('visitor', array());
|
543 |
}
|
544 |
-
if(isset($_POST['advanced_ad']['injection'])) {
|
545 |
-
$ad->set_option('injection', $_POST['advanced_ad']['injection']);
|
546 |
-
} else {
|
547 |
-
$ad->set_option('injection', array());
|
548 |
-
}
|
549 |
// save size
|
550 |
$ad->width = 0;
|
551 |
if(isset($_POST['advanced_ad']['width'])) {
|
@@ -556,9 +531,14 @@ class Advanced_Ads_Admin {
|
|
556 |
$ad->height = absint($_POST['advanced_ad']['height']);
|
557 |
}
|
558 |
|
|
|
|
|
|
|
|
|
559 |
if(!empty($_POST['advanced_ad']['content']))
|
560 |
$ad->content = $_POST['advanced_ad']['content'];
|
561 |
else $ad->content = '';
|
|
|
562 |
if(!empty($_POST['advanced_ad']['conditions'])){
|
563 |
$ad->conditions = $_POST['advanced_ad']['conditions'];
|
564 |
} else {
|
@@ -575,9 +555,6 @@ class Advanced_Ads_Admin {
|
|
575 |
}
|
576 |
|
577 |
$ad->save();
|
578 |
-
|
579 |
-
// update global ad information
|
580 |
-
$this->update_global_injection_array();
|
581 |
}
|
582 |
|
583 |
/**
|
@@ -708,36 +685,6 @@ class Advanced_Ads_Admin {
|
|
708 |
echo '<p class="description">'. sprintf(__('Only enable this if you can and want to use the advanced JavaScript functions described <a href="%s">here</a>.', ADVADS_SLUG), 'http://wpadvancedads.com/javascript-functions/') .'</p>';
|
709 |
}
|
710 |
|
711 |
-
/**
|
712 |
-
* save a global array with ad injection information
|
713 |
-
* runs every time for all ads a single ad is saved (but not on autosave)
|
714 |
-
*
|
715 |
-
* @since 1.1.0
|
716 |
-
*/
|
717 |
-
public function update_global_injection_array(){
|
718 |
-
// get all public ads
|
719 |
-
$ad_posts = Advanced_Ads::get_ads();
|
720 |
-
|
721 |
-
// merge ad injection settings by type (place => ad id)
|
722 |
-
$all_injections = array();
|
723 |
-
if(is_array($ad_posts)) foreach($ad_posts as $_ad){
|
724 |
-
// load the ad
|
725 |
-
$ad = new Advads_Ad($_ad->ID);
|
726 |
-
// get injection post meta
|
727 |
-
$injection_options = $ad->options('injection');
|
728 |
-
// add injection settings to global array
|
729 |
-
if(isset($injection_options)) foreach($injection_options as $_iokey => $_io){
|
730 |
-
$all_injections[$_iokey][] = $_ad->ID;
|
731 |
-
}
|
732 |
-
}
|
733 |
-
|
734 |
-
// save global injection array to WP options table or remove it
|
735 |
-
if(is_array($all_injections) && count($all_injections) > 0)
|
736 |
-
update_option('advads-ads-injections', $all_injections);
|
737 |
-
else
|
738 |
-
delete_option ('advads-ads-injections');
|
739 |
-
}
|
740 |
-
|
741 |
/**
|
742 |
* add heading for extra column of ads list
|
743 |
* remove the date column
|
@@ -762,6 +709,25 @@ class Advanced_Ads_Admin {
|
|
762 |
return $defaults;
|
763 |
}
|
764 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
765 |
/**
|
766 |
* display ad details in ads list
|
767 |
*
|
91 |
// save ads post type
|
92 |
add_action('save_post', array($this, 'save_ad'));
|
93 |
|
94 |
+
// handling (ad) lists
|
95 |
+
add_filter('request', array($this, 'ad_list_request')); // order ads by title, not ID
|
96 |
+
add_filter('manage_advanced_ads_posts_columns', array($this, 'ad_list_columns_head')); // extra column
|
97 |
+
add_filter('manage_advanced_ads_posts_custom_column', array($this, 'ad_list_columns_content'), 10, 2); // extra column
|
98 |
|
99 |
// settings handling
|
100 |
add_action('admin_init', array($this, 'settings_init'));
|
177 |
*/
|
178 |
public function admin_notices()
|
179 |
{
|
180 |
+
// removed ad injection notice in version 1.3.18
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
}
|
182 |
|
183 |
/**
|
399 |
if (!isset($post->post_type) || $post->post_type != $this->post_type) {
|
400 |
return;
|
401 |
}
|
402 |
+
$ad = new Advads_Ad($post->ID);
|
403 |
+
|
404 |
require_once('views/ad_info.php');
|
405 |
}
|
406 |
|
425 |
add_meta_box(
|
426 |
'ad-visitor-box', __('Visitor Conditions', ADVADS_SLUG), array($this, 'markup_meta_boxes'), Advanced_Ads::POST_TYPE_SLUG, 'normal', 'high'
|
427 |
);
|
|
|
|
|
|
|
428 |
}
|
429 |
|
430 |
/**
|
477 |
case 'ad-visitor-box':
|
478 |
$view = 'ad-visitor-metabox.php';
|
479 |
break;
|
|
|
|
|
|
|
480 |
}
|
481 |
|
482 |
if (empty($view))
|
521 |
} else {
|
522 |
$ad->set_option('visitor', array());
|
523 |
}
|
|
|
|
|
|
|
|
|
|
|
524 |
// save size
|
525 |
$ad->width = 0;
|
526 |
if(isset($_POST['advanced_ad']['width'])) {
|
531 |
$ad->height = absint($_POST['advanced_ad']['height']);
|
532 |
}
|
533 |
|
534 |
+
if(!empty($_POST['advanced_ad']['description']))
|
535 |
+
$ad->description = esc_textarea($_POST['advanced_ad']['description']);
|
536 |
+
else $ad->description = '';
|
537 |
+
|
538 |
if(!empty($_POST['advanced_ad']['content']))
|
539 |
$ad->content = $_POST['advanced_ad']['content'];
|
540 |
else $ad->content = '';
|
541 |
+
|
542 |
if(!empty($_POST['advanced_ad']['conditions'])){
|
543 |
$ad->conditions = $_POST['advanced_ad']['conditions'];
|
544 |
} else {
|
555 |
}
|
556 |
|
557 |
$ad->save();
|
|
|
|
|
|
|
558 |
}
|
559 |
|
560 |
/**
|
685 |
echo '<p class="description">'. sprintf(__('Only enable this if you can and want to use the advanced JavaScript functions described <a href="%s">here</a>.', ADVADS_SLUG), 'http://wpadvancedads.com/javascript-functions/') .'</p>';
|
686 |
}
|
687 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
688 |
/**
|
689 |
* add heading for extra column of ads list
|
690 |
* remove the date column
|
709 |
return $defaults;
|
710 |
}
|
711 |
|
712 |
+
/**
|
713 |
+
* order ads by title on ads list
|
714 |
+
*
|
715 |
+
* @since 1.3.18
|
716 |
+
* @param arr $vars array with request vars
|
717 |
+
*/
|
718 |
+
public function ad_list_request($vars){
|
719 |
+
|
720 |
+
// order ads by title on ads list
|
721 |
+
if ( is_admin() && empty( $vars['orderby'] ) && $this->post_type == $vars['post_type'] ) {
|
722 |
+
$vars = array_merge( $vars, array(
|
723 |
+
'orderby' => 'title',
|
724 |
+
'order' => 'ASC'
|
725 |
+
) );
|
726 |
+
}
|
727 |
+
|
728 |
+
return $vars;
|
729 |
+
}
|
730 |
+
|
731 |
/**
|
732 |
* display ad details in ads list
|
733 |
*
|
admin/includes/class-ad-groups-list-table.php
CHANGED
@@ -242,10 +242,6 @@ class AdvAds_Groups_List_Table extends AdvAds_List_Table {
|
|
242 |
* @since 1.0.0
|
243 |
*/
|
244 |
function prepare_items() {
|
245 |
-
// how many items per page
|
246 |
-
// get_items_per_page basically uses a filter
|
247 |
-
$per_page = $this->get_items_per_page('edit_' . $this->taxonomy . '_per_page');
|
248 |
-
|
249 |
// set columns
|
250 |
$columns = $this->get_columns();
|
251 |
$hidden = array();
|
@@ -263,10 +259,7 @@ class AdvAds_Groups_List_Table extends AdvAds_List_Table {
|
|
263 |
$args = array(
|
264 |
'taxonomy' => $this->taxonomy,
|
265 |
'search' => $search,
|
266 |
-
'page' => $this->get_pagenum(),
|
267 |
-
'number' => $per_page,
|
268 |
'hide_empty' => 0,
|
269 |
-
'orderby' => 'id'
|
270 |
);
|
271 |
|
272 |
if (!empty($_REQUEST['orderby']))
|
@@ -283,8 +276,7 @@ class AdvAds_Groups_List_Table extends AdvAds_List_Table {
|
|
283 |
$total_items = count($this->items);
|
284 |
$this->set_pagination_args(array(
|
285 |
'total_items' => $total_items,
|
286 |
-
'
|
287 |
-
'total_pages' => ceil($total_items / $per_page)
|
288 |
));
|
289 |
}
|
290 |
|
242 |
* @since 1.0.0
|
243 |
*/
|
244 |
function prepare_items() {
|
|
|
|
|
|
|
|
|
245 |
// set columns
|
246 |
$columns = $this->get_columns();
|
247 |
$hidden = array();
|
259 |
$args = array(
|
260 |
'taxonomy' => $this->taxonomy,
|
261 |
'search' => $search,
|
|
|
|
|
262 |
'hide_empty' => 0,
|
|
|
263 |
);
|
264 |
|
265 |
if (!empty($_REQUEST['orderby']))
|
276 |
$total_items = count($this->items);
|
277 |
$this->set_pagination_args(array(
|
278 |
'total_items' => $total_items,
|
279 |
+
'total_pages' => 1
|
|
|
280 |
));
|
281 |
}
|
282 |
|
admin/views/ad-group.php
CHANGED
@@ -82,7 +82,6 @@ if (isset($_REQUEST['message']) && ( $msg = (int) $_REQUEST['message'] ) || isse
|
|
82 |
<form class="search-form" action="" method="get">
|
83 |
<!--input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" /-->
|
84 |
<input type="hidden" name="page" value="advanced-ads-groups" />
|
85 |
-
<input type="hidden" name="post_type" value="<?php echo esc_attr($post_type); ?>" />
|
86 |
<?php $ad_group_table->search_box($tax->labels->search_items, 'tag'); ?>
|
87 |
|
88 |
</form>
|
82 |
<form class="search-form" action="" method="get">
|
83 |
<!--input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" /-->
|
84 |
<input type="hidden" name="page" value="advanced-ads-groups" />
|
|
|
85 |
<?php $ad_group_table->search_box($tax->labels->search_items, 'tag'); ?>
|
86 |
|
87 |
</form>
|
admin/views/ad-inject-metabox.php
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
<p class="description"><?php _e('Include ads on specific places automatically without shortcodes or functions.', ADVADS_SLUG); ?></p>
|
2 |
-
<?php $options = $ad->options('injection'); ?>
|
3 |
-
<?php if($options) : ?>
|
4 |
-
<p style="color: red;"><?php _e('This feature is now provided through placements. Please convert the settings made here to placements.', ADVADS_SLUG); ?></p>
|
5 |
-
<ul id="advanced-ad-injection">
|
6 |
-
<li>
|
7 |
-
<input type="checkbox" name="advanced_ad[injection][header]"
|
8 |
-
id="advanced-ad-injection-header" value="1"
|
9 |
-
<?php checked(!empty($options['header']), 1); ?>/>
|
10 |
-
<label for="advanced-ad-injection-header"><?php _e('Include in Header (before closing </head> Tag, probably not visible)', ADVADS_SLUG); ?></label>
|
11 |
-
</li>
|
12 |
-
<li>
|
13 |
-
<input type="checkbox" name="advanced_ad[injection][footer]"
|
14 |
-
id="advanced-ad-injection-footer" value="1"
|
15 |
-
<?php checked(!empty($options['footer']), 1); ?>/>
|
16 |
-
<label for="advanced-ad-injection-footer"><?php _e('Include in Footer (before closing </body> Tag)', ADVADS_SLUG); ?></label>
|
17 |
-
</li>
|
18 |
-
<li>
|
19 |
-
<input type="checkbox" name="advanced_ad[injection][post_start]"
|
20 |
-
id="advanced-ad-injection-post_start" value="1"
|
21 |
-
<?php checked(!empty($options['post_start']), 1); ?>/>
|
22 |
-
<label for="advanced-ad-injection-post_start"><?php _e('Include before the post content', ADVADS_SLUG); ?></label>
|
23 |
-
</li>
|
24 |
-
<li>
|
25 |
-
<input type="checkbox" name="advanced_ad[injection][post_end]"
|
26 |
-
id="advanced-ad-injection-post_end" value="1"
|
27 |
-
<?php checked(!empty($options['post_end']), 1); ?>/>
|
28 |
-
<label for="advanced-ad-injection-post_end"><?php _e('Include after the post content', ADVADS_SLUG); ?></label>
|
29 |
-
</li>
|
30 |
-
</ul>
|
31 |
-
<?php else : ?>
|
32 |
-
<p><?php _e('This feature is now provided through placements. Please convert the settings made here to placements.', ADVADS_SLUG); ?></p>
|
33 |
-
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
admin/views/ad_info.php
CHANGED
@@ -10,4 +10,14 @@
|
|
10 |
<p class="description"><?php _e('To display an ad in template files', ADVADS_SLUG); ?></p>
|
11 |
<pre><input type="text" onclick="this.select();" value="the_ad(<?php echo $post->ID; ?>);"/></pre>
|
12 |
</div>
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
<p class="description"><?php _e('To display an ad in template files', ADVADS_SLUG); ?></p>
|
11 |
<pre><input type="text" onclick="this.select();" value="the_ad(<?php echo $post->ID; ?>);"/></pre>
|
12 |
</div>
|
13 |
+
<div id="advads-ad-description">
|
14 |
+
<?php if(!empty($ad->description)) : ?>
|
15 |
+
<p title="<?php _e('click to change', ADVADS_SLUG); ?>"
|
16 |
+
onclick="advads_toggle('#advads-ad-description textarea'); advads_toggle('#advads-ad-description p')"><?php
|
17 |
+
echo nl2br($ad->description); ?></p>
|
18 |
+
<?php else : ?>
|
19 |
+
<button type="button" onclick="advads_toggle('#advads-ad-description textarea'); advads_toggle('#advads-ad-description button')"><?php _e('Add a description', ADVADS_SLUG); ?></button>
|
20 |
+
<?php endif; ?>
|
21 |
+
<textarea name="advanced_ad[description]" placeholder="<?php
|
22 |
+
_e('Internal description or your own notes about this ad.', ADVADS_SLUG); ?>"><?php echo $ad->description; ?></textarea>
|
23 |
+
</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.3.
|
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.3.18
|
16 |
* Author: Thomas Maier
|
17 |
* Author URI: http://webgilde.com
|
18 |
* Text Domain: advanced-ads
|
classes/ad.php
CHANGED
@@ -149,6 +149,7 @@ class Advads_Ad {
|
|
149 |
$this->width = $this->options('width');
|
150 |
$this->height = $this->options('height');
|
151 |
$this->conditions = $this->options('conditions');
|
|
|
152 |
$this->output = $this->options('output');
|
153 |
$this->status = $_data->post_status;
|
154 |
$this->wrapper = $this->load_wrapper_options();
|
@@ -568,6 +569,7 @@ class Advads_Ad {
|
|
568 |
$options['height'] = $this->height;
|
569 |
$options['conditions'] = $conditions;
|
570 |
$options['expiry_date'] = $this->expiry_date;
|
|
|
571 |
|
572 |
// filter to manipulate options or add more to be saved
|
573 |
$options = apply_filters('advanced-ads-save-options', $options, $this);
|
149 |
$this->width = $this->options('width');
|
150 |
$this->height = $this->options('height');
|
151 |
$this->conditions = $this->options('conditions');
|
152 |
+
$this->description = $this->options('description');
|
153 |
$this->output = $this->options('output');
|
154 |
$this->status = $_data->post_status;
|
155 |
$this->wrapper = $this->load_wrapper_options();
|
569 |
$options['height'] = $this->height;
|
570 |
$options['conditions'] = $conditions;
|
571 |
$options['expiry_date'] = $this->expiry_date;
|
572 |
+
$options['description'] = $this->description;
|
573 |
|
574 |
// filter to manipulate options or add more to be saved
|
575 |
$options = apply_filters('advanced-ads-save-options', $options, $this);
|
classes/ad_placements.php
CHANGED
@@ -196,9 +196,14 @@ class Advads_Ad_Placements {
|
|
196 |
$advads = Advanced_Ads::get_instance();
|
197 |
$advads->current_ads[] = array('type' => 'placement', 'id' => $id, 'title' => $placements[$id]['name']);
|
198 |
|
199 |
-
// create class from placement id
|
200 |
-
$
|
201 |
-
|
|
|
|
|
|
|
|
|
|
|
202 |
|
203 |
} elseif ($_item[0] == 'group') {
|
204 |
// add the placement to the global output array
|
196 |
$advads = Advanced_Ads::get_instance();
|
197 |
$advads->current_ads[] = array('type' => 'placement', 'id' => $id, 'title' => $placements[$id]['name']);
|
198 |
|
199 |
+
// create class from placement id, but not, if header injection
|
200 |
+
if($placements[$id]['type'] == 'header'){
|
201 |
+
$ad_args = array();
|
202 |
+
} else {
|
203 |
+
$class = 'advads-' . $id;
|
204 |
+
$ad_args = array('output' => array('class' => array($class)));
|
205 |
+
}
|
206 |
+
return get_ad($_item_id, $ad_args);
|
207 |
|
208 |
} elseif ($_item[0] == 'group') {
|
209 |
// add the placement to the global output array
|
classes/ad_type_plain.php
CHANGED
@@ -46,14 +46,28 @@ class Advads_Ad_Type_Plain extends Advads_Ad_Type_Abstract{
|
|
46 |
* @since 1.0.0
|
47 |
*/
|
48 |
public function render_parameters($ad){
|
49 |
-
// load
|
50 |
$content = (isset($ad->content)) ? $ad->content : '';
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
?><p class="description"><?php _e('Insert plain text or code into this field.', ADVADS_SLUG); ?></p>
|
56 |
<textarea id="advads-ad-content-plain" cols="40" rows="10" name="advanced_ad[content]"><?php echo $content; ?></textarea>
|
|
|
|
|
57 |
<?php
|
58 |
}
|
59 |
|
@@ -65,10 +79,15 @@ class Advads_Ad_Type_Plain extends Advads_Ad_Type_Abstract{
|
|
65 |
* @since 1.0.0
|
66 |
*/
|
67 |
public function prepare_output($ad){
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
72 |
return $content;
|
73 |
}
|
74 |
|
46 |
* @since 1.0.0
|
47 |
*/
|
48 |
public function render_parameters($ad){
|
49 |
+
// load content
|
50 |
$content = (isset($ad->content)) ? $ad->content : '';
|
51 |
+
|
52 |
+
// check if php is allowed
|
53 |
+
if(isset($ad->output['allow_php'])){
|
54 |
+
$allow_php = absint($ad->output['allow_php']);
|
55 |
+
} else {
|
56 |
+
/**
|
57 |
+
* for compatibility for ads with php added prior to 1.3.18
|
58 |
+
* check if there is php code in the content
|
59 |
+
*/
|
60 |
+
if(preg_match('/\<\?php/', $content)){
|
61 |
+
$allow_php = 1;
|
62 |
+
} else {
|
63 |
+
$allow_php = 0;
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
?><p class="description"><?php _e('Insert plain text or code into this field.', ADVADS_SLUG); ?></p>
|
68 |
<textarea id="advads-ad-content-plain" cols="40" rows="10" name="advanced_ad[content]"><?php echo $content; ?></textarea>
|
69 |
+
<input type="hidden" name="advanced_ad[output][allow_php]" value="0"/>
|
70 |
+
<label><input type="checkbox" name="advanced_ad[output][allow_php]" value="1" <?php checked(1, $allow_php); ?>/><?php _e('Execute PHP code (wrapped in <code><?php ?></code>)', ADVADS_SLUG); ?></label>
|
71 |
<?php
|
72 |
}
|
73 |
|
79 |
* @since 1.0.0
|
80 |
*/
|
81 |
public function prepare_output($ad){
|
82 |
+
|
83 |
+
// evaluate the code as php if setting was never saved or is allowed
|
84 |
+
if(!isset($ad->output['allow_php']) || $ad->output['allow_php']){
|
85 |
+
ob_start();
|
86 |
+
eval('?>'.$ad->content);
|
87 |
+
$content = ob_get_clean();
|
88 |
+
} else {
|
89 |
+
$content = $ad->content;
|
90 |
+
}
|
91 |
return $content;
|
92 |
}
|
93 |
|
public/class-advanced-ads.php
CHANGED
@@ -416,24 +416,6 @@ class Advanced_Ads {
|
|
416 |
return $ads_by_conditions;
|
417 |
}
|
418 |
|
419 |
-
/**
|
420 |
-
* get the array with global ad injections
|
421 |
-
*
|
422 |
-
* @since 1.1.0
|
423 |
-
* @return arr $ad_injections
|
424 |
-
* @todo make static
|
425 |
-
*/
|
426 |
-
public function get_ad_injections_array(){
|
427 |
-
|
428 |
-
$ad_injections = get_option('advads-ads-injections', array());
|
429 |
-
// load default array if not saved yet
|
430 |
-
if(!is_array($ad_injections)){
|
431 |
-
$ad_injections = array();
|
432 |
-
}
|
433 |
-
|
434 |
-
return $ad_injections;
|
435 |
-
}
|
436 |
-
|
437 |
/**
|
438 |
* get the array with ad placements
|
439 |
*
|
@@ -664,24 +646,6 @@ class Advanced_Ads {
|
|
664 |
echo Advads_Ad_Placements::output($_placement_id);
|
665 |
}
|
666 |
}
|
667 |
-
|
668 |
-
/* FROM HERE, THE CODE IS DEPRECATED – MOVE AUTO INJECTED ADS TO PLACEMENTS */
|
669 |
-
// get information about injected ads
|
670 |
-
$injections = get_option('advads-ads-injections', array());
|
671 |
-
if(isset($injections['header']) && is_array($injections['header'])){
|
672 |
-
$ads = $injections['header'];
|
673 |
-
// randomize ads
|
674 |
-
shuffle($ads);
|
675 |
-
// check ads one by one for being able to be displayed on this spot
|
676 |
-
foreach ($ads as $_ad_id) {
|
677 |
-
// load the ad object
|
678 |
-
$ad = new Advads_Ad($_ad_id);
|
679 |
-
if ($ad->can_display()) {
|
680 |
-
// display the ad
|
681 |
-
echo $ad->output();
|
682 |
-
}
|
683 |
-
}
|
684 |
-
}
|
685 |
}
|
686 |
|
687 |
/**
|
@@ -696,24 +660,6 @@ class Advanced_Ads {
|
|
696 |
echo Advads_Ad_Placements::output($_placement_id);
|
697 |
}
|
698 |
}
|
699 |
-
|
700 |
-
/* FROM HERE, THE CODE IS DEPRECATED – MOVE AUTO INJECTED ADS TO PLACEMENTS */
|
701 |
-
// get information about injected ads
|
702 |
-
$injections = get_option('advads-ads-injections', array());
|
703 |
-
if(isset($injections['footer']) && is_array($injections['footer'])){
|
704 |
-
$ads = $injections['footer'];
|
705 |
-
// randomize ads
|
706 |
-
shuffle($ads);
|
707 |
-
// check ads one by one for being able to be displayed on this spot
|
708 |
-
foreach ($ads as $_ad_id) {
|
709 |
-
// load the ad object
|
710 |
-
$ad = new Advads_Ad($_ad_id);
|
711 |
-
if ($ad->can_display()) {
|
712 |
-
// display the ad
|
713 |
-
echo $ad->output();
|
714 |
-
}
|
715 |
-
}
|
716 |
-
}
|
717 |
}
|
718 |
|
719 |
/**
|
@@ -744,42 +690,6 @@ class Advanced_Ads {
|
|
744 |
}
|
745 |
}
|
746 |
|
747 |
-
/* FROM HERE, THE CODE IS DEPRECATED – MOVE AUTO INJECTED ADS TO PLACEMENTS */
|
748 |
-
// get information about injected ads
|
749 |
-
$injections = get_option('advads-ads-injections', array());
|
750 |
-
|
751 |
-
// display ad before the content
|
752 |
-
if(isset($injections['post_start']) && is_array($injections['post_start'])){
|
753 |
-
$ads = $injections['post_start'];
|
754 |
-
// randomize ads
|
755 |
-
shuffle($ads);
|
756 |
-
// check ads one by one for being able to be displayed on this spot
|
757 |
-
foreach ($ads as $_ad_id) {
|
758 |
-
// load the ad object
|
759 |
-
$ad = new Advads_Ad($_ad_id);
|
760 |
-
if ($ad->can_display()) {
|
761 |
-
// display the ad
|
762 |
-
$content = $ad->output() . $content;
|
763 |
-
}
|
764 |
-
}
|
765 |
-
}
|
766 |
-
|
767 |
-
// display ad after the content
|
768 |
-
if(isset($injections['post_end']) && is_array($injections['post_end'])){
|
769 |
-
$ads = $injections['post_end'];
|
770 |
-
// randomize ads
|
771 |
-
shuffle($ads);
|
772 |
-
// check ads one by one for being able to be displayed on this spot
|
773 |
-
foreach ($ads as $_ad_id) {
|
774 |
-
// load the ad object
|
775 |
-
$ad = new Advads_Ad($_ad_id);
|
776 |
-
if ($ad->can_display()) {
|
777 |
-
// display the ad
|
778 |
-
$content .= $ad->output();
|
779 |
-
}
|
780 |
-
}
|
781 |
-
}
|
782 |
-
|
783 |
return $content;
|
784 |
}
|
785 |
|
416 |
return $ads_by_conditions;
|
417 |
}
|
418 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
419 |
/**
|
420 |
* get the array with ad placements
|
421 |
*
|
646 |
echo Advads_Ad_Placements::output($_placement_id);
|
647 |
}
|
648 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
649 |
}
|
650 |
|
651 |
/**
|
660 |
echo Advads_Ad_Placements::output($_placement_id);
|
661 |
}
|
662 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
663 |
}
|
664 |
|
665 |
/**
|
690 |
}
|
691 |
}
|
692 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
693 |
return $content;
|
694 |
}
|
695 |
|
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.1.
|
7 |
-
Stable tag: 1.3.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -22,6 +22,7 @@ Learn more on the [plugin homepage](http://wpadvancedads.com).
|
|
22 |
* group ads to create ad rotations
|
23 |
* create drafts or ads only visible to logged in users
|
24 |
* set a date for when to publish the ad
|
|
|
25 |
|
26 |
= ad types =
|
27 |
|
@@ -86,7 +87,7 @@ You can also use it to add additional ad network tags into header or footer of y
|
|
86 |
|
87 |
Learn more on the [plugin homepage](http://wpadvancedads.com).
|
88 |
|
89 |
-
Localizations: English, German, Italien
|
90 |
|
91 |
= Add-Ons =
|
92 |
|
@@ -155,6 +156,17 @@ There is no revenue share. Advanced Ads doesn’t alter your ad codes in a way t
|
|
155 |
|
156 |
== Changelog ==
|
157 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
= 1.3.17 =
|
159 |
|
160 |
* allow ad injection in all public post types now
|
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.1.
|
7 |
+
Stable tag: 1.3.18
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
22 |
* group ads to create ad rotations
|
23 |
* create drafts or ads only visible to logged in users
|
24 |
* set a date for when to publish the ad
|
25 |
+
* make internal notes about each ad
|
26 |
|
27 |
= ad types =
|
28 |
|
87 |
|
88 |
Learn more on the [plugin homepage](http://wpadvancedads.com).
|
89 |
|
90 |
+
Localizations: English, German, Italien, Portuguese
|
91 |
|
92 |
= Add-Ons =
|
93 |
|
156 |
|
157 |
== Changelog ==
|
158 |
|
159 |
+
= 1.3.18 =
|
160 |
+
|
161 |
+
* removed wrapper for header injection placement
|
162 |
+
* removed deprecated code used for ad based content injections
|
163 |
+
* ordered ads by title in ads list
|
164 |
+
* removed broken pagination from ad groups list. now, all ad groups are displayed
|
165 |
+
* order ad groups by name when no other order is specified
|
166 |
+
* fixed search for ad groups in ad groups list
|
167 |
+
* PHP is not automatically allowed for new plain text ad codes anymore
|
168 |
+
* add an internal description and notes to your ads
|
169 |
+
|
170 |
= 1.3.17 =
|
171 |
|
172 |
* allow ad injection in all public post types now
|