本文整理汇总了PHP中acf_extract_vars函数的典型用法代码示例。如果您正苦于以下问题:PHP acf_extract_vars函数的具体用法?PHP acf_extract_vars怎么用?PHP acf_extract_vars使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了acf_extract_vars函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: inject_info
function inject_info($result, $action = null, $args = null)
{
// vars
$slug = acf_get_setting('slug');
// validate
if (isset($args->slug) && $args->slug == $slug) {
$info = acf_pro_get_remote_info();
$sections = acf_extract_vars($info, array('description', 'installation', 'changelog', 'upgrade_notice'));
$obj = new stdClass();
foreach ($info as $k => $v) {
$obj->{$k} = $v;
}
$obj->sections = $sections;
return $obj;
}
// return
return $result;
}
示例2: acf_prepare_field_for_import
function acf_prepare_field_for_import($field)
{
// extract some args
$extract = acf_extract_vars($field, array('value', 'id', 'class', '_name', '_input', '_valid'));
// filter for 3rd party customization
$field = apply_filters("acf/prepare_field_for_import", $field);
// return
return $field;
}
示例3: acf_update_field_group
function acf_update_field_group($field_group = array())
{
// validate
$field_group = acf_get_valid_field_group($field_group);
// may have been posted. Remove slashes
$field_group = wp_unslash($field_group);
// locations may contain 'uniquid' array keys
$field_group['location'] = array_values($field_group['location']);
foreach ($field_group['location'] as $k => $v) {
$field_group['location'][$k] = array_values($v);
}
// store origional field group for return
$data = $field_group;
// extract some args
$extract = acf_extract_vars($data, array('ID', 'key', 'title', 'menu_order', 'fields'));
// serialize for DB
$data = maybe_serialize($data);
// save
$save = array('ID' => $extract['ID'], 'post_status' => 'publish', 'post_type' => 'acf-field-group', 'post_title' => $extract['title'], 'post_name' => $extract['key'], 'post_excerpt' => sanitize_title($extract['title']), 'post_content' => $data, 'menu_order' => $extract['menu_order']);
// allow field groups to contain the same name
add_filter('wp_unique_post_slug', 'acf_update_field_group_wp_unique_post_slug', 100, 6);
// update the field group and update the ID
if ($field_group['ID']) {
wp_update_post($save);
} else {
$field_group['ID'] = wp_insert_post($save);
}
// action for 3rd party customization
do_action('acf/update_field_group', $field_group);
// clear cache
wp_cache_delete('field_groups', 'acf');
// return
return $field_group;
}