2003-10-26 01:25:26 -04:00
< ? php
2004-04-24 23:59:12 -04:00
require_once ( '../wp-includes/wp-l10n.php' );
$title = __ ( 'Permalink Options' );
2004-04-19 04:09:27 -04:00
$parent_file = 'options-general.php' ;
2003-10-26 01:25:26 -04:00
2003-12-18 04:36:13 -05:00
$wpvarstoreset = array ( 'action' , 'standalone' , 'option_group_id' );
for ( $i = 0 ; $i < count ( $wpvarstoreset ); $i += 1 ) {
$wpvar = $wpvarstoreset [ $i ];
if ( ! isset ( $$wpvar )) {
2004-04-20 18:56:47 -04:00
if ( empty ( $_POST [ " $wpvar " ])) {
if ( empty ( $_GET [ " $wpvar " ])) {
2003-12-18 04:36:13 -05:00
$$wpvar = '' ;
2003-10-26 01:25:26 -04:00
} else {
2004-04-20 18:56:47 -04:00
$$wpvar = $_GET [ " $wpvar " ];
2003-10-26 01:25:26 -04:00
}
} else {
2004-04-20 18:56:47 -04:00
$$wpvar = $_POST [ " $wpvar " ];
2003-10-26 01:25:26 -04:00
}
}
}
2004-04-22 16:58:15 -04:00
require_once ( './optionhandler.php' );
2003-10-26 01:25:26 -04:00
2004-05-09 01:47:02 -04:00
if ( isset ( $_POST [ 'submit' ])) {
2004-04-20 18:56:47 -04:00
update_option ( 'permalink_structure' , $_POST [ 'permalink_structure' ]);
$permalink_structure = $_POST [ 'permalink_structure' ];
2004-05-05 03:34:41 -04:00
update_option ( 'category_base' , $_POST [ 'category_base' ]);
$category_base = $_POST [ 'category_base' ];
2003-10-26 01:25:26 -04:00
} else {
$permalink_structure = get_settings ( 'permalink_structure' );
2004-05-05 03:34:41 -04:00
$category_base = get_settings ( 'category_base' );
2003-10-26 01:25:26 -04:00
}
2004-04-22 16:58:15 -04:00
require_once ( 'admin-header.php' );
2004-04-11 04:15:10 -04:00
if ( $user_level <= 6 ) {
2004-04-24 23:59:12 -04:00
die ( __ ( " You have do not have sufficient permissions to edit the options for this blog. " ));
2003-10-26 01:25:26 -04:00
}
2004-04-22 16:58:15 -04:00
require ( './options-head.php' );
2003-10-26 01:25:26 -04:00
?>
2004-05-09 01:47:02 -04:00
< ? php if ( isset ( $_POST [ 'submit' ])) : ?>
2004-04-28 00:56:29 -04:00
< div class = " updated " >< p >< ? php _e ( 'Permalink structure updated.' ); ?> </p></div>
< ? php endif ; ?>
2004-07-27 19:37:45 -04:00
< ? php if ( isset ( $_POST [ 'rules' ])) {
$rules = explode ( " \n " , $_POST [ 'rules' ]);
if ( insert_with_markers ( ABSPATH . '.htaccess' , 'WordPress' , $rules )) {
?>
< div class = " updated " id = " htupdate " >< p >< ? php _e ( 'mod_rewrite rules written to .htaccess.' ); ?> </p></div>
< ? php
} else {
?>
< div class = " updated " id = " htupdate " >< p >< ? php _e ( 'Failed to write mod_rewrite rules to .htaccess.' ); ?> </p></div>
< ? php
}
}
?>
2003-10-26 01:25:26 -04:00
< div class = " wrap " >
2004-04-24 23:59:12 -04:00
< h2 >< ? php _e ( 'Edit Permalink Structure' ) ?> </h2>
< ? php _e ( '<p>WordPress offers you the ability to create a custom URI structure for your permalinks and archives. The following “tags” are available:</p>' ) ?>
2004-05-05 03:34:41 -04:00
< dl >
< dt >< code >% year %</ code ></ dt >
< dd >
< ? php _e ( 'The year of the post, 4 digits, for example <code>2004</code>' ) ?>
</ dd >
< dt >< code >% monthnum %</ code ></ dt >
< dd >
< ? php _e ( 'Month of the year, for example <code>05</code>' ) ?>
</ dd >
< dt >< code >% day %</ code ></ dt >
< dd >
< ? php _e ( 'Day of the month, for example <code>28</code>' ) ?>
</ dd >
< dt >< code >% hour %</ code ></ dt >
< dd >
< ? php _e ( 'Hour of the day, for example <code>15</code>' ) ?>
</ dd >
< dt >< code >% minute %</ code ></ dt >
< dd >
< ? php _e ( 'Minute of the hour, for example <code>43</code>' ) ?>
</ dd >
< dt >< code >% second %</ code ></ dt >
< dd >
< ? php _e ( 'Second of the minute, for example <code>33</code>' ) ?>
</ dd >
< dt >< code >% postname %</ code ></ dt >
< dd >
< ? php _e ( 'A sanitized version of the title of the post. So “This Is A Great Post!” becomes “<code>this-is-a-great-post</code>” in the URI' ) ?>
</ dd >
< dt >< code >% post_id %</ code ></ dt >
< dd >
< ? php _e ( 'The unique ID # of the post, for example <code>423</code>' ) ?>
</ dd >
</ dl >
2004-04-24 23:59:12 -04:00
< ? php _e ( ' < p > So for example a value like :</ p >
2004-04-15 03:53:45 -04:00
< p >< code >/ archives /% year %/% monthnum %/% day %/% postname %/</ code > </ p >
2004-04-21 17:38:38 -04:00
< p > would give you a permalink like :</ p >
< p >< code >/ archives / 2003 / 05 / 23 / my - cheese - sandwich /</ code ></ p >
< p > In general for this you must use mod_rewrite , however if you put a filename at the beginning WordPress will attempt to use that to pass the arguments , for example :</ p >
2004-04-15 03:53:45 -04:00
< p >< code >/ index . php / archives /% year %/% monthnum %/% day %/% postname %/</ code > </ p >
2004-06-13 12:14:58 -04:00
< p > If you use this option you can ignore the mod_rewrite rules .</ p > ' ) ?>
2003-12-10 19:22:36 -05:00
< form name = " form " action = " options-permalink.php " method = " post " >
2004-05-05 03:34:41 -04:00
< p >< ? php _e ( 'Use the template tags above to create a virtual site structure:' ) ?> </p>
2003-10-26 01:25:26 -04:00
< p >
2004-04-22 16:58:15 -04:00
< input name = " permalink_structure " type = " text " style = " width: 98%; " value = " <?php echo $permalink_structure ; ?> " />
2003-10-26 01:25:26 -04:00
</ p >
2004-05-08 22:52:27 -04:00
< p >< ? php _e ( 'If you like, you may enter a custom prefix for your category URIs here. For example, <code>/taxonomy/categorias</code> would make your category links like <code>http://example.org/taxonomy/categorias/general/</code>. If you leave this blank the default will be used.' ) ?> </p>
2004-05-05 03:34:41 -04:00
< p >
< input name = " category_base " type = " text " style = " width: 98%; " value = " <?php echo $category_base ; ?> " />
</ p >
2004-04-19 04:09:27 -04:00
< p class = " submit " >
2004-06-11 14:23:12 -04:00
< input type = " submit " name = " submit " value = " <?php _e('Update Permalink Structure »') ?> " />
2003-10-26 01:25:26 -04:00
</ p >
</ form >
2003-10-30 10:03:30 -05:00
< ? php
if ( $permalink_structure ) {
?>
2004-05-14 04:38:34 -04:00
< p >< ? php printf ( __ ( 'Using the permalink structure value you currently have, <code>%s</code>, these are the mod_rewrite rules you should have in your <code>.htaccess</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all.' ), $permalink_structure ) ?> </p>
2004-07-27 19:37:45 -04:00
< form action = " options-permalink.php " method = " post " >
2004-04-15 03:53:45 -04:00
< p >
2004-07-27 19:37:45 -04:00
< textarea rows = " 5 " style = " width: 98%; " name = " rules " >< ? php echo mod_rewrite_rules ( $permalink_structure ); ?>
2004-05-31 13:22:25 -04:00
</ textarea >
2004-04-15 03:53:45 -04:00
</ p >
2004-07-27 19:37:45 -04:00
< ? php
if (( ! file_exists ( ABSPATH . '.htaccess' ) && is_writable ( ABSPATH )) || is_writable ( ABSPATH . '.htaccess' )) {
?>
< p class = " submit " >
< input type = " submit " name = " writerules " value = " <?php _e('Write mod_rewrite rules to .htaccess »') ?> " >
</ p >
< ? php } ?>
2004-03-08 00:12:11 -05:00
</ form >
2004-06-19 00:23:59 -04:00
2003-10-26 01:25:26 -04:00
< ? php
2003-10-30 10:03:30 -05:00
} else {
?>
< p >
2004-04-24 23:59:12 -04:00
< ? php _e ( 'You are not currently using customized permalinks. No special mod_rewrite rules are needed.' ) ?>
2003-10-30 10:03:30 -05:00
</ p >
2004-05-14 04:38:34 -04:00
< ? php } ?>
</ div >
2003-10-26 01:25:26 -04:00
2004-05-14 04:38:34 -04:00
< ? php
2004-04-22 16:58:15 -04:00
require ( './admin-footer.php' );
2004-05-14 04:38:34 -04:00
?>