Changeset 14051
- Timestamp:
- 04/10/2010 11:30:34 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/options-permalink.php
r13980 r14051 76 76 $iis7_permalinks = iis7_supports_permalinks(); 77 77 78 $prefix = ''; 79 if ( ! got_mod_rewrite() && ! $iis7_permalinks ) 80 $prefix .= '/index.php'; 81 if ( is_multisite() && !is_subdomain_install() && is_main_site() ) 82 $prefix .= '/blog'; 83 78 84 if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) { 79 85 check_admin_referer('update-permalink'); … … 81 87 if ( isset( $_POST['permalink_structure'] ) ) { 82 88 $permalink_structure = $_POST['permalink_structure']; 83 if ( ! empty( $permalink_structure ) ) { 84 $permalink_structure = preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $permalink_structure ) ); 85 if ( is_multisite() && ! is_subdomain_install() && is_main_site() ) 86 $permalink_structure = '/blog' . $permalink_structure; 87 } 89 if ( ! empty( $permalink_structure ) ) 90 $permalink_structure = $prefix . preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $permalink_structure ) ); 88 91 $wp_rewrite->set_permalink_structure( $permalink_structure ); 89 92 } … … 91 94 if ( isset( $_POST['category_base'] ) ) { 92 95 $category_base = $_POST['category_base']; 93 if (! empty( $category_base ) ) { 94 $category_base = preg_replace('#/+#', '/', '/' . str_replace( '#', '', $category_base ) ); 95 if ( is_multisite() && ! is_subdomain_install() && is_main_site() ) 96 $category_base = '/blog' . $category_base; 97 } 96 if ( ! empty( $category_base ) ) 97 $category_base = $prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $category_base ) ); 98 98 $wp_rewrite->set_category_base( $category_base ); 99 99 } … … 101 101 if ( isset( $_POST['tag_base'] ) ) { 102 102 $tag_base = $_POST['tag_base']; 103 if ( ! empty( $tag_base ) ) { 104 $tag_base = preg_replace('#/+#', '/', '/' . str_replace( '#', '', $tag_base ) ); 105 if ( is_multisite() && ! is_subdomain_install() && is_main_site() ) 106 $tag_base = '/blog' . $tag_base; 107 } 103 if ( ! empty( $tag_base ) ) 104 $tag_base = $prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $tag_base ) ); 108 105 $wp_rewrite->set_tag_base( $tag_base ); 109 106 } … … 167 164 168 165 <?php 169 $prefix = '';170 171 166 if ( ! got_mod_rewrite() && ! $iis7_permalinks ) 172 $prefix = '/index.php'; 167 $permalink_structure = preg_replace( '|^/?index\.php|', '', $permalink_structure ); 168 169 if ( is_multisite() && !is_subdomain_install() && is_main_site() ) { 170 $permalink_structure = preg_replace( '|^/?blog|', '', $permalink_structure ); 171 $category_base = preg_replace( '|^/?blog|', '', $category_base ); 172 $tag_base = preg_replace( '|^/?blog|', '', $tag_base ); 173 } 173 174 174 175 $structures = array( 175 176 '', 176 $prefix .'/%year%/%monthnum%/%day%/%postname%/',177 $prefix .'/%year%/%monthnum%/%postname%/',178 $prefix .'/archives/%post_id%'177 '/%year%/%monthnum%/%day%/%postname%/', 178 '/%year%/%monthnum%/%postname%/', 179 '/archives/%post_id%' 179 180 ); 180 181 ?> … … 199 200 <tr> 200 201 <th> 201 <label><input name="selection" id="custom_selection" type="radio" value="custom" class="tog" 202 <?php if ( !in_array($permalink_structure, $structures) ) { ?> 203 checked="checked" 204 <?php } ?> 205 /> 202 <label><input name="selection" id="custom_selection" type="radio" value="custom" class="tog" <?php checked( !in_array($permalink_structure, $structures) ); ?> /> 206 203 <?php _e('Custom Structure'); ?> 207 204 </label> 208 205 </th> 209 206 <td> 210 <?php if ( is_multisite() && !is_subdomain_install() && is_main_site() ) { echo "/blog"; $permalink_structure = preg_replace( "|^/?blog|", "", $permalink_structure ); }?>207 <?php echo $prefix; ?> 211 208 <input name="permalink_structure" id="permalink_structure" type="text" value="<?php echo esc_attr($permalink_structure); ?>" class="regular-text code" /> 212 209 </td> … … 224 221 <tr> 225 222 <th><label for="category_base"><?php /* translators: prefix for category permalinks */ _e('Category base'); ?></label></th> 226 <td><?php if ( is_multisite() && !is_subdomain_install() && is_main_site() ) { echo "/blog"; $category_base = preg_replace( "|^/?blog|", "", $category_base ); }?> <input name="category_base" id="category_base" type="text" value="<?php echo esc_attr( $category_base ); ?>" class="regular-text code" /></td>223 <td><?php echo $prefix; ?> <input name="category_base" id="category_base" type="text" value="<?php echo esc_attr( $category_base ); ?>" class="regular-text code" /></td> 227 224 </tr> 228 225 <tr> 229 226 <th><label for="tag_base"><?php _e('Tag base'); ?></label></th> 230 <td><?php if ( is_multisite() && !is_subdomain_install() && is_main_site() ) { echo "/blog"; $tag_base = preg_replace( "|^/?blog|", "", $tag_base ); }?> <input name="tag_base" id="tag_base" type="text" value="<?php echo esc_attr($tag_base); ?>" class="regular-text code" /></td>227 <td><?php echo $prefix; ?> <input name="tag_base" id="tag_base" type="text" value="<?php echo esc_attr($tag_base); ?>" class="regular-text code" /></td> 231 228 </tr> 232 229 <?php do_settings_fields('permalink', 'optional'); ?> … … 240 237 </form> 241 238 <?php if ( !is_multisite() ) { ?> 242 <?php if ( $iis7_permalinks) :239 <?php if ( $iis7_permalinks ) : 243 240 if ( isset($_POST['submit']) && $permalink_structure && ! $usingpi && ! $writable ) : 244 241 if ( file_exists($home_path . 'web.config') ) : ?>
Note: See TracChangeset
for help on using the changeset viewer.