Completed
Branch BUG/fix-more-php-8-issues (9d1e37)
by
unknown
05:14 queued 02:56
created
core/libraries/shortcodes/EE_Attendee_Shortcodes.lib.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
             ? null
115 115
             : $this->_data;
116 116
 
117
-        if (! $registration instanceof EE_Registration) {
117
+        if ( ! $registration instanceof EE_Registration) {
118 118
             // let's attempt to get the txn_id for the error message.
119 119
             $txn_id  = isset($this->_extra->txn) && $this->_extra->txn instanceof EE_Transaction
120 120
                 ? $this->_extra->txn->ID()
@@ -131,12 +131,12 @@  discard block
 block discarded – undo
131 131
         }
132 132
 
133 133
         // attendee obj for this registration
134
-        $attendee = isset($this->_extra->registrations[ $registration->ID() ]['att_obj'])
135
-            ? $this->_extra->registrations[ $registration->ID() ]['att_obj']
134
+        $attendee = isset($this->_extra->registrations[$registration->ID()]['att_obj'])
135
+            ? $this->_extra->registrations[$registration->ID()]['att_obj']
136 136
             : null;
137 137
 
138
-        if (! $attendee instanceof EE_Attendee) {
139
-            $msg     = esc_html__(
138
+        if ( ! $attendee instanceof EE_Attendee) {
139
+            $msg = esc_html__(
140 140
                 'There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.',
141 141
                 'event_espresso'
142 142
             );
Please login to merge, or discard this patch.
Indentation   +188 added lines, -188 removed lines patch added patch discarded remove patch
@@ -15,192 +15,192 @@
 block discarded – undo
15 15
  */
16 16
 class EE_Attendee_Shortcodes extends EE_Shortcodes
17 17
 {
18
-    /**
19
-     * hold all extra data.
20
-     *
21
-     * @var array
22
-     */
23
-    protected $_extra;
24
-
25
-
26
-    /**
27
-     * EE_Attendee_Shortcodes constructor.
28
-     */
29
-    public function __construct()
30
-    {
31
-        parent::__construct();
32
-    }
33
-
34
-
35
-    protected function _init_props()
36
-    {
37
-        $this->label       = esc_html__('Attendee Shortcodes', 'event_espresso');
38
-        $this->description = esc_html__('All shortcodes specific to attendee related data', 'event_espresso');
39
-        $this->_shortcodes = [
40
-            '[FNAME]'                          => esc_html__('First Name of an attendee.', 'event_espresso'),
41
-            '[LNAME]'                          => esc_html__('Last Name of an attendee.', 'event_espresso'),
42
-            '[ATTENDEE_EMAIL]'                 => esc_html__('Email address for the attendee.', 'event_espresso'),
43
-            '[EDIT_ATTENDEE_LINK]'             => esc_html__(
44
-                'Edit Registration Link (typically you\'d only use this for messages going to event administrators)',
45
-                'event_espresso'
46
-            ),
47
-            '[REGISTRATION_ID]'                => esc_html__(
48
-                'Unique Registration ID for the registration',
49
-                'event_espresso'
50
-            ),
51
-            '[REGISTRATION_CODE]'              => esc_html__(
52
-                'Unique Registration Code for the registration',
53
-                'event_espresso'
54
-            ),
55
-            '[REGISTRATION_STATUS_ID]'         => esc_html__(
56
-                'Parses to the registration status for the attendee',
57
-                'event_espresso'
58
-            ),
59
-            '[REGISTRATION_STATUS_LABEL]'      => esc_html__(
60
-                'Parses to the status label for the registrant',
61
-                'event_espresso'
62
-            ),
63
-            '[REGISTRATION_TOTAL_AMOUNT_PAID]' => esc_html__(
64
-                'Parses to the total amount paid for this registration.',
65
-                'event_espresso'
66
-            ),
67
-            '[FRONTEND_EDIT_REG_LINK]'         => esc_html__(
68
-                'Generates a link for the given registration to edit this registration details on the frontend.',
69
-                'event_espresso'
70
-            ),
71
-            '[PHONE_NUMBER]'                   => esc_html__(
72
-                'The Phone Number for the Registration.',
73
-                'event_espresso'
74
-            ),
75
-            '[ADDRESS]'                        => esc_html__('The Address for the Registration', 'event_espresso'),
76
-            '[ADDRESS2]'                       => esc_html__(
77
-                'Whatever was in the address 2 field for the registration.',
78
-                'event_espresso'
79
-            ),
80
-            '[CITY]'                           => esc_html__('The city for the registration.', 'event_espresso'),
81
-            '[ZIP_PC]'                         => esc_html__(
82
-                'The ZIP (or Postal) Code for the Registration.',
83
-                'event_espresso'
84
-            ),
85
-            '[ADDRESS_STATE]'                  => esc_html__(
86
-                'The state/province for the registration.',
87
-                'event_espresso'
88
-            ),
89
-            '[COUNTRY]'                        => esc_html__('The country for the registration.', 'event_espresso'),
90
-        ];
91
-    }
92
-
93
-
94
-    /**
95
-     * handles shortcode parsing
96
-     *
97
-     * @access protected
98
-     * @param string $shortcode the shortcode to be parsed.
99
-     * @return string
100
-     * @throws EE_Error
101
-     * @throws ReflectionException
102
-     */
103
-    protected function _parser($shortcode)
104
-    {
105
-
106
-
107
-        $this->_extra = ! empty($this->_extra_data) && $this->_extra_data['data'] instanceof EE_Messages_Addressee
108
-            ? $this->_extra_data['data']
109
-            : null;
110
-
111
-        // incoming object should only be a registration object.
112
-        $registration = ! $this->_data instanceof EE_Registration
113
-            ? null
114
-            : $this->_data;
115
-
116
-        if (! $registration instanceof EE_Registration) {
117
-            // let's attempt to get the txn_id for the error message.
118
-            $txn_id  = isset($this->_extra->txn) && $this->_extra->txn instanceof EE_Transaction
119
-                ? $this->_extra->txn->ID()
120
-                : esc_html__('Unknown', 'event_espresso');
121
-            $msg     = esc_html__(
122
-                'There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.',
123
-                'event_espresso'
124
-            );
125
-            $dev_msg = sprintf(
126
-                esc_html__('The transaction ID for this request is: %s', 'event_espresso'),
127
-                $txn_id
128
-            );
129
-            throw new EE_Error("{$msg}||{$msg} {$dev_msg}");
130
-        }
131
-
132
-        // attendee obj for this registration
133
-        $attendee = isset($this->_extra->registrations[ $registration->ID() ]['att_obj'])
134
-            ? $this->_extra->registrations[ $registration->ID() ]['att_obj']
135
-            : null;
136
-
137
-        if (! $attendee instanceof EE_Attendee) {
138
-            $msg     = esc_html__(
139
-                'There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.',
140
-                'event_espresso'
141
-            );
142
-            $dev_msg = sprintf(
143
-                esc_html__('The registration ID for this request is: %s', 'event_espresso'),
144
-                $registration->ID()
145
-            );
146
-            throw new EE_Error("{$msg}||{$msg} {$dev_msg}");
147
-        }
148
-
149
-        switch ($shortcode) {
150
-            case '[FNAME]':
151
-                return $attendee->fname();
152
-
153
-            case '[LNAME]':
154
-                return $attendee->lname();
155
-
156
-            case '[ATTENDEE_EMAIL]':
157
-                return $attendee->email();
158
-
159
-            case '[EDIT_ATTENDEE_LINK]':
160
-                return $registration->get_admin_edit_url();
161
-
162
-            case '[REGISTRATION_CODE]':
163
-                return $registration->reg_code();
164
-
165
-            case '[REGISTRATION_ID]':
166
-                return $registration->ID();
167
-
168
-            case '[FRONTEND_EDIT_REG_LINK]':
169
-                return $registration->edit_attendee_information_url();
170
-
171
-            case '[PHONE_NUMBER]':
172
-                return $attendee->phone();
173
-
174
-            case '[ADDRESS]':
175
-                return $attendee->address();
176
-
177
-            case '[ADDRESS2]':
178
-                return $attendee->address2();
179
-
180
-            case '[CITY]':
181
-                return $attendee->city();
182
-
183
-            case '[ZIP_PC]':
184
-                return $attendee->zip();
185
-
186
-            case '[ADDRESS_STATE]':
187
-                $state_obj = $attendee->state_obj();
188
-                return $state_obj instanceof EE_State ? $state_obj->name() : '';
189
-
190
-            case '[COUNTRY]':
191
-                $country_obj = $attendee->country_obj();
192
-                return $country_obj instanceof EE_Country ? $country_obj->name() : '';
193
-
194
-            case '[REGISTRATION_STATUS_ID]':
195
-                return $registration->status_ID();
196
-
197
-            case '[REGISTRATION_STATUS_LABEL]':
198
-                return $registration->pretty_status();
199
-
200
-            case '[REGISTRATION_TOTAL_AMOUNT_PAID]':
201
-                return $registration->pretty_paid();
202
-        }
203
-
204
-        return '';
205
-    }
18
+	/**
19
+	 * hold all extra data.
20
+	 *
21
+	 * @var array
22
+	 */
23
+	protected $_extra;
24
+
25
+
26
+	/**
27
+	 * EE_Attendee_Shortcodes constructor.
28
+	 */
29
+	public function __construct()
30
+	{
31
+		parent::__construct();
32
+	}
33
+
34
+
35
+	protected function _init_props()
36
+	{
37
+		$this->label       = esc_html__('Attendee Shortcodes', 'event_espresso');
38
+		$this->description = esc_html__('All shortcodes specific to attendee related data', 'event_espresso');
39
+		$this->_shortcodes = [
40
+			'[FNAME]'                          => esc_html__('First Name of an attendee.', 'event_espresso'),
41
+			'[LNAME]'                          => esc_html__('Last Name of an attendee.', 'event_espresso'),
42
+			'[ATTENDEE_EMAIL]'                 => esc_html__('Email address for the attendee.', 'event_espresso'),
43
+			'[EDIT_ATTENDEE_LINK]'             => esc_html__(
44
+				'Edit Registration Link (typically you\'d only use this for messages going to event administrators)',
45
+				'event_espresso'
46
+			),
47
+			'[REGISTRATION_ID]'                => esc_html__(
48
+				'Unique Registration ID for the registration',
49
+				'event_espresso'
50
+			),
51
+			'[REGISTRATION_CODE]'              => esc_html__(
52
+				'Unique Registration Code for the registration',
53
+				'event_espresso'
54
+			),
55
+			'[REGISTRATION_STATUS_ID]'         => esc_html__(
56
+				'Parses to the registration status for the attendee',
57
+				'event_espresso'
58
+			),
59
+			'[REGISTRATION_STATUS_LABEL]'      => esc_html__(
60
+				'Parses to the status label for the registrant',
61
+				'event_espresso'
62
+			),
63
+			'[REGISTRATION_TOTAL_AMOUNT_PAID]' => esc_html__(
64
+				'Parses to the total amount paid for this registration.',
65
+				'event_espresso'
66
+			),
67
+			'[FRONTEND_EDIT_REG_LINK]'         => esc_html__(
68
+				'Generates a link for the given registration to edit this registration details on the frontend.',
69
+				'event_espresso'
70
+			),
71
+			'[PHONE_NUMBER]'                   => esc_html__(
72
+				'The Phone Number for the Registration.',
73
+				'event_espresso'
74
+			),
75
+			'[ADDRESS]'                        => esc_html__('The Address for the Registration', 'event_espresso'),
76
+			'[ADDRESS2]'                       => esc_html__(
77
+				'Whatever was in the address 2 field for the registration.',
78
+				'event_espresso'
79
+			),
80
+			'[CITY]'                           => esc_html__('The city for the registration.', 'event_espresso'),
81
+			'[ZIP_PC]'                         => esc_html__(
82
+				'The ZIP (or Postal) Code for the Registration.',
83
+				'event_espresso'
84
+			),
85
+			'[ADDRESS_STATE]'                  => esc_html__(
86
+				'The state/province for the registration.',
87
+				'event_espresso'
88
+			),
89
+			'[COUNTRY]'                        => esc_html__('The country for the registration.', 'event_espresso'),
90
+		];
91
+	}
92
+
93
+
94
+	/**
95
+	 * handles shortcode parsing
96
+	 *
97
+	 * @access protected
98
+	 * @param string $shortcode the shortcode to be parsed.
99
+	 * @return string
100
+	 * @throws EE_Error
101
+	 * @throws ReflectionException
102
+	 */
103
+	protected function _parser($shortcode)
104
+	{
105
+
106
+
107
+		$this->_extra = ! empty($this->_extra_data) && $this->_extra_data['data'] instanceof EE_Messages_Addressee
108
+			? $this->_extra_data['data']
109
+			: null;
110
+
111
+		// incoming object should only be a registration object.
112
+		$registration = ! $this->_data instanceof EE_Registration
113
+			? null
114
+			: $this->_data;
115
+
116
+		if (! $registration instanceof EE_Registration) {
117
+			// let's attempt to get the txn_id for the error message.
118
+			$txn_id  = isset($this->_extra->txn) && $this->_extra->txn instanceof EE_Transaction
119
+				? $this->_extra->txn->ID()
120
+				: esc_html__('Unknown', 'event_espresso');
121
+			$msg     = esc_html__(
122
+				'There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.',
123
+				'event_espresso'
124
+			);
125
+			$dev_msg = sprintf(
126
+				esc_html__('The transaction ID for this request is: %s', 'event_espresso'),
127
+				$txn_id
128
+			);
129
+			throw new EE_Error("{$msg}||{$msg} {$dev_msg}");
130
+		}
131
+
132
+		// attendee obj for this registration
133
+		$attendee = isset($this->_extra->registrations[ $registration->ID() ]['att_obj'])
134
+			? $this->_extra->registrations[ $registration->ID() ]['att_obj']
135
+			: null;
136
+
137
+		if (! $attendee instanceof EE_Attendee) {
138
+			$msg     = esc_html__(
139
+				'There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.',
140
+				'event_espresso'
141
+			);
142
+			$dev_msg = sprintf(
143
+				esc_html__('The registration ID for this request is: %s', 'event_espresso'),
144
+				$registration->ID()
145
+			);
146
+			throw new EE_Error("{$msg}||{$msg} {$dev_msg}");
147
+		}
148
+
149
+		switch ($shortcode) {
150
+			case '[FNAME]':
151
+				return $attendee->fname();
152
+
153
+			case '[LNAME]':
154
+				return $attendee->lname();
155
+
156
+			case '[ATTENDEE_EMAIL]':
157
+				return $attendee->email();
158
+
159
+			case '[EDIT_ATTENDEE_LINK]':
160
+				return $registration->get_admin_edit_url();
161
+
162
+			case '[REGISTRATION_CODE]':
163
+				return $registration->reg_code();
164
+
165
+			case '[REGISTRATION_ID]':
166
+				return $registration->ID();
167
+
168
+			case '[FRONTEND_EDIT_REG_LINK]':
169
+				return $registration->edit_attendee_information_url();
170
+
171
+			case '[PHONE_NUMBER]':
172
+				return $attendee->phone();
173
+
174
+			case '[ADDRESS]':
175
+				return $attendee->address();
176
+
177
+			case '[ADDRESS2]':
178
+				return $attendee->address2();
179
+
180
+			case '[CITY]':
181
+				return $attendee->city();
182
+
183
+			case '[ZIP_PC]':
184
+				return $attendee->zip();
185
+
186
+			case '[ADDRESS_STATE]':
187
+				$state_obj = $attendee->state_obj();
188
+				return $state_obj instanceof EE_State ? $state_obj->name() : '';
189
+
190
+			case '[COUNTRY]':
191
+				$country_obj = $attendee->country_obj();
192
+				return $country_obj instanceof EE_Country ? $country_obj->name() : '';
193
+
194
+			case '[REGISTRATION_STATUS_ID]':
195
+				return $registration->status_ID();
196
+
197
+			case '[REGISTRATION_STATUS_LABEL]':
198
+				return $registration->pretty_status();
199
+
200
+			case '[REGISTRATION_TOTAL_AMOUNT_PAID]':
201
+				return $registration->pretty_paid();
202
+		}
203
+
204
+		return '';
205
+	}
206 206
 }
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Attendee_List_Shortcodes.lib.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         $att_result    = '';
160 160
         $registrations =
161 161
             isset($this->_extra_data['data']->tickets)
162
-                ? $this->_extra_data['data']->tickets[ $ticket->ID() ]['reg_objs']
162
+                ? $this->_extra_data['data']->tickets[$ticket->ID()]['reg_objs']
163 163
                 : [];
164 164
 
165 165
         // each attendee in this case should be an attendee object.
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
     private function _get_registrations_from_event(EE_Event $event)
186 186
     {
187 187
         return isset($this->_extra_data['data']->events)
188
-            ? $this->_extra_data['data']->events[ $event->ID() ]['reg_objs']
188
+            ? $this->_extra_data['data']->events[$event->ID()]['reg_objs']
189 189
             : [];
190 190
     }
191 191
 }
Please login to merge, or discard this patch.
Indentation   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -18,173 +18,173 @@
 block discarded – undo
18 18
  */
19 19
 class EE_Attendee_List_Shortcodes extends EE_Shortcodes
20 20
 {
21
-    public function __construct()
22
-    {
23
-        parent::__construct();
24
-    }
25
-
26
-
27
-    protected function _init_props()
28
-    {
29
-        $this->label       = esc_html__('Attendee List Shortcodes', 'event_espresso');
30
-        $this->description = esc_html__('All shortcodes specific to attendee lists', 'event_espresso');
31
-        $this->_shortcodes = [
32
-            '[ATTENDEE_LIST]' => esc_html__('Will output a list of attendees', 'event_espresso'),
33
-        ];
34
-    }
35
-
36
-
37
-    /**
38
-     * @param string $shortcode
39
-     * @return string
40
-     * @throws EE_Error
41
-     * @throws ReflectionException
42
-     */
43
-    protected function _parser($shortcode)
44
-    {
45
-        switch ($shortcode) {
46
-            case '[ATTENDEE_LIST]':
47
-                return $this->_get_attendee_list();
48
-        }
49
-        return '';
50
-    }
51
-
52
-
53
-    /**
54
-     * figure out what the incoming data is and then return the appropriate parsed value.
55
-     *
56
-     * @return string
57
-     * @throws EE_Error
58
-     * @throws ReflectionException
59
-     */
60
-    private function _get_attendee_list()
61
-    {
62
-        $this->_validate_list_requirements();
63
-
64
-        if ($this->_data['data'] instanceof EE_Messages_Addressee) {
65
-            return $this->_get_attendee_list_for_main();
66
-        }
67
-        if ($this->_data['data'] instanceof EE_Event) {
68
-            return $this->_get_attendee_list_for_event();
69
-        }
70
-        if ($this->_data['data'] instanceof EE_Ticket) {
71
-            return $this->_get_registration_list_for_ticket();
72
-        }
73
-        // prevent recursive loop
74
-        return '';
75
-    }
76
-
77
-
78
-    /**
79
-     * This returns the parsed attendee list for main template;
80
-     */
81
-    private function _get_attendee_list_for_main()
82
-    {
83
-        $valid_shortcodes = ['attendee', 'event_list', 'ticket_list', 'question_list', 'recipient_details'];
84
-        $template         = $this->_data['template'];
85
-        $data             = $this->_data['data'];
86
-        $attendees        = '';
87
-
88
-
89
-        // now we need to loop through the attendee list and send data to the EE_Parser helper.
90
-        foreach ($data->reg_objs as $registration) {
91
-            $attendees .= $this->_shortcode_helper->parse_attendee_list_template(
92
-                $template,
93
-                $registration,
94
-                $valid_shortcodes,
95
-                $this->_extra_data
96
-            );
97
-        }
98
-
99
-        return $attendees;
100
-    }
101
-
102
-
103
-    /**
104
-     * return parsed list of attendees for an event
105
-     *
106
-     * @return string
107
-     * @throws EE_Error
108
-     * @throws ReflectionException
109
-     */
110
-    private function _get_attendee_list_for_event()
111
-    {
112
-        $valid_shortcodes = ['attendee', 'ticket_list', 'question_list', 'recipient_details'];
113
-        $template         = is_array($this->_data['template']) && isset($this->_data['template']['attendee_list'])
114
-            ? $this->_data['template']['attendee_list']
115
-            : $this->_extra_data['template']['attendee_list'];
116
-        $event            = $this->_data['data'];
117
-
118
-        // let's remove any existing [EVENT_LIST] shortcode from the attendee list template so that we don't get recursion.
119
-        $template = str_replace('[EVENT_LIST]', '', $template);
120
-
121
-        // here we're setting up the attendees for the attendee_list template for THIS event.
122
-        $att_result    = '';
123
-        $registrations = $this->_get_registrations_from_event($event);
124
-
125
-        // each attendee in this case should be an attendee object.
126
-        foreach ($registrations as $registration) {
127
-            $att_result .= $this->_shortcode_helper->parse_attendee_list_template(
128
-                $template,
129
-                $registration,
130
-                $valid_shortcodes,
131
-                $this->_extra_data
132
-            );
133
-        }
134
-
135
-        return $att_result;
136
-    }
137
-
138
-
139
-    /**
140
-     * return parsed list of attendees for a ticket
141
-     *
142
-     * @return string
143
-     */
144
-    private function _get_registration_list_for_ticket()
145
-    {
146
-        $valid_shortcodes = ['attendee', 'event_list', 'question_list', 'recipient_details'];
147
-        $template         = is_array($this->_data['template']) && isset($this->_data['template']['attendee_list'])
148
-            ? $this->_data['template']['attendee_list']
149
-            : $this->_extra_data['template']['attendee_list'];
150
-        $ticket           = $this->_data['data'];
151
-
152
-        // let's remove any existing [TICKET_LIST] (or related) shortcode from the attendee list template so that we don't get recursion.
153
-        $template = str_replace('[TICKET_LIST]', '', $template);
154
-        $template = str_replace('[RECIPIENT_TICKET_LIST]', '', $template);
155
-        $template = str_replace('[PRIMARY_REGISTRANT_TICKET_LIST]', '', $template);
156
-
157
-        // here we're setting up the attendees for the attendee_list template for THIS ticket.
158
-        $att_result    = '';
159
-        $registrations =
160
-            isset($this->_extra_data['data']->tickets)
161
-                ? $this->_extra_data['data']->tickets[ $ticket->ID() ]['reg_objs']
162
-                : [];
163
-
164
-        // each attendee in this case should be an attendee object.
165
-        foreach ($registrations as $registration) {
166
-            $att_result .= $this->_shortcode_helper->parse_attendee_list_template(
167
-                $template,
168
-                $registration,
169
-                $valid_shortcodes,
170
-                $this->_extra_data
171
-            );
172
-        }
173
-
174
-        return $att_result;
175
-    }
176
-
177
-
178
-    /**
179
-     * @param EE_Event $event
180
-     * @return array|mixed
181
-     * @throws EE_Error
182
-     * @throws ReflectionException
183
-     */
184
-    private function _get_registrations_from_event(EE_Event $event)
185
-    {
186
-        return isset($this->_extra_data['data']->events)
187
-            ? $this->_extra_data['data']->events[ $event->ID() ]['reg_objs']
188
-            : [];
189
-    }
21
+	public function __construct()
22
+	{
23
+		parent::__construct();
24
+	}
25
+
26
+
27
+	protected function _init_props()
28
+	{
29
+		$this->label       = esc_html__('Attendee List Shortcodes', 'event_espresso');
30
+		$this->description = esc_html__('All shortcodes specific to attendee lists', 'event_espresso');
31
+		$this->_shortcodes = [
32
+			'[ATTENDEE_LIST]' => esc_html__('Will output a list of attendees', 'event_espresso'),
33
+		];
34
+	}
35
+
36
+
37
+	/**
38
+	 * @param string $shortcode
39
+	 * @return string
40
+	 * @throws EE_Error
41
+	 * @throws ReflectionException
42
+	 */
43
+	protected function _parser($shortcode)
44
+	{
45
+		switch ($shortcode) {
46
+			case '[ATTENDEE_LIST]':
47
+				return $this->_get_attendee_list();
48
+		}
49
+		return '';
50
+	}
51
+
52
+
53
+	/**
54
+	 * figure out what the incoming data is and then return the appropriate parsed value.
55
+	 *
56
+	 * @return string
57
+	 * @throws EE_Error
58
+	 * @throws ReflectionException
59
+	 */
60
+	private function _get_attendee_list()
61
+	{
62
+		$this->_validate_list_requirements();
63
+
64
+		if ($this->_data['data'] instanceof EE_Messages_Addressee) {
65
+			return $this->_get_attendee_list_for_main();
66
+		}
67
+		if ($this->_data['data'] instanceof EE_Event) {
68
+			return $this->_get_attendee_list_for_event();
69
+		}
70
+		if ($this->_data['data'] instanceof EE_Ticket) {
71
+			return $this->_get_registration_list_for_ticket();
72
+		}
73
+		// prevent recursive loop
74
+		return '';
75
+	}
76
+
77
+
78
+	/**
79
+	 * This returns the parsed attendee list for main template;
80
+	 */
81
+	private function _get_attendee_list_for_main()
82
+	{
83
+		$valid_shortcodes = ['attendee', 'event_list', 'ticket_list', 'question_list', 'recipient_details'];
84
+		$template         = $this->_data['template'];
85
+		$data             = $this->_data['data'];
86
+		$attendees        = '';
87
+
88
+
89
+		// now we need to loop through the attendee list and send data to the EE_Parser helper.
90
+		foreach ($data->reg_objs as $registration) {
91
+			$attendees .= $this->_shortcode_helper->parse_attendee_list_template(
92
+				$template,
93
+				$registration,
94
+				$valid_shortcodes,
95
+				$this->_extra_data
96
+			);
97
+		}
98
+
99
+		return $attendees;
100
+	}
101
+
102
+
103
+	/**
104
+	 * return parsed list of attendees for an event
105
+	 *
106
+	 * @return string
107
+	 * @throws EE_Error
108
+	 * @throws ReflectionException
109
+	 */
110
+	private function _get_attendee_list_for_event()
111
+	{
112
+		$valid_shortcodes = ['attendee', 'ticket_list', 'question_list', 'recipient_details'];
113
+		$template         = is_array($this->_data['template']) && isset($this->_data['template']['attendee_list'])
114
+			? $this->_data['template']['attendee_list']
115
+			: $this->_extra_data['template']['attendee_list'];
116
+		$event            = $this->_data['data'];
117
+
118
+		// let's remove any existing [EVENT_LIST] shortcode from the attendee list template so that we don't get recursion.
119
+		$template = str_replace('[EVENT_LIST]', '', $template);
120
+
121
+		// here we're setting up the attendees for the attendee_list template for THIS event.
122
+		$att_result    = '';
123
+		$registrations = $this->_get_registrations_from_event($event);
124
+
125
+		// each attendee in this case should be an attendee object.
126
+		foreach ($registrations as $registration) {
127
+			$att_result .= $this->_shortcode_helper->parse_attendee_list_template(
128
+				$template,
129
+				$registration,
130
+				$valid_shortcodes,
131
+				$this->_extra_data
132
+			);
133
+		}
134
+
135
+		return $att_result;
136
+	}
137
+
138
+
139
+	/**
140
+	 * return parsed list of attendees for a ticket
141
+	 *
142
+	 * @return string
143
+	 */
144
+	private function _get_registration_list_for_ticket()
145
+	{
146
+		$valid_shortcodes = ['attendee', 'event_list', 'question_list', 'recipient_details'];
147
+		$template         = is_array($this->_data['template']) && isset($this->_data['template']['attendee_list'])
148
+			? $this->_data['template']['attendee_list']
149
+			: $this->_extra_data['template']['attendee_list'];
150
+		$ticket           = $this->_data['data'];
151
+
152
+		// let's remove any existing [TICKET_LIST] (or related) shortcode from the attendee list template so that we don't get recursion.
153
+		$template = str_replace('[TICKET_LIST]', '', $template);
154
+		$template = str_replace('[RECIPIENT_TICKET_LIST]', '', $template);
155
+		$template = str_replace('[PRIMARY_REGISTRANT_TICKET_LIST]', '', $template);
156
+
157
+		// here we're setting up the attendees for the attendee_list template for THIS ticket.
158
+		$att_result    = '';
159
+		$registrations =
160
+			isset($this->_extra_data['data']->tickets)
161
+				? $this->_extra_data['data']->tickets[ $ticket->ID() ]['reg_objs']
162
+				: [];
163
+
164
+		// each attendee in this case should be an attendee object.
165
+		foreach ($registrations as $registration) {
166
+			$att_result .= $this->_shortcode_helper->parse_attendee_list_template(
167
+				$template,
168
+				$registration,
169
+				$valid_shortcodes,
170
+				$this->_extra_data
171
+			);
172
+		}
173
+
174
+		return $att_result;
175
+	}
176
+
177
+
178
+	/**
179
+	 * @param EE_Event $event
180
+	 * @return array|mixed
181
+	 * @throws EE_Error
182
+	 * @throws ReflectionException
183
+	 */
184
+	private function _get_registrations_from_event(EE_Event $event)
185
+	{
186
+		return isset($this->_extra_data['data']->events)
187
+			? $this->_extra_data['data']->events[ $event->ID() ]['reg_objs']
188
+			: [];
189
+	}
190 190
 }
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page_Menu_Group.core.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,6 +39,6 @@
 block discarded – undo
39 39
 
40 40
     private function _group_link()
41 41
     {
42
-        return '<span class="ee_menu_group"  onclick="return false;">' . $this->menu_label . '</span>';
42
+        return '<span class="ee_menu_group"  onclick="return false;">'.$this->menu_label.'</span>';
43 43
     }
44 44
 }
Please login to merge, or discard this patch.
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -13,31 +13,31 @@
 block discarded – undo
13 13
  */
14 14
 class EE_Admin_Page_Menu_Group extends EE_Admin_Page_Menu_Map
15 15
 {
16
-    /**
17
-     * @throws EE_Error
18
-     */
19
-    public function __construct($menu_args = [])
20
-    {
21
-        $required = ['menu_label', 'menu_slug', 'menu_order', 'parent_slug'];
22
-        parent::__construct($menu_args, $required);
23
-    }
16
+	/**
17
+	 * @throws EE_Error
18
+	 */
19
+	public function __construct($menu_args = [])
20
+	{
21
+		$required = ['menu_label', 'menu_slug', 'menu_order', 'parent_slug'];
22
+		parent::__construct($menu_args, $required);
23
+	}
24 24
 
25 25
 
26
-    protected function _add_menu_page()
27
-    {
28
-        return add_submenu_page(
29
-            $this->parent_slug,
30
-            $this->menu_label,
31
-            $this->_group_link(),
32
-            $this->capability,
33
-            $this->menu_slug,
34
-            '__return_false'
35
-        );
36
-    }
26
+	protected function _add_menu_page()
27
+	{
28
+		return add_submenu_page(
29
+			$this->parent_slug,
30
+			$this->menu_label,
31
+			$this->_group_link(),
32
+			$this->capability,
33
+			$this->menu_slug,
34
+			'__return_false'
35
+		);
36
+	}
37 37
 
38 38
 
39
-    private function _group_link()
40
-    {
41
-        return '<span class="ee_menu_group"  onclick="return false;">' . $this->menu_label . '</span>';
42
-    }
39
+	private function _group_link()
40
+	{
41
+		return '<span class="ee_menu_group"  onclick="return false;">' . $this->menu_label . '</span>';
42
+	}
43 43
 }
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page_Main_Menu.core.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
             $this->icon_url,
71 71
             $this->position
72 72
         );
73
-        if (! empty($this->subtitle)) {
73
+        if ( ! empty($this->subtitle)) {
74 74
             add_submenu_page(
75 75
                 $this->parent_slug,
76 76
                 $this->subtitle,
Please login to merge, or discard this patch.
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -9,76 +9,76 @@
 block discarded – undo
9 9
  */
10 10
 class EE_Admin_Page_Main_Menu extends EE_Admin_Page_Menu_Map
11 11
 {
12
-    /**
13
-     * If included int incoming params, then this class will also register a Sub Menue Admin page with a different
14
-     * subtitle than the main menu item.
15
-     *
16
-     * @since 4.4.0
17
-     *
18
-     * @var string
19
-     */
20
-    public $subtitle;
12
+	/**
13
+	 * If included int incoming params, then this class will also register a Sub Menue Admin page with a different
14
+	 * subtitle than the main menu item.
15
+	 *
16
+	 * @since 4.4.0
17
+	 *
18
+	 * @var string
19
+	 */
20
+	public $subtitle;
21 21
 
22
-    /**
23
-     * The page to a icon used for this menu.
24
-     *
25
-     * @since  4.4.0
26
-     * @see    http://codex.wordpress.org/Function_Reference/add_menu_page#Parameters
27
-     *        for what can be set for this property.
28
-     * @var string
29
-     */
30
-    public $icon_url;
22
+	/**
23
+	 * The page to a icon used for this menu.
24
+	 *
25
+	 * @since  4.4.0
26
+	 * @see    http://codex.wordpress.org/Function_Reference/add_menu_page#Parameters
27
+	 *        for what can be set for this property.
28
+	 * @var string
29
+	 */
30
+	public $icon_url;
31 31
 
32 32
 
33
-    /**
34
-     * What position in the main menu order for the WP admin menu this menu item
35
-     * should show.
36
-     *
37
-     * @since  4.4.0
38
-     * @see    http://codex.wordpress.org/Function_Reference/add_menu_page#Parameters
39
-     *        for what can be set for this property.
40
-     * @var integer
41
-     */
42
-    public $position;
33
+	/**
34
+	 * What position in the main menu order for the WP admin menu this menu item
35
+	 * should show.
36
+	 *
37
+	 * @since  4.4.0
38
+	 * @see    http://codex.wordpress.org/Function_Reference/add_menu_page#Parameters
39
+	 *        for what can be set for this property.
40
+	 * @var integer
41
+	 */
42
+	public $position;
43 43
 
44 44
 
45
-    /**
46
-     * @throws EE_Error
47
-     */
48
-    public function __construct($menu_args)
49
-    {
50
-        $required = ['menu_label', 'parent_slug', 'menu_slug', 'menu_group', 'menu_order', 'admin_init_page'];
45
+	/**
46
+	 * @throws EE_Error
47
+	 */
48
+	public function __construct($menu_args)
49
+	{
50
+		$required = ['menu_label', 'parent_slug', 'menu_slug', 'menu_group', 'menu_order', 'admin_init_page'];
51 51
 
52
-        parent::__construct($menu_args, $required);
52
+		parent::__construct($menu_args, $required);
53 53
 
54
-        $this->position = ! empty($this->position) ? (int) $this->position : $this->position;
55
-    }
54
+		$this->position = ! empty($this->position) ? (int) $this->position : $this->position;
55
+	}
56 56
 
57 57
 
58
-    /**
59
-     * Uses the proper WP utility for registering a menu page for the main WP pages.
60
-     */
61
-    protected function _add_menu_page()
62
-    {
63
-        $main = add_menu_page(
64
-            $this->title,
65
-            $this->menu_label,
66
-            $this->capability,
67
-            $this->parent_slug,
68
-            $this->menu_callback,
69
-            $this->icon_url,
70
-            $this->position
71
-        );
72
-        if (! empty($this->subtitle)) {
73
-            add_submenu_page(
74
-                $this->parent_slug,
75
-                $this->subtitle,
76
-                $this->subtitle,
77
-                $this->capability,
78
-                $this->menu_slug,
79
-                $this->menu_callback
80
-            );
81
-        }
82
-        return $main;
83
-    }
58
+	/**
59
+	 * Uses the proper WP utility for registering a menu page for the main WP pages.
60
+	 */
61
+	protected function _add_menu_page()
62
+	{
63
+		$main = add_menu_page(
64
+			$this->title,
65
+			$this->menu_label,
66
+			$this->capability,
67
+			$this->parent_slug,
68
+			$this->menu_callback,
69
+			$this->icon_url,
70
+			$this->position
71
+		);
72
+		if (! empty($this->subtitle)) {
73
+			add_submenu_page(
74
+				$this->parent_slug,
75
+				$this->subtitle,
76
+				$this->subtitle,
77
+				$this->capability,
78
+				$this->menu_slug,
79
+				$this->menu_callback
80
+			);
81
+		}
82
+		return $main;
83
+	}
84 84
 }
Please login to merge, or discard this patch.
core/domain/services/admin/privacy/policy/privacy_policy.template.php 2 patches
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@  discard block
 block discarded – undo
7 7
 ?>
8 8
 <h2><?php esc_html_e('Event Registration Data', 'event_espresso'); ?></h2>
9 9
 <p><?php
10
-    esc_html_e(
11
-        'We collect information about you during event registration. This information may include but is not limited to:',
12
-        'event_espresso'
13
-    ); ?></p>
10
+	esc_html_e(
11
+		'We collect information about you during event registration. This information may include but is not limited to:',
12
+		'event_espresso'
13
+	); ?></p>
14 14
 <ul>
15 15
     <li><?php esc_html_e('Your names', 'event_espresso'); ?></li>
16 16
     <li><?php esc_html_e('Billing address', 'event_espresso'); ?></li>
@@ -18,16 +18,16 @@  discard block
 block discarded – undo
18 18
     <li><?php esc_html_e('Email address', 'event_espresso'); ?></li>
19 19
     <li><?php esc_html_e('Phone number', 'event_espresso'); ?></li>
20 20
     <li><?php
21
-        esc_html_e(
22
-            'Location and traffic data (including partial IP address and browser type)',
23
-            'event_espresso'
24
-        ); ?>
21
+		esc_html_e(
22
+			'Location and traffic data (including partial IP address and browser type)',
23
+			'event_espresso'
24
+		); ?>
25 25
     </li>
26 26
     <li><?php
27
-        esc_html_e(
28
-            'Any other details that might be requested from you for the purpose of processing your registration or ticket purchase',
29
-            'event_espresso'
30
-        ); ?>
27
+		esc_html_e(
28
+			'Any other details that might be requested from you for the purpose of processing your registration or ticket purchase',
29
+			'event_espresso'
30
+		); ?>
31 31
     </li>
32 32
 </ul>
33 33
 
@@ -36,101 +36,101 @@  discard block
 block discarded – undo
36 36
     <li><?php esc_html_e('Send you important account/purchase/service information.', 'event_espresso'); ?></li>
37 37
     <li><?php esc_html_e('Respond to your queries, refund requests, or complaints.', 'event_espresso'); ?></li>
38 38
     <li><?php
39
-        esc_html_e(
40
-            'Process payments and prevent fraudulent transactions. We do this on the basis of our legitimate business interests.',
41
-            'event_espresso'
42
-        ); ?></li>
39
+		esc_html_e(
40
+			'Process payments and prevent fraudulent transactions. We do this on the basis of our legitimate business interests.',
41
+			'event_espresso'
42
+		); ?></li>
43 43
     <li><?php
44
-        esc_html_e(
45
-            'Set up and administer your account, provide technical and customer support, and to verify your identity.',
46
-            'event_espresso'
47
-        ); ?></li>
44
+		esc_html_e(
45
+			'Set up and administer your account, provide technical and customer support, and to verify your identity.',
46
+			'event_espresso'
47
+		); ?></li>
48 48
 </ul>
49 49
 
50 50
 <?php if (! empty($active_onsite_payment_methods) || ! empty($active_offsite_payment_methods)) { ?>
51 51
     <h2><?php esc_html_e('Billing Information', 'event_espresso'); ?> </h2>
52 52
     <?php
53
-    // if onsite or offsite payment methods are active
54
-    if (! empty($active_onsite_payment_methods)) { ?>
53
+	// if onsite or offsite payment methods are active
54
+	if (! empty($active_onsite_payment_methods)) { ?>
55 55
         <p><?php
56
-            esc_html_e(
57
-                'In order to process payments, we collect billing information on-site. Sensitive billing information is not stored on our server, but may be handled while in-transit to the payment processing server.',
58
-                'event_espresso'
59
-            ); ?></p>
56
+			esc_html_e(
57
+				'In order to process payments, we collect billing information on-site. Sensitive billing information is not stored on our server, but may be handled while in-transit to the payment processing server.',
58
+				'event_espresso'
59
+			); ?></p>
60 60
         <p><?php
61
-            printf(
62
-                esc_html_x(
63
-                    'Please see the privacy policy of %1$s.',
64
-                    'Please see the privacy policy of PayPal Pro',
65
-                    'event_espresso'
66
-                ),
67
-                implode(
68
-                    ', ',
69
-                    array_merge(
70
-                        $active_onsite_payment_methods,
71
-                        $active_offsite_payment_methods
72
-                    )
73
-                )
74
-            ); ?></p>
61
+			printf(
62
+				esc_html_x(
63
+					'Please see the privacy policy of %1$s.',
64
+					'Please see the privacy policy of PayPal Pro',
65
+					'event_espresso'
66
+				),
67
+				implode(
68
+					', ',
69
+					array_merge(
70
+						$active_onsite_payment_methods,
71
+						$active_offsite_payment_methods
72
+					)
73
+				)
74
+			); ?></p>
75 75
         <p><?php
76
-            esc_html_e(
77
-                'Masked billing information may be stored on our servers (eg only the last 4 digits of credit card numbers are stored: **** **** **** 1234).',
78
-                'event_espresso'
79
-            ); ?></p>
76
+			esc_html_e(
77
+				'Masked billing information may be stored on our servers (eg only the last 4 digits of credit card numbers are stored: **** **** **** 1234).',
78
+				'event_espresso'
79
+			); ?></p>
80 80
     <?php } elseif (! empty($active_offsite_payment_methods)) { // IF OFFSITE PAYMENT METHOD ACTIVE ?>
81 81
         <p><?php
82
-            printf(
83
-                esc_html_x(
84
-                    'Billing information is sent directly to the payment processor, and is not handled by our servers. Please see the privacy policy of %1$s.',
85
-                    'Billing information is sent directly to the payment processor, and is not handled by our servers. Please see the privacy policy of PayPal Pro.',
86
-                    'event_espresso'
87
-                ),
88
-                implode(', ', $active_offsite_payment_methods)
89
-            ); ?></p>
82
+			printf(
83
+				esc_html_x(
84
+					'Billing information is sent directly to the payment processor, and is not handled by our servers. Please see the privacy policy of %1$s.',
85
+					'Billing information is sent directly to the payment processor, and is not handled by our servers. Please see the privacy policy of PayPal Pro.',
86
+					'event_espresso'
87
+				),
88
+				implode(', ', $active_offsite_payment_methods)
89
+			); ?></p>
90 90
     <?php } ?>
91 91
     <h2><?php esc_html_e('Payment Logging', 'event_espresso'); ?></h2>
92 92
     <p><?php
93
-        esc_html_e(
94
-            'Site administrators may keep a log of communications with the payment processors in order to verify payments are being processed correctly. These logs are automatically deleted after a week.',
95
-            'event_espresso'
96
-        ); ?></p>
93
+		esc_html_e(
94
+			'Site administrators may keep a log of communications with the payment processors in order to verify payments are being processed correctly. These logs are automatically deleted after a week.',
95
+			'event_espresso'
96
+		); ?></p>
97 97
 <?php } ?>
98 98
 
99 99
 <h2><?php esc_html_e('Event Registration Cookies', 'event_espresso'); ?></h2>
100 100
 <p><?php
101
-    printf(
102
-        esc_html_x(
103
-            'When you begin registering for an event and select a ticket quantity, a cookie will be used to track your registration. This cookie lasts %1$s.',
104
-            'When you begin registering for an event and select a ticket quantity, a cookie will be used to track your registration. This cookie lasts 2 hours.',
105
-            'event_espresso'
106
-        ),
107
-        $session_lifespan
108
-    ); ?></p>
101
+	printf(
102
+		esc_html_x(
103
+			'When you begin registering for an event and select a ticket quantity, a cookie will be used to track your registration. This cookie lasts %1$s.',
104
+			'When you begin registering for an event and select a ticket quantity, a cookie will be used to track your registration. This cookie lasts 2 hours.',
105
+			'event_espresso'
106
+		),
107
+		$session_lifespan
108
+	); ?></p>
109 109
 
110 110
 <h2><?php esc_html_e('Email History Data', 'event_espresso'); ?></h2>
111 111
 <p><?php
112
-    esc_html_e(
113
-        'We keep a record of the emails sent to you. This is to ensure communication is successfully sent and its information is accurate.',
114
-        'event_espresso'
115
-    ); ?></p>
112
+	esc_html_e(
113
+		'We keep a record of the emails sent to you. This is to ensure communication is successfully sent and its information is accurate.',
114
+		'event_espresso'
115
+	); ?></p>
116 116
 
117 117
 <h2><?php esc_html_e('Event Check-In Record', 'event_espresso'); ?></h2>
118 118
 <p><?php
119
-    esc_html_e(
120
-        'When you attend an event, an event manager may record the time you check in or out of the event.',
121
-        'event_espresso'
122
-    ); ?></p>
119
+	esc_html_e(
120
+		'When you attend an event, an event manager may record the time you check in or out of the event.',
121
+		'event_espresso'
122
+	); ?></p>
123 123
 
124 124
 <h2><?php esc_html_e('Event Registration Data Retention', 'event_espresso'); ?></h2>
125 125
 <p><?php
126
-    esc_html_e(
127
-        'Personal data is stored at least until the date of the event, and may be kept indefinitely in case of future registrations.',
128
-        'event_espresso'
129
-    ); ?></p>
126
+	esc_html_e(
127
+		'Personal data is stored at least until the date of the event, and may be kept indefinitely in case of future registrations.',
128
+		'event_espresso'
129
+	); ?></p>
130 130
 
131 131
 <h2><?php esc_html_e('Event Registration Data Erasure and Export', 'event_espresso'); ?></h2>
132 132
 <p><?php
133
-    esc_html_e(
134
-        'You have the right to request your personal data be sent to you electronically, and the right to request your registration data be erased after the event. To do so, please contact the event manager or site administrator.',
135
-        'event_espresso'
136
-    ); ?></p>
133
+	esc_html_e(
134
+		'You have the right to request your personal data be sent to you electronically, and the right to request your registration data be erased after the event. To do so, please contact the event manager or site administrator.',
135
+		'event_espresso'
136
+	); ?></p>
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
         ); ?></li>
48 48
 </ul>
49 49
 
50
-<?php if (! empty($active_onsite_payment_methods) || ! empty($active_offsite_payment_methods)) { ?>
50
+<?php if ( ! empty($active_onsite_payment_methods) || ! empty($active_offsite_payment_methods)) { ?>
51 51
     <h2><?php esc_html_e('Billing Information', 'event_espresso'); ?> </h2>
52 52
     <?php
53 53
     // if onsite or offsite payment methods are active
54
-    if (! empty($active_onsite_payment_methods)) { ?>
54
+    if ( ! empty($active_onsite_payment_methods)) { ?>
55 55
         <p><?php
56 56
             esc_html_e(
57 57
                 'In order to process payments, we collect billing information on-site. Sensitive billing information is not stored on our server, but may be handled while in-transit to the payment processing server.',
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
                 'Masked billing information may be stored on our servers (eg only the last 4 digits of credit card numbers are stored: **** **** **** 1234).',
78 78
                 'event_espresso'
79 79
             ); ?></p>
80
-    <?php } elseif (! empty($active_offsite_payment_methods)) { // IF OFFSITE PAYMENT METHOD ACTIVE ?>
80
+    <?php } elseif ( ! empty($active_offsite_payment_methods)) { // IF OFFSITE PAYMENT METHOD ACTIVE ?>
81 81
         <p><?php
82 82
             printf(
83 83
                 esc_html_x(
Please login to merge, or discard this patch.
public/Espresso_Arabica_2014/loop-espresso_events.php 2 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -11,48 +11,48 @@
 block discarded – undo
11 11
  * @version     4+
12 12
  */
13 13
 if (have_posts()) :
14
-    if (apply_filters('FHEE__archive_espresso_events_template__show_header', true)) : ?>
14
+	if (apply_filters('FHEE__archive_espresso_events_template__show_header', true)) : ?>
15 15
         <header class="page-header">
16 16
             <h1 class="page-title">
17 17
                 <?php
18
-                if (is_day()) :
19
-                    printf(esc_html__('Today\'s Events: %s', 'event_espresso'), get_the_date());
20
-                elseif (is_month()) :
21
-                    printf(
22
-                        esc_html__('Events This Month: %s', 'event_espresso'),
23
-                        get_the_date(_x('F Y', 'monthly archives date format', 'event_espresso'))
24
-                    );
25
-                elseif (is_year()) :
26
-                    printf(
27
-                        esc_html__('Events This Year: %s', 'event_espresso'),
28
-                        get_the_date(_x('Y', 'yearly archives date format', 'event_espresso'))
29
-                    );
30
-                else :
31
-                    echo apply_filters(
32
-                        'FHEE__archive_espresso_events_template__upcoming_events_h1',
33
-                        esc_html__('Upcoming Events', 'event_espresso')
34
-                    );
35
-                endif;
36
-                ?>
18
+				if (is_day()) :
19
+					printf(esc_html__('Today\'s Events: %s', 'event_espresso'), get_the_date());
20
+				elseif (is_month()) :
21
+					printf(
22
+						esc_html__('Events This Month: %s', 'event_espresso'),
23
+						get_the_date(_x('F Y', 'monthly archives date format', 'event_espresso'))
24
+					);
25
+				elseif (is_year()) :
26
+					printf(
27
+						esc_html__('Events This Year: %s', 'event_espresso'),
28
+						get_the_date(_x('Y', 'yearly archives date format', 'event_espresso'))
29
+					);
30
+				else :
31
+					echo apply_filters(
32
+						'FHEE__archive_espresso_events_template__upcoming_events_h1',
33
+						esc_html__('Upcoming Events', 'event_espresso')
34
+					);
35
+				endif;
36
+				?>
37 37
             </h1>
38 38
 
39 39
         </header><!-- .page-header -->
40 40
 
41 41
         <?php
42
-    endif;
43
-    // allow other stuff
44
-    do_action('AHEE__archive_espresso_events_template__before_loop');
45
-    // Start the Loop.
46
-    while (have_posts()) : the_post();
47
-        // Include the post TYPE-specific template for the content.
48
-        espresso_get_template_part('content', 'espresso_events-shortcode');
49
-    endwhile;
50
-    // Previous/next page navigation.
51
-    espresso_pagination();
52
-    // allow moar other stuff
53
-    do_action('AHEE__archive_espresso_events_template__after_loop');
42
+	endif;
43
+	// allow other stuff
44
+	do_action('AHEE__archive_espresso_events_template__before_loop');
45
+	// Start the Loop.
46
+	while (have_posts()) : the_post();
47
+		// Include the post TYPE-specific template for the content.
48
+		espresso_get_template_part('content', 'espresso_events-shortcode');
49
+	endwhile;
50
+	// Previous/next page navigation.
51
+	espresso_pagination();
52
+	// allow moar other stuff
53
+	do_action('AHEE__archive_espresso_events_template__after_loop');
54 54
 else :
55
-    // If no content, include the "No posts found" template.
56
-    espresso_get_template_part('content', 'none');
55
+	// If no content, include the "No posts found" template.
56
+	espresso_get_template_part('content', 'none');
57 57
 endif;
58 58
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,11 +27,13 @@  discard block
 block discarded – undo
27 27
                         esc_html__('Events This Year: %s', 'event_espresso'),
28 28
                         get_the_date(_x('Y', 'yearly archives date format', 'event_espresso'))
29 29
                     );
30
-                else :
30
+                else {
31
+                	:
31 32
                     echo apply_filters(
32 33
                         'FHEE__archive_espresso_events_template__upcoming_events_h1',
33 34
                         esc_html__('Upcoming Events', 'event_espresso')
34 35
                     );
36
+                }
35 37
                 endif;
36 38
                 ?>
37 39
             </h1>
@@ -51,8 +53,10 @@  discard block
 block discarded – undo
51 53
     espresso_pagination();
52 54
     // allow moar other stuff
53 55
     do_action('AHEE__archive_espresso_events_template__after_loop');
54
-else :
56
+else {
57
+	:
55 58
     // If no content, include the "No posts found" template.
56 59
     espresso_get_template_part('content', 'none');
60
+}
57 61
 endif;
58 62
 
Please login to merge, or discard this patch.
public/Espresso_Arabica_2014/functions.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@  discard block
 block discarded – undo
9 9
  * @ link			http://www.eventespresso.com
10 10
  * @ version		4+
11 11
  */
12
-define( 'EE_THEME_FUNCTIONS_LOADED', TRUE );
12
+define('EE_THEME_FUNCTIONS_LOADED', TRUE);
13 13
 
14
-if ( ! function_exists( 'espresso_pagination' ) ) {
14
+if ( ! function_exists('espresso_pagination')) {
15 15
 	/**
16 16
 	 *    espresso_pagination
17 17
 	 *
@@ -23,21 +23,21 @@  discard block
 block discarded – undo
23 23
 		$big = 999999999; // need an unlikely integer
24 24
 		$pagination = paginate_links(
25 25
 			array(
26
-				'base'         => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
26
+				'base'         => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
27 27
 				'format'       => '?paged=%#%',
28
-				'current'      => max( 1, get_query_var( 'paged' ) ),
28
+				'current'      => max(1, get_query_var('paged')),
29 29
 				'total'        => $wp_query->max_num_pages,
30 30
 				'show_all'     => true,
31 31
 				'end_size'     => 10,
32 32
 				'mid_size'     => 6,
33 33
 				'prev_next'    => true,
34
-				'prev_text'    => esc_html__( '&lsaquo; PREV', 'event_espresso' ),
35
-				'next_text'    => esc_html__( 'NEXT &rsaquo;', 'event_espresso' ),
34
+				'prev_text'    => esc_html__('&lsaquo; PREV', 'event_espresso'),
35
+				'next_text'    => esc_html__('NEXT &rsaquo;', 'event_espresso'),
36 36
 				'type'         => 'plain',
37 37
 				'add_args'     => false,
38 38
 				'add_fragment' => ''
39 39
 			)
40 40
 		);
41
-		echo ! empty( $pagination ) ? '<div class="ee-pagination-dv ee-clear-float">' . $pagination . '</div>' : '';
41
+		echo ! empty($pagination) ? '<div class="ee-pagination-dv ee-clear-float">'.$pagination.'</div>' : '';
42 42
 	}
43 43
 }
44 44
\ No newline at end of file
Please login to merge, or discard this patch.
core/libraries/messages/data_class/EE_Messages_REG_incoming_data.class.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,14 +31,14 @@  discard block
 block discarded – undo
31 31
     {
32 32
         $filtered_reg_status = null;
33 33
 
34
-        if (! is_array($data) && $data instanceof EE_Registration) {
34
+        if ( ! is_array($data) && $data instanceof EE_Registration) {
35 35
             $this->reg_obj = $data;
36 36
         } else {
37 37
             $this->reg_obj = is_array($data) && isset($data[0]) && $data[0] instanceof EE_Registration ? $data[0] : null;
38 38
             $filtered_reg_status = is_array($data) && ! empty($data[1]) ? $data[1] : null;
39 39
         }
40 40
 
41
-        if (! $this->reg_obj instanceof EE_Registration) {
41
+        if ( ! $this->reg_obj instanceof EE_Registration) {
42 42
             throw new EE_Error(
43 43
                 sprintf(
44 44
                     esc_html__('%1$s requires the incoming data argument to be an instance of %2$s or an array where the first value is an instance of %2$s', 'event_espresso'),
@@ -66,16 +66,16 @@  discard block
 block discarded – undo
66 66
     public static function convert_data_for_persistent_storage($data)
67 67
     {
68 68
         $prepped_data = array();
69
-        if (! is_array($data) && $data instanceof EE_Registration) {
69
+        if ( ! is_array($data) && $data instanceof EE_Registration) {
70 70
             $prepped_data['Registration'] = $data->ID();
71 71
             return $prepped_data;
72
-        } elseif (! is_array($data)) {
72
+        } elseif ( ! is_array($data)) {
73 73
             return array();
74 74
         } else {
75 75
             if ($data[0] instanceof EE_Registration) {
76 76
                 $prepped_data['Registration'] = $data[0];
77 77
             }
78
-            if (! empty($data[1])) {
78
+            if ( ! empty($data[1])) {
79 79
                 $prepped_data['filter'] = $data[1];
80 80
             }
81 81
         }
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         $this->txn = $this->reg_obj->transaction();
122 122
         // possible session stuff?
123 123
         $session = $this->txn->session_data();
124
-        $session_data =  $session instanceof EE_Session ? $session->get_session_data() : array();
124
+        $session_data = $session instanceof EE_Session ? $session->get_session_data() : array();
125 125
 
126 126
         // other data from the session (if possible)
127 127
         $this->user_id = isset($session_data['user_id']) ? $session_data['user_id'] : '';
Please login to merge, or discard this patch.
Indentation   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -15,137 +15,137 @@
 block discarded – undo
15 15
  */
16 16
 class EE_Messages_REG_incoming_data extends EE_Messages_incoming_data
17 17
 {
18
-    /**
19
-     * For the constructor of this special preview class.
20
-     *
21
-     * The data is expected to be an array that came from the request data
22
-     * and should have at least one property from the list looked for.
23
-     *
24
-     * @param EE_Registration|array $data
25
-     * @throws \EE_Error
26
-     */
27
-    public function __construct($data)
28
-    {
29
-        $filtered_reg_status = null;
30
-
31
-        if (! is_array($data) && $data instanceof EE_Registration) {
32
-            $this->reg_obj = $data;
33
-        } else {
34
-            $this->reg_obj = is_array($data) && isset($data[0]) && $data[0] instanceof EE_Registration ? $data[0] : null;
35
-            $filtered_reg_status = is_array($data) && ! empty($data[1]) ? $data[1] : null;
36
-        }
37
-
38
-        if (! $this->reg_obj instanceof EE_Registration) {
39
-            throw new EE_Error(
40
-                sprintf(
41
-                    esc_html__('%1$s requires the incoming data argument to be an instance of %2$s or an array where the first value is an instance of %2$s', 'event_espresso'),
42
-                    'EE_Messages_REG_incoming_data',
43
-                    'EE_Registration'
44
-                )
45
-            );
46
-        }
47
-
48
-        $data = array(
49
-            'reg_obj' => $this->reg_obj,
50
-            'filtered_reg_status' => $filtered_reg_status
51
-            );
52
-
53
-        parent::__construct($data);
54
-    }
55
-
56
-    /**
57
-     * Returns database safe representation of the data later used to when instantiating this object.
58
-     *
59
-     * @param mixed $data The incoming data to be prepped.
60
-     *
61
-     * @return array   The prepped data for db
62
-     */
63
-    public static function convert_data_for_persistent_storage($data)
64
-    {
65
-        $prepped_data = array();
66
-        if (! is_array($data) && $data instanceof EE_Registration) {
67
-            $prepped_data['Registration'] = $data->ID();
68
-            return $prepped_data;
69
-        } elseif (! is_array($data)) {
70
-            return array();
71
-        } else {
72
-            if ($data[0] instanceof EE_Registration) {
73
-                $prepped_data['Registration'] = $data[0];
74
-            }
75
-            if (! empty($data[1])) {
76
-                $prepped_data['filter'] = $data[1];
77
-            }
78
-        }
79
-
80
-        return $prepped_data;
81
-    }
82
-
83
-    /**
84
-     * Data that has been stored in persistent storage that was prepped by _convert_data_for_persistent_storage
85
-     * can be sent into this method and converted back into the format used for instantiating with this data handler.
86
-     *
87
-     * @param $data
88
-     *
89
-     * @return mixed
90
-     */
91
-    public static function convert_data_from_persistent_storage($data)
92
-    {
93
-        $registration = null;
94
-        // $data['Registration'] could be either an ID (back compat) or a registration object (prepped using old system).
95
-        if (isset($data['Registration'])) {
96
-            $registration = $data['Registration'] instanceof EE_Registration
97
-                ? $data['Registration']
98
-                : EEM_Registration::instance()->get_one_by_ID($data['Registration']);
99
-        }
100
-        $prepped_data = array(
101
-            0 => $registration,
102
-            1 => isset($data['filter']) ? $data['filter'] : null
103
-        );
104
-        return $prepped_data;
105
-    }
106
-
107
-
108
-    /**
109
-     * This will just setup the _events property in the expected format.
110
-     * @return void
111
-     */
112
-    protected function _setup_data()
113
-    {
114
-
115
-        // now let's loop and set up the _events property.  At the same time we'll set up attendee properties.
116
-        $this->filtered_reg_status = $this->_data['filtered_reg_status'];
117
-        // get txn
118
-        $this->txn = $this->reg_obj->transaction();
119
-        // possible session stuff?
120
-        $session = $this->txn->session_data();
121
-        $session_data =  $session instanceof EE_Session ? $session->get_session_data() : array();
122
-
123
-        // other data from the session (if possible)
124
-        $this->user_id = isset($session_data['user_id']) ? $session_data['user_id'] : '';
125
-        $this->ip_address = isset($session_data['ip_address']) ? $session_data['ip_address'] : '';
126
-        $this->user_agent = isset($session_data['user_agent']) ? $session_data['user_agent'] : '';
127
-        $this->init_access = $this->last_access = '';
128
-
129
-        $this->payment = $this->txn->get_first_related('Payment');
130
-        // if there is no payments associated with the transaction
131
-        // then we just create a default payment object for potential parsing.
132
-        $this->payment = empty($this->payment)
133
-            ? EE_Payment::new_instance(
134
-                array(
135
-                    'STS_ID'               => EEM_Payment::status_id_pending,
136
-                    'PAY_timestamp'        => time(),
137
-                    'PMD_ID'               => $this->txn->payment_method_ID(),
138
-                    'PAY_gateway_response' => $this->txn->gateway_response_on_transaction(),
139
-                )
140
-            )
141
-            : $this->payment;
142
-
143
-
144
-        // get reg_objs for txn
145
-        $this->reg_objs = $this->txn->registrations();
146
-
147
-        // now we can set things up like we do for other handlers
148
-
149
-        $this->_assemble_data();
150
-    }
18
+	/**
19
+	 * For the constructor of this special preview class.
20
+	 *
21
+	 * The data is expected to be an array that came from the request data
22
+	 * and should have at least one property from the list looked for.
23
+	 *
24
+	 * @param EE_Registration|array $data
25
+	 * @throws \EE_Error
26
+	 */
27
+	public function __construct($data)
28
+	{
29
+		$filtered_reg_status = null;
30
+
31
+		if (! is_array($data) && $data instanceof EE_Registration) {
32
+			$this->reg_obj = $data;
33
+		} else {
34
+			$this->reg_obj = is_array($data) && isset($data[0]) && $data[0] instanceof EE_Registration ? $data[0] : null;
35
+			$filtered_reg_status = is_array($data) && ! empty($data[1]) ? $data[1] : null;
36
+		}
37
+
38
+		if (! $this->reg_obj instanceof EE_Registration) {
39
+			throw new EE_Error(
40
+				sprintf(
41
+					esc_html__('%1$s requires the incoming data argument to be an instance of %2$s or an array where the first value is an instance of %2$s', 'event_espresso'),
42
+					'EE_Messages_REG_incoming_data',
43
+					'EE_Registration'
44
+				)
45
+			);
46
+		}
47
+
48
+		$data = array(
49
+			'reg_obj' => $this->reg_obj,
50
+			'filtered_reg_status' => $filtered_reg_status
51
+			);
52
+
53
+		parent::__construct($data);
54
+	}
55
+
56
+	/**
57
+	 * Returns database safe representation of the data later used to when instantiating this object.
58
+	 *
59
+	 * @param mixed $data The incoming data to be prepped.
60
+	 *
61
+	 * @return array   The prepped data for db
62
+	 */
63
+	public static function convert_data_for_persistent_storage($data)
64
+	{
65
+		$prepped_data = array();
66
+		if (! is_array($data) && $data instanceof EE_Registration) {
67
+			$prepped_data['Registration'] = $data->ID();
68
+			return $prepped_data;
69
+		} elseif (! is_array($data)) {
70
+			return array();
71
+		} else {
72
+			if ($data[0] instanceof EE_Registration) {
73
+				$prepped_data['Registration'] = $data[0];
74
+			}
75
+			if (! empty($data[1])) {
76
+				$prepped_data['filter'] = $data[1];
77
+			}
78
+		}
79
+
80
+		return $prepped_data;
81
+	}
82
+
83
+	/**
84
+	 * Data that has been stored in persistent storage that was prepped by _convert_data_for_persistent_storage
85
+	 * can be sent into this method and converted back into the format used for instantiating with this data handler.
86
+	 *
87
+	 * @param $data
88
+	 *
89
+	 * @return mixed
90
+	 */
91
+	public static function convert_data_from_persistent_storage($data)
92
+	{
93
+		$registration = null;
94
+		// $data['Registration'] could be either an ID (back compat) or a registration object (prepped using old system).
95
+		if (isset($data['Registration'])) {
96
+			$registration = $data['Registration'] instanceof EE_Registration
97
+				? $data['Registration']
98
+				: EEM_Registration::instance()->get_one_by_ID($data['Registration']);
99
+		}
100
+		$prepped_data = array(
101
+			0 => $registration,
102
+			1 => isset($data['filter']) ? $data['filter'] : null
103
+		);
104
+		return $prepped_data;
105
+	}
106
+
107
+
108
+	/**
109
+	 * This will just setup the _events property in the expected format.
110
+	 * @return void
111
+	 */
112
+	protected function _setup_data()
113
+	{
114
+
115
+		// now let's loop and set up the _events property.  At the same time we'll set up attendee properties.
116
+		$this->filtered_reg_status = $this->_data['filtered_reg_status'];
117
+		// get txn
118
+		$this->txn = $this->reg_obj->transaction();
119
+		// possible session stuff?
120
+		$session = $this->txn->session_data();
121
+		$session_data =  $session instanceof EE_Session ? $session->get_session_data() : array();
122
+
123
+		// other data from the session (if possible)
124
+		$this->user_id = isset($session_data['user_id']) ? $session_data['user_id'] : '';
125
+		$this->ip_address = isset($session_data['ip_address']) ? $session_data['ip_address'] : '';
126
+		$this->user_agent = isset($session_data['user_agent']) ? $session_data['user_agent'] : '';
127
+		$this->init_access = $this->last_access = '';
128
+
129
+		$this->payment = $this->txn->get_first_related('Payment');
130
+		// if there is no payments associated with the transaction
131
+		// then we just create a default payment object for potential parsing.
132
+		$this->payment = empty($this->payment)
133
+			? EE_Payment::new_instance(
134
+				array(
135
+					'STS_ID'               => EEM_Payment::status_id_pending,
136
+					'PAY_timestamp'        => time(),
137
+					'PMD_ID'               => $this->txn->payment_method_ID(),
138
+					'PAY_gateway_response' => $this->txn->gateway_response_on_transaction(),
139
+				)
140
+			)
141
+			: $this->payment;
142
+
143
+
144
+		// get reg_objs for txn
145
+		$this->reg_objs = $this->txn->registrations();
146
+
147
+		// now we can set things up like we do for other handlers
148
+
149
+		$this->_assemble_data();
150
+	}
151 151
 }
Please login to merge, or discard this patch.
libraries/messages/data_class/EE_Messages_Gateways_incoming_data.class.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     {
33 33
 
34 34
         // test for valid params
35
-        if (! ( $data[0] instanceof EE_Transaction )) {
35
+        if ( ! ($data[0] instanceof EE_Transaction)) {
36 36
             throw new EE_Error(esc_html__('Incoming data for the Gateways data handler must have an EE_Transaction object as the value for the first array index.', 'event_espresso'));
37 37
         }
38 38
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
             $pmt_obj = $this->_get_empty_payment_obj($data[0]);
41 41
         }
42 42
 
43
-        if (! empty($data[2])) {
43
+        if ( ! empty($data[2])) {
44 44
             $filtered_reg_status = $data[2];
45 45
         }
46 46
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
             $prepped_data['Payment'] = $data[1]->ID();
76 76
         }
77 77
 
78
-        if (! empty($data[2])) {
78
+        if ( ! empty($data[2])) {
79 79
             $prepped_data['filter'] = $data[2];
80 80
         }
81 81
 
Please login to merge, or discard this patch.
Indentation   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -13,141 +13,141 @@
 block discarded – undo
13 13
  */
14 14
 class EE_Messages_Gateways_incoming_data extends EE_Messages_incoming_data
15 15
 {
16
-    /**
17
-     * This holds the incoming payment object
18
-     * @var EE_Payment
19
-     */
20
-    public $payment;
21
-
22
-
23
-
24
-    /**
25
-     * incoming data is expected to be a EE_Transaction object and (possibly) EE_Payment object in an array.
26
-     *
27
-     * @param array $data
28
-     * @throws EE_Error
29
-     */
30
-    public function __construct($data)
31
-    {
32
-
33
-        // test for valid params
34
-        if (! ( $data[0] instanceof EE_Transaction )) {
35
-            throw new EE_Error(esc_html__('Incoming data for the Gateways data handler must have an EE_Transaction object as the value for the first array index.', 'event_espresso'));
36
-        }
37
-
38
-        if (empty($data[1]) || ! $data[1] instanceof  EE_Payment) {
39
-            $pmt_obj = $this->_get_empty_payment_obj($data[0]);
40
-        }
41
-
42
-        if (! empty($data[2])) {
43
-            $filtered_reg_status = $data[2];
44
-        }
16
+	/**
17
+	 * This holds the incoming payment object
18
+	 * @var EE_Payment
19
+	 */
20
+	public $payment;
21
+
22
+
23
+
24
+	/**
25
+	 * incoming data is expected to be a EE_Transaction object and (possibly) EE_Payment object in an array.
26
+	 *
27
+	 * @param array $data
28
+	 * @throws EE_Error
29
+	 */
30
+	public function __construct($data)
31
+	{
32
+
33
+		// test for valid params
34
+		if (! ( $data[0] instanceof EE_Transaction )) {
35
+			throw new EE_Error(esc_html__('Incoming data for the Gateways data handler must have an EE_Transaction object as the value for the first array index.', 'event_espresso'));
36
+		}
37
+
38
+		if (empty($data[1]) || ! $data[1] instanceof  EE_Payment) {
39
+			$pmt_obj = $this->_get_empty_payment_obj($data[0]);
40
+		}
41
+
42
+		if (! empty($data[2])) {
43
+			$filtered_reg_status = $data[2];
44
+		}
45 45
 
46
-        $data = array(
47
-            'txn_obj' => $data[0],
48
-            'pmt_obj' => isset($pmt_obj) ? $pmt_obj : $data[1],
49
-            'filtered_reg_status' => isset($filtered_reg_status) ? $filtered_reg_status : null
50
-            );
51
-        parent::__construct($data);
52
-    }
53
-
54
-
55
-
56
-
57
-
58
-    /**
59
-     * Returns database safe representation of the data later used to when instantiating this object.
60
-     *
61
-     * @param array $data The incoming data to be prepped.
62
-     *
63
-     * @return array   The prepped data for db
64
-     */
65
-    public static function convert_data_for_persistent_storage($data)
66
-    {
67
-        $prepped_data = array();
68
-
69
-        if ($data[0] instanceof EE_Transaction) {
70
-            $prepped_data['Transaction'] = $data[0]->ID();
71
-        }
72
-
73
-        if (isset($data[1]) && $data[1] instanceof EE_Payment) {
74
-            $prepped_data['Payment'] = $data[1]->ID();
75
-        }
76
-
77
-        if (! empty($data[2])) {
78
-            $prepped_data['filter'] = $data[2];
79
-        }
80
-
81
-        return $prepped_data;
82
-    }
83
-
84
-
85
-
86
-
87
-
88
-
89
-    /**
90
-     * Data that has been stored in persistent storage that was prepped by _convert_data_for_persistent_storage
91
-     * can be sent into this method and converted back into the format used for instantiating with this data handler.
92
-     *
93
-     * @param array  $data
94
-     *
95
-     * @return array
96
-     */
97
-    public static function convert_data_from_persistent_storage($data)
98
-    {
99
-        $prepped_data = array(
100
-            0 => isset($data['Transaction']) ? EEM_Transaction::instance()->get_one_by_ID($data['Transaction']) : null,
101
-            1 => isset($data['Payment']) ? EEM_Payment::instance()->get_one_by_ID($data['Payment']) : null,
102
-            2 => isset($data['filter']) ? $data['filter'] : null
103
-        );
104
-        return $prepped_data;
105
-    }
106
-
107
-
108
-    /**
109
-     * This sets up an empty EE_Payment object for the purpose of shortcode parsing.  Note that this doesn't actually get saved to the db.
110
-     * @param \EE_Transaction $txn
111
-     * @return \EE_Payment
112
-     */
113
-    private function _get_empty_payment_obj(EE_Transaction $txn)
114
-    {
115
-        $PMT = EE_Payment::new_instance(array(
116
-            'STS_ID' => EEM_Payment::status_id_pending,
117
-            'PAY_timestamp' => time(),
118
-            'PMD_ID' => $txn->payment_method_ID(),
119
-            'PAY_gateway_response' => $txn->gateway_response_on_transaction(),
120
-            ));
121
-        return $PMT;
122
-    }
123
-
124
-
125
-
126
-    /**
127
-     * _setup_data
128
-     *
129
-     * @throws EE_Error
130
-     */
131
-    protected function _setup_data()
132
-    {
133
-
134
-        $this->reg_info = array();
135
-
136
-        $this->txn = $this->_data['txn_obj'];
137
-        $this->payment = $this->_data['pmt_obj'];
138
-        $this->filtered_reg_status = $this->_data['filtered_reg_status'];
139
-        $this->incoming_data = $this->_data;
140
-
141
-        $session_data = $this->txn->session_data();
142
-
143
-
144
-        // other data from the session (if possible)
145
-        $this->user_id = isset($session_data['user_id']) ? $session_data['user_id'] : '';
146
-        $this->ip_address = isset($session_data['ip_address']) ? $session_data['ip_address'] : '';
147
-        $this->user_agent = isset($session_data['user_agent']) ? $session_data['user_agent'] : '';
148
-        $this->init_access = $this->last_access = '';
149
-        // get all non-trashed registrations
150
-        $this->reg_objs = $this->txn->registrations(array(array('REG_deleted' => false)));
151
-        $this->_assemble_data();
152
-    }
46
+		$data = array(
47
+			'txn_obj' => $data[0],
48
+			'pmt_obj' => isset($pmt_obj) ? $pmt_obj : $data[1],
49
+			'filtered_reg_status' => isset($filtered_reg_status) ? $filtered_reg_status : null
50
+			);
51
+		parent::__construct($data);
52
+	}
53
+
54
+
55
+
56
+
57
+
58
+	/**
59
+	 * Returns database safe representation of the data later used to when instantiating this object.
60
+	 *
61
+	 * @param array $data The incoming data to be prepped.
62
+	 *
63
+	 * @return array   The prepped data for db
64
+	 */
65
+	public static function convert_data_for_persistent_storage($data)
66
+	{
67
+		$prepped_data = array();
68
+
69
+		if ($data[0] instanceof EE_Transaction) {
70
+			$prepped_data['Transaction'] = $data[0]->ID();
71
+		}
72
+
73
+		if (isset($data[1]) && $data[1] instanceof EE_Payment) {
74
+			$prepped_data['Payment'] = $data[1]->ID();
75
+		}
76
+
77
+		if (! empty($data[2])) {
78
+			$prepped_data['filter'] = $data[2];
79
+		}
80
+
81
+		return $prepped_data;
82
+	}
83
+
84
+
85
+
86
+
87
+
88
+
89
+	/**
90
+	 * Data that has been stored in persistent storage that was prepped by _convert_data_for_persistent_storage
91
+	 * can be sent into this method and converted back into the format used for instantiating with this data handler.
92
+	 *
93
+	 * @param array  $data
94
+	 *
95
+	 * @return array
96
+	 */
97
+	public static function convert_data_from_persistent_storage($data)
98
+	{
99
+		$prepped_data = array(
100
+			0 => isset($data['Transaction']) ? EEM_Transaction::instance()->get_one_by_ID($data['Transaction']) : null,
101
+			1 => isset($data['Payment']) ? EEM_Payment::instance()->get_one_by_ID($data['Payment']) : null,
102
+			2 => isset($data['filter']) ? $data['filter'] : null
103
+		);
104
+		return $prepped_data;
105
+	}
106
+
107
+
108
+	/**
109
+	 * This sets up an empty EE_Payment object for the purpose of shortcode parsing.  Note that this doesn't actually get saved to the db.
110
+	 * @param \EE_Transaction $txn
111
+	 * @return \EE_Payment
112
+	 */
113
+	private function _get_empty_payment_obj(EE_Transaction $txn)
114
+	{
115
+		$PMT = EE_Payment::new_instance(array(
116
+			'STS_ID' => EEM_Payment::status_id_pending,
117
+			'PAY_timestamp' => time(),
118
+			'PMD_ID' => $txn->payment_method_ID(),
119
+			'PAY_gateway_response' => $txn->gateway_response_on_transaction(),
120
+			));
121
+		return $PMT;
122
+	}
123
+
124
+
125
+
126
+	/**
127
+	 * _setup_data
128
+	 *
129
+	 * @throws EE_Error
130
+	 */
131
+	protected function _setup_data()
132
+	{
133
+
134
+		$this->reg_info = array();
135
+
136
+		$this->txn = $this->_data['txn_obj'];
137
+		$this->payment = $this->_data['pmt_obj'];
138
+		$this->filtered_reg_status = $this->_data['filtered_reg_status'];
139
+		$this->incoming_data = $this->_data;
140
+
141
+		$session_data = $this->txn->session_data();
142
+
143
+
144
+		// other data from the session (if possible)
145
+		$this->user_id = isset($session_data['user_id']) ? $session_data['user_id'] : '';
146
+		$this->ip_address = isset($session_data['ip_address']) ? $session_data['ip_address'] : '';
147
+		$this->user_agent = isset($session_data['user_agent']) ? $session_data['user_agent'] : '';
148
+		$this->init_access = $this->last_access = '';
149
+		// get all non-trashed registrations
150
+		$this->reg_objs = $this->txn->registrations(array(array('REG_deleted' => false)));
151
+		$this->_assemble_data();
152
+	}
153 153
 }
Please login to merge, or discard this patch.