コード例 #1
0
ファイル: Extension.php プロジェクト: daanbakker1995/vanteun
 /**
  * Fulfill order
  *
  * @param array $entry
  */
 public function fulfill_order($entry)
 {
     $feed = get_pronamic_gf_pay_feed_by_entry_id(rgar($entry, 'id'));
     if (null !== $feed) {
         $this->maybe_update_user_role($entry, $feed);
         $form = RGFormsModel::get_form_meta($entry['form_id']);
         // Delay post creation
         // @see https://github.com/gravityforms/gravityforms/blob/1.8.20.5/forms_model.php#L2383
         // @see https://github.com/gravityforms/gravityformspaypal/blob/1.10.3/paypal.php#L2411-L2415
         if ($feed->delay_post_creation) {
             RGFormsModel::create_post($form, $entry);
         }
         // Delay Aweber
         // @see https://github.com/gravityforms/gravityformsaweber/blob/1.4.2/aweber.php#L1167-L1197
         if ($feed->delay_aweber_subscription && Pronamic_WP_Pay_Class::method_exists('GFAWeber', 'export')) {
             call_user_func(array('GFAWeber', 'export'), $entry, $form, false);
             // @since 1.3.0
             // @see https://github.com/gravityforms/gravityformsaweber/blob/2.2.1/aweber.php#L48-L50
             // @see https://github.com/gravityforms/gravityforms/blob/1.9.10.15/includes/addon/class-gf-feed-addon.php#L43
             if (function_exists('gf_aweber')) {
                 $addon = gf_aweber();
                 if (method_exists($addon, 'maybe_process_feed')) {
                     $addon->maybe_process_feed($entry, $form);
                 }
             }
         }
         // Delay Campaign Monitor
         if ($feed->delay_campaignmonitor_subscription) {
             // @see https://github.com/gravityforms/gravityformscampaignmonitor/blob/2.5.1/campaignmonitor.php#L1184
             if (Pronamic_WP_Pay_Class::method_exists('GFCampaignMonitor', 'export')) {
                 call_user_func(array('GFCampaignMonitor', 'export'), $entry, $form, false);
             }
             // @since 1.3.0
             // @see https://github.com/gravityforms/gravityformscampaignmonitor/blob/3.3.2/campaignmonitor.php#L48-L50
             // @see https://github.com/gravityforms/gravityforms/blob/1.9.10.15/includes/addon/class-gf-feed-addon.php#L43
             if (function_exists('gf_campaignmonitor')) {
                 $addon = gf_campaignmonitor();
                 if (method_exists($addon, 'maybe_process_feed')) {
                     $addon->maybe_process_feed($entry, $form);
                 }
             }
         }
         // Delay Mailchimp
         if ($feed->delay_mailchimp_subscription) {
             // @see https://github.com/gravityforms/gravityformsmailchimp/blob/2.4.5/mailchimp.php#L1512
             if (Pronamic_WP_Pay_Class::method_exists('GFMailChimp', 'export')) {
                 call_user_func(array('GFMailChimp', 'export'), $entry, $form, false);
             }
             // @since 1.3.0
             // @see https://github.com/gravityforms/gravityformsmailchimp/blob/3.6.3/mailchimp.php#L48-L50
             // @see https://github.com/gravityforms/gravityforms/blob/1.9.10.15/includes/addon/class-gf-feed-addon.php#L43
             if (function_exists('gf_mailchimp')) {
                 $addon = gf_mailchimp();
                 if (method_exists($addon, 'maybe_process_feed')) {
                     $addon->maybe_process_feed($entry, $form);
                 }
             }
         }
         // Delay Zapier
         // @see https://github.com/gravityforms/gravityformszapier/blob/1.4.2/zapier.php#L469-L533
         if ($feed->delay_zapier && Pronamic_WP_Pay_Class::method_exists('GFZapier', 'send_form_data_to_zapier')) {
             call_user_func(array('GFZapier', 'send_form_data_to_zapier'), $entry, $form);
         }
         // Delay user registration
         // @see https://github.com/gravityforms/gravityformsuserregistration/blob/2.0/userregistration.php#L2133
         if ($feed->delay_user_registration && Pronamic_WP_Pay_Class::method_exists('GFUser', 'gf_create_user')) {
             call_user_func(array('GFUser', 'gf_create_user'), $entry, $form, false);
         }
         // Delay notifications
         // Determine if the feed has Gravity Form 1.7 Feed IDs
         if ($feed->has_delayed_notifications()) {
             // @see https://bitbucket.org/Pronamic/gravityforms/src/42773f75ad7ad9ac9c31ce149510ff825e4aa01f/common.php?at=1.7.8#cl-1512
             GFCommon::send_notifications($feed->delay_notification_ids, $form, $entry, true, 'form_submission');
         }
         if ($feed->delay_admin_notification && Pronamic_WP_Pay_Class::method_exists('GFCommon', 'send_admin_notification')) {
             // https://github.com/gravityforms/gravityforms/blob/1.8.9/common.php#L1265-L1270
             GFCommon::send_admin_notification($form, $entry);
         }
         if ($feed->delay_user_notification && Pronamic_WP_Pay_Class::method_exists('GFCommon', 'send_user_notification')) {
             // https://github.com/gravityforms/gravityforms/blob/1.8.9/common.php#L1258-L1263
             GFCommon::send_user_notification($form, $entry);
         }
     }
     // The Gravity Forms PayPal Add-On executes the 'gform_paypal_fulfillment' action
     do_action('gform_ideal_fulfillment', $entry, $feed);
 }
コード例 #2
0
 /**
  * Pre submission
  */
 public function pre_submission($form)
 {
     if ($this->is_processing($form)) {
         // Delay
         // The Add-Ons mainly use the 'gform_after_submission' to export entries, to delay this we have to remove these
         // actions before this filter executes.
         // @see https://github.com/wp-premium/gravityforms/blob/1.8.16/form_display.php#L101-L103
         // @see https://github.com/wp-premium/gravityforms/blob/1.8.16/form_display.php#L111-L113
         // Maybe delay AWeber subscription
         if ($this->feed->delay_aweber_subscription) {
             // @see https://github.com/wp-premium/gravityformsaweber/blob/1.4.2/aweber.php#L124-L125
             remove_action('gform_post_submission', array('GFAWeber', 'export'), 10, 2);
             // @since 1.3.0
             // @see https://github.com/wp-premium/gravityformsaweber/blob/2.2.1/aweber.php#L48-L50
             // @see https://github.com/wp-premium/gravityforms/blob/1.9.10.15/includes/addon/class-gf-feed-addon.php#L43
             if (function_exists('gf_aweber')) {
                 $addon = gf_aweber();
                 remove_filter('gform_entry_post_save', array($addon, 'maybe_process_feed'), 10, 2);
             }
         }
         // Maybe delay Campaign Monitor subscription
         if ($this->feed->delay_campaignmonitor_subscription) {
             // @see https://github.com/wp-premium/gravityformscampaignmonitor/blob/2.5.1/campaignmonitor.php#L124-L125
             remove_action('gform_after_submission', array('GFCampaignMonitor', 'export'), 10, 2);
             // @since 1.3.0
             // @see https://github.com/wp-premium/gravityformscampaignmonitor/blob/3.3.2/campaignmonitor.php#L48-L50
             // @see https://github.com/wp-premium/gravityforms/blob/1.9.10.15/includes/addon/class-gf-feed-addon.php#L43
             if (function_exists('gf_campaignmonitor')) {
                 $addon = gf_campaignmonitor();
                 remove_filter('gform_entry_post_save', array($addon, 'maybe_process_feed'), 10, 2);
             }
         }
         // Maybe delay MailChimp subscription
         if ($this->feed->delay_mailchimp_subscription) {
             // @see https://github.com/wp-premium/gravityformsmailchimp/blob/2.4.1/mailchimp.php#L120-L121
             remove_action('gform_after_submission', array('GFMailChimp', 'export'), 10, 2);
             // @since 1.3.0
             // @see https://github.com/wp-premium/gravityformsmailchimp/blob/3.6.3/mailchimp.php#L48-L50
             // @see https://github.com/wp-premium/gravityforms/blob/1.9.10.15/includes/addon/class-gf-feed-addon.php#L43
             if (function_exists('gf_mailchimp')) {
                 $addon = gf_mailchimp();
                 remove_filter('gform_entry_post_save', array($addon, 'maybe_process_feed'), 10, 2);
             }
         }
         // Maybe delay Zapier
         if ($this->feed->delay_zapier) {
             // @see https://github.com/wp-premium/gravityformszapier/blob/1.4.2/zapier.php#L106
             remove_action('gform_after_submission', array('GFZapier', 'send_form_data_to_zapier'), 10, 2);
         }
     }
 }