Advanced Ads - Version 1.3.3

Version Description

  • added column with ad details
  • removed the date column from ad list
  • fixed saving and retrieving of settings
  • changed the dashboard icon
  • renamed admin images so they wont get blocked by ad blockers

  • ACTION REQUIRED: please check and resave settings (Advanced Ads > Settings)

Download this release

Release Info

Developer webzunft
Plugin Icon 128x128 Advanced Ads
Version 1.3.3
Comparing to
See all releases

Code changes from version 1.3.2 to 1.3.3

admin/assets/img/{ad-output-center.png → output-center.png} RENAMED
File without changes
admin/assets/img/{ad-output-left.png → output-left.png} RENAMED
File without changes
admin/assets/img/{ad-output-right.png → output-right.png} RENAMED
File without changes
admin/class-advanced-ads-admin.php CHANGED
@@ -90,6 +90,10 @@ class Advanced_Ads_Admin {
90
  // save ads post type
91
  add_action('save_post', array($this, 'save_ad'));
92
 
 
 
 
 
93
  // settings handling
94
  add_action('admin_init', array($this, 'settings_init'));
95
 
@@ -193,7 +197,7 @@ class Advanced_Ads_Admin {
193
 
194
  // add main menu item with overview page
195
  add_menu_page(
196
- __('Overview', ADVADS_SLUG), __('Advanced Ads', ADVADS_SLUG), 'manage_options', $this->plugin_slug, array($this, 'display_overview_page'), '', '58.74'
197
  );
198
 
199
  add_submenu_page(
@@ -559,7 +563,7 @@ class Advanced_Ads_Admin {
559
  $hook = $this->plugin_screen_hook_suffix;
560
 
561
  // register settings
562
- register_setting($hook, 'advancedads');
563
 
564
  // add new section
565
  add_settings_section(
@@ -605,6 +609,7 @@ class Advanced_Ads_Admin {
605
  $options = Advanced_Ads::get_instance()->options();
606
  $current_capability_role = isset($options['hide-for-user-role']) ? $options['hide-for-user-role'] : 0;
607
 
 
608
  $capability_roles = array(
609
  '' => __('(display to all)', ADVADS_SLUG),
610
  'read' => __('Subscriber', ADVADS_SLUG),
@@ -613,7 +618,7 @@ class Advanced_Ads_Admin {
613
  'edit_pages' => __('Editor', ADVADS_SLUG),
614
  'activate_plugins' => __('Admin', ADVADS_SLUG),
615
  );
616
- echo '<select name="advancedads[hide-for-user-role]">';
617
  foreach($capability_roles as $_capability => $_role) {
618
  echo '<option value="'.$_capability.'" '.selected($_capability, $current_capability_role, false).'>'.$_role.'</option>';
619
  }
@@ -631,7 +636,7 @@ class Advanced_Ads_Admin {
631
  $options = Advanced_Ads::get_instance()->options();
632
  $checked = (!empty($options['advanced-js'])) ? 1 : 0;
633
 
634
- echo '<input id="advanced-ads-advanced-js" type="checkbox" value="1" name="advancedads[advanced-js]" '.checked($checked, 1, false).'>';
635
  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>';
636
  }
637
 
@@ -665,4 +670,58 @@ class Advanced_Ads_Admin {
665
  delete_option ('advads-ads-injections');
666
  }
667
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
668
  }
90
  // save ads post type
91
  add_action('save_post', array($this, 'save_ad'));
92
 
93
+ // handling extra columns on ad lists
94
+ add_filter('manage_advanced_ads_posts_columns', array($this, 'ad_list_columns_head'));
95
+ add_filter('manage_advanced_ads_posts_custom_column', array($this, 'ad_list_columns_content'), 10, 2);
96
+
97
  // settings handling
98
  add_action('admin_init', array($this, 'settings_init'));
99
 
197
 
198
  // add main menu item with overview page
199
  add_menu_page(
200
+ __('Overview', ADVADS_SLUG), __('Advanced Ads', ADVADS_SLUG), 'manage_options', $this->plugin_slug, array($this, 'display_overview_page'), 'dashicons-chart-line', '58.74'
201
  );
202
 
203
  add_submenu_page(
563
  $hook = $this->plugin_screen_hook_suffix;
564
 
565
  // register settings
566
+ register_setting($hook, ADVADS_SLUG);
567
 
568
  // add new section
569
  add_settings_section(
609
  $options = Advanced_Ads::get_instance()->options();
610
  $current_capability_role = isset($options['hide-for-user-role']) ? $options['hide-for-user-role'] : 0;
611
 
612
+
613
  $capability_roles = array(
614
  '' => __('(display to all)', ADVADS_SLUG),
615
  'read' => __('Subscriber', ADVADS_SLUG),
618
  'edit_pages' => __('Editor', ADVADS_SLUG),
619
  'activate_plugins' => __('Admin', ADVADS_SLUG),
620
  );
621
+ echo '<select name="'.ADVADS_SLUG.'[hide-for-user-role]">';
622
  foreach($capability_roles as $_capability => $_role) {
623
  echo '<option value="'.$_capability.'" '.selected($_capability, $current_capability_role, false).'>'.$_role.'</option>';
624
  }
636
  $options = Advanced_Ads::get_instance()->options();
637
  $checked = (!empty($options['advanced-js'])) ? 1 : 0;
638
 
639
+ echo '<input id="advanced-ads-advanced-js" type="checkbox" value="1" name="'.ADVADS_SLUG.'[advanced-js]" '.checked($checked, 1, false).'>';
640
  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>';
641
  }
642
 
670
  delete_option ('advads-ads-injections');
671
  }
672
 
673
+ /**
674
+ * add heading for extra column of ads list
675
+ * remove the date column
676
+ *
677
+ * @since 1.3.3
678
+ * @param arr $defaults
679
+ */
680
+ public function ad_list_columns_head($defaults){
681
+
682
+ $offset = array_search('title', array_keys($defaults)) + 1;
683
+
684
+ $defaults = array_merge
685
+ (
686
+ array_slice($defaults, 0, $offset),
687
+ array('ad_details' => __('Ad Details', ADVADS_SLUG)),
688
+ array_slice($defaults, $offset, null)
689
+ );
690
+
691
+ // remove the date
692
+ unset($defaults['date']);
693
+
694
+ return $defaults;
695
+ }
696
+
697
+ /**
698
+ * display ad details in ads list
699
+ *
700
+ * @since 1.3.3
701
+ * @param string $column_name name of the column
702
+ * @param int $ad_id id of the ad
703
+ */
704
+ public function ad_list_columns_content($column_name, $ad_id) {
705
+ if ($column_name == 'ad_details') {
706
+ $ad = new Advads_Ad($ad_id);
707
+
708
+ // load ad type title
709
+ $types = Advanced_Ads::get_instance()->ad_types;
710
+ $type = (!empty($types[$ad->type]->title)) ? $types[$ad->type]->title : 0;
711
+
712
+ // load ad size
713
+ $size = 0;
714
+ if(!empty($ad->width) || !empty($ad->height)){
715
+ $size = sprintf('%d x %d', $ad->width, $ad->height);
716
+ }
717
+
718
+ $view = plugin_dir_path(__FILE__) . 'views/ad_list_details_column.php';
719
+ if (is_file($view)) {
720
+ require( $view );
721
+ }
722
+
723
+ }
724
+ }
725
+
726
+
727
  }
admin/views/ad-output-metabox.php CHANGED
@@ -7,13 +7,13 @@
7
  ?>" <?php if(empty($options['position'])) checked(1, 1); ?>/><?php _e('default', ADVADS_SLUG); ?></label>
8
  <label title="<?php _e('left', ADVADS_SLUG); ?>"><input type="radio" name="advanced_ad[output][position]" value="left"
9
  <?php if(isset($options['position'])) checked($options['position'], 'left'); ?>/>
10
- <img src="<?php echo ADVADS_BASE_URL; ?>admin/assets/img/ad-output-left.png" width="60" height="45"/></label>
11
  <label title="<?php _e('center', ADVADS_SLUG); ?>"><input type="radio" name="advanced_ad[output][position]" value="center"
12
  <?php if(isset($options['position'])) checked($options['position'], 'center'); ?>/>
13
- <img src="<?php echo ADVADS_BASE_URL; ?>admin/assets/img/ad-output-center.png" width="60" height="45"/></label>
14
  <label title="<?php _e('right', ADVADS_SLUG); ?>"><input type="radio" name="advanced_ad[output][position]" value="right"
15
  <?php if(isset($options['position'])) checked($options['position'], 'right'); ?>/>
16
- <img src="<?php echo ADVADS_BASE_URL; ?>admin/assets/img/ad-output-right.png" width="60" height="45"/></label>
17
  </div>
18
  <p><label><input type="checkbox" name="advanced_ad[output][clearfix]" value="1"<?php if(isset($options['clearfix'])) checked($options['clearfix'], 1); ?>/><?php
19
  _e('Check this if you don\'t want the following elements to float around the ad. (adds a clearfix)', ADVADS_SLUG);
7
  ?>" <?php if(empty($options['position'])) checked(1, 1); ?>/><?php _e('default', ADVADS_SLUG); ?></label>
8
  <label title="<?php _e('left', ADVADS_SLUG); ?>"><input type="radio" name="advanced_ad[output][position]" value="left"
9
  <?php if(isset($options['position'])) checked($options['position'], 'left'); ?>/>
10
+ <img src="<?php echo ADVADS_BASE_URL; ?>admin/assets/img/output-left.png" width="60" height="45"/></label>
11
  <label title="<?php _e('center', ADVADS_SLUG); ?>"><input type="radio" name="advanced_ad[output][position]" value="center"
12
  <?php if(isset($options['position'])) checked($options['position'], 'center'); ?>/>
13
+ <img src="<?php echo ADVADS_BASE_URL; ?>admin/assets/img/output-center.png" width="60" height="45"/></label>
14
  <label title="<?php _e('right', ADVADS_SLUG); ?>"><input type="radio" name="advanced_ad[output][position]" value="right"
15
  <?php if(isset($options['position'])) checked($options['position'], 'right'); ?>/>
16
+ <img src="<?php echo ADVADS_BASE_URL; ?>admin/assets/img/output-right.png" width="60" height="45"/></label>
17
  </div>
18
  <p><label><input type="checkbox" name="advanced_ad[output][clearfix]" value="1"<?php if(isset($options['clearfix'])) checked($options['clearfix'], 1); ?>/><?php
19
  _e('Check this if you don\'t want the following elements to float around the ad. (adds a clearfix)', ADVADS_SLUG);
admin/views/ad_list_details_column.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php if(!empty($type)) :
2
+ ?><p><strong><?php echo $type; ?></strong></p><?php
3
+ endif;
4
+ if(!empty($size)) :
5
+ ?><p><?php echo $size; ?></p><?php
6
+ endif;
7
+ do_action('advanced-ads-ad-list-details-column-after', $ad);
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.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.3.3
16
  * Author: Thomas Maier
17
  * Author URI: http://webgilde.com
18
  * Text Domain: advanced-ads
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.0.1
7
- Stable tag: 1.3.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -146,6 +146,16 @@ There is no revenue share. Advanced Ads doesn’t alter your ad codes in a way t
146
 
147
  == Changelog ==
148
 
 
 
 
 
 
 
 
 
 
 
149
  = 1.3.2 =
150
 
151
  * hotfix: prevent infinite loops (ads within ads…) for rich content ads
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.1
7
+ Stable tag: 1.3.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
146
 
147
  == Changelog ==
148
 
149
+ = 1.3.3 =
150
+
151
+ * added column with ad details
152
+ * removed the date column from ad list
153
+ * fixed saving and retrieving of settings
154
+ * changed the dashboard icon
155
+ * renamed admin images so they won’t get blocked by ad blockers
156
+
157
+ * ACTION REQUIRED: please check and resave settings (_Advanced Ads > Settings_)
158
+
159
  = 1.3.2 =
160
 
161
  * hotfix: prevent infinite loops (ads within ads…) for rich content ads