Ticket #9296: 9296.3.diff
File 9296.3.diff, 6.1 KB (added by , 12 years ago) |
---|
-
options-permalink.php
82 82 if ( is_multisite() && !is_subdomain_install() && is_main_site() ) 83 83 $blog_prefix = '/blog'; 84 84 85 if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) { 86 check_admin_referer('update-permalink'); 87 88 if ( isset( $_POST['permalink_structure'] ) ) { 89 if ( isset( $_POST['selection'] ) && 'custom' != $_POST['selection'] ) 90 $permalink_structure = $_POST['selection']; 91 else 92 $permalink_structure = $_POST['permalink_structure']; 93 94 if ( ! empty( $permalink_structure ) ) { 95 $permalink_structure = preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $permalink_structure ) ); 96 if ( $prefix && $blog_prefix ) 97 $permalink_structure = $prefix . preg_replace( '#^/?index\.php#', '', $permalink_structure ); 98 else 99 $permalink_structure = $blog_prefix . $permalink_structure; 100 } 101 $wp_rewrite->set_permalink_structure( $permalink_structure ); 102 } 103 104 if ( isset( $_POST['category_base'] ) ) { 105 $category_base = $_POST['category_base']; 106 if ( ! empty( $category_base ) ) 107 $category_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $category_base ) ); 108 $wp_rewrite->set_category_base( $category_base ); 109 } 110 111 if ( isset( $_POST['tag_base'] ) ) { 112 $tag_base = $_POST['tag_base']; 113 if ( ! empty( $tag_base ) ) 114 $tag_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $tag_base ) ); 115 $wp_rewrite->set_tag_base( $tag_base ); 116 } 117 118 create_initial_taxonomies(); 119 } 120 121 $permalink_structure = get_option('permalink_structure'); 122 $category_base = get_option('category_base'); 85 $permalink_structure = get_option( 'permalink_structure' ); 86 $category_base = get_option( 'category_base' ); 123 87 $tag_base = get_option( 'tag_base' ); 124 88 125 89 if ( $iis7_permalinks ) { … … 141 105 142 106 flush_rewrite_rules(); 143 107 144 if ( isset($_POST['submit'])) : ?>108 if ( isset( $_GET['settings-updated'] ) ) : ?> 145 109 <div id="message" class="updated"><p><?php 146 110 if ( ! is_multisite() ) { 147 111 if ( $iis7_permalinks ) { … … 168 132 <?php screen_icon(); ?> 169 133 <h2><?php echo esc_html( $title ); ?></h2> 170 134 171 <form name="form" action="options -permalink.php" method="post">172 <?php wp_nonce_field('update-permalink')?>135 <form name="form" action="options.php" method="POST"> 136 <?php settings_fields( 'permalink' ); ?> 173 137 174 138 <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> 175 139 -
options.php
63 63 'discussion' => array( 'default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating', 'avatar_default', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'page_comments', 'comments_per_page', 'default_comments_page', 'comment_order', 'comment_registration' ), 64 64 'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type' ), 65 65 'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'show_on_front', 'blog_public' ), 66 'writing' => array( 'use_smilies', 'default_category', 'default_email_category', 'use_balanceTags', 'default_link_category', 'default_post_format' ) 66 'writing' => array( 'use_smilies', 'default_category', 'default_email_category', 'use_balanceTags', 'default_link_category', 'default_post_format' ), 67 'permalink' => array( 'permalink_structure', 'category_base', 'tag_base' ), 67 68 ); 68 69 $whitelist_options['misc'] = $whitelist_options['options'] = $whitelist_options['privacy'] = array(); 69 70 … … 139 140 } 140 141 } 141 142 143 // Handle permalinks page. 144 if ( 'permalink' == $option_page ) { 145 if ( isset( $permalink_structure ) || isset( $category_base ) ) { 146 147 if ( isset( $permalink_structure ) ) { 148 if ( isset( $selection ) && 'custom' != $selection ) 149 $permalink_structure = $selection; 150 151 if ( ! empty( $permalink_structure ) ) { 152 $permalink_structure = preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $permalink_structure ) ); 153 if ( $prefix && $blog_prefix ) 154 $permalink_structure = $prefix . preg_replace( '#^/?index\.php#', '', $permalink_structure ); 155 else 156 $permalink_structure = $blog_prefix . $permalink_structure; 157 } 158 $wp_rewrite->set_permalink_structure( $permalink_structure ); 159 } 160 161 if ( isset( $category_base ) ) { 162 if ( ! empty( $category_base ) ) 163 $category_base = $blog_prefix . preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $category_base ) ); 164 $wp_rewrite->set_category_base( $category_base ); 165 } 166 167 if ( isset( $tag_base ) ) { 168 if ( ! empty( $tag_base ) ) 169 $tag_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $tag_base ) ); 170 $wp_rewrite->set_tag_base( $tag_base ); 171 } 172 173 create_initial_taxonomies(); 174 } 175 } 176 142 177 if ( $options ) { 143 178 foreach ( $options as $option ) { 144 179 if ( $unregistered ) … … 160 195 * Handle settings errors and return to options page 161 196 */ 162 197 // If no settings errors were registered add a general 'updated' message. 163 if ( !count( get_settings_errors() ) )198 if ( !count( get_settings_errors() ) && 'permalink' != $option_page ) 164 199 add_settings_error('general', 'settings_updated', __('Settings saved.'), 'updated'); 165 200 set_transient('settings_errors', get_settings_errors(), 30); 166 201