web/wp-admin/options-permalink.php
changeset 204 09a1c134465b
parent 194 32102edaa81b
equal deleted inserted replaced
203:f507feede89a 204:09a1c134465b
    47 );
    47 );
    48 
    48 
    49 /**
    49 /**
    50  * Display JavaScript on the page.
    50  * Display JavaScript on the page.
    51  *
    51  *
    52  * @package WordPress
    52  * @since 3.5.0
    53  * @subpackage Permalink_Settings_Screen
       
    54  */
    53  */
    55 function add_js() {
    54 function options_permalink_add_js() {
    56 	?>
    55 	?>
    57 <script type="text/javascript">
    56 <script type="text/javascript">
    58 //<![CDATA[
    57 //<![CDATA[
    59 jQuery(document).ready(function() {
    58 jQuery(document).ready(function() {
    60 	jQuery('input:radio.tog').change(function() {
    59 	jQuery('.permalink-structure input:radio').change(function() {
    61 		if ( 'custom' == this.value )
    60 		if ( 'custom' == this.value )
    62 			return;
    61 			return;
    63 		jQuery('#permalink_structure').val( this.value );
    62 		jQuery('#permalink_structure').val( this.value );
    64 	});
    63 	});
    65 	jQuery('#permalink_structure').focus(function() {
    64 	jQuery('#permalink_structure').focus(function() {
    68 });
    67 });
    69 //]]>
    68 //]]>
    70 </script>
    69 </script>
    71 <?php
    70 <?php
    72 }
    71 }
    73 add_filter('admin_head', 'add_js');
    72 add_filter('admin_head', 'options_permalink_add_js');
    74 
    73 
    75 include('./admin-header.php');
    74 include('./admin-header.php');
    76 
    75 
    77 $home_path = get_home_path();
    76 $home_path = get_home_path();
    78 $iis7_permalinks = iis7_supports_permalinks();
    77 $iis7_permalinks = iis7_supports_permalinks();
   188 	3 => $prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/%post_id%',
   187 	3 => $prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/%post_id%',
   189 	4 => $prefix . '/%postname%/',
   188 	4 => $prefix . '/%postname%/',
   190 );
   189 );
   191 ?>
   190 ?>
   192 <h3><?php _e('Common Settings'); ?></h3>
   191 <h3><?php _e('Common Settings'); ?></h3>
   193 <table class="form-table">
   192 <table class="form-table permalink-structure">
   194 	<tr>
   193 	<tr>
   195 		<th><label><input name="selection" type="radio" value="" class="tog" <?php checked('', $permalink_structure); ?> /> <?php _e('Default'); ?></label></th>
   194 		<th><label><input name="selection" type="radio" value="" <?php checked('', $permalink_structure); ?> /> <?php _e('Default'); ?></label></th>
   196 		<td><code><?php echo get_option('home'); ?>/?p=123</code></td>
   195 		<td><code><?php echo get_option('home'); ?>/?p=123</code></td>
   197 	</tr>
   196 	</tr>
   198 	<tr>
   197 	<tr>
   199 		<th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[1]); ?>" class="tog" <?php checked($structures[1], $permalink_structure); ?> /> <?php _e('Day and name'); ?></label></th>
   198 		<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>
   200 		<td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td>
   199 		<td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td>
   201 	</tr>
   200 	</tr>
   202 	<tr>
   201 	<tr>
   203 		<th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[2]); ?>" class="tog" <?php checked($structures[2], $permalink_structure); ?> /> <?php _e('Month and name'); ?></label></th>
   202 		<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>
   204 		<td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . date('Y') . '/' . date('m') . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td>
   203 		<td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . date('Y') . '/' . date('m') . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td>
   205 	</tr>
   204 	</tr>
   206 	<tr>
   205 	<tr>
   207 		<th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[3]); ?>" class="tog" <?php checked($structures[3], $permalink_structure); ?> /> <?php _e('Numeric'); ?></label></th>
   206 		<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>
   208 		<td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/123'; ?></code></td>
   207 		<td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/123'; ?></code></td>
   209 	</tr>
   208 	</tr>
   210 	<tr>
   209 	<tr>
   211 		<th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[4]); ?>" class="tog" <?php checked($structures[4], $permalink_structure); ?> /> <?php _e('Post name'); ?></label></th>
   210 		<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>
   212 		<td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td>
   211 		<td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td>
   213 	</tr>
   212 	</tr>
   214 	<tr>
   213 	<tr>
   215 		<th>
   214 		<th>
   216 			<label><input name="selection" id="custom_selection" type="radio" value="custom" class="tog" <?php checked( !in_array($permalink_structure, $structures) ); ?> />
   215 			<label><input name="selection" id="custom_selection" type="radio" value="custom" <?php checked( !in_array($permalink_structure, $structures) ); ?> />
   217 			<?php _e('Custom Structure'); ?>
   216 			<?php _e('Custom Structure'); ?>
   218 			</label>
   217 			</label>
   219 		</th>
   218 		</th>
   220 		<td>
   219 		<td>
   221 			<?php echo $blog_prefix; ?>
   220 			<code><?php echo get_option('home') . $blog_prefix; ?></code>
   222 			<input name="permalink_structure" id="permalink_structure" type="text" value="<?php echo esc_attr($permalink_structure); ?>" class="regular-text code" />
   221 			<input name="permalink_structure" id="permalink_structure" type="text" value="<?php echo esc_attr($permalink_structure); ?>" class="regular-text code" />
   223 		</td>
   222 		</td>
   224 	</tr>
   223 	</tr>
   225 </table>
   224 </table>
   226 
   225