-
+ C3F84E51F460C5EF75A9C8FB834A0A8E6867D2FA549945A18F355CE10982F8F56B0FA6B44731DEC04B9ECDCFC5CF27586C3CC796DFA546C980B368288360D7B0mp-wp/wp-admin/options-permalink.php(0 . 0)(1 . 216)
53904 <?php
53905 /**
53906 * Permalink settings administration panel.
53907 *
53908 * @package WordPress
53909 * @subpackage Administration
53910 */
53911
53912 /** WordPress Administration Bootstrap */
53913 require_once('admin.php');
53914
53915 $title = __('Permalink Settings');
53916 $parent_file = 'options-general.php';
53917
53918 /**
53919 * Display JavaScript on the page.
53920 *
53921 * @package WordPress
53922 * @subpackage Permalink_Settings_Panel
53923 */
53924 function add_js() {
53925 ?>
53926 <script type="text/javascript">
53927 //<![CDATA[
53928 function GetElementsWithClassName(elementName, className) {
53929 var allElements = document.getElementsByTagName(elementName);
53930 var elemColl = new Array();
53931 for (i = 0; i < allElements.length; i++) {
53932 if (allElements[i].className == className) {
53933 elemColl[elemColl.length] = allElements[i];
53934 }
53935 }
53936 return elemColl;
53937 }
53938
53939 function upit() {
53940 var inputColl = GetElementsWithClassName('input', 'tog');
53941 var structure = document.getElementById('permalink_structure');
53942 var inputs = '';
53943 for (i = 0; i < inputColl.length; i++) {
53944 if ( inputColl[i].checked && inputColl[i].value != '') {
53945 inputs += inputColl[i].value + ' ';
53946 }
53947 }
53948 inputs = inputs.substr(0,inputs.length - 1);
53949 if ( 'custom' != inputs )
53950 structure.value = inputs;
53951 }
53952
53953 function blurry() {
53954 if (!document.getElementById) return;
53955
53956 var structure = document.getElementById('permalink_structure');
53957 structure.onfocus = function () { document.getElementById('custom_selection').checked = 'checked'; }
53958
53959 var aInputs = document.getElementsByTagName('input');
53960
53961 for (var i = 0; i < aInputs.length; i++) {
53962 aInputs[i].onclick = aInputs[i].onkeyup = upit;
53963 }
53964 }
53965
53966 window.onload = blurry;
53967 //]]>
53968 </script>
53969 <?php
53970 }
53971 add_filter('admin_head', 'add_js');
53972
53973 include('admin-header.php');
53974
53975 $home_path = get_home_path();
53976
53977 if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) {
53978 check_admin_referer('update-permalink');
53979
53980 if ( isset($_POST['permalink_structure']) ) {
53981 $permalink_structure = $_POST['permalink_structure'];
53982 if (! empty($permalink_structure) )
53983 $permalink_structure = preg_replace('#/+#', '/', '/' . $_POST['permalink_structure']);
53984 $wp_rewrite->set_permalink_structure($permalink_structure);
53985 }
53986
53987 if ( isset($_POST['category_base']) ) {
53988 $category_base = $_POST['category_base'];
53989 if (! empty($category_base) )
53990 $category_base = preg_replace('#/+#', '/', '/' . $_POST['category_base']);
53991 $wp_rewrite->set_category_base($category_base);
53992 }
53993
53994 if ( isset($_POST['tag_base']) ) {
53995 $tag_base = $_POST['tag_base'];
53996 if (! empty($tag_base) )
53997 $tag_base = preg_replace('#/+#', '/', '/' . $_POST['tag_base']);
53998 $wp_rewrite->set_tag_base($tag_base);
53999 }
54000 }
54001
54002 $permalink_structure = get_option('permalink_structure');
54003 $category_base = get_option('category_base');
54004 $tag_base = get_option( 'tag_base' );
54005
54006 if ( (!file_exists($home_path.'.htaccess') && is_writable($home_path)) || is_writable($home_path.'.htaccess') )
54007 $writable = true;
54008 else
54009 $writable = false;
54010
54011 if ($wp_rewrite->using_index_permalinks())
54012 $usingpi = true;
54013 else
54014 $usingpi = false;
54015
54016 $wp_rewrite->flush_rules();
54017 ?>
54018
54019 <?php if (isset($_POST['submit'])) : ?>
54020 <div id="message" class="updated fade"><p><?php
54021 if ( $permalink_structure && !$usingpi && !$writable )
54022 _e('You should update your .htaccess now.');
54023 else
54024 _e('Permalink structure updated.');
54025 ?></p></div>
54026 <?php endif; ?>
54027
54028 <div class="wrap">
54029 <?php screen_icon(); ?>
54030 <h2><?php echo wp_specialchars( $title ); ?></h2>
54031
54032 <form name="form" action="options-permalink.php" method="post">
54033 <?php wp_nonce_field('update-permalink') ?>
54034
54035 <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>
54036
54037 <?php
54038 $prefix = '';
54039
54040 if ( ! got_mod_rewrite() )
54041 $prefix = '/index.php';
54042
54043 $structures = array(
54044 '',
54045 $prefix . '/%year%/%monthnum%/%day%/%postname%/',
54046 $prefix . '/%year%/%monthnum%/%postname%/',
54047 $prefix . '/archives/%post_id%'
54048 );
54049 ?>
54050 <h3><?php _e('Common settings'); ?></h3>
54051 <table class="form-table">
54052 <tr>
54053 <th><label><input name="selection" type="radio" value="" class="tog" <?php checked('', $permalink_structure); ?> /> <?php _e('Default'); ?></label></th>
54054 <td><code><?php echo get_option('home'); ?>/?p=123</code></td>
54055 </tr>
54056 <tr>
54057 <th><label><input name="selection" type="radio" value="<?php echo $structures[1]; ?>" class="tog" <?php checked($structures[1], $permalink_structure); ?> /> <?php _e('Day and name'); ?></label></th>
54058 <td><code><?php echo get_option('home') . $prefix . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/sample-post/'; ?></code></td>
54059 </tr>
54060 <tr>
54061 <th><label><input name="selection" type="radio" value="<?php echo $structures[2]; ?>" class="tog" <?php checked($structures[2], $permalink_structure); ?> /> <?php _e('Month and name'); ?></label></th>
54062 <td><code><?php echo get_option('home') . $prefix . '/' . date('Y') . '/' . date('m') . '/sample-post/'; ?></code></td>
54063 </tr>
54064 <tr>
54065 <th><label><input name="selection" type="radio" value="<?php echo $structures[3]; ?>" class="tog" <?php checked($structures[3], $permalink_structure); ?> /> <?php _e('Numeric'); ?></label></th>
54066 <td><code><?php echo get_option('home') . $prefix ; ?>/archives/123</code></td>
54067 </tr>
54068 <tr>
54069 <th>
54070 <label><input name="selection" id="custom_selection" type="radio" value="custom" class="tog"
54071 <?php if ( !in_array($permalink_structure, $structures) ) { ?>
54072 checked="checked"
54073 <?php } ?>
54074 />
54075 <?php _e('Custom Structure'); ?>
54076 </label>
54077 </th>
54078 <td>
54079 <input name="permalink_structure" id="permalink_structure" type="text" value="<?php echo attribute_escape($permalink_structure); ?>" class="regular-text code" />
54080 </td>
54081 </tr>
54082 </table>
54083
54084 <h3><?php _e('Optional'); ?></h3>
54085 <?php if ($is_apache) : ?>
54086 <p><?php _e('If you like, you may enter custom structures for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <kbd>topics</kbd> as your category base would make your category links like <code>http://example.org/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p>
54087 <?php else : ?>
54088 <p><?php _e('If you like, you may enter custom structures for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <code>topics</code> as your category base would make your category links like <code>http://example.org/index.php/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p>
54089 <?php endif; ?>
54090
54091 <table class="form-table">
54092 <tr>
54093 <th><label for="category_base"><?php _e('Category base'); ?></label></th>
54094 <td><input name="category_base" id="category_base" type="text" value="<?php echo attribute_escape($category_base); ?>" class="regular-text code" /></td>
54095 </tr>
54096 <tr>
54097 <th><label for="tag_base"><?php _e('Tag base'); ?></label></th>
54098 <td><input name="tag_base" id="tag_base" type="text" value="<?php echo attribute_escape($tag_base); ?>" class="regular-text code" /></td>
54099 </tr>
54100 <?php do_settings_fields('permalink', 'optional'); ?>
54101 </table>
54102
54103 <?php do_settings_sections('permalink'); ?>
54104
54105 <p class="submit">
54106 <input type="submit" name="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
54107 </p>
54108 </form>
54109 <?php if ( $permalink_structure && !$usingpi && !$writable ) : ?>
54110 <p><?php _e('If your <code>.htaccess</code> file were <a href="http://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn’t so 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.') ?></p>
54111 <form action="options-permalink.php" method="post">
54112 <?php wp_nonce_field('update-permalink') ?>
54113 <p><textarea rows="6" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo wp_specialchars($wp_rewrite->mod_rewrite_rules()); ?></textarea></p>
54114 </form>
54115 <?php endif; ?>
54116
54117 </div>
54118
54119 <?php require('./admin-footer.php'); ?>