@@ -1,6 +1,7 @@ |
||
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 | * EE_Form_Section_HTML |
6 | 7 | * HTML to be laid out like a proper subsection |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | if( $all_ints ){ |
109 | 109 | $normalization = new EE_Int_Normalization(); |
110 | - }else{ |
|
110 | + } else{ |
|
111 | 111 | $normalization = new EE_Text_Normalization(); |
112 | 112 | } |
113 | 113 | } |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | foreach( $unnormalized_value_choices as $unnormalized_value_choice ){ |
259 | 259 | if( isset( $options[ $unnormalized_value_choice ] ) ){ |
260 | 260 | $pretty_strings[] = $options[ $unnormalized_value_choice ]; |
261 | - }else{ |
|
261 | + } else{ |
|
262 | 262 | $pretty_strings[] = $this->normalized_value(); |
263 | 263 | } |
264 | 264 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @subpackage |
8 | 8 | * @author Mike Nelson |
9 | 9 | */ |
10 | -class EE_Form_Input_With_Options_Base extends EE_Form_Input_Base{ |
|
10 | +class EE_Form_Input_With_Options_Base extends EE_Form_Input_Base { |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * array of available options to choose as an answer |
@@ -57,18 +57,18 @@ discard block |
||
57 | 57 | * } |
58 | 58 | * And all the options accepted by EE_Form_Input_Base |
59 | 59 | */ |
60 | - public function __construct( $answer_options = array(), $input_settings = array() ) { |
|
61 | - if ( isset( $input_settings['label_size'] )) { |
|
62 | - $this->_set_label_size( $input_settings['label_size'] ); |
|
63 | - if ( isset( $input_settings['enforce_label_size'] ) && $input_settings['enforce_label_size'] ) { |
|
60 | + public function __construct($answer_options = array(), $input_settings = array()) { |
|
61 | + if (isset($input_settings['label_size'])) { |
|
62 | + $this->_set_label_size($input_settings['label_size']); |
|
63 | + if (isset($input_settings['enforce_label_size']) && $input_settings['enforce_label_size']) { |
|
64 | 64 | $this->_enforce_label_size = TRUE; |
65 | 65 | } |
66 | 66 | } |
67 | - if ( isset( $input_settings['display_html_label_text'] )) { |
|
68 | - $this->set_display_html_label_text( $input_settings['display_html_label_text'] ); |
|
67 | + if (isset($input_settings['display_html_label_text'])) { |
|
68 | + $this->set_display_html_label_text($input_settings['display_html_label_text']); |
|
69 | 69 | } |
70 | - $this->set_select_options( $answer_options ); |
|
71 | - parent::__construct( $input_settings ); |
|
70 | + $this->set_select_options($answer_options); |
|
71 | + parent::__construct($input_settings); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -79,47 +79,47 @@ discard block |
||
79 | 79 | * @param array $answer_options |
80 | 80 | * @return void just has the side-effect of setting the options for this input |
81 | 81 | */ |
82 | - public function set_select_options( $answer_options = array() ){ |
|
83 | - $answer_options = is_array( $answer_options ) ? $answer_options : array( $answer_options ); |
|
82 | + public function set_select_options($answer_options = array()) { |
|
83 | + $answer_options = is_array($answer_options) ? $answer_options : array($answer_options); |
|
84 | 84 | //get the first item in the select options and check it's type |
85 | - if ( reset( $answer_options ) instanceof EE_Question_Option ) { |
|
86 | - $this->_options = $this->_process_question_options( $answer_options ); |
|
85 | + if (reset($answer_options) instanceof EE_Question_Option) { |
|
86 | + $this->_options = $this->_process_question_options($answer_options); |
|
87 | 87 | } else { |
88 | 88 | $this->_options = $answer_options; |
89 | 89 | } |
90 | 90 | //d( $this->_options ); |
91 | - $select_option_keys = array_keys( $this->_options ); |
|
91 | + $select_option_keys = array_keys($this->_options); |
|
92 | 92 | // attempt to determine data type for values in order to set normalization type |
93 | 93 | if ( |
94 | - count( $this->_options ) == 2 |
|
94 | + count($this->_options) == 2 |
|
95 | 95 | && |
96 | 96 | ( |
97 | - ( in_array( TRUE, $select_option_keys, true ) && in_array( FALSE, $select_option_keys, true )) |
|
98 | - || ( in_array( 1, $select_option_keys, true ) && in_array( 0, $select_option_keys, true )) |
|
97 | + (in_array(TRUE, $select_option_keys, true) && in_array(FALSE, $select_option_keys, true)) |
|
98 | + || (in_array(1, $select_option_keys, true) && in_array(0, $select_option_keys, true)) |
|
99 | 99 | ) |
100 | - ){ |
|
100 | + ) { |
|
101 | 101 | // values appear to be boolean, like TRUE, FALSE, 1, 0 |
102 | 102 | $normalization = new EE_Boolean_Normalization(); |
103 | - } else{ |
|
103 | + } else { |
|
104 | 104 | //are ALL the options ints? If so use int validation |
105 | 105 | $all_ints = true; |
106 | - foreach($select_option_keys as $value ){ |
|
107 | - if( ! is_int( $value ) ){ |
|
106 | + foreach ($select_option_keys as $value) { |
|
107 | + if ( ! is_int($value)) { |
|
108 | 108 | $all_ints = false; |
109 | 109 | break; |
110 | 110 | } |
111 | 111 | } |
112 | - if( $all_ints ){ |
|
112 | + if ($all_ints) { |
|
113 | 113 | $normalization = new EE_Int_Normalization(); |
114 | - }else{ |
|
114 | + } else { |
|
115 | 115 | $normalization = new EE_Text_Normalization(); |
116 | 116 | } |
117 | 117 | } |
118 | 118 | // does input type have multiple options ? |
119 | - if ( $this->_multiple_selections ) { |
|
120 | - $this->_set_normalization_strategy( new EE_Many_Valued_Normalization( $normalization )); |
|
119 | + if ($this->_multiple_selections) { |
|
120 | + $this->_set_normalization_strategy(new EE_Many_Valued_Normalization($normalization)); |
|
121 | 121 | } else { |
122 | - $this->_set_normalization_strategy( $normalization ); |
|
122 | + $this->_set_normalization_strategy($normalization); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | /** |
129 | 129 | * @return array |
130 | 130 | */ |
131 | - public function options(){ |
|
131 | + public function options() { |
|
132 | 132 | return $this->_options; |
133 | 133 | } |
134 | 134 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * Returns an array which is guaranteed to not be multidimensional |
139 | 139 | * @return array |
140 | 140 | */ |
141 | - public function flat_options(){ |
|
141 | + public function flat_options() { |
|
142 | 142 | return $this->_flatten_select_options($this->options()); |
143 | 143 | } |
144 | 144 | |
@@ -149,19 +149,19 @@ discard block |
||
149 | 149 | * @param array $arr |
150 | 150 | * @return array |
151 | 151 | */ |
152 | - protected function _flatten_select_options( $arr ){ |
|
152 | + protected function _flatten_select_options($arr) { |
|
153 | 153 | $flat_array = array(); |
154 | - if ( EEH_Array::is_multi_dimensional_array( $arr )) { |
|
155 | - foreach( $arr as $sub_array ){ |
|
156 | - foreach( $sub_array as $key => $value ) { |
|
157 | - $flat_array[ $key ] = $value; |
|
158 | - $this->_set_label_size( $value ); |
|
154 | + if (EEH_Array::is_multi_dimensional_array($arr)) { |
|
155 | + foreach ($arr as $sub_array) { |
|
156 | + foreach ($sub_array as $key => $value) { |
|
157 | + $flat_array[$key] = $value; |
|
158 | + $this->_set_label_size($value); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | } else { |
162 | - foreach( $arr as $key => $value ) { |
|
163 | - $flat_array[ $key ] = $value; |
|
164 | - $this->_set_label_size( $value ); |
|
162 | + foreach ($arr as $key => $value) { |
|
163 | + $flat_array[$key] = $value; |
|
164 | + $this->_set_label_size($value); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | return $flat_array; |
@@ -173,18 +173,18 @@ discard block |
||
173 | 173 | * @param EE_Question_Option[] $question_options_array |
174 | 174 | * @return array |
175 | 175 | */ |
176 | - protected function _process_question_options( $question_options_array = array() ) { |
|
176 | + protected function _process_question_options($question_options_array = array()) { |
|
177 | 177 | $flat_array = array(); |
178 | - foreach( $question_options_array as $question_option ) { |
|
179 | - if ( $question_option instanceof EE_Question_Option ) { |
|
178 | + foreach ($question_options_array as $question_option) { |
|
179 | + if ($question_option instanceof EE_Question_Option) { |
|
180 | 180 | $desc = ''; |
181 | - if ( $this->_use_desc_in_label ) { |
|
181 | + if ($this->_use_desc_in_label) { |
|
182 | 182 | $desc = $question_option->desc(); |
183 | - $desc = ! empty( $desc ) ? '<span class="ee-question-option-desc"> - ' . $desc . '</span>' : ''; |
|
183 | + $desc = ! empty($desc) ? '<span class="ee-question-option-desc"> - '.$desc.'</span>' : ''; |
|
184 | 184 | } |
185 | - $flat_array[ $question_option->value() ] = $question_option->value() . $desc; |
|
186 | - } elseif ( is_array( $question_option )) { |
|
187 | - $non_question_option = $this->_flatten_select_options( $question_option ); |
|
185 | + $flat_array[$question_option->value()] = $question_option->value().$desc; |
|
186 | + } elseif (is_array($question_option)) { |
|
187 | + $non_question_option = $this->_flatten_select_options($question_option); |
|
188 | 188 | $flat_array = $flat_array + $non_question_option; |
189 | 189 | } |
190 | 190 | } |
@@ -197,12 +197,12 @@ discard block |
||
197 | 197 | * set_label_sizes |
198 | 198 | * @return void |
199 | 199 | */ |
200 | - public function set_label_sizes(){ |
|
200 | + public function set_label_sizes() { |
|
201 | 201 | // did the input settings specifically say to NOT set the label size dynamically ? |
202 | - if ( ! $this->_enforce_label_size ) { |
|
203 | - foreach( $this->_options as $option ) { |
|
202 | + if ( ! $this->_enforce_label_size) { |
|
203 | + foreach ($this->_options as $option) { |
|
204 | 204 | // calculate the strlen of the label |
205 | - $this->_set_label_size( $option ); |
|
205 | + $this->_set_label_size($option); |
|
206 | 206 | } |
207 | 207 | } |
208 | 208 | } |
@@ -214,9 +214,9 @@ discard block |
||
214 | 214 | * @param int|string $value |
215 | 215 | * @return void |
216 | 216 | */ |
217 | - private function _set_label_size( $value = '' ){ |
|
217 | + private function _set_label_size($value = '') { |
|
218 | 218 | // determine length of option value |
219 | - $val_size = is_int( $value ) ? $value : strlen( $value ); |
|
219 | + $val_size = is_int($value) ? $value : strlen($value); |
|
220 | 220 | // use new value if bigger than existing |
221 | 221 | $this->_label_size = $val_size > $this->_label_size ? $val_size : $this->_label_size; |
222 | 222 | } |
@@ -227,22 +227,22 @@ discard block |
||
227 | 227 | * get_label_size_class |
228 | 228 | * @return string |
229 | 229 | */ |
230 | - function get_label_size_class(){ |
|
230 | + function get_label_size_class() { |
|
231 | 231 | // use maximum option value length to determine label size |
232 | - if( $this->_label_size < 3 ) { |
|
232 | + if ($this->_label_size < 3) { |
|
233 | 233 | $size = ' nano-lbl'; |
234 | - } else if ( $this->_label_size < 6 ) { |
|
235 | - $size = ' micro-lbl'; |
|
236 | - } else if ( $this->_label_size < 12 ) { |
|
237 | - $size = ' tiny-lbl'; |
|
238 | - } else if ( $this->_label_size < 25 ) { |
|
239 | - $size = ' small-lbl'; |
|
240 | - } else if ( $this->_label_size < 50 ) { |
|
241 | - $size = ' medium-lbl'; |
|
242 | - } else if ( $this->_label_size >= 100 ) { |
|
243 | - $size = ' big-lbl'; |
|
234 | + } else if ($this->_label_size < 6) { |
|
235 | + $size = ' micro-lbl'; |
|
236 | + } else if ($this->_label_size < 12) { |
|
237 | + $size = ' tiny-lbl'; |
|
238 | + } else if ($this->_label_size < 25) { |
|
239 | + $size = ' small-lbl'; |
|
240 | + } else if ($this->_label_size < 50) { |
|
241 | + $size = ' medium-lbl'; |
|
242 | + } else if ($this->_label_size >= 100) { |
|
243 | + $size = ' big-lbl'; |
|
244 | 244 | } else { |
245 | - $size = ' medium-lbl'; |
|
245 | + $size = ' medium-lbl'; |
|
246 | 246 | } |
247 | 247 | return $size; |
248 | 248 | } |
@@ -251,21 +251,21 @@ discard block |
||
251 | 251 | * Returns the pretty value for the normalized value |
252 | 252 | * @return string |
253 | 253 | */ |
254 | - function pretty_value(){ |
|
254 | + function pretty_value() { |
|
255 | 255 | $options = $this->flat_options(); |
256 | - $unnormalized_value_choices = $this->get_normalization_strategy()->unnormalize( $this->_normalized_value ); |
|
257 | - if( ! $this->_multiple_selections ){ |
|
258 | - $unnormalized_value_choices = array( $unnormalized_value_choices ); |
|
256 | + $unnormalized_value_choices = $this->get_normalization_strategy()->unnormalize($this->_normalized_value); |
|
257 | + if ( ! $this->_multiple_selections) { |
|
258 | + $unnormalized_value_choices = array($unnormalized_value_choices); |
|
259 | 259 | } |
260 | 260 | $pretty_strings = array(); |
261 | - foreach( $unnormalized_value_choices as $unnormalized_value_choice ){ |
|
262 | - if( isset( $options[ $unnormalized_value_choice ] ) ){ |
|
263 | - $pretty_strings[] = $options[ $unnormalized_value_choice ]; |
|
264 | - }else{ |
|
261 | + foreach ($unnormalized_value_choices as $unnormalized_value_choice) { |
|
262 | + if (isset($options[$unnormalized_value_choice])) { |
|
263 | + $pretty_strings[] = $options[$unnormalized_value_choice]; |
|
264 | + } else { |
|
265 | 265 | $pretty_strings[] = $this->normalized_value(); |
266 | 266 | } |
267 | 267 | } |
268 | - return implode(", ", $pretty_strings ); |
|
268 | + return implode(", ", $pretty_strings); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | |
@@ -282,8 +282,8 @@ discard block |
||
282 | 282 | /** |
283 | 283 | * @param boolean $display_html_label_text |
284 | 284 | */ |
285 | - public function set_display_html_label_text( $display_html_label_text ) { |
|
286 | - $this->_display_html_label_text = filter_var( $display_html_label_text, FILTER_VALIDATE_BOOLEAN ); |
|
285 | + public function set_display_html_label_text($display_html_label_text) { |
|
286 | + $this->_display_html_label_text = filter_var($display_html_label_text, FILTER_VALIDATE_BOOLEAN); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 |
@@ -70,7 +70,7 @@ |
||
70 | 70 | $results = wp_remote_head( $src ); |
71 | 71 | if( is_array( $results) && ! $results instanceof WP_Error){ |
72 | 72 | return strpos($results['headers']['content-type'], "image" ) !== FALSE; |
73 | - }else{ |
|
73 | + } else{ |
|
74 | 74 | return FALSE; |
75 | 75 | } |
76 | 76 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @since 4.6 |
9 | 9 | * |
10 | 10 | */ |
11 | -class EE_Admin_File_Uploader_Display_Strategy extends EE_Display_Strategy_Base{ |
|
11 | +class EE_Admin_File_Uploader_Display_Strategy extends EE_Display_Strategy_Base { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * return EE_Admin_File_Uploader_Display_Strategy |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | * Besides that, no special consideration should be required to make the media uploader appear, besides having |
30 | 30 | * this input displayed. |
31 | 31 | */ |
32 | - static function enqueue_scripts(){ |
|
32 | + static function enqueue_scripts() { |
|
33 | 33 | wp_enqueue_media(); |
34 | 34 | wp_enqueue_script('media-upload'); |
35 | - wp_enqueue_script('ee-payments',EE_GLOBAL_ASSETS_URL.'scripts/ee-media-uploader.js'); |
|
35 | + wp_enqueue_script('ee-payments', EE_GLOBAL_ASSETS_URL.'scripts/ee-media-uploader.js'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -42,19 +42,19 @@ discard block |
||
42 | 42 | * @return string of html to display the field |
43 | 43 | */ |
44 | 44 | |
45 | - function display(){ |
|
45 | + function display() { |
|
46 | 46 | // the actual input |
47 | 47 | $input = '<input type="text" size="34" '; |
48 | - $input .= 'name="' . $this->_input->html_name() . '" '; |
|
49 | - $input .= $this->_input->html_class() != '' ? 'class="large-text ee_media_url ' . $this->_input->html_class() . '" ' : 'class="large-text ee_media_url" '; |
|
50 | - $input .= 'value="' . $this->_input->raw_value_in_form() . '" '; |
|
51 | - $input .= $this->_input->other_html_attributes() . '>'; |
|
48 | + $input .= 'name="'.$this->_input->html_name().'" '; |
|
49 | + $input .= $this->_input->html_class() != '' ? 'class="large-text ee_media_url '.$this->_input->html_class().'" ' : 'class="large-text ee_media_url" '; |
|
50 | + $input .= 'value="'.$this->_input->raw_value_in_form().'" '; |
|
51 | + $input .= $this->_input->other_html_attributes().'>'; |
|
52 | 52 | // image uploader |
53 | - $uploader = EEH_HTML::link( '#', '<img src="' . admin_url( 'images/media-button-image.gif' ) . '" >', __( 'click to add an image', 'event_espresso' ), '', 'ee_media_upload' ); |
|
53 | + $uploader = EEH_HTML::link('#', '<img src="'.admin_url('images/media-button-image.gif').'" >', __('click to add an image', 'event_espresso'), '', 'ee_media_upload'); |
|
54 | 54 | //only attempt to show the image if it at least exists |
55 | - $image = $this->src_exists( $this->_input->raw_value() ) ? EEH_HTML::br(2) . EEH_HTML::img( $this->_input->raw_value(), __( 'logo', 'event_espresso' ), '', 'ee_media_image' ) : ''; |
|
55 | + $image = $this->src_exists($this->_input->raw_value()) ? EEH_HTML::br(2).EEH_HTML::img($this->_input->raw_value(), __('logo', 'event_espresso'), '', 'ee_media_image') : ''; |
|
56 | 56 | // html string |
57 | - return EEH_HTML::div( $input . EEH_HTML::nbsp() . $uploader . $image, '', 'ee_media_uploader_area' ); |
|
57 | + return EEH_HTML::div($input.EEH_HTML::nbsp().$uploader.$image, '', 'ee_media_uploader_area'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | * @param string $src |
66 | 66 | * @return boolean |
67 | 67 | */ |
68 | - protected function src_exists( $src ){ |
|
69 | - $results = wp_remote_head( $src ); |
|
70 | - if( is_array( $results) && ! $results instanceof WP_Error){ |
|
71 | - return strpos($results['headers']['content-type'], "image" ) !== FALSE; |
|
72 | - }else{ |
|
68 | + protected function src_exists($src) { |
|
69 | + $results = wp_remote_head($src); |
|
70 | + if (is_array($results) && ! $results instanceof WP_Error) { |
|
71 | + return strpos($results['headers']['content-type'], "image") !== FALSE; |
|
72 | + } else { |
|
73 | 73 | return FALSE; |
74 | 74 | } |
75 | 75 | } |
@@ -10,7 +10,7 @@ |
||
10 | 10 | if( $input instanceof EE_Text_Area_Input ) { |
11 | 11 | $rows = $input->get_rows(); |
12 | 12 | $cols = $input->get_cols(); |
13 | - }else{ |
|
13 | + } else{ |
|
14 | 14 | $rows = 4; |
15 | 15 | $cols = 20; |
16 | 16 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -class EE_Text_Area_Display_Strategy extends EE_Display_Strategy_Base{ |
|
2 | +class EE_Text_Area_Display_Strategy extends EE_Display_Strategy_Base { |
|
3 | 3 | |
4 | 4 | |
5 | 5 | |
@@ -7,32 +7,32 @@ discard block |
||
7 | 7 | * |
8 | 8 | * @return string of html to display the field |
9 | 9 | */ |
10 | - function display(){ |
|
10 | + function display() { |
|
11 | 11 | $input = $this->_input; |
12 | 12 | $raw_value = maybe_serialize($input->raw_value()); |
13 | - if( $input instanceof EE_Text_Area_Input ) { |
|
13 | + if ($input instanceof EE_Text_Area_Input) { |
|
14 | 14 | $rows = $input->get_rows(); |
15 | 15 | $cols = $input->get_cols(); |
16 | - }else{ |
|
16 | + } else { |
|
17 | 17 | $rows = 4; |
18 | 18 | $cols = 20; |
19 | 19 | } |
20 | 20 | $html = '<textarea'; |
21 | - $html .= ' id="' . $input->html_id() . '"'; |
|
22 | - $html .= ' name="' . $input->html_name() . '"'; |
|
23 | - $html .= ' class="' . $input->html_class() . '"' ; |
|
24 | - $html .= ' style="' . $input->html_style() . '"'; |
|
21 | + $html .= ' id="'.$input->html_id().'"'; |
|
22 | + $html .= ' name="'.$input->html_name().'"'; |
|
23 | + $html .= ' class="'.$input->html_class().'"'; |
|
24 | + $html .= ' style="'.$input->html_style().'"'; |
|
25 | 25 | $html .= $input->other_html_attributes(); |
26 | - $html .= ' rows= "' . $rows . '" cols="' . $cols . '">'; |
|
26 | + $html .= ' rows= "'.$rows.'" cols="'.$cols.'">'; |
|
27 | 27 | $html .= $raw_value; |
28 | 28 | $html .= '</textarea>'; |
29 | - foreach ( $this->_input->get_validation_strategies() as $validation_strategy ) { |
|
29 | + foreach ($this->_input->get_validation_strategies() as $validation_strategy) { |
|
30 | 30 | if ( |
31 | 31 | $validation_strategy instanceof EE_Simple_HTML_Validation_Strategy |
32 | 32 | || $validation_strategy instanceof EE_Full_HTML_Validation_Strategy |
33 | 33 | ) { |
34 | 34 | $html .= sprintf( |
35 | - __( '%1$s(allowed tags: %2$s)%3$s', 'event_espresso' ), |
|
35 | + __('%1$s(allowed tags: %2$s)%3$s', 'event_espresso'), |
|
36 | 36 | '<p class="ee-question-desc">', |
37 | 37 | $validation_strategy->get_list_of_allowed_tags(), |
38 | 38 | '</p>' |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Attendees shortcode class |
4 | 6 | * |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * @param WP $WP |
20 | 20 | * @return void |
21 | 21 | */ |
22 | - public function run( WP $WP ) {} |
|
22 | + public function run(WP $WP) {} |
|
23 | 23 | |
24 | 24 | |
25 | 25 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @param array $attributes |
70 | 70 | * @return string |
71 | 71 | */ |
72 | - public function process_shortcode( $attributes = array() ) { |
|
72 | + public function process_shortcode($attributes = array()) { |
|
73 | 73 | |
74 | 74 | //set default attributes |
75 | 75 | $default_shortcode_attributes = array( |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $default_shortcode_attributes |
87 | 87 | ); |
88 | 88 | // grab attributes and merge with defaults, then extract |
89 | - $attributes = array_merge( (array) $default_shortcode_attributes, (array) $attributes ); |
|
89 | + $attributes = array_merge((array) $default_shortcode_attributes, (array) $attributes); |
|
90 | 90 | |
91 | 91 | $template_args = array( |
92 | 92 | 'contacts' => array(), |
@@ -102,31 +102,31 @@ discard block |
||
102 | 102 | $error = false; |
103 | 103 | |
104 | 104 | //what event? |
105 | - if ( empty( $attributes['event_id'] ) && empty( $attributes['datetime_id'] ) && empty( $attributes['ticket_id'] ) ) { |
|
105 | + if (empty($attributes['event_id']) && empty($attributes['datetime_id']) && empty($attributes['ticket_id'])) { |
|
106 | 106 | //seems like is_espresso_event_single() isn't working as expected. So using alternate method. |
107 | - if ( is_single() && is_espresso_event() ) { |
|
107 | + if (is_single() && is_espresso_event()) { |
|
108 | 108 | $event = EEH_Event_View::get_event(); |
109 | - if ( $event instanceof EE_Event ) { |
|
109 | + if ($event instanceof EE_Event) { |
|
110 | 110 | $template_args['event'] = $event; |
111 | 111 | $query[0]['Registration.EVT_ID'] = $event->ID(); |
112 | 112 | } |
113 | 113 | } else { |
114 | 114 | //try getting the earliest active event if none then get the |
115 | - $events = EEM_Event::instance()->get_active_events( array( 'limit' => 1, |
|
116 | - 'order_by' => array( 'Datetime.DTT_EVT_start' => 'ASC' ) |
|
117 | - ) ); |
|
118 | - $events = empty( $events ) ? EEM_Event::instance()->get_upcoming_events( array( 'limit' => 1, |
|
119 | - 'order_by' => array( 'Datetime.DTT_EVT_start' => 'ASC' ) |
|
120 | - ) ) : $events; |
|
121 | - $event = reset( $events ); |
|
122 | - if ( $event instanceof EE_Event ) { |
|
115 | + $events = EEM_Event::instance()->get_active_events(array('limit' => 1, |
|
116 | + 'order_by' => array('Datetime.DTT_EVT_start' => 'ASC') |
|
117 | + )); |
|
118 | + $events = empty($events) ? EEM_Event::instance()->get_upcoming_events(array('limit' => 1, |
|
119 | + 'order_by' => array('Datetime.DTT_EVT_start' => 'ASC') |
|
120 | + )) : $events; |
|
121 | + $event = reset($events); |
|
122 | + if ($event instanceof EE_Event) { |
|
123 | 123 | $query[0]['Registration.EVT_ID'] = $event->ID(); |
124 | 124 | $template_args['event'] = $event; |
125 | 125 | } |
126 | 126 | } |
127 | - } elseif ( ! empty( $attributes['event_id'] ) ) { |
|
128 | - $event = EEM_Event::instance()->get_one_by_ID( $attributes['event_id'] ); |
|
129 | - if ( $event instanceof EE_Event ) { |
|
127 | + } elseif ( ! empty($attributes['event_id'])) { |
|
128 | + $event = EEM_Event::instance()->get_one_by_ID($attributes['event_id']); |
|
129 | + if ($event instanceof EE_Event) { |
|
130 | 130 | $query[0]['Registration.EVT_ID'] = $attributes['event_id']; |
131 | 131 | $template_args['event'] = $event; |
132 | 132 | } else { |
@@ -135,9 +135,9 @@ discard block |
||
135 | 135 | } |
136 | 136 | |
137 | 137 | //datetime? |
138 | - if ( ! empty( $attributes['datetime_id'] ) && empty( $attributes['event_id'] ) ) { |
|
139 | - $datetime = EEM_Datetime::instance()->get_one_by_ID( $attributes['datetime_id'] ); |
|
140 | - if ( $datetime instanceof EE_Datetime ) { |
|
138 | + if ( ! empty($attributes['datetime_id']) && empty($attributes['event_id'])) { |
|
139 | + $datetime = EEM_Datetime::instance()->get_one_by_ID($attributes['datetime_id']); |
|
140 | + if ($datetime instanceof EE_Datetime) { |
|
141 | 141 | $query[0]['Registration.Ticket.Datetime.DTT_ID'] = $attributes['datetime_id']; |
142 | 142 | $query['default_where_conditions'] = 'this_model_only'; |
143 | 143 | $template_args['datetime'] = $datetime; |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | //ticket?just |
151 | - if ( ! empty( $attributes['ticket_id'] ) && empty( $attributes['event_id'] ) && empty( $attributes['datetime_id'] ) ) { |
|
152 | - $ticket = EEM_Ticket::instance()->get_one_by_ID( $attributes['ticket_id'] ); |
|
153 | - if ( $ticket instanceof EE_Ticket ) { |
|
151 | + if ( ! empty($attributes['ticket_id']) && empty($attributes['event_id']) && empty($attributes['datetime_id'])) { |
|
152 | + $ticket = EEM_Ticket::instance()->get_one_by_ID($attributes['ticket_id']); |
|
153 | + if ($ticket instanceof EE_Ticket) { |
|
154 | 154 | $query[0]['Registration.TKT_ID'] = $attributes['ticket_id']; |
155 | 155 | $template_args['ticket'] = $ticket; |
156 | 156 | $template_args['event'] = $ticket->first_datetime() instanceof EE_Datetime ? $ticket->first_datetime()->event() : null; |
@@ -161,17 +161,17 @@ discard block |
||
161 | 161 | |
162 | 162 | //status |
163 | 163 | $reg_status_array = EEM_Registration::reg_status_array(); |
164 | - if ( $attributes['status'] != 'all' && isset( $reg_status_array[$attributes['status']] ) ) { |
|
164 | + if ($attributes['status'] != 'all' && isset($reg_status_array[$attributes['status']])) { |
|
165 | 165 | $query[0]['Registration.STS_ID'] = $attributes['status']; |
166 | 166 | } |
167 | - $query['group_by'] = array( 'ATT_ID' ); |
|
168 | - $query['order_by'] = apply_filters( 'FHEE__EES_Espresso_Event_Attendees__process_shortcode__order_by', array( 'ATT_lname' => 'ASC', 'ATT_fname' => 'ASC' ) ); |
|
167 | + $query['group_by'] = array('ATT_ID'); |
|
168 | + $query['order_by'] = apply_filters('FHEE__EES_Espresso_Event_Attendees__process_shortcode__order_by', array('ATT_lname' => 'ASC', 'ATT_fname' => 'ASC')); |
|
169 | 169 | |
170 | 170 | //if we have NO query where conditions, then there was an invalid parameter or the shortcode was used incorrectly |
171 | 171 | //so when WP_DEBUG is set and true, we'll show a message, otherwise we'll just return an empty string. |
172 | - if ( ( ! isset( $query[0] ) || ! is_array( $query[0] ) ) || $error ) { |
|
173 | - if ( WP_DEBUG ) { |
|
174 | - return '<div class="important-notice ee-attention">' . __( 'The [ESPRESSO_EVENT_ATTENDEES] shortcode has been used incorrectly. Please double check the arguments you used for any typos. In the case of ID type arguments, its possible the given ID does not correspond to existing data in the database.', 'event_espresso' ) . '</div>'; |
|
172 | + if (( ! isset($query[0]) || ! is_array($query[0])) || $error) { |
|
173 | + if (WP_DEBUG) { |
|
174 | + return '<div class="important-notice ee-attention">'.__('The [ESPRESSO_EVENT_ATTENDEES] shortcode has been used incorrectly. Please double check the arguments you used for any typos. In the case of ID type arguments, its possible the given ID does not correspond to existing data in the database.', 'event_espresso').'</div>'; |
|
175 | 175 | } else { |
176 | 176 | return ''; |
177 | 177 | } |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | |
180 | 180 | |
181 | 181 | //get contacts! |
182 | - $template_args['contacts'] = EEM_Attendee::instance()->get_all( $query ); |
|
182 | + $template_args['contacts'] = EEM_Attendee::instance()->get_all($query); |
|
183 | 183 | |
184 | 184 | |
185 | 185 | //all set let's load up the template and return. |
186 | - return EEH_Template::locate_template( 'loop-espresso_event_attendees.php', $template_args, true, true ); |
|
186 | + return EEH_Template::locate_template('loop-espresso_event_attendees.php', $template_args, true, true); |
|
187 | 187 | |
188 | 188 | } |
189 | 189 |
@@ -113,10 +113,10 @@ |
||
113 | 113 | } else { |
114 | 114 | //try getting the earliest active event if none then get the |
115 | 115 | $events = EEM_Event::instance()->get_active_events( array( 'limit' => 1, |
116 | - 'order_by' => array( 'Datetime.DTT_EVT_start' => 'ASC' ) |
|
116 | + 'order_by' => array( 'Datetime.DTT_EVT_start' => 'ASC' ) |
|
117 | 117 | ) ); |
118 | 118 | $events = empty( $events ) ? EEM_Event::instance()->get_upcoming_events( array( 'limit' => 1, |
119 | - 'order_by' => array( 'Datetime.DTT_EVT_start' => 'ASC' ) |
|
119 | + 'order_by' => array( 'Datetime.DTT_EVT_start' => 'ASC' ) |
|
120 | 120 | ) ) : $events; |
121 | 121 | $event = reset( $events ); |
122 | 122 | if ( $event instanceof EE_Event ) { |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | * update_espresso_config |
374 | 374 | * |
375 | 375 | * @access public |
376 | - * @return bool |
|
376 | + * @return boolean|null |
|
377 | 377 | */ |
378 | 378 | protected function _reset_espresso_addon_config() { |
379 | 379 | $this->_addon_option_names = array(); |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | * @param string $name |
460 | 460 | * @param string $config_class |
461 | 461 | * @param EE_Config_Base $config_obj |
462 | - * @param array $tests_to_run |
|
462 | + * @param integer[] $tests_to_run |
|
463 | 463 | * @param bool $display_errors |
464 | 464 | * @return bool TRUE on success, FALSE on fail |
465 | 465 | */ |
@@ -1736,7 +1736,7 @@ discard block |
||
1736 | 1736 | |
1737 | 1737 | |
1738 | 1738 | /** |
1739 | - * @return array |
|
1739 | + * @return integer[] |
|
1740 | 1740 | */ |
1741 | 1741 | public function get_critical_pages_array() { |
1742 | 1742 | return array( |
@@ -1750,7 +1750,7 @@ discard block |
||
1750 | 1750 | |
1751 | 1751 | |
1752 | 1752 | /** |
1753 | - * @return array |
|
1753 | + * @return string[] |
|
1754 | 1754 | */ |
1755 | 1755 | public function get_critical_pages_shortcodes_array() { |
1756 | 1756 | return array( |
@@ -2785,7 +2785,7 @@ discard block |
||
2785 | 2785 | * according to max_input_vars |
2786 | 2786 | * |
2787 | 2787 | * @param int $input_count the count of input vars. |
2788 | - * @return array { |
|
2788 | + * @return string { |
|
2789 | 2789 | * An array that represents whether available space and if no available space the error |
2790 | 2790 | * message. |
2791 | 2791 | * @type bool $has_space whether more inputs can be added. |
@@ -2105,7 +2105,7 @@ discard block |
||
2105 | 2105 | public function __construct( $CNT_ISO = '' ) { |
2106 | 2106 | // get country code from organization settings or use default |
2107 | 2107 | $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) |
2108 | - && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
|
2108 | + && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
|
2109 | 2109 | ? EE_Registry::instance()->CFG->organization->CNT_ISO |
2110 | 2110 | : ''; |
2111 | 2111 | // but override if requested |
@@ -2794,8 +2794,8 @@ discard block |
||
2794 | 2794 | */ |
2795 | 2795 | public function max_input_vars_limit_check( $input_count = 0 ) { |
2796 | 2796 | if ( ! empty( $this->php->max_input_vars ) |
2797 | - && ( $input_count >= $this->php->max_input_vars ) |
|
2798 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2797 | + && ( $input_count >= $this->php->max_input_vars ) |
|
2798 | + && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2799 | 2799 | ) { |
2800 | 2800 | return sprintf( |
2801 | 2801 | __( |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public static function instance() { |
123 | 123 | // check if class object is instantiated, and instantiated properly |
124 | - if ( ! self::$_instance instanceof EE_Config ) { |
|
124 | + if ( ! self::$_instance instanceof EE_Config) { |
|
125 | 125 | self::$_instance = new self(); |
126 | 126 | } |
127 | 127 | return self::$_instance; |
@@ -141,20 +141,20 @@ discard block |
||
141 | 141 | * site was put into maintenance mode) |
142 | 142 | * @return EE_Config |
143 | 143 | */ |
144 | - public static function reset( $hard_reset = false, $reinstantiate = true ) { |
|
145 | - if ( $hard_reset ) { |
|
144 | + public static function reset($hard_reset = false, $reinstantiate = true) { |
|
145 | + if ($hard_reset) { |
|
146 | 146 | self::$_instance->_addon_option_names = array(); |
147 | 147 | self::$_instance->_initialize_config(); |
148 | 148 | self::$_instance->update_espresso_config(); |
149 | 149 | } |
150 | - if ( self::$_instance instanceof EE_Config ) { |
|
150 | + if (self::$_instance instanceof EE_Config) { |
|
151 | 151 | self::$_instance->update_addon_option_names(); |
152 | 152 | } |
153 | 153 | self::$_instance = null; |
154 | 154 | //we don't need to reset the static properties imo because those should |
155 | 155 | //only change when a module is added or removed. Currently we don't |
156 | 156 | //support removing a module during a request when it previously existed |
157 | - if ( $reinstantiate ) { |
|
157 | + if ($reinstantiate) { |
|
158 | 158 | return self::instance(); |
159 | 159 | } else { |
160 | 160 | return null; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @return \EE_Config |
171 | 171 | */ |
172 | 172 | private function __construct() { |
173 | - do_action( 'AHEE__EE_Config__construct__begin', $this ); |
|
173 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
174 | 174 | // setup empty config classes |
175 | 175 | $this->_initialize_config(); |
176 | 176 | // load existing EE site settings |
@@ -180,17 +180,17 @@ discard block |
||
180 | 180 | // register shortcodes and modules |
181 | 181 | add_action( |
182 | 182 | 'AHEE__EE_System__register_shortcodes_modules_and_widgets', |
183 | - array( $this, 'register_shortcodes_and_modules' ), |
|
183 | + array($this, 'register_shortcodes_and_modules'), |
|
184 | 184 | 999 |
185 | 185 | ); |
186 | 186 | // initialize shortcodes and modules |
187 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' ) ); |
|
187 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
188 | 188 | // register widgets |
189 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
189 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
190 | 190 | // shutdown |
191 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
191 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
192 | 192 | // construct__end hook |
193 | - do_action( 'AHEE__EE_Config__construct__end', $this ); |
|
193 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
194 | 194 | // hardcoded hack |
195 | 195 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
196 | 196 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @return string current theme set. |
204 | 204 | */ |
205 | 205 | public static function get_current_theme() { |
206 | - return isset( self::$_instance->template_settings->current_espresso_theme ) |
|
206 | + return isset(self::$_instance->template_settings->current_espresso_theme) |
|
207 | 207 | ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
208 | 208 | } |
209 | 209 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | private function _initialize_config() { |
219 | 219 | EE_Config::trim_log(); |
220 | 220 | //set defaults |
221 | - $this->_addon_option_names = get_option( EE_Config::ADDON_OPTION_NAMES, array() ); |
|
221 | + $this->_addon_option_names = get_option(EE_Config::ADDON_OPTION_NAMES, array()); |
|
222 | 222 | $this->addons = new stdClass(); |
223 | 223 | // set _module_route_map |
224 | 224 | EE_Config::$_module_route_map = array(); |
@@ -238,9 +238,9 @@ discard block |
||
238 | 238 | */ |
239 | 239 | private function _load_core_config() { |
240 | 240 | // load_core_config__start hook |
241 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
241 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
242 | 242 | $espresso_config = $this->get_espresso_config(); |
243 | - foreach ( $espresso_config as $config => $settings ) { |
|
243 | + foreach ($espresso_config as $config => $settings) { |
|
244 | 244 | // load_core_config__start hook |
245 | 245 | $settings = apply_filters( |
246 | 246 | 'FHEE__EE_Config___load_core_config__config_settings', |
@@ -248,22 +248,22 @@ discard block |
||
248 | 248 | $config, |
249 | 249 | $this |
250 | 250 | ); |
251 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
252 | - $this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
251 | + if (is_object($settings) && property_exists($this, $config)) { |
|
252 | + $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
253 | 253 | //call configs populate method to ensure any defaults are set for empty values. |
254 | - if ( method_exists( $settings, 'populate' ) ) { |
|
254 | + if (method_exists($settings, 'populate')) { |
|
255 | 255 | $this->{$config}->populate(); |
256 | 256 | } |
257 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
257 | + if (method_exists($settings, 'do_hooks')) { |
|
258 | 258 | $this->{$config}->do_hooks(); |
259 | 259 | } |
260 | 260 | } |
261 | 261 | } |
262 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', false ) ) { |
|
262 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', false)) { |
|
263 | 263 | $this->update_espresso_config(); |
264 | 264 | } |
265 | 265 | // load_core_config__end hook |
266 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
266 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
@@ -278,23 +278,23 @@ discard block |
||
278 | 278 | $this->core = $this->core instanceof EE_Core_Config |
279 | 279 | ? $this->core |
280 | 280 | : new EE_Core_Config(); |
281 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
281 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
282 | 282 | $this->organization = $this->organization instanceof EE_Organization_Config |
283 | 283 | ? $this->organization |
284 | 284 | : new EE_Organization_Config(); |
285 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
285 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
286 | 286 | $this->currency = $this->currency instanceof EE_Currency_Config |
287 | 287 | ? $this->currency |
288 | 288 | : new EE_Currency_Config(); |
289 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
289 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
290 | 290 | $this->registration = $this->registration instanceof EE_Registration_Config |
291 | 291 | ? $this->registration |
292 | 292 | : new EE_Registration_Config(); |
293 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
293 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
294 | 294 | $this->admin = $this->admin instanceof EE_Admin_Config |
295 | 295 | ? $this->admin |
296 | 296 | : new EE_Admin_Config(); |
297 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
297 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
298 | 298 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
299 | 299 | ? $this->template_settings |
300 | 300 | : new EE_Template_Config(); |
@@ -305,15 +305,15 @@ discard block |
||
305 | 305 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
306 | 306 | ? $this->map_settings |
307 | 307 | : new EE_Map_Config(); |
308 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
308 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
309 | 309 | $this->environment = $this->environment instanceof EE_Environment_Config |
310 | 310 | ? $this->environment |
311 | 311 | : new EE_Environment_Config(); |
312 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
312 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
313 | 313 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
314 | 314 | ? $this->gateway |
315 | 315 | : new EE_Gateway_Config(); |
316 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
316 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | // grab espresso configuration |
329 | 329 | return apply_filters( |
330 | 330 | 'FHEE__EE_Config__get_espresso_config__CFG', |
331 | - get_option( EE_Config::OPTION_NAME, array() ) |
|
331 | + get_option(EE_Config::OPTION_NAME, array()) |
|
332 | 332 | ); |
333 | 333 | } |
334 | 334 | |
@@ -342,12 +342,12 @@ discard block |
||
342 | 342 | * @param $old_value |
343 | 343 | * @param $value |
344 | 344 | */ |
345 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
345 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
346 | 346 | // make sure we're checking the ee config |
347 | - if ( $option === EE_Config::OPTION_NAME ) { |
|
347 | + if ($option === EE_Config::OPTION_NAME) { |
|
348 | 348 | // run a loose comparison of the old value against the new value for type and properties, |
349 | 349 | // but NOT exact instance like WP update_option does (ie: NOT type safe comparison) |
350 | - if ( $value != $old_value ) { |
|
350 | + if ($value != $old_value) { |
|
351 | 351 | // if they are NOT the same, then remove the hook, |
352 | 352 | // which means the subsequent update results will be based solely on the update query results |
353 | 353 | // the reason we do this is because, as stated above, |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | // the string it sees in the db looks the same as the new one it has been passed!!! |
363 | 363 | // This results in the query returning an "affected rows" value of ZERO, |
364 | 364 | // which gets returned immediately by WP update_option and looks like an error. |
365 | - remove_action( 'update_option', array( $this, 'check_config_updated' ) ); |
|
365 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
366 | 366 | } |
367 | 367 | } |
368 | 368 | } |
@@ -377,11 +377,11 @@ discard block |
||
377 | 377 | */ |
378 | 378 | protected function _reset_espresso_addon_config() { |
379 | 379 | $this->_addon_option_names = array(); |
380 | - foreach ( $this->addons as $addon_name => $addon_config_obj ) { |
|
381 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
382 | - $config_class = get_class( $addon_config_obj ); |
|
383 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
384 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, false ); |
|
380 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
381 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
382 | + $config_class = get_class($addon_config_obj); |
|
383 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
384 | + $this->update_config('addons', $addon_name, $addon_config_obj, false); |
|
385 | 385 | } |
386 | 386 | $this->addons->{$addon_name} = null; |
387 | 387 | } |
@@ -397,22 +397,22 @@ discard block |
||
397 | 397 | * @param bool $add_error |
398 | 398 | * @return bool |
399 | 399 | */ |
400 | - public function update_espresso_config( $add_success = false, $add_error = true ) { |
|
400 | + public function update_espresso_config($add_success = false, $add_error = true) { |
|
401 | 401 | // don't allow config updates during WP heartbeats |
402 | - if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) { |
|
402 | + if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') { |
|
403 | 403 | return false; |
404 | 404 | } |
405 | 405 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
406 | 406 | //$clone = clone( self::$_instance ); |
407 | 407 | //self::$_instance = NULL; |
408 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin', $this ); |
|
408 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
409 | 409 | $this->_reset_espresso_addon_config(); |
410 | 410 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
411 | 411 | // but BEFORE the actual update occurs |
412 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
412 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
413 | 413 | // now update "ee_config" |
414 | - $saved = update_option( EE_Config::OPTION_NAME, $this ); |
|
415 | - EE_Config::log( EE_Config::OPTION_NAME ); |
|
414 | + $saved = update_option(EE_Config::OPTION_NAME, $this); |
|
415 | + EE_Config::log(EE_Config::OPTION_NAME); |
|
416 | 416 | // if not saved... check if the hook we just added still exists; |
417 | 417 | // if it does, it means one of two things: |
418 | 418 | // that update_option bailed at the ( $value === $old_value ) conditional, |
@@ -423,17 +423,17 @@ discard block |
||
423 | 423 | // but just means no update occurred, so don't display an error to the user. |
424 | 424 | // BUT... if update_option returns FALSE, AND the hook is missing, |
425 | 425 | // then it means that something truly went wrong |
426 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' ) ) : $saved; |
|
426 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
427 | 427 | // remove our action since we don't want it in the system anymore |
428 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
429 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
428 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
429 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
430 | 430 | //self::$_instance = $clone; |
431 | 431 | //unset( $clone ); |
432 | 432 | // if config remains the same or was updated successfully |
433 | - if ( $saved ) { |
|
434 | - if ( $add_success ) { |
|
433 | + if ($saved) { |
|
434 | + if ($add_success) { |
|
435 | 435 | EE_Error::add_success( |
436 | - __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), |
|
436 | + __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
437 | 437 | __FILE__, |
438 | 438 | __FUNCTION__, |
439 | 439 | __LINE__ |
@@ -441,9 +441,9 @@ discard block |
||
441 | 441 | } |
442 | 442 | return true; |
443 | 443 | } else { |
444 | - if ( $add_error ) { |
|
444 | + if ($add_error) { |
|
445 | 445 | EE_Error::add_error( |
446 | - __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), |
|
446 | + __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
447 | 447 | __FILE__, |
448 | 448 | __FUNCTION__, |
449 | 449 | __LINE__ |
@@ -472,16 +472,16 @@ discard block |
||
472 | 472 | $name = '', |
473 | 473 | $config_class = '', |
474 | 474 | $config_obj = null, |
475 | - $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), |
|
475 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
476 | 476 | $display_errors = true |
477 | 477 | ) { |
478 | 478 | try { |
479 | - foreach ( $tests_to_run as $test ) { |
|
480 | - switch ( $test ) { |
|
479 | + foreach ($tests_to_run as $test) { |
|
480 | + switch ($test) { |
|
481 | 481 | // TEST #1 : check that section was set |
482 | 482 | case 1 : |
483 | - if ( empty( $section ) ) { |
|
484 | - if ( $display_errors ) { |
|
483 | + if (empty($section)) { |
|
484 | + if ($display_errors) { |
|
485 | 485 | throw new EE_Error( |
486 | 486 | sprintf( |
487 | 487 | __( |
@@ -497,11 +497,11 @@ discard block |
||
497 | 497 | break; |
498 | 498 | // TEST #2 : check that settings section exists |
499 | 499 | case 2 : |
500 | - if ( ! isset( $this->{$section} ) ) { |
|
501 | - if ( $display_errors ) { |
|
500 | + if ( ! isset($this->{$section} )) { |
|
501 | + if ($display_errors) { |
|
502 | 502 | throw new EE_Error( |
503 | 503 | sprintf( |
504 | - __( 'The "%s" configuration section does not exist.', 'event_espresso' ), |
|
504 | + __('The "%s" configuration section does not exist.', 'event_espresso'), |
|
505 | 505 | $section |
506 | 506 | ) |
507 | 507 | ); |
@@ -512,9 +512,9 @@ discard block |
||
512 | 512 | // TEST #3 : check that section is the proper format |
513 | 513 | case 3 : |
514 | 514 | if ( |
515 | - ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass ) |
|
515 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
516 | 516 | ) { |
517 | - if ( $display_errors ) { |
|
517 | + if ($display_errors) { |
|
518 | 518 | throw new EE_Error( |
519 | 519 | sprintf( |
520 | 520 | __( |
@@ -530,8 +530,8 @@ discard block |
||
530 | 530 | break; |
531 | 531 | // TEST #4 : check that config section name has been set |
532 | 532 | case 4 : |
533 | - if ( empty( $name ) ) { |
|
534 | - if ( $display_errors ) { |
|
533 | + if (empty($name)) { |
|
534 | + if ($display_errors) { |
|
535 | 535 | throw new EE_Error( |
536 | 536 | __( |
537 | 537 | 'No name has been provided for the specific configuration section.', |
@@ -544,8 +544,8 @@ discard block |
||
544 | 544 | break; |
545 | 545 | // TEST #5 : check that a config class name has been set |
546 | 546 | case 5 : |
547 | - if ( empty( $config_class ) ) { |
|
548 | - if ( $display_errors ) { |
|
547 | + if (empty($config_class)) { |
|
548 | + if ($display_errors) { |
|
549 | 549 | throw new EE_Error( |
550 | 550 | __( |
551 | 551 | 'No class name has been provided for the specific configuration section.', |
@@ -558,8 +558,8 @@ discard block |
||
558 | 558 | break; |
559 | 559 | // TEST #6 : verify config class is accessible |
560 | 560 | case 6 : |
561 | - if ( ! class_exists( $config_class ) ) { |
|
562 | - if ( $display_errors ) { |
|
561 | + if ( ! class_exists($config_class)) { |
|
562 | + if ($display_errors) { |
|
563 | 563 | throw new EE_Error( |
564 | 564 | sprintf( |
565 | 565 | __( |
@@ -575,11 +575,11 @@ discard block |
||
575 | 575 | break; |
576 | 576 | // TEST #7 : check that config has even been set |
577 | 577 | case 7 : |
578 | - if ( ! isset( $this->{$section}->{$name} ) ) { |
|
579 | - if ( $display_errors ) { |
|
578 | + if ( ! isset($this->{$section}->{$name} )) { |
|
579 | + if ($display_errors) { |
|
580 | 580 | throw new EE_Error( |
581 | 581 | sprintf( |
582 | - __( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ), |
|
582 | + __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
583 | 583 | $section, |
584 | 584 | $name |
585 | 585 | ) |
@@ -588,13 +588,13 @@ discard block |
||
588 | 588 | return false; |
589 | 589 | } else { |
590 | 590 | // and make sure it's not serialized |
591 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
591 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
592 | 592 | } |
593 | 593 | break; |
594 | 594 | // TEST #8 : check that config is the requested type |
595 | 595 | case 8 : |
596 | - if ( ! $this->{$section}->{$name} instanceof $config_class ) { |
|
597 | - if ( $display_errors ) { |
|
596 | + if ( ! $this->{$section}->{$name} instanceof $config_class) { |
|
597 | + if ($display_errors) { |
|
598 | 598 | throw new EE_Error( |
599 | 599 | sprintf( |
600 | 600 | __( |
@@ -612,12 +612,12 @@ discard block |
||
612 | 612 | break; |
613 | 613 | // TEST #9 : verify config object |
614 | 614 | case 9 : |
615 | - if ( ! $config_obj instanceof EE_Config_Base ) { |
|
616 | - if ( $display_errors ) { |
|
615 | + if ( ! $config_obj instanceof EE_Config_Base) { |
|
616 | + if ($display_errors) { |
|
617 | 617 | throw new EE_Error( |
618 | 618 | sprintf( |
619 | - __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), |
|
620 | - print_r( $config_obj, true ) |
|
619 | + __('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
620 | + print_r($config_obj, true) |
|
621 | 621 | ) |
622 | 622 | ); |
623 | 623 | } |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | break; |
627 | 627 | } |
628 | 628 | } |
629 | - } catch ( EE_Error $e ) { |
|
629 | + } catch (EE_Error $e) { |
|
630 | 630 | $e->get_error(); |
631 | 631 | } |
632 | 632 | // you have successfully run the gauntlet |
@@ -643,8 +643,8 @@ discard block |
||
643 | 643 | * @param string $name |
644 | 644 | * @return string |
645 | 645 | */ |
646 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
647 | - return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) ); |
|
646 | + private function _generate_config_option_name($section = '', $name = '') { |
|
647 | + return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name)); |
|
648 | 648 | } |
649 | 649 | |
650 | 650 | |
@@ -658,10 +658,10 @@ discard block |
||
658 | 658 | * @param string $name |
659 | 659 | * @return string |
660 | 660 | */ |
661 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
662 | - return ! empty( $config_class ) |
|
661 | + private function _set_config_class($config_class = '', $name = '') { |
|
662 | + return ! empty($config_class) |
|
663 | 663 | ? $config_class |
664 | - : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config'; |
|
664 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
665 | 665 | } |
666 | 666 | |
667 | 667 | |
@@ -676,36 +676,36 @@ discard block |
||
676 | 676 | * @param EE_Config_Base $config_obj |
677 | 677 | * @return EE_Config_Base |
678 | 678 | */ |
679 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) { |
|
679 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) { |
|
680 | 680 | // ensure config class is set to something |
681 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
681 | + $config_class = $this->_set_config_class($config_class, $name); |
|
682 | 682 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
683 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
683 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
684 | 684 | return null; |
685 | 685 | } |
686 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
686 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
687 | 687 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
688 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
689 | - $this->_addon_option_names[ $config_option_name ] = $config_class; |
|
688 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
689 | + $this->_addon_option_names[$config_option_name] = $config_class; |
|
690 | 690 | $this->update_addon_option_names(); |
691 | 691 | } |
692 | 692 | // verify the incoming config object but suppress errors |
693 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
693 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
694 | 694 | $config_obj = new $config_class(); |
695 | 695 | } |
696 | - if ( get_option( $config_option_name ) ) { |
|
697 | - EE_Config::log( $config_option_name ); |
|
698 | - update_option( $config_option_name, $config_obj ); |
|
696 | + if (get_option($config_option_name)) { |
|
697 | + EE_Config::log($config_option_name); |
|
698 | + update_option($config_option_name, $config_obj); |
|
699 | 699 | $this->{$section}->{$name} = $config_obj; |
700 | 700 | return $this->{$section}->{$name}; |
701 | 701 | } else { |
702 | 702 | // create a wp-option for this config |
703 | - if ( add_option( $config_option_name, $config_obj, '', 'no' ) ) { |
|
704 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
703 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
704 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
705 | 705 | return $this->{$section}->{$name}; |
706 | 706 | } else { |
707 | 707 | EE_Error::add_error( |
708 | - sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), |
|
708 | + sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
709 | 709 | __FILE__, |
710 | 710 | __FUNCTION__, |
711 | 711 | __LINE__ |
@@ -728,44 +728,44 @@ discard block |
||
728 | 728 | * @param bool $throw_errors |
729 | 729 | * @return bool |
730 | 730 | */ |
731 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) { |
|
731 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) { |
|
732 | 732 | // don't allow config updates during WP heartbeats |
733 | - if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) { |
|
733 | + if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') { |
|
734 | 734 | return false; |
735 | 735 | } |
736 | - $config_obj = maybe_unserialize( $config_obj ); |
|
736 | + $config_obj = maybe_unserialize($config_obj); |
|
737 | 737 | // get class name of the incoming object |
738 | - $config_class = get_class( $config_obj ); |
|
738 | + $config_class = get_class($config_obj); |
|
739 | 739 | // run tests 1-5 and 9 to verify config |
740 | 740 | if ( ! $this->_verify_config_params( |
741 | 741 | $section, |
742 | 742 | $name, |
743 | 743 | $config_class, |
744 | 744 | $config_obj, |
745 | - array( 1, 2, 3, 4, 7, 9 ) |
|
745 | + array(1, 2, 3, 4, 7, 9) |
|
746 | 746 | ) |
747 | 747 | ) { |
748 | 748 | return false; |
749 | 749 | } |
750 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
750 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
751 | 751 | // check if config object has been added to db by seeing if config option name is in $this->_addon_option_names array |
752 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
752 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
753 | 753 | // save new config to db |
754 | - return $this->set_config( $section, $name, $config_class, $config_obj ); |
|
754 | + return $this->set_config($section, $name, $config_class, $config_obj); |
|
755 | 755 | } else { |
756 | 756 | // first check if the record already exists |
757 | - $existing_config = get_option( $config_option_name ); |
|
758 | - $config_obj = serialize( $config_obj ); |
|
757 | + $existing_config = get_option($config_option_name); |
|
758 | + $config_obj = serialize($config_obj); |
|
759 | 759 | // just return if db record is already up to date (NOT type safe comparison) |
760 | - if ( $existing_config == $config_obj ) { |
|
760 | + if ($existing_config == $config_obj) { |
|
761 | 761 | $this->{$section}->{$name} = $config_obj; |
762 | 762 | return true; |
763 | - } else if ( update_option( $config_option_name, $config_obj ) ) { |
|
764 | - EE_Config::log( $config_option_name ); |
|
763 | + } else if (update_option($config_option_name, $config_obj)) { |
|
764 | + EE_Config::log($config_option_name); |
|
765 | 765 | // update wp-option for this config class |
766 | 766 | $this->{$section}->{$name} = $config_obj; |
767 | 767 | return true; |
768 | - } elseif ( $throw_errors ) { |
|
768 | + } elseif ($throw_errors) { |
|
769 | 769 | EE_Error::add_error( |
770 | 770 | sprintf( |
771 | 771 | __( |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | 'event_espresso' |
774 | 774 | ), |
775 | 775 | $config_class, |
776 | - 'EE_Config->' . $section . '->' . $name |
|
776 | + 'EE_Config->'.$section.'->'.$name |
|
777 | 777 | ), |
778 | 778 | __FILE__, |
779 | 779 | __FUNCTION__, |
@@ -795,34 +795,34 @@ discard block |
||
795 | 795 | * @param string $config_class |
796 | 796 | * @return mixed EE_Config_Base | NULL |
797 | 797 | */ |
798 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
798 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
799 | 799 | // ensure config class is set to something |
800 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
800 | + $config_class = $this->_set_config_class($config_class, $name); |
|
801 | 801 | // run tests 1-4, 6 and 7 to verify that all params have been set |
802 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
802 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
803 | 803 | return null; |
804 | 804 | } |
805 | 805 | // now test if the requested config object exists, but suppress errors |
806 | - if ( $this->_verify_config_params( $section, $name, $config_class, null, array( 7, 8 ), false ) ) { |
|
806 | + if ($this->_verify_config_params($section, $name, $config_class, null, array(7, 8), false)) { |
|
807 | 807 | // config already exists, so pass it back |
808 | 808 | return $this->{$section}->{$name}; |
809 | 809 | } |
810 | 810 | // load config option from db if it exists |
811 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name ) ); |
|
811 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
812 | 812 | // verify the newly retrieved config object, but suppress errors |
813 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
813 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
814 | 814 | // config is good, so set it and pass it back |
815 | 815 | $this->{$section}->{$name} = $config_obj; |
816 | 816 | return $this->{$section}->{$name}; |
817 | 817 | } |
818 | 818 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
819 | - $config_obj = $this->set_config( $section, $name, $config_class ); |
|
819 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
820 | 820 | // verify the newly created config object |
821 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ) ) ) { |
|
821 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
822 | 822 | return $this->{$section}->{$name}; |
823 | 823 | } else { |
824 | 824 | EE_Error::add_error( |
825 | - sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), |
|
825 | + sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
826 | 826 | __FILE__, |
827 | 827 | __FUNCTION__, |
828 | 828 | __LINE__ |
@@ -840,11 +840,11 @@ discard block |
||
840 | 840 | * @param string $config_option_name |
841 | 841 | * @return mixed EE_Config_Base | FALSE |
842 | 842 | */ |
843 | - public function get_config_option( $config_option_name = '' ) { |
|
843 | + public function get_config_option($config_option_name = '') { |
|
844 | 844 | // retrieve the wp-option for this config class. |
845 | - $config_option = maybe_unserialize( get_option( $config_option_name, array() ) ); |
|
846 | - if ( empty( $config_option ) ) { |
|
847 | - EE_Config::log( $config_option_name . '-NOT-FOUND' ); |
|
845 | + $config_option = maybe_unserialize(get_option($config_option_name, array())); |
|
846 | + if (empty($config_option)) { |
|
847 | + EE_Config::log($config_option_name.'-NOT-FOUND'); |
|
848 | 848 | } |
849 | 849 | return $config_option; |
850 | 850 | } |
@@ -856,17 +856,17 @@ discard block |
||
856 | 856 | * |
857 | 857 | * @param string $config_option_name |
858 | 858 | */ |
859 | - public static function log( $config_option_name = '' ) { |
|
860 | - if ( ! empty( $config_option_name ) ) { |
|
861 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
859 | + public static function log($config_option_name = '') { |
|
860 | + if ( ! empty($config_option_name)) { |
|
861 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
862 | 862 | //copy incoming $_REQUEST and sanitize it so we can save it |
863 | 863 | $_request = $_REQUEST; |
864 | - array_walk_recursive( $_request, 'sanitize_text_field' ); |
|
865 | - $config_log[ (string) microtime( true ) ] = array( |
|
864 | + array_walk_recursive($_request, 'sanitize_text_field'); |
|
865 | + $config_log[(string) microtime(true)] = array( |
|
866 | 866 | 'config_name' => $config_option_name, |
867 | 867 | 'request' => $_request, |
868 | 868 | ); |
869 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
869 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
870 | 870 | } |
871 | 871 | } |
872 | 872 | |
@@ -877,12 +877,12 @@ discard block |
||
877 | 877 | * reduces the size of the config log to the length specified by EE_Config::LOG_LENGTH |
878 | 878 | */ |
879 | 879 | public static function trim_log() { |
880 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
881 | - $log_length = count( $config_log ); |
|
882 | - if ( $log_length > EE_Config::LOG_LENGTH ) { |
|
883 | - ksort( $config_log ); |
|
884 | - $config_log = array_slice( $config_log, $log_length - EE_Config::LOG_LENGTH, null, true ); |
|
885 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
880 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
881 | + $log_length = count($config_log); |
|
882 | + if ($log_length > EE_Config::LOG_LENGTH) { |
|
883 | + ksort($config_log); |
|
884 | + $config_log = array_slice($config_log, $log_length - EE_Config::LOG_LENGTH, null, true); |
|
885 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
886 | 886 | } |
887 | 887 | } |
888 | 888 | |
@@ -897,14 +897,14 @@ discard block |
||
897 | 897 | * @return string |
898 | 898 | */ |
899 | 899 | public static function get_page_for_posts() { |
900 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
901 | - if ( ! $page_for_posts ) { |
|
900 | + $page_for_posts = get_option('page_for_posts'); |
|
901 | + if ( ! $page_for_posts) { |
|
902 | 902 | return 'posts'; |
903 | 903 | } |
904 | 904 | /** @type WPDB $wpdb */ |
905 | 905 | global $wpdb; |
906 | 906 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
907 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts ) ); |
|
907 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
908 | 908 | } |
909 | 909 | |
910 | 910 | |
@@ -960,17 +960,17 @@ discard block |
||
960 | 960 | ) |
961 | 961 | ) { |
962 | 962 | // grab list of installed widgets |
963 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
963 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
964 | 964 | // filter list of modules to register |
965 | 965 | $widgets_to_register = apply_filters( |
966 | 966 | 'FHEE__EE_Config__register_widgets__widgets_to_register', |
967 | 967 | $widgets_to_register |
968 | 968 | ); |
969 | - if ( ! empty( $widgets_to_register ) ) { |
|
969 | + if ( ! empty($widgets_to_register)) { |
|
970 | 970 | // cycle thru widget folders |
971 | - foreach ( $widgets_to_register as $widget_path ) { |
|
971 | + foreach ($widgets_to_register as $widget_path) { |
|
972 | 972 | // add to list of installed widget modules |
973 | - EE_Config::register_ee_widget( $widget_path ); |
|
973 | + EE_Config::register_ee_widget($widget_path); |
|
974 | 974 | } |
975 | 975 | } |
976 | 976 | // filter list of installed modules |
@@ -990,57 +990,57 @@ discard block |
||
990 | 990 | * @param string $widget_path - full path up to and including widget folder |
991 | 991 | * @return void |
992 | 992 | */ |
993 | - public static function register_ee_widget( $widget_path = null ) { |
|
994 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
993 | + public static function register_ee_widget($widget_path = null) { |
|
994 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
995 | 995 | $widget_ext = '.widget.php'; |
996 | 996 | // make all separators match |
997 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
997 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
998 | 998 | // does the file path INCLUDE the actual file name as part of the path ? |
999 | - if ( strpos( $widget_path, $widget_ext ) !== false ) { |
|
999 | + if (strpos($widget_path, $widget_ext) !== false) { |
|
1000 | 1000 | // grab and shortcode file name from directory name and break apart at dots |
1001 | - $file_name = explode( '.', basename( $widget_path ) ); |
|
1001 | + $file_name = explode('.', basename($widget_path)); |
|
1002 | 1002 | // take first segment from file name pieces and remove class prefix if it exists |
1003 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
1003 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
1004 | 1004 | // sanitize shortcode directory name |
1005 | - $widget = sanitize_key( $widget ); |
|
1005 | + $widget = sanitize_key($widget); |
|
1006 | 1006 | // now we need to rebuild the shortcode path |
1007 | - $widget_path = explode( DS, $widget_path ); |
|
1007 | + $widget_path = explode(DS, $widget_path); |
|
1008 | 1008 | // remove last segment |
1009 | - array_pop( $widget_path ); |
|
1009 | + array_pop($widget_path); |
|
1010 | 1010 | // glue it back together |
1011 | - $widget_path = implode( DS, $widget_path ); |
|
1011 | + $widget_path = implode(DS, $widget_path); |
|
1012 | 1012 | } else { |
1013 | 1013 | // grab and sanitize widget directory name |
1014 | - $widget = sanitize_key( basename( $widget_path ) ); |
|
1014 | + $widget = sanitize_key(basename($widget_path)); |
|
1015 | 1015 | } |
1016 | 1016 | // create classname from widget directory name |
1017 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ) ) ); |
|
1017 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
1018 | 1018 | // add class prefix |
1019 | - $widget_class = 'EEW_' . $widget; |
|
1019 | + $widget_class = 'EEW_'.$widget; |
|
1020 | 1020 | // does the widget exist ? |
1021 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext ) ) { |
|
1021 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
1022 | 1022 | $msg = sprintf( |
1023 | 1023 | __( |
1024 | 1024 | 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', |
1025 | 1025 | 'event_espresso' |
1026 | 1026 | ), |
1027 | 1027 | $widget_class, |
1028 | - $widget_path . DS . $widget_class . $widget_ext |
|
1028 | + $widget_path.DS.$widget_class.$widget_ext |
|
1029 | 1029 | ); |
1030 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1030 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1031 | 1031 | return; |
1032 | 1032 | } |
1033 | 1033 | // load the widget class file |
1034 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
1034 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
1035 | 1035 | // verify that class exists |
1036 | - if ( ! class_exists( $widget_class ) ) { |
|
1037 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
1038 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1036 | + if ( ! class_exists($widget_class)) { |
|
1037 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
1038 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1039 | 1039 | return; |
1040 | 1040 | } |
1041 | - register_widget( $widget_class ); |
|
1041 | + register_widget($widget_class); |
|
1042 | 1042 | // add to array of registered widgets |
1043 | - EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext; |
|
1043 | + EE_Registry::instance()->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext; |
|
1044 | 1044 | } |
1045 | 1045 | |
1046 | 1046 | |
@@ -1053,17 +1053,17 @@ discard block |
||
1053 | 1053 | */ |
1054 | 1054 | private function _register_shortcodes() { |
1055 | 1055 | // grab list of installed shortcodes |
1056 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
1056 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
1057 | 1057 | // filter list of modules to register |
1058 | 1058 | $shortcodes_to_register = apply_filters( |
1059 | 1059 | 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', |
1060 | 1060 | $shortcodes_to_register |
1061 | 1061 | ); |
1062 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
1062 | + if ( ! empty($shortcodes_to_register)) { |
|
1063 | 1063 | // cycle thru shortcode folders |
1064 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
1064 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
1065 | 1065 | // add to list of installed shortcode modules |
1066 | - EE_Config::register_shortcode( $shortcode_path ); |
|
1066 | + EE_Config::register_shortcode($shortcode_path); |
|
1067 | 1067 | } |
1068 | 1068 | } |
1069 | 1069 | // filter list of installed modules |
@@ -1082,64 +1082,64 @@ discard block |
||
1082 | 1082 | * @param string $shortcode_path - full path up to and including shortcode folder |
1083 | 1083 | * @return bool |
1084 | 1084 | */ |
1085 | - public static function register_shortcode( $shortcode_path = null ) { |
|
1086 | - do_action( 'AHEE__EE_Config__register_shortcode__begin', $shortcode_path ); |
|
1085 | + public static function register_shortcode($shortcode_path = null) { |
|
1086 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
1087 | 1087 | $shortcode_ext = '.shortcode.php'; |
1088 | 1088 | // make all separators match |
1089 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
1089 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
1090 | 1090 | // does the file path INCLUDE the actual file name as part of the path ? |
1091 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== false ) { |
|
1091 | + if (strpos($shortcode_path, $shortcode_ext) !== false) { |
|
1092 | 1092 | // grab shortcode file name from directory name and break apart at dots |
1093 | - $shortcode_file = explode( '.', basename( $shortcode_path ) ); |
|
1093 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
1094 | 1094 | // take first segment from file name pieces and remove class prefix if it exists |
1095 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 |
|
1096 | - ? substr( $shortcode_file[0], 4 ) |
|
1095 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 |
|
1096 | + ? substr($shortcode_file[0], 4) |
|
1097 | 1097 | : $shortcode_file[0]; |
1098 | 1098 | // sanitize shortcode directory name |
1099 | - $shortcode = sanitize_key( $shortcode ); |
|
1099 | + $shortcode = sanitize_key($shortcode); |
|
1100 | 1100 | // now we need to rebuild the shortcode path |
1101 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
1101 | + $shortcode_path = explode(DS, $shortcode_path); |
|
1102 | 1102 | // remove last segment |
1103 | - array_pop( $shortcode_path ); |
|
1103 | + array_pop($shortcode_path); |
|
1104 | 1104 | // glue it back together |
1105 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
1105 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
1106 | 1106 | } else { |
1107 | 1107 | // we need to generate the filename based off of the folder name |
1108 | 1108 | // grab and sanitize shortcode directory name |
1109 | - $shortcode = sanitize_key( basename( $shortcode_path ) ); |
|
1110 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
1109 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
1110 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
1111 | 1111 | } |
1112 | 1112 | // create classname from shortcode directory or file name |
1113 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ) ) ); |
|
1113 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
1114 | 1114 | // add class prefix |
1115 | - $shortcode_class = 'EES_' . $shortcode; |
|
1115 | + $shortcode_class = 'EES_'.$shortcode; |
|
1116 | 1116 | // does the shortcode exist ? |
1117 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext ) ) { |
|
1117 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
1118 | 1118 | $msg = sprintf( |
1119 | 1119 | __( |
1120 | 1120 | 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', |
1121 | 1121 | 'event_espresso' |
1122 | 1122 | ), |
1123 | 1123 | $shortcode_class, |
1124 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
1124 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
1125 | 1125 | ); |
1126 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1126 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1127 | 1127 | return false; |
1128 | 1128 | } |
1129 | 1129 | // load the shortcode class file |
1130 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
1130 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
1131 | 1131 | // verify that class exists |
1132 | - if ( ! class_exists( $shortcode_class ) ) { |
|
1132 | + if ( ! class_exists($shortcode_class)) { |
|
1133 | 1133 | $msg = sprintf( |
1134 | - __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), |
|
1134 | + __('The requested %s shortcode class does not exist.', 'event_espresso'), |
|
1135 | 1135 | $shortcode_class |
1136 | 1136 | ); |
1137 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1137 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1138 | 1138 | return false; |
1139 | 1139 | } |
1140 | - $shortcode = strtoupper( $shortcode ); |
|
1140 | + $shortcode = strtoupper($shortcode); |
|
1141 | 1141 | // add to array of registered shortcodes |
1142 | - EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
1142 | + EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
1143 | 1143 | return true; |
1144 | 1144 | } |
1145 | 1145 | |
@@ -1153,22 +1153,22 @@ discard block |
||
1153 | 1153 | */ |
1154 | 1154 | private function _register_modules() { |
1155 | 1155 | // grab list of installed modules |
1156 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
1156 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
1157 | 1157 | // filter list of modules to register |
1158 | 1158 | $modules_to_register = apply_filters( |
1159 | 1159 | 'FHEE__EE_Config__register_modules__modules_to_register', |
1160 | 1160 | $modules_to_register |
1161 | 1161 | ); |
1162 | - if ( ! empty( $modules_to_register ) ) { |
|
1162 | + if ( ! empty($modules_to_register)) { |
|
1163 | 1163 | // loop through folders |
1164 | - foreach ( $modules_to_register as $module_path ) { |
|
1164 | + foreach ($modules_to_register as $module_path) { |
|
1165 | 1165 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
1166 | 1166 | if ( |
1167 | - $module_path !== EE_MODULES . 'zzz-copy-this-module-template' |
|
1168 | - && $module_path !== EE_MODULES . 'gateways' |
|
1167 | + $module_path !== EE_MODULES.'zzz-copy-this-module-template' |
|
1168 | + && $module_path !== EE_MODULES.'gateways' |
|
1169 | 1169 | ) { |
1170 | 1170 | // add to list of installed modules |
1171 | - EE_Config::register_module( $module_path ); |
|
1171 | + EE_Config::register_module($module_path); |
|
1172 | 1172 | } |
1173 | 1173 | } |
1174 | 1174 | } |
@@ -1188,39 +1188,39 @@ discard block |
||
1188 | 1188 | * @param string $module_path - full path up to and including module folder |
1189 | 1189 | * @return bool |
1190 | 1190 | */ |
1191 | - public static function register_module( $module_path = null ) { |
|
1192 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
1191 | + public static function register_module($module_path = null) { |
|
1192 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
1193 | 1193 | $module_ext = '.module.php'; |
1194 | 1194 | // make all separators match |
1195 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
1195 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
1196 | 1196 | // does the file path INCLUDE the actual file name as part of the path ? |
1197 | - if ( strpos( $module_path, $module_ext ) !== false ) { |
|
1197 | + if (strpos($module_path, $module_ext) !== false) { |
|
1198 | 1198 | // grab and shortcode file name from directory name and break apart at dots |
1199 | - $module_file = explode( '.', basename( $module_path ) ); |
|
1199 | + $module_file = explode('.', basename($module_path)); |
|
1200 | 1200 | // now we need to rebuild the shortcode path |
1201 | - $module_path = explode( DS, $module_path ); |
|
1201 | + $module_path = explode(DS, $module_path); |
|
1202 | 1202 | // remove last segment |
1203 | - array_pop( $module_path ); |
|
1203 | + array_pop($module_path); |
|
1204 | 1204 | // glue it back together |
1205 | - $module_path = implode( DS, $module_path ) . DS; |
|
1205 | + $module_path = implode(DS, $module_path).DS; |
|
1206 | 1206 | // take first segment from file name pieces and sanitize it |
1207 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
1207 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
1208 | 1208 | // ensure class prefix is added |
1209 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
1209 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
1210 | 1210 | } else { |
1211 | 1211 | // we need to generate the filename based off of the folder name |
1212 | 1212 | // grab and sanitize module name |
1213 | - $module = strtolower( basename( $module_path ) ); |
|
1214 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module ); |
|
1213 | + $module = strtolower(basename($module_path)); |
|
1214 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
1215 | 1215 | // like trailingslashit() |
1216 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
1216 | + $module_path = rtrim($module_path, DS).DS; |
|
1217 | 1217 | // create classname from module directory name |
1218 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ) ) ); |
|
1218 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
1219 | 1219 | // add class prefix |
1220 | - $module_class = 'EED_' . $module; |
|
1220 | + $module_class = 'EED_'.$module; |
|
1221 | 1221 | } |
1222 | 1222 | // does the module exist ? |
1223 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext ) ) { |
|
1223 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
1224 | 1224 | $msg = sprintf( |
1225 | 1225 | __( |
1226 | 1226 | 'The requested %s module file could not be found or is not readable due to file permissions.', |
@@ -1228,19 +1228,19 @@ discard block |
||
1228 | 1228 | ), |
1229 | 1229 | $module |
1230 | 1230 | ); |
1231 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1231 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1232 | 1232 | return false; |
1233 | 1233 | } |
1234 | 1234 | // load the module class file |
1235 | - require_once( $module_path . $module_class . $module_ext ); |
|
1235 | + require_once($module_path.$module_class.$module_ext); |
|
1236 | 1236 | // verify that class exists |
1237 | - if ( ! class_exists( $module_class ) ) { |
|
1238 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
1239 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1237 | + if ( ! class_exists($module_class)) { |
|
1238 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
1239 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1240 | 1240 | return false; |
1241 | 1241 | } |
1242 | 1242 | // add to array of registered modules |
1243 | - EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext; |
|
1243 | + EE_Registry::instance()->modules->{$module_class} = $module_path.$module_class.$module_ext; |
|
1244 | 1244 | do_action( |
1245 | 1245 | 'AHEE__EE_Config__register_module__complete', |
1246 | 1246 | $module_class, |
@@ -1260,26 +1260,26 @@ discard block |
||
1260 | 1260 | */ |
1261 | 1261 | private function _initialize_shortcodes() { |
1262 | 1262 | // cycle thru shortcode folders |
1263 | - foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) { |
|
1263 | + foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) { |
|
1264 | 1264 | // add class prefix |
1265 | - $shortcode_class = 'EES_' . $shortcode; |
|
1265 | + $shortcode_class = 'EES_'.$shortcode; |
|
1266 | 1266 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1267 | 1267 | // which set hooks ? |
1268 | - if ( is_admin() ) { |
|
1268 | + if (is_admin()) { |
|
1269 | 1269 | // fire immediately |
1270 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' ) ); |
|
1270 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
1271 | 1271 | } else { |
1272 | 1272 | // delay until other systems are online |
1273 | 1273 | add_action( |
1274 | 1274 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1275 | - array( $shortcode_class, 'set_hooks' ) |
|
1275 | + array($shortcode_class, 'set_hooks') |
|
1276 | 1276 | ); |
1277 | 1277 | // convert classname to UPPERCASE and create WP shortcode. |
1278 | - $shortcode_tag = strtoupper( $shortcode ); |
|
1278 | + $shortcode_tag = strtoupper($shortcode); |
|
1279 | 1279 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
1280 | - if ( ! shortcode_exists( $shortcode_tag ) ) { |
|
1280 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
1281 | 1281 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
1282 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' ) ); |
|
1282 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
1283 | 1283 | } |
1284 | 1284 | } |
1285 | 1285 | } |
@@ -1296,17 +1296,17 @@ discard block |
||
1296 | 1296 | */ |
1297 | 1297 | private function _initialize_modules() { |
1298 | 1298 | // cycle thru shortcode folders |
1299 | - foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) { |
|
1299 | + foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
1300 | 1300 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1301 | 1301 | // which set hooks ? |
1302 | - if ( is_admin() ) { |
|
1302 | + if (is_admin()) { |
|
1303 | 1303 | // fire immediately |
1304 | - call_user_func( array( $module_class, 'set_hooks_admin' ) ); |
|
1304 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
1305 | 1305 | } else { |
1306 | 1306 | // delay until other systems are online |
1307 | 1307 | add_action( |
1308 | 1308 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1309 | - array( $module_class, 'set_hooks' ) |
|
1309 | + array($module_class, 'set_hooks') |
|
1310 | 1310 | ); |
1311 | 1311 | } |
1312 | 1312 | } |
@@ -1324,29 +1324,29 @@ discard block |
||
1324 | 1324 | * @param string $key - url param key indicating a route is being called |
1325 | 1325 | * @return bool |
1326 | 1326 | */ |
1327 | - public static function register_route( $route = null, $module = null, $method_name = null, $key = 'ee' ) { |
|
1328 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
1329 | - $module = str_replace( 'EED_', '', $module ); |
|
1330 | - $module_class = 'EED_' . $module; |
|
1331 | - if ( ! isset( EE_Registry::instance()->modules->{$module_class} ) ) { |
|
1332 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
1333 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1327 | + public static function register_route($route = null, $module = null, $method_name = null, $key = 'ee') { |
|
1328 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
1329 | + $module = str_replace('EED_', '', $module); |
|
1330 | + $module_class = 'EED_'.$module; |
|
1331 | + if ( ! isset(EE_Registry::instance()->modules->{$module_class} )) { |
|
1332 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
1333 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1334 | 1334 | return false; |
1335 | 1335 | } |
1336 | - if ( empty( $route ) ) { |
|
1337 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
1338 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1336 | + if (empty($route)) { |
|
1337 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
1338 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1339 | 1339 | return false; |
1340 | 1340 | } |
1341 | - if ( ! method_exists( 'EED_' . $module, $method_name ) ) { |
|
1341 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
1342 | 1342 | $msg = sprintf( |
1343 | - __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), |
|
1343 | + __('A valid class method for the %s route has not been supplied.', 'event_espresso'), |
|
1344 | 1344 | $route |
1345 | 1345 | ); |
1346 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1346 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1347 | 1347 | return false; |
1348 | 1348 | } |
1349 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
1349 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
1350 | 1350 | return true; |
1351 | 1351 | } |
1352 | 1352 | |
@@ -1360,11 +1360,11 @@ discard block |
||
1360 | 1360 | * @param string $key - url param key indicating a route is being called |
1361 | 1361 | * @return string |
1362 | 1362 | */ |
1363 | - public static function get_route( $route = null, $key = 'ee' ) { |
|
1364 | - do_action( 'AHEE__EE_Config__get_route__begin', $route ); |
|
1365 | - $route = (string) apply_filters( 'FHEE__EE_Config__get_route', $route ); |
|
1366 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ) { |
|
1367 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
1363 | + public static function get_route($route = null, $key = 'ee') { |
|
1364 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
1365 | + $route = (string) apply_filters('FHEE__EE_Config__get_route', $route); |
|
1366 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
1367 | + return EE_Config::$_module_route_map[$key][$route]; |
|
1368 | 1368 | } |
1369 | 1369 | return null; |
1370 | 1370 | } |
@@ -1394,49 +1394,49 @@ discard block |
||
1394 | 1394 | * @param string $key - url param key indicating a route is being called |
1395 | 1395 | * @return bool |
1396 | 1396 | */ |
1397 | - public static function register_forward( $route = null, $status = 0, $forward = null, $key = 'ee' ) { |
|
1398 | - do_action( 'AHEE__EE_Config__register_forward', $route, $status, $forward ); |
|
1399 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1397 | + public static function register_forward($route = null, $status = 0, $forward = null, $key = 'ee') { |
|
1398 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
1399 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1400 | 1400 | $msg = sprintf( |
1401 | - __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), |
|
1401 | + __('The module route %s for this forward has not been registered.', 'event_espresso'), |
|
1402 | 1402 | $route |
1403 | 1403 | ); |
1404 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1404 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1405 | 1405 | return false; |
1406 | 1406 | } |
1407 | - if ( empty( $forward ) ) { |
|
1408 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
1409 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1407 | + if (empty($forward)) { |
|
1408 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
1409 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1410 | 1410 | return false; |
1411 | 1411 | } |
1412 | - if ( is_array( $forward ) ) { |
|
1413 | - if ( ! isset( $forward[1] ) ) { |
|
1412 | + if (is_array($forward)) { |
|
1413 | + if ( ! isset($forward[1])) { |
|
1414 | 1414 | $msg = sprintf( |
1415 | - __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), |
|
1415 | + __('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), |
|
1416 | 1416 | $route |
1417 | 1417 | ); |
1418 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1418 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1419 | 1419 | return false; |
1420 | 1420 | } |
1421 | - if ( ! method_exists( $forward[0], $forward[1] ) ) { |
|
1421 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
1422 | 1422 | $msg = sprintf( |
1423 | - __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1423 | + __('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1424 | 1424 | $forward[1], |
1425 | 1425 | $route |
1426 | 1426 | ); |
1427 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1427 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1428 | 1428 | return false; |
1429 | 1429 | } |
1430 | - } else if ( ! function_exists( $forward ) ) { |
|
1430 | + } else if ( ! function_exists($forward)) { |
|
1431 | 1431 | $msg = sprintf( |
1432 | - __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1432 | + __('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1433 | 1433 | $forward, |
1434 | 1434 | $route |
1435 | 1435 | ); |
1436 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1436 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1437 | 1437 | return false; |
1438 | 1438 | } |
1439 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
1439 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
1440 | 1440 | return true; |
1441 | 1441 | } |
1442 | 1442 | |
@@ -1452,12 +1452,12 @@ discard block |
||
1452 | 1452 | * @param string $key - url param key indicating a route is being called |
1453 | 1453 | * @return string |
1454 | 1454 | */ |
1455 | - public static function get_forward( $route = null, $status = 0, $key = 'ee' ) { |
|
1456 | - do_action( 'AHEE__EE_Config__get_forward__begin', $route, $status ); |
|
1457 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] ) ) { |
|
1455 | + public static function get_forward($route = null, $status = 0, $key = 'ee') { |
|
1456 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
1457 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
1458 | 1458 | return apply_filters( |
1459 | 1459 | 'FHEE__EE_Config__get_forward', |
1460 | - EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], |
|
1460 | + EE_Config::$_module_forward_map[$key][$route][$status], |
|
1461 | 1461 | $route, |
1462 | 1462 | $status |
1463 | 1463 | ); |
@@ -1479,17 +1479,17 @@ discard block |
||
1479 | 1479 | * @param string $key - url param key indicating a route is being called |
1480 | 1480 | * @return bool |
1481 | 1481 | */ |
1482 | - public static function register_view( $route = null, $status = 0, $view = null, $key = 'ee' ) { |
|
1483 | - do_action( 'AHEE__EE_Config__register_view__begin', $route, $status, $view ); |
|
1484 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1482 | + public static function register_view($route = null, $status = 0, $view = null, $key = 'ee') { |
|
1483 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
1484 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1485 | 1485 | $msg = sprintf( |
1486 | - __( 'The module route %s for this view has not been registered.', 'event_espresso' ), |
|
1486 | + __('The module route %s for this view has not been registered.', 'event_espresso'), |
|
1487 | 1487 | $route |
1488 | 1488 | ); |
1489 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1489 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1490 | 1490 | return false; |
1491 | 1491 | } |
1492 | - if ( ! is_readable( $view ) ) { |
|
1492 | + if ( ! is_readable($view)) { |
|
1493 | 1493 | $msg = sprintf( |
1494 | 1494 | __( |
1495 | 1495 | 'The %s view file could not be found or is not readable due to file permissions.', |
@@ -1497,10 +1497,10 @@ discard block |
||
1497 | 1497 | ), |
1498 | 1498 | $view |
1499 | 1499 | ); |
1500 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1500 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1501 | 1501 | return false; |
1502 | 1502 | } |
1503 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
1503 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
1504 | 1504 | return true; |
1505 | 1505 | } |
1506 | 1506 | |
@@ -1516,12 +1516,12 @@ discard block |
||
1516 | 1516 | * @param string $key - url param key indicating a route is being called |
1517 | 1517 | * @return string |
1518 | 1518 | */ |
1519 | - public static function get_view( $route = null, $status = 0, $key = 'ee' ) { |
|
1520 | - do_action( 'AHEE__EE_Config__get_view__begin', $route, $status ); |
|
1521 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] ) ) { |
|
1519 | + public static function get_view($route = null, $status = 0, $key = 'ee') { |
|
1520 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
1521 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
1522 | 1522 | return apply_filters( |
1523 | 1523 | 'FHEE__EE_Config__get_view', |
1524 | - EE_Config::$_module_view_map[ $key ][ $route ][ $status ], |
|
1524 | + EE_Config::$_module_view_map[$key][$route][$status], |
|
1525 | 1525 | $route, |
1526 | 1526 | $status |
1527 | 1527 | ); |
@@ -1532,7 +1532,7 @@ discard block |
||
1532 | 1532 | |
1533 | 1533 | |
1534 | 1534 | public function update_addon_option_names() { |
1535 | - update_option( EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names ); |
|
1535 | + update_option(EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names); |
|
1536 | 1536 | } |
1537 | 1537 | |
1538 | 1538 | |
@@ -1560,22 +1560,22 @@ discard block |
||
1560 | 1560 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
1561 | 1561 | * @throws \EE_Error |
1562 | 1562 | */ |
1563 | - public function get_pretty( $property ) { |
|
1564 | - if ( ! property_exists( $this, $property ) ) { |
|
1563 | + public function get_pretty($property) { |
|
1564 | + if ( ! property_exists($this, $property)) { |
|
1565 | 1565 | throw new EE_Error( |
1566 | 1566 | sprintf( |
1567 | 1567 | __( |
1568 | 1568 | '%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', |
1569 | 1569 | 'event_espresso' |
1570 | 1570 | ), |
1571 | - get_class( $this ), |
|
1571 | + get_class($this), |
|
1572 | 1572 | $property |
1573 | 1573 | ) |
1574 | 1574 | ); |
1575 | 1575 | } |
1576 | 1576 | //just handling escaping of strings for now. |
1577 | - if ( is_string( $this->{$property} ) ) { |
|
1578 | - return stripslashes( $this->{$property} ); |
|
1577 | + if (is_string($this->{$property} )) { |
|
1578 | + return stripslashes($this->{$property} ); |
|
1579 | 1579 | } |
1580 | 1580 | return $this->{$property}; |
1581 | 1581 | } |
@@ -1584,17 +1584,17 @@ discard block |
||
1584 | 1584 | |
1585 | 1585 | public function populate() { |
1586 | 1586 | //grab defaults via a new instance of this class. |
1587 | - $class_name = get_class( $this ); |
|
1587 | + $class_name = get_class($this); |
|
1588 | 1588 | $defaults = new $class_name; |
1589 | 1589 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
1590 | 1590 | //default from our $defaults object. |
1591 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
1592 | - if ( $this->{$property} === null ) { |
|
1591 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
1592 | + if ($this->{$property} === null) { |
|
1593 | 1593 | $this->{$property} = $value; |
1594 | 1594 | } |
1595 | 1595 | } |
1596 | 1596 | //cleanup |
1597 | - unset( $defaults ); |
|
1597 | + unset($defaults); |
|
1598 | 1598 | } |
1599 | 1599 | |
1600 | 1600 | |
@@ -1610,7 +1610,7 @@ discard block |
||
1610 | 1610 | * @param $a |
1611 | 1611 | * @return bool |
1612 | 1612 | */ |
1613 | - public function __isset( $a ) { |
|
1613 | + public function __isset($a) { |
|
1614 | 1614 | return false; |
1615 | 1615 | } |
1616 | 1616 | |
@@ -1622,7 +1622,7 @@ discard block |
||
1622 | 1622 | * @param $a |
1623 | 1623 | * @return bool |
1624 | 1624 | */ |
1625 | - public function __unset( $a ) { |
|
1625 | + public function __unset($a) { |
|
1626 | 1626 | return false; |
1627 | 1627 | } |
1628 | 1628 | |
@@ -1733,7 +1733,7 @@ discard block |
||
1733 | 1733 | $this->current_blog_id = get_current_blog_id(); |
1734 | 1734 | $this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id; |
1735 | 1735 | $this->ee_ueip_optin = $this->_get_main_ee_ueip_optin(); |
1736 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', false ) : true; |
|
1736 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', false) : true; |
|
1737 | 1737 | $this->post_shortcodes = array(); |
1738 | 1738 | $this->module_route_map = array(); |
1739 | 1739 | $this->module_forward_map = array(); |
@@ -1749,9 +1749,9 @@ discard block |
||
1749 | 1749 | $this->thank_you_page_url = ''; |
1750 | 1750 | $this->cancel_page_url = ''; |
1751 | 1751 | //cpt slugs |
1752 | - $this->event_cpt_slug = __( 'events', 'event_espresso' ); |
|
1752 | + $this->event_cpt_slug = __('events', 'event_espresso'); |
|
1753 | 1753 | //ueip constant check |
1754 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
1754 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
1755 | 1755 | $this->ee_ueip_optin = false; |
1756 | 1756 | $this->ee_ueip_has_notified = true; |
1757 | 1757 | } |
@@ -1794,8 +1794,8 @@ discard block |
||
1794 | 1794 | * @return string |
1795 | 1795 | */ |
1796 | 1796 | public function reg_page_url() { |
1797 | - if ( ! $this->reg_page_url ) { |
|
1798 | - $this->reg_page_url = get_permalink( $this->reg_page_id ) . '#checkout'; |
|
1797 | + if ( ! $this->reg_page_url) { |
|
1798 | + $this->reg_page_url = get_permalink($this->reg_page_id).'#checkout'; |
|
1799 | 1799 | } |
1800 | 1800 | return $this->reg_page_url; |
1801 | 1801 | } |
@@ -1810,12 +1810,12 @@ discard block |
||
1810 | 1810 | * @access public |
1811 | 1811 | * @return string |
1812 | 1812 | */ |
1813 | - public function txn_page_url( $query_args = array() ) { |
|
1814 | - if ( ! $this->txn_page_url ) { |
|
1815 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
1813 | + public function txn_page_url($query_args = array()) { |
|
1814 | + if ( ! $this->txn_page_url) { |
|
1815 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
1816 | 1816 | } |
1817 | - if ( $query_args ) { |
|
1818 | - return add_query_arg( $query_args, $this->txn_page_url ); |
|
1817 | + if ($query_args) { |
|
1818 | + return add_query_arg($query_args, $this->txn_page_url); |
|
1819 | 1819 | } else { |
1820 | 1820 | return $this->txn_page_url; |
1821 | 1821 | } |
@@ -1831,12 +1831,12 @@ discard block |
||
1831 | 1831 | * @access public |
1832 | 1832 | * @return string |
1833 | 1833 | */ |
1834 | - public function thank_you_page_url( $query_args = array() ) { |
|
1835 | - if ( ! $this->thank_you_page_url ) { |
|
1836 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
1834 | + public function thank_you_page_url($query_args = array()) { |
|
1835 | + if ( ! $this->thank_you_page_url) { |
|
1836 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
1837 | 1837 | } |
1838 | - if ( $query_args ) { |
|
1839 | - return add_query_arg( $query_args, $this->thank_you_page_url ); |
|
1838 | + if ($query_args) { |
|
1839 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
1840 | 1840 | } else { |
1841 | 1841 | return $this->thank_you_page_url; |
1842 | 1842 | } |
@@ -1851,8 +1851,8 @@ discard block |
||
1851 | 1851 | * @return string |
1852 | 1852 | */ |
1853 | 1853 | public function cancel_page_url() { |
1854 | - if ( ! $this->cancel_page_url ) { |
|
1855 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
1854 | + if ( ! $this->cancel_page_url) { |
|
1855 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
1856 | 1856 | } |
1857 | 1857 | return $this->cancel_page_url; |
1858 | 1858 | } |
@@ -1881,22 +1881,22 @@ discard block |
||
1881 | 1881 | */ |
1882 | 1882 | protected function _get_main_ee_ueip_optin() { |
1883 | 1883 | //if this is the main site then we can just bypass our direct query. |
1884 | - if ( is_main_site() ) { |
|
1885 | - return get_option( 'ee_ueip_optin', false ); |
|
1884 | + if (is_main_site()) { |
|
1885 | + return get_option('ee_ueip_optin', false); |
|
1886 | 1886 | } |
1887 | 1887 | |
1888 | 1888 | //is this already cached for this request? If so use it. |
1889 | - if ( ! empty( EE_Core_Config::$ee_ueip_option ) ) { |
|
1889 | + if ( ! empty(EE_Core_Config::$ee_ueip_option)) { |
|
1890 | 1890 | return EE_Core_Config::$ee_ueip_option; |
1891 | 1891 | } |
1892 | 1892 | |
1893 | 1893 | global $wpdb; |
1894 | 1894 | $current_network_main_site = is_multisite() ? get_current_site() : null; |
1895 | - $current_main_site_id = ! empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
1895 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
1896 | 1896 | $option = 'ee_ueip_optin'; |
1897 | 1897 | |
1898 | 1898 | //set correct table for query |
1899 | - $table_name = $wpdb->get_blog_prefix( $current_main_site_id ) . 'options'; |
|
1899 | + $table_name = $wpdb->get_blog_prefix($current_main_site_id).'options'; |
|
1900 | 1900 | |
1901 | 1901 | |
1902 | 1902 | //rather than getting blog option for the $current_main_site_id, we do a direct $wpdb query because |
@@ -1904,20 +1904,20 @@ discard block |
||
1904 | 1904 | //re-constructed on the blog switch. Note, we are still executing any core wp filters on this option retrieval. |
1905 | 1905 | //this bit of code is basically a direct copy of get_option without any caching because we are NOT switched to the blog |
1906 | 1906 | //for the purpose of caching. |
1907 | - $pre = apply_filters( 'pre_option_' . $option, false, $option ); |
|
1908 | - if ( false !== $pre ) { |
|
1907 | + $pre = apply_filters('pre_option_'.$option, false, $option); |
|
1908 | + if (false !== $pre) { |
|
1909 | 1909 | EE_Core_Config::$ee_ueip_option = $pre; |
1910 | 1910 | return EE_Core_Config::$ee_ueip_option; |
1911 | 1911 | } |
1912 | 1912 | |
1913 | - $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option ) ); |
|
1914 | - if ( is_object( $row ) ) { |
|
1913 | + $row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option)); |
|
1914 | + if (is_object($row)) { |
|
1915 | 1915 | $value = $row->option_value; |
1916 | 1916 | } else { //option does not exist so use default. |
1917 | - return apply_filters( 'default_option_' . $option, false, $option ); |
|
1917 | + return apply_filters('default_option_'.$option, false, $option); |
|
1918 | 1918 | } |
1919 | 1919 | |
1920 | - EE_Core_Config::$ee_ueip_option = apply_filters( 'option_' . $option, maybe_unserialize( $value ), $option ); |
|
1920 | + EE_Core_Config::$ee_ueip_option = apply_filters('option_'.$option, maybe_unserialize($value), $option); |
|
1921 | 1921 | return EE_Core_Config::$ee_ueip_option; |
1922 | 1922 | } |
1923 | 1923 | |
@@ -1933,7 +1933,7 @@ discard block |
||
1933 | 1933 | //reset all url properties |
1934 | 1934 | $this->_reset_urls(); |
1935 | 1935 | //return what to save to db |
1936 | - return array_keys( get_object_vars( $this ) ); |
|
1936 | + return array_keys(get_object_vars($this)); |
|
1937 | 1937 | } |
1938 | 1938 | |
1939 | 1939 | } |
@@ -2081,14 +2081,14 @@ discard block |
||
2081 | 2081 | */ |
2082 | 2082 | public function __construct() { |
2083 | 2083 | // set default organization settings |
2084 | - $this->name = get_bloginfo( 'name' ); |
|
2084 | + $this->name = get_bloginfo('name'); |
|
2085 | 2085 | $this->address_1 = '123 Onna Road'; |
2086 | 2086 | $this->address_2 = 'PO Box 123'; |
2087 | 2087 | $this->city = 'Inna City'; |
2088 | 2088 | $this->STA_ID = 4; |
2089 | 2089 | $this->CNT_ISO = 'US'; |
2090 | 2090 | $this->zip = '12345'; |
2091 | - $this->email = get_bloginfo( 'admin_email' ); |
|
2091 | + $this->email = get_bloginfo('admin_email'); |
|
2092 | 2092 | $this->phone = ''; |
2093 | 2093 | $this->vat = '123456789'; |
2094 | 2094 | $this->logo_url = ''; |
@@ -2176,44 +2176,44 @@ discard block |
||
2176 | 2176 | * @param string $CNT_ISO |
2177 | 2177 | * @return \EE_Currency_Config |
2178 | 2178 | */ |
2179 | - public function __construct( $CNT_ISO = '' ) { |
|
2179 | + public function __construct($CNT_ISO = '') { |
|
2180 | 2180 | // get country code from organization settings or use default |
2181 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) |
|
2181 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) |
|
2182 | 2182 | && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
2183 | 2183 | ? EE_Registry::instance()->CFG->organization->CNT_ISO |
2184 | 2184 | : ''; |
2185 | 2185 | // but override if requested |
2186 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
2186 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
2187 | 2187 | // so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists |
2188 | 2188 | if ( |
2189 | - ! empty( $CNT_ISO ) |
|
2189 | + ! empty($CNT_ISO) |
|
2190 | 2190 | && EE_Maintenance_Mode::instance()->models_can_query() |
2191 | - && EEH_Activation::table_exists( EE_Registry::instance()->load_model( 'Country' )->table() ) |
|
2191 | + && EEH_Activation::table_exists(EE_Registry::instance()->load_model('Country')->table()) |
|
2192 | 2192 | ) { |
2193 | 2193 | // retrieve the country settings from the db, just in case they have been customized |
2194 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
2195 | - if ( $country instanceof EE_Country ) { |
|
2196 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2197 | - $this->name = $country->currency_name_single(); // Dollar |
|
2198 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
2199 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
2200 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2201 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2202 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2203 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2194 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
2195 | + if ($country instanceof EE_Country) { |
|
2196 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2197 | + $this->name = $country->currency_name_single(); // Dollar |
|
2198 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
2199 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
2200 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2201 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2202 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2203 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2204 | 2204 | } |
2205 | 2205 | } |
2206 | 2206 | // fallback to hardcoded defaults, in case the above failed |
2207 | - if ( empty( $this->code ) ) { |
|
2207 | + if (empty($this->code)) { |
|
2208 | 2208 | // set default currency settings |
2209 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2210 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
2211 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
2212 | - $this->sign = '$'; // currency sign: $ |
|
2213 | - $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2214 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2215 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2216 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2209 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2210 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
2211 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
2212 | + $this->sign = '$'; // currency sign: $ |
|
2213 | + $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2214 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2215 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2216 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2217 | 2217 | } |
2218 | 2218 | } |
2219 | 2219 | } |
@@ -2376,7 +2376,7 @@ discard block |
||
2376 | 2376 | * @since 4.8.8.rc.019 |
2377 | 2377 | */ |
2378 | 2378 | public function do_hooks() { |
2379 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' ) ); |
|
2379 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
2380 | 2380 | } |
2381 | 2381 | |
2382 | 2382 | |
@@ -2385,7 +2385,7 @@ discard block |
||
2385 | 2385 | * @return void |
2386 | 2386 | */ |
2387 | 2387 | public function set_default_reg_status_on_EEM_Event() { |
2388 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
2388 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
2389 | 2389 | } |
2390 | 2390 | |
2391 | 2391 | |
@@ -2490,10 +2490,10 @@ discard block |
||
2490 | 2490 | * @param bool $reset |
2491 | 2491 | * @return string |
2492 | 2492 | */ |
2493 | - public function log_file_name( $reset = false ) { |
|
2494 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
2495 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2496 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2493 | + public function log_file_name($reset = false) { |
|
2494 | + if (empty($this->log_file_name) || $reset) { |
|
2495 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', true))).'.txt'; |
|
2496 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2497 | 2497 | } |
2498 | 2498 | return $this->log_file_name; |
2499 | 2499 | } |
@@ -2504,10 +2504,10 @@ discard block |
||
2504 | 2504 | * @param bool $reset |
2505 | 2505 | * @return string |
2506 | 2506 | */ |
2507 | - public function debug_file_name( $reset = false ) { |
|
2508 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
2509 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2510 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2507 | + public function debug_file_name($reset = false) { |
|
2508 | + if (empty($this->debug_file_name) || $reset) { |
|
2509 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', true))).'.txt'; |
|
2510 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2511 | 2511 | } |
2512 | 2512 | return $this->debug_file_name; |
2513 | 2513 | } |
@@ -2685,21 +2685,21 @@ discard block |
||
2685 | 2685 | $this->use_google_maps = true; |
2686 | 2686 | $this->google_map_api_key = ''; |
2687 | 2687 | // for event details pages (reg page) |
2688 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
2689 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
2690 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2691 | - $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2692 | - $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2693 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2694 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2688 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
2689 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
2690 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2691 | + $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2692 | + $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2693 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2694 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2695 | 2695 | // for event list pages |
2696 | - $this->event_list_map_width = 300; // ee_map_width |
|
2697 | - $this->event_list_map_height = 185; // ee_map_height |
|
2698 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2699 | - $this->event_list_display_nav = false; // ee_map_nav_display |
|
2700 | - $this->event_list_nav_size = true; // ee_map_nav_size |
|
2701 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2702 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
2696 | + $this->event_list_map_width = 300; // ee_map_width |
|
2697 | + $this->event_list_map_height = 185; // ee_map_height |
|
2698 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2699 | + $this->event_list_display_nav = false; // ee_map_nav_display |
|
2700 | + $this->event_list_nav_size = true; // ee_map_nav_size |
|
2701 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2702 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
2703 | 2703 | } |
2704 | 2704 | |
2705 | 2705 | } |
@@ -2852,7 +2852,7 @@ discard block |
||
2852 | 2852 | * @return void |
2853 | 2853 | */ |
2854 | 2854 | protected function _set_php_values() { |
2855 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
2855 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
2856 | 2856 | $this->php->version = phpversion(); |
2857 | 2857 | } |
2858 | 2858 | |
@@ -2871,10 +2871,10 @@ discard block |
||
2871 | 2871 | * @type string $msg Any message to be displayed. |
2872 | 2872 | * } |
2873 | 2873 | */ |
2874 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
2875 | - if ( ! empty( $this->php->max_input_vars ) |
|
2876 | - && ( $input_count >= $this->php->max_input_vars ) |
|
2877 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2874 | + public function max_input_vars_limit_check($input_count = 0) { |
|
2875 | + if ( ! empty($this->php->max_input_vars) |
|
2876 | + && ($input_count >= $this->php->max_input_vars) |
|
2877 | + && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9) |
|
2878 | 2878 | ) { |
2879 | 2879 | return sprintf( |
2880 | 2880 | __( |
@@ -2940,7 +2940,7 @@ discard block |
||
2940 | 2940 | */ |
2941 | 2941 | public function __construct() { |
2942 | 2942 | $this->payment_settings = array(); |
2943 | - $this->active_gateways = array( 'Invoice' => false ); |
|
2943 | + $this->active_gateways = array('Invoice' => false); |
|
2944 | 2944 | } |
2945 | 2945 | } |
2946 | 2946 |
@@ -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 | /** |
@@ -14,31 +14,31 @@ discard block |
||
14 | 14 | * @author Mike Nelson |
15 | 15 | * |
16 | 16 | */ |
17 | -class EE_Billing_Attendee_Info_Form extends EE_Billing_Info_Form{ |
|
17 | +class EE_Billing_Attendee_Info_Form extends EE_Billing_Info_Form { |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * |
21 | 21 | * @param EE_Payment_Method $payment_method |
22 | 22 | * @param array $options_array @see EE_Form_Section_Proper::__construct() |
23 | 23 | */ |
24 | - public function __construct( EE_Payment_Method $payment_method, $options_array= array()){ |
|
24 | + public function __construct(EE_Payment_Method $payment_method, $options_array = array()) { |
|
25 | 25 | $options_array['subsections'] = array_merge( |
26 | 26 | array( |
27 | - 'first_name' => new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-fname', 'html_label_text' => __( 'First Name', 'event_espresso' ) ) ), |
|
28 | - 'last_name' => new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-lname', 'html_label_text' => __( 'Last Name', 'event_espresso' ) ) ), |
|
29 | - 'email' => new EE_Email_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-email', 'html_label_text' => __( 'Email', 'event_espresso' ) ) ), |
|
30 | - 'address' => new EE_Text_Input( array( 'html_label_text'=> __( 'Address', 'event_espresso'), 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-address' )), |
|
31 | - 'address2' => new EE_Text_Input( array( 'html_label_text'=> __( 'Address 2', 'event_espresso'), 'html_class' => 'ee-billing-qstn ee-billing-qstn-address2' )), |
|
32 | - 'city' => new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-city', 'html_label_text' => __( 'City', 'event_espresso' ) ) ), |
|
33 | - 'state' => apply_filters( 'FHEE__EE_Billing_Attendee_Info_Form__state_field', new EE_State_Select_Input( NULL, array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-state', 'html_label_text' => __( 'State', 'event_espresso' ) ) ) ), |
|
34 | - 'country' => apply_filters( 'FHEE__EE_Billing_Attendee_Info_Form__country_field', new EE_Country_Select_Input( NULL, array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-country', 'html_label_text' => __( 'Country', 'event_espresso' ) ) ) ), |
|
35 | - 'zip' => new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', 'html_label_text' => __( 'Zip', 'event_espresso' ) ) ), |
|
36 | - 'phone' => new EE_Text_Input( array( 'html_class' => 'ee-billing-qstn ee-billing-qstn-phone', 'html_label_text' => __( 'Phone', 'event_espresso' ) )), |
|
27 | + 'first_name' => new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-fname', 'html_label_text' => __('First Name', 'event_espresso'))), |
|
28 | + 'last_name' => new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-lname', 'html_label_text' => __('Last Name', 'event_espresso'))), |
|
29 | + 'email' => new EE_Email_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-email', 'html_label_text' => __('Email', 'event_espresso'))), |
|
30 | + 'address' => new EE_Text_Input(array('html_label_text'=> __('Address', 'event_espresso'), 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-address')), |
|
31 | + 'address2' => new EE_Text_Input(array('html_label_text'=> __('Address 2', 'event_espresso'), 'html_class' => 'ee-billing-qstn ee-billing-qstn-address2')), |
|
32 | + 'city' => new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-city', 'html_label_text' => __('City', 'event_espresso'))), |
|
33 | + 'state' => apply_filters('FHEE__EE_Billing_Attendee_Info_Form__state_field', new EE_State_Select_Input(NULL, array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-state', 'html_label_text' => __('State', 'event_espresso')))), |
|
34 | + 'country' => apply_filters('FHEE__EE_Billing_Attendee_Info_Form__country_field', new EE_Country_Select_Input(NULL, array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-country', 'html_label_text' => __('Country', 'event_espresso')))), |
|
35 | + 'zip' => new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', 'html_label_text' => __('Zip', 'event_espresso'))), |
|
36 | + 'phone' => new EE_Text_Input(array('html_class' => 'ee-billing-qstn ee-billing-qstn-phone', 'html_label_text' => __('Phone', 'event_espresso'))), |
|
37 | 37 | ), |
38 | - isset( $options_array['subsections'] ) ? $options_array['subsections'] : array() |
|
38 | + isset($options_array['subsections']) ? $options_array['subsections'] : array() |
|
39 | 39 | ); |
40 | 40 | |
41 | - parent::__construct( $payment_method, $options_array ); |
|
41 | + parent::__construct($payment_method, $options_array); |
|
42 | 42 | |
43 | 43 | } |
44 | 44 | |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | * Sets the defaults for the billing form according to the attendee's details |
47 | 47 | * @param EE_Attendee $attendee |
48 | 48 | */ |
49 | - public function populate_from_attendee( $attendee ){ |
|
49 | + public function populate_from_attendee($attendee) { |
|
50 | 50 | $attendee = EEM_Attendee::instance()->ensure_is_obj($attendee); |
51 | 51 | /** @var $attendee EE_Attendee */ |
52 | 52 | $this->populate_defaults( |
53 | - apply_filters( 'FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee', |
|
53 | + apply_filters('FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee', |
|
54 | 54 | array( |
55 | 55 | 'first_name'=>$attendee->fname(), |
56 | 56 | 'last_name'=>$attendee->lname(), |
@@ -78,48 +78,48 @@ discard block |
||
78 | 78 | * @param \EE_Attendee $attendee - the attendee object to copy details to |
79 | 79 | * @return \EE_Attendee |
80 | 80 | */ |
81 | - public function copy_billing_form_data_to_attendee( EE_Attendee $attendee ){ |
|
81 | + public function copy_billing_form_data_to_attendee(EE_Attendee $attendee) { |
|
82 | 82 | // grab billing form data |
83 | 83 | $data = $this->valid_data(); |
84 | 84 | // copy first_name |
85 | - if ( ! empty( $data['first_name'] )) { |
|
86 | - $attendee->set_fname( $data['first_name'] ); |
|
85 | + if ( ! empty($data['first_name'])) { |
|
86 | + $attendee->set_fname($data['first_name']); |
|
87 | 87 | } |
88 | 88 | // copy last_name |
89 | - if ( ! empty( $data['last_name'] )) { |
|
90 | - $attendee->set_lname( $data['last_name'] ); |
|
89 | + if ( ! empty($data['last_name'])) { |
|
90 | + $attendee->set_lname($data['last_name']); |
|
91 | 91 | } |
92 | 92 | // copy email |
93 | - if ( ! empty( $data['email'] )) { |
|
94 | - $attendee->set_email( $data['email'] ); |
|
93 | + if ( ! empty($data['email'])) { |
|
94 | + $attendee->set_email($data['email']); |
|
95 | 95 | } |
96 | 96 | // copy address |
97 | - if ( ! empty( $data['address'] )) { |
|
98 | - $attendee->set_address( $data['address'] ); |
|
97 | + if ( ! empty($data['address'])) { |
|
98 | + $attendee->set_address($data['address']); |
|
99 | 99 | } |
100 | 100 | // copy address2 |
101 | - if ( ! empty( $data['address2'] )) { |
|
102 | - $attendee->set_address2( $data['address2'] ); |
|
101 | + if ( ! empty($data['address2'])) { |
|
102 | + $attendee->set_address2($data['address2']); |
|
103 | 103 | } |
104 | 104 | // copy city |
105 | - if ( ! empty( $data['city'] )) { |
|
106 | - $attendee->set_city( $data['city'] ); |
|
105 | + if ( ! empty($data['city'])) { |
|
106 | + $attendee->set_city($data['city']); |
|
107 | 107 | } |
108 | 108 | // copy state |
109 | - if ( ! empty( $data['state'] )) { |
|
110 | - $attendee->set_state( $data['state'] ); |
|
109 | + if ( ! empty($data['state'])) { |
|
110 | + $attendee->set_state($data['state']); |
|
111 | 111 | } |
112 | 112 | // copy country |
113 | - if ( ! empty( $data['country'] )) { |
|
114 | - $attendee->set_country( $data['country'] ); |
|
113 | + if ( ! empty($data['country'])) { |
|
114 | + $attendee->set_country($data['country']); |
|
115 | 115 | } |
116 | 116 | // copy zip |
117 | - if ( ! empty( $data['zip'] )) { |
|
118 | - $attendee->set_zip( $data['zip'] ); |
|
117 | + if ( ! empty($data['zip'])) { |
|
118 | + $attendee->set_zip($data['zip']); |
|
119 | 119 | } |
120 | 120 | // copy phone |
121 | - if ( ! empty( $data['phone'] )) { |
|
122 | - $attendee->set_phone( $data['phone'] ); |
|
121 | + if ( ! empty($data['phone'])) { |
|
122 | + $attendee->set_phone($data['phone']); |
|
123 | 123 | } |
124 | 124 | return $attendee; |
125 | 125 | } |
@@ -130,20 +130,20 @@ discard block |
||
130 | 130 | * uses info from the billing form to create a new attendee |
131 | 131 | * @return \EE_Attendee |
132 | 132 | */ |
133 | - public function create_attendee_from_billing_form_data(){ |
|
133 | + public function create_attendee_from_billing_form_data() { |
|
134 | 134 | // grab billing form data |
135 | 135 | $data = $this->valid_data(); |
136 | - return EE_Attendee::new_instance( array( |
|
137 | - 'ATT_fname' => ! empty( $data['first_name'] ) ? $data['first_name'] : '', |
|
138 | - 'ATT_lname' => ! empty( $data['last_name'] ) ? $data['last_name'] : '', |
|
139 | - 'ATT_email' => ! empty( $data['email'] ) ? $data['email'] : '', |
|
140 | - 'ATT_address' => ! empty( $data['address'] ) ? $data['address'] : '', |
|
141 | - 'ATT_address2' => ! empty( $data['address2'] ) ? $data['address2'] : '', |
|
142 | - 'ATT_city' => ! empty( $data['city'] ) ? $data['city'] : '', |
|
143 | - 'STA_ID' => ! empty( $data['state'] ) ? $data['state'] : '', |
|
144 | - 'CNT_ISO' => ! empty( $data['country'] ) ? $data['country'] : '', |
|
145 | - 'ATT_zip' => ! empty( $data['zip'] ) ? $data['zip'] : '', |
|
146 | - 'ATT_phone' => ! empty( $data['phone'] ) ? $data['phone'] : '', |
|
136 | + return EE_Attendee::new_instance(array( |
|
137 | + 'ATT_fname' => ! empty($data['first_name']) ? $data['first_name'] : '', |
|
138 | + 'ATT_lname' => ! empty($data['last_name']) ? $data['last_name'] : '', |
|
139 | + 'ATT_email' => ! empty($data['email']) ? $data['email'] : '', |
|
140 | + 'ATT_address' => ! empty($data['address']) ? $data['address'] : '', |
|
141 | + 'ATT_address2' => ! empty($data['address2']) ? $data['address2'] : '', |
|
142 | + 'ATT_city' => ! empty($data['city']) ? $data['city'] : '', |
|
143 | + 'STA_ID' => ! empty($data['state']) ? $data['state'] : '', |
|
144 | + 'CNT_ISO' => ! empty($data['country']) ? $data['country'] : '', |
|
145 | + 'ATT_zip' => ! empty($data['zip']) ? $data['zip'] : '', |
|
146 | + 'ATT_phone' => ! empty($data['phone']) ? $data['phone'] : '', |
|
147 | 147 | )); |
148 | 148 | } |
149 | 149 | } |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' )) { exit( 'No direct script access allowed' ); } |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * Class EE_Select_Reveal_Input |
4 | 4 | * |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @since 4.6 |
12 | 12 | * |
13 | 13 | */ |
14 | -class EE_Select_Reveal_Input extends EE_Select_Input{ |
|
14 | +class EE_Select_Reveal_Input extends EE_Select_Input { |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * @param array $answer_options Array keys which match a sibling section's name |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @param array $input_settings |
28 | 28 | */ |
29 | - public function __construct( $answer_options, $input_settings = array() ){ |
|
30 | - parent::__construct( $answer_options, $input_settings ); |
|
29 | + public function __construct($answer_options, $input_settings = array()) { |
|
30 | + parent::__construct($answer_options, $input_settings); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -36,17 +36,17 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function sibling_sections_controlled() { |
38 | 38 | $sibling_sections = array(); |
39 | - foreach( $this->options() as $sibling_section_name => $sibling_section ) { |
|
39 | + foreach ($this->options() as $sibling_section_name => $sibling_section) { |
|
40 | 40 | //if it's an empty string just leave it alone |
41 | - if( empty( $sibling_section_name ) ) { |
|
41 | + if (empty($sibling_section_name)) { |
|
42 | 42 | continue; |
43 | 43 | } |
44 | - $sibling_section = $this->find_section_from_path( '../' . $sibling_section_name ); |
|
45 | - if( |
|
44 | + $sibling_section = $this->find_section_from_path('../'.$sibling_section_name); |
|
45 | + if ( |
|
46 | 46 | $sibling_section instanceof EE_Form_Section_Base |
47 | - && ! empty( $sibling_section_name ) |
|
47 | + && ! empty($sibling_section_name) |
|
48 | 48 | ) { |
49 | - $sibling_sections[ $sibling_section_name ] = $sibling_section; |
|
49 | + $sibling_sections[$sibling_section_name] = $sibling_section; |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | return $sibling_sections; |
@@ -59,16 +59,16 @@ discard block |
||
59 | 59 | * @param array $form_other_js_data |
60 | 60 | * @return array |
61 | 61 | */ |
62 | - public function get_other_js_data( $form_other_js_data = array() ) { |
|
63 | - $form_other_js_data = parent::get_other_js_data( $form_other_js_data ); |
|
64 | - if( ! isset($form_other_js_data[ 'select_reveal_inputs' ] ) ) { |
|
65 | - $form_other_js_data[ 'select_reveal_inputs' ] = array(); |
|
62 | + public function get_other_js_data($form_other_js_data = array()) { |
|
63 | + $form_other_js_data = parent::get_other_js_data($form_other_js_data); |
|
64 | + if ( ! isset($form_other_js_data['select_reveal_inputs'])) { |
|
65 | + $form_other_js_data['select_reveal_inputs'] = array(); |
|
66 | 66 | } |
67 | 67 | $sibling_input_to_html_id_map = array(); |
68 | - foreach( $this->sibling_sections_controlled() as $sibling_section_path => $sibling_section ) { |
|
69 | - $sibling_input_to_html_id_map[ $sibling_section_path ] = $sibling_section->html_id(); |
|
68 | + foreach ($this->sibling_sections_controlled() as $sibling_section_path => $sibling_section) { |
|
69 | + $sibling_input_to_html_id_map[$sibling_section_path] = $sibling_section->html_id(); |
|
70 | 70 | } |
71 | - $form_other_js_data[ 'select_reveal_inputs' ][ $this->html_id() ] = $sibling_input_to_html_id_map; |
|
71 | + $form_other_js_data['select_reveal_inputs'][$this->html_id()] = $sibling_input_to_html_id_map; |
|
72 | 72 | return $form_other_js_data; |
73 | 73 | } |
74 | 74 |
@@ -13,9 +13,9 @@ discard block |
||
13 | 13 | * |
14 | 14 | * @return string |
15 | 15 | */ |
16 | - public function layout_form_begin( $additional_args = array() ) { |
|
16 | + public function layout_form_begin($additional_args = array()) { |
|
17 | 17 | $this->_form_section->set_html_class('form-table'); |
18 | - return parent::layout_form_begin( $additional_args ); |
|
18 | + return parent::layout_form_begin($additional_args); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | * @param EE_Form_Section_Proper $form_section |
26 | 26 | * @return string |
27 | 27 | */ |
28 | - public function layout_subsection( $form_section ){ |
|
29 | - if ( $form_section instanceof EE_Form_Section_Proper ) { |
|
30 | - return EEH_HTML::no_row( $form_section->get_html(), 2 ); |
|
31 | - } else if ( $form_section instanceof EE_Form_Section_HTML ) { |
|
28 | + public function layout_subsection($form_section) { |
|
29 | + if ($form_section instanceof EE_Form_Section_Proper) { |
|
30 | + return EEH_HTML::no_row($form_section->get_html(), 2); |
|
31 | + } else if ($form_section instanceof EE_Form_Section_HTML) { |
|
32 | 32 | return $form_section->get_html(); |
33 | 33 | } |
34 | 34 | return ''; |
@@ -41,30 +41,30 @@ discard block |
||
41 | 41 | * @param EE_Form_Input_Base $input |
42 | 42 | * @return string |
43 | 43 | */ |
44 | - public function layout_input( $input ) { |
|
44 | + public function layout_input($input) { |
|
45 | 45 | |
46 | 46 | if ( |
47 | 47 | $input->get_display_strategy() instanceof EE_Text_Area_Display_Strategy || |
48 | 48 | $input->get_display_strategy() instanceof EE_Text_Input_Display_Strategy || |
49 | 49 | $input->get_display_strategy() instanceof EE_Admin_File_Uploader_Display_Strategy |
50 | 50 | ) { |
51 | - $input->set_html_class( $input->html_class() . ' large-text' ); |
|
51 | + $input->set_html_class($input->html_class().' large-text'); |
|
52 | 52 | } |
53 | - if ( $input instanceof EE_Text_Area_Input ) { |
|
54 | - $input->set_rows( 4 ); |
|
55 | - $input->set_cols( 60 ); |
|
53 | + if ($input instanceof EE_Text_Area_Input) { |
|
54 | + $input->set_rows(4); |
|
55 | + $input->set_cols(60); |
|
56 | 56 | } |
57 | 57 | $input_html = $input->get_html_for_input(); |
58 | 58 | // maybe add errors and help text ? |
59 | - $input_html .= $input->get_html_for_errors() != '' ? EEH_HTML::nl() . $input->get_html_for_errors() : ''; |
|
60 | - $input_html .= $input->get_html_for_help() != '' ? EEH_HTML::nl() . $input->get_html_for_help() : ''; |
|
59 | + $input_html .= $input->get_html_for_errors() != '' ? EEH_HTML::nl().$input->get_html_for_errors() : ''; |
|
60 | + $input_html .= $input->get_html_for_help() != '' ? EEH_HTML::nl().$input->get_html_for_help() : ''; |
|
61 | 61 | //overriding parent to add wp admin specific things. |
62 | 62 | $html = ''; |
63 | - if ( $input instanceof EE_Hidden_Input ) { |
|
64 | - $html .= EEH_HTML::no_row( $input->get_html_for_input(), 2 ); |
|
63 | + if ($input instanceof EE_Hidden_Input) { |
|
64 | + $html .= EEH_HTML::no_row($input->get_html_for_input(), 2); |
|
65 | 65 | } else { |
66 | 66 | $html .= EEH_HTML::tr( |
67 | - EEH_HTML::th( $input->get_html_for_label(), '', '', '', 'scope="row"' ) . EEH_HTML::td( $input_html ) |
|
67 | + EEH_HTML::th($input->get_html_for_label(), '', '', '', 'scope="row"').EEH_HTML::td($input_html) |
|
68 | 68 | ); |
69 | 69 | } |
70 | 70 | return $html; |