filter() 공개 정적인 메소드

Filters: - rwmb_{$name} - rwmb_{$field['type']}_{$name} - rwmb_{$field['id']}_{$name}
public static filter ( ) : mixed
리턴 mixed
예제 #1
0
 /**
  * @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
0
파일: select.php 프로젝트: rilwis/meta-box
 /**
  * @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('&nbsp;', $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
0
 /**
  * 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);
 }
 /**
  * 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>';
 }