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


PHP acf_extract_vars函数代码示例

本文整理汇总了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;
 }
开发者ID:rousnay,项目名称:lighthouse,代码行数:18,代码来源:updates.php

示例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;
}
开发者ID:coreymargulis,项目名称:karenmargulis,代码行数:9,代码来源:api-field.php

示例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;
}
开发者ID:kochira,项目名称:competstrat,代码行数:34,代码来源:api-field-group.php


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