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


PHP RGFormsModel::delete_form方法代码示例

本文整理汇总了PHP中RGFormsModel::delete_form方法的典型用法代码示例。如果您正苦于以下问题:PHP RGFormsModel::delete_form方法的具体用法?PHP RGFormsModel::delete_form怎么用?PHP RGFormsModel::delete_form使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RGFormsModel的用法示例。


在下文中一共展示了RGFormsModel::delete_form方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 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

示例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 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

示例3: forms_page

    public static function forms_page($form_id)
    {
        global $wpdb;
        if (!GFCommon::ensure_wp_version()) {
            return;
        }
        $update_result = "";
        if (rgpost("operation") == "delete") {
            check_admin_referer('gforms_delete_form', 'gforms_delete_form');
            RGFormsModel::delete_form($form_id);
            ?>
                <script type="text/javascript">
                jQuery(document).ready(
                    function(){document.location.href="?page=gf_edit_forms";}
                );
                </script>
            <?php 
            exit;
        } else {
            if (!rgempty("gform_meta")) {
                check_admin_referer("gforms_update_form_{$form_id}", 'gforms_update_form');
                $update_result = self::save_form_info($form_id, rgpost("gform_meta", false));
            }
        }
        if (version_compare(get_bloginfo("version"), '3.3.dev1', '<')) {
            ?>
            <script type='text/javascript'>
                /* <![CDATA[
                *Needed for custom version of thickbox
                */
                var thickboxL10n = {
                    loadingAnimation: "<?php 
            echo includes_url();
            ?>
js/thickbox/loadingAnimation.gif",
                    closeImage: "<?php 
            echo includes_url();
            ?>
js/thickbox/tb-close.png"
                };
                try{convertEntities(thickboxL10n);}catch(e){};
                /* ]]> */
            </script>
            <?php 
            wp_register_script("gf_thickbox", GFCommon::get_base_url() . "/js/thickbox.js", null, GFCommon::$version);
            wp_register_style("gf_thickbox", GFCommon::get_base_url() . "/js/thickbox.css", null, GFCommon::$version);
            wp_print_scripts(array("gf_thickbox"));
            wp_print_styles(array("gf_thickbox"));
        } else {
            wp_print_scripts(array("thickbox"));
            wp_print_styles(array("thickbox"));
        }
        wp_register_script("rg_currency", GFCommon::get_base_url() . "/js/gravityforms.js", null, GFCommon::$version);
        wp_print_scripts(array("jquery-ui-core", "jquery-ui-sortable", "jquery-ui-tabs", "sack", "rg_currency"));
        ?>
        <script src="<?php 
        echo GFCommon::get_base_url();
        ?>
/js/jquery.dimensions.js?ver=<?php 
        echo GFCommon::$version;
        ?>
"></script>
        <script src="<?php 
        echo GFCommon::get_base_url();
        ?>
/js/floatmenu_init.js?ver=<?php 
        echo GFCommon::$version;
        ?>
"></script>
        <script src="<?php 
        echo GFCommon::get_base_url();
        ?>
/js/menu.js?ver=<?php 
        echo GFCommon::$version;
        ?>
"></script>
        <script src="<?php 
        echo GFCommon::get_base_url();
        ?>
/js/jquery.json-1.3.js?ver=<?php 
        echo GFCommon::$version;
        ?>
"></script>
        <script src="<?php 
        echo GFCommon::get_base_url();
        ?>
/js/jquery.simplemodal-1.3.min.js?ver=<?php 
        echo GFCommon::$version;
        ?>
"></script>
        <script src="<?php 
        echo GFCommon::get_base_url();
        ?>
/js/forms.js?ver=<?php 
        echo GFCommon::$version;
        ?>
"></script>
        <script src="<?php 
        echo GFCommon::get_base_url();
        ?>
//.........这里部分代码省略.........
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:101,代码来源:form_detail.php

示例4: 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 == "delete") {
            check_admin_referer('gforms_update_forms', 'gforms_update_forms');
            $form_id = RGForms::post("action_argument");
            RGFormsModel::delete_form($form_id);
        } else {
            if ($action == "duplicate") {
                check_admin_referer('gforms_update_forms', 'gforms_update_forms');
                $form_id = RGForms::post("action_argument");
                RGFormsModel::duplicate_form($form_id);
            } else {
                if ($bulk_action == "delete") {
                    check_admin_referer('gforms_update_forms', 'gforms_update_forms');
                    $form_ids = RGForms::post("form");
                    RGFormsModel::delete_forms($form_ids);
                } else {
                    if ($bulk_action == "reset_views") {
                        check_admin_referer('gforms_update_forms', 'gforms_update_forms');
                        $form_ids = RGForms::post("form");
                        foreach ($form_ids as $form_id) {
                            RGFormsModel::delete_views($form_id);
                        }
                    } else {
                        if ($bulk_action == "delete_entries") {
                            check_admin_referer('gforms_update_forms', 'gforms_update_forms');
                            $form_ids = RGForms::post("form");
                            foreach ($form_ids as $form_id) {
                                RGFormsModel::delete_leads_by_form($form_id);
                            }
                        }
                    }
                }
            }
        }
        $active = RGForms::get("active") == "" ? null : RGForms::get("active");
        $forms = RGFormsModel::get_forms($active, "title");
        $form_count = RGFormsModel::get_form_count();
        ?>
        <script>
            function DeleteForm(form_id){
                jQuery("#action_argument").val(form_id);
                jQuery("#action").val("delete");
                jQuery("#forms_form")[0].submit();
            }

            function DuplicateForm(form_id){
                jQuery("#action_argument").val(form_id);
                jQuery("#action").val("duplicate");
                jQuery("#forms_form")[0].submit();
            }

            function ToggleActive(img, form_id){
                var is_active = img.src.indexOf("active1.png") >=0
                if(is_active){
                    img.src = img.src.replace("active1.png", "active0.png");
                    jQuery(img).attr('title','<?php 
        _e("Inactive", "gravityforms");
        ?>
').attr('alt', '<?php 
        _e("Inactive", "gravityforms");
        ?>
');
                }
                else{
                    img.src = img.src.replace("active0.png", "active1.png");
                    jQuery(img).attr('title','<?php 
        _e("Active", "gravityforms");
        ?>
').attr('alt', '<?php 
        _e("Active", "gravityforms");
        ?>
');
                }

                UpdateCount("active_count", is_active ? -1 : 1);
                UpdateCount("inactive_count", is_active ? 1 : -1);

                var mysack = new sack("<?php 
        echo admin_url("admin-ajax.php");
        ?>
" );
                mysack.execute = 1;
                mysack.method = 'POST';
                mysack.setVar( "action", "rg_update_form_active" );
                mysack.setVar( "rg_update_form_active", "<?php 
        echo wp_create_nonce("rg_update_form_active");
        ?>
" );
                mysack.setVar( "form_id", form_id);
                mysack.setVar( "is_active", is_active ? 0 : 1);
                mysack.encVar( "cookie", document.cookie, false );
//.........这里部分代码省略.........
开发者ID:hypenotic,项目名称:slowfood,代码行数:101,代码来源:form_list.php

示例5: 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

示例6: forms_page

    public static function forms_page($form_id)
    {
        global $wpdb;
        if (!GFCommon::ensure_wp_version()) {
            return;
        }
        if ($_POST["operation"] == "delete") {
            check_admin_referer('gforms_delete_form', 'gforms_delete_form');
            RGFormsModel::delete_form($form_id);
            ?>
                <script>
                jQuery(document).ready(
                    function(){document.location.href="?page=gf_edit_forms";}
                );
                </script>
            <?php 
            exit;
        }
        wp_print_scripts(array("jquery-ui-core", "jquery-ui-sortable", "jquery-ui-tabs", "sack", "thickbox"));
        wp_print_styles(array("thickbox"));
        ?>
        <script src="<?php 
        echo GFCommon::get_base_url();
        ?>
/js/jquery.dimensions.js"></script>
        <script src="<?php 
        echo GFCommon::get_base_url();
        ?>
/js/floatmenu_init.js"></script>
        <script src="<?php 
        echo GFCommon::get_base_url();
        ?>
/js/menu.js"></script>
        <script src="<?php 
        echo GFCommon::get_base_url();
        ?>
/js/jquery.json-1.3.js"></script>
        <script src="<?php 
        echo GFCommon::get_base_url();
        ?>
/js/jquery.simplemodal-1.3.min.js"></script>
        <script src="<?php 
        echo GFCommon::get_base_url();
        ?>
/js/forms.js"></script>
        <script src="<?php 
        echo GFCommon::get_base_url();
        ?>
/js/jquery-ui/ui.datepicker.js"></script>

        <link rel="stylesheet" href="<?php 
        echo GFCommon::get_base_url();
        ?>
/css/jquery-ui-1.7.2.custom.css" type="text/css" />
        <link rel="stylesheet" href="<?php 
        echo GFCommon::get_base_url();
        ?>
/css/admin.css" type="text/css" />
        <script>
            jQuery(document).ready(
                function() {
                    jQuery('.datepicker').datepicker({showOn: "both", buttonImage: "<?php 
        echo GFCommon::get_base_url();
        ?>
/images/calendar.png", buttonImageOnly: true});
                }
            );

            function has_entry(fieldNumber){
                var submitted_fields = new Array(<?php 
        echo RGFormsModel::get_submitted_fields($form_id);
        ?>
);
                for(var i=0; i<submitted_fields.length; i++){
                    if(submitted_fields[i] == fieldNumber)
                        return true;
                }
                return false;
            }

            function InsertVariable(element_id){
                var variable = jQuery('#' + element_id + '_variable_select').val();
                var messageElement = jQuery("#" + element_id);

                if(document.selection) {
                    // Go the IE way
                    messageElement[0].focus();
                    document.selection.createRange().text=variable;
                }
                else if(messageElement[0].selectionStart) {
                    // Go the Gecko way
                    obj = messageElement[0]
                    obj.value = obj.value.substr(0, obj.selectionStart) + variable + obj.value.substr(obj.selectionEnd, obj.value.length);
                }
                else {
                    messageElement.val(variable + messageElement.val());
                }

                jQuery('#' + element_id + '_variable_select')[0].selectedIndex = 0;
            }
//.........这里部分代码省略.........
开发者ID:812studio,项目名称:812studio,代码行数:101,代码来源:form_detail.php


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