本文整理汇总了PHP中acf_get_setting函数的典型用法代码示例。如果您正苦于以下问题:PHP acf_get_setting函数的具体用法?PHP acf_get_setting怎么用?PHP acf_get_setting使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了acf_get_setting函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: admin_footer
function admin_footer()
{
// vars
$args = acf_get_setting('form_data');
// validate
if (empty($args)) {
return;
}
// global
global $wp_version;
// options
$o = array('post_id' => $args['post_id'], 'nonce' => wp_create_nonce('acf_nonce'), 'admin_url' => admin_url(), 'ajaxurl' => admin_url('admin-ajax.php'), 'ajax' => $args['ajax'], 'wp_version' => $wp_version);
// l10n
$l10n = apply_filters('acf/input/admin_l10n', array('core' => array('expand_details' => __('Expand Details', 'acf'), 'collapse_details' => __('Collapse Details', 'acf'), 'save_alert' => __('The changes you made will be lost if you navigate away from this page.', 'acf')), 'validation' => array('error' => __("Validation Failed. One or more fields below are required.", 'acf'))));
?>
<script type="text/javascript">
(function($) {
acf.o = <?php
echo json_encode($o);
?>
;
acf.l10n = <?php
echo json_encode($l10n);
?>
;
})(jQuery);
</script>
<?php
}
示例2: inject_update
function inject_update($transient)
{
// bail early if not admin
if (!is_admin()) {
return $transient;
}
// bail early if no update available
if (!acf_pro_is_update_available()) {
return $transient;
}
// vars
$info = acf_pro_get_remote_info();
$basename = acf_get_setting('basename');
$slug = acf_get_setting('slug');
// create new object for update
$obj = new stdClass();
$obj->slug = $slug;
$obj->new_version = $info['version'];
$obj->url = $info['homepage'];
$obj->package = '';
// license
if (acf_pro_is_license_active()) {
$obj->package = acf_pro_get_remote_url('download', array('k' => acf_pro_get_license()));
}
// add to transient
$transient->response[$basename] = $obj;
// return
return $transient;
}
示例3: modify_plugin_update
function modify_plugin_update($transient)
{
// bail early if no response (dashboard showed an error)
if (!isset($transient->response)) {
return $transient;
}
// vars
$basename = acf_get_setting('basename');
$show_updates = acf_get_setting('show_updates');
// bail early if not a plugin (included in theme)
if (!acf_is_plugin_active()) {
$show_updates = false;
}
// bail early if no show_updates
if (!$show_updates) {
// remove from transient
unset($transient->response[$basename]);
// return
return $transient;
}
// get update
$update = acf_maybe_get($transient->response, $basename);
// filter
$update = apply_filters('acf/updates/plugin_update', $update, $transient);
// update
if ($update) {
$transient->response[$basename] = $update;
} else {
unset($transient->response[$basename]);
}
// return
return $transient;
}
示例4: input_admin_enqueue_scripts
function input_admin_enqueue_scripts()
{
// bail ealry if no enqueue
if (!acf_get_setting('enqueue_select2')) {
return;
}
// globals
global $wp_scripts, $wp_styles;
// vars
$min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
$major = acf_get_setting('select2_version');
$version = '';
$script = '';
$style = '';
// v4
if ($major == 4) {
$version = '4.0';
$script = acf_get_dir("assets/inc/select2/4/select2.full{$min}.js");
$style = acf_get_dir("assets/inc/select2/4/select2{$min}.css");
// v3
} else {
$version = '3.5.2';
$script = acf_get_dir("assets/inc/select2/3/select2{$min}.js");
$style = acf_get_dir("assets/inc/select2/3/select2.css");
}
// enqueue
wp_enqueue_script('select2', $script, array('jquery'), $version);
wp_enqueue_style('select2', $style, '', $version);
}
示例5: admin_footer
function admin_footer()
{
// vars
$args = acf_get_setting('form_data');
// global
global $wp_version;
// options
$o = array('post_id' => $args['post_id'], 'nonce' => wp_create_nonce('acf_nonce'), 'admin_url' => admin_url(), 'ajaxurl' => admin_url('admin-ajax.php'), 'ajax' => $args['ajax'], 'validation' => $args['validation'], 'wp_version' => $wp_version);
// l10n
$l10n = apply_filters('acf/input/admin_l10n', array('unload' => __('The changes you made will be lost if you navigate away from this page', 'acf'), 'expand_details' => __('Expand Details', 'acf'), 'collapse_details' => __('Collapse Details', 'acf')));
?>
<script type="text/javascript">
/* <![CDATA[ */
if( typeof acf !== 'undefined' ) {
acf.o = <?php
echo json_encode($o);
?>
;
acf.l10n = <?php
echo json_encode($l10n);
?>
;
<?php
do_action('acf/input/admin_footer_js');
?>
}
/* ]]> */
</script>
<?php
}
示例6: is_version_compatible
/**
* Check if the installed version of ACF is compatible with this version of Layotter
*
* @return bool
*/
public static function is_version_compatible()
{
if (self::is_pro_installed()) {
return version_compare(acf_get_setting('version'), self::REQUIRED_PRO_VERSION) >= 0;
} else {
return version_compare(acf()->get_info('version'), self::REQUIRED_VERSION) >= 0;
}
}
示例7: admin_menu
function admin_menu()
{
// bail early if no show_admin
if (!acf_get_setting('show_admin')) {
return;
}
add_menu_page(__("Custom Fields", 'acf'), __("Custom Fields", 'acf'), 'manage_options', 'edit.php?post_type=acf-field-group', false, false, '80.025');
}
示例8: wp_init
function wp_init()
{
// register acf scripts
wp_register_script('acf-pro-input', acf_get_dir('pro/js/pro-input.js'), false, acf_get_setting('version'));
wp_register_style('acf-pro-input', acf_get_dir('pro/css/pro-input.css'), false, acf_get_setting('version'));
// register acf scripts
wp_register_script('acf-pro-field-group', acf_get_dir('pro/js/pro-field-group.js'), false, acf_get_setting('version'));
wp_register_style('acf-pro-field-group', acf_get_dir('pro/css/pro-field-group.css'), false, acf_get_setting('version'));
}
示例9: is_enabled
function is_enabled()
{
// bail early if no local allowed
if (!acf_get_setting('local')) {
return false;
}
// return
return acf_is_filter_enabled('local');
}
示例10: admin_menu
function admin_menu()
{
// bail early if no show_admin
if (!acf_get_setting('show_admin')) {
return;
}
// add page
$page = add_submenu_page('edit.php?post_type=acf-field-group', __('Import / Export', 'acf'), __('Import/Export', 'acf'), 'manage_options', 'acf-settings-export', array($this, 'html'));
// actions
add_action('load-' . $page, array($this, 'load'));
}
示例11: wp_init
function wp_init()
{
// min
$min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
// register scripts
wp_register_script('acf-pro-input', acf_get_dir("pro/js/pro-input{$min}.js"), false, acf_get_setting('version'));
wp_register_script('acf-pro-field-group', acf_get_dir("pro/js/pro-field-group{$min}.js"), false, acf_get_setting('version'));
// register styles
wp_register_style('acf-pro-input', acf_get_dir('pro/css/pro-input.css'), false, acf_get_setting('version'));
wp_register_style('acf-pro-field-group', acf_get_dir('pro/css/pro-field-group.css'), false, acf_get_setting('version'));
}
示例12: acf_get_valid_field_group
function acf_get_valid_field_group($field_group = false)
{
// parse in defaults
$field_group = acf_parse_args($field_group, array('ID' => 0, 'key' => '', 'title' => '', 'fields' => array(), 'location' => array(), 'menu_order' => 0, 'position' => 'normal', 'style' => 'default', 'label_placement' => 'top', 'instruction_placement' => 'label', 'hide_on_screen' => array(), 'active' => 1, 'description' => ''));
// translate
$field_group = acf_translate_keys($field_group, acf_get_setting('l10n_field_group'));
// filter
$field_group = apply_filters('acf/get_valid_field_group', $field_group);
// return
return $field_group;
}
示例13: html
function html()
{
// vars
$view = array('version' => acf_get_setting('version'), 'have_pro' => acf_get_setting('pro'), 'tabs' => array('new' => __("What's New", 'acf'), 'changelog' => __("Changelog", 'acf')), 'active' => 'new');
// set active tab
if (!empty($_GET['tab']) && array_key_exists($_GET['tab'], $view['tabs'])) {
$view['active'] = $_GET['tab'];
}
// load view
acf_get_view('settings-info', $view);
}
示例14: admin_menu
function admin_menu()
{
// bail early if no show_admin
if (!acf_get_setting('show_admin')) {
return;
}
// add parent menu page
add_menu_page(__("Custom Fields", 'acf'), __("Custom Fields", 'acf'), acf_get_setting('capability'), 'edit.php?post_type=acf-field-group', false, false, '80.025');
// add child menu page
add_submenu_page('edit.php?post_type=acf-field-group', __('Add New', 'acf'), __('Add New', 'acf'), acf_get_setting('capability'), 'post-new.php?post_type=acf-field-group');
}
示例15: admin_menu
function admin_menu()
{
// bail early if no show_admin
if (!acf_get_setting('show_admin')) {
return;
}
// add page
$page = add_submenu_page('edit.php?post_type=acf-field-group', __('Tools', 'acf'), __('Tools', 'acf'), acf_get_setting('capability'), 'acf-settings-tools', array($this, 'html'));
// actions
add_action('load-' . $page, array($this, 'load'));
}