@@ -19,200 +19,200 @@ |
||
19 | 19 | { |
20 | 20 | |
21 | 21 | |
22 | - protected function _init_props() |
|
23 | - { |
|
24 | - $this->label = __('Primary_Registration Details Shortcodes', 'event_espresso'); |
|
25 | - $this->description = __('All shortcodes specific primary registrant data', 'event_espresso'); |
|
26 | - $this->_shortcodes = array( |
|
27 | - '[PRIMARY_REGISTRANT_FNAME]' => __( |
|
28 | - 'Parses to the first name of the primary registration for the transaction.', |
|
29 | - 'event_espresso' |
|
30 | - ), |
|
31 | - '[PRIMARY_REGISTRANT_LNAME]' => __( |
|
32 | - 'Parses to the last name of the primary registration for the transaction.', |
|
33 | - 'event_espresso' |
|
34 | - ), |
|
35 | - '[PRIMARY_REGISTRANT_EMAIL]' => __( |
|
36 | - 'Parses to the email address of the primary registration for the transaction.', |
|
37 | - 'event_espresso' |
|
38 | - ), |
|
39 | - '[PRIMARY_REGISTRANT_REGISTRATION_ID]' => __( |
|
40 | - 'Parses to the registration ID of the primary registrant for the transaction.', |
|
41 | - 'event_espresso' |
|
42 | - ), |
|
43 | - '[PRIMARY_REGISTRANT_REGISTRATION_CODE]' => __( |
|
44 | - 'Parses to the registration code of the primary registrant for the transaction.', |
|
45 | - 'event_espresso' |
|
46 | - ), |
|
47 | - '[PRIMARY_REGISTRANT_PHONE_NUMBER]' => __( |
|
48 | - 'The Phone Number for the primary registrant for the transaction.', |
|
49 | - 'event_espresso' |
|
50 | - ), |
|
51 | - '[PRIMARY_REGISTRANT_ADDRESS]' => __( |
|
52 | - 'The Address for the primary registrant for the transaction.', |
|
53 | - 'event_espresso' |
|
54 | - ), |
|
55 | - '[PRIMARY_REGISTRANT_ADDRESS2]' => __( |
|
56 | - 'Whatever was in the address 2 field for the primary registrant for the transaction.', |
|
57 | - 'event_espresso' |
|
58 | - ), |
|
59 | - '[PRIMARY_REGISTRANT_CITY]' => __( |
|
60 | - 'The city for the primary registrant for the transaction.', |
|
61 | - 'event_espresso' |
|
62 | - ), |
|
63 | - '[PRIMARY_REGISTRANT_ZIP_PC]' => __( |
|
64 | - 'The ZIP (or Postal) Code for the primary registrant for the transaction.', |
|
65 | - 'event_espresso' |
|
66 | - ), |
|
67 | - '[PRIMARY_REGISTRANT_ADDRESS_STATE]' => __( |
|
68 | - 'The state/province for the primary registrant for the transaction.', |
|
69 | - 'event_espresso' |
|
70 | - ), |
|
71 | - '[PRIMARY_REGISTRANT_COUNTRY]' => __( |
|
72 | - 'The country for the primary registrant for the transaction.', |
|
73 | - 'event_espresso' |
|
74 | - ), |
|
75 | - '[PRIMARY_REGISTRANT_REGISTRATION_DATE]' => __( |
|
76 | - 'The date the registration occured for the primary registration.', |
|
77 | - 'event_espresso' |
|
78 | - ), |
|
79 | - '[PRIMARY_REGISTRANT_FRONTEND_EDIT_REG_LINK]' => __( |
|
80 | - 'Generates a link for the given registration to edit this registration details on the frontend.', |
|
81 | - 'event_espresso' |
|
82 | - ), |
|
83 | - '[PRIMARY_REGISTRANT_ANSWER_*]' => __( |
|
84 | - 'This is a special dynamic shortcode. After the "*", add the exact text of an existing question, and if there is an answer for that question for this primary registrant, then it will be output in place of this shortcode.', |
|
85 | - 'event_espresso' |
|
86 | - ), |
|
87 | - ); |
|
88 | - } |
|
89 | - |
|
90 | - |
|
91 | - protected function _parser($shortcode) |
|
92 | - { |
|
93 | - // make sure we end up with a copy of the EE_Messages_Addressee object |
|
94 | - $primary_registration = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null; |
|
95 | - $primary_registration = ! $primary_registration instanceof EE_Messages_Addressee && is_array( |
|
96 | - $this->_data |
|
97 | - ) && isset($this->_data['data']) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] |
|
98 | - : $primary_registration; |
|
99 | - $primary_registration = ! $primary_registration instanceof EE_Messages_Addressee && ! empty($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
|
100 | - ? $this->_extra_data['data'] : $primary_registration; |
|
101 | - |
|
102 | - if (! $primary_registration instanceof EE_Messages_Addressee) { |
|
103 | - return ''; |
|
104 | - } |
|
105 | - |
|
106 | - $attendee = $primary_registration->primary_att_obj; |
|
107 | - $primary_reg = $primary_registration->primary_reg_obj; |
|
108 | - |
|
109 | - if (! $attendee instanceof EE_Attendee || ! $primary_reg instanceof EE_Registration) { |
|
110 | - return ''; |
|
111 | - } |
|
112 | - |
|
113 | - switch ($shortcode) { |
|
114 | - case '[PRIMARY_REGISTRANT_FNAME]': |
|
115 | - return $attendee->fname(); |
|
116 | - break; |
|
117 | - |
|
118 | - case '[PRIMARY_REGISTRANT_LNAME]': |
|
119 | - return $attendee->lname(); |
|
120 | - break; |
|
121 | - |
|
122 | - case '[PRIMARY_REGISTRANT_EMAIL]': |
|
123 | - return $attendee->email(); |
|
124 | - break; |
|
125 | - |
|
126 | - case '[PRIMARY_REGISTRANT_REGISTRATION_ID]': |
|
127 | - return $primary_reg->ID(); |
|
128 | - break; |
|
129 | - |
|
130 | - case '[PRIMARY_REGISTRANT_REGISTRATION_CODE]': |
|
131 | - return $primary_reg->reg_code(); |
|
132 | - break; |
|
133 | - |
|
134 | - case '[PRIMARY_REGISTRANT_PHONE_NUMBER]': |
|
135 | - return $attendee->phone(); |
|
136 | - break; |
|
137 | - |
|
138 | - case '[PRIMARY_REGISTRANT_ADDRESS]': |
|
139 | - return $attendee->address(); |
|
140 | - break; |
|
141 | - |
|
142 | - case '[PRIMARY_REGISTRANT_ADDRESS2]': |
|
143 | - return $attendee->address2(); |
|
144 | - break; |
|
145 | - |
|
146 | - case '[PRIMARY_REGISTRANT_CITY]': |
|
147 | - return $attendee->city(); |
|
148 | - break; |
|
149 | - |
|
150 | - case '[PRIMARY_REGISTRANT_ZIP_PC]': |
|
151 | - return $attendee->zip(); |
|
152 | - break; |
|
153 | - |
|
154 | - case '[PRIMARY_REGISTRANT_ADDRESS_STATE]': |
|
155 | - $state_obj = $attendee->state_obj(); |
|
156 | - return $state_obj instanceof EE_State ? $state_obj->name() : ''; |
|
157 | - break; |
|
158 | - |
|
159 | - case '[PRIMARY_REGISTRANT_COUNTRY]': |
|
160 | - $country_obj = $attendee->country_obj(); |
|
161 | - return $country_obj instanceof EE_Country ? $country_obj->name() : ''; |
|
162 | - break; |
|
163 | - |
|
164 | - case '[PRIMARY_REGISTRANT_REGISTRATION_DATE]': |
|
165 | - if (! $primary_registration->primary_reg_obj instanceof EE_Registration) { |
|
166 | - return ''; |
|
167 | - } |
|
168 | - return $primary_registration->primary_reg_obj->get_i18n_datetime('REG_date', get_option('date_format')); |
|
169 | - break; |
|
170 | - |
|
171 | - case '[PRIMARY_REGISTRANT_FRONTEND_EDIT_REG_LINK]': |
|
172 | - return $primary_reg->edit_attendee_information_url(); |
|
173 | - break; |
|
174 | - } |
|
175 | - |
|
176 | - if (strpos($shortcode, '[PRIMARY_REGISTRANT_ANSWER_*') !== false) { |
|
177 | - $shortcode = str_replace('[PRIMARY_REGISTRANT_ANSWER_*', '', $shortcode); |
|
178 | - $shortcode = trim(str_replace(']', '', $shortcode)); |
|
179 | - |
|
180 | - |
|
181 | - // now let's figure out what question has this text |
|
182 | - if (empty($primary_registration->questions)) { |
|
183 | - return ''; |
|
184 | - } |
|
185 | - |
|
186 | - foreach ($primary_registration->questions as $ansid => $question) { |
|
187 | - if ($question instanceof EE_Question |
|
188 | - && trim($question->get('QST_display_text')) === trim($shortcode) |
|
189 | - && isset($primary_registration->registrations[ $primary_reg->ID() ]['ans_objs'][ $ansid ]) |
|
190 | - ) { |
|
191 | - $primary_reg_ansid = $primary_registration->registrations[ $primary_reg->ID() ]['ans_objs'][ $ansid ]; |
|
22 | + protected function _init_props() |
|
23 | + { |
|
24 | + $this->label = __('Primary_Registration Details Shortcodes', 'event_espresso'); |
|
25 | + $this->description = __('All shortcodes specific primary registrant data', 'event_espresso'); |
|
26 | + $this->_shortcodes = array( |
|
27 | + '[PRIMARY_REGISTRANT_FNAME]' => __( |
|
28 | + 'Parses to the first name of the primary registration for the transaction.', |
|
29 | + 'event_espresso' |
|
30 | + ), |
|
31 | + '[PRIMARY_REGISTRANT_LNAME]' => __( |
|
32 | + 'Parses to the last name of the primary registration for the transaction.', |
|
33 | + 'event_espresso' |
|
34 | + ), |
|
35 | + '[PRIMARY_REGISTRANT_EMAIL]' => __( |
|
36 | + 'Parses to the email address of the primary registration for the transaction.', |
|
37 | + 'event_espresso' |
|
38 | + ), |
|
39 | + '[PRIMARY_REGISTRANT_REGISTRATION_ID]' => __( |
|
40 | + 'Parses to the registration ID of the primary registrant for the transaction.', |
|
41 | + 'event_espresso' |
|
42 | + ), |
|
43 | + '[PRIMARY_REGISTRANT_REGISTRATION_CODE]' => __( |
|
44 | + 'Parses to the registration code of the primary registrant for the transaction.', |
|
45 | + 'event_espresso' |
|
46 | + ), |
|
47 | + '[PRIMARY_REGISTRANT_PHONE_NUMBER]' => __( |
|
48 | + 'The Phone Number for the primary registrant for the transaction.', |
|
49 | + 'event_espresso' |
|
50 | + ), |
|
51 | + '[PRIMARY_REGISTRANT_ADDRESS]' => __( |
|
52 | + 'The Address for the primary registrant for the transaction.', |
|
53 | + 'event_espresso' |
|
54 | + ), |
|
55 | + '[PRIMARY_REGISTRANT_ADDRESS2]' => __( |
|
56 | + 'Whatever was in the address 2 field for the primary registrant for the transaction.', |
|
57 | + 'event_espresso' |
|
58 | + ), |
|
59 | + '[PRIMARY_REGISTRANT_CITY]' => __( |
|
60 | + 'The city for the primary registrant for the transaction.', |
|
61 | + 'event_espresso' |
|
62 | + ), |
|
63 | + '[PRIMARY_REGISTRANT_ZIP_PC]' => __( |
|
64 | + 'The ZIP (or Postal) Code for the primary registrant for the transaction.', |
|
65 | + 'event_espresso' |
|
66 | + ), |
|
67 | + '[PRIMARY_REGISTRANT_ADDRESS_STATE]' => __( |
|
68 | + 'The state/province for the primary registrant for the transaction.', |
|
69 | + 'event_espresso' |
|
70 | + ), |
|
71 | + '[PRIMARY_REGISTRANT_COUNTRY]' => __( |
|
72 | + 'The country for the primary registrant for the transaction.', |
|
73 | + 'event_espresso' |
|
74 | + ), |
|
75 | + '[PRIMARY_REGISTRANT_REGISTRATION_DATE]' => __( |
|
76 | + 'The date the registration occured for the primary registration.', |
|
77 | + 'event_espresso' |
|
78 | + ), |
|
79 | + '[PRIMARY_REGISTRANT_FRONTEND_EDIT_REG_LINK]' => __( |
|
80 | + 'Generates a link for the given registration to edit this registration details on the frontend.', |
|
81 | + 'event_espresso' |
|
82 | + ), |
|
83 | + '[PRIMARY_REGISTRANT_ANSWER_*]' => __( |
|
84 | + 'This is a special dynamic shortcode. After the "*", add the exact text of an existing question, and if there is an answer for that question for this primary registrant, then it will be output in place of this shortcode.', |
|
85 | + 'event_espresso' |
|
86 | + ), |
|
87 | + ); |
|
88 | + } |
|
89 | + |
|
90 | + |
|
91 | + protected function _parser($shortcode) |
|
92 | + { |
|
93 | + // make sure we end up with a copy of the EE_Messages_Addressee object |
|
94 | + $primary_registration = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null; |
|
95 | + $primary_registration = ! $primary_registration instanceof EE_Messages_Addressee && is_array( |
|
96 | + $this->_data |
|
97 | + ) && isset($this->_data['data']) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] |
|
98 | + : $primary_registration; |
|
99 | + $primary_registration = ! $primary_registration instanceof EE_Messages_Addressee && ! empty($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
|
100 | + ? $this->_extra_data['data'] : $primary_registration; |
|
101 | + |
|
102 | + if (! $primary_registration instanceof EE_Messages_Addressee) { |
|
103 | + return ''; |
|
104 | + } |
|
105 | + |
|
106 | + $attendee = $primary_registration->primary_att_obj; |
|
107 | + $primary_reg = $primary_registration->primary_reg_obj; |
|
108 | + |
|
109 | + if (! $attendee instanceof EE_Attendee || ! $primary_reg instanceof EE_Registration) { |
|
110 | + return ''; |
|
111 | + } |
|
112 | + |
|
113 | + switch ($shortcode) { |
|
114 | + case '[PRIMARY_REGISTRANT_FNAME]': |
|
115 | + return $attendee->fname(); |
|
116 | + break; |
|
117 | + |
|
118 | + case '[PRIMARY_REGISTRANT_LNAME]': |
|
119 | + return $attendee->lname(); |
|
120 | + break; |
|
121 | + |
|
122 | + case '[PRIMARY_REGISTRANT_EMAIL]': |
|
123 | + return $attendee->email(); |
|
124 | + break; |
|
125 | + |
|
126 | + case '[PRIMARY_REGISTRANT_REGISTRATION_ID]': |
|
127 | + return $primary_reg->ID(); |
|
128 | + break; |
|
129 | + |
|
130 | + case '[PRIMARY_REGISTRANT_REGISTRATION_CODE]': |
|
131 | + return $primary_reg->reg_code(); |
|
132 | + break; |
|
133 | + |
|
134 | + case '[PRIMARY_REGISTRANT_PHONE_NUMBER]': |
|
135 | + return $attendee->phone(); |
|
136 | + break; |
|
137 | + |
|
138 | + case '[PRIMARY_REGISTRANT_ADDRESS]': |
|
139 | + return $attendee->address(); |
|
140 | + break; |
|
141 | + |
|
142 | + case '[PRIMARY_REGISTRANT_ADDRESS2]': |
|
143 | + return $attendee->address2(); |
|
144 | + break; |
|
145 | + |
|
146 | + case '[PRIMARY_REGISTRANT_CITY]': |
|
147 | + return $attendee->city(); |
|
148 | + break; |
|
149 | + |
|
150 | + case '[PRIMARY_REGISTRANT_ZIP_PC]': |
|
151 | + return $attendee->zip(); |
|
152 | + break; |
|
153 | + |
|
154 | + case '[PRIMARY_REGISTRANT_ADDRESS_STATE]': |
|
155 | + $state_obj = $attendee->state_obj(); |
|
156 | + return $state_obj instanceof EE_State ? $state_obj->name() : ''; |
|
157 | + break; |
|
158 | + |
|
159 | + case '[PRIMARY_REGISTRANT_COUNTRY]': |
|
160 | + $country_obj = $attendee->country_obj(); |
|
161 | + return $country_obj instanceof EE_Country ? $country_obj->name() : ''; |
|
162 | + break; |
|
163 | + |
|
164 | + case '[PRIMARY_REGISTRANT_REGISTRATION_DATE]': |
|
165 | + if (! $primary_registration->primary_reg_obj instanceof EE_Registration) { |
|
166 | + return ''; |
|
167 | + } |
|
168 | + return $primary_registration->primary_reg_obj->get_i18n_datetime('REG_date', get_option('date_format')); |
|
169 | + break; |
|
170 | + |
|
171 | + case '[PRIMARY_REGISTRANT_FRONTEND_EDIT_REG_LINK]': |
|
172 | + return $primary_reg->edit_attendee_information_url(); |
|
173 | + break; |
|
174 | + } |
|
175 | + |
|
176 | + if (strpos($shortcode, '[PRIMARY_REGISTRANT_ANSWER_*') !== false) { |
|
177 | + $shortcode = str_replace('[PRIMARY_REGISTRANT_ANSWER_*', '', $shortcode); |
|
178 | + $shortcode = trim(str_replace(']', '', $shortcode)); |
|
179 | + |
|
180 | + |
|
181 | + // now let's figure out what question has this text |
|
182 | + if (empty($primary_registration->questions)) { |
|
183 | + return ''; |
|
184 | + } |
|
185 | + |
|
186 | + foreach ($primary_registration->questions as $ansid => $question) { |
|
187 | + if ($question instanceof EE_Question |
|
188 | + && trim($question->get('QST_display_text')) === trim($shortcode) |
|
189 | + && isset($primary_registration->registrations[ $primary_reg->ID() ]['ans_objs'][ $ansid ]) |
|
190 | + ) { |
|
191 | + $primary_reg_ansid = $primary_registration->registrations[ $primary_reg->ID() ]['ans_objs'][ $ansid ]; |
|
192 | 192 | |
193 | - // what we show for the answer depends on the question type! |
|
194 | - switch ($question->get('QST_type')) { |
|
195 | - case EEM_Question::QST_type_state: |
|
196 | - $state = EEM_State::instance()->get_one_by_ID($primary_reg_ansid->get('ANS_value')); |
|
197 | - $answer = $state instanceof EE_State ? $state->name() : ''; |
|
198 | - break; |
|
193 | + // what we show for the answer depends on the question type! |
|
194 | + switch ($question->get('QST_type')) { |
|
195 | + case EEM_Question::QST_type_state: |
|
196 | + $state = EEM_State::instance()->get_one_by_ID($primary_reg_ansid->get('ANS_value')); |
|
197 | + $answer = $state instanceof EE_State ? $state->name() : ''; |
|
198 | + break; |
|
199 | 199 | |
200 | - case EEM_Question::QST_type_country: |
|
201 | - $country = EEM_Country::instance()->get_one_by_ID($primary_reg_ansid->get('ANS_value')); |
|
202 | - $answer = $country instanceof EE_Country ? $country->name() : ''; |
|
203 | - break; |
|
200 | + case EEM_Question::QST_type_country: |
|
201 | + $country = EEM_Country::instance()->get_one_by_ID($primary_reg_ansid->get('ANS_value')); |
|
202 | + $answer = $country instanceof EE_Country ? $country->name() : ''; |
|
203 | + break; |
|
204 | 204 | |
205 | - default: |
|
206 | - $answer = $primary_reg_ansid->get_pretty('ANS_value', 'no_wpautop'); |
|
207 | - break; |
|
208 | - } |
|
205 | + default: |
|
206 | + $answer = $primary_reg_ansid->get_pretty('ANS_value', 'no_wpautop'); |
|
207 | + break; |
|
208 | + } |
|
209 | 209 | |
210 | - return $answer; |
|
211 | - break; |
|
212 | - } |
|
213 | - } |
|
214 | - } |
|
215 | - |
|
216 | - return ''; |
|
217 | - } |
|
210 | + return $answer; |
|
211 | + break; |
|
212 | + } |
|
213 | + } |
|
214 | + } |
|
215 | + |
|
216 | + return ''; |
|
217 | + } |
|
218 | 218 | } |
@@ -99,14 +99,14 @@ discard block |
||
99 | 99 | $primary_registration = ! $primary_registration instanceof EE_Messages_Addressee && ! empty($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
100 | 100 | ? $this->_extra_data['data'] : $primary_registration; |
101 | 101 | |
102 | - if (! $primary_registration instanceof EE_Messages_Addressee) { |
|
102 | + if ( ! $primary_registration instanceof EE_Messages_Addressee) { |
|
103 | 103 | return ''; |
104 | 104 | } |
105 | 105 | |
106 | 106 | $attendee = $primary_registration->primary_att_obj; |
107 | 107 | $primary_reg = $primary_registration->primary_reg_obj; |
108 | 108 | |
109 | - if (! $attendee instanceof EE_Attendee || ! $primary_reg instanceof EE_Registration) { |
|
109 | + if ( ! $attendee instanceof EE_Attendee || ! $primary_reg instanceof EE_Registration) { |
|
110 | 110 | return ''; |
111 | 111 | } |
112 | 112 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | break; |
163 | 163 | |
164 | 164 | case '[PRIMARY_REGISTRANT_REGISTRATION_DATE]': |
165 | - if (! $primary_registration->primary_reg_obj instanceof EE_Registration) { |
|
165 | + if ( ! $primary_registration->primary_reg_obj instanceof EE_Registration) { |
|
166 | 166 | return ''; |
167 | 167 | } |
168 | 168 | return $primary_registration->primary_reg_obj->get_i18n_datetime('REG_date', get_option('date_format')); |
@@ -186,9 +186,9 @@ discard block |
||
186 | 186 | foreach ($primary_registration->questions as $ansid => $question) { |
187 | 187 | if ($question instanceof EE_Question |
188 | 188 | && trim($question->get('QST_display_text')) === trim($shortcode) |
189 | - && isset($primary_registration->registrations[ $primary_reg->ID() ]['ans_objs'][ $ansid ]) |
|
189 | + && isset($primary_registration->registrations[$primary_reg->ID()]['ans_objs'][$ansid]) |
|
190 | 190 | ) { |
191 | - $primary_reg_ansid = $primary_registration->registrations[ $primary_reg->ID() ]['ans_objs'][ $ansid ]; |
|
191 | + $primary_reg_ansid = $primary_registration->registrations[$primary_reg->ID()]['ans_objs'][$ansid]; |
|
192 | 192 | |
193 | 193 | // what we show for the answer depends on the question type! |
194 | 194 | switch ($question->get('QST_type')) { |
@@ -19,354 +19,354 @@ |
||
19 | 19 | class EE_Recipient_Details_Shortcodes extends EE_Shortcodes |
20 | 20 | { |
21 | 21 | |
22 | - protected $_recipient; |
|
23 | - |
|
24 | - protected $_registrations_for_recipient; |
|
25 | - |
|
26 | - |
|
27 | - protected function _init_props() |
|
28 | - { |
|
29 | - $this->label = esc_html__('Recipient Details Shortcodes', 'event_espresso'); |
|
30 | - $this->description = esc_html__('All shortcodes specific to recipient registration data', 'event_espresso'); |
|
31 | - $this->_shortcodes = array( |
|
32 | - '[RECIPIENT_FNAME]' => esc_html__( |
|
33 | - 'Parses to the first name of the recipient for the message.', |
|
34 | - 'event_espresso' |
|
35 | - ), |
|
36 | - '[RECIPIENT_LNAME]' => esc_html__( |
|
37 | - 'Parses to the last name of the recipient for the message.', |
|
38 | - 'event_espresso' |
|
39 | - ), |
|
40 | - '[RECIPIENT_EMAIL]' => esc_html__( |
|
41 | - 'Parses to the email address of the recipient for the message.', |
|
42 | - 'event_espresso' |
|
43 | - ), |
|
44 | - '[RECIPIENT_REGISTRATION_ID]' => esc_html__( |
|
45 | - 'Parses to the registration ID of the recipient for the message.', |
|
46 | - 'event_espresso' |
|
47 | - ), |
|
48 | - '[RECIPIENT_REGISTRATION_CODE]' => esc_html__( |
|
49 | - 'Parses to the registration code of the recipient for the message.', |
|
50 | - 'event_espresso' |
|
51 | - ), |
|
52 | - '[RECIPIENT_EDIT_REGISTRATION_LINK]' => esc_html__( |
|
53 | - 'Parses to a link for frontend editing of the registration for the recipient.', |
|
54 | - 'event_espresso' |
|
55 | - ), |
|
56 | - '[RECIPIENT_PHONE_NUMBER]' => esc_html__( |
|
57 | - 'The Phone Number for the recipient of the message.', |
|
58 | - 'event_espresso' |
|
59 | - ), |
|
60 | - '[RECIPIENT_ADDRESS]' => esc_html__( |
|
61 | - 'The Address for the recipient of the message.', |
|
62 | - 'event_espresso' |
|
63 | - ), |
|
64 | - '[RECIPIENT_ADDRESS2]' => esc_html__( |
|
65 | - 'Whatever was in the address 2 field for the recipient of the message.', |
|
66 | - 'event_espresso' |
|
67 | - ), |
|
68 | - '[RECIPIENT_CITY]' => esc_html__( |
|
69 | - 'The city for the recipient of the message.', |
|
70 | - 'event_espresso' |
|
71 | - ), |
|
72 | - '[RECIPIENT_ZIP_PC]' => esc_html__( |
|
73 | - 'The ZIP (or Postal) Code for the recipient of the message.', |
|
74 | - 'event_espresso' |
|
75 | - ), |
|
76 | - '[RECIPIENT_ADDRESS_STATE]' => esc_html__( |
|
77 | - 'The state/province for the recipient of the message.', |
|
78 | - 'event_espresso' |
|
79 | - ), |
|
80 | - '[RECIPIENT_COUNTRY]' => esc_html__( |
|
81 | - 'The country for the recipient of the message.', |
|
82 | - 'event_espresso' |
|
83 | - ), |
|
84 | - '[RECIPIENT_ANSWER_*]' => esc_html__( |
|
85 | - 'This is a special dynamic shortcode. After the "*", add the exact text of an existing question, and if there is an answer for that question for this recipient, then it will be output in place of this shortcode.', |
|
86 | - 'event_espresso' |
|
87 | - ), |
|
88 | - '[RECIPIENT_TOTAL_AMOUNT_PAID]' => esc_html__( |
|
89 | - 'If a single registration related to the recipient is available, that is used to retrieve the total amount that has been paid for this recipient. Otherwise the value of 0 is printed.', |
|
90 | - 'event_espresso' |
|
91 | - ), |
|
92 | - ); |
|
93 | - } |
|
94 | - |
|
95 | - |
|
96 | - /** |
|
97 | - * @access protected |
|
98 | - * @param string $shortcode the shortcode to be parsed. |
|
99 | - * @return string parsed shortcode |
|
100 | - */ |
|
101 | - protected function _parser($shortcode) |
|
102 | - { |
|
103 | - |
|
104 | - // make sure we end up with a copy of the EE_Messages_Addressee object |
|
105 | - $this->_recipient = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null; |
|
106 | - $this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee |
|
107 | - && is_array($this->_data) |
|
108 | - && isset($this->_data['data']) |
|
109 | - && $this->_data['data'] instanceof EE_Messages_Addressee |
|
110 | - ? $this->_data['data'] |
|
111 | - : |
|
112 | - $this->_recipient; |
|
113 | - $this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee |
|
114 | - && ! empty($this->_extra_data['data']) |
|
115 | - && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
|
116 | - ? $this->_extra_data['data'] |
|
117 | - : $this->_recipient; |
|
118 | - |
|
119 | - if (! $this->_recipient instanceof EE_Messages_Addressee) { |
|
120 | - return ''; |
|
121 | - } |
|
122 | - |
|
123 | - $attendee = $this->_recipient->att_obj; |
|
124 | - if (! $attendee instanceof EE_Attendee) { |
|
125 | - return ''; |
|
126 | - } |
|
127 | - |
|
128 | - $this->_registrations_for_recipient = isset($this->_recipient->attendees[ $attendee->ID() ]['reg_objs']) |
|
129 | - ? $this->_recipient->attendees[ $attendee->ID() ]['reg_objs'] |
|
130 | - : array(); |
|
131 | - |
|
132 | - switch ($shortcode) { |
|
133 | - case '[RECIPIENT_FNAME]': |
|
134 | - return $attendee->fname(); |
|
135 | - break; |
|
136 | - |
|
137 | - case '[RECIPIENT_LNAME]': |
|
138 | - return $attendee->lname(); |
|
139 | - break; |
|
140 | - |
|
141 | - case '[RECIPIENT_EMAIL]': |
|
142 | - return $attendee->email(); |
|
143 | - break; |
|
144 | - |
|
145 | - case '[RECIPIENT_REGISTRATION_ID]': |
|
146 | - if (! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
147 | - return ''; |
|
148 | - } |
|
149 | - return $this->_get_reg_id(); |
|
150 | - break; |
|
151 | - |
|
152 | - case '[RECIPIENT_REGISTRATION_CODE]': |
|
153 | - if (! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
154 | - return ''; |
|
155 | - } |
|
156 | - return $this->_get_reg_code(); |
|
157 | - break; |
|
158 | - |
|
159 | - case '[RECIPIENT_EDIT_REGISTRATION_LINK]': |
|
160 | - if (! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
161 | - return ''; |
|
162 | - } |
|
163 | - return $this->_recipient->reg_obj->edit_attendee_information_url(); |
|
164 | - break; |
|
165 | - |
|
166 | - case '[RECIPIENT_PHONE_NUMBER]': |
|
167 | - return $attendee->phone(); |
|
168 | - break; |
|
169 | - |
|
170 | - case '[RECIPIENT_ADDRESS]': |
|
171 | - return $attendee->address(); |
|
172 | - break; |
|
173 | - |
|
174 | - case '[RECIPIENT_ADDRESS2]': |
|
175 | - return $attendee->address2(); |
|
176 | - break; |
|
177 | - |
|
178 | - case '[RECIPIENT_CITY]': |
|
179 | - return $attendee->city(); |
|
180 | - break; |
|
181 | - |
|
182 | - case '[RECIPIENT_ZIP_PC]': |
|
183 | - return $attendee->zip(); |
|
184 | - break; |
|
185 | - |
|
186 | - case '[RECIPIENT_ADDRESS_STATE]': |
|
187 | - $state_obj = $attendee->state_obj(); |
|
188 | - return $state_obj instanceof EE_State ? $state_obj->name() : ''; |
|
189 | - break; |
|
190 | - |
|
191 | - case '[RECIPIENT_COUNTRY]': |
|
192 | - $country_obj = $attendee->country_obj(); |
|
193 | - return $country_obj instanceof EE_Country ? $country_obj->name() : ''; |
|
194 | - break; |
|
195 | - case '[RECIPIENT_TOTAL_AMOUNT_PAID]': |
|
196 | - return $this->_recipient->reg_obj instanceof EE_Registration |
|
197 | - ? $this->_recipient->reg_obj->pretty_paid() |
|
198 | - : 0; |
|
199 | - break; |
|
200 | - } |
|
201 | - |
|
202 | - if (strpos($shortcode, '[RECIPIENT_ANSWER_*') !== false) { |
|
203 | - $shortcode = str_replace('[RECIPIENT_ANSWER_*', '', $shortcode); |
|
204 | - $shortcode = trim(str_replace(']', '', $shortcode)); |
|
205 | - |
|
206 | - |
|
207 | - // now let's figure out what question has this text |
|
208 | - if (empty($this->_recipient->questions) || ! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
209 | - return ''; |
|
210 | - } |
|
211 | - |
|
212 | - foreach ($this->_recipient->questions as $ansid => $question) { |
|
213 | - if ($question instanceof EE_Question |
|
214 | - && trim($question->display_text()) === trim($shortcode) |
|
215 | - && isset($this->_recipient->registrations[ $this->_recipient->reg_obj->ID() ]['ans_objs'][ $ansid ]) |
|
216 | - ) { |
|
217 | - $recipient_ansid = $this->_recipient->registrations[ $this->_recipient->reg_obj->ID() ]['ans_objs'][ $ansid ]; |
|
22 | + protected $_recipient; |
|
23 | + |
|
24 | + protected $_registrations_for_recipient; |
|
25 | + |
|
26 | + |
|
27 | + protected function _init_props() |
|
28 | + { |
|
29 | + $this->label = esc_html__('Recipient Details Shortcodes', 'event_espresso'); |
|
30 | + $this->description = esc_html__('All shortcodes specific to recipient registration data', 'event_espresso'); |
|
31 | + $this->_shortcodes = array( |
|
32 | + '[RECIPIENT_FNAME]' => esc_html__( |
|
33 | + 'Parses to the first name of the recipient for the message.', |
|
34 | + 'event_espresso' |
|
35 | + ), |
|
36 | + '[RECIPIENT_LNAME]' => esc_html__( |
|
37 | + 'Parses to the last name of the recipient for the message.', |
|
38 | + 'event_espresso' |
|
39 | + ), |
|
40 | + '[RECIPIENT_EMAIL]' => esc_html__( |
|
41 | + 'Parses to the email address of the recipient for the message.', |
|
42 | + 'event_espresso' |
|
43 | + ), |
|
44 | + '[RECIPIENT_REGISTRATION_ID]' => esc_html__( |
|
45 | + 'Parses to the registration ID of the recipient for the message.', |
|
46 | + 'event_espresso' |
|
47 | + ), |
|
48 | + '[RECIPIENT_REGISTRATION_CODE]' => esc_html__( |
|
49 | + 'Parses to the registration code of the recipient for the message.', |
|
50 | + 'event_espresso' |
|
51 | + ), |
|
52 | + '[RECIPIENT_EDIT_REGISTRATION_LINK]' => esc_html__( |
|
53 | + 'Parses to a link for frontend editing of the registration for the recipient.', |
|
54 | + 'event_espresso' |
|
55 | + ), |
|
56 | + '[RECIPIENT_PHONE_NUMBER]' => esc_html__( |
|
57 | + 'The Phone Number for the recipient of the message.', |
|
58 | + 'event_espresso' |
|
59 | + ), |
|
60 | + '[RECIPIENT_ADDRESS]' => esc_html__( |
|
61 | + 'The Address for the recipient of the message.', |
|
62 | + 'event_espresso' |
|
63 | + ), |
|
64 | + '[RECIPIENT_ADDRESS2]' => esc_html__( |
|
65 | + 'Whatever was in the address 2 field for the recipient of the message.', |
|
66 | + 'event_espresso' |
|
67 | + ), |
|
68 | + '[RECIPIENT_CITY]' => esc_html__( |
|
69 | + 'The city for the recipient of the message.', |
|
70 | + 'event_espresso' |
|
71 | + ), |
|
72 | + '[RECIPIENT_ZIP_PC]' => esc_html__( |
|
73 | + 'The ZIP (or Postal) Code for the recipient of the message.', |
|
74 | + 'event_espresso' |
|
75 | + ), |
|
76 | + '[RECIPIENT_ADDRESS_STATE]' => esc_html__( |
|
77 | + 'The state/province for the recipient of the message.', |
|
78 | + 'event_espresso' |
|
79 | + ), |
|
80 | + '[RECIPIENT_COUNTRY]' => esc_html__( |
|
81 | + 'The country for the recipient of the message.', |
|
82 | + 'event_espresso' |
|
83 | + ), |
|
84 | + '[RECIPIENT_ANSWER_*]' => esc_html__( |
|
85 | + 'This is a special dynamic shortcode. After the "*", add the exact text of an existing question, and if there is an answer for that question for this recipient, then it will be output in place of this shortcode.', |
|
86 | + 'event_espresso' |
|
87 | + ), |
|
88 | + '[RECIPIENT_TOTAL_AMOUNT_PAID]' => esc_html__( |
|
89 | + 'If a single registration related to the recipient is available, that is used to retrieve the total amount that has been paid for this recipient. Otherwise the value of 0 is printed.', |
|
90 | + 'event_espresso' |
|
91 | + ), |
|
92 | + ); |
|
93 | + } |
|
94 | + |
|
95 | + |
|
96 | + /** |
|
97 | + * @access protected |
|
98 | + * @param string $shortcode the shortcode to be parsed. |
|
99 | + * @return string parsed shortcode |
|
100 | + */ |
|
101 | + protected function _parser($shortcode) |
|
102 | + { |
|
103 | + |
|
104 | + // make sure we end up with a copy of the EE_Messages_Addressee object |
|
105 | + $this->_recipient = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null; |
|
106 | + $this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee |
|
107 | + && is_array($this->_data) |
|
108 | + && isset($this->_data['data']) |
|
109 | + && $this->_data['data'] instanceof EE_Messages_Addressee |
|
110 | + ? $this->_data['data'] |
|
111 | + : |
|
112 | + $this->_recipient; |
|
113 | + $this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee |
|
114 | + && ! empty($this->_extra_data['data']) |
|
115 | + && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
|
116 | + ? $this->_extra_data['data'] |
|
117 | + : $this->_recipient; |
|
118 | + |
|
119 | + if (! $this->_recipient instanceof EE_Messages_Addressee) { |
|
120 | + return ''; |
|
121 | + } |
|
122 | + |
|
123 | + $attendee = $this->_recipient->att_obj; |
|
124 | + if (! $attendee instanceof EE_Attendee) { |
|
125 | + return ''; |
|
126 | + } |
|
127 | + |
|
128 | + $this->_registrations_for_recipient = isset($this->_recipient->attendees[ $attendee->ID() ]['reg_objs']) |
|
129 | + ? $this->_recipient->attendees[ $attendee->ID() ]['reg_objs'] |
|
130 | + : array(); |
|
131 | + |
|
132 | + switch ($shortcode) { |
|
133 | + case '[RECIPIENT_FNAME]': |
|
134 | + return $attendee->fname(); |
|
135 | + break; |
|
136 | + |
|
137 | + case '[RECIPIENT_LNAME]': |
|
138 | + return $attendee->lname(); |
|
139 | + break; |
|
140 | + |
|
141 | + case '[RECIPIENT_EMAIL]': |
|
142 | + return $attendee->email(); |
|
143 | + break; |
|
144 | + |
|
145 | + case '[RECIPIENT_REGISTRATION_ID]': |
|
146 | + if (! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
147 | + return ''; |
|
148 | + } |
|
149 | + return $this->_get_reg_id(); |
|
150 | + break; |
|
151 | + |
|
152 | + case '[RECIPIENT_REGISTRATION_CODE]': |
|
153 | + if (! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
154 | + return ''; |
|
155 | + } |
|
156 | + return $this->_get_reg_code(); |
|
157 | + break; |
|
158 | + |
|
159 | + case '[RECIPIENT_EDIT_REGISTRATION_LINK]': |
|
160 | + if (! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
161 | + return ''; |
|
162 | + } |
|
163 | + return $this->_recipient->reg_obj->edit_attendee_information_url(); |
|
164 | + break; |
|
165 | + |
|
166 | + case '[RECIPIENT_PHONE_NUMBER]': |
|
167 | + return $attendee->phone(); |
|
168 | + break; |
|
169 | + |
|
170 | + case '[RECIPIENT_ADDRESS]': |
|
171 | + return $attendee->address(); |
|
172 | + break; |
|
173 | + |
|
174 | + case '[RECIPIENT_ADDRESS2]': |
|
175 | + return $attendee->address2(); |
|
176 | + break; |
|
177 | + |
|
178 | + case '[RECIPIENT_CITY]': |
|
179 | + return $attendee->city(); |
|
180 | + break; |
|
181 | + |
|
182 | + case '[RECIPIENT_ZIP_PC]': |
|
183 | + return $attendee->zip(); |
|
184 | + break; |
|
185 | + |
|
186 | + case '[RECIPIENT_ADDRESS_STATE]': |
|
187 | + $state_obj = $attendee->state_obj(); |
|
188 | + return $state_obj instanceof EE_State ? $state_obj->name() : ''; |
|
189 | + break; |
|
190 | + |
|
191 | + case '[RECIPIENT_COUNTRY]': |
|
192 | + $country_obj = $attendee->country_obj(); |
|
193 | + return $country_obj instanceof EE_Country ? $country_obj->name() : ''; |
|
194 | + break; |
|
195 | + case '[RECIPIENT_TOTAL_AMOUNT_PAID]': |
|
196 | + return $this->_recipient->reg_obj instanceof EE_Registration |
|
197 | + ? $this->_recipient->reg_obj->pretty_paid() |
|
198 | + : 0; |
|
199 | + break; |
|
200 | + } |
|
201 | + |
|
202 | + if (strpos($shortcode, '[RECIPIENT_ANSWER_*') !== false) { |
|
203 | + $shortcode = str_replace('[RECIPIENT_ANSWER_*', '', $shortcode); |
|
204 | + $shortcode = trim(str_replace(']', '', $shortcode)); |
|
205 | + |
|
206 | + |
|
207 | + // now let's figure out what question has this text |
|
208 | + if (empty($this->_recipient->questions) || ! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
209 | + return ''; |
|
210 | + } |
|
211 | + |
|
212 | + foreach ($this->_recipient->questions as $ansid => $question) { |
|
213 | + if ($question instanceof EE_Question |
|
214 | + && trim($question->display_text()) === trim($shortcode) |
|
215 | + && isset($this->_recipient->registrations[ $this->_recipient->reg_obj->ID() ]['ans_objs'][ $ansid ]) |
|
216 | + ) { |
|
217 | + $recipient_ansid = $this->_recipient->registrations[ $this->_recipient->reg_obj->ID() ]['ans_objs'][ $ansid ]; |
|
218 | 218 | |
219 | - // what we show for the answer depends on the question type! |
|
220 | - switch ($question->get('QST_type')) { |
|
221 | - case EEM_Question::QST_type_state: |
|
222 | - $state = EEM_State::instance()->get_one_by_ID($recipient_ansid->get('ANS_value')); |
|
223 | - $answer = $state instanceof EE_State ? $state->name() : ''; |
|
224 | - break; |
|
219 | + // what we show for the answer depends on the question type! |
|
220 | + switch ($question->get('QST_type')) { |
|
221 | + case EEM_Question::QST_type_state: |
|
222 | + $state = EEM_State::instance()->get_one_by_ID($recipient_ansid->get('ANS_value')); |
|
223 | + $answer = $state instanceof EE_State ? $state->name() : ''; |
|
224 | + break; |
|
225 | 225 | |
226 | - case EEM_Question::QST_type_country: |
|
227 | - $country = EEM_Country::instance()->get_one_by_ID($recipient_ansid->get('ANS_value')); |
|
228 | - $answer = $country instanceof EE_Country ? $country->name() : ''; |
|
229 | - break; |
|
226 | + case EEM_Question::QST_type_country: |
|
227 | + $country = EEM_Country::instance()->get_one_by_ID($recipient_ansid->get('ANS_value')); |
|
228 | + $answer = $country instanceof EE_Country ? $country->name() : ''; |
|
229 | + break; |
|
230 | 230 | |
231 | - default: |
|
232 | - $answer = $recipient_ansid->get_pretty('ANS_value', 'no_wpautop'); |
|
233 | - break; |
|
234 | - } |
|
231 | + default: |
|
232 | + $answer = $recipient_ansid->get_pretty('ANS_value', 'no_wpautop'); |
|
233 | + break; |
|
234 | + } |
|
235 | 235 | |
236 | - return $answer; |
|
237 | - break; |
|
238 | - } |
|
239 | - } |
|
240 | - } |
|
241 | - |
|
242 | - return ''; |
|
243 | - } |
|
244 | - |
|
245 | - |
|
246 | - /** |
|
247 | - * Returns the EE_Messages_Addressee object for the recipient. |
|
248 | - * |
|
249 | - * @since 4.5.0 |
|
250 | - * |
|
251 | - * @return EE_Messages_Addressee |
|
252 | - */ |
|
253 | - public function get_recipient() |
|
254 | - { |
|
255 | - return $this->_recipient; |
|
256 | - } |
|
257 | - |
|
258 | - |
|
259 | - /** |
|
260 | - * returns the reg code for the recipient depending on the context and whether the recipient has multiple |
|
261 | - * registrations or not. |
|
262 | - * |
|
263 | - * @return string |
|
264 | - */ |
|
265 | - protected function _get_reg_code() |
|
266 | - { |
|
267 | - |
|
268 | - // if only one related registration for the recipient then just return that reg code. |
|
269 | - if (count($this->_registrations_for_recipient) <= 1) { |
|
270 | - return $this->_recipient->reg_obj->reg_code(); |
|
271 | - } |
|
272 | - |
|
273 | - // k more than one registration so let's see if we can get specific to context |
|
274 | - // are we parsing event_list? |
|
275 | - if ($this->_data instanceof EE_Event) { |
|
276 | - $reg_code = array(); |
|
277 | - // loop through registrations for recipient and see if there is a match for this event |
|
278 | - foreach ($this->_registrations_for_recipient as $reg) { |
|
279 | - if ($reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID()) { |
|
280 | - $reg_code[] = $reg->reg_code(); |
|
281 | - } |
|
282 | - } |
|
283 | - return implode(', ', $reg_code); |
|
284 | - } |
|
285 | - |
|
286 | - // are we parsing ticket list? |
|
287 | - if ($this->_data instanceof EE_Ticket) { |
|
288 | - $reg_code = array(); |
|
289 | - // loop through each registration for recipient and see if there is a match for this ticket |
|
290 | - foreach ($this->_registrations_for_recipient as $reg) { |
|
291 | - if ($reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID()) { |
|
292 | - $reg_code = $reg->reg_code(); |
|
293 | - } |
|
294 | - } |
|
295 | - return implode(', ', $reg_code); |
|
296 | - } |
|
297 | - |
|
298 | - // do we have a specific reg_obj? Let's use it |
|
299 | - if ($this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration) { |
|
300 | - return $this->_data->reg_obj->reg_code(); |
|
301 | - } |
|
302 | - |
|
303 | - // do we have a specific reg_obj? Let's use it |
|
304 | - if ($this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration) { |
|
305 | - return $this->_data->reg_obj->reg_code(); |
|
306 | - } |
|
307 | - |
|
308 | - // not able to determine the single reg code so let's return a comma delimited list of reg codes. |
|
309 | - $reg_code = array(); |
|
310 | - foreach ($this->_registrations_for_recipient as $reg) { |
|
311 | - if ($reg instanceof EE_Registration) { |
|
312 | - $reg_code[] = $reg->reg_code(); |
|
313 | - } |
|
314 | - } |
|
315 | - return implode(', ', $reg_code); |
|
316 | - } |
|
317 | - |
|
318 | - |
|
319 | - /** |
|
320 | - * returns the reg ID for the recipient depending on the context and whether the recipient has multiple |
|
321 | - * registrations or not. |
|
322 | - * |
|
323 | - * @return int|string |
|
324 | - */ |
|
325 | - protected function _get_reg_id() |
|
326 | - { |
|
327 | - |
|
328 | - // if only one related registration for the recipient then just return that reg code. |
|
329 | - if (count($this->_registrations_for_recipient) <= 1) { |
|
330 | - return $this->_recipient->reg_obj->ID(); |
|
331 | - } |
|
332 | - |
|
333 | - // k more than one registration so let's see if we can get specific to context |
|
334 | - // are we parsing event_list? |
|
335 | - if ($this->_data instanceof EE_Event) { |
|
336 | - $registration_ids = array(); |
|
337 | - // loop through registrations for recipient and see if there is a match for this event |
|
338 | - foreach ($this->_registrations_for_recipient as $reg) { |
|
339 | - if ($reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID()) { |
|
340 | - $registration_ids[] = $reg->ID(); |
|
341 | - } |
|
342 | - } |
|
343 | - return implode(', ', $registration_ids); |
|
344 | - } |
|
345 | - |
|
346 | - // are we parsing ticket list? |
|
347 | - if ($this->_data instanceof EE_Ticket) { |
|
348 | - $registration_ids = array(); |
|
349 | - // loop through each registration for recipient and see if there is a match for this ticket |
|
350 | - foreach ($this->_registrations_for_recipient as $reg) { |
|
351 | - if ($reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID()) { |
|
352 | - $registration_ids = $reg->ID(); |
|
353 | - } |
|
354 | - } |
|
355 | - return implode(', ', $registration_ids); |
|
356 | - } |
|
357 | - |
|
358 | - // do we have a specific reg_obj? Let's use it |
|
359 | - if ($this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration) { |
|
360 | - return $this->_data->reg_obj->ID(); |
|
361 | - } |
|
362 | - |
|
363 | - // not able to determine the single reg code so let's return a comma delimited list of reg codes. |
|
364 | - $registration_ids = array(); |
|
365 | - foreach ($this->_registrations_for_recipient as $reg) { |
|
366 | - if ($reg instanceof EE_Registration) { |
|
367 | - $registration_ids[] = $reg->ID(); |
|
368 | - } |
|
369 | - } |
|
370 | - return implode(', ', $registration_ids); |
|
371 | - } |
|
236 | + return $answer; |
|
237 | + break; |
|
238 | + } |
|
239 | + } |
|
240 | + } |
|
241 | + |
|
242 | + return ''; |
|
243 | + } |
|
244 | + |
|
245 | + |
|
246 | + /** |
|
247 | + * Returns the EE_Messages_Addressee object for the recipient. |
|
248 | + * |
|
249 | + * @since 4.5.0 |
|
250 | + * |
|
251 | + * @return EE_Messages_Addressee |
|
252 | + */ |
|
253 | + public function get_recipient() |
|
254 | + { |
|
255 | + return $this->_recipient; |
|
256 | + } |
|
257 | + |
|
258 | + |
|
259 | + /** |
|
260 | + * returns the reg code for the recipient depending on the context and whether the recipient has multiple |
|
261 | + * registrations or not. |
|
262 | + * |
|
263 | + * @return string |
|
264 | + */ |
|
265 | + protected function _get_reg_code() |
|
266 | + { |
|
267 | + |
|
268 | + // if only one related registration for the recipient then just return that reg code. |
|
269 | + if (count($this->_registrations_for_recipient) <= 1) { |
|
270 | + return $this->_recipient->reg_obj->reg_code(); |
|
271 | + } |
|
272 | + |
|
273 | + // k more than one registration so let's see if we can get specific to context |
|
274 | + // are we parsing event_list? |
|
275 | + if ($this->_data instanceof EE_Event) { |
|
276 | + $reg_code = array(); |
|
277 | + // loop through registrations for recipient and see if there is a match for this event |
|
278 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
279 | + if ($reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID()) { |
|
280 | + $reg_code[] = $reg->reg_code(); |
|
281 | + } |
|
282 | + } |
|
283 | + return implode(', ', $reg_code); |
|
284 | + } |
|
285 | + |
|
286 | + // are we parsing ticket list? |
|
287 | + if ($this->_data instanceof EE_Ticket) { |
|
288 | + $reg_code = array(); |
|
289 | + // loop through each registration for recipient and see if there is a match for this ticket |
|
290 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
291 | + if ($reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID()) { |
|
292 | + $reg_code = $reg->reg_code(); |
|
293 | + } |
|
294 | + } |
|
295 | + return implode(', ', $reg_code); |
|
296 | + } |
|
297 | + |
|
298 | + // do we have a specific reg_obj? Let's use it |
|
299 | + if ($this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration) { |
|
300 | + return $this->_data->reg_obj->reg_code(); |
|
301 | + } |
|
302 | + |
|
303 | + // do we have a specific reg_obj? Let's use it |
|
304 | + if ($this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration) { |
|
305 | + return $this->_data->reg_obj->reg_code(); |
|
306 | + } |
|
307 | + |
|
308 | + // not able to determine the single reg code so let's return a comma delimited list of reg codes. |
|
309 | + $reg_code = array(); |
|
310 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
311 | + if ($reg instanceof EE_Registration) { |
|
312 | + $reg_code[] = $reg->reg_code(); |
|
313 | + } |
|
314 | + } |
|
315 | + return implode(', ', $reg_code); |
|
316 | + } |
|
317 | + |
|
318 | + |
|
319 | + /** |
|
320 | + * returns the reg ID for the recipient depending on the context and whether the recipient has multiple |
|
321 | + * registrations or not. |
|
322 | + * |
|
323 | + * @return int|string |
|
324 | + */ |
|
325 | + protected function _get_reg_id() |
|
326 | + { |
|
327 | + |
|
328 | + // if only one related registration for the recipient then just return that reg code. |
|
329 | + if (count($this->_registrations_for_recipient) <= 1) { |
|
330 | + return $this->_recipient->reg_obj->ID(); |
|
331 | + } |
|
332 | + |
|
333 | + // k more than one registration so let's see if we can get specific to context |
|
334 | + // are we parsing event_list? |
|
335 | + if ($this->_data instanceof EE_Event) { |
|
336 | + $registration_ids = array(); |
|
337 | + // loop through registrations for recipient and see if there is a match for this event |
|
338 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
339 | + if ($reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID()) { |
|
340 | + $registration_ids[] = $reg->ID(); |
|
341 | + } |
|
342 | + } |
|
343 | + return implode(', ', $registration_ids); |
|
344 | + } |
|
345 | + |
|
346 | + // are we parsing ticket list? |
|
347 | + if ($this->_data instanceof EE_Ticket) { |
|
348 | + $registration_ids = array(); |
|
349 | + // loop through each registration for recipient and see if there is a match for this ticket |
|
350 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
351 | + if ($reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID()) { |
|
352 | + $registration_ids = $reg->ID(); |
|
353 | + } |
|
354 | + } |
|
355 | + return implode(', ', $registration_ids); |
|
356 | + } |
|
357 | + |
|
358 | + // do we have a specific reg_obj? Let's use it |
|
359 | + if ($this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration) { |
|
360 | + return $this->_data->reg_obj->ID(); |
|
361 | + } |
|
362 | + |
|
363 | + // not able to determine the single reg code so let's return a comma delimited list of reg codes. |
|
364 | + $registration_ids = array(); |
|
365 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
366 | + if ($reg instanceof EE_Registration) { |
|
367 | + $registration_ids[] = $reg->ID(); |
|
368 | + } |
|
369 | + } |
|
370 | + return implode(', ', $registration_ids); |
|
371 | + } |
|
372 | 372 | } |
@@ -116,17 +116,17 @@ discard block |
||
116 | 116 | ? $this->_extra_data['data'] |
117 | 117 | : $this->_recipient; |
118 | 118 | |
119 | - if (! $this->_recipient instanceof EE_Messages_Addressee) { |
|
119 | + if ( ! $this->_recipient instanceof EE_Messages_Addressee) { |
|
120 | 120 | return ''; |
121 | 121 | } |
122 | 122 | |
123 | 123 | $attendee = $this->_recipient->att_obj; |
124 | - if (! $attendee instanceof EE_Attendee) { |
|
124 | + if ( ! $attendee instanceof EE_Attendee) { |
|
125 | 125 | return ''; |
126 | 126 | } |
127 | 127 | |
128 | - $this->_registrations_for_recipient = isset($this->_recipient->attendees[ $attendee->ID() ]['reg_objs']) |
|
129 | - ? $this->_recipient->attendees[ $attendee->ID() ]['reg_objs'] |
|
128 | + $this->_registrations_for_recipient = isset($this->_recipient->attendees[$attendee->ID()]['reg_objs']) |
|
129 | + ? $this->_recipient->attendees[$attendee->ID()]['reg_objs'] |
|
130 | 130 | : array(); |
131 | 131 | |
132 | 132 | switch ($shortcode) { |
@@ -143,21 +143,21 @@ discard block |
||
143 | 143 | break; |
144 | 144 | |
145 | 145 | case '[RECIPIENT_REGISTRATION_ID]': |
146 | - if (! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
146 | + if ( ! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
147 | 147 | return ''; |
148 | 148 | } |
149 | 149 | return $this->_get_reg_id(); |
150 | 150 | break; |
151 | 151 | |
152 | 152 | case '[RECIPIENT_REGISTRATION_CODE]': |
153 | - if (! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
153 | + if ( ! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
154 | 154 | return ''; |
155 | 155 | } |
156 | 156 | return $this->_get_reg_code(); |
157 | 157 | break; |
158 | 158 | |
159 | 159 | case '[RECIPIENT_EDIT_REGISTRATION_LINK]': |
160 | - if (! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
160 | + if ( ! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
161 | 161 | return ''; |
162 | 162 | } |
163 | 163 | return $this->_recipient->reg_obj->edit_attendee_information_url(); |
@@ -212,9 +212,9 @@ discard block |
||
212 | 212 | foreach ($this->_recipient->questions as $ansid => $question) { |
213 | 213 | if ($question instanceof EE_Question |
214 | 214 | && trim($question->display_text()) === trim($shortcode) |
215 | - && isset($this->_recipient->registrations[ $this->_recipient->reg_obj->ID() ]['ans_objs'][ $ansid ]) |
|
215 | + && isset($this->_recipient->registrations[$this->_recipient->reg_obj->ID()]['ans_objs'][$ansid]) |
|
216 | 216 | ) { |
217 | - $recipient_ansid = $this->_recipient->registrations[ $this->_recipient->reg_obj->ID() ]['ans_objs'][ $ansid ]; |
|
217 | + $recipient_ansid = $this->_recipient->registrations[$this->_recipient->reg_obj->ID()]['ans_objs'][$ansid]; |
|
218 | 218 | |
219 | 219 | // what we show for the answer depends on the question type! |
220 | 220 | switch ($question->get('QST_type')) { |
@@ -3,33 +3,33 @@ |
||
3 | 3 | global $post; |
4 | 4 | ?> |
5 | 5 | <div class="event-content"> |
6 | -<?php if ( apply_filters( 'FHEE__content_espresso_events_details_template__display_entry_meta', TRUE )): ?> |
|
6 | +<?php if (apply_filters('FHEE__content_espresso_events_details_template__display_entry_meta', TRUE)): ?> |
|
7 | 7 | <div class="entry-meta"> |
8 | - <span class="tags-links"><?php espresso_event_categories( $post->ID, TRUE, TRUE ); ?></span> |
|
8 | + <span class="tags-links"><?php espresso_event_categories($post->ID, TRUE, TRUE); ?></span> |
|
9 | 9 | <?php |
10 | - if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) : |
|
10 | + if ( ! post_password_required() && (comments_open() || get_comments_number())) : |
|
11 | 11 | ?> |
12 | - <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'event_espresso' ), __( '1 Comment', 'event_espresso' ), __( '% Comments', 'event_espresso' ) ); ?></span> |
|
12 | + <span class="comments-link"><?php comments_popup_link(__('Leave a comment', 'event_espresso'), __('1 Comment', 'event_espresso'), __('% Comments', 'event_espresso')); ?></span> |
|
13 | 13 | <?php |
14 | 14 | endif; |
15 | - edit_post_link( __( 'Edit', 'event_espresso' ), '<span class="edit-link">', '</span>' ); |
|
15 | + edit_post_link(__('Edit', 'event_espresso'), '<span class="edit-link">', '</span>'); |
|
16 | 16 | ?> |
17 | 17 | </div> |
18 | 18 | <?php endif; |
19 | - $event_phone = espresso_event_phone( $post->ID, FALSE ); |
|
20 | - if ( $event_phone != '' ) : ?> |
|
19 | + $event_phone = espresso_event_phone($post->ID, FALSE); |
|
20 | + if ($event_phone != '') : ?> |
|
21 | 21 | <p class="event-phone"> |
22 | - <span class="small-text"><strong><?php esc_html_e( 'Event Phone:', 'event_espresso' ); ?> </strong></span> <?php echo $event_phone; ?> |
|
22 | + <span class="small-text"><strong><?php esc_html_e('Event Phone:', 'event_espresso'); ?> </strong></span> <?php echo $event_phone; ?> |
|
23 | 23 | </p> |
24 | -<?php endif; ?> |
|
24 | +<?php endif; ?> |
|
25 | 25 | <?php |
26 | - if ( apply_filters( 'FHEE__content_espresso_events_details_template__display_the_content', true ) ) { |
|
27 | - do_action( 'AHEE_event_details_before_the_content', $post ); |
|
26 | + if (apply_filters('FHEE__content_espresso_events_details_template__display_the_content', true)) { |
|
27 | + do_action('AHEE_event_details_before_the_content', $post); |
|
28 | 28 | echo apply_filters( |
29 | 29 | 'FHEE__content_espresso_events_details_template__the_content', |
30 | - espresso_event_content_or_excerpt( 55, null, false ) |
|
30 | + espresso_event_content_or_excerpt(55, null, false) |
|
31 | 31 | ); |
32 | - do_action( 'AHEE_event_details_after_the_content', $post ); |
|
32 | + do_action('AHEE_event_details_after_the_content', $post); |
|
33 | 33 | } |
34 | 34 | ?> |
35 | 35 | </div> |
@@ -16,74 +16,74 @@ |
||
16 | 16 | class EraseAttendeeData implements PersonalDataEraserInterface |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * @var EEM_Attendee |
|
21 | - */ |
|
22 | - protected $attendee_model; |
|
19 | + /** |
|
20 | + * @var EEM_Attendee |
|
21 | + */ |
|
22 | + protected $attendee_model; |
|
23 | 23 | |
24 | 24 | |
25 | - /** |
|
26 | - * EraseAttendeeData constructor. |
|
27 | - * |
|
28 | - * @param EEM_Attendee $attendee_model |
|
29 | - */ |
|
30 | - public function __construct(EEM_Attendee $attendee_model) |
|
31 | - { |
|
32 | - $this->attendee_model = $attendee_model; |
|
33 | - } |
|
25 | + /** |
|
26 | + * EraseAttendeeData constructor. |
|
27 | + * |
|
28 | + * @param EEM_Attendee $attendee_model |
|
29 | + */ |
|
30 | + public function __construct(EEM_Attendee $attendee_model) |
|
31 | + { |
|
32 | + $this->attendee_model = $attendee_model; |
|
33 | + } |
|
34 | 34 | |
35 | 35 | |
36 | - /** |
|
37 | - * Gets a translated string name for the data eraser |
|
38 | - * |
|
39 | - * @return string |
|
40 | - */ |
|
41 | - public function name() |
|
42 | - { |
|
43 | - return esc_html__('Event Espresso Attendee Data', 'event_espresso'); |
|
44 | - } |
|
36 | + /** |
|
37 | + * Gets a translated string name for the data eraser |
|
38 | + * |
|
39 | + * @return string |
|
40 | + */ |
|
41 | + public function name() |
|
42 | + { |
|
43 | + return esc_html__('Event Espresso Attendee Data', 'event_espresso'); |
|
44 | + } |
|
45 | 45 | |
46 | 46 | |
47 | - /** |
|
48 | - * Erases a "page" of personal user data |
|
49 | - * |
|
50 | - * @return array { |
|
51 | - * @type boolean $items_removed whether items were removed successfully or not |
|
52 | - * @type boolean $items_retained whether any items were skipped or not |
|
53 | - * @type array $messages values are messages to show |
|
54 | - * @type boolean $done whether this eraser is done or has more pages |
|
55 | - * } |
|
56 | - * @throws \EE_Error |
|
57 | - */ |
|
58 | - public function erase($email_address, $page = 1) |
|
59 | - { |
|
60 | - $rows_updated = $this->attendee_model->update( |
|
61 | - array( |
|
62 | - 'ATT_fname' => esc_html__('Anonymous', 'event_espresso'), |
|
63 | - 'ATT_lname' => '', |
|
64 | - 'ATT_email' => '', |
|
65 | - 'ATT_address' => '', |
|
66 | - 'ATT_address2' => '', |
|
67 | - 'ATT_city' => '', |
|
68 | - 'STA_ID' => 0, |
|
69 | - 'CNT_ISO' => '', |
|
70 | - 'ATT_zip' => '', |
|
71 | - 'ATT_phone' => '', |
|
72 | - ), |
|
73 | - array( |
|
74 | - array( |
|
75 | - 'ATT_email' => $email_address, |
|
76 | - ), |
|
77 | - ) |
|
78 | - ); |
|
47 | + /** |
|
48 | + * Erases a "page" of personal user data |
|
49 | + * |
|
50 | + * @return array { |
|
51 | + * @type boolean $items_removed whether items were removed successfully or not |
|
52 | + * @type boolean $items_retained whether any items were skipped or not |
|
53 | + * @type array $messages values are messages to show |
|
54 | + * @type boolean $done whether this eraser is done or has more pages |
|
55 | + * } |
|
56 | + * @throws \EE_Error |
|
57 | + */ |
|
58 | + public function erase($email_address, $page = 1) |
|
59 | + { |
|
60 | + $rows_updated = $this->attendee_model->update( |
|
61 | + array( |
|
62 | + 'ATT_fname' => esc_html__('Anonymous', 'event_espresso'), |
|
63 | + 'ATT_lname' => '', |
|
64 | + 'ATT_email' => '', |
|
65 | + 'ATT_address' => '', |
|
66 | + 'ATT_address2' => '', |
|
67 | + 'ATT_city' => '', |
|
68 | + 'STA_ID' => 0, |
|
69 | + 'CNT_ISO' => '', |
|
70 | + 'ATT_zip' => '', |
|
71 | + 'ATT_phone' => '', |
|
72 | + ), |
|
73 | + array( |
|
74 | + array( |
|
75 | + 'ATT_email' => $email_address, |
|
76 | + ), |
|
77 | + ) |
|
78 | + ); |
|
79 | 79 | |
80 | - return array( |
|
81 | - 'items_removed' => (bool) $rows_updated, |
|
82 | - 'items_retained' => false, // always false in this example |
|
83 | - 'messages' => array(), |
|
84 | - 'done' => true, |
|
85 | - ); |
|
86 | - } |
|
80 | + return array( |
|
81 | + 'items_removed' => (bool) $rows_updated, |
|
82 | + 'items_retained' => false, // always false in this example |
|
83 | + 'messages' => array(), |
|
84 | + 'done' => true, |
|
85 | + ); |
|
86 | + } |
|
87 | 87 | } |
88 | 88 | // End of file EraseAttendeeData.php |
89 | 89 | // Location: EventEspresso\core\domain\services\privacy\erasure/EraseAttendeeData.php |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <div id="admin-primary-mbox-questions-dv" class="admin-primary-mbox-dv"> |
2 | 2 | <p> |
3 | 3 | <?php _e( |
4 | - 'This displays the custom questions and answers for this registrant. Please note that any answers to system questions have been saved with the contact record. You can edit those answers via the "View/Edit this Contact" link in the Contact Details metabox in the sidebar.', |
|
5 | - 'event_espresso' |
|
6 | - ); ?></p> |
|
4 | + 'This displays the custom questions and answers for this registrant. Please note that any answers to system questions have been saved with the contact record. You can edit those answers via the "View/Edit this Contact" link in the Contact Details metabox in the sidebar.', |
|
5 | + 'event_espresso' |
|
6 | + ); ?></p> |
|
7 | 7 | |
8 | 8 | <form name="reg-admin-attendee-questions-frm" id="reg-admin-attendee-questions-frm" |
9 | 9 | action="<?php echo REG_ADMIN_URL; ?>" method="post"> |
@@ -16,19 +16,19 @@ discard block |
||
16 | 16 | <?php echo $att_questions; ?> |
17 | 17 | <?php if (! empty($att_questions)) : ?> |
18 | 18 | <?php if (EE_Registry::instance()->CAP->current_user_can( |
19 | - 'ee_edit_registration', |
|
20 | - 'edit-reg-questions-mbox', |
|
21 | - $REG_ID |
|
22 | - )) : ?> |
|
19 | + 'ee_edit_registration', |
|
20 | + 'edit-reg-questions-mbox', |
|
21 | + $REG_ID |
|
22 | + )) : ?> |
|
23 | 23 | <input id="reg-admin-attendee-questions-submit" class="button-primary" value="Update Registration Questions" |
24 | 24 | type="submit"/> |
25 | 25 | <?php endif; ?> |
26 | 26 | <?php else : ?> |
27 | 27 | <p class="ee-attention"> |
28 | 28 | <?php _e( |
29 | - 'There were no custom questions asked for this registration.', |
|
30 | - 'event_espresso' |
|
31 | - ); ?></p> |
|
29 | + 'There were no custom questions asked for this registration.', |
|
30 | + 'event_espresso' |
|
31 | + ); ?></p> |
|
32 | 32 | <?php endif; ?> |
33 | 33 | |
34 | 34 | </form> |
@@ -7,14 +7,14 @@ |
||
7 | 7 | |
8 | 8 | <form name="reg-admin-attendee-questions-frm" id="reg-admin-attendee-questions-frm" |
9 | 9 | action="<?php echo REG_ADMIN_URL; ?>" method="post"> |
10 | - <?php wp_nonce_field($reg_questions_form_action . '_nonce', $reg_questions_form_action . '_nonce'); ?> |
|
10 | + <?php wp_nonce_field($reg_questions_form_action.'_nonce', $reg_questions_form_action.'_nonce'); ?> |
|
11 | 11 | <input type="hidden" name="page" value="<?php echo REG_PG_SLUG; ?>"/> |
12 | 12 | <input type="hidden" name="action" value="<?php echo $reg_questions_form_action; ?>"/> |
13 | 13 | <input type="hidden" name="_REG_ID" value="<?php echo $REG_ID; ?>"/> |
14 | 14 | <input type="hidden" name="espresso_ajax" id="espresso-ajax" value="0"/> |
15 | 15 | <input type="hidden" name="noheader" id="reg-admin-noheader-inp" value="true"/> |
16 | 16 | <?php echo $att_questions; ?> |
17 | - <?php if (! empty($att_questions)) : ?> |
|
17 | + <?php if ( ! empty($att_questions)) : ?> |
|
18 | 18 | <?php if (EE_Registry::instance()->CAP->current_user_can( |
19 | 19 | 'ee_edit_registration', |
20 | 20 | 'edit-reg-questions-mbox', |
@@ -23,12 +23,15 @@ |
||
23 | 23 | <input id="reg-admin-attendee-questions-submit" class="button-primary" value="Update Registration Questions" |
24 | 24 | type="submit"/> |
25 | 25 | <?php endif; ?> |
26 | - <?php else : ?> |
|
26 | + <?php else { |
|
27 | + : ?> |
|
27 | 28 | <p class="ee-attention"> |
28 | 29 | <?php _e( |
29 | 30 | 'There were no custom questions asked for this registration.', |
30 | 31 | 'event_espresso' |
31 | - ); ?></p> |
|
32 | + ); |
|
33 | +} |
|
34 | +?></p> |
|
32 | 35 | <?php endif; ?> |
33 | 36 | |
34 | 37 | </form> |
@@ -17,89 +17,89 @@ |
||
17 | 17 | class EE_Restriction_Generator_Event_Related_Protected extends EE_Restriction_Generator_Base |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * Path to the event model from the model this restriction generator will be applied to; |
|
22 | - * including the event model itself. Eg "Ticket.Datetime.Event" |
|
23 | - * @var string |
|
24 | - */ |
|
25 | - protected $_path_to_event_model = null; |
|
20 | + /** |
|
21 | + * Path to the event model from the model this restriction generator will be applied to; |
|
22 | + * including the event model itself. Eg "Ticket.Datetime.Event" |
|
23 | + * @var string |
|
24 | + */ |
|
25 | + protected $_path_to_event_model = null; |
|
26 | 26 | |
27 | - /** |
|
28 | - * Capability context on event model when creating restrictions. |
|
29 | - * Eg, although we may want capability restrictions relating to deleting datetimes, |
|
30 | - * they don't need to be able to DELETE EVENTS, they just need to be able to |
|
31 | - * EDIT EVENTS in order to DELETE DATETIMES. |
|
32 | - * @var string one of EEM_Base::valid_cap_contexts() |
|
33 | - */ |
|
34 | - protected $_cap_context_on_event_model = null; |
|
35 | - /** |
|
36 | - * |
|
37 | - * @param string $path_to_event_model |
|
38 | - * @param string $cap_context_on_event_model capability context on event model when creating restrictions. |
|
39 | - * Eg, although we may want capability restrictions relating to deleting datetimes, |
|
40 | - * they don't need to be able to DELETE EVENTS, they just need to be able to |
|
41 | - * EDIT EVENTS in order to DELETE DATETIMES. If none if provided, assumed to be the same |
|
42 | - * as on the primary model. |
|
43 | - */ |
|
44 | - public function __construct($path_to_event_model, $cap_context_on_event_model = null) |
|
45 | - { |
|
46 | - if (substr($path_to_event_model, -1, 1) != '.') { |
|
47 | - $path_to_event_model .= '.'; |
|
48 | - } |
|
49 | - $this->_path_to_event_model = $path_to_event_model; |
|
50 | - $this->_cap_context_on_event_model = $cap_context_on_event_model; |
|
51 | - } |
|
27 | + /** |
|
28 | + * Capability context on event model when creating restrictions. |
|
29 | + * Eg, although we may want capability restrictions relating to deleting datetimes, |
|
30 | + * they don't need to be able to DELETE EVENTS, they just need to be able to |
|
31 | + * EDIT EVENTS in order to DELETE DATETIMES. |
|
32 | + * @var string one of EEM_Base::valid_cap_contexts() |
|
33 | + */ |
|
34 | + protected $_cap_context_on_event_model = null; |
|
35 | + /** |
|
36 | + * |
|
37 | + * @param string $path_to_event_model |
|
38 | + * @param string $cap_context_on_event_model capability context on event model when creating restrictions. |
|
39 | + * Eg, although we may want capability restrictions relating to deleting datetimes, |
|
40 | + * they don't need to be able to DELETE EVENTS, they just need to be able to |
|
41 | + * EDIT EVENTS in order to DELETE DATETIMES. If none if provided, assumed to be the same |
|
42 | + * as on the primary model. |
|
43 | + */ |
|
44 | + public function __construct($path_to_event_model, $cap_context_on_event_model = null) |
|
45 | + { |
|
46 | + if (substr($path_to_event_model, -1, 1) != '.') { |
|
47 | + $path_to_event_model .= '.'; |
|
48 | + } |
|
49 | + $this->_path_to_event_model = $path_to_event_model; |
|
50 | + $this->_cap_context_on_event_model = $cap_context_on_event_model; |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * Returns `$this->_cap_context_on_event_model`, the relevant action ("read", |
|
55 | - * "read_admin", "edit" or "delete") for the EVENT related to this model. |
|
56 | - * @see EE_Restriction_Generator_Event_Related_Protected::__construct() |
|
57 | - * @return string one of EEM_Base::valid_cap_contexts() |
|
58 | - */ |
|
59 | - protected function action_for_event() |
|
60 | - { |
|
61 | - if ($this->_cap_context_on_event_model) { |
|
62 | - return $this->_cap_context_on_event_model; |
|
63 | - } else { |
|
64 | - return $this->action(); |
|
65 | - } |
|
66 | - } |
|
53 | + /** |
|
54 | + * Returns `$this->_cap_context_on_event_model`, the relevant action ("read", |
|
55 | + * "read_admin", "edit" or "delete") for the EVENT related to this model. |
|
56 | + * @see EE_Restriction_Generator_Event_Related_Protected::__construct() |
|
57 | + * @return string one of EEM_Base::valid_cap_contexts() |
|
58 | + */ |
|
59 | + protected function action_for_event() |
|
60 | + { |
|
61 | + if ($this->_cap_context_on_event_model) { |
|
62 | + return $this->_cap_context_on_event_model; |
|
63 | + } else { |
|
64 | + return $this->action(); |
|
65 | + } |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * |
|
70 | - * @return \EE_Default_Where_Conditions |
|
71 | - */ |
|
72 | - protected function _generate_restrictions() |
|
73 | - { |
|
74 | - // if there are no standard caps for this model, then for now all we know |
|
75 | - // if they need the default cap to access this |
|
76 | - if (! $this->model()->cap_slug()) { |
|
77 | - return array( |
|
78 | - self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions() |
|
79 | - ); |
|
80 | - } |
|
68 | + /** |
|
69 | + * |
|
70 | + * @return \EE_Default_Where_Conditions |
|
71 | + */ |
|
72 | + protected function _generate_restrictions() |
|
73 | + { |
|
74 | + // if there are no standard caps for this model, then for now all we know |
|
75 | + // if they need the default cap to access this |
|
76 | + if (! $this->model()->cap_slug()) { |
|
77 | + return array( |
|
78 | + self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions() |
|
79 | + ); |
|
80 | + } |
|
81 | 81 | |
82 | - $event_model = EEM_Event::instance(); |
|
83 | - return array( |
|
84 | - // first: basically access to non-defaults is essentially controlled by which events are accessible |
|
85 | - // if they don't have the basic event cap, they can't access ANY non-default items |
|
86 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event()) => new EE_Return_None_Where_Conditions(), |
|
87 | - // if they don't have the others event cap, they can't access others' non-default items |
|
88 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_others') => new EE_Default_Where_Conditions( |
|
89 | - array( $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder ) |
|
90 | - ), |
|
91 | - // if they have basic and others, but not private, they can't access others' private non-default items |
|
92 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_private') => new EE_Default_Where_Conditions( |
|
93 | - array( |
|
94 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_private') => $this->addPublishedPostConditions( |
|
95 | - array( |
|
96 | - $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
97 | - ), |
|
98 | - false, |
|
99 | - $this->_path_to_event_model |
|
100 | - ) |
|
101 | - ) |
|
102 | - ), |
|
103 | - ); |
|
104 | - } |
|
82 | + $event_model = EEM_Event::instance(); |
|
83 | + return array( |
|
84 | + // first: basically access to non-defaults is essentially controlled by which events are accessible |
|
85 | + // if they don't have the basic event cap, they can't access ANY non-default items |
|
86 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event()) => new EE_Return_None_Where_Conditions(), |
|
87 | + // if they don't have the others event cap, they can't access others' non-default items |
|
88 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_others') => new EE_Default_Where_Conditions( |
|
89 | + array( $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder ) |
|
90 | + ), |
|
91 | + // if they have basic and others, but not private, they can't access others' private non-default items |
|
92 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_private') => new EE_Default_Where_Conditions( |
|
93 | + array( |
|
94 | + 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_private') => $this->addPublishedPostConditions( |
|
95 | + array( |
|
96 | + $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
97 | + ), |
|
98 | + false, |
|
99 | + $this->_path_to_event_model |
|
100 | + ) |
|
101 | + ) |
|
102 | + ), |
|
103 | + ); |
|
104 | + } |
|
105 | 105 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | { |
74 | 74 | // if there are no standard caps for this model, then for now all we know |
75 | 75 | // if they need the default cap to access this |
76 | - if (! $this->model()->cap_slug()) { |
|
76 | + if ( ! $this->model()->cap_slug()) { |
|
77 | 77 | return array( |
78 | 78 | self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions() |
79 | 79 | ); |
@@ -85,15 +85,15 @@ discard block |
||
85 | 85 | // if they don't have the basic event cap, they can't access ANY non-default items |
86 | 86 | EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event()) => new EE_Return_None_Where_Conditions(), |
87 | 87 | // if they don't have the others event cap, they can't access others' non-default items |
88 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_others') => new EE_Default_Where_Conditions( |
|
89 | - array( $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder ) |
|
88 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event().'_others') => new EE_Default_Where_Conditions( |
|
89 | + array($this->_path_to_event_model.'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder) |
|
90 | 90 | ), |
91 | 91 | // if they have basic and others, but not private, they can't access others' private non-default items |
92 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_private') => new EE_Default_Where_Conditions( |
|
92 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event().'_private') => new EE_Default_Where_Conditions( |
|
93 | 93 | array( |
94 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_private') => $this->addPublishedPostConditions( |
|
94 | + 'OR*no_'.EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event().'_private') => $this->addPublishedPostConditions( |
|
95 | 95 | array( |
96 | - $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
96 | + $this->_path_to_event_model.'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
97 | 97 | ), |
98 | 98 | false, |
99 | 99 | $this->_path_to_event_model |
@@ -17,72 +17,72 @@ |
||
17 | 17 | class EE_Restriction_Generator_Event_Related_Public extends EE_Restriction_Generator_Base |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * Path to the event model from the model this restriction generator will be applied to; |
|
22 | - * including the event model itself. Eg "Ticket.Datetime.Event" |
|
23 | - * @var string |
|
24 | - */ |
|
25 | - protected $_path_to_event_model; |
|
26 | - /** |
|
27 | - * |
|
28 | - * @param string $path_to_event_model |
|
29 | - */ |
|
30 | - public function __construct($path_to_event_model) |
|
31 | - { |
|
32 | - if (substr($path_to_event_model, -1, 1) != '.') { |
|
33 | - $path_to_event_model .= '.'; |
|
34 | - } |
|
35 | - $this->_path_to_event_model = $path_to_event_model; |
|
36 | - } |
|
37 | - /** |
|
38 | - * |
|
39 | - * @return \EE_Default_Where_Conditions |
|
40 | - */ |
|
41 | - protected function _generate_restrictions() |
|
42 | - { |
|
43 | - // if there are no standard caps for this model, then for now all we know |
|
44 | - // if they need the default cap to access this |
|
45 | - if (! $this->model()->cap_slug()) { |
|
46 | - return array( |
|
47 | - self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions() |
|
48 | - ); |
|
49 | - } |
|
20 | + /** |
|
21 | + * Path to the event model from the model this restriction generator will be applied to; |
|
22 | + * including the event model itself. Eg "Ticket.Datetime.Event" |
|
23 | + * @var string |
|
24 | + */ |
|
25 | + protected $_path_to_event_model; |
|
26 | + /** |
|
27 | + * |
|
28 | + * @param string $path_to_event_model |
|
29 | + */ |
|
30 | + public function __construct($path_to_event_model) |
|
31 | + { |
|
32 | + if (substr($path_to_event_model, -1, 1) != '.') { |
|
33 | + $path_to_event_model .= '.'; |
|
34 | + } |
|
35 | + $this->_path_to_event_model = $path_to_event_model; |
|
36 | + } |
|
37 | + /** |
|
38 | + * |
|
39 | + * @return \EE_Default_Where_Conditions |
|
40 | + */ |
|
41 | + protected function _generate_restrictions() |
|
42 | + { |
|
43 | + // if there are no standard caps for this model, then for now all we know |
|
44 | + // if they need the default cap to access this |
|
45 | + if (! $this->model()->cap_slug()) { |
|
46 | + return array( |
|
47 | + self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions() |
|
48 | + ); |
|
49 | + } |
|
50 | 50 | |
51 | - $event_model = EEM_Event::instance(); |
|
52 | - return array( |
|
53 | - // first: basically access to non-defaults is essentially controlled by which events are accessible |
|
54 | - // if they don't have the basic event cap, they can only read things for published events |
|
55 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => new EE_Default_Where_Conditions( |
|
56 | - $this->addPublishedPostConditions( |
|
57 | - array(), |
|
58 | - true, |
|
59 | - $this->_path_to_event_model |
|
60 | - ) |
|
61 | - ), |
|
62 | - // if they don't have the others event cap, they can't access others' non-default items |
|
63 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => new EE_Default_Where_Conditions( |
|
64 | - array( |
|
65 | - 'OR*' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => $this->addPublishedPostConditions( |
|
66 | - array( |
|
67 | - $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
68 | - ), |
|
69 | - true, |
|
70 | - $this->_path_to_event_model |
|
71 | - ) |
|
72 | - ) |
|
73 | - ), |
|
74 | - // if they have basic and others, but not private, they can't access others' private non-default items |
|
75 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => new EE_Default_Where_Conditions( |
|
76 | - array( |
|
77 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => $this->addPublishedPostConditions( |
|
78 | - array( |
|
79 | - $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
80 | - ), |
|
81 | - false, |
|
82 | - $this->_path_to_event_model |
|
83 | - ) |
|
84 | - ) |
|
85 | - ), |
|
86 | - ); |
|
87 | - } |
|
51 | + $event_model = EEM_Event::instance(); |
|
52 | + return array( |
|
53 | + // first: basically access to non-defaults is essentially controlled by which events are accessible |
|
54 | + // if they don't have the basic event cap, they can only read things for published events |
|
55 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => new EE_Default_Where_Conditions( |
|
56 | + $this->addPublishedPostConditions( |
|
57 | + array(), |
|
58 | + true, |
|
59 | + $this->_path_to_event_model |
|
60 | + ) |
|
61 | + ), |
|
62 | + // if they don't have the others event cap, they can't access others' non-default items |
|
63 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => new EE_Default_Where_Conditions( |
|
64 | + array( |
|
65 | + 'OR*' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => $this->addPublishedPostConditions( |
|
66 | + array( |
|
67 | + $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
68 | + ), |
|
69 | + true, |
|
70 | + $this->_path_to_event_model |
|
71 | + ) |
|
72 | + ) |
|
73 | + ), |
|
74 | + // if they have basic and others, but not private, they can't access others' private non-default items |
|
75 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => new EE_Default_Where_Conditions( |
|
76 | + array( |
|
77 | + 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => $this->addPublishedPostConditions( |
|
78 | + array( |
|
79 | + $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
80 | + ), |
|
81 | + false, |
|
82 | + $this->_path_to_event_model |
|
83 | + ) |
|
84 | + ) |
|
85 | + ), |
|
86 | + ); |
|
87 | + } |
|
88 | 88 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | { |
43 | 43 | // if there are no standard caps for this model, then for now all we know |
44 | 44 | // if they need the default cap to access this |
45 | - if (! $this->model()->cap_slug()) { |
|
45 | + if ( ! $this->model()->cap_slug()) { |
|
46 | 46 | return array( |
47 | 47 | self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions() |
48 | 48 | ); |
@@ -60,11 +60,11 @@ discard block |
||
60 | 60 | ) |
61 | 61 | ), |
62 | 62 | // if they don't have the others event cap, they can't access others' non-default items |
63 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => new EE_Default_Where_Conditions( |
|
63 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action().'_others') => new EE_Default_Where_Conditions( |
|
64 | 64 | array( |
65 | - 'OR*' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => $this->addPublishedPostConditions( |
|
65 | + 'OR*'.EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action().'_others') => $this->addPublishedPostConditions( |
|
66 | 66 | array( |
67 | - $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
67 | + $this->_path_to_event_model.'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
68 | 68 | ), |
69 | 69 | true, |
70 | 70 | $this->_path_to_event_model |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | ) |
73 | 73 | ), |
74 | 74 | // if they have basic and others, but not private, they can't access others' private non-default items |
75 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => new EE_Default_Where_Conditions( |
|
75 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action().'_private') => new EE_Default_Where_Conditions( |
|
76 | 76 | array( |
77 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => $this->addPublishedPostConditions( |
|
77 | + 'OR*no_'.EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action().'_private') => $this->addPublishedPostConditions( |
|
78 | 78 | array( |
79 | - $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
79 | + $this->_path_to_event_model.'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
80 | 80 | ), |
81 | 81 | false, |
82 | 82 | $this->_path_to_event_model |
@@ -12,74 +12,74 @@ |
||
12 | 12 | */ |
13 | 13 | class EE_Restriction_Generator_Public extends EE_Restriction_Generator_Base |
14 | 14 | { |
15 | - protected function _generate_restrictions() |
|
16 | - { |
|
17 | - // if there are no standard caps for this model, then for allow full access |
|
18 | - if (! $this->model()->cap_slug()) { |
|
19 | - return array( |
|
20 | - ); |
|
21 | - } |
|
15 | + protected function _generate_restrictions() |
|
16 | + { |
|
17 | + // if there are no standard caps for this model, then for allow full access |
|
18 | + if (! $this->model()->cap_slug()) { |
|
19 | + return array( |
|
20 | + ); |
|
21 | + } |
|
22 | 22 | |
23 | - $restrictions = array(); |
|
24 | - // does the basic cap exist? (eg 'ee_read_registrations') |
|
25 | - if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action())) { |
|
26 | - if ($this->model() instanceof EEM_CPT_Base) { |
|
27 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) ] = new EE_Default_Where_Conditions( |
|
28 | - $this->addPublishedPostConditions() |
|
29 | - ); |
|
30 | - } elseif ($this->model() instanceof EEM_Soft_Delete_Base) { |
|
31 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) ] = new EE_Default_Where_Conditions( |
|
32 | - array( $this->model()->deleted_field_name() => false ) |
|
33 | - ); |
|
34 | - } else { |
|
35 | - // don't impose any restrictions if they don't have the basic reading cap |
|
36 | - } |
|
37 | - // does the others cap exist? (eg 'ee_read_others_registrations') |
|
38 | - if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_others')) {// both caps exist |
|
39 | - if ($this->model() instanceof EEM_CPT_Base) { |
|
40 | - // then if they don't have the others cap, AT MOST show them their own and other published ones |
|
41 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') ] = new EE_Default_Where_Conditions( |
|
42 | - array( |
|
43 | - 'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') => $this->addPublishedPostConditions( |
|
44 | - array( |
|
45 | - EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
|
46 | - ) |
|
47 | - ) |
|
48 | - ) |
|
49 | - ); |
|
50 | - } elseif ($this->model() instanceof EEM_Soft_Delete_Base) { |
|
51 | - // then if they don't have the other cap, AT MOST show them their own or non deleted ones |
|
52 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') ] = new EE_Default_Where_Conditions( |
|
53 | - array( |
|
54 | - 'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') => array( |
|
55 | - EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
|
56 | - $this->model()->deleted_field_name() => false |
|
57 | - ) |
|
58 | - ) |
|
59 | - ); |
|
60 | - } else { |
|
61 | - // again, if they don't have the others cap, continue showing all because there are no inherently hidden ones |
|
62 | - } |
|
63 | - // does the private cap exist (eg 'ee_read_others_private_events') |
|
64 | - if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_private') && $this->model() instanceof EEM_CPT_Base) { |
|
65 | - // if they have basic and others, but not private, restrict them to see theirs and others' that aren't private |
|
66 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_private') ] = new EE_Default_Where_Conditions( |
|
67 | - array( |
|
68 | - 'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_private') => $this->addPublishedPostConditions( |
|
69 | - array( |
|
70 | - EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
|
71 | - ), |
|
72 | - false, |
|
73 | - '' |
|
74 | - ) |
|
75 | - ) |
|
76 | - ); |
|
77 | - } |
|
78 | - } |
|
79 | - } else { |
|
80 | - // there is no basic cap. So allow full access |
|
81 | - $restrictions = array(); |
|
82 | - } |
|
83 | - return $restrictions; |
|
84 | - } |
|
23 | + $restrictions = array(); |
|
24 | + // does the basic cap exist? (eg 'ee_read_registrations') |
|
25 | + if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action())) { |
|
26 | + if ($this->model() instanceof EEM_CPT_Base) { |
|
27 | + $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) ] = new EE_Default_Where_Conditions( |
|
28 | + $this->addPublishedPostConditions() |
|
29 | + ); |
|
30 | + } elseif ($this->model() instanceof EEM_Soft_Delete_Base) { |
|
31 | + $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) ] = new EE_Default_Where_Conditions( |
|
32 | + array( $this->model()->deleted_field_name() => false ) |
|
33 | + ); |
|
34 | + } else { |
|
35 | + // don't impose any restrictions if they don't have the basic reading cap |
|
36 | + } |
|
37 | + // does the others cap exist? (eg 'ee_read_others_registrations') |
|
38 | + if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_others')) {// both caps exist |
|
39 | + if ($this->model() instanceof EEM_CPT_Base) { |
|
40 | + // then if they don't have the others cap, AT MOST show them their own and other published ones |
|
41 | + $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') ] = new EE_Default_Where_Conditions( |
|
42 | + array( |
|
43 | + 'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') => $this->addPublishedPostConditions( |
|
44 | + array( |
|
45 | + EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
|
46 | + ) |
|
47 | + ) |
|
48 | + ) |
|
49 | + ); |
|
50 | + } elseif ($this->model() instanceof EEM_Soft_Delete_Base) { |
|
51 | + // then if they don't have the other cap, AT MOST show them their own or non deleted ones |
|
52 | + $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') ] = new EE_Default_Where_Conditions( |
|
53 | + array( |
|
54 | + 'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') => array( |
|
55 | + EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
|
56 | + $this->model()->deleted_field_name() => false |
|
57 | + ) |
|
58 | + ) |
|
59 | + ); |
|
60 | + } else { |
|
61 | + // again, if they don't have the others cap, continue showing all because there are no inherently hidden ones |
|
62 | + } |
|
63 | + // does the private cap exist (eg 'ee_read_others_private_events') |
|
64 | + if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_private') && $this->model() instanceof EEM_CPT_Base) { |
|
65 | + // if they have basic and others, but not private, restrict them to see theirs and others' that aren't private |
|
66 | + $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_private') ] = new EE_Default_Where_Conditions( |
|
67 | + array( |
|
68 | + 'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_private') => $this->addPublishedPostConditions( |
|
69 | + array( |
|
70 | + EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
|
71 | + ), |
|
72 | + false, |
|
73 | + '' |
|
74 | + ) |
|
75 | + ) |
|
76 | + ); |
|
77 | + } |
|
78 | + } |
|
79 | + } else { |
|
80 | + // there is no basic cap. So allow full access |
|
81 | + $restrictions = array(); |
|
82 | + } |
|
83 | + return $restrictions; |
|
84 | + } |
|
85 | 85 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | protected function _generate_restrictions() |
16 | 16 | { |
17 | 17 | // if there are no standard caps for this model, then for allow full access |
18 | - if (! $this->model()->cap_slug()) { |
|
18 | + if ( ! $this->model()->cap_slug()) { |
|
19 | 19 | return array( |
20 | 20 | ); |
21 | 21 | } |
@@ -24,23 +24,23 @@ discard block |
||
24 | 24 | // does the basic cap exist? (eg 'ee_read_registrations') |
25 | 25 | if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action())) { |
26 | 26 | if ($this->model() instanceof EEM_CPT_Base) { |
27 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) ] = new EE_Default_Where_Conditions( |
|
27 | + $restrictions[EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action())] = new EE_Default_Where_Conditions( |
|
28 | 28 | $this->addPublishedPostConditions() |
29 | 29 | ); |
30 | 30 | } elseif ($this->model() instanceof EEM_Soft_Delete_Base) { |
31 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) ] = new EE_Default_Where_Conditions( |
|
32 | - array( $this->model()->deleted_field_name() => false ) |
|
31 | + $restrictions[EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action())] = new EE_Default_Where_Conditions( |
|
32 | + array($this->model()->deleted_field_name() => false) |
|
33 | 33 | ); |
34 | 34 | } else { |
35 | 35 | // don't impose any restrictions if they don't have the basic reading cap |
36 | 36 | } |
37 | 37 | // does the others cap exist? (eg 'ee_read_others_registrations') |
38 | - if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_others')) {// both caps exist |
|
38 | + if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action().'_others')) {// both caps exist |
|
39 | 39 | if ($this->model() instanceof EEM_CPT_Base) { |
40 | 40 | // then if they don't have the others cap, AT MOST show them their own and other published ones |
41 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') ] = new EE_Default_Where_Conditions( |
|
41 | + $restrictions[EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_others')] = new EE_Default_Where_Conditions( |
|
42 | 42 | array( |
43 | - 'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') => $this->addPublishedPostConditions( |
|
43 | + 'OR*'.EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_others') => $this->addPublishedPostConditions( |
|
44 | 44 | array( |
45 | 45 | EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
46 | 46 | ) |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | ); |
50 | 50 | } elseif ($this->model() instanceof EEM_Soft_Delete_Base) { |
51 | 51 | // then if they don't have the other cap, AT MOST show them their own or non deleted ones |
52 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') ] = new EE_Default_Where_Conditions( |
|
52 | + $restrictions[EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_others')] = new EE_Default_Where_Conditions( |
|
53 | 53 | array( |
54 | - 'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') => array( |
|
54 | + 'OR*'.EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_others') => array( |
|
55 | 55 | EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
56 | 56 | $this->model()->deleted_field_name() => false |
57 | 57 | ) |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | // again, if they don't have the others cap, continue showing all because there are no inherently hidden ones |
62 | 62 | } |
63 | 63 | // does the private cap exist (eg 'ee_read_others_private_events') |
64 | - if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_private') && $this->model() instanceof EEM_CPT_Base) { |
|
64 | + if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action().'_private') && $this->model() instanceof EEM_CPT_Base) { |
|
65 | 65 | // if they have basic and others, but not private, restrict them to see theirs and others' that aren't private |
66 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_private') ] = new EE_Default_Where_Conditions( |
|
66 | + $restrictions[EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_private')] = new EE_Default_Where_Conditions( |
|
67 | 67 | array( |
68 | - 'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_private') => $this->addPublishedPostConditions( |
|
68 | + 'OR*'.EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_private') => $this->addPublishedPostConditions( |
|
69 | 69 | array( |
70 | 70 | EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
71 | 71 | ), |
@@ -18,110 +18,110 @@ |
||
18 | 18 | class EE_Restriction_Generator_Default_Public extends EE_Restriction_Generator_Base |
19 | 19 | { |
20 | 20 | /** |
21 | - * Name of the field on this model (or a related model, including the model chain to it) |
|
22 | - * that is a boolean indicating whether or not a model object is considered "Default" or not |
|
23 | - * @var string |
|
24 | - */ |
|
25 | - protected $_default_field_name; |
|
21 | + * Name of the field on this model (or a related model, including the model chain to it) |
|
22 | + * that is a boolean indicating whether or not a model object is considered "Default" or not |
|
23 | + * @var string |
|
24 | + */ |
|
25 | + protected $_default_field_name; |
|
26 | 26 | |
27 | - /** |
|
28 | - * The model chain to follow to get to the event model, including the event model itself. |
|
29 | - * Eg 'Ticket.Datetime.Event' |
|
30 | - * @var string |
|
31 | - */ |
|
32 | - protected $_path_to_event_model; |
|
33 | - /** |
|
34 | - * |
|
35 | - * @param string $default_field_name the name of the field Name of the field on this model (or a related model, including the model chain to it) |
|
36 | - * that is a boolean indicating whether or not a model object is considered "Default" or not |
|
37 | - * @param string $path_to_event_model The model chain to follow to get to the event model, including the event model itself. |
|
38 | - * Eg 'Ticket.Datetime.Event' |
|
39 | - */ |
|
40 | - public function __construct($default_field_name, $path_to_event_model) |
|
41 | - { |
|
42 | - $this->_default_field_name = $default_field_name; |
|
43 | - if (substr($path_to_event_model, -1, 1) != '.') { |
|
44 | - $path_to_event_model .= '.'; |
|
45 | - } |
|
46 | - $this->_path_to_event_model = $path_to_event_model; |
|
47 | - } |
|
27 | + /** |
|
28 | + * The model chain to follow to get to the event model, including the event model itself. |
|
29 | + * Eg 'Ticket.Datetime.Event' |
|
30 | + * @var string |
|
31 | + */ |
|
32 | + protected $_path_to_event_model; |
|
33 | + /** |
|
34 | + * |
|
35 | + * @param string $default_field_name the name of the field Name of the field on this model (or a related model, including the model chain to it) |
|
36 | + * that is a boolean indicating whether or not a model object is considered "Default" or not |
|
37 | + * @param string $path_to_event_model The model chain to follow to get to the event model, including the event model itself. |
|
38 | + * Eg 'Ticket.Datetime.Event' |
|
39 | + */ |
|
40 | + public function __construct($default_field_name, $path_to_event_model) |
|
41 | + { |
|
42 | + $this->_default_field_name = $default_field_name; |
|
43 | + if (substr($path_to_event_model, -1, 1) != '.') { |
|
44 | + $path_to_event_model .= '.'; |
|
45 | + } |
|
46 | + $this->_path_to_event_model = $path_to_event_model; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * @return EE_Default_Where_Conditions |
|
51 | - * @throws EE_Error |
|
52 | - */ |
|
53 | - protected function _generate_restrictions() |
|
54 | - { |
|
55 | - // if there are no standard caps for this model, then for now all we know |
|
56 | - // if they need the default cap to access this |
|
57 | - if (!$this->model()->cap_slug()) { |
|
58 | - return array( |
|
59 | - self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions() |
|
60 | - ); |
|
61 | - } |
|
49 | + /** |
|
50 | + * @return EE_Default_Where_Conditions |
|
51 | + * @throws EE_Error |
|
52 | + */ |
|
53 | + protected function _generate_restrictions() |
|
54 | + { |
|
55 | + // if there are no standard caps for this model, then for now all we know |
|
56 | + // if they need the default cap to access this |
|
57 | + if (!$this->model()->cap_slug()) { |
|
58 | + return array( |
|
59 | + self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions() |
|
60 | + ); |
|
61 | + } |
|
62 | 62 | |
63 | - $event_model = EEM_Event::instance(); |
|
63 | + $event_model = EEM_Event::instance(); |
|
64 | 64 | |
65 | - $restrictions = array( |
|
66 | - // first: basically access to non-defaults is essentially controlled by which events are accessible |
|
67 | - // if they don't have the basic event cap, they can't access ANY non-default items |
|
68 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => new EE_Default_Where_Conditions(array( |
|
69 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => $this->addPublishedPostConditions( |
|
70 | - array( |
|
71 | - $this->_default_field_name => true, |
|
72 | - ), |
|
73 | - true, |
|
74 | - $this->_path_to_event_model |
|
75 | - ) |
|
76 | - )), |
|
77 | - // if they don't have the others event cap, they can only access their own, others' that are for published events, or defaults |
|
78 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => new EE_Default_Where_Conditions( |
|
79 | - array( |
|
80 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => $this->addPublishedPostConditions( |
|
81 | - array( |
|
82 | - $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
83 | - $this->_default_field_name => true, |
|
84 | - ), |
|
85 | - true, |
|
86 | - $this->_path_to_event_model |
|
87 | - ) |
|
88 | - ) |
|
89 | - ), |
|
90 | - // if they have basic and others, but not private, they can access default, their own, and others' that aren't private |
|
91 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => new EE_Default_Where_Conditions( |
|
92 | - array( |
|
93 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => $this->addPublishedPostConditions( |
|
94 | - array( |
|
95 | - $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
96 | - $this->_default_field_name => true |
|
97 | - ), |
|
98 | - false, |
|
99 | - $this->_path_to_event_model |
|
100 | - ) |
|
101 | - ) |
|
102 | - ), |
|
103 | - // second: access to defaults is controlled by the default capabilities |
|
104 | - // if they don't have the basic default capability, restrict access to only non-default items |
|
105 | - EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_default') => new EE_Default_Where_Conditions( |
|
106 | - array( $this->_default_field_name => false ) |
|
107 | - ), |
|
108 | - ); |
|
109 | - if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_others_default')) { |
|
110 | - // if they don't have the "others" default capability, restrict access to only their default ones, and non-default ones |
|
111 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others_default') ] = new EE_Default_Where_Conditions( |
|
112 | - array( |
|
113 | - // if they don't have the others default cap, they can't access others default items (but they can access |
|
114 | - // their own default items, and non-default items) |
|
115 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others_default') => array( |
|
116 | - 'AND' => array( |
|
117 | - EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
|
118 | - $this->_default_field_name => true |
|
119 | - ), |
|
120 | - $this->_default_field_name => false |
|
121 | - ) |
|
122 | - ) |
|
123 | - ); |
|
124 | - } |
|
125 | - return $restrictions; |
|
126 | - } |
|
65 | + $restrictions = array( |
|
66 | + // first: basically access to non-defaults is essentially controlled by which events are accessible |
|
67 | + // if they don't have the basic event cap, they can't access ANY non-default items |
|
68 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => new EE_Default_Where_Conditions(array( |
|
69 | + 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => $this->addPublishedPostConditions( |
|
70 | + array( |
|
71 | + $this->_default_field_name => true, |
|
72 | + ), |
|
73 | + true, |
|
74 | + $this->_path_to_event_model |
|
75 | + ) |
|
76 | + )), |
|
77 | + // if they don't have the others event cap, they can only access their own, others' that are for published events, or defaults |
|
78 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => new EE_Default_Where_Conditions( |
|
79 | + array( |
|
80 | + 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => $this->addPublishedPostConditions( |
|
81 | + array( |
|
82 | + $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
83 | + $this->_default_field_name => true, |
|
84 | + ), |
|
85 | + true, |
|
86 | + $this->_path_to_event_model |
|
87 | + ) |
|
88 | + ) |
|
89 | + ), |
|
90 | + // if they have basic and others, but not private, they can access default, their own, and others' that aren't private |
|
91 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => new EE_Default_Where_Conditions( |
|
92 | + array( |
|
93 | + 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => $this->addPublishedPostConditions( |
|
94 | + array( |
|
95 | + $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
96 | + $this->_default_field_name => true |
|
97 | + ), |
|
98 | + false, |
|
99 | + $this->_path_to_event_model |
|
100 | + ) |
|
101 | + ) |
|
102 | + ), |
|
103 | + // second: access to defaults is controlled by the default capabilities |
|
104 | + // if they don't have the basic default capability, restrict access to only non-default items |
|
105 | + EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_default') => new EE_Default_Where_Conditions( |
|
106 | + array( $this->_default_field_name => false ) |
|
107 | + ), |
|
108 | + ); |
|
109 | + if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_others_default')) { |
|
110 | + // if they don't have the "others" default capability, restrict access to only their default ones, and non-default ones |
|
111 | + $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others_default') ] = new EE_Default_Where_Conditions( |
|
112 | + array( |
|
113 | + // if they don't have the others default cap, they can't access others default items (but they can access |
|
114 | + // their own default items, and non-default items) |
|
115 | + 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others_default') => array( |
|
116 | + 'AND' => array( |
|
117 | + EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
|
118 | + $this->_default_field_name => true |
|
119 | + ), |
|
120 | + $this->_default_field_name => false |
|
121 | + ) |
|
122 | + ) |
|
123 | + ); |
|
124 | + } |
|
125 | + return $restrictions; |
|
126 | + } |
|
127 | 127 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | { |
55 | 55 | // if there are no standard caps for this model, then for now all we know |
56 | 56 | // if they need the default cap to access this |
57 | - if (!$this->model()->cap_slug()) { |
|
57 | + if ( ! $this->model()->cap_slug()) { |
|
58 | 58 | return array( |
59 | 59 | self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions() |
60 | 60 | ); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | // first: basically access to non-defaults is essentially controlled by which events are accessible |
67 | 67 | // if they don't have the basic event cap, they can't access ANY non-default items |
68 | 68 | EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => new EE_Default_Where_Conditions(array( |
69 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => $this->addPublishedPostConditions( |
|
69 | + 'OR*no_'.EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => $this->addPublishedPostConditions( |
|
70 | 70 | array( |
71 | 71 | $this->_default_field_name => true, |
72 | 72 | ), |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | ) |
76 | 76 | )), |
77 | 77 | // if they don't have the others event cap, they can only access their own, others' that are for published events, or defaults |
78 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => new EE_Default_Where_Conditions( |
|
78 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action().'_others') => new EE_Default_Where_Conditions( |
|
79 | 79 | array( |
80 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => $this->addPublishedPostConditions( |
|
80 | + 'OR*no_'.EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action().'_others') => $this->addPublishedPostConditions( |
|
81 | 81 | array( |
82 | - $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
82 | + $this->_path_to_event_model.'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
83 | 83 | $this->_default_field_name => true, |
84 | 84 | ), |
85 | 85 | true, |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | ) |
89 | 89 | ), |
90 | 90 | // if they have basic and others, but not private, they can access default, their own, and others' that aren't private |
91 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => new EE_Default_Where_Conditions( |
|
91 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action().'_private') => new EE_Default_Where_Conditions( |
|
92 | 92 | array( |
93 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => $this->addPublishedPostConditions( |
|
93 | + 'OR*no_'.EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action().'_private') => $this->addPublishedPostConditions( |
|
94 | 94 | array( |
95 | - $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
95 | + $this->_path_to_event_model.'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
96 | 96 | $this->_default_field_name => true |
97 | 97 | ), |
98 | 98 | false, |
@@ -102,17 +102,17 @@ discard block |
||
102 | 102 | ), |
103 | 103 | // second: access to defaults is controlled by the default capabilities |
104 | 104 | // if they don't have the basic default capability, restrict access to only non-default items |
105 | - EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_default') => new EE_Default_Where_Conditions( |
|
106 | - array( $this->_default_field_name => false ) |
|
105 | + EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_default') => new EE_Default_Where_Conditions( |
|
106 | + array($this->_default_field_name => false) |
|
107 | 107 | ), |
108 | 108 | ); |
109 | - if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_others_default')) { |
|
109 | + if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action().'_others_default')) { |
|
110 | 110 | // if they don't have the "others" default capability, restrict access to only their default ones, and non-default ones |
111 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others_default') ] = new EE_Default_Where_Conditions( |
|
111 | + $restrictions[EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_others_default')] = new EE_Default_Where_Conditions( |
|
112 | 112 | array( |
113 | 113 | // if they don't have the others default cap, they can't access others default items (but they can access |
114 | 114 | // their own default items, and non-default items) |
115 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others_default') => array( |
|
115 | + 'OR*no_'.EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_others_default') => array( |
|
116 | 116 | 'AND' => array( |
117 | 117 | EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
118 | 118 | $this->_default_field_name => true |