PHP Class RWMB_Datetime_Field

Afficher le fichier Open project: rilwis/meta-box Class Usage Examples

Protected Properties

Свойство Type Description
$date_formats array Translate date format from jQuery UI date picker to PHP date() It's used to store timestamp value of the field Missing: '!' => '', 'oo' => '', '@' => '', "''" => "'"
$time_formats array Translate time format from jQuery UI time picker to PHP date() It's used to store timestamp value of the field Missing: 't' => '', T' => '', 'm' => '', 's' => ''

Méthodes publiques

Méthode Description
admin_enqueue_scripts ( ) Enqueue scripts and styles
admin_register_scripts ( ) Register scripts and styles.
get_attributes ( array $field, mixed $value = null ) : array Get the attributes for a field
html ( mixed $meta, array $field ) : string Get field HTML
meta ( integer $post_id, boolean $saved, array $field ) : mixed Get meta value
normalize ( array $field ) : array Normalize parameters for field
translate_format ( array $field ) : string Returns a date() compatible format string from the JavaScript format
value ( mixed $new, mixed $old, integer $post_id, array $field ) : string | integer Calculates the timestamp from the datetime string and returns it if $field['timestamp'] is set or the datetime string if not

Méthodes protégées

Méthode Description
prepare_meta ( array | string $meta, array $field ) : array Format meta value if set 'timestamp'

Method Details

admin_enqueue_scripts() public static méthode

Enqueue scripts and styles
public static admin_enqueue_scripts ( )

admin_register_scripts() public static méthode

Register scripts and styles.
public static admin_register_scripts ( )

get_attributes() public static méthode

Get the attributes for a field
public static get_attributes ( array $field, mixed $value = null ) : array
$field array
$value mixed
Résultat array

html() public static méthode

Get field HTML
public static html ( mixed $meta, array $field ) : string
$meta mixed
$field array
Résultat string

meta() public static méthode

Get meta value
public static meta ( integer $post_id, boolean $saved, array $field ) : mixed
$post_id integer
$saved boolean
$field array
Résultat mixed

normalize() public static méthode

Normalize parameters for field
public static normalize ( array $field ) : array
$field array
Résultat array

prepare_meta() protected static méthode

Format meta value if set 'timestamp'
protected static prepare_meta ( array | string $meta, array $field ) : array
$meta array | string The meta value
$field array Field parameter
Résultat array

translate_format() public static méthode

Returns a date() compatible format string from the JavaScript format
public static translate_format ( array $field ) : string
$field array
Résultat string

value() public static méthode

Calculates the timestamp from the datetime string and returns it if $field['timestamp'] is set or the datetime string if not
public static value ( mixed $new, mixed $old, integer $post_id, array $field ) : string | integer
$new mixed
$old mixed
$post_id integer
$field array
Résultat string | integer

Property Details

$date_formats protected_oe static_oe property

Translate date format from jQuery UI date picker to PHP date() It's used to store timestamp value of the field Missing: '!' => '', 'oo' => '', '@' => '', "''" => "'"
protected static array $date_formats
Résultat array

$time_formats protected_oe static_oe property

Translate time format from jQuery UI time picker to PHP date() It's used to store timestamp value of the field Missing: 't' => '', T' => '', 'm' => '', 's' => ''
protected static array $time_formats
Résultat array