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


PHP RGFormsModel::trash_form方法代码示例

本文整理汇总了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';
        }
//.........这里部分代码省略.........
开发者ID:nhainam,项目名称:wordpress4,代码行数:101,代码来源:form_list.php

示例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);
//.........这里部分代码省略.........
开发者ID:macconsultinggroup,项目名称:WordPress,代码行数:101,代码来源:form_list.php

示例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)) {
//.........这里部分代码省略.........
开发者ID:fjbeteiligung,项目名称:development,代码行数:101,代码来源:form_list.php


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