Changeset 5150
- Timestamp:
- 03/31/2007 09:19:32 AM (18 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/options-permalink.php
r4681 r5150 74 74 $wp_rewrite->set_category_base($category_base); 75 75 } 76 77 if ( isset($_POST['tag_base']) ) { 78 $tag_base = $_POST['tag_base']; 79 if (! empty($tag_base) ) 80 $tag_base = preg_replace('#/+#', '/', '/' . $_POST['tag_base']); 81 $wp_rewrite->set_tag_base($tag_base); 82 } 76 83 } 77 84 78 85 $permalink_structure = get_option('permalink_structure'); 79 86 $category_base = get_option('category_base'); 87 $tag_base = get_option( 'tag_base' ); 80 88 81 89 if ( (!file_exists($home_path.'.htaccess') && is_writable($home_path)) || is_writable($home_path.'.htaccess') ) … … 160 168 <p> 161 169 <?php _e('Category base'); ?>: <input name="category_base" type="text" class="code" value="<?php echo attribute_escape($category_base); ?>" size="30" /> 170 </p> 171 <p> 172 <?php _e('Tag base'); ?>: <input name="tag_base" type="text" class="code" value="<?php echo attribute_escape($tag_base); ?>" size="30" /> 162 173 </p> 163 174 <p class="submit"> -
trunk/wp-admin/upgrade-schema.php
r5110 r5150 243 243 add_option('show_on_front', 'posts'); 244 244 245 // 2.2 246 add_option('tag_base'); 247 245 248 // Delete unused options 246 249 $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing'); -
trunk/wp-includes/category-template.php
r5149 r5150 43 43 function get_tag_link( $tag_id ) { 44 44 global $wp_rewrite; 45 $catlink = $wp_rewrite->get_ category_permastruct();45 $catlink = $wp_rewrite->get_tag_permastruct(); 46 46 47 47 $category = &get_category($tag_id); -
trunk/wp-includes/functions.php
r5138 r5150 671 671 672 672 function update_post_caches(&$posts) { 673 global $post_cache, $category_cache, $post_meta_cache ;673 global $post_cache, $category_cache, $post_meta_cache, $tag_cache; 674 674 global $wpdb, $blog_id; 675 675 -
trunk/wp-includes/link-template.php
r5087 r5150 60 60 '%post_id%', 61 61 '%category%', 62 '%tag%', 62 63 '%author%', 63 64 '%pagename%' -
trunk/wp-includes/rewrite.php
r5131 r5150 47 47 define('EP_SEARCH', 256 ); 48 48 define('EP_CATEGORIES', 512 ); 49 define('EP_AUTHORS', 1024); 50 define('EP_PAGES', 2048); 49 define('EP_TAGS', 1024 ); 50 define('EP_AUTHORS', 2048); 51 define('EP_PAGES', 4096); 51 52 //pseudo-places 52 53 define('EP_NONE', 0 ); 53 define('EP_ALL', 4095);54 define('EP_ALL', 8191); 54 55 55 56 //and an endpoint, like /trackback/ … … 151 152 var $use_trailing_slashes; 152 153 var $category_base; 154 var $tag_base; 153 155 var $category_structure; 156 var $tag_structure; 154 157 var $author_base = 'author'; 155 158 var $author_structure; … … 182 185 '%post_id%', 183 186 '%category%', 187 '%tag%', 184 188 '%author%', 185 189 '%pagename%', … … 198 202 '([0-9]+)', 199 203 '(.+?)', 204 '(.+?)', 200 205 '([^/]+)', 201 206 '([^/]+)', … … 214 219 'p=', 215 220 'category_name=', 221 'tag=', 216 222 'author_name=', 217 223 'pagename=', … … 377 383 378 384 return $this->category_structure; 385 } 386 387 function get_tag_permastruct() { 388 if (isset($this->tag_structure)) { 389 return $this->tag_structure; 390 } 391 392 if (empty($this->permalink_structure)) { 393 $this->tag_structure = ''; 394 return false; 395 } 396 397 if (empty($this->tag_base)) 398 $this->tag_structure = $this->front . 'tag/'; 399 else 400 $this->tag_structure = $this->tag_base . '/'; 401 402 $this->tag_structure .= '%tag%'; 403 404 return $this->tag_structure; 379 405 } 380 406 … … 735 761 $category_rewrite = apply_filters('category_rewrite_rules', $category_rewrite); 736 762 763 // Tags 764 $tag_rewrite = $this->generate_rewrite_rules($this->get_tag_permastruct(), EP_TAGS); 765 $tag_rewrite = apply_filters('tag_rewrite_rules', $tag_rewrite); 766 737 767 // Authors 738 768 $author_rewrite = $this->generate_rewrite_rules($this->get_author_permastruct(), EP_AUTHORS); … … 744 774 745 775 // Put them together. 746 $this->rules = array_merge($robots_rewrite, $default_feeds, $page_rewrite, $root_rewrite, $comments_rewrite, $search_rewrite, $category_rewrite, $ author_rewrite, $date_rewrite, $post_rewrite, $this->extra_rules);776 $this->rules = array_merge($robots_rewrite, $default_feeds, $page_rewrite, $root_rewrite, $comments_rewrite, $search_rewrite, $category_rewrite, $tag_rewrite, $author_rewrite, $date_rewrite, $post_rewrite, $this->extra_rules); 747 777 748 778 do_action_ref_array('generate_rewrite_rules', array(&$this)); … … 870 900 $this->root = $this->index . '/'; 871 901 } 872 $this->category_base = get_option('category_base'); 902 $this->category_base = get_option( 'category_base' ); 903 $this->tag_base = get_option( 'tag_base' ); 873 904 unset($this->category_structure); 874 905 unset($this->author_structure); … … 895 926 } 896 927 928 function set_tag_base( $tag_base ) { 929 if ( $tag_base != $this->tag_base ) { 930 update_option( 'tag_base', $tag_base ); 931 $this->init(); 932 } 933 } 934 897 935 function WP_Rewrite() { 898 936 $this->init();
Note: See TracChangeset
for help on using the changeset viewer.