Add `@static*` annotations where they are missing.

Initialize all static vars that are not, most to `null`.

See #32444.

Built from https://develop.svn.wordpress.org/trunk@32650


git-svn-id: http://core.svn.wordpress.org/trunk@32620 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-05-29 15:43:29 +00:00
parent fccc19b510
commit 19a3aacc94
36 changed files with 173 additions and 53 deletions

View File

@ -379,7 +379,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
* @return string * @return string
*/ */
public function parselisting($line) { public function parselisting($line) {
static $is_windows; static $is_windows = null;
if ( is_null($is_windows) ) if ( is_null($is_windows) )
$is_windows = stripos( ftp_systype($this->link), 'win') !== false; $is_windows = stripos( ftp_systype($this->link), 'win') !== false;

View File

@ -900,6 +900,8 @@ class WP_List_Table {
* @since 3.1.0 * @since 3.1.0
* @access public * @access public
* *
* @staticvar int $cb_counter
*
* @param bool $with_id Whether to set the id attribute or not * @param bool $with_id Whether to set the id attribute or not
*/ */
public function print_column_headers( $with_id = true ) { public function print_column_headers( $with_id = true ) {

View File

@ -162,7 +162,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
* @return bool * @return bool
*/ */
public function _search_callback( $theme ) { public function _search_callback( $theme ) {
static $term; static $term = null;
if ( is_null( $term ) ) if ( is_null( $term ) )
$term = wp_unslash( $_REQUEST['s'] ); $term = wp_unslash( $_REQUEST['s'] );

View File

@ -219,7 +219,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
* @return boolean * @return boolean
*/ */
public function _search_callback( $plugin ) { public function _search_callback( $plugin ) {
static $term; static $term = null;
if ( is_null( $term ) ) if ( is_null( $term ) )
$term = wp_unslash( $_REQUEST['s'] ); $term = wp_unslash( $_REQUEST['s'] );

View File

@ -1658,6 +1658,8 @@ class Language_Pack_Upgrader extends WP_Upgrader {
* Hooked to the {@see 'upgrader_process_complete'} action by default. * Hooked to the {@see 'upgrader_process_complete'} action by default.
* *
* @since 3.7.0 * @since 3.7.0
*
* @static
*/ */
public static function async_upgrade( $upgrader = false ) { public static function async_upgrade( $upgrader = false ) {
// Avoid recursion. // Avoid recursion.
@ -2136,6 +2138,8 @@ class Core_Upgrader extends WP_Upgrader {
* *
* @since 3.7.0 * @since 3.7.0
* *
* @static
*
* @param string $offered_ver The offered version, of the format x.y.z. * @param string $offered_ver The offered version, of the format x.y.z.
* @return bool True if we should update to the offered version, otherwise false. * @return bool True if we should update to the offered version, otherwise false.
*/ */

View File

@ -732,6 +732,8 @@ function wp_dashboard_quick_press_output() {
* @deprecated 3.3.0 * @deprecated 3.3.0
* @deprecated Use wp_editor() * @deprecated Use wp_editor()
* @see wp_editor() * @see wp_editor()
*
* @staticvar int $num
*/ */
function wp_tiny_mce( $teeny = false, $settings = false ) { function wp_tiny_mce( $teeny = false, $settings = false ) {
_deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' ); _deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );

View File

@ -535,6 +535,8 @@ document.body.className = document.body.className.replace('no-js', 'js');
* *
* @global int $post_ID * @global int $post_ID
* *
* @staticvar int $instance
*
* @param string $editor_id * @param string $editor_id
*/ */
function media_buttons($editor_id = 'content') { function media_buttons($editor_id = 'content') {

View File

@ -11,6 +11,8 @@
* *
* @since 2.7.0 * @since 2.7.0
* *
* @staticvar array $column_headers
*
* @param string|WP_Screen $screen The screen you want the headers for * @param string|WP_Screen $screen The screen you want the headers for
* @return array Containing the headers in the format id => UI String * @return array Containing the headers in the format id => UI String
*/ */
@ -327,6 +329,11 @@ final class WP_Screen {
/** /**
* Stores old string-based help. * Stores old string-based help.
*
* @static
* @access private
*
* @var array
*/ */
private static $_old_compat_help = array(); private static $_old_compat_help = array();
@ -343,8 +350,11 @@ final class WP_Screen {
* The screen object registry. * The screen object registry.
* *
* @since 3.3.0 * @since 3.3.0
* @var array *
* @static
* @access private * @access private
*
* @var array
*/ */
private static $_registry = array(); private static $_registry = array();
@ -372,6 +382,8 @@ final class WP_Screen {
* @since 3.3.0 * @since 3.3.0
* @access public * @access public
* *
* @static
*
* @global string $hook_suffix * @global string $hook_suffix
* *
* @param string|WP_Screen $hook_name Optional. The hook name (also known as the hook suffix) used to determine the screen. * @param string|WP_Screen $hook_name Optional. The hook name (also known as the hook suffix) used to determine the screen.
@ -588,6 +600,8 @@ final class WP_Screen {
* *
* @since 3.3.0 * @since 3.3.0
* *
* @static
*
* @param WP_Screen $screen A screen object. * @param WP_Screen $screen A screen object.
* @param string $help Help text. * @param string $help Help text.
*/ */

View File

@ -605,12 +605,14 @@ function list_meta( $meta ) {
* *
* @since 2.5.0 * @since 2.5.0
* *
* @staticvar string $update_nonce
*
* @param array $entry * @param array $entry
* @param int $count * @param int $count
* @return string * @return string
*/ */
function _list_meta_row( $entry, &$count ) { function _list_meta_row( $entry, &$count ) {
static $update_nonce = false; static $update_nonce = '';
if ( is_protected_meta( $entry['meta_key'], 'post' ) ) if ( is_protected_meta( $entry['meta_key'], 'post' ) )
return ''; return '';
@ -1991,6 +1993,8 @@ final class WP_Internal_Pointers {
* Individual pointers (e.g. wp390_widgets) can be disabled using the following: * Individual pointers (e.g. wp390_widgets) can be disabled using the following:
* remove_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_wp390_widgets' ) ); * remove_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_wp390_widgets' ) );
* *
* @static
*
* @param string $hook_suffix The current admin page. * @param string $hook_suffix The current admin page.
*/ */
public static function enqueue_scripts( $hook_suffix ) { public static function enqueue_scripts( $hook_suffix ) {
@ -2047,6 +2051,8 @@ final class WP_Internal_Pointers {
* *
* @since 3.3.0 * @since 3.3.0
* *
* @static
*
* @param string $pointer_id The pointer ID. * @param string $pointer_id The pointer ID.
* @param string $selector The HTML elements, on which the pointer should be attached. * @param string $selector The HTML elements, on which the pointer should be attached.
* @param array $args Arguments to be passed to the pointer JS (see wp-pointer.js). * @param array $args Arguments to be passed to the pointer JS (see wp-pointer.js).
@ -2094,6 +2100,9 @@ final class WP_Internal_Pointers {
public static function pointer_wp350_media() {} public static function pointer_wp350_media() {}
public static function pointer_wp360_revisions() {} public static function pointer_wp360_revisions() {}
/**
* @static
*/
public static function pointer_wp360_locks() { public static function pointer_wp360_locks() {
if ( ! is_multi_author() ) { if ( ! is_multi_author() ) {
return; return;
@ -2108,6 +2117,9 @@ final class WP_Internal_Pointers {
) ); ) );
} }
/**
* @static
*/
public static function pointer_wp390_widgets() { public static function pointer_wp390_widgets() {
if ( ! current_theme_supports( 'widgets' ) ) { if ( ! current_theme_supports( 'widgets' ) ) {
return; return;
@ -2165,6 +2177,8 @@ final class WP_Internal_Pointers {
* *
* @since 3.3.0 * @since 3.3.0
* *
* @static
*
* @param int $user_id User ID. * @param int $user_id User ID.
*/ */
public static function dismiss_pointers_for_new_users( $user_id ) { public static function dismiss_pointers_for_new_users( $user_id ) {

View File

@ -136,11 +136,13 @@ function theme_update_available( $theme ) {
* *
* @since 3.8.0 * @since 3.8.0
* *
* @staticvar object $themes_update
*
* @param WP_Theme $theme WP_Theme object. * @param WP_Theme $theme WP_Theme object.
* @return false|string HTML for the update link, or false if invalid info was passed. * @return false|string HTML for the update link, or false if invalid info was passed.
*/ */
function get_theme_update_available( $theme ) { function get_theme_update_available( $theme ) {
static $themes_update; static $themes_update = null;
if ( !current_user_can('update_themes' ) ) if ( !current_user_can('update_themes' ) )
return false; return false;

View File

@ -104,6 +104,8 @@ function wp_list_widget_controls( $sidebar, $sidebar_name = '' ) {
* *
* @global array $wp_registered_widgets * @global array $wp_registered_widgets
* *
* @staticvar int $i
*
* @param array $params * @param array $params
* @return array * @return array
*/ */

View File

@ -489,6 +489,11 @@ class WP_User {
*/ */
var $filter = null; var $filter = null;
/**
* @static
* @access private
* @var array
*/
private static $back_compat_keys; private static $back_compat_keys;
/** /**
@ -562,6 +567,8 @@ class WP_User {
* *
* @since 3.3.0 * @since 3.3.0
* *
* @static
*
* @global wpdb $wpdb * @global wpdb $wpdb
* *
* @param string $field The field to query against: 'id', 'slug', 'email' or 'login' * @param string $field The field to query against: 'id', 'slug', 'email' or 'login'

View File

@ -341,6 +341,8 @@ class WP_Http {
* The order for requests is cURL, and then PHP Streams. * The order for requests is cURL, and then PHP Streams.
* *
* @since 3.2.0 * @since 3.2.0
*
* @static
* @access private * @access private
* *
* @param string $url URL to Request * @param string $url URL to Request
@ -626,6 +628,9 @@ class WP_Http {
* @link https://core.trac.wordpress.org/ticket/8927 Allow preventing external requests. * @link https://core.trac.wordpress.org/ticket/8927 Allow preventing external requests.
* @link https://core.trac.wordpress.org/ticket/14636 Allow wildcard domains in WP_ACCESSIBLE_HOSTS * @link https://core.trac.wordpress.org/ticket/14636 Allow wildcard domains in WP_ACCESSIBLE_HOSTS
* *
* @staticvar array|null $accessible_hosts
* @staticvar array $wildcard_regex
*
* @param string $uri URI of url. * @param string $uri URI of url.
* @return bool True to block, false to allow. * @return bool True to block, false to allow.
*/ */
@ -656,9 +661,9 @@ class WP_Http {
if ( !defined('WP_ACCESSIBLE_HOSTS') ) if ( !defined('WP_ACCESSIBLE_HOSTS') )
return true; return true;
static $accessible_hosts; static $accessible_hosts = null;
static $wildcard_regex = false; static $wildcard_regex = array();
if ( null == $accessible_hosts ) { if ( null === $accessible_hosts ) {
$accessible_hosts = preg_split('|,\s*|', WP_ACCESSIBLE_HOSTS); $accessible_hosts = preg_split('|,\s*|', WP_ACCESSIBLE_HOSTS);
if ( false !== strpos(WP_ACCESSIBLE_HOSTS, '*') ) { if ( false !== strpos(WP_ACCESSIBLE_HOSTS, '*') ) {
@ -687,6 +692,8 @@ class WP_Http {
* when URL parsing failed. * when URL parsing failed.
* *
* @since 4.1.0 * @since 4.1.0
*
* @static
* @access protected * @access protected
* *
* @param string $url The URL to parse. * @param string $url The URL to parse.
@ -725,7 +732,9 @@ class WP_Http {
* *
* @since 3.4.0 * @since 3.4.0
* *
* @static
* @access public * @access public
*
* @param string $maybe_relative_path The URL which might be relative * @param string $maybe_relative_path The URL which might be relative
* @param string $url The URL which $maybe_relative_path is relative to * @param string $url The URL which $maybe_relative_path is relative to
* @return string An Absolute URL, in a failure condition where the URL cannot be parsed, the relative URL will be returned. * @return string An Absolute URL, in a failure condition where the URL cannot be parsed, the relative URL will be returned.
@ -796,6 +805,8 @@ class WP_Http {
* *
* @since 3.7.0 * @since 3.7.0
* *
* @static
*
* @param string $url The URL which was requested. * @param string $url The URL which was requested.
* @param array $args The Arguments which were used to make the request. * @param array $args The Arguments which were used to make the request.
* @param array $response The Response of the HTTP request. * @param array $response The Response of the HTTP request.
@ -1798,6 +1809,9 @@ class WP_HTTP_Proxy {
* *
* @since 2.8.0 * @since 2.8.0
* *
* @staticvar array|null $bypass_hosts
* @staticvar array $wildcard_regex
*
* @param string $uri URI to check. * @param string $uri URI to check.
* @return bool True, to send through the proxy and false if, the proxy should not be used. * @return bool True, to send through the proxy and false if, the proxy should not be used.
*/ */
@ -1837,9 +1851,9 @@ class WP_HTTP_Proxy {
if ( !defined('WP_PROXY_BYPASS_HOSTS') ) if ( !defined('WP_PROXY_BYPASS_HOSTS') )
return true; return true;
static $bypass_hosts; static $bypass_hosts = null;
static $wildcard_regex = false; static $wildcard_regex = array();
if ( null == $bypass_hosts ) { if ( null === $bypass_hosts ) {
$bypass_hosts = preg_split('|,\s*|', WP_PROXY_BYPASS_HOSTS); $bypass_hosts = preg_split('|,\s*|', WP_PROXY_BYPASS_HOSTS);
if ( false !== strpos(WP_PROXY_BYPASS_HOSTS, '*') ) { if ( false !== strpos(WP_PROXY_BYPASS_HOSTS, '*') ) {
@ -2087,6 +2101,8 @@ class WP_Http_Encoding {
* *
* @since 2.8.0 * @since 2.8.0
* *
* @static
*
* @param string $raw String to compress. * @param string $raw String to compress.
* @param int $level Optional, default is 9. Compression level, 9 is highest. * @param int $level Optional, default is 9. Compression level, 9 is highest.
* @param string $supports Optional, not used. When implemented it will choose the right compression based on what the server supports. * @param string $supports Optional, not used. When implemented it will choose the right compression based on what the server supports.
@ -2106,6 +2122,8 @@ class WP_Http_Encoding {
* *
* @since 2.8.0 * @since 2.8.0
* *
* @static
*
* @param string $compressed String to decompress. * @param string $compressed String to decompress.
* @param int $length The optional length of the compressed data. * @param int $length The optional length of the compressed data.
* @return string|bool False on failure. * @return string|bool False on failure.
@ -2151,6 +2169,8 @@ class WP_Http_Encoding {
* @link http://au2.php.net/manual/en/function.gzinflate.php#70875 * @link http://au2.php.net/manual/en/function.gzinflate.php#70875
* @link http://au2.php.net/manual/en/function.gzinflate.php#77336 * @link http://au2.php.net/manual/en/function.gzinflate.php#77336
* *
* @static
*
* @param string $gzData String to decompress. * @param string $gzData String to decompress.
* @return string|bool False on failure. * @return string|bool False on failure.
*/ */
@ -2190,6 +2210,8 @@ class WP_Http_Encoding {
* *
* @since 2.8.0 * @since 2.8.0
* *
* @static
*
* @param string $url * @param string $url
* @param array $args * @param array $args
* @return string Types of encoding to accept. * @return string Types of encoding to accept.
@ -2236,6 +2258,8 @@ class WP_Http_Encoding {
* *
* @since 2.8.0 * @since 2.8.0
* *
* @static
*
* @return string Content-Encoding string to send in the header. * @return string Content-Encoding string to send in the header.
*/ */
public static function content_encoding() { public static function content_encoding() {
@ -2247,6 +2271,8 @@ class WP_Http_Encoding {
* *
* @since 2.8.0 * @since 2.8.0
* *
* @static
*
* @param array|string $headers All of the available headers. * @param array|string $headers All of the available headers.
* @return bool * @return bool
*/ */
@ -2270,6 +2296,8 @@ class WP_Http_Encoding {
* *
* @since 2.8.0 * @since 2.8.0
* *
* @static
*
* @return bool * @return bool
*/ */
public static function is_available() { public static function is_available() {

View File

@ -19,6 +19,10 @@
*/ */
class WP_oEmbed { class WP_oEmbed {
public $providers = array(); public $providers = array();
/**
* @static
* @var array
*/
public static $early_providers = array(); public static $early_providers = array();
private $compat_methods = array( '_fetch_with_format', '_parse_json', '_parse_xml', '_parse_body' ); private $compat_methods = array( '_fetch_with_format', '_parse_json', '_parse_xml', '_parse_body' );
@ -611,15 +615,15 @@ class WP_oEmbed {
* @since 2.9.0 * @since 2.9.0
* @access private * @access private
* *
* @see WP_oEmbed * @staticvar WP_oEmbed $wp_oembed
* *
* @return WP_oEmbed object. * @return WP_oEmbed object.
*/ */
function _wp_oembed_get_object() { function _wp_oembed_get_object() {
static $wp_oembed; static $wp_oembed = null;
if ( is_null($wp_oembed) ) if ( is_null( $wp_oembed ) ) {
$wp_oembed = new WP_oEmbed(); $wp_oembed = new WP_oEmbed();
}
return $wp_oembed; return $wp_oembed;
} }

View File

@ -20,6 +20,8 @@ class WP_Customize_Control {
* Used when sorting two instances whose priorities are equal. * Used when sorting two instances whose priorities are equal.
* *
* @since 4.1.0 * @since 4.1.0
*
* @static
* @access protected * @access protected
* @var int * @var int
*/ */

View File

@ -24,6 +24,8 @@ class WP_Customize_Panel {
* Used when sorting two instances whose priorities are equal. * Used when sorting two instances whose priorities are equal.
* *
* @since 4.1.0 * @since 4.1.0
*
* @static
* @access protected * @access protected
* @var int * @var int
*/ */

View File

@ -24,6 +24,8 @@ class WP_Customize_Section {
* Used when sorting two instances whose priorities are equal. * Used when sorting two instances whose priorities are equal.
* *
* @since 4.1.0 * @since 4.1.0
*
* @static
* @access protected * @access protected
* @var int * @var int
*/ */

View File

@ -108,6 +108,8 @@ final class WP_Customize_Widgets {
* @since 4.2.0 * @since 4.2.0
* @access protected * @access protected
* *
* @staticvar array $cache
*
* @param $setting_id Setting ID. * @param $setting_id Setting ID.
* @return string|void Setting type. * @return string|void Setting type.
*/ */
@ -876,7 +878,6 @@ final class WP_Customize_Widgets {
* Naturally order available widgets by name. * Naturally order available widgets by name.
* *
* @since 3.9.0 * @since 3.9.0
* @static
* @access protected * @access protected
* *
* @param array $widget_a The first widget to compare. * @param array $widget_a The first widget to compare.

View File

@ -34,10 +34,12 @@ class WP_Image_Editor_GD extends WP_Image_Editor {
* Checks to see if current environment supports GD. * Checks to see if current environment supports GD.
* *
* @since 3.5.0 * @since 3.5.0
*
* @static
* @access public * @access public
* *
* @param array $args * @param array $args
* @return boolean * @return bool
*/ */
public static function test( $args = array() ) { public static function test( $args = array() ) {
if ( ! extension_loaded('gd') || ! function_exists('gd_info') ) if ( ! extension_loaded('gd') || ! function_exists('gd_info') )
@ -58,10 +60,12 @@ class WP_Image_Editor_GD extends WP_Image_Editor {
* Checks to see if editor supports the mime-type specified. * Checks to see if editor supports the mime-type specified.
* *
* @since 3.5.0 * @since 3.5.0
*
* @static
* @access public * @access public
* *
* @param string $mime_type * @param string $mime_type
* @return boolean * @return bool
*/ */
public static function supports_mime_type( $mime_type ) { public static function supports_mime_type( $mime_type ) {
$image_types = imagetypes(); $image_types = imagetypes();

View File

@ -38,6 +38,8 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
* method can be called statically. * method can be called statically.
* *
* @since 3.5.0 * @since 3.5.0
*
* @static
* @access public * @access public
* *
* @param array $args * @param array $args
@ -86,6 +88,8 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
* Checks to see if editor supports the mime-type specified. * Checks to see if editor supports the mime-type specified.
* *
* @since 3.5.0 * @since 3.5.0
*
* @static
* @access public * @access public
* *
* @param string $mime_type * @param string $mime_type

View File

@ -31,6 +31,8 @@ abstract class WP_Image_Editor {
* Must be overridden in a sub-class. * Must be overridden in a sub-class.
* *
* @since 3.5.0 * @since 3.5.0
*
* @static
* @access public * @access public
* @abstract * @abstract
* *
@ -46,6 +48,8 @@ abstract class WP_Image_Editor {
* Must be overridden in a sub-class. * Must be overridden in a sub-class.
* *
* @since 3.5.0 * @since 3.5.0
*
* @static
* @access public * @access public
* @abstract * @abstract
* *
@ -442,6 +446,8 @@ abstract class WP_Image_Editor {
* as mapped from wp_get_mime_types() * as mapped from wp_get_mime_types()
* *
* @since 3.5.0 * @since 3.5.0
*
* @static
* @access protected * @access protected
* *
* @param string $extension * @param string $extension
@ -468,6 +474,8 @@ abstract class WP_Image_Editor {
* as mapped from wp_get_mime_types() * as mapped from wp_get_mime_types()
* *
* @since 3.5.0 * @since 3.5.0
*
* @static
* @access protected * @access protected
* *
* @param string $mime_type * @param string $mime_type

View File

@ -687,7 +687,7 @@ final class WP_Theme implements ArrayAccess {
* @since 3.4.0 * @since 3.4.0
* @access private * @access private
* *
* @stativar string $comma * @staticvar string $comma
* *
* @param string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags. * @param string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags.
* @param string $value Value to mark up. * @param string $value Value to mark up.

View File

@ -2558,6 +2558,8 @@ function wp_defer_comment_counting($defer=null) {
* @since 2.1.0 * @since 2.1.0
* @see wp_update_comment_count_now() For what could cause a false return value * @see wp_update_comment_count_now() For what could cause a false return value
* *
* @staticvar array $_deferred
*
* @param int $post_id Post ID * @param int $post_id Post ID
* @param bool $do_deferred Whether to process previously deferred post comment counts * @param bool $do_deferred Whether to process previously deferred post comment counts
* @return bool|void True on success, false on failure * @return bool|void True on success, false on failure

View File

@ -20,6 +20,8 @@ if ( !function_exists('_') ) {
* @since 4.2.2 * @since 4.2.2
* @access private * @access private
* *
* @staticvar string $utf8_pcre
*
* @param bool $set - Used for testing only * @param bool $set - Used for testing only
* null : default - get PCRE/u capability * null : default - get PCRE/u capability
* false : Used for testing - return false for future calls to this function * false : Used for testing - return false for future calls to this function

View File

@ -644,10 +644,14 @@ class WP_Widget_Categories extends WP_Widget {
} }
/** /**
* @staticvar bool $first_dropdown
*
* @param array $args * @param array $args
* @param array $instance * @param array $instance
*/ */
public function widget( $args, $instance ) { public function widget( $args, $instance ) {
static $first_dropdown = true;
/** This filter is documented in wp-includes/default-widgets.php */ /** This filter is documented in wp-includes/default-widgets.php */
$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title'], $instance, $this->id_base ); $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title'], $instance, $this->id_base );
@ -667,8 +671,6 @@ class WP_Widget_Categories extends WP_Widget {
); );
if ( $d ) { if ( $d ) {
static $first_dropdown = true;
$dropdown_id = ( $first_dropdown ) ? 'cat' : "{$this->id_base}-dropdown-{$this->number}"; $dropdown_id = ( $first_dropdown ) ? 'cat' : "{$this->id_base}-dropdown-{$this->number}";
$first_dropdown = false; $first_dropdown = false;

View File

@ -38,8 +38,13 @@
*/ */
function wptexturize( $text, $reset = false ) { function wptexturize( $text, $reset = false ) {
global $wp_cockneyreplace, $shortcode_tags; global $wp_cockneyreplace, $shortcode_tags;
static $static_characters, $static_replacements, $dynamic_characters, $dynamic_replacements, static $static_characters = null,
$default_no_texturize_tags, $default_no_texturize_shortcodes, $run_texturize = true; $static_replacements = null,
$dynamic_characters = null,
$dynamic_replacements = null,
$default_no_texturize_tags = null,
$default_no_texturize_shortcodes = null,
$run_texturize = true;
// If there's nothing to do, just stop. // If there's nothing to do, just stop.
if ( empty( $text ) || false === $run_texturize ) { if ( empty( $text ) || false === $run_texturize ) {
@ -630,7 +635,7 @@ function seems_utf8( $str ) {
* @since 1.2.2 * @since 1.2.2
* @access private * @access private
* *
* @staticvar string|false $_charset * @staticvar string $_charset
* *
* @param string $string The text which is to be encoded. * @param string $string The text which is to be encoded.
* @param int $quote_style Optional. Converts double quotes if set to ENT_COMPAT, both single and double if set to ENT_QUOTES or none if set to ENT_NOQUOTES. Also compatible with old values; converting single quotes if set to 'single', double if set to 'double' or both if otherwise set. Default is ENT_NOQUOTES. * @param int $quote_style Optional. Converts double quotes if set to ENT_COMPAT, both single and double if set to ENT_QUOTES or none if set to ENT_NOQUOTES. Also compatible with old values; converting single quotes if set to 'single', double if set to 'double' or both if otherwise set. Default is ENT_NOQUOTES.
@ -656,7 +661,7 @@ function _wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = fals
// Store the site charset as a static to avoid multiple calls to wp_load_alloptions() // Store the site charset as a static to avoid multiple calls to wp_load_alloptions()
if ( ! $charset ) { if ( ! $charset ) {
static $_charset; static $_charset = null;
if ( ! isset( $_charset ) ) { if ( ! isset( $_charset ) ) {
$alloptions = wp_load_alloptions(); $alloptions = wp_load_alloptions();
$_charset = isset( $alloptions['blog_charset'] ) ? $alloptions['blog_charset'] : ''; $_charset = isset( $alloptions['blog_charset'] ) ? $alloptions['blog_charset'] : '';
@ -790,7 +795,7 @@ function wp_check_invalid_utf8( $string, $strip = false ) {
} }
// Store the site charset as a static to avoid multiple calls to get_option() // Store the site charset as a static to avoid multiple calls to get_option()
static $is_utf8; static $is_utf8 = null;
if ( ! isset( $is_utf8 ) ) { if ( ! isset( $is_utf8 ) ) {
$is_utf8 = in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ); $is_utf8 = in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) );
} }
@ -799,7 +804,7 @@ function wp_check_invalid_utf8( $string, $strip = false ) {
} }
// Check for support for utf8 in the installed PCRE library once and store the result in a static // Check for support for utf8 in the installed PCRE library once and store the result in a static
static $utf8_pcre; static $utf8_pcre = null;
if ( ! isset( $utf8_pcre ) ) { if ( ! isset( $utf8_pcre ) ) {
$utf8_pcre = @preg_match( '/^./u', 'a' ); $utf8_pcre = @preg_match( '/^./u', 'a' );
} }
@ -3959,13 +3964,13 @@ function capital_P_dangit( $text ) {
return str_replace( 'Wordpress', 'WordPress', $text ); return str_replace( 'Wordpress', 'WordPress', $text );
// Still here? Use the more judicious replacement // Still here? Use the more judicious replacement
static $dblq = false; static $dblq = false;
if ( false === $dblq ) if ( false === $dblq ) {
$dblq = _x( '“', 'opening curly double quote' ); $dblq = _x( '“', 'opening curly double quote' );
}
return str_replace( return str_replace(
array( ' Wordpress', '‘Wordpress', $dblq . 'Wordpress', '>Wordpress', '(Wordpress' ), array( ' Wordpress', '‘Wordpress', $dblq . 'Wordpress', '>Wordpress', '(Wordpress' ),
array( ' WordPress', '‘WordPress', $dblq . 'WordPress', '>WordPress', '(WordPress' ), array( ' WordPress', '‘WordPress', $dblq . 'WordPress', '>WordPress', '(WordPress' ),
$text ); $text );
} }
/** /**
@ -4095,7 +4100,7 @@ function get_url_in_content( $content ) {
* @return string The spaces regexp. * @return string The spaces regexp.
*/ */
function wp_spaces_regexp() { function wp_spaces_regexp() {
static $spaces; static $spaces = '';
if ( empty( $spaces ) ) { if ( empty( $spaces ) ) {
/** /**

View File

@ -1621,7 +1621,7 @@ function wp_normalize_path( $path ) {
* @return string Writable temporary directory. * @return string Writable temporary directory.
*/ */
function get_temp_dir() { function get_temp_dir() {
static $temp; static $temp = '';
if ( defined('WP_TEMP_DIR') ) if ( defined('WP_TEMP_DIR') )
return trailingslashit(WP_TEMP_DIR); return trailingslashit(WP_TEMP_DIR);
@ -4483,7 +4483,7 @@ function send_frame_options_header() {
* @return array Array of allowed protocols. * @return array Array of allowed protocols.
*/ */
function wp_allowed_protocols() { function wp_allowed_protocols() {
static $protocols; static $protocols = array();
if ( empty( $protocols ) ) { if ( empty( $protocols ) ) {
$protocols = array( 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn', 'tel', 'fax', 'xmpp', 'webcal' ); $protocols = array( 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn', 'tel', 'fax', 'xmpp', 'webcal' );

View File

@ -22,11 +22,11 @@
* @return WP_Http HTTP Transport object. * @return WP_Http HTTP Transport object.
*/ */
function _wp_http_get_object() { function _wp_http_get_object() {
static $http; static $http = null;
if ( is_null($http) ) if ( is_null( $http ) ) {
$http = new WP_Http(); $http = new WP_Http();
}
return $http; return $http;
} }

View File

@ -2146,11 +2146,11 @@ Thanks!
* *
* @staticvar bool $forced_content * @staticvar bool $forced_content
* *
* @param string|bool $force * @param bool $force
* @return bool True if forced, false if not forced. * @return bool True if forced, false if not forced.
*/ */
function force_ssl_content( $force = '' ) { function force_ssl_content( $force = '' ) {
static $forced_content; static $forced_content = false;
if ( '' != $force ) { if ( '' != $force ) {
$old_forced = $forced_content; $old_forced = $forced_content;

View File

@ -689,7 +689,7 @@ function wp_register_plugin_realpath( $file ) {
global $wp_plugin_paths; global $wp_plugin_paths;
// Normalize, but store as static to avoid recalculation of a constant value // Normalize, but store as static to avoid recalculation of a constant value
static $wp_plugin_path, $wpmu_plugin_path; static $wp_plugin_path = null, $wpmu_plugin_path = null;
if ( ! isset( $wp_plugin_path ) ) { if ( ! isset( $wp_plugin_path ) ) {
$wp_plugin_path = wp_normalize_path( WP_PLUGIN_DIR ); $wp_plugin_path = wp_normalize_path( WP_PLUGIN_DIR );
$wpmu_plugin_path = wp_normalize_path( WPMU_PLUGIN_DIR ); $wpmu_plugin_path = wp_normalize_path( WPMU_PLUGIN_DIR );

View File

@ -355,6 +355,7 @@ class PO extends Gettext_Translations {
/** /**
* @staticvar string $last_line * @staticvar string $last_line
* @staticvar boolean $use_last_line * @staticvar boolean $use_last_line
*
* @param resource $f * @param resource $f
* @param string $action * @param string $action
* @return boolean * @return boolean

View File

@ -16,16 +16,16 @@
* @since 2.6.0 * @since 2.6.0
* @access private * @access private
* *
* @staticvar array|false $fields * @staticvar array $fields
* *
* @param array $post Optional. A post array to be processed for insertion as a post revision. * @param array $post Optional. A post array to be processed for insertion as a post revision.
* @param bool $autosave Optional. Is the revision an autosave? * @param bool $autosave Optional. Is the revision an autosave?
* @return array Post array ready to be inserted as a post revision or array of fields that can be versioned. * @return array Post array ready to be inserted as a post revision or array of fields that can be versioned.
*/ */
function _wp_post_revision_fields( $post = null, $autosave = false ) { function _wp_post_revision_fields( $post = null, $autosave = false ) {
static $fields = false; static $fields = null;
if ( !$fields ) { if ( is_null( $fields ) ) {
// Allow these to be versioned // Allow these to be versioned
$fields = array( $fields = array(
'post_title' => __( 'Title' ), 'post_title' => __( 'Title' ),

View File

@ -2170,7 +2170,7 @@ class WP_Rewrite {
* @param bool $hard Whether to update .htaccess (hard flush) or just update rewrite_rules option (soft flush). Default is true (hard). * @param bool $hard Whether to update .htaccess (hard flush) or just update rewrite_rules option (soft flush). Default is true (hard).
*/ */
public function flush_rules( $hard = true ) { public function flush_rules( $hard = true ) {
static $do_hard_later; static $do_hard_later = null;
// Prevent this action from running before everyone has registered their rewrites // Prevent this action from running before everyone has registered their rewrites
if ( ! did_action( 'wp_loaded' ) ) { if ( ! did_action( 'wp_loaded' ) ) {

View File

@ -410,10 +410,11 @@ function register_theme_directory( $directory ) {
*/ */
function search_theme_directories( $force = false ) { function search_theme_directories( $force = false ) {
global $wp_theme_directories; global $wp_theme_directories;
static $found_themes = null;
if ( empty( $wp_theme_directories ) ) if ( empty( $wp_theme_directories ) )
return false; return false;
static $found_themes;
if ( ! $force && isset( $found_themes ) ) if ( ! $force && isset( $found_themes ) )
return $found_themes; return $found_themes;
@ -1105,7 +1106,7 @@ function get_header_image() {
* @return object * @return object
*/ */
function _get_random_header_data() { function _get_random_header_data() {
static $_wp_random_header; static $_wp_random_header = null;
if ( empty( $_wp_random_header ) ) { if ( empty( $_wp_random_header ) ) {
global $_wp_default_headers; global $_wp_default_headers;

View File

@ -118,13 +118,16 @@ $is_iis7 = $is_IIS && intval( substr( $_SERVER['SERVER_SOFTWARE'], strpos( $_SER
/** /**
* Test if the current browser runs on a mobile device (smart phone, tablet, etc.) * Test if the current browser runs on a mobile device (smart phone, tablet, etc.)
* *
* @staticvar bool $is_mobile
*
* @return bool true|false * @return bool true|false
*/ */
function wp_is_mobile() { function wp_is_mobile() {
static $is_mobile; static $is_mobile = null;
if ( isset($is_mobile) ) if ( isset( $is_mobile ) ) {
return $is_mobile; return $is_mobile;
}
if ( empty($_SERVER['HTTP_USER_AGENT']) ) { if ( empty($_SERVER['HTTP_USER_AGENT']) ) {
$is_mobile = false; $is_mobile = false;

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.3-alpha-32649'; $wp_version = '4.3-alpha-32650';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.