Completed
Branch 973/fix-visible-recaptcha (0580c7)
by
unknown
03:03 queued 30s
created
EE_Messages_Email_Declined_Registration_Validator.class.php 2 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -15,31 +15,31 @@
 block discarded – undo
15 15
 {
16 16
 
17 17
 
18
-    public function __construct($fields, $context)
19
-    {
20
-        $this->_m_name = 'email';
21
-        $this->_mt_name = 'declined_registration';
18
+	public function __construct($fields, $context)
19
+	{
20
+		$this->_m_name = 'email';
21
+		$this->_mt_name = 'declined_registration';
22 22
 
23
-        parent::__construct($fields, $context);
24
-    }
23
+		parent::__construct($fields, $context);
24
+	}
25 25
 
26
-    /**
27
-     * custom validator (restricting what was originally set by the messenger)
28
-     */
29
-    protected function _modify_validator()
30
-    {
31
-        $new_config = $this->_messenger->get_validator_config();
32
-        // modify just event_list
33
-        $new_config['event_list'] = array(
34
-            'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'),
35
-            'required' => array('[EVENT_LIST]')
36
-            );
37
-        $this->_messenger->set_validator_config($new_config);
26
+	/**
27
+	 * custom validator (restricting what was originally set by the messenger)
28
+	 */
29
+	protected function _modify_validator()
30
+	{
31
+		$new_config = $this->_messenger->get_validator_config();
32
+		// modify just event_list
33
+		$new_config['event_list'] = array(
34
+			'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'),
35
+			'required' => array('[EVENT_LIST]')
36
+			);
37
+		$this->_messenger->set_validator_config($new_config);
38 38
 
39
-        if ($this->_context != 'admin') {
40
-            $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list');
41
-        }
39
+		if ($this->_context != 'admin') {
40
+			$this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list');
41
+		}
42 42
 
43
-        $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]');
44
-    }
43
+		$this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]');
44
+	}
45 45
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
         $this->_messenger->set_validator_config($new_config);
39 39
 
40 40
         if ($this->_context != 'admin') {
41
-            $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list');
41
+            $this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list');
42 42
         }
43 43
 
44 44
         $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]');
Please login to merge, or discard this patch.
payment_reminder/EE_Messages_Email_Payment_Reminder_Validator.class.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -15,37 +15,37 @@
 block discarded – undo
15 15
 {
16 16
 
17 17
 
18
-    public function __construct($fields, $context)
19
-    {
20
-        $this->_m_name = 'email';
21
-        $this->_mt_name = 'payment_reminder';
22
-
23
-        parent::__construct($fields, $context);
24
-    }
25
-
26
-    /**
27
-     * at this point no custom validation needed for this messenger/message_type combo.
28
-     */
29
-    protected function _modify_validator()
30
-    {
31
-        $new_config = $this->_messenger->get_validator_config();
32
-
33
-        // modify just event_list
34
-        $new_config['event_list'] = array(
35
-            'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list')
36
-            );
37
-        $new_config['ticket_list'] = array(
38
-            'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction')
39
-            );
40
-        $new_config['content'] = array(
41
-            'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger')
42
-            );
43
-        $this->_messenger->set_validator_config($new_config);
44
-
45
-        if ($this->_context != 'admin') {
46
-            $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list');
47
-        }
48
-
49
-        $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]');
50
-    }
18
+	public function __construct($fields, $context)
19
+	{
20
+		$this->_m_name = 'email';
21
+		$this->_mt_name = 'payment_reminder';
22
+
23
+		parent::__construct($fields, $context);
24
+	}
25
+
26
+	/**
27
+	 * at this point no custom validation needed for this messenger/message_type combo.
28
+	 */
29
+	protected function _modify_validator()
30
+	{
31
+		$new_config = $this->_messenger->get_validator_config();
32
+
33
+		// modify just event_list
34
+		$new_config['event_list'] = array(
35
+			'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list')
36
+			);
37
+		$new_config['ticket_list'] = array(
38
+			'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction')
39
+			);
40
+		$new_config['content'] = array(
41
+			'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger')
42
+			);
43
+		$this->_messenger->set_validator_config($new_config);
44
+
45
+		if ($this->_context != 'admin') {
46
+			$this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list');
47
+		}
48
+
49
+		$this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]');
50
+	}
51 51
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,18 +32,18 @@
 block discarded – undo
32 32
 
33 33
         // modify just event_list
34 34
         $new_config['event_list'] = array(
35
-            'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list')
35
+            'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list')
36 36
             );
37 37
         $new_config['ticket_list'] = array(
38 38
             'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction')
39 39
             );
40 40
         $new_config['content'] = array(
41
-            'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger')
41
+            'shortcodes' => array('event_list', 'attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger')
42 42
             );
43 43
         $this->_messenger->set_validator_config($new_config);
44 44
 
45 45
         if ($this->_context != 'admin') {
46
-            $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list');
46
+            $this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list');
47 47
         }
48 48
 
49 49
         $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]');
Please login to merge, or discard this patch.
caffeinated/core/libraries/shortcodes/EE_Question_Shortcodes.lib.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -49,15 +49,15 @@  discard block
 block discarded – undo
49 49
     protected function _parser($shortcode)
50 50
     {
51 51
 
52
-        if (! $this->_data instanceof EE_Answer || ! isset($this->_extra_data['data']) || ! $this->_extra_data['data'] instanceof EE_Messages_Addressee) {
52
+        if ( ! $this->_data instanceof EE_Answer || ! isset($this->_extra_data['data']) || ! $this->_extra_data['data'] instanceof EE_Messages_Addressee) {
53 53
             return '';
54 54
         }
55 55
 
56 56
         switch ($shortcode) {
57 57
             case '[QUESTION]':
58
-                $question = isset($this->_extra_data['data']->questions[ $this->_data->ID() ])
59
-                    ? $this->_extra_data['data']->questions[ $this->_data->ID() ] : $this->_data->question();
60
-                if (! $question instanceof EE_Question) {
58
+                $question = isset($this->_extra_data['data']->questions[$this->_data->ID()])
59
+                    ? $this->_extra_data['data']->questions[$this->_data->ID()] : $this->_data->question();
60
+                if ( ! $question instanceof EE_Question) {
61 61
                     return ''; // get out because we can't figure out what the question is.
62 62
                 }
63 63
 
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 
67 67
             case '[ANSWER]':
68 68
                 // need to get the question to determine the type of question (some questions require translation of the answer).
69
-                $question = isset($this->_extra_data['data']->questions[ $this->_data->ID() ])
70
-                    ? $this->_extra_data['data']->questions[ $this->_data->ID() ] : $this->_data->question();
71
-                if (! $question instanceof EE_Question) {
69
+                $question = isset($this->_extra_data['data']->questions[$this->_data->ID()])
70
+                    ? $this->_extra_data['data']->questions[$this->_data->ID()] : $this->_data->question();
71
+                if ( ! $question instanceof EE_Question) {
72 72
                     return ''; // get out cause we can't figure out what the question type is!
73 73
                 }
74 74
 
Please login to merge, or discard this patch.
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -19,85 +19,85 @@
 block discarded – undo
19 19
 {
20 20
 
21 21
 
22
-    /**
23
-     * _init_props
24
-     *
25
-     * @access protected
26
-     * @return void
27
-     */
28
-    protected function _init_props()
29
-    {
30
-        $this->label = esc_html__('Attendee Shortcodes', 'event_espresso');
31
-        $this->description = esc_html__('All shortcodes specific to attendee related data', 'event_espresso');
32
-        $this->_shortcodes = array(
33
-            '[QUESTION]' => esc_html__('Will parse to a question.', 'event_espresso'),
34
-            '[ANSWER]'   => esc_html__('Will parse to the answer for a question', 'event_espresso'),
35
-        );
36
-    }
22
+	/**
23
+	 * _init_props
24
+	 *
25
+	 * @access protected
26
+	 * @return void
27
+	 */
28
+	protected function _init_props()
29
+	{
30
+		$this->label = esc_html__('Attendee Shortcodes', 'event_espresso');
31
+		$this->description = esc_html__('All shortcodes specific to attendee related data', 'event_espresso');
32
+		$this->_shortcodes = array(
33
+			'[QUESTION]' => esc_html__('Will parse to a question.', 'event_espresso'),
34
+			'[ANSWER]'   => esc_html__('Will parse to the answer for a question', 'event_espresso'),
35
+		);
36
+	}
37 37
 
38 38
 
39
-    /**
40
-     * This method will give parsing instructions for each shortcode defined in the _shortcodes array.  Child methods
41
-     * will have to take care of handling.
42
-     *
43
-     * @access protected
44
-     *
45
-     * @param string $shortcode the shortcode to be parsed.
46
-     *
47
-     * @return string parsed shortcode
48
-     */
49
-    protected function _parser($shortcode)
50
-    {
39
+	/**
40
+	 * This method will give parsing instructions for each shortcode defined in the _shortcodes array.  Child methods
41
+	 * will have to take care of handling.
42
+	 *
43
+	 * @access protected
44
+	 *
45
+	 * @param string $shortcode the shortcode to be parsed.
46
+	 *
47
+	 * @return string parsed shortcode
48
+	 */
49
+	protected function _parser($shortcode)
50
+	{
51 51
 
52
-        if (! $this->_data instanceof EE_Answer || ! isset($this->_extra_data['data']) || ! $this->_extra_data['data'] instanceof EE_Messages_Addressee) {
53
-            return '';
54
-        }
52
+		if (! $this->_data instanceof EE_Answer || ! isset($this->_extra_data['data']) || ! $this->_extra_data['data'] instanceof EE_Messages_Addressee) {
53
+			return '';
54
+		}
55 55
 
56
-        switch ($shortcode) {
57
-            case '[QUESTION]':
58
-                $question = isset($this->_extra_data['data']->questions[ $this->_data->ID() ])
59
-                    ? $this->_extra_data['data']->questions[ $this->_data->ID() ] : $this->_data->question();
60
-                if (! $question instanceof EE_Question) {
61
-                    return ''; // get out because we can't figure out what the question is.
62
-                }
56
+		switch ($shortcode) {
57
+			case '[QUESTION]':
58
+				$question = isset($this->_extra_data['data']->questions[ $this->_data->ID() ])
59
+					? $this->_extra_data['data']->questions[ $this->_data->ID() ] : $this->_data->question();
60
+				if (! $question instanceof EE_Question) {
61
+					return ''; // get out because we can't figure out what the question is.
62
+				}
63 63
 
64
-                return $question->get('QST_display_text');
65
-                break;
64
+				return $question->get('QST_display_text');
65
+				break;
66 66
 
67
-            case '[ANSWER]':
68
-                // need to get the question to determine the type of question (some questions require translation of the answer).
69
-                $question = isset($this->_extra_data['data']->questions[ $this->_data->ID() ])
70
-                    ? $this->_extra_data['data']->questions[ $this->_data->ID() ] : $this->_data->question();
71
-                if (! $question instanceof EE_Question) {
72
-                    return ''; // get out cause we can't figure out what the question type is!
73
-                }
67
+			case '[ANSWER]':
68
+				// need to get the question to determine the type of question (some questions require translation of the answer).
69
+				$question = isset($this->_extra_data['data']->questions[ $this->_data->ID() ])
70
+					? $this->_extra_data['data']->questions[ $this->_data->ID() ] : $this->_data->question();
71
+				if (! $question instanceof EE_Question) {
72
+					return ''; // get out cause we can't figure out what the question type is!
73
+				}
74 74
 
75
-                // what we show for the answer depends on the question type!
76
-                switch ($question->get('QST_type')) {
77
-                    case 'STATE':
78
-                        $state = EEM_State::instance()->get_one_by_ID($this->_data->get('ANS_value'));
79
-                        $answer = $state instanceof EE_State ? $state->name() : '';
80
-                        break;
75
+				// what we show for the answer depends on the question type!
76
+				switch ($question->get('QST_type')) {
77
+					case 'STATE':
78
+						$state = EEM_State::instance()->get_one_by_ID($this->_data->get('ANS_value'));
79
+						$answer = $state instanceof EE_State ? $state->name() : '';
80
+						break;
81 81
 
82
-                    case 'COUNTRY':
83
-                        $country = EEM_Country::instance()->get_one_by_ID($this->_data->get('ANS_value'));
84
-                        $answer = $country instanceof EE_Country ? $country->name() : '';
85
-                        break;
82
+					case 'COUNTRY':
83
+						$country = EEM_Country::instance()->get_one_by_ID($this->_data->get('ANS_value'));
84
+						$answer = $country instanceof EE_Country ? $country->name() : '';
85
+						break;
86 86
 
87
-                    default:
88
-                        $answer = $this->_data->get_pretty('ANS_value', 'no_wpautop');
89
-                        break;
90
-                }
87
+					default:
88
+						$answer = $this->_data->get_pretty('ANS_value', 'no_wpautop');
89
+						break;
90
+				}
91 91
 
92
-                return apply_filters(
93
-                    'FHEE__EE_Question_Shortcodes___parser__answer',
94
-                    $answer,
95
-                    $question,
96
-                    $this->_data
97
-                );
98
-                break;
99
-        }
92
+				return apply_filters(
93
+					'FHEE__EE_Question_Shortcodes___parser__answer',
94
+					$answer,
95
+					$question,
96
+					$this->_data
97
+				);
98
+				break;
99
+		}
100 100
 
101
-        return '';
102
-    }
101
+		return '';
102
+	}
103 103
 }
Please login to merge, or discard this patch.
events_archive_caff/templates/admin-event-list-settings.template.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
             </label>
51 51
         </th>
52 52
         <td>
53
-            <p><?php echo site_url() . '/ '
53
+            <p><?php echo site_url().'/ '
54 54
                           . EEH_Form_Fields::text(
55 55
                               'not_used',
56 56
                               EE_Registry::instance()->CFG->core->event_cpt_slug,
Please login to merge, or discard this patch.
Indentation   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -5,18 +5,18 @@  discard block
 block discarded – undo
5 5
 add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string');
6 6
 
7 7
 $values = EEH_Form_Fields::prep_answer_options(
8
-    array(
9
-        array('id' => 1, 'text' => esc_html__('Yes', 'event_espresso')),
10
-        array('id' => 0, 'text' => esc_html__('No', 'event_espresso')),
11
-    )
8
+	array(
9
+		array('id' => 1, 'text' => esc_html__('Yes', 'event_espresso')),
10
+		array('id' => 0, 'text' => esc_html__('No', 'event_espresso')),
11
+	)
12 12
 );
13 13
 
14 14
 $description = EEH_Form_Fields::prep_answer_options(
15
-    array(
16
-        array('id' => 0, 'text' => esc_html__('none', 'event_espresso')),
17
-        array('id' => 1, 'text' => esc_html__('excerpt (short desc)', 'event_espresso')),
18
-        array('id' => 2, 'text' => esc_html__('full description', 'event_espresso')),
19
-    )
15
+	array(
16
+		array('id' => 0, 'text' => esc_html__('none', 'event_espresso')),
17
+		array('id' => 1, 'text' => esc_html__('excerpt (short desc)', 'event_espresso')),
18
+		array('id' => 2, 'text' => esc_html__('full description', 'event_espresso')),
19
+	)
20 20
 );
21 21
 
22 22
 ?>
@@ -35,14 +35,14 @@  discard block
 block discarded – undo
35 35
         <th>
36 36
             <label for="event_listings_url">
37 37
                 <?php esc_html_e('Event Listings URL', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link(
38
-                    'event_listings_url_info'
39
-                ); ?>
38
+					'event_listings_url_info'
39
+				); ?>
40 40
             </label>
41 41
         </th>
42 42
         <td>
43 43
             <a id="event_listings_url" class="ee-admin-settings-hdr-lnk small-text"
44 44
                href="<?php echo EEH_Event_View::event_archive_url(); ?>"><?php
45
-                echo EEH_Event_View::event_archive_url(); ?></a>
45
+				echo EEH_Event_View::event_archive_url(); ?></a>
46 46
         </td>
47 47
     </tr>
48 48
 
@@ -54,30 +54,30 @@  discard block
 block discarded – undo
54 54
         </th>
55 55
         <td>
56 56
             <p><?php echo site_url() . '/ '
57
-                          . EEH_Form_Fields::text(
58
-                              'not_used',
59
-                              EE_Registry::instance()->CFG->core->event_cpt_slug,
60
-                              'event_cpt_slug',
61
-                              'event_cpt_slug',
62
-                              'regular'
63
-                          ); ?></p>
57
+						  . EEH_Form_Fields::text(
58
+							  'not_used',
59
+							  EE_Registry::instance()->CFG->core->event_cpt_slug,
60
+							  'event_cpt_slug',
61
+							  'event_cpt_slug',
62
+							  'regular'
63
+						  ); ?></p>
64 64
             <p class="description"><?php
65
-                esc_html_e(
66
-                    'This allows you to configure what slug is used for the url of all event pages.',
67
-                    'event_espresso'
68
-                ); ?></p>
65
+				esc_html_e(
66
+					'This allows you to configure what slug is used for the url of all event pages.',
67
+					'event_espresso'
68
+				); ?></p>
69 69
             <?php if (has_filter('FHEE__EE_Register_CPTs__register_CPT__rewrite')) : ?>
70 70
                 <p class="important-notice">
71 71
                     <?php
72
-                    sprintf(
73
-                        esc_html__(
74
-                            'Usage of the %1$s FHEE__EE_Register_CPTs__register_CPT__rewrite %2$s filter has been detected.  Please be aware that while this filter is being used, this setting has no affect.',
75
-                            'event_espresso'
76
-                        ),
77
-                        '<code>',
78
-                        '</code>'
79
-                    );
80
-                    ?>
72
+					sprintf(
73
+						esc_html__(
74
+							'Usage of the %1$s FHEE__EE_Register_CPTs__register_CPT__rewrite %2$s filter has been detected.  Please be aware that while this filter is being used, this setting has no affect.',
75
+							'event_espresso'
76
+						),
77
+						'<code>',
78
+						'</code>'
79
+					);
80
+					?>
81 81
                 </p>
82 82
             <?php endif; ?>
83 83
         </td>
@@ -91,17 +91,17 @@  discard block
 block discarded – undo
91 91
         </th>
92 92
         <td>
93 93
             <?php echo EEH_Form_Fields::select(
94
-                'display_status_banner',
95
-                $display_status_banner,
96
-                $values,
97
-                'EED_Events_Archive_display_status_banner',
98
-                'EED_Events_Archive_display_status_banner'
99
-            ); ?>
94
+				'display_status_banner',
95
+				$display_status_banner,
96
+				$values,
97
+				'EED_Events_Archive_display_status_banner',
98
+				'EED_Events_Archive_display_status_banner'
99
+			); ?>
100 100
             <p class="description"><?php
101
-                esc_html_e(
102
-                    'Selecting "Yes" will inject an Event Status banner with the title whenever Events are displaying on the events archive page.',
103
-                    'event_espresso'
104
-                ); ?></p>
101
+				esc_html_e(
102
+					'Selecting "Yes" will inject an Event Status banner with the title whenever Events are displaying on the events archive page.',
103
+					'event_espresso'
104
+				); ?></p>
105 105
         </td>
106 106
     </tr>
107 107
 
@@ -109,18 +109,18 @@  discard block
 block discarded – undo
109 109
         <th>
110 110
             <label for="EED_Events_Archive_display_description">
111 111
                 <?php esc_html_e('Display Description', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link(
112
-                    'display_description_info'
113
-                ); ?>
112
+					'display_description_info'
113
+				); ?>
114 114
             </label>
115 115
         </th>
116 116
         <td>
117 117
             <?php echo EEH_Form_Fields::select(
118
-                'description',
119
-                $display_description,
120
-                $description,
121
-                'EED_Events_Archive_display_description',
122
-                'EED_Events_Archive_display_description'
123
-            ); ?>
118
+				'description',
119
+				$display_description,
120
+				$description,
121
+				'EED_Events_Archive_display_description',
122
+				'EED_Events_Archive_display_description'
123
+			); ?>
124 124
         </td>
125 125
     </tr>
126 126
 
@@ -128,18 +128,18 @@  discard block
 block discarded – undo
128 128
         <th>
129 129
             <label for="EED_Events_Archive_display_ticket_selector">
130 130
                 <?php esc_html_e('Display Ticket Selector', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link(
131
-                    'display_ticket_selector_info'
132
-                ); ?>
131
+					'display_ticket_selector_info'
132
+				); ?>
133 133
             </label>
134 134
         </th>
135 135
         <td>
136 136
             <?php echo EEH_Form_Fields::select(
137
-                'ticket_selector',
138
-                $display_ticket_selector,
139
-                $values,
140
-                'EED_Events_Archive_display_ticket_selector',
141
-                'EED_Events_Archive_display_ticket_selector'
142
-            ); ?>
137
+				'ticket_selector',
138
+				$display_ticket_selector,
139
+				$values,
140
+				'EED_Events_Archive_display_ticket_selector',
141
+				'EED_Events_Archive_display_ticket_selector'
142
+			); ?>
143 143
         </td>
144 144
     </tr>
145 145
 
@@ -147,18 +147,18 @@  discard block
 block discarded – undo
147 147
         <th>
148 148
             <label for="EED_Events_Archive_display_datetimes">
149 149
                 <?php esc_html_e('Display Datetimes', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link(
150
-                    'display_datetimes_info'
151
-                ); ?>
150
+					'display_datetimes_info'
151
+				); ?>
152 152
             </label>
153 153
         </th>
154 154
         <td>
155 155
             <?php echo EEH_Form_Fields::select(
156
-                'venue_details',
157
-                $display_datetimes,
158
-                $values,
159
-                'EED_Events_Archive_display_datetimes',
160
-                'EED_Events_Archive_display_datetimes'
161
-            ); ?>
156
+				'venue_details',
157
+				$display_datetimes,
158
+				$values,
159
+				'EED_Events_Archive_display_datetimes',
160
+				'EED_Events_Archive_display_datetimes'
161
+			); ?>
162 162
         </td>
163 163
     </tr>
164 164
 
@@ -166,18 +166,18 @@  discard block
 block discarded – undo
166 166
         <th>
167 167
             <label for="EED_Events_Archive_display_venue">
168 168
                 <?php esc_html_e('Display Venue Details', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link(
169
-                    'display_venue_details_info'
170
-                ); ?>
169
+					'display_venue_details_info'
170
+				); ?>
171 171
             </label>
172 172
         </th>
173 173
         <td>
174 174
             <?php echo EEH_Form_Fields::select(
175
-                'display_venue',
176
-                $display_venue,
177
-                $values,
178
-                'EED_Events_Archive_display_venue',
179
-                'EED_Events_Archive_display_venue'
180
-            ); ?>
175
+				'display_venue',
176
+				$display_venue,
177
+				$values,
178
+				'EED_Events_Archive_display_venue',
179
+				'EED_Events_Archive_display_venue'
180
+			); ?>
181 181
         </td>
182 182
     </tr>
183 183
 
@@ -185,18 +185,18 @@  discard block
 block discarded – undo
185 185
         <th>
186 186
             <label for="EED_Events_Archive_display_expired_events">
187 187
                 <?php esc_html_e('Display Expired Events', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link(
188
-                    'display_expired_events_info'
189
-                ); ?>
188
+					'display_expired_events_info'
189
+				); ?>
190 190
             </label>
191 191
         </th>
192 192
         <td>
193 193
             <?php echo EEH_Form_Fields::select(
194
-                'expired_events',
195
-                $display_expired_events,
196
-                $values,
197
-                'EED_Events_Archive_display_expired_events',
198
-                'EED_Events_Archive_display_expired_events'
199
-            ); ?>
194
+				'expired_events',
195
+				$display_expired_events,
196
+				$values,
197
+				'EED_Events_Archive_display_expired_events',
198
+				'EED_Events_Archive_display_expired_events'
199
+			); ?>
200 200
         </td>
201 201
     </tr>
202 202
 
@@ -204,43 +204,43 @@  discard block
 block discarded – undo
204 204
         <th>
205 205
             <label for="EED_Events_Archive_use_sortable_display_order">
206 206
                 <?php esc_html_e(
207
-                    'Use Custom Display Order?',
208
-                    'event_espresso'
209
-                ); ?><?php // echo EEH_Template::get_help_tab_link('use_sortable_display_order_info');?>
207
+					'Use Custom Display Order?',
208
+					'event_espresso'
209
+				); ?><?php // echo EEH_Template::get_help_tab_link('use_sortable_display_order_info');?>
210 210
             </label>
211 211
         </th>
212 212
         <td>
213 213
             <?php echo EEH_Form_Fields::select(
214
-                'use_sortable_display_order',
215
-                $use_sortable_display_order,
216
-                $values,
217
-                'EED_Events_Archive_use_sortable_display_order',
218
-                'EED_Events_Archive_use_sortable_display_order'
219
-            ); ?>
214
+				'use_sortable_display_order',
215
+				$use_sortable_display_order,
216
+				$values,
217
+				'EED_Events_Archive_use_sortable_display_order',
218
+				'EED_Events_Archive_use_sortable_display_order'
219
+			); ?>
220 220
         </td>
221 221
     </tr>
222 222
 
223 223
     <tr>
224 224
         <th>
225 225
             <?php esc_html_e(
226
-                'Display Order',
227
-                'event_espresso'
228
-            ); ?><?php // echo EEH_Template::get_help_tab_link( 'event_archive_order_info' ); ?>
226
+				'Display Order',
227
+				'event_espresso'
228
+			); ?><?php // echo EEH_Template::get_help_tab_link( 'event_archive_order_info' ); ?>
229 229
         </th>
230 230
         <td>
231 231
 
232 232
             <?php wp_nonce_field(
233
-                'espresso_update_event_archive_order',
234
-                'espresso_update_event_archive_order_nonce',
235
-                false
236
-            ); ?>
233
+				'espresso_update_event_archive_order',
234
+				'espresso_update_event_archive_order_nonce',
235
+				false
236
+			); ?>
237 237
             <?php echo wp_kses($event_archive_display_order, AllowedTags::getWithFormTags()); ?>
238 238
 
239 239
             <p class="description"><?php
240
-                esc_html_e(
241
-                    'Drag and Drop the above to determine the display order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the event archive page.',
242
-                    'event_espresso'
243
-                ); ?></p>
240
+				esc_html_e(
241
+					'Drag and Drop the above to determine the display order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the event archive page.',
242
+					'event_espresso'
243
+				); ?></p>
244 244
 
245 245
         </td>
246 246
     </tr>
@@ -253,12 +253,12 @@  discard block
 block discarded – undo
253 253
         </th>
254 254
         <td>
255 255
             <?php echo EEH_Form_Fields::select(
256
-                'reset_event_list_settings',
257
-                0,
258
-                $values,
259
-                'EED_Events_Archive_reset_event_list_settings',
260
-                'EED_Events_Archive_reset_event_list_settings'
261
-            ); ?>
256
+				'reset_event_list_settings',
257
+				0,
258
+				$values,
259
+				'EED_Events_Archive_reset_event_list_settings',
260
+				'EED_Events_Archive_reset_event_list_settings'
261
+			); ?>
262 262
         </td>
263 263
     </tr>
264 264
 
Please login to merge, or discard this patch.
caffeinated/modules/recaptcha/templates/recaptcha.template.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 if (! defined('EVENT_ESPRESSO_VERSION')) {
3
-    exit('No direct script access allowed');
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 /** @type string $recaptcha_language */
6 6
 /** @type string $recaptcha_publickey */
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-if (! defined('EVENT_ESPRESSO_VERSION')) {
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3 3
     exit('No direct script access allowed');
4 4
 }
5 5
 /** @type string $recaptcha_language */
Please login to merge, or discard this patch.
caffeinated/payment_methods/Paypal_Pro/EEG_Paypal_Pro.gateway.php 2 patches
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
     public function do_direct_payment($payment, $billing_info = null)
78 78
     {
79 79
         $transaction = $payment->transaction();
80
-        if (! $transaction instanceof EEI_Transaction) {
80
+        if ( ! $transaction instanceof EEI_Transaction) {
81 81
             throw new EE_Error(
82 82
                 esc_html__('No transaction for payment while paying with PayPal Pro.', 'event_espresso')
83 83
             );
84 84
         }
85 85
         $primary_registrant = $transaction->primary_registration();
86
-        if (! $primary_registrant instanceof EEI_Registration) {
86
+        if ( ! $primary_registrant instanceof EEI_Registration) {
87 87
             throw new EE_Error(
88 88
                 esc_html__(
89 89
                     'No primary registration on transaction while paying with PayPal Pro.',
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             );
93 93
         }
94 94
         $attendee = $primary_registrant->attendee();
95
-        if (! $attendee instanceof EEI_Attendee) {
95
+        if ( ! $attendee instanceof EEI_Attendee) {
96 96
             throw new EE_Error(
97 97
                 esc_html__(
98 98
                     'No attendee on primary registration while paying with PayPal Pro.',
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
             // Required.  Credit card number.  No spaces or punctuation.
190 190
             'acct'           => $billing_info['credit_card'],
191 191
             // Required.  Credit card expiration date.  Format is MMYYYY
192
-            'expdate'        => $billing_info['exp_month'] . $billing_info['exp_year'],
192
+            'expdate'        => $billing_info['exp_month'].$billing_info['exp_year'],
193 193
             // Requirements determined by your PayPal account settings.  Security digits for credit card.
194 194
             'cvv2'           => $billing_info['cvv'],
195 195
         );
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
         $ShippingAddress = array(
242 242
             'shiptoname'     => substr($use_registration_address_info
243 243
                 ? $attendee->full_name()
244
-                : $billing_info['first_name'] . ' ' . $billing_info['last_name'], 0, 32),
244
+                : $billing_info['first_name'].' '.$billing_info['last_name'], 0, 32),
245 245
             'shiptostreet'   => substr($use_registration_address_info
246 246
                 ? $attendee->address()
247 247
                 : $billing_info['address'], 0, 100),
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
             'currencycode' => $payment->currency_code(),
271 271
             // Required if you include itemized cart details. (L_AMTn, etc.)
272 272
             // Subtotal of items not including S&H, or tax.
273
-            'itemamt'      => $gateway_formatter->formatCurrency($item_amount),//
273
+            'itemamt'      => $gateway_formatter->formatCurrency($item_amount), //
274 274
             // Total shipping costs for the order.  If you specify shippingamt, you must also specify itemamt.
275 275
             'shippingamt'  => '',
276 276
             // Total handling costs for the order.  If you specify handlingamt, you must also specify itemamt.
@@ -283,10 +283,10 @@  discard block
 block discarded – undo
283 283
             // Free-form field for your own use.  256 char max.
284 284
             'custom'       => $primary_registrant ? $primary_registrant->ID() : '',
285 285
             // Your own invoice or tracking number
286
-            'invnum'       => wp_generate_password(12, false),// $transaction->ID(),
286
+            'invnum'       => wp_generate_password(12, false), // $transaction->ID(),
287 287
             // URL for receiving Instant Payment Notifications.  This overrides what your profile is set to use.
288 288
             'notifyurl'    => '',
289
-            'buttonsource' => 'EventEspresso_SP',// EE will blow up if you change this
289
+            'buttonsource' => 'EventEspresso_SP', // EE will blow up if you change this
290 290
         );
291 291
         // Wrap all data arrays into a single, "master" array which will be passed into the class function.
292 292
         $PayPalRequestData = array(
@@ -396,52 +396,52 @@  discard block
 block discarded – undo
396 396
         // DP Fields
397 397
         $DPFields = isset($DataArray['DPFields']) ? $DataArray['DPFields'] : array();
398 398
         foreach ($DPFields as $DPFieldsVar => $DPFieldsVal) {
399
-            $DPFieldsNVP .= '&' . strtoupper($DPFieldsVar) . '=' . urlencode($DPFieldsVal);
399
+            $DPFieldsNVP .= '&'.strtoupper($DPFieldsVar).'='.urlencode($DPFieldsVal);
400 400
         }
401 401
         // CC Details Fields
402 402
         $CCDetails = isset($DataArray['CCDetails']) ? $DataArray['CCDetails'] : array();
403 403
         foreach ($CCDetails as $CCDetailsVar => $CCDetailsVal) {
404
-            $CCDetailsNVP .= '&' . strtoupper($CCDetailsVar) . '=' . urlencode($CCDetailsVal);
404
+            $CCDetailsNVP .= '&'.strtoupper($CCDetailsVar).'='.urlencode($CCDetailsVal);
405 405
         }
406 406
         // PayerInfo Type Fields
407 407
         $PayerInfo = isset($DataArray['PayerInfo']) ? $DataArray['PayerInfo'] : array();
408 408
         foreach ($PayerInfo as $PayerInfoVar => $PayerInfoVal) {
409
-            $PayerInfoNVP .= '&' . strtoupper($PayerInfoVar) . '=' . urlencode($PayerInfoVal);
409
+            $PayerInfoNVP .= '&'.strtoupper($PayerInfoVar).'='.urlencode($PayerInfoVal);
410 410
         }
411 411
         // Payer Name Fields
412 412
         $PayerName = isset($DataArray['PayerName']) ? $DataArray['PayerName'] : array();
413 413
         foreach ($PayerName as $PayerNameVar => $PayerNameVal) {
414
-            $PayerNameNVP .= '&' . strtoupper($PayerNameVar) . '=' . urlencode($PayerNameVal);
414
+            $PayerNameNVP .= '&'.strtoupper($PayerNameVar).'='.urlencode($PayerNameVal);
415 415
         }
416 416
         // Address Fields (Billing)
417 417
         $BillingAddress = isset($DataArray['BillingAddress']) ? $DataArray['BillingAddress'] : array();
418 418
         foreach ($BillingAddress as $BillingAddressVar => $BillingAddressVal) {
419
-            $BillingAddressNVP .= '&' . strtoupper($BillingAddressVar) . '=' . urlencode($BillingAddressVal);
419
+            $BillingAddressNVP .= '&'.strtoupper($BillingAddressVar).'='.urlencode($BillingAddressVal);
420 420
         }
421 421
         // Payment Details Type Fields
422 422
         $PaymentDetails = isset($DataArray['PaymentDetails']) ? $DataArray['PaymentDetails'] : array();
423 423
         foreach ($PaymentDetails as $PaymentDetailsVar => $PaymentDetailsVal) {
424
-            $PaymentDetailsNVP .= '&' . strtoupper($PaymentDetailsVar) . '=' . urlencode($PaymentDetailsVal);
424
+            $PaymentDetailsNVP .= '&'.strtoupper($PaymentDetailsVar).'='.urlencode($PaymentDetailsVal);
425 425
         }
426 426
         // Payment Details Item Type Fields
427 427
         $OrderItems = isset($DataArray['OrderItems']) ? $DataArray['OrderItems'] : array();
428 428
         $n = 0;
429 429
         foreach ($OrderItems as $OrderItemsVar => $OrderItemsVal) {
430
-            $CurrentItem = $OrderItems[ $OrderItemsVar ];
430
+            $CurrentItem = $OrderItems[$OrderItemsVar];
431 431
             foreach ($CurrentItem as $CurrentItemVar => $CurrentItemVal) {
432
-                $OrderItemsNVP .= '&' . strtoupper($CurrentItemVar) . $n . '=' . urlencode($CurrentItemVal);
432
+                $OrderItemsNVP .= '&'.strtoupper($CurrentItemVar).$n.'='.urlencode($CurrentItemVal);
433 433
             }
434 434
             $n++;
435 435
         }
436 436
         // Ship To Address Fields
437 437
         $ShippingAddress = isset($DataArray['ShippingAddress']) ? $DataArray['ShippingAddress'] : array();
438 438
         foreach ($ShippingAddress as $ShippingAddressVar => $ShippingAddressVal) {
439
-            $ShippingAddressNVP .= '&' . strtoupper($ShippingAddressVar) . '=' . urlencode($ShippingAddressVal);
439
+            $ShippingAddressNVP .= '&'.strtoupper($ShippingAddressVar).'='.urlencode($ShippingAddressVal);
440 440
         }
441 441
         // 3D Secure Fields
442 442
         $Secure3D = isset($DataArray['Secure3D']) ? $DataArray['Secure3D'] : array();
443 443
         foreach ($Secure3D as $Secure3DVar => $Secure3DVal) {
444
-            $Secure3DNVP .= '&' . strtoupper($Secure3DVar) . '=' . urlencode($Secure3DVal);
444
+            $Secure3DNVP .= '&'.strtoupper($Secure3DVar).'='.urlencode($Secure3DVal);
445 445
         }
446 446
         // Now that we have each chunk we need to go ahead and append them all together for our entire NVP string
447 447
         $NVPRequest = 'USER='
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
             $valuepos = strpos($NVPString, '&') ? strpos($NVPString, '&') : strlen($NVPString);
513 513
             $valval = substr($NVPString, $keypos + 1, $valuepos - $keypos - 1);
514 514
             // decoding the response
515
-            $proArray[ $keyval ] = urldecode($valval);
515
+            $proArray[$keyval] = urldecode($valval);
516 516
             $NVPString = substr($NVPString, $valuepos + 1, strlen($NVPString));
517 517
         }
518 518
         return $proArray;
@@ -545,16 +545,16 @@  discard block
 block discarded – undo
545 545
     {
546 546
         $Errors = array();
547 547
         $n = 0;
548
-        while (isset($DataArray[ 'L_ERRORCODE' . $n . '' ])) {
549
-            $LErrorCode = isset($DataArray[ 'L_ERRORCODE' . $n . '' ]) ? $DataArray[ 'L_ERRORCODE' . $n . '' ] : '';
550
-            $LShortMessage = isset($DataArray[ 'L_SHORTMESSAGE' . $n . '' ])
551
-                ? $DataArray[ 'L_SHORTMESSAGE' . $n . '' ]
548
+        while (isset($DataArray['L_ERRORCODE'.$n.''])) {
549
+            $LErrorCode = isset($DataArray['L_ERRORCODE'.$n.'']) ? $DataArray['L_ERRORCODE'.$n.''] : '';
550
+            $LShortMessage = isset($DataArray['L_SHORTMESSAGE'.$n.''])
551
+                ? $DataArray['L_SHORTMESSAGE'.$n.'']
552 552
                 : '';
553
-            $LLongMessage = isset($DataArray[ 'L_LONGMESSAGE' . $n . '' ])
554
-                ? $DataArray[ 'L_LONGMESSAGE' . $n . '' ]
553
+            $LLongMessage = isset($DataArray['L_LONGMESSAGE'.$n.''])
554
+                ? $DataArray['L_LONGMESSAGE'.$n.'']
555 555
                 : '';
556
-            $LSeverityCode = isset($DataArray[ 'L_SEVERITYCODE' . $n . '' ])
557
-                ? $DataArray[ 'L_SEVERITYCODE' . $n . '' ]
556
+            $LSeverityCode = isset($DataArray['L_SEVERITYCODE'.$n.''])
557
+                ? $DataArray['L_SEVERITYCODE'.$n.'']
558 558
                 : '';
559 559
             $CurrentItem = array(
560 560
                 'L_ERRORCODE'    => $LErrorCode,
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
     {
582 582
         $error = '';
583 583
         foreach ($Errors as $ErrorVar => $ErrorVal) {
584
-            $CurrentError = $Errors[ $ErrorVar ];
584
+            $CurrentError = $Errors[$ErrorVar];
585 585
             foreach ($CurrentError as $CurrentErrorVar => $CurrentErrorVal) {
586 586
                 $CurrentVarName = '';
587 587
                 if ($CurrentErrorVar == 'L_ERRORCODE') {
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
                 } elseif ($CurrentErrorVar == 'L_SEVERITYCODE') {
594 594
                     $CurrentVarName = 'Severity Code';
595 595
                 }
596
-                $error .= '<br />' . $CurrentVarName . ': ' . $CurrentErrorVal;
596
+                $error .= '<br />'.$CurrentVarName.': '.$CurrentErrorVal;
597 597
             }
598 598
         }
599 599
         return $error;
Please login to merge, or discard this patch.
Indentation   +606 added lines, -606 removed lines patch added patch discarded remove patch
@@ -14,610 +14,610 @@
 block discarded – undo
14 14
 class EEG_Paypal_Pro extends EE_Onsite_Gateway
15 15
 {
16 16
 
17
-    /**
18
-     * @var $_paypal_api_username string
19
-     */
20
-    protected $_api_username = null;
21
-
22
-    /**
23
-     * @var $_api_password string
24
-     */
25
-    protected $_api_password = null;
26
-
27
-    /**
28
-     * @var $_api_signature string
29
-     */
30
-    protected $_api_signature = null;
31
-
32
-    /**
33
-     * @var $_credit_card_types array with the keys for credit card types accepted on this account
34
-     */
35
-    protected $_credit_card_types    = null;
36
-
37
-    protected $_currencies_supported = array(
38
-        'USD',
39
-        'GBP',
40
-        'CAD',
41
-        'AUD',
42
-        'BRL',
43
-        'CHF',
44
-        'CZK',
45
-        'DKK',
46
-        'EUR',
47
-        'HKD',
48
-        'HUF',
49
-        'ILS',
50
-        'JPY',
51
-        'MXN',
52
-        'MYR',
53
-        'NOK',
54
-        'NZD',
55
-        'PHP',
56
-        'PLN',
57
-        'SEK',
58
-        'SGD',
59
-        'THB',
60
-        'TRY',
61
-        'TWD',
62
-        'RUB',
63
-        'INR',
64
-    );
65
-
66
-
67
-
68
-    /**
69
-     * @param EEI_Payment $payment
70
-     * @param array       $billing_info {
71
-     * @type string $credit_card
72
-     * @type string $credit_card_type
73
-     * @type string $exp_month always 2 characters
74
-     * @type string $exp_year always 4 characters
75
-     * @type string $cvv
76
-     * }
77
-     * @see      parent::do_direct_payment for more info
78
-     * @return EE_Payment|EEI_Payment
79
-     * @throws EE_Error
80
-     */
81
-    public function do_direct_payment($payment, $billing_info = null)
82
-    {
83
-        $transaction = $payment->transaction();
84
-        if (! $transaction instanceof EEI_Transaction) {
85
-            throw new EE_Error(
86
-                esc_html__('No transaction for payment while paying with PayPal Pro.', 'event_espresso')
87
-            );
88
-        }
89
-        $primary_registrant = $transaction->primary_registration();
90
-        if (! $primary_registrant instanceof EEI_Registration) {
91
-            throw new EE_Error(
92
-                esc_html__(
93
-                    'No primary registration on transaction while paying with PayPal Pro.',
94
-                    'event_espresso'
95
-                )
96
-            );
97
-        }
98
-        $attendee = $primary_registrant->attendee();
99
-        if (! $attendee instanceof EEI_Attendee) {
100
-            throw new EE_Error(
101
-                esc_html__(
102
-                    'No attendee on primary registration while paying with PayPal Pro.',
103
-                    'event_espresso'
104
-                )
105
-            );
106
-        }
107
-        $gateway_formatter = $this->_get_gateway_formatter();
108
-        $order_description = substr($gateway_formatter->formatOrderDescription($payment), 0, 127);
109
-        // charge for the full amount. Show itemized list
110
-        if ($this->_money->compare_floats($payment->amount(), $transaction->total(), '==')) {
111
-            $item_num = 1;
112
-            $total_line_item = $transaction->total_line_item();
113
-            $order_items = array();
114
-            foreach ($total_line_item->get_items() as $line_item) {
115
-                // ignore line items with a quantity of 0
116
-                if ($line_item->quantity() == 0) {
117
-                    continue;
118
-                }
119
-                // For percent items, whose unit_price is 0, use the total instead.
120
-                if ($line_item->is_percent()) {
121
-                    $unit_price = $line_item->total();
122
-                    $line_item_quantity = 1;
123
-                } else {
124
-                    $unit_price = $line_item->unit_price();
125
-                    $line_item_quantity = $line_item->quantity();
126
-                }
127
-                $item = array(
128
-                    // Item Name.  127 char max.
129
-                    'l_name'                 => substr(
130
-                        $gateway_formatter->formatLineItemName($line_item, $payment),
131
-                        0,
132
-                        127
133
-                    ),
134
-                    // Item description.  127 char max.
135
-                    'l_desc'                 => substr(
136
-                        $gateway_formatter->formatLineItemDesc($line_item, $payment),
137
-                        0,
138
-                        127
139
-                    ),
140
-                    // Cost of individual item.
141
-                    'l_amt'                  => $unit_price,
142
-                    // Item Number.  127 char max.
143
-                    'l_number'               => $item_num++,
144
-                    // Item quantity.  Must be any positive integer.
145
-                    'l_qty'                  => $line_item_quantity,
146
-                    // Item's sales tax amount.
147
-                    'l_taxamt'               => '',
148
-                    // eBay auction number of item.
149
-                    'l_ebayitemnumber'       => '',
150
-                    // eBay transaction ID of purchased item.
151
-                    'l_ebayitemauctiontxnid' => '',
152
-                    // eBay order ID for the item.
153
-                    'l_ebayitemorderid'      => '',
154
-                );
155
-                // add to array of all items
156
-                array_push($order_items, $item);
157
-            }
158
-            $item_amount = $total_line_item->get_items_total();
159
-            $tax_amount = $total_line_item->get_total_tax();
160
-        } else {
161
-            $order_items = array();
162
-            $item_amount = $payment->amount();
163
-            $tax_amount = 0;
164
-            array_push($order_items, array(
165
-                // Item Name.  127 char max.
166
-                'l_name'   => substr(
167
-                    $gateway_formatter->formatPartialPaymentLineItemName($payment),
168
-                    0,
169
-                    127
170
-                ),
171
-                // Item description.  127 char max.
172
-                'l_desc'   => substr(
173
-                    $gateway_formatter->formatPartialPaymentLineItemDesc($payment),
174
-                    0,
175
-                    127
176
-                ),
177
-                // Cost of individual item.
178
-                'l_amt'    => $payment->amount(),
179
-                // Item Number.  127 char max.
180
-                'l_number' => 1,
181
-                // Item quantity.  Must be any positive integer.
182
-                'l_qty'    => 1,
183
-            ));
184
-        }
185
-
186
-
187
-        /** @var RequestInterface $request */
188
-        $request = LoaderFactory::getLoader()->getShared(RequestInterface::class);
189
-        // Populate data arrays with order data.
190
-        $DPFields = array(
191
-            // How you want to obtain payment ?
192
-            // Authorization indicates the payment is a basic auth subject to settlement with Auth & Capture.
193
-            // Sale indicates that this is a final sale for which you are requesting payment.  Default is Sale.
194
-            'paymentaction'    => 'Sale',
195
-            // Required.  IP address of the payer's browser.
196
-            'ipaddress'        => $request->ipAddress(),
197
-            // Flag to determine whether you want the results returned by FMF.  1 or 0.  Default is 0.
198
-            'returnfmfdetails' => '1',
199
-        );
200
-        $CCDetails = array(
201
-            // Required. Type of credit card.  Visa, MasterCard, Discover, Amex, Maestro, Solo.
202
-            // If Maestro or Solo, the currency code must be GBP.
203
-            //  In addition, either start date or issue number must be specified.
204
-            'creditcardtype' => $billing_info['credit_card_type'],
205
-            // Required.  Credit card number.  No spaces or punctuation.
206
-            'acct'           => $billing_info['credit_card'],
207
-            // Required.  Credit card expiration date.  Format is MMYYYY
208
-            'expdate'        => $billing_info['exp_month'] . $billing_info['exp_year'],
209
-            // Requirements determined by your PayPal account settings.  Security digits for credit card.
210
-            'cvv2'           => $billing_info['cvv'],
211
-        );
212
-        $PayerInfo = array(
213
-            // Email address of payer.
214
-            'email'       => $billing_info['email'],
215
-            // Unique PayPal customer ID for payer.
216
-            'payerid'     => '',
217
-            // Status of payer.  Values are verified or unverified
218
-            'payerstatus' => '',
219
-            // Payer's business name.
220
-            'business'    => '',
221
-        );
222
-        $PayerName = array(
223
-            // Payer's salutation.  20 char max.
224
-            'salutation' => '',
225
-            // Payer's first name.  25 char max.
226
-            'firstname'  => substr($billing_info['first_name'], 0, 25),
227
-            // Payer's middle name.  25 char max.
228
-            'middlename' => '',
229
-            // Payer's last name.  25 char max.
230
-            'lastname'   => substr($billing_info['last_name'], 0, 25),
231
-            // Payer's suffix.  12 char max.
232
-            'suffix'     => '',
233
-        );
234
-        $BillingAddress = array(
235
-            // Required.  First street address.
236
-            'street'      => $billing_info['address'],
237
-            // Second street address.
238
-            'street2'     => $billing_info['address2'],
239
-            // Required.  Name of City.
240
-            'city'        => $billing_info['city'],
241
-            // Required. Name of State or Province.
242
-            'state'       => substr($billing_info['state'], 0, 40),
243
-            // Required.  Country code.
244
-            'countrycode' => $billing_info['country'],
245
-            // Required.  Postal code of payer.
246
-            'zip'         => $billing_info['zip'],
247
-        );
248
-        // check if the registration info contains the needed fields for paypal pro
249
-        // (see https://developer.paypal.com/docs/classic/api/merchant/DoDirectPayment_API_Operation_NVP/)
250
-        if ($attendee->address() && $attendee->city() && $attendee->country_ID()) {
251
-            $use_registration_address_info = true;
252
-        } else {
253
-            $use_registration_address_info = false;
254
-        }
255
-        // so if the attendee has enough data to fill out PayPal Pro's shipping info, use it.
256
-        // If not, use the billing info again
257
-        $ShippingAddress = array(
258
-            'shiptoname'     => substr($use_registration_address_info
259
-                ? $attendee->full_name()
260
-                : $billing_info['first_name'] . ' ' . $billing_info['last_name'], 0, 32),
261
-            'shiptostreet'   => substr($use_registration_address_info
262
-                ? $attendee->address()
263
-                : $billing_info['address'], 0, 100),
264
-            'shiptostreet2'  => substr($use_registration_address_info
265
-                ? $attendee->address2() : $billing_info['address2'], 0, 100),
266
-            'shiptocity'     => substr($use_registration_address_info
267
-                ? $attendee->city()
268
-                : $billing_info['city'], 0, 40),
269
-            'shiptostate'          => substr($use_registration_address_info
270
-                ? $attendee->state_name()
271
-                : $billing_info['state'], 0, 40),
272
-            'shiptocountry'  => $use_registration_address_info
273
-                ? $attendee->country_ID()
274
-                : $billing_info['country'],
275
-            'shiptozip'      => substr($use_registration_address_info
276
-                ? $attendee->zip()
277
-                : $billing_info['zip'], 0, 20),
278
-            'shiptophonenum' => substr($use_registration_address_info
279
-                ? $attendee->phone()
280
-                : $billing_info['phone'], 0, 20),
281
-        );
282
-        $PaymentDetails = array(
283
-            // Required.  Total amount of order, including shipping, handling, and tax.
284
-            'amt'          => $gateway_formatter->formatCurrency($payment->amount()),
285
-            // Required.  Three-letter currency code.  Default is USD.
286
-            'currencycode' => $payment->currency_code(),
287
-            // Required if you include itemized cart details. (L_AMTn, etc.)
288
-            // Subtotal of items not including S&H, or tax.
289
-            'itemamt'      => $gateway_formatter->formatCurrency($item_amount),//
290
-            // Total shipping costs for the order.  If you specify shippingamt, you must also specify itemamt.
291
-            'shippingamt'  => '',
292
-            // Total handling costs for the order.  If you specify handlingamt, you must also specify itemamt.
293
-            'handlingamt'  => '',
294
-            // Required if you specify itemized cart tax details.
295
-            // Sum of tax for all items on the order.  Total sales tax.
296
-            'taxamt'       => $gateway_formatter->formatCurrency($tax_amount),
297
-            // Description of the order the customer is purchasing.  127 char max.
298
-            'desc'         => $order_description,
299
-            // Free-form field for your own use.  256 char max.
300
-            'custom'       => $primary_registrant ? $primary_registrant->ID() : '',
301
-            // Your own invoice or tracking number
302
-            'invnum'       => wp_generate_password(12, false),// $transaction->ID(),
303
-            // URL for receiving Instant Payment Notifications.  This overrides what your profile is set to use.
304
-            'notifyurl'    => '',
305
-            'buttonsource' => 'EventEspresso_SP',// EE will blow up if you change this
306
-        );
307
-        // Wrap all data arrays into a single, "master" array which will be passed into the class function.
308
-        $PayPalRequestData = array(
309
-            'DPFields'        => $DPFields,
310
-            'CCDetails'       => $CCDetails,
311
-            'PayerInfo'       => $PayerInfo,
312
-            'PayerName'       => $PayerName,
313
-            'BillingAddress'  => $BillingAddress,
314
-            'ShippingAddress' => $ShippingAddress,
315
-            'PaymentDetails'  => $PaymentDetails,
316
-            'OrderItems'      => $order_items,
317
-        );
318
-        $this->_log_clean_request($PayPalRequestData, $payment);
319
-        try {
320
-            $PayPalResult = $this->prep_and_curl_request($PayPalRequestData);
321
-            // remove PCI-sensitive data so it doesn't get stored
322
-            $PayPalResult = $this->_log_clean_response($PayPalResult, $payment);
323
-            if (isset($PayPalResult['L_ERRORCODE0']) && $PayPalResult['L_ERRORCODE0'] === '10002') {
324
-                $message = esc_html__('PayPal did not accept your API username, password, or signature. Please double-check these credentials and if debug mode is on.', 'event_espresso');
325
-            } elseif (isset($PayPalResult['L_LONGMESSAGE0'])) {
326
-                $message = $PayPalResult['L_LONGMESSAGE0'];
327
-            } else {
328
-                $message = $PayPalResult['ACK'];
329
-            }
330
-            if (empty($PayPalResult['RAWRESPONSE'])) {
331
-                $payment->set_status($this->_pay_model->failed_status());
332
-                $payment->set_gateway_response(esc_html__('No response received from Paypal Pro', 'event_espresso'));
333
-                $payment->set_details($PayPalResult);
334
-            } else {
335
-                if ($this->_APICallSuccessful($PayPalResult)) {
336
-                    $payment->set_status($this->_pay_model->approved_status());
337
-                } else {
338
-                    $payment->set_status($this->_pay_model->declined_status());
339
-                }
340
-                // make sure we interpret the AMT as a float, not an international string
341
-                // (where periods are thousand separators)
342
-                $payment->set_amount(isset($PayPalResult['AMT']) ? floatval($PayPalResult['AMT']) : 0);
343
-                $payment->set_gateway_response($message);
344
-                $payment->set_txn_id_chq_nmbr(isset($PayPalResult['TRANSACTIONID'])
345
-                    ? $PayPalResult['TRANSACTIONID']
346
-                    : null);
347
-                $primary_registration_code = $primary_registrant instanceof EE_Registration
348
-                    ? $primary_registrant->reg_code()
349
-                    : '';
350
-                $payment->set_extra_accntng($primary_registration_code);
351
-                $payment->set_details($PayPalResult);
352
-            }
353
-        } catch (Exception $e) {
354
-            $payment->set_status($this->_pay_model->failed_status());
355
-            $payment->set_gateway_response($e->getMessage());
356
-        }
357
-        // $payment->set_status( $this->_pay_model->declined_status() );
358
-        // $payment->set_gateway_response( '' );
359
-        return $payment;
360
-    }
361
-
362
-
363
-
364
-    /**
365
-     * CLeans out sensitive CC data and then logs it, and returns the cleaned request
366
-     *
367
-     * @param array       $request
368
-     * @param EEI_Payment $payment
369
-     * @return void
370
-     */
371
-    private function _log_clean_request($request, $payment)
372
-    {
373
-        $cleaned_request_data = $request;
374
-        unset($cleaned_request_data['CCDetails']['acct']);
375
-        unset($cleaned_request_data['CCDetails']['cvv2']);
376
-        unset($cleaned_request_data['CCDetails']['expdate']);
377
-        $this->log(array('Paypal Request' => $cleaned_request_data), $payment);
378
-    }
379
-
380
-
381
-
382
-    /**
383
-     * Cleans the response, logs it, and returns it
384
-     *
385
-     * @param array       $response
386
-     * @param EEI_Payment $payment
387
-     * @return array cleaned
388
-     */
389
-    private function _log_clean_response($response, $payment)
390
-    {
391
-        unset($response['REQUESTDATA']['CREDITCARDTYPE']);
392
-        unset($response['REQUESTDATA']['ACCT']);
393
-        unset($response['REQUESTDATA']['EXPDATE']);
394
-        unset($response['REQUESTDATA']['CVV2']);
395
-        unset($response['RAWREQUEST']);
396
-        $this->log(array('Paypal Response' => $response), $payment);
397
-        return $response;
398
-    }
399
-
400
-
401
-
402
-    /**
403
-     * @param $DataArray
404
-     * @return array
405
-     */
406
-    private function prep_and_curl_request($DataArray)
407
-    {
408
-        // Create empty holders for each portion of the NVP string
409
-        $DPFieldsNVP = '&METHOD=DoDirectPayment&BUTTONSOURCE=AngellEYE_PHP_Class_DDP';
410
-        $CCDetailsNVP = '';
411
-        $PayerInfoNVP = '';
412
-        $PayerNameNVP = '';
413
-        $BillingAddressNVP = '';
414
-        $ShippingAddressNVP = '';
415
-        $PaymentDetailsNVP = '';
416
-        $OrderItemsNVP = '';
417
-        $Secure3DNVP = '';
418
-        // DP Fields
419
-        $DPFields = isset($DataArray['DPFields']) ? $DataArray['DPFields'] : array();
420
-        foreach ($DPFields as $DPFieldsVar => $DPFieldsVal) {
421
-            $DPFieldsNVP .= '&' . strtoupper($DPFieldsVar) . '=' . urlencode($DPFieldsVal);
422
-        }
423
-        // CC Details Fields
424
-        $CCDetails = isset($DataArray['CCDetails']) ? $DataArray['CCDetails'] : array();
425
-        foreach ($CCDetails as $CCDetailsVar => $CCDetailsVal) {
426
-            $CCDetailsNVP .= '&' . strtoupper($CCDetailsVar) . '=' . urlencode($CCDetailsVal);
427
-        }
428
-        // PayerInfo Type Fields
429
-        $PayerInfo = isset($DataArray['PayerInfo']) ? $DataArray['PayerInfo'] : array();
430
-        foreach ($PayerInfo as $PayerInfoVar => $PayerInfoVal) {
431
-            $PayerInfoNVP .= '&' . strtoupper($PayerInfoVar) . '=' . urlencode($PayerInfoVal);
432
-        }
433
-        // Payer Name Fields
434
-        $PayerName = isset($DataArray['PayerName']) ? $DataArray['PayerName'] : array();
435
-        foreach ($PayerName as $PayerNameVar => $PayerNameVal) {
436
-            $PayerNameNVP .= '&' . strtoupper($PayerNameVar) . '=' . urlencode($PayerNameVal);
437
-        }
438
-        // Address Fields (Billing)
439
-        $BillingAddress = isset($DataArray['BillingAddress']) ? $DataArray['BillingAddress'] : array();
440
-        foreach ($BillingAddress as $BillingAddressVar => $BillingAddressVal) {
441
-            $BillingAddressNVP .= '&' . strtoupper($BillingAddressVar) . '=' . urlencode($BillingAddressVal);
442
-        }
443
-        // Payment Details Type Fields
444
-        $PaymentDetails = isset($DataArray['PaymentDetails']) ? $DataArray['PaymentDetails'] : array();
445
-        foreach ($PaymentDetails as $PaymentDetailsVar => $PaymentDetailsVal) {
446
-            $PaymentDetailsNVP .= '&' . strtoupper($PaymentDetailsVar) . '=' . urlencode($PaymentDetailsVal);
447
-        }
448
-        // Payment Details Item Type Fields
449
-        $OrderItems = isset($DataArray['OrderItems']) ? $DataArray['OrderItems'] : array();
450
-        $n = 0;
451
-        foreach ($OrderItems as $OrderItemsVar => $OrderItemsVal) {
452
-            $CurrentItem = $OrderItems[ $OrderItemsVar ];
453
-            foreach ($CurrentItem as $CurrentItemVar => $CurrentItemVal) {
454
-                $OrderItemsNVP .= '&' . strtoupper($CurrentItemVar) . $n . '=' . urlencode($CurrentItemVal);
455
-            }
456
-            $n++;
457
-        }
458
-        // Ship To Address Fields
459
-        $ShippingAddress = isset($DataArray['ShippingAddress']) ? $DataArray['ShippingAddress'] : array();
460
-        foreach ($ShippingAddress as $ShippingAddressVar => $ShippingAddressVal) {
461
-            $ShippingAddressNVP .= '&' . strtoupper($ShippingAddressVar) . '=' . urlencode($ShippingAddressVal);
462
-        }
463
-        // 3D Secure Fields
464
-        $Secure3D = isset($DataArray['Secure3D']) ? $DataArray['Secure3D'] : array();
465
-        foreach ($Secure3D as $Secure3DVar => $Secure3DVal) {
466
-            $Secure3DNVP .= '&' . strtoupper($Secure3DVar) . '=' . urlencode($Secure3DVal);
467
-        }
468
-        // Now that we have each chunk we need to go ahead and append them all together for our entire NVP string
469
-        $NVPRequest = 'USER='
470
-                      . $this->_api_username
471
-                      . '&PWD='
472
-                      . $this->_api_password
473
-                      . '&VERSION=64.0'
474
-                      . '&SIGNATURE='
475
-                      . $this->_api_signature
476
-                      . $DPFieldsNVP
477
-                      . $CCDetailsNVP
478
-                      . $PayerInfoNVP
479
-                      . $PayerNameNVP
480
-                      . $BillingAddressNVP
481
-                      . $PaymentDetailsNVP
482
-                      . $OrderItemsNVP
483
-                      . $ShippingAddressNVP
484
-                      . $Secure3DNVP;
485
-        $NVPResponse = $this->_CURLRequest($NVPRequest);
486
-        $NVPRequestArray = $this->_NVPToArray($NVPRequest);
487
-        $NVPResponseArray = $this->_NVPToArray($NVPResponse);
488
-        $Errors = $this->_GetErrors($NVPResponseArray);
489
-        $NVPResponseArray['ERRORS'] = $Errors;
490
-        $NVPResponseArray['REQUESTDATA'] = $NVPRequestArray;
491
-        $NVPResponseArray['RAWREQUEST'] = $NVPRequest;
492
-        $NVPResponseArray['RAWRESPONSE'] = $NVPResponse;
493
-        return $NVPResponseArray;
494
-    }
495
-
496
-
497
-
498
-    /**
499
-     * @param $Request
500
-     * @return mixed
501
-     */
502
-    private function _CURLRequest($Request)
503
-    {
504
-        $EndPointURL = $this->_debug_mode ? 'https://api-3t.sandbox.paypal.com/nvp' : 'https://api-3t.paypal.com/nvp';
505
-        $curl = curl_init();
506
-        curl_setopt($curl, CURLOPT_VERBOSE, apply_filters('FHEE__EEG_Paypal_Pro__CurlRequest__CURLOPT_VERBOSE', true));
507
-        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
508
-        curl_setopt($curl, CURLOPT_TIMEOUT, 60);
509
-        curl_setopt($curl, CURLOPT_URL, $EndPointURL);
510
-        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
511
-        curl_setopt($curl, CURLOPT_POSTFIELDS, $Request);
512
-        curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
513
-        // execute the curl POST
514
-        $Response = curl_exec($curl);
515
-        curl_close($curl);
516
-        return $Response;
517
-    }
518
-
519
-
520
-
521
-    /**
522
-     * @param $NVPString
523
-     * @return array
524
-     */
525
-    private function _NVPToArray($NVPString)
526
-    {
527
-        // prepare responses into array
528
-        $proArray = array();
529
-        while (strlen($NVPString)) {
530
-            // name
531
-            $keypos = strpos($NVPString, '=');
532
-            $keyval = substr($NVPString, 0, $keypos);
533
-            // value
534
-            $valuepos = strpos($NVPString, '&') ? strpos($NVPString, '&') : strlen($NVPString);
535
-            $valval = substr($NVPString, $keypos + 1, $valuepos - $keypos - 1);
536
-            // decoding the response
537
-            $proArray[ $keyval ] = urldecode($valval);
538
-            $NVPString = substr($NVPString, $valuepos + 1, strlen($NVPString));
539
-        }
540
-        return $proArray;
541
-    }
542
-
543
-
544
-
545
-    /**
546
-     * @param array $PayPalResult
547
-     * @return bool
548
-     */
549
-    private function _APICallSuccessful($PayPalResult)
550
-    {
551
-        $approved = false;
552
-        // check main response message from PayPal
553
-        if (isset($PayPalResult['ACK']) && ! empty($PayPalResult['ACK'])) {
554
-            $ack = strtoupper($PayPalResult['ACK']);
555
-            $approved = ($ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING' || $ack == 'PARTIALSUCCESS') ? true : false;
556
-        }
557
-        return $approved;
558
-    }
559
-
560
-
561
-
562
-    /**
563
-     * @param $DataArray
564
-     * @return array
565
-     */
566
-    private function _GetErrors($DataArray)
567
-    {
568
-        $Errors = array();
569
-        $n = 0;
570
-        while (isset($DataArray[ 'L_ERRORCODE' . $n . '' ])) {
571
-            $LErrorCode = isset($DataArray[ 'L_ERRORCODE' . $n . '' ]) ? $DataArray[ 'L_ERRORCODE' . $n . '' ] : '';
572
-            $LShortMessage = isset($DataArray[ 'L_SHORTMESSAGE' . $n . '' ])
573
-                ? $DataArray[ 'L_SHORTMESSAGE' . $n . '' ]
574
-                : '';
575
-            $LLongMessage = isset($DataArray[ 'L_LONGMESSAGE' . $n . '' ])
576
-                ? $DataArray[ 'L_LONGMESSAGE' . $n . '' ]
577
-                : '';
578
-            $LSeverityCode = isset($DataArray[ 'L_SEVERITYCODE' . $n . '' ])
579
-                ? $DataArray[ 'L_SEVERITYCODE' . $n . '' ]
580
-                : '';
581
-            $CurrentItem = array(
582
-                'L_ERRORCODE'    => $LErrorCode,
583
-                'L_SHORTMESSAGE' => $LShortMessage,
584
-                'L_LONGMESSAGE'  => $LLongMessage,
585
-                'L_SEVERITYCODE' => $LSeverityCode,
586
-            );
587
-            array_push($Errors, $CurrentItem);
588
-            $n++;
589
-        }
590
-        return $Errors;
591
-    }
592
-
593
-
594
-
595
-    /**
596
-     *        nothing to see here...  move along....
597
-     *
598
-     * @access protected
599
-     * @param $Errors
600
-     * @return string
601
-     */
602
-    private function _DisplayErrors($Errors)
603
-    {
604
-        $error = '';
605
-        foreach ($Errors as $ErrorVar => $ErrorVal) {
606
-            $CurrentError = $Errors[ $ErrorVar ];
607
-            foreach ($CurrentError as $CurrentErrorVar => $CurrentErrorVal) {
608
-                $CurrentVarName = '';
609
-                if ($CurrentErrorVar == 'L_ERRORCODE') {
610
-                    $CurrentVarName = 'Error Code';
611
-                } elseif ($CurrentErrorVar == 'L_SHORTMESSAGE') {
612
-                    $CurrentVarName = 'Short Message';
613
-                } elseif ($CurrentErrorVar == 'L_LONGMESSAGE') {
614
-                    $CurrentVarName = 'Long Message';
615
-                } elseif ($CurrentErrorVar == 'L_SEVERITYCODE') {
616
-                    $CurrentVarName = 'Severity Code';
617
-                }
618
-                $error .= '<br />' . $CurrentVarName . ': ' . $CurrentErrorVal;
619
-            }
620
-        }
621
-        return $error;
622
-    }
17
+	/**
18
+	 * @var $_paypal_api_username string
19
+	 */
20
+	protected $_api_username = null;
21
+
22
+	/**
23
+	 * @var $_api_password string
24
+	 */
25
+	protected $_api_password = null;
26
+
27
+	/**
28
+	 * @var $_api_signature string
29
+	 */
30
+	protected $_api_signature = null;
31
+
32
+	/**
33
+	 * @var $_credit_card_types array with the keys for credit card types accepted on this account
34
+	 */
35
+	protected $_credit_card_types    = null;
36
+
37
+	protected $_currencies_supported = array(
38
+		'USD',
39
+		'GBP',
40
+		'CAD',
41
+		'AUD',
42
+		'BRL',
43
+		'CHF',
44
+		'CZK',
45
+		'DKK',
46
+		'EUR',
47
+		'HKD',
48
+		'HUF',
49
+		'ILS',
50
+		'JPY',
51
+		'MXN',
52
+		'MYR',
53
+		'NOK',
54
+		'NZD',
55
+		'PHP',
56
+		'PLN',
57
+		'SEK',
58
+		'SGD',
59
+		'THB',
60
+		'TRY',
61
+		'TWD',
62
+		'RUB',
63
+		'INR',
64
+	);
65
+
66
+
67
+
68
+	/**
69
+	 * @param EEI_Payment $payment
70
+	 * @param array       $billing_info {
71
+	 * @type string $credit_card
72
+	 * @type string $credit_card_type
73
+	 * @type string $exp_month always 2 characters
74
+	 * @type string $exp_year always 4 characters
75
+	 * @type string $cvv
76
+	 * }
77
+	 * @see      parent::do_direct_payment for more info
78
+	 * @return EE_Payment|EEI_Payment
79
+	 * @throws EE_Error
80
+	 */
81
+	public function do_direct_payment($payment, $billing_info = null)
82
+	{
83
+		$transaction = $payment->transaction();
84
+		if (! $transaction instanceof EEI_Transaction) {
85
+			throw new EE_Error(
86
+				esc_html__('No transaction for payment while paying with PayPal Pro.', 'event_espresso')
87
+			);
88
+		}
89
+		$primary_registrant = $transaction->primary_registration();
90
+		if (! $primary_registrant instanceof EEI_Registration) {
91
+			throw new EE_Error(
92
+				esc_html__(
93
+					'No primary registration on transaction while paying with PayPal Pro.',
94
+					'event_espresso'
95
+				)
96
+			);
97
+		}
98
+		$attendee = $primary_registrant->attendee();
99
+		if (! $attendee instanceof EEI_Attendee) {
100
+			throw new EE_Error(
101
+				esc_html__(
102
+					'No attendee on primary registration while paying with PayPal Pro.',
103
+					'event_espresso'
104
+				)
105
+			);
106
+		}
107
+		$gateway_formatter = $this->_get_gateway_formatter();
108
+		$order_description = substr($gateway_formatter->formatOrderDescription($payment), 0, 127);
109
+		// charge for the full amount. Show itemized list
110
+		if ($this->_money->compare_floats($payment->amount(), $transaction->total(), '==')) {
111
+			$item_num = 1;
112
+			$total_line_item = $transaction->total_line_item();
113
+			$order_items = array();
114
+			foreach ($total_line_item->get_items() as $line_item) {
115
+				// ignore line items with a quantity of 0
116
+				if ($line_item->quantity() == 0) {
117
+					continue;
118
+				}
119
+				// For percent items, whose unit_price is 0, use the total instead.
120
+				if ($line_item->is_percent()) {
121
+					$unit_price = $line_item->total();
122
+					$line_item_quantity = 1;
123
+				} else {
124
+					$unit_price = $line_item->unit_price();
125
+					$line_item_quantity = $line_item->quantity();
126
+				}
127
+				$item = array(
128
+					// Item Name.  127 char max.
129
+					'l_name'                 => substr(
130
+						$gateway_formatter->formatLineItemName($line_item, $payment),
131
+						0,
132
+						127
133
+					),
134
+					// Item description.  127 char max.
135
+					'l_desc'                 => substr(
136
+						$gateway_formatter->formatLineItemDesc($line_item, $payment),
137
+						0,
138
+						127
139
+					),
140
+					// Cost of individual item.
141
+					'l_amt'                  => $unit_price,
142
+					// Item Number.  127 char max.
143
+					'l_number'               => $item_num++,
144
+					// Item quantity.  Must be any positive integer.
145
+					'l_qty'                  => $line_item_quantity,
146
+					// Item's sales tax amount.
147
+					'l_taxamt'               => '',
148
+					// eBay auction number of item.
149
+					'l_ebayitemnumber'       => '',
150
+					// eBay transaction ID of purchased item.
151
+					'l_ebayitemauctiontxnid' => '',
152
+					// eBay order ID for the item.
153
+					'l_ebayitemorderid'      => '',
154
+				);
155
+				// add to array of all items
156
+				array_push($order_items, $item);
157
+			}
158
+			$item_amount = $total_line_item->get_items_total();
159
+			$tax_amount = $total_line_item->get_total_tax();
160
+		} else {
161
+			$order_items = array();
162
+			$item_amount = $payment->amount();
163
+			$tax_amount = 0;
164
+			array_push($order_items, array(
165
+				// Item Name.  127 char max.
166
+				'l_name'   => substr(
167
+					$gateway_formatter->formatPartialPaymentLineItemName($payment),
168
+					0,
169
+					127
170
+				),
171
+				// Item description.  127 char max.
172
+				'l_desc'   => substr(
173
+					$gateway_formatter->formatPartialPaymentLineItemDesc($payment),
174
+					0,
175
+					127
176
+				),
177
+				// Cost of individual item.
178
+				'l_amt'    => $payment->amount(),
179
+				// Item Number.  127 char max.
180
+				'l_number' => 1,
181
+				// Item quantity.  Must be any positive integer.
182
+				'l_qty'    => 1,
183
+			));
184
+		}
185
+
186
+
187
+		/** @var RequestInterface $request */
188
+		$request = LoaderFactory::getLoader()->getShared(RequestInterface::class);
189
+		// Populate data arrays with order data.
190
+		$DPFields = array(
191
+			// How you want to obtain payment ?
192
+			// Authorization indicates the payment is a basic auth subject to settlement with Auth & Capture.
193
+			// Sale indicates that this is a final sale for which you are requesting payment.  Default is Sale.
194
+			'paymentaction'    => 'Sale',
195
+			// Required.  IP address of the payer's browser.
196
+			'ipaddress'        => $request->ipAddress(),
197
+			// Flag to determine whether you want the results returned by FMF.  1 or 0.  Default is 0.
198
+			'returnfmfdetails' => '1',
199
+		);
200
+		$CCDetails = array(
201
+			// Required. Type of credit card.  Visa, MasterCard, Discover, Amex, Maestro, Solo.
202
+			// If Maestro or Solo, the currency code must be GBP.
203
+			//  In addition, either start date or issue number must be specified.
204
+			'creditcardtype' => $billing_info['credit_card_type'],
205
+			// Required.  Credit card number.  No spaces or punctuation.
206
+			'acct'           => $billing_info['credit_card'],
207
+			// Required.  Credit card expiration date.  Format is MMYYYY
208
+			'expdate'        => $billing_info['exp_month'] . $billing_info['exp_year'],
209
+			// Requirements determined by your PayPal account settings.  Security digits for credit card.
210
+			'cvv2'           => $billing_info['cvv'],
211
+		);
212
+		$PayerInfo = array(
213
+			// Email address of payer.
214
+			'email'       => $billing_info['email'],
215
+			// Unique PayPal customer ID for payer.
216
+			'payerid'     => '',
217
+			// Status of payer.  Values are verified or unverified
218
+			'payerstatus' => '',
219
+			// Payer's business name.
220
+			'business'    => '',
221
+		);
222
+		$PayerName = array(
223
+			// Payer's salutation.  20 char max.
224
+			'salutation' => '',
225
+			// Payer's first name.  25 char max.
226
+			'firstname'  => substr($billing_info['first_name'], 0, 25),
227
+			// Payer's middle name.  25 char max.
228
+			'middlename' => '',
229
+			// Payer's last name.  25 char max.
230
+			'lastname'   => substr($billing_info['last_name'], 0, 25),
231
+			// Payer's suffix.  12 char max.
232
+			'suffix'     => '',
233
+		);
234
+		$BillingAddress = array(
235
+			// Required.  First street address.
236
+			'street'      => $billing_info['address'],
237
+			// Second street address.
238
+			'street2'     => $billing_info['address2'],
239
+			// Required.  Name of City.
240
+			'city'        => $billing_info['city'],
241
+			// Required. Name of State or Province.
242
+			'state'       => substr($billing_info['state'], 0, 40),
243
+			// Required.  Country code.
244
+			'countrycode' => $billing_info['country'],
245
+			// Required.  Postal code of payer.
246
+			'zip'         => $billing_info['zip'],
247
+		);
248
+		// check if the registration info contains the needed fields for paypal pro
249
+		// (see https://developer.paypal.com/docs/classic/api/merchant/DoDirectPayment_API_Operation_NVP/)
250
+		if ($attendee->address() && $attendee->city() && $attendee->country_ID()) {
251
+			$use_registration_address_info = true;
252
+		} else {
253
+			$use_registration_address_info = false;
254
+		}
255
+		// so if the attendee has enough data to fill out PayPal Pro's shipping info, use it.
256
+		// If not, use the billing info again
257
+		$ShippingAddress = array(
258
+			'shiptoname'     => substr($use_registration_address_info
259
+				? $attendee->full_name()
260
+				: $billing_info['first_name'] . ' ' . $billing_info['last_name'], 0, 32),
261
+			'shiptostreet'   => substr($use_registration_address_info
262
+				? $attendee->address()
263
+				: $billing_info['address'], 0, 100),
264
+			'shiptostreet2'  => substr($use_registration_address_info
265
+				? $attendee->address2() : $billing_info['address2'], 0, 100),
266
+			'shiptocity'     => substr($use_registration_address_info
267
+				? $attendee->city()
268
+				: $billing_info['city'], 0, 40),
269
+			'shiptostate'          => substr($use_registration_address_info
270
+				? $attendee->state_name()
271
+				: $billing_info['state'], 0, 40),
272
+			'shiptocountry'  => $use_registration_address_info
273
+				? $attendee->country_ID()
274
+				: $billing_info['country'],
275
+			'shiptozip'      => substr($use_registration_address_info
276
+				? $attendee->zip()
277
+				: $billing_info['zip'], 0, 20),
278
+			'shiptophonenum' => substr($use_registration_address_info
279
+				? $attendee->phone()
280
+				: $billing_info['phone'], 0, 20),
281
+		);
282
+		$PaymentDetails = array(
283
+			// Required.  Total amount of order, including shipping, handling, and tax.
284
+			'amt'          => $gateway_formatter->formatCurrency($payment->amount()),
285
+			// Required.  Three-letter currency code.  Default is USD.
286
+			'currencycode' => $payment->currency_code(),
287
+			// Required if you include itemized cart details. (L_AMTn, etc.)
288
+			// Subtotal of items not including S&H, or tax.
289
+			'itemamt'      => $gateway_formatter->formatCurrency($item_amount),//
290
+			// Total shipping costs for the order.  If you specify shippingamt, you must also specify itemamt.
291
+			'shippingamt'  => '',
292
+			// Total handling costs for the order.  If you specify handlingamt, you must also specify itemamt.
293
+			'handlingamt'  => '',
294
+			// Required if you specify itemized cart tax details.
295
+			// Sum of tax for all items on the order.  Total sales tax.
296
+			'taxamt'       => $gateway_formatter->formatCurrency($tax_amount),
297
+			// Description of the order the customer is purchasing.  127 char max.
298
+			'desc'         => $order_description,
299
+			// Free-form field for your own use.  256 char max.
300
+			'custom'       => $primary_registrant ? $primary_registrant->ID() : '',
301
+			// Your own invoice or tracking number
302
+			'invnum'       => wp_generate_password(12, false),// $transaction->ID(),
303
+			// URL for receiving Instant Payment Notifications.  This overrides what your profile is set to use.
304
+			'notifyurl'    => '',
305
+			'buttonsource' => 'EventEspresso_SP',// EE will blow up if you change this
306
+		);
307
+		// Wrap all data arrays into a single, "master" array which will be passed into the class function.
308
+		$PayPalRequestData = array(
309
+			'DPFields'        => $DPFields,
310
+			'CCDetails'       => $CCDetails,
311
+			'PayerInfo'       => $PayerInfo,
312
+			'PayerName'       => $PayerName,
313
+			'BillingAddress'  => $BillingAddress,
314
+			'ShippingAddress' => $ShippingAddress,
315
+			'PaymentDetails'  => $PaymentDetails,
316
+			'OrderItems'      => $order_items,
317
+		);
318
+		$this->_log_clean_request($PayPalRequestData, $payment);
319
+		try {
320
+			$PayPalResult = $this->prep_and_curl_request($PayPalRequestData);
321
+			// remove PCI-sensitive data so it doesn't get stored
322
+			$PayPalResult = $this->_log_clean_response($PayPalResult, $payment);
323
+			if (isset($PayPalResult['L_ERRORCODE0']) && $PayPalResult['L_ERRORCODE0'] === '10002') {
324
+				$message = esc_html__('PayPal did not accept your API username, password, or signature. Please double-check these credentials and if debug mode is on.', 'event_espresso');
325
+			} elseif (isset($PayPalResult['L_LONGMESSAGE0'])) {
326
+				$message = $PayPalResult['L_LONGMESSAGE0'];
327
+			} else {
328
+				$message = $PayPalResult['ACK'];
329
+			}
330
+			if (empty($PayPalResult['RAWRESPONSE'])) {
331
+				$payment->set_status($this->_pay_model->failed_status());
332
+				$payment->set_gateway_response(esc_html__('No response received from Paypal Pro', 'event_espresso'));
333
+				$payment->set_details($PayPalResult);
334
+			} else {
335
+				if ($this->_APICallSuccessful($PayPalResult)) {
336
+					$payment->set_status($this->_pay_model->approved_status());
337
+				} else {
338
+					$payment->set_status($this->_pay_model->declined_status());
339
+				}
340
+				// make sure we interpret the AMT as a float, not an international string
341
+				// (where periods are thousand separators)
342
+				$payment->set_amount(isset($PayPalResult['AMT']) ? floatval($PayPalResult['AMT']) : 0);
343
+				$payment->set_gateway_response($message);
344
+				$payment->set_txn_id_chq_nmbr(isset($PayPalResult['TRANSACTIONID'])
345
+					? $PayPalResult['TRANSACTIONID']
346
+					: null);
347
+				$primary_registration_code = $primary_registrant instanceof EE_Registration
348
+					? $primary_registrant->reg_code()
349
+					: '';
350
+				$payment->set_extra_accntng($primary_registration_code);
351
+				$payment->set_details($PayPalResult);
352
+			}
353
+		} catch (Exception $e) {
354
+			$payment->set_status($this->_pay_model->failed_status());
355
+			$payment->set_gateway_response($e->getMessage());
356
+		}
357
+		// $payment->set_status( $this->_pay_model->declined_status() );
358
+		// $payment->set_gateway_response( '' );
359
+		return $payment;
360
+	}
361
+
362
+
363
+
364
+	/**
365
+	 * CLeans out sensitive CC data and then logs it, and returns the cleaned request
366
+	 *
367
+	 * @param array       $request
368
+	 * @param EEI_Payment $payment
369
+	 * @return void
370
+	 */
371
+	private function _log_clean_request($request, $payment)
372
+	{
373
+		$cleaned_request_data = $request;
374
+		unset($cleaned_request_data['CCDetails']['acct']);
375
+		unset($cleaned_request_data['CCDetails']['cvv2']);
376
+		unset($cleaned_request_data['CCDetails']['expdate']);
377
+		$this->log(array('Paypal Request' => $cleaned_request_data), $payment);
378
+	}
379
+
380
+
381
+
382
+	/**
383
+	 * Cleans the response, logs it, and returns it
384
+	 *
385
+	 * @param array       $response
386
+	 * @param EEI_Payment $payment
387
+	 * @return array cleaned
388
+	 */
389
+	private function _log_clean_response($response, $payment)
390
+	{
391
+		unset($response['REQUESTDATA']['CREDITCARDTYPE']);
392
+		unset($response['REQUESTDATA']['ACCT']);
393
+		unset($response['REQUESTDATA']['EXPDATE']);
394
+		unset($response['REQUESTDATA']['CVV2']);
395
+		unset($response['RAWREQUEST']);
396
+		$this->log(array('Paypal Response' => $response), $payment);
397
+		return $response;
398
+	}
399
+
400
+
401
+
402
+	/**
403
+	 * @param $DataArray
404
+	 * @return array
405
+	 */
406
+	private function prep_and_curl_request($DataArray)
407
+	{
408
+		// Create empty holders for each portion of the NVP string
409
+		$DPFieldsNVP = '&METHOD=DoDirectPayment&BUTTONSOURCE=AngellEYE_PHP_Class_DDP';
410
+		$CCDetailsNVP = '';
411
+		$PayerInfoNVP = '';
412
+		$PayerNameNVP = '';
413
+		$BillingAddressNVP = '';
414
+		$ShippingAddressNVP = '';
415
+		$PaymentDetailsNVP = '';
416
+		$OrderItemsNVP = '';
417
+		$Secure3DNVP = '';
418
+		// DP Fields
419
+		$DPFields = isset($DataArray['DPFields']) ? $DataArray['DPFields'] : array();
420
+		foreach ($DPFields as $DPFieldsVar => $DPFieldsVal) {
421
+			$DPFieldsNVP .= '&' . strtoupper($DPFieldsVar) . '=' . urlencode($DPFieldsVal);
422
+		}
423
+		// CC Details Fields
424
+		$CCDetails = isset($DataArray['CCDetails']) ? $DataArray['CCDetails'] : array();
425
+		foreach ($CCDetails as $CCDetailsVar => $CCDetailsVal) {
426
+			$CCDetailsNVP .= '&' . strtoupper($CCDetailsVar) . '=' . urlencode($CCDetailsVal);
427
+		}
428
+		// PayerInfo Type Fields
429
+		$PayerInfo = isset($DataArray['PayerInfo']) ? $DataArray['PayerInfo'] : array();
430
+		foreach ($PayerInfo as $PayerInfoVar => $PayerInfoVal) {
431
+			$PayerInfoNVP .= '&' . strtoupper($PayerInfoVar) . '=' . urlencode($PayerInfoVal);
432
+		}
433
+		// Payer Name Fields
434
+		$PayerName = isset($DataArray['PayerName']) ? $DataArray['PayerName'] : array();
435
+		foreach ($PayerName as $PayerNameVar => $PayerNameVal) {
436
+			$PayerNameNVP .= '&' . strtoupper($PayerNameVar) . '=' . urlencode($PayerNameVal);
437
+		}
438
+		// Address Fields (Billing)
439
+		$BillingAddress = isset($DataArray['BillingAddress']) ? $DataArray['BillingAddress'] : array();
440
+		foreach ($BillingAddress as $BillingAddressVar => $BillingAddressVal) {
441
+			$BillingAddressNVP .= '&' . strtoupper($BillingAddressVar) . '=' . urlencode($BillingAddressVal);
442
+		}
443
+		// Payment Details Type Fields
444
+		$PaymentDetails = isset($DataArray['PaymentDetails']) ? $DataArray['PaymentDetails'] : array();
445
+		foreach ($PaymentDetails as $PaymentDetailsVar => $PaymentDetailsVal) {
446
+			$PaymentDetailsNVP .= '&' . strtoupper($PaymentDetailsVar) . '=' . urlencode($PaymentDetailsVal);
447
+		}
448
+		// Payment Details Item Type Fields
449
+		$OrderItems = isset($DataArray['OrderItems']) ? $DataArray['OrderItems'] : array();
450
+		$n = 0;
451
+		foreach ($OrderItems as $OrderItemsVar => $OrderItemsVal) {
452
+			$CurrentItem = $OrderItems[ $OrderItemsVar ];
453
+			foreach ($CurrentItem as $CurrentItemVar => $CurrentItemVal) {
454
+				$OrderItemsNVP .= '&' . strtoupper($CurrentItemVar) . $n . '=' . urlencode($CurrentItemVal);
455
+			}
456
+			$n++;
457
+		}
458
+		// Ship To Address Fields
459
+		$ShippingAddress = isset($DataArray['ShippingAddress']) ? $DataArray['ShippingAddress'] : array();
460
+		foreach ($ShippingAddress as $ShippingAddressVar => $ShippingAddressVal) {
461
+			$ShippingAddressNVP .= '&' . strtoupper($ShippingAddressVar) . '=' . urlencode($ShippingAddressVal);
462
+		}
463
+		// 3D Secure Fields
464
+		$Secure3D = isset($DataArray['Secure3D']) ? $DataArray['Secure3D'] : array();
465
+		foreach ($Secure3D as $Secure3DVar => $Secure3DVal) {
466
+			$Secure3DNVP .= '&' . strtoupper($Secure3DVar) . '=' . urlencode($Secure3DVal);
467
+		}
468
+		// Now that we have each chunk we need to go ahead and append them all together for our entire NVP string
469
+		$NVPRequest = 'USER='
470
+					  . $this->_api_username
471
+					  . '&PWD='
472
+					  . $this->_api_password
473
+					  . '&VERSION=64.0'
474
+					  . '&SIGNATURE='
475
+					  . $this->_api_signature
476
+					  . $DPFieldsNVP
477
+					  . $CCDetailsNVP
478
+					  . $PayerInfoNVP
479
+					  . $PayerNameNVP
480
+					  . $BillingAddressNVP
481
+					  . $PaymentDetailsNVP
482
+					  . $OrderItemsNVP
483
+					  . $ShippingAddressNVP
484
+					  . $Secure3DNVP;
485
+		$NVPResponse = $this->_CURLRequest($NVPRequest);
486
+		$NVPRequestArray = $this->_NVPToArray($NVPRequest);
487
+		$NVPResponseArray = $this->_NVPToArray($NVPResponse);
488
+		$Errors = $this->_GetErrors($NVPResponseArray);
489
+		$NVPResponseArray['ERRORS'] = $Errors;
490
+		$NVPResponseArray['REQUESTDATA'] = $NVPRequestArray;
491
+		$NVPResponseArray['RAWREQUEST'] = $NVPRequest;
492
+		$NVPResponseArray['RAWRESPONSE'] = $NVPResponse;
493
+		return $NVPResponseArray;
494
+	}
495
+
496
+
497
+
498
+	/**
499
+	 * @param $Request
500
+	 * @return mixed
501
+	 */
502
+	private function _CURLRequest($Request)
503
+	{
504
+		$EndPointURL = $this->_debug_mode ? 'https://api-3t.sandbox.paypal.com/nvp' : 'https://api-3t.paypal.com/nvp';
505
+		$curl = curl_init();
506
+		curl_setopt($curl, CURLOPT_VERBOSE, apply_filters('FHEE__EEG_Paypal_Pro__CurlRequest__CURLOPT_VERBOSE', true));
507
+		curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
508
+		curl_setopt($curl, CURLOPT_TIMEOUT, 60);
509
+		curl_setopt($curl, CURLOPT_URL, $EndPointURL);
510
+		curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
511
+		curl_setopt($curl, CURLOPT_POSTFIELDS, $Request);
512
+		curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
513
+		// execute the curl POST
514
+		$Response = curl_exec($curl);
515
+		curl_close($curl);
516
+		return $Response;
517
+	}
518
+
519
+
520
+
521
+	/**
522
+	 * @param $NVPString
523
+	 * @return array
524
+	 */
525
+	private function _NVPToArray($NVPString)
526
+	{
527
+		// prepare responses into array
528
+		$proArray = array();
529
+		while (strlen($NVPString)) {
530
+			// name
531
+			$keypos = strpos($NVPString, '=');
532
+			$keyval = substr($NVPString, 0, $keypos);
533
+			// value
534
+			$valuepos = strpos($NVPString, '&') ? strpos($NVPString, '&') : strlen($NVPString);
535
+			$valval = substr($NVPString, $keypos + 1, $valuepos - $keypos - 1);
536
+			// decoding the response
537
+			$proArray[ $keyval ] = urldecode($valval);
538
+			$NVPString = substr($NVPString, $valuepos + 1, strlen($NVPString));
539
+		}
540
+		return $proArray;
541
+	}
542
+
543
+
544
+
545
+	/**
546
+	 * @param array $PayPalResult
547
+	 * @return bool
548
+	 */
549
+	private function _APICallSuccessful($PayPalResult)
550
+	{
551
+		$approved = false;
552
+		// check main response message from PayPal
553
+		if (isset($PayPalResult['ACK']) && ! empty($PayPalResult['ACK'])) {
554
+			$ack = strtoupper($PayPalResult['ACK']);
555
+			$approved = ($ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING' || $ack == 'PARTIALSUCCESS') ? true : false;
556
+		}
557
+		return $approved;
558
+	}
559
+
560
+
561
+
562
+	/**
563
+	 * @param $DataArray
564
+	 * @return array
565
+	 */
566
+	private function _GetErrors($DataArray)
567
+	{
568
+		$Errors = array();
569
+		$n = 0;
570
+		while (isset($DataArray[ 'L_ERRORCODE' . $n . '' ])) {
571
+			$LErrorCode = isset($DataArray[ 'L_ERRORCODE' . $n . '' ]) ? $DataArray[ 'L_ERRORCODE' . $n . '' ] : '';
572
+			$LShortMessage = isset($DataArray[ 'L_SHORTMESSAGE' . $n . '' ])
573
+				? $DataArray[ 'L_SHORTMESSAGE' . $n . '' ]
574
+				: '';
575
+			$LLongMessage = isset($DataArray[ 'L_LONGMESSAGE' . $n . '' ])
576
+				? $DataArray[ 'L_LONGMESSAGE' . $n . '' ]
577
+				: '';
578
+			$LSeverityCode = isset($DataArray[ 'L_SEVERITYCODE' . $n . '' ])
579
+				? $DataArray[ 'L_SEVERITYCODE' . $n . '' ]
580
+				: '';
581
+			$CurrentItem = array(
582
+				'L_ERRORCODE'    => $LErrorCode,
583
+				'L_SHORTMESSAGE' => $LShortMessage,
584
+				'L_LONGMESSAGE'  => $LLongMessage,
585
+				'L_SEVERITYCODE' => $LSeverityCode,
586
+			);
587
+			array_push($Errors, $CurrentItem);
588
+			$n++;
589
+		}
590
+		return $Errors;
591
+	}
592
+
593
+
594
+
595
+	/**
596
+	 *        nothing to see here...  move along....
597
+	 *
598
+	 * @access protected
599
+	 * @param $Errors
600
+	 * @return string
601
+	 */
602
+	private function _DisplayErrors($Errors)
603
+	{
604
+		$error = '';
605
+		foreach ($Errors as $ErrorVar => $ErrorVal) {
606
+			$CurrentError = $Errors[ $ErrorVar ];
607
+			foreach ($CurrentError as $CurrentErrorVar => $CurrentErrorVal) {
608
+				$CurrentVarName = '';
609
+				if ($CurrentErrorVar == 'L_ERRORCODE') {
610
+					$CurrentVarName = 'Error Code';
611
+				} elseif ($CurrentErrorVar == 'L_SHORTMESSAGE') {
612
+					$CurrentVarName = 'Short Message';
613
+				} elseif ($CurrentErrorVar == 'L_LONGMESSAGE') {
614
+					$CurrentVarName = 'Long Message';
615
+				} elseif ($CurrentErrorVar == 'L_SEVERITYCODE') {
616
+					$CurrentVarName = 'Severity Code';
617
+				}
618
+				$error .= '<br />' . $CurrentVarName . ': ' . $CurrentErrorVal;
619
+			}
620
+		}
621
+		return $error;
622
+	}
623 623
 }
Please login to merge, or discard this patch.
core/db_models/fields/EE_Enum_Text_Field.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -89,8 +89,8 @@
 block discarded – undo
89 89
     public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
90 90
     {
91 91
         $options = $this->_allowed_enum_values();
92
-        if (isset($options[ $value_on_field_to_be_outputted ])) {
93
-            return $options[ $value_on_field_to_be_outputted ];
92
+        if (isset($options[$value_on_field_to_be_outputted])) {
93
+            return $options[$value_on_field_to_be_outputted];
94 94
         } else {
95 95
             return $value_on_field_to_be_outputted;
96 96
         }
Please login to merge, or discard this patch.
Indentation   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -11,131 +11,131 @@
 block discarded – undo
11 11
 class EE_Enum_Text_Field extends EE_Text_Field_Base
12 12
 {
13 13
 
14
-    /**
15
-     * @var array $_allowed_enum_values
16
-     */
17
-    public $_allowed_enum_values;
18
-
19
-    /**
20
-     * @param string  $table_column
21
-     * @param string  $nice_name
22
-     * @param boolean $nullable
23
-     * @param mixed   $default_value
24
-     * @param array   $allowed_enum_values keys are values to be used in the DB, values are how they should be displayed
25
-     */
26
-    public function __construct($table_column, $nice_name, $nullable, $default_value, $allowed_enum_values)
27
-    {
28
-        $this->_allowed_enum_values = $allowed_enum_values;
29
-        parent::__construct($table_column, $nice_name, $nullable, $default_value);
30
-        $this->setSchemaType('object');
31
-    }
32
-
33
-
34
-
35
-    /**
36
-     * Returns the list of allowed enum options, but filterable.
37
-     * This is used internally
38
-     *
39
-     * @return array
40
-     */
41
-    protected function _allowed_enum_values()
42
-    {
43
-        return apply_filters(
44
-            'FHEE__EE_Enum_Text_Field___allowed_enum_options',
45
-            $this->_allowed_enum_values,
46
-            $this
47
-        );
48
-    }
49
-
50
-
51
-
52
-    /**
53
-     * When setting, just verify that the value being used matches what we've defined as allowable enum values.
54
-     * If not, throw an error (but if WP_DEBUG is false, just set the value to default).
55
-     *
56
-     * @param string $value_inputted_for_field_on_model_object
57
-     * @return string
58
-     * @throws EE_Error
59
-     */
60
-    public function prepare_for_set($value_inputted_for_field_on_model_object)
61
-    {
62
-        if (
63
-            $value_inputted_for_field_on_model_object !== null
64
-            && ! array_key_exists($value_inputted_for_field_on_model_object, $this->_allowed_enum_values())
65
-        ) {
66
-            if (defined('WP_DEBUG') && WP_DEBUG) {
67
-                $msg = sprintf(
68
-                    esc_html__('System is assigning incompatible value "%1$s" to field "%2$s"', 'event_espresso'),
69
-                    $value_inputted_for_field_on_model_object,
70
-                    $this->_name
71
-                );
72
-                $msg2 = sprintf(
73
-                    esc_html__('Allowed values for "%1$s" are "%2$s". You provided: "%3$s"', 'event_espresso'),
74
-                    $this->_name,
75
-                    implode(', ', array_keys($this->_allowed_enum_values())),
76
-                    $value_inputted_for_field_on_model_object
77
-                );
78
-                EE_Error::add_error("{$msg}||{$msg2}", __FILE__, __FUNCTION__, __LINE__);
79
-            }
80
-            return $this->get_default_value();
81
-        }
82
-        return $value_inputted_for_field_on_model_object;
83
-    }
84
-
85
-
86
-    /**
87
-     * Gets the pretty version of the enum's value.
88
-     *
89
-     * @param     int |string $value_on_field_to_be_outputted
90
-     * @param    null         $schema
91
-     * @return    string
92
-     */
93
-    public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
94
-    {
95
-        $options = $this->_allowed_enum_values();
96
-        if (isset($options[ $value_on_field_to_be_outputted ])) {
97
-            return $options[ $value_on_field_to_be_outputted ];
98
-        } else {
99
-            return $value_on_field_to_be_outputted;
100
-        }
101
-    }
102
-
103
-
104
-
105
-    /**
106
-     * When retrieving something from the DB, don't enforce the enum's options. If it's in the DB, we just have to live
107
-     * with that. Note also: when we're saving to the DB again, we also don't enforce the enum options. It's ONLY
108
-     * when we're receiving USER input from prepare_for_set() that we enforce the enum options.
109
-     *
110
-     * @param mixed $value_in_db
111
-     * @return mixed
112
-     */
113
-    public function prepare_for_set_from_db($value_in_db)
114
-    {
115
-        return $value_in_db;
116
-    }
117
-
118
-
119
-    public function getSchemaProperties()
120
-    {
121
-        return array(
122
-            'raw' => array(
123
-                'description' =>  sprintf(
124
-                    esc_html__('%s - the value in the database.', 'event_espresso'),
125
-                    $this->get_nicename()
126
-                ),
127
-                'type' => 'string',
128
-                'enum' => array_keys($this->_allowed_enum_values)
129
-            ),
130
-            'pretty' => array(
131
-                'description' =>  sprintf(
132
-                    esc_html__('%s - the value for display.', 'event_espresso'),
133
-                    $this->get_nicename()
134
-                ),
135
-                'type' => 'string',
136
-                'enum' => array_values($this->_allowed_enum_values),
137
-                'read_only' => true
138
-            )
139
-        );
140
-    }
14
+	/**
15
+	 * @var array $_allowed_enum_values
16
+	 */
17
+	public $_allowed_enum_values;
18
+
19
+	/**
20
+	 * @param string  $table_column
21
+	 * @param string  $nice_name
22
+	 * @param boolean $nullable
23
+	 * @param mixed   $default_value
24
+	 * @param array   $allowed_enum_values keys are values to be used in the DB, values are how they should be displayed
25
+	 */
26
+	public function __construct($table_column, $nice_name, $nullable, $default_value, $allowed_enum_values)
27
+	{
28
+		$this->_allowed_enum_values = $allowed_enum_values;
29
+		parent::__construct($table_column, $nice_name, $nullable, $default_value);
30
+		$this->setSchemaType('object');
31
+	}
32
+
33
+
34
+
35
+	/**
36
+	 * Returns the list of allowed enum options, but filterable.
37
+	 * This is used internally
38
+	 *
39
+	 * @return array
40
+	 */
41
+	protected function _allowed_enum_values()
42
+	{
43
+		return apply_filters(
44
+			'FHEE__EE_Enum_Text_Field___allowed_enum_options',
45
+			$this->_allowed_enum_values,
46
+			$this
47
+		);
48
+	}
49
+
50
+
51
+
52
+	/**
53
+	 * When setting, just verify that the value being used matches what we've defined as allowable enum values.
54
+	 * If not, throw an error (but if WP_DEBUG is false, just set the value to default).
55
+	 *
56
+	 * @param string $value_inputted_for_field_on_model_object
57
+	 * @return string
58
+	 * @throws EE_Error
59
+	 */
60
+	public function prepare_for_set($value_inputted_for_field_on_model_object)
61
+	{
62
+		if (
63
+			$value_inputted_for_field_on_model_object !== null
64
+			&& ! array_key_exists($value_inputted_for_field_on_model_object, $this->_allowed_enum_values())
65
+		) {
66
+			if (defined('WP_DEBUG') && WP_DEBUG) {
67
+				$msg = sprintf(
68
+					esc_html__('System is assigning incompatible value "%1$s" to field "%2$s"', 'event_espresso'),
69
+					$value_inputted_for_field_on_model_object,
70
+					$this->_name
71
+				);
72
+				$msg2 = sprintf(
73
+					esc_html__('Allowed values for "%1$s" are "%2$s". You provided: "%3$s"', 'event_espresso'),
74
+					$this->_name,
75
+					implode(', ', array_keys($this->_allowed_enum_values())),
76
+					$value_inputted_for_field_on_model_object
77
+				);
78
+				EE_Error::add_error("{$msg}||{$msg2}", __FILE__, __FUNCTION__, __LINE__);
79
+			}
80
+			return $this->get_default_value();
81
+		}
82
+		return $value_inputted_for_field_on_model_object;
83
+	}
84
+
85
+
86
+	/**
87
+	 * Gets the pretty version of the enum's value.
88
+	 *
89
+	 * @param     int |string $value_on_field_to_be_outputted
90
+	 * @param    null         $schema
91
+	 * @return    string
92
+	 */
93
+	public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
94
+	{
95
+		$options = $this->_allowed_enum_values();
96
+		if (isset($options[ $value_on_field_to_be_outputted ])) {
97
+			return $options[ $value_on_field_to_be_outputted ];
98
+		} else {
99
+			return $value_on_field_to_be_outputted;
100
+		}
101
+	}
102
+
103
+
104
+
105
+	/**
106
+	 * When retrieving something from the DB, don't enforce the enum's options. If it's in the DB, we just have to live
107
+	 * with that. Note also: when we're saving to the DB again, we also don't enforce the enum options. It's ONLY
108
+	 * when we're receiving USER input from prepare_for_set() that we enforce the enum options.
109
+	 *
110
+	 * @param mixed $value_in_db
111
+	 * @return mixed
112
+	 */
113
+	public function prepare_for_set_from_db($value_in_db)
114
+	{
115
+		return $value_in_db;
116
+	}
117
+
118
+
119
+	public function getSchemaProperties()
120
+	{
121
+		return array(
122
+			'raw' => array(
123
+				'description' =>  sprintf(
124
+					esc_html__('%s - the value in the database.', 'event_espresso'),
125
+					$this->get_nicename()
126
+				),
127
+				'type' => 'string',
128
+				'enum' => array_keys($this->_allowed_enum_values)
129
+			),
130
+			'pretty' => array(
131
+				'description' =>  sprintf(
132
+					esc_html__('%s - the value for display.', 'event_espresso'),
133
+					$this->get_nicename()
134
+				),
135
+				'type' => 'string',
136
+				'enum' => array_values($this->_allowed_enum_values),
137
+				'read_only' => true
138
+			)
139
+		);
140
+	}
141 141
 }
Please login to merge, or discard this patch.
modules/thank_you_page/templates/thank-you-page-overview.template.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 
10 10
 <div id="espresso-thank-you-page-overview-dv" class="width-100">
11 11
 
12
-    <?php if (! $revisit) : ?>
12
+    <?php if ( ! $revisit) : ?>
13 13
         <div class="ee-attention">
14 14
             <div class="extra-padding-sides">
15 15
                 <?php echo apply_filters(
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
                         '<br />'
22 22
                     )
23 23
                 );
24
-                if (! empty($TXN_receipt_url)) : ?>
24
+                if ( ! empty($TXN_receipt_url)) : ?>
25 25
                     <br/>
26 26
                     <div class="jst-rght">
27 27
                         <a class="ee-button ee-roundish indented-text big-text"
Please login to merge, or discard this patch.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -13,15 +13,15 @@  discard block
 block discarded – undo
13 13
         <div class="ee-attention">
14 14
             <div class="extra-padding-sides">
15 15
                 <?php echo apply_filters(
16
-                    'FHEE__thank_you_page_overview_template__order_conf_desc',
17
-                    sprintf(
18
-                        $order_conf_desc,
19
-                        '<h3 class="">',
20
-                        '</h3>',
21
-                        '<br />'
22
-                    )
23
-                );
24
-                if (! empty($TXN_receipt_url)) : ?>
16
+					'FHEE__thank_you_page_overview_template__order_conf_desc',
17
+					sprintf(
18
+						$order_conf_desc,
19
+						'<h3 class="">',
20
+						'</h3>',
21
+						'<br />'
22
+					)
23
+				);
24
+				if (! empty($TXN_receipt_url)) : ?>
25 25
                     <br/>
26 26
                     <div class="jst-rght">
27 27
                         <a class="ee-button ee-roundish indented-text big-text"
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
                         >
30 30
                             <span class="ee-icon ee-icon-PDF-file-type"></span>
31 31
                             <?php echo apply_filters(
32
-                                'FHEE__thank_you_page_overview_template__order_conf_button_text',
33
-                                esc_html__('View Full Order Confirmation Receipt', 'event_espresso')
34
-                            ); ?>
32
+								'FHEE__thank_you_page_overview_template__order_conf_button_text',
33
+								esc_html__('View Full Order Confirmation Receipt', 'event_espresso')
34
+							); ?>
35 35
                         </a>
36 36
                     </div>
37 37
                 <?php endif; ?>
Please login to merge, or discard this patch.
thank_you_page/templates/thank-you-page-payment-details.template.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 
6 6
 <div id="espresso-thank-you-page-payment-details-dv">
7 7
     <?php
8
-    if (! empty($payments)) { ?>
8
+    if ( ! empty($payments)) { ?>
9 9
         <table class="ee-table">
10 10
             <thead>
11 11
             <tr>
Please login to merge, or discard this patch.
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
 <div id="espresso-thank-you-page-payment-details-dv">
18 18
     <?php
19
-    if (! empty($payments)) { ?>
19
+	if (! empty($payments)) { ?>
20 20
         <table class="ee-table">
21 21
             <thead>
22 22
             <tr>
@@ -36,37 +36,37 @@  discard block
 block discarded – undo
36 36
             </thead>
37 37
             <tbody>
38 38
             <?php
39
-            foreach ($payments as $payment) {
40
-                echo wp_kses($payment, AllowedTags::getWithFormTags());
41
-            }
42
-            ?>
39
+			foreach ($payments as $payment) {
40
+				echo wp_kses($payment, AllowedTags::getWithFormTags());
41
+			}
42
+			?>
43 43
             </tbody>
44 44
         </table>
45 45
         <?php
46
-    } else {
47
-        if ($transaction->total()) {
48
-            echo apply_filters(
49
-                'FHEE__payment_overview_template__no_payments_made',
50
-                sprintf(
51
-                    esc_html__('%sNo payments towards this transaction have been received.%s', 'event_espresso'),
52
-                    '<p class="important-notice">',
53
-                    '</p>'
54
-                )
55
-            );
56
-            do_action('AHEE__thank_you_page_payment_details_template__no_payments_made', $transaction);
57
-        } else {
58
-            echo apply_filters(
59
-                'FHEE__payment_overview_template__no_payment_required',
60
-                sprintf(
61
-                    esc_html__('%sNo payment is required for this transaction.%s', 'event_espresso'),
62
-                    '<p>',
63
-                    '</p>'
64
-                )
65
-            );
66
-            do_action('AHEE__thank_you_page_payment_details_template__no_payment_required');
67
-        }
68
-    }
69
-    echo wp_kses($gateway_content, AllowedTags::getWithFormTags());
70
-    do_action('AHEE__thank_you_page_payment_details_template__after_gateway_content', $gateway_content);
71
-    echo '<br/>';
72
-    do_action('AHEE__thank_you_page_payment_details_template__after_payment_details');
46
+	} else {
47
+		if ($transaction->total()) {
48
+			echo apply_filters(
49
+				'FHEE__payment_overview_template__no_payments_made',
50
+				sprintf(
51
+					esc_html__('%sNo payments towards this transaction have been received.%s', 'event_espresso'),
52
+					'<p class="important-notice">',
53
+					'</p>'
54
+				)
55
+			);
56
+			do_action('AHEE__thank_you_page_payment_details_template__no_payments_made', $transaction);
57
+		} else {
58
+			echo apply_filters(
59
+				'FHEE__payment_overview_template__no_payment_required',
60
+				sprintf(
61
+					esc_html__('%sNo payment is required for this transaction.%s', 'event_espresso'),
62
+					'<p>',
63
+					'</p>'
64
+				)
65
+			);
66
+			do_action('AHEE__thank_you_page_payment_details_template__no_payment_required');
67
+		}
68
+	}
69
+	echo wp_kses($gateway_content, AllowedTags::getWithFormTags());
70
+	do_action('AHEE__thank_you_page_payment_details_template__after_gateway_content', $gateway_content);
71
+	echo '<br/>';
72
+	do_action('AHEE__thank_you_page_payment_details_template__after_payment_details');
Please login to merge, or discard this patch.