Making WordPress.org

Changeset 1136


Ignore:
Timestamp:
01/13/2015 07:33:18 PM (12 years ago)
Author:
coffee2code
Message:

developer.wordpress.org: Prevent display of inline @internal for summaries and descriptions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/formatting.php

    r1091 r1136  
    2424                add_filter( 'the_excerpt', array( __CLASS__, 'lowercase_P_dangit_just_once' ) );
    2525                add_filter( 'the_content', array( __CLASS__, 'make_doclink_clickable' ), 10, 5 );
     26
     27                add_filter( 'the_excerpt', array( __CLASS__, 'remove_inline_internal' ) );
     28                add_filter( 'the_content', array( __CLASS__, 'remove_inline_internal' ) );
    2629        }
    2730
    … …  
    4245
    4346                return $excerpt;
     47        }
     48
     49        /**
     50         * Prevents display of the inline use of {@internal}} as it is not meant to be shown.
     51         *
     52         * @param  string      $content   The post content.
     53         * @param  null|string $post_type Optional. The post type. Default null.
     54         * @return string
     55         */
     56        public static function remove_inline_internal( $content, $post_type = null ) {
     57                // Only attempt a change for a parsed post type with an @internal reference in the text.
     58                if ( DevHub\is_parsed_post_type( $post_type ) && false !== strpos( $content, '{@internal ' ) ) {
     59                        $content = preg_replace( '/\{@internal (.+)\}\}/', '', $content );
     60                }
     61
     62                return $content;
    4463        }
    4564
Note: See TracChangeset for help on using the changeset viewer.