Changeset 15825 for trunk/wp-includes/rewrite.php
- Timestamp:
- 10/17/2010 05:41:22 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/rewrite.php
r15590 r15825 380 380 */ 381 381 var $use_trailing_slashes; 382 383 /**384 * Customized or default category permalink base ( example.com/xx/tagname ).385 *386 * @since 1.5.0387 * @access private388 * @var string389 */390 var $category_base;391 392 /**393 * Customized or default tag permalink base ( example.com/xx/tagname ).394 *395 * @since 2.3.0396 * @access private397 * @var string398 */399 var $tag_base;400 401 /**402 * Permalink request structure for categories.403 *404 * @since 1.5.0405 * @access private406 * @var string407 */408 var $category_structure;409 410 /**411 * Permalink request structure for tags.412 *413 * @since 2.3.0414 * @access private415 * @var string416 */417 var $tag_structure;418 382 419 383 /** … … 682 646 '([^/]+)', 683 647 '([0-9]+)', 684 '(.+?)',685 '(.+?)',686 648 '([^/]+)', 687 649 '([^/]+?)', … … 706 668 'name=', 707 669 'p=', 708 'category_name=',709 'tag=',710 670 'author_name=', 711 671 'pagename=', … … 1029 989 */ 1030 990 function get_category_permastruct() { 1031 if ( isset($this->category_structure) ) 1032 return $this->category_structure; 1033 1034 if ( empty($this->permalink_structure) ) { 1035 $this->category_structure = ''; 1036 return false; 1037 } 1038 1039 if ( empty($this->category_base) ) 1040 $this->category_structure = trailingslashit( $this->front . 'category' ); 1041 else 1042 $this->category_structure = trailingslashit( '/' . $this->root . $this->category_base ); 1043 1044 $this->category_structure .= '%category%'; 1045 1046 return $this->category_structure; 991 return $this->get_extra_permastruct('category'); 1047 992 } 1048 993 … … 1061 1006 */ 1062 1007 function get_tag_permastruct() { 1063 if ( isset($this->tag_structure) ) 1064 return $this->tag_structure; 1065 1066 if ( empty($this->permalink_structure) ) { 1067 $this->tag_structure = ''; 1068 return false; 1069 } 1070 1071 if ( empty($this->tag_base) ) 1072 $this->tag_structure = trailingslashit( $this->front . 'tag' ); 1073 else 1074 $this->tag_structure = trailingslashit( '/' . $this->root . $this->tag_base ); 1075 1076 $this->tag_structure .= '%tag%'; 1077 1078 return $this->tag_structure; 1008 return $this->get_extra_permastruct('post_tag'); 1079 1009 } 1080 1010 … … 1614 1544 $search_rewrite = apply_filters('search_rewrite_rules', $search_rewrite); 1615 1545 1616 // Categories1617 $category_rewrite = $this->generate_rewrite_rules($this->get_category_permastruct(), EP_CATEGORIES);1618 $category_rewrite = apply_filters('category_rewrite_rules', $category_rewrite);1619 1620 // Tags1621 $tag_rewrite = $this->generate_rewrite_rules($this->get_tag_permastruct(), EP_TAGS);1622 $tag_rewrite = apply_filters('tag_rewrite_rules', $tag_rewrite);1623 1624 1546 // Authors 1625 1547 $author_rewrite = $this->generate_rewrite_rules($this->get_author_permastruct(), EP_AUTHORS); … … 1631 1553 1632 1554 // Extra permastructs 1633 foreach ( $this->extra_permastructs as $permastruct ) {1555 foreach ( $this->extra_permastructs as $permastructname => $permastruct ) { 1634 1556 if ( is_array($permastruct) ) 1635 $ this->extra_rules_top = array_merge($this->extra_rules_top, $this->generate_rewrite_rules($permastruct[0], $permastruct[1]));1557 $rules = $this->generate_rewrite_rules($permastruct[0], $permastruct[1]); 1636 1558 else 1637 $this->extra_rules_top = array_merge($this->extra_rules_top, $this->generate_rewrite_rules($permastruct, EP_NONE)); 1559 $rules = $this->generate_rewrite_rules($permastruct, EP_NONE); 1560 1561 $rules = apply_filters($permastructname . '_rewrite_rules', $rules); 1562 if ( 'post_tag' == $permastructname ) 1563 $rules = apply_filters('tag_rewrite_rules', $rules); 1564 1565 $this->extra_rules_top = array_merge($this->extra_rules_top, $rules); 1638 1566 } 1639 1567 1640 1568 // Put them together. 1641 1569 if ( $this->use_verbose_page_rules ) 1642 $this->rules = array_merge($this->extra_rules_top, $robots_rewrite, $default_feeds, $registration_pages, $page_rewrite, $root_rewrite, $comments_rewrite, $search_rewrite, $category_rewrite, $tag_rewrite,$author_rewrite, $date_rewrite, $post_rewrite, $this->extra_rules);1570 $this->rules = array_merge($this->extra_rules_top, $robots_rewrite, $default_feeds, $registration_pages, $page_rewrite, $root_rewrite, $comments_rewrite, $search_rewrite, $author_rewrite, $date_rewrite, $post_rewrite, $this->extra_rules); 1643 1571 else 1644 $this->rules = array_merge($this->extra_rules_top, $robots_rewrite, $default_feeds, $registration_pages, $root_rewrite, $comments_rewrite, $search_rewrite, $category_rewrite, $tag_rewrite,$author_rewrite, $date_rewrite, $post_rewrite, $page_rewrite, $this->extra_rules);1572 $this->rules = array_merge($this->extra_rules_top, $robots_rewrite, $default_feeds, $registration_pages, $root_rewrite, $comments_rewrite, $search_rewrite, $author_rewrite, $date_rewrite, $post_rewrite, $page_rewrite, $this->extra_rules); 1645 1573 1646 1574 do_action_ref_array('generate_rewrite_rules', array(&$this)); … … 1979 1907 if ( $this->using_index_permalinks() ) 1980 1908 $this->root = $this->index . '/'; 1981 $this->category_base = get_option( 'category_base' );1982 $this->tag_base = get_option( 'tag_base' );1983 unset($this->category_structure);1984 1909 unset($this->author_structure); 1985 1910 unset($this->date_structure); … … 2033 1958 */ 2034 1959 function set_category_base($category_base) { 2035 if ( $category_base != $this->category_base) {1960 if ( $category_base != get_option('category_base') ) { 2036 1961 update_option('category_base', $category_base); 2037 1962 $this->init(); … … 2052 1977 */ 2053 1978 function set_tag_base( $tag_base ) { 2054 if ( $tag_base != $this->tag_base) {1979 if ( $tag_base != get_option( 'tag_base') ) { 2055 1980 update_option( 'tag_base', $tag_base ); 2056 1981 $this->init();
Note: See TracChangeset
for help on using the changeset viewer.