PHP Class custom_metadata_manager

Show file Open project: pressbooks/pressbooks Class Usage Examples

Public Properties

Property Type Description
$_always_multiple_fields fields that always save as an array
$_builtin_object_types Object types that come "built-in" with WordPress
$_cloneable_field_types field types that are cloneable
$_column_filter_object_types Object types whose columns are generated through apply_filters instead of do_action
$_column_types Column filter names
$_field_types field types
$_field_types_that_are_read_only field types that are read only by default
$_field_types_that_support_default_value field types that support a default value
$_field_types_that_support_multifield @todo: workarounds needed for other field types
$_field_types_that_support_placeholder field types that support the placeholder attribute
$_multiple_not_cloneable filed types that are saved as multiples but not cloneable
$_non_post_types
$_pages_whitelist Whitelisted pages that get stylesheets and scripts
$_taxonomy_fields taxonomy types
$default_editor_args the default args used for the wp_editor function
$errors
$metadata

Public Methods

Method Description
__construct ( ) do nothing on construct
_add_registration_error ( $field_slug, $error_message )
_delete_field_value ( $field_slug, $field, $object_type, $object_id, $value = false )
_display_field_description ( $field_slug, $field, $object_type, $object_id, $value )
_display_group_description ( $group )
_display_group_nonce ( $group_slug, $object_type )
_display_metadata_field ( $field_slug, $field, $object_type, $object_id, $field_id = null, $value = null )
_display_metadata_multifield ( $slug, $multifield, $object_type, $object_id )
_display_post_metadata_box ( $object, $meta_box )
_display_registration_errors ( )
_display_user_metadata_box ( $group_slug, $group, $object_type, $fields )
_display_wp_link_dialog ( )
_get_field_value ( $field_slug, $field, $object_type, $object_id, $single = false )
_get_object_type_context ( )
_get_save_callback ( $field, $object_type )
_get_value_callback ( $field, $object_type )
_is_multifield ( $slug )
_metadata_column_content ( $field_slug, $field, $object_type, $object_id )
_multifield_exists_for_group_object ( $slug, $group_slug, $object_type )
_push_field ( $field_slug, $field, $group_slug, $object_type )
_push_group ( $group_slug, $group, $object_type )
_push_multifield ( $slug, $multifield, $group_slug, $object_type )
_sanitize_field_value ( $field_slug, $field, $object_type, $object_id, $value )
_save_field_value ( $field_slug, $field, $object_type, $object_id, $value )
_validate_metadata_field ( $field_slug, $field, $group_slug, $object_types )
_validate_metadata_group ( $group_slug, $group, $object_type )
add_field_to_group ( $field_slug, $field, $group_slug, $object_types )
add_group_to_object_type ( $group_slug, $group, $object_types )
add_metadata_column_content ( $name, $object_id, $column_content = '' )
add_metadata_column_headers ( $columns )
add_metadata_field ( $field_slug, $object_types = ['post'], $args = [] )
add_metadata_group ( $group_slug, $object_types, $args = [] )
add_multifield ( $slug, $object_types = ['post'], $args = [] )
add_multifield_to_group ( $slug, $multifield, $group_slug, $object_types )
add_post_metadata_group ( $group_slug, $group, $object_type, $object_id )
add_post_metadata_groups ( )
add_user_metadata_column_content ( $param, $name, $object_id )
add_user_metadata_group ( $group_slug, $group, $object_type, $user_id )
add_user_metadata_groups ( )
admin_init ( )
build_nonce_key ( $group_slug, $object_type )
does_id_array_match_object ( $id_array, $object_type, $object_id, $object_slug = '' )
does_id_match_object ( $id, $object_id, $object_slug = '' )
enqueue_scripts ( )
enqueue_styles ( )
get_display_column_callback ( $field, $object_type )
get_field ( $field_slug, $group_slug, $object_type )
get_fields_in_group ( $group_slug, $object_type )
get_fields_in_multifield ( $group_slug, $multifield_slug, $object_type )
get_fields_in_object_type ( $object_type )
get_group ( $group_slug, $object_type )
get_groups_in_object_type ( $object_type )
get_metadata_field_value ( $field_slug, $field, $object_type, $object_id )
get_metadata_mulitifield_value ( $slug, $multifield, $object_type, $object_id )
get_object_types ( )
get_sanitize_callback ( $field, $object_type )
get_single_field_in_group ( $field_slug, $group_slug, $object_type )
get_single_field_in_object_type ( $field_slug, $object_type )
init_columns ( )
init_metadata ( )
init_object_types ( )
instance ( )
is_field_addable_to_columns ( $field_slug, $field )
is_field_in_group ( $field_slug, $group_slug, $object_type )
is_group_in_object_type ( $group_slug, $object_type )
is_registered_field ( $field_slug, $group_slug = '', $object_type )
is_registered_group ( $group_slug, $object_type )
is_registered_object_type ( $object_type )
is_restricted_field ( $field_slug, $object_type )
is_restricted_group ( $group_slug, $object_type )
is_thing_added_to_object ( $thing_slug, $thing, $object_type, $object_id, $object_slug = '' )
run_initial_hooks ( )
save_comment_metadata ( $comment_id )
save_metadata_field ( $field_slug, $field, $object_type, $object_id )
save_metadata_group ( $group_slug, $group, $object_type, $object_id )
save_metadata_multifield ( $slug, $multifield, $object_type, $object_id )
save_post_metadata ( $post_id )
save_user_metadata ( $user_id )
verify_group_nonce ( $group_slug, $object_type )

Method Details

__construct() public method

do nothing on construct
public __construct ( )

_add_registration_error() public method

public _add_registration_error ( $field_slug, $error_message )

_delete_field_value() public method

public _delete_field_value ( $field_slug, $field, $object_type, $object_id, $value = false )

_display_field_description() public method

public _display_field_description ( $field_slug, $field, $object_type, $object_id, $value )

_display_group_description() public method

public _display_group_description ( $group )

_display_group_nonce() public method

public _display_group_nonce ( $group_slug, $object_type )

_display_metadata_field() public method

public _display_metadata_field ( $field_slug, $field, $object_type, $object_id, $field_id = null, $value = null )

_display_metadata_multifield() public method

public _display_metadata_multifield ( $slug, $multifield, $object_type, $object_id )

_display_post_metadata_box() public method

public _display_post_metadata_box ( $object, $meta_box )

_display_registration_errors() public method

_display_user_metadata_box() public method

public _display_user_metadata_box ( $group_slug, $group, $object_type, $fields )

_get_field_value() public method

public _get_field_value ( $field_slug, $field, $object_type, $object_id, $single = false )

_get_object_type_context() public method

_get_save_callback() public method

public _get_save_callback ( $field, $object_type )

_get_value_callback() public method

public _get_value_callback ( $field, $object_type )

_is_multifield() public method

public _is_multifield ( $slug )

_metadata_column_content() public method

public _metadata_column_content ( $field_slug, $field, $object_type, $object_id )

_multifield_exists_for_group_object() public method

public _multifield_exists_for_group_object ( $slug, $group_slug, $object_type )

_push_field() public method

public _push_field ( $field_slug, $field, $group_slug, $object_type )

_push_group() public method

public _push_group ( $group_slug, $group, $object_type )

_push_multifield() public method

public _push_multifield ( $slug, $multifield, $group_slug, $object_type )

_sanitize_field_value() public method

public _sanitize_field_value ( $field_slug, $field, $object_type, $object_id, $value )

_save_field_value() public method

public _save_field_value ( $field_slug, $field, $object_type, $object_id, $value )

_validate_metadata_field() public method

public _validate_metadata_field ( $field_slug, $field, $group_slug, $object_types )

_validate_metadata_group() public method

public _validate_metadata_group ( $group_slug, $group, $object_type )

add_field_to_group() public method

public add_field_to_group ( $field_slug, $field, $group_slug, $object_types )

add_group_to_object_type() public method

public add_group_to_object_type ( $group_slug, $group, $object_types )

add_metadata_column_content() public method

public add_metadata_column_content ( $name, $object_id, $column_content = '' )

add_metadata_column_headers() public method

public add_metadata_column_headers ( $columns )

add_metadata_field() public method

public add_metadata_field ( $field_slug, $object_types = ['post'], $args = [] )

add_metadata_group() public method

public add_metadata_group ( $group_slug, $object_types, $args = [] )

add_multifield() public method

public add_multifield ( $slug, $object_types = ['post'], $args = [] )

add_multifield_to_group() public method

public add_multifield_to_group ( $slug, $multifield, $group_slug, $object_types )

add_post_metadata_group() public method

public add_post_metadata_group ( $group_slug, $group, $object_type, $object_id )

add_post_metadata_groups() public method

add_user_metadata_column_content() public method

public add_user_metadata_column_content ( $param, $name, $object_id )

add_user_metadata_group() public method

public add_user_metadata_group ( $group_slug, $group, $object_type, $user_id )

add_user_metadata_groups() public method

admin_init() public method

public admin_init ( )

build_nonce_key() public method

public build_nonce_key ( $group_slug, $object_type )

does_id_array_match_object() public method

public does_id_array_match_object ( $id_array, $object_type, $object_id, $object_slug = '' )

does_id_match_object() public method

public does_id_match_object ( $id, $object_id, $object_slug = '' )

enqueue_scripts() public method

public enqueue_scripts ( )

enqueue_styles() public method

public enqueue_styles ( )

get_display_column_callback() public method

public get_display_column_callback ( $field, $object_type )

get_field() public method

public get_field ( $field_slug, $group_slug, $object_type )

get_fields_in_group() public method

public get_fields_in_group ( $group_slug, $object_type )

get_fields_in_multifield() public method

public get_fields_in_multifield ( $group_slug, $multifield_slug, $object_type )

get_fields_in_object_type() public method

public get_fields_in_object_type ( $object_type )

get_group() public method

public get_group ( $group_slug, $object_type )

get_groups_in_object_type() public method

public get_groups_in_object_type ( $object_type )

get_metadata_field_value() public method

public get_metadata_field_value ( $field_slug, $field, $object_type, $object_id )

get_metadata_mulitifield_value() public method

public get_metadata_mulitifield_value ( $slug, $multifield, $object_type, $object_id )

get_object_types() public method

public get_object_types ( )

get_sanitize_callback() public method

public get_sanitize_callback ( $field, $object_type )

get_single_field_in_group() public method

public get_single_field_in_group ( $field_slug, $group_slug, $object_type )

get_single_field_in_object_type() public method

public get_single_field_in_object_type ( $field_slug, $object_type )

init_columns() public method

public init_columns ( )

init_metadata() public method

public init_metadata ( )

init_object_types() public method

public init_object_types ( )

instance() public static method

public static instance ( )

is_field_addable_to_columns() public method

public is_field_addable_to_columns ( $field_slug, $field )

is_field_in_group() public method

public is_field_in_group ( $field_slug, $group_slug, $object_type )

is_group_in_object_type() public method

public is_group_in_object_type ( $group_slug, $object_type )

is_registered_field() public method

public is_registered_field ( $field_slug, $group_slug = '', $object_type )

is_registered_group() public method

public is_registered_group ( $group_slug, $object_type )

is_registered_object_type() public method

public is_registered_object_type ( $object_type )

is_restricted_field() public method

public is_restricted_field ( $field_slug, $object_type )

is_restricted_group() public method

public is_restricted_group ( $group_slug, $object_type )

is_thing_added_to_object() public method

public is_thing_added_to_object ( $thing_slug, $thing, $object_type, $object_id, $object_slug = '' )

run_initial_hooks() public method

public run_initial_hooks ( )

save_comment_metadata() public method

public save_comment_metadata ( $comment_id )

save_metadata_field() public method

public save_metadata_field ( $field_slug, $field, $object_type, $object_id )

save_metadata_group() public method

public save_metadata_group ( $group_slug, $group, $object_type, $object_id )

save_metadata_multifield() public method

public save_metadata_multifield ( $slug, $multifield, $object_type, $object_id )

save_post_metadata() public method

public save_post_metadata ( $post_id )

save_user_metadata() public method

public save_user_metadata ( $user_id )

verify_group_nonce() public method

public verify_group_nonce ( $group_slug, $object_type )

Property Details

$_always_multiple_fields public property

fields that always save as an array
public $_always_multiple_fields

$_builtin_object_types public property

Object types that come "built-in" with WordPress
public $_builtin_object_types

$_cloneable_field_types public property

field types that are cloneable
public $_cloneable_field_types

$_column_filter_object_types public property

Object types whose columns are generated through apply_filters instead of do_action
public $_column_filter_object_types

$_column_types public property

Column filter names
public $_column_types

$_field_types public property

field types
public $_field_types

$_field_types_that_are_read_only public property

field types that are read only by default
public $_field_types_that_are_read_only

$_field_types_that_support_default_value public property

field types that support a default value
public $_field_types_that_support_default_value

$_field_types_that_support_multifield public property

@todo: workarounds needed for other field types
public $_field_types_that_support_multifield

$_field_types_that_support_placeholder public property

field types that support the placeholder attribute
public $_field_types_that_support_placeholder

$_multiple_not_cloneable public property

filed types that are saved as multiples but not cloneable
public $_multiple_not_cloneable

$_non_post_types public property

public $_non_post_types

$_pages_whitelist public property

Whitelisted pages that get stylesheets and scripts
public $_pages_whitelist

$_taxonomy_fields public property

taxonomy types
public $_taxonomy_fields

$default_editor_args public property

the default args used for the wp_editor function
public $default_editor_args

$errors public property

public $errors

$metadata public property

public $metadata