mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
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');
|
require_once(dirname(dirname(__FILE__)) . '/wp-load.php');
|
||||||
|
|
||||||
if ( get_option('db_upgraded') ) {
|
if ( get_option('db_upgraded') ) {
|
||||||
$wp_rewrite->flush_rules();
|
flush_rewrite_rules();
|
||||||
update_option( 'db_upgraded', false );
|
update_option( 'db_upgraded', false );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -196,17 +196,15 @@ function update_recently_edited( $file ) {
|
|||||||
*
|
*
|
||||||
* @since 2.1.0
|
* @since 2.1.0
|
||||||
*
|
*
|
||||||
* @param unknown_type $old_value
|
* @param string $old_value
|
||||||
* @param unknown_type $value
|
* @param string $value
|
||||||
*/
|
*/
|
||||||
function update_home_siteurl( $old_value, $value ) {
|
function update_home_siteurl( $old_value, $value ) {
|
||||||
global $wp_rewrite;
|
|
||||||
|
|
||||||
if ( defined( "WP_INSTALLING" ) )
|
if ( defined( "WP_INSTALLING" ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// If home changed, write rewrite rules to new location.
|
// 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 );
|
add_action( 'update_option_home', 'update_home_siteurl', 10, 2 );
|
||||||
|
@ -821,7 +821,7 @@ endif;
|
|||||||
* so the error code must be checked) or failure.
|
* so the error code must be checked) or failure.
|
||||||
*/
|
*/
|
||||||
function populate_network( $network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $subdomain_install = false ) {
|
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();
|
$errors = new WP_Error();
|
||||||
if ( '' == $domain )
|
if ( '' == $domain )
|
||||||
@ -942,7 +942,7 @@ We hope you enjoy your new site. Thanks!
|
|||||||
else
|
else
|
||||||
update_option( 'permalink_structure', '/blog/%year%/%monthnum%/%day%/%postname%/');
|
update_option( 'permalink_structure', '/blog/%year%/%monthnum%/%day%/%postname%/');
|
||||||
|
|
||||||
$wp_rewrite->flush_rules();
|
flush_rewrite_rules();
|
||||||
|
|
||||||
if ( $subdomain_install ) {
|
if ( $subdomain_install ) {
|
||||||
$vhost_ok = false;
|
$vhost_ok = false;
|
||||||
|
@ -35,8 +35,6 @@ if ( !function_exists('wp_install') ) :
|
|||||||
* @return array Array keys 'url', 'user_id', 'password', 'password_message'.
|
* @return array Array keys 'url', 'user_id', 'password', 'password_message'.
|
||||||
*/
|
*/
|
||||||
function wp_install( $blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '' ) {
|
function wp_install( $blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '' ) {
|
||||||
global $wp_rewrite;
|
|
||||||
|
|
||||||
if ( !empty( $deprecated ) )
|
if ( !empty( $deprecated ) )
|
||||||
_deprecated_argument( __FUNCTION__, '2.6' );
|
_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_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.') ) );
|
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
|
* @since 1.0.1
|
||||||
*/
|
*/
|
||||||
function upgrade_all() {
|
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');
|
$wp_current_db_version = __get_option('db_version');
|
||||||
|
|
||||||
// We are up-to-date. Nothing to do.
|
// We are up-to-date. Nothing to do.
|
||||||
|
@ -140,7 +140,7 @@ if ( $wp_rewrite->using_index_permalinks() )
|
|||||||
else
|
else
|
||||||
$usingpi = false;
|
$usingpi = false;
|
||||||
|
|
||||||
$wp_rewrite->flush_rules();
|
flush_rewrite_rules();
|
||||||
|
|
||||||
if (isset($_POST['submit'])) : ?>
|
if (isset($_POST['submit'])) : ?>
|
||||||
<div id="message" class="updated"><p><?php
|
<div id="message" class="updated"><p><?php
|
||||||
|
@ -605,7 +605,6 @@ function default_topic_count_scale( $count ) {
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function wp_generate_tag_cloud( $tags, $args = '' ) {
|
function wp_generate_tag_cloud( $tags, $args = '' ) {
|
||||||
global $wp_rewrite;
|
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 0,
|
'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 0,
|
||||||
'format' => 'flat', 'separator' => "\n", 'orderby' => 'name', 'order' => 'ASC',
|
'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.
|
* @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 = '' ) {
|
function get_term_feed_link( $term_id, $taxonomy = 'category', $feed = '' ) {
|
||||||
global $wp_rewrite;
|
|
||||||
|
|
||||||
$term_id = ( int ) $term_id;
|
$term_id = ( int ) $term_id;
|
||||||
|
|
||||||
$term = get_term( $term_id, $taxonomy );
|
$term = get_term( $term_id, $taxonomy );
|
||||||
|
@ -1006,9 +1006,9 @@ function register_post_type($post_type, $args = array()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( $args->hierarchical )
|
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
|
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 ) {
|
if ( $args->has_archive ) {
|
||||||
$archive_slug = $args->has_archive === true ? $args->rewrite['slug'] : $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
|
else
|
||||||
$archive_slug = $wp_rewrite->root . $archive_slug;
|
$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 ) {
|
if ( $args->rewrite['feeds'] && $wp_rewrite->feeds ) {
|
||||||
$feeds = '(' . trim( implode( '|', $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' );
|
add_rewrite_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}/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
|
||||||
}
|
}
|
||||||
if ( $args->rewrite['pages'] )
|
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 )
|
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
|
* @return mixed False on failure
|
||||||
*/
|
*/
|
||||||
function wp_delete_post( $postid = 0, $force_delete = false ) {
|
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)) )
|
if ( !$post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $postid)) )
|
||||||
return $post;
|
return $post;
|
||||||
@ -2399,7 +2399,6 @@ function wp_get_single_post($postid = 0, $mode = OBJECT) {
|
|||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @uses $wpdb
|
* @uses $wpdb
|
||||||
* @uses $wp_rewrite
|
|
||||||
* @uses $user_ID
|
* @uses $user_ID
|
||||||
* @uses do_action() Calls 'pre_post_update' on post ID if this is an update.
|
* @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.
|
* @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.
|
* @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) {
|
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,
|
$defaults = array('post_status' => 'draft', 'post_type' => 'post', 'post_author' => $user_ID,
|
||||||
'ping_status' => get_option('default_ping_status'), 'post_parent' => 0,
|
'ping_status' => get_option('default_ping_status'), 'post_parent' => 0,
|
||||||
|
@ -296,7 +296,6 @@ function is_taxonomy_hierarchical($taxonomy) {
|
|||||||
* @subpackage Taxonomy
|
* @subpackage Taxonomy
|
||||||
* @since 2.3.0
|
* @since 2.3.0
|
||||||
* @uses $wp_taxonomies Inserts new taxonomy object into the list
|
* @uses $wp_taxonomies Inserts new taxonomy object into the list
|
||||||
* @uses $wp_rewrite Adds rewrite tags and permastructs
|
|
||||||
* @uses $wp Adds query vars
|
* @uses $wp Adds query vars
|
||||||
*
|
*
|
||||||
* @param string $taxonomy Name of taxonomy object
|
* @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.
|
* @param array|string $args See above description for the two keys values.
|
||||||
*/
|
*/
|
||||||
function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
|
function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
|
||||||
global $wp_taxonomies, $wp_rewrite, $wp;
|
global $wp_taxonomies, $wp;
|
||||||
|
|
||||||
if ( ! is_array($wp_taxonomies) )
|
if ( ! is_array($wp_taxonomies) )
|
||||||
$wp_taxonomies = array();
|
$wp_taxonomies = array();
|
||||||
@ -343,8 +342,8 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
|
|||||||
else
|
else
|
||||||
$tag = '([^/]+)';
|
$tag = '([^/]+)';
|
||||||
|
|
||||||
$wp_rewrite->add_rewrite_tag("%$taxonomy%", $tag, $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term=");
|
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_permastruct( $taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( is_null($args['show_ui']) )
|
if ( is_null($args['show_ui']) )
|
||||||
|
Loading…
Reference in New Issue
Block a user