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


PHP RGFormsModel::add_note方法代码示例

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


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

示例1: update_entry_creator

 /**
  * When the entry creator is changed, add a note to the entry
  * @param  array $form   GF entry array
  * @param  int $leadid Lead ID
  * @return void
  */
 function update_entry_creator($form, $leadid)
 {
     global $current_user;
     // Update the entry
     $created_by = intval(rgpost('created_by'));
     RGFormsModel::update_lead_property($leadid, 'created_by', $created_by);
     // If the creator has changed, let's add a note about who it used to be.
     $originally_created_by = rgpost('originally_created_by');
     if ($originally_created_by !== $created_by) {
         $user_data = get_userdata($current_user->ID);
         $user_format = __('%s (ID #%d)', 'gravity-view');
         $original_name = $created_by_name = esc_attr__('No User', 'gravity-view');
         if (!empty($originally_created_by)) {
             $originally_created_by_user_data = get_userdata($originally_created_by);
             $original_name = sprintf($user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID);
         }
         if (!empty($created_by)) {
             $created_by_user_data = get_userdata($created_by);
             $created_by_name = sprintf($user_format, $created_by_user_data->display_name, $created_by_user_data->ID);
         }
         RGFormsModel::add_note($leadid, $current_user->ID, $user_data->display_name, sprintf(__('Changed lead creator from %s to %s', 'gravity-forms-addons'), $original_name, $created_by_name));
     }
 }
开发者ID:healthcommcore,项目名称:osnap,代码行数:29,代码来源:gravity-forms-lead-creator.php

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

示例3: start_subscription

 private static function start_subscription($entry, $subscriber_id, $amount, $user_id, $user_name)
 {
     $entry["payment_status"] = "Active";
     $entry["payment_amount"] = $amount;
     $entry["payment_date"] = gmdate("y-m-d H:i:s");
     $entry["transaction_id"] = $subscriber_id;
     $entry["transaction_type"] = 2;
     //subscription
     if (!$entry["is_fulfilled"]) {
         self::fulfill_order($entry, $subscriber_id, $amount);
         $entry["is_fulfilled"] = true;
     }
     RGFormsModel::update_lead($entry);
     RGFormsModel::add_note($entry["id"], $user_id, $user_name, sprintf(__("Subscription has been created. Subscriber Id: %s", "gravityforms"), $subscriber_id));
 }
开发者ID:hscale,项目名称:webento,代码行数:15,代码来源:paypal.php

示例4: add_note

 /**
  * Add note to GF Entry
  * @param int $id   Entry ID
  * @param string $note Note text
  */
 private static function add_note($id, $note)
 {
     if (!apply_filters('gravityforms_constant_contact_add_notes_to_entries', true) || !class_exists('RGFormsModel')) {
         return;
     }
     RGFormsModel::add_note($id, 0, __('Gravity Forms Constant Contact Add-on'), $note);
 }
开发者ID:NerdyDillinger,项目名称:ovrride,代码行数:12,代码来源:constantcontact.php

示例5: mf_add_note

function mf_add_note($leadid, $notetext)
{
    global $current_user;
    $user_data = get_userdata($current_user->ID);
    RGFormsModel::add_note($leadid, $current_user->ID, $user_data->display_name, $notetext);
}
开发者ID:hansstam,项目名称:makerfaire,代码行数:6,代码来源:gf-entry-sidebar.php

示例6: 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"]);
        $lead_id = rgget('lid');
        $filter = rgget("filter");
        $status = in_array($filter, array("trash", "spam")) ? $filter : "active";
        $search = rgget("s");
        $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;
        // added status as an optional parameter to get_lead_count because the counts are inaccurate without using the status
        $lead_count = RGFormsModel::get_lead_count($form['id'], $search, $star, $read, null, null, $status);
        $prev_pos = !rgblank($position) && $position > 0 ? $position - 1 : false;
        $next_pos = !rgblank($position) && $position < $lead_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 == $lead_count) {
                $next_pos = false;
            }
        }
        // get the lead
        $leads = RGFormsModel::get_leads($form['id'], $sort_field, $sort_direction, $search, $position, 1, $star, $read, $is_numeric, null, null, $status);
        if (!$lead_id) {
            $lead = !empty($leads) ? $leads[0] : false;
        } else {
            $lead = RGFormsModel::get_lead($lead_id);
        }
        if (!$lead) {
            _e("Oops! We couldn't find your lead. 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');
                RGFormsModel::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"]);
                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;
            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');
                if ($_POST["bulk_action"] == "delete") {
                    RGFormsModel::delete_notes($_POST["note"]);
                }
                break;
            case "trash":
                check_admin_referer('gforms_save_entry', 'gforms_save_entry');
                RGFormsModel::update_lead_property($lead["id"], "status", "trash");
                $lead = RGFormsModel::get_lead($lead["id"]);
                break;
            case "restore":
            case "unspam":
                check_admin_referer('gforms_save_entry', 'gforms_save_entry');
                RGFormsModel::update_lead_property($lead["id"], "status", "active");
                $lead = RGFormsModel::get_lead($lead["id"]);
                break;
            case "spam":
                check_admin_referer('gforms_save_entry', 'gforms_save_entry');
                RGFormsModel::update_lead_property($lead["id"], "status", "spam");
                $lead = RGFormsModel::get_lead($lead["id"]);
                break;
            case "delete":
                check_admin_referer('gforms_save_entry', 'gforms_save_entry');
                RGFormsModel::delete_lead($lead["id"]);
                ?>
                <script type="text/javascript">
                    document.location.href='<?php 
                echo "admin.php?page=gf_entries&view=entries&id=" . absint($form["id"]);
                ?>
';
//.........这里部分代码省略.........
开发者ID:xeyefex,项目名称:Mixd-WordPress-Framework,代码行数:101,代码来源:entry_detail.php

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

示例8: export_feed

 public static function export_feed($entry, $form, $feed, &$api)
 {
     global $current_user;
     $email_field_id = $feed["meta"]["field_map"]["Email"];
     $email = $entry[$email_field_id];
     $merge_vars = array();
     // Handle the CustomFields
     foreach ((array) $feed['meta']['field_map']['CustomFields'] as $key => $field_id) {
         $feed['meta']['field_map'][$key] = $field_id;
         unset($feed['meta']['field_map']['CustomFields'][$key]);
     }
     unset($feed['meta']['field_map']['CustomFields']);
     foreach ($feed["meta"]["field_map"] as $var_tag => $field_id) {
         // If something's mapped to nothing, or nothign is mapped to something, get outta here!
         if (empty($var_tag) || empty($field_id)) {
             continue;
         }
         $field = RGFormsModel::get_field($form, $field_id);
         $input_type = RGFormsModel::get_input_type($field);
         if ($field_id == intval($field_id) && RGFormsModel::get_input_type($field) == "address") {
             //handling full address
             $merge_vars[$var_tag] = self::get_address($entry, $field_id);
         } else {
             if ($var_tag != "EMAIL") {
                 //ignoring email field as it will be handled separatelly
                 $merge_vars[$var_tag] = isset($entry[$field_id]) ? $entry[$field_id] : NULL;
             }
         }
         $merge_vars[$var_tag] = self::clean_utf8($merge_vars[$var_tag]);
         if (preg_match('/^date|date$|LastReferred/ism', $var_tag)) {
             $merge_vars[$var_tag] = $api->getTime($merge_vars[$var_tag]);
         }
     }
     if (self::test_api()) {
         $cookie = self::get_munchkin_cookie();
         $syncType = !$cookie || self::get_setting('sync_type') === 'email' ? 'EMAIL' : $cookie;
         if (!$syncType) {
             $syncType = 'EMAIL';
         }
         $success = $api->syncLead($syncType, $merge_vars, self::get_munchkin_cookie());
         if (!is_wp_error($success) && !empty($success) && !empty($success->result) && is_object($success->result)) {
             $leadId = $success->result->leadId;
         } else {
             $leadId = false;
         }
         /**
          * Add the lead to the specified campaign
          */
         $campaign_id = $feed['meta']['contact_list_id'];
         $campaign_name = $feed['meta']['contact_list_name'];
         if (!empty($campaign_id)) {
             $campaign = $api->requestCampaign($campaign_id, $leadId);
         }
         if (self::is_debug()) {
             echo '<h3>' . __('Admin-only Form Debugging', 'gravity-forms-marketo') . '</h3>';
             self::r(array('Form Entry Data' => $entry, 'Marketo Sync Type' => $syncType, 'Marketo Feed Meta Data' => $feed, 'Munchkin Cookie' => self::get_munchkin_cookie(), 'Marketo Posted Merge Data' => $merge_vars, 'Posted Data ($_POST)' => $_POST, 'syncLead Result' => print_r($success, true), 'Added to Campaign?' => !empty($campaign) ? sprintf('Added to `%s` campaign (ID: %s)', $campaign_name, $campaign_id) : 'Adding to campaign failed.'));
         }
         /**
          * Add lead notes with Marketo lead ID info
          */
         if (function_exists('gform_update_meta') && $leadId) {
             try {
                 // TODO - assign campaign to lead
                 @RGFormsModel::add_note($entry['id'], $current_user->ID, $current_user->display_name, stripslashes(sprintf(__('Added or Updated on Marketo. Contact ID: #%d. View entry at %s', 'gravity-forms-marketo'), $leadId, self::get_contact_url($leadId))));
                 @gform_update_meta($entry['id'], 'marketo_id', $leadId);
             } catch (Exception $e) {
             }
         }
     } elseif (current_user_can('administrator')) {
         echo '<div class="error" id="message">' . wpautop(sprintf(__("The form didn't create a contact because the Marketo Gravity Forms Add-on plugin isn't properly configured. %sCheck the configuration%s and try again.", 'gravity-forms-marketo'), '<a href="' . admin_url('admin.php?page=gf_settings&amp;addon=Marketo') . '">', '</a>')) . '</div>';
     }
 }
开发者ID:emilysnothere,项目名称:Gravity-Forms-Marketo-Add-on,代码行数:72,代码来源:marketo.php

示例9: process_renewals

 public static function process_renewals()
 {
     if (!self::is_gravityforms_supported()) {
         return;
     }
     // getting user information
     $user_id = 0;
     $user_name = "System";
     //loading data lib
     require_once self::get_base_path() . "/data.php";
     // loading authorizenet api and getting credentials
     self::include_api();
     // getting all authorize.net subscription feeds
     $recurring_feeds = GFAuthorizeNetData::get_feeds();
     foreach ($recurring_feeds as $feed) {
         // process renewalls if authorize.net feed is subscription feed
         if ($feed["meta"]["type"] == "subscription") {
             $form_id = $feed["form_id"];
             // getting billig cycle information
             $billing_cycle_number = $feed["meta"]["billing_cycle_number"];
             $billing_cycle_type = $feed["meta"]["billing_cycle_type"];
             if ($billing_cycle_type == "M") {
                 $billing_cycle = $billing_cycle_number . " month";
             } else {
                 $billing_cycle = $billing_cycle_number . " day";
             }
             $querytime = strtotime(gmdate("Y-m-d") . "-" . $billing_cycle);
             $querydate = gmdate("Y-m-d", $querytime) . " 00:00:00";
             // finding leads with a late payment date
             global $wpdb;
             $results = $wpdb->get_results("SELECT l.id, l.transaction_id, m.meta_value as payment_date\r\n                                                FROM {$wpdb->prefix}rg_lead l\r\n                                                INNER JOIN {$wpdb->prefix}rg_lead_meta m ON l.id = m.lead_id\r\n                                                WHERE l.form_id={$form_id}\r\n                                                AND payment_status = 'Active'\r\n                                                AND meta_key = 'subscription_payment_date'\r\n                                                AND meta_value < '{$querydate}'");
             foreach ($results as $result) {
                 //Getting entry
                 $entry_id = $result->id;
                 $entry = RGFormsModel::get_lead($entry_id);
                 //Getting subscription status from authorize.net
                 $subscription_id = $result->transaction_id;
                 $status_request = self::get_arb(self::get_local_api_settings($feed));
                 $status_response = $status_request->getSubscriptionStatus($subscription_id);
                 $status = $status_response->getSubscriptionStatus();
                 switch (strtolower($status)) {
                     case "active":
                         // getting feed trial information
                         $trial_period_enabled = $feed["meta"]["trial_period_enabled"];
                         $trial_period_occurrences = $feed["meta"]["trial_period_number"];
                         // finding payment date
                         $new_payment_time = strtotime($result->payment_date . "+" . $billing_cycle);
                         $new_payment_date = gmdate('Y-m-d H:i:s', $new_payment_time);
                         // finding payment amount
                         $payment_count = gform_get_meta($entry_id, "subscription_payment_count");
                         $new_payment_amount = gform_get_meta($entry_id, "subscription_regular_amount");
                         if ($trial_period_enabled == 1 && $trial_period_occurrences >= $payment_count) {
                             $new_payment_amount = gform_get_meta($entry_id, "subscription_trial_amount");
                         }
                         // update subscription payment and lead information
                         gform_update_meta($entry_id, "subscription_payment_count", $payment_count + 1);
                         gform_update_meta($entry_id, "subscription_payment_date", $new_payment_date);
                         RGFormsModel::add_note($entry_id, $user_id, $user_name, sprintf(__("Subscription payment has been made. Amount: %s. Subscriber Id: %s", "gravityforms"), GFCommon::to_money($new_payment_amount, $entry["currency"]), $subscription_id));
                         // inserting transaction
                         GFAuthorizeNetData::insert_transaction($entry_id, "payment", $subscription_id, $subscription_id, $new_payment_amount);
                         do_action("gform_authorizenet_post_recurring_payment", $subscription_id, $entry, $new_payment_amount, $payment_count);
                         //deprecated
                         do_action("gform_authorizenet_after_recurring_payment", $entry, $subscription_id, $subscription_id, $new_payment_amount);
                         break;
                     case "expired":
                         $entry["payment_status"] = "Expired";
                         RGFormsModel::update_lead($entry);
                         RGFormsModel::add_note($entry["id"], $user_id, $user_name, sprintf(__("Subscription has successfully completed its billing schedule. Subscriber Id: %s", "gravityformsauthorizenet"), $subscription_id));
                         do_action("gform_authorizenet_post_expire_subscription", $subscription_id, $entry);
                         //deprecated
                         do_action("gform_authorizenet_subscription_ended", $entry, $subscription_id, $transaction_id, $new_payment_amount);
                         break;
                     case "suspended":
                         $entry["payment_status"] = "Failed";
                         RGFormsModel::update_lead($entry);
                         RGFormsModel::add_note($entry["id"], $user_id, $user_name, sprintf(__("Subscription is currently suspended due to a transaction decline, rejection, or error. Suspended subscriptions must be reactivated before the next scheduled transaction or the subscription will be terminated by the payment gateway. Subscriber Id: %s", "gravityforms"), $subscription_id));
                         do_action("gform_authorizenet_post_suspend_subscription", $subscription_id, $entry);
                         //deprecated
                         do_action("gform_authorizenet_subscription_suspended", $entry, $subscription_id, $transaction_id, $new_payment_amount);
                         break;
                     case "terminated":
                     case "canceled":
                         self::cancel_subscription($entry);
                         RGFormsModel::add_note($entry_id, $user_id, $user_name, sprintf(__("Subscription has been canceled. Subscriber Id: %s", "gravityforms"), $subscription_id));
                         do_action("gform_authorizenet_post_cancel_subscription", $subscription_id, $entry);
                         //deprecated
                         do_action("gform_authorizenet_subscription_canceled", $entry, $subscription_id, $transaction_id, $new_payment_amount);
                         break;
                     default:
                         $entry["payment_status"] = "Failed";
                         RGFormsModel::update_lead($entry);
                         RGFormsModel::add_note($entry["id"], $user_id, $user_name, sprintf(__("Subscription is currently suspended due to a transaction decline, rejection, or error. Suspended subscriptions must be reactivated before the next scheduled transaction or the subscription will be terminated by the payment gateway. Subscriber Id: %s", "gravityforms"), $subscription_id));
                         do_action("gform_authorizenet_post_suspend_subscription", $subscription_id, $entry);
                         //deprecated
                         do_action("gform_authorizenet_subscription_suspended", $entry, $subscription_id, $transaction_id, $new_payment_amount);
                         break;
                 }
             }
         }
     }
//.........这里部分代码省略.........
开发者ID:macconsultinggroup,项目名称:WordPress,代码行数:101,代码来源:authorizenet.php

示例10: 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"]);
        $lead = RGFormsModel::get_lead($_GET["lid"]);
        if (!$lead) {
            _e("OOps! We couldn't find your lead. Please try again", "gravityforms");
            return;
        }
        RGFormsModel::update_lead_property($lead["id"], "is_read", 1);
        $search_qs = empty($_GET["s"]) ? "" : "&s=" . $_GET["s"];
        $sort_qs = empty($_GET["sort"]) ? "" : "&sort=" . $_GET["sort"];
        $dir_qs = empty($_GET["dir"]) ? "" : "&dir=" . $_GET["dir"];
        $page_qs = empty($_GET["paged"]) ? "" : "&paged=" . absint($_GET["paged"]);
        switch (RGForms::post("action")) {
            case "update":
                check_admin_referer('gforms_save_entry', 'gforms_save_entry');
                RGFormsModel::save_lead($form, $lead);
                $lead = RGFormsModel::get_lead($_GET["lid"]);
                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;
            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');
                if ($_POST["bulk_action"] == "delete") {
                    RGFormsModel::delete_notes($_POST["note"]);
                }
                break;
            case "delete":
                check_admin_referer('gforms_save_entry', 'gforms_save_entry');
                RGFormsModel::delete_lead($lead["id"]);
                ?>
                <div id="message" class="updated fade" style="background-color: rgb(255, 251, 204); margin-top:50px; padding:50px;">
                    <?php 
                _e("Entry has been deleted.", "gravityforms");
                ?>
 <a href="<?php 
                echo esc_url("admin.php?page=gf_entries&view=entries&id=" . absint($form["id"]) . $search_qs . $sort_qs . $dir_qs . $page_qs);
                ?>
"><?php 
                _e("Back to entries list", "gravityforms");
                ?>
</a>
                </div>
                <?php 
                exit;
                break;
        }
        $mode = empty($_POST["screen_mode"]) ? "view" : $_POST["screen_mode"];
        ?>
        <link rel="stylesheet" href="<?php 
        echo GFCommon::get_base_url();
        ?>
/css/admin.css" />
        <script type="text/javascript">

            function DeleteFile(leadId, fieldId){
                if(confirm(<?php 
        _e("'Would you like to delete this file? \\'Cancel\\' to stop. \\'OK\\' to delete'", "gravityforms");
        ?>
)){

                    var mysack = new sack("<?php 
        echo admin_url("admin-ajax.php");
        ?>
");
                    mysack.execute = 1;
                    mysack.method = 'POST';
                    mysack.setVar( "action", "rg_delete_file" );
                    mysack.setVar( "rg_delete_file", "<?php 
        echo wp_create_nonce("rg_delete_file");
        ?>
" );
                    mysack.setVar( "lead_id", leadId );
                    mysack.setVar( "field_id", fieldId );
                    mysack.encVar( "cookie", document.cookie, false );
                    mysack.onError = function() { alert('<?php 
        echo esc_js(__("Ajax error while deleting field.", "gravityforms"));
        ?>
//.........这里部分代码省略.........
开发者ID:hypenotic,项目名称:slowfood,代码行数:101,代码来源:entry_detail.php

示例11: update_entry_creator

 /**
  * When the entry creator is changed, add a note to the entry
  * @param  array $form   GF entry array
  * @param  int $entry_id Entry ID
  * @return void
  */
 function update_entry_creator($form, $entry_id)
 {
     global $current_user;
     // Update the entry
     $created_by = absint(rgpost('created_by'));
     RGFormsModel::update_lead_property($entry_id, 'created_by', $created_by);
     // If the creator has changed, let's add a note about who it used to be.
     $originally_created_by = rgpost('originally_created_by');
     // If there's no owner and there didn't used to be, keep going
     if (empty($originally_created_by) && empty($created_by)) {
         return;
     }
     // If the values have changed
     if (absint($originally_created_by) !== absint($created_by)) {
         $user_data = get_userdata($current_user->ID);
         $user_format = _x('%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview');
         $original_name = $created_by_name = esc_attr_x('No User', 'To show that the entry was unassigned from an actual user to no user.', 'gravityview');
         if (!empty($originally_created_by)) {
             $originally_created_by_user_data = get_userdata($originally_created_by);
             $original_name = sprintf($user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID);
         }
         if (!empty($created_by)) {
             $created_by_user_data = get_userdata($created_by);
             $created_by_name = sprintf($user_format, $created_by_user_data->display_name, $created_by_user_data->ID);
         }
         RGFormsModel::add_note($entry_id, $current_user->ID, $user_data->display_name, sprintf(__('Changed entry creator from %s to %s', 'gravityview'), $original_name, $created_by_name), 'gravityview');
     }
 }
开发者ID:robinsutherland223,项目名称:gravity,代码行数:34,代码来源:class-change-entry-creator.php

示例12: update_approved

 /**
  * update_approved function.
  *
  * @access public
  * @static
  * @param int $lead_id (default: 0)
  * @param int $approved (default: 0)
  * @param int $form_id (default: 0)
  * @param int $approvedcolumn (default: 0)
  * @return boolean True: It worked; False: it failed
  */
 public static function update_approved($entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0)
 {
     if (!class_exists('GFAPI')) {
         return;
     }
     if (empty($approvedcolumn)) {
         $approvedcolumn = self::get_approved_column($form_id);
     }
     //get the entry
     $entry = GFAPI::get_entry($entry_id);
     //update entry
     $entry[(string) $approvedcolumn] = $approved;
     /** @var bool|WP_Error $result */
     $result = GFAPI::update_entry($entry);
     /**
      * GFAPI::update_entry() doesn't trigger `gform_after_update_entry`, so we trigger updating the meta ourselves.
      */
     self::update_approved_meta($entry_id, $approved);
     // add note to entry
     if ($result === true) {
         $note = empty($approved) ? __('Disapproved the Entry for GravityView', 'gravityview') : __('Approved the Entry for GravityView', 'gravityview');
         if (class_exists('RGFormsModel')) {
             global $current_user;
             get_currentuserinfo();
             RGFormsModel::add_note($entry_id, $current_user->ID, $current_user->display_name, $note);
         }
         /**
          * Destroy the cache for this form
          * @see class-cache.php
          * @since 1.5.1
          */
         do_action('gravityview_clear_form_cache', $form_id);
     } else {
         if (is_wp_error($result)) {
             do_action('gravityview_log_error', __METHOD__ . sprintf(' - Entry approval not updated: %s', $result->get_error_message()));
             $result = false;
         }
     }
     return $result;
 }
开发者ID:psdes,项目名称:GravityView,代码行数:51,代码来源:class-admin-approve-entries.php

示例13: directory_update_approved

 static function directory_update_approved($lead_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0)
 {
     global $wpdb, $_gform_directory_approvedcolumn, $current_user;
     $current_user = wp_get_current_user();
     $user_data = get_userdata($current_user->ID);
     if (!empty($approvedcolumn)) {
         $_gform_directory_approvedcolumn = $approvedcolumn;
     }
     if (empty($_gform_directory_approvedcolumn)) {
         return false;
     }
     $lead_detail_table = RGFormsModel::get_lead_details_table_name();
     // This will be faster in the 1.6+ future.
     if (function_exists('gform_update_meta')) {
         gform_update_meta($lead_id, 'is_approved', $approved);
     }
     if (empty($approved)) {
         //Deleting details for this field
         $sql = $wpdb->prepare("DELETE FROM {$lead_detail_table} WHERE lead_id=%d AND field_number BETWEEN %f AND %f ", $lead_id, $_gform_directory_approvedcolumn - 0.001, $_gform_directory_approvedcolumn + 0.001);
         $wpdb->query($sql);
         RGFormsModel::add_note($lead_id, $current_user->ID, $user_data->display_name, stripslashes(__('Disapproved the lead', 'gravity-forms-addons')));
     } else {
         // Get the fields for the lead
         $current_fields = $wpdb->get_results($wpdb->prepare("SELECT id, field_number FROM {$lead_detail_table} WHERE lead_id=%d", $lead_id));
         $lead_detail_id = RGFormsModel::get_lead_detail_id($current_fields, $_gform_directory_approvedcolumn);
         // If there's already a field for the approved column, then we update it.
         if ($lead_detail_id > 0) {
             $update = $wpdb->update($lead_detail_table, array("value" => $approved), array("lead_id" => $lead_id, 'form_id' => $form_id, 'field_number' => $_gform_directory_approvedcolumn), array("%s"), array("%d", "%d", "%f"));
         } else {
             $update = $wpdb->insert($lead_detail_table, array("lead_id" => $lead_id, "form_id" => $form_id, "field_number" => $_gform_directory_approvedcolumn, "value" => $approved), array("%d", "%d", "%f", "%s"));
         }
         RGFormsModel::add_note($lead_id, $current_user->ID, $user_data->display_name, stripslashes(__('Approved the lead', 'gravity-forms-addons')));
     }
 }
开发者ID:healthcommcore,项目名称:osnap,代码行数:34,代码来源:gravity-forms-addons.php

示例14: set_payment_status

 public static function set_payment_status($config, $entry, $status, $transaction_type, $transaction_id, $subscriber_id, $amount, $profile_status, $period_type, $initial_payment_status, $initial_payment_amount, $initial_payment_transaction_id, $parent_transaction_id, $reason_code)
 {
     global $current_user;
     $user_id = 0;
     $user_name = "System";
     if ($current_user && ($user_data = get_userdata($current_user->ID))) {
         $user_id = $current_user->ID;
         $user_name = $user_data->display_name;
     }
     switch (strtolower($transaction_type)) {
         case "recurring_payment_profile_created":
             if ($profile_status == "Active" && $entry["payment_status"] == "Pending") {
                 //Adding note
                 RGFormsModel::add_note($entry["id"], $user_id, $user_name, __("Pending profile has been approved by PayPal and this subscription has been marked as Active.", "gravityformspaypalpro"));
                 //Marking entry as Active
                 $entry["payment_status"] = "Active";
                 RGFormsModel::update_lead($entry);
                 //Update transaction with transaction_id and payment amount
                 $transactions = GFPayPalProData::get_transactions("signup", $subscriber_id);
                 if (count($transactions) > 0) {
                     $transaction = $transactions[0];
                     $transaction["transaction_id"] = rgpost("initial_payment_txn_id");
                     $transaction["amount"] = rgpost("initial_payment_amount");
                     GFPayPalProData::update_transaction($transaction);
                 } else {
                     //this shoulndn't happen, but create a new transaction if one isn't there
                     $feed_id = gform_get_meta($entry["id"], "paypalpro_feed_id");
                     GFPayPalProData::insert_transaction($entry["id"], $feed_id, "signup", $subscriber_id, $transaction_id, $parent_transaction_id, $initial_payment_amount);
                 }
                 //fulfilling order
                 self::fulfill_order($entry, $subscriber_id, $initial_payment_amount, $amount);
             }
             break;
         case "recurring_payment":
             if ($amount != 0) {
                 $do_fulfillment = false;
                 if ($profile_status == "Active") {
                     if ($period_type == "Trial") {
                         RGFormsModel::add_note($entry["id"], $user_id, $user_name, sprintf(__("Trial payment has been made. Amount: %s. Transaction Id: %s", "gravityforms"), GFCommon::to_money($amount, $entry["currency"]), $transaction_id));
                     } else {
                         RGFormsModel::add_note($entry["id"], $user_id, $user_name, sprintf(__("Subscription payment has been made. Amount: %s. Transaction Id: %s", "gravityforms"), GFCommon::to_money($amount, $entry["currency"]), $transaction_id));
                     }
                     //Setting entry to Active
                     if ($entry["payment_status"] == "Pending") {
                         RGFormsModel::add_note($entry["id"], $user_id, $user_name, __("Pending profile has been approved by PayPal and this subscription has been marked as Active.", "gravityformspaypalpro"));
                         $entry["payment_status"] = "Active";
                         $do_fulfillment = true;
                     }
                 } else {
                     if ($profile_status == "Expired") {
                         $entry["payment_status"] = "Expired";
                         RGFormsModel::add_note($entry["id"], $user_id, $user_name, sprintf(__("Subscription has successfully completed its billing schedule. Subscriber Id: %s", "gravityformspaypalpro"), $subscriber_id));
                     }
                 }
                 RGFormsModel::update_lead($entry);
                 GFPayPalProData::insert_transaction($entry["id"], $config["id"], "payment", $subscriber_id, $transaction_id, $parent_transaction_id, $amount);
                 //fulfilling order
                 if ($do_fulfillment) {
                     self::fulfill_order($entry, $subscriber_id, $initial_payment_amount, $amount);
                 }
             }
             break;
         case "recurring_payment_failed":
             if ($profile_status == "Active") {
                 $entry["payment_status"] = "Failed";
                 RGFormsModel::add_note($entry["id"], $user_id, $user_name, sprintf(__("Subscription payment failed due to a transaction decline, rejection, or error. The gateway will retry to collect payment in the next billing cycle. Subscriber Id: %s", "gravityforms"), $subscriber_id));
             } else {
                 if ($profile_status == "Suspended") {
                     $entry["payment_status"] = "Failed";
                     RGFormsModel::add_note($entry["id"], $user_id, $user_name, sprintf(__("Subscription payment failed due to a transaction decline, rejection, or error. Subscriber Id: %s", "gravityformspaypalpro"), $subscriber_id));
                 }
             }
             RGFormsModel::update_lead($entry);
             break;
         case "recurring_payment_profile_cancel":
             $entry["payment_status"] = "Cancelled";
             RGFormsModel::update_lead($entry);
             RGFormsModel::add_note($entry["id"], $user_id, $user_name, sprintf(__("Subscription has been cancelled. Subscriber Id: %s", "gravityformspaypalpro"), $subscriber_id));
             break;
         case "recurring_payment_suspended_due_to_max_failed_payment":
             $entry["payment_status"] = "Failed";
             RGFormsModel::update_lead($entry);
             RGFormsModel::add_note($entry["id"], $user_id, $user_name, sprintf(__("Subscription is currently suspended as it exceeded maximum number of failed payments allowed. Subscriber Id: %s", "gravityformspaypalpro"), $subscriber_id));
             break;
         default:
             //handles products and donation
             switch (strtolower($status)) {
                 case "reversed":
                     //self::$log->LogDebug("Processing reversal.");
                     if ($entry["payment_status"] != "Reversed") {
                         if ($entry["transaction_type"] == 1) {
                             $entry["payment_status"] = "Reversed";
                             ////self::$log->LogDebug("Setting entry as Reversed");
                             RGFormsModel::update_lead($entry);
                         }
                         RGFormsModel::add_note($entry["id"], $user_id, $user_name, sprintf(__("Payment has been reversed. Transaction Id: %s. Reason: %s", "gravityformspaypalpro"), $transaction_id, self::get_reason($reason_code)));
                     }
                     GFPayPalProData::insert_transaction($entry["id"], $config["id"], "reversal", $subscriber_id, $transaction_id, $parent_transaction_id, $amount);
                     break;
                 case "canceled_reversal":
//.........这里部分代码省略.........
开发者ID:bryanmonzon,项目名称:jenjonesdirect,代码行数:101,代码来源:paypalpro.php

示例15: admin_update_payment

 public static function admin_update_payment($form, $lead_id)
 {
     check_admin_referer('gforms_save_entry', 'gforms_save_entry');
     //update payment information in admin, need to use this function so the lead data is updated before displayed in the sidebar info section
     //check meta to see if this entry is paypal
     $payment_gateway = gform_get_meta($lead_id, "payment_gateway");
     $form_action = strtolower(rgpost("save"));
     if ($payment_gateway != "paypal" || $form_action != "update") {
         return;
     }
     //get lead
     $lead = RGFormsModel::get_lead($lead_id);
     //get payment fields to update
     $payment_status = rgpost("payment_status");
     //when updating, payment status may not be editable, if no value in post, set to lead payment status
     if (empty($payment_status)) {
         $payment_status = $lead["payment_status"];
     }
     $payment_amount = rgpost("payment_amount");
     $payment_transaction = rgpost("paypal_transaction_id");
     $payment_date = rgpost("payment_date");
     if (empty($payment_date)) {
         $payment_date = gmdate("y-m-d H:i:s");
     } else {
         //format date entered by user
         $payment_date = date("Y-m-d H:i:s", strtotime($payment_date));
     }
     global $current_user;
     $user_id = 0;
     $user_name = "System";
     if ($current_user && ($user_data = get_userdata($current_user->ID))) {
         $user_id = $current_user->ID;
         $user_name = $user_data->display_name;
     }
     $lead["payment_status"] = $payment_status;
     $lead["payment_amount"] = $payment_amount;
     $lead["payment_date"] = $payment_date;
     $lead["transaction_id"] = $payment_transaction;
     // if payment status does not equal approved or the lead has already been fulfilled, do not continue with fulfillment
     if ($payment_status == 'Approved' && !$lead["is_fulfilled"]) {
         //call fulfill order, mark lead as fulfilled
         self::fulfill_order($lead, $payment_transaction, $payment_amount);
         $lead["is_fulfilled"] = true;
     }
     //update lead, add a note
     RGFormsModel::update_lead($lead);
     RGFormsModel::add_note($lead["id"], $user_id, $user_name, sprintf(__("Payment information was manually updated. Status: %s. Amount: %s. Transaction Id: %s. Date: %s", "gravityforms"), $lead["payment_status"], GFCommon::to_money($lead["payment_amount"], $lead["currency"]), $payment_transaction, $lead["payment_date"]));
 }
开发者ID:bryanmonzon,项目名称:jenjonesdirect,代码行数:48,代码来源:paypal.php


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