本文整理汇总了PHP中wpcf_admin_fields_remove_field_from_group函数的典型用法代码示例。如果您正苦于以下问题:PHP wpcf_admin_fields_remove_field_from_group函数的具体用法?PHP wpcf_admin_fields_remove_field_from_group怎么用?PHP wpcf_admin_fields_remove_field_from_group使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpcf_admin_fields_remove_field_from_group函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wpcf_ajax
/**
* All AJAX calls go here.
*/
function wpcf_ajax()
{
if (!current_user_can('manage_options') || (!isset($_REQUEST['_wpnonce']) || !wp_verify_nonce($_REQUEST['_wpnonce'], $_REQUEST['wpcf_action']))) {
die;
}
switch ($_REQUEST['wpcf_action']) {
case 'fields_insert':
require_once WPCF_INC_ABSPATH . '/fields.php';
require_once WPCF_INC_ABSPATH . '/fields-form.php';
wpcf_fields_insert_ajax();
wpcf_form_render_js_validation();
break;
case 'fields_insert_existing':
require_once WPCF_INC_ABSPATH . '/fields.php';
require_once WPCF_INC_ABSPATH . '/fields-form.php';
wpcf_fields_insert_existing_ajax();
wpcf_form_render_js_validation();
break;
case 'remove_field_from_group':
require_once WPCF_INC_ABSPATH . '/fields.php';
if (isset($_GET['group_id']) && isset($_GET['field_id'])) {
wpcf_admin_fields_remove_field_from_group($_GET['group_id'], $_GET['field_id']);
}
break;
case 'deactivate_group':
require_once WPCF_INC_ABSPATH . '/fields.php';
$success = wpcf_admin_fields_deactivate_group(intval($_GET['group_id']));
if ($success) {
echo json_encode(array('output' => __('Group deactivated', 'wpcf'), 'execute' => 'jQuery("#wpcf-list-activate-' . intval($_GET['group_id']) . '").replaceWith(\'' . wpcf_admin_fields_get_ajax_activation_link(intval($_GET['group_id'])) . '\');jQuery(".wpcf-table-column-active-' . intval($_GET['group_id']) . '").html("' . __('No', 'wpcf') . '");', 'wpcf_nonce_ajax_callback' => wp_create_nonce('execute')));
} else {
echo json_encode(array('output' => __('Error occured', 'wpcf')));
}
break;
case 'activate_group':
require_once WPCF_INC_ABSPATH . '/fields.php';
$success = wpcf_admin_fields_activate_group(intval($_GET['group_id']));
if ($success) {
echo json_encode(array('output' => __('Group activated', 'wpcf'), 'execute' => 'jQuery("#wpcf-list-activate-' . intval($_GET['group_id']) . '").replaceWith(\'' . wpcf_admin_fields_get_ajax_deactivation_link(intval($_GET['group_id'])) . '\');jQuery(".wpcf-table-column-active-' . intval($_GET['group_id']) . '").html("' . __('Yes', 'wpcf') . '");', 'wpcf_nonce_ajax_callback' => wp_create_nonce('execute')));
} else {
echo json_encode(array('output' => __('Error occured', 'wpcf')));
}
break;
case 'delete_group':
require_once WPCF_INC_ABSPATH . '/fields.php';
wpcf_admin_fields_delete_group(intval($_GET['group_id']));
echo json_encode(array('output' => '', 'execute' => 'jQuery("#wpcf-list-activate-' . intval($_GET['group_id']) . '").parents("tr").css("background-color", "#FF0000").fadeOut();', 'wpcf_nonce_ajax_callback' => wp_create_nonce('execute')));
break;
case 'deactivate_post_type':
if (!isset($_GET['wpcf-post-type'])) {
die;
}
require_once WPCF_INC_ABSPATH . '/custom-types.php';
$custom_types = get_option('wpcf-custom-types', array());
if (isset($custom_types[$_GET['wpcf-post-type']])) {
$custom_types[$_GET['wpcf-post-type']]['disabled'] = 1;
update_option('wpcf-custom-types', $custom_types);
echo json_encode(array('output' => __('Post type deactivated', 'wpcf'), 'execute' => 'jQuery("#wpcf-list-activate-' . $_GET['wpcf-post-type'] . '").replaceWith(\'' . wpcf_admin_custom_types_get_ajax_activation_link(esc_attr($_GET['wpcf-post-type'])) . '\');jQuery(".wpcf-table-column-active-' . $_GET['wpcf-post-type'] . '").html("' . __('No', 'wpcf') . '");', 'wpcf_nonce_ajax_callback' => wp_create_nonce('execute')));
} else {
echo json_encode(array('output' => __('Error occured', 'wpcf')));
}
break;
case 'activate_post_type':
if (!isset($_GET['wpcf-post-type'])) {
die;
}
require_once WPCF_INC_ABSPATH . '/custom-types.php';
$custom_types = get_option('wpcf-custom-types', array());
if (isset($custom_types[$_GET['wpcf-post-type']])) {
$custom_types[$_GET['wpcf-post-type']]['disabled'] = 0;
update_option('wpcf-custom-types', $custom_types);
echo json_encode(array('output' => __('Post type activated', 'wpcf'), 'execute' => 'jQuery("#wpcf-list-activate-' . $_GET['wpcf-post-type'] . '").replaceWith(\'' . wpcf_admin_custom_types_get_ajax_deactivation_link($_GET['wpcf-post-type']) . '\');jQuery(".wpcf-table-column-active-' . $_GET['wpcf-post-type'] . '").html("' . __('Yes', 'wpcf') . '");', 'wpcf_nonce_ajax_callback' => wp_create_nonce('execute')));
} else {
echo json_encode(array('output' => __('Error occured', 'wpcf')));
}
break;
case 'delete_post_type':
if (!isset($_GET['wpcf-post-type'])) {
die;
}
$custom_types = get_option('wpcf-custom-types', array());
unset($custom_types[$_GET['wpcf-post-type']]);
update_option('wpcf-custom-types', $custom_types);
echo json_encode(array('output' => '', 'execute' => 'jQuery("#wpcf-list-activate-' . $_GET['wpcf-post-type'] . '").parents("tr").css("background-color", "#FF0000").fadeOut();', 'wpcf_nonce_ajax_callback' => wp_create_nonce('execute')));
break;
case 'deactivate_taxonomy':
if (!isset($_GET['wpcf-tax'])) {
die;
}
require_once WPCF_INC_ABSPATH . '/custom-taxonomies.php';
$custom_taxonomies = get_option('wpcf-custom-taxonomies', array());
if (isset($custom_taxonomies[$_GET['wpcf-tax']])) {
$custom_taxonomies[$_GET['wpcf-tax']]['disabled'] = 1;
update_option('wpcf-custom-taxonomies', $custom_taxonomies);
echo json_encode(array('output' => __('Taxonomy deactivated', 'wpcf'), 'execute' => 'jQuery("#wpcf-list-activate-' . $_GET['wpcf-tax'] . '").replaceWith(\'' . wpcf_admin_custom_taxonomies_get_ajax_activation_link($_GET['wpcf-tax']) . '\');jQuery(".wpcf-table-column-active-' . $_GET['wpcf-tax'] . '").html("' . __('No', 'wpcf') . '");', 'wpcf_nonce_ajax_callback' => wp_create_nonce('execute')));
} else {
echo json_encode(array('output' => __('Error occured', 'wpcf')));
}
//.........这里部分代码省略.........
开发者ID:nuevomediagroup,项目名称:nmg-code,代码行数:101,代码来源:ajax.php
示例2: wpcf_ajax
/**
* All AJAX calls go here.
*
* @global object $wpdb
*
*/
function wpcf_ajax()
{
if (!current_user_can('manage_options') || (!isset($_REQUEST['_wpnonce']) || !wp_verify_nonce($_REQUEST['_wpnonce'], $_REQUEST['wpcf_action']))) {
die;
}
switch ($_REQUEST['wpcf_action']) {
/* User meta actions*/
case 'user_fields_control_bulk':
require_once WPCF_INC_ABSPATH . '/fields.php';
require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields.php';
require_once WPCF_INC_ABSPATH . '/fields-control.php';
require_once WPCF_INC_ABSPATH . '/usermeta-control.php';
wpcf_admin_user_fields_control_bulk_ajax();
break;
case 'usermeta_delete':
case 'delete_usermeta':
require_once WPCF_INC_ABSPATH . '/fields.php';
if (isset($_GET['field_id'])) {
$field_id = sanitize_text_field($_GET['field_id']);
wpcf_admin_fields_delete_field($field_id, 'wp-types-user-group', 'wpcf-usermeta');
}
if (isset($_GET['field'])) {
$field = sanitize_text_field($_GET['field']);
wpcf_admin_fields_delete_field($field, 'wp-types-user-group', 'wpcf-usermeta');
}
echo json_encode(array('output' => ''));
break;
case 'remove_from_history2':
require_once WPCF_INC_ABSPATH . '/fields.php';
$fields = wpcf_admin_fields_get_fields(true, true, false, 'wpcf-usermeta');
if (isset($_GET['field_id']) && isset($fields[$_GET['field_id']])) {
$fields[$_GET['field_id']]['data']['removed_from_history'] = 1;
wpcf_admin_fields_save_fields($fields, true, 'wpcf-usermeta');
}
echo json_encode(array('output' => ''));
break;
case 'deactivate_user_group':
require_once WPCF_INC_ABSPATH . '/fields.php';
require_once WPCF_INC_ABSPATH . '/usermeta.php';
$success = wpcf_admin_fields_deactivate_group(intval($_GET['group_id']), 'wp-types-user-group');
if ($success) {
echo json_encode(array('output' => __('Group deactivated', 'wpcf'), 'execute' => 'location.reload();'));
} else {
echo json_encode(array('output' => __('Error occured', 'wpcf')));
}
break;
case 'activate_user_group':
require_once WPCF_INC_ABSPATH . '/fields.php';
require_once WPCF_INC_ABSPATH . '/usermeta.php';
$success = wpcf_admin_fields_activate_group(intval($_GET['group_id']), 'wp-types-user-group');
if ($success) {
echo json_encode(array('output' => __('Group activated', 'wpcf'), 'execute' => 'location.reload();'));
} else {
echo json_encode(array('output' => __('Error occured', 'wpcf')));
}
break;
case 'delete_usermeta_group':
require_once WPCF_INC_ABSPATH . '/fields.php';
require_once WPCF_INC_ABSPATH . '/usermeta.php';
wpcf_admin_fields_delete_group(intval($_GET['group_id']), 'wp-types-user-group');
echo json_encode(array('output' => '', 'execute' => 'location.reload();'));
break;
case 'usermeta_insert_existing':
require_once WPCF_INC_ABSPATH . '/fields.php';
require_once WPCF_INC_ABSPATH . '/fields-form.php';
require_once WPCF_INC_ABSPATH . '/usermeta-form.php';
wpcf_usermeta_insert_existing_ajax();
wpcf_form_render_js_validation();
break;
/* End Usertmeta actions*/
/* End Usertmeta actions*/
case 'fields_insert':
require_once WPCF_INC_ABSPATH . '/fields.php';
require_once WPCF_INC_ABSPATH . '/fields-form.php';
wpcf_fields_insert_ajax();
wpcf_form_render_js_validation();
break;
case 'fields_insert_existing':
require_once WPCF_INC_ABSPATH . '/fields.php';
require_once WPCF_INC_ABSPATH . '/fields-form.php';
wpcf_fields_insert_existing_ajax();
wpcf_form_render_js_validation();
break;
case 'remove_field_from_group':
require_once WPCF_INC_ABSPATH . '/fields.php';
if (isset($_GET['group_id']) && isset($_GET['field_id'])) {
wpcf_admin_fields_remove_field_from_group(intval($_GET['group_id']), sanitize_text_field($_GET['field_id']));
}
break;
case 'deactivate_group':
require_once WPCF_INC_ABSPATH . '/fields.php';
$success = wpcf_admin_fields_deactivate_group(intval($_GET['group_id']));
if ($success) {
echo json_encode(array('output' => __('Group deactivated', 'wpcf'), 'execute' => 'location.reload();'));
//.........这里部分代码省略.........
开发者ID:SpencerNeitzke,项目名称:types,代码行数:101,代码来源:ajax.php
示例3: wpcf_admin_fields_delete_field
/**
* Deletes field.
*
* @param type $field_id
*/
function wpcf_admin_fields_delete_field($field_id)
{
global $wpdb;
$fields = get_option('wpcf-fields', array());
if (isset($fields[$field_id])) {
// Remove from groups
$groups = wpcf_admin_fields_get_groups();
foreach ($groups as $key => $group) {
wpcf_admin_fields_remove_field_from_group($group['id'], $field_id);
}
// Remove from posts
if (!wpcf_types_cf_under_control('check_outsider', $field_id)) {
$results = $wpdb->get_results("SELECT post_id, meta_key FROM {$wpdb->postmeta} WHERE meta_key = '" . wpcf_types_get_meta_prefix($fields[$field_id]) . strval($field_id) . "'");
foreach ($results as $result) {
delete_post_meta($result->post_id, $result->meta_key);
}
}
unset($fields[$field_id]);
wpcf_admin_fields_save_fields($fields, true);
return true;
} else {
return false;
}
}
开发者ID:sriram911,项目名称:pls,代码行数:29,代码来源:fields.php
示例4: wpcf_admin_fields_delete_field
/**
* Deletes field.
* Modified by Gen, 13.02.2013
*
* @global object $wpdb
*
* @param type $field_id
*/
function wpcf_admin_fields_delete_field($field_id, $post_type = TYPES_CUSTOM_FIELD_GROUP_CPT_NAME, $meta_name = 'wpcf-fields')
{
global $wpdb;
$fields = get_option($meta_name, array());
if (isset($fields[$field_id])) {
// Remove from groups
$groups = wpcf_admin_fields_get_groups($post_type);
foreach ($groups as $key => $group) {
wpcf_admin_fields_remove_field_from_group($group['id'], $field_id);
}
// Remove from posts
if (!wpcf_types_cf_under_control('check_outsider', $field_id, $post_type, $meta_name)) {
$results = $wpdb->get_results($wpdb->prepare("SELECT post_id, meta_key FROM {$wpdb->postmeta} WHERE meta_key = %s", wpcf_types_get_meta_prefix($fields[$field_id]) . strval($field_id)));
foreach ($results as $result) {
delete_post_meta($result->post_id, $result->meta_key);
}
}
unset($fields[$field_id]);
wpcf_admin_fields_save_fields($fields, true, $meta_name);
return true;
} else {
return false;
}
}
开发者ID:aarongillett,项目名称:B22-151217,代码行数:32,代码来源:fields.php
示例5: wpcf_ajax
//.........这里部分代码省略.........
}
break;
case 'delete_usermeta_group':
require_once WPCF_INC_ABSPATH . '/fields.php';
require_once WPCF_INC_ABSPATH . '/usermeta.php';
$redirect = wpcf_ajax_group_delete_redirect();
wpcf_admin_fields_delete_group(intval($_GET['group_id']), TYPES_USER_META_FIELD_GROUP_CPT_NAME);
echo json_encode($redirect);
break;
case 'usermeta_insert_existing':
require_once WPCF_INC_ABSPATH . '/fields.php';
require_once WPCF_INC_ABSPATH . '/fields-form.php';
require_once WPCF_INC_ABSPATH . '/usermeta-form.php';
wpcf_usermeta_insert_existing_ajax();
wpcf_form_render_js_validation();
break;
/* End Usertmeta actions*/
/* End Usertmeta actions*/
case 'fields_insert':
require_once WPCF_INC_ABSPATH . '/fields.php';
require_once WPCF_INC_ABSPATH . '/fields-form.php';
wpcf_fields_insert_ajax();
wpcf_form_render_js_validation();
break;
case 'fields_insert_existing':
require_once WPCF_INC_ABSPATH . '/fields.php';
require_once WPCF_INC_ABSPATH . '/fields-form.php';
wpcf_fields_insert_existing_ajax();
wpcf_form_render_js_validation();
break;
case 'remove_field_from_group':
require_once WPCF_INC_ABSPATH . '/fields.php';
if (isset($_GET['group_id']) && isset($_GET['field_id'])) {
wpcf_admin_fields_remove_field_from_group(intval($_GET['group_id']), sanitize_text_field($_GET['field_id']));
}
break;
case 'deactivate_group':
require_once WPCF_INC_ABSPATH . '/fields.php';
$success = wpcf_admin_fields_deactivate_group(intval($_GET['group_id']));
if ($success) {
echo json_encode(array('output' => __('Group deactivated', 'wpcf'), 'execute' => 'reload', 'wpcf_nonce_ajax_callback' => wp_create_nonce('execute')));
} else {
wpcf_ajax_helper_print_error_and_die();
}
break;
case 'activate_group':
require_once WPCF_INC_ABSPATH . '/fields.php';
$success = wpcf_admin_fields_activate_group(intval($_GET['group_id']));
if ($success) {
echo json_encode(array('output' => __('Group activated', 'wpcf'), 'execute' => 'reload', 'wpcf_nonce_ajax_callback' => wp_create_nonce('execute')));
} else {
wpcf_ajax_helper_print_error_and_die();
}
break;
case 'delete_group':
require_once WPCF_INC_ABSPATH . '/fields.php';
$redirect = wpcf_ajax_group_delete_redirect();
wpcf_admin_fields_delete_group(intval($_GET['group_id']));
echo json_encode($redirect);
break;
case 'deactivate_term_group':
require_once WPCF_INC_ABSPATH . '/fields.php';
$success = wpcf_admin_fields_deactivate_group(intval($_GET['group_id']), Types_Field_Group_Term::POST_TYPE);
if ($success) {
echo json_encode(array('output' => __('Group deactivated', 'wpcf'), 'execute' => 'reload', 'wpcf_nonce_ajax_callback' => wp_create_nonce('execute')));
} else {
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:67,代码来源:ajax.php
示例6: wpcf_ajax
/**
* All AJAX calls go here.
*/
function wpcf_ajax()
{
if (!current_user_can('manage_options') || (!isset($_REQUEST['_wpnonce']) || !wp_verify_nonce($_REQUEST['_wpnonce'], $_REQUEST['wpcf_action']))) {
die;
}
switch ($_REQUEST['wpcf_action']) {
/* User meta actions*/
case 'user_fields_control_bulk':
require_once WPCF_INC_ABSPATH . '/fields.php';
require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields.php';
require_once WPCF_INC_ABSPATH . '/fields-control.php';
require_once WPCF_INC_ABSPATH . '/usermeta-control.php';
wpcf_admin_user_fields_control_bulk_ajax();
break;
case 'usermeta_delete':
case 'delete_usermeta':
require_once WPCF_INC_ABSPATH . '/fields.php';
if (isset($_GET['field_id'])) {
wpcf_admin_fields_delete_field($_GET['field_id'], 'wp-types-user-group', 'wpcf-usermeta');
}
if (isset($_GET['field'])) {
wpcf_admin_fields_delete_field($_GET['field'], 'wp-types-user-group', 'wpcf-usermeta');
}
echo json_encode(array('output' => ''));
break;
case 'remove_from_history2':
require_once WPCF_INC_ABSPATH . '/fields.php';
$fields = wpcf_admin_fields_get_fields(true, true, false, 'wpcf-usermeta');
if (isset($_GET['field_id']) && isset($fields[$_GET['field_id']])) {
$fields[$_GET['field_id']]['data']['removed_from_history'] = 1;
wpcf_admin_fields_save_fields($fields, true, 'wpcf-usermeta');
}
echo json_encode(array('output' => ''));
break;
case 'deactivate_user_group':
require_once WPCF_INC_ABSPATH . '/fields.php';
require_once WPCF_INC_ABSPATH . '/usermeta.php';
$success = wpcf_admin_fields_deactivate_group(intval($_GET['group_id']), 'wp-types-user-group');
if ($success) {
echo json_encode(array('output' => __('Group deactivated', 'wpcf'), 'execute' => 'jQuery("#wpcf-list-activate-' . intval($_GET['group_id']) . '").replaceWith(\'' . wpcf_admin_usermeta_get_ajax_activation_link(intval($_GET['group_id'])) . '\');jQuery(".wpcf-table-column-active-' . intval($_GET['group_id']) . '").html("' . __('No', 'wpcf') . '");', 'wpcf_nonce_ajax_callback' => wp_create_nonce('execute')));
} else {
echo json_encode(array('output' => __('Error occured', 'wpcf')));
}
break;
case 'activate_user_group':
require_once WPCF_INC_ABSPATH . '/fields.php';
require_once WPCF_INC_ABSPATH . '/usermeta.php';
$success = wpcf_admin_fields_activate_group(intval($_GET['group_id']), 'wp-types-user-group');
if ($success) {
echo json_encode(array('output' => __('Group activated', 'wpcf'), 'execute' => 'jQuery("#wpcf-list-activate-' . intval($_GET['group_id']) . '").replaceWith(\'' . wpcf_admin_usermeta_get_ajax_deactivation_link(intval($_GET['group_id'])) . '\');jQuery(".wpcf-table-column-active-' . intval($_GET['group_id']) . '").html("' . __('Yes', 'wpcf') . '");', 'wpcf_nonce_ajax_callback' => wp_create_nonce('execute')));
} else {
echo json_encode(array('output' => __('Error occured', 'wpcf')));
}
break;
case 'delete_usermeta_group':
require_once WPCF_INC_ABSPATH . '/fields.php';
require_once WPCF_INC_ABSPATH . '/usermeta.php';
wpcf_admin_fields_delete_group(intval($_GET['group_id']), 'wp-types-user-group');
echo json_encode(array('output' => '', 'execute' => 'jQuery("#wpcf-list-activate-' . intval($_GET['group_id']) . '").parents("tr").css("background-color", "#FF0000").fadeOut();', 'wpcf_nonce_ajax_callback' => wp_create_nonce('execute')));
break;
case 'usermeta_insert_existing':
require_once WPCF_INC_ABSPATH . '/fields.php';
require_once WPCF_INC_ABSPATH . '/fields-form.php';
require_once WPCF_INC_ABSPATH . '/usermeta-form.php';
wpcf_usermeta_insert_existing_ajax();
wpcf_form_render_js_validation();
break;
/* End Usertmeta actions*/
/* End Usertmeta actions*/
case 'fields_insert':
require_once WPCF_INC_ABSPATH . '/fields.php';
require_once WPCF_INC_ABSPATH . '/fields-form.php';
wpcf_fields_insert_ajax();
wpcf_form_render_js_validation();
break;
case 'fields_insert_existing':
require_once WPCF_INC_ABSPATH . '/fields.php';
require_once WPCF_INC_ABSPATH . '/fields-form.php';
wpcf_fields_insert_existing_ajax();
wpcf_form_render_js_validation();
break;
case 'remove_field_from_group':
require_once WPCF_INC_ABSPATH . '/fields.php';
if (isset($_GET['group_id']) && isset($_GET['field_id'])) {
wpcf_admin_fields_remove_field_from_group($_GET['group_id'], $_GET['field_id']);
}
break;
case 'deactivate_group':
require_once WPCF_INC_ABSPATH . '/fields.php';
$success = wpcf_admin_fields_deactivate_group(intval($_GET['group_id']));
if ($success) {
echo json_encode(array('output' => __('Group deactivated', 'wpcf'), 'execute' => 'jQuery("#wpcf-list-activate-' . intval($_GET['group_id']) . '").replaceWith(\'' . wpcf_admin_fields_get_ajax_activation_link(intval($_GET['group_id'])) . '\');jQuery(".wpcf-table-column-active-' . intval($_GET['group_id']) . '").html("' . __('No', 'wpcf') . '");', 'wpcf_nonce_ajax_callback' => wp_create_nonce('execute')));
} else {
echo json_encode(array('output' => __('Error occured', 'wpcf')));
}
break;
case 'activate_group':
//.........这里部分代码省略.........
开发者ID:CrankMaster336,项目名称:FFW-TR,代码行数:101,代码来源:ajax.php
注:本文中的wpcf_admin_fields_remove_field_from_group函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论