PluginProbe ʕ •ᴥ•ʔ
Advanced Ads – Ad Manager & AdSense / 1.10.10
Advanced Ads – Ad Manager & AdSense v1.10.10
2.0.23 2.0.22 2.0.21 1.38.0 1.39.0 1.39.1 1.39.2 1.39.3 1.39.4 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.40.0 1.40.1 1.40.2 1.41.0 1.42.0 1.42.1 1.42.2 1.43.0 1.44.0 1.44.1 1.45.0 1.45.1 1.46.0 1.47.0 1.47.1 1.47.2 1.47.3 1.47.4 1.47.5 1.48.0 1.48.1 1.49.0 1.5.0 1.5.0.1 1.5.1 1.5.2 1.5.2.1 1.5.4 1.5.4.1 1.5.5 1.50.0 1.51.0 1.51.1 1.51.2 1.51.3 1.52.0 1.52.1 1.52.2 1.52.3 1.52.4 1.53.0 1.53.1 1.53.2 1.54.0 1.54.1 1.55.0 1.56.0 1.56.1 1.56.2 1.56.3 1.56.4 1.6 1.6.1 1.6.10 1.6.10.1 1.6.10.2 1.6.11 1.6.11.1 1.6.12 1.6.13 1.6.14 1.6.15 1.6.16 1.6.17 1.6.17.1 1.6.17.2 1.6.2 1.6.2.1 1.6.3 1.6.4 1.6.4.1 1.6.5 1.6.6 1.6.6.1 1.6.7 1.6.7.1 1.6.8 1.6.8.1 1.6.8.2 1.6.8.3 1.6.9 1.6.9.1 1.6.9.2 1.6.9.3 1.6.9.4 1.7 1.7.0.1 1.7.0.2 1.7.0.3 1.7.1 1.7.1.1 1.7.1.2 1.7.1.3 1.7.1.4 1.7.1.5 1.7.10 trunk 1.7.11 1.0.1 1.7.12 1.0.2 1.7.13 1.0.3 1.7.14 1.1.0 1.7.15 1.1.1 1.7.16 1.1.2 1.7.17 1.1.3 1.7.18 1.10 1.7.19 1.10.1 1.7.2 1.10.10 1.7.2.1 1.10.11 1.7.20 1.10.12 1.7.21 1.10.2 1.7.22 1.10.3 1.7.23 1.10.4 1.7.24 1.10.5 1.7.25 1.10.6 1.7.3 1.10.7 1.7.4 1.10.8 1.7.4.1 1.10.9 1.7.4.2 1.11 1.7.4.3 1.11.1 1.7.4.4 1.11.2 1.7.4.5 1.12 1.7.5 1.13 1.7.5.1 1.13.1 1.7.6 1.13.2 1.7.7 1.13.3 1.7.8 1.13.4 1.7.9 1.13.5 1.7.9.1 1.13.6 1.7.9.2 1.13.7 1.7.9.3 1.13.8 1.8 1.14 1.8.1 1.14.1 1.8.10 1.14.10 1.8.11 1.14.11 1.8.12 1.14.2 1.8.13 1.14.3 1.8.14 1.14.4 1.8.15 1.14.5 1.8.16 1.14.6 1.8.17 1.14.7 1.8.18 1.14.8 1.8.19 1.14.9 1.8.2 1.15 1.8.20 1.16 1.8.21 1.16.1 1.8.22 1.17 1.8.23 1.17.1 1.8.24 1.17.10 1.8.25 1.17.10-rc.1 1.8.26 1.17.11 1.8.27 1.17.12 1.8.28 1.17.12-rc.1 1.8.29 1.17.2 1.8.3 1.17.3 1.8.30 1.17.4 1.8.4 1.17.5 1.8.5 1.17.6 1.8.6 1.17.7 1.8.7 1.17.8 1.8.8 1.17.9 1.8.9 1.17.9-beta.1 1.9 1.18.0 2.0.0 1.19.0 2.0.1 1.19.1 2.0.10 1.2 2.0.11 1.2.1 2.0.12 1.2.2 2.0.13 1.2.3 2.0.14 1.2.4 2.0.15 1.2.5 2.0.16 1.2.6 2.0.17 1.2.7 2.0.18 1.20.0 2.0.19 1.20.0-rc.1 2.0.2 1.20.0-rc.2 2.0.20 1.20.1 2.0.3 1.20.2 2.0.4 1.20.3 2.0.5 1.21.0 2.0.6 1.21.1 2.0.7 1.22.0 2.0.8 1.22.1 2.0.9 1.22.2 1.23.0 1.23.1 1.23.2 1.24.0 1.24.1 1.24.2 1.25.0 1.25.1 1.26.0 1.27.0 1.28.0 1.29.0 1.29.1 1.3 1.3.1 1.3.10 1.3.11 1.3.12 1.3.13 1.3.14 1.3.15 1.3.16 1.3.17 1.3.18 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.30.0 1.30.1 1.30.2 1.30.2-rc.1 1.30.3 1.30.4 1.30.4-rc.1 1.30.5 1.31.0 1.31.1 1.32.0 1.32.0-rc.1 1.33.0 1.33.1 1.33.2 1.34.0 1.35.0 1.35.1 1.36.0 1.36.1 1.36.2 1.36.3 1.37.0 1.37.1 1.37.2
advanced-ads / admin / includes / class-meta-box.php
advanced-ads / admin / includes Last commit date
class-ad-groups-list.php 8 years ago class-ad-type.php 7 years ago class-licenses.php 7 years ago class-list-filters.php 7 years ago class-menu.php 8 years ago class-meta-box.php 7 years ago class-notices.php 7 years ago class-options.php 9 years ago class-overview-widgets.php 7 years ago class-settings.php 8 years ago class-shortcode-creator.php 9 years ago notices.php 7 years ago shortcode-creator-l10n.php 10 years ago
class-meta-box.php
496 lines
1 <?php
2 defined( 'ABSPATH' ) || exit;
3
4 class Advanced_Ads_Admin_Meta_Boxes {
5 /**
6 * Instance of this class.
7 *
8 * @var object
9 */
10 protected static $instance = null;
11
12 /**
13 * meta box ids
14 *
15 * @since 1.7.4.2
16 * @var array
17 */
18 protected $meta_box_ids = array();
19
20
21 private function __construct() {
22 add_action( 'add_meta_boxes_' . Advanced_Ads::POST_TYPE_SLUG, array( $this, 'add_meta_boxes' ) );
23 // add meta box for post types edit pages
24 add_action( 'add_meta_boxes', array( $this, 'add_post_meta_box' ) );
25 add_action( 'save_post', array( $this, 'save_post_meta_box' ) );
26 // register dashboard widget
27 add_action( 'wp_dashboard_setup', array($this, 'add_dashboard_widget') );
28 // fixes compatibility issue with WP QUADS PRO
29 add_action( 'quads_meta_box_post_types', array($this, 'fix_wpquadspro_issue'), 11 );
30 }
31
32 /**
33 * Return an instance of this class.
34 *
35 * @return object A single instance of this class.
36 */
37 public static function get_instance() {
38 // If the single instance hasn't been set, set it now.
39 if ( null == self::$instance ) {
40 self::$instance = new self;
41 }
42
43 return self::$instance;
44 }
45
46 /**
47 * Add meta boxes
48 *
49 * @since 1.0.0
50 */
51 public function add_meta_boxes() {
52 $post_type = Advanced_Ads::POST_TYPE_SLUG;
53
54 add_meta_box(
55 'ad-main-box', __( 'Ad Type', 'advanced-ads' ), array($this, 'markup_meta_boxes'), $post_type, 'normal', 'high'
56 );
57 // use dynamic filter from to add close class to ad type meta box after saved first time
58 add_filter( 'postbox_classes_advanced_ads_ad-main-box', array( $this, 'close_ad_type_metabox' ) );
59
60 add_meta_box(
61 'ad-parameters-box', __( 'Ad Parameters', 'advanced-ads' ), array($this, 'markup_meta_boxes'), $post_type, 'normal', 'high'
62 );
63 add_meta_box(
64 'ad-output-box', __( 'Layout / Output', 'advanced-ads' ), array($this, 'markup_meta_boxes'), $post_type, 'normal', 'high'
65 );
66 add_meta_box(
67 'ad-display-box', __( 'Display Conditions', 'advanced-ads' ), array($this, 'markup_meta_boxes'), $post_type, 'normal', 'high'
68 );
69 add_meta_box(
70 'ad-visitor-box', __( 'Visitor Conditions', 'advanced-ads' ), array($this, 'markup_meta_boxes'), $post_type, 'normal', 'high'
71 );
72 if( ! defined( 'AAP_VERSION' ) ){
73 add_meta_box(
74 'advads-pro-pitch', __( 'Increase your ad revenue', 'advanced-ads' ), array($this, 'markup_meta_boxes'), $post_type, 'side', 'low'
75 );
76 }
77 if( ! defined( 'AAT_VERSION' ) ){
78 add_meta_box(
79 'advads-tracking-pitch', __( 'Ad Stats', 'advanced-ads' ), array($this, 'markup_meta_boxes'), $post_type, 'normal', 'low'
80 );
81 }
82
83 // register meta box ids
84 $this->meta_box_ids = array(
85 'ad-main-box',
86 'ad-parameters-box',
87 'ad-output-box',
88 'ad-display-box',
89 'ad-visitor-box',
90 'advads-pro-pitch',
91 'advads-tracking-pitch',
92 'revisionsdiv', // revisions – only when activated
93 'advanced_ads_groupsdiv' // automatically added by ad groups taxonomy
94 );
95
96 // force AA meta boxes to never be completely hidden by screen options
97 add_filter( 'hidden_meta_boxes', array( $this, 'unhide_meta_boxes' ), 10, 2 );
98
99 $whitelist = apply_filters( 'advanced-ads-ad-edit-allowed-metaboxes', array_merge(
100 $this->meta_box_ids,
101 array(
102 'submitdiv',
103 'slugdiv',
104 'tracking-ads-box',
105 'ad-layer-ads-box', // deprecated
106 )
107 ) );
108
109 global $wp_meta_boxes;
110 // remove non-white-listed meta boxes
111 foreach ( array( 'normal', 'advanced', 'side' ) as $context ) {
112 if ( isset( $wp_meta_boxes[ $post_type ][ $context ] ) ) {
113 foreach ( array( 'high', 'sorted', 'core', 'default', 'low' ) as $priority ) {
114 if ( isset( $wp_meta_boxes[ $post_type ][ $context ][ $priority ]) ) {
115 foreach ( (array) $wp_meta_boxes[ $post_type ][ $context ][ $priority ] as $id => $box ) {
116 if ( ! in_array( $id, $whitelist ) ) {
117 unset( $wp_meta_boxes[ $post_type ][ $context ][ $priority ][ $id ] );
118 }
119 }
120 }
121 }
122 }
123 }
124 }
125
126 /**
127 * load templates for all meta boxes
128 *
129 * @since 1.0.0
130 * @param obj $post
131 * @param array $box
132 * @todo move ad initialization to main function and just global it
133 */
134 public function markup_meta_boxes($post, $box) {
135 $ad = new Advanced_Ads_Ad( $post->ID );
136
137 switch ( $box['id'] ) {
138 case 'ad-main-box':
139 $view = 'ad-main-metabox.php';
140 $hndlelinks = '<a href="' . ADVADS_URL . 'manual/ad-types#utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-ad-type" target="_blank">' . __('Manual', 'advanced-ads') . '</a>';
141 break;
142 case 'ad-parameters-box':
143 $view = 'ad-parameters-metabox.php';
144 break;
145 case 'ad-output-box':
146 $view = 'ad-output-metabox.php';
147 break;
148 case 'ad-display-box':
149 $view = 'ad-display-metabox.php';
150 $hndlelinks = '<a href="#" class="advads-video-link">' . __('Video', 'advanced-ads') . '</a>';
151 $hndlelinks .= '<a href="' . ADVADS_URL . 'manual/display-conditions#utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-display" target="_blank">' . __('Manual', 'advanced-ads') . '</a>';
152 $videomarkup = '<iframe width="420" height="315" src="https://www.youtube-nocookie.com/embed/wVB6UpeyWNA?rel=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>';
153 break;
154 case 'ad-visitor-box':
155 $view = 'ad-visitor-metabox.php';
156 $hndlelinks = '<a href="' . ADVADS_URL . 'manual/visitor-conditions#utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-visitor" target="_blank">' . __('Manual', 'advanced-ads') . '</a>';
157 break;
158 case 'advads-pro-pitch':
159 $view = 'pitch-bundle.php';
160 // $hndlelinks = '<a href="' . ADVADS_URL . 'manual/visitor-conditions#utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-visitor" target="_blank">' . __('Manual', 'advanced-ads') . '</a>';
161 break;
162 case 'advads-tracking-pitch':
163 $view = 'pitch-tracking.php';
164 // $hndlelinks = '<a href="' . ADVADS_URL . 'manual/visitor-conditions#utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-visitor" target="_blank">' . __('Manual', 'advanced-ads') . '</a>';
165 break;
166 }
167
168 if ( ! isset( $view ) ) {
169 return;
170 }
171 // markup moved to handle headline of the metabox
172 if( isset( $hndlelinks ) ){
173 ?><span class="advads-hndlelinks hidden"><?php echo $hndlelinks; ?></span>
174 <?php
175 }
176 // show video markup
177 if( isset( $videomarkup ) ){
178 echo '<div class="advads-video-link-container" data-videolink=\'' . $videomarkup . '\'></div>';
179 }
180 /**
181 * list general notices
182 *
183 * elements in $warnings contain [text] and [class] attributes
184 */
185 $warnings = array();
186 // show warning if ad contains https in parameters box
187 if ( 'ad-parameters-box' === $box['id'] && $message = Advanced_Ads_Ad_Debug::is_https_and_http( $ad ) ) {
188 $warnings[] = array(
189 'text' => $message,
190 'class' =>'advads-ad-notice-https-missing error'
191 );
192 }
193
194 if ( 'ad-parameters-box' === $box['id'] ) {
195 $auto_ads_strings = Advanced_Ads_AdSense_Admin::get_auto_ads_messages();
196
197 if ( Advanced_Ads_AdSense_Data::get_instance()->is_page_level_enabled() ) {
198 $warnings[] = array(
199 'text' => $auto_ads_strings['enabled'],
200 'class' => 'advads-auto-ad-in-ad-content hidden error'
201 );
202 } else {
203 $warnings[] = array(
204 'text' => $auto_ads_strings['disabled'],
205 'class' => 'advads-auto-ad-in-ad-content hidden error'
206 );
207 }
208 }
209
210 $warnings = apply_filters( 'advanced-ads-ad-notices', $warnings, $box, $post );
211 echo '<ul id="' .$box['id'].'-notices" class="advads-metabox-notices">';
212 foreach( $warnings as $_warning ){
213 if( isset( $_warning['text'] ) ) :
214 $warning_class = isset( $_warning['class'] ) ? $_warning['class'] : '';
215 echo '<li class="'. $warning_class . '">';
216 echo $_warning['text'];
217 echo '</li>';
218 endif;
219 }
220 echo '</ul>';
221 include ADVADS_BASE_PATH . 'admin/views/' . $view;
222 }
223
224 /**
225 * force all AA related meta boxes to stay visible
226 *
227 * @since 1.7.4.2
228 * @param array $hidden An array of hidden meta boxes
229 * @param WP_Screen $screen WP_Screen object of the current screen
230 */
231 public function unhide_meta_boxes( $hidden, $screen ){
232 // only check on Advanced Ads edit screen
233 if ( ! isset( $screen->id ) || $screen->id !== 'advanced_ads' || !is_array( $this->meta_box_ids ) ) {
234 return $hidden;
235 }
236
237 // return only hidden elements which are not among the Advanced Ads meta box ids
238 return array_diff( $hidden, $this->meta_box_ids );
239 }
240
241 /**
242 * add a meta box to post type edit screens with ad settings
243 *
244 * @since 1.3.10
245 * @param string $post_type current post type
246 */
247 public function add_post_meta_box($post_type = ''){
248 // don’t display for non admins
249 if( ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads') ) ) {
250 return;
251 }
252
253 // get public post types
254 $public_post_types = get_post_types( array('public' => true, 'publicly_queryable' => true), 'names', 'or' );
255
256 //limit meta box to public post types
257 if ( in_array( $post_type, $public_post_types ) ) {
258 add_meta_box(
259 'advads-ad-settings',
260 __( 'Ad Settings', 'advanced-ads' ),
261 array( $this, 'render_post_meta_box' ),
262 $post_type,
263 'side',
264 'low'
265 );
266 }
267 }
268
269 /**
270 * render meta box for ad settings on a per post basis
271 *
272 * @since 1.3.10
273 * @param WP_Post $post The post object.
274 */
275 public function render_post_meta_box( $post ) {
276
277 // nonce field to check when we save the values
278 wp_nonce_field( 'advads_post_meta_box', 'advads_post_meta_box_nonce' );
279
280 // retrieve an existing value from the database.
281 $values = get_post_meta( $post->ID, '_advads_ad_settings', true );
282
283 // load the view
284 include ADVADS_BASE_PATH . 'admin/views/post-ad-settings-metabox.php';
285
286 do_action( 'advanced_ads_render_post_meta_box', $post, $values );
287 }
288
289 /**
290 * save the ad meta when the post is saved.
291 *
292 * @since 1.3.10
293 * @param int $post_id The ID of the post being saved.
294 */
295 public function save_post_meta_box( $post_id ) {
296
297 if( ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads') ) ) {
298 return;
299 }
300
301 // check nonce
302 if ( ! isset( $_POST['advads_post_meta_box_nonce'] ) ) {
303 return $post_id; }
304
305 $nonce = $_POST['advads_post_meta_box_nonce'];
306
307 // Verify that the nonce is valid.
308 if ( ! wp_verify_nonce( $nonce, 'advads_post_meta_box' ) ) {
309 return $post_id; }
310
311 // don’t save on autosave
312 if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
313 return $post_id; }
314
315 // check the user's permissions.
316 if ( 'page' == $_POST['post_type'] ) {
317 if ( ! current_user_can( 'edit_page', $post_id ) ) {
318 return $post_id; }
319 } else {
320 if ( ! current_user_can( 'edit_post', $post_id ) ) {
321 return $post_id; }
322 }
323
324 // Sanitize the user input.
325 $_data['disable_ads'] = isset($_POST['advanced_ads']['disable_ads']) ? absint( $_POST['advanced_ads']['disable_ads'] ) : 0;
326
327 $_data = apply_filters( 'advanced_ads_save_post_meta_box', $_data );
328
329 // Update the meta field.
330 update_post_meta( $post_id, '_advads_ad_settings', $_data );
331 }
332
333 /**
334 * add "close" class to collapse the ad-type metabox after ad was saved first
335 *
336 * @since 1.7.2
337 * @param arr $classes
338 * @return arr $classes
339 */
340 public function close_ad_type_metabox( $classes = array() ) {
341 global $post;
342 if ( isset( $post->ID ) && 'publish' === $post->post_status ) {
343 if ( ! in_array( 'closed', $classes ) ) {
344 $classes[] = 'closed';
345 }
346 } else {
347 $classes = array();
348 }
349 return $classes;
350 }
351
352 /**
353 * add dashboard widget with ad stats and additional information
354 *
355 * @since 1.3.12
356 */
357 public function add_dashboard_widget(){
358 // display dashboard widget only to authors and higher roles
359 if( ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_see_interface') ) ) {
360 return;
361 }
362 add_meta_box( 'advads_dashboard_widget', __( 'Ads Dashboard', 'advanced-ads' ), array($this, 'dashboard_widget_function'), 'dashboard', 'side', 'high' );
363 }
364
365 /**
366 * display widget functions
367 */
368 public static function dashboard_widget_function($post, $callback_args){
369 // get number of ads
370 $ads_count = Advanced_Ads::get_number_of_ads();
371 if( current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads') ) ) {
372 echo '<p>';
373 printf(__( '%d ads – <a href="%s">manage</a> - <a href="%s">new</a>', 'advanced-ads' ),
374 $ads_count,
375 'edit.php?post_type='. Advanced_Ads::POST_TYPE_SLUG,
376 'post-new.php?post_type='. Advanced_Ads::POST_TYPE_SLUG);
377 echo '</p>';
378 }
379
380 // get and display plugin version
381 $advads_plugin_data = get_plugin_data( ADVADS_BASE_PATH . 'advanced-ads.php' );
382 if ( isset($advads_plugin_data['Version']) ){
383 $version = $advads_plugin_data['Version'];
384 echo '<p><a href="'.ADVADS_URL.'#utm_source=advanced-ads&utm_medium=link&utm_campaign=dashboard" target="_blank" title="'.
385 __( 'plugin manual and homepage', 'advanced-ads' ).'">Advanced Ads</a> '. $version .'</p>';
386 }
387
388 $notice_options = Advanced_Ads_Admin_Notices::get_instance()->options();
389 $_notice = 'nl_first_steps';
390 if ( ! isset($notice_options['closed'][ $_notice ] ) ) {
391 ?><div class="advads-admin-notice">
392 <p><button type="button" class="button-primary advads-notices-button-subscribe" data-notice="<?php echo $_notice ?>"><?php _e('Get the tutorial via email', 'advanced-ads'); ?></button></p>
393 </div><?php
394 }
395
396 $_notice = 'nl_adsense';
397 if ( ! isset($notice_options['closed'][ $_notice ] ) ) {
398 ?><div class="advads-admin-notice">
399 <p><button type="button" class="button-primary advads-notices-button-subscribe" data-notice="<?php echo $_notice ?>"><?php _e('Get AdSense tips via email', 'advanced-ads'); ?></button></p>
400 </div><?php
401 }
402
403 // rss feed
404 self::dashboard_cached_rss_widget();
405
406 // add markup for utm variables
407 // todo: move to js file
408 ?><script>jQuery('#advads_dashboard_widget .rss-widget a').each(function(){ this.href = this.href + '#utm_source=advanced-ads&utm_medium=rss-link&utm_campaign=dashboard'; })</script><?php
409 }
410
411 /**
412 * checks to see if there are feed urls in transient cache; if not, load them
413 * built using a lot of https://developer.wordpress.org/reference/functions/wp_dashboard_cached_rss_widget/
414 *
415 * @since 1.3.12
416 * @param string $widget_id
417 * @param callback $callback
418 * @param array $check_urls RSS feeds
419 * @return bool False on failure. True on success.
420 */
421 static function dashboard_cached_rss_widget() {
422
423 $cache_key = 'dash_' . md5( 'advads_dashboard_widget' );
424
425 if ( false !== ( $output = get_transient( $cache_key ) ) ) {
426 echo $output;
427 return true;
428 }
429 /**
430 * only display dummy output which then loads the content via AJAX
431 */
432 ?><div id="advads-dashboard-widget-placeholder">
433 <img src="<?php echo admin_url( 'images/spinner.gif' ); ?>" width="20" height="20"/>
434 <script>advads_load_dashboard_rss_widget_content();</script>
435 </div><?php
436
437 return true;
438 }
439
440 /**
441 * create the rss output of the widget
442 *
443 * @param string $widget_id Widget ID.
444 */
445 static function dashboard_widget_function_output( ) {
446
447 check_ajax_referer('advanced-ads-admin-ajax-nonce', 'nonce');
448
449 $cache_key = 'dash_' . md5( 'advads_dashboard_widget' );
450
451 $feeds = array(
452 array(
453 'link' => 'http://webgilde.com/en/ad-optimization/',
454 'url' => 'http://webgilde.com/en/ad-optimization/feed/',
455 'title' => __( 'From the ad optimization universe', 'advanced-ads' ),
456 'items' => 2,
457 'show_summary' => 0,
458 'show_author' => 0,
459 'show_date' => 0,
460 ),
461 array(
462 'link' => ADVADS_URL,
463 'url' => ADVADS_URL . 'feed/',
464 'title' => __( 'Advanced Ads Tutorials', 'advanced-ads' ),
465 'items' => 2,
466 'show_summary' => 0,
467 'show_author' => 0,
468 'show_date' => 0,
469 ),
470 );
471
472 // create output and also cache it
473
474 ob_start();
475 foreach ( $feeds as $_feed ){
476 echo '<div class="rss-widget">';
477 echo '<h4>'.$_feed['title'].'</h4>';
478 wp_widget_rss_output( $_feed['url'], $_feed );
479 echo '</div>';
480 }
481 set_transient( $cache_key, ob_get_flush(), 48 * HOUR_IN_SECONDS ); // Default lifetime in cache of 48 hours
482 die();
483 }
484
485 /**
486 * fixes a WP QUADS PRO compatibility issue
487 * they inject their ad optimization meta box into our ad page, even though it is not a public post type
488 * using they filter, we remove AA from the list of post types they inject this box into
489 */
490 function fix_wpquadspro_issue( $allowed_post_types ){
491 unset( $allowed_post_types['advanced_ads'] );
492 return $allowed_post_types;
493 }
494
495 }
496