本文整理汇总了PHP中wpcf_admin_fields_save_group_post_types函数的典型用法代码示例。如果您正苦于以下问题:PHP wpcf_admin_fields_save_group_post_types函数的具体用法?PHP wpcf_admin_fields_save_group_post_types怎么用?PHP wpcf_admin_fields_save_group_post_types使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpcf_admin_fields_save_group_post_types函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wpcf_ajax
//.........这里部分代码省略.........
$id = array_shift($element);
$element_txt = wpcf_fields_radio_get_option_alt_text($id, urldecode($_GET['parent_name']));
echo json_encode(array('output' => wpcf_form_simple($element), 'execute' => 'jQuery("#wpcf-form-groups-radio-ajax-response-' . urldecode($_GET['wpcf_ajax_update_add']) . '").append(\'' . trim(str_replace("\r\n", '', wpcf_form_simple($element_txt))) . '\');', 'wpcf_nonce_ajax_callback' => wp_create_nonce('execute')));
break;
case 'add_select_option':
require_once WPCF_INC_ABSPATH . '/fields/select.php';
$element = wpcf_fields_select_get_option(urldecode($_GET['parent_name']));
echo json_encode(array('output' => wpcf_form_simple($element)));
break;
case 'add_checkboxes_option':
require_once WPCF_INC_ABSPATH . '/fields/checkboxes.php';
$element = wpcf_fields_checkboxes_get_option(urldecode($_GET['parent_name']));
$id = array_shift($element);
$element_txt = wpcf_fields_checkboxes_get_option_alt_text($id, urldecode($_GET['parent_name']));
echo json_encode(array('output' => wpcf_form_simple($element), 'wpcf_nonce_ajax_callback' => wp_create_nonce('execute')));
break;
case 'group_form_collapsed':
require_once WPCF_INC_ABSPATH . '/fields-form.php';
$group_id = sanitize_text_field($_GET['group_id']);
$action = sanitize_text_field($_GET['toggle']);
$fieldset = sanitize_text_field($_GET['id']);
wpcf_admin_fields_form_save_open_fieldset($action, $fieldset, $group_id);
break;
case 'form_fieldset_toggle':
$action = sanitize_text_field($_GET['toggle']);
$fieldset = sanitize_text_field($_GET['id']);
wpcf_admin_form_fieldset_save_toggle($action, $fieldset);
break;
case 'group_update_post_types':
require_once WPCF_INC_ABSPATH . '/fields.php';
// @todo Sanitize this $post_types
$post_types = empty($_GET['wpcf']['group']['supports']) ? array() : $_GET['wpcf']['group']['supports'];
if (!empty($_GET['group_id'])) {
wpcf_admin_fields_save_group_post_types(sanitize_text_field($_GET['group_id']), $post_types);
$output = array();
foreach ($post_types as $post_type) {
$post_type = get_post_type_object($post_type);
if (!empty($post_type->label)) {
$output[] = $post_type->label;
}
}
if (empty($post_types)) {
$output[] = __('No post types associated', 'wpcf');
}
$output = implode(', ', $output);
} else {
$output = __('No post types associated', 'wpcf');
}
echo json_encode(array('output' => $output));
break;
case 'group_update_taxonomies':
require_once WPCF_INC_ABSPATH . '/fields.php';
$taxonomies_post = empty($_GET['wpcf']['group']['taxonomies']) ? array() : $_GET['wpcf']['group']['taxonomies'];
$terms = array();
foreach ($taxonomies_post as $taxonomy) {
foreach ($taxonomy as $tax => $term) {
$terms[] = $term;
}
}
if (!empty($_GET['group_id'])) {
wpcf_admin_fields_save_group_terms(sanitize_text_field($_GET['group_id']), $terms);
$output = array();
foreach ($taxonomies_post as $taxonomy => $terms) {
$taxonomy = get_taxonomy($taxonomy);
if (!empty($taxonomy)) {
$title = $taxonomy->label . ': ';
开发者ID:SpencerNeitzke,项目名称:types,代码行数:67,代码来源:ajax.php
示例2: wpcf_ajax
//.........这里部分代码省略.........
$custom_taxonomies = get_option('wpcf-custom-taxonomies', array());
unset($custom_taxonomies[$_GET['wpcf-tax']]);
update_option('wpcf-custom-taxonomies', $custom_taxonomies);
echo json_encode(array('output' => '', 'execute' => 'jQuery("#wpcf-list-activate-' . $_GET['wpcf-tax'] . '").parents("tr").css("background-color", "#FF0000").fadeOut();', 'wpcf_nonce_ajax_callback' => wp_create_nonce('execute')));
break;
case 'add_radio_option':
require_once WPCF_INC_ABSPATH . '/fields/radio.php';
$element = wpcf_fields_radio_get_option(urldecode($_GET['parent_name']));
$id = array_shift($element);
$element_txt = wpcf_fields_radio_get_option_alt_text($id, urldecode($_GET['parent_name']));
echo json_encode(array('output' => wpcf_form_simple($element), 'execute' => 'jQuery("#wpcf-form-groups-radio-ajax-response-' . urldecode($_GET['wpcf_ajax_update_add']) . '").append(\'' . trim(str_replace("\r\n", '', wpcf_form_simple($element_txt))) . '\');', 'wpcf_nonce_ajax_callback' => wp_create_nonce('execute')));
break;
case 'add_select_option':
require_once WPCF_INC_ABSPATH . '/fields/select.php';
$element = wpcf_fields_select_get_option(urldecode($_GET['parent_name']));
echo json_encode(array('output' => wpcf_form_simple($element)));
break;
case 'group_form_collapsed':
require_once WPCF_INC_ABSPATH . '/fields-form.php';
$group_id = $_GET['group_id'];
$action = $_GET['toggle'];
$fieldset = $_GET['id'];
wpcf_admin_fields_form_save_open_fieldset($action, $fieldset, $group_id);
break;
case 'form_fieldset_toggle':
$action = $_GET['toggle'];
$fieldset = $_GET['id'];
wpcf_admin_form_fieldset_save_toggle($action, $fieldset);
break;
case 'group_update_post_types':
require_once WPCF_INC_ABSPATH . '/fields.php';
$post_types = empty($_GET['wpcf']['group']['supports']) ? array() : $_GET['wpcf']['group']['supports'];
if (!empty($_GET['group_id'])) {
wpcf_admin_fields_save_group_post_types($_GET['group_id'], $post_types);
$output = array();
foreach ($post_types as $post_type) {
$post_type = get_post_type_object($post_type);
if (!empty($post_type->label)) {
$output[] = $post_type->label;
}
}
if (empty($post_types)) {
$output[] = __('No post types associated', 'wpcf');
}
$output = implode(', ', $output);
} else {
$output = __('No post types associated', 'wpcf');
}
echo json_encode(array('output' => $output));
break;
case 'group_update_taxonomies':
require_once WPCF_INC_ABSPATH . '/fields.php';
$taxonomies_post = empty($_GET['wpcf']['group']['taxonomies']) ? array() : $_GET['wpcf']['group']['taxonomies'];
$terms = array();
foreach ($taxonomies_post as $taxonomy) {
foreach ($taxonomy as $tax => $term) {
$terms[] = $term;
}
}
if (!empty($_GET['group_id'])) {
wpcf_admin_fields_save_group_terms($_GET['group_id'], $terms);
$output = array();
foreach ($taxonomies_post as $taxonomy => $terms) {
$taxonomy = get_taxonomy($taxonomy);
if (!empty($taxonomy)) {
$title = $taxonomy->label . ': ';
开发者ID:nuevomediagroup,项目名称:nmg-code,代码行数:67,代码来源:ajax.php
示例3: wpcf_admin_migration_form_submit
/**
* Adds 3rd party created types, taxonomies and fields
*/
function wpcf_admin_migration_form_submit()
{
$cfui_types = get_option('cpt_custom_post_types', array());
$cfui_taxonomies = get_option('cpt_custom_tax_types', array());
$wpcf_types = get_option('wpcf-custom-types', array());
$wpcf_taxonomies = get_option('wpcf-custom-taxonomies', array());
$redirect_page = 'wpcf-ctt';
if (!empty($_POST['cfui']['types'])) {
$data = array();
foreach ($_POST['cfui']['types'] as $key => $types_slug) {
if (array_key_exists(sanitize_title($types_slug), $wpcf_types)) {
continue;
}
foreach ($cfui_types as $cfui_type) {
if (sanitize_title($cfui_type['name']) == $types_slug) {
$data[$types_slug] = wpcf_admin_migrate_get_cfui_type_data($cfui_type);
wpcf_admin_message_store(sprintf(__("Post Type %s added", 'wpcf'), '<em>' . $cfui_type['name'] . '</em>'));
}
}
}
$wpcf_types = array_merge($wpcf_types, $data);
update_option('wpcf-custom-types', $wpcf_types);
}
if (!empty($_POST['cfui']['tax'])) {
$data = array();
foreach ($_POST['cfui']['tax'] as $key => $tax_slug) {
if (array_key_exists(sanitize_title($tax_slug), $wpcf_taxonomies)) {
continue;
}
foreach ($cfui_taxonomies as $cfui_tax) {
if (sanitize_title($cfui_tax['name']) == $tax_slug) {
$data[$tax_slug] = wpcf_admin_migrate_get_cfui_tax_data($cfui_tax);
wpcf_admin_message_store(sprintf(__("Taxonomy %s added", 'wpcf'), '<em>' . $cfui_tax['name'] . '</em>'));
}
}
}
$wpcf_taxonomies = array_merge($wpcf_taxonomies, $data);
update_option('wpcf-custom-taxonomies', $wpcf_taxonomies);
}
// ACF
if (!empty($_POST['acf_posts']['migrate_groups'])) {
foreach ($_POST['acf_posts']['migrate_groups'] as $acf_group_id) {
if (empty($_POST['acf_posts'][$acf_group_id])) {
continue;
}
global $wpdb;
$group = $wpdb->get_row($wpdb->prepare("SELECT ID, post_title FROM {$wpdb->posts} WHERE post_title = %s AND post_type='wp-types-group'", $_POST['acf_posts'][$acf_group_id]['post_title']));
if (empty($group)) {
$group = array();
$group['name'] = $_POST['acf_posts'][$acf_group_id]['post_title'];
$group['description'] = $_POST['acf_posts'][$acf_group_id]['post_content'];
$group_id = wpcf_admin_fields_save_group($group);
wpcf_admin_message_store(sprintf(__("Group %s added", 'wpcf'), '<em>' . $group['name'] . '</em>'));
} else {
$group_id = $group->ID;
wpcf_admin_message_store(sprintf(__("Group %s updated", 'wpcf'), '<em>' . $group->post_title . '</em>'));
}
$fields_to_add = array();
if ($group_id && !empty($_POST['acf_posts'][$acf_group_id]['fields'])) {
foreach ($_POST['acf_posts'][$acf_group_id]['fields'] as $field_id => $field) {
if (!in_array($field_id, $_POST['acf_posts'][$acf_group_id]['migrate_fields'])) {
continue;
}
if (!wpcf_types_cf_under_control('check_exists', $field['slug']) || wpcf_types_cf_under_control('check_outsider', $field['slug'])) {
// save field
$field['controlled'] = 1;
$temp = wpcf_admin_fields_save_field($field);
$fields_to_add[] = $temp;
wpcf_admin_message_store(sprintf(__("Field %s added", 'wpcf'), '<em>' . $temp . '</em>'));
}
}
wpcf_admin_fields_save_group_fields($group_id, $fields_to_add, false);
}
wpcf_admin_fields_save_group_post_types($group_id, array());
wpcf_admin_fields_save_group_terms($group_id, array());
}
$redirect_page = 'wpcf';
}
flush_rewrite_rules();
// Deactivate plugins
if (!empty($_POST['deactivate-cfui'])) {
$active_plugins = get_option('active_plugins', array());
foreach ($active_plugins as $key => $file) {
if (strpos($file, 'custom-post-type-ui.php') !== false) {
unset($active_plugins[$key]);
}
}
update_option('active_plugins', array_values($active_plugins));
}
wp_redirect(admin_url('admin.php?page=' . $redirect_page));
die;
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:95,代码来源:migration.php
示例4: wpcf_admin_save_fields_groups_submit
/**
* Saves fields and groups.
*
* If field name is changed in specific group - new one will be created,
* otherwise old one will be updated and will appear in that way in other grups.
*
* @return type
*/
function wpcf_admin_save_fields_groups_submit($form)
{
if (!isset($_POST['wpcf']['group']['name'])) {
return false;
}
global $wpdb;
$new_group = false;
$group_slug = $_POST['wpcf']['group']['slug'] = sanitize_title($_POST['wpcf']['group']['name']);
// Basic check
if (isset($_REQUEST['group_id'])) {
// Check if group exists
$post = get_post($_REQUEST['group_id']);
if (empty($post) || $post->post_type != 'wp-types-group') {
$form->triggerError();
wpcf_admin_message(sprintf(__("Wrong group ID %d", 'wpcf'), intval($_REQUEST['group_id'])), 'error');
return false;
}
$group_id = $post->ID;
} else {
$new_group = true;
}
// Save fields for future use
$fields = array();
if (!empty($_POST['wpcf']['fields'])) {
// Before anything - search unallowed characters
foreach ($_POST['wpcf']['fields'] as $key => $field) {
if (empty($field['slug']) && preg_match('#[^a-zA-Z0-9\\s\\_\\-]#', $field['name']) || !empty($field['slug']) && preg_match('#[^a-zA-Z0-9\\s\\_\\-]#', $field['slug'])) {
$form->triggerError();
wpcf_admin_message(sprintf(__('Field slugs cannot contain non-English characters. Please edit this field name %s and save again.', 'wpcf'), $field['name']), 'error');
return false;
}
}
foreach ($_POST['wpcf']['fields'] as $key => $field) {
if (!empty($field['is_new'])) {
if (wpcf_types_cf_under_control('check_exists', sanitize_title($field['name']))) {
$form->triggerError();
wpcf_admin_message(sprintf(__('Field with name "%s" already exists', 'wpcf'), $field['name']), 'error');
return false;
}
}
// Field ID and slug are same thing
// $slug = $_POST['wpcf']['fields'][$key]['slug'] = sanitize_title($field['name']);
$field_id = wpcf_admin_fields_save_field($field);
if (!empty($field_id)) {
$fields[] = $field_id;
}
// WPML
if (function_exists('wpml_cf_translation_preferences_store')) {
$wpml_save_cf = wpml_cf_translation_preferences_store($key, wpcf_types_get_meta_prefix(wpcf_admin_fields_get_field($field_id)) . $field_id);
}
}
}
// Save group
$post_types = isset($_POST['wpcf']['group']['supports']) ? $_POST['wpcf']['group']['supports'] : array();
$taxonomies_post = isset($_POST['wpcf']['group']['taxonomies']) ? $_POST['wpcf']['group']['taxonomies'] : array();
$terms = array();
foreach ($taxonomies_post as $taxonomy) {
foreach ($taxonomy as $tax => $term) {
$terms[] = $term;
}
}
// Rename if needed
if (isset($_REQUEST['group_id'])) {
$_POST['wpcf']['group']['id'] = $_REQUEST['group_id'];
}
$group_id = wpcf_admin_fields_save_group($_POST['wpcf']['group']);
// Set open fieldsets
if ($new_group && !empty($group_id)) {
$open_fieldsets = get_user_meta(get_current_user_id(), 'wpcf-group-form-toggle', true);
if (isset($open_fieldsets[-1])) {
$open_fieldsets[$group_id] = $open_fieldsets[-1];
unset($open_fieldsets[-1]);
update_user_meta(get_current_user_id(), 'wpcf-group-form-toggle', $open_fieldsets);
}
}
// Rest of processes
if (!empty($group_id)) {
wpcf_admin_fields_save_group_fields($group_id, $fields);
wpcf_admin_fields_save_group_post_types($group_id, $post_types);
wpcf_admin_fields_save_group_terms($group_id, $terms);
if (!empty($_POST['wpcf']['group']['templates'])) {
wpcf_admin_fields_save_group_templates($group_id, $_POST['wpcf']['group']['templates']);
}
$_POST['wpcf']['group']['fields'] = isset($_POST['wpcf']['fields']) ? $_POST['wpcf']['fields'] : array();
do_action('wpcf_save_group', $_POST['wpcf']['group']);
wpcf_admin_message_store(__('Group saved', 'wpcf'));
wp_redirect(admin_url('admin.php?page=wpcf-edit&group_id=' . $group_id));
die;
} else {
wpcf_admin_message_store(__('Error saving group', 'wpcf'), 'error');
}
}
开发者ID:nuevomediagroup,项目名称:nmg-code,代码行数:100,代码来源:fields-form.php
示例5: wpcf_admin_save_fields_groups_submit
//.........这里部分代码省略.........
// Check if already exists
$exists = get_page_by_title($_POST['wpcf']['group']['name'], 'OBJECT', 'wp-types-group');
if (!empty($exists)) {
$form->triggerError();
wpcf_admin_message(sprintf(__("A group by name <em>%s</em> already exists. Please use a different name and save again.", 'wpcf'), htmlspecialchars($_POST['wpcf']['group']['name'])), 'error');
return $form;
}
}
// Save fields for future use
$fields = array();
if (!empty($_POST['wpcf']['fields'])) {
// Before anything - search unallowed characters
foreach ($_POST['wpcf']['fields'] as $key => $field) {
if (empty($field['slug']) && preg_match('#[^a-zA-Z0-9\\s\\_\\-]#', $field['name']) || !empty($field['slug']) && preg_match('#[^a-zA-Z0-9\\s\\_\\-]#', $field['slug'])) {
$form->triggerError();
wpcf_admin_message(sprintf(__('Field slugs cannot contain non-English characters. Please edit this field name %s and save again.', 'wpcf'), $field['name']), 'error');
return $form;
}
if (!empty($field['name']) && is_numeric($field['name']) || !empty($field['slug']) && is_numeric($field['slug'])) {
$form->triggerError();
wpcf_admin_message(sprintf(__('Field names or slugs cannot contain only numbers.', 'wpcf'), $field['name']), 'error');
return $form;
}
}
// First check all fields
foreach ($_POST['wpcf']['fields'] as $key => $field) {
$field = apply_filters('wpcf_field_pre_save', $field);
if (!empty($field['is_new'])) {
// Check name and slug
if (wpcf_types_cf_under_control('check_exists', sanitize_title($field['name']))) {
$form->triggerError();
wpcf_admin_message(sprintf(__('Field with name "%s" already exists', 'wpcf'), $field['name']), 'error');
return $form;
}
if (isset($field['slug']) && wpcf_types_cf_under_control('check_exists', sanitize_title($field['slug']))) {
$form->triggerError();
wpcf_admin_message(sprintf(__('Field with slug "%s" already exists', 'wpcf'), $field['slug']), 'error');
return $form;
}
}
// Field ID and slug are same thing
$field_id = wpcf_admin_fields_save_field($field);
if (is_wp_error($field_id)) {
$form->triggerError();
wpcf_admin_message($field_id->get_error_message(), 'error');
return $form;
}
if (!empty($field_id)) {
$fields[] = $field_id;
}
// WPML
if (function_exists('wpml_cf_translation_preferences_store')) {
$wpml_save_cf = wpml_cf_translation_preferences_store($key, wpcf_types_get_meta_prefix(wpcf_admin_fields_get_field($field_id)) . $field_id);
}
}
}
// Save group
$post_types = isset($_POST['wpcf']['group']['supports']) ? $_POST['wpcf']['group']['supports'] : array();
$taxonomies_post = isset($_POST['wpcf']['group']['taxonomies']) ? $_POST['wpcf']['group']['taxonomies'] : array();
$admin_style = $_POST['wpcf']['group']['admin_styles'];
$terms = array();
foreach ($taxonomies_post as $taxonomy) {
foreach ($taxonomy as $tax => $term) {
$terms[] = $term;
}
}
// Rename if needed
if (isset($_REQUEST['group_id'])) {
$_POST['wpcf']['group']['id'] = intval($_REQUEST['group_id']);
}
$group_id = wpcf_admin_fields_save_group($_POST['wpcf']['group']);
$_POST['wpcf']['group']['id'] = $group_id;
// Set open fieldsets
if ($new_group && !empty($group_id)) {
$open_fieldsets = get_user_meta(get_current_user_id(), 'wpcf-group-form-toggle', true);
if (isset($open_fieldsets[-1])) {
$open_fieldsets[$group_id] = $open_fieldsets[-1];
unset($open_fieldsets[-1]);
update_user_meta(get_current_user_id(), 'wpcf-group-form-toggle', $open_fieldsets);
}
}
// Rest of processes
if (!empty($group_id)) {
wpcf_admin_fields_save_group_fields($group_id, $fields);
wpcf_admin_fields_save_group_post_types($group_id, $post_types);
wpcf_admin_fields_save_group_terms($group_id, $terms);
wpcf_admin_fields_save_group_admin_styles($group_id, $admin_style);
if (empty($_POST['wpcf']['group']['templates'])) {
$_POST['wpcf']['group']['templates'] = array();
}
wpcf_admin_fields_save_group_templates($group_id, $_POST['wpcf']['group']['templates']);
$_POST['wpcf']['group']['fields'] = isset($_POST['wpcf']['fields']) ? $_POST['wpcf']['fields'] : array();
do_action('wpcf_save_group', $_POST['wpcf']['group']);
wpcf_admin_message_store(apply_filters('types_message_custom_fields_saved', __('Group saved', 'wpcf'), $_POST['wpcf']['group']['name'], $new_group ? false : true), 'custom');
wp_redirect(admin_url('admin.php?page=wpcf-edit&group_id=' . $group_id));
die;
} else {
wpcf_admin_message_store(__('Error saving group', 'wpcf'), 'error');
}
}
开发者ID:chrismathers,项目名称:premierplacement,代码行数:101,代码来源:fields-form.php
示例6: save_condition_post_types
/**
* Summary.
*
* Description.
*
* @since x.x.x
* @access (for functions: only use if private)
*
* @param $group_id
*/
private function save_condition_post_types($group_id)
{
$post_types = isset($_POST['wpcf']['group']['supports']) ? $_POST['wpcf']['group']['supports'] : array();
wpcf_admin_fields_save_group_post_types($group_id, $post_types);
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:15,代码来源:class.types.admin.edit.custom.fields.group.php
示例7: wpcf_ajax
//.........这里部分代码省略.........
$element = wpcf_fields_radio_get_option(urldecode($_GET['parent_name']));
$id = array_shift($element);
$element_txt = wpcf_fields_radio_get_option_alt_text($id, urldecode($_GET['parent_name']));
echo json_encode(array('output' => wpcf_form_simple($element), 'execute' => 'jQuery("#wpcf-form-groups-radio-ajax-response-' . urldecode($_GET['wpcf_ajax_update_add']) . '").append(\'' . trim(str_replace("\r\n", '', wpcf_form_simple($element_txt))) . '\');', 'wpcf_nonce_ajax_callback' => wp_create_nonce('execute')));
break;
case 'add_select_option':
require_once WPCF_INC_ABSPATH . '/fields/select.php';
$element = wpcf_fields_select_get_option(urldecode($_GET['parent_name']));
echo json_encode(array('output' => wpcf_form_simple($element)));
break;
case 'add_checkboxes_option':
require_once WPCF_INC_ABSPATH . '/fields/checkboxes.php';
$element = wpcf_fields_checkboxes_get_option(urldecode($_GET['parent_name']));
$id = array_shift($element);
$element_txt = wpcf_fields_checkboxes_get_option_alt_text($id, urldecode($_GET['parent_name']));
echo json_encode(array('output' => wpcf_form_simple($element), 'wpcf_nonce_ajax_callback' => wp_create_nonce('execute')));
break;
case 'group_form_collapsed':
require_once WPCF_INC_ABSPATH . '/fields-form.php';
$group_id = $_GET['group_id'];
$action = $_GET['toggle'];
$fieldset = $_GET['id'];
wpcf_admin_fields_form_save_open_fieldset($action, $fieldset, $group_id);
break;
case 'form_fieldset_toggle':
$action = $_GET['toggle'];
$fieldset = $_GET['id'];
wpcf_admin_form_fieldset_save_toggle($action, $fieldset);
break;
case 'group_update_post_types':
require_once WPCF_INC_ABSPATH . '/fields.php';
$post_types = empty($_GET['wpcf']['group']['supports']) ? array() : $_GET['wpcf']['group']['supports'];
if (!empty($_GET['group_id'])) {
wpcf_admin_fields_save_group_post_types($_GET['group_id'], $post_types);
$output = array();
foreach ($post_types as $post_type) {
$post_type = get_post_type_object($post_type);
if (!empty($post_type->label)) {
$output[] = $post_type->label;
}
}
if (empty($post_types)) {
$output[] = __('No post types associated', 'wpcf');
}
$output = implode(', ', $output);
} else {
$output = __('No post types associated', 'wpcf');
}
echo json_encode(array('output' => $output));
break;
case 'group_update_taxonomies':
require_once WPCF_INC_ABSPATH . '/fields.php';
$taxonomies_post = empty($_GET['wpcf']['group']['taxonomies']) ? array() : $_GET['wpcf']['group']['taxonomies'];
$terms = array();
foreach ($taxonomies_post as $taxonomy) {
foreach ($taxonomy as $tax => $term) {
$terms[] = $term;
}
}
if (!empty($_GET['group_id'])) {
wpcf_admin_fields_save_group_terms($_GET['group_id'], $terms);
$output = array();
foreach ($taxonomies_post as $taxonomy => $terms) {
$taxonomy = get_taxonomy($taxonomy);
if (!empty($taxonomy)) {
$title = $taxonomy->label . ': ';
开发者ID:CrankMaster336,项目名称:FFW-TR,代码行数:67,代码来源:ajax.php
注:本文中的wpcf_admin_fields_save_group_post_types函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论