Reduce references to the $wp_rewrite global because it's no longer used or a wrapper function can be used instead. Fixes #14546.#14546.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20023 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b367a71d1a
commit
a395e06896
|
@ -30,7 +30,7 @@ if ( isset($_GET['import']) && !defined('WP_LOAD_IMPORTERS') )
|
|||
require_once(dirname(dirname(__FILE__)) . '/wp-load.php');
|
||||
|
||||
if ( get_option('db_upgraded') ) {
|
||||
$wp_rewrite->flush_rules();
|
||||
flush_rewrite_rules();
|
||||
update_option( 'db_upgraded', false );
|
||||
|
||||
/**
|
||||
|
|
|
@ -196,17 +196,15 @@ function update_recently_edited( $file ) {
|
|||
*
|
||||
* @since 2.1.0
|
||||
*
|
||||
* @param unknown_type $old_value
|
||||
* @param unknown_type $value
|
||||
* @param string $old_value
|
||||
* @param string $value
|
||||
*/
|
||||
function update_home_siteurl( $old_value, $value ) {
|
||||
global $wp_rewrite;
|
||||
|
||||
if ( defined( "WP_INSTALLING" ) )
|
||||
return;
|
||||
|
||||
// If home changed, write rewrite rules to new location.
|
||||
$wp_rewrite->flush_rules();
|
||||
flush_rewrite_rules();
|
||||
}
|
||||
|
||||
add_action( 'update_option_home', 'update_home_siteurl', 10, 2 );
|
||||
|
|
|
@ -821,7 +821,7 @@ endif;
|
|||
* so the error code must be checked) or failure.
|
||||
*/
|
||||
function populate_network( $network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $subdomain_install = false ) {
|
||||
global $wpdb, $current_site, $wp_db_version, $wp_rewrite;
|
||||
global $wpdb, $current_site, $wp_db_version;
|
||||
|
||||
$errors = new WP_Error();
|
||||
if ( '' == $domain )
|
||||
|
@ -942,7 +942,7 @@ We hope you enjoy your new site. Thanks!
|
|||
else
|
||||
update_option( 'permalink_structure', '/blog/%year%/%monthnum%/%day%/%postname%/');
|
||||
|
||||
$wp_rewrite->flush_rules();
|
||||
flush_rewrite_rules();
|
||||
|
||||
if ( $subdomain_install ) {
|
||||
$vhost_ok = false;
|
||||
|
|
|
@ -35,8 +35,6 @@ if ( !function_exists('wp_install') ) :
|
|||
* @return array Array keys 'url', 'user_id', 'password', 'password_message'.
|
||||
*/
|
||||
function wp_install( $blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '' ) {
|
||||
global $wp_rewrite;
|
||||
|
||||
if ( !empty( $deprecated ) )
|
||||
_deprecated_argument( __FUNCTION__, '2.6' );
|
||||
|
||||
|
@ -82,7 +80,7 @@ function wp_install( $blog_title, $user_name, $user_email, $public, $deprecated
|
|||
|
||||
wp_install_defaults($user_id);
|
||||
|
||||
$wp_rewrite->flush_rules();
|
||||
flush_rewrite_rules();
|
||||
|
||||
wp_new_blog_notification($blog_title, $guessurl, $user_id, ($email_password ? $user_password : __('The password you chose during the install.') ) );
|
||||
|
||||
|
@ -391,7 +389,7 @@ endif;
|
|||
* @since 1.0.1
|
||||
*/
|
||||
function upgrade_all() {
|
||||
global $wp_current_db_version, $wp_db_version, $wp_rewrite;
|
||||
global $wp_current_db_version, $wp_db_version;
|
||||
$wp_current_db_version = __get_option('db_version');
|
||||
|
||||
// We are up-to-date. Nothing to do.
|
||||
|
|
|
@ -140,7 +140,7 @@ if ( $wp_rewrite->using_index_permalinks() )
|
|||
else
|
||||
$usingpi = false;
|
||||
|
||||
$wp_rewrite->flush_rules();
|
||||
flush_rewrite_rules();
|
||||
|
||||
if (isset($_POST['submit'])) : ?>
|
||||
<div id="message" class="updated"><p><?php
|
||||
|
|
|
@ -605,7 +605,6 @@ function default_topic_count_scale( $count ) {
|
|||
* @return string
|
||||
*/
|
||||
function wp_generate_tag_cloud( $tags, $args = '' ) {
|
||||
global $wp_rewrite;
|
||||
$defaults = array(
|
||||
'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 0,
|
||||
'format' => 'flat', 'separator' => "\n", 'orderby' => 'name', 'order' => 'ASC',
|
||||
|
|
|
@ -589,8 +589,6 @@ function get_category_feed_link($cat_id, $feed = '') {
|
|||
* @return string Link to the feed for the term specified by $term_id and $taxonomy.
|
||||
*/
|
||||
function get_term_feed_link( $term_id, $taxonomy = 'category', $feed = '' ) {
|
||||
global $wp_rewrite;
|
||||
|
||||
$term_id = ( int ) $term_id;
|
||||
|
||||
$term = get_term( $term_id, $taxonomy );
|
||||
|
|
|
@ -1006,9 +1006,9 @@ function register_post_type($post_type, $args = array()) {
|
|||
}
|
||||
|
||||
if ( $args->hierarchical )
|
||||
$wp_rewrite->add_rewrite_tag("%$post_type%", '(.+?)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=");
|
||||
add_rewrite_tag("%$post_type%", '(.+?)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=");
|
||||
else
|
||||
$wp_rewrite->add_rewrite_tag("%$post_type%", '([^/]+)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=");
|
||||
add_rewrite_tag("%$post_type%", '([^/]+)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=");
|
||||
|
||||
if ( $args->has_archive ) {
|
||||
$archive_slug = $args->has_archive === true ? $args->rewrite['slug'] : $args->has_archive;
|
||||
|
@ -1017,17 +1017,17 @@ function register_post_type($post_type, $args = array()) {
|
|||
else
|
||||
$archive_slug = $wp_rewrite->root . $archive_slug;
|
||||
|
||||
$wp_rewrite->add_rule( "{$archive_slug}/?$", "index.php?post_type=$post_type", 'top' );
|
||||
add_rewrite_rule( "{$archive_slug}/?$", "index.php?post_type=$post_type", 'top' );
|
||||
if ( $args->rewrite['feeds'] && $wp_rewrite->feeds ) {
|
||||
$feeds = '(' . trim( implode( '|', $wp_rewrite->feeds ) ) . ')';
|
||||
$wp_rewrite->add_rule( "{$archive_slug}/feed/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
|
||||
$wp_rewrite->add_rule( "{$archive_slug}/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
|
||||
add_rewrite_rule( "{$archive_slug}/feed/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
|
||||
add_rewrite_rule( "{$archive_slug}/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
|
||||
}
|
||||
if ( $args->rewrite['pages'] )
|
||||
$wp_rewrite->add_rule( "{$archive_slug}/{$wp_rewrite->pagination_base}/([0-9]{1,})/?$", "index.php?post_type=$post_type" . '&paged=$matches[1]', 'top' );
|
||||
add_rewrite_rule( "{$archive_slug}/{$wp_rewrite->pagination_base}/([0-9]{1,})/?$", "index.php?post_type=$post_type" . '&paged=$matches[1]', 'top' );
|
||||
}
|
||||
|
||||
$wp_rewrite->add_permastruct( $post_type, "{$args->rewrite['slug']}/%$post_type%", $args->rewrite );
|
||||
add_permastruct( $post_type, "{$args->rewrite['slug']}/%$post_type%", $args->rewrite );
|
||||
}
|
||||
|
||||
if ( $args->register_meta_box_cb )
|
||||
|
@ -1961,7 +1961,7 @@ function wp_post_mime_type_where($post_mime_types, $table_alias = '') {
|
|||
* @return mixed False on failure
|
||||
*/
|
||||
function wp_delete_post( $postid = 0, $force_delete = false ) {
|
||||
global $wpdb, $wp_rewrite;
|
||||
global $wpdb;
|
||||
|
||||
if ( !$post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $postid)) )
|
||||
return $post;
|
||||
|
@ -2399,7 +2399,6 @@ function wp_get_single_post($postid = 0, $mode = OBJECT) {
|
|||
*
|
||||
* @since 1.0.0
|
||||
* @uses $wpdb
|
||||
* @uses $wp_rewrite
|
||||
* @uses $user_ID
|
||||
* @uses do_action() Calls 'pre_post_update' on post ID if this is an update.
|
||||
* @uses do_action() Calls 'edit_post' action on post ID and post data if this is an update.
|
||||
|
@ -2412,7 +2411,7 @@ function wp_get_single_post($postid = 0, $mode = OBJECT) {
|
|||
* @return int|WP_Error The value 0 or WP_Error on failure. The post ID on success.
|
||||
*/
|
||||
function wp_insert_post($postarr, $wp_error = false) {
|
||||
global $wpdb, $wp_rewrite, $user_ID;
|
||||
global $wpdb, $user_ID;
|
||||
|
||||
$defaults = array('post_status' => 'draft', 'post_type' => 'post', 'post_author' => $user_ID,
|
||||
'ping_status' => get_option('default_ping_status'), 'post_parent' => 0,
|
||||
|
|
|
@ -296,7 +296,6 @@ function is_taxonomy_hierarchical($taxonomy) {
|
|||
* @subpackage Taxonomy
|
||||
* @since 2.3.0
|
||||
* @uses $wp_taxonomies Inserts new taxonomy object into the list
|
||||
* @uses $wp_rewrite Adds rewrite tags and permastructs
|
||||
* @uses $wp Adds query vars
|
||||
*
|
||||
* @param string $taxonomy Name of taxonomy object
|
||||
|
@ -304,7 +303,7 @@ function is_taxonomy_hierarchical($taxonomy) {
|
|||
* @param array|string $args See above description for the two keys values.
|
||||
*/
|
||||
function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
|
||||
global $wp_taxonomies, $wp_rewrite, $wp;
|
||||
global $wp_taxonomies, $wp;
|
||||
|
||||
if ( ! is_array($wp_taxonomies) )
|
||||
$wp_taxonomies = array();
|
||||
|
@ -343,8 +342,8 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
|
|||
else
|
||||
$tag = '([^/]+)';
|
||||
|
||||
$wp_rewrite->add_rewrite_tag("%$taxonomy%", $tag, $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term=");
|
||||
$wp_rewrite->add_permastruct( $taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite'] );
|
||||
add_rewrite_tag( "%$taxonomy%", $tag, $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term=" );
|
||||
add_permastruct( $taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite'] );
|
||||
}
|
||||
|
||||
if ( is_null($args['show_ui']) )
|
||||
|
|
Loading…
Reference in New Issue