18 $timezone_format = _x('Y-m-d G:i:s', 'timezone date format'); |
18 $timezone_format = _x('Y-m-d G:i:s', 'timezone date format'); |
19 |
19 |
20 /** |
20 /** |
21 * Display JavaScript on the page. |
21 * Display JavaScript on the page. |
22 * |
22 * |
23 * @package WordPress |
23 * @since 3.5.0 |
24 * @subpackage General_Settings_Screen |
|
25 */ |
24 */ |
26 function add_js() { |
25 function options_general_add_js() { |
27 ?> |
26 ?> |
28 <script type="text/javascript"> |
27 <script type="text/javascript"> |
29 //<![CDATA[ |
28 //<![CDATA[ |
30 jQuery(document).ready(function($){ |
29 jQuery(document).ready(function($){ |
31 $("input[name='date_format']").click(function(){ |
30 $("input[name='date_format']").click(function(){ |
43 $("input[name='time_format_custom']").focus(function(){ |
42 $("input[name='time_format_custom']").focus(function(){ |
44 $("#time_format_custom_radio").attr("checked", "checked"); |
43 $("#time_format_custom_radio").attr("checked", "checked"); |
45 }); |
44 }); |
46 $("input[name='date_format_custom'], input[name='time_format_custom']").change( function() { |
45 $("input[name='date_format_custom'], input[name='time_format_custom']").change( function() { |
47 var format = $(this); |
46 var format = $(this); |
48 format.siblings('img').css('visibility','visible'); |
47 format.siblings('.spinner').css('display', 'inline-block'); // show(); can't be used here |
49 $.post(ajaxurl, { |
48 $.post(ajaxurl, { |
50 action: 'date_format_custom' == format.attr('name') ? 'date_format' : 'time_format', |
49 action: 'date_format_custom' == format.attr('name') ? 'date_format' : 'time_format', |
51 date : format.val() |
50 date : format.val() |
52 }, function(d) { format.siblings('img').css('visibility','hidden'); format.siblings('.example').text(d); } ); |
51 }, function(d) { format.siblings('.spinner').hide(); format.siblings('.example').text(d); } ); |
53 }); |
52 }); |
54 }); |
53 }); |
55 //]]> |
54 //]]> |
56 </script> |
55 </script> |
57 <?php |
56 <?php |
58 } |
57 } |
59 add_action('admin_head', 'add_js'); |
58 add_action('admin_head', 'options_general_add_js'); |
60 |
59 |
61 $options_help = '<p>' . __('The fields on this screen determine some of the basics of your site setup.') . '</p>' . |
60 $options_help = '<p>' . __('The fields on this screen determine some of the basics of your site setup.') . '</p>' . |
62 '<p>' . __('Most themes display the site title at the top of every page, in the title bar of the browser, and as the identifying name for syndicated feeds. The tagline is also displayed by many themes.') . '</p>'; |
61 '<p>' . __('Most themes display the site title at the top of every page, in the title bar of the browser, and as the identifying name for syndicated feeds. The tagline is also displayed by many themes.') . '</p>'; |
63 |
62 |
64 if ( ! is_multisite() ) { |
63 if ( ! is_multisite() ) { |
229 <th scope="row"><?php _e('Date Format') ?></th> |
228 <th scope="row"><?php _e('Date Format') ?></th> |
230 <td> |
229 <td> |
231 <fieldset><legend class="screen-reader-text"><span><?php _e('Date Format') ?></span></legend> |
230 <fieldset><legend class="screen-reader-text"><span><?php _e('Date Format') ?></span></legend> |
232 <?php |
231 <?php |
233 |
232 |
234 $date_formats = apply_filters( 'date_formats', array( |
233 $date_formats = array_unique( apply_filters( 'date_formats', array( |
235 __('F j, Y'), |
234 __('F j, Y'), |
236 'Y/m/d', |
235 'Y/m/d', |
237 'm/d/Y', |
236 'm/d/Y', |
238 'd/m/Y', |
237 'd/m/Y', |
239 ) ); |
238 ) ) ); |
240 |
239 |
241 $custom = true; |
240 $custom = true; |
242 |
241 |
243 foreach ( $date_formats as $format ) { |
242 foreach ( $date_formats as $format ) { |
244 echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='date_format' value='" . esc_attr($format) . "'"; |
243 echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='date_format' value='" . esc_attr($format) . "'"; |
249 echo ' /> <span>' . date_i18n( $format ) . "</span></label><br />\n"; |
248 echo ' /> <span>' . date_i18n( $format ) . "</span></label><br />\n"; |
250 } |
249 } |
251 |
250 |
252 echo ' <label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"'; |
251 echo ' <label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"'; |
253 checked( $custom ); |
252 checked( $custom ); |
254 echo '/> ' . __('Custom:') . ' </label><input type="text" name="date_format_custom" value="' . esc_attr( get_option('date_format') ) . '" class="small-text" /> <span class="example"> ' . date_i18n( get_option('date_format') ) . "</span> <img class='ajax-loading' src='" . esc_url( admin_url( 'images/wpspin_light.gif' ) ) . "' />\n"; |
253 echo '/> ' . __('Custom:') . ' </label><input type="text" name="date_format_custom" value="' . esc_attr( get_option('date_format') ) . '" class="small-text" /> <span class="example"> ' . date_i18n( get_option('date_format') ) . "</span> <span class='spinner'></span>\n"; |
255 |
254 |
256 echo "\t<p>" . __('<a href="http://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date and time formatting</a>.') . "</p>\n"; |
255 echo "\t<p>" . __('<a href="http://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date and time formatting</a>.') . "</p>\n"; |
257 ?> |
256 ?> |
258 </fieldset> |
257 </fieldset> |
259 </td> |
258 </td> |
262 <th scope="row"><?php _e('Time Format') ?></th> |
261 <th scope="row"><?php _e('Time Format') ?></th> |
263 <td> |
262 <td> |
264 <fieldset><legend class="screen-reader-text"><span><?php _e('Time Format') ?></span></legend> |
263 <fieldset><legend class="screen-reader-text"><span><?php _e('Time Format') ?></span></legend> |
265 <?php |
264 <?php |
266 |
265 |
267 $time_formats = apply_filters( 'time_formats', array( |
266 $time_formats = array_unique( apply_filters( 'time_formats', array( |
268 __('g:i a'), |
267 __('g:i a'), |
269 'g:i A', |
268 'g:i A', |
270 'H:i', |
269 'H:i', |
271 ) ); |
270 ) ) ); |
272 |
271 |
273 $custom = true; |
272 $custom = true; |
274 |
273 |
275 foreach ( $time_formats as $format ) { |
274 foreach ( $time_formats as $format ) { |
276 echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='time_format' value='" . esc_attr($format) . "'"; |
275 echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='time_format' value='" . esc_attr($format) . "'"; |
281 echo ' /> <span>' . date_i18n( $format ) . "</span></label><br />\n"; |
280 echo ' /> <span>' . date_i18n( $format ) . "</span></label><br />\n"; |
282 } |
281 } |
283 |
282 |
284 echo ' <label><input type="radio" name="time_format" id="time_format_custom_radio" value="\c\u\s\t\o\m"'; |
283 echo ' <label><input type="radio" name="time_format" id="time_format_custom_radio" value="\c\u\s\t\o\m"'; |
285 checked( $custom ); |
284 checked( $custom ); |
286 echo '/> ' . __('Custom:') . ' </label><input type="text" name="time_format_custom" value="' . esc_attr( get_option('time_format') ) . '" class="small-text" /> <span class="example"> ' . date_i18n( get_option('time_format') ) . "</span> <img class='ajax-loading' src='" . esc_url( admin_url( 'images/wpspin_light.gif' ) ) . "' />\n"; |
285 echo '/> ' . __('Custom:') . ' </label><input type="text" name="time_format_custom" value="' . esc_attr( get_option('time_format') ) . '" class="small-text" /> <span class="example"> ' . date_i18n( get_option('time_format') ) . "</span> <span class='spinner'></span>\n"; |
287 ; |
286 ; |
288 ?> |
287 ?> |
289 </fieldset> |
288 </fieldset> |
290 </td> |
289 </td> |
291 </tr> |
290 </tr> |