WordPress.org

Make WordPress Core

Changeset 20023


Ignore:
Timestamp:
02/28/2012 08:29:33 PM (7 years ago)
Author:
duck_
Message:

Reduce references to the $wp_rewrite global because it's no longer used or a wrapper function can be used instead. Fixes #14546.#14546.

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin.php

    r19712 r20023  
    3131
    3232if ( get_option('db_upgraded') ) {
    33     $wp_rewrite->flush_rules();
     33    flush_rewrite_rules();
    3434    update_option( 'db_upgraded',  false );
    3535
  • trunk/wp-admin/includes/misc.php

    r19712 r20023  
    197197 * @since 2.1.0
    198198 *
    199  * @param unknown_type $old_value
    200  * @param unknown_type $value
     199 * @param string $old_value
     200 * @param string $value
    201201 */
    202202function update_home_siteurl( $old_value, $value ) {
    203     global $wp_rewrite;
    204 
    205203    if ( defined( "WP_INSTALLING" ) )
    206204        return;
    207205
    208206    // If home changed, write rewrite rules to new location.
    209     $wp_rewrite->flush_rules();
     207    flush_rewrite_rules();
    210208}
    211209
  • trunk/wp-admin/includes/schema.php

    r19863 r20023  
    822822 */
    823823function populate_network( $network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $subdomain_install = false ) {
    824     global $wpdb, $current_site, $wp_db_version, $wp_rewrite;
     824    global $wpdb, $current_site, $wp_db_version;
    825825
    826826    $errors = new WP_Error();
     
    943943        update_option( 'permalink_structure', '/blog/%year%/%monthnum%/%day%/%postname%/');
    944944
    945     $wp_rewrite->flush_rules();
     945    flush_rewrite_rules();
    946946
    947947    if ( $subdomain_install ) {
  • trunk/wp-admin/includes/upgrade.php

    r20022 r20023  
    3636 */
    3737function wp_install( $blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '' ) {
    38     global $wp_rewrite;
    39 
    4038    if ( !empty( $deprecated ) )
    4139        _deprecated_argument( __FUNCTION__, '2.6' );
     
    8381    wp_install_defaults($user_id);
    8482
    85     $wp_rewrite->flush_rules();
     83    flush_rewrite_rules();
    8684
    8785    wp_new_blog_notification($blog_title, $guessurl, $user_id, ($email_password ? $user_password : __('The password you chose during the install.') ) );
     
    392390 */
    393391function upgrade_all() {
    394     global $wp_current_db_version, $wp_db_version, $wp_rewrite;
     392    global $wp_current_db_version, $wp_db_version;
    395393    $wp_current_db_version = __get_option('db_version');
    396394
  • trunk/wp-admin/options-permalink.php

    r19684 r20023  
    141141    $usingpi = false;
    142142
    143 $wp_rewrite->flush_rules();
     143flush_rewrite_rules();
    144144
    145145if (isset($_POST['submit'])) : ?>
  • trunk/wp-includes/category-template.php

    r19927 r20023  
    606606 */
    607607function wp_generate_tag_cloud( $tags, $args = '' ) {
    608     global $wp_rewrite;
    609608    $defaults = array(
    610609        'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 0,
  • trunk/wp-includes/link-template.php

    r20000 r20023  
    590590*/
    591591function get_term_feed_link( $term_id, $taxonomy = 'category', $feed = '' ) {
    592     global $wp_rewrite;
    593 
    594592    $term_id = ( int ) $term_id;
    595593
  • trunk/wp-includes/post.php

    r19924 r20023  
    10071007
    10081008        if ( $args->hierarchical )
    1009             $wp_rewrite->add_rewrite_tag("%$post_type%", '(.+?)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=");
     1009            add_rewrite_tag("%$post_type%", '(.+?)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=");
    10101010        else
    1011             $wp_rewrite->add_rewrite_tag("%$post_type%", '([^/]+)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=");
     1011            add_rewrite_tag("%$post_type%", '([^/]+)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=");
    10121012
    10131013        if ( $args->has_archive ) {
     
    10181018                $archive_slug = $wp_rewrite->root . $archive_slug;
    10191019
    1020             $wp_rewrite->add_rule( "{$archive_slug}/?$", "index.php?post_type=$post_type", 'top' );
     1020            add_rewrite_rule( "{$archive_slug}/?$", "index.php?post_type=$post_type", 'top' );
    10211021            if ( $args->rewrite['feeds'] && $wp_rewrite->feeds ) {
    10221022                $feeds = '(' . trim( implode( '|', $wp_rewrite->feeds ) ) . ')';
    1023                 $wp_rewrite->add_rule( "{$archive_slug}/feed/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
    1024                 $wp_rewrite->add_rule( "{$archive_slug}/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
     1023                add_rewrite_rule( "{$archive_slug}/feed/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
     1024                add_rewrite_rule( "{$archive_slug}/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
    10251025            }
    10261026            if ( $args->rewrite['pages'] )
    1027                 $wp_rewrite->add_rule( "{$archive_slug}/{$wp_rewrite->pagination_base}/([0-9]{1,})/?$", "index.php?post_type=$post_type" . '&paged=$matches[1]', 'top' );
     1027                add_rewrite_rule( "{$archive_slug}/{$wp_rewrite->pagination_base}/([0-9]{1,})/?$", "index.php?post_type=$post_type" . '&paged=$matches[1]', 'top' );
    10281028        }
    10291029
    1030         $wp_rewrite->add_permastruct( $post_type, "{$args->rewrite['slug']}/%$post_type%", $args->rewrite );
     1030        add_permastruct( $post_type, "{$args->rewrite['slug']}/%$post_type%", $args->rewrite );
    10311031    }
    10321032
     
    19621962 */
    19631963function wp_delete_post( $postid = 0, $force_delete = false ) {
    1964     global $wpdb, $wp_rewrite;
     1964    global $wpdb;
    19651965
    19661966    if ( !$post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $postid)) )
     
    24002400 * @since 1.0.0
    24012401 * @uses $wpdb
    2402  * @uses $wp_rewrite
    24032402 * @uses $user_ID
    24042403 * @uses do_action() Calls 'pre_post_update' on post ID if this is an update.
     
    24132412 */
    24142413function wp_insert_post($postarr, $wp_error = false) {
    2415     global $wpdb, $wp_rewrite, $user_ID;
     2414    global $wpdb, $user_ID;
    24162415
    24172416    $defaults = array('post_status' => 'draft', 'post_type' => 'post', 'post_author' => $user_ID,
  • trunk/wp-includes/taxonomy.php

    r19975 r20023  
    297297 * @since 2.3.0
    298298 * @uses $wp_taxonomies Inserts new taxonomy object into the list
    299  * @uses $wp_rewrite Adds rewrite tags and permastructs
    300299 * @uses $wp Adds query vars
    301300 *
     
    305304 */
    306305function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
    307     global $wp_taxonomies, $wp_rewrite, $wp;
     306    global $wp_taxonomies, $wp;
    308307
    309308    if ( ! is_array($wp_taxonomies) )
     
    344343            $tag = '([^/]+)';
    345344
    346         $wp_rewrite->add_rewrite_tag("%$taxonomy%", $tag, $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term=");
    347         $wp_rewrite->add_permastruct( $taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite'] );
     345        add_rewrite_tag( "%$taxonomy%", $tag, $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term=" );
     346        add_permastruct( $taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite'] );
    348347    }
    349348
Note: See TracChangeset for help on using the changeset viewer.