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


PHP acf_update_setting函数代码示例

本文整理汇总了PHP中acf_update_setting函数的典型用法代码示例。如果您正苦于以下问题:PHP acf_update_setting函数的具体用法?PHP acf_update_setting怎么用?PHP acf_update_setting使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了acf_update_setting函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: acf_pro_get_remote_response

function acf_pro_get_remote_response($action = '', $post = array())
{
    // vars
    $url = acf_pro_get_remote_url($action);
    // connect
    $request = wp_remote_post($url, array('body' => $post));
    // error
    if (is_wp_error($request)) {
        // loop
        foreach ($request->errors as $k => $v) {
            // bail early if no error
            if (empty($v[0])) {
                continue;
            }
            // save
            acf_update_setting('remote_response_error', $k . ': ' . $v[0]);
            // only run once
            break;
        }
        // success
    } elseif (wp_remote_retrieve_response_code($request) === 200) {
        return $request['body'];
    }
    // return
    return 0;
}
开发者ID:Garth619,项目名称:Femi9,代码行数:26,代码来源:api-pro.php

示例2: __construct

 function __construct()
 {
     // global
     global $sitepress;
     // vars
     $this->lang = ICL_LANGUAGE_CODE;
     // update settings
     acf_update_setting('default_language', $sitepress->get_default_language());
     acf_update_setting('current_language', $this->lang);
     // actions
     add_action('acf/verify_ajax', array($this, 'verify_ajax'));
     add_action('acf/field_group/admin_head', array($this, 'admin_head'));
     add_action('acf/input/admin_head', array($this, 'admin_head'));
     // bail early if not transaltable
     if (!$this->is_translatable()) {
         return;
     }
     // actions
     add_action('acf/upgrade_start/5.0.0', array($this, 'upgrade_start_5'));
     add_action('acf/upgrade_finish/5.0.0', array($this, 'upgrade_finish_5'));
     add_action('acf/update_field_group', array($this, 'update_field_group'), 2, 1);
     add_action('icl_make_duplicate', array($this, 'icl_make_duplicate'), 10, 4);
     // filters
     add_filter('acf/settings/save_json', array($this, 'settings_save_json'));
     add_filter('acf/settings/load_json', array($this, 'settings_load_json'));
 }
开发者ID:slavic18,项目名称:cats,代码行数:26,代码来源:wpml.php

示例3: set_language

 /**
  * Action: Set Language
  *
  * @param string  $lang_slug
  * @param object  $current_lang  Current language
  */
 public function set_language($lang_slug, $current_lang)
 {
     $this->default_lang = pll_default_language();
     $this->current_lang = pll_current_language();
     acf_update_setting('default_language', $this->default_lang);
     acf_update_setting('current_language', $this->current_lang);
 }
开发者ID:locomotivemtl,项目名称:wordpress-boilerplate,代码行数:13,代码来源:acf.php

示例4: init

 function init()
 {
     // ACF_LITE
     if (defined('ACF_LITE') && ACF_LITE) {
         acf_update_setting('show_admin', false);
     }
 }
开发者ID:Aqro,项目名称:NewDWM,代码行数:7,代码来源:compatibility.php

示例5: __construct

 function __construct()
 {
     // update setting
     acf_update_setting('pro', true);
     acf_update_setting('name', __('Advanced Custom Fields PRO', 'acf'));
     // api
     acf_include('pro/api/api-pro.php');
     acf_include('pro/api/api-options-page.php');
     // updates
     acf_include('pro/core/updates.php');
     // admin
     if (is_admin()) {
         // options page
         acf_include('pro/admin/options-page.php');
         // settings
         acf_include('pro/admin/settings-updates.php');
     }
     // fields
     acf_include('pro/fields/repeater.php');
     acf_include('pro/fields/flexible-content.php');
     acf_include('pro/fields/gallery.php');
     // actions
     add_action('init', array($this, 'wp_init'));
     add_action('acf/input/admin_enqueue_scripts', array($this, 'input_admin_enqueue_scripts'));
     add_action('acf/field_group/admin_enqueue_scripts', array($this, 'field_group_admin_enqueue_scripts'));
     add_action('acf/field_group/admin_l10n', array($this, 'field_group_admin_l10n'));
     // filters
     add_filter('acf/get_valid_field', array($this, 'get_valid_field'), 11, 1);
     add_filter('acf/update_field', array($this, 'update_field'), 1, 1);
     add_filter('acf/prepare_field_for_export', array($this, 'prepare_field_for_export'));
     add_filter('acf/prepare_field_for_import', array($this, 'prepare_field_for_import'));
 }
开发者ID:bmavus,项目名称:wp-theme-blank,代码行数:32,代码来源:acf-pro.php

示例6: __construct

 function __construct()
 {
     // update setting
     acf_update_setting('save_json', get_stylesheet_directory() . '/acf-json');
     acf_append_setting('load_json', get_stylesheet_directory() . '/acf-json');
     // actions
     add_action('acf/update_field_group', array($this, 'update_field_group'), 10, 5);
     add_action('acf/duplicate_field_group', array($this, 'update_field_group'), 10, 5);
     add_action('acf/untrash_field_group', array($this, 'update_field_group'), 10, 5);
     add_action('acf/trash_field_group', array($this, 'delete_field_group'), 10, 5);
     add_action('acf/delete_field_group', array($this, 'delete_field_group'), 10, 5);
     add_action('acf/include_fields', array($this, 'include_fields'), 10, 5);
 }
开发者ID:rousnay,项目名称:lighthouse,代码行数:13,代码来源:json.php

示例7: __construct

 function __construct()
 {
     // global
     global $sitepress;
     // vars
     $this->lang = ICL_LANGUAGE_CODE;
     // update settings
     acf_update_setting('default_language', $sitepress->get_default_language());
     acf_update_setting('current_language', $this->lang);
     // actions
     add_action('acf/update_field_group', array($this, 'update_field_group'), 1, 1);
     add_action('icl_make_duplicate', array($this, 'icl_make_duplicate'), 10, 4);
     add_action('acf/field_group/admin_head', array($this, 'admin_head'));
     add_action('acf/input/admin_head', array($this, 'admin_head'));
     // filters
     add_filter('acf/settings/save_json', array($this, 'settings_save_json'));
     add_filter('acf/settings/load_json', array($this, 'settings_load_json'));
 }
开发者ID:mariussunde,项目名称:Sn-hetta-Designmanual-WP-Theme,代码行数:18,代码来源:wpml.php

示例8: check_sync

 function check_sync()
 {
     // message
     if ($ids = acf_maybe_get($_GET, 'acfsynccomplete')) {
         // explode
         $ids = explode(',', $ids);
         $total = count($ids);
         if ($total == 1) {
             acf_add_admin_notice(sprintf(__('Field group synchronised. %s', 'acf'), '<a href="' . get_edit_post_link($ids[0]) . '">' . get_the_title($ids[0]) . '</a>'));
         } else {
             acf_add_admin_notice(sprintf(_n('%s field group synchronised.', '%s field groups synchronised.', $total, 'acf'), $total));
         }
     }
     // vars
     $groups = acf_get_field_groups();
     // bail early if no field groups
     if (empty($groups)) {
         return;
     }
     // find JSON field groups which have not yet been imported
     foreach ($groups as $group) {
         // vars
         $local = acf_maybe_get($group, 'local', false);
         $modified = acf_maybe_get($group, 'modified', 0);
         $private = acf_maybe_get($group, 'private', false);
         // ignore DB / PHP / private field groups
         if ($local !== 'json' || $private) {
             // do nothing
         } elseif (!$group['ID']) {
             $this->sync[$group['key']] = $group;
         } elseif ($modified && $modified > get_post_modified_time('U', true, $group['ID'], true)) {
             $this->sync[$group['key']] = $group;
         }
     }
     // bail if no sync needed
     if (empty($this->sync)) {
         return;
     }
     // import field group
     if ($key = acf_maybe_get($_GET, 'acfsync')) {
         // disable JSON
         // - this prevents a new JSON file being created and causing a 'change' to theme files - solves git anoyance
         acf_update_setting('json', false);
         // validate
         check_admin_referer('bulk-posts');
         // append fields
         if (acf_have_local_fields($key)) {
             $this->sync[$key]['fields'] = acf_get_local_fields($key);
         }
         // import
         $field_group = acf_import_field_group($this->sync[$key]);
         // redirect
         wp_redirect(admin_url($this->url . '&acfsynccomplete=' . $field_group['ID']));
         exit;
     } elseif (acf_maybe_get($_GET, 'action2') === 'acfsync') {
         // validate
         check_admin_referer('bulk-posts');
         // get ids
         $keys = acf_maybe_get($_GET, 'post');
         if (!empty($keys)) {
             // disable JSON
             // - this prevents a new JSON file being created and causing a 'change' to theme files - solves git anoyance
             acf_update_setting('json', false);
             // vars
             $new_ids = array();
             foreach ($keys as $key) {
                 // append fields
                 if (acf_have_local_fields($key)) {
                     $this->sync[$key]['fields'] = acf_get_local_fields($key);
                 }
                 // import
                 $field_group = acf_import_field_group($this->sync[$key]);
                 // append
                 $new_ids[] = $field_group['ID'];
             }
             // redirect
             wp_redirect(admin_url($this->url . '&acfsynccomplete=' . implode(',', $new_ids)));
             exit;
         }
     }
     // filters
     add_filter('views_edit-acf-field-group', array($this, 'list_table_views'));
 }
开发者ID:coreymargulis,项目名称:karenmargulis,代码行数:83,代码来源:field-groups.php

示例9: acf_form

function acf_form($args = array())
{
    // vars
    $url = acf_get_current_url();
    // defaults
    $args = wp_parse_args($args, array('id' => 'acf-form', 'post_id' => false, 'new_post' => false, 'field_groups' => false, 'fields' => false, 'post_title' => false, 'post_content' => false, 'form' => true, 'form_attributes' => array(), 'return' => add_query_arg('updated', 'true', $url), 'html_before_fields' => '', 'html_after_fields' => '', 'submit_value' => __("Update", 'acf'), 'updated_message' => __("Post updated", 'acf'), 'label_placement' => 'top', 'instruction_placement' => 'label', 'field_el' => 'div', 'uploader' => 'wp'));
    $args['form_attributes'] = wp_parse_args($args['form_attributes'], array('id' => 'post', 'class' => '', 'action' => '', 'method' => 'post'));
    // filter post_id
    $args['post_id'] = acf_get_valid_post_id($args['post_id']);
    // load values from this post
    $post_id = $args['post_id'];
    // new post?
    if ($post_id == 'new_post') {
        // dont load values
        $post_id = false;
        // new post defaults
        $args['new_post'] = acf_parse_args($args['new_post'], array('post_type' => 'post', 'post_status' => 'draft'));
    }
    // attributes
    $args['form_attributes']['class'] .= ' acf-form';
    // vars
    $field_groups = array();
    $fields = array();
    // post_title
    if ($args['post_title']) {
        $fields[] = acf_get_valid_field(array('name' => '_post_title', 'label' => 'Title', 'type' => 'text', 'value' => $post_id ? get_post_field('post_title', $post_id) : '', 'required' => true));
    }
    // post_content
    if ($args['post_content']) {
        $fields[] = acf_get_valid_field(array('name' => '_post_content', 'label' => 'Content', 'type' => 'wysiwyg', 'value' => $post_id ? get_post_field('post_content', $post_id) : ''));
    }
    // specific fields
    if ($args['fields']) {
        foreach ($args['fields'] as $selector) {
            // append field ($strict = false to allow for better compatibility with field names)
            $fields[] = acf_maybe_get_field($selector, $post_id, false);
        }
    } elseif ($args['field_groups']) {
        foreach ($args['field_groups'] as $selector) {
            $field_groups[] = acf_get_field_group($selector);
        }
    } elseif ($args['post_id'] == 'new_post') {
        $field_groups = acf_get_field_groups(array('post_type' => $args['new_post']['post_type']));
    } else {
        $field_groups = acf_get_field_groups(array('post_id' => $args['post_id']));
    }
    //load fields based on field groups
    if (!empty($field_groups)) {
        foreach ($field_groups as $field_group) {
            $field_group_fields = acf_get_fields($field_group);
            if (!empty($field_group_fields)) {
                foreach (array_keys($field_group_fields) as $i) {
                    $fields[] = acf_extract_var($field_group_fields, $i);
                }
            }
        }
    }
    // updated message
    if (!empty($_GET['updated']) && $args['updated_message']) {
        echo '<div id="message" class="updated"><p>' . $args['updated_message'] . '</p></div>';
    }
    // uploader (always set incase of multiple forms on the page)
    acf_update_setting('uploader', $args['uploader']);
    // display form
    if ($args['form']) {
        ?>

	
	<form <?php 
        acf_esc_attr_e($args['form_attributes']);
        ?>
>
	
	<?php 
    }
    // render post data
    acf_form_data(array('post_id' => $args['post_id'], 'nonce' => 'acf_form'));
    ?>

	<div class="acf-hidden">
		<?php 
    acf_hidden_input(array('name' => '_acf_form', 'value' => base64_encode(json_encode($args))));
    ?>

	</div>
	<div class="acf-fields acf-form-fields -<?php 
    echo $args['label_placement'];
    ?>
">
	
		<?php 
    // html before fields
    echo $args['html_before_fields'];
    // render
    acf_render_fields($post_id, $fields, $args['field_el'], $args['instruction_placement']);
    // html after fields
    echo $args['html_after_fields'];
    ?>

	
//.........这里部分代码省略.........
开发者ID:de190909,项目名称:WPTest,代码行数:101,代码来源:api-template.php

示例10: admin_load

 function admin_load()
 {
     // globals
     global $plugin_page;
     // vars
     $this->page = acf_get_options_page($plugin_page);
     // verify and remove nonce
     if (acf_verify_nonce('options')) {
         // save data
         if (acf_validate_save_post(true)) {
             // get post_id (allow lang modification)
             $post_id = acf_get_valid_post_id($this->page['post_id']);
             // set autoload
             acf_update_setting('autoload', $this->page['autoload']);
             // save
             acf_save_post($post_id);
             // redirect
             wp_redirect(add_query_arg(array('message' => '1')));
             exit;
         }
     }
     // load acf scripts
     acf_enqueue_scripts();
     // actions
     add_action('acf/input/admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
     add_action('acf/input/admin_head', array($this, 'admin_head'));
     // add columns support
     add_screen_option('layout_columns', array('max' => 2, 'default' => 2));
 }
开发者ID:rmikeska,项目名称:ushipnetwork,代码行数:29,代码来源:options-page.php

示例11: acf_duplicate_fields

function acf_duplicate_fields($fields, $new_parent = 0)
{
    // bail early if no fields
    if (empty($fields)) {
        return;
    }
    // create new field keys (for conditional logic fixes)
    foreach ($fields as $field) {
        // ensure a delay for unique ID
        usleep(1);
        acf_update_setting('duplicate_key_' . $field['key'], uniqid('field_'));
    }
    // duplicate fields
    foreach ($fields as $field) {
        // duplicate
        acf_duplicate_field($field['ID'], $new_parent);
    }
}
开发者ID:coreymargulis,项目名称:karenmargulis,代码行数:18,代码来源:api-field.php

示例12: admin_load

 function admin_load()
 {
     // globals
     global $plugin_page;
     // vars
     $this->page = acf_get_options_page($plugin_page);
     // verify and remove nonce
     if (acf_verify_nonce('options')) {
         // save data
         if (acf_validate_save_post(true)) {
             // get post_id (allow lang modification)
             $post_id = acf_get_valid_post_id($this->page['post_id']);
             // set autoload
             acf_update_setting('autoload', $this->page['autoload']);
             // save
             acf_save_post($post_id);
             // redirect
             wp_redirect(admin_url("admin.php?page={$plugin_page}&message=1"));
             exit;
         }
     }
     // actions
     add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
 }
开发者ID:Aqro,项目名称:NewDWM,代码行数:24,代码来源:options-page.php

示例13: generate

 function generate()
 {
     // translate
     if (acf_get_setting('l10n_textdomain')) {
         // prevent default translation
         acf_update_setting('l10n_var_export', true);
         // filters
         add_filter('acf/prepare_field_group_for_export', array($this, '_translate_field_group'));
         add_filter('acf/prepare_field_for_export', array($this, '_translate_field'));
     }
     // vars
     $json = $this->get_json();
     // validate
     if ($json === false) {
         acf_add_admin_notice(__("No field groups selected", 'acf'), 'error');
         return;
     }
     // update view
     $this->view = 'settings-tools-export';
     $this->data['field_groups'] = $json;
 }
开发者ID:rousnay,项目名称:lighthouse,代码行数:21,代码来源:settings-tools.php

示例14: copernico_acf_init

 function copernico_acf_init()
 {
     global $copernico_opt;
     acf_update_setting('google_api_key', $copernico_opt['acf_google_map_api']);
 }
开发者ID:miniMAC,项目名称:copernico,代码行数:5,代码来源:acf-options.php

示例15: complete

 function complete()
 {
     // bail early if actions have not passed 'plugins_loaded'
     // this allows all plugins / theme to hook in
     if (!did_action('plugins_loaded')) {
         return;
     }
     // once run once
     if (acf_get_setting('complete')) {
         return;
     }
     // update setting
     acf_update_setting('complete', true);
     // wpml
     if (defined('ICL_SITEPRESS_VERSION')) {
         acf_include('core/wpml.php');
     }
     // include field types
     do_action('acf/include_field_types', 5);
     // include local fields
     do_action('acf/include_fields', 5);
     // final action
     do_action('acf/init');
 }
开发者ID:jewbre,项目名称:vdlhr,代码行数:24,代码来源:acf.php


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