@@ -1,64 +1,64 @@ |
||
1 | 1 | <?php |
2 | 2 | //echo '<br/><h6 style="color:#2EA2CC;">'. __FILE__ . ' <span style="font-weight:normal;color:#E76700"> Line #: ' . __LINE__ . '</span></h6>'; |
3 | 3 | if ( |
4 | - ( is_single() && espresso_display_venue_in_event_details() ) |
|
5 | - || ( is_archive() && espresso_display_venue_in_event_list() ) |
|
4 | + (is_single() && espresso_display_venue_in_event_details()) |
|
5 | + || (is_archive() && espresso_display_venue_in_event_list()) |
|
6 | 6 | ) : |
7 | 7 | global $post; |
8 | - do_action( 'AHEE_event_details_before_venue_details', $post ); |
|
9 | - $venue_name = espresso_venue_name( 0, 'details', FALSE ); |
|
10 | - if ( empty( $venue_name ) && espresso_is_venue_private() ) { |
|
11 | - do_action( 'AHEE_event_details_after_venue_details', $post ); |
|
8 | + do_action('AHEE_event_details_before_venue_details', $post); |
|
9 | + $venue_name = espresso_venue_name(0, 'details', FALSE); |
|
10 | + if (empty($venue_name) && espresso_is_venue_private()) { |
|
11 | + do_action('AHEE_event_details_after_venue_details', $post); |
|
12 | 12 | return ''; |
13 | 13 | } |
14 | 14 | ?> |
15 | 15 | |
16 | 16 | <div class="espresso-venue-dv<?php echo espresso_is_venue_private() ? ' espresso-private-venue-dv' : ''; ?>"> |
17 | 17 | <h3 class="event-venues-h3 ee-event-h3"> |
18 | - <?php _e( 'Location', 'event_espresso' ); ?> |
|
18 | + <?php _e('Location', 'event_espresso'); ?> |
|
19 | 19 | </h3> |
20 | - <h4><strong><?php _e( 'Venue:', 'event_espresso' ); ?></strong> <strong> <?php echo $venue_name; ?></strong></h4> |
|
20 | + <h4><strong><?php _e('Venue:', 'event_espresso'); ?></strong> <strong> <?php echo $venue_name; ?></strong></h4> |
|
21 | 21 | <p><span class="smaller-text tags-links"><?php echo espresso_venue_categories(); ?></span></p> |
22 | -<?php if ( $venue_phone = espresso_venue_phone( $post->ID, FALSE )) : ?> |
|
22 | +<?php if ($venue_phone = espresso_venue_phone($post->ID, FALSE)) : ?> |
|
23 | 23 | <p> |
24 | - <span class="small-text"><strong><?php _e( 'Venue Phone:', 'event_espresso' ); ?></strong></span> <?php echo $venue_phone; ?> |
|
24 | + <span class="small-text"><strong><?php _e('Venue Phone:', 'event_espresso'); ?></strong></span> <?php echo $venue_phone; ?> |
|
25 | 25 | </p> |
26 | -<?php endif; ?> |
|
27 | -<?php if ( espresso_venue_has_address( $post->ID )) : ?> |
|
28 | - <strong><span class="dashicons dashicons-location-alt"></span><?php _e( 'Address:', 'event_espresso' ); ?></strong> |
|
29 | - <?php espresso_venue_address( 'inline' ); ?> |
|
30 | - <?php espresso_venue_gmap( $post->ID ); ?> |
|
26 | +<?php endif; ?> |
|
27 | +<?php if (espresso_venue_has_address($post->ID)) : ?> |
|
28 | + <strong><span class="dashicons dashicons-location-alt"></span><?php _e('Address:', 'event_espresso'); ?></strong> |
|
29 | + <?php espresso_venue_address('inline'); ?> |
|
30 | + <?php espresso_venue_gmap($post->ID); ?> |
|
31 | 31 | <div class="clear"><br/></div> |
32 | -<?php endif; ?> |
|
32 | +<?php endif; ?> |
|
33 | 33 | |
34 | - <?php $VNU_ID = espresso_venue_id( $post->ID ); ?> |
|
35 | - <?php if ( is_single() ) : ?> |
|
36 | - <?php $venue_description = espresso_venue_description( $VNU_ID, FALSE ); ?> |
|
37 | - <?php if ( $venue_description ) : ?> |
|
34 | + <?php $VNU_ID = espresso_venue_id($post->ID); ?> |
|
35 | + <?php if (is_single()) : ?> |
|
36 | + <?php $venue_description = espresso_venue_description($VNU_ID, FALSE); ?> |
|
37 | + <?php if ($venue_description) : ?> |
|
38 | 38 | <p> |
39 | - <strong><?php _e( 'Description:', 'event_espresso' ); ?></strong><br/> |
|
40 | - <?php echo do_shortcode( $venue_description ); ?> |
|
39 | + <strong><?php _e('Description:', 'event_espresso'); ?></strong><br/> |
|
40 | + <?php echo do_shortcode($venue_description); ?> |
|
41 | 41 | </p> |
42 | - <?php endif; ?> |
|
42 | + <?php endif; ?> |
|
43 | 43 | <?php else : ?> |
44 | - <?php $venue_excerpt = espresso_venue_excerpt( $VNU_ID, FALSE ); ?> |
|
45 | - <?php if ( $venue_excerpt ) : ?> |
|
44 | + <?php $venue_excerpt = espresso_venue_excerpt($VNU_ID, FALSE); ?> |
|
45 | + <?php if ($venue_excerpt) : ?> |
|
46 | 46 | <p> |
47 | - <strong><?php _e( 'Description:', 'event_espresso' ); ?></strong><br/> |
|
47 | + <strong><?php _e('Description:', 'event_espresso'); ?></strong><br/> |
|
48 | 48 | <?php echo $venue_excerpt; ?> |
49 | 49 | </p> |
50 | - <?php endif; ?> |
|
51 | - <?php endif; ?> |
|
50 | + <?php endif; ?> |
|
51 | + <?php endif; ?> |
|
52 | 52 | </div> |
53 | 53 | <!-- .espresso-venue-dv --> |
54 | 54 | <?php |
55 | -do_action( 'AHEE_event_details_after_venue_details', $post ); |
|
55 | +do_action('AHEE_event_details_after_venue_details', $post); |
|
56 | 56 | else : |
57 | - if ( espresso_venue_is_password_protected() ) : |
|
57 | + if (espresso_venue_is_password_protected()) : |
|
58 | 58 | ?> |
59 | 59 | <div class="espresso-venue-dv espresso-password-protected-venue-dv" > |
60 | 60 | <h3 class="event-venues-h3 ee-event-h3"> |
61 | - <?php _e( 'Location', 'event_espresso' );?> |
|
61 | + <?php _e('Location', 'event_espresso'); ?> |
|
62 | 62 | </h3> |
63 | 63 | <?php echo espresso_password_protected_venue_form(); ?> |
64 | 64 | </div> |
@@ -40,8 +40,11 @@ discard block |
||
40 | 40 | <?php echo do_shortcode( $venue_description ); ?> |
41 | 41 | </p> |
42 | 42 | <?php endif; ?> |
43 | - <?php else : ?> |
|
44 | - <?php $venue_excerpt = espresso_venue_excerpt( $VNU_ID, FALSE ); ?> |
|
43 | + <?php else { |
|
44 | + : ?> |
|
45 | + <?php $venue_excerpt = espresso_venue_excerpt( $VNU_ID, FALSE ); |
|
46 | +} |
|
47 | +?> |
|
45 | 48 | <?php if ( $venue_excerpt ) : ?> |
46 | 49 | <p> |
47 | 50 | <strong><?php _e( 'Description:', 'event_espresso' ); ?></strong><br/> |
@@ -53,12 +56,15 @@ discard block |
||
53 | 56 | <!-- .espresso-venue-dv --> |
54 | 57 | <?php |
55 | 58 | do_action( 'AHEE_event_details_after_venue_details', $post ); |
56 | -else : |
|
59 | +else { |
|
60 | + : |
|
57 | 61 | if ( espresso_venue_is_password_protected() ) : |
58 | 62 | ?> |
59 | 63 | <div class="espresso-venue-dv espresso-password-protected-venue-dv" > |
60 | 64 | <h3 class="event-venues-h3 ee-event-h3"> |
61 | - <?php _e( 'Location', 'event_espresso' );?> |
|
65 | + <?php _e( 'Location', 'event_espresso' ); |
|
66 | +} |
|
67 | +?> |
|
62 | 68 | </h3> |
63 | 69 | <?php echo espresso_password_protected_venue_form(); ?> |
64 | 70 | </div> |
@@ -10,21 +10,21 @@ discard block |
||
10 | 10 | * @since 4.6 |
11 | 11 | * |
12 | 12 | */ |
13 | -class EE_Full_HTML_Validation_Strategy extends EE_Validation_Strategy_Base{ |
|
13 | +class EE_Full_HTML_Validation_Strategy extends EE_Validation_Strategy_Base { |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * @param null $validation_error_message |
17 | 17 | */ |
18 | - public function __construct( $validation_error_message = NULL ) { |
|
19 | - if ( ! $validation_error_message ) { |
|
18 | + public function __construct($validation_error_message = NULL) { |
|
19 | + if ( ! $validation_error_message) { |
|
20 | 20 | global $allowedposttags; |
21 | 21 | $validation_error_message = sprintf( |
22 | - __( 'Only the following HTML tags are allowed:%1$s%2$s', "event_espresso" ), |
|
22 | + __('Only the following HTML tags are allowed:%1$s%2$s', "event_espresso"), |
|
23 | 23 | '<br />', |
24 | - implode( ",", array_keys( $allowedposttags ) ) |
|
24 | + implode(",", array_keys($allowedposttags)) |
|
25 | 25 | ); |
26 | 26 | } |
27 | - parent::__construct( $validation_error_message ); |
|
27 | + parent::__construct($validation_error_message); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function get_list_of_allowed_tags() { |
40 | 40 | global $allowedposttags; |
41 | - ksort( $allowedposttags ); |
|
42 | - return implode( ', ', array_keys( $allowedposttags ) ); |
|
41 | + ksort($allowedposttags); |
|
42 | + return implode(', ', array_keys($allowedposttags)); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function validate($normalized_value) { |
52 | 52 | global $allowedposttags; |
53 | - parent::validate( $normalized_value ); |
|
54 | - $normalized_value_sans_tags = wp_kses( "$normalized_value", $allowedposttags ); |
|
55 | - if ( strlen( $normalized_value ) > strlen( $normalized_value_sans_tags ) ) { |
|
56 | - throw new EE_Validation_Error( $this->get_validation_error_message(), 'complex_html_tags' ); |
|
53 | + parent::validate($normalized_value); |
|
54 | + $normalized_value_sans_tags = wp_kses("$normalized_value", $allowedposttags); |
|
55 | + if (strlen($normalized_value) > strlen($normalized_value_sans_tags)) { |
|
56 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'complex_html_tags'); |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | } |
60 | 60 | \ No newline at end of file |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | /** |
263 | 263 | * Sets sensitive_data_removal_strategy |
264 | 264 | * @param EE_Sensitive_Data_Removal_Base $sensitive_data_removal_strategy |
265 | - * @return boolean |
|
265 | + * @return boolean|null |
|
266 | 266 | */ |
267 | 267 | public function set_sensitive_data_removal_strategy($sensitive_data_removal_strategy) { |
268 | 268 | $this->_sensitive_data_removal_strategy = $sensitive_data_removal_strategy; |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | /** |
357 | 357 | * returns true if input employs any of the validation strategy defined by the supplied array of classnames |
358 | 358 | * |
359 | - * @param array $validation_strategy_classnames |
|
359 | + * @param string[] $validation_strategy_classnames |
|
360 | 360 | * @return bool |
361 | 361 | */ |
362 | 362 | public function has_validation_strategy( $validation_strategy_classnames ) { |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | * Returns whether or not any validation errors occurred |
480 | 480 | * |
481 | 481 | * @param array $req_data like $_POST |
482 | - * @return boolean whether or not there was an error |
|
482 | + * @return boolean|null whether or not there was an error |
|
483 | 483 | */ |
484 | 484 | protected function _normalize( $req_data ) { |
485 | 485 | //any existing validation errors don't apply so clear them |
@@ -810,8 +810,7 @@ |
||
810 | 810 | * (If that doesn't exist, we also check for this subsection's name |
811 | 811 | * at the TOP LEVEL of the request data. Eg $_REQUEST['form_input_1'].) |
812 | 812 | * This function finds its value in the form. |
813 | - |
|
814 | -* |
|
813 | + * |
|
815 | 814 | *@param array $req_data |
816 | 815 | * @return mixed whatever the raw value of this form section is in the request data |
817 | 816 | * @throws \EE_Error |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $this->html_id() |
244 | 244 | ) |
245 | 245 | ); |
246 | - }else{ |
|
246 | + } else{ |
|
247 | 247 | return $this->_display_strategy; |
248 | 248 | } |
249 | 249 | } |
@@ -458,14 +458,14 @@ discard block |
||
458 | 458 | if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) { |
459 | 459 | try{ |
460 | 460 | $validation_strategy->validate($this->normalized_value()); |
461 | - }catch(EE_Validation_Error $e){ |
|
461 | + } catch(EE_Validation_Error $e){ |
|
462 | 462 | $this->add_validation_error($e); |
463 | 463 | } |
464 | 464 | } |
465 | 465 | } |
466 | 466 | if( $this->get_validation_errors()){ |
467 | 467 | return false; |
468 | - }else{ |
|
468 | + } else{ |
|
469 | 469 | return true; |
470 | 470 | } |
471 | 471 | } |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | |
653 | 653 | if(! empty($jquery_validation_rules)){ |
654 | 654 | $jquery_validation_js[ $this->html_id( TRUE ) ] = $jquery_validation_rules; |
655 | - }else{ |
|
655 | + } else{ |
|
656 | 656 | return array(); |
657 | 657 | } |
658 | 658 | return $jquery_validation_js; |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | if( isset( $matches[ 1 ] ) && is_array( $matches[ 1 ] ) ){ |
829 | 829 | $name_parts = $matches[ 1 ]; |
830 | 830 | array_unshift($name_parts, $before_any_brackets); |
831 | - }else{ |
|
831 | + } else{ |
|
832 | 832 | $name_parts = array( $before_any_brackets ); |
833 | 833 | } |
834 | 834 | // now get the value for the input |
@@ -853,13 +853,13 @@ discard block |
||
853 | 853 | if( isset( $req_data[ $first_part_to_consider ] ) ){ |
854 | 854 | if( empty($html_name_parts ) ){ |
855 | 855 | return $req_data[ $first_part_to_consider ]; |
856 | - }else{ |
|
856 | + } else{ |
|
857 | 857 | return $this->_find_form_data_for_this_section_using_name_parts( |
858 | 858 | $html_name_parts, |
859 | 859 | $req_data[ $first_part_to_consider ] |
860 | 860 | ); |
861 | 861 | } |
862 | - }else{ |
|
862 | + } else{ |
|
863 | 863 | return NULL; |
864 | 864 | } |
865 | 865 | } |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | $checked_value = $this->find_form_data_for_this_section( $req_data ); |
881 | 881 | if( $checked_value !== null ){ |
882 | 882 | return TRUE; |
883 | - }else{ |
|
883 | + } else{ |
|
884 | 884 | return FALSE; |
885 | 885 | } |
886 | 886 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @subpackage |
9 | 9 | * @author Mike Nelson |
10 | 10 | */ |
11 | -abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable{ |
|
11 | +abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * the input's name attribute |
@@ -143,54 +143,54 @@ discard block |
||
143 | 143 | * @type EE_Validation_Strategy_Base[] $validation_strategies |
144 | 144 | * } |
145 | 145 | */ |
146 | - public function __construct( $input_args = array() ){ |
|
147 | - $input_args = (array) apply_filters( 'FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this ); |
|
146 | + public function __construct($input_args = array()) { |
|
147 | + $input_args = (array) apply_filters('FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this); |
|
148 | 148 | // the following properties must be cast as arrays |
149 | - if ( isset( $input_args['validation_strategies'] ) ) { |
|
150 | - foreach ( (array) $input_args['validation_strategies'] as $validation_strategy ) { |
|
151 | - if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) { |
|
152 | - $this->_validation_strategies[ get_class( $validation_strategy ) ] = $validation_strategy; |
|
149 | + if (isset($input_args['validation_strategies'])) { |
|
150 | + foreach ((array) $input_args['validation_strategies'] as $validation_strategy) { |
|
151 | + if ($validation_strategy instanceof EE_Validation_Strategy_Base) { |
|
152 | + $this->_validation_strategies[get_class($validation_strategy)] = $validation_strategy; |
|
153 | 153 | } |
154 | 154 | } |
155 | - unset( $input_args['validation_strategies'] ); |
|
155 | + unset($input_args['validation_strategies']); |
|
156 | 156 | } |
157 | 157 | // loop thru incoming options |
158 | - foreach( $input_args as $key => $value ) { |
|
158 | + foreach ($input_args as $key => $value) { |
|
159 | 159 | // add underscore to $key to match property names |
160 | - $_key = '_' . $key; |
|
161 | - if ( property_exists( $this, $_key )) { |
|
160 | + $_key = '_'.$key; |
|
161 | + if (property_exists($this, $_key)) { |
|
162 | 162 | $this->{$_key} = $value; |
163 | 163 | } |
164 | 164 | } |
165 | 165 | // ensure that "required" is set correctly |
166 | 166 | $this->set_required( |
167 | - $this->_required, isset( $input_args[ 'required_validation_error_message' ] ) |
|
168 | - ? $input_args[ 'required_validation_error_message' ] |
|
167 | + $this->_required, isset($input_args['required_validation_error_message']) |
|
168 | + ? $input_args['required_validation_error_message'] |
|
169 | 169 | : null |
170 | 170 | ); |
171 | 171 | |
172 | 172 | //$this->_html_name_specified = isset( $input_args['html_name'] ) ? TRUE : FALSE; |
173 | 173 | |
174 | 174 | $this->_display_strategy->_construct_finalize($this); |
175 | - foreach( $this->_validation_strategies as $validation_strategy ){ |
|
175 | + foreach ($this->_validation_strategies as $validation_strategy) { |
|
176 | 176 | $validation_strategy->_construct_finalize($this); |
177 | 177 | } |
178 | 178 | |
179 | - if( ! $this->_normalization_strategy){ |
|
179 | + if ( ! $this->_normalization_strategy) { |
|
180 | 180 | $this->_normalization_strategy = new EE_Text_Normalization(); |
181 | 181 | } |
182 | 182 | $this->_normalization_strategy->_construct_finalize($this); |
183 | 183 | |
184 | 184 | //at least we can use the normalization strategy to populate the default |
185 | - if( isset( $input_args[ 'default' ] ) ) { |
|
186 | - $this->set_default( $input_args[ 'default' ] ); |
|
185 | + if (isset($input_args['default'])) { |
|
186 | + $this->set_default($input_args['default']); |
|
187 | 187 | } |
188 | 188 | |
189 | - if( ! $this->_sensitive_data_removal_strategy){ |
|
189 | + if ( ! $this->_sensitive_data_removal_strategy) { |
|
190 | 190 | $this->_sensitive_data_removal_strategy = new EE_No_Sensitive_Data_Removal(); |
191 | 191 | } |
192 | 192 | $this->_sensitive_data_removal_strategy->_construct_finalize($this); |
193 | - parent::__construct( $input_args ); |
|
193 | + parent::__construct($input_args); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
@@ -201,11 +201,11 @@ discard block |
||
201 | 201 | * |
202 | 202 | * @throws \EE_Error |
203 | 203 | */ |
204 | - protected function _set_default_html_name_if_empty(){ |
|
205 | - if( ! $this->_html_name){ |
|
204 | + protected function _set_default_html_name_if_empty() { |
|
205 | + if ( ! $this->_html_name) { |
|
206 | 206 | $this->_html_name = $this->name(); |
207 | - if( $this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper){ |
|
208 | - $this->_html_name = $this->_parent_section->html_name_prefix() . "[{$this->name()}]"; |
|
207 | + if ($this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper) { |
|
208 | + $this->_html_name = $this->_parent_section->html_name_prefix()."[{$this->name()}]"; |
|
209 | 209 | } |
210 | 210 | } |
211 | 211 | } |
@@ -220,10 +220,10 @@ discard block |
||
220 | 220 | public function _construct_finalize($parent_form_section, $name) { |
221 | 221 | parent::_construct_finalize($parent_form_section, $name); |
222 | 222 | $this->_set_default_html_name_if_empty(); |
223 | - if( ! $this->_html_label && ! $this->_html_label_text){ |
|
224 | - $this->_html_label_text = ucwords( str_replace("_"," ",$name)); |
|
223 | + if ( ! $this->_html_label && ! $this->_html_label_text) { |
|
224 | + $this->_html_label_text = ucwords(str_replace("_", " ", $name)); |
|
225 | 225 | } |
226 | - do_action( 'AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name ); |
|
226 | + do_action('AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /** |
@@ -231,8 +231,8 @@ discard block |
||
231 | 231 | * @return EE_Display_Strategy_Base |
232 | 232 | * @throws EE_Error |
233 | 233 | */ |
234 | - protected function _get_display_strategy(){ |
|
235 | - if( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base){ |
|
234 | + protected function _get_display_strategy() { |
|
235 | + if ( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base) { |
|
236 | 236 | throw new EE_Error( |
237 | 237 | sprintf( |
238 | 238 | __( |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $this->html_id() |
244 | 244 | ) |
245 | 245 | ); |
246 | - }else{ |
|
246 | + } else { |
|
247 | 247 | return $this->_display_strategy; |
248 | 248 | } |
249 | 249 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * Sets the display strategy. |
252 | 252 | * @param EE_Display_Strategy_Base $strategy |
253 | 253 | */ |
254 | - protected function _set_display_strategy(EE_Display_Strategy_Base $strategy){ |
|
254 | + protected function _set_display_strategy(EE_Display_Strategy_Base $strategy) { |
|
255 | 255 | $this->_display_strategy = $strategy; |
256 | 256 | } |
257 | 257 | |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * Sets the sanitization strategy |
260 | 260 | * @param EE_Normalization_Strategy_Base $strategy |
261 | 261 | */ |
262 | - protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy){ |
|
262 | + protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy) { |
|
263 | 263 | $this->_normalization_strategy = $strategy; |
264 | 264 | } |
265 | 265 | |
@@ -285,14 +285,14 @@ discard block |
||
285 | 285 | * Gets the display strategy for this input |
286 | 286 | * @return EE_Display_Strategy_Base |
287 | 287 | */ |
288 | - public function get_display_strategy(){ |
|
288 | + public function get_display_strategy() { |
|
289 | 289 | return $this->_display_strategy; |
290 | 290 | } |
291 | 291 | /** |
292 | 292 | * Overwrites the display strategy |
293 | 293 | * @param EE_Display_Strategy_Base $display_strategy |
294 | 294 | */ |
295 | - public function set_display_strategy($display_strategy){ |
|
295 | + public function set_display_strategy($display_strategy) { |
|
296 | 296 | $this->_display_strategy = $display_strategy; |
297 | 297 | $this->_display_strategy->_construct_finalize($this); |
298 | 298 | } |
@@ -300,14 +300,14 @@ discard block |
||
300 | 300 | * Gets the normalization strategy set on this input |
301 | 301 | * @return EE_Normalization_Strategy_Base |
302 | 302 | */ |
303 | - public function get_normalization_strategy(){ |
|
303 | + public function get_normalization_strategy() { |
|
304 | 304 | return $this->_normalization_strategy; |
305 | 305 | } |
306 | 306 | /** |
307 | 307 | * Overwrites the normalization strategy |
308 | 308 | * @param EE_Normalization_Strategy_Base $normalization_strategy |
309 | 309 | */ |
310 | - public function set_normalization_strategy($normalization_strategy){ |
|
310 | + public function set_normalization_strategy($normalization_strategy) { |
|
311 | 311 | $this->_normalization_strategy = $normalization_strategy; |
312 | 312 | $this->_normalization_strategy->_construct_finalize($this); |
313 | 313 | } |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | * Returns all teh validation strategies which apply to this field, numerically indexed |
317 | 317 | * @return EE_Validation_Strategy_Base[] |
318 | 318 | */ |
319 | - public function get_validation_strategies(){ |
|
319 | + public function get_validation_strategies() { |
|
320 | 320 | return $this->_validation_strategies; |
321 | 321 | } |
322 | 322 | |
@@ -327,8 +327,8 @@ discard block |
||
327 | 327 | * @param EE_Validation_Strategy_Base $validation_strategy |
328 | 328 | * @return void |
329 | 329 | */ |
330 | - protected function _add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ){ |
|
331 | - $validation_strategy->_construct_finalize( $this ); |
|
330 | + protected function _add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) { |
|
331 | + $validation_strategy->_construct_finalize($this); |
|
332 | 332 | $this->_validation_strategies[] = $validation_strategy; |
333 | 333 | } |
334 | 334 | |
@@ -339,8 +339,8 @@ discard block |
||
339 | 339 | * @param EE_Validation_Strategy_Base $validation_strategy |
340 | 340 | * @return void |
341 | 341 | */ |
342 | - public function add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ) { |
|
343 | - $this->_add_validation_strategy( $validation_strategy ); |
|
342 | + public function add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) { |
|
343 | + $this->_add_validation_strategy($validation_strategy); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | |
@@ -350,13 +350,13 @@ discard block |
||
350 | 350 | * |
351 | 351 | * @param string $validation_strategy_classname |
352 | 352 | */ |
353 | - public function remove_validation_strategy( $validation_strategy_classname ) { |
|
354 | - foreach( $this->_validation_strategies as $key => $validation_strategy ){ |
|
355 | - if( |
|
353 | + public function remove_validation_strategy($validation_strategy_classname) { |
|
354 | + foreach ($this->_validation_strategies as $key => $validation_strategy) { |
|
355 | + if ( |
|
356 | 356 | $validation_strategy instanceof $validation_strategy_classname |
357 | - || is_subclass_of( $validation_strategy, $validation_strategy_classname ) |
|
357 | + || is_subclass_of($validation_strategy, $validation_strategy_classname) |
|
358 | 358 | ) { |
359 | - unset( $this->_validation_strategies[ $key ] ); |
|
359 | + unset($this->_validation_strategies[$key]); |
|
360 | 360 | } |
361 | 361 | } |
362 | 362 | } |
@@ -369,12 +369,12 @@ discard block |
||
369 | 369 | * @param array $validation_strategy_classnames |
370 | 370 | * @return bool |
371 | 371 | */ |
372 | - public function has_validation_strategy( $validation_strategy_classnames ) { |
|
373 | - $validation_strategy_classnames = is_array( $validation_strategy_classnames ) |
|
372 | + public function has_validation_strategy($validation_strategy_classnames) { |
|
373 | + $validation_strategy_classnames = is_array($validation_strategy_classnames) |
|
374 | 374 | ? $validation_strategy_classnames |
375 | - : array( $validation_strategy_classnames ); |
|
376 | - foreach( $this->_validation_strategies as $key => $validation_strategy ){ |
|
377 | - if( in_array( $key, $validation_strategy_classnames ) ) { |
|
375 | + : array($validation_strategy_classnames); |
|
376 | + foreach ($this->_validation_strategies as $key => $validation_strategy) { |
|
377 | + if (in_array($key, $validation_strategy_classnames)) { |
|
378 | 378 | return true; |
379 | 379 | } |
380 | 380 | } |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | * to the parent form's layout strategy |
389 | 389 | * @return string |
390 | 390 | */ |
391 | - public function get_html_and_js(){ |
|
391 | + public function get_html_and_js() { |
|
392 | 392 | return $this->_parent_section->get_html_for_input($this); |
393 | 393 | } |
394 | 394 | |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | * @return string |
403 | 403 | * @throws \EE_Error |
404 | 404 | */ |
405 | - public function get_html_for_input(){ |
|
405 | + public function get_html_for_input() { |
|
406 | 406 | return $this->_get_display_strategy()->display(); |
407 | 407 | } |
408 | 408 | |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | * @return string |
413 | 413 | */ |
414 | 414 | public function html_other_attributes() { |
415 | - return ! empty( $this->_html_other_attributes ) ? ' ' . $this->_html_other_attributes : ''; |
|
415 | + return ! empty($this->_html_other_attributes) ? ' '.$this->_html_other_attributes : ''; |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | /** |
421 | 421 | * @param string $html_other_attributes |
422 | 422 | */ |
423 | - public function set_html_other_attributes( $html_other_attributes ) { |
|
423 | + public function set_html_other_attributes($html_other_attributes) { |
|
424 | 424 | $this->_html_other_attributes = $html_other_attributes; |
425 | 425 | } |
426 | 426 | |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | * according to the form section's layout strategy |
430 | 430 | * @return string |
431 | 431 | */ |
432 | - public function get_html_for_label(){ |
|
432 | + public function get_html_for_label() { |
|
433 | 433 | return $this->_parent_section->get_layout_strategy()->display_label($this); |
434 | 434 | } |
435 | 435 | /** |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | * according to the form section's layout strategy |
438 | 438 | * @return string |
439 | 439 | */ |
440 | - public function get_html_for_errors(){ |
|
440 | + public function get_html_for_errors() { |
|
441 | 441 | return $this->_parent_section->get_layout_strategy()->display_errors($this); |
442 | 442 | } |
443 | 443 | /** |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | * according to the form section's layout strategy |
446 | 446 | * @return string |
447 | 447 | */ |
448 | - public function get_html_for_help(){ |
|
448 | + public function get_html_for_help() { |
|
449 | 449 | return $this->_parent_section->get_layout_strategy()->display_help_text($this); |
450 | 450 | } |
451 | 451 | /** |
@@ -454,18 +454,18 @@ discard block |
||
454 | 454 | * @return boolean |
455 | 455 | */ |
456 | 456 | protected function _validate() { |
457 | - foreach($this->_validation_strategies as $validation_strategy){ |
|
458 | - if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) { |
|
459 | - try{ |
|
457 | + foreach ($this->_validation_strategies as $validation_strategy) { |
|
458 | + if ($validation_strategy instanceof EE_Validation_Strategy_Base) { |
|
459 | + try { |
|
460 | 460 | $validation_strategy->validate($this->normalized_value()); |
461 | - }catch(EE_Validation_Error $e){ |
|
461 | + } catch (EE_Validation_Error $e) { |
|
462 | 462 | $this->add_validation_error($e); |
463 | 463 | } |
464 | 464 | } |
465 | 465 | } |
466 | - if( $this->get_validation_errors()){ |
|
466 | + if ($this->get_validation_errors()) { |
|
467 | 467 | return false; |
468 | - }else{ |
|
468 | + } else { |
|
469 | 469 | return true; |
470 | 470 | } |
471 | 471 | } |
@@ -478,8 +478,8 @@ discard block |
||
478 | 478 | * @param string $value |
479 | 479 | * @return null|string |
480 | 480 | */ |
481 | - private function _sanitize($value){ |
|
482 | - return $value !== NULL ?stripslashes(html_entity_decode($value)) : NULL;//don't sanitize_text_field |
|
481 | + private function _sanitize($value) { |
|
482 | + return $value !== NULL ? stripslashes(html_entity_decode($value)) : NULL; //don't sanitize_text_field |
|
483 | 483 | } |
484 | 484 | |
485 | 485 | |
@@ -493,24 +493,24 @@ discard block |
||
493 | 493 | * @return boolean whether or not there was an error |
494 | 494 | * @throws \EE_Error |
495 | 495 | */ |
496 | - protected function _normalize( $req_data ) { |
|
496 | + protected function _normalize($req_data) { |
|
497 | 497 | //any existing validation errors don't apply so clear them |
498 | 498 | $this->_validation_errors = array(); |
499 | 499 | try { |
500 | - $raw_input = $this->find_form_data_for_this_section( $req_data ); |
|
500 | + $raw_input = $this->find_form_data_for_this_section($req_data); |
|
501 | 501 | //super simple sanitization for now |
502 | - if ( is_array( $raw_input )) { |
|
502 | + if (is_array($raw_input)) { |
|
503 | 503 | $this->_raw_value = array(); |
504 | - foreach( $raw_input as $key => $value ) { |
|
505 | - $this->_raw_value[ $key ] = $this->_sanitize( $value ); |
|
504 | + foreach ($raw_input as $key => $value) { |
|
505 | + $this->_raw_value[$key] = $this->_sanitize($value); |
|
506 | 506 | } |
507 | 507 | } else { |
508 | - $this->_raw_value = $this->_sanitize( $raw_input ); |
|
508 | + $this->_raw_value = $this->_sanitize($raw_input); |
|
509 | 509 | } |
510 | 510 | //we want ot mostly leave the input alone in case we need to re-display it to the user |
511 | - $this->_normalized_value = $this->_normalization_strategy->normalize( $this->raw_value() ); |
|
512 | - } catch ( EE_Validation_Error $e ) { |
|
513 | - $this->add_validation_error( $e ); |
|
511 | + $this->_normalized_value = $this->_normalization_strategy->normalize($this->raw_value()); |
|
512 | + } catch (EE_Validation_Error $e) { |
|
513 | + $this->add_validation_error($e); |
|
514 | 514 | } |
515 | 515 | } |
516 | 516 | |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | /** |
520 | 520 | * @return string |
521 | 521 | */ |
522 | - public function html_name(){ |
|
522 | + public function html_name() { |
|
523 | 523 | return $this->_html_name; |
524 | 524 | } |
525 | 525 | |
@@ -528,8 +528,8 @@ discard block |
||
528 | 528 | /** |
529 | 529 | * @return string |
530 | 530 | */ |
531 | - public function html_label_id(){ |
|
532 | - return ! empty( $this->_html_label_id ) ? $this->_html_label_id : $this->_html_id . '-lbl'; |
|
531 | + public function html_label_id() { |
|
532 | + return ! empty($this->_html_label_id) ? $this->_html_label_id : $this->_html_id.'-lbl'; |
|
533 | 533 | } |
534 | 534 | |
535 | 535 | |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | /** |
538 | 538 | * @return string |
539 | 539 | */ |
540 | - public function html_label_class(){ |
|
540 | + public function html_label_class() { |
|
541 | 541 | return $this->_html_label_class; |
542 | 542 | } |
543 | 543 | |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | /** |
547 | 547 | * @return string |
548 | 548 | */ |
549 | - public function html_label_style(){ |
|
549 | + public function html_label_style() { |
|
550 | 550 | return $this->_html_label_style; |
551 | 551 | } |
552 | 552 | |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | /** |
556 | 556 | * @return string |
557 | 557 | */ |
558 | - public function html_label_text(){ |
|
558 | + public function html_label_text() { |
|
559 | 559 | return $this->_html_label_text; |
560 | 560 | } |
561 | 561 | |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | /** |
565 | 565 | * @return string |
566 | 566 | */ |
567 | - public function html_help_text(){ |
|
567 | + public function html_help_text() { |
|
568 | 568 | return $this->_html_help_text; |
569 | 569 | } |
570 | 570 | |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | /** |
574 | 574 | * @return string |
575 | 575 | */ |
576 | - public function html_help_class(){ |
|
576 | + public function html_help_class() { |
|
577 | 577 | return $this->_html_help_class; |
578 | 578 | } |
579 | 579 | |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | /** |
583 | 583 | * @return string |
584 | 584 | */ |
585 | - public function html_help_style(){ |
|
585 | + public function html_help_style() { |
|
586 | 586 | return $this->_html_style; |
587 | 587 | } |
588 | 588 | /** |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | * in which case, we would have stored the malicious content to our database. |
596 | 596 | * @return string |
597 | 597 | */ |
598 | - public function raw_value(){ |
|
598 | + public function raw_value() { |
|
599 | 599 | return $this->_raw_value; |
600 | 600 | } |
601 | 601 | /** |
@@ -603,15 +603,15 @@ discard block |
||
603 | 603 | * it escapes all html entities |
604 | 604 | * @return string |
605 | 605 | */ |
606 | - public function raw_value_in_form(){ |
|
607 | - return htmlentities($this->raw_value(),ENT_QUOTES, 'UTF-8'); |
|
606 | + public function raw_value_in_form() { |
|
607 | + return htmlentities($this->raw_value(), ENT_QUOTES, 'UTF-8'); |
|
608 | 608 | } |
609 | 609 | /** |
610 | 610 | * returns the value after it's been sanitized, and then converted into it's proper type |
611 | 611 | * in PHP. Eg, a string, an int, an array, |
612 | 612 | * @return mixed |
613 | 613 | */ |
614 | - public function normalized_value(){ |
|
614 | + public function normalized_value() { |
|
615 | 615 | return $this->_normalized_value; |
616 | 616 | } |
617 | 617 | |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | * the best thing to display |
622 | 622 | * @return string |
623 | 623 | */ |
624 | - public function pretty_value(){ |
|
624 | + public function pretty_value() { |
|
625 | 625 | return $this->_normalized_value; |
626 | 626 | } |
627 | 627 | /** |
@@ -640,19 +640,19 @@ discard block |
||
640 | 640 | }</code> |
641 | 641 | * @return array |
642 | 642 | */ |
643 | - public function get_jquery_validation_rules(){ |
|
643 | + public function get_jquery_validation_rules() { |
|
644 | 644 | |
645 | 645 | $jquery_validation_rules = array(); |
646 | - foreach($this->get_validation_strategies() as $validation_strategy){ |
|
646 | + foreach ($this->get_validation_strategies() as $validation_strategy) { |
|
647 | 647 | $jquery_validation_rules = array_replace_recursive( |
648 | 648 | $jquery_validation_rules, |
649 | 649 | $validation_strategy->get_jquery_validation_rule_array() |
650 | 650 | ); |
651 | 651 | } |
652 | 652 | |
653 | - if(! empty($jquery_validation_rules)){ |
|
654 | - $jquery_validation_js[ $this->html_id( TRUE ) ] = $jquery_validation_rules; |
|
655 | - }else{ |
|
653 | + if ( ! empty($jquery_validation_rules)) { |
|
654 | + $jquery_validation_js[$this->html_id(TRUE)] = $jquery_validation_rules; |
|
655 | + } else { |
|
656 | 656 | return array(); |
657 | 657 | } |
658 | 658 | return $jquery_validation_js; |
@@ -664,9 +664,9 @@ discard block |
||
664 | 664 | * @param mixed $value |
665 | 665 | * @return void |
666 | 666 | */ |
667 | - public function set_default($value){ |
|
667 | + public function set_default($value) { |
|
668 | 668 | $this->_normalized_value = $value; |
669 | - $this->_raw_value = $this->_normalization_strategy->unnormalize( $value ); |
|
669 | + $this->_raw_value = $this->_normalization_strategy->unnormalize($value); |
|
670 | 670 | } |
671 | 671 | |
672 | 672 | /** |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | * @param string $label |
675 | 675 | * @return void |
676 | 676 | */ |
677 | - public function set_html_label_text($label){ |
|
677 | + public function set_html_label_text($label) { |
|
678 | 678 | $this->_html_label_text = $label; |
679 | 679 | } |
680 | 680 | |
@@ -688,13 +688,13 @@ discard block |
||
688 | 688 | * @param boolean $required boolean |
689 | 689 | * @param null $required_text |
690 | 690 | */ |
691 | - public function set_required($required = true, $required_text = NULL ){ |
|
692 | - $required = filter_var( $required, FILTER_VALIDATE_BOOLEAN ); |
|
691 | + public function set_required($required = true, $required_text = NULL) { |
|
692 | + $required = filter_var($required, FILTER_VALIDATE_BOOLEAN); |
|
693 | 693 | //whether $required is a string or a boolean, we want to add a required validation strategy |
694 | - if ( $required ) { |
|
695 | - $this->_add_validation_strategy( new EE_Required_Validation_Strategy( $required_text ) ); |
|
694 | + if ($required) { |
|
695 | + $this->_add_validation_strategy(new EE_Required_Validation_Strategy($required_text)); |
|
696 | 696 | } else { |
697 | - unset( $this->_validation_strategies[ 'EE_Required_Validation_Strategy' ] ); |
|
697 | + unset($this->_validation_strategies['EE_Required_Validation_Strategy']); |
|
698 | 698 | } |
699 | 699 | $this->_required = $required; |
700 | 700 | } |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | * Returns whether or not this field is required |
703 | 703 | * @return boolean |
704 | 704 | */ |
705 | - public function required(){ |
|
705 | + public function required() { |
|
706 | 706 | return $this->_required; |
707 | 707 | } |
708 | 708 | |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | /** |
712 | 712 | * @param string $required_css_class |
713 | 713 | */ |
714 | - public function set_required_css_class( $required_css_class ) { |
|
714 | + public function set_required_css_class($required_css_class) { |
|
715 | 715 | $this->_required_css_class = $required_css_class; |
716 | 716 | } |
717 | 717 | |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | * Sets the help text, in case |
731 | 731 | * @param string $text |
732 | 732 | */ |
733 | - public function set_html_help_text($text){ |
|
733 | + public function set_html_help_text($text) { |
|
734 | 734 | $this->_html_help_text = $text; |
735 | 735 | } |
736 | 736 | /** |
@@ -742,8 +742,8 @@ discard block |
||
742 | 742 | public function clean_sensitive_data() { |
743 | 743 | //if we do ANY kind of sensitive data removal on this, then just clear out the raw value |
744 | 744 | //if we need more logic than this we'll make a strategy for it |
745 | - if( $this->_sensitive_data_removal_strategy && |
|
746 | - ! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal ){ |
|
745 | + if ($this->_sensitive_data_removal_strategy && |
|
746 | + ! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal) { |
|
747 | 747 | $this->_raw_value = NULL; |
748 | 748 | } |
749 | 749 | //and clean the normalized value according to the appropriate strategy |
@@ -759,10 +759,10 @@ discard block |
||
759 | 759 | * @param string $button_size |
760 | 760 | * @param string $other_attributes |
761 | 761 | */ |
762 | - public function set_button_css_attributes( $primary = TRUE, $button_size = '', $other_attributes = '' ) { |
|
762 | + public function set_button_css_attributes($primary = TRUE, $button_size = '', $other_attributes = '') { |
|
763 | 763 | $button_css_attributes = 'button'; |
764 | 764 | $button_css_attributes .= $primary === TRUE ? ' button-primary' : ' button-secondary'; |
765 | - switch ( $button_size ) { |
|
765 | + switch ($button_size) { |
|
766 | 766 | case 'xs' : |
767 | 767 | case 'extra-small' : |
768 | 768 | $button_css_attributes .= ' button-xs'; |
@@ -783,8 +783,8 @@ discard block |
||
783 | 783 | default : |
784 | 784 | $button_css_attributes .= ''; |
785 | 785 | } |
786 | - $this->_button_css_attributes .= ! empty( $other_attributes ) |
|
787 | - ? $button_css_attributes . ' ' . $other_attributes |
|
786 | + $this->_button_css_attributes .= ! empty($other_attributes) |
|
787 | + ? $button_css_attributes.' '.$other_attributes |
|
788 | 788 | : $button_css_attributes; |
789 | 789 | } |
790 | 790 | |
@@ -794,7 +794,7 @@ discard block |
||
794 | 794 | * @return string |
795 | 795 | */ |
796 | 796 | public function button_css_attributes() { |
797 | - if ( empty( $this->_button_css_attributes )) { |
|
797 | + if (empty($this->_button_css_attributes)) { |
|
798 | 798 | $this->set_button_css_attributes(); |
799 | 799 | } |
800 | 800 | return $this->_button_css_attributes; |
@@ -816,26 +816,26 @@ discard block |
||
816 | 816 | * @return mixed whatever the raw value of this form section is in the request data |
817 | 817 | * @throws \EE_Error |
818 | 818 | */ |
819 | - public function find_form_data_for_this_section( $req_data ){ |
|
819 | + public function find_form_data_for_this_section($req_data) { |
|
820 | 820 | // break up the html name by "[]" |
821 | - if ( strpos( $this->html_name(), '[' ) !== FALSE ) { |
|
822 | - $before_any_brackets = substr( $this->html_name(), 0, strpos($this->html_name(), '[') ); |
|
821 | + if (strpos($this->html_name(), '[') !== FALSE) { |
|
822 | + $before_any_brackets = substr($this->html_name(), 0, strpos($this->html_name(), '[')); |
|
823 | 823 | } else { |
824 | 824 | $before_any_brackets = $this->html_name(); |
825 | 825 | } |
826 | 826 | // grab all of the segments |
827 | - preg_match_all('~\[([^]]*)\]~',$this->html_name(), $matches); |
|
828 | - if( isset( $matches[ 1 ] ) && is_array( $matches[ 1 ] ) ){ |
|
829 | - $name_parts = $matches[ 1 ]; |
|
827 | + preg_match_all('~\[([^]]*)\]~', $this->html_name(), $matches); |
|
828 | + if (isset($matches[1]) && is_array($matches[1])) { |
|
829 | + $name_parts = $matches[1]; |
|
830 | 830 | array_unshift($name_parts, $before_any_brackets); |
831 | - }else{ |
|
832 | - $name_parts = array( $before_any_brackets ); |
|
831 | + } else { |
|
832 | + $name_parts = array($before_any_brackets); |
|
833 | 833 | } |
834 | 834 | // now get the value for the input |
835 | 835 | $value = $this->_find_form_data_for_this_section_using_name_parts($name_parts, $req_data); |
836 | 836 | // check if this thing's name is at the TOP level of the request data |
837 | - if( $value === null && isset( $req_data[ $this->name() ] ) ){ |
|
838 | - $value = $req_data[ $this->name() ]; |
|
837 | + if ($value === null && isset($req_data[$this->name()])) { |
|
838 | + $value = $req_data[$this->name()]; |
|
839 | 839 | } |
840 | 840 | return $value; |
841 | 841 | } |
@@ -848,18 +848,18 @@ discard block |
||
848 | 848 | * @param array $req_data |
849 | 849 | * @return array | NULL |
850 | 850 | */ |
851 | - public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data){ |
|
852 | - $first_part_to_consider = array_shift( $html_name_parts ); |
|
853 | - if( isset( $req_data[ $first_part_to_consider ] ) ){ |
|
854 | - if( empty($html_name_parts ) ){ |
|
855 | - return $req_data[ $first_part_to_consider ]; |
|
856 | - }else{ |
|
851 | + public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data) { |
|
852 | + $first_part_to_consider = array_shift($html_name_parts); |
|
853 | + if (isset($req_data[$first_part_to_consider])) { |
|
854 | + if (empty($html_name_parts)) { |
|
855 | + return $req_data[$first_part_to_consider]; |
|
856 | + } else { |
|
857 | 857 | return $this->_find_form_data_for_this_section_using_name_parts( |
858 | 858 | $html_name_parts, |
859 | - $req_data[ $first_part_to_consider ] |
|
859 | + $req_data[$first_part_to_consider] |
|
860 | 860 | ); |
861 | 861 | } |
862 | - }else{ |
|
862 | + } else { |
|
863 | 863 | return NULL; |
864 | 864 | } |
865 | 865 | } |
@@ -873,14 +873,14 @@ discard block |
||
873 | 873 | * @return boolean |
874 | 874 | * @throws \EE_Error |
875 | 875 | */ |
876 | - public function form_data_present_in($req_data = NULL){ |
|
877 | - if( $req_data === NULL ){ |
|
876 | + public function form_data_present_in($req_data = NULL) { |
|
877 | + if ($req_data === NULL) { |
|
878 | 878 | $req_data = $_POST; |
879 | 879 | } |
880 | - $checked_value = $this->find_form_data_for_this_section( $req_data ); |
|
881 | - if( $checked_value !== null ){ |
|
880 | + $checked_value = $this->find_form_data_for_this_section($req_data); |
|
881 | + if ($checked_value !== null) { |
|
882 | 882 | return TRUE; |
883 | - }else{ |
|
883 | + } else { |
|
884 | 884 | return FALSE; |
885 | 885 | } |
886 | 886 | } |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | protected function _set_tips_array() { |
19 | 19 | $this->_qtipsa = array( |
20 | 20 | 0 => array( |
21 | - 'content_id' => 'message_status-' . EEM_Message::status_sent, |
|
22 | - 'target' => '.msg-status-' . EEM_Message::status_sent, |
|
23 | - 'content' => $this->_message_status_legend( EEM_Message::status_sent ), |
|
21 | + 'content_id' => 'message_status-'.EEM_Message::status_sent, |
|
22 | + 'target' => '.msg-status-'.EEM_Message::status_sent, |
|
23 | + 'content' => $this->_message_status_legend(EEM_Message::status_sent), |
|
24 | 24 | 'options' => array( |
25 | 25 | 'position' => array( |
26 | 26 | 'target' => 'mouse', |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | ) |
29 | 29 | ), |
30 | 30 | 1 => array( |
31 | - 'content_id' => 'message_status-' . EEM_Message::status_idle, |
|
32 | - 'target' => '.msg-status-' . EEM_Message::status_idle, |
|
33 | - 'content' => $this->_message_status_legend( EEM_Message::status_idle ), |
|
31 | + 'content_id' => 'message_status-'.EEM_Message::status_idle, |
|
32 | + 'target' => '.msg-status-'.EEM_Message::status_idle, |
|
33 | + 'content' => $this->_message_status_legend(EEM_Message::status_idle), |
|
34 | 34 | 'options' => array( |
35 | 35 | 'position' => array( |
36 | 36 | 'target' => 'mouse', |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | ) |
39 | 39 | ), |
40 | 40 | 2 => array( |
41 | - 'content_id' => 'message_status-' . EEM_Message::status_failed, |
|
42 | - 'target' => '.msg-status-' . EEM_Message::status_failed, |
|
43 | - 'content' => $this->_message_status_legend( EEM_Message::status_failed ), |
|
41 | + 'content_id' => 'message_status-'.EEM_Message::status_failed, |
|
42 | + 'target' => '.msg-status-'.EEM_Message::status_failed, |
|
43 | + 'content' => $this->_message_status_legend(EEM_Message::status_failed), |
|
44 | 44 | 'options' => array( |
45 | 45 | 'position' => array( |
46 | 46 | 'target' => 'mouse', |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | ) |
49 | 49 | ), |
50 | 50 | 3 => array( |
51 | - 'content_id' => 'message_status-' . EEM_Message::status_resend, |
|
52 | - 'target' => '.msg-status-' . EEM_Message::status_resend, |
|
53 | - 'content' => $this->_message_status_legend( EEM_Message::status_resend ), |
|
51 | + 'content_id' => 'message_status-'.EEM_Message::status_resend, |
|
52 | + 'target' => '.msg-status-'.EEM_Message::status_resend, |
|
53 | + 'content' => $this->_message_status_legend(EEM_Message::status_resend), |
|
54 | 54 | 'options' => array( |
55 | 55 | 'position' => array( |
56 | 56 | 'target' => 'mouse', |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | ) |
59 | 59 | ), |
60 | 60 | 4 => array( |
61 | - 'content_id' => 'message_status-' . EEM_Message::status_incomplete, |
|
62 | - 'target' => '.msg-status-' . EEM_Message::status_incomplete, |
|
63 | - 'content' => $this->_message_status_legend( EEM_Message::status_incomplete ), |
|
61 | + 'content_id' => 'message_status-'.EEM_Message::status_incomplete, |
|
62 | + 'target' => '.msg-status-'.EEM_Message::status_incomplete, |
|
63 | + 'content' => $this->_message_status_legend(EEM_Message::status_incomplete), |
|
64 | 64 | 'options' => array( |
65 | 65 | 'position' => array( |
66 | 66 | 'target' => 'mouse', |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | ) |
69 | 69 | ), |
70 | 70 | 5 => array( |
71 | - 'content_id' => 'message_status-' . EEM_Message::status_retry, |
|
72 | - 'target' => '.msg-status-' . EEM_Message::status_retry, |
|
73 | - 'content' => $this->_message_status_legend( EEM_Message::status_retry ), |
|
71 | + 'content_id' => 'message_status-'.EEM_Message::status_retry, |
|
72 | + 'target' => '.msg-status-'.EEM_Message::status_retry, |
|
73 | + 'content' => $this->_message_status_legend(EEM_Message::status_retry), |
|
74 | 74 | 'options' => array( |
75 | 75 | 'position' => array( |
76 | 76 | 'target' => 'mouse', |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | ) |
79 | 79 | ), |
80 | 80 | 6 => array( |
81 | - 'content_id' => 'message_status-' . EEM_Message::status_debug_only, |
|
82 | - 'target' => '.msg-status-' . EEM_Message::status_debug_only, |
|
83 | - 'content' => $this->_message_status_legend( EEM_Message::status_debug_only ), |
|
81 | + 'content_id' => 'message_status-'.EEM_Message::status_debug_only, |
|
82 | + 'target' => '.msg-status-'.EEM_Message::status_debug_only, |
|
83 | + 'content' => $this->_message_status_legend(EEM_Message::status_debug_only), |
|
84 | 84 | 'options' => array( |
85 | 85 | 'position' => array( |
86 | 86 | 'target' => 'mouse', |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @param EEM_Message constant $status What status is set (by class) |
100 | 100 | * @return string The status legend with the related status highlighted |
101 | 101 | */ |
102 | - private function _message_status_legend( $status ) { |
|
102 | + private function _message_status_legend($status) { |
|
103 | 103 | |
104 | 104 | $status_array = array( |
105 | 105 | 'sent_status' => EEM_Message::status_sent, |
@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | 'retry_status' => EEM_Message::status_retry, |
111 | 111 | ); |
112 | 112 | |
113 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
113 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
114 | 114 | $status_array['debug_only_status'] = EEM_Message::status_debug_only; |
115 | 115 | } |
116 | 116 | |
117 | - return EEH_Template::status_legend( $status_array, $status ); |
|
117 | + return EEH_Template::status_legend($status_array, $status); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | \ No newline at end of file |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | /** |
6 | 6 | * ************************************************************************ |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @param \EE_Checkout $checkout |
32 | 32 | * @return string |
33 | 33 | */ |
34 | -function ee_deprecated__registration_checkout__button_text( $submit_button_text, EE_Checkout $checkout ) { |
|
34 | +function ee_deprecated__registration_checkout__button_text($submit_button_text, EE_Checkout $checkout) { |
|
35 | 35 | // list of old filters |
36 | 36 | $deprecated_filters = array( |
37 | 37 | 'update_registration_details' => true, |
@@ -41,16 +41,16 @@ discard block |
||
41 | 41 | 'proceed_to' => true, |
42 | 42 | ); |
43 | 43 | // loop thru and call doing_it_wrong() or remove any that aren't being used |
44 | - foreach ( $deprecated_filters as $deprecated_filter => $on ) { |
|
44 | + foreach ($deprecated_filters as $deprecated_filter => $on) { |
|
45 | 45 | // was this filter called ? |
46 | - if ( has_action( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter )) { |
|
46 | + if (has_action('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter)) { |
|
47 | 47 | // only display doing_it_wrong() notice to Event Admins during non-AJAX requests |
48 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'hide_doing_it_wrong_for_deprecated_SPCO_filter' ) && ! defined( 'DOING_AJAX' ) ) { |
|
48 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'hide_doing_it_wrong_for_deprecated_SPCO_filter') && ! defined('DOING_AJAX')) { |
|
49 | 49 | EE_Error::doing_it_wrong( |
50 | - 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter, |
|
50 | + 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter, |
|
51 | 51 | sprintf( |
52 | - __( 'The %1$s filter is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the following new filter: %2$s"%3$s" found in "%4$s"', 'event_espresso' ), |
|
53 | - 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter, |
|
52 | + __('The %1$s filter is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the following new filter: %2$s"%3$s" found in "%4$s"', 'event_espresso'), |
|
53 | + 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter, |
|
54 | 54 | '<br />', |
55 | 55 | 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', |
56 | 56 | '/modules/single_page_checkout/inc/EE_SPCO_Reg_Step.class.php' |
@@ -60,24 +60,24 @@ discard block |
||
60 | 60 | ); |
61 | 61 | } |
62 | 62 | } else { |
63 | - unset( $deprecated_filters[ $deprecated_filter ] ); |
|
63 | + unset($deprecated_filters[$deprecated_filter]); |
|
64 | 64 | } |
65 | 65 | } |
66 | - if ( ! empty( $deprecated_filters )) { |
|
67 | - |
|
68 | - if ( $checkout->current_step->slug() == 'attendee_information' && $checkout->revisit && isset( $deprecated_filters[ 'update_registration_details' ] )) { |
|
69 | - $submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__update_registration_details', $submit_button_text ); |
|
70 | - } else if ( $checkout->current_step->slug() == 'payment_options' && $checkout->revisit && isset( $deprecated_filters[ 'process_payment' ] ) ) { |
|
71 | - $submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__process_payment', $submit_button_text ); |
|
72 | - } else if ( $checkout->next_step instanceof EE_SPCO_Reg_Step && $checkout->next_step->slug() == 'finalize_registration' && isset( $deprecated_filters[ 'finalize_registration' ] ) ) { |
|
73 | - $submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__finalize_registration', $submit_button_text ); |
|
66 | + if ( ! empty($deprecated_filters)) { |
|
67 | + |
|
68 | + if ($checkout->current_step->slug() == 'attendee_information' && $checkout->revisit && isset($deprecated_filters['update_registration_details'])) { |
|
69 | + $submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__update_registration_details', $submit_button_text); |
|
70 | + } else if ($checkout->current_step->slug() == 'payment_options' && $checkout->revisit && isset($deprecated_filters['process_payment'])) { |
|
71 | + $submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__process_payment', $submit_button_text); |
|
72 | + } else if ($checkout->next_step instanceof EE_SPCO_Reg_Step && $checkout->next_step->slug() == 'finalize_registration' && isset($deprecated_filters['finalize_registration'])) { |
|
73 | + $submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__finalize_registration', $submit_button_text); |
|
74 | 74 | } |
75 | - if ( $checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
76 | - if ( $checkout->payment_required() && $checkout->next_step->slug() == 'payment_options' && isset( $deprecated_filters[ 'and_proceed_to_payment' ] ) ) { |
|
77 | - $submit_button_text .= apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__and_proceed_to_payment', $submit_button_text ); |
|
75 | + if ($checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
76 | + if ($checkout->payment_required() && $checkout->next_step->slug() == 'payment_options' && isset($deprecated_filters['and_proceed_to_payment'])) { |
|
77 | + $submit_button_text .= apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__and_proceed_to_payment', $submit_button_text); |
|
78 | 78 | } |
79 | - if ( $checkout->next_step->slug() != 'finalize_registration' && ! $checkout->revisit && isset( $deprecated_filters[ 'proceed_to' ] ) ) { |
|
80 | - $submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to', $submit_button_text ) . $checkout->next_step->name(); |
|
79 | + if ($checkout->next_step->slug() != 'finalize_registration' && ! $checkout->revisit && isset($deprecated_filters['proceed_to'])) { |
|
80 | + $submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to', $submit_button_text).$checkout->next_step->name(); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | return $submit_button_text; |
86 | 86 | |
87 | 87 | } |
88 | -add_filter( 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', 'ee_deprecated__registration_checkout__button_text', 10, 2 ); |
|
88 | +add_filter('FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', 'ee_deprecated__registration_checkout__button_text', 10, 2); |
|
89 | 89 | |
90 | 90 | |
91 | 91 | |
@@ -96,16 +96,16 @@ discard block |
||
96 | 96 | * @param \EE_Checkout $checkout |
97 | 97 | * @param boolean $status_updates |
98 | 98 | */ |
99 | -function ee_deprecated_finalize_transaction( EE_Checkout $checkout, $status_updates ) { |
|
99 | +function ee_deprecated_finalize_transaction(EE_Checkout $checkout, $status_updates) { |
|
100 | 100 | $action_ref = NULL; |
101 | - $action_ref = has_action( 'AHEE__EE_Transaction__finalize__new_transaction' ) ? 'AHEE__EE_Transaction__finalize__new_transaction' : $action_ref; |
|
102 | - $action_ref = has_action( 'AHEE__EE_Transaction__finalize__all_transaction' ) ? 'AHEE__EE_Transaction__finalize__all_transaction' : $action_ref; |
|
103 | - if ( $action_ref ) { |
|
101 | + $action_ref = has_action('AHEE__EE_Transaction__finalize__new_transaction') ? 'AHEE__EE_Transaction__finalize__new_transaction' : $action_ref; |
|
102 | + $action_ref = has_action('AHEE__EE_Transaction__finalize__all_transaction') ? 'AHEE__EE_Transaction__finalize__all_transaction' : $action_ref; |
|
103 | + if ($action_ref) { |
|
104 | 104 | |
105 | 105 | EE_Error::doing_it_wrong( |
106 | 106 | $action_ref, |
107 | 107 | sprintf( |
108 | - __( 'This action is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use one of the following new actions: %1$s"%3$s" found in "%2$s" %1$s"%4$s" found in "%2$s" %1$s"%5$s" found in "%2$s" %1$s"%6$s" found in "%2$s"', 'event_espresso' ), |
|
108 | + __('This action is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use one of the following new actions: %1$s"%3$s" found in "%2$s" %1$s"%4$s" found in "%2$s" %1$s"%5$s" found in "%2$s" %1$s"%6$s" found in "%2$s"', 'event_espresso'), |
|
109 | 109 | '<br />', |
110 | 110 | '/core/business/EE_Transaction_Processor.class.php', |
111 | 111 | 'AHEE__EE_Transaction_Processor__finalize', |
@@ -116,29 +116,29 @@ discard block |
||
116 | 116 | '4.6.0', |
117 | 117 | E_USER_DEPRECATED |
118 | 118 | ); |
119 | - switch ( $action_ref ) { |
|
119 | + switch ($action_ref) { |
|
120 | 120 | case 'AHEE__EE_Transaction__finalize__new_transaction' : |
121 | - do_action( 'AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, $checkout->admin_request ); |
|
121 | + do_action('AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, $checkout->admin_request); |
|
122 | 122 | break; |
123 | 123 | case 'AHEE__EE_Transaction__finalize__all_transaction' : |
124 | - do_action( 'AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, array( 'new_reg' => ! $checkout->revisit, 'to_approved' => $status_updates ), $checkout->admin_request ); |
|
124 | + do_action('AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, array('new_reg' => ! $checkout->revisit, 'to_approved' => $status_updates), $checkout->admin_request); |
|
125 | 125 | break; |
126 | 126 | } |
127 | 127 | } |
128 | 128 | } |
129 | -add_action( 'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', 'ee_deprecated_finalize_transaction', 10, 2 ); |
|
129 | +add_action('AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', 'ee_deprecated_finalize_transaction', 10, 2); |
|
130 | 130 | /** |
131 | 131 | * ee_deprecated_finalize_registration |
132 | 132 | * |
133 | 133 | * @param EE_Registration $registration |
134 | 134 | */ |
135 | -function ee_deprecated_finalize_registration( EE_Registration $registration ) { |
|
136 | - $action_ref = has_action( 'AHEE__EE_Registration__finalize__update_and_new_reg' ) ? 'AHEE__EE_Registration__finalize__update_and_new_reg' : NULL; |
|
137 | - if ( $action_ref ) { |
|
135 | +function ee_deprecated_finalize_registration(EE_Registration $registration) { |
|
136 | + $action_ref = has_action('AHEE__EE_Registration__finalize__update_and_new_reg') ? 'AHEE__EE_Registration__finalize__update_and_new_reg' : NULL; |
|
137 | + if ($action_ref) { |
|
138 | 138 | EE_Error::doing_it_wrong( |
139 | 139 | $action_ref, |
140 | 140 | sprintf( |
141 | - __( 'This action is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the following new action: %1$s"%3$s" found in "%2$s"', 'event_espresso' ), |
|
141 | + __('This action is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the following new action: %1$s"%3$s" found in "%2$s"', 'event_espresso'), |
|
142 | 142 | '<br />', |
143 | 143 | '/core/business/EE_Registration_Processor.class.php', |
144 | 144 | 'AHEE__EE_Registration_Processor__trigger_registration_status_changed_hook' |
@@ -146,10 +146,10 @@ discard block |
||
146 | 146 | '4.6.0', |
147 | 147 | E_USER_DEPRECATED |
148 | 148 | ); |
149 | - do_action( 'AHEE__EE_Registration__finalize__update_and_new_reg', $registration, ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ))); |
|
149 | + do_action('AHEE__EE_Registration__finalize__update_and_new_reg', $registration, (is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX))); |
|
150 | 150 | } |
151 | 151 | } |
152 | -add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', 'ee_deprecated_finalize_registration', 10, 1 ); |
|
152 | +add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', 'ee_deprecated_finalize_registration', 10, 1); |
|
153 | 153 | |
154 | 154 | |
155 | 155 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @return array |
172 | 172 | */ |
173 | -function ee_deprecated_get_templates( $templates, EE_messenger $messenger, EE_message_type $message_type, EE_Messages_Template_Pack $template_pack ) { |
|
173 | +function ee_deprecated_get_templates($templates, EE_messenger $messenger, EE_message_type $message_type, EE_Messages_Template_Pack $template_pack) { |
|
174 | 174 | $old_default_classnames = array( |
175 | 175 | 'EE_Messages_Email_Cancelled_Registration_Defaults', |
176 | 176 | 'EE_Messages_Email_Declined_Registration_Defaults', |
@@ -186,23 +186,23 @@ discard block |
||
186 | 186 | |
187 | 187 | $old_class_instance = new stdClass(); |
188 | 188 | |
189 | - foreach ( $old_default_classnames as $classname ) { |
|
190 | - $filter_ref = 'FHEE__' . $classname . '___create_new_templates___templates'; |
|
191 | - if ( has_filter( $filter_ref ) ) { |
|
192 | - EE_Error::doing_it_wrong( $filter_ref, __('This filter is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the new filter provided which is "FHEE__EE_Template_Pack___get_templates__templates" found in the EE_Messages_Template_Pack class.', 'event_espresso'), '4.5.0', E_USER_DEPRECATED ); |
|
189 | + foreach ($old_default_classnames as $classname) { |
|
190 | + $filter_ref = 'FHEE__'.$classname.'___create_new_templates___templates'; |
|
191 | + if (has_filter($filter_ref)) { |
|
192 | + EE_Error::doing_it_wrong($filter_ref, __('This filter is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the new filter provided which is "FHEE__EE_Template_Pack___get_templates__templates" found in the EE_Messages_Template_Pack class.', 'event_espresso'), '4.5.0', E_USER_DEPRECATED); |
|
193 | 193 | } |
194 | - $templates = apply_filters( $filter_ref, $templates, $old_class_instance ); |
|
194 | + $templates = apply_filters($filter_ref, $templates, $old_class_instance); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | return $templates; |
198 | 198 | } |
199 | -add_filter( 'FHEE__EE_Template_Pack___get_templates__templates', 'ee_deprecated_get_templates', 10, 4 ); |
|
199 | +add_filter('FHEE__EE_Template_Pack___get_templates__templates', 'ee_deprecated_get_templates', 10, 4); |
|
200 | 200 | |
201 | 201 | /** |
202 | 202 | * Called after EED_Module::set_hooks() and EED_Module::set_admin_hooks() was called. |
203 | 203 | * Checks if any deprecated hooks were hooked-into and provide doing_it_wrong messages appropriately. |
204 | 204 | */ |
205 | -function ee_deprecated_hooks(){ |
|
205 | +function ee_deprecated_hooks() { |
|
206 | 206 | /** |
207 | 207 | * @var $hooks array where keys are hook names, and their values are array{ |
208 | 208 | * @type string $version when deprecated |
@@ -213,26 +213,26 @@ discard block |
||
213 | 213 | $hooks = array( |
214 | 214 | 'AHEE__EE_System___do_setup_validations' => array( |
215 | 215 | 'version' => '4.6.0', |
216 | - 'alternative' => __( 'Instead use "AHEE__EEH_Activation__validate_messages_system" which is called after validating messages (done on every new install, upgrade, reactivation, and downgrade)', 'event_espresso' ), |
|
216 | + 'alternative' => __('Instead use "AHEE__EEH_Activation__validate_messages_system" which is called after validating messages (done on every new install, upgrade, reactivation, and downgrade)', 'event_espresso'), |
|
217 | 217 | 'still_works' => FALSE |
218 | 218 | ) |
219 | 219 | ); |
220 | - foreach( $hooks as $name => $deprecation_info ){ |
|
221 | - if( has_action( $name ) ){ |
|
220 | + foreach ($hooks as $name => $deprecation_info) { |
|
221 | + if (has_action($name)) { |
|
222 | 222 | EE_Error::doing_it_wrong( |
223 | 223 | $name, |
224 | 224 | sprintf( |
225 | - __('This filter is deprecated. %1$s%2$s','event_espresso'), |
|
226 | - $deprecation_info[ 'still_works' ] ? __('It *may* work as an attempt to build in backwards compatibility.', 'event_espresso') : __( 'It has been completely removed.', 'event_espresso' ), |
|
227 | - isset( $deprecation_info[ 'alternative' ] ) ? $deprecation_info[ 'alternative' ] : __( 'Please read the current EE4 documentation further or contact Support.', 'event_espresso' ) |
|
225 | + __('This filter is deprecated. %1$s%2$s', 'event_espresso'), |
|
226 | + $deprecation_info['still_works'] ? __('It *may* work as an attempt to build in backwards compatibility.', 'event_espresso') : __('It has been completely removed.', 'event_espresso'), |
|
227 | + isset($deprecation_info['alternative']) ? $deprecation_info['alternative'] : __('Please read the current EE4 documentation further or contact Support.', 'event_espresso') |
|
228 | 228 | ), |
229 | - isset( $deprecation_info[ 'version' ] ) ? $deprecation_info[ 'version' ] : __( 'recently', 'event_espresso' ), |
|
229 | + isset($deprecation_info['version']) ? $deprecation_info['version'] : __('recently', 'event_espresso'), |
|
230 | 230 | E_USER_DEPRECATED |
231 | 231 | ); |
232 | 232 | } |
233 | 233 | } |
234 | 234 | } |
235 | -add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', 'ee_deprecated_hooks' ); |
|
235 | +add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', 'ee_deprecated_hooks'); |
|
236 | 236 | |
237 | 237 | |
238 | 238 | |
@@ -255,25 +255,25 @@ discard block |
||
255 | 255 | * |
256 | 256 | * @return string The default contents for the messenger, message type, context and field. |
257 | 257 | */ |
258 | -function ee_deprecated_get_default_field_content( $contents, $actual_path, EE_messenger $messenger, EE_message_type $message_type, $field, $context, EE_Messages_Template_Pack $template_pack ) { |
|
258 | +function ee_deprecated_get_default_field_content($contents, $actual_path, EE_messenger $messenger, EE_message_type $message_type, $field, $context, EE_Messages_Template_Pack $template_pack) { |
|
259 | 259 | |
260 | 260 | $classnames_to_try = array( |
261 | - get_class( $messenger ) => $messenger, |
|
262 | - get_class( $message_type ) => $message_type, |
|
261 | + get_class($messenger) => $messenger, |
|
262 | + get_class($message_type) => $message_type, |
|
263 | 263 | 'EE_Messages_Base' => $message_type |
264 | 264 | ); |
265 | 265 | |
266 | - foreach ( $classnames_to_try as $classname => $obj ) { |
|
267 | - $filter_ref = 'FHEE__' . $classname . '__get_default_field_content'; |
|
268 | - if ( has_filter( $filter_ref ) ) { |
|
269 | - EE_Error::doing_it_wrong( $filter_ref, __('This filter is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the new filter provided which is "FHEE__EE_Messages_Template_Pack__get_specific_template__contents" found in the EE_Messages_Template_Pack class.', 'event_espresso'), '4.5.0', E_USER_DEPRECATED ); |
|
266 | + foreach ($classnames_to_try as $classname => $obj) { |
|
267 | + $filter_ref = 'FHEE__'.$classname.'__get_default_field_content'; |
|
268 | + if (has_filter($filter_ref)) { |
|
269 | + EE_Error::doing_it_wrong($filter_ref, __('This filter is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the new filter provided which is "FHEE__EE_Messages_Template_Pack__get_specific_template__contents" found in the EE_Messages_Template_Pack class.', 'event_espresso'), '4.5.0', E_USER_DEPRECATED); |
|
270 | 270 | } |
271 | - $contents = apply_filters( $filter_ref, $contents, $obj ); |
|
271 | + $contents = apply_filters($filter_ref, $contents, $obj); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | return $contents; |
275 | 275 | } |
276 | -add_filter( 'FHEE__EE_Messages_Template_Pack__get_specific_template__contents', 'ee_deprecated_get_default_field_content', 10, 7 ); |
|
276 | +add_filter('FHEE__EE_Messages_Template_Pack__get_specific_template__contents', 'ee_deprecated_get_default_field_content', 10, 7); |
|
277 | 277 | |
278 | 278 | |
279 | 279 | |
@@ -301,23 +301,23 @@ discard block |
||
301 | 301 | * |
302 | 302 | * @return string The path to the file being used. |
303 | 303 | */ |
304 | -function ee_deprecated_get_inline_css_template_filters( $variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url, EE_Messages_Template_Pack $template_pack ) { |
|
304 | +function ee_deprecated_get_inline_css_template_filters($variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url, EE_Messages_Template_Pack $template_pack) { |
|
305 | 305 | |
306 | - if ( $messenger == 'email' ) { |
|
306 | + if ($messenger == 'email') { |
|
307 | 307 | $filter_ref = $url ? 'FHEE__EE_Email_messenger__get_inline_css_template__css_url' : 'FHEE__EE_Email_messenger__get_inline_css_template__css_path'; |
308 | - } elseif ( $messenger == 'html' ) { |
|
308 | + } elseif ($messenger == 'html') { |
|
309 | 309 | $filter_ref = $url ? 'FHEE__EE_Html_messenger__get_inline_css_template__css_url' : 'FHEE__EE_Html_messenger__get_inline_css_template__css_path'; |
310 | 310 | } else { |
311 | 311 | return $variation_path; |
312 | 312 | } |
313 | 313 | |
314 | - if ( has_filter( $filter_ref ) ) { |
|
315 | - EE_Error::doing_it_wrong( $filter_ref, __('This filter is deprecated. It is recommended to use the new filter provided which is "FHEE__EE_Messages_Template_Pack__get_variation" found in the EE_Messages_Template_Pack class.', 'event_espresso'), '4.5.0', E_USER_DEPRECATED ); |
|
314 | + if (has_filter($filter_ref)) { |
|
315 | + EE_Error::doing_it_wrong($filter_ref, __('This filter is deprecated. It is recommended to use the new filter provided which is "FHEE__EE_Messages_Template_Pack__get_variation" found in the EE_Messages_Template_Pack class.', 'event_espresso'), '4.5.0', E_USER_DEPRECATED); |
|
316 | 316 | } |
317 | 317 | |
318 | - return apply_filters( $filter_ref, $variation_path, $url, $type ); |
|
318 | + return apply_filters($filter_ref, $variation_path, $url, $type); |
|
319 | 319 | } |
320 | -add_filter( 'FHEE__EE_Messages_Template_Pack__get_variation', 'ee_deprecated_get_inline_css_template_filters', 10, 8 ); |
|
320 | +add_filter('FHEE__EE_Messages_Template_Pack__get_variation', 'ee_deprecated_get_inline_css_template_filters', 10, 8); |
|
321 | 321 | |
322 | 322 | |
323 | 323 | |
@@ -333,78 +333,78 @@ discard block |
||
333 | 333 | class EE_Messages_Init extends EE_Base { |
334 | 334 | |
335 | 335 | public function __construct() { |
336 | - self::doing_it_wrong_call( __METHOD__ ); |
|
336 | + self::doing_it_wrong_call(__METHOD__); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | /** |
340 | 340 | * @param $method_name |
341 | 341 | */ |
342 | - public static function doing_it_wrong_call( $method_name ) { |
|
343 | - EE_Error::doing_it_wrong( __CLASS__, sprintf( __('The %s in this class is deprecated as of EE4.5.0. All functionality formerly in this class is now in the EED_Messages module.', 'event_espresso'), $method_name ), '4.5.0', E_USER_DEPRECATED ); |
|
342 | + public static function doing_it_wrong_call($method_name) { |
|
343 | + EE_Error::doing_it_wrong(__CLASS__, sprintf(__('The %s in this class is deprecated as of EE4.5.0. All functionality formerly in this class is now in the EED_Messages module.', 'event_espresso'), $method_name), '4.5.0', E_USER_DEPRECATED); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
347 | 347 | * @deprecated 4.5.0 |
348 | 348 | */ |
349 | 349 | public static function set_autoloaders() { |
350 | - self::doing_it_wrong_call( __METHOD__ ); |
|
350 | + self::doing_it_wrong_call(__METHOD__); |
|
351 | 351 | EED_Messages::set_autoloaders(); |
352 | 352 | } |
353 | 353 | |
354 | 354 | /** |
355 | 355 | * @deprecated 4.5.0 |
356 | 356 | */ |
357 | - public function payment_reminder( $transaction ) { |
|
358 | - self::doing_it_wrong_call( __METHOD__ ); |
|
359 | - EED_Messages::payment_reminder( $transaction ); |
|
357 | + public function payment_reminder($transaction) { |
|
358 | + self::doing_it_wrong_call(__METHOD__); |
|
359 | + EED_Messages::payment_reminder($transaction); |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | /** |
363 | 363 | * @deprecated 4.5.0 |
364 | 364 | */ |
365 | - public function payment( $transaction, $payment ) { |
|
366 | - self::doing_it_wrong_call( __METHOD__ ); |
|
367 | - EED_Messages::payment( $transaction, $payment ); |
|
365 | + public function payment($transaction, $payment) { |
|
366 | + self::doing_it_wrong_call(__METHOD__); |
|
367 | + EED_Messages::payment($transaction, $payment); |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | /** |
371 | 371 | * @deprecated 4.5.0 |
372 | 372 | */ |
373 | - public function cancelled_registration( $transaction ) { |
|
374 | - self::doing_it_wrong_call( __METHOD__ ); |
|
375 | - EED_Messages::cancelled_registration( $transaction ); |
|
373 | + public function cancelled_registration($transaction) { |
|
374 | + self::doing_it_wrong_call(__METHOD__); |
|
375 | + EED_Messages::cancelled_registration($transaction); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | /** |
379 | 379 | * @deprecated 4.5.0 |
380 | 380 | */ |
381 | - public function maybe_registration( $transaction, $reg_msg, $from_admin ) { |
|
382 | - self::doing_it_wrong_call( __METHOD__ ); |
|
383 | - EED_Messages::maybe_registration( $transaction, $reg_msg, $from_admin ); |
|
381 | + public function maybe_registration($transaction, $reg_msg, $from_admin) { |
|
382 | + self::doing_it_wrong_call(__METHOD__); |
|
383 | + EED_Messages::maybe_registration($transaction, $reg_msg, $from_admin); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | /** |
387 | 387 | * @deprecated 4.5.0 |
388 | 388 | */ |
389 | - public function process_resend( $success, $req_data ) { |
|
390 | - self::doing_it_wrong_call( __METHOD__ ); |
|
391 | - EED_Messages::process_resend( $req_data ); |
|
389 | + public function process_resend($success, $req_data) { |
|
390 | + self::doing_it_wrong_call(__METHOD__); |
|
391 | + EED_Messages::process_resend($req_data); |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | /** |
395 | 395 | * @deprecated 4.5.0 |
396 | 396 | */ |
397 | - public function process_admin_payment( $success, $payment ) { |
|
398 | - self::doing_it_wrong_call( __METHOD__ ); |
|
399 | - EED_Messages::process_admin_payment( $payment ); |
|
397 | + public function process_admin_payment($success, $payment) { |
|
398 | + self::doing_it_wrong_call(__METHOD__); |
|
399 | + EED_Messages::process_admin_payment($payment); |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | /** |
403 | 403 | * @deprecated 4.5.0 |
404 | 404 | */ |
405 | - public function send_newsletter_message( $contacts, $grp_id ) { |
|
406 | - self::doing_it_wrong_call( __METHOD__ ); |
|
407 | - EED_Messages::send_newsletter_message( $contacts, $grp_id ); |
|
405 | + public function send_newsletter_message($contacts, $grp_id) { |
|
406 | + self::doing_it_wrong_call(__METHOD__); |
|
407 | + EED_Messages::send_newsletter_message($contacts, $grp_id); |
|
408 | 408 | } |
409 | 409 | |
410 | 410 | |
@@ -425,13 +425,13 @@ discard block |
||
425 | 425 | * |
426 | 426 | * @return array additional cpts. |
427 | 427 | */ |
428 | -function ee_deprecated_get_cpts( $cpts ) { |
|
429 | - if ( has_filter( 'FHEE__EE_Register_CPTs__construct__CPTs' ) ) { |
|
430 | - EE_Error::doing_it_wrong( 'FHEE__EE_Register_CPTs__construct__CPTs', __('This filter is deprecated. It will still work for the time being. However, it is recommended to use the new filter provided which is "FHEE__EE_Register_CPTs__get_CPTs__cpts" found in EE_Register_CPTs::get_CPTs()', 'event_espresso'), '4.5.0', E_USER_DEPRECATED ); |
|
428 | +function ee_deprecated_get_cpts($cpts) { |
|
429 | + if (has_filter('FHEE__EE_Register_CPTs__construct__CPTs')) { |
|
430 | + EE_Error::doing_it_wrong('FHEE__EE_Register_CPTs__construct__CPTs', __('This filter is deprecated. It will still work for the time being. However, it is recommended to use the new filter provided which is "FHEE__EE_Register_CPTs__get_CPTs__cpts" found in EE_Register_CPTs::get_CPTs()', 'event_espresso'), '4.5.0', E_USER_DEPRECATED); |
|
431 | 431 | } |
432 | - return apply_filters( 'FHEE__EE_Register_CPTs__construct__CPTs', $cpts ); |
|
432 | + return apply_filters('FHEE__EE_Register_CPTs__construct__CPTs', $cpts); |
|
433 | 433 | } |
434 | -add_filter( 'FHEE__EE_Register_CPTs__get_CPTs__cpts', 'ee_deprecated_get_cpts', 10 ); |
|
434 | +add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', 'ee_deprecated_get_cpts', 10); |
|
435 | 435 | |
436 | 436 | |
437 | 437 | |
@@ -445,13 +445,13 @@ discard block |
||
445 | 445 | * |
446 | 446 | * @return array additional custom taxonomies. |
447 | 447 | */ |
448 | -function ee_deprecated_get_taxonomies( $cts ) { |
|
449 | - if ( has_filter( 'FHEE__EE_Register_CPTs__construct__taxonomies' ) ) { |
|
450 | - EE_Error::doing_it_wrong( 'FHEE__EE_Register_CPTs__construct__taxonomies', __('This filter is deprecated. It will still work for the time being. However, it is recommended to use the new filter provided which is "FHEE__EE_Register_CPTs__get_taxonomies__taxonomies" found in EE_Register_CPTs::get_taxonomies()', 'event_espresso'), '4.5.0', E_USER_DEPRECATED ); |
|
448 | +function ee_deprecated_get_taxonomies($cts) { |
|
449 | + if (has_filter('FHEE__EE_Register_CPTs__construct__taxonomies')) { |
|
450 | + EE_Error::doing_it_wrong('FHEE__EE_Register_CPTs__construct__taxonomies', __('This filter is deprecated. It will still work for the time being. However, it is recommended to use the new filter provided which is "FHEE__EE_Register_CPTs__get_taxonomies__taxonomies" found in EE_Register_CPTs::get_taxonomies()', 'event_espresso'), '4.5.0', E_USER_DEPRECATED); |
|
451 | 451 | } |
452 | - return apply_filters( 'FHEE__EE_Register_CPTs__construct__taxonomies', $cts ); |
|
452 | + return apply_filters('FHEE__EE_Register_CPTs__construct__taxonomies', $cts); |
|
453 | 453 | } |
454 | -add_filter( 'FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', 'ee_deprecated_get_taxonomies', 10 ); |
|
454 | +add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', 'ee_deprecated_get_taxonomies', 10); |
|
455 | 455 | |
456 | 456 | |
457 | 457 | |
@@ -463,9 +463,9 @@ discard block |
||
463 | 463 | * @return boolean |
464 | 464 | */ |
465 | 465 | function ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() { |
466 | - $in_use = has_filter( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns' ) |
|
467 | - || has_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save' ); |
|
468 | - if( $in_use ) { |
|
466 | + $in_use = has_filter('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns') |
|
467 | + || has_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save'); |
|
468 | + if ($in_use) { |
|
469 | 469 | $msg = __( |
470 | 470 | 'We detected you are using the filter FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns or AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save.' |
471 | 471 | . 'Both of these have been deprecated and should not be used anymore. You should instead use FHEE__EE_Form_Section_Proper___construct__options_array to customize the contents of the form,' |
@@ -474,18 +474,18 @@ discard block |
||
474 | 474 | 'event_espresso' ) |
475 | 475 | ; |
476 | 476 | EE_Error::doing_it_wrong( |
477 | - __CLASS__ . '::' . __FUNCTION__, |
|
477 | + __CLASS__.'::'.__FUNCTION__, |
|
478 | 478 | $msg, |
479 | 479 | '4.8.32.rc.000' |
480 | 480 | ); |
481 | 481 | //it seems the doing_it_wrong messages get output during some hidden html tags, so add an error to make sure this gets noticed |
482 | - if ( is_admin() && ! defined( 'DOING_AJAX' ) ) { |
|
483 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
482 | + if (is_admin() && ! defined('DOING_AJAX')) { |
|
483 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
484 | 484 | } |
485 | 485 | } |
486 | 486 | return $in_use; |
487 | 487 | } |
488 | -add_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', 'ee_deprecated_using_old_registration_admin_custom_questions_form_hooks' ); |
|
488 | +add_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', 'ee_deprecated_using_old_registration_admin_custom_questions_form_hooks'); |
|
489 | 489 | |
490 | 490 | /** |
491 | 491 | * @deprecated since 4.8.32.rc.000 because it has issues on https://events.codebasehq.com/projects/event-espresso/tickets/9165 |
@@ -494,34 +494,34 @@ discard block |
||
494 | 494 | * @param EE_Admin_Page $admin_page |
495 | 495 | * @return void |
496 | 496 | */ |
497 | -function ee_deprecated_update_attendee_registration_form_old( $admin_page ) { |
|
497 | +function ee_deprecated_update_attendee_registration_form_old($admin_page) { |
|
498 | 498 | //check if the old hooks are in use. If not, do the default |
499 | - if( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
500 | - || ! $admin_page instanceof EE_Admin_Page ) { |
|
499 | + if ( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
500 | + || ! $admin_page instanceof EE_Admin_Page) { |
|
501 | 501 | return; |
502 | 502 | } |
503 | 503 | $req_data = $admin_page->get_request_data(); |
504 | - $qstns = isset( $req_data['qstn'] ) ? $req_data['qstn'] : FALSE; |
|
505 | - $REG_ID = isset( $req_data['_REG_ID'] ) ? absint( $req_data['_REG_ID'] ) : FALSE; |
|
506 | - $qstns = apply_filters( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns ); |
|
507 | - if ( ! $REG_ID || ! $qstns ) { |
|
508 | - EE_Error::add_error( __('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
504 | + $qstns = isset($req_data['qstn']) ? $req_data['qstn'] : FALSE; |
|
505 | + $REG_ID = isset($req_data['_REG_ID']) ? absint($req_data['_REG_ID']) : FALSE; |
|
506 | + $qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns); |
|
507 | + if ( ! $REG_ID || ! $qstns) { |
|
508 | + EE_Error::add_error(__('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
509 | 509 | } |
510 | 510 | $success = TRUE; |
511 | 511 | |
512 | 512 | // allow others to get in on this awesome fun :D |
513 | - do_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns ); |
|
513 | + do_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns); |
|
514 | 514 | // loop thru questions... FINALLY!!! |
515 | 515 | |
516 | - foreach ( $qstns as $QST_ID => $qstn ) { |
|
516 | + foreach ($qstns as $QST_ID => $qstn) { |
|
517 | 517 | //if $qstn isn't an array then it doesn't already have an answer, so let's create the answer |
518 | - if ( !is_array($qstn) ) { |
|
519 | - $success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn); |
|
518 | + if ( ! is_array($qstn)) { |
|
519 | + $success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn); |
|
520 | 520 | continue; |
521 | 521 | } |
522 | 522 | |
523 | 523 | |
524 | - foreach ( $qstn as $ANS_ID => $ANS_value ) { |
|
524 | + foreach ($qstn as $ANS_ID => $ANS_value) { |
|
525 | 525 | //get answer |
526 | 526 | $query_params = array( |
527 | 527 | 0 => array( |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | ); |
533 | 533 | $answer = EEM_Answer::instance()->get_one($query_params); |
534 | 534 | //this MAY be an array but NOT have an answer because its multi select. If so then we need to create the answer |
535 | - if ( ! $answer instanceof EE_Answer ) { |
|
535 | + if ( ! $answer instanceof EE_Answer) { |
|
536 | 536 | $set_values = array( |
537 | 537 | 'QST_ID' => $QST_ID, |
538 | 538 | 'REG_ID' => $REG_ID, |
@@ -547,11 +547,11 @@ discard block |
||
547 | 547 | } |
548 | 548 | } |
549 | 549 | $what = __('Registration Form', 'event_espresso'); |
550 | - $route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' ); |
|
551 | - $admin_page->redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route ); |
|
550 | + $route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default'); |
|
551 | + $admin_page->redirect_after_action($success, $what, __('updated', 'event_espresso'), $route); |
|
552 | 552 | exit; |
553 | 553 | } |
554 | -add_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', 'ee_deprecated_update_attendee_registration_form_old', 10, 1 ); |
|
554 | +add_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', 'ee_deprecated_update_attendee_registration_form_old', 10, 1); |
|
555 | 555 | /** |
556 | 556 | * Render the registration admin page's custom questions area in the old fashion |
557 | 557 | * and firing the old hooks. When this method is removed, we can probably also |
@@ -564,31 +564,31 @@ discard block |
||
564 | 564 | * @return bool |
565 | 565 | * @throws \EE_Error |
566 | 566 | */ |
567 | -function ee_deprecated_reg_questions_meta_box_old( $do_default_action, $admin_page, $registration ) { |
|
567 | +function ee_deprecated_reg_questions_meta_box_old($do_default_action, $admin_page, $registration) { |
|
568 | 568 | //check if the old hooks are in use. If not, do the default |
569 | - if( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
570 | - || ! $admin_page instanceof EE_Admin_Page ) { |
|
569 | + if ( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
570 | + || ! $admin_page instanceof EE_Admin_Page) { |
|
571 | 571 | return $do_default_action; |
572 | 572 | } |
573 | - add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array( $admin_page, 'form_before_question_group' ), 10, 1 ); |
|
574 | - add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array( $admin_page, 'form_after_question_group' ), 10, 1 ); |
|
575 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $admin_page, 'form_form_field_label_wrap' ), 10, 1 ); |
|
576 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $admin_page, 'form_form_field_input__wrap' ), 10, 1 ); |
|
573 | + add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array($admin_page, 'form_before_question_group'), 10, 1); |
|
574 | + add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array($admin_page, 'form_after_question_group'), 10, 1); |
|
575 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($admin_page, 'form_form_field_label_wrap'), 10, 1); |
|
576 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($admin_page, 'form_form_field_input__wrap'), 10, 1); |
|
577 | 577 | |
578 | - $question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options( $registration, $registration->get('EVT_ID') ); |
|
578 | + $question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options($registration, $registration->get('EVT_ID')); |
|
579 | 579 | |
580 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
580 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
581 | 581 | $template_args = array( |
582 | - 'att_questions' => EEH_Form_Fields::generate_question_groups_html( $question_groups ), |
|
582 | + 'att_questions' => EEH_Form_Fields::generate_question_groups_html($question_groups), |
|
583 | 583 | 'reg_questions_form_action' => 'edit_registration', |
584 | 584 | 'REG_ID' => $registration->ID() |
585 | 585 | ); |
586 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
587 | - echo EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
586 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
587 | + echo EEH_Template::display_template($template_path, $template_args, TRUE); |
|
588 | 588 | //indicate that we should not do the default admin page code |
589 | 589 | return false; |
590 | 590 | } |
591 | -add_action( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', 'ee_deprecated_reg_questions_meta_box_old', 10, 3 ); |
|
591 | +add_action('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', 'ee_deprecated_reg_questions_meta_box_old', 10, 3); |
|
592 | 592 | |
593 | 593 | |
594 | 594 | |
@@ -628,9 +628,9 @@ discard block |
||
628 | 628 | '4.9.0' |
629 | 629 | ); |
630 | 630 | /** @var EE_Message_Resource_Manager $message_resource_manager */ |
631 | - $message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
632 | - $messenger = $message_resource_manager->get_messenger( $messenger_name ); |
|
633 | - $message_type = $message_resource_manager->get_message_type( $message_type_name ); |
|
631 | + $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
632 | + $messenger = $message_resource_manager->get_messenger($messenger_name); |
|
633 | + $message_type = $message_resource_manager->get_message_type($message_type_name); |
|
634 | 634 | return EE_Registry::instance()->load_lib( |
635 | 635 | 'Messages_Template_Defaults', |
636 | 636 | array( |
@@ -694,15 +694,15 @@ discard block |
||
694 | 694 | /** |
695 | 695 | * @param string $method |
696 | 696 | */ |
697 | - public function _class_is_deprecated( $method ) { |
|
697 | + public function _class_is_deprecated($method) { |
|
698 | 698 | // EE_messages has been deprecated |
699 | 699 | EE_Error::doing_it_wrong( |
700 | - 'EE_messages::' . $method, |
|
701 | - __( 'EE_messages has been deprecated. Please use EE_Message_Resource_Manager instead.' ), |
|
700 | + 'EE_messages::'.$method, |
|
701 | + __('EE_messages has been deprecated. Please use EE_Message_Resource_Manager instead.'), |
|
702 | 702 | '4.9.0' |
703 | 703 | ); |
704 | 704 | // Please use EE_Message_Resource_Manager instead |
705 | - $this->_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
705 | + $this->_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
706 | 706 | } |
707 | 707 | |
708 | 708 | |
@@ -712,10 +712,10 @@ discard block |
||
712 | 712 | * @param string $messenger_name |
713 | 713 | * @return boolean TRUE if it was PREVIOUSLY active, and FALSE if it was previously inactive |
714 | 714 | */ |
715 | - public function ensure_messenger_is_active( $messenger_name ) { |
|
715 | + public function ensure_messenger_is_active($messenger_name) { |
|
716 | 716 | // EE_messages has been deprecated |
717 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
718 | - return $this->_message_resource_manager->ensure_messenger_is_active( $messenger_name ); |
|
717 | + $this->_class_is_deprecated(__FUNCTION__); |
|
718 | + return $this->_message_resource_manager->ensure_messenger_is_active($messenger_name); |
|
719 | 719 | } |
720 | 720 | |
721 | 721 | |
@@ -727,10 +727,10 @@ discard block |
||
727 | 727 | * @return bool true if it got activated (or was active) and false if not. |
728 | 728 | * @throws \EE_Error |
729 | 729 | */ |
730 | - public function ensure_message_type_is_active( $message_type, $messenger ) { |
|
730 | + public function ensure_message_type_is_active($message_type, $messenger) { |
|
731 | 731 | // EE_messages has been deprecated |
732 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
733 | - return $this->_message_resource_manager->ensure_message_type_is_active( $message_type, $messenger ); |
|
732 | + $this->_class_is_deprecated(__FUNCTION__); |
|
733 | + return $this->_message_resource_manager->ensure_message_type_is_active($message_type, $messenger); |
|
734 | 734 | } |
735 | 735 | |
736 | 736 | |
@@ -743,10 +743,10 @@ discard block |
||
743 | 743 | * they are already setup.) |
744 | 744 | * @return boolean an array of generated templates or false if nothing generated/activated. |
745 | 745 | */ |
746 | - public function activate_messenger( $messenger_name, $mts_to_activate = array() ) { |
|
746 | + public function activate_messenger($messenger_name, $mts_to_activate = array()) { |
|
747 | 747 | // EE_messages has been deprecated |
748 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
749 | - return $this->_message_resource_manager->activate_messenger( $messenger_name, $mts_to_activate ); |
|
748 | + $this->_class_is_deprecated(__FUNCTION__); |
|
749 | + return $this->_message_resource_manager->activate_messenger($messenger_name, $mts_to_activate); |
|
750 | 750 | } |
751 | 751 | |
752 | 752 | |
@@ -758,10 +758,10 @@ discard block |
||
758 | 758 | * |
759 | 759 | * @return bool true is a generating messenger and can be sent OR FALSE meaning cannot send. |
760 | 760 | */ |
761 | - public function is_generating_messenger_and_active( EE_messenger $messenger, EE_message_type $message_type ) { |
|
761 | + public function is_generating_messenger_and_active(EE_messenger $messenger, EE_message_type $message_type) { |
|
762 | 762 | // EE_messages has been deprecated |
763 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
764 | - return $this->_message_resource_manager->is_generating_messenger_and_active( $messenger, $message_type ); |
|
763 | + $this->_class_is_deprecated(__FUNCTION__); |
|
764 | + return $this->_message_resource_manager->is_generating_messenger_and_active($messenger, $message_type); |
|
765 | 765 | } |
766 | 766 | |
767 | 767 | |
@@ -771,10 +771,10 @@ discard block |
||
771 | 771 | * @param string $messenger |
772 | 772 | * @return EE_messenger | null |
773 | 773 | */ |
774 | - public function get_messenger_if_active( $messenger ) { |
|
774 | + public function get_messenger_if_active($messenger) { |
|
775 | 775 | // EE_messages has been deprecated |
776 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
777 | - return $this->_message_resource_manager->get_active_messenger( $messenger ); |
|
776 | + $this->_class_is_deprecated(__FUNCTION__); |
|
777 | + return $this->_message_resource_manager->get_active_messenger($messenger); |
|
778 | 778 | } |
779 | 779 | |
780 | 780 | |
@@ -795,9 +795,9 @@ discard block |
||
795 | 795 | * 'message_type' => null |
796 | 796 | * ) |
797 | 797 | */ |
798 | - public function validate_for_use( EE_Message $message ) { |
|
798 | + public function validate_for_use(EE_Message $message) { |
|
799 | 799 | // EE_messages has been deprecated |
800 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
800 | + $this->_class_is_deprecated(__FUNCTION__); |
|
801 | 801 | return array( |
802 | 802 | 'messenger' => $message->messenger_object(), |
803 | 803 | 'message_type' => $message->message_type_object(), |
@@ -825,41 +825,41 @@ discard block |
||
825 | 825 | $send = true |
826 | 826 | ) { |
827 | 827 | // EE_messages has been deprecated |
828 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
828 | + $this->_class_is_deprecated(__FUNCTION__); |
|
829 | 829 | /** @type EE_Messages_Processor $processor */ |
830 | - $processor = EE_Registry::instance()->load_lib( 'Messages_Processor' ); |
|
830 | + $processor = EE_Registry::instance()->load_lib('Messages_Processor'); |
|
831 | 831 | $error = false; |
832 | 832 | //try to intelligently determine what method we'll call based on the incoming data. |
833 | 833 | //if generating and sending are different then generate and send immediately. |
834 | - if ( ! empty( $sending_messenger ) && $sending_messenger != $generating_messenger && $send ) { |
|
834 | + if ( ! empty($sending_messenger) && $sending_messenger != $generating_messenger && $send) { |
|
835 | 835 | //in the legacy system, when generating and sending were different, that means all the |
836 | 836 | //vars are already in the request object. So let's just use that. |
837 | 837 | try { |
838 | 838 | /** @type EE_Message_To_Generate_From_Request $mtg */ |
839 | - $mtg = EE_Registry::instance()->load_lib( 'Message_To_Generate_From_Request' ); |
|
840 | - $processor->generate_and_send_now( $mtg ); |
|
841 | - } catch ( EE_Error $e ) { |
|
839 | + $mtg = EE_Registry::instance()->load_lib('Message_To_Generate_From_Request'); |
|
840 | + $processor->generate_and_send_now($mtg); |
|
841 | + } catch (EE_Error $e) { |
|
842 | 842 | $error_msg = __( |
843 | 843 | 'Please note that a system message failed to send due to a technical issue.', |
844 | 844 | 'event_espresso' |
845 | 845 | ); |
846 | 846 | // add specific message for developers if WP_DEBUG in on |
847 | - $error_msg .= '||' . $e->getMessage(); |
|
848 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
847 | + $error_msg .= '||'.$e->getMessage(); |
|
848 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
849 | 849 | $error = true; |
850 | 850 | } |
851 | 851 | } else { |
852 | - $processor->generate_for_all_active_messengers( $type, $vars, $send ); |
|
852 | + $processor->generate_for_all_active_messengers($type, $vars, $send); |
|
853 | 853 | //let's find out if there were any errors and how many successfully were queued. |
854 | 854 | $count_errors = $processor->get_queue()->count_STS_in_queue( |
855 | - array( EEM_Message::status_failed, EEM_Message::status_debug_only ) |
|
855 | + array(EEM_Message::status_failed, EEM_Message::status_debug_only) |
|
856 | 856 | ); |
857 | - $count_queued = $processor->get_queue()->count_STS_in_queue( EEM_Message::status_incomplete ); |
|
858 | - $count_retry = $processor->get_queue()->count_STS_in_queue( EEM_Message::status_retry ); |
|
857 | + $count_queued = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_incomplete); |
|
858 | + $count_retry = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_retry); |
|
859 | 859 | $count_errors = $count_errors + $count_retry; |
860 | - if ( $count_errors > 0 ) { |
|
860 | + if ($count_errors > 0) { |
|
861 | 861 | $error = true; |
862 | - if ( $count_errors > 1 && $count_retry > 1 && $count_queued > 1 ) { |
|
862 | + if ($count_errors > 1 && $count_retry > 1 && $count_queued > 1) { |
|
863 | 863 | $message = sprintf( |
864 | 864 | __( |
865 | 865 | 'There were %d errors and %d messages successfully queued for generation and sending', |
@@ -868,7 +868,7 @@ discard block |
||
868 | 868 | $count_errors, |
869 | 869 | $count_queued |
870 | 870 | ); |
871 | - } elseif ( $count_errors > 1 && $count_queued === 1 ) { |
|
871 | + } elseif ($count_errors > 1 && $count_queued === 1) { |
|
872 | 872 | $message = sprintf( |
873 | 873 | __( |
874 | 874 | 'There were %d errors and %d message successfully queued for generation.', |
@@ -877,7 +877,7 @@ discard block |
||
877 | 877 | $count_errors, |
878 | 878 | $count_queued |
879 | 879 | ); |
880 | - } elseif ( $count_errors === 1 && $count_queued > 1 ) { |
|
880 | + } elseif ($count_errors === 1 && $count_queued > 1) { |
|
881 | 881 | $message = sprintf( |
882 | 882 | __( |
883 | 883 | 'There was %d error and %d messages successfully queued for generation.', |
@@ -895,9 +895,9 @@ discard block |
||
895 | 895 | $count_errors |
896 | 896 | ); |
897 | 897 | } |
898 | - EE_Error::add_error( $message, __FILE__, __FUNCTION__, __LINE__ ); |
|
898 | + EE_Error::add_error($message, __FILE__, __FUNCTION__, __LINE__); |
|
899 | 899 | } else { |
900 | - if ( $count_queued === 1 ) { |
|
900 | + if ($count_queued === 1) { |
|
901 | 901 | $message = sprintf( |
902 | 902 | __( |
903 | 903 | '%d message successfully queued for generation.', |
@@ -914,18 +914,18 @@ discard block |
||
914 | 914 | $count_queued |
915 | 915 | ); |
916 | 916 | } |
917 | - EE_Error::add_success( $message ); |
|
917 | + EE_Error::add_success($message); |
|
918 | 918 | } |
919 | 919 | } |
920 | 920 | //if no error then return the generated message(s). |
921 | - if ( ! $error && ! $send ) { |
|
922 | - $generated_queue = $processor->generate_queue( false ); |
|
921 | + if ( ! $error && ! $send) { |
|
922 | + $generated_queue = $processor->generate_queue(false); |
|
923 | 923 | //get message and return. |
924 | 924 | $generated_queue->get_queue()->rewind(); |
925 | 925 | $messages = array(); |
926 | - while ( $generated_queue->get_queue()->valid() ) { |
|
926 | + while ($generated_queue->get_queue()->valid()) { |
|
927 | 927 | $message = $generated_queue->get_queue()->current(); |
928 | - if ( $message instanceof EE_Message ) { |
|
928 | + if ($message instanceof EE_Message) { |
|
929 | 929 | //set properties that might be expected by add-ons (backward compat) |
930 | 930 | $message->content = $message->content(); |
931 | 931 | $message->template_pack = $message->get_template_pack(); |
@@ -950,10 +950,10 @@ discard block |
||
950 | 950 | * @param bool $send true we will do a test send using the messenger delivery, false we just do a regular preview |
951 | 951 | * @return string The body of the message. |
952 | 952 | */ |
953 | - public function preview_message( $type, $context, $messenger, $send = false ) { |
|
953 | + public function preview_message($type, $context, $messenger, $send = false) { |
|
954 | 954 | // EE_messages has been deprecated |
955 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
956 | - return EED_Messages::preview_message( $type, $context, $messenger, $send ); |
|
955 | + $this->_class_is_deprecated(__FUNCTION__); |
|
956 | + return EED_Messages::preview_message($type, $context, $messenger, $send); |
|
957 | 957 | } |
958 | 958 | |
959 | 959 | |
@@ -967,14 +967,14 @@ discard block |
||
967 | 967 | * |
968 | 968 | * @return bool success or fail. |
969 | 969 | */ |
970 | - public function send_message_with_messenger_only( $messenger, $message_type, $message ) { |
|
970 | + public function send_message_with_messenger_only($messenger, $message_type, $message) { |
|
971 | 971 | // EE_messages has been deprecated |
972 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
972 | + $this->_class_is_deprecated(__FUNCTION__); |
|
973 | 973 | //setup for sending to new method. |
974 | 974 | /** @type EE_Messages_Queue $queue */ |
975 | - $queue = EE_Registry::instance()->load_lib( 'Messages_Queue' ); |
|
975 | + $queue = EE_Registry::instance()->load_lib('Messages_Queue'); |
|
976 | 976 | //make sure we have a proper message object |
977 | - if ( ! $message instanceof EE_Message && is_object( $message ) && isset( $message->content ) ) { |
|
977 | + if ( ! $message instanceof EE_Message && is_object($message) && isset($message->content)) { |
|
978 | 978 | $msg = EE_Message_Factory::create( |
979 | 979 | array( |
980 | 980 | 'MSG_messenger' => $messenger, |
@@ -986,15 +986,15 @@ discard block |
||
986 | 986 | } else { |
987 | 987 | $msg = $message; |
988 | 988 | } |
989 | - if ( ! $msg instanceof EE_Message ) { |
|
989 | + if ( ! $msg instanceof EE_Message) { |
|
990 | 990 | return false; |
991 | 991 | } |
992 | 992 | //make sure any content in a content property (if not empty) is set on the MSG_content. |
993 | - if ( ! empty( $msg->content ) ) { |
|
994 | - $msg->set( 'MSG_content', $msg->content ); |
|
993 | + if ( ! empty($msg->content)) { |
|
994 | + $msg->set('MSG_content', $msg->content); |
|
995 | 995 | } |
996 | - $queue->add( $msg ); |
|
997 | - return EED_Messages::send_message_with_messenger_only( $messenger, $message_type, $queue ); |
|
996 | + $queue->add($msg); |
|
997 | + return EED_Messages::send_message_with_messenger_only($messenger, $message_type, $queue); |
|
998 | 998 | } |
999 | 999 | |
1000 | 1000 | |
@@ -1008,11 +1008,11 @@ discard block |
||
1008 | 1008 | * @return array|object if creation is successful then we return an array of info, otherwise an error_object is returned. |
1009 | 1009 | * @throws \EE_Error |
1010 | 1010 | */ |
1011 | - public function create_new_templates( $messenger, $message_type, $GRP_ID = 0, $is_global = false ) { |
|
1011 | + public function create_new_templates($messenger, $message_type, $GRP_ID = 0, $is_global = false) { |
|
1012 | 1012 | // EE_messages has been deprecated |
1013 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1014 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
1015 | - return EEH_MSG_Template::create_new_templates( $messenger, $message_type, $GRP_ID, $is_global ); |
|
1013 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1014 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
1015 | + return EEH_MSG_Template::create_new_templates($messenger, $message_type, $GRP_ID, $is_global); |
|
1016 | 1016 | } |
1017 | 1017 | |
1018 | 1018 | |
@@ -1023,11 +1023,11 @@ discard block |
||
1023 | 1023 | * @param string $message_type_name name of EE_message_type |
1024 | 1024 | * @return array |
1025 | 1025 | */ |
1026 | - public function get_fields( $messenger_name, $message_type_name ) { |
|
1026 | + public function get_fields($messenger_name, $message_type_name) { |
|
1027 | 1027 | // EE_messages has been deprecated |
1028 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1029 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
1030 | - return EEH_MSG_Template::get_fields( $messenger_name, $message_type_name ); |
|
1028 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1029 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
1030 | + return EEH_MSG_Template::get_fields($messenger_name, $message_type_name); |
|
1031 | 1031 | } |
1032 | 1032 | |
1033 | 1033 | |
@@ -1041,13 +1041,13 @@ discard block |
||
1041 | 1041 | * @return array multidimensional array of messenger and message_type objects |
1042 | 1042 | * (messengers index, and message_type index); |
1043 | 1043 | */ |
1044 | - public function get_installed( $type = 'all', $skip_cache = false ) { |
|
1044 | + public function get_installed($type = 'all', $skip_cache = false) { |
|
1045 | 1045 | // EE_messages has been deprecated |
1046 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1047 | - if ( $skip_cache ) { |
|
1046 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1047 | + if ($skip_cache) { |
|
1048 | 1048 | $this->_message_resource_manager->reset_active_messengers_and_message_types(); |
1049 | 1049 | } |
1050 | - switch ( $type ) { |
|
1050 | + switch ($type) { |
|
1051 | 1051 | case 'messengers' : |
1052 | 1052 | return array( |
1053 | 1053 | 'messenger' => $this->_message_resource_manager->installed_messengers(), |
@@ -1076,7 +1076,7 @@ discard block |
||
1076 | 1076 | */ |
1077 | 1077 | public function get_active_messengers() { |
1078 | 1078 | // EE_messages has been deprecated |
1079 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1079 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1080 | 1080 | return $this->_message_resource_manager->active_messengers(); |
1081 | 1081 | } |
1082 | 1082 | |
@@ -1088,7 +1088,7 @@ discard block |
||
1088 | 1088 | */ |
1089 | 1089 | public function get_active_message_types() { |
1090 | 1090 | // EE_messages has been deprecated |
1091 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1091 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1092 | 1092 | return $this->_message_resource_manager->list_of_active_message_types(); |
1093 | 1093 | } |
1094 | 1094 | |
@@ -1100,7 +1100,7 @@ discard block |
||
1100 | 1100 | */ |
1101 | 1101 | public function get_active_message_type_objects() { |
1102 | 1102 | // EE_messages has been deprecated |
1103 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1103 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1104 | 1104 | return $this->_message_resource_manager->get_active_message_type_objects(); |
1105 | 1105 | } |
1106 | 1106 | |
@@ -1112,10 +1112,10 @@ discard block |
||
1112 | 1112 | * @param string $messenger The messenger being checked |
1113 | 1113 | * @return EE_message_type[] (or empty array if none present) |
1114 | 1114 | */ |
1115 | - public function get_active_message_types_per_messenger( $messenger ) { |
|
1115 | + public function get_active_message_types_per_messenger($messenger) { |
|
1116 | 1116 | // EE_messages has been deprecated |
1117 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1118 | - return $this->_message_resource_manager->get_active_message_types_for_messenger( $messenger ); |
|
1117 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1118 | + return $this->_message_resource_manager->get_active_message_types_for_messenger($messenger); |
|
1119 | 1119 | } |
1120 | 1120 | |
1121 | 1121 | |
@@ -1126,10 +1126,10 @@ discard block |
||
1126 | 1126 | * @param string $message_type The string should correspond to a message type. |
1127 | 1127 | * @return EE_message_type|null |
1128 | 1128 | */ |
1129 | - public function get_active_message_type( $messenger, $message_type ) { |
|
1129 | + public function get_active_message_type($messenger, $message_type) { |
|
1130 | 1130 | // EE_messages has been deprecated |
1131 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1132 | - return $this->_message_resource_manager->get_active_message_type_for_messenger( $messenger, $message_type ); |
|
1131 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1132 | + return $this->_message_resource_manager->get_active_message_type_for_messenger($messenger, $message_type); |
|
1133 | 1133 | } |
1134 | 1134 | |
1135 | 1135 | |
@@ -1140,7 +1140,7 @@ discard block |
||
1140 | 1140 | */ |
1141 | 1141 | public function get_installed_message_types() { |
1142 | 1142 | // EE_messages has been deprecated |
1143 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1143 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1144 | 1144 | return $this->_message_resource_manager->installed_message_types(); |
1145 | 1145 | } |
1146 | 1146 | |
@@ -1152,7 +1152,7 @@ discard block |
||
1152 | 1152 | */ |
1153 | 1153 | public function get_installed_messengers() { |
1154 | 1154 | // EE_messages has been deprecated |
1155 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1155 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1156 | 1156 | return $this->_message_resource_manager->installed_messengers(); |
1157 | 1157 | } |
1158 | 1158 | |
@@ -1163,10 +1163,10 @@ discard block |
||
1163 | 1163 | * @param bool $slugs_only Whether to return an array of just slugs and labels (true) or all contexts indexed by message type. |
1164 | 1164 | * @return array |
1165 | 1165 | */ |
1166 | - public function get_all_contexts( $slugs_only = true ) { |
|
1166 | + public function get_all_contexts($slugs_only = true) { |
|
1167 | 1167 | // EE_messages has been deprecated |
1168 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1169 | - return $this->_message_resource_manager->get_all_contexts( $slugs_only ); |
|
1168 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1169 | + return $this->_message_resource_manager->get_all_contexts($slugs_only); |
|
1170 | 1170 | } |
1171 | 1171 | |
1172 | 1172 |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | } |
338 | 338 | |
339 | 339 | /** |
340 | - * @param $method_name |
|
340 | + * @param string $method_name |
|
341 | 341 | */ |
342 | 342 | public static function doing_it_wrong_call( $method_name ) { |
343 | 343 | EE_Error::doing_it_wrong( __CLASS__, sprintf( __('The %s in this class is deprecated as of EE4.5.0. All functionality formerly in this class is now in the EED_Messages module.', 'event_espresso'), $method_name ), '4.5.0', E_USER_DEPRECATED ); |
@@ -1150,7 +1150,7 @@ discard block |
||
1150 | 1150 | |
1151 | 1151 | /** |
1152 | 1152 | * @deprecated 4.9.0 |
1153 | - * @return array |
|
1153 | + * @return EE_messenger[] |
|
1154 | 1154 | */ |
1155 | 1155 | public function get_installed_messengers() { |
1156 | 1156 | // EE_messages has been deprecated |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * |
9 | 9 | * This input has a default validation strategy of plaintext (which can be removed after construction) |
10 | 10 | */ |
11 | -class EE_Text_Area_Input extends EE_Form_Input_Base{ |
|
11 | +class EE_Text_Area_Input extends EE_Form_Input_Base { |
|
12 | 12 | |
13 | 13 | |
14 | 14 | protected $_rows = 2; |
@@ -18,28 +18,28 @@ discard block |
||
18 | 18 | * sets the rows property on this input |
19 | 19 | * @param int $rows |
20 | 20 | */ |
21 | - public function set_rows( $rows ) { |
|
21 | + public function set_rows($rows) { |
|
22 | 22 | $this->_rows = $rows; |
23 | 23 | } |
24 | 24 | /** |
25 | 25 | * sets the cols html property on this input |
26 | 26 | * @param int $cols |
27 | 27 | */ |
28 | - public function set_cols( $cols ) { |
|
28 | + public function set_cols($cols) { |
|
29 | 29 | $this->_cols = $cols; |
30 | 30 | } |
31 | 31 | /** |
32 | 32 | * |
33 | 33 | * @return int |
34 | 34 | */ |
35 | - public function get_rows(){ |
|
35 | + public function get_rows() { |
|
36 | 36 | return $this->_rows; |
37 | 37 | } |
38 | 38 | /** |
39 | 39 | * |
40 | 40 | * @return int |
41 | 41 | */ |
42 | - public function get_cols(){ |
|
42 | + public function get_cols() { |
|
43 | 43 | return $this->_cols; |
44 | 44 | } |
45 | 45 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | //if the input hasn't specifically mentioned a more lenient validation strategy, |
59 | 59 | //apply plaintext validation strategy |
60 | - if( ! $this->has_validation_strategy( |
|
60 | + if ( ! $this->has_validation_strategy( |
|
61 | 61 | array( |
62 | 62 | 'EE_Full_HTML_Validation_Strategy', |
63 | 63 | 'EE_Simple_HTML_Validation_Strategy' |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | ) { |
67 | 67 | //by default we use the plaintext validation. If you want something else, |
68 | 68 | //just remove it after the input is constructed :P using EE_Form_Input_Base::remove_validation_strategy() |
69 | - $this->_add_validation_strategy( new EE_Plaintext_Validation_Strategy() ); |
|
69 | + $this->_add_validation_strategy(new EE_Plaintext_Validation_Strategy()); |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | } |
@@ -8,19 +8,19 @@ discard block |
||
8 | 8 | * |
9 | 9 | * This input has a default validation strategy of plaintext (which can be removed after construction) |
10 | 10 | */ |
11 | -class EE_Text_Input extends EE_Form_Input_Base{ |
|
11 | +class EE_Text_Input extends EE_Form_Input_Base { |
|
12 | 12 | |
13 | 13 | |
14 | 14 | /** |
15 | 15 | * @param array $options |
16 | 16 | */ |
17 | - function __construct($options = array()){ |
|
17 | + function __construct($options = array()) { |
|
18 | 18 | $this->_set_display_strategy(new EE_Text_Input_Display_Strategy()); |
19 | 19 | $this->_set_normalization_strategy(new EE_Text_Normalization()); |
20 | 20 | parent::__construct($options); |
21 | 21 | //if the input hasn't specifically mentioned a more lenient validation strategy, |
22 | 22 | //apply plaintext validation strategy |
23 | - if( ! $this->has_validation_strategy( |
|
23 | + if ( ! $this->has_validation_strategy( |
|
24 | 24 | array( |
25 | 25 | 'EE_Full_HTML_Validation_Strategy', |
26 | 26 | 'EE_Simple_HTML_Validation_Strategy' |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | ) { |
30 | 30 | //by default we use the plaintext validation. If you want something else, |
31 | 31 | //just remove it after the input is constructed :P using EE_Form_Input_Base::remove_validation_strategy() |
32 | - $this->_add_validation_strategy( new EE_Plaintext_Validation_Strategy() ); |
|
32 | + $this->_add_validation_strategy(new EE_Plaintext_Validation_Strategy()); |
|
33 | 33 | } |
34 | 34 | } |
35 | 35 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | *_question_model EEM_Question model instance (for queries) |
51 | 51 | * |
52 | 52 | * @var EEM_Question $_question_model; |
53 | - */ |
|
53 | + */ |
|
54 | 54 | protected $_question_model; |
55 | 55 | |
56 | 56 | /** |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | ), |
152 | 152 | 'list_table' => 'Registration_Form_Questions_Admin_List_Table', |
153 | 153 | 'metaboxes' => $this->_default_espresso_metaboxes, |
154 | - 'help_tabs' => array( |
|
154 | + 'help_tabs' => array( |
|
155 | 155 | 'registration_form_questions_overview_help_tab' => array( |
156 | 156 | 'title' => __('Questions Overview', 'event_espresso'), |
157 | 157 | 'filename' => 'registration_form_questions_overview' |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | 'filename' => 'registration_form_edit_question' |
203 | 203 | ), |
204 | 204 | ), |
205 | - 'help_tour' => array( 'Registration_Form_Edit_Question_Help_Tour'), |
|
205 | + 'help_tour' => array( 'Registration_Form_Edit_Question_Help_Tour'), |
|
206 | 206 | 'require_nonce' => FALSE |
207 | 207 | ), |
208 | 208 | ); |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -342,14 +343,9 @@ discard block |
||
342 | 343 | else if ( $fieldName === 'QST_admin_label' && ( isset( $this->_req_data['QST_admin_label'] ) && empty( $this->_req_data['QST_admin_label'] ) )) { |
343 | 344 | $QST_text = isset( $this->_req_data['QST_display_text'] ) ? $this->_req_data['QST_display_text'] : '' ; |
344 | 345 | $set_column_values[$fieldName] = sanitize_title(wp_trim_words($QST_text,10)); |
345 | - } |
|
346 | - |
|
347 | - |
|
348 | - else if ( $fieldName === 'QST_admin_only' && ( !isset( $this->_req_data['QST_admin_only'] ) ) ) { |
|
346 | + } else if ( $fieldName === 'QST_admin_only' && ( !isset( $this->_req_data['QST_admin_only'] ) ) ) { |
|
349 | 347 | $set_column_values[$fieldName] = 0; |
350 | - } |
|
351 | - |
|
352 | - else if ( $fieldName === 'QST_max' ) { |
|
348 | + } else if ( $fieldName === 'QST_max' ) { |
|
353 | 349 | $qst_system = EEM_Question::instance()->get_var( |
354 | 350 | array( |
355 | 351 | array( |
@@ -402,7 +398,7 @@ discard block |
||
402 | 398 | $question=$this->_question_model->get_one_by_ID($ID); |
403 | 399 | $additional_hidden_fields=array('QST_ID'=>array('type'=>'hidden','value'=>$ID)); |
404 | 400 | $this->_set_add_edit_form_tags('update_question', $additional_hidden_fields); |
405 | - }else{ |
|
401 | + } else{ |
|
406 | 402 | $question= EE_Question::new_instance(); |
407 | 403 | $question->set_order_to_latest(); |
408 | 404 | $this->_set_add_edit_form_tags('insert_question'); |
@@ -433,7 +429,7 @@ discard block |
||
433 | 429 | $ID=$this->_question_model->insert($set_column_values); |
434 | 430 | $success = $ID ? true : false; |
435 | 431 | $action_desc = 'added'; |
436 | - }else{ |
|
432 | + } else{ |
|
437 | 433 | $ID=absint($this->_req_data['QST_ID']); |
438 | 434 | $pk=$this->_question_model->primary_key_name(); |
439 | 435 | $wheres=array($pk=>$ID); |
@@ -454,7 +450,7 @@ discard block |
||
454 | 450 | $option_req_index=$this->_get_option_req_data_index($option_ID); |
455 | 451 | if($option_req_index!==FALSE){ |
456 | 452 | $option->save($this->_req_data['question_options'][$option_req_index]); |
457 | - }else{ |
|
453 | + } else{ |
|
458 | 454 | //not found, remove it |
459 | 455 | $option->delete(); |
460 | 456 | } |
@@ -531,7 +527,7 @@ discard block |
||
531 | 527 | 'QSG_name'=>array('LIKE',"%$search_string%"), |
532 | 528 | 'QSG_desc'=>array('LIKE',"%$search_string%")) |
533 | 529 | ); |
534 | - }else{ |
|
530 | + } else{ |
|
535 | 531 | $query_params[0]=array( |
536 | 532 | 'QST_display_text'=>array('LIKE',"%$search_string%") |
537 | 533 | ); |
@@ -587,7 +583,7 @@ discard block |
||
587 | 583 | if ($count){ |
588 | 584 | $where = isset( $query_params[0] ) ? array( $query_params[0] ) : array(); |
589 | 585 | $results = $QST->count($where); |
590 | - }else{ |
|
586 | + } else{ |
|
591 | 587 | $results = $QST->get_all($query_params); |
592 | 588 | } |
593 | 589 | return $results; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object. |
69 | 69 | * @access public |
70 | 70 | */ |
71 | - public function __construct( $routing = TRUE ) { |
|
72 | - require_once( EE_MODELS . 'EEM_Question.model.php' ); |
|
73 | - require_once( EE_MODELS . 'EEM_Question_Group.model.php' ); |
|
74 | - $this->_question_model= EEM_Question::instance(); |
|
75 | - $this->_question_group_model=EEM_Question_Group::instance(); |
|
76 | - parent::__construct( $routing ); |
|
71 | + public function __construct($routing = TRUE) { |
|
72 | + require_once(EE_MODELS.'EEM_Question.model.php'); |
|
73 | + require_once(EE_MODELS.'EEM_Question_Group.model.php'); |
|
74 | + $this->_question_model = EEM_Question::instance(); |
|
75 | + $this->_question_group_model = EEM_Question_Group::instance(); |
|
76 | + parent::__construct($routing); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | *_set_page_routes |
110 | 110 | */ |
111 | 111 | protected function _set_page_routes() { |
112 | - $qst_id = ! empty( $this->_req_data['QST_ID'] ) ? $this->_req_data['QST_ID'] : 0; |
|
112 | + $qst_id = ! empty($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0; |
|
113 | 113 | $this->_page_routes = array( |
114 | 114 | 'default' => array( |
115 | 115 | 'func' => '_questions_overview_list_table', |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | 'update_question' => array( |
132 | 132 | 'func' => '_insert_or_update_question', |
133 | - 'args' => array('new_question' => FALSE ), |
|
133 | + 'args' => array('new_question' => FALSE), |
|
134 | 134 | 'capability' => 'ee_edit_question', |
135 | 135 | 'obj_id' => $qst_id, |
136 | 136 | 'noheader' => TRUE, |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | 'filename' => 'registration_form_questions_overview_views_bulk_actions_search' |
166 | 166 | ) |
167 | 167 | ), |
168 | - 'help_tour' => array( 'Registration_Form_Questions_Overview_Help_Tour'), |
|
168 | + 'help_tour' => array('Registration_Form_Questions_Overview_Help_Tour'), |
|
169 | 169 | 'require_nonce' => FALSE, |
170 | 170 | 'qtips' => array( |
171 | 171 | 'EE_Registration_Form_Tips' |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | 'filename' => 'registration_form_question_groups' |
185 | 185 | ), |
186 | 186 | ), |
187 | - 'help_tour' => array( 'Registration_Form_Question_Groups_Help_Tour'), |
|
187 | + 'help_tour' => array('Registration_Form_Question_Groups_Help_Tour'), |
|
188 | 188 | 'require_nonce' => FALSE |
189 | 189 | ), |
190 | 190 | |
@@ -193,16 +193,16 @@ discard block |
||
193 | 193 | 'label' => __('Edit Question', 'event_espresso'), |
194 | 194 | 'order' => 15, |
195 | 195 | 'persistent' => FALSE, |
196 | - 'url' => isset($this->_req_data['question_id']) ? add_query_arg(array('question_id' => $this->_req_data['question_id'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
196 | + 'url' => isset($this->_req_data['question_id']) ? add_query_arg(array('question_id' => $this->_req_data['question_id']), $this->_current_page_view_url) : $this->_admin_base_url |
|
197 | 197 | ), |
198 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
|
198 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
199 | 199 | 'help_tabs' => array( |
200 | 200 | 'registration_form_edit_question_group_help_tab' => array( |
201 | 201 | 'title' => __('Edit Question', 'event_espresso'), |
202 | 202 | 'filename' => 'registration_form_edit_question' |
203 | 203 | ), |
204 | 204 | ), |
205 | - 'help_tour' => array( 'Registration_Form_Edit_Question_Help_Tour'), |
|
205 | + 'help_tour' => array('Registration_Form_Edit_Question_Help_Tour'), |
|
206 | 206 | 'require_nonce' => FALSE |
207 | 207 | ), |
208 | 208 | ); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | //none of the below group are currently used for Event Categories |
231 | 231 | protected function _add_feature_pointers() {} |
232 | 232 | public function load_scripts_styles() { |
233 | - wp_register_style( 'espresso_registration', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
233 | + wp_register_style('espresso_registration', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
234 | 234 | wp_enqueue_style('espresso_registration'); |
235 | 235 | } |
236 | 236 | public function admin_init() {} |
@@ -246,20 +246,20 @@ discard block |
||
246 | 246 | |
247 | 247 | public function load_scripts_styles_add_question() { |
248 | 248 | $this->load_scripts_styles_forms(); |
249 | - wp_register_script( 'espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
250 | - wp_enqueue_script( 'espresso_registration_form_single' ); |
|
249 | + wp_register_script('espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
250 | + wp_enqueue_script('espresso_registration_form_single'); |
|
251 | 251 | } |
252 | 252 | public function load_scripts_styles_edit_question() { |
253 | 253 | $this->load_scripts_styles_forms(); |
254 | - wp_register_script( 'espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
255 | - wp_enqueue_script( 'espresso_registration_form_single' ); |
|
254 | + wp_register_script('espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
255 | + wp_enqueue_script('espresso_registration_form_single'); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | |
259 | 259 | |
260 | 260 | |
261 | 261 | public function recaptcha_info_help_tab() { |
262 | - $template = REGISTRATION_FORM_TEMPLATE_PATH . 'recaptcha_info_help_tab.template.php'; |
|
262 | + $template = REGISTRATION_FORM_TEMPLATE_PATH.'recaptcha_info_help_tab.template.php'; |
|
263 | 263 | EEH_Template::display_template($template, array()); |
264 | 264 | } |
265 | 265 | |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | ) |
292 | 292 | ); |
293 | 293 | |
294 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_questions', 'espresso_registration_form_trash_questions' ) ) { |
|
294 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions')) { |
|
295 | 295 | $this->_views['trash'] = array( |
296 | 296 | 'slug' => 'trash', |
297 | 297 | 'label' => __('Trash', 'event_espresso'), |
@@ -309,9 +309,9 @@ discard block |
||
309 | 309 | */ |
310 | 310 | protected function _questions_groups_preview() { |
311 | 311 | $this->_admin_page_title = __('Question Groups (Preview)', 'event_espresso'); |
312 | - $this->_template_args['preview_img'] = '<img src="' . REGISTRATION_FORM_ASSETS_URL . 'caf_reg_form_preview.jpg" alt="' . esc_attr__( 'Preview Question Groups Overview List Table screenshot', 'event_espresso' ) . '" />'; |
|
313 | - $this->_template_args['preview_text'] = '<strong>'.__( 'Question Groups is a feature that is only available in the Caffeinated version of Event Espresso. With the Question Groups feature you are able to: create new question groups, edit existing question groups, and also create and edit new questions and add them to question groups.', 'event_espresso' ).'</strong>'; |
|
314 | - $this->display_admin_caf_preview_page( 'question_groups_tab' ); |
|
312 | + $this->_template_args['preview_img'] = '<img src="'.REGISTRATION_FORM_ASSETS_URL.'caf_reg_form_preview.jpg" alt="'.esc_attr__('Preview Question Groups Overview List Table screenshot', 'event_espresso').'" />'; |
|
313 | + $this->_template_args['preview_text'] = '<strong>'.__('Question Groups is a feature that is only available in the Caffeinated version of Event Espresso. With the Question Groups feature you are able to: create new question groups, edit existing question groups, and also create and edit new questions and add them to question groups.', 'event_espresso').'</strong>'; |
|
314 | + $this->display_admin_caf_preview_page('question_groups_tab'); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | |
@@ -322,58 +322,58 @@ discard block |
||
322 | 322 | * @param \EEM_Base $model |
323 | 323 | * @return array where each key is the name of a model's field/db column, and each value is its value. |
324 | 324 | */ |
325 | - protected function _set_column_values_for(EEM_Base $model){ |
|
326 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
327 | - $set_column_values=array(); |
|
325 | + protected function _set_column_values_for(EEM_Base $model) { |
|
326 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
327 | + $set_column_values = array(); |
|
328 | 328 | |
329 | 329 | //some initial checks for proper values. |
330 | 330 | //if QST_admin_only, then no matter what QST_required is we disable. |
331 | - if ( !empty( $this->_req_data['QST_admin_only'] ) ) { |
|
331 | + if ( ! empty($this->_req_data['QST_admin_only'])) { |
|
332 | 332 | $this->_req_data['QST_required'] = 0; |
333 | 333 | } |
334 | - foreach($model->field_settings() as $fieldName=>$settings){ |
|
334 | + foreach ($model->field_settings() as $fieldName=>$settings) { |
|
335 | 335 | // basically if QSG_identifier is empty or not set |
336 | - if ( $fieldName === 'QSG_identifier' && ( isset( $this->_req_data['QSG_identifier'] ) && empty( $this->_req_data['QSG_identifier'] ) )) { |
|
337 | - $QSG_name = isset( $this->_req_data['QSG_name'] ) ? $this->_req_data['QSG_name'] : '' ; |
|
338 | - $set_column_values[$fieldName] = sanitize_title($QSG_name ) . '-' . uniqid( '', true ); |
|
336 | + if ($fieldName === 'QSG_identifier' && (isset($this->_req_data['QSG_identifier']) && empty($this->_req_data['QSG_identifier']))) { |
|
337 | + $QSG_name = isset($this->_req_data['QSG_name']) ? $this->_req_data['QSG_name'] : ''; |
|
338 | + $set_column_values[$fieldName] = sanitize_title($QSG_name).'-'.uniqid('', true); |
|
339 | 339 | // dd($set_column_values); |
340 | 340 | } |
341 | 341 | //if the admin label is blank, use a slug version of the question text |
342 | - else if ( $fieldName === 'QST_admin_label' && ( isset( $this->_req_data['QST_admin_label'] ) && empty( $this->_req_data['QST_admin_label'] ) )) { |
|
343 | - $QST_text = isset( $this->_req_data['QST_display_text'] ) ? $this->_req_data['QST_display_text'] : '' ; |
|
344 | - $set_column_values[$fieldName] = sanitize_title(wp_trim_words($QST_text,10)); |
|
342 | + else if ($fieldName === 'QST_admin_label' && (isset($this->_req_data['QST_admin_label']) && empty($this->_req_data['QST_admin_label']))) { |
|
343 | + $QST_text = isset($this->_req_data['QST_display_text']) ? $this->_req_data['QST_display_text'] : ''; |
|
344 | + $set_column_values[$fieldName] = sanitize_title(wp_trim_words($QST_text, 10)); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | |
348 | - else if ( $fieldName === 'QST_admin_only' && ( !isset( $this->_req_data['QST_admin_only'] ) ) ) { |
|
348 | + else if ($fieldName === 'QST_admin_only' && ( ! isset($this->_req_data['QST_admin_only']))) { |
|
349 | 349 | $set_column_values[$fieldName] = 0; |
350 | 350 | } |
351 | 351 | |
352 | - else if ( $fieldName === 'QST_max' ) { |
|
352 | + else if ($fieldName === 'QST_max') { |
|
353 | 353 | $qst_system = EEM_Question::instance()->get_var( |
354 | 354 | array( |
355 | 355 | array( |
356 | - 'QST_ID' => isset( $this->_req_data[ 'QST_ID' ] ) ? $this->_req_data[ 'QST_ID' ] : 0 |
|
356 | + 'QST_ID' => isset($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0 |
|
357 | 357 | ) |
358 | 358 | ), |
359 | 359 | 'QST_system' ); |
360 | - $max_max = EEM_Question::instance()->absolute_max_for_system_question( $qst_system ); |
|
361 | - if( empty( $this->_req_data[ 'QST_max' ] ) || |
|
362 | - $this->_req_data[ 'QST_max' ] > $max_max ) { |
|
363 | - $set_column_values[ $fieldName ] = $max_max; |
|
360 | + $max_max = EEM_Question::instance()->absolute_max_for_system_question($qst_system); |
|
361 | + if (empty($this->_req_data['QST_max']) || |
|
362 | + $this->_req_data['QST_max'] > $max_max) { |
|
363 | + $set_column_values[$fieldName] = $max_max; |
|
364 | 364 | } |
365 | 365 | } |
366 | 366 | |
367 | 367 | |
368 | 368 | //only add a property to the array if it's not null (otherwise the model should just use the default value) |
369 | - if( |
|
370 | - ! isset( $set_column_values[ $fieldName ] ) && |
|
371 | - isset($this->_req_data[$fieldName] ) ){ |
|
372 | - $set_column_values[$fieldName]=$this->_req_data[$fieldName]; |
|
369 | + if ( |
|
370 | + ! isset($set_column_values[$fieldName]) && |
|
371 | + isset($this->_req_data[$fieldName]) ) { |
|
372 | + $set_column_values[$fieldName] = $this->_req_data[$fieldName]; |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | } |
376 | - return $set_column_values;//validation fo this data to be performed by the model before insertion. |
|
376 | + return $set_column_values; //validation fo this data to be performed by the model before insertion. |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | |
@@ -392,29 +392,29 @@ discard block |
||
392 | 392 | * _edit_question |
393 | 393 | */ |
394 | 394 | protected function _edit_question() { |
395 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
396 | - $ID=isset( $this->_req_data['QST_ID'] ) && ! empty( $this->_req_data['QST_ID'] ) ? absint( $this->_req_data['QST_ID'] ) : FALSE; |
|
395 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
396 | + $ID = isset($this->_req_data['QST_ID']) && ! empty($this->_req_data['QST_ID']) ? absint($this->_req_data['QST_ID']) : FALSE; |
|
397 | 397 | |
398 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
398 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
399 | 399 | // add PRC_ID to title if editing |
400 | - $this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title; |
|
401 | - if($ID){ |
|
402 | - $question=$this->_question_model->get_one_by_ID($ID); |
|
403 | - $additional_hidden_fields=array('QST_ID'=>array('type'=>'hidden','value'=>$ID)); |
|
400 | + $this->_admin_page_title = $ID ? $this->_admin_page_title.' # '.$ID : $this->_admin_page_title; |
|
401 | + if ($ID) { |
|
402 | + $question = $this->_question_model->get_one_by_ID($ID); |
|
403 | + $additional_hidden_fields = array('QST_ID'=>array('type'=>'hidden', 'value'=>$ID)); |
|
404 | 404 | $this->_set_add_edit_form_tags('update_question', $additional_hidden_fields); |
405 | - }else{ |
|
406 | - $question= EE_Question::new_instance(); |
|
405 | + } else { |
|
406 | + $question = EE_Question::new_instance(); |
|
407 | 407 | $question->set_order_to_latest(); |
408 | 408 | $this->_set_add_edit_form_tags('insert_question'); |
409 | 409 | } |
410 | - $question_types = $question->has_answers() ? $this->_question_model->question_types_in_same_category( $question->type() ) : $this->_question_model->allowed_question_types(); |
|
411 | - $this->_template_args['QST_ID']=$ID; |
|
412 | - $this->_template_args['question']=$question; |
|
413 | - $this->_template_args['question_types']= $question_types; |
|
414 | - $this->_template_args['max_max'] = EEM_Question::instance()->absolute_max_for_system_question( $question->system_ID() ); |
|
410 | + $question_types = $question->has_answers() ? $this->_question_model->question_types_in_same_category($question->type()) : $this->_question_model->allowed_question_types(); |
|
411 | + $this->_template_args['QST_ID'] = $ID; |
|
412 | + $this->_template_args['question'] = $question; |
|
413 | + $this->_template_args['question_types'] = $question_types; |
|
414 | + $this->_template_args['max_max'] = EEM_Question::instance()->absolute_max_for_system_question($question->system_ID()); |
|
415 | 415 | $this->_template_args['question_type_descriptions'] = $this->_get_question_type_descriptions(); |
416 | - $this->_set_publish_post_box_vars( 'id', $ID ); |
|
417 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_TEMPLATE_PATH . 'questions_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
416 | + $this->_set_publish_post_box_vars('id', $ID); |
|
417 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_TEMPLATE_PATH.'questions_main_meta_box.template.php', $this->_template_args, TRUE); |
|
418 | 418 | |
419 | 419 | // the details template wrapper |
420 | 420 | $this->display_admin_page_with_sidebar(); |
@@ -429,18 +429,18 @@ discard block |
||
429 | 429 | EE_Registry::instance()->load_helper('HTML'); |
430 | 430 | $descriptions = ''; |
431 | 431 | $question_type_descriptions = EEM_Question::instance()->question_descriptions(); |
432 | - foreach ( $question_type_descriptions as $type => $question_type_description ) { |
|
433 | - if ( $type == 'HTML_TEXTAREA' ) { |
|
432 | + foreach ($question_type_descriptions as $type => $question_type_description) { |
|
433 | + if ($type == 'HTML_TEXTAREA') { |
|
434 | 434 | $html = new EE_Simple_HTML_Validation_Strategy(); |
435 | 435 | $question_type_description .= sprintf( |
436 | - __( '%1$s(allowed tags: %2$s)', 'event_espresso' ), |
|
436 | + __('%1$s(allowed tags: %2$s)', 'event_espresso'), |
|
437 | 437 | '<br/>', |
438 | 438 | $html->get_list_of_allowed_tags() |
439 | 439 | ); |
440 | 440 | } |
441 | 441 | $descriptions .= EEH_HTML::p( |
442 | 442 | $question_type_description, |
443 | - 'question_type_description-' . $type, |
|
443 | + 'question_type_description-'.$type, |
|
444 | 444 | 'question_type_description description', |
445 | 445 | 'display:none;' |
446 | 446 | ); |
@@ -454,58 +454,58 @@ discard block |
||
454 | 454 | * @param bool|true $new_question |
455 | 455 | * @throws \EE_Error |
456 | 456 | */ |
457 | - protected function _insert_or_update_question( $new_question = TRUE) { |
|
458 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
459 | - $set_column_values=$this->_set_column_values_for($this->_question_model); |
|
460 | - if($new_question){ |
|
461 | - $ID=$this->_question_model->insert($set_column_values); |
|
457 | + protected function _insert_or_update_question($new_question = TRUE) { |
|
458 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
459 | + $set_column_values = $this->_set_column_values_for($this->_question_model); |
|
460 | + if ($new_question) { |
|
461 | + $ID = $this->_question_model->insert($set_column_values); |
|
462 | 462 | $success = $ID ? true : false; |
463 | 463 | $action_desc = 'added'; |
464 | - }else{ |
|
465 | - $ID=absint($this->_req_data['QST_ID']); |
|
466 | - $pk=$this->_question_model->primary_key_name(); |
|
467 | - $wheres=array($pk=>$ID); |
|
464 | + } else { |
|
465 | + $ID = absint($this->_req_data['QST_ID']); |
|
466 | + $pk = $this->_question_model->primary_key_name(); |
|
467 | + $wheres = array($pk=>$ID); |
|
468 | 468 | unset($set_column_values[$pk]); |
469 | - $success= $this->_question_model->update($set_column_values,array($wheres)); |
|
470 | - $action_desc='updated'; |
|
469 | + $success = $this->_question_model->update($set_column_values, array($wheres)); |
|
470 | + $action_desc = 'updated'; |
|
471 | 471 | } |
472 | 472 | |
473 | - if ($ID){ |
|
473 | + if ($ID) { |
|
474 | 474 | //save the related options |
475 | 475 | //trash removed options, save old ones |
476 | 476 | //get list of all options |
477 | 477 | /** @type EE_Question $question */ |
478 | - $question=$this->_question_model->get_one_by_ID($ID); |
|
479 | - $options=$question->options(); |
|
480 | - if(! empty($options)){ |
|
481 | - foreach($options as $option_ID=>$option){ |
|
482 | - $option_req_index=$this->_get_option_req_data_index($option_ID); |
|
483 | - if($option_req_index!==FALSE){ |
|
478 | + $question = $this->_question_model->get_one_by_ID($ID); |
|
479 | + $options = $question->options(); |
|
480 | + if ( ! empty($options)) { |
|
481 | + foreach ($options as $option_ID=>$option) { |
|
482 | + $option_req_index = $this->_get_option_req_data_index($option_ID); |
|
483 | + if ($option_req_index !== FALSE) { |
|
484 | 484 | $option->save($this->_req_data['question_options'][$option_req_index]); |
485 | - }else{ |
|
485 | + } else { |
|
486 | 486 | //not found, remove it |
487 | 487 | $option->delete(); |
488 | 488 | } |
489 | 489 | } |
490 | 490 | } |
491 | 491 | //save new related options |
492 | - foreach($this->_req_data['question_options'] as $index=>$option_req_data){ |
|
493 | - if( empty($option_req_data['QSO_ID'] ) && ( ( isset( $option_req_data['QSO_value'] ) && $option_req_data['QSO_value'] !== '' ) || ! empty( $option_req_data['QSO_desc'] ) ) ) {//no ID! save it! |
|
494 | - if( ! isset( $option_req_data['QSO_value'] ) || $option_req_data['QSO_value'] === '' ){ |
|
495 | - $option_req_data['QSO_value']=$option_req_data['QSO_desc']; |
|
492 | + foreach ($this->_req_data['question_options'] as $index=>$option_req_data) { |
|
493 | + if (empty($option_req_data['QSO_ID']) && ((isset($option_req_data['QSO_value']) && $option_req_data['QSO_value'] !== '') || ! empty($option_req_data['QSO_desc']))) {//no ID! save it! |
|
494 | + if ( ! isset($option_req_data['QSO_value']) || $option_req_data['QSO_value'] === '') { |
|
495 | + $option_req_data['QSO_value'] = $option_req_data['QSO_desc']; |
|
496 | 496 | } |
497 | - $new_option=EE_Question_Option::new_instance( array( 'QSO_value' => $option_req_data['QSO_value'], 'QSO_desc' => $option_req_data['QSO_desc'], 'QSO_order' => $option_req_data['QSO_order'], 'QST_ID' => $question->ID())); |
|
497 | + $new_option = EE_Question_Option::new_instance(array('QSO_value' => $option_req_data['QSO_value'], 'QSO_desc' => $option_req_data['QSO_desc'], 'QSO_order' => $option_req_data['QSO_order'], 'QST_ID' => $question->ID())); |
|
498 | 498 | $new_option->save(); |
499 | 499 | } |
500 | 500 | } |
501 | 501 | } |
502 | - $query_args = array( 'action' => 'edit_question', 'QST_ID' => $ID ); |
|
503 | - if ( $success !== FALSE ) { |
|
504 | - $msg = $new_question ? sprintf( __('The %s has been created', 'event_espresso'), $this->_question_model->item_name() ) : sprintf( __('The %s has been updated', 'event_espresso' ), $this->_question_model->item_name() ); |
|
505 | - EE_Error::add_success( $msg ); |
|
502 | + $query_args = array('action' => 'edit_question', 'QST_ID' => $ID); |
|
503 | + if ($success !== FALSE) { |
|
504 | + $msg = $new_question ? sprintf(__('The %s has been created', 'event_espresso'), $this->_question_model->item_name()) : sprintf(__('The %s has been updated', 'event_espresso'), $this->_question_model->item_name()); |
|
505 | + EE_Error::add_success($msg); |
|
506 | 506 | } |
507 | 507 | |
508 | - $this->_redirect_after_action( FALSE, '', $action_desc, $query_args, TRUE); |
|
508 | + $this->_redirect_after_action(FALSE, '', $action_desc, $query_args, TRUE); |
|
509 | 509 | } |
510 | 510 | |
511 | 511 | |
@@ -518,10 +518,10 @@ discard block |
||
518 | 518 | * @param int $ID of the question option to find |
519 | 519 | * @return int index in question_options array if successful, FALSE if unsuccessful |
520 | 520 | */ |
521 | - protected function _get_option_req_data_index($ID){ |
|
522 | - $req_data_for_question_options=$this->_req_data['question_options']; |
|
523 | - foreach($req_data_for_question_options as $num=>$option_data){ |
|
524 | - if( array_key_exists('QSO_ID',$option_data) && (int)$option_data['QSO_ID'] === $ID ){ |
|
521 | + protected function _get_option_req_data_index($ID) { |
|
522 | + $req_data_for_question_options = $this->_req_data['question_options']; |
|
523 | + foreach ($req_data_for_question_options as $num=>$option_data) { |
|
524 | + if (array_key_exists('QSO_ID', $option_data) && (int) $option_data['QSO_ID'] === $ID) { |
|
525 | 525 | return $num; |
526 | 526 | } |
527 | 527 | } |
@@ -543,25 +543,25 @@ discard block |
||
543 | 543 | * @param int $current_page |
544 | 544 | * @return array lik EEM_Base::get_all's $query_params parameter |
545 | 545 | */ |
546 | - protected function get_query_params($model, $per_page=10,$current_page=10){ |
|
546 | + protected function get_query_params($model, $per_page = 10, $current_page = 10) { |
|
547 | 547 | $query_params = array(); |
548 | - $offset=($current_page-1)*$per_page; |
|
549 | - $query_params['limit']=array($offset,$per_page); |
|
550 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
548 | + $offset = ($current_page - 1) * $per_page; |
|
549 | + $query_params['limit'] = array($offset, $per_page); |
|
550 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
551 | 551 | $orderby_field = $model instanceof EEM_Question ? 'QST_ID' : 'QSG_order'; |
552 | 552 | $field_to_order_by = empty($this->_req_data['orderby']) ? $orderby_field : $this->_req_data['orderby']; |
553 | - $query_params['order_by']=array( $field_to_order_by => $order ); |
|
554 | - $search_string = array_key_exists('s',$this->_req_data) ? $this->_req_data['s'] : null; |
|
555 | - if(! empty($search_string)){ |
|
556 | - if($model instanceof EEM_Question_Group){ |
|
557 | - $query_params[0]=array( |
|
553 | + $query_params['order_by'] = array($field_to_order_by => $order); |
|
554 | + $search_string = array_key_exists('s', $this->_req_data) ? $this->_req_data['s'] : null; |
|
555 | + if ( ! empty($search_string)) { |
|
556 | + if ($model instanceof EEM_Question_Group) { |
|
557 | + $query_params[0] = array( |
|
558 | 558 | 'OR'=>array( |
559 | - 'QSG_name'=>array('LIKE',"%$search_string%"), |
|
560 | - 'QSG_desc'=>array('LIKE',"%$search_string%")) |
|
559 | + 'QSG_name'=>array('LIKE', "%$search_string%"), |
|
560 | + 'QSG_desc'=>array('LIKE', "%$search_string%")) |
|
561 | 561 | ); |
562 | - }else{ |
|
563 | - $query_params[0]=array( |
|
564 | - 'QST_display_text'=>array('LIKE',"%$search_string%") |
|
562 | + } else { |
|
563 | + $query_params[0] = array( |
|
564 | + 'QST_display_text'=>array('LIKE', "%$search_string%") |
|
565 | 565 | ); |
566 | 566 | } |
567 | 567 | } |
@@ -609,13 +609,13 @@ discard block |
||
609 | 609 | * @param bool|false $count |
610 | 610 | * @return \EE_Soft_Delete_Base_Class[]|int |
611 | 611 | */ |
612 | - public function get_questions( $per_page=10, $current_page = 1, $count = FALSE ) { |
|
612 | + public function get_questions($per_page = 10, $current_page = 1, $count = FALSE) { |
|
613 | 613 | $QST = EEM_Question::instance(); |
614 | 614 | $query_params = $this->get_query_params($QST, $per_page, $current_page); |
615 | - if ($count){ |
|
616 | - $where = isset( $query_params[0] ) ? array( $query_params[0] ) : array(); |
|
615 | + if ($count) { |
|
616 | + $where = isset($query_params[0]) ? array($query_params[0]) : array(); |
|
617 | 617 | $results = $QST->count($where); |
618 | - }else{ |
|
618 | + } else { |
|
619 | 619 | $results = $QST->get_all($query_params); |
620 | 620 | } |
621 | 621 | return $results; |
@@ -630,10 +630,10 @@ discard block |
||
630 | 630 | * @param bool|false $count |
631 | 631 | * @return \EE_Soft_Delete_Base_Class[]|int |
632 | 632 | */ |
633 | - public function get_trashed_questions( $per_page, $current_page = 1, $count = FALSE ) { |
|
634 | - $query_params =$this->get_query_params( EEM_Question::instance(), $per_page, $current_page); |
|
635 | - $where = isset( $query_params[0] ) ? array($query_params[0]) : array(); |
|
636 | - $questions =$count ? EEM_Question::instance()->count_deleted($where) : EEM_Question::instance()->get_all_deleted($query_params); |
|
633 | + public function get_trashed_questions($per_page, $current_page = 1, $count = FALSE) { |
|
634 | + $query_params = $this->get_query_params(EEM_Question::instance(), $per_page, $current_page); |
|
635 | + $where = isset($query_params[0]) ? array($query_params[0]) : array(); |
|
636 | + $questions = $count ? EEM_Question::instance()->count_deleted($where) : EEM_Question::instance()->get_all_deleted($query_params); |
|
637 | 637 | return $questions; |
638 | 638 | } |
639 | 639 | |
@@ -645,12 +645,12 @@ discard block |
||
645 | 645 | * @param bool|false $count |
646 | 646 | * @return \EE_Soft_Delete_Base_Class[] |
647 | 647 | */ |
648 | - public function get_question_groups( $per_page, $current_page = 1, $count = FALSE ) { |
|
648 | + public function get_question_groups($per_page, $current_page = 1, $count = FALSE) { |
|
649 | 649 | /** @type EEM_Question_Group $questionGroupModel */ |
650 | 650 | $questionGroupModel = EEM_Question_Group::instance(); |
651 | 651 | //note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items |
652 | 652 | return $questionGroupModel->get_all( |
653 | - $this->get_query_params( $questionGroupModel, $per_page, $current_page ) |
|
653 | + $this->get_query_params($questionGroupModel, $per_page, $current_page) |
|
654 | 654 | ); |
655 | 655 | } |
656 | 656 | |
@@ -667,36 +667,36 @@ discard block |
||
667 | 667 | |
668 | 668 | $this->_template_args['values'] = $this->_yes_no_values; |
669 | 669 | |
670 | - $this->_template_args['use_captcha'] = isset( EE_Registry::instance()->CFG->registration->use_captcha ) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE; |
|
671 | - $this->_template_args['show_captcha_settings'] = $this->_template_args['use_captcha'] ? 'style="display:table-row;"': ''; |
|
670 | + $this->_template_args['use_captcha'] = isset(EE_Registry::instance()->CFG->registration->use_captcha) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE; |
|
671 | + $this->_template_args['show_captcha_settings'] = $this->_template_args['use_captcha'] ? 'style="display:table-row;"' : ''; |
|
672 | 672 | |
673 | - $this->_template_args['recaptcha_publickey'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) : ''; |
|
674 | - $this->_template_args['recaptcha_privatekey'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) : ''; |
|
675 | - $this->_template_args['recaptcha_width'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_width ) ? absint( EE_Registry::instance()->CFG->registration->recaptcha_width ) : 500; |
|
673 | + $this->_template_args['recaptcha_publickey'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_publickey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_publickey) : ''; |
|
674 | + $this->_template_args['recaptcha_privatekey'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) : ''; |
|
675 | + $this->_template_args['recaptcha_width'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_width) ? absint(EE_Registry::instance()->CFG->registration->recaptcha_width) : 500; |
|
676 | 676 | |
677 | 677 | $this->_template_args['recaptcha_theme_options'] = array( |
678 | - array('id' => 'red','text'=> __('Red', 'event_espresso')), |
|
679 | - array('id' => 'white','text'=> __('White', 'event_espresso')), |
|
680 | - array('id' => 'blackglass','text'=> __('Blackglass', 'event_espresso')), |
|
681 | - array('id' => 'clean','text'=> __('Clean', 'event_espresso')) |
|
678 | + array('id' => 'red', 'text'=> __('Red', 'event_espresso')), |
|
679 | + array('id' => 'white', 'text'=> __('White', 'event_espresso')), |
|
680 | + array('id' => 'blackglass', 'text'=> __('Blackglass', 'event_espresso')), |
|
681 | + array('id' => 'clean', 'text'=> __('Clean', 'event_espresso')) |
|
682 | 682 | ); |
683 | - $this->_template_args['recaptcha_theme'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_theme ) ? EE_Registry::instance()->CFG->registration->get_pretty( 'recaptcha_theme' ) : 'clean'; |
|
683 | + $this->_template_args['recaptcha_theme'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_theme) ? EE_Registry::instance()->CFG->registration->get_pretty('recaptcha_theme') : 'clean'; |
|
684 | 684 | |
685 | 685 | $this->_template_args['recaptcha_language_options'] = array( |
686 | - array('id' => 'en','text'=> __('English', 'event_espresso')), |
|
687 | - array('id' => 'es','text'=> __('Spanish', 'event_espresso')), |
|
688 | - array('id' => 'nl','text'=> __('Dutch', 'event_espresso')), |
|
689 | - array('id' => 'fr','text'=> __('French', 'event_espresso')), |
|
690 | - array('id' => 'de','text'=> __('German', 'event_espresso')), |
|
691 | - array('id' => 'pt','text'=> __('Portuguese', 'event_espresso')), |
|
692 | - array('id' => 'ru','text'=> __('Russian', 'event_espresso')), |
|
693 | - array('id' => 'tr','text'=> __('Turkish', 'event_espresso')) |
|
686 | + array('id' => 'en', 'text'=> __('English', 'event_espresso')), |
|
687 | + array('id' => 'es', 'text'=> __('Spanish', 'event_espresso')), |
|
688 | + array('id' => 'nl', 'text'=> __('Dutch', 'event_espresso')), |
|
689 | + array('id' => 'fr', 'text'=> __('French', 'event_espresso')), |
|
690 | + array('id' => 'de', 'text'=> __('German', 'event_espresso')), |
|
691 | + array('id' => 'pt', 'text'=> __('Portuguese', 'event_espresso')), |
|
692 | + array('id' => 'ru', 'text'=> __('Russian', 'event_espresso')), |
|
693 | + array('id' => 'tr', 'text'=> __('Turkish', 'event_espresso')) |
|
694 | 694 | ); |
695 | - $this->_template_args['recaptcha_language'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_language ) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en'; |
|
695 | + $this->_template_args['recaptcha_language'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_language) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en'; |
|
696 | 696 | |
697 | - $this->_set_add_edit_form_tags( 'update_reg_form_settings' ); |
|
698 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
699 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_TEMPLATE_PATH . 'reg_form_settings.template.php', $this->_template_args, TRUE ); |
|
697 | + $this->_set_add_edit_form_tags('update_reg_form_settings'); |
|
698 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
699 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_TEMPLATE_PATH.'reg_form_settings.template.php', $this->_template_args, TRUE); |
|
700 | 700 | $this->display_admin_page_with_sidebar(); |
701 | 701 | } |
702 | 702 |
@@ -3,15 +3,15 @@ |
||
3 | 3 | <?php _e('This page shows options for Email Validation, the EE "Bot Trap" and reCAPTCHA which can help prevent SPAM registrations on your site.', 'event_espresso'); ?> |
4 | 4 | </p> |
5 | 5 | <div id="email_validation_info"> |
6 | -<p><strong><?php _e('Email Validation', 'event_espresso');?></strong></p> |
|
6 | +<p><strong><?php _e('Email Validation', 'event_espresso'); ?></strong></p> |
|
7 | 7 | <p><?php _e("Validating an email address is extremely difficult to do correctly. Your server's configuration, as well as your own tolerances and needs, can affect the type of validation needed. We offer different types of validation so that you can control how strict your registration form responds to entered email addresses. If you are receiving too many bogus email addresses, then you can try the WordPress Default validation setting. If you find that the form validation is blocking a valid email address you can try the Basic setting, or if available, the International validation settings.", 'event_espresso'); ?> |
8 | 8 | </p> |
9 | -<p><strong><?php _e('Validation Options:', 'event_espresso' );?></strong></p> |
|
9 | +<p><strong><?php _e('Validation Options:', 'event_espresso'); ?></strong></p> |
|
10 | 10 | <ul> |
11 | 11 | <li> |
12 | 12 | <?php _e('"Basic" - only checks that an email address follows the most basic structure guidelines ( ie: [email protected] ). Will work with the widest range of email addresses but will also allow the most garbage through.', 'event_espresso'); ?></li> |
13 | 13 | <li> |
14 | - <?php _e('"WordPress Default" - uses built in WordPress email validation, but does not support unicode characters (ie: international characters from non-latin based languages).','event_espresso'); ?></li> |
|
14 | + <?php _e('"WordPress Default" - uses built in WordPress email validation, but does not support unicode characters (ie: international characters from non-latin based languages).', 'event_espresso'); ?></li> |
|
15 | 15 | <li> |
16 | 16 | <?php _e('"International" - supports unicode characters but may not be supported by all server configurations. Try this first if you need to international language support, but drop back down to "Basic" if your server configuration conflicts.', 'event_espresso'); ?> |
17 | 17 | </li> |