本文整理汇总了PHP中RWMB_Field::filter方法的典型用法代码示例。如果您正苦于以下问题:PHP RWMB_Field::filter方法的具体用法?PHP RWMB_Field::filter怎么用?PHP RWMB_Field::filter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RWMB_Field
的用法示例。
在下文中一共展示了RWMB_Field::filter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: start_el
/**
* @see Walker::start_el()
*
* @param string $output Passed by reference. Used to append additional content.
* @param object $object Item data object.
* @param int $depth Depth of item.
* @param int $current_object_id Item ID.
* @param array $args
*/
public function start_el(&$output, $object, $depth = 0, $args = array(), $current_object_id = 0)
{
$label = $this->db_fields['label'];
$id = $this->db_fields['id'];
$attributes = RWMB_Field::call('get_attributes', $this->field, $object->{$id});
$output .= sprintf('<li><label><input %s %s>%s</label>', RWMB_Field::render_attributes($attributes), checked(in_array($object->{$id}, $this->meta), 1, false), RWMB_Field::filter('choice_label', $object->{$label}, $this->field, $object));
}
示例2: start_el
/**
* @see Walker::start_el()
*
* @param string $output Passed by reference. Used to append additional content.
* @param object $object Item
* @param int $depth Depth of Item.
* @param int $current_object_id Item id.
* @param array $args
*/
public function start_el(&$output, $object, $depth = 0, $args = array(), $current_object_id = 0)
{
$label = $this->db_fields['label'];
$id = $this->db_fields['id'];
$meta = $this->meta;
$indent = str_repeat(' ', $depth * 4);
$output .= sprintf('<option value="%s" %s>%s%s</option>', $object->{$id}, selected(in_array($object->{$id}, $meta), 1, false), $indent, RWMB_Field::filter('choice_label', $object->{$label}, $this->field, $object));
}
示例3: save_post
/**
* Save data from meta box
* @param int $post_id Post ID
*/
public function save_post($post_id)
{
if (!$this->validate()) {
return;
}
$this->saved = true;
// Make sure meta is added to the post, not a revision
if ($the_post = wp_is_post_revision($post_id)) {
$post_id = $the_post;
}
// Before save action
do_action('rwmb_before_save_post', $post_id);
do_action("rwmb_{$this->meta_box['id']}_before_save_post", $post_id);
foreach ($this->fields as $field) {
$single = $field['clone'] || !$field['multiple'];
$old = get_post_meta($post_id, $field['id'], $single);
$new = isset($_POST[$field['id']]) ? $_POST[$field['id']] : ($single ? '' : array());
// Allow field class change the value
if ($field['clone']) {
$new = RWMB_Clone::value($new, $old, $post_id, $field);
} else {
$new = RWMB_Field::call($field, 'value', $new, $old, $post_id);
$new = RWMB_Field::filter('sanitize', $new, $field);
}
$new = RWMB_Field::filter('value', $new, $field, $old);
// Call defined method to save meta value, if there's no methods, call common one
RWMB_Field::call($field, 'save', $new, $old, $post_id);
}
// After save action
do_action('rwmb_after_save_post', $post_id);
do_action("rwmb_{$this->meta_box['id']}_after_save_post", $post_id);
}
示例4: remove_clone_button
/**
* Remove clone button
*
* @param array $field Field parameter
* @return string $html
*/
public static function remove_clone_button($field)
{
$text = RWMB_Field::filter('remove_clone_button_text', '<i class="dashicons dashicons-minus"></i>', $field);
return '<a href="#" class="rwmb-button remove-clone">' . $text . '</a>';
}