PHP Класс RWMB_Datetime_Field

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$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' => ''

Открытые методы

Метод Описание
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

Защищенные методы

Метод Описание
prepare_meta ( array | string $meta, array $field ) : array Format meta value if set 'timestamp'

Описание методов

admin_enqueue_scripts() публичный статический метод

Enqueue scripts and styles
public static admin_enqueue_scripts ( )

admin_register_scripts() публичный статический метод

Register scripts and styles.
public static admin_register_scripts ( )

get_attributes() публичный статический метод

Get the attributes for a field
public static get_attributes ( array $field, mixed $value = null ) : array
$field array
$value mixed
Результат array

html() публичный статический метод

Get field HTML
public static html ( mixed $meta, array $field ) : string
$meta mixed
$field array
Результат string

meta() публичный статический метод

Get meta value
public static meta ( integer $post_id, boolean $saved, array $field ) : mixed
$post_id integer
$saved boolean
$field array
Результат mixed

normalize() публичный статический метод

Normalize parameters for field
public static normalize ( array $field ) : array
$field array
Результат array

prepare_meta() защищенный статический метод

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
Результат array

translate_format() публичный статический метод

Returns a date() compatible format string from the JavaScript format
public static translate_format ( array $field ) : string
$field array
Результат string

value() публичный статический метод

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
Результат string | integer

Описание свойств

$date_formats защищенное статическое свойство

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
Результат array

$time_formats защищенное статическое свойство

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
Результат array