X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/38ca813a0e312e2768e5b9519f0415cd0aa84781..a9fa37e08fa731c7bd108a175c24876823bc071b:/wp-admin/options-permalink.php diff --git a/wp-admin/options-permalink.php b/wp-admin/options-permalink.php index 50aa32e1..6fab4d21 100644 --- a/wp-admin/options-permalink.php +++ b/wp-admin/options-permalink.php @@ -7,7 +7,7 @@ */ /** WordPress Administration Bootstrap */ -require_once('./admin.php'); +require_once( dirname( __FILE__ ) . '/admin.php' ); if ( ! current_user_can( 'manage_options' ) ) wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) ); @@ -15,55 +15,56 @@ if ( ! current_user_can( 'manage_options' ) ) $title = __('Permalink Settings'); $parent_file = 'options-general.php'; -add_contextual_help($current_screen, - '

' . __('This screen provides some common options for your default permalinks URL structure.') . '

' . - '

' . __('If you pick an option other than Default, your general URL path with structure tags, terms surrounded by %, will also appear in the custom structure field and your path can be further modified there.') . '

' . - '

' . __('When you assign multiple categories or tags to a post, only one can show up in the permalink: the lowest numbered category. This applies if your custom structure includes %category% or %tag%.') . '

' . - '

' . __('Note that permalinks beginning with the category, tag, author or postname structure tags require more advanced server resources. Double-check your hosting details to make sure those are in place or start your permalinks with other structure tags.') . '

' . - '

' . __('The Optional fields let you customize the “category” and “tag” base names that will appear in archive URLs. For example, the page listing all posts in the “Uncategorized” category could be /topics/uncategorized instead of /category/uncategorized.') . '

' . - '

' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '

' . +get_current_screen()->add_help_tab( array( + 'id' => 'overview', + 'title' => __('Overview'), + 'content' => '

' . __('Permalinks are the permanent URLs to your individual pages and blog posts, as well as your category and tag archives. A permalink is the web address used to link to your content. The URL to each post should be permanent, and never change — hence the name permalink.') . '

' . + '

' . __( 'This screen allows you to choose your permalink structure. You can choose from common settings or create custom URL structures.' ) . '

' . + '

' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '

', +) ); + +get_current_screen()->add_help_tab( array( + 'id' => 'permalink-settings', + 'title' => __('Permalink Settings'), + 'content' => '

' . __( 'Permalinks can contain useful information, such as the post date, title, or other elements. You can choose from any of the suggested permalink formats, or you can craft your own if you select Custom Structure.' ) . '

' . + '

' . __( 'If you pick an option other than Plain, your general URL path with structure tags (terms surrounded by %) will also appear in the custom structure field and your path can be further modified there.' ) . '

' . + '

' . __('When you assign multiple categories or tags to a post, only one can show up in the permalink: the lowest numbered category. This applies if your custom structure includes %category% or %tag%.') . '

' . + '

' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '

', +) ); + +get_current_screen()->add_help_tab( array( + 'id' => 'custom-structures', + 'title' => __('Custom Structures'), + 'content' => '

' . __('The Optional fields let you customize the “category” and “tag” base names that will appear in archive URLs. For example, the page listing all posts in the “Uncategorized” category could be /topics/uncategorized instead of /category/uncategorized.') . '

' . + '

' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '

', +) ); + +get_current_screen()->set_help_sidebar( '

' . __('For more information:') . '

' . - '

' . __('Documentation on Permalinks Settings') . '

' . - '

' . __('Documentation on Using Permalinks') . '

' . - '

' . __('Support Forums') . '

' + '

' . __('Documentation on Permalinks Settings') . '

' . + '

' . __('Documentation on Using Permalinks') . '

' . + '

' . __('Support Forums') . '

' ); -/** - * Display JavaScript on the page. - * - * @package WordPress - * @subpackage Permalink_Settings_Screen - */ -function add_js() { - ?> - -set_tag_base( $tag_base ); } - create_initial_taxonomies(); + wp_redirect( admin_url( 'options-permalink.php?settings-updated=true' ) ); + exit; } -$permalink_structure = get_option('permalink_structure'); -$category_base = get_option('category_base'); -$tag_base = get_option( 'tag_base' ); +$category_base = get_option( 'category_base' ); +$tag_base = get_option( 'tag_base' ); +$update_required = false; if ( $iis7_permalinks ) { if ( ( ! file_exists($home_path . 'web.config') && win_is_writable($home_path) ) || win_is_writable($home_path . 'web.config') ) $writable = true; else $writable = false; +} elseif ( $is_nginx ) { + $writable = false; } else { - if ( ( ! file_exists($home_path . '.htaccess') && is_writable($home_path) ) || is_writable($home_path . '.htaccess') ) + if ( ( ! file_exists( $home_path . '.htaccess' ) && is_writable( $home_path ) ) || is_writable( $home_path . '.htaccess' ) ) { $writable = true; - else + } else { $writable = false; + $existing_rules = array_filter( extract_from_markers( $home_path . '.htaccess', 'WordPress' ) ); + $new_rules = array_filter( explode( "\n", $wp_rewrite->mod_rewrite_rules() ) ); + $update_required = ( $new_rules !== $existing_rules ); + } } if ( $wp_rewrite->using_index_permalinks() ) @@ -122,24 +130,29 @@ if ( $wp_rewrite->using_index_permalinks() ) else $usingpi = false; -$wp_rewrite->flush_rules(); +flush_rewrite_rules(); +require( ABSPATH . 'wp-admin/admin-header.php' ); -if (isset($_POST['submit'])) : ?> -

+

- -

+

-

URLs 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 number of tags are available, and here are some examples to get you started.'); ?>

+

number of tags are available, and here are some examples to get you started.' ); ?>

'', + 1 => $prefix . '/%year%/%monthnum%/%day%/%postname%/', + 2 => $prefix . '/%year%/%monthnum%/%postname%/', + 3 => $prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/%post_id%', + 4 => $prefix . '/%postname%/', +); ?> -

- +

+
- + - - + + - - + + - - + + + + + + -

- -

URLs here. For example, using topics as your category base would make your category links like http://example.org/topics/uncategorized/. If you leave these blank the defaults will be used.') ?>

- -

URLs here. For example, using topics as your category base would make your category links like http://example.org/index.php/topics/uncategorized/. If you leave these blank the defaults will be used.') ?>

- +

+

topics as your category base would make your category links like %s/topics/uncategorized/. If you leave these blank the defaults will be used.' ), get_option( 'home' ) . $blog_prefix . $prefix ); ?>

@@ -229,24 +244,26 @@ $structures = array( -

web.config file were writable, we could do this automatically, but it isn’t so this is the url rewrite rule you should have in your web.config file. Click in the field and press CTRL + a to select all. Then insert this rule inside of the /<configuration>/<system.webServer>/<rewrite>/<rules> element in web.config file.') ?>

+

web.config file were writable, we could do this automatically, but it isn’t so this is the url rewrite rule you should have in your web.config file. Click in the field and press CTRL + a to select all. Then insert this rule inside of the /<configuration>/<system.webServer>/<rewrite>/<rules> element in web.config file.') ?>

-

web.config file writable for us to generate rewrite rules automatically, do not forget to revert the permissions after rule has been saved.') ?>

+

web.config file writable for us to generate rewrite rules automatically, do not forget to revert the permissions after rule has been saved.') ?>

-

writable, we could do this automatically, but it isn’t so this is the url rewrite rule you should have in your web.config file. Create a new file, called web.config in the root directory of your site. Click in the field and press CTRL + a to select all. Then insert this code into the web.config file.') ?>

+

writable, we could do this automatically, but it isn’t so this is the url rewrite rule you should have in your web.config file. Create a new file, called web.config in the root directory of your site. Click in the field and press CTRL + a to select all. Then insert this code into the web.config file.') ?>

-

web.config file automatically, do not forget to revert the permissions after the file has been created.') ?>

+

web.config file automatically, do not forget to revert the permissions after the file has been created.') ?>

- -

.htaccess file were writable, we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your .htaccess file. Click in the field and press CTRL + a to select all.') ?>

+ +

Documentation on Nginx configuration.' ); ?>

+ +

.htaccess file were writable, we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your .htaccess file. Click in the field and press CTRL + a to select all.') ?>

@@ -257,4 +274,4 @@ $structures = array( - +