7 */ |
7 */ |
8 |
8 |
9 /** WordPress Administration Bootstrap */ |
9 /** WordPress Administration Bootstrap */ |
10 require_once( dirname( __FILE__ ) . '/admin.php' ); |
10 require_once( dirname( __FILE__ ) . '/admin.php' ); |
11 |
11 |
12 if ( ! current_user_can( 'manage_options' ) ) |
12 if ( ! current_user_can( 'manage_options' ) ) { |
13 wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) ); |
13 wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) ); |
14 |
14 } |
15 $title = __('Permalink Settings'); |
15 |
|
16 $title = __( 'Permalink Settings' ); |
16 $parent_file = 'options-general.php'; |
17 $parent_file = 'options-general.php'; |
17 |
18 |
18 get_current_screen()->add_help_tab( array( |
19 get_current_screen()->add_help_tab( |
19 'id' => 'overview', |
20 array( |
20 'title' => __('Overview'), |
21 'id' => 'overview', |
21 'content' => '<p>' . __('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.') . '</p>' . |
22 'title' => __( 'Overview' ), |
22 '<p>' . __( 'This screen allows you to choose your permalink structure. You can choose from common settings or create custom URL structures.' ) . '</p>' . |
23 'content' => '<p>' . __( '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.' ) . '</p>' . |
23 '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>', |
24 '<p>' . __( 'This screen allows you to choose your permalink structure. You can choose from common settings or create custom URL structures.' ) . '</p>' . |
24 ) ); |
25 '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>', |
25 |
26 ) |
26 get_current_screen()->add_help_tab( array( |
27 ); |
27 'id' => 'permalink-settings', |
28 |
28 'title' => __('Permalink Settings'), |
29 get_current_screen()->add_help_tab( |
29 'content' => '<p>' . __( '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.' ) . '</p>' . |
30 array( |
30 '<p>' . __( 'If you pick an option other than Plain, your general URL path with structure tags (terms surrounded by <code>%</code>) will also appear in the custom structure field and your path can be further modified there.' ) . '</p>' . |
31 'id' => 'permalink-settings', |
31 '<p>' . __('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 <code>%category%</code> or <code>%tag%</code>.') . '</p>' . |
32 'title' => __( 'Permalink Settings' ), |
32 '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>', |
33 'content' => '<p>' . __( '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.' ) . '</p>' . |
33 ) ); |
34 '<p>' . __( 'If you pick an option other than Plain, your general URL path with structure tags (terms surrounded by <code>%</code>) will also appear in the custom structure field and your path can be further modified there.' ) . '</p>' . |
34 |
35 '<p>' . __( '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 <code>%category%</code> or <code>%tag%</code>.' ) . '</p>' . |
35 get_current_screen()->add_help_tab( array( |
36 '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>', |
36 'id' => 'custom-structures', |
37 ) |
37 'title' => __('Custom Structures'), |
38 ); |
38 'content' => '<p>' . __('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 <code>/topics/uncategorized</code> instead of <code>/category/uncategorized</code>.') . '</p>' . |
39 |
39 '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>', |
40 get_current_screen()->add_help_tab( |
40 ) ); |
41 array( |
|
42 'id' => 'custom-structures', |
|
43 'title' => __( 'Custom Structures' ), |
|
44 'content' => '<p>' . __( '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 <code>/topics/uncategorized</code> instead of <code>/category/uncategorized</code>.' ) . '</p>' . |
|
45 '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>', |
|
46 ) |
|
47 ); |
41 |
48 |
42 get_current_screen()->set_help_sidebar( |
49 get_current_screen()->set_help_sidebar( |
43 '<p><strong>' . __('For more information:') . '</strong></p>' . |
50 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
44 '<p>' . __('<a href="https://codex.wordpress.org/Settings_Permalinks_Screen">Documentation on Permalinks Settings</a>') . '</p>' . |
51 '<p>' . __( '<a href="https://codex.wordpress.org/Settings_Permalinks_Screen">Documentation on Permalinks Settings</a>' ) . '</p>' . |
45 '<p>' . __('<a href="https://codex.wordpress.org/Using_Permalinks">Documentation on Using Permalinks</a>') . '</p>' . |
52 '<p>' . __( '<a href="https://codex.wordpress.org/Using_Permalinks">Documentation on Using Permalinks</a>' ) . '</p>' . |
46 '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>' |
53 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
47 ); |
54 ); |
48 |
55 |
49 $home_path = get_home_path(); |
56 $home_path = get_home_path(); |
50 $iis7_permalinks = iis7_supports_permalinks(); |
57 $iis7_permalinks = iis7_supports_permalinks(); |
51 $permalink_structure = get_option( 'permalink_structure' ); |
58 $permalink_structure = get_option( 'permalink_structure' ); |
52 |
59 |
53 $prefix = $blog_prefix = ''; |
60 $prefix = $blog_prefix = ''; |
54 if ( ! got_url_rewrite() ) |
61 if ( ! got_url_rewrite() ) { |
55 $prefix = '/index.php'; |
62 $prefix = '/index.php'; |
|
63 } |
56 |
64 |
57 /** |
65 /** |
58 * In a subdirectory configuration of multisite, the `/blog` prefix is used by |
66 * In a subdirectory configuration of multisite, the `/blog` prefix is used by |
59 * default on the main site to avoid collisions with other sites created on that |
67 * default on the main site to avoid collisions with other sites created on that |
60 * network. If the `permalink_structure` option has been changed to remove this |
68 * network. If the `permalink_structure` option has been changed to remove this |
62 */ |
70 */ |
63 if ( is_multisite() && ! is_subdomain_install() && is_main_site() && 0 === strpos( $permalink_structure, '/blog/' ) ) { |
71 if ( is_multisite() && ! is_subdomain_install() && is_main_site() && 0 === strpos( $permalink_structure, '/blog/' ) ) { |
64 $blog_prefix = '/blog'; |
72 $blog_prefix = '/blog'; |
65 } |
73 } |
66 |
74 |
67 $category_base = get_option( 'category_base' ); |
75 $category_base = get_option( 'category_base' ); |
68 $tag_base = get_option( 'tag_base' ); |
76 $tag_base = get_option( 'tag_base' ); |
69 $update_required = false; |
77 $update_required = false; |
70 |
78 |
71 if ( $iis7_permalinks ) { |
79 if ( $iis7_permalinks ) { |
72 if ( ( ! file_exists($home_path . 'web.config') && win_is_writable($home_path) ) || win_is_writable($home_path . 'web.config') ) |
80 if ( ( ! file_exists( $home_path . 'web.config' ) && win_is_writable( $home_path ) ) || win_is_writable( $home_path . 'web.config' ) ) { |
73 $writable = true; |
81 $writable = true; |
74 else |
82 } else { |
75 $writable = false; |
83 $writable = false; |
|
84 } |
76 } elseif ( $is_nginx ) { |
85 } elseif ( $is_nginx ) { |
77 $writable = false; |
86 $writable = false; |
78 } else { |
87 } else { |
79 if ( ( ! file_exists( $home_path . '.htaccess' ) && is_writable( $home_path ) ) || is_writable( $home_path . '.htaccess' ) ) { |
88 if ( ( ! file_exists( $home_path . '.htaccess' ) && is_writable( $home_path ) ) || is_writable( $home_path . '.htaccess' ) ) { |
80 $writable = true; |
89 $writable = true; |
81 } else { |
90 } else { |
82 $writable = false; |
91 $writable = false; |
83 $existing_rules = array_filter( extract_from_markers( $home_path . '.htaccess', 'WordPress' ) ); |
92 $existing_rules = array_filter( extract_from_markers( $home_path . '.htaccess', 'WordPress' ) ); |
84 $new_rules = array_filter( explode( "\n", $wp_rewrite->mod_rewrite_rules() ) ); |
93 $new_rules = array_filter( explode( "\n", $wp_rewrite->mod_rewrite_rules() ) ); |
85 $update_required = ( $new_rules !== $existing_rules ); |
94 $update_required = ( $new_rules !== $existing_rules ); |
86 } |
95 } |
87 } |
96 } |
88 |
97 |
89 $using_index_permalinks = $wp_rewrite->using_index_permalinks(); |
98 $using_index_permalinks = $wp_rewrite->using_index_permalinks(); |
90 |
99 |
91 if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) { |
100 if ( isset( $_POST['permalink_structure'] ) || isset( $_POST['category_base'] ) ) { |
92 check_admin_referer('update-permalink'); |
101 check_admin_referer( 'update-permalink' ); |
93 |
102 |
94 if ( isset( $_POST['permalink_structure'] ) ) { |
103 if ( isset( $_POST['permalink_structure'] ) ) { |
95 if ( isset( $_POST['selection'] ) && 'custom' != $_POST['selection'] ) |
104 if ( isset( $_POST['selection'] ) && 'custom' != $_POST['selection'] ) { |
96 $permalink_structure = $_POST['selection']; |
105 $permalink_structure = $_POST['selection']; |
97 else |
106 } else { |
98 $permalink_structure = $_POST['permalink_structure']; |
107 $permalink_structure = $_POST['permalink_structure']; |
|
108 } |
99 |
109 |
100 if ( ! empty( $permalink_structure ) ) { |
110 if ( ! empty( $permalink_structure ) ) { |
101 $permalink_structure = preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $permalink_structure ) ); |
111 $permalink_structure = preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $permalink_structure ) ); |
102 if ( $prefix && $blog_prefix ) |
112 if ( $prefix && $blog_prefix ) { |
103 $permalink_structure = $prefix . preg_replace( '#^/?index\.php#', '', $permalink_structure ); |
113 $permalink_structure = $prefix . preg_replace( '#^/?index\.php#', '', $permalink_structure ); |
104 else |
114 } else { |
105 $permalink_structure = $blog_prefix . $permalink_structure; |
115 $permalink_structure = $blog_prefix . $permalink_structure; |
|
116 } |
106 } |
117 } |
107 |
118 |
108 $permalink_structure = sanitize_option( 'permalink_structure', $permalink_structure ); |
119 $permalink_structure = sanitize_option( 'permalink_structure', $permalink_structure ); |
109 |
120 |
110 $wp_rewrite->set_permalink_structure( $permalink_structure ); |
121 $wp_rewrite->set_permalink_structure( $permalink_structure ); |
111 } |
122 } |
112 |
123 |
113 if ( isset( $_POST['category_base'] ) ) { |
124 if ( isset( $_POST['category_base'] ) ) { |
114 $category_base = $_POST['category_base']; |
125 $category_base = $_POST['category_base']; |
115 if ( ! empty( $category_base ) ) |
126 if ( ! empty( $category_base ) ) { |
116 $category_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $category_base ) ); |
127 $category_base = $blog_prefix . preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $category_base ) ); |
|
128 } |
117 $wp_rewrite->set_category_base( $category_base ); |
129 $wp_rewrite->set_category_base( $category_base ); |
118 } |
130 } |
119 |
131 |
120 if ( isset( $_POST['tag_base'] ) ) { |
132 if ( isset( $_POST['tag_base'] ) ) { |
121 $tag_base = $_POST['tag_base']; |
133 $tag_base = $_POST['tag_base']; |
122 if ( ! empty( $tag_base ) ) |
134 if ( ! empty( $tag_base ) ) { |
123 $tag_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $tag_base ) ); |
135 $tag_base = $blog_prefix . preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $tag_base ) ); |
|
136 } |
124 $wp_rewrite->set_tag_base( $tag_base ); |
137 $wp_rewrite->set_tag_base( $tag_base ); |
125 } |
138 } |
126 |
139 |
127 $message = __( 'Permalink structure updated.' ); |
140 $message = __( 'Permalink structure updated.' ); |
128 |
141 |
152 ?> |
165 ?> |
153 <div class="wrap"> |
166 <div class="wrap"> |
154 <h1><?php echo esc_html( $title ); ?></h1> |
167 <h1><?php echo esc_html( $title ); ?></h1> |
155 |
168 |
156 <form name="form" action="options-permalink.php" method="post"> |
169 <form name="form" action="options-permalink.php" method="post"> |
157 <?php wp_nonce_field('update-permalink') ?> |
170 <?php wp_nonce_field( 'update-permalink' ); ?> |
158 |
171 |
159 <p><?php |
172 <p> |
|
173 <?php |
160 printf( |
174 printf( |
161 /* translators: %s: Codex URL */ |
175 /* translators: %s: Codex URL */ |
162 __( 'WordPress offers you the ability to create a custom URL structure for your permalinks and archives. Custom URL structures can improve the aesthetics, usability, and forward-compatibility of your links. A <a href="%s">number of tags are available</a>, and here are some examples to get you started.' ), |
176 __( 'WordPress offers you the ability to create a custom URL structure for your permalinks and archives. Custom URL structures can improve the aesthetics, usability, and forward-compatibility of your links. A <a href="%s">number of tags are available</a>, and here are some examples to get you started.' ), |
163 __( 'https://codex.wordpress.org/Using_Permalinks' ) |
177 __( 'https://codex.wordpress.org/Using_Permalinks' ) |
164 ); |
178 ); |
165 ?></p> |
179 ?> |
|
180 </p> |
166 |
181 |
167 <?php |
182 <?php |
168 if ( is_multisite() && ! is_subdomain_install() && is_main_site() && 0 === strpos( $permalink_structure, '/blog/' ) ) { |
183 if ( is_multisite() && ! is_subdomain_install() && is_main_site() && 0 === strpos( $permalink_structure, '/blog/' ) ) { |
169 $permalink_structure = preg_replace( '|^/?blog|', '', $permalink_structure ); |
184 $permalink_structure = preg_replace( '|^/?blog|', '', $permalink_structure ); |
170 $category_base = preg_replace( '|^/?blog|', '', $category_base ); |
185 $category_base = preg_replace( '|^/?blog|', '', $category_base ); |
171 $tag_base = preg_replace( '|^/?blog|', '', $tag_base ); |
186 $tag_base = preg_replace( '|^/?blog|', '', $tag_base ); |
172 } |
187 } |
173 |
188 |
174 $structures = array( |
189 $structures = array( |
175 0 => '', |
190 0 => '', |
176 1 => $prefix . '/%year%/%monthnum%/%day%/%postname%/', |
191 1 => $prefix . '/%year%/%monthnum%/%day%/%postname%/', |
177 2 => $prefix . '/%year%/%monthnum%/%postname%/', |
192 2 => $prefix . '/%year%/%monthnum%/%postname%/', |
178 3 => $prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/%post_id%', |
193 3 => $prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/%post_id%', |
179 4 => $prefix . '/%postname%/', |
194 4 => $prefix . '/%postname%/', |
180 ); |
195 ); |
181 ?> |
196 ?> |
182 <h2 class="title"><?php _e('Common Settings'); ?></h2> |
197 <h2 class="title"><?php _e( 'Common Settings' ); ?></h2> |
183 <table class="form-table permalink-structure"> |
198 <table class="form-table permalink-structure"> |
184 <tr> |
199 <tr> |
185 <th><label><input name="selection" type="radio" value="" <?php checked('', $permalink_structure); ?> /> <?php _e( 'Plain' ); ?></label></th> |
200 <th scope="row"><label><input name="selection" type="radio" value="" <?php checked( '', $permalink_structure ); ?> /> <?php _e( 'Plain' ); ?></label></th> |
186 <td><code><?php echo get_option('home'); ?>/?p=123</code></td> |
201 <td><code><?php echo get_option( 'home' ); ?>/?p=123</code></td> |
187 </tr> |
202 </tr> |
188 <tr> |
203 <tr> |
189 <th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[1]); ?>" <?php checked($structures[1], $permalink_structure); ?> /> <?php _e('Day and name'); ?></label></th> |
204 <th scope="row"><label><input name="selection" type="radio" value="<?php echo esc_attr( $structures[1] ); ?>" <?php checked( $structures[1], $permalink_structure ); ?> /> <?php _e( 'Day and name' ); ?></label></th> |
190 <td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td> |
205 <td><code><?php echo get_option( 'home' ) . $blog_prefix . $prefix . '/' . date( 'Y' ) . '/' . date( 'm' ) . '/' . date( 'd' ) . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td> |
191 </tr> |
206 </tr> |
192 <tr> |
207 <tr> |
193 <th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[2]); ?>" <?php checked($structures[2], $permalink_structure); ?> /> <?php _e('Month and name'); ?></label></th> |
208 <th scope="row"><label><input name="selection" type="radio" value="<?php echo esc_attr( $structures[2] ); ?>" <?php checked( $structures[2], $permalink_structure ); ?> /> <?php _e( 'Month and name' ); ?></label></th> |
194 <td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . date('Y') . '/' . date('m') . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td> |
209 <td><code><?php echo get_option( 'home' ) . $blog_prefix . $prefix . '/' . date( 'Y' ) . '/' . date( 'm' ) . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td> |
195 </tr> |
210 </tr> |
196 <tr> |
211 <tr> |
197 <th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[3]); ?>" <?php checked($structures[3], $permalink_structure); ?> /> <?php _e('Numeric'); ?></label></th> |
212 <th scope="row"><label><input name="selection" type="radio" value="<?php echo esc_attr( $structures[3] ); ?>" <?php checked( $structures[3], $permalink_structure ); ?> /> <?php _e( 'Numeric' ); ?></label></th> |
198 <td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/123'; ?></code></td> |
213 <td><code><?php echo get_option( 'home' ) . $blog_prefix . $prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/123'; ?></code></td> |
199 </tr> |
214 </tr> |
200 <tr> |
215 <tr> |
201 <th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[4]); ?>" <?php checked($structures[4], $permalink_structure); ?> /> <?php _e('Post name'); ?></label></th> |
216 <th scope="row"><label><input name="selection" type="radio" value="<?php echo esc_attr( $structures[4] ); ?>" <?php checked( $structures[4], $permalink_structure ); ?> /> <?php _e( 'Post name' ); ?></label></th> |
202 <td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td> |
217 <td><code><?php echo get_option( 'home' ) . $blog_prefix . $prefix . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td> |
203 </tr> |
218 </tr> |
204 <tr> |
219 <tr> |
205 <th> |
220 <th scope="row"> |
206 <label><input name="selection" id="custom_selection" type="radio" value="custom" <?php checked( !in_array($permalink_structure, $structures) ); ?> /> |
221 <label><input name="selection" id="custom_selection" type="radio" value="custom" <?php checked( ! in_array( $permalink_structure, $structures ) ); ?> /> |
207 <?php _e('Custom Structure'); ?> |
222 <?php _e( 'Custom Structure' ); ?> |
208 </label> |
223 </label> |
209 </th> |
224 </th> |
210 <td> |
225 <td> |
211 <code><?php echo get_option('home') . $blog_prefix; ?></code> |
226 <code><?php echo get_option( 'home' ) . $blog_prefix; ?></code> |
212 <input name="permalink_structure" id="permalink_structure" type="text" value="<?php echo esc_attr($permalink_structure); ?>" class="regular-text code" /> |
227 <input name="permalink_structure" id="permalink_structure" type="text" value="<?php echo esc_attr( $permalink_structure ); ?>" class="regular-text code" /> |
213 <div class="available-structure-tags hide-if-no-js"> |
228 <div class="available-structure-tags hide-if-no-js"> |
214 <div id="custom_selection_updated" aria-live="assertive" class="screen-reader-text"></div> |
229 <div id="custom_selection_updated" aria-live="assertive" class="screen-reader-text"></div> |
215 <?php |
230 <?php |
216 $available_tags = array( |
231 $available_tags = array( |
217 /* translators: %s: permalink structure tag */ |
232 /* translators: %s: permalink structure tag */ |
275 </div> |
290 </div> |
276 </td> |
291 </td> |
277 </tr> |
292 </tr> |
278 </table> |
293 </table> |
279 |
294 |
280 <h2 class="title"><?php _e('Optional'); ?></h2> |
295 <h2 class="title"><?php _e( 'Optional' ); ?></h2> |
281 <p><?php |
296 <p> |
|
297 <?php |
282 /* translators: %s: placeholder that must come at the start of the URL */ |
298 /* translators: %s: placeholder that must come at the start of the URL */ |
283 printf( __( 'If you like, you may enter custom structures for your category and tag URLs here. For example, using <code>topics</code> as your category base would make your category links like <code>%s/topics/uncategorized/</code>. If you leave these blank the defaults will be used.' ), get_option( 'home' ) . $blog_prefix . $prefix ); ?></p> |
299 printf( __( 'If you like, you may enter custom structures for your category and tag URLs here. For example, using <code>topics</code> as your category base would make your category links like <code>%s/topics/uncategorized/</code>. If you leave these blank the defaults will be used.' ), get_option( 'home' ) . $blog_prefix . $prefix ); |
284 |
300 ?> |
285 <table class="form-table"> |
301 </p> |
286 <tr> |
302 |
287 <th><label for="category_base"><?php /* translators: prefix for category permalinks */ _e('Category base'); ?></label></th> |
303 <table class="form-table" role="presentation"> |
|
304 <tr> |
|
305 <th><label for="category_base"><?php /* translators: prefix for category permalinks */ _e( 'Category base' ); ?></label></th> |
288 <td><?php echo $blog_prefix; ?> <input name="category_base" id="category_base" type="text" value="<?php echo esc_attr( $category_base ); ?>" class="regular-text code" /></td> |
306 <td><?php echo $blog_prefix; ?> <input name="category_base" id="category_base" type="text" value="<?php echo esc_attr( $category_base ); ?>" class="regular-text code" /></td> |
289 </tr> |
307 </tr> |
290 <tr> |
308 <tr> |
291 <th><label for="tag_base"><?php _e('Tag base'); ?></label></th> |
309 <th><label for="tag_base"><?php _e( 'Tag base' ); ?></label></th> |
292 <td><?php echo $blog_prefix; ?> <input name="tag_base" id="tag_base" type="text" value="<?php echo esc_attr($tag_base); ?>" class="regular-text code" /></td> |
310 <td><?php echo $blog_prefix; ?> <input name="tag_base" id="tag_base" type="text" value="<?php echo esc_attr( $tag_base ); ?>" class="regular-text code" /></td> |
293 </tr> |
311 </tr> |
294 <?php do_settings_fields('permalink', 'optional'); ?> |
312 <?php do_settings_fields( 'permalink', 'optional' ); ?> |
295 </table> |
313 </table> |
296 |
314 |
297 <?php do_settings_sections('permalink'); ?> |
315 <?php do_settings_sections( 'permalink' ); ?> |
298 |
316 |
299 <?php submit_button(); ?> |
317 <?php submit_button(); ?> |
300 </form> |
318 </form> |
301 <?php if ( !is_multisite() ) { ?> |
319 <?php if ( ! is_multisite() ) { ?> |
302 <?php if ( $iis7_permalinks ) : |
320 <?php |
303 if ( isset($_POST['submit']) && $permalink_structure && ! $using_index_permalinks && ! $writable ) : |
321 if ( $iis7_permalinks ) : |
304 if ( file_exists($home_path . 'web.config') ) : ?> |
322 if ( isset( $_POST['submit'] ) && $permalink_structure && ! $using_index_permalinks && ! $writable ) : |
305 <p><?php |
323 if ( file_exists( $home_path . 'web.config' ) ) : |
306 printf( |
324 ?> |
307 /* translators: 1: web.config, 2: Codex URL, 3: CTRL + a, 4: element code */ |
325 <p> |
308 __( 'If your %1$s file was <a href="%2$s">writable</a>, we could do this automatically, but it isn’t so this is the url rewrite rule you should have in your %1$s file. Click in the field and press %3$s to select all. Then insert this rule inside of the %4$s element in %1$s file.' ), |
326 <?php |
309 '<code>web.config</code>', |
327 printf( |
310 __( 'https://codex.wordpress.org/Changing_File_Permissions' ), |
328 /* translators: 1: web.config, 2: Codex URL, 3: CTRL + a, 4: element code */ |
311 '<kbd>CTRL + a</kbd>', |
329 __( 'If your %1$s file was <a href="%2$s">writable</a>, we could do this automatically, but it isn’t so this is the url rewrite rule you should have in your %1$s file. Click in the field and press %3$s to select all. Then insert this rule inside of the %4$s element in %1$s file.' ), |
312 '<code>/<configuration>/<system.webServer>/<rewrite>/<rules></code>' |
330 '<code>web.config</code>', |
313 ); |
331 __( 'https://codex.wordpress.org/Changing_File_Permissions' ), |
314 ?></p> |
332 '<kbd>CTRL + a</kbd>', |
|
333 '<code>/<configuration>/<system.webServer>/<rewrite>/<rules></code>' |
|
334 ); |
|
335 ?> |
|
336 </p> |
315 <form action="options-permalink.php" method="post"> |
337 <form action="options-permalink.php" method="post"> |
316 <?php wp_nonce_field('update-permalink') ?> |
338 <?php wp_nonce_field( 'update-permalink' ); ?> |
317 <p><textarea rows="9" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->iis7_url_rewrite_rules() ); ?></textarea></p> |
339 <p><textarea rows="9" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->iis7_url_rewrite_rules() ); ?></textarea></p> |
318 </form> |
340 </form> |
319 <p><?php |
341 <p> |
320 printf( |
342 <?php |
321 /* translators: %s: web.config */ |
343 printf( |
322 __( 'If you temporarily make your %s file writable for us to generate rewrite rules automatically, do not forget to revert the permissions after rule has been saved.' ), |
344 /* translators: %s: web.config */ |
323 '<code>web.config</code>' |
345 __( 'If you temporarily make your %s file writable for us to generate rewrite rules automatically, do not forget to revert the permissions after rule has been saved.' ), |
324 ); |
346 '<code>web.config</code>' |
325 ?></p> |
347 ); |
|
348 ?> |
|
349 </p> |
326 <?php else : ?> |
350 <?php else : ?> |
327 <p><?php |
351 <p> |
328 printf( |
352 <?php |
329 /* translators: 1: Codex URL, 2: web.config, 3: CTRL + a */ |
353 printf( |
330 __( 'If the root directory of your site was <a href="%1$s">writable</a>, we could do this automatically, but it isn’t so this is the url rewrite rule you should have in your %2$s file. Create a new file, called %2$s in the root directory of your site. Click in the field and press %3$s to select all. Then insert this code into the %2$s file.' ), |
354 /* translators: 1: Codex URL, 2: web.config, 3: CTRL + a */ |
331 __( 'https://codex.wordpress.org/Changing_File_Permissions' ), |
355 __( 'If the root directory of your site was <a href="%1$s">writable</a>, we could do this automatically, but it isn’t so this is the url rewrite rule you should have in your %2$s file. Create a new file, called %2$s in the root directory of your site. Click in the field and press %3$s to select all. Then insert this code into the %2$s file.' ), |
332 '<code>web.config</code>', |
356 __( 'https://codex.wordpress.org/Changing_File_Permissions' ), |
333 '<kbd>CTRL + a</kbd>' |
357 '<code>web.config</code>', |
334 ); |
358 '<kbd>CTRL + a</kbd>' |
335 ?></p> |
359 ); |
|
360 ?> |
|
361 </p> |
336 <form action="options-permalink.php" method="post"> |
362 <form action="options-permalink.php" method="post"> |
337 <?php wp_nonce_field('update-permalink') ?> |
363 <?php wp_nonce_field( 'update-permalink' ); ?> |
338 <p><textarea rows="18" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->iis7_url_rewrite_rules(true) ); ?></textarea></p> |
364 <p><textarea rows="18" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->iis7_url_rewrite_rules( true ) ); ?></textarea></p> |
339 </form> |
365 </form> |
340 <p><?php |
366 <p> |
341 printf( |
367 <?php |
342 /* translators: %s: web.config */ |
368 printf( |
343 __( 'If you temporarily make your site’s root directory writable for us to generate the %s file automatically, do not forget to revert the permissions after the file has been created.' ), |
369 /* translators: %s: web.config */ |
344 '<code>web.config</code>' |
370 __( 'If you temporarily make your site’s root directory writable for us to generate the %s file automatically, do not forget to revert the permissions after the file has been created.' ), |
345 ); |
371 '<code>web.config</code>' |
346 ?></p> |
372 ); |
|
373 ?> |
|
374 </p> |
347 <?php endif; ?> |
375 <?php endif; ?> |
348 <?php endif; ?> |
376 <?php endif; ?> |
349 <?php elseif ( $is_nginx ) : ?> |
377 <?php elseif ( $is_nginx ) : ?> |
350 <p><?php _e( '<a href="https://codex.wordpress.org/Nginx">Documentation on Nginx configuration</a>.' ); ?></p> |
378 <p><?php _e( '<a href="https://codex.wordpress.org/Nginx">Documentation on Nginx configuration</a>.' ); ?></p> |
351 <?php else: |
379 <?php |
352 if ( $permalink_structure && ! $using_index_permalinks && ! $writable && $update_required ) : ?> |
380 else : |
353 <p><?php |
381 if ( $permalink_structure && ! $using_index_permalinks && ! $writable && $update_required ) : |
354 printf( |
382 ?> |
355 /* translators: 1: .htaccess, 2: Codex URL, 3: CTRL + a */ |
383 <p> |
356 __( 'If your %1$s file was <a href="%2$s">writable</a>, we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your %1$s file. Click in the field and press %3$s to select all.' ), |
384 <?php |
357 '<code>.htaccess</code>', |
385 printf( |
358 __( 'https://codex.wordpress.org/Changing_File_Permissions' ), |
386 /* translators: 1: .htaccess, 2: Codex URL, 3: CTRL + a */ |
359 '<kbd>CTRL + a</kbd>' |
387 __( 'If your %1$s file was <a href="%2$s">writable</a>, we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your %1$s file. Click in the field and press %3$s to select all.' ), |
360 ); |
388 '<code>.htaccess</code>', |
361 ?></p> |
389 __( 'https://codex.wordpress.org/Changing_File_Permissions' ), |
|
390 '<kbd>CTRL + a</kbd>' |
|
391 ); |
|
392 ?> |
|
393 </p> |
362 <form action="options-permalink.php" method="post"> |
394 <form action="options-permalink.php" method="post"> |
363 <?php wp_nonce_field('update-permalink') ?> |
395 <?php wp_nonce_field( 'update-permalink' ); ?> |
364 <p><textarea rows="6" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->mod_rewrite_rules() ); ?></textarea></p> |
396 <p><textarea rows="6" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->mod_rewrite_rules() ); ?></textarea></p> |
365 </form> |
397 </form> |
366 <?php endif; ?> |
398 <?php endif; ?> |
367 <?php endif; ?> |
399 <?php endif; ?> |
368 <?php } // multisite ?> |
400 <?php } // multisite ?> |