Ticket #9296: 9296.diff
File 9296.diff, 5.9 KB (added by , 13 years ago) |
---|
-
wp-admin/options.php
61 61 'privacy' => array( 'blog_public' ), 62 62 'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'blog_charset', 'show_on_front', 'page_on_front', 'page_for_posts' ), 63 63 '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' ), 64 'options' => array( '' ) ); 64 'options' => array( '' ), 65 'permalink' => array( 'permalink_structure', 'category_base', 'tag_base' ) ); 65 66 66 67 $mail_options = array('mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass'); 67 68 $uploads_options = array('uploads_use_yearmonth_folders', 'upload_path', 'upload_url_path'); … … 105 106 check_admin_referer( $option_page . '-options' ); 106 107 } 107 108 108 if ( ! isset( $whitelist_options[ $option_page ] ) )109 if ( ! isset( $whitelist_options[ $option_page ] ) ) 109 110 wp_die( __( 'Error: options page not found.' ) ); 110 111 111 112 if ( 'options' == $option_page ) { … … 129 130 $_POST['timezone_string'] = ''; 130 131 } 131 132 } 133 134 if ( 'permalink' == $option_page ) { 135 if ( isset( $permalink_structure ) || isset( $category_base ) ) { 132 136 137 if ( isset( $permalink_structure ) ) { 138 if ( isset( $selection ) && 'custom' != $selection ) 139 $permalink_structure = $selection; 140 141 if ( ! empty( $permalink_structure ) ) { 142 $permalink_structure = preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $permalink_structure ) ); 143 if ( $prefix && $blog_prefix ) 144 $permalink_structure = $prefix . preg_replace( '#^/?index\.php#', '', $permalink_structure ); 145 else 146 $permalink_structure = $blog_prefix . $permalink_structure; 147 } 148 $wp_rewrite->set_permalink_structure( $permalink_structure ); 149 } 150 151 if ( isset( $category_base ) ) { 152 if ( ! empty( $category_base ) ) 153 $category_base = $blog_prefix . preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $category_base ) ); 154 $wp_rewrite->set_category_base( $category_base ); 155 } 156 157 if ( isset( $tag_base ) ) { 158 if ( ! empty( $tag_base ) ) 159 $tag_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $tag_base ) ); 160 $wp_rewrite->set_tag_base( $tag_base ); 161 } 162 163 create_initial_taxonomies(); 164 } 165 } 166 133 167 if ( $options ) { 134 168 foreach ( $options as $option ) { 135 169 if ( $unregistered ) … … 150 184 * Handle settings errors and return to options page 151 185 */ 152 186 // If no settings errors were registered add a general 'updated' message. 153 if ( !count( get_settings_errors() ) )187 if ( !count( get_settings_errors() ) && 'permalink' != $option_page ) 154 188 add_settings_error('general', 'settings_updated', __('Settings saved.'), 'updated'); 155 189 set_transient('settings_errors', get_settings_errors(), 30); 156 190 -
wp-admin/options-permalink.php
65 65 if ( is_multisite() && !is_subdomain_install() && is_main_site() ) 66 66 $blog_prefix = '/blog'; 67 67 68 if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) { 69 check_admin_referer('update-permalink'); 70 71 if ( isset( $_POST['permalink_structure'] ) ) { 72 if ( isset( $_POST['selection'] ) && 'custom' != $_POST['selection'] ) 73 $permalink_structure = $_POST['selection']; 74 else 75 $permalink_structure = $_POST['permalink_structure']; 76 77 if ( ! empty( $permalink_structure ) ) { 78 $permalink_structure = preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $permalink_structure ) ); 79 if ( $prefix && $blog_prefix ) 80 $permalink_structure = $prefix . preg_replace( '#^/?index\.php#', '', $permalink_structure ); 81 else 82 $permalink_structure = $blog_prefix . $permalink_structure; 83 } 84 $wp_rewrite->set_permalink_structure( $permalink_structure ); 85 } 86 87 if ( isset( $_POST['category_base'] ) ) { 88 $category_base = $_POST['category_base']; 89 if ( ! empty( $category_base ) ) 90 $category_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $category_base ) ); 91 $wp_rewrite->set_category_base( $category_base ); 92 } 93 94 if ( isset( $_POST['tag_base'] ) ) { 95 $tag_base = $_POST['tag_base']; 96 if ( ! empty( $tag_base ) ) 97 $tag_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $tag_base ) ); 98 $wp_rewrite->set_tag_base( $tag_base ); 99 } 100 101 create_initial_taxonomies(); 102 } 103 104 $permalink_structure = get_option('permalink_structure'); 105 $category_base = get_option('category_base'); 68 $permalink_structure = get_option( 'permalink_structure' ); 69 $category_base = get_option( 'category_base' ); 106 70 $tag_base = get_option( 'tag_base' ); 107 71 108 72 if ( $iis7_permalinks ) { … … 125 89 $wp_rewrite->flush_rules(); 126 90 127 91 128 if (isset($_ POST['submit'])) : ?>92 if (isset($_GET['settings-updated'])) : ?> 129 93 <div id="message" class="updated"><p><?php 130 94 if ( ! is_multisite() ) { 131 95 if ( $iis7_permalinks ) { … … 152 116 <?php screen_icon(); ?> 153 117 <h2><?php echo esc_html( $title ); ?></h2> 154 118 155 <form name="form" action="options -permalink.php" method="post">156 <?php wp_nonce_field('update-permalink')?>119 <form name="form" action="options.php" method="post"> 120 <?php settings_fields( 'permalink' ); ?> 157 121 158 122 <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> 159 123