Ticket #9296: 9296.2.diff
File 9296.2.diff, 5.6 KB (added by , 12 years ago) |
---|
-
wp-admin/options-permalink.php
83 83 if ( is_multisite() && !is_subdomain_install() && is_main_site() ) 84 84 $blog_prefix = '/blog'; 85 85 86 if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) { 87 check_admin_referer('update-permalink'); 88 89 if ( isset( $_POST['permalink_structure'] ) ) { 90 if ( isset( $_POST['selection'] ) && 'custom' != $_POST['selection'] ) 91 $permalink_structure = $_POST['selection']; 92 else 93 $permalink_structure = $_POST['permalink_structure']; 94 95 if ( ! empty( $permalink_structure ) ) { 96 $permalink_structure = preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $permalink_structure ) ); 97 if ( $prefix && $blog_prefix ) 98 $permalink_structure = $prefix . preg_replace( '#^/?index\.php#', '', $permalink_structure ); 99 else 100 $permalink_structure = $blog_prefix . $permalink_structure; 101 } 102 $wp_rewrite->set_permalink_structure( $permalink_structure ); 103 } 104 105 if ( isset( $_POST['category_base'] ) ) { 106 $category_base = $_POST['category_base']; 107 if ( ! empty( $category_base ) ) 108 $category_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $category_base ) ); 109 $wp_rewrite->set_category_base( $category_base ); 110 } 111 112 if ( isset( $_POST['tag_base'] ) ) { 113 $tag_base = $_POST['tag_base']; 114 if ( ! empty( $tag_base ) ) 115 $tag_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $tag_base ) ); 116 $wp_rewrite->set_tag_base( $tag_base ); 117 } 118 119 create_initial_taxonomies(); 120 } 121 122 $permalink_structure = get_option('permalink_structure'); 123 $category_base = get_option('category_base'); 86 $permalink_structure = get_option( 'permalink_structure' ); 87 $category_base = get_option( 'category_base' ); 124 88 $tag_base = get_option( 'tag_base' ); 125 89 126 90 if ( $iis7_permalinks ) { … … 142 106 143 107 flush_rewrite_rules(); 144 108 145 if ( isset($_POST['submit'])) : ?>109 if ( isset( $_GET['settings-updated'] ) ) : ?> 146 110 <div id="message" class="updated"><p><?php 147 111 if ( ! is_multisite() ) { 148 112 if ( $iis7_permalinks ) { … … 169 133 <?php screen_icon(); ?> 170 134 <h2><?php echo esc_html( $title ); ?></h2> 171 135 172 <form name="form" action="options -permalink.php" method="post">173 <?php wp_nonce_field('update-permalink')?>136 <form name="form" action="options.php" method="post"> 137 <?php settings_fields( 'permalink' ); ?> 174 138 175 139 <p><?php _e('By default WordPress uses web <abbr title="Universal Resource Locator">URL</abbr>s which have question marks and lots of numbers in them, however WordPress offers you the ability to create a custom URL structure for your permalinks and archives. This can improve the aesthetics, usability, and forward-compatibility of your links. A <a href="http://codex.wordpress.org/Using_Permalinks">number of tags are available</a>, and here are some examples to get you started.'); ?></p> 176 140 -
wp-admin/options.php
65 65 'privacy' => array( 'blog_public' ), 66 66 'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'blog_charset', 'show_on_front', 'page_on_front', 'page_for_posts' ), 67 67 'writing' => array( 'default_post_edit_rows', 'use_smilies', 'default_category', 'default_email_category', 'use_balanceTags', 'default_link_category', 'default_post_format', 'enable_app', 'enable_xmlrpc' ), 68 'options' => array( '' ) ); 68 'options' => array( '' ), 69 'permalink' => array( 'permalink_structure', 'category_base', 'tag_base' ) ); 69 70 70 71 $mail_options = array('mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass'); 71 72 $uploads_options = array('uploads_use_yearmonth_folders', 'upload_path', 'upload_url_path'); … … 132 133 $_POST['timezone_string'] = ''; 133 134 } 134 135 } 136 137 if ( 'permalink' == $option_page ) { 138 if ( isset( $permalink_structure ) || isset( $category_base ) ) { 135 139 140 if ( isset( $permalink_structure ) ) { 141 if ( isset( $selection ) && 'custom' != $selection ) 142 $permalink_structure = $selection; 143 144 if ( ! empty( $permalink_structure ) ) { 145 $permalink_structure = preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $permalink_structure ) ); 146 if ( $prefix && $blog_prefix ) 147 $permalink_structure = $prefix . preg_replace( '#^/?index\.php#', '', $permalink_structure ); 148 else 149 $permalink_structure = $blog_prefix . $permalink_structure; 150 } 151 $wp_rewrite->set_permalink_structure( $permalink_structure ); 152 } 153 154 if ( isset( $category_base ) ) { 155 if ( ! empty( $category_base ) ) 156 $category_base = $blog_prefix . preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $category_base ) ); 157 $wp_rewrite->set_category_base( $category_base ); 158 } 159 160 if ( isset( $tag_base ) ) { 161 if ( ! empty( $tag_base ) ) 162 $tag_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $tag_base ) ); 163 $wp_rewrite->set_tag_base( $tag_base ); 164 } 165 166 create_initial_taxonomies(); 167 } 168 } 169 136 170 if ( $options ) { 137 171 foreach ( $options as $option ) { 138 172 if ( $unregistered ) … … 153 187 * Handle settings errors and return to options page 154 188 */ 155 189 // If no settings errors were registered add a general 'updated' message. 156 if ( !count( get_settings_errors() ) )190 if ( !count( get_settings_errors() ) && 'permalink' != $option_page ) 157 191 add_settings_error('general', 'settings_updated', __('Settings saved.'), 'updated'); 158 192 set_transient('settings_errors', get_settings_errors(), 30); 159 193