本文整理汇总了PHP中RGFormsModel::trash_form方法的典型用法代码示例。如果您正苦于以下问题:PHP RGFormsModel::trash_form方法的具体用法?PHP RGFormsModel::trash_form怎么用?PHP RGFormsModel::trash_form使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RGFormsModel
的用法示例。
在下文中一共展示了RGFormsModel::trash_form方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: form_list_page
public static function form_list_page()
{
global $wpdb;
if (!GFCommon::ensure_wp_version()) {
return;
}
echo GFCommon::get_remote_message();
$action = RGForms::post('action');
$bulk_action = RGForms::post('bulk_action');
$bulk_action = !empty($bulk_action) ? $bulk_action : RGForms::post('bulk_action2');
if ($action == 'trash') {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_id = RGForms::post('action_argument');
RGFormsModel::trash_form($form_id);
$message = __('Form moved to the trash.', 'gravityforms');
} else {
if ($action == 'restore') {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_id = RGForms::post('action_argument');
RGFormsModel::restore_form($form_id);
$message = __('Form restored.', 'gravityforms');
} else {
if ($action == 'delete') {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_id = RGForms::post('action_argument');
if (GFCommon::current_user_can_any('gravityforms_delete_forms')) {
RGFormsModel::delete_form($form_id);
$message = __('Form deleted.', 'gravityforms');
} else {
$message = __("You don't have adequate permission to delete forms.", 'gravityforms');
}
} else {
if ($action == 'duplicate') {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_id = RGForms::post('action_argument');
RGFormsModel::duplicate_form($form_id);
$message = __('Form duplicated.', 'gravityforms');
}
}
}
}
if ($bulk_action) {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_ids = is_array(rgpost('form')) ? rgpost('form') : array();
$form_count = count($form_ids);
switch ($bulk_action) {
case 'trash':
GFFormsModel::trash_forms($form_ids);
$message = _n('%s form moved to the trash.', '%s forms moved to the trash.', $form_count, 'gravityforms');
break;
case 'restore':
GFFormsModel::restore_forms($form_ids);
$message = _n('%s form restored.', '%s forms restored.', $form_count, 'gravityforms');
break;
case 'delete':
if (GFCommon::current_user_can_any('gravityforms_delete_forms')) {
GFFormsModel::delete_forms($form_ids);
$message = _n('%s form deleted.', '%s forms deleted.', $form_count, 'gravityforms');
} else {
$message = __("You don't have adequate permissions to delete forms.", 'gravityforms');
}
break;
case 'reset_views':
foreach ($form_ids as $form_id) {
GFFormsModel::delete_views($form_id);
}
$message = _n('Views for %s form have been reset.', 'Views for %s forms have been reset.', $form_count, 'gravityforms');
break;
case 'delete_entries':
if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
foreach ($form_ids as $form_id) {
GFFormsModel::delete_leads_by_form($form_id);
}
$message = _n('Entries for %s form have been deleted.', 'Entries for %s forms have been deleted.', $form_count, 'gravityforms');
} else {
$message = __("You don't have adequate permission to delete entries.", 'gravityforms');
}
break;
case 'activate':
foreach ($form_ids as $form_id) {
GFFormsModel::update_form_active($form_id, 1);
}
$message = _n('%s form has been marked as active.', '%s forms have been marked as active.', $form_count, 'gravityforms');
break;
case 'deactivate':
foreach ($form_ids as $form_id) {
GFFormsModel::update_form_active($form_id, 0);
}
$message = _n('%s form has been marked as inactive.', '%s forms have been marked as inactive.', $form_count, 'gravityforms');
break;
}
if (isset($message)) {
$message = sprintf($message, $form_count);
}
}
$sort_column = empty($_GET['sort']) ? 'title' : $_GET['sort'];
$db_columns = GFFormsModel::get_form_db_columns();
if (!in_array(strtolower($sort_column), $db_columns)) {
$sort_column = 'title';
}
//.........这里部分代码省略.........
示例2: form_list_page
public static function form_list_page()
{
global $wpdb;
if (!GFCommon::ensure_wp_version()) {
return;
}
echo GFCommon::get_remote_message();
$action = RGForms::post("action");
$bulk_action = RGForms::post("bulk_action");
$bulk_action = !empty($bulk_action) ? $bulk_action : RGForms::post("bulk_action2");
if ($action == "trash") {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_id = RGForms::post("action_argument");
RGFormsModel::trash_form($form_id);
$message = __('Form moved to the trash.', 'gravityforms');
} else {
if ($action == "restore") {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_id = RGForms::post("action_argument");
RGFormsModel::restore_form($form_id);
$message = __('Form restored.', 'gravityforms');
} else {
if ($action == "delete") {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_id = RGForms::post("action_argument");
if (GFCommon::current_user_can_any("gravityforms_delete_forms")) {
RGFormsModel::delete_form($form_id);
$message = __('Form deleted.', 'gravityforms');
} else {
$message = __("You don't have adequate permissions to delete forms.", 'gravityforms');
}
} else {
if ($action == "duplicate") {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_id = RGForms::post("action_argument");
RGFormsModel::duplicate_form($form_id);
$message = __('Form duplicated.', 'gravityforms');
}
}
}
}
if ($bulk_action) {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_ids = is_array(rgpost('form')) ? rgpost('form') : array();
$form_count = count($form_ids);
switch ($bulk_action) {
case 'trash':
GFFormsModel::trash_forms($form_ids);
$message = _n('%s form moved to the trash.', '%s forms moved to the trash.', $form_count, 'gravityforms');
break;
case 'restore':
GFFormsModel::restore_forms($form_ids);
$message = _n('%s form restored.', '%s forms restored.', $form_count, 'gravityforms');
break;
case 'delete':
if (GFCommon::current_user_can_any("gravityforms_delete_forms")) {
GFFormsModel::delete_forms($form_ids);
$message = _n('%s form deleted.', '%s forms deleted.', $form_count, 'gravityforms');
} else {
$message = __("You don't have adequate permissions to delete forms.", 'gravityforms');
}
break;
case 'reset_views':
foreach ($form_ids as $form_id) {
GFFormsModel::delete_views($form_id);
}
$message = _n('Views for %s form have been reset.', 'Views for %s forms have been reset.', $form_count, 'gravityforms');
break;
case 'delete_entries':
if (GFCommon::current_user_can_any("gravityforms_delete_entries")) {
foreach ($form_ids as $form_id) {
GFFormsModel::delete_leads_by_form($form_id);
}
$message = _n('Entries for %s form have been deleted.', 'Entries for %s forms have been deleted.', $form_count, 'gravityforms');
} else {
$message = __("You don't have adequate permissions to delete entries.", "gravityforms");
}
break;
case 'activate':
foreach ($form_ids as $form_id) {
GFFormsModel::update_form_active($form_id, 1);
}
$message = _n('%s form has been marked as active.', '%s forms have been marked as active.', $form_count, 'gravityforms');
break;
case 'deactivate':
foreach ($form_ids as $form_id) {
GFFormsModel::update_form_active($form_id, 0);
}
$message = _n('%s form has been marked as inactive.', '%s forms have been marked as inactive.', $form_count, 'gravityforms');
break;
}
if (isset($message)) {
$message = sprintf($message, $form_count);
}
}
$sort_column = empty($_GET["sort"]) ? "title" : $_GET["sort"];
$sort_direction = empty($_GET["dir"]) ? "ASC" : $_GET["dir"];
$active = RGForms::get("active") == "" ? null : RGForms::get("active");
$trash = RGForms::get("trash") == "" ? false : RGForms::get("trash");
$trash = esc_attr($trash);
//.........这里部分代码省略.........
示例3: process_action
function process_action()
{
$single_action = rgpost('single_action');
$remote_action = rgget('action');
//action initiated at other pages (i.e. trash command from form menu)
$bulk_action = $this->current_action();
if (!($single_action || $bulk_action || $remote_action)) {
return;
}
if ($single_action) {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_id = rgpost('single_action_argument');
switch ($single_action) {
case 'trash':
RGFormsModel::trash_form($form_id);
$message = __('Form moved to the trash.', 'gravityforms');
break;
case 'restore':
RGFormsModel::restore_form($form_id);
$message = __('Form restored.', 'gravityforms');
break;
case 'delete':
if (GFCommon::current_user_can_any('gravityforms_delete_forms')) {
RGFormsModel::delete_form($form_id);
$message = __('Form deleted.', 'gravityforms');
} else {
$message = __("You don't have adequate permission to delete forms.", 'gravityforms');
}
break;
case 'duplicate':
RGFormsModel::duplicate_form($form_id);
$message = __('Form duplicated.', 'gravityforms');
break;
}
} elseif ($remote_action) {
$form_id = rgget('arg');
switch ($remote_action) {
case 'trash':
check_admin_referer("gf_delete_form_{$form_id}");
RGFormsModel::trash_form($form_id);
$message = __('Form moved to the trash.', 'gravityforms');
break;
case 'duplicate':
check_ajax_referer("gf_duplicate_form_{$form_id}");
RGFormsModel::duplicate_form($form_id);
$message = __('Form duplicated.', 'gravityforms');
break;
}
} elseif ($bulk_action) {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_ids = is_array(rgpost('form')) ? rgpost('form') : array();
$form_count = count($form_ids);
$message = '';
switch ($bulk_action) {
case 'trash':
GFFormsModel::trash_forms($form_ids);
$message = _n('%s form moved to the trash.', '%s forms moved to the trash.', $form_count, 'gravityforms');
break;
case 'restore':
GFFormsModel::restore_forms($form_ids);
$message = _n('%s form restored.', '%s forms restored.', $form_count, 'gravityforms');
break;
case 'delete':
if (GFCommon::current_user_can_any('gravityforms_delete_forms')) {
GFFormsModel::delete_forms($form_ids);
$message = _n('%s form deleted.', '%s forms deleted.', $form_count, 'gravityforms');
} else {
$message = __("You don't have adequate permissions to delete forms.", 'gravityforms');
}
break;
case 'reset_views':
foreach ($form_ids as $form_id) {
GFFormsModel::delete_views($form_id);
}
$message = _n('Views for %s form have been reset.', 'Views for %s forms have been reset.', $form_count, 'gravityforms');
break;
case 'delete_entries':
if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
foreach ($form_ids as $form_id) {
GFFormsModel::delete_leads_by_form($form_id);
}
$message = _n('Entries for %s form have been deleted.', 'Entries for %s forms have been deleted.', $form_count, 'gravityforms');
} else {
$message = __("You don't have adequate permission to delete entries.", 'gravityforms');
}
break;
case 'activate':
foreach ($form_ids as $form_id) {
GFFormsModel::update_form_active($form_id, 1);
}
$message = _n('%s form has been marked as active.', '%s forms have been marked as active.', $form_count, 'gravityforms');
break;
case 'deactivate':
foreach ($form_ids as $form_id) {
GFFormsModel::update_form_active($form_id, 0);
}
$message = _n('%s form has been marked as inactive.', '%s forms have been marked as inactive.', $form_count, 'gravityforms');
break;
}
if (!empty($message)) {
//.........这里部分代码省略.........