*
 *
 * @package     GravityFlow
 * @subpackage  Classes/Gravity_Flow_Step_Feed_MailChimp
 * @copyright   Copyright (c) 2015, Steven Henty
 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
 * @since       1.0
 */
if (!class_exists('GFForms')) {
    die;
}
class Gravity_Flow_Step_Feed_MailChimp extends Gravity_Flow_Step_Feed_Add_On
{
    public $_step_type = 'mailchimp';
    protected $_class_name = 'GFMailChimp';
    public function get_label()
    {
        return esc_html__('MailChimp', 'gravityflow');
    }
    public function get_icon_url()
    {
        return $this->get_base_url() . '/images/mailchimp.svg';
    }
    function get_feed_label($feed)
    {
        $label = $feed['meta']['feedName'];
        return $label;
    }
}
Gravity_Flow_Steps::register(new Gravity_Flow_Step_Feed_MailChimp());
                }
            }
        }
        GFFormsModel::refresh_product_cache($form, $lead = RGFormsModel::get_lead($lead['id']));
        //saving total field as the last field of the form.
        if (!empty($total_fields)) {
            foreach ($total_fields as $total_field) {
                gravity_flow()->log_debug(__METHOD__ . '(): Saving total field.');
                GFFormsModel::save_input($form, $total_field, $lead, $current_fields, $total_field->id);
                GFFormsModel::refresh_lead_field_value($lead['id'], $total_field->id);
            }
        }
    }
    /**
     * Replace the workflow_note merge tag and the tags in the base step class.
     *
     * @param string $text The text with merge tags.
     * @param Gravity_Flow_Assignee $assignee
     *
     * @return mixed
     */
    public function replace_variables($text, $assignee)
    {
        $text = parent::replace_variables($text, $assignee);
        $comment = rgpost('gravityflow_note');
        $text = str_replace('{workflow_note}', $comment, $text);
        return $text;
    }
}
Gravity_Flow_Steps::register(new Gravity_Flow_Step_User_Input());
        if ($feedback) {
            return $feedback;
        }
        if (!in_array($action, array('approve', 'reject'))) {
            return false;
        }
        $entry_id = rgars($token, 'scopes/entry_id');
        if (empty($entry_id) || $entry_id != $entry['id']) {
            return new WP_Error('incorrect_entry_id', esc_html__('Error: incorrect entry.', 'gravityflow'));
        }
        $step_id = rgars($token, 'scopes/step_id');
        if (empty($step_id) || $step_id != $this->get_id()) {
            return new WP_Error('step_already_processed', esc_html__('Error: step already processed.', 'gravityflow'));
        }
        $assignee_key = sanitize_text_field($token['sub']);
        $assignee = new Gravity_Flow_Assignee($assignee_key, $this);
        $new_status = false;
        switch ($token['scopes']['action']) {
            case 'approve':
                $new_status = 'approved';
                break;
            case 'reject':
                $new_status = 'rejected';
                break;
        }
        $feedback = $this->process_assignee_status($assignee, $new_status, $form);
        return $feedback;
    }
}
Gravity_Flow_Steps::register(new Gravity_Flow_Step_Approval());
        $url = GFCommon::replace_variables($url, $this->get_form(), $entry, true, false, false, 'text');
        $this->log_debug(__METHOD__ . '() - url after replacing variables: ' . $url);
        $method = strtoupper($this->method);
        $body = null;
        $headers = array();
        if (in_array($method, array('POST', 'PUT'))) {
            if ($this->format == 'json') {
                $headers = array('Content-type' => 'application/json');
                $body = json_encode($entry);
            } else {
                $headers = array();
                $body = $entry;
            }
        }
        $args = array('method' => $method, 'timeout' => 45, 'redirection' => 3, 'blocking' => true, 'headers' => $headers, 'body' => $body, 'cookies' => array());
        $args = apply_filters('gravityflow_webhook_args', $args, $entry, $this);
        $response = wp_remote_request($url, $args);
        $this->log_debug(__METHOD__ . '() - response: ' . print_r($response, true));
        if (is_wp_error($response)) {
            $step_status = 'error';
        } else {
            $step_status = 'success';
        }
        $note = esc_html__('Webhook sent. Url: ' . $url);
        $this->add_note($note, 0, 'webhook');
        do_action('gravityflow_post_webhook', $response, $args, $entry, $this);
        return $step_status;
    }
}
Gravity_Flow_Steps::register(new Gravity_Flow_Step_Webhook());
    public function get_label()
    {
        return esc_html__('Zapier', 'gravityflow');
    }
    public function get_icon_url()
    {
        return $this->get_base_url() . '/images/zapier-icon.svg';
    }
    function get_feeds()
    {
        $form_id = $this->get_form_id();
        $feeds = GFZapierData::get_feed_by_form($form_id);
        return $feeds;
    }
    function process_feed($feed)
    {
        $form = $this->get_form();
        $entry = $this->get_entry();
        GFZapier::send_form_data_to_zapier($entry, $form);
    }
    function intercept_submission()
    {
        remove_action('gform_after_submission', array('GFZapier', 'send_form_data_to_zapier'));
    }
    function get_feed_label($feed)
    {
        return $feed['name'];
    }
}
Gravity_Flow_Steps::register(new Gravity_Flow_Step_Feed_Zapier());
<?php

/**
 * Gravity Flow Step Feed Emma
 *
 *
 * @package     GravityFlow
 * @subpackage  Classes/Gravity_Flow_Step_Feed_Emma
 * @copyright   Copyright (c) 2015, Steven Henty
 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
 * @since       1.0
 */
if (!class_exists('GFForms')) {
    die;
}
class Gravity_Flow_Step_Feed_Emma extends Gravity_Flow_Step_Feed_Add_On
{
    public $_step_type = 'emma';
    protected $_class_name = 'GFEmma';
    public function get_label()
    {
        return esc_html__('Emma', 'gravityflow');
    }
    function get_feed_label($feed)
    {
        $label = $feed['meta']['feed_name'];
        return $label;
    }
}
Gravity_Flow_Steps::register(new Gravity_Flow_Step_Feed_Emma());
            return;
        }
        $notification['workflow_notification_type'] = 'workflow';
        $notification['fromName'] = $this->workflow_notification_from_name;
        $notification['from'] = $this->workflow_notification_from_email;
        $notification['replyTo'] = $this->workflow_notification_reply_to;
        $notification['bcc'] = $this->workflow_notification_bcc;
        $notification['subject'] = $this->workflow_notification_subject;
        $notification['message'] = $this->workflow_notification_message;
        $this->send_notifications($assignees, $notification);
        $note = esc_html__('Sent Notification: ', 'gravityflow') . $this->get_name();
        $this->add_note($note);
    }
    /**
     * Replace the workflow_note merge tag and the tags in the base step class.
     *
     * @param string $text The text with merge tags.
     * @param Gravity_Flow_Assignee $assignee
     *
     * @return mixed
     */
    public function replace_variables($text, $assignee)
    {
        $text = parent::replace_variables($text, $assignee);
        $comment = rgpost('gravityflow_note');
        $text = str_replace('{workflow_note}', $comment, $text);
        return $text;
    }
}
Gravity_Flow_Steps::register(new Gravity_Flow_Step_Notification());
<?php

/**
 * Gravity Flow Step Feed Twlio
 *
 *
 * @package     GravityFlow
 * @subpackage  Classes/Gravity_Flow_Step_Feed_Twilio
 * @copyright   Copyright (c) 2015, Steven Henty
 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
 * @since       1.0
 */
if (!class_exists('GFForms')) {
    die;
}
class Gravity_Flow_Step_Feed_Twilio extends Gravity_Flow_Step_Feed_Add_On
{
    public $_step_type = 'twilio';
    protected $_class_name = 'GFTwilio';
    public function get_label()
    {
        return esc_html__('Twilio', 'gravityflow');
    }
    public function get_icon_url()
    {
        return $this->get_base_url() . '/images/twilio-icon-red.svg';
    }
}
Gravity_Flow_Steps::register(new Gravity_Flow_Step_Feed_Twilio());
<?php

/**
 * Gravity Flow Step Feed Campaign Monitor
 *
 *
 * @package     GravityFlow
 * @subpackage  Classes/Gravity_Flow_Step_Feed_Campaign_Monitor
 * @copyright   Copyright (c) 2015, Steven Henty
 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
 * @since       1.0
 */
if (!class_exists('GFForms')) {
    die;
}
class Gravity_Flow_Step_Feed_Campaign_Monitor extends Gravity_Flow_Step_Feed_Add_On
{
    public $_step_type = 'campaign_monitor';
    protected $_class_name = 'GFCampaignMonitor';
    public function get_label()
    {
        return esc_html__('Campaign Monitor', 'gravityflow');
    }
}
Gravity_Flow_Steps::register(new Gravity_Flow_Step_Feed_Campaign_Monitor());
    {
        if (class_exists('GF_User_Registration')) {
            parent::process_feed($feed);
            return;
        }
        $form = $this->get_form();
        $entry = $this->get_entry();
        remove_filter('gform_disable_registration', '__return_true');
        GFUser::gf_create_user($entry, $form);
        // Make sure it's not run twice
        add_filter('gform_disable_registration', '__return_true');
    }
    function intercept_submission()
    {
        if (class_exists('GF_User_Registration')) {
            parent::intercept_submission();
            return;
        }
        add_filter('gform_disable_registration', '__return_true');
    }
    function get_feed_label($feed)
    {
        if (class_exists('GF_User_Registration')) {
            return parent::get_feed_label($feed);
        }
        $label = $feed['meta']['feed_type'] == 'create' ? __('Create', 'gravityflow') : __('Update', 'gravityflow');
        return $label;
    }
}
Gravity_Flow_Steps::register(new Gravity_Flow_Step_Feed_User_Registration());