Changeset 37908
- Timestamp:
- 06/29/2016 12:57:19 PM (9 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/default-filters.php
r37708 r37908 405 405 // Script Loader 406 406 add_action( 'wp_default_scripts', 'wp_default_scripts' ); 407 add_action( 'wp_enqueue_scripts', 'wp_localize_jquery_ui_datepicker', 1000 ); 408 add_action( 'admin_enqueue_scripts', 'wp_localize_jquery_ui_datepicker', 1000 ); 407 409 add_filter( 'wp_print_scripts', 'wp_just_in_time_script_localization' ); 408 410 add_filter( 'print_scripts_array', 'wp_prototype_before_jquery' ); -
trunk/src/wp-includes/script-loader.php
r37891 r37908 883 883 'blog_id' => get_current_blog_id(), 884 884 ) ); 885 885 } 886 887 /** 888 * Localizes the jQuery UI datepicker. 889 * 890 * @since 4.6.0 891 * 892 * @link http://api.jqueryui.com/datepicker/#options 893 * @global WP_Locale $wp_locale The WordPress date and time locale object. 894 */ 895 function wp_localize_jquery_ui_datepicker() { 896 global $wp_locale; 897 898 if ( ! wp_script_is( 'jquery-ui-datepicker', 'enqueued' ) ) { 899 return; 900 } 901 902 // Convert the PHP date format into jQuery UI's format. 903 $datepicker_date_format = str_replace( 904 array( 905 'd', 'j', 'l', 'z', // Day. 906 'F', 'M', 'n', 'm', // Month. 907 'Y', 'y' // Year. 908 ), 909 array( 910 'dd', 'd', 'DD', 'o', 911 'MM', 'M', 'm', 'mm', 912 'yy', 'y' 913 ), 914 get_option( 'date_format' ) 915 ); 916 917 $datepicker_defaults = wp_json_encode( array( 918 'closeText' => __( 'Close' ), 919 'currentText' => __( 'Today' ), 920 'monthNames' => array_values( $wp_locale->month ), 921 'monthNamesShort' => array_values( $wp_locale->month_abbrev ), 922 'nextText' => __( 'Next' ), 923 'prevText' => __( 'Previous' ), 924 'dayNames' => array_values( $wp_locale->weekday ), 925 'dayNamesShort' => array_values( $wp_locale->weekday_abbrev ), 926 'dayNamesMin' => array_values( $wp_locale->weekday_initial ), 927 'dateFormat' => $datepicker_date_format, 928 'firstDay' => absint( get_option( 'start_of_week' ) ), 929 'isRTL' => $wp_locale->is_rtl(), 930 ) ); 931 932 wp_add_inline_script( 'jquery-ui-datepicker', "jQuery(document).ready(function(jQuery){jQuery.datepicker.setDefaults({$datepicker_defaults});});" ); 886 933 } 887 934
Note: See TracChangeset
for help on using the changeset viewer.