@@ -224,15 +224,15 @@ function get_options() {
224224 $ default_provider = 'doubleclick_for_publishers ' ;
225225 // Make sure our default provider exists. Otherwise, the sky will fall on our head
226226 if ( ! isset ( $ this ->providers ->$ default_provider ) ) {
227- foreach ( $ this ->providers as $ slug => $ provider ) {
227+ foreach ( $ this ->providers as $ slug => $ provider ) {
228228 $ default_provider = $ slug ;
229229 break ;
230230 }
231231 }
232232
233233 $ defaults = array (
234- 'provider ' => $ default_provider ,
235- );
234+ 'provider ' => $ default_provider ,
235+ );
236236 $ options = get_option ( 'acm_options ' , array () );
237237 return array_merge ( $ defaults , $ options );
238238 }
@@ -336,7 +336,7 @@ function handle_admin_action() {
336336 break ;
337337 case 'update_options ' :
338338 $ options = $ this ->get_options ();
339- foreach ( $ options as $ key => $ value ) {
339+ foreach ( $ options as $ key => $ value ) {
340340 if ( isset ( $ _REQUEST [$ key ] ) )
341341 $ options [$ key ] = sanitize_text_field ( $ _REQUEST [$ key ] );
342342 }
@@ -639,7 +639,7 @@ function parse_readme_into_contextual_help() {
639639 if ( 5 > count ( $ sections ) )
640640 return ;
641641
642- $ useful = array ( $ sections [3 ], $ sections [2 ], $ sections [4 ] );
642+ $ useful = array ( $ sections [2 ], $ sections [4 ], $ sections [7 ] );
643643 foreach ( $ useful as $ i => $ tab ) {
644644 // Because WP.ORG Markdown has a different flavor
645645 $ useful [$ i ] = Markdown ( str_replace ( array ( '= ' , ' = ' ), '** ' , $ tab ) );
@@ -651,7 +651,7 @@ function contextual_help() {
651651 global $ pagenow ;
652652 if ( 'tools.php ' != $ pagenow || !isset ( $ _GET ['page ' ] ) || $ _GET ['page ' ] != $ this ->plugin_slug )
653653 return ;
654- list ( $ installation , $ description , $ configuration ) = $ this ->parse_readme_into_contextual_help ();
654+ list ( $ description , $ configuration , $ filters ) = $ this ->parse_readme_into_contextual_help ();
655655 ob_start ();
656656?>
657657 <div id="conditionals-help">
@@ -690,16 +690,16 @@ function contextual_help() {
690690 );
691691 get_current_screen ()->add_help_tab (
692692 array (
693- 'id ' => 'acm-install ' ,
694- 'title ' => 'Installation ' ,
695- 'content ' => $ installation ,
693+ 'id ' => 'acm-config ' ,
694+ 'title ' => 'Configuration ' ,
695+ 'content ' => $ configuration ,
696696 )
697697 );
698698 get_current_screen ()->add_help_tab (
699699 array (
700- 'id ' => 'acm-config ' ,
701- 'title ' => 'Configuration ' ,
702- 'content ' => $ configuration ,
700+ 'id ' => 'acm-filters ' ,
701+ 'title ' => 'Configuration Filters ' ,
702+ 'content ' => $ filters ,
703703 )
704704 );
705705 get_current_screen ()->add_help_tab (
@@ -805,7 +805,7 @@ function register_ad_codes( $ad_codes = array() ) {
805805 /**
806806 * 'enable_ui_mapping' is a special argument which means this ad tag can be
807807 * mapped with ad codes through the admin interface. If that's the case, we
808- * want to make sure those ad codes are only registered with the tag.
808+ * want to make sure those ad codes are only registered with the tag.
809809 */
810810 if ( isset ( $ default_tag ['enable_ui_mapping ' ] ) && $ default_tag ['tag ' ] != $ ad_code ['url_vars ' ]['tag ' ] )
811811 continue ;
@@ -836,6 +836,14 @@ function register_ad_codes( $ad_codes = array() ) {
836836 * @param string $tag_id Unique ID for the ad tag
837837 */
838838 function action_acm_tag ( $ tag_id ) {
839+ /**
840+ * See http://adcodemanager.wordpress.com/2013/04/10/hi-all-on-a-dotcom-site-that-uses/
841+ *
842+ * Configuration filter: acm_disable_ad_rendering
843+ * Should be boolean, defaulting to disabling ads on previews
844+ */
845+ if ( apply_filters ( 'acm_disable_ad_rendering ' , is_preview () ) )
846+ return ;
839847
840848 $ code_to_display = $ this ->get_matching_ad_code ( $ tag_id );
841849
0 commit comments