~canonical-sysadmins/wordpress/4.1.3

« back to all changes in this revision

Viewing changes to wp-includes/rewrite.php

  • Committer: Nick Moffitt
  • Date: 2015-01-15 11:05:37 UTC
  • mfrom: (1.1.1 wp4-upstream)
  • Revision ID: nick.moffitt@canonical.com-20150115110537-8bp1y42eyg0jsa7c
Tags: 4.1
MergeĀ upstreamĀ versionĀ 4.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
226
226
 * Adding an endpoint creates extra rewrite rules for each of the matching
227
227
 * places specified by the provided bitmask. For example:
228
228
 *
229
 
 * <code>
230
 
 * add_rewrite_endpoint( 'json', EP_PERMALINK | EP_PAGES );
231
 
 * </code>
 
229
 *     add_rewrite_endpoint( 'json', EP_PERMALINK | EP_PAGES );
232
230
 *
233
231
 * will add a new rewrite rule ending with "json(/(.*))?/?$" for every permastruct
234
232
 * that describes a permalink (post) or page. This is rewritten to "json=$match"
235
233
 * where $match is the part of the URL matched by the endpoint regex (e.g. "foo" in
236
 
 * "<permalink>/json/foo/").
 
234
 * "[permalink]/json/foo/").
237
235
 *
238
236
 * A new query var with the same name as the endpoint will also be created.
239
237
 *
240
238
 * When specifying $places ensure that you are using the EP_* constants (or a
241
239
 * combination of them using the bitwise OR operator) as their values are not
242
 
 * guaranteed to remain static (especially EP_ALL).
 
240
 * guaranteed to remain static (especially `EP_ALL`).
243
241
 *
244
 
 * Be sure to flush the rewrite rules - flush_rewrite_rules() - when your plugin gets
 
242
 * Be sure to flush the rewrite rules - {@see flush_rewrite_rules()} - when your plugin gets
245
243
 * activated and deactivated.
246
244
 *
247
245
 * @since 2.1.0
365
363
                if ( preg_match("#^$match#", $request_match, $matches) ) {
366
364
 
367
365
                        if ( $wp_rewrite->use_verbose_page_rules && preg_match( '/pagename=\$matches\[([0-9]+)\]/', $query, $varmatch ) ) {
368
 
                                // this is a verbose page match, lets check to be sure about it
 
366
                                // This is a verbose page match, let's check to be sure about it.
369
367
                                if ( ! get_page_by_path( $matches[ $varmatch[1] ] ) )
370
368
                                        continue;
371
369
                        }
666
664
         * Now it tells {@link WP::parse_request()} to check if a URL matching the
667
665
         * page permastruct is actually a page before accepting it.
668
666
         *
669
 
         * @link http://core.trac.wordpress.org/ticket/16687
 
667
         * @link https://core.trac.wordpress.org/ticket/16687
670
668
         * @see WP_Rewrite::init()
671
669
         * @since 2.5.0
672
670
         * @access public
911
909
         * @since 1.5.0
912
910
         * @access public
913
911
         *
914
 
         * @return bool|string False on no permalink structure. Date permalink structure.
 
912
         * @return string|false False on no permalink structure. Date permalink structure.
915
913
         */
916
914
        public function get_date_permastruct() {
917
915
                if ( isset($this->date_structure) )
965
963
         * @since 1.5.0
966
964
         * @access public
967
965
         *
968
 
         * @return bool|string False on failure. Year structure on success.
 
966
         * @return false|string False on failure. Year structure on success.
969
967
         */
970
968
        public function get_year_permastruct() {
971
969
                $structure = $this->get_date_permastruct();
990
988
         * @since 1.5.0
991
989
         * @access public
992
990
         *
993
 
         * @return bool|string False on failure. Year/Month structure on success.
 
991
         * @return false|string False on failure. Year/Month structure on success.
994
992
         */
995
993
        public function get_month_permastruct() {
996
994
                $structure = $this->get_date_permastruct();
1013
1011
         * @since 1.5.0
1014
1012
         * @access public
1015
1013
         *
1016
 
         * @return bool|string False on failure. Year/Month/Day structure on success.
 
1014
         * @return string|false False on failure. Year/Month/Day structure on success.
1017
1015
         */
1018
1016
        public function get_day_permastruct() {
1019
1017
                return $this->get_date_permastruct();
1082
1080
         * @since 1.5.0
1083
1081
         * @access public
1084
1082
         *
1085
 
         * @return string|bool False if not found. Permalink structure string.
 
1083
         * @return string|false False if not found. Permalink structure string.
1086
1084
         */
1087
1085
        public function get_author_permastruct() {
1088
1086
                if ( isset($this->author_structure) )
1108
1106
         * @since 1.5.0
1109
1107
         * @access public
1110
1108
         *
1111
 
         * @return string|bool False if not found. Permalink structure string.
 
1109
         * @return string|false False if not found. Permalink structure string.
1112
1110
         */
1113
1111
        public function get_search_permastruct() {
1114
1112
                if ( isset($this->search_structure) )
1134
1132
         * @since 1.5.0
1135
1133
         * @access public
1136
1134
         *
1137
 
         * @return string|bool False if not found. Permalink structure string.
 
1135
         * @return string|false False if not found. Permalink structure string.
1138
1136
         */
1139
1137
        public function get_page_permastruct() {
1140
1138
                if ( isset($this->page_structure) )
1160
1158
         * @since 1.5.0
1161
1159
         * @access public
1162
1160
         *
1163
 
         * @return string|bool False if not found. Permalink structure string.
 
1161
         * @return string|false False if not found. Permalink structure string.
1164
1162
         */
1165
1163
        public function get_feed_permastruct() {
1166
1164
                if ( isset($this->feed_structure) )
1678
1676
                        /**
1679
1677
                         * Filter rewrite rules used for individual permastructs.
1680
1678
                         *
1681
 
                         * The dynamic portion of the hook name, $permastructname, refers
 
1679
                         * The dynamic portion of the hook name, `$permastructname`, refers
1682
1680
                         * to the name of the registered permastruct, e.g. 'post_tag' (tags),
1683
1681
                         * 'category' (categories), etc.
1684
1682
                         *