X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/784f914b1e4b1c62d6657e86397c2e83bcee4295..refs/tags/wordpress-4.7.1:/wp-includes/class-wp-rewrite.php diff --git a/wp-includes/class-wp-rewrite.php b/wp-includes/class-wp-rewrite.php index 7c621fb0..17c58b90 100644 --- a/wp-includes/class-wp-rewrite.php +++ b/wp-includes/class-wp-rewrite.php @@ -1252,13 +1252,13 @@ class WP_Rewrite { /** * Constructs rewrite matches and queries from permalink structure. * - * Runs the action 'generate_rewrite_rules' with the parameter that is an + * Runs the action {@see 'generate_rewrite_rules'} with the parameter that is an * reference to the current WP_Rewrite instance to further manipulate the - * permalink structures and rewrite rules. Runs the 'rewrite_rules_array' + * permalink structures and rewrite rules. Runs the {@see 'rewrite_rules_array'} * filter on the full rewrite rule array. * * There are two ways to manipulate the rewrite rules, one by hooking into - * the 'generate_rewrite_rules' action and gaining full control of the + * the {@see 'generate_rewrite_rules'} action and gaining full control of the * object or just manipulating the rewrite rule array before it is passed * from the function. * @@ -1297,7 +1297,7 @@ class WP_Rewrite { $post_rewrite = $this->generate_rewrite_rules( $this->permalink_structure, EP_PERMALINK ); /** - * Filter rewrite rules used for "post" archives. + * Filters rewrite rules used for "post" archives. * * @since 1.5.0 * @@ -1309,7 +1309,7 @@ class WP_Rewrite { $date_rewrite = $this->generate_rewrite_rules($this->get_date_permastruct(), EP_DATE); /** - * Filter rewrite rules used for date archives. + * Filters rewrite rules used for date archives. * * Likely date archives would include /yyyy/, /yyyy/mm/, and /yyyy/mm/dd/. * @@ -1323,7 +1323,7 @@ class WP_Rewrite { $root_rewrite = $this->generate_rewrite_rules($this->root . '/', EP_ROOT); /** - * Filter rewrite rules used for root-level archives. + * Filters rewrite rules used for root-level archives. * * Likely root-level archives would include pagination rules for the homepage * as well as site-wide post feeds (e.g. /feed/, and /feed/atom/). @@ -1338,7 +1338,7 @@ class WP_Rewrite { $comments_rewrite = $this->generate_rewrite_rules($this->root . $this->comments_base, EP_COMMENTS, false, true, true, false); /** - * Filter rewrite rules used for comment feed archives. + * Filters rewrite rules used for comment feed archives. * * Likely comments feed archives include /comments/feed/, and /comments/feed/atom/. * @@ -1353,7 +1353,7 @@ class WP_Rewrite { $search_rewrite = $this->generate_rewrite_rules($search_structure, EP_SEARCH); /** - * Filter rewrite rules used for search archives. + * Filters rewrite rules used for search archives. * * Likely search-related archives include /search/search+query/ as well as * pagination and feed paths for a search. @@ -1368,7 +1368,7 @@ class WP_Rewrite { $author_rewrite = $this->generate_rewrite_rules($this->get_author_permastruct(), EP_AUTHORS); /** - * Filter rewrite rules used for author archives. + * Filters rewrite rules used for author archives. * * Likely author archives would include /author/author-name/, as well as * pagination and feed paths for author archives. @@ -1383,7 +1383,7 @@ class WP_Rewrite { $page_rewrite = $this->page_rewrite_rules(); /** - * Filter rewrite rules used for "page" post type archives. + * Filters rewrite rules used for "page" post type archives. * * @since 1.5.0 * @@ -1403,7 +1403,7 @@ class WP_Rewrite { } /** - * Filter rewrite rules used for individual permastructs. + * Filters rewrite rules used for individual permastructs. * * The dynamic portion of the hook name, `$permastructname`, refers * to the name of the registered permastruct, e.g. 'post_tag' (tags), @@ -1413,11 +1413,11 @@ class WP_Rewrite { * * @param array $rules The rewrite rules generated for the current permastruct. */ - $rules = apply_filters( $permastructname . '_rewrite_rules', $rules ); + $rules = apply_filters( "{$permastructname}_rewrite_rules", $rules ); if ( 'post_tag' == $permastructname ) { /** - * Filter rewrite rules used specifically for Tags. + * Filters rewrite rules used specifically for Tags. * * @since 2.3.0 * @deprecated 3.1.0 Use 'post_tag_rewrite_rules' instead @@ -1446,7 +1446,7 @@ class WP_Rewrite { do_action_ref_array( 'generate_rewrite_rules', array( &$this ) ); /** - * Filter the full set of generated rewrite rules. + * Filters the full set of generated rewrite rules. * * @since 1.5.0 * @@ -1475,6 +1475,10 @@ class WP_Rewrite { if ( empty($this->rules) ) { $this->matches = 'matches'; $this->rewrite_rules(); + if ( ! did_action( 'wp_loaded' ) ) { + add_action( 'wp_loaded', array( $this, 'flush_rules' ) ); + return $this->rules; + } update_option('rewrite_rules', $this->rules); } @@ -1550,7 +1554,7 @@ class WP_Rewrite { $rules .= "\n"; /** - * Filter the list of rewrite rules formatted for output to an .htaccess file. + * Filters the list of rewrite rules formatted for output to an .htaccess file. * * @since 1.5.0 * @@ -1559,7 +1563,7 @@ class WP_Rewrite { $rules = apply_filters( 'mod_rewrite_rules', $rules ); /** - * Filter the list of rewrite rules formatted for output to an .htaccess file. + * Filters the list of rewrite rules formatted for output to an .htaccess file. * * @since 1.5.0 * @deprecated 1.5.0 Use the mod_rewrite_rules filter instead. @@ -1612,7 +1616,7 @@ class WP_Rewrite { } /** - * Filter the list of rewrite rules formatted for output to a web.config. + * Filters the list of rewrite rules formatted for output to a web.config. * * @since 2.8.0 * @@ -1743,7 +1747,7 @@ class WP_Rewrite { * } */ public function add_permastruct( $name, $struct, $args = array() ) { - // Backwards compatibility for the old parameters: $with_front and $ep_mask. + // Back-compat for the old parameters: $with_front and $ep_mask. if ( ! is_array( $args ) ) $args = array( 'with_front' => $args ); if ( func_num_args() == 4 ) @@ -1814,7 +1818,7 @@ class WP_Rewrite { $this->wp_rewrite_rules(); /** - * Filter whether a "hard" rewrite rule flush should be performed when requested. + * Filters whether a "hard" rewrite rule flush should be performed when requested. * * A "hard" flush updates .htaccess (Apache) or web.config (IIS). * @@ -1872,7 +1876,7 @@ class WP_Rewrite { * between the current permalink structure and the parameter value. Calls * WP_Rewrite::init() after the option is updated. * - * Fires the 'permalink_structure_changed' action once the init call has + * Fires the {@see 'permalink_structure_changed'} action once the init call has * processed passing the old and new values * * @since 1.5.0