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


PHP GFCommon::json_decode方法代码示例

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


在下文中一共展示了GFCommon::json_decode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: leads_page


//.........这里部分代码省略.........
                        break;
                    case 'restore':
                        RGFormsModel::update_leads_property($leads, 'status', 'active');
                        $update_message = sprintf(esc_html__('%s restored from the Trash.', 'gravityforms'), $entry_count);
                        break;
                    case 'unspam':
                        RGFormsModel::update_leads_property($leads, 'status', 'active');
                        $update_message = sprintf(esc_html__('%s restored from the spam.', 'gravityforms'), $entry_count);
                        break;
                    case 'spam':
                        RGFormsModel::update_leads_property($leads, 'status', 'spam');
                        $update_message = sprintf(esc_html__('%s marked as spam.', 'gravityforms'), $entry_count);
                        break;
                    case 'mark_read':
                        RGFormsModel::update_leads_property($leads, 'is_read', 1);
                        $update_message = sprintf(esc_html__('%s marked as read.', 'gravityforms'), $entry_count);
                        break;
                    case 'mark_unread':
                        RGFormsModel::update_leads_property($leads, 'is_read', 0);
                        $update_message = sprintf(esc_html__('%s marked as unread.', 'gravityforms'), $entry_count);
                        break;
                    case 'add_star':
                        RGFormsModel::update_leads_property($leads, 'is_starred', 1);
                        $update_message = sprintf(esc_html__('%s starred.', 'gravityforms'), $entry_count);
                        break;
                    case 'remove_star':
                        RGFormsModel::update_leads_property($leads, 'is_starred', 0);
                        $update_message = sprintf(esc_html__('%s unstarred.', 'gravityforms'), $entry_count);
                        break;
                }
                break;
            case 'change_columns':
                check_admin_referer('gforms_entry_list', 'gforms_entry_list');
                $columns = GFCommon::json_decode(stripslashes($_POST['grid_columns']), true);
                RGFormsModel::update_grid_column_meta($form_id, $columns);
                break;
        }
        if (rgpost('button_delete_permanently')) {
            if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
                RGFormsModel::delete_leads_by_form($form_id, $filter);
            }
        }
        $sort_field = empty($_GET['sort']) ? 0 : $_GET['sort'];
        $sort_direction = empty($_GET['dir']) ? 'DESC' : $_GET['dir'];
        $sort_field_meta = RGFormsModel::get_field($form, $sort_field);
        $is_numeric = $sort_field_meta['type'] == 'number';
        $page_size = gf_apply_filters('gform_entry_page_size', $form_id, 20, $form_id);
        $first_item_index = $page_index * $page_size;
        if (!empty($sort_field)) {
            $sorting = array('key' => $_GET['sort'], 'direction' => $sort_direction, 'is_numeric' => $is_numeric);
        } else {
            $sorting = array();
        }
        $paging = array('offset' => $first_item_index, 'page_size' => $page_size);
        $total_count = 0;
        $leads = GFAPI::get_entries($form_id, $search_criteria, $sorting, $paging, $total_count);
        $summary = RGFormsModel::get_form_counts($form_id);
        $active_lead_count = $summary['total'];
        $unread_count = $summary['unread'];
        $starred_count = $summary['starred'];
        $spam_count = $summary['spam'];
        $trash_count = $summary['trash'];
        $columns = RGFormsModel::get_grid_columns($form_id, true);
        $search_qs = empty($search) ? '' : '&s=' . esc_attr(urlencode($search));
        $sort_qs = empty($sort_field) ? '' : '&sort=' . esc_attr($sort_field);
        $dir_qs = empty($sort_direction) ? '' : '&dir=' . esc_attr($sort_direction);
开发者ID:kidaak,项目名称:gravityforms,代码行数:67,代码来源:entry_list.php

示例2: process_form

 public static function process_form($form_id)
 {
     GFCommon::log_debug("GFFormDisplay::process_form(): Starting to process form (#{$form_id}) submission.");
     $form = GFAPI::get_form($form_id);
     /**
      * Filter the form before GF begins to process the submission.
      *
      * @param array $form The Form Object
      */
     $filtered_form = gf_apply_filters(array('gform_pre_process', $form['id']), $form);
     if ($filtered_form !== null) {
         $form = $filtered_form;
     }
     //reading form metadata
     $form = self::maybe_add_review_page($form);
     if (!$form['is_active'] || $form['is_trash']) {
         return;
     }
     if (rgar($form, 'requireLogin')) {
         if (!is_user_logged_in()) {
             return;
         }
         check_admin_referer('gform_submit_' . $form_id, '_gform_submit_nonce_' . $form_id);
     }
     $lead = array();
     $field_values = RGForms::post('gform_field_values');
     $confirmation_message = '';
     $source_page_number = self::get_source_page($form_id);
     $page_number = $source_page_number;
     $target_page = self::get_target_page($form, $page_number, $field_values);
     GFCommon::log_debug("GFFormDisplay::process_form(): Source page number: {$source_page_number}. Target page number: {$target_page}.");
     //Loading files that have been uploaded to temp folder
     $files = GFCommon::json_decode(stripslashes(RGForms::post('gform_uploaded_files')));
     if (!is_array($files)) {
         $files = array();
     }
     RGFormsModel::$uploaded_files[$form_id] = $files;
     $saving_for_later = rgpost('gform_save') ? true : false;
     $is_valid = true;
     $failed_validation_page = $page_number;
     //don't validate when going to previous page or saving for later
     if (!$saving_for_later && (empty($target_page) || $target_page >= $page_number)) {
         $is_valid = self::validate($form, $field_values, $page_number, $failed_validation_page);
     }
     $log_is_valid = $is_valid ? 'Yes' : 'No';
     GFCommon::log_debug("GFFormDisplay::process_form(): After validation. Is submission valid? {$log_is_valid}.");
     //Upload files to temp folder when saving for later, going to the next page or when submitting the form and it failed validation
     if ($saving_for_later || $target_page >= $page_number || $target_page == 0 && !$is_valid) {
         if (!empty($_FILES)) {
             GFCommon::log_debug('GFFormDisplay::process_form(): Uploading files...');
             //Uploading files to temporary folder
             $files = self::upload_files($form, $files);
             RGFormsModel::$uploaded_files[$form_id] = $files;
         }
     }
     // Load target page if it did not fail validation or if going to the previous page
     if (!$saving_for_later && $is_valid) {
         $page_number = $target_page;
     } else {
         $page_number = $failed_validation_page;
     }
     $confirmation = '';
     if ($is_valid && $page_number == 0 || $saving_for_later) {
         $ajax = isset($_POST['gform_ajax']);
         //adds honeypot field if configured
         if (rgar($form, 'enableHoneypot')) {
             $form['fields'][] = self::get_honeypot_field($form);
         }
         $failed_honeypot = rgar($form, 'enableHoneypot') && !self::validate_honeypot($form);
         if ($failed_honeypot) {
             GFCommon::log_debug('GFFormDisplay::process_form(): Failed Honeypot validation. Displaying confirmation and aborting.');
             //display confirmation but doesn't process the form when honeypot fails
             $confirmation = self::handle_confirmation($form, $lead, $ajax);
             $is_valid = false;
         } elseif (!$saving_for_later) {
             GFCommon::log_debug('GFFormDisplay::process_form(): Submission is valid. Moving forward.');
             $form = self::update_confirmation($form);
             //pre submission action
             /**
              * Fires before form submission is handled
              *
              * Typically used to modify values before the submission is processed.
              *
              * @param array $form The Form object
              */
             gf_do_action(array('gform_pre_submission', $form['id']), $form);
             //pre submission filter
             $form = gf_apply_filters(array('gform_pre_submission_filter', $form_id), $form);
             //handle submission
             $confirmation = self::handle_submission($form, $lead, $ajax);
             //after submission hook
             if (has_filter('gform_after_submission') || has_filter("gform_after_submission_{$form['id']}")) {
                 GFCommon::log_debug(__METHOD__ . '(): Executing functions hooked to gform_after_submission.');
             }
             /**
              * Fires after successful form submission
              *
              * Used to perform additional actions after submission
              *
              * @param array $lead The Entry object
//.........这里部分代码省略.........
开发者ID:timk85,项目名称:DIT,代码行数:101,代码来源:form_display.php

示例3: lead_detail_page

    public static function lead_detail_page()
    {
        global $wpdb;
        global $current_user;
        if (!GFCommon::ensure_wp_version()) {
            return;
        }
        echo GFCommon::get_remote_message();
        $form = RGFormsModel::get_form_meta($_GET["id"]);
        $form_id = $form["id"];
        $form = apply_filters("gform_admin_pre_render_" . $form["id"], apply_filters("gform_admin_pre_render", $form));
        $lead_id = rgget('lid');
        $filter = rgget("filter");
        $status = in_array($filter, array("trash", "spam")) ? $filter : "active";
        $position = rgget('pos') ? rgget('pos') : 0;
        $sort_direction = rgget('dir') ? rgget('dir') : 'DESC';
        $sort_field = empty($_GET["sort"]) ? 0 : $_GET["sort"];
        $sort_field_meta = RGFormsModel::get_field($form, $sort_field);
        $is_numeric = $sort_field_meta["type"] == "number";
        $star = $filter == "star" ? 1 : null;
        $read = $filter == "unread" ? 0 : null;
        $search_criteria["status"] = $status;
        if ($star) {
            $search_criteria["field_filters"][] = array("key" => "is_starred", "value" => (bool) $star);
        }
        if (!is_null($read)) {
            $search_criteria["field_filters"][] = array("key" => "is_read", "value" => (bool) $read);
        }
        $search_field_id = rgget("field_id");
        if (isset($_GET["field_id"]) && $_GET["field_id"] !== '') {
            $key = $search_field_id;
            $val = rgget("s");
            $strpos_row_key = strpos($search_field_id, "|");
            if ($strpos_row_key !== false) {
                //multi-row likert
                $key_array = explode("|", $search_field_id);
                $key = $key_array[0];
                $val = $key_array[1] . ":" . $val;
            }
            $type = rgget("type");
            if (empty($type)) {
                $type = rgget("field_id") == "0" ? "global" : "field";
            }
            $search_criteria["field_filters"][] = array("key" => $key, "type" => $type, "operator" => rgempty("operator", $_GET) ? "is" : rgget("operator"), "value" => $val);
        }
        $paging = array('offset' => $position, 'page_size' => 1);
        if (!empty($sort_field)) {
            $sorting = array('key' => $_GET["sort"], 'direction' => $sort_direction, 'is_numeric' => $is_numeric);
        } else {
            $sorting = array();
        }
        $total_count = 0;
        $leads = GFAPI::get_entries($form['id'], $search_criteria, $sorting, $paging, $total_count);
        $prev_pos = !rgblank($position) && $position > 0 ? $position - 1 : false;
        $next_pos = !rgblank($position) && $position < $total_count - 1 ? $position + 1 : false;
        // unread filter requires special handling for pagination since entries are filter out of the query as they are read
        if ($filter == 'unread') {
            $next_pos = $position;
            if ($next_pos + 1 == $total_count) {
                $next_pos = false;
            }
        }
        if (!$lead_id) {
            $lead = !empty($leads) ? $leads[0] : false;
        } else {
            $lead = GFAPI::get_entry($lead_id);
        }
        if (!$lead) {
            _e("Oops! We couldn't find your entry. Please try again", "gravityforms");
            return;
        }
        RGFormsModel::update_lead_property($lead["id"], "is_read", 1);
        switch (RGForms::post("action")) {
            case "update":
                check_admin_referer('gforms_save_entry', 'gforms_save_entry');
                //Loading files that have been uploaded to temp folder
                $files = GFCommon::json_decode(stripslashes(RGForms::post("gform_uploaded_files")));
                if (!is_array($files)) {
                    $files = array();
                }
                GFFormsModel::$uploaded_files[$form_id] = $files;
                GFFormsModel::save_lead($form, $lead);
                do_action("gform_after_update_entry", $form, $lead["id"]);
                do_action("gform_after_update_entry_{$form["id"]}", $form, $lead["id"]);
                $lead = RGFormsModel::get_lead($lead["id"]);
                $lead = GFFormsModel::set_entry_meta($lead, $form);
                break;
            case "add_note":
                check_admin_referer('gforms_update_note', 'gforms_update_note');
                $user_data = get_userdata($current_user->ID);
                RGFormsModel::add_note($lead["id"], $current_user->ID, $user_data->display_name, stripslashes($_POST["new_note"]));
                //emailing notes if configured
                if (rgpost("gentry_email_notes_to")) {
                    $email_to = $_POST["gentry_email_notes_to"];
                    $email_from = $current_user->user_email;
                    $email_subject = stripslashes($_POST["gentry_email_subject"]);
                    $headers = "From: \"{$email_from}\" <{$email_from}> \r\n";
                    $result = wp_mail($email_to, $email_subject, stripslashes($_POST["new_note"]), $headers);
                }
                break;
//.........这里部分代码省略.........
开发者ID:JSpier,项目名称:smacamp,代码行数:101,代码来源:entry_detail.php

示例4: save_buddypress_meta

 public static function save_buddypress_meta($config)
 {
     $json = stripslashes(RGForms::post("gf_buddypress_config"));
     $data = GFCommon::json_decode($json);
     $clean_data = array();
     foreach ($data as $item) {
         // possible user may want to "overwrite" meta with blank value so only check for name to ensure valid meta
         if (empty($item['meta_name'])) {
             continue;
         }
         $clean_data[] = $item;
     }
     $config["meta"]["buddypress_meta"] = $clean_data;
     return $config;
 }
开发者ID:Inteleck,项目名称:hwc,代码行数:15,代码来源:userregistration.php

示例5: leads_page

    public static function leads_page($form_id)
    {
        global $wpdb;
        //quit if version of wp is not supported
        if (!GFCommon::ensure_wp_version()) {
            return;
        }
        echo GFCommon::get_remote_message();
        $action = RGForms::post("action");
        $filter = rgget("filter");
        $search = rgget("s");
        $page_index = empty($_GET["paged"]) ? 0 : intval($_GET["paged"]) - 1;
        $star = $filter == "star" ? 1 : null;
        // is_numeric(RGForms::get("star")) ? intval(RGForms::get("star")) : null;
        $read = $filter == "unread" ? 0 : null;
        //is_numeric(RGForms::get("read")) ? intval(RGForms::get("read")) : null;
        $status = in_array($filter, array("trash", "spam")) ? $filter : "active";
        $update_message = "";
        switch ($action) {
            case "delete":
                check_admin_referer('gforms_entry_list', 'gforms_entry_list');
                $lead_id = $_POST["action_argument"];
                RGFormsModel::delete_lead($lead_id);
                $update_message = __("Entry deleted.", "gravityforms");
                break;
            case "bulk":
                check_admin_referer('gforms_entry_list', 'gforms_entry_list');
                $bulk_action = !empty($_POST["bulk_action"]) ? $_POST["bulk_action"] : $_POST["bulk_action2"];
                $select_all = rgpost("all_entries");
                $leads = empty($select_all) ? $_POST["lead"] : GFFormsModel::get_lead_ids($form_id, $search, $star, $read, null, null, $status);
                $entry_count = count($leads) > 1 ? sprintf(__("%d entries", "gravityforms"), count($leads)) : __("1 entry", "gravityforms");
                switch ($bulk_action) {
                    case "delete":
                        RGFormsModel::delete_leads($leads);
                        $update_message = sprintf(__("%s deleted.", "gravityforms"), $entry_count);
                        break;
                    case "trash":
                        RGFormsModel::update_leads_property($leads, "status", "trash");
                        $update_message = sprintf(__("%s moved to Trash.", "gravityforms"), $entry_count);
                        break;
                    case "restore":
                        RGFormsModel::update_leads_property($leads, "status", "active");
                        $update_message = sprintf(__("%s restored from the Trash.", "gravityforms"), $entry_count);
                        break;
                    case "unspam":
                        RGFormsModel::update_leads_property($leads, "status", "active");
                        $update_message = sprintf(__("%s restored from the spam.", "gravityforms"), $entry_count);
                        break;
                    case "spam":
                        RGFormsModel::update_leads_property($leads, "status", "spam");
                        $update_message = sprintf(__("%s marked as spam.", "gravityforms"), $entry_count);
                        break;
                    case "mark_read":
                        RGFormsModel::update_leads_property($leads, "is_read", 1);
                        $update_message = sprintf(__("%s marked as read.", "gravityforms"), $entry_count);
                        break;
                    case "mark_unread":
                        RGFormsModel::update_leads_property($leads, "is_read", 0);
                        $update_message = sprintf(__("%s marked as unread.", "gravityforms"), $entry_count);
                        break;
                    case "add_star":
                        RGFormsModel::update_leads_property($leads, "is_starred", 1);
                        $update_message = sprintf(__("%s starred.", "gravityforms"), $entry_count);
                        break;
                    case "remove_star":
                        RGFormsModel::update_leads_property($leads, "is_starred", 0);
                        $update_message = sprintf(__("%s unstarred.", "gravityforms"), $entry_count);
                        break;
                }
                break;
            case "change_columns":
                check_admin_referer('gforms_entry_list', 'gforms_entry_list');
                $columns = GFCommon::json_decode(stripslashes($_POST["grid_columns"]), true);
                RGFormsModel::update_grid_column_meta($form_id, $columns);
                break;
        }
        if (rgpost("button_delete_permanently")) {
            RGFormsModel::delete_leads_by_form($form_id, $filter);
        }
        $sort_field = empty($_GET["sort"]) ? 0 : $_GET["sort"];
        $sort_direction = empty($_GET["dir"]) ? "DESC" : $_GET["dir"];
        $form = RGFormsModel::get_form_meta($form_id);
        $sort_field_meta = RGFormsModel::get_field($form, $sort_field);
        $is_numeric = $sort_field_meta["type"] == "number";
        $page_size = apply_filters("gform_entry_page_size", apply_filters("gform_entry_page_size_{$form_id}", 20, $form_id), $form_id);
        $first_item_index = $page_index * $page_size;
        $leads = RGFormsModel::get_leads($form_id, $sort_field, $sort_direction, $search, $first_item_index, $page_size, $star, $read, $is_numeric, null, null, $status);
        $lead_count = RGFormsModel::get_lead_count($form_id, $search, $star, $read, null, null, $status);
        $summary = RGFormsModel::get_form_counts($form_id);
        $active_lead_count = $summary["total"];
        $unread_count = $summary["unread"];
        $starred_count = $summary["starred"];
        $spam_count = $summary["spam"];
        $trash_count = $summary["trash"];
        $columns = RGFormsModel::get_grid_columns($form_id, true);
        $search_qs = empty($search) ? "" : "&s=" . urlencode($search);
        $sort_qs = empty($sort_field) ? "" : "&sort={$sort_field}";
        $dir_qs = empty($sort_field) ? "" : "&dir={$sort_direction}";
        $star_qs = $star !== null ? "&star={$star}" : "";
        $read_qs = $read !== null ? "&read={$read}" : "";
//.........这里部分代码省略.........
开发者ID:nikibrown,项目名称:2014-Nerd-presentation,代码行数:101,代码来源:entry_list.php

示例6: process_save_process_files

 /**
  * Have GF handle file uploads
  *
  * Copy of code from GFFormDisplay::process_form()
  *
  * @param int $form_id
  */
 function process_save_process_files($form_id)
 {
     //Loading files that have been uploaded to temp folder
     $files = GFCommon::json_decode(stripslashes(RGForms::post('gform_uploaded_files')));
     if (!is_array($files)) {
         $files = array();
     }
     RGFormsModel::$uploaded_files[$form_id] = $files;
 }
开发者ID:hansstam,项目名称:makerfaire,代码行数:16,代码来源:class-edit-entry-render.php

示例7: maybe_process_status_update

 public function maybe_process_status_update($form, $entry)
 {
     $feedback = false;
     $form_id = $form['id'];
     if (isset($_POST['gforms_save_entry']) && check_admin_referer('gforms_save_entry', 'gforms_save_entry')) {
         $new_status = rgpost('gravityflow_status');
         if (!in_array($new_status, array('in_progress', 'complete'))) {
             return false;
         }
         // Loading files that have been uploaded to temp folder
         $files = GFCommon::json_decode(stripslashes(RGForms::post('gform_uploaded_files')));
         if (!is_array($files)) {
             $files = array();
         }
         GFFormsModel::$uploaded_files[$form_id] = $files;
         $validation = $this->validate_status_update($new_status, $form);
         if (is_wp_error($validation)) {
             return $validation;
         }
         $editable_fields = $this->get_editable_fields();
         $previous_assignees = $this->get_assignees();
         $this->save_entry($form, $entry, $editable_fields);
         remove_action('gform_after_update_entry', array(gravity_flow(), 'filter_after_update_entry'));
         do_action('gform_after_update_entry', $form, $entry['id']);
         do_action("gform_after_update_entry_{$form['id']}", $form, $entry['id']);
         $entry = GFFormsModel::get_lead($entry['id']);
         $entry = GFFormsModel::set_entry_meta($entry, $form);
         $this->refresh_entry();
         GFCache::flush();
         $this->maybe_adjust_assignment($previous_assignees);
         if ($token = gravity_flow()->decode_access_token()) {
             $assignee_key = sanitize_text_field($token['sub']);
         } else {
             $user = wp_get_current_user();
             $assignee_key = 'user_id|' . $user->ID;
         }
         $assignee = new Gravity_Flow_Assignee($assignee_key, $this);
         $feedback = $this->process_assignee_status($assignee, $new_status, $form);
     }
     return $feedback;
 }
开发者ID:jakejackson1,项目名称:gravityflow,代码行数:41,代码来源:class-step-user-input.php

示例8: save_custom_choice

 public static function save_custom_choice()
 {
     check_ajax_referer('gf_save_custom_choice', 'gf_save_custom_choice');
     RGFormsModel::save_custom_choice(rgpost('previous_name'), rgpost('new_name'), GFCommon::json_decode(rgpost('choices')));
     exit;
 }
开发者ID:sbayer55,项目名称:The-Road-Gallery,代码行数:6,代码来源:form_detail.php

示例9: process_form

 public static function process_form($form_id)
 {
     GFCommon::log_debug("GFFormDisplay::process_form(): Starting to process form (#{$form_id}) submission.");
     //reading form metadata
     $form = GFAPI::get_form($form_id);
     if (!$form['is_active'] || $form['is_trash']) {
         return;
     }
     if (rgar($form, 'requireLogin')) {
         if (!is_user_logged_in()) {
             return;
         }
         check_admin_referer('gform_submit_' . $form_id, '_gform_submit_nonce_' . $form_id);
     }
     //pre process action
     do_action('gform_pre_process', $form);
     do_action("gform_pre_process_{$form['id']}", $form);
     $lead = array();
     $field_values = RGForms::post('gform_field_values');
     $confirmation_message = '';
     $source_page_number = self::get_source_page($form_id);
     $page_number = $source_page_number;
     $target_page = self::get_target_page($form, $page_number, $field_values);
     GFCommon::log_debug("GFFormDisplay::process_form(): Source page number: {$source_page_number}. Target page number: {$target_page}.");
     //Loading files that have been uploaded to temp folder
     $files = GFCommon::json_decode(stripslashes(RGForms::post('gform_uploaded_files')));
     if (!is_array($files)) {
         $files = array();
     }
     RGFormsModel::$uploaded_files[$form_id] = $files;
     $saving_for_later = rgpost('gform_save') ? true : false;
     $is_valid = true;
     $failed_validation_page = $page_number;
     //don't validate when going to previous page or saving for later
     if (!$saving_for_later && (empty($target_page) || $target_page >= $page_number)) {
         $is_valid = self::validate($form, $field_values, $page_number, $failed_validation_page);
     }
     $log_is_valid = $is_valid ? 'Yes' : 'No';
     GFCommon::log_debug("GFFormDisplay::process_form(): After validation. Is submission valid? {$log_is_valid}.");
     //Upload files to temp folder when saving for later, going to the next page or when submitting the form and it failed validation
     if ($saving_for_later || $target_page >= $page_number || $target_page == 0 && !$is_valid) {
         if (!empty($_FILES)) {
             GFCommon::log_debug('GFFormDisplay::process_form(): Uploading files...');
             //Uploading files to temporary folder
             $files = self::upload_files($form, $files);
             RGFormsModel::$uploaded_files[$form_id] = $files;
         }
     }
     // Load target page if it did not fail validation or if going to the previous page
     if (!$saving_for_later && $is_valid) {
         $page_number = $target_page;
     } else {
         $page_number = $failed_validation_page;
     }
     $confirmation = '';
     if ($is_valid && $page_number == 0 || $saving_for_later) {
         $ajax = isset($_POST['gform_ajax']);
         //adds honeypot field if configured
         if (rgar($form, 'enableHoneypot')) {
             $form['fields'][] = self::get_honeypot_field($form);
         }
         $failed_honeypot = rgar($form, 'enableHoneypot') && !self::validate_honeypot($form);
         if ($failed_honeypot) {
             GFCommon::log_debug('GFFormDisplay::process_form(): Failed Honeypot validation. Displaying confirmation and aborting.');
             //display confirmation but doesn't process the form when honeypot fails
             $confirmation = self::handle_confirmation($form, $lead, $ajax);
             $is_valid = false;
         } elseif (!$saving_for_later) {
             GFCommon::log_debug('GFFormDisplay::process_form(): Submission is valid. Moving forward.');
             $form = self::update_confirmation($form);
             //pre submission action
             do_action('gform_pre_submission', $form);
             do_action("gform_pre_submission_{$form['id']}", $form);
             //pre submission filter
             $form = apply_filters("gform_pre_submission_filter_{$form['id']}", apply_filters('gform_pre_submission_filter', $form));
             //handle submission
             $confirmation = self::handle_submission($form, $lead, $ajax);
             //after submission hook
             do_action('gform_after_submission', $lead, $form);
             do_action("gform_after_submission_{$form['id']}", $lead, $form);
         } elseif ($saving_for_later) {
             GFCommon::log_debug('GFFormDisplay::process_form(): Saving for later.');
             $lead = GFFormsModel::get_current_lead();
             $form = self::update_confirmation($form, $lead, 'form_saved');
             $confirmation = rgar($form['confirmation'], 'message');
             $nl2br = rgar($form['confirmation'], 'disableAutoformat') ? false : true;
             $confirmation = GFCommon::replace_variables($confirmation, $form, $lead, false, true, $nl2br);
             $form_unique_id = GFFormsModel::get_form_unique_id($form_id);
             $ip = GFFormsModel::get_ip();
             $source_url = GFFormsModel::get_current_page_url();
             $resume_token = rgpost('gform_resume_token');
             $resume_token = GFFormsModel::save_incomplete_submission($form, $lead, $field_values, $page_number, $files, $form_unique_id, $ip, $source_url, $resume_token);
             $notifications_to_send = GFCommon::get_notifications_to_send('form_saved', $form, $lead);
             $log_notification_event = empty($notifications_to_send) ? 'No notifications to process' : 'Processing notifications';
             GFCommon::log_debug("GFFormDisplay::process_form(): {$log_notification_event} for form_saved event.");
             foreach ($notifications_to_send as $notification) {
                 if (isset($notification['isActive']) && !$notification['isActive']) {
                     GFCommon::log_debug("GFFormDisplay::process_form(): Notification is inactive, not processing notification (#{$notification['id']} - {$notification['name']}).");
                     continue;
                 }
//.........这里部分代码省略.........
开发者ID:shahidbasheer,项目名称:gravityform,代码行数:101,代码来源:form_display.php

示例10: leads_page

    public static function leads_page($form_id)
    {
        global $wpdb;
        //quit if version of wp is not supported
        if (!GFCommon::ensure_wp_version()) {
            return;
        }
        echo GFCommon::get_remote_message();
        $action = RGForms::post("action");
        switch ($action) {
            case "delete":
                check_admin_referer('gforms_entry_list', 'gforms_entry_list');
                $lead_id = $_POST["action_argument"];
                RGFormsModel::delete_lead($lead_id);
                break;
            case "bulk":
                check_admin_referer('gforms_entry_list', 'gforms_entry_list');
                $bulk_action = !empty($_POST["bulk_action"]) ? $_POST["bulk_action"] : $_POST["bulk_action2"];
                $leads = $_POST["lead"];
                switch ($bulk_action) {
                    case "delete":
                        RGFormsModel::delete_leads($leads);
                        break;
                    case "mark_read":
                        RGFormsModel::update_leads_property($leads, "is_read", 1);
                        break;
                    case "mark_unread":
                        RGFormsModel::update_leads_property($leads, "is_read", 0);
                        break;
                    case "add_star":
                        RGFormsModel::update_leads_property($leads, "is_starred", 1);
                        break;
                    case "remove_star":
                        RGFormsModel::update_leads_property($leads, "is_starred", 0);
                        break;
                }
                break;
            case "change_columns":
                check_admin_referer('gforms_entry_list', 'gforms_entry_list');
                $columns = GFCommon::json_decode(stripslashes($_POST["grid_columns"]), true);
                RGFormsModel::update_grid_column_meta($form_id, $columns);
                break;
        }
        $sort_field = empty($_GET["sort"]) ? 0 : $_GET["sort"];
        $sort_direction = empty($_GET["dir"]) ? "DESC" : $_GET["dir"];
        $search = RGForms::get("s");
        $page_index = empty($_GET["paged"]) ? 0 : intval($_GET["paged"]) - 1;
        $star = is_numeric(RGForms::get("star")) ? intval(RGForms::get("star")) : null;
        $read = is_numeric(RGForms::get("read")) ? intval(RGForms::get("read")) : null;
        $page_size = 20;
        $first_item_index = $page_index * $page_size;
        $form = RGFormsModel::get_form_meta($form_id);
        $sort_field_meta = RGFormsModel::get_field($form, $sort_field);
        $is_numeric = $sort_field_meta["type"] == "number";
        $leads = RGFormsModel::get_leads($form_id, $sort_field, $sort_direction, $search, $first_item_index, $page_size, $star, $read, $is_numeric);
        $lead_count = RGFormsModel::get_lead_count($form_id, $search, $star, $read);
        $summary = RGFormsModel::get_form_counts($form_id);
        $total_lead_count = $summary["total"];
        $unread_count = $summary["unread"];
        $starred_count = $summary["starred"];
        $columns = RGFormsModel::get_grid_columns($form_id, true);
        $search_qs = empty($search) ? "" : "&s=" . urlencode($search);
        $sort_qs = empty($sort_field) ? "" : "&sort={$sort_field}";
        $dir_qs = empty($sort_field) ? "" : "&dir={$sort_direction}";
        $star_qs = $star !== null ? "&star={$star}" : "";
        $read_qs = $read !== null ? "&read={$read}" : "";
        $page_links = paginate_links(array('base' => admin_url("admin.php") . "?page=gf_entries&view=entries&id={$form_id}&%_%" . $search_qs . $sort_qs . $dir_qs . $star_qs . $read_qs, 'format' => 'paged=%#%', 'prev_text' => __('&laquo;'), 'next_text' => __('&raquo;'), 'total' => ceil($lead_count / $page_size), 'current' => $page_index + 1, 'show_all' => false));
        wp_print_scripts(array("thickbox"));
        wp_print_styles(array("thickbox"));
        ?>

        <script src="<?php 
        echo GFCommon::get_base_url();
        ?>
/js/jquery.json-1.3.js?ver=<?php 
        echo GFCommon::$version;
        ?>
"></script>

        <script>
            function ChangeColumns(columns){
                jQuery("#action").val("change_columns");
                jQuery("#grid_columns").val(jQuery.toJSON(columns));
                tb_remove();
                jQuery("#lead_form")[0].submit();
            }

            function Search(sort_field_id, sort_direction, form_id, search, star, read){
                var search_qs = search == "" ? "" : "&s=" + search;
                var star_qs = star == "" ? "" : "&star=" + star;
                var read_qs = read == "" ? "" : "&read=" + read;

                var location = "?page=gf_entries&view=entries&id=" + form_id + "&sort=" + sort_field_id + "&dir=" + sort_direction + search_qs + star_qs + read_qs;
                document.location = location;
            }

            function ToggleStar(img, lead_id){
                var is_starred = img.src.indexOf("star1.png") >=0
                if(is_starred)
                    img.src = img.src.replace("star1.png", "star0.png");
//.........这里部分代码省略.........
开发者ID:hypenotic,项目名称:slowfood,代码行数:101,代码来源:entry_list.php

示例11: lead_detail_page

    public static function lead_detail_page()
    {
        global $current_user;
        if (!GFCommon::ensure_wp_version()) {
            return;
        }
        echo GFCommon::get_remote_message();
        $requested_form_id = absint($_GET['id']);
        if (empty($requested_form_id)) {
            return;
        }
        $lead = self::get_current_entry();
        if (is_wp_error($lead) || !$lead) {
            esc_html_e("Oops! We couldn't find your entry. Please try again", 'gravityforms');
            return;
        }
        $lead_id = $lead['id'];
        $form = self::get_current_form();
        $form_id = absint($form['id']);
        $total_count = self::get_total_count();
        $position = rgget('pos') ? rgget('pos') : 0;
        $prev_pos = !rgblank($position) && $position > 0 ? $position - 1 : false;
        $next_pos = !rgblank($position) && $position < self::$_total_count - 1 ? $position + 1 : false;
        $filter = rgget('filter');
        // unread filter requires special handling for pagination since entries are filter out of the query as they are read
        if ($filter == 'unread') {
            $next_pos = $position;
            if ($next_pos + 1 == $total_count) {
                $next_pos = false;
            }
        }
        RGFormsModel::update_lead_property($lead['id'], 'is_read', 1);
        switch (RGForms::post('action')) {
            case 'update':
                check_admin_referer('gforms_save_entry', 'gforms_save_entry');
                //Loading files that have been uploaded to temp folder
                $files = GFCommon::json_decode(stripslashes(RGForms::post('gform_uploaded_files')));
                if (!is_array($files)) {
                    $files = array();
                }
                $original_entry = $lead;
                GFFormsModel::$uploaded_files[$form_id] = $files;
                GFFormsModel::save_lead($form, $lead);
                /**
                 * Fires after the Entry is updated from the entry detail page.
                 *
                 * @param array   $form           The form object for the entry.
                 * @param integer $lead['id']     The entry ID.
                 * @param array   $original_entry The entry object before being updated.
                 */
                gf_do_action(array('gform_after_update_entry', $form['id']), $form, $lead['id'], $original_entry);
                $lead = RGFormsModel::get_lead($lead['id']);
                $lead = GFFormsModel::set_entry_meta($lead, $form);
                self::set_current_entry($lead);
                break;
            case 'add_note':
                check_admin_referer('gforms_update_note', 'gforms_update_note');
                $user_data = get_userdata($current_user->ID);
                RGFormsModel::add_note($lead['id'], $current_user->ID, $user_data->display_name, stripslashes($_POST['new_note']));
                //emailing notes if configured
                if (rgpost('gentry_email_notes_to')) {
                    GFCommon::log_debug('GFEntryDetail::lead_detail_page(): Preparing to email entry notes.');
                    $email_to = $_POST['gentry_email_notes_to'];
                    $email_from = $current_user->user_email;
                    $email_subject = stripslashes($_POST['gentry_email_subject']);
                    $body = stripslashes($_POST['new_note']);
                    $headers = "From: \"{$email_from}\" <{$email_from}> \r\n";
                    GFCommon::log_debug("GFEntryDetail::lead_detail_page(): Emailing notes - TO: {$email_to} SUBJECT: {$email_subject} BODY: {$body} HEADERS: {$headers}");
                    $is_success = wp_mail($email_to, $email_subject, $body, $headers);
                    $result = is_wp_error($is_success) ? $is_success->get_error_message() : $is_success;
                    GFCommon::log_debug("GFEntryDetail::lead_detail_page(): Result from wp_mail(): {$result}");
                    if (!is_wp_error($is_success) && $is_success) {
                        GFCommon::log_debug('GFEntryDetail::lead_detail_page(): Mail was passed from WordPress to the mail server.');
                    } else {
                        GFCommon::log_error('GFEntryDetail::lead_detail_page(): The mail message was passed off to WordPress for processing, but WordPress was unable to send the message.');
                    }
                    if (has_filter('phpmailer_init')) {
                        GFCommon::log_debug(__METHOD__ . '(): The WordPress phpmailer_init hook has been detected, usually used by SMTP plugins, it can impact mail delivery.');
                    }
                    /**
                     * Fires after a note is attached to an entry and sent as an email
                     *
                     * @param string $result        The Error message or success message when the entry note is sent
                     * @param string $email_to      The email address to send the entry note to
                     * @param string $email_from    The email address from which the email is sent from
                     * @param string $email_subject The subject of the email that is sent
                     * @param mixed  $body          The Full body of the email containing the message after the note is sent
                     * @param array  $form          The current form object
                     * @param array  $lead          The Current lead object
                     */
                    do_action('gform_post_send_entry_note', $result, $email_to, $email_from, $email_subject, $body, $form, $lead);
                }
                break;
            case 'add_quick_note':
                check_admin_referer('gforms_save_entry', 'gforms_save_entry');
                $user_data = get_userdata($current_user->ID);
                RGFormsModel::add_note($lead['id'], $current_user->ID, $user_data->display_name, stripslashes($_POST['quick_note']));
                break;
            case 'bulk':
                check_admin_referer('gforms_update_note', 'gforms_update_note');
//.........这里部分代码省略.........
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:101,代码来源:entry_detail.php

示例12: check_admin_referer

<?php

if (isset($_POST) && !empty($_POST)) {
    check_admin_referer('gforms_save_entry', 'gforms_save_entry');
    //Loading files that have been uploaded to temp folder
    $files = GFCommon::json_decode(stripslashes(RGForms::post("gform_uploaded_files")));
    if (!is_array($files)) {
        $files = array();
    }
    GFFormsModel::$uploaded_files[$form_id] = $files;
    GFFormsModel::save_lead($form, $lead);
    do_action("gform_after_update_entry", $form, $lead["id"]);
    do_action("gform_after_update_entry_{$form["id"]}", $form, $lead["id"]);
    $lead = RGFormsModel::get_lead($lead["id"]);
    $lead = GFFormsModel::set_entry_meta($lead, $form);
    $formid = $lead['form_id'];
    $where = 'form_id =' . $formid;
    $params = array('where' => $where);
    $templates = gettplList($params);
    $fieldmap = gettplFieldMap($params);
    if (!empty($templates['meta']['files'])) {
        $return = tpl_combine($lead, $templates, $fieldmap);
    }
}
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:24,代码来源:entry_edit_page_controller.php

示例13: process_action

 /**
  * Processes a bulk or single action.
  */
 function process_action()
 {
     $single_action = rgpost('single_action');
     $bulk_action = $this->current_action();
     $delete_permanently = (bool) rgpost('button_delete_permanently');
     if (!($single_action || $bulk_action || $delete_permanently)) {
         return;
     }
     check_admin_referer('gforms_entry_list', 'gforms_entry_list');
     $form_id = $this->get_form_id();
     if ($delete_permanently) {
         if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
             RGFormsModel::delete_leads_by_form($form_id, $this->filter);
         }
         return;
     }
     if ($single_action) {
         $entry_id = rgpost('single_action_argument');
         switch ($single_action) {
             case 'delete':
                 if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
                     RGFormsModel::delete_lead($entry_id);
                     $message = esc_html__('Entry deleted.', 'gravityforms');
                 } else {
                     $message = esc_html__("You don't have adequate permission to delete entries.", 'gravityforms');
                 }
                 break;
             case 'change_columns':
                 $columns = GFCommon::json_decode(stripslashes($_POST['grid_columns']), true);
                 RGFormsModel::update_grid_column_meta($form_id, $columns);
                 $this->set_columns();
                 break;
         }
     } elseif ($bulk_action) {
         $select_all = rgpost('all_entries');
         $search_criteria = $this->get_search_criteria();
         $entries = empty($select_all) ? $_POST['entry'] : GFFormsModel::search_lead_ids($form_id, $search_criteria);
         $entry_count = count($entries) > 1 ? sprintf(esc_html__('%d entries', 'gravityforms'), count($entries)) : esc_html__('1 entry', 'gravityforms');
         switch ($bulk_action) {
             case 'delete':
                 if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
                     RGFormsModel::delete_leads($entries);
                     $message = sprintf(esc_html__('%s deleted.', 'gravityforms'), $entry_count);
                 } else {
                     $message = esc_html__("You don't have adequate permission to delete entries.", 'gravityforms');
                 }
                 break;
             case 'trash':
                 RGFormsModel::update_leads_property($entries, 'status', 'trash');
                 $message = sprintf(esc_html__('%s moved to Trash.', 'gravityforms'), $entry_count);
                 break;
             case 'restore':
                 RGFormsModel::update_leads_property($entries, 'status', 'active');
                 $message = sprintf(esc_html__('%s restored from the Trash.', 'gravityforms'), $entry_count);
                 break;
             case 'unspam':
                 RGFormsModel::update_leads_property($entries, 'status', 'active');
                 $message = sprintf(esc_html__('%s restored from the spam.', 'gravityforms'), $entry_count);
                 break;
             case 'spam':
                 RGFormsModel::update_leads_property($entries, 'status', 'spam');
                 $message = sprintf(esc_html__('%s marked as spam.', 'gravityforms'), $entry_count);
                 break;
             case 'mark_read':
                 RGFormsModel::update_leads_property($entries, 'is_read', 1);
                 $message = sprintf(esc_html__('%s marked as read.', 'gravityforms'), $entry_count);
                 break;
             case 'mark_unread':
                 RGFormsModel::update_leads_property($entries, 'is_read', 0);
                 $message = sprintf(esc_html__('%s marked as unread.', 'gravityforms'), $entry_count);
                 break;
             case 'add_star':
                 RGFormsModel::update_leads_property($entries, 'is_starred', 1);
                 $message = sprintf(esc_html__('%s starred.', 'gravityforms'), $entry_count);
                 break;
             case 'remove_star':
                 RGFormsModel::update_leads_property($entries, 'is_starred', 0);
                 $message = sprintf(esc_html__('%s unstarred.', 'gravityforms'), $entry_count);
                 break;
         }
     }
     if (!empty($message)) {
         echo '<div id="message" class="updated notice is-dismissible"><p>' . $message . '</p></div>';
     }
 }
开发者ID:arobbins,项目名称:spellestate,代码行数:88,代码来源:entry_list.php

示例14: save_buddypress_meta

 public static function save_buddypress_meta($config)
 {
     $json = stripslashes(RGForms::post("gf_buddypress_config"));
     $config["meta"]["buddypress_meta"] = GFCommon::json_decode($json);
     return $config;
 }
开发者ID:macconsultinggroup,项目名称:WordPress,代码行数:6,代码来源:userregistration.php

示例15: change_directory_columns

 public static function change_directory_columns()
 {
     check_ajax_referer('gforms_directory_columns', 'gforms_directory_columns');
     $columns = GFCommon::json_decode(stripslashes($_POST["directory_columns"]), true);
     self::update_grid_column_meta((int) $_POST['form_id'], $columns);
 }
开发者ID:healthcommcore,项目名称:osnap,代码行数:6,代码来源:gravity-forms-addons.php


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