当前位置: 首页>>代码示例>>PHP>>正文


PHP RWMB_Field::call方法代码示例

本文整理汇总了PHP中RWMB_Field::call方法的典型用法代码示例。如果您正苦于以下问题:PHP RWMB_Field::call方法的具体用法?PHP RWMB_Field::call怎么用?PHP RWMB_Field::call使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RWMB_Field的用法示例。


在下文中一共展示了RWMB_Field::call方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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), $object->{$label});
 }
开发者ID:kevin578,项目名称:mrteacherkevin,代码行数:16,代码来源:input-list-walker.php

示例2: value

 /**
  * Set value of meta before saving into database
  *
  * @param mixed $new
  * @param mixed $old
  * @param int   $post_id
  * @param array $field
  *
  * @return mixed
  */
 public static function value($new, $old, $post_id, $field)
 {
     foreach ($new as $key => $value) {
         $old_value = isset($old[$key]) ? $old[$key] : null;
         $value = RWMB_Field::call($field, 'value', $value, $old_value, $post_id);
         $new[$key] = RWMB_Field::filter('sanitize', $value, $field);
     }
     return $new;
 }
开发者ID:CityOfPhiladelphia,项目名称:business.phila.gov,代码行数:19,代码来源:clone.php

示例3: display_level

 function display_level($options, $parent_id = 0, $active = false)
 {
     $id = $this->db_fields['id'];
     $field = $this->field;
     $walker = new RWMB_Walker_Select($this->db_fields, $field, $this->meta);
     $attributes = RWMB_Field::call('get_attributes', $field, $this->meta);
     $children = $options[$parent_id];
     $output = sprintf('<div class="rwmb-select-tree %s" data-parent-id="%s"><select %s>', $active ? '' : 'hidden', $parent_id, RWMB_Field::render_attributes($attributes));
     $output .= isset($field['placeholder']) ? "<option value=''>{$field['placeholder']}</option>" : '<option></option>';
     $output .= $walker->walk($children, -1);
     $output .= '</select>';
     foreach ($children as $c) {
         if (isset($options[$c->{$id}])) {
             $output .= $this->display_level($options, $c->{$id}, in_array($c->{$id}, $this->meta) && $active);
         }
     }
     $output .= '</div>';
     return $output;
 }
开发者ID:rilwis,项目名称:meta-box,代码行数:19,代码来源:select-tree.php

示例4: admin_enqueue_scripts

 /**
  * Enqueue scripts and styles.
  */
 public static function admin_enqueue_scripts()
 {
     // Group field is the 1st param
     $args = func_get_args();
     $fields = $args[0]['fields'];
     // Load clone script conditionally
     foreach ($fields as $field) {
         if ($field['clone']) {
             wp_enqueue_script('rwmb-clone', RWMB_JS_URL . 'clone.js', array('jquery-ui-sortable'), RWMB_VER, true);
             break;
         }
     }
     // Enqueue sub-fields scripts and styles.
     foreach ($fields as $field) {
         RWMB_Field::call($field, 'admin_enqueue_scripts');
     }
     // Use helper function to get correct URL to current folder, which can be used in themes/plugins.
     list(, $url) = RWMB_Loader::get_path(dirname(__FILE__));
     wp_enqueue_style('rwmb-group', $url . 'group.css', '', '1.1.2');
     wp_enqueue_script('rwmb-group', $url . 'group.js', array('jquery'), '1.1.2', true);
 }
开发者ID:WPTie,项目名称:VRCore,代码行数:24,代码来源:class-rwmb-group-field.php

示例5: rwmb_the_value

 /**
  * Display the value of a field
  *
  * @param  string   $field_id Field ID. Required.
  * @param  array    $args     Additional arguments. Rarely used. See specific fields for details
  * @param  int|null $post_id  Post ID. null for current post. Optional.
  * @param  bool     $echo     Display field meta value? Default `true` which works in almost all cases. We use `false` for  the [rwmb_meta] shortcode
  *
  * @return string
  */
 function rwmb_the_value($field_id, $args = array(), $post_id = null, $echo = true)
 {
     $args = wp_parse_args($args);
     $field = RWMB_Helper::find_field($field_id, $post_id);
     if (!$field) {
         return '';
     }
     $output = RWMB_Field::call('the_value', $field, $args, $post_id);
     /**
      * Allow developers to change the returned value of field
      * For version < 4.8.2, the filter name was 'rwmb_get_field'
      *
      * @param mixed    $value   Field HTML output
      * @param array    $field   Field parameter
      * @param array    $args    Additional arguments. Rarely used. See specific fields for details
      * @param int|null $post_id Post ID. null for current post. Optional.
      */
     $output = apply_filters('rwmb_the_value', $output, $field, $args, $post_id);
     if ($echo) {
         echo $output;
     }
     return $output;
 }
开发者ID:sptheme,项目名称:learninginstitute,代码行数:33,代码来源:functions.php

示例6: normalize_fields

 /**
  * Normalize an array of fields
  * @param array $fields Array of fields
  * @return array $fields Normalized fields
  */
 public static function normalize_fields($fields)
 {
     foreach ($fields as $k => $field) {
         $field = RWMB_Field::call('normalize', $field);
         // Allow to add default values for fields
         $field = apply_filters('rwmb_normalize_field', $field);
         $field = apply_filters("rwmb_normalize_{$field['type']}_field", $field);
         $field = apply_filters("rwmb_normalize_{$field['id']}_field", $field);
         $fields[$k] = $field;
     }
     return $fields;
 }
开发者ID:jesusmarket,项目名称:jesusmarket,代码行数:17,代码来源:meta-box.php

示例7: is_saved

 /**
  * Check if meta box is saved before.
  * This helps saving empty value in meta fields (text, check box, etc.) and set the correct default values.
  *
  * @return bool
  */
 public function is_saved()
 {
     $post = get_post();
     foreach ($this->fields as $field) {
         if (empty($field['id'])) {
             continue;
         }
         $value = RWMB_Field::call($field, 'raw_meta', $post->ID);
         if (!$field['multiple'] && '' !== $value || $field['multiple'] && array() !== $value) {
             return true;
         }
     }
     return false;
 }
开发者ID:CityOfPhiladelphia,项目名称:business.phila.gov,代码行数:20,代码来源:meta-box.php

示例8: get_value

 /**
  * Get the field value
  * The difference between this function and 'meta' function is 'meta' function always returns the escaped value
  * of the field saved in the database, while this function returns more meaningful value of the field, for ex.:
  * for file/image: return array of file/image information instead of file/image IDs
  *
  * Each field can extend this function and add more data to the returned value.
  * See specific field classes for details.
  *
  * @param  array    $field   Field parameters
  * @param  array    $args    Additional arguments. Rarely used. See specific fields for details
  * @param  int|null $post_id Post ID. null for current post. Optional.
  *
  * @return mixed Field value
  */
 public static function get_value($field, $args = array(), $post_id = null)
 {
     // Some fields does not have ID like heading, custom HTML, etc.
     if (empty($field['id'])) {
         return '';
     }
     if (!$post_id) {
         $post_id = get_the_ID();
     }
     // Get raw meta value in the database, no escape
     $value = RWMB_Field::call($field, 'raw_meta', $post_id);
     // Make sure meta value is an array for cloneable and multiple fields
     if ($field['clone'] || $field['multiple']) {
         $value = is_array($value) && $value ? $value : array();
     }
     return $value;
 }
开发者ID:CityOfPhiladelphia,项目名称:business.phila.gov,代码行数:32,代码来源:field.php

示例9: meta

 /**
  * Get post meta
  *
  * @param string   $key     Meta key. Required.
  * @param int|null $post_id Post ID. null for current post. Optional
  * @param array    $args    Array of arguments. Optional.
  *
  * @return mixed
  */
 public static function meta($key, $args = array(), $post_id = null)
 {
     $post_id = empty($post_id) ? get_the_ID() : $post_id;
     $args = wp_parse_args($args, array('type' => 'text', 'multiple' => false, 'clone' => false));
     // Always set 'multiple' true for following field types
     if (in_array($args['type'], array('checkbox_list', 'autocomplete', 'file', 'file_advanced', 'image', 'image_advanced', 'plupload_image', 'thickbox_image'))) {
         $args['multiple'] = true;
     }
     $field = array('id' => $key, 'type' => $args['type'], 'clone' => $args['clone'], 'multiple' => $args['multiple']);
     switch ($args['type']) {
         case 'taxonomy_advanced':
             if (empty($args['taxonomy'])) {
                 break;
             }
             $meta = get_post_meta($post_id, $key, !$args['multiple']);
             $term_ids = wp_parse_id_list($meta);
             // Allow to pass more arguments to "get_terms"
             $func_args = wp_parse_args(array('include' => $term_ids, 'hide_empty' => false), $args);
             unset($func_args['type'], $func_args['taxonomy'], $func_args['multiple']);
             $meta = get_terms($args['taxonomy'], $func_args);
             break;
         case 'taxonomy':
             $meta = empty($args['taxonomy']) ? array() : get_the_terms($post_id, $args['taxonomy']);
             break;
         case 'map':
             $field = array('id' => $key, 'multiple' => false, 'clone' => false);
             $meta = RWMB_Map_Field::the_value($field, $args, $post_id);
             break;
         case 'oembed':
             $meta = RWMB_OEmbed_Field::the_value($field, $args, $post_id);
             break;
         default:
             $meta = RWMB_Field::call('get_value', $field, $args, $post_id);
     }
     return apply_filters('rwmb_meta', $meta, $key, $args, $post_id);
 }
开发者ID:rilwis,项目名称:meta-box,代码行数:45,代码来源:helper.php


注:本文中的RWMB_Field::call方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。