Make WordPress Core


Ignore:
Timestamp:
05/29/2015 03:42:40 PM (10 years ago)
Author:
wonderboymusic
Message:

Add @static* annotations where they are missing.
Initialize all static vars that are not, most to null.

See #32444.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/formatting.php

    r32590 r32650  
    3939function wptexturize( $text, $reset = false ) {
    4040    global $wp_cockneyreplace, $shortcode_tags;
    41     static $static_characters, $static_replacements, $dynamic_characters, $dynamic_replacements,
    42         $default_no_texturize_tags, $default_no_texturize_shortcodes, $run_texturize = true;
     41    static $static_characters = null,
     42        $static_replacements = null,
     43        $dynamic_characters = null,
     44        $dynamic_replacements = null,
     45        $default_no_texturize_tags = null,
     46        $default_no_texturize_shortcodes = null,
     47        $run_texturize = true;
    4348
    4449    // If there's nothing to do, just stop.
     
    631636 * @access private
    632637 *
    633  * @staticvar string|false $_charset
     638 * @staticvar string $_charset
    634639 *
    635640 * @param string $string         The text which is to be encoded.
     
    657662    // Store the site charset as a static to avoid multiple calls to wp_load_alloptions()
    658663    if ( ! $charset ) {
    659         static $_charset;
     664        static $_charset = null;
    660665        if ( ! isset( $_charset ) ) {
    661666            $alloptions = wp_load_alloptions();
     
    791796
    792797    // Store the site charset as a static to avoid multiple calls to get_option()
    793     static $is_utf8;
    794     if ( !isset( $is_utf8 ) ) {
     798    static $is_utf8 = null;
     799    if ( ! isset( $is_utf8 ) ) {
    795800        $is_utf8 = in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) );
    796801    }
    797     if ( !$is_utf8 ) {
     802    if ( ! $is_utf8 ) {
    798803        return $string;
    799804    }
    800805
    801806    // Check for support for utf8 in the installed PCRE library once and store the result in a static
    802     static $utf8_pcre;
    803     if ( !isset( $utf8_pcre ) ) {
     807    static $utf8_pcre = null;
     808    if ( ! isset( $utf8_pcre ) ) {
    804809        $utf8_pcre = @preg_match( '/^./u', 'a' );
    805810    }
     
    39603965    // Still here? Use the more judicious replacement
    39613966    static $dblq = false;
    3962     if ( false === $dblq )
     3967    if ( false === $dblq ) {
    39633968        $dblq = _x( '“', 'opening curly double quote' );
     3969    }
    39643970    return str_replace(
    39653971        array( ' Wordpress', '‘Wordpress', $dblq . 'Wordpress', '>Wordpress', '(Wordpress' ),
    39663972        array( ' WordPress', '‘WordPress', $dblq . 'WordPress', '>WordPress', '(WordPress' ),
    39673973    $text );
    3968 
    39693974}
    39703975
     
    40964101 */
    40974102function wp_spaces_regexp() {
    4098     static $spaces;
     4103    static $spaces = '';
    40994104
    41004105    if ( empty( $spaces ) ) {
Note: See TracChangeset for help on using the changeset viewer.