WordPress.org

Make WordPress Core

Ticket #14546: refactor_for_wp_rewrite.diff

File refactor_for_wp_rewrite.diff, 10.2 KB (added by ikailo, 10 years ago)
  • wp-admin/admin.php

    # This patch file was generated by NetBeans IDE
    # Following Index: paths are relative to: C:\Documents and Settings\John\My Documents\Programming\SVN Repository\wordpress.core
    # This patch can be applied using context Tools: Patch action on respective folder.
    # It uses platform neutral UTF-8 encoding and \n newlines.
    # Above lines and this line are ignored by the patching process.
     
    2323require_once(dirname(dirname(__FILE__)) . '/wp-load.php');
    2424
    2525if ( get_option('db_upgraded') ) {
    26         $wp_rewrite->flush_rules();
     26        flush_rewrite_rules();
    2727        update_option( 'db_upgraded',  false );
    2828
    2929        /**
     
    200200        include(ABSPATH . 'wp-admin/admin-footer.php');
    201201
    202202        // Make sure rules are flushed
    203         global $wp_rewrite;
    204         $wp_rewrite->flush_rules(false);
     203        flush_rewrite_rules(false);
    205204
    206205        exit();
    207206} else {
  • wp-admin/includes/misc.php

     
    199199 * @param unknown_type $value
    200200 */
    201201function update_home_siteurl( $old_value, $value ) {
    202         global $wp_rewrite;
    203202
    204203        if ( defined( "WP_INSTALLING" ) )
    205204                return;
    206205
    207206        // If home changed, write rewrite rules to new location.
    208         $wp_rewrite->flush_rules();
     207        flush_rewrite_rules();
    209208}
    210209
    211210add_action( 'update_option_home', 'update_home_siteurl', 10, 2 );
  • wp-admin/includes/schema.php

     
    630630 *      so the error code must be checked) or failure.
    631631 */
    632632function populate_network( $network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $subdomain_install = false ) {
    633         global $wpdb, $current_site, $wp_db_version, $wp_rewrite;
     633        global $wpdb, $current_site, $wp_db_version;
    634634
    635635        $errors = new WP_Error();
    636636        if ( '' == $domain )
     
    750750        else
    751751                update_option( 'permalink_structure', '/blog/%year%/%monthnum%/%day%/%postname%/');
    752752
    753         $wp_rewrite->flush_rules();
     753        flush_rewrite_rules();
    754754
    755755        if ( $subdomain_install ) {
    756756                $vhost_ok = false;
  • wp-admin/includes/upgrade.php

     
    3535 * @return array Array keys 'url', 'user_id', 'password', 'password_message'.
    3636 */
    3737function wp_install( $blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '' ) {
    38         global $wp_rewrite;
    3938
    4039        if ( !empty( $deprecated ) )
    4140                _deprecated_argument( __FUNCTION__, '2.6' );
     
    8281
    8382        wp_install_defaults($user_id);
    8483
    85         $wp_rewrite->flush_rules();
     84        flush_rewrite_rules();
    8685
    8786        wp_new_blog_notification($blog_title, $guessurl, $user_id, ($email_password ? $user_password : __('The password you chose during the install.') ) );
    8887
     
    103102 * @param int $user_id User ID.
    104103 */
    105104function wp_install_defaults($user_id) {
    106         global $wpdb, $wp_rewrite, $current_site, $table_prefix;
     105        global $wpdb, $current_site, $table_prefix;
    107106
    108107        // Default category
    109108        $cat_name = __('Uncategorized');
     
    277276
    278277        if ( is_multisite() ) {
    279278                // Flush rules to pick up the new page.
     279                global $wp_rewrite;
    280280                $wp_rewrite->init();
    281                 $wp_rewrite->flush_rules();
     281                flush_rewrite_rules();
    282282
    283283                $user = new WP_User($user_id);
    284284                $wpdb->update( $wpdb->options, array('option_value' => $user->user_email), array('option_name' => 'admin_email') );
     
    378378 * @since unknown
    379379 */
    380380function upgrade_all() {
    381         global $wp_current_db_version, $wp_db_version, $wp_rewrite;
     381        global $wp_current_db_version, $wp_db_version;
    382382        $wp_current_db_version = __get_option('db_version');
    383383
    384384        // We are up-to-date.  Nothing to do.
  • wp-admin/options-permalink.php

     
    120120else
    121121        $usingpi = false;
    122122
    123 $wp_rewrite->flush_rules();
     123flush_rewrite_rules();
    124124
    125125
    126126if (isset($_POST['submit'])) : ?>
  • wp-includes/category-template.php

     
    645645 * @return string
    646646 */
    647647function wp_generate_tag_cloud( $tags, $args = '' ) {
    648         global $wp_rewrite;
    649  No newline at end of file
    650648        $defaults = array(
    651649                'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 0,
    652650                'format' => 'flat', 'separator' => "\n", 'orderby' => 'name', 'order' => 'ASC',
  • wp-includes/link-template.php

     
    585585 * @return string Link to the feed for the taxonomy specified by $term_id and $taxonomy.
    586586*/
    587587function get_term_feed_link( $term_id, $taxonomy = 'category', $feed = '' ) {
    588         global $wp_rewrite;
    589588
    590589        $term_id = ( int ) $term_id;
    591590
  • wp-includes/post.php

     
    803803 * @return object the registered post type object
    804804 */
    805805function register_post_type($post_type, $args = array()) {
    806         global $wp_post_types, $wp_rewrite, $wp;
     806        global $wp_post_types, $wp;
    807807
    808808        if ( !is_array($wp_post_types) )
    809809                $wp_post_types = array();
     
    867867                if ( !isset($args->rewrite['with_front']) )
    868868                        $args->rewrite['with_front'] = true;
    869869                if ( $args->hierarchical )
    870                         $wp_rewrite->add_rewrite_tag("%$post_type%", '(.+?)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=");
     870                        add_rewrite_tag("%$post_type%", '(.+?)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=");
    871871                else
    872                         $wp_rewrite->add_rewrite_tag("%$post_type%", '([^/]+)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=");
    873                 $wp_rewrite->add_permastruct($post_type, "{$args->rewrite['slug']}/%$post_type%", $args->rewrite['with_front'], $args->permalink_epmask);
     872                        add_rewrite_tag("%$post_type%", '([^/]+)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=");
     873                add_permastruct($post_type, "{$args->rewrite['slug']}/%$post_type%", $args->rewrite['with_front'], $args->permalink_epmask);
    874874        }
    875875
    876876        if ( $args->register_meta_box_cb )
     
    17141714 * @return mixed False on failure
    17151715 */
    17161716function wp_delete_post( $postid = 0, $force_delete = false ) {
    1717         global $wpdb, $wp_rewrite;
     1717        global $wpdb;
    17181718
    17191719        if ( !$post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $postid)) )
    17201720                return $post;
     
    17901790                foreach ( (array) $children as $child )
    17911791                        clean_page_cache($child->ID);
    17921792
    1793                 $wp_rewrite->flush_rules(false);
     1793                flush_rewrite_rules(false);
    17941794        } else {
    17951795                clean_post_cache($postid);
    17961796        }
     
    21302130 * @since 1.0.0
    21312131 * @link http://core.trac.wordpress.org/ticket/9084 Bug report on 'wp_insert_post_data' filter.
    21322132 * @uses $wpdb
    2133  * @uses $wp_rewrite
    21342133 * @uses $user_ID
    21352134 *
    21362135 * @uses do_action() Calls 'pre_post_update' on post ID if this is an update.
     
    21472146 * @return int|WP_Error The value 0 or WP_Error on failure. The post ID on success.
    21482147 */
    21492148function wp_insert_post($postarr = array(), $wp_error = false) {
    2150         global $wpdb, $wp_rewrite, $user_ID;
     2149        global $wpdb, $user_ID;
    21512150
    21522151        $defaults = array('post_status' => 'draft', 'post_type' => 'post', 'post_author' => $user_ID,
    21532152                'ping_status' => get_option('default_ping_status'), 'post_parent' => 0,
     
    42724271 *
    42734272 * @since 2.3.0
    42744273 * @access private
    4275  * @uses $wp_rewrite Flushes Rewrite Rules.
     4274 * @uses flush_rewrite_rules() Flushes Rewrite Rules.
    42764275 *
    42774276 * @param int $post_id The ID in the database table for the $post
    42784277 * @param object $post Object type containing the post information
     
    42824281                clean_page_cache($post_id);
    42834282                // Avoid flushing rules for every post during import.
    42844283                if ( !defined('WP_IMPORTING') ) {
    4285                         global $wp_rewrite;
    4286                         $wp_rewrite->flush_rules(false);
     4284                        flush_rewrite_rules(false);
    42874285                }
    42884286        } else {
    42894287                clean_post_cache($post_id);
  • wp-includes/taxonomy.php

     
    247247 * @subpackage Taxonomy
    248248 * @since 2.3.0
    249249 * @uses $wp_taxonomies Inserts new taxonomy object into the list
    250  * @uses $wp_rewrite Adds rewrite tags and permastructs
    251250 * @uses $wp Adds query vars
    252251 *
    253252 * @param string $taxonomy Name of taxonomy object
     
    255254 * @param array|string $args See above description for the two keys values.
    256255 */
    257256function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
    258         global $wp_taxonomies, $wp_rewrite, $wp;
     257        global $wp_taxonomies, $wp;
    259258
    260259        if ( ! is_array($wp_taxonomies) )
    261260                $wp_taxonomies = array();
     
    286285                        'slug' => sanitize_title_with_dashes($taxonomy),
    287286                        'with_front' => true,
    288287                ));
    289                 $wp_rewrite->add_rewrite_tag("%$taxonomy%", '([^/]+)', $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term=");
    290                 $wp_rewrite->add_permastruct($taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite']['with_front']);
     288                add_rewrite_tag("%$taxonomy%", '([^/]+)', $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term=");
     289                add_permastruct($taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite']['with_front']);
    291290        }
    292291
    293292        if ( is_null($args['show_ui']) )
  • wp-includes/theme.php

     
    10771077 * @param bool $require_once Whether to require_once or require. Default true.
    10781078 */
    10791079function load_template( $_template_file, $require_once = true ) {
    1080         global $posts, $post, $wp_did_header, $wp_did_template_redirect, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID;
     1080        global $posts, $post, $wp_did_header, $wp_did_template_redirect, $wp_query, $wpdb, $wp_version, $wp, $id, $comment, $user_ID;
    10811081
    10821082        if ( is_array( $wp_query->query_vars ) )
    10831083                extract( $wp_query->query_vars, EXTR_SKIP );