Changeset 12923 for trunk/wp-includes/classes.php
- Timestamp:
- 02/01/2010 11:12:26 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/classes.php
r12598 r12923 27 27 * @var array 28 28 */ 29 var $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 'withoutcomments', 's', 'search', 'exact', 'sentence', 'debug', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'tag', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots', 'taxonomy', 'term', 'cpage' );29 var $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 'withoutcomments', 's', 'search', 'exact', 'sentence', 'debug', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'tag', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots', 'taxonomy', 'term', 'cpage', 'post_type'); 30 30 31 31 /** … … 145 145 $rewrite = $wp_rewrite->wp_rewrite_rules(); 146 146 147 if ( ! empty($rewrite)) {147 if ( ! empty($rewrite) ) { 148 148 // If we match a rewrite rule, this will be cleared. 149 149 $error = '404'; … … 204 204 // If the requesting file is the anchor of the match, prepend it 205 205 // to the path info. 206 if ( (! empty($req_uri)) && (strpos($match, $req_uri) === 0) && ($req_uri != $request)) {206 if ( (! empty($req_uri)) && (strpos($match, $req_uri) === 0) && ($req_uri != $request) ) 207 207 $request_match = $req_uri . '/' . $request; 208 } 209 210 if (preg_match("#^$match#", $request_match, $matches) || 211 preg_match("#^$match#", urldecode($request_match), $matches)) { 208 209 if ( preg_match("#^$match#", $request_match, $matches) || 210 preg_match("#^$match#", urldecode($request_match), $matches) ) { 212 211 // Got a match. 213 212 $this->matched_rule = $match; … … 226 225 // If we're processing a 404 request, clear the error var 227 226 // since we found something. 228 if ( isset($_GET['error']))227 if ( isset($_GET['error']) ) 229 228 unset($_GET['error']); 230 229 231 if ( isset($error))230 if ( isset($error) ) 232 231 unset($error); 233 232 … … 237 236 238 237 // If req_uri is empty or if it is a request for ourself, unset error. 239 if ( empty($request) || $req_uri == $self || strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false) {240 if ( isset($_GET['error']))238 if ( empty($request) || $req_uri == $self || strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false ) { 239 if ( isset($_GET['error']) ) 241 240 unset($_GET['error']); 242 241 243 if ( isset($error))242 if ( isset($error) ) 244 243 unset($error); 245 244 246 if ( isset($perma_query_vars) && strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false)245 if ( isset($perma_query_vars) && strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false ) 247 246 unset($perma_query_vars); 248 247 … … 257 256 $taxonomy_query_vars[$t->query_var] = $taxonomy; 258 257 259 for ($i=0; $i<count($this->public_query_vars); $i += 1) { 258 foreach ( $GLOBALS['wp_post_types'] as $post_type => $t ) 259 if ( $t->query_var ) 260 $post_type_query_vars[$t->query_var] = $post_type; 261 262 for ( $i = 0; $i < count($this->public_query_vars); $i += 1 ) { 260 263 $wpvar = $this->public_query_vars[$i]; 261 if ( isset($this->extra_query_vars[$wpvar]))264 if ( isset($this->extra_query_vars[$wpvar]) ) 262 265 $this->query_vars[$wpvar] = $this->extra_query_vars[$wpvar]; 263 elseif ( isset($GLOBALS[$wpvar]))266 elseif ( isset($GLOBALS[$wpvar]) ) 264 267 $this->query_vars[$wpvar] = $GLOBALS[$wpvar]; 265 elseif ( !empty($_POST[$wpvar]))268 elseif ( !empty($_POST[$wpvar]) ) 266 269 $this->query_vars[$wpvar] = $_POST[$wpvar]; 267 elseif ( !empty($_GET[$wpvar]))270 elseif ( !empty($_GET[$wpvar]) ) 268 271 $this->query_vars[$wpvar] = $_GET[$wpvar]; 269 elseif ( !empty($perma_query_vars[$wpvar]))272 elseif ( !empty($perma_query_vars[$wpvar]) ) 270 273 $this->query_vars[$wpvar] = $perma_query_vars[$wpvar]; 271 274 … … 275 278 $this->query_vars['taxonomy'] = $taxonomy_query_vars[$wpvar]; 276 279 $this->query_vars['term'] = $this->query_vars[$wpvar]; 280 } elseif ( in_array( $wpvar, $post_type_query_vars ) ) { 281 $this->query_vars['post_type'] = $post_type_query_vars[$wpvar]; 282 $this->query_vars['name'] = $this->query_vars[$wpvar]; 277 283 } 278 284 } 279 285 } 280 286 287 // Limit publicly queried post_types to those that are publicly_queryable 288 if ( isset( $this->query_vars['post_type']) ) { 289 $queryable_post_types = get_post_types( array('publicly_queryable' => true) ); 290 if ( ! in_array( $this->query_vars['post_type'], $queryable_post_types ) ) 291 unset( $this->query_vars['post_type'] ); 292 } 293 281 294 foreach ( (array) $this->private_query_vars as $var) { 282 if ( isset($this->extra_query_vars[$var]))295 if ( isset($this->extra_query_vars[$var]) ) 283 296 $this->query_vars[$var] = $this->extra_query_vars[$var]; 284 elseif ( isset($GLOBALS[$var]) && '' != $GLOBALS[$var])297 elseif ( isset($GLOBALS[$var]) && '' != $GLOBALS[$var] ) 285 298 $this->query_vars[$var] = $GLOBALS[$var]; 286 299 }
Note: See TracChangeset
for help on using the changeset viewer.