@@ -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 | * |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * @author Mike Nelson |
14 | 14 | * @since 4.6.0 |
15 | 15 | */ |
16 | -class EE_Soft_Delete_Where_Conditions extends EE_Default_Where_Conditions{ |
|
16 | +class EE_Soft_Delete_Where_Conditions extends EE_Default_Where_Conditions { |
|
17 | 17 | /** |
18 | 18 | * Strategy for setting default soft delete where conditions. This strategy will find |
19 | 19 | * the field of type 'EE_Trashed_Flag_Field', and add a condition that it be FALSE on all queries involving |
@@ -22,12 +22,12 @@ discard block |
||
22 | 22 | * Eg, |
23 | 23 | * |
24 | 24 | */ |
25 | - function __construct(){} |
|
25 | + function __construct() {} |
|
26 | 26 | /** |
27 | 27 | * Gets the where default where conditions for a custom post type model |
28 | 28 | * @return array like EEM_Base::get_all's $query_params's index [0] (where conditions) |
29 | 29 | */ |
30 | - protected function _get_default_where_conditions(){ |
|
30 | + protected function _get_default_where_conditions() { |
|
31 | 31 | $trashed_field_name = $this->deleted_field_name(); |
32 | 32 | return array( |
33 | 33 | $trashed_field_name => false |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | * @return string |
40 | 40 | * @throws EE_Error |
41 | 41 | */ |
42 | - private function deleted_field_name(){ |
|
42 | + private function deleted_field_name() { |
|
43 | 43 | $field = $this->_model->get_a_field_of_type('EE_Trashed_Flag_Field'); |
44 | - if($field){ |
|
44 | + if ($field) { |
|
45 | 45 | return $field->get_name(); |
46 | - }else{ |
|
47 | - throw new EE_Error(sprintf(__('We are trying to find the deleted flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?','event_espresso'),get_class($this),get_class($this))); |
|
46 | + } else { |
|
47 | + throw new EE_Error(sprintf(__('We are trying to find the deleted flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?', 'event_espresso'), get_class($this), get_class($this))); |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | } |
51 | 51 | \ No newline at end of file |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | * @return string |
59 | 59 | * @todo: at some point we can break this down into other static methods to abstract it a bit better. |
60 | 60 | */ |
61 | - static public function get_form_fields( $input_vars = array(), $id = FALSE ) { |
|
61 | + static public function get_form_fields($input_vars = array(), $id = FALSE) { |
|
62 | 62 | |
63 | - if ( empty($input_vars) ) { |
|
64 | - EE_Error::add_error( __('missing required variables for the form field generator', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
63 | + if (empty($input_vars)) { |
|
64 | + EE_Error::add_error(__('missing required variables for the form field generator', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
65 | 65 | return FALSE; |
66 | 66 | } |
67 | 67 | |
@@ -87,25 +87,25 @@ discard block |
||
87 | 87 | 'append_content' => '' |
88 | 88 | ); |
89 | 89 | |
90 | - $input_value = wp_parse_args( $input_value, $defaults ); |
|
90 | + $input_value = wp_parse_args($input_value, $defaults); |
|
91 | 91 | |
92 | 92 | // required fields get a * |
93 | 93 | $required = isset($input_value['required']) && $input_value['required'] ? ' <span>*</span>: ' : ': '; |
94 | 94 | // and the css class "required" |
95 | - $css_class = isset( $input_value['css_class'] ) ? $input_value['css_class'] : ''; |
|
96 | - $styles = $input_value['required'] ? 'required ' . $css_class : $css_class; |
|
95 | + $css_class = isset($input_value['css_class']) ? $input_value['css_class'] : ''; |
|
96 | + $styles = $input_value['required'] ? 'required '.$css_class : $css_class; |
|
97 | 97 | |
98 | - $field_id = ($id) ? $id . '-' . $input_key : $input_key; |
|
99 | - $tabindex = !empty($input_value['tabindex']) ? ' tabindex="' . $input_value['tabindex'] . '"' : ''; |
|
98 | + $field_id = ($id) ? $id.'-'.$input_key : $input_key; |
|
99 | + $tabindex = ! empty($input_value['tabindex']) ? ' tabindex="'.$input_value['tabindex'].'"' : ''; |
|
100 | 100 | |
101 | 101 | //rows or cols? |
102 | - $rows = isset($input_value['rows'] ) ? $input_value['rows'] : '10'; |
|
103 | - $cols = isset($input_value['cols'] ) ? $input_value['cols'] : '80'; |
|
102 | + $rows = isset($input_value['rows']) ? $input_value['rows'] : '10'; |
|
103 | + $cols = isset($input_value['cols']) ? $input_value['cols'] : '80'; |
|
104 | 104 | |
105 | 105 | //any content? |
106 | 106 | $append_content = $input_value['append_content']; |
107 | 107 | |
108 | - $output .= (!$close) ? '<ul>' : ''; |
|
108 | + $output .= ( ! $close) ? '<ul>' : ''; |
|
109 | 109 | $output .= '<li>'; |
110 | 110 | |
111 | 111 | // what type of input are we dealing with ? |
@@ -113,15 +113,15 @@ discard block |
||
113 | 113 | |
114 | 114 | // text inputs |
115 | 115 | case 'text' : |
116 | - $output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>'; |
|
117 | - $output .= "\n\t\t\t" . '<input id="' . $field_id . '" class="' . $styles . '" type="text" value="' . $input_value['value'] . '" name="' . $input_value['name'] . '"' . $tabindex . '>'; |
|
116 | + $output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>'; |
|
117 | + $output .= "\n\t\t\t".'<input id="'.$field_id.'" class="'.$styles.'" type="text" value="'.$input_value['value'].'" name="'.$input_value['name'].'"'.$tabindex.'>'; |
|
118 | 118 | break; |
119 | 119 | |
120 | 120 | // dropdowns |
121 | 121 | case 'select' : |
122 | 122 | |
123 | - $output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>'; |
|
124 | - $output .= "\n\t\t\t" . '<select id="' . $field_id . '" class="' . $styles . '" name="' . $input_value['name'] . '"' . $tabindex . '>'; |
|
123 | + $output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>'; |
|
124 | + $output .= "\n\t\t\t".'<select id="'.$field_id.'" class="'.$styles.'" name="'.$input_value['name'].'"'.$tabindex.'>'; |
|
125 | 125 | |
126 | 126 | if (is_array($input_value['options'])) { |
127 | 127 | $options = $input_value['options']; |
@@ -130,30 +130,30 @@ discard block |
||
130 | 130 | } |
131 | 131 | |
132 | 132 | foreach ($options as $key => $value) { |
133 | - $selected = isset( $input_value['value'] ) && $input_value['value'] == $key ? 'selected=selected' : ''; |
|
133 | + $selected = isset($input_value['value']) && $input_value['value'] == $key ? 'selected=selected' : ''; |
|
134 | 134 | //$key = str_replace( ' ', '_', sanitize_key( $value )); |
135 | - $output .= "\n\t\t\t\t" . '<option '. $selected . ' value="' . $key . '">' . $value . '</option>'; |
|
135 | + $output .= "\n\t\t\t\t".'<option '.$selected.' value="'.$key.'">'.$value.'</option>'; |
|
136 | 136 | } |
137 | - $output .= "\n\t\t\t" . '</select>'; |
|
137 | + $output .= "\n\t\t\t".'</select>'; |
|
138 | 138 | |
139 | 139 | break; |
140 | 140 | |
141 | 141 | case 'textarea' : |
142 | 142 | |
143 | - $output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>'; |
|
144 | - $output .= "\n\t\t\t" . '<textarea id="' . $field_id . '" class="' . $styles . '" rows="'.$rows.'" cols="'.$cols.'" name="' . $input_value['name'] . '"' . $tabindex . '>' . $input_value['value'] . '</textarea>'; |
|
143 | + $output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>'; |
|
144 | + $output .= "\n\t\t\t".'<textarea id="'.$field_id.'" class="'.$styles.'" rows="'.$rows.'" cols="'.$cols.'" name="'.$input_value['name'].'"'.$tabindex.'>'.$input_value['value'].'</textarea>'; |
|
145 | 145 | break; |
146 | 146 | |
147 | 147 | case 'hidden' : |
148 | 148 | $close = false; |
149 | 149 | $output .= "</li></ul>"; |
150 | - $output .= "\n\t\t\t" . '<input id="' . $field_id . '" type="hidden" name="' . $input_value['name'] . '" value="' . $input_value['value'] . '">'; |
|
150 | + $output .= "\n\t\t\t".'<input id="'.$field_id.'" type="hidden" name="'.$input_value['name'].'" value="'.$input_value['value'].'">'; |
|
151 | 151 | break; |
152 | 152 | |
153 | 153 | case 'checkbox' : |
154 | - $checked = ( $input_value['value'] == 1 ) ? 'checked="checked"' : ''; |
|
155 | - $output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>'; |
|
156 | - $output .= "\n\t\t\t" . '<input id="' . $field_id. '" type="checkbox" name="' . $input_value['name'] . '" value="1"' . $checked . $tabindex . ' />'; |
|
154 | + $checked = ($input_value['value'] == 1) ? 'checked="checked"' : ''; |
|
155 | + $output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>'; |
|
156 | + $output .= "\n\t\t\t".'<input id="'.$field_id.'" type="checkbox" name="'.$input_value['name'].'" value="1"'.$checked.$tabindex.' />'; |
|
157 | 157 | break; |
158 | 158 | |
159 | 159 | case 'wp_editor' : |
@@ -166,19 +166,19 @@ discard block |
||
166 | 166 | ); |
167 | 167 | $output .= '</li>'; |
168 | 168 | $output .= '</ul>'; |
169 | - $output .= '<h4>' . $input_value['label'] . '</h4>'; |
|
170 | - if ( $append_content ) { |
|
169 | + $output .= '<h4>'.$input_value['label'].'</h4>'; |
|
170 | + if ($append_content) { |
|
171 | 171 | $output .= $append_content; |
172 | 172 | } |
173 | 173 | ob_start(); |
174 | - wp_editor( $input_value['value'], $field_id, $editor_settings); |
|
174 | + wp_editor($input_value['value'], $field_id, $editor_settings); |
|
175 | 175 | $editor = ob_get_contents(); |
176 | 176 | ob_end_clean(); |
177 | 177 | $output .= $editor; |
178 | 178 | break; |
179 | 179 | |
180 | 180 | } |
181 | - if ( $append_content && $input_value['input'] !== 'wp_editor' ) { |
|
181 | + if ($append_content && $input_value['input'] !== 'wp_editor') { |
|
182 | 182 | $output .= $append_content; |
183 | 183 | } |
184 | 184 | $output .= ($close) ? '</li>' : ''; |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $form_fields = array(); |
220 | 220 | $fields = (array) $fields; |
221 | 221 | |
222 | - foreach ( $fields as $field_name => $field_atts ) { |
|
222 | + foreach ($fields as $field_name => $field_atts) { |
|
223 | 223 | //defaults: |
224 | 224 | $defaults = array( |
225 | 225 | 'label' => '', |
@@ -237,67 +237,67 @@ discard block |
||
237 | 237 | 'wpeditor_args' => array() |
238 | 238 | ); |
239 | 239 | // merge defaults with passed arguments |
240 | - $_fields = wp_parse_args( $field_atts, $defaults); |
|
241 | - extract( $_fields ); |
|
240 | + $_fields = wp_parse_args($field_atts, $defaults); |
|
241 | + extract($_fields); |
|
242 | 242 | // generate label |
243 | - $label = empty($label) ? '' : '<label for="' . $id . '">' . $label . '</label>'; |
|
243 | + $label = empty($label) ? '' : '<label for="'.$id.'">'.$label.'</label>'; |
|
244 | 244 | // generate field name |
245 | - $f_name = !empty($unique_id) ? $field_name . '[' . $unique_id . ']' : $field_name; |
|
245 | + $f_name = ! empty($unique_id) ? $field_name.'['.$unique_id.']' : $field_name; |
|
246 | 246 | |
247 | 247 | //tabindex |
248 | - $tabindex_str = !empty( $tabindex ) ? ' tabindex="' . $tabindex . '"' : ''; |
|
248 | + $tabindex_str = ! empty($tabindex) ? ' tabindex="'.$tabindex.'"' : ''; |
|
249 | 249 | |
250 | 250 | //we determine what we're building based on the type |
251 | - switch ( $type ) { |
|
251 | + switch ($type) { |
|
252 | 252 | |
253 | 253 | case 'textarea' : |
254 | - $fld = '<textarea id="' . $id . '" class="' . $class . '" rows="' . $dimensions[1] . '" cols="' . $dimensions[0] . '" name="' . $f_name . '"' . $tabindex_str . '>' . $value . '</textarea>'; |
|
254 | + $fld = '<textarea id="'.$id.'" class="'.$class.'" rows="'.$dimensions[1].'" cols="'.$dimensions[0].'" name="'.$f_name.'"'.$tabindex_str.'>'.$value.'</textarea>'; |
|
255 | 255 | $fld .= $extra_desc; |
256 | 256 | break; |
257 | 257 | |
258 | 258 | case 'checkbox' : |
259 | 259 | $c_input = ''; |
260 | - if ( is_array($value) ) { |
|
261 | - foreach ( $value as $key => $val ) { |
|
262 | - $c_id = $field_name . '_' . $value; |
|
263 | - $c_class = isset($classes[$key]) ? ' class="' . $classes[$key] . '" ' : ''; |
|
264 | - $c_label = isset($labels[$key]) ? '<label for="' . $c_id . '">' . $labels[$key] . '</label>' : ''; |
|
265 | - $checked = !empty($default) && $default == $val ? ' checked="checked" ' : ''; |
|
266 | - $c_input .= '<input name="' . $f_name . '[]" type="checkbox" id="' . $c_id . '"' . $c_class . 'value="' . $val . '"' . $checked . $tabindex_str . ' />' . "\n" . $c_label; |
|
260 | + if (is_array($value)) { |
|
261 | + foreach ($value as $key => $val) { |
|
262 | + $c_id = $field_name.'_'.$value; |
|
263 | + $c_class = isset($classes[$key]) ? ' class="'.$classes[$key].'" ' : ''; |
|
264 | + $c_label = isset($labels[$key]) ? '<label for="'.$c_id.'">'.$labels[$key].'</label>' : ''; |
|
265 | + $checked = ! empty($default) && $default == $val ? ' checked="checked" ' : ''; |
|
266 | + $c_input .= '<input name="'.$f_name.'[]" type="checkbox" id="'.$c_id.'"'.$c_class.'value="'.$val.'"'.$checked.$tabindex_str.' />'."\n".$c_label; |
|
267 | 267 | } |
268 | 268 | $fld = $c_input; |
269 | 269 | } else { |
270 | - $checked = !empty($default) && $default == $val ? 'checked="checked" ' : ''; |
|
271 | - $fld = '<input name="'. $f_name . '" type="checkbox" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $checked . $tabindex_str . ' />' . "\n"; |
|
270 | + $checked = ! empty($default) && $default == $val ? 'checked="checked" ' : ''; |
|
271 | + $fld = '<input name="'.$f_name.'" type="checkbox" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$checked.$tabindex_str.' />'."\n"; |
|
272 | 272 | } |
273 | 273 | break; |
274 | 274 | |
275 | 275 | case 'radio' : |
276 | 276 | $c_input = ''; |
277 | - if ( is_array($value) ) { |
|
278 | - foreach ( $value as $key => $val ) { |
|
279 | - $c_id = $field_name . '_' . $value; |
|
280 | - $c_class = isset($classes[$key]) ? 'class="' . $classes[$key] . '" ' : ''; |
|
281 | - $c_label = isset($labels[$key]) ? '<label for="' . $c_id . '">' . $labels[$key] . '</label>' : ''; |
|
282 | - $checked = !empty($default) && $default == $val ? ' checked="checked" ' : ''; |
|
283 | - $c_input .= '<input name="' . $f_name . '" type="checkbox" id="' . $c_id . '"' . $c_class . 'value="' . $val . '"' . $checked . $tabindex_str . ' />' . "\n" . $c_label; |
|
277 | + if (is_array($value)) { |
|
278 | + foreach ($value as $key => $val) { |
|
279 | + $c_id = $field_name.'_'.$value; |
|
280 | + $c_class = isset($classes[$key]) ? 'class="'.$classes[$key].'" ' : ''; |
|
281 | + $c_label = isset($labels[$key]) ? '<label for="'.$c_id.'">'.$labels[$key].'</label>' : ''; |
|
282 | + $checked = ! empty($default) && $default == $val ? ' checked="checked" ' : ''; |
|
283 | + $c_input .= '<input name="'.$f_name.'" type="checkbox" id="'.$c_id.'"'.$c_class.'value="'.$val.'"'.$checked.$tabindex_str.' />'."\n".$c_label; |
|
284 | 284 | } |
285 | 285 | $fld = $c_input; |
286 | 286 | } else { |
287 | - $checked = !empty($default) && $default == $val ? 'checked="checked" ' : ''; |
|
288 | - $fld = '<input name="'. $f_name . '" type="checkbox" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $checked . $tabindex_str . ' />' . "\n"; |
|
287 | + $checked = ! empty($default) && $default == $val ? 'checked="checked" ' : ''; |
|
288 | + $fld = '<input name="'.$f_name.'" type="checkbox" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$checked.$tabindex_str.' />'."\n"; |
|
289 | 289 | } |
290 | 290 | break; |
291 | 291 | |
292 | 292 | case 'hidden' : |
293 | - $fld = '<input name="' . $f_name . '" type="hidden" id="' . $id . '" class="' . $class . '" value="' . $value . '" />' . "\n"; |
|
293 | + $fld = '<input name="'.$f_name.'" type="hidden" id="'.$id.'" class="'.$class.'" value="'.$value.'" />'."\n"; |
|
294 | 294 | break; |
295 | 295 | |
296 | 296 | case 'select' : |
297 | - $fld = '<select name="' . $f_name . '" class="' . $class . '" id="' . $id . '"' . $tabindex_str . '>' . "\n"; |
|
298 | - foreach ( $value as $key => $val ) { |
|
299 | - $checked = !empty($default) && $default == $val ? ' selected="selected"' : ''; |
|
300 | - $fld .= "\t" . '<option value="' . $val . '"' . $checked . '>' . $labels[$key] . '</option>' . "\n"; |
|
297 | + $fld = '<select name="'.$f_name.'" class="'.$class.'" id="'.$id.'"'.$tabindex_str.'>'."\n"; |
|
298 | + foreach ($value as $key => $val) { |
|
299 | + $checked = ! empty($default) && $default == $val ? ' selected="selected"' : ''; |
|
300 | + $fld .= "\t".'<option value="'.$val.'"'.$checked.'>'.$labels[$key].'</option>'."\n"; |
|
301 | 301 | } |
302 | 302 | $fld .= '</select>'; |
303 | 303 | break; |
@@ -309,21 +309,21 @@ discard block |
||
309 | 309 | 'editor_class' => $class, |
310 | 310 | 'tabindex' => $tabindex |
311 | 311 | ); |
312 | - $editor_settings = array_merge( $wpeditor_args, $editor_settings ); |
|
312 | + $editor_settings = array_merge($wpeditor_args, $editor_settings); |
|
313 | 313 | ob_start(); |
314 | - wp_editor( $value, $id, $editor_settings ); |
|
314 | + wp_editor($value, $id, $editor_settings); |
|
315 | 315 | $editor = ob_get_contents(); |
316 | 316 | ob_end_clean(); |
317 | 317 | $fld = $editor; |
318 | 318 | break; |
319 | 319 | |
320 | 320 | default : //'text fields' |
321 | - $fld = '<input name="' . $f_name . '" type="text" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $tabindex_str . ' />' . "\n"; |
|
321 | + $fld = '<input name="'.$f_name.'" type="text" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$tabindex_str.' />'."\n"; |
|
322 | 322 | $fld .= $extra_desc; |
323 | 323 | |
324 | 324 | } |
325 | 325 | |
326 | - $form_fields[ $field_name ] = array( 'label' => $label, 'field' => $fld ); |
|
326 | + $form_fields[$field_name] = array('label' => $label, 'field' => $fld); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | return $form_fields; |
@@ -352,22 +352,22 @@ discard block |
||
352 | 352 | */ |
353 | 353 | static public function select_input($name, $values, $default = '', $parameters = '', $class = '', $autosize = true) { |
354 | 354 | //if $values was submitted in the wrong format, convert it over |
355 | - if(!empty($values) && (!array_key_exists(0,$values) || !is_array($values[0]))){ |
|
356 | - $converted_values=array(); |
|
357 | - foreach($values as $id=>$text){ |
|
358 | - $converted_values[]=array('id'=>$id,'text'=>$text); |
|
355 | + if ( ! empty($values) && ( ! array_key_exists(0, $values) || ! is_array($values[0]))) { |
|
356 | + $converted_values = array(); |
|
357 | + foreach ($values as $id=>$text) { |
|
358 | + $converted_values[] = array('id'=>$id, 'text'=>$text); |
|
359 | 359 | } |
360 | - $values=$converted_values; |
|
360 | + $values = $converted_values; |
|
361 | 361 | } |
362 | 362 | //load formatter helper |
363 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
363 | + EE_Registry::instance()->load_helper('Formatter'); |
|
364 | 364 | //EE_Registry::instance()->load_helper( 'Formatter' ); |
365 | 365 | |
366 | - $field = '<select id="' . EEH_Formatter::ee_tep_output_string($name) . '" name="' . EEH_Formatter::ee_tep_output_string($name) . '"'; |
|
366 | + $field = '<select id="'.EEH_Formatter::ee_tep_output_string($name).'" name="'.EEH_Formatter::ee_tep_output_string($name).'"'; |
|
367 | 367 | //Debug |
368 | 368 | //EEH_Debug_Tools::printr( $values, '$values <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
369 | - if ( EEH_Formatter::ee_tep_not_null($parameters)) |
|
370 | - $field .= ' ' . $parameters; |
|
369 | + if (EEH_Formatter::ee_tep_not_null($parameters)) |
|
370 | + $field .= ' '.$parameters; |
|
371 | 371 | if ($autosize) { |
372 | 372 | $size = 'med'; |
373 | 373 | for ($ii = 0, $ni = sizeof($values); $ii < $ni; $ii++) { |
@@ -380,21 +380,21 @@ discard block |
||
380 | 380 | $size = ''; |
381 | 381 | } |
382 | 382 | |
383 | - $field .= ' class="' . $class . ' ' . $size . '">'; |
|
383 | + $field .= ' class="'.$class.' '.$size.'">'; |
|
384 | 384 | |
385 | 385 | if (empty($default) && isset($GLOBALS[$name])) |
386 | 386 | $default = stripslashes($GLOBALS[$name]); |
387 | 387 | |
388 | 388 | |
389 | 389 | for ($i = 0, $n = sizeof($values); $i < $n; $i++) { |
390 | - $field .= '<option value="' . $values[$i]['id'] . '"'; |
|
390 | + $field .= '<option value="'.$values[$i]['id'].'"'; |
|
391 | 391 | if ($default == $values[$i]['id']) { |
392 | 392 | $field .= ' selected = "selected"'; |
393 | 393 | } |
394 | - if ( isset( $values[$i]['class'] ) ) { |
|
395 | - $field .= ' class="' . $values[$i]['class'] . '"'; |
|
394 | + if (isset($values[$i]['class'])) { |
|
395 | + $field .= ' class="'.$values[$i]['class'].'"'; |
|
396 | 396 | } |
397 | - $field .= '>' . $values[$i]['text'] . '</option>'; |
|
397 | + $field .= '>'.$values[$i]['text'].'</option>'; |
|
398 | 398 | } |
399 | 399 | $field .= '</select>'; |
400 | 400 | |
@@ -412,38 +412,38 @@ discard block |
||
412 | 412 | * @param string $question_groups |
413 | 413 | * @return string HTML |
414 | 414 | */ |
415 | - static function generate_question_groups_html( $question_groups = array(), $group_wrapper = 'fieldset' ) { |
|
415 | + static function generate_question_groups_html($question_groups = array(), $group_wrapper = 'fieldset') { |
|
416 | 416 | |
417 | 417 | $html = ''; |
418 | - $before_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '' ); |
|
419 | - $after_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '' ); |
|
418 | + $before_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', ''); |
|
419 | + $after_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', ''); |
|
420 | 420 | |
421 | - if ( ! empty( $question_groups )) { |
|
421 | + if ( ! empty($question_groups)) { |
|
422 | 422 | //EEH_Debug_Tools::printr( $question_groups, '$question_groups <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
423 | 423 | // loop thru question groups |
424 | - foreach ( $question_groups as $QSG ) { |
|
424 | + foreach ($question_groups as $QSG) { |
|
425 | 425 | // check that questions exist |
426 | - if ( ! empty( $QSG['QSG_questions'] )) { |
|
426 | + if ( ! empty($QSG['QSG_questions'])) { |
|
427 | 427 | // use fieldsets |
428 | - $html .= "\n\t" . '<' . $group_wrapper . ' class="espresso-question-group-wrap" id="' . $QSG['QSG_identifier'] . '">'; |
|
428 | + $html .= "\n\t".'<'.$group_wrapper.' class="espresso-question-group-wrap" id="'.$QSG['QSG_identifier'].'">'; |
|
429 | 429 | // group_name |
430 | - $html .= $QSG['QSG_show_group_name'] ? "\n\t\t" . '<h5 class="espresso-question-group-title-h5 section-title">' . self::prep_answer( $QSG['QSG_name'] ) . '</h5>' : ''; |
|
430 | + $html .= $QSG['QSG_show_group_name'] ? "\n\t\t".'<h5 class="espresso-question-group-title-h5 section-title">'.self::prep_answer($QSG['QSG_name']).'</h5>' : ''; |
|
431 | 431 | // group_desc |
432 | - $html .= $QSG['QSG_show_group_desc'] && ! empty( $QSG['QSG_desc'] ) ? '<div class="espresso-question-group-desc-pg">' . self::prep_answer( $QSG['QSG_desc'] ) . '</div>' : ''; |
|
432 | + $html .= $QSG['QSG_show_group_desc'] && ! empty($QSG['QSG_desc']) ? '<div class="espresso-question-group-desc-pg">'.self::prep_answer($QSG['QSG_desc']).'</div>' : ''; |
|
433 | 433 | |
434 | 434 | $html .= $before_question_group_questions; |
435 | 435 | // loop thru questions |
436 | - foreach ( $QSG['QSG_questions'] as $question ) { |
|
436 | + foreach ($QSG['QSG_questions'] as $question) { |
|
437 | 437 | // EEH_Debug_Tools::printr( $question, '$question <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
438 | 438 | $QFI = new EE_Question_Form_Input( |
439 | 439 | $question['qst_obj'], |
440 | 440 | $question['ans_obj'], |
441 | 441 | $question |
442 | 442 | ); |
443 | - $html .= self::generate_form_input( $QFI ); |
|
443 | + $html .= self::generate_form_input($QFI); |
|
444 | 444 | } |
445 | 445 | $html .= $after_question_group_questions; |
446 | - $html .= "\n\t" . '</' . $group_wrapper . '>'; |
|
446 | + $html .= "\n\t".'</'.$group_wrapper.'>'; |
|
447 | 447 | } |
448 | 448 | } |
449 | 449 | } |
@@ -463,11 +463,11 @@ discard block |
||
463 | 463 | * @param string $group_wrapper |
464 | 464 | * @return string HTML |
465 | 465 | */ |
466 | - static function generate_question_groups_html2( $question_groups = array(), $q_meta = array(), $from_admin = FALSE, $group_wrapper = 'fieldset' ) { |
|
466 | + static function generate_question_groups_html2($question_groups = array(), $q_meta = array(), $from_admin = FALSE, $group_wrapper = 'fieldset') { |
|
467 | 467 | |
468 | 468 | $html = ''; |
469 | - $before_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '' ); |
|
470 | - $after_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '' ); |
|
469 | + $before_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', ''); |
|
470 | + $after_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', ''); |
|
471 | 471 | |
472 | 472 | $default_q_meta = array( |
473 | 473 | 'att_nmbr' => 1, |
@@ -476,55 +476,55 @@ discard block |
||
476 | 476 | 'input_id' => '', |
477 | 477 | 'input_class' => '' |
478 | 478 | ); |
479 | - $q_meta = array_merge( $default_q_meta, $q_meta ); |
|
479 | + $q_meta = array_merge($default_q_meta, $q_meta); |
|
480 | 480 | //EEH_Debug_Tools::printr( $q_meta, '$q_meta <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
481 | 481 | |
482 | - if ( ! empty( $question_groups )) { |
|
482 | + if ( ! empty($question_groups)) { |
|
483 | 483 | // EEH_Debug_Tools::printr( $question_groups, '$question_groups <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
484 | 484 | // loop thru question groups |
485 | - foreach ( $question_groups as $QSG ) { |
|
486 | - if ( $QSG instanceof EE_Question_Group ) { |
|
485 | + foreach ($question_groups as $QSG) { |
|
486 | + if ($QSG instanceof EE_Question_Group) { |
|
487 | 487 | // check that questions exist |
488 | 488 | |
489 | - $where = array( 'QST_deleted' => 0 ); |
|
490 | - if ( ! $from_admin ) { |
|
489 | + $where = array('QST_deleted' => 0); |
|
490 | + if ( ! $from_admin) { |
|
491 | 491 | $where['QST_admin_only'] = 0; |
492 | 492 | } |
493 | - $questions = $QSG->questions( array( $where, 'order_by' => array( 'Question_Group_Question.QGQ_order' => 'ASC' ))); |
|
494 | - if ( ! empty( $questions )) { |
|
493 | + $questions = $QSG->questions(array($where, 'order_by' => array('Question_Group_Question.QGQ_order' => 'ASC'))); |
|
494 | + if ( ! empty($questions)) { |
|
495 | 495 | // use fieldsets |
496 | - $html .= "\n\t" . '<' . $group_wrapper . ' class="espresso-question-group-wrap" id="' . $QSG->get( 'QSG_identifier' ) . '">'; |
|
496 | + $html .= "\n\t".'<'.$group_wrapper.' class="espresso-question-group-wrap" id="'.$QSG->get('QSG_identifier').'">'; |
|
497 | 497 | // group_name |
498 | - if ( $QSG->show_group_name() ) { |
|
499 | - $html .= "\n\t\t" . '<h5 class="espresso-question-group-title-h5 section-title">' . $QSG->get_pretty( 'QSG_name' ) . '</h5>'; |
|
498 | + if ($QSG->show_group_name()) { |
|
499 | + $html .= "\n\t\t".'<h5 class="espresso-question-group-title-h5 section-title">'.$QSG->get_pretty('QSG_name').'</h5>'; |
|
500 | 500 | } |
501 | 501 | // group_desc |
502 | - if ( $QSG->show_group_desc() ) { |
|
503 | - $html .= '<div class="espresso-question-group-desc-pg">' . $QSG->get_pretty( 'QSG_desc' ) . '</div>'; |
|
502 | + if ($QSG->show_group_desc()) { |
|
503 | + $html .= '<div class="espresso-question-group-desc-pg">'.$QSG->get_pretty('QSG_desc').'</div>'; |
|
504 | 504 | } |
505 | 505 | |
506 | 506 | $html .= $before_question_group_questions; |
507 | 507 | // loop thru questions |
508 | - foreach ( $questions as $QST ) { |
|
508 | + foreach ($questions as $QST) { |
|
509 | 509 | $qstn_id = $QST->is_system_question() ? $QST->system_ID() : $QST->ID(); |
510 | 510 | |
511 | 511 | $answer = NULL; |
512 | 512 | |
513 | - if ( isset( $_GET['qstn'] ) && isset( $q_meta['input_id'] ) && isset( $q_meta['att_nmbr'] )) { |
|
513 | + if (isset($_GET['qstn']) && isset($q_meta['input_id']) && isset($q_meta['att_nmbr'])) { |
|
514 | 514 | // check for answer in $_GET in case we are reprocessing a form after an error |
515 | - if ( isset( $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] )) { |
|
516 | - $answer = is_array( $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] ) ? $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] : sanitize_text_field( $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] ); |
|
515 | + if (isset($_GET['qstn'][$q_meta['input_id']][$qstn_id])) { |
|
516 | + $answer = is_array($_GET['qstn'][$q_meta['input_id']][$qstn_id]) ? $_GET['qstn'][$q_meta['input_id']][$qstn_id] : sanitize_text_field($_GET['qstn'][$q_meta['input_id']][$qstn_id]); |
|
517 | 517 | } |
518 | - } else if ( isset( $q_meta['attendee'] ) && $q_meta['attendee'] ) { |
|
518 | + } else if (isset($q_meta['attendee']) && $q_meta['attendee']) { |
|
519 | 519 | //attendee data from the session |
520 | - $answer = isset( $q_meta['attendee'][ $qstn_id ] ) ? $q_meta['attendee'][ $qstn_id ] : NULL; |
|
520 | + $answer = isset($q_meta['attendee'][$qstn_id]) ? $q_meta['attendee'][$qstn_id] : NULL; |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | |
524 | 524 | |
525 | 525 | $QFI = new EE_Question_Form_Input( |
526 | 526 | $QST, |
527 | - EE_Answer::new_instance ( array( |
|
527 | + EE_Answer::new_instance(array( |
|
528 | 528 | 'ANS_ID'=> 0, |
529 | 529 | 'QST_ID'=> 0, |
530 | 530 | 'REG_ID'=> 0, |
@@ -533,10 +533,10 @@ discard block |
||
533 | 533 | $q_meta |
534 | 534 | ); |
535 | 535 | //EEH_Debug_Tools::printr( $QFI, '$QFI <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
536 | - $html .= self::generate_form_input( $QFI ); |
|
536 | + $html .= self::generate_form_input($QFI); |
|
537 | 537 | } |
538 | 538 | $html .= $after_question_group_questions; |
539 | - $html .= "\n\t" . '</' . $group_wrapper . '>'; |
|
539 | + $html .= "\n\t".'</'.$group_wrapper.'>'; |
|
540 | 540 | } |
541 | 541 | } |
542 | 542 | } |
@@ -556,63 +556,63 @@ discard block |
||
556 | 556 | * @param EE_Question_Form_Input $QFI |
557 | 557 | * @return string HTML |
558 | 558 | */ |
559 | - static function generate_form_input( EE_Question_Form_Input $QFI ) { |
|
560 | - if ( isset( $QFI->QST_admin_only) && $QFI->QST_admin_only && ! is_admin() ) { |
|
559 | + static function generate_form_input(EE_Question_Form_Input $QFI) { |
|
560 | + if (isset($QFI->QST_admin_only) && $QFI->QST_admin_only && ! is_admin()) { |
|
561 | 561 | return ''; |
562 | 562 | } |
563 | 563 | |
564 | - $QFI = self::_load_system_dropdowns( $QFI ); |
|
565 | - $QFI = self::_load_specialized_dropdowns( $QFI ); |
|
564 | + $QFI = self::_load_system_dropdowns($QFI); |
|
565 | + $QFI = self::_load_specialized_dropdowns($QFI); |
|
566 | 566 | |
567 | 567 | //we also need to verify |
568 | 568 | |
569 | 569 | $display_text = $QFI->get('QST_display_text'); |
570 | 570 | $input_name = $QFI->get('QST_input_name'); |
571 | - $answer = EE_Registry::instance()->REQ->is_set( $input_name ) ? EE_Registry::instance()->REQ->get( $input_name ) : $QFI->get('ANS_value'); |
|
571 | + $answer = EE_Registry::instance()->REQ->is_set($input_name) ? EE_Registry::instance()->REQ->get($input_name) : $QFI->get('ANS_value'); |
|
572 | 572 | $input_id = $QFI->get('QST_input_id'); |
573 | 573 | $input_class = $QFI->get('QST_input_class'); |
574 | 574 | // $disabled = $QFI->get('QST_disabled') ? ' disabled="disabled"' : ''; |
575 | 575 | $disabled = $QFI->get('QST_disabled') ? TRUE : FALSE; |
576 | - $required_label = apply_filters(' FHEE__EEH_Form_Fields__generate_form_input__required_label', '<em>*</em>' ); |
|
576 | + $required_label = apply_filters(' FHEE__EEH_Form_Fields__generate_form_input__required_label', '<em>*</em>'); |
|
577 | 577 | $QST_required = $QFI->get('QST_required'); |
578 | - $required = $QST_required ? array( 'label' => $required_label, 'class' => 'required needs-value', 'title' => $QST_required ) : array(); |
|
579 | - $use_html_entities = $QFI->get_meta( 'htmlentities' ); |
|
580 | - $required_text = $QFI->get('QST_required_text') != '' ? $QFI->get('QST_required_text') : __( 'This field is required', 'event_espresso' ); |
|
581 | - $required_text = $QST_required ? "\n\t\t\t" . '<div class="required-text hidden">' . self::prep_answer( $required_text, $use_html_entities ) . '</div>' : ''; |
|
578 | + $required = $QST_required ? array('label' => $required_label, 'class' => 'required needs-value', 'title' => $QST_required) : array(); |
|
579 | + $use_html_entities = $QFI->get_meta('htmlentities'); |
|
580 | + $required_text = $QFI->get('QST_required_text') != '' ? $QFI->get('QST_required_text') : __('This field is required', 'event_espresso'); |
|
581 | + $required_text = $QST_required ? "\n\t\t\t".'<div class="required-text hidden">'.self::prep_answer($required_text, $use_html_entities).'</div>' : ''; |
|
582 | 582 | $label_class = 'espresso-form-input-lbl'; |
583 | - $QST_options = $QFI->options(true,$answer); |
|
584 | - $options = is_array( $QST_options ) ? self::prep_answer_options( $QST_options ) : array(); |
|
583 | + $QST_options = $QFI->options(true, $answer); |
|
584 | + $options = is_array($QST_options) ? self::prep_answer_options($QST_options) : array(); |
|
585 | 585 | $system_ID = $QFI->get('QST_system'); |
586 | - $label_b4 = $QFI->get_meta( 'label_b4' ); |
|
587 | - $use_desc_4_label = $QFI->get_meta( 'use_desc_4_label' ); |
|
586 | + $label_b4 = $QFI->get_meta('label_b4'); |
|
587 | + $use_desc_4_label = $QFI->get_meta('use_desc_4_label'); |
|
588 | 588 | |
589 | 589 | |
590 | - switch ( $QFI->get('QST_type') ){ |
|
590 | + switch ($QFI->get('QST_type')) { |
|
591 | 591 | |
592 | 592 | case 'TEXTAREA' : |
593 | - return EEH_Form_Fields::textarea( $display_text, $answer, $input_name, $input_id, $input_class, array(), $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities ); |
|
593 | + return EEH_Form_Fields::textarea($display_text, $answer, $input_name, $input_id, $input_class, array(), $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities); |
|
594 | 594 | break; |
595 | 595 | |
596 | 596 | case 'DROPDOWN' : |
597 | - return EEH_Form_Fields::select( $display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, TRUE ); |
|
597 | + return EEH_Form_Fields::select($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, TRUE); |
|
598 | 598 | break; |
599 | 599 | |
600 | 600 | |
601 | 601 | case 'RADIO_BTN' : |
602 | - return EEH_Form_Fields::radio( $display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, $label_b4, $use_desc_4_label ); |
|
602 | + return EEH_Form_Fields::radio($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, $label_b4, $use_desc_4_label); |
|
603 | 603 | break; |
604 | 604 | |
605 | 605 | case 'CHECKBOX' : |
606 | - return EEH_Form_Fields::checkbox( $display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $label_b4, $system_ID, $use_html_entities ); |
|
606 | + return EEH_Form_Fields::checkbox($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $label_b4, $system_ID, $use_html_entities); |
|
607 | 607 | break; |
608 | 608 | |
609 | 609 | case 'DATE' : |
610 | - return EEH_Form_Fields::datepicker( $display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities ); |
|
610 | + return EEH_Form_Fields::datepicker($display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities); |
|
611 | 611 | break; |
612 | 612 | |
613 | 613 | case 'TEXT' : |
614 | 614 | default: |
615 | - return EEH_Form_Fields::text( $display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities ); |
|
615 | + return EEH_Form_Fields::text($display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities); |
|
616 | 616 | break; |
617 | 617 | |
618 | 618 | } |
@@ -638,31 +638,31 @@ discard block |
||
638 | 638 | * @param string $disabled disabled="disabled" or null |
639 | 639 | * @return string HTML |
640 | 640 | */ |
641 | - static function text( $question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) { |
|
641 | + static function text($question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) { |
|
642 | 642 | // need these |
643 | - if ( ! $question || ! $name ) { |
|
643 | + if ( ! $question || ! $name) { |
|
644 | 644 | return NULL; |
645 | 645 | } |
646 | 646 | // prep the answer |
647 | - $answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities ); |
|
647 | + $answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities); |
|
648 | 648 | // prep the required array |
649 | - $required = self::prep_required( $required ); |
|
649 | + $required = self::prep_required($required); |
|
650 | 650 | // set disabled tag |
651 | - $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
651 | + $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
652 | 652 | // ya gots ta have style man!!! |
653 | 653 | $txt_class = is_admin() ? 'regular-text' : 'espresso-text-inp'; |
654 | - $class = empty( $class ) ? $txt_class : $class; |
|
655 | - $class .= ! empty( $system_ID ) ? ' ' . $system_ID : ''; |
|
656 | - $extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' ); |
|
654 | + $class = empty($class) ? $txt_class : $class; |
|
655 | + $class .= ! empty($system_ID) ? ' '.$system_ID : ''; |
|
656 | + $extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', ''); |
|
657 | 657 | |
658 | - $label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>'; |
|
658 | + $label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>'; |
|
659 | 659 | // filter label but ensure required text comes before it |
660 | - $label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text ); |
|
660 | + $label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text); |
|
661 | 661 | |
662 | - $input_html = "\n\t\t\t" . '<input type="text" name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" value="' . esc_attr( $answer ) . '" title="' . esc_attr( $required['msg'] ) . '" ' . $disabled .' ' . $extra . '/>'; |
|
662 | + $input_html = "\n\t\t\t".'<input type="text" name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" value="'.esc_attr($answer).'" title="'.esc_attr($required['msg']).'" '.$disabled.' '.$extra.'/>'; |
|
663 | 663 | |
664 | - $input_html = apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id ); |
|
665 | - return $label_html . $input_html; |
|
664 | + $input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id); |
|
665 | + return $label_html.$input_html; |
|
666 | 666 | |
667 | 667 | } |
668 | 668 | |
@@ -684,35 +684,35 @@ discard block |
||
684 | 684 | * @param string $disabled disabled="disabled" or null |
685 | 685 | * @return string HTML |
686 | 686 | */ |
687 | - static function textarea( $question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $dimensions = FALSE, $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) { |
|
687 | + static function textarea($question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $dimensions = FALSE, $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) { |
|
688 | 688 | // need these |
689 | - if ( ! $question || ! $name ) { |
|
689 | + if ( ! $question || ! $name) { |
|
690 | 690 | return NULL; |
691 | 691 | } |
692 | 692 | // prep the answer |
693 | - $answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities ); |
|
693 | + $answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities); |
|
694 | 694 | // prep the required array |
695 | - $required = self::prep_required( $required ); |
|
695 | + $required = self::prep_required($required); |
|
696 | 696 | // make sure $dimensions is an array |
697 | - $dimensions = is_array( $dimensions ) ? $dimensions : array(); |
|
697 | + $dimensions = is_array($dimensions) ? $dimensions : array(); |
|
698 | 698 | // and set some defaults |
699 | - $dimensions = array_merge( array( 'rows' => 3, 'cols' => 40 ), $dimensions ); |
|
699 | + $dimensions = array_merge(array('rows' => 3, 'cols' => 40), $dimensions); |
|
700 | 700 | // set disabled tag |
701 | - $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
701 | + $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
702 | 702 | // ya gots ta have style man!!! |
703 | 703 | $txt_class = is_admin() ? 'regular-text' : 'espresso-textarea-inp'; |
704 | - $class = empty( $class ) ? $txt_class : $class; |
|
705 | - $class .= ! empty( $system_ID ) ? ' ' . $system_ID : ''; |
|
706 | - $extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' ); |
|
704 | + $class = empty($class) ? $txt_class : $class; |
|
705 | + $class .= ! empty($system_ID) ? ' '.$system_ID : ''; |
|
706 | + $extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', ''); |
|
707 | 707 | |
708 | - $label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>'; |
|
708 | + $label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>'; |
|
709 | 709 | // filter label but ensure required text comes before it |
710 | - $label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text ); |
|
710 | + $label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text); |
|
711 | 711 | |
712 | - $input_html = "\n\t\t\t" . '<textarea name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" rows="' . $dimensions['rows'] . '" cols="' . $dimensions['cols'] . '" title="' . $required['msg'] . '" ' . $disabled . ' ' . $extra . '>' . $answer . '</textarea>'; |
|
712 | + $input_html = "\n\t\t\t".'<textarea name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" rows="'.$dimensions['rows'].'" cols="'.$dimensions['cols'].'" title="'.$required['msg'].'" '.$disabled.' '.$extra.'>'.$answer.'</textarea>'; |
|
713 | 713 | |
714 | - $input_html = apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id ); |
|
715 | - return $label_html . $input_html; |
|
714 | + $input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id); |
|
715 | + return $label_html.$input_html; |
|
716 | 716 | |
717 | 717 | } |
718 | 718 | |
@@ -735,47 +735,47 @@ discard block |
||
735 | 735 | * @param string $disabled disabled="disabled" or null |
736 | 736 | * @return string HTML |
737 | 737 | */ |
738 | - static function select( $question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $add_please_select_option = FALSE ) { |
|
738 | + static function select($question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $add_please_select_option = FALSE) { |
|
739 | 739 | |
740 | 740 | // need these |
741 | - if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) { |
|
741 | + if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) { |
|
742 | 742 | return NULL; |
743 | 743 | } |
744 | 744 | // prep the answer |
745 | - $answer = is_array( $answer ) ? self::prep_answer( array_shift( $answer ), $use_html_entities) : self::prep_answer( $answer, $use_html_entities ); |
|
745 | + $answer = is_array($answer) ? self::prep_answer(array_shift($answer), $use_html_entities) : self::prep_answer($answer, $use_html_entities); |
|
746 | 746 | // prep the required array |
747 | - $required = self::prep_required( $required ); |
|
747 | + $required = self::prep_required($required); |
|
748 | 748 | // set disabled tag |
749 | - $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
749 | + $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
750 | 750 | // ya gots ta have style man!!! |
751 | 751 | $txt_class = is_admin() ? 'wide' : 'espresso-select-inp'; |
752 | - $class = empty( $class ) ? $txt_class : $class; |
|
753 | - $class .= ! empty( $system_ID ) ? ' ' . $system_ID : ''; |
|
754 | - $extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' ); |
|
752 | + $class = empty($class) ? $txt_class : $class; |
|
753 | + $class .= ! empty($system_ID) ? ' '.$system_ID : ''; |
|
754 | + $extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', ''); |
|
755 | 755 | |
756 | - $label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>'; |
|
756 | + $label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>'; |
|
757 | 757 | // filter label but ensure required text comes before it |
758 | - $label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text ); |
|
758 | + $label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text); |
|
759 | 759 | |
760 | - $input_html = "\n\t\t\t" . '<select name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" title="' . esc_attr( $required['msg'] ) . '"' . $disabled . ' ' . $extra . '>'; |
|
760 | + $input_html = "\n\t\t\t".'<select name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" title="'.esc_attr($required['msg']).'"'.$disabled.' '.$extra.'>'; |
|
761 | 761 | // recursively count array elements, to determine total number of options |
762 | - $only_option = count( $options, 1 ) == 1 ? TRUE : FALSE; |
|
763 | - if ( ! $only_option ) { |
|
762 | + $only_option = count($options, 1) == 1 ? TRUE : FALSE; |
|
763 | + if ( ! $only_option) { |
|
764 | 764 | // if there is NO answer set and there are multiple options to choose from, then set the "please select" message as selected |
765 | 765 | $selected = $answer === NULL ? ' selected="selected"' : ''; |
766 | - $input_html .= $add_please_select_option ? "\n\t\t\t\t" . '<option value=""' . $selected . '>' . __(' - please select - ', 'event_espresso') . '</option>' : ''; |
|
766 | + $input_html .= $add_please_select_option ? "\n\t\t\t\t".'<option value=""'.$selected.'>'.__(' - please select - ', 'event_espresso').'</option>' : ''; |
|
767 | 767 | } |
768 | - foreach ( $options as $key => $value ) { |
|
768 | + foreach ($options as $key => $value) { |
|
769 | 769 | // if value is an array, then create option groups, else create regular ol' options |
770 | - $input_html .= is_array( $value ) ? self::_generate_select_option_group( $key, $value, $answer, $use_html_entities ) : self::_generate_select_option( $value->value(), $value->desc(), $answer, $only_option, $use_html_entities ); |
|
770 | + $input_html .= is_array($value) ? self::_generate_select_option_group($key, $value, $answer, $use_html_entities) : self::_generate_select_option($value->value(), $value->desc(), $answer, $only_option, $use_html_entities); |
|
771 | 771 | } |
772 | 772 | |
773 | - $input_html .= "\n\t\t\t" . '</select>'; |
|
773 | + $input_html .= "\n\t\t\t".'</select>'; |
|
774 | 774 | |
775 | - $input_html = apply_filters( 'FHEE__EEH_Form_Fields__select__before_end_wrapper', $input_html, $question, $answer, $name, $id, $class, $system_ID ); |
|
775 | + $input_html = apply_filters('FHEE__EEH_Form_Fields__select__before_end_wrapper', $input_html, $question, $answer, $name, $id, $class, $system_ID); |
|
776 | 776 | |
777 | - $input_html = apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id ); |
|
778 | - return $label_html . $input_html; |
|
777 | + $input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id); |
|
778 | + return $label_html.$input_html; |
|
779 | 779 | |
780 | 780 | } |
781 | 781 | |
@@ -793,12 +793,12 @@ discard block |
||
793 | 793 | * @param boolean $use_html_entities |
794 | 794 | * @return string |
795 | 795 | */ |
796 | - private static function _generate_select_option_group( $opt_group, $QSOs, $answer, $use_html_entities = true ){ |
|
797 | - $html = "\n\t\t\t\t" . '<optgroup label="' . self::prep_option_value( $opt_group ) . '">'; |
|
798 | - foreach ( $QSOs as $QSO ) { |
|
799 | - $html .= self::_generate_select_option( $QSO->value(), $QSO->desc(), $answer, false, $use_html_entities ); |
|
796 | + private static function _generate_select_option_group($opt_group, $QSOs, $answer, $use_html_entities = true) { |
|
797 | + $html = "\n\t\t\t\t".'<optgroup label="'.self::prep_option_value($opt_group).'">'; |
|
798 | + foreach ($QSOs as $QSO) { |
|
799 | + $html .= self::_generate_select_option($QSO->value(), $QSO->desc(), $answer, false, $use_html_entities); |
|
800 | 800 | } |
801 | - $html .= "\n\t\t\t\t" . '</optgroup>'; |
|
801 | + $html .= "\n\t\t\t\t".'</optgroup>'; |
|
802 | 802 | return $html; |
803 | 803 | } |
804 | 804 | |
@@ -813,12 +813,12 @@ discard block |
||
813 | 813 | * @param boolean $use_html_entities |
814 | 814 | * @return string |
815 | 815 | */ |
816 | - private static function _generate_select_option( $key, $value, $answer, $only_option = FALSE, $use_html_entities = true ){ |
|
817 | - $key = self::prep_answer( $key, $use_html_entities ); |
|
818 | - $value = self::prep_answer( $value, $use_html_entities ); |
|
819 | - $value = ! empty( $value ) ? $value : $key; |
|
820 | - $selected = ( $answer == $key || $only_option ) ? ' selected="selected"' : ''; |
|
821 | - return "\n\t\t\t\t" . '<option value="' . self::prep_option_value( $key ) . '"' . $selected . '> ' . $value . ' </option>'; |
|
816 | + private static function _generate_select_option($key, $value, $answer, $only_option = FALSE, $use_html_entities = true) { |
|
817 | + $key = self::prep_answer($key, $use_html_entities); |
|
818 | + $value = self::prep_answer($value, $use_html_entities); |
|
819 | + $value = ! empty($value) ? $value : $key; |
|
820 | + $selected = ($answer == $key || $only_option) ? ' selected="selected"' : ''; |
|
821 | + return "\n\t\t\t\t".'<option value="'.self::prep_option_value($key).'"'.$selected.'> '.$value.' </option>'; |
|
822 | 822 | } |
823 | 823 | |
824 | 824 | |
@@ -842,56 +842,56 @@ discard block |
||
842 | 842 | * @param bool $use_desc_4_label |
843 | 843 | * @return string HTML |
844 | 844 | */ |
845 | - static function radio( $question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $label_b4 = FALSE, $use_desc_4_label = FALSE ) { |
|
845 | + static function radio($question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $label_b4 = FALSE, $use_desc_4_label = FALSE) { |
|
846 | 846 | // need these |
847 | - if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) { |
|
847 | + if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) { |
|
848 | 848 | return NULL; |
849 | 849 | } |
850 | 850 | // prep the answer |
851 | - $answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities ); |
|
851 | + $answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities); |
|
852 | 852 | // prep the required array |
853 | - $required = self::prep_required( $required ); |
|
853 | + $required = self::prep_required($required); |
|
854 | 854 | // set disabled tag |
855 | - $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
855 | + $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
856 | 856 | // ya gots ta have style man!!! |
857 | 857 | $radio_class = is_admin() ? 'ee-admin-radio-lbl' : $label_class; |
858 | - $class = ! empty( $class ) ? $class : 'espresso-radio-btn-inp'; |
|
859 | - $extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' ); |
|
858 | + $class = ! empty($class) ? $class : 'espresso-radio-btn-inp'; |
|
859 | + $extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', ''); |
|
860 | 860 | |
861 | - $label_html = $required_text . "\n\t\t\t" . '<label class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label> '; |
|
861 | + $label_html = $required_text."\n\t\t\t".'<label class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label> '; |
|
862 | 862 | // filter label but ensure required text comes before it |
863 | - $label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text ); |
|
863 | + $label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text); |
|
864 | 864 | |
865 | - $input_html = "\n\t\t\t" . '<ul id="' . $id . '-ul" class="espresso-radio-btn-options-ul ' . $label_class . ' ' . $class . '-ul">'; |
|
865 | + $input_html = "\n\t\t\t".'<ul id="'.$id.'-ul" class="espresso-radio-btn-options-ul '.$label_class.' '.$class.'-ul">'; |
|
866 | 866 | |
867 | - $class .= ! empty( $system_ID ) ? ' ' . $system_ID : ''; |
|
868 | - $class .= ! empty( $required['class'] ) ? ' ' . $required['class'] : ''; |
|
867 | + $class .= ! empty($system_ID) ? ' '.$system_ID : ''; |
|
868 | + $class .= ! empty($required['class']) ? ' '.$required['class'] : ''; |
|
869 | 869 | |
870 | - foreach ( $options as $OPT ) { |
|
871 | - if ( $OPT instanceof EE_Question_Option ) { |
|
872 | - $value = self::prep_option_value( $OPT->value() ); |
|
870 | + foreach ($options as $OPT) { |
|
871 | + if ($OPT instanceof EE_Question_Option) { |
|
872 | + $value = self::prep_option_value($OPT->value()); |
|
873 | 873 | $label = $use_desc_4_label ? $OPT->desc() : $OPT->value(); |
874 | - $size = $use_desc_4_label ? self::get_label_size_class( $OPT->value() . ' ' . $OPT->desc() ) : self::get_label_size_class( $OPT->value() ); |
|
875 | - $desc = $OPT->desc();//no self::prep_answer |
|
876 | - $answer = is_numeric( $value ) && empty( $answer ) ? 0 : $answer; |
|
877 | - $checked = (string)$value == (string)$answer ? ' checked="checked"' : ''; |
|
878 | - $opt = '-' . sanitize_key( $value ); |
|
879 | - |
|
880 | - $input_html .= "\n\t\t\t\t" . '<li' . $size . '>'; |
|
881 | - $input_html .= "\n\t\t\t\t\t" . '<label class="' . $radio_class . ' espresso-radio-btn-lbl">'; |
|
882 | - $input_html .= $label_b4 ? "\n\t\t\t\t\t\t" . '<span>' . $label . '</span>' : ''; |
|
883 | - $input_html .= "\n\t\t\t\t\t\t" . '<input type="radio" name="' . $name . '" id="' . $id . $opt . '" class="' . $class . '" value="' . $value . '" title="' . esc_attr( $required['msg'] ) . '" ' . $disabled . $checked . ' ' . $extra . '/>'; |
|
884 | - $input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t" . '<span class="espresso-radio-btn-desc">' . $label . '</span>' : ''; |
|
885 | - $input_html .= "\n\t\t\t\t\t" . '</label>'; |
|
886 | - $input_html .= $use_desc_4_label ? '' : '<span class="espresso-radio-btn-option-desc small-text grey-text">' . $desc . '</span>'; |
|
887 | - $input_html .= "\n\t\t\t\t" . '</li>'; |
|
874 | + $size = $use_desc_4_label ? self::get_label_size_class($OPT->value().' '.$OPT->desc()) : self::get_label_size_class($OPT->value()); |
|
875 | + $desc = $OPT->desc(); //no self::prep_answer |
|
876 | + $answer = is_numeric($value) && empty($answer) ? 0 : $answer; |
|
877 | + $checked = (string) $value == (string) $answer ? ' checked="checked"' : ''; |
|
878 | + $opt = '-'.sanitize_key($value); |
|
879 | + |
|
880 | + $input_html .= "\n\t\t\t\t".'<li'.$size.'>'; |
|
881 | + $input_html .= "\n\t\t\t\t\t".'<label class="'.$radio_class.' espresso-radio-btn-lbl">'; |
|
882 | + $input_html .= $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$label.'</span>' : ''; |
|
883 | + $input_html .= "\n\t\t\t\t\t\t".'<input type="radio" name="'.$name.'" id="'.$id.$opt.'" class="'.$class.'" value="'.$value.'" title="'.esc_attr($required['msg']).'" '.$disabled.$checked.' '.$extra.'/>'; |
|
884 | + $input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t".'<span class="espresso-radio-btn-desc">'.$label.'</span>' : ''; |
|
885 | + $input_html .= "\n\t\t\t\t\t".'</label>'; |
|
886 | + $input_html .= $use_desc_4_label ? '' : '<span class="espresso-radio-btn-option-desc small-text grey-text">'.$desc.'</span>'; |
|
887 | + $input_html .= "\n\t\t\t\t".'</li>'; |
|
888 | 888 | } |
889 | 889 | } |
890 | 890 | |
891 | - $input_html .= "\n\t\t\t" . '</ul>'; |
|
891 | + $input_html .= "\n\t\t\t".'</ul>'; |
|
892 | 892 | |
893 | - $input_html = apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id ); |
|
894 | - return $label_html . $input_html; |
|
893 | + $input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id); |
|
894 | + return $label_html.$input_html; |
|
895 | 895 | |
896 | 896 | } |
897 | 897 | |
@@ -914,65 +914,65 @@ discard block |
||
914 | 914 | * @param string $disabled disabled="disabled" or null |
915 | 915 | * @return string HTML |
916 | 916 | */ |
917 | - static function checkbox( $question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $label_b4 = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) { |
|
917 | + static function checkbox($question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $label_b4 = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) { |
|
918 | 918 | // need these |
919 | - if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) { |
|
919 | + if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) { |
|
920 | 920 | return NULL; |
921 | 921 | } |
922 | - $answer = maybe_unserialize( $answer ); |
|
922 | + $answer = maybe_unserialize($answer); |
|
923 | 923 | |
924 | 924 | // prep the answer(s) |
925 | - $answer = is_array( $answer ) ? $answer : array( sanitize_key( $answer ) => $answer ); |
|
925 | + $answer = is_array($answer) ? $answer : array(sanitize_key($answer) => $answer); |
|
926 | 926 | |
927 | - foreach ( $answer as $key => $value ) { |
|
928 | - $key = self::prep_option_value( $key ); |
|
929 | - $answer[$key] = self::prep_answer( $value, $use_html_entities ); |
|
927 | + foreach ($answer as $key => $value) { |
|
928 | + $key = self::prep_option_value($key); |
|
929 | + $answer[$key] = self::prep_answer($value, $use_html_entities); |
|
930 | 930 | } |
931 | 931 | |
932 | 932 | // prep the required array |
933 | - $required = self::prep_required( $required ); |
|
933 | + $required = self::prep_required($required); |
|
934 | 934 | // set disabled tag |
935 | - $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
935 | + $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
936 | 936 | // ya gots ta have style man!!! |
937 | 937 | $radio_class = is_admin() ? 'ee-admin-radio-lbl' : $label_class; |
938 | - $class = empty( $class ) ? 'espresso-radio-btn-inp' : $class; |
|
939 | - $extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' ); |
|
938 | + $class = empty($class) ? 'espresso-radio-btn-inp' : $class; |
|
939 | + $extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', ''); |
|
940 | 940 | |
941 | - $label_html = $required_text . "\n\t\t\t" . '<label class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label> '; |
|
941 | + $label_html = $required_text."\n\t\t\t".'<label class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label> '; |
|
942 | 942 | // filter label but ensure required text comes before it |
943 | - $label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text ); |
|
944 | - |
|
945 | - $input_html = "\n\t\t\t" . '<ul id="' . $id . '-ul" class="espresso-checkbox-options-ul ' . $label_class . ' ' . $class . '-ul">'; |
|
946 | - |
|
947 | - $class .= ! empty( $system_ID ) ? ' ' . $system_ID : ''; |
|
948 | - $class .= ! empty( $required['class'] ) ? ' ' . $required['class'] : ''; |
|
949 | - |
|
950 | - foreach ( $options as $OPT ) { |
|
951 | - $value = $OPT->value();//self::prep_option_value( $OPT->value() ); |
|
952 | - $size = self::get_label_size_class( $OPT->value() . ' ' . $OPT->desc() ); |
|
953 | - $text = self::prep_answer( $OPT->value() ); |
|
954 | - $desc = $OPT->desc() ; |
|
955 | - $opt = '-' . sanitize_key( $value ); |
|
956 | - |
|
957 | - $checked = is_array( $answer ) && in_array( $text, $answer ) ? ' checked="checked"' : ''; |
|
958 | - |
|
959 | - $input_html .= "\n\t\t\t\t" . '<li' . $size . '>'; |
|
960 | - $input_html .= "\n\t\t\t\t\t" . '<label class="' . $radio_class . ' espresso-checkbox-lbl">'; |
|
961 | - $input_html .= $label_b4 ? "\n\t\t\t\t\t\t" . '<span>' . $text . '</span>' : ''; |
|
962 | - $input_html .= "\n\t\t\t\t\t\t" . '<input type="checkbox" name="' . $name . '[' . $OPT->ID() . ']" id="' . $id . $opt . '" class="' . $class . '" value="' . $value . '" title="' . esc_attr( $required['msg'] ) . '" ' . $disabled . $checked . ' ' . $extra . '/>'; |
|
963 | - $input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t" . '<span>' . $text . '</span>' : ''; |
|
964 | - $input_html .= "\n\t\t\t\t\t" . '</label>'; |
|
965 | - if ( ! empty( $desc ) && $desc != $text ) { |
|
966 | - $input_html .= "\n\t\t\t\t\t" . ' <br/><div class="espresso-checkbox-option-desc small-text grey-text">' . $desc . '</div>'; |
|
943 | + $label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text); |
|
944 | + |
|
945 | + $input_html = "\n\t\t\t".'<ul id="'.$id.'-ul" class="espresso-checkbox-options-ul '.$label_class.' '.$class.'-ul">'; |
|
946 | + |
|
947 | + $class .= ! empty($system_ID) ? ' '.$system_ID : ''; |
|
948 | + $class .= ! empty($required['class']) ? ' '.$required['class'] : ''; |
|
949 | + |
|
950 | + foreach ($options as $OPT) { |
|
951 | + $value = $OPT->value(); //self::prep_option_value( $OPT->value() ); |
|
952 | + $size = self::get_label_size_class($OPT->value().' '.$OPT->desc()); |
|
953 | + $text = self::prep_answer($OPT->value()); |
|
954 | + $desc = $OPT->desc(); |
|
955 | + $opt = '-'.sanitize_key($value); |
|
956 | + |
|
957 | + $checked = is_array($answer) && in_array($text, $answer) ? ' checked="checked"' : ''; |
|
958 | + |
|
959 | + $input_html .= "\n\t\t\t\t".'<li'.$size.'>'; |
|
960 | + $input_html .= "\n\t\t\t\t\t".'<label class="'.$radio_class.' espresso-checkbox-lbl">'; |
|
961 | + $input_html .= $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$text.'</span>' : ''; |
|
962 | + $input_html .= "\n\t\t\t\t\t\t".'<input type="checkbox" name="'.$name.'['.$OPT->ID().']" id="'.$id.$opt.'" class="'.$class.'" value="'.$value.'" title="'.esc_attr($required['msg']).'" '.$disabled.$checked.' '.$extra.'/>'; |
|
963 | + $input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$text.'</span>' : ''; |
|
964 | + $input_html .= "\n\t\t\t\t\t".'</label>'; |
|
965 | + if ( ! empty($desc) && $desc != $text) { |
|
966 | + $input_html .= "\n\t\t\t\t\t".' <br/><div class="espresso-checkbox-option-desc small-text grey-text">'.$desc.'</div>'; |
|
967 | 967 | } |
968 | - $input_html .= "\n\t\t\t\t" . '</li>'; |
|
968 | + $input_html .= "\n\t\t\t\t".'</li>'; |
|
969 | 969 | |
970 | 970 | } |
971 | 971 | |
972 | - $input_html .= "\n\t\t\t" . '</ul>'; |
|
972 | + $input_html .= "\n\t\t\t".'</ul>'; |
|
973 | 973 | |
974 | - $input_html = apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id ); |
|
975 | - return $label_html . $input_html; |
|
974 | + $input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id); |
|
975 | + return $label_html.$input_html; |
|
976 | 976 | |
977 | 977 | } |
978 | 978 | |
@@ -994,36 +994,36 @@ discard block |
||
994 | 994 | * @param string $disabled disabled="disabled" or null |
995 | 995 | * @return string HTML |
996 | 996 | */ |
997 | - static function datepicker( $question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) { |
|
997 | + static function datepicker($question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) { |
|
998 | 998 | // need these |
999 | - if ( ! $question || ! $name ) { |
|
999 | + if ( ! $question || ! $name) { |
|
1000 | 1000 | return NULL; |
1001 | 1001 | } |
1002 | 1002 | // prep the answer |
1003 | - $answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities ); |
|
1003 | + $answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities); |
|
1004 | 1004 | // prep the required array |
1005 | - $required = self::prep_required( $required ); |
|
1005 | + $required = self::prep_required($required); |
|
1006 | 1006 | // set disabled tag |
1007 | - $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
1007 | + $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
1008 | 1008 | // ya gots ta have style man!!! |
1009 | 1009 | $txt_class = is_admin() ? 'regular-text' : 'espresso-datepicker-inp'; |
1010 | - $class = empty( $class ) ? $txt_class : $class; |
|
1011 | - $class .= ! empty( $system_ID ) ? ' ' . $system_ID : ''; |
|
1012 | - $extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' ); |
|
1010 | + $class = empty($class) ? $txt_class : $class; |
|
1011 | + $class .= ! empty($system_ID) ? ' '.$system_ID : ''; |
|
1012 | + $extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', ''); |
|
1013 | 1013 | |
1014 | - $label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>'; |
|
1014 | + $label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>'; |
|
1015 | 1015 | // filter label but ensure required text comes before it |
1016 | - $label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text ); |
|
1016 | + $label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text); |
|
1017 | 1017 | |
1018 | - $input_html = "\n\t\t\t" . '<input type="text" name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . ' datepicker" value="' . $answer . '" title="' . esc_attr( $required['msg'] ) . '" ' . $disabled . ' ' . $extra . '/>'; |
|
1018 | + $input_html = "\n\t\t\t".'<input type="text" name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].' datepicker" value="'.$answer.'" title="'.esc_attr($required['msg']).'" '.$disabled.' '.$extra.'/>'; |
|
1019 | 1019 | |
1020 | 1020 | // enqueue scripts |
1021 | - wp_register_style( 'espresso-ui-theme', EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1022 | - wp_enqueue_style( 'espresso-ui-theme'); |
|
1023 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
1021 | + wp_register_style('espresso-ui-theme', EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION); |
|
1022 | + wp_enqueue_style('espresso-ui-theme'); |
|
1023 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
1024 | 1024 | |
1025 | - $input_html = apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id ); |
|
1026 | - return $label_html . $input_html; |
|
1025 | + $input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id); |
|
1026 | + return $label_html.$input_html; |
|
1027 | 1027 | |
1028 | 1028 | } |
1029 | 1029 | |
@@ -1035,7 +1035,7 @@ discard block |
||
1035 | 1035 | * @access public |
1036 | 1036 | * @return string |
1037 | 1037 | */ |
1038 | - public static function remove_label_keep_required_msg( $label_html, $required_text ) { |
|
1038 | + public static function remove_label_keep_required_msg($label_html, $required_text) { |
|
1039 | 1039 | return $required_text; |
1040 | 1040 | } |
1041 | 1041 | |
@@ -1049,9 +1049,9 @@ discard block |
||
1049 | 1049 | * @param string $value |
1050 | 1050 | * @return string HTML |
1051 | 1051 | */ |
1052 | - static function hidden_input( $name, $value, $id = '' ){ |
|
1053 | - $id = ! empty( $id ) ? $id : $name; |
|
1054 | - return '<input id="' . $id . '" type="hidden" name="'.$name.'" value="' . $value . '"/>'; |
|
1052 | + static function hidden_input($name, $value, $id = '') { |
|
1053 | + $id = ! empty($id) ? $id : $name; |
|
1054 | + return '<input id="'.$id.'" type="hidden" name="'.$name.'" value="'.$value.'"/>'; |
|
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | |
@@ -1063,7 +1063,7 @@ discard block |
||
1063 | 1063 | * @param string $question |
1064 | 1064 | * @return string |
1065 | 1065 | */ |
1066 | - static function prep_question( $question ){ |
|
1066 | + static function prep_question($question) { |
|
1067 | 1067 | return $question; |
1068 | 1068 | // $link = ''; |
1069 | 1069 | // // does this label have a help link attached ? |
@@ -1086,13 +1086,13 @@ discard block |
||
1086 | 1086 | * @param mixed $answer |
1087 | 1087 | * @return string |
1088 | 1088 | */ |
1089 | - static function prep_answer( $answer, $use_html_entities = TRUE ){ |
|
1089 | + static function prep_answer($answer, $use_html_entities = TRUE) { |
|
1090 | 1090 | //make sure we convert bools first. Otherwise (bool) false becomes an empty string which is NOT desired, we want "0". |
1091 | - if ( is_bool( $answer ) ) { |
|
1091 | + if (is_bool($answer)) { |
|
1092 | 1092 | $answer = $answer ? 1 : 0; |
1093 | 1093 | } |
1094 | - $answer = trim( stripslashes( str_replace( ''', "'", $answer ))); |
|
1095 | - return $use_html_entities ? htmlentities( $answer, ENT_QUOTES, 'UTF-8' ) : $answer; |
|
1094 | + $answer = trim(stripslashes(str_replace(''', "'", $answer))); |
|
1095 | + return $use_html_entities ? htmlentities($answer, ENT_QUOTES, 'UTF-8') : $answer; |
|
1096 | 1096 | } |
1097 | 1097 | |
1098 | 1098 | |
@@ -1102,18 +1102,18 @@ discard block |
||
1102 | 1102 | * @param array $QSOs array of EE_Question_Option objects |
1103 | 1103 | * @return array |
1104 | 1104 | */ |
1105 | - public static function prep_answer_options( $QSOs = array() ){ |
|
1105 | + public static function prep_answer_options($QSOs = array()) { |
|
1106 | 1106 | $prepped_answer_options = array(); |
1107 | - if ( is_array( $QSOs ) && ! empty( $QSOs )) { |
|
1108 | - foreach( $QSOs as $key => $QSO ) { |
|
1109 | - if ( ! $QSO instanceof EE_Question_Option ) { |
|
1110 | - $QSO = EE_Question_Option::new_instance( array( |
|
1111 | - 'QSO_value' => is_array( $QSO ) && isset( $QSO['id'] ) ? (string)$QSO['id'] : (string)$key, |
|
1112 | - 'QSO_desc' => is_array( $QSO ) && isset( $QSO['text'] ) ? (string)$QSO['text'] : (string)$QSO |
|
1107 | + if (is_array($QSOs) && ! empty($QSOs)) { |
|
1108 | + foreach ($QSOs as $key => $QSO) { |
|
1109 | + if ( ! $QSO instanceof EE_Question_Option) { |
|
1110 | + $QSO = EE_Question_Option::new_instance(array( |
|
1111 | + 'QSO_value' => is_array($QSO) && isset($QSO['id']) ? (string) $QSO['id'] : (string) $key, |
|
1112 | + 'QSO_desc' => is_array($QSO) && isset($QSO['text']) ? (string) $QSO['text'] : (string) $QSO |
|
1113 | 1113 | )); |
1114 | 1114 | } |
1115 | - if ( $QSO->opt_group() ) { |
|
1116 | - $prepped_answer_options[ $QSO->opt_group() ][] = $QSO; |
|
1115 | + if ($QSO->opt_group()) { |
|
1116 | + $prepped_answer_options[$QSO->opt_group()][] = $QSO; |
|
1117 | 1117 | } else { |
1118 | 1118 | $prepped_answer_options[] = $QSO; |
1119 | 1119 | } |
@@ -1129,8 +1129,8 @@ discard block |
||
1129 | 1129 | * @param string $option_value |
1130 | 1130 | * @return string |
1131 | 1131 | */ |
1132 | - static function prep_option_value( $option_value ){ |
|
1133 | - return esc_attr( trim( stripslashes( $option_value ) ) ); |
|
1132 | + static function prep_option_value($option_value) { |
|
1133 | + return esc_attr(trim(stripslashes($option_value))); |
|
1134 | 1134 | } |
1135 | 1135 | |
1136 | 1136 | |
@@ -1141,11 +1141,11 @@ discard block |
||
1141 | 1141 | * @param string|array $required |
1142 | 1142 | * @return array |
1143 | 1143 | */ |
1144 | - static function prep_required( $required = array() ){ |
|
1144 | + static function prep_required($required = array()) { |
|
1145 | 1145 | // make sure required is an array |
1146 | - $required = is_array( $required ) ? $required : array(); |
|
1146 | + $required = is_array($required) ? $required : array(); |
|
1147 | 1147 | // and set some defaults |
1148 | - $required = array_merge( array( 'label' => '', 'class' => '', 'msg' => '' ), $required ); |
|
1148 | + $required = array_merge(array('label' => '', 'class' => '', 'msg' => ''), $required); |
|
1149 | 1149 | return $required; |
1150 | 1150 | } |
1151 | 1151 | |
@@ -1156,30 +1156,30 @@ discard block |
||
1156 | 1156 | * @param string $value |
1157 | 1157 | * @return string |
1158 | 1158 | */ |
1159 | - static function get_label_size_class( $value = FALSE ){ |
|
1160 | - if ( $value === FALSE || $value == '' ) { |
|
1159 | + static function get_label_size_class($value = FALSE) { |
|
1160 | + if ($value === FALSE || $value == '') { |
|
1161 | 1161 | return ' class="medium-lbl"'; |
1162 | 1162 | } |
1163 | 1163 | // determine length of option value |
1164 | - $val_size = strlen( $value ); |
|
1165 | - switch( $val_size ){ |
|
1164 | + $val_size = strlen($value); |
|
1165 | + switch ($val_size) { |
|
1166 | 1166 | case $val_size < 3 : |
1167 | - $size = ' class="nano-lbl"'; |
|
1167 | + $size = ' class="nano-lbl"'; |
|
1168 | 1168 | break; |
1169 | 1169 | case $val_size < 6 : |
1170 | - $size = ' class="micro-lbl"'; |
|
1170 | + $size = ' class="micro-lbl"'; |
|
1171 | 1171 | break; |
1172 | 1172 | case $val_size < 12 : |
1173 | - $size = ' class="tiny-lbl"'; |
|
1173 | + $size = ' class="tiny-lbl"'; |
|
1174 | 1174 | break; |
1175 | 1175 | case $val_size < 25 : |
1176 | - $size = ' class="small-lbl"'; |
|
1176 | + $size = ' class="small-lbl"'; |
|
1177 | 1177 | break; |
1178 | 1178 | case $val_size > 100 : |
1179 | - $size = ' class="big-lbl"'; |
|
1179 | + $size = ' class="big-lbl"'; |
|
1180 | 1180 | break; |
1181 | 1181 | default: |
1182 | - $size = ' class="medium-lbl"'; |
|
1182 | + $size = ' class="medium-lbl"'; |
|
1183 | 1183 | break; |
1184 | 1184 | } |
1185 | 1185 | return $size; |
@@ -1193,20 +1193,20 @@ discard block |
||
1193 | 1193 | * @param array $QFI |
1194 | 1194 | * @return array |
1195 | 1195 | */ |
1196 | - private static function _load_system_dropdowns( $QFI ){ |
|
1196 | + private static function _load_system_dropdowns($QFI) { |
|
1197 | 1197 | $QST_system = $QFI->get('QST_system'); |
1198 | - switch ( $QST_system ) { |
|
1198 | + switch ($QST_system) { |
|
1199 | 1199 | case 'state' : |
1200 | - $QFI = self::generate_state_dropdown( $QFI ); |
|
1200 | + $QFI = self::generate_state_dropdown($QFI); |
|
1201 | 1201 | break; |
1202 | 1202 | case 'country' : |
1203 | - $QFI = self::generate_country_dropdown( $QFI ); |
|
1203 | + $QFI = self::generate_country_dropdown($QFI); |
|
1204 | 1204 | break; |
1205 | 1205 | case 'admin-state' : |
1206 | - $QFI = self::generate_state_dropdown( $QFI, TRUE ); |
|
1206 | + $QFI = self::generate_state_dropdown($QFI, TRUE); |
|
1207 | 1207 | break; |
1208 | 1208 | case 'admin-country' : |
1209 | - $QFI = self::generate_country_dropdown( $QFI, TRUE ); |
|
1209 | + $QFI = self::generate_country_dropdown($QFI, TRUE); |
|
1210 | 1210 | break; |
1211 | 1211 | } |
1212 | 1212 | return $QFI; |
@@ -1223,13 +1223,13 @@ discard block |
||
1223 | 1223 | * |
1224 | 1224 | * @return EE_Question_Form_Input |
1225 | 1225 | */ |
1226 | - protected static function _load_specialized_dropdowns( $QFI ) { |
|
1227 | - switch( $QFI->get( 'QST_type' ) ) { |
|
1226 | + protected static function _load_specialized_dropdowns($QFI) { |
|
1227 | + switch ($QFI->get('QST_type')) { |
|
1228 | 1228 | case 'STATE' : |
1229 | - $QFI = self::generate_state_dropdown( $QFI ); |
|
1229 | + $QFI = self::generate_state_dropdown($QFI); |
|
1230 | 1230 | break; |
1231 | 1231 | case 'COUNTRY' : |
1232 | - $QFI = self::generate_country_dropdown( $QFI ); |
|
1232 | + $QFI = self::generate_country_dropdown($QFI); |
|
1233 | 1233 | break; |
1234 | 1234 | } |
1235 | 1235 | return $QFI; |
@@ -1243,23 +1243,23 @@ discard block |
||
1243 | 1243 | * @param bool $get_all |
1244 | 1244 | * @return array |
1245 | 1245 | */ |
1246 | - public static function generate_state_dropdown( $QST, $get_all = FALSE ){ |
|
1246 | + public static function generate_state_dropdown($QST, $get_all = FALSE) { |
|
1247 | 1247 | $states = $get_all ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_states_of_active_countries(); |
1248 | - if ( $states && count( $states ) != count( $QST->options() )) { |
|
1249 | - $QST->set( 'QST_type', 'DROPDOWN' ); |
|
1248 | + if ($states && count($states) != count($QST->options())) { |
|
1249 | + $QST->set('QST_type', 'DROPDOWN'); |
|
1250 | 1250 | // if multiple countries, we'll create option groups within the dropdown |
1251 | - foreach ( $states as $state ) { |
|
1252 | - if ( $state instanceof EE_State ) { |
|
1253 | - $QSO = EE_Question_Option::new_instance ( array ( |
|
1251 | + foreach ($states as $state) { |
|
1252 | + if ($state instanceof EE_State) { |
|
1253 | + $QSO = EE_Question_Option::new_instance(array( |
|
1254 | 1254 | 'QSO_value' => $state->ID(), |
1255 | 1255 | 'QSO_desc' => $state->name(), |
1256 | - 'QST_ID' => $QST->get( 'QST_ID' ), |
|
1256 | + 'QST_ID' => $QST->get('QST_ID'), |
|
1257 | 1257 | 'QSO_deleted' => FALSE |
1258 | 1258 | )); |
1259 | 1259 | // set option group |
1260 | - $QSO->set_opt_group( $state->country()->name() ); |
|
1260 | + $QSO->set_opt_group($state->country()->name()); |
|
1261 | 1261 | // add option to question |
1262 | - $QST->add_temp_option( $QSO ); |
|
1262 | + $QST->add_temp_option($QSO); |
|
1263 | 1263 | } |
1264 | 1264 | } |
1265 | 1265 | } |
@@ -1275,20 +1275,20 @@ discard block |
||
1275 | 1275 | * @internal param array $question |
1276 | 1276 | * @return array |
1277 | 1277 | */ |
1278 | - public static function generate_country_dropdown( $QST, $get_all = FALSE ){ |
|
1278 | + public static function generate_country_dropdown($QST, $get_all = FALSE) { |
|
1279 | 1279 | $countries = $get_all ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries(); |
1280 | - if ( $countries && count( $countries ) != count( $QST->options() ) ) { |
|
1281 | - $QST->set( 'QST_type', 'DROPDOWN' ); |
|
1280 | + if ($countries && count($countries) != count($QST->options())) { |
|
1281 | + $QST->set('QST_type', 'DROPDOWN'); |
|
1282 | 1282 | // now add countries |
1283 | - foreach ( $countries as $country ) { |
|
1284 | - if ( $country instanceof EE_Country ) { |
|
1285 | - $QSO = EE_Question_Option::new_instance ( array ( |
|
1283 | + foreach ($countries as $country) { |
|
1284 | + if ($country instanceof EE_Country) { |
|
1285 | + $QSO = EE_Question_Option::new_instance(array( |
|
1286 | 1286 | 'QSO_value' => $country->ID(), |
1287 | 1287 | 'QSO_desc' => $country->name(), |
1288 | - 'QST_ID' => $QST->get( 'QST_ID' ), |
|
1288 | + 'QST_ID' => $QST->get('QST_ID'), |
|
1289 | 1289 | 'QSO_deleted' => FALSE |
1290 | 1290 | )); |
1291 | - $QST->add_temp_option( $QSO ); |
|
1291 | + $QST->add_temp_option($QSO); |
|
1292 | 1292 | } |
1293 | 1293 | } |
1294 | 1294 | } |
@@ -1305,11 +1305,11 @@ discard block |
||
1305 | 1305 | */ |
1306 | 1306 | public static function two_digit_months_dropdown_options() { |
1307 | 1307 | $options = array(); |
1308 | - for ( $x = 1; $x <= 12; $x++ ) { |
|
1309 | - $mm = str_pad( $x, 2, '0', STR_PAD_LEFT ); |
|
1310 | - $options[ (string)$mm ] = (string)$mm; |
|
1308 | + for ($x = 1; $x <= 12; $x++) { |
|
1309 | + $mm = str_pad($x, 2, '0', STR_PAD_LEFT); |
|
1310 | + $options[(string) $mm] = (string) $mm; |
|
1311 | 1311 | } |
1312 | - return EEH_Form_Fields::prep_answer_options( $options ); |
|
1312 | + return EEH_Form_Fields::prep_answer_options($options); |
|
1313 | 1313 | } |
1314 | 1314 | |
1315 | 1315 | |
@@ -1324,11 +1324,11 @@ discard block |
||
1324 | 1324 | $options = array(); |
1325 | 1325 | $current_year = date('y'); |
1326 | 1326 | $next_decade = $current_year + 10; |
1327 | - for ( $x = $current_year; $x <= $next_decade; $x++ ) { |
|
1328 | - $yy = str_pad( $x, 2, '0', STR_PAD_LEFT ); |
|
1329 | - $options[ (string)$yy ] = (string)$yy; |
|
1327 | + for ($x = $current_year; $x <= $next_decade; $x++) { |
|
1328 | + $yy = str_pad($x, 2, '0', STR_PAD_LEFT); |
|
1329 | + $options[(string) $yy] = (string) $yy; |
|
1330 | 1330 | } |
1331 | - return EEH_Form_Fields::prep_answer_options( $options ); |
|
1331 | + return EEH_Form_Fields::prep_answer_options($options); |
|
1332 | 1332 | } |
1333 | 1333 | |
1334 | 1334 | |
@@ -1342,17 +1342,17 @@ discard block |
||
1342 | 1342 | * @param integer $evt_category Event Category ID if the Event Category filter is selected |
1343 | 1343 | * @return string html |
1344 | 1344 | */ |
1345 | - public static function generate_registration_months_dropdown( $cur_date = '', $status = '', $evt_category = 0 ) { |
|
1345 | + public static function generate_registration_months_dropdown($cur_date = '', $status = '', $evt_category = 0) { |
|
1346 | 1346 | $_where = array(); |
1347 | - if ( !empty( $status ) ) { |
|
1347 | + if ( ! empty($status)) { |
|
1348 | 1348 | $_where['STS_ID'] = $status; |
1349 | 1349 | } |
1350 | 1350 | |
1351 | - if ( $evt_category > 0 ) { |
|
1351 | + if ($evt_category > 0) { |
|
1352 | 1352 | $_where['Event.Term_Taxonomy.term_id'] = $evt_category; |
1353 | 1353 | } |
1354 | 1354 | |
1355 | - $regdtts = EEM_Registration::instance()->get_reg_months_and_years( $_where ); |
|
1355 | + $regdtts = EEM_Registration::instance()->get_reg_months_and_years($_where); |
|
1356 | 1356 | |
1357 | 1357 | //setup vals for select input helper |
1358 | 1358 | $options = array( |
@@ -1362,15 +1362,15 @@ discard block |
||
1362 | 1362 | ) |
1363 | 1363 | ); |
1364 | 1364 | |
1365 | - foreach ( $regdtts as $regdtt ) { |
|
1366 | - $date = $regdtt->reg_month. ' ' . $regdtt->reg_year; |
|
1365 | + foreach ($regdtts as $regdtt) { |
|
1366 | + $date = $regdtt->reg_month.' '.$regdtt->reg_year; |
|
1367 | 1367 | $options[] = array( |
1368 | 1368 | 'text' => $date, |
1369 | 1369 | 'id' => $date |
1370 | 1370 | ); |
1371 | 1371 | } |
1372 | 1372 | |
1373 | - return self::select_input('month_range', $options, $cur_date, '', 'wide' ); |
|
1373 | + return self::select_input('month_range', $options, $cur_date, '', 'wide'); |
|
1374 | 1374 | } |
1375 | 1375 | |
1376 | 1376 | |
@@ -1384,18 +1384,18 @@ discard block |
||
1384 | 1384 | * @param string $evt_active_status "upcoming", "expired", "active", or "inactive" |
1385 | 1385 | * @return string html |
1386 | 1386 | */ |
1387 | - public static function generate_event_months_dropdown( $cur_date = '', $status = NULL, $evt_category = NULL, $evt_active_status = NULL ) { |
|
1387 | + public static function generate_event_months_dropdown($cur_date = '', $status = NULL, $evt_category = NULL, $evt_active_status = NULL) { |
|
1388 | 1388 | //determine what post_status our condition will have for the query. |
1389 | - switch ( $status ) { |
|
1389 | + switch ($status) { |
|
1390 | 1390 | case 'month' : |
1391 | 1391 | case 'today' : |
1392 | 1392 | case NULL : |
1393 | 1393 | case 'all' : |
1394 | - $where['Event.status'] = array( 'NOT IN', array('trash') ); |
|
1394 | + $where['Event.status'] = array('NOT IN', array('trash')); |
|
1395 | 1395 | break; |
1396 | 1396 | |
1397 | 1397 | case 'draft' : |
1398 | - $where['Event.status'] = array( 'IN', array('draft', 'auto-draft') ); |
|
1398 | + $where['Event.status'] = array('IN', array('draft', 'auto-draft')); |
|
1399 | 1399 | |
1400 | 1400 | default : |
1401 | 1401 | $where['Event.status'] = $status; |
@@ -1404,7 +1404,7 @@ discard block |
||
1404 | 1404 | //categories? |
1405 | 1405 | |
1406 | 1406 | |
1407 | - if ( !empty ( $evt_category ) ) { |
|
1407 | + if ( ! empty ($evt_category)) { |
|
1408 | 1408 | $where['Event.Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
1409 | 1409 | $where['Event.Term_Taxonomy.term_id'] = $evt_category; |
1410 | 1410 | } |
@@ -1412,7 +1412,7 @@ discard block |
||
1412 | 1412 | |
1413 | 1413 | // $where['DTT_is_primary'] = 1; |
1414 | 1414 | |
1415 | - $DTTS = EE_Registry::instance()->load_model('Datetime')->get_dtt_months_and_years($where, $evt_active_status ); |
|
1415 | + $DTTS = EE_Registry::instance()->load_model('Datetime')->get_dtt_months_and_years($where, $evt_active_status); |
|
1416 | 1416 | |
1417 | 1417 | //let's setup vals for select input helper |
1418 | 1418 | $options = array( |
@@ -1425,9 +1425,9 @@ discard block |
||
1425 | 1425 | //translate month and date |
1426 | 1426 | global $wp_locale; |
1427 | 1427 | |
1428 | - foreach ( $DTTS as $DTT ) { |
|
1429 | - $localized_date = $wp_locale->get_month( date('m', strtotime($DTT->dtt_month)) ) . ' ' . $DTT->dtt_year; |
|
1430 | - $id = $DTT->dtt_month . ' ' . $DTT->dtt_year; |
|
1428 | + foreach ($DTTS as $DTT) { |
|
1429 | + $localized_date = $wp_locale->get_month(date('m', strtotime($DTT->dtt_month))).' '.$DTT->dtt_year; |
|
1430 | + $id = $DTT->dtt_month.' '.$DTT->dtt_year; |
|
1431 | 1431 | $options[] = array( |
1432 | 1432 | 'text' => $localized_date, |
1433 | 1433 | 'id' => $id |
@@ -1435,7 +1435,7 @@ discard block |
||
1435 | 1435 | } |
1436 | 1436 | |
1437 | 1437 | |
1438 | - return self::select_input( 'month_range', $options, $cur_date, '', 'wide' ); |
|
1438 | + return self::select_input('month_range', $options, $cur_date, '', 'wide'); |
|
1439 | 1439 | } |
1440 | 1440 | |
1441 | 1441 | |
@@ -1446,7 +1446,7 @@ discard block |
||
1446 | 1446 | * @param integer $current_cat currently selected category |
1447 | 1447 | * @return string html for dropdown |
1448 | 1448 | */ |
1449 | - public static function generate_event_category_dropdown( $current_cat = -1 ) { |
|
1449 | + public static function generate_event_category_dropdown($current_cat = -1) { |
|
1450 | 1450 | $categories = EEM_Term::instance()->get_all_ee_categories(TRUE); |
1451 | 1451 | $options = array( |
1452 | 1452 | '0' => array( |
@@ -1456,14 +1456,14 @@ discard block |
||
1456 | 1456 | ); |
1457 | 1457 | |
1458 | 1458 | //setup categories for dropdown |
1459 | - foreach ( $categories as $category ) { |
|
1459 | + foreach ($categories as $category) { |
|
1460 | 1460 | $options[] = array( |
1461 | 1461 | 'text' => $category->get('name'), |
1462 | 1462 | 'id' => $category->ID() |
1463 | 1463 | ); |
1464 | 1464 | } |
1465 | 1465 | |
1466 | - return self::select_input( 'EVT_CAT', $options, $current_cat ); |
|
1466 | + return self::select_input('EVT_CAT', $options, $current_cat); |
|
1467 | 1467 | } |
1468 | 1468 | |
1469 | 1469 | |
@@ -1482,20 +1482,20 @@ discard block |
||
1482 | 1482 | * @param string $extra_attributes - any extra attributes that need to be attached to the form input |
1483 | 1483 | * @return void |
1484 | 1484 | */ |
1485 | - public static function submit_button( $url = '', $ID = '', $class = '', $text = '', $nonce_action = '', $input_only = FALSE, $extra_attributes = '' ) { |
|
1485 | + public static function submit_button($url = '', $ID = '', $class = '', $text = '', $nonce_action = '', $input_only = FALSE, $extra_attributes = '') { |
|
1486 | 1486 | $btn = ''; |
1487 | - if ( empty( $url ) || empty( $ID )) { |
|
1487 | + if (empty($url) || empty($ID)) { |
|
1488 | 1488 | return $btn; |
1489 | 1489 | } |
1490 | - $text = ! empty( $text ) ? $text : __('Submit', 'event_espresso' ); |
|
1491 | - $btn .= '<input id="' . $ID . '-btn" class="' . $class . '" type="submit" value="' . $text . '" ' . $extra_attributes . '/>'; |
|
1492 | - if ( ! $input_only ) { |
|
1493 | - $btn_frm = '<form id="' . $ID . '-frm" method="POST" action="' . $url . '">'; |
|
1494 | - $btn_frm .= ! empty( $nonce_action ) ? wp_nonce_field( $nonce_action, $nonce_action . '_nonce', TRUE, FALSE ) : ''; |
|
1490 | + $text = ! empty($text) ? $text : __('Submit', 'event_espresso'); |
|
1491 | + $btn .= '<input id="'.$ID.'-btn" class="'.$class.'" type="submit" value="'.$text.'" '.$extra_attributes.'/>'; |
|
1492 | + if ( ! $input_only) { |
|
1493 | + $btn_frm = '<form id="'.$ID.'-frm" method="POST" action="'.$url.'">'; |
|
1494 | + $btn_frm .= ! empty($nonce_action) ? wp_nonce_field($nonce_action, $nonce_action.'_nonce', TRUE, FALSE) : ''; |
|
1495 | 1495 | $btn_frm .= $btn; |
1496 | 1496 | $btn_frm .= '</form>'; |
1497 | 1497 | $btn = $btn_frm; |
1498 | - unset ( $btn_frm ); |
|
1498 | + unset ($btn_frm); |
|
1499 | 1499 | } |
1500 | 1500 | return $btn; |
1501 | 1501 | } |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | * |
798 | 798 | * @param mixed $opt_group |
799 | 799 | * @param mixed $QSOs |
800 | - * @param mixed $answer |
|
800 | + * @param string $answer |
|
801 | 801 | * @param boolean $use_html_entities |
802 | 802 | * @return string |
803 | 803 | */ |
@@ -1147,7 +1147,7 @@ discard block |
||
1147 | 1147 | /** |
1148 | 1148 | * prep_required |
1149 | 1149 | * @param string|array $required |
1150 | - * @return array |
|
1150 | + * @return string |
|
1151 | 1151 | */ |
1152 | 1152 | static function prep_required( $required = array() ){ |
1153 | 1153 | // make sure required is an array |
@@ -1198,8 +1198,8 @@ discard block |
||
1198 | 1198 | |
1199 | 1199 | /** |
1200 | 1200 | * _load_system_dropdowns |
1201 | - * @param array $QFI |
|
1202 | - * @return array |
|
1201 | + * @param EE_Question_Form_Input $QFI |
|
1202 | + * @return EE_Question_Form_Input |
|
1203 | 1203 | */ |
1204 | 1204 | private static function _load_system_dropdowns( $QFI ){ |
1205 | 1205 | $QST_system = $QFI->get('QST_system'); |
@@ -1490,7 +1490,7 @@ discard block |
||
1490 | 1490 | * @param string $nonce_action - if using nonces |
1491 | 1491 | * @param bool|string $input_only - whether to print form header and footer. TRUE returns the input without the form |
1492 | 1492 | * @param string $extra_attributes - any extra attributes that need to be attached to the form input |
1493 | - * @return void |
|
1493 | + * @return string |
|
1494 | 1494 | */ |
1495 | 1495 | public static function submit_button( $url = '', $ID = '', $class = '', $text = '', $nonce_action = '', $input_only = FALSE, $extra_attributes = '' ) { |
1496 | 1496 | $btn = ''; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | -require_once( EE_MODELS . 'EEM_CPT_Base.model.php'); |
|
2 | +require_once(EE_MODELS.'EEM_CPT_Base.model.php'); |
|
3 | 3 | /** |
4 | 4 | * |
5 | 5 | * EEM_Event Model |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @author Michael Nelson, Brent Christensen |
12 | 12 | * |
13 | 13 | */ |
14 | -class EEM_Event extends EEM_CPT_Base{ |
|
14 | +class EEM_Event extends EEM_CPT_Base { |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * constant used by status(), indicating that no more tickets can be purchased for any of the datetimes for the event |
@@ -51,15 +51,15 @@ discard block |
||
51 | 51 | * @param string $timezone |
52 | 52 | * @return EEM_Event |
53 | 53 | */ |
54 | - public static function instance( $timezone = NULL ){ |
|
54 | + public static function instance($timezone = NULL) { |
|
55 | 55 | |
56 | 56 | // check if instance of EEM_Event already exists |
57 | - if ( ! self::$_instance instanceof EEM_Event ) { |
|
57 | + if ( ! self::$_instance instanceof EEM_Event) { |
|
58 | 58 | // instantiate Espresso_model |
59 | - self::$_instance = new self( $timezone ); |
|
59 | + self::$_instance = new self($timezone); |
|
60 | 60 | } |
61 | 61 | //we might have a timezone set, let set_timezone decide what to do with it |
62 | - self::$_instance->set_timezone( $timezone ); |
|
62 | + self::$_instance->set_timezone($timezone); |
|
63 | 63 | // EEM_Event object |
64 | 64 | return self::$_instance; |
65 | 65 | } |
@@ -70,12 +70,12 @@ discard block |
||
70 | 70 | * @param string $timezone |
71 | 71 | * @return EEM_Event |
72 | 72 | */ |
73 | - protected function __construct($timezone = null){ |
|
73 | + protected function __construct($timezone = null) { |
|
74 | 74 | |
75 | - EE_Registry::instance()->load_model( 'Registration' ); |
|
75 | + EE_Registry::instance()->load_model('Registration'); |
|
76 | 76 | |
77 | - $this->singular_item = __('Event','event_espresso'); |
|
78 | - $this->plural_item = __('Events','event_espresso'); |
|
77 | + $this->singular_item = __('Event', 'event_espresso'); |
|
78 | + $this->plural_item = __('Events', 'event_espresso'); |
|
79 | 79 | |
80 | 80 | // to remove Cancelled events from the frontend, copy the following filter to your functions.php file |
81 | 81 | // add_filter( 'AFEE__EEM_Event__construct___custom_stati__cancelled__Public', '__return_false' ); |
@@ -89,57 +89,57 @@ discard block |
||
89 | 89 | array( |
90 | 90 | EEM_Event::cancelled => array( |
91 | 91 | 'label' => __('Cancelled', 'event_espresso'), |
92 | - 'public' => apply_filters( 'AFEE__EEM_Event__construct___custom_stati__cancelled__Public', TRUE ) |
|
92 | + 'public' => apply_filters('AFEE__EEM_Event__construct___custom_stati__cancelled__Public', TRUE) |
|
93 | 93 | ), |
94 | 94 | EEM_Event::postponed => array( |
95 | 95 | 'label' => __('Postponed', 'event_espresso'), |
96 | - 'public' => apply_filters( 'AFEE__EEM_Event__construct___custom_stati__postponed__Public', TRUE ) |
|
96 | + 'public' => apply_filters('AFEE__EEM_Event__construct___custom_stati__postponed__Public', TRUE) |
|
97 | 97 | ), |
98 | 98 | EEM_Event::sold_out => array( |
99 | 99 | 'label' => __('Sold Out', 'event_espresso'), |
100 | - 'public' => apply_filters( 'AFEE__EEM_Event__construct___custom_stati__sold_out__Public', TRUE ) |
|
100 | + 'public' => apply_filters('AFEE__EEM_Event__construct___custom_stati__sold_out__Public', TRUE) |
|
101 | 101 | ) |
102 | 102 | ) |
103 | 103 | ); |
104 | 104 | |
105 | - self::$_default_reg_status = empty( self::$_default_reg_status ) ? EEM_Registration::status_id_pending_payment : self::$_default_reg_status; |
|
105 | + self::$_default_reg_status = empty(self::$_default_reg_status) ? EEM_Registration::status_id_pending_payment : self::$_default_reg_status; |
|
106 | 106 | |
107 | 107 | $this->_tables = array( |
108 | - 'Event_CPT'=>new EE_Primary_Table( 'posts','ID' ), |
|
109 | - 'Event_Meta'=> new EE_Secondary_Table( 'esp_event_meta', 'EVTM_ID', 'EVT_ID' ) |
|
108 | + 'Event_CPT'=>new EE_Primary_Table('posts', 'ID'), |
|
109 | + 'Event_Meta'=> new EE_Secondary_Table('esp_event_meta', 'EVTM_ID', 'EVT_ID') |
|
110 | 110 | ); |
111 | 111 | |
112 | 112 | $this->_fields = array( |
113 | 113 | 'Event_CPT'=>array( |
114 | - 'EVT_ID'=>new EE_Primary_Key_Int_Field( 'ID', __( 'Post ID for Event','event_espresso' )), |
|
115 | - 'EVT_name'=>new EE_Plain_Text_Field( 'post_title', __( 'Event Name','event_espresso' ), FALSE, '' ), |
|
116 | - 'EVT_desc'=>new EE_Post_Content_Field( 'post_content', __( 'Event Description', 'event_espresso' ), FALSE, '' ), |
|
117 | - 'EVT_slug'=>new EE_Slug_Field( 'post_name', __( 'Event Slug', 'event_espresso' ), FALSE, '' ), |
|
118 | - 'EVT_created'=>new EE_Datetime_Field( 'post_date', __( 'Date/Time Event Created', 'event_espresso' ), FALSE, time()), |
|
119 | - 'EVT_short_desc'=>new EE_Simple_HTML_Field( 'post_excerpt', __( 'Event Short Description', 'event_espresso' ), FALSE,'' ), |
|
120 | - 'EVT_modified'=>new EE_Datetime_Field( 'post_modified', __( 'Date/Time Event Modified', 'event_espresso' ), FALSE, time()), |
|
121 | - 'EVT_wp_user'=>new EE_WP_User_Field( 'post_author', __( 'Event Creator ID', 'event_espresso'), FALSE), |
|
122 | - 'parent'=>new EE_Integer_Field( 'post_parent', __( 'Event Parent ID', 'event_espresso' ), FALSE, 0 ), |
|
123 | - 'EVT_order'=>new EE_Integer_Field( 'menu_order', __( 'Event Menu Order', 'event_espresso' ), FALSE, 1 ), |
|
124 | - 'post_type'=>new EE_WP_Post_Type_Field('espresso_events'),// EE_Plain_Text_Field( 'post_type', __( 'Event Post Type', 'event_espresso' ), FALSE, 'espresso_events' ), |
|
125 | - 'status' => new EE_WP_Post_Status_Field( 'post_status', __( 'Event Status', 'event_espresso' ), FALSE, 'draft', $this->_custom_stati ) |
|
114 | + 'EVT_ID'=>new EE_Primary_Key_Int_Field('ID', __('Post ID for Event', 'event_espresso')), |
|
115 | + 'EVT_name'=>new EE_Plain_Text_Field('post_title', __('Event Name', 'event_espresso'), FALSE, ''), |
|
116 | + 'EVT_desc'=>new EE_Post_Content_Field('post_content', __('Event Description', 'event_espresso'), FALSE, ''), |
|
117 | + 'EVT_slug'=>new EE_Slug_Field('post_name', __('Event Slug', 'event_espresso'), FALSE, ''), |
|
118 | + 'EVT_created'=>new EE_Datetime_Field('post_date', __('Date/Time Event Created', 'event_espresso'), FALSE, time()), |
|
119 | + 'EVT_short_desc'=>new EE_Simple_HTML_Field('post_excerpt', __('Event Short Description', 'event_espresso'), FALSE, ''), |
|
120 | + 'EVT_modified'=>new EE_Datetime_Field('post_modified', __('Date/Time Event Modified', 'event_espresso'), FALSE, time()), |
|
121 | + 'EVT_wp_user'=>new EE_WP_User_Field('post_author', __('Event Creator ID', 'event_espresso'), FALSE), |
|
122 | + 'parent'=>new EE_Integer_Field('post_parent', __('Event Parent ID', 'event_espresso'), FALSE, 0), |
|
123 | + 'EVT_order'=>new EE_Integer_Field('menu_order', __('Event Menu Order', 'event_espresso'), FALSE, 1), |
|
124 | + 'post_type'=>new EE_WP_Post_Type_Field('espresso_events'), // EE_Plain_Text_Field( 'post_type', __( 'Event Post Type', 'event_espresso' ), FALSE, 'espresso_events' ), |
|
125 | + 'status' => new EE_WP_Post_Status_Field('post_status', __('Event Status', 'event_espresso'), FALSE, 'draft', $this->_custom_stati) |
|
126 | 126 | ), |
127 | 127 | 'Event_Meta'=>array( |
128 | - 'EVTM_ID'=> new EE_DB_Only_Float_Field( 'EVTM_ID', __( 'Event Meta Row ID','event_espresso' ), FALSE ), |
|
129 | - 'EVT_ID_fk'=>new EE_DB_Only_Int_Field( 'EVT_ID', __( 'Foreign key to Event ID from Event Meta table', 'event_espresso' ), FALSE ), |
|
130 | - 'EVT_display_desc'=>new EE_Boolean_Field( 'EVT_display_desc', __( 'Display Description Flag', 'event_espresso' ), FALSE, 1 ), |
|
131 | - 'EVT_display_ticket_selector'=>new EE_Boolean_Field( 'EVT_display_ticket_selector', __( 'Display Ticket Selector Flag', 'event_espresso' ), FALSE, 1 ), |
|
132 | - 'EVT_visible_on'=>new EE_Datetime_Field( 'EVT_visible_on', __( 'Event Visible Date', 'event_espresso' ), TRUE, time()), |
|
133 | - 'EVT_additional_limit'=>new EE_Integer_Field( 'EVT_additional_limit', __( 'Limit of Additional Registrations on Same Transaction', 'event_espresso' ), TRUE, 10 ), |
|
128 | + 'EVTM_ID'=> new EE_DB_Only_Float_Field('EVTM_ID', __('Event Meta Row ID', 'event_espresso'), FALSE), |
|
129 | + 'EVT_ID_fk'=>new EE_DB_Only_Int_Field('EVT_ID', __('Foreign key to Event ID from Event Meta table', 'event_espresso'), FALSE), |
|
130 | + 'EVT_display_desc'=>new EE_Boolean_Field('EVT_display_desc', __('Display Description Flag', 'event_espresso'), FALSE, 1), |
|
131 | + 'EVT_display_ticket_selector'=>new EE_Boolean_Field('EVT_display_ticket_selector', __('Display Ticket Selector Flag', 'event_espresso'), FALSE, 1), |
|
132 | + 'EVT_visible_on'=>new EE_Datetime_Field('EVT_visible_on', __('Event Visible Date', 'event_espresso'), TRUE, time()), |
|
133 | + 'EVT_additional_limit'=>new EE_Integer_Field('EVT_additional_limit', __('Limit of Additional Registrations on Same Transaction', 'event_espresso'), TRUE, 10), |
|
134 | 134 | 'EVT_default_registration_status'=>new EE_Enum_Text_Field( |
135 | - 'EVT_default_registration_status', __( 'Default Registration Status on this Event', 'event_espresso' ), FALSE, EEM_Event::$_default_reg_status, EEM_Registration::reg_status_array() |
|
135 | + 'EVT_default_registration_status', __('Default Registration Status on this Event', 'event_espresso'), FALSE, EEM_Event::$_default_reg_status, EEM_Registration::reg_status_array() |
|
136 | 136 | ), |
137 | - 'EVT_member_only'=>new EE_Boolean_Field( 'EVT_member_only', __( 'Member-Only Event Flag', 'event_espresso' ), FALSE, FALSE ), |
|
138 | - 'EVT_phone'=> new EE_Plain_Text_Field('EVT_phone', __( 'Event Phone Number', 'event_espresso' ), FALSE ), |
|
139 | - 'EVT_allow_overflow'=>new EE_Boolean_Field( 'EVT_allow_overflow', __( 'Allow Overflow on Event', 'event_espresso' ), FALSE, FALSE ), |
|
140 | - 'EVT_timezone_string'=>new EE_Plain_Text_Field( 'EVT_timezone_string', __( 'Timezone (name) for Event times', 'event_espresso' ), FALSE ), |
|
141 | - 'EVT_external_URL'=>new EE_Plain_Text_Field( 'EVT_external_URL', __( 'URL of Event Page if hosted elsewhere', 'event_espresso' ), TRUE ), |
|
142 | - 'EVT_donations'=>new EE_Boolean_Field( 'EVT_donations', __( 'Accept Donations?', 'event_espresso' ), FALSE, FALSE ) |
|
137 | + 'EVT_member_only'=>new EE_Boolean_Field('EVT_member_only', __('Member-Only Event Flag', 'event_espresso'), FALSE, FALSE), |
|
138 | + 'EVT_phone'=> new EE_Plain_Text_Field('EVT_phone', __('Event Phone Number', 'event_espresso'), FALSE), |
|
139 | + 'EVT_allow_overflow'=>new EE_Boolean_Field('EVT_allow_overflow', __('Allow Overflow on Event', 'event_espresso'), FALSE, FALSE), |
|
140 | + 'EVT_timezone_string'=>new EE_Plain_Text_Field('EVT_timezone_string', __('Timezone (name) for Event times', 'event_espresso'), FALSE), |
|
141 | + 'EVT_external_URL'=>new EE_Plain_Text_Field('EVT_external_URL', __('URL of Event Page if hosted elsewhere', 'event_espresso'), TRUE), |
|
142 | + 'EVT_donations'=>new EE_Boolean_Field('EVT_donations', __('Accept Donations?', 'event_espresso'), FALSE, FALSE) |
|
143 | 143 | |
144 | 144 | )); |
145 | 145 | |
@@ -154,8 +154,8 @@ discard block |
||
154 | 154 | 'WP_User' => new EE_Belongs_To_Relation(), |
155 | 155 | ); |
156 | 156 | //this model is generally available for reading |
157 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
158 | - parent::__construct( $timezone ); |
|
157 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
158 | + parent::__construct($timezone); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | |
@@ -163,14 +163,14 @@ discard block |
||
163 | 163 | /** |
164 | 164 | * @param string $default_reg_status |
165 | 165 | */ |
166 | - public static function set_default_reg_status( $default_reg_status ) { |
|
166 | + public static function set_default_reg_status($default_reg_status) { |
|
167 | 167 | self::$_default_reg_status = $default_reg_status; |
168 | 168 | //if EEM_Event has already been instantiated, then we need to reset the `EVT_default_reg_status` field to use the new default. |
169 | - if ( self::$_instance instanceof EEM_Event ) { |
|
169 | + if (self::$_instance instanceof EEM_Event) { |
|
170 | 170 | self::$_instance->_fields['Event_Meta']['EVT_default_registration_status'] = new EE_Enum_Text_Field( |
171 | - 'EVT_default_registration_status', __( 'Default Registration Status on this Event', 'event_espresso' ), false, $default_reg_status, EEM_Registration::reg_status_array() |
|
171 | + 'EVT_default_registration_status', __('Default Registration Status on this Event', 'event_espresso'), false, $default_reg_status, EEM_Registration::reg_status_array() |
|
172 | 172 | ); |
173 | - self::$_instance->_fields['Event_Meta']['EVT_default_registration_status']->_construct_finalize( 'Event_Meta', 'EVT_default_registration_status', 'EEM_Event' ); |
|
173 | + self::$_instance->_fields['Event_Meta']['EVT_default_registration_status']->_construct_finalize('Event_Meta', 'EVT_default_registration_status', 'EEM_Event'); |
|
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
@@ -183,9 +183,9 @@ discard block |
||
183 | 183 | * @return array |
184 | 184 | */ |
185 | 185 | public function get_all_question_groups() { |
186 | - return EE_Registry::instance()->load_model( 'Question_Group' )->get_all( array( |
|
187 | - array( 'QSG_deleted' => FALSE ), |
|
188 | - 'order_by' => array( 'QSG_order' => 'ASC' ) |
|
186 | + return EE_Registry::instance()->load_model('Question_Group')->get_all(array( |
|
187 | + array('QSG_deleted' => FALSE), |
|
188 | + 'order_by' => array('QSG_order' => 'ASC') |
|
189 | 189 | )); |
190 | 190 | } |
191 | 191 | |
@@ -201,13 +201,13 @@ discard block |
||
201 | 201 | * @param int $EVT_ID |
202 | 202 | * @return array |
203 | 203 | */ |
204 | - public function get_all_event_question_groups( $EVT_ID = 0 ) { |
|
205 | - if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) { |
|
206 | - EE_Error::add_error( __( 'An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
204 | + public function get_all_event_question_groups($EVT_ID = 0) { |
|
205 | + if ( ! isset($EVT_ID) || ! absint($EVT_ID)) { |
|
206 | + EE_Error::add_error(__('An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
207 | 207 | return FALSE; |
208 | 208 | } |
209 | - return EE_Registry::instance()->load_model( 'Event_Question_Group' )->get_all( array( |
|
210 | - array( 'EVT_ID' => $EVT_ID ) |
|
209 | + return EE_Registry::instance()->load_model('Event_Question_Group')->get_all(array( |
|
210 | + array('EVT_ID' => $EVT_ID) |
|
211 | 211 | )); |
212 | 212 | } |
213 | 213 | |
@@ -223,13 +223,13 @@ discard block |
||
223 | 223 | * @param boolean $for_primary_attendee |
224 | 224 | * @return array |
225 | 225 | */ |
226 | - public function get_event_question_groups( $EVT_ID = 0, $for_primary_attendee = TRUE ) { |
|
227 | - if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) { |
|
228 | - EE_Error::add_error( __( 'An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
226 | + public function get_event_question_groups($EVT_ID = 0, $for_primary_attendee = TRUE) { |
|
227 | + if ( ! isset($EVT_ID) || ! absint($EVT_ID)) { |
|
228 | + EE_Error::add_error(__('An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
229 | 229 | return FALSE; |
230 | 230 | } |
231 | - return EE_Registry::instance()->load_model( 'Event_Question_Group' )->get_all( array( |
|
232 | - array( 'EVT_ID' => $EVT_ID, 'EQG_primary' => $for_primary_attendee ) |
|
231 | + return EE_Registry::instance()->load_model('Event_Question_Group')->get_all(array( |
|
232 | + array('EVT_ID' => $EVT_ID, 'EQG_primary' => $for_primary_attendee) |
|
233 | 233 | )); |
234 | 234 | } |
235 | 235 | |
@@ -246,10 +246,10 @@ discard block |
||
246 | 246 | * @param EE_Registration $registration |
247 | 247 | * @return array |
248 | 248 | */ |
249 | - public function get_question_groups_for_event( $EVT_ID = 0, EE_Registration $registration ) { |
|
249 | + public function get_question_groups_for_event($EVT_ID = 0, EE_Registration $registration) { |
|
250 | 250 | |
251 | - if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) { |
|
252 | - EE_Error::add_error( __( 'An error occurred. No Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
251 | + if ( ! isset($EVT_ID) || ! absint($EVT_ID)) { |
|
252 | + EE_Error::add_error(__('An error occurred. No Question Groups could be retrieved because an Event ID was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
253 | 253 | return FALSE; |
254 | 254 | } |
255 | 255 | |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | 'QSG_deleted' => FALSE |
260 | 260 | ); |
261 | 261 | |
262 | - return EE_Registry::instance()->load_model( 'Question_Group' )->get_all( array( |
|
262 | + return EE_Registry::instance()->load_model('Question_Group')->get_all(array( |
|
263 | 263 | $where_params, |
264 | 264 | 'order_by' => array('QSG_order' => 'ASC') |
265 | 265 | )); |
@@ -279,16 +279,16 @@ discard block |
||
279 | 279 | * @param string $QSG_IDs csv list of $QSG IDs |
280 | 280 | * @return array |
281 | 281 | */ |
282 | - public function get_questions_in_groups( $QSG_IDs = '' ) { |
|
282 | + public function get_questions_in_groups($QSG_IDs = '') { |
|
283 | 283 | |
284 | - if ( empty( $QSG_IDs )) { |
|
285 | - EE_Error::add_error( __( 'An error occurred. No Question Group IDs were received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
284 | + if (empty($QSG_IDs)) { |
|
285 | + EE_Error::add_error(__('An error occurred. No Question Group IDs were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
286 | 286 | return FALSE; |
287 | 287 | } |
288 | 288 | |
289 | - return EE_Registry::instance()->load_model( 'Question' )->get_all( array( |
|
289 | + return EE_Registry::instance()->load_model('Question')->get_all(array( |
|
290 | 290 | array( |
291 | - 'Question_Group.QSG_ID' => array( 'IN', $QSG_IDs ), |
|
291 | + 'Question_Group.QSG_ID' => array('IN', $QSG_IDs), |
|
292 | 292 | 'QST_deleted' => FALSE, |
293 | 293 | 'QST_admin_only' => is_admin() |
294 | 294 | ), |
@@ -310,16 +310,16 @@ discard block |
||
310 | 310 | * @param string $QST_IDs csv list of $QST IDs |
311 | 311 | * @return array |
312 | 312 | */ |
313 | - public function get_options_for_question( $QST_IDs ) { |
|
313 | + public function get_options_for_question($QST_IDs) { |
|
314 | 314 | |
315 | - if ( empty( $QST_IDs )) { |
|
316 | - EE_Error::add_error( __( 'An error occurred. No Question IDs were received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
315 | + if (empty($QST_IDs)) { |
|
316 | + EE_Error::add_error(__('An error occurred. No Question IDs were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
317 | 317 | return FALSE; |
318 | 318 | } |
319 | 319 | |
320 | - return EE_Registry::instance()->load_model( 'Question_Option' )->get_all( array( |
|
320 | + return EE_Registry::instance()->load_model('Question_Option')->get_all(array( |
|
321 | 321 | array( |
322 | - 'Question.QST_ID' => array( 'IN', $QST_IDs ), |
|
322 | + 'Question.QST_ID' => array('IN', $QST_IDs), |
|
323 | 323 | 'QSO_deleted' => FALSE |
324 | 324 | ), |
325 | 325 | 'order_by' => 'QSO_ID' |
@@ -338,46 +338,46 @@ discard block |
||
338 | 338 | * @throws EE_Error |
339 | 339 | * @return array |
340 | 340 | */ |
341 | - public function assemble_array_of_groups_questions_and_options( EE_Registration $registration, $EVT_ID = 0 ) { |
|
341 | + public function assemble_array_of_groups_questions_and_options(EE_Registration $registration, $EVT_ID = 0) { |
|
342 | 342 | |
343 | - if ( empty( $EVT_ID ) ) { |
|
344 | - throw new EE_Error( __( 'An error occurred. No EVT_ID is included. Needed to know which question groups to retrieve.', 'event_espresso' ) ); |
|
343 | + if (empty($EVT_ID)) { |
|
344 | + throw new EE_Error(__('An error occurred. No EVT_ID is included. Needed to know which question groups to retrieve.', 'event_espresso')); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | $questions = array(); |
348 | 348 | |
349 | 349 | // get all question groups for event |
350 | - $qgs = $this->get_question_groups_for_event( $EVT_ID, $registration ); |
|
351 | - if ( !empty( $qgs ) ) { |
|
352 | - foreach ( $qgs as $qg ) { |
|
350 | + $qgs = $this->get_question_groups_for_event($EVT_ID, $registration); |
|
351 | + if ( ! empty($qgs)) { |
|
352 | + foreach ($qgs as $qg) { |
|
353 | 353 | $qsts = $qg->questions(); |
354 | - $questions[ $qg->ID() ] = $qg->model_field_array(); |
|
355 | - $questions[ $qg->ID() ]['QSG_questions'] = array(); |
|
356 | - foreach ( $qsts as $qst ) { |
|
357 | - if ( $qst->is_system_question() ) |
|
354 | + $questions[$qg->ID()] = $qg->model_field_array(); |
|
355 | + $questions[$qg->ID()]['QSG_questions'] = array(); |
|
356 | + foreach ($qsts as $qst) { |
|
357 | + if ($qst->is_system_question()) |
|
358 | 358 | continue; |
359 | - $answer = EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $qst->ID(), 'REG_ID' => $registration->ID() ) ) ); |
|
359 | + $answer = EEM_Answer::instance()->get_one(array(array('QST_ID' => $qst->ID(), 'REG_ID' => $registration->ID()))); |
|
360 | 360 | $answer = $answer instanceof EE_Answer ? $answer : EEM_Answer::instance()->create_default_object(); |
361 | 361 | $qst_name = $qstn_id = $qst->ID(); |
362 | 362 | $ans_id = $answer->ID(); |
363 | - $qst_name = !empty( $ans_id ) ? '[' . $qst_name . '][' . $ans_id . ']' : '[' . $qst_name . ']'; |
|
363 | + $qst_name = ! empty($ans_id) ? '['.$qst_name.']['.$ans_id.']' : '['.$qst_name.']'; |
|
364 | 364 | $input_name = ''; |
365 | - $input_id = sanitize_key( $qst->display_text() ); |
|
365 | + $input_id = sanitize_key($qst->display_text()); |
|
366 | 366 | $input_class = ''; |
367 | 367 | $questions[$qg->ID()]['QSG_questions'][$qst->ID()] = $qst->model_field_array(); |
368 | - $questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_input_name'] = 'qstn' . $input_name . $qst_name; |
|
369 | - $questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_input_id'] = $input_id . '-' . $qstn_id; |
|
370 | - $questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_input_class'] = $input_class; |
|
371 | - $questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_options'] = array(); |
|
372 | - $questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['qst_obj'] = $qst; |
|
373 | - $questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['ans_obj'] = $answer; |
|
368 | + $questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_input_name'] = 'qstn'.$input_name.$qst_name; |
|
369 | + $questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_input_id'] = $input_id.'-'.$qstn_id; |
|
370 | + $questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_input_class'] = $input_class; |
|
371 | + $questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_options'] = array(); |
|
372 | + $questions[$qg->ID()]['QSG_questions'][$qst->ID()]['qst_obj'] = $qst; |
|
373 | + $questions[$qg->ID()]['QSG_questions'][$qst->ID()]['ans_obj'] = $answer; |
|
374 | 374 | //leave responses as-is, don't convert stuff into html entities please! |
375 | - $questions[ $qg->ID() ][ 'QSG_questions'][ $qst->ID() ][ 'htmlentities' ] = false; |
|
376 | - if ( $qst->type() == 'RADIO_BTN' || $qst->type() == 'CHECKBOX' || $qst->type() == 'DROPDOWN' ) { |
|
377 | - $QSOs = $qst->options(TRUE,$answer->value()); |
|
378 | - if ( is_array( $QSOs ) ) { |
|
379 | - foreach ( $QSOs as $QSO_ID => $QSO ) { |
|
380 | - $questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_options'][ $QSO_ID ] = $QSO->model_field_array(); |
|
375 | + $questions[$qg->ID()]['QSG_questions'][$qst->ID()]['htmlentities'] = false; |
|
376 | + if ($qst->type() == 'RADIO_BTN' || $qst->type() == 'CHECKBOX' || $qst->type() == 'DROPDOWN') { |
|
377 | + $QSOs = $qst->options(TRUE, $answer->value()); |
|
378 | + if (is_array($QSOs)) { |
|
379 | + foreach ($QSOs as $QSO_ID => $QSO) { |
|
380 | + $questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_options'][$QSO_ID] = $QSO->model_field_array(); |
|
381 | 381 | } |
382 | 382 | } |
383 | 383 | } |
@@ -401,9 +401,9 @@ discard block |
||
401 | 401 | * @param $QST |
402 | 402 | * @return string string |
403 | 403 | */ |
404 | - private function _generate_question_input_name( $QST ) { |
|
404 | + private function _generate_question_input_name($QST) { |
|
405 | 405 | |
406 | - if ( $QST->QST_system ) { |
|
406 | + if ($QST->QST_system) { |
|
407 | 407 | $qst_name = $QST->QST_system; |
408 | 408 | /* switch( $QST->QST_system ) { |
409 | 409 | |
@@ -470,36 +470,36 @@ discard block |
||
470 | 470 | * @param bool $count whether to return the count or not (default FALSE) |
471 | 471 | * @return array EE_Event objects |
472 | 472 | */ |
473 | - public function get_active_events( $query_params, $count = FALSE ) { |
|
474 | - if ( array_key_exists( 0, $query_params ) ) { |
|
473 | + public function get_active_events($query_params, $count = FALSE) { |
|
474 | + if (array_key_exists(0, $query_params)) { |
|
475 | 475 | $where_params = $query_params[0]; |
476 | - unset( $query_params[0] ); |
|
476 | + unset($query_params[0]); |
|
477 | 477 | } else { |
478 | 478 | $where_params = array(); |
479 | 479 | } |
480 | 480 | |
481 | 481 | //if we have count make sure we don't include group by |
482 | - if ( $count && isset( $query_params['group_by'] ) ) { |
|
483 | - unset( $query_params['group_by'] ); |
|
482 | + if ($count && isset($query_params['group_by'])) { |
|
483 | + unset($query_params['group_by']); |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | //let's add specific query_params for active_events - keep in mind this will override any sent status in the query AND any date queries. |
487 | 487 | $where_params['status'] = 'publish'; |
488 | 488 | //if already have where params for DTT_EVT_start or DTT_EVT_end then append these conditions |
489 | - if ( isset( $where_params['Datetime.DTT_EVT_start'] ) ) { |
|
490 | - $where_params['Datetime.DTT_EVT_start******'] = array('<', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) ); |
|
489 | + if (isset($where_params['Datetime.DTT_EVT_start'])) { |
|
490 | + $where_params['Datetime.DTT_EVT_start******'] = array('<', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start')); |
|
491 | 491 | } else { |
492 | - $where_params['Datetime.DTT_EVT_start'] = array('<', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) ); |
|
492 | + $where_params['Datetime.DTT_EVT_start'] = array('<', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start')); |
|
493 | 493 | } |
494 | 494 | |
495 | - if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) { |
|
496 | - $where_params['Datetime.DTT_EVT_end*****'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ); |
|
495 | + if (isset($where_params['Datetime.DTT_EVT_end'])) { |
|
496 | + $where_params['Datetime.DTT_EVT_end*****'] = array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end')); |
|
497 | 497 | } else { |
498 | - $where_params['Datetime.DTT_EVT_end'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ); |
|
498 | + $where_params['Datetime.DTT_EVT_end'] = array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end')); |
|
499 | 499 | } |
500 | 500 | $query_params[0] = $where_params; |
501 | 501 | // don't use $query_params with count() because we don't want to include additional query clauses like "GROUP BY" |
502 | - return $count ? $this->count( array( $where_params ), 'EVT_ID', true ) : $this->get_all( $query_params ); |
|
502 | + return $count ? $this->count(array($where_params), 'EVT_ID', true) : $this->get_all($query_params); |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | |
@@ -514,30 +514,30 @@ discard block |
||
514 | 514 | * @param bool $count whether to return the count or not (default FALSE) |
515 | 515 | * @return array EE_Event objects |
516 | 516 | */ |
517 | - public function get_upcoming_events( $query_params, $count = FALSE ) { |
|
518 | - if ( array_key_exists( 0, $query_params ) ) { |
|
517 | + public function get_upcoming_events($query_params, $count = FALSE) { |
|
518 | + if (array_key_exists(0, $query_params)) { |
|
519 | 519 | $where_params = $query_params[0]; |
520 | - unset( $query_params[0] ); |
|
520 | + unset($query_params[0]); |
|
521 | 521 | } else { |
522 | 522 | $where_params = array(); |
523 | 523 | } |
524 | 524 | |
525 | 525 | //if we have count make sure we don't include group by |
526 | - if ( $count && isset( $query_params['group_by'] ) ) { |
|
527 | - unset( $query_params['group_by'] ); |
|
526 | + if ($count && isset($query_params['group_by'])) { |
|
527 | + unset($query_params['group_by']); |
|
528 | 528 | } |
529 | 529 | |
530 | 530 | //let's add specific query_params for active_events - keep in mind this will override any sent status in the query AND any date queries. |
531 | 531 | $where_params['status'] = 'publish'; |
532 | 532 | //if there are already query_params matching DTT_EVT_start then we need to modify that to add them. |
533 | - if ( isset( $where_params['Datetime.DTT_EVT_start'] ) ) { |
|
534 | - $where_params['Datetime.DTT_EVT_start*****'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) ); |
|
533 | + if (isset($where_params['Datetime.DTT_EVT_start'])) { |
|
534 | + $where_params['Datetime.DTT_EVT_start*****'] = array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start')); |
|
535 | 535 | } else { |
536 | - $where_params['Datetime.DTT_EVT_start'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) ); |
|
536 | + $where_params['Datetime.DTT_EVT_start'] = array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start')); |
|
537 | 537 | } |
538 | 538 | $query_params[0] = $where_params; |
539 | 539 | // don't use $query_params with count() because we don't want to include additional query clauses like "GROUP BY" |
540 | - return $count ? $this->count( array( $where_params ), 'EVT_ID', true ) : $this->get_all( $query_params ); |
|
540 | + return $count ? $this->count(array($where_params), 'EVT_ID', true) : $this->get_all($query_params); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | |
@@ -549,56 +549,56 @@ discard block |
||
549 | 549 | * @param bool $count whether to return the count or not (default FALSE) |
550 | 550 | * @return array EE_Event objects |
551 | 551 | */ |
552 | - public function get_expired_events( $query_params, $count = FALSE ) { |
|
552 | + public function get_expired_events($query_params, $count = FALSE) { |
|
553 | 553 | |
554 | - $where_params = isset( $query_params[0] ) ? $query_params[0] : array(); |
|
554 | + $where_params = isset($query_params[0]) ? $query_params[0] : array(); |
|
555 | 555 | |
556 | 556 | //if we have count make sure we don't include group by |
557 | - if ( $count && isset( $query_params['group_by'] ) ) { |
|
558 | - unset( $query_params['group_by'] ); |
|
557 | + if ($count && isset($query_params['group_by'])) { |
|
558 | + unset($query_params['group_by']); |
|
559 | 559 | } |
560 | 560 | |
561 | 561 | //let's add specific query_params for active_events - keep in mind this will override any sent status in the query AND any date queries. |
562 | - if ( isset( $where_params['status'] ) ) { |
|
563 | - unset( $where_params['status'] ); |
|
562 | + if (isset($where_params['status'])) { |
|
563 | + unset($where_params['status']); |
|
564 | 564 | } |
565 | 565 | $exclude_query = $query_params; |
566 | - if ( isset( $exclude_query[0] ) ) { |
|
567 | - unset( $exclude_query[0] ); |
|
566 | + if (isset($exclude_query[0])) { |
|
567 | + unset($exclude_query[0]); |
|
568 | 568 | } |
569 | - $exclude_query[0] = array( 'Datetime.DTT_EVT_end' => array( '>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ) ); |
|
569 | + $exclude_query[0] = array('Datetime.DTT_EVT_end' => array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'))); |
|
570 | 570 | //first get all events that have datetimes where its not expired. |
571 | - $event_ids = $this->_get_all_wpdb_results( $exclude_query, OBJECT_K, 'Event_CPT.ID' ); |
|
572 | - $event_ids = array_keys( $event_ids ); |
|
571 | + $event_ids = $this->_get_all_wpdb_results($exclude_query, OBJECT_K, 'Event_CPT.ID'); |
|
572 | + $event_ids = array_keys($event_ids); |
|
573 | 573 | |
574 | 574 | //if we have any additional query_params, let's add them to the 'AND' condition |
575 | 575 | $and_condition = array( |
576 | - 'Datetime.DTT_EVT_end' => array( '<', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ), |
|
577 | - 'EVT_ID' => array( 'NOT IN', $event_ids ) |
|
576 | + 'Datetime.DTT_EVT_end' => array('<', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end')), |
|
577 | + 'EVT_ID' => array('NOT IN', $event_ids) |
|
578 | 578 | ); |
579 | 579 | |
580 | - if ( isset( $where_params['OR'] ) ) { |
|
580 | + if (isset($where_params['OR'])) { |
|
581 | 581 | $and_condition['OR'] = $where_params['OR']; |
582 | - unset( $where_params['OR'] ); |
|
582 | + unset($where_params['OR']); |
|
583 | 583 | } |
584 | 584 | |
585 | - if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) { |
|
585 | + if (isset($where_params['Datetime.DTT_EVT_end'])) { |
|
586 | 586 | $and_condition['Datetime.DTT_EVT_end****'] = $where_params['Datetime.DTT_EVT_end']; |
587 | - unset( $where_params['Datetime.DTT_EVT_end'] ); |
|
587 | + unset($where_params['Datetime.DTT_EVT_end']); |
|
588 | 588 | } |
589 | 589 | |
590 | - if ( isset( $where_params['Datetime.DTT_EVT_start'] ) ) { |
|
590 | + if (isset($where_params['Datetime.DTT_EVT_start'])) { |
|
591 | 591 | $and_condition['Datetime.DTT_EVT_start'] = $where_params['Datetime.DTT_EVT_start']; |
592 | - unset( $where_params['Datetime.DTT_EVT_start'] ); |
|
592 | + unset($where_params['Datetime.DTT_EVT_start']); |
|
593 | 593 | } |
594 | 594 | |
595 | 595 | //merge remaining $where params with the and conditions. |
596 | - $and_condtion = array_merge( $and_condition, $where_params ); |
|
596 | + $and_condtion = array_merge($and_condition, $where_params); |
|
597 | 597 | |
598 | 598 | $where_params['AND'] = $and_condition; |
599 | 599 | $query_params[0] = $where_params; |
600 | 600 | // don't use $query_params with count() because we don't want to include additional query clauses like "GROUP BY" |
601 | - return $count ? $this->count( array( $where_params ), 'EVT_ID', true ) : $this->get_all( $query_params ); |
|
601 | + return $count ? $this->count(array($where_params), 'EVT_ID', true) : $this->get_all($query_params); |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | |
@@ -609,40 +609,40 @@ discard block |
||
609 | 609 | * @param boolean $count whether to return the count or not (default FALSE) |
610 | 610 | * @return EE_Event[] array of EE_Event objects |
611 | 611 | */ |
612 | - public function get_inactive_events( $query_params, $count = FALSE ) { |
|
613 | - $where_params = isset( $query_params[0] ) ? $query_params[0] : array(); |
|
612 | + public function get_inactive_events($query_params, $count = FALSE) { |
|
613 | + $where_params = isset($query_params[0]) ? $query_params[0] : array(); |
|
614 | 614 | |
615 | 615 | //let's add in specific query_params for inactive events. |
616 | - if ( isset( $where_params['status'] ) ) { |
|
617 | - unset( $where_params['status'] ); |
|
616 | + if (isset($where_params['status'])) { |
|
617 | + unset($where_params['status']); |
|
618 | 618 | } |
619 | 619 | |
620 | 620 | //if we have count make sure we don't include group by |
621 | - if ( $count && isset( $query_params['group_by'] ) ) { |
|
622 | - unset( $query_params['group_by'] ); |
|
621 | + if ($count && isset($query_params['group_by'])) { |
|
622 | + unset($query_params['group_by']); |
|
623 | 623 | } |
624 | 624 | |
625 | 625 | //if we have any additional query_params, let's add them to the 'AND' condition |
626 | - $where_params['AND']['status'] = array( '!=', 'publish' ); |
|
626 | + $where_params['AND']['status'] = array('!=', 'publish'); |
|
627 | 627 | |
628 | - if ( isset( $where_params['OR'] ) ) { |
|
628 | + if (isset($where_params['OR'])) { |
|
629 | 629 | $where_params['AND']['OR'] = $where_params['OR']; |
630 | - unset( $where_params['OR'] ); |
|
630 | + unset($where_params['OR']); |
|
631 | 631 | } |
632 | 632 | |
633 | - if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) { |
|
633 | + if (isset($where_params['Datetime.DTT_EVT_end'])) { |
|
634 | 634 | $where_params['AND']['Datetime.DTT_EVT_end****'] = $where_params['Datetime.DTT_EVT_end']; |
635 | - unset( $where_params['Datetime.DTT_EVT_end'] ); |
|
635 | + unset($where_params['Datetime.DTT_EVT_end']); |
|
636 | 636 | } |
637 | 637 | |
638 | - if ( isset( $where_params['Datetime.DTT_EVT_start'] ) ) { |
|
638 | + if (isset($where_params['Datetime.DTT_EVT_start'])) { |
|
639 | 639 | $where_params['AND']['Datetime.DTT_EVT_start'] = $where_params['Datetime.DTT_EVT_start']; |
640 | - unset( $where_params['Datetime.DTT_EVT_start'] ); |
|
640 | + unset($where_params['Datetime.DTT_EVT_start']); |
|
641 | 641 | } |
642 | 642 | |
643 | 643 | $query_params[0] = $where_params; |
644 | 644 | // don't use $query_params with count() because we don't want to include additional query clauses like "GROUP BY" |
645 | - return $count ? $this->count( array( $where_params ), 'EVT_ID', true ) : $this->get_all( $query_params ); |
|
645 | + return $count ? $this->count(array($where_params), 'EVT_ID', true) : $this->get_all($query_params); |
|
646 | 646 | } |
647 | 647 | |
648 | 648 | |
@@ -650,13 +650,13 @@ discard block |
||
650 | 650 | * This is just injecting into the parent add_relationship_to so we do special handling on price relationships because we don't want to override any existing global default prices but instead insert NEW prices that get attached to the event. |
651 | 651 | * See parent for param descriptions |
652 | 652 | */ |
653 | - public function add_relationship_to($id_or_obj,$other_model_id_or_obj, $relationName, $where_query = array()){ |
|
653 | + public function add_relationship_to($id_or_obj, $other_model_id_or_obj, $relationName, $where_query = array()) { |
|
654 | 654 | |
655 | - if ( $relationName == 'Price' ) { |
|
655 | + if ($relationName == 'Price') { |
|
656 | 656 | //let's get the PRC object for the given ID to make sure that we aren't dealing with a default |
657 | 657 | $prc_chk = $this->get_related_model_obj($relationName)->ensure_is_obj($other_model_id_or_obj); |
658 | 658 | //if EVT_ID = 0, then this is a default |
659 | - if ( $prc_chk->get('EVT_ID') == 0 ) { |
|
659 | + if ($prc_chk->get('EVT_ID') == 0) { |
|
660 | 660 | //let's set the prc_id as 0 so we force an insert on the add_relation_to carried out by relation |
661 | 661 | $prc_chk->set('PRC_ID', 0); |
662 | 662 | } |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | } |
667 | 667 | |
668 | 668 | //otherwise carry on as normal |
669 | - return parent::add_relationship_to($id_or_obj,$other_model_id_or_obj, $relationName, $where_query); |
|
669 | + return parent::add_relationship_to($id_or_obj, $other_model_id_or_obj, $relationName, $where_query); |
|
670 | 670 | } |
671 | 671 | |
672 | 672 |
@@ -24,14 +24,14 @@ discard block |
||
24 | 24 | * But either way, the string or the array's values can ONLY contain simple HTML tags. |
25 | 25 | * If you want to allow Full HTML in the value, use EE_Maybe_Serialized_Text_Field |
26 | 26 | */ |
27 | -class EE_Maybe_Serialized_Simple_HTML_Field extends EE_Maybe_Serialized_Text_Field{ |
|
27 | +class EE_Maybe_Serialized_Simple_HTML_Field extends EE_Maybe_Serialized_Text_Field { |
|
28 | 28 | /** |
29 | 29 | * removes all non-basic tags when setting |
30 | 30 | * @param string $value_inputted_for_field_on_model_object |
31 | 31 | * @return string |
32 | 32 | */ |
33 | 33 | function prepare_for_set($value_inputted_for_field_on_model_object) { |
34 | - return parent::prepare_for_set( $this->_remove_tags( $value_inputted_for_field_on_model_object ) ); |
|
34 | + return parent::prepare_for_set($this->_remove_tags($value_inputted_for_field_on_model_object)); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | * @param array|string $value |
40 | 40 | * @return array|string |
41 | 41 | */ |
42 | - protected function _remove_tags( $value ) { |
|
43 | - if( is_array( $value ) ) { |
|
44 | - foreach( $value as $key => $v ) { |
|
45 | - $value[ $key ] = $this->_remove_tags( $v ); |
|
42 | + protected function _remove_tags($value) { |
|
43 | + if (is_array($value)) { |
|
44 | + foreach ($value as $key => $v) { |
|
45 | + $value[$key] = $this->_remove_tags($v); |
|
46 | 46 | } |
47 | - }elseif( is_string( $value ) ) { |
|
48 | - $value = wp_kses("$value", $this->_get_allowed_tags() ); |
|
47 | + }elseif (is_string($value)) { |
|
48 | + $value = wp_kses("$value", $this->_get_allowed_tags()); |
|
49 | 49 | } |
50 | 50 | return $value; |
51 | 51 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @return array|string |
57 | 57 | */ |
58 | 58 | function prepare_for_set_from_db($value_found_in_db_for_model_object) { |
59 | - return $this->_remove_tags( parent::prepare_for_set_from_db( $value_found_in_db_for_model_object ) ); |
|
59 | + return $this->_remove_tags(parent::prepare_for_set_from_db($value_found_in_db_for_model_object)); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | |
@@ -65,12 +65,12 @@ discard block |
||
65 | 65 | * @global array $allowedtags |
66 | 66 | * @return array |
67 | 67 | */ |
68 | - function _get_allowed_tags(){ |
|
68 | + function _get_allowed_tags() { |
|
69 | 69 | global $allowedtags; |
70 | 70 | $tags_we_allow = $allowedtags; |
71 | - $tags_we_allow['ol']=array(); |
|
72 | - $tags_we_allow['ul']=array(); |
|
73 | - $tags_we_allow['li']=array(); |
|
74 | - return apply_filters( 'FHEE__EE_Maybe_Serialized_Simple_HTML_Field___get_allowed_tags', $tags_we_allow, $this ); |
|
71 | + $tags_we_allow['ol'] = array(); |
|
72 | + $tags_we_allow['ul'] = array(); |
|
73 | + $tags_we_allow['li'] = array(); |
|
74 | + return apply_filters('FHEE__EE_Maybe_Serialized_Simple_HTML_Field___get_allowed_tags', $tags_we_allow, $this); |
|
75 | 75 | } |
76 | 76 | } |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | * |
22 | 22 | * ------------------------------------------------------------------------ |
23 | 23 | */ |
24 | -require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
|
25 | -require_once ( EE_CLASSES . 'EE_Ticket.class.php' ); |
|
24 | +require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
25 | +require_once (EE_CLASSES.'EE_Ticket.class.php'); |
|
26 | 26 | |
27 | 27 | class EEM_Ticket extends EEM_Soft_Delete_Base { |
28 | 28 | |
@@ -35,35 +35,35 @@ discard block |
||
35 | 35 | * @access private |
36 | 36 | * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) |
37 | 37 | */ |
38 | - protected function __construct( $timezone ) { |
|
39 | - $this->singular_item = __('Ticket','event_espresso'); |
|
40 | - $this->plural_item = __('Tickets','event_espresso'); |
|
38 | + protected function __construct($timezone) { |
|
39 | + $this->singular_item = __('Ticket', 'event_espresso'); |
|
40 | + $this->plural_item = __('Tickets', 'event_espresso'); |
|
41 | 41 | |
42 | 42 | $this->_tables = array( |
43 | 43 | 'Ticket'=> new EE_Primary_Table('esp_ticket', 'TKT_ID') |
44 | 44 | ); |
45 | 45 | $this->_fields = array( |
46 | 46 | 'Ticket'=>array( |
47 | - 'TKT_ID'=> new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID','event_espresso')), |
|
48 | - 'TTM_ID'=>new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID','event_espresso'), false, 0, 'Ticket_Template'), |
|
47 | + 'TKT_ID'=> new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID', 'event_espresso')), |
|
48 | + 'TTM_ID'=>new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID', 'event_espresso'), false, 0, 'Ticket_Template'), |
|
49 | 49 | 'TKT_name'=>new EE_Plain_Text_Field('TKT_name', __('Ticket Name', 'event_espresso'), false, ''), |
50 | - 'TKT_description'=>new EE_Full_HTML_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, '' ), |
|
51 | - 'TKT_start_date'=>new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket','event_espresso'), false, time(), $timezone ), |
|
52 | - 'TKT_end_date'=>new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket','event_espresso'), false, time(), $timezone ), |
|
53 | - 'TKT_min'=>new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0 ), |
|
54 | - 'TKT_max'=>new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, EE_INF ), |
|
50 | + 'TKT_description'=>new EE_Full_HTML_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, ''), |
|
51 | + 'TKT_start_date'=>new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket', 'event_espresso'), false, time(), $timezone), |
|
52 | + 'TKT_end_date'=>new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket', 'event_espresso'), false, time(), $timezone), |
|
53 | + 'TKT_min'=>new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0), |
|
54 | + 'TKT_max'=>new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, EE_INF), |
|
55 | 55 | 'TKT_price'=> new EE_Money_Field('TKT_price', 'Final calculated price for ticket', false, 0), |
56 | 56 | 'TKT_sold' => new EE_Integer_Field('TKT_sold', __('Number of this ticket sold', 'event_espresso'), false, 0), |
57 | - 'TKT_qty'=>new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available','event_espresso'), false, EE_INF), |
|
58 | - 'TKT_uses'=>new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, EE_INF ), |
|
59 | - 'TKT_required'=>new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false ), |
|
60 | - 'TKT_taxable'=>new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false,false), |
|
61 | - 'TKT_is_default'=>new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false ), |
|
57 | + 'TKT_qty'=>new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available', 'event_espresso'), false, EE_INF), |
|
58 | + 'TKT_uses'=>new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, EE_INF), |
|
59 | + 'TKT_required'=>new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false), |
|
60 | + 'TKT_taxable'=>new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false, false), |
|
61 | + 'TKT_is_default'=>new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false), |
|
62 | 62 | 'TKT_order' => new EE_Integer_Field('TKT_order', __('The order in which the Ticket is displayed in the editor (used for autosaves when the form doesn\'t have the ticket ID yet)', 'event_espresso'), false, 0), |
63 | - 'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0 ), |
|
63 | + 'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0), |
|
64 | 64 | 'TKT_deleted' => new EE_Trashed_Flag_Field('TKT_deleted', __('Flag indicating if this has been archived or not', 'event_espresso'), false, false), |
65 | - 'TKT_wp_user' => new EE_WP_User_Field('TKT_wp_user', __('Ticket Creator ID', 'event_espresso'), FALSE ), |
|
66 | - 'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0 ) |
|
65 | + 'TKT_wp_user' => new EE_WP_User_Field('TKT_wp_user', __('Ticket Creator ID', 'event_espresso'), FALSE), |
|
66 | + 'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0) |
|
67 | 67 | )); |
68 | 68 | $this->_model_relations = array( |
69 | 69 | 'Datetime'=>new EE_HABTM_Relation('Datetime_Ticket'), |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | ); |
76 | 76 | |
77 | 77 | //this model is generally available for reading |
78 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Default_Public('TKT_is_default', 'Datetime.Event'); |
|
78 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Default_Public('TKT_is_default', 'Datetime.Event'); |
|
79 | 79 | //account for default tickets in the caps |
80 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' ); |
|
81 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' ); |
|
82 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' ); |
|
83 | - parent::__construct( $timezone ); |
|
80 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event'); |
|
81 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event'); |
|
82 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event'); |
|
83 | + parent::__construct($timezone); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function get_all_default_tickets() { |
93 | 93 | /** @type EE_Ticket[] $tickets */ |
94 | - $tickets = $this->get_all( array( array('TKT_is_default' => 1), 'order_by' => array('TKT_ID' => 'ASC')) ); |
|
94 | + $tickets = $this->get_all(array(array('TKT_is_default' => 1), 'order_by' => array('TKT_ID' => 'ASC'))); |
|
95 | 95 | //we need to set the start date and end date to today's date and the start of the default dtt |
96 | - return $this->_set_default_dates( $tickets ); |
|
96 | + return $this->_set_default_dates($tickets); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | * @param EE_Ticket[] $tickets |
104 | 104 | * @return EE_Ticket[] |
105 | 105 | */ |
106 | - private function _set_default_dates( $tickets ) { |
|
107 | - foreach ( $tickets as $ticket ) { |
|
108 | - $ticket->set('TKT_start_date', $this->current_time_for_query('TKT_start_date', true) ); |
|
109 | - $ticket->set('TKT_end_date', $this->current_time_for_query( 'TKT_end_date', true ) + (60 * 60 * 24 * 30 ) ); |
|
110 | - $ticket->set_end_time( $this->convert_datetime_for_query( 'TKT_end_date', '11:59 pm', 'g:i a', $this->_timezone ) ); |
|
106 | + private function _set_default_dates($tickets) { |
|
107 | + foreach ($tickets as $ticket) { |
|
108 | + $ticket->set('TKT_start_date', $this->current_time_for_query('TKT_start_date', true)); |
|
109 | + $ticket->set('TKT_end_date', $this->current_time_for_query('TKT_end_date', true) + (60 * 60 * 24 * 30)); |
|
110 | + $ticket->set_end_time($this->convert_datetime_for_query('TKT_end_date', '11:59 pm', 'g:i a', $this->_timezone)); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | return $tickets; |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | * @param array $query_params |
123 | 123 | * @return int |
124 | 124 | */ |
125 | - public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()){ |
|
126 | - return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime( $DTT_ID, $query_params ); |
|
125 | + public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) { |
|
126 | + return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime($DTT_ID, $query_params); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | * @param EE_Ticket[] $tickets |
134 | 134 | * @return void |
135 | 135 | */ |
136 | - public function update_tickets_sold($tickets){ |
|
137 | - foreach($tickets as $ticket){ |
|
136 | + public function update_tickets_sold($tickets) { |
|
137 | + foreach ($tickets as $ticket) { |
|
138 | 138 | /* @var $ticket EE_Ticket */ |
139 | 139 | $ticket->update_tickets_sold(); |
140 | 140 | } |
@@ -36,53 +36,53 @@ discard block |
||
36 | 36 | <h2 id="invoice-hdr"><?php _e('Order Confirmation', 'event_espresso')?></h2> |
37 | 37 | <h3 id="invoice-date"><?php _e('Date:', 'event_espresso')?> <span class="plain-text">[registration_date]</span></h3> |
38 | 38 | <h3 id="invoice-txn-id"><?php _e('Transaction ID:', 'event_espresso')?> <span class="plain-text">[transaction_id]</span></h3> |
39 | - <h3 id="invoice-txn-status"><?php _e('Status:', 'event_espresso')?> <span class="<?php echo $transaction->status_ID()?> plain-text"><?php echo $transaction->pretty_status();?></span></h3> |
|
39 | + <h3 id="invoice-txn-status"><?php _e('Status:', 'event_espresso')?> <span class="<?php echo $transaction->status_ID()?> plain-text"><?php echo $transaction->pretty_status(); ?></span></h3> |
|
40 | 40 | </div> |
41 | 41 | </td> |
42 | 42 | </tr> |
43 | 43 | </table> |
44 | 44 | <div class="events"> |
45 | - <?php foreach($events_for_txn as $event_id => $event){ |
|
46 | - ?><h3 class="section-title event-name"><img class="icon" src="<?php echo EE_IMAGES_URL.'calendar_year-24x24.png';?>"><?php _e("Event Name:","event_espresso")?> <span class="plain-text"><?php echo $event->name();?></span> <span class="small-text link">[ <a href='<?php echo $event->get_permalink()?>'><?php _e('view', 'event_espresso'); ?></a> ]</span></h3> |
|
47 | - <?php if (strlen($event->description()>1)){?><p class="event-description"><?php $event->description()?></p><?php }?> |
|
45 | + <?php foreach ($events_for_txn as $event_id => $event) { |
|
46 | + ?><h3 class="section-title event-name"><img class="icon" src="<?php echo EE_IMAGES_URL.'calendar_year-24x24.png'; ?>"><?php _e("Event Name:", "event_espresso")?> <span class="plain-text"><?php echo $event->name(); ?></span> <span class="small-text link">[ <a href='<?php echo $event->get_permalink()?>'><?php _e('view', 'event_espresso'); ?></a> ]</span></h3> |
|
47 | + <?php if (strlen($event->description() > 1)) {?><p class="event-description"><?php $event->description()?></p><?php }?> |
|
48 | 48 | <ul class="tickets-per-event"> |
49 | - <?php foreach($ticket_line_items_per_event[$event_id] as $line_item_id => $line_item){ |
|
49 | + <?php foreach ($ticket_line_items_per_event[$event_id] as $line_item_id => $line_item) { |
|
50 | 50 | $ticket = $line_item->ticket(); |
51 | - $taxable_html = $ticket->taxable() ? '*': ''; |
|
51 | + $taxable_html = $ticket->taxable() ? '*' : ''; |
|
52 | 52 | $subitems = $line_item->children(); |
53 | - $ticket_uses = $ticket->get_pretty('TKT_uses', __("any", "event_espresso")); |
|
53 | + $ticket_uses = $ticket->get_pretty('TKT_uses', __("any", "event_espresso")); |
|
54 | 54 | ?> |
55 | 55 | <li class="event-ticket"> |
56 | 56 | <div class="ticket-details"> |
57 | 57 | <table class="invoice-amount"> |
58 | 58 | <thead> |
59 | 59 | <tr class="header_row"> |
60 | - <th class="name-column"><?php _e("Ticket", "event_espresso");?></th> |
|
61 | - <th colspan="2" class="desc-column"><?php _e("Description", "event_espresso");?></th> |
|
62 | - <th class="number-column item_c"><?php _e("Quantity", "event_espresso");?></th> |
|
63 | - <th class="number-column item_c"><?php _e("Price", "event_espresso");?></th> |
|
64 | - <th class="number-column item_r"><?php _e("Total", "event_espresso");?></th> |
|
60 | + <th class="name-column"><?php _e("Ticket", "event_espresso"); ?></th> |
|
61 | + <th colspan="2" class="desc-column"><?php _e("Description", "event_espresso"); ?></th> |
|
62 | + <th class="number-column item_c"><?php _e("Quantity", "event_espresso"); ?></th> |
|
63 | + <th class="number-column item_c"><?php _e("Price", "event_espresso"); ?></th> |
|
64 | + <th class="number-column item_r"><?php _e("Total", "event_espresso"); ?></th> |
|
65 | 65 | </tr> |
66 | 66 | </thead> |
67 | 67 | <tbody> |
68 | - <?php if( count($subitems) < 2){?> |
|
68 | + <?php if (count($subitems) < 2) {?> |
|
69 | 69 | <tr class="item"> |
70 | 70 | <td><?php echo $line_item->name().$taxable_html?></td> |
71 | - <td colspan="2"><?php echo $line_item->desc();?><p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), $ticket_uses); ?></p></td> |
|
71 | + <td colspan="2"><?php echo $line_item->desc(); ?><p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), $ticket_uses); ?></p></td> |
|
72 | 72 | <td class="item_c"><?php echo $line_item->quantity()?></td> |
73 | 73 | <td class="item_c"><?php echo $line_item->unit_price_no_code()?></td> |
74 | 74 | <td class="item_r"><?php echo $line_item->total_no_code()?></td> |
75 | 75 | </tr> |
76 | - <?php }else{?> |
|
76 | + <?php } else {?> |
|
77 | 77 | <tr class="item"> |
78 | 78 | <td class="aln-left"><?php echo $line_item->name().$taxable_html?></td> |
79 | - <td colspan="2"><?php echo $line_item->desc();?><p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), $ticket_uses); ?></p></td> |
|
79 | + <td colspan="2"><?php echo $line_item->desc(); ?><p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), $ticket_uses); ?></p></td> |
|
80 | 80 | <td class="item_c"><?php echo $line_item->quantity()?></td> |
81 | 81 | <td class="item_c"><?php echo $line_item->unit_price_no_code()?></td> |
82 | 82 | <td class="item_r"><?php echo $line_item->total_no_code()?></td> |
83 | 83 | </tr> |
84 | - <?php foreach($subitems as $sub_line_item){ |
|
85 | - $is_percent = $sub_line_item->is_percent();?> |
|
84 | + <?php foreach ($subitems as $sub_line_item) { |
|
85 | + $is_percent = $sub_line_item->is_percent(); ?> |
|
86 | 86 | <tr class="subitem-row"> |
87 | 87 | <td class="subitem"><?php echo $sub_line_item->name()?></td> |
88 | 88 | <td colspan="2"><?php echo $sub_line_item->desc()?></td> |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | <?php } ?> |
94 | 94 | <tr class="total_tr odd"> |
95 | 95 | <td colspan="4"></td> |
96 | - <td class="total" nowrap="nowrap"><?php _e("Ticket Total:", "event_espresso");?></td> |
|
96 | + <td class="total" nowrap="nowrap"><?php _e("Ticket Total:", "event_espresso"); ?></td> |
|
97 | 97 | <td class="item_r"><?php echo $line_item->total_no_code()?></td> |
98 | 98 | </tr> |
99 | 99 | <?php }?> |
@@ -104,22 +104,22 @@ discard block |
||
104 | 104 | <div class="reg-details-for-ticket"> |
105 | 105 | <div class="ticket-time-and-place-details"> |
106 | 106 | <div class="ticket-time-details"> |
107 | - <h4 class="sub-section-title no-bottom-margin"><img class="icon" src="<?php echo EE_IMAGES_URL.'clock-16x16.png';?>"><?php echo _n("Date/Time:","Dates/Times:",count($ticket->datetimes()), "event_espresso");?></h4> |
|
107 | + <h4 class="sub-section-title no-bottom-margin"><img class="icon" src="<?php echo EE_IMAGES_URL.'clock-16x16.png'; ?>"><?php echo _n("Date/Time:", "Dates/Times:", count($ticket->datetimes()), "event_espresso"); ?></h4> |
|
108 | 108 | <ul class="event-dates"> |
109 | - <?php foreach($ticket->datetimes_ordered() as $datetime){ |
|
109 | + <?php foreach ($ticket->datetimes_ordered() as $datetime) { |
|
110 | 110 | /* @var $datetime EE_Datetime */ ?> |
111 | 111 | <li><?php |
112 | - echo $datetime->name() ? '<b>'.$datetime->name().' </b>' : '' ; |
|
113 | - echo sprintf(__("%s - %s (%s)", "event_espresso"),$datetime->start_date_and_time(),$datetime->end_date_and_time(),$datetime->get_timezone()); |
|
112 | + echo $datetime->name() ? '<b>'.$datetime->name().' </b>' : ''; |
|
113 | + echo sprintf(__("%s - %s (%s)", "event_espresso"), $datetime->start_date_and_time(), $datetime->end_date_and_time(), $datetime->get_timezone()); |
|
114 | 114 | echo $datetime->description() ? '<p class="ticket-note">'.$datetime->description().'</p>' : '' ?></li> |
115 | 115 | <?php }?> |
116 | 116 | </ul> |
117 | 117 | </div> |
118 | - <?php if ($event->venues()){?> |
|
118 | + <?php if ($event->venues()) {?> |
|
119 | 119 | <div class="ticket-place-details"> |
120 | - <h4 class="sub-section-title no-bottom-margin"><img class="icon" src="<?php echo EE_IMAGES_URL.'location-pin-16x16.png';?>"><?php echo _n("Venue:","Venues:",count($event->venues()), "event_espresso");?></h4> |
|
120 | + <h4 class="sub-section-title no-bottom-margin"><img class="icon" src="<?php echo EE_IMAGES_URL.'location-pin-16x16.png'; ?>"><?php echo _n("Venue:", "Venues:", count($event->venues()), "event_espresso"); ?></h4> |
|
121 | 121 | <ul class="event-venues"> |
122 | - <?php foreach($event->venues() as $venue){?> |
|
122 | + <?php foreach ($event->venues() as $venue) {?> |
|
123 | 123 | <li><?php echo $venue->name()?> <span class="small-text">[ <a href='<?php echo $venue->get_permalink()?>'><?php _e('view', 'event_espresso'); ?></a> ]</span></li> |
124 | 124 | <?php } ?> |
125 | 125 | </ul> |
@@ -127,34 +127,34 @@ discard block |
||
127 | 127 | <?php }?> |
128 | 128 | </div> |
129 | 129 | <div class="ticket-registrations-area"> |
130 | - <h4 class="sub-section-title"><img class="icon" src="<?php echo EE_IMAGES_URL.'users-16x16.png';?>"><?php echo __("Registration Details", "event_espresso");?> <span class="small-text link">[ <a class="print_button noPrint" href="<?php echo $edit_reg_info_url; ?>"><?php _e('edit', 'event_espresso'); ?></a> ]</span></h4> |
|
130 | + <h4 class="sub-section-title"><img class="icon" src="<?php echo EE_IMAGES_URL.'users-16x16.png'; ?>"><?php echo __("Registration Details", "event_espresso"); ?> <span class="small-text link">[ <a class="print_button noPrint" href="<?php echo $edit_reg_info_url; ?>"><?php _e('edit', 'event_espresso'); ?></a> ]</span></h4> |
|
131 | 131 | <ul class="ticket-registrations-list"> |
132 | - <?php foreach($registrations_per_line_item[$line_item_id] as $registration){ |
|
132 | + <?php foreach ($registrations_per_line_item[$line_item_id] as $registration) { |
|
133 | 133 | /* @var $registration EE_Registration */ |
134 | 134 | $attendee = $registration->attendee(); |
135 | - $answers = $registration->answers(array('order_by'=>array('Question.Question_Group_Question.QGQ_order'=>'ASC')));?> |
|
135 | + $answers = $registration->answers(array('order_by'=>array('Question.Question_Group_Question.QGQ_order'=>'ASC'))); ?> |
|
136 | 136 | <li class="ticket-registration"> |
137 | 137 | <table class="registration-details"> |
138 | 138 | <tr class="odd"> |
139 | - <th><?php echo _e("Registration Code:", "event_espresso");?></th> |
|
140 | - <td><?php echo $registration->reg_code();?> - <span class="<?php echo $registration->status_ID()?>"><?php echo $registration->pretty_status()?></span></td> |
|
139 | + <th><?php echo _e("Registration Code:", "event_espresso"); ?></th> |
|
140 | + <td><?php echo $registration->reg_code(); ?> - <span class="<?php echo $registration->status_ID()?>"><?php echo $registration->pretty_status()?></span></td> |
|
141 | 141 | </tr> |
142 | 142 | <?php |
143 | - foreach($event->question_groups() as $question_group){ |
|
144 | - ?><tr><th><?php $question_group->e('QSG_name');?></th><td></td></tr><?php |
|
143 | + foreach ($event->question_groups() as $question_group) { |
|
144 | + ?><tr><th><?php $question_group->e('QSG_name'); ?></th><td></td></tr><?php |
|
145 | 145 | $has_personal_info = false; |
146 | - foreach($question_group->questions() as $question){ |
|
147 | - if( in_array($question->system_ID(),$questions_to_skip)){ |
|
146 | + foreach ($question_group->questions() as $question) { |
|
147 | + if (in_array($question->system_ID(), $questions_to_skip)) { |
|
148 | 148 | $has_personal_info = true; |
149 | 149 | continue; |
150 | 150 | } |
151 | 151 | ?><tr> |
152 | 152 | <th><?php echo $question->display_text()?></th> |
153 | - <td><?php echo $registration->answer_value_to_question($question);?></td> |
|
153 | + <td><?php echo $registration->answer_value_to_question($question); ?></td> |
|
154 | 154 | </tr><?php |
155 | 155 | } |
156 | - if($has_personal_info){ |
|
157 | - ?><tr><th><?php _e('Attendee', 'event_espresso');?></th><td><?php echo sprintf(__('%s (%s)', "event_espresso"),$attendee->full_name(),$attendee->email())?></td></tr><?php |
|
156 | + if ($has_personal_info) { |
|
157 | + ?><tr><th><?php _e('Attendee', 'event_espresso'); ?></th><td><?php echo sprintf(__('%s (%s)', "event_espresso"), $attendee->full_name(), $attendee->email())?></td></tr><?php |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | ?> |
@@ -171,21 +171,21 @@ discard block |
||
171 | 171 | <?php }?> |
172 | 172 | </div> |
173 | 173 | <div class="taxes"> |
174 | - <?php if ($tax_total_line_item && $tax_total_line_item->children()){?> |
|
175 | - <h3 class="section-title"><?php _e("Taxes",'event_espresso')?></h3> |
|
174 | + <?php if ($tax_total_line_item && $tax_total_line_item->children()) {?> |
|
175 | + <h3 class="section-title"><?php _e("Taxes", 'event_espresso')?></h3> |
|
176 | 176 | <table class="invoice-amount"> |
177 | 177 | |
178 | 178 | <thead> |
179 | 179 | <tr class="header_row"> |
180 | - <th class="left ticket_th"><?php _e("Tax Name", "event_espresso");?></th> |
|
181 | - <th class="left"><?php _e('Description', 'event_espresso');?></th> |
|
180 | + <th class="left ticket_th"><?php _e("Tax Name", "event_espresso"); ?></th> |
|
181 | + <th class="left"><?php _e('Description', 'event_espresso'); ?></th> |
|
182 | 182 | <th class="event_th item_c"><?php _e('Rate', 'event_espresso'); ?></th> |
183 | 183 | <th class="subtotal_th"><?php _e('Tax Amount', 'event_espresso'); ?></th> |
184 | 184 | </tr> |
185 | 185 | </thead> |
186 | 186 | <tbody> |
187 | 187 | <?php |
188 | - foreach($tax_total_line_item->children() as $child_tax){?> |
|
188 | + foreach ($tax_total_line_item->children() as $child_tax) {?> |
|
189 | 189 | <tr> |
190 | 190 | <td><?php echo $child_tax->name()?></td> |
191 | 191 | <td><?php echo $child_tax->desc()?></td> |
@@ -195,26 +195,26 @@ discard block |
||
195 | 195 | <?php } ?> |
196 | 196 | <tr class="total_tr odd"> |
197 | 197 | <td class="total_tr" colspan="2"></td> |
198 | - <td class="total"><?php _e("Tax Total:", "event_espresso");?></td> |
|
198 | + <td class="total"><?php _e("Tax Total:", "event_espresso"); ?></td> |
|
199 | 199 | <td class="item_r"><?php echo $tax_total_line_item->total_no_code()?></td> |
200 | 200 | </tr> |
201 | 201 | </tbody> |
202 | 202 | |
203 | 203 | </table> |
204 | 204 | <?php }?> |
205 | - <p><?php _e("* taxable items", "event_espresso");?></p> |
|
205 | + <p><?php _e("* taxable items", "event_espresso"); ?></p> |
|
206 | 206 | </div> |
207 | 207 | <div class="grand-total-dv"> |
208 | - <h2 class="grand-total"><?php printf(__("Grand Total: %s", "event_espresso"),EEH_Template::format_currency($total_cost));?></h2> |
|
208 | + <h2 class="grand-total"><?php printf(__("Grand Total: %s", "event_espresso"), EEH_Template::format_currency($total_cost)); ?></h2> |
|
209 | 209 | </div> |
210 | 210 | <div class="payment-dv"> |
211 | - <h3 class="section-title"><?php _e("Payments",'event_espresso')?></h3> |
|
211 | + <h3 class="section-title"><?php _e("Payments", 'event_espresso')?></h3> |
|
212 | 212 | <p>[instructions]</p> |
213 | 213 | <table class="invoice-amount"> |
214 | 214 | <thead> |
215 | 215 | <tr class="header_row"> |
216 | 216 | <th><span class=""><?php _e('Payment Method', 'event_espresso'); ?></span></th> |
217 | - <th class='left datetime_th'><?php _e("Date",'event_espresso')?></th> |
|
217 | + <th class='left datetime_th'><?php _e("Date", 'event_espresso')?></th> |
|
218 | 218 | <th><span class=""><?php _e('Transaction Id / Cheque #', 'event_espresso'); ?></span></th> |
219 | 219 | <th><span class=""><?php _e('P.O. / S.O.#', 'event_espresso'); ?></span></th> |
220 | 220 | <th><span class=""><?php _e('Status', 'event_espresso'); ?></span></th> |
@@ -224,11 +224,11 @@ discard block |
||
224 | 224 | <tbody> |
225 | 225 | <?php |
226 | 226 | $c = false; |
227 | - if(!empty($payments)){ |
|
227 | + if ( ! empty($payments)) { |
|
228 | 228 | |
229 | - foreach($payments as $payment){ |
|
229 | + foreach ($payments as $payment) { |
|
230 | 230 | /* @var $payment EE_Payment */?> |
231 | - <tr class='item <?php echo (($c = !$c) ? ' odd' : '')?>'> |
|
231 | + <tr class='item <?php echo (($c = ! $c) ? ' odd' : '')?>'> |
|
232 | 232 | <td><?php $payment->e('PAY_gateway')?></td> |
233 | 233 | <td><?php echo $payment->timestamp()?></td> |
234 | 234 | <td><?php $payment->e('PAY_txn_id_chq_nmbr')?></td> |
@@ -237,17 +237,17 @@ discard block |
||
237 | 237 | <td class='item_r'><?php echo $payment->amount_no_code()?></td> |
238 | 238 | </tr> |
239 | 239 | <?php } |
240 | - }else{?> |
|
240 | + } else {?> |
|
241 | 241 | <tr class='item'> |
242 | - <td class='aln-cntr' colspan="6"><?php _e("No approved payments have been received.",'event_espresso')?> </td> |
|
242 | + <td class='aln-cntr' colspan="6"><?php _e("No approved payments have been received.", 'event_espresso')?> </td> |
|
243 | 243 | </tr> |
244 | 244 | <?php } |
245 | - ?><tr class="item" ><td class='aln-cntr' colspan="6"><?php if($amount_owed){?><a class="noPrint" href='<?php echo $retry_payment_url?>'><?php _e("Please make a payment.", "event_espresso");}?></a></td></tr> |
|
245 | + ?><tr class="item" ><td class='aln-cntr' colspan="6"><?php if ($amount_owed) {?><a class="noPrint" href='<?php echo $retry_payment_url?>'><?php _e("Please make a payment.", "event_espresso"); }?></a></td></tr> |
|
246 | 246 | </tbody> |
247 | 247 | <tfoot> |
248 | 248 | <tr class='total_tr'><td colspan="4"> </td> |
249 | - <td class="item_r"><?php _e('Total Paid','event_espresso')?></td> |
|
250 | - <td class="item_r"><?php echo EEH_Template::format_currency($amount_pd,false,false)?> </td> |
|
249 | + <td class="item_r"><?php _e('Total Paid', 'event_espresso')?></td> |
|
250 | + <td class="item_r"><?php echo EEH_Template::format_currency($amount_pd, false, false)?> </td> |
|
251 | 251 | </tr> |
252 | 252 | <?php //echo $discount; ?> |
253 | 253 | <tr class="total_tr odd"> |
@@ -259,20 +259,20 @@ discard block |
||
259 | 259 | </table> |
260 | 260 | </div> |
261 | 261 | <div class="additional-info-dv"> |
262 | - <h3 class="section-title"><?php _e("Additional Information:", "event_espresso");?></h3> |
|
262 | + <h3 class="section-title"><?php _e("Additional Information:", "event_espresso"); ?></h3> |
|
263 | 263 | <div class="additional-info"> |
264 | - <?php if($venues_for_events){?> |
|
265 | - <h2><?php echo _n("Venue Details:", "Venues Details:", "event_espresso",count($venues_for_events));?></h2> |
|
264 | + <?php if ($venues_for_events) {?> |
|
265 | + <h2><?php echo _n("Venue Details:", "Venues Details:", "event_espresso", count($venues_for_events)); ?></h2> |
|
266 | 266 | <table class="venue-list"> |
267 | - <?php foreach($venues_for_events as $venue){?> |
|
267 | + <?php foreach ($venues_for_events as $venue) {?> |
|
268 | 268 | <tr class="venue-details"> |
269 | 269 | <td class="venue-details-part venue-address-dv"> |
270 | 270 | <h3><a href='<?php echo $venue->get_permalink()?>'><?php |
271 | 271 | echo $venue->name() |
272 | 272 | ?></a></h3> |
273 | 273 | <p><?php echo $venue->description()?></p> |
274 | - <?php echo EEH_Address::format($venue);?></td> |
|
275 | - <?php if($venue->enable_for_gmap()){?> |
|
274 | + <?php echo EEH_Address::format($venue); ?></td> |
|
275 | + <?php if ($venue->enable_for_gmap()) {?> |
|
276 | 276 | <td class="venue-details-part venue-image-dv"><?php echo EEH_Venue_View::espresso_google_static_map($venue)?></td> |
277 | 277 | <?php } ?> |
278 | 278 | </tr> |
@@ -280,9 +280,9 @@ discard block |
||
280 | 280 | </table> |
281 | 281 | <?php } ?> |
282 | 282 | |
283 | - <?php if($shameless_plug){?> |
|
283 | + <?php if ($shameless_plug) {?> |
|
284 | 284 | <div class='aln-cntr'><?php |
285 | - printf(__("Powered by %sEvent Espresso %s", "event_espresso"),"<a href='https://eventespresso.com'>","</a>"); |
|
285 | + printf(__("Powered by %sEvent Espresso %s", "event_espresso"), "<a href='https://eventespresso.com'>", "</a>"); |
|
286 | 286 | ?></div> |
287 | 287 | <?php } ?> |
288 | 288 | </div> |
@@ -23,15 +23,15 @@ discard block |
||
23 | 23 | </td> |
24 | 24 | <td> |
25 | 25 | <div id="invoice-info"> |
26 | - <h2 id="invoice-hdr"><?php _e( 'Order Confirmation', 'event_espresso' ) ?></h2> |
|
26 | + <h2 id="invoice-hdr"><?php _e('Order Confirmation', 'event_espresso') ?></h2> |
|
27 | 27 | |
28 | - <h3 id="invoice-date"><?php _e( 'Date:', 'event_espresso' ) ?> |
|
28 | + <h3 id="invoice-date"><?php _e('Date:', 'event_espresso') ?> |
|
29 | 29 | <span class="plain-text">[PRIMARY_REGISTRANT_REGISTRATION_DATE]</span></h3> |
30 | 30 | |
31 | - <h3 id="invoice-txn-id"><?php _e( 'Transaction ID:', 'event_espresso' ) ?> |
|
31 | + <h3 id="invoice-txn-id"><?php _e('Transaction ID:', 'event_espresso') ?> |
|
32 | 32 | <span class="plain-text">[TXN_ID]</span></h3> |
33 | 33 | |
34 | - <h3 id="invoice-txn-status"><?php _e( 'Status:', 'event_espresso' ) ?> |
|
34 | + <h3 id="invoice-txn-status"><?php _e('Status:', 'event_espresso') ?> |
|
35 | 35 | <span class="[TXN_STATUS_ID] plain-text">[TXN_STATUS]</span></h3> |
36 | 36 | </div> |
37 | 37 | </td> |
@@ -41,15 +41,15 @@ discard block |
||
41 | 41 | [EVENT_LIST] |
42 | 42 | </div> |
43 | 43 | <div class="taxes"> |
44 | - <h3 class="section-title"><?php _e( "Additional Charges/Discounts", 'event_espresso' ) ?></h3> |
|
44 | + <h3 class="section-title"><?php _e("Additional Charges/Discounts", 'event_espresso') ?></h3> |
|
45 | 45 | <table class="invoice-amount"> |
46 | 46 | <thead> |
47 | 47 | <tr class="header_row"> |
48 | - <th class="left ticket_th"><?php _e( "Name", "event_espresso" ); ?></th> |
|
49 | - <th class="left"><?php _e( 'Description', 'event_espresso' ); ?></th> |
|
50 | - <th class="event_th item_c"><?php _e( 'Quantity', 'event_espresso' ); ?></th> |
|
51 | - <th class="event_th item_c"><?php _e( 'Unit Price', 'event_espresso' ); ?></th> |
|
52 | - <th class="subtotal_th"><?php _e( 'Total', 'event_espresso' ); ?></th> |
|
48 | + <th class="left ticket_th"><?php _e("Name", "event_espresso"); ?></th> |
|
49 | + <th class="left"><?php _e('Description', 'event_espresso'); ?></th> |
|
50 | + <th class="event_th item_c"><?php _e('Quantity', 'event_espresso'); ?></th> |
|
51 | + <th class="event_th item_c"><?php _e('Unit Price', 'event_espresso'); ?></th> |
|
52 | + <th class="subtotal_th"><?php _e('Total', 'event_espresso'); ?></th> |
|
53 | 53 | </tr> |
54 | 54 | </thead> |
55 | 55 | <tbody> |
@@ -60,15 +60,15 @@ discard block |
||
60 | 60 | </table> |
61 | 61 | </div> |
62 | 62 | <div class="taxes"> |
63 | - <h3 class="section-title"><?php _e( "Taxes", 'event_espresso' ) ?></h3> |
|
64 | - <p><?php printf( __( '%s*%s Taxable items. The total amount collected for taxes is reflected in the total(s) below.', 'event_espresso' ), '<strong>', '</strong>' ); ?></p> |
|
63 | + <h3 class="section-title"><?php _e("Taxes", 'event_espresso') ?></h3> |
|
64 | + <p><?php printf(__('%s*%s Taxable items. The total amount collected for taxes is reflected in the total(s) below.', 'event_espresso'), '<strong>', '</strong>'); ?></p> |
|
65 | 65 | <table class="invoice-amount"> |
66 | 66 | <thead> |
67 | 67 | <tr class="header_row"> |
68 | - <th class="left ticket_th"><?php _e( "Tax Name", "event_espresso" ); ?></th> |
|
69 | - <th class="left"><?php _e( 'Description', 'event_espresso' ); ?></th> |
|
70 | - <th class="event_th item_c"><?php _e( 'Rate', 'event_espresso' ); ?></th> |
|
71 | - <th class="subtotal_th"><?php _e( 'Tax Amount', 'event_espresso' ); ?></th> |
|
68 | + <th class="left ticket_th"><?php _e("Tax Name", "event_espresso"); ?></th> |
|
69 | + <th class="left"><?php _e('Description', 'event_espresso'); ?></th> |
|
70 | + <th class="event_th item_c"><?php _e('Rate', 'event_espresso'); ?></th> |
|
71 | + <th class="subtotal_th"><?php _e('Tax Amount', 'event_espresso'); ?></th> |
|
72 | 72 | </tr> |
73 | 73 | </thead> |
74 | 74 | <tbody> |
@@ -79,19 +79,19 @@ discard block |
||
79 | 79 | </table> |
80 | 80 | </div> |
81 | 81 | <div class="grand-total-dv"> |
82 | - <h2 class="grand-total"><?php printf( __( "Grand Total: %s", "event_espresso" ), '[TOTAL_COST]' ); ?></h2> |
|
82 | + <h2 class="grand-total"><?php printf(__("Grand Total: %s", "event_espresso"), '[TOTAL_COST]'); ?></h2> |
|
83 | 83 | </div> |
84 | 84 | <div class="payment-dv"> |
85 | - <h3 class="section-title"><?php _e( "Payments", 'event_espresso' ) ?></h3> |
|
85 | + <h3 class="section-title"><?php _e("Payments", 'event_espresso') ?></h3> |
|
86 | 86 | <table class="invoice-amount"> |
87 | 87 | <thead> |
88 | 88 | <tr class="header_row"> |
89 | - <th><span class=""><?php _e( 'Payment Method', 'event_espresso' ); ?></span></th> |
|
90 | - <th class='left datetime_th'><?php _e( "Date", 'event_espresso' ) ?></th> |
|
91 | - <th><span class=""><?php _e( 'Transaction Id / Cheque #', 'event_espresso' ); ?></span></th> |
|
92 | - <th><span class=""><?php _e( 'P.O. / S.O.#', 'event_espresso' ); ?></span></th> |
|
93 | - <th><span class=""><?php _e( 'Status', 'event_espresso' ); ?></span></th> |
|
94 | - <th><?php _e( 'Amount', 'event_espresso' ); ?></th> |
|
89 | + <th><span class=""><?php _e('Payment Method', 'event_espresso'); ?></span></th> |
|
90 | + <th class='left datetime_th'><?php _e("Date", 'event_espresso') ?></th> |
|
91 | + <th><span class=""><?php _e('Transaction Id / Cheque #', 'event_espresso'); ?></span></th> |
|
92 | + <th><span class=""><?php _e('P.O. / S.O.#', 'event_espresso'); ?></span></th> |
|
93 | + <th><span class=""><?php _e('Status', 'event_espresso'); ?></span></th> |
|
94 | + <th><?php _e('Amount', 'event_espresso'); ?></th> |
|
95 | 95 | </tr> |
96 | 96 | </thead> |
97 | 97 | <tbody> |
@@ -105,21 +105,21 @@ discard block |
||
105 | 105 | <tfoot> |
106 | 106 | <tr class='total_tr'> |
107 | 107 | <td colspan="4"> </td> |
108 | - <td class="item_r"><?php _e( 'Total Paid', 'event_espresso' ) ?></td> |
|
108 | + <td class="item_r"><?php _e('Total Paid', 'event_espresso') ?></td> |
|
109 | 109 | <td class="item_r">[TOTAL_AMOUNT_PAID]</td> |
110 | 110 | </tr> |
111 | 111 | <tr class="total_tr odd"> |
112 | 112 | <td colspan="4"> </td> |
113 | - <td class="total" id="total_currency"><?php _e( 'Amount Owed:', 'event_espresso' ); ?></td> |
|
113 | + <td class="total" id="total_currency"><?php _e('Amount Owed:', 'event_espresso'); ?></td> |
|
114 | 114 | <td class="total">[TOTAL_OWING]</td> |
115 | 115 | </tr> |
116 | 116 | </tfoot> |
117 | 117 | </table> |
118 | 118 | </div> |
119 | 119 | <div class="additional-info-dv"> |
120 | - <h3 class="section-title"><?php _e( "Additional Information:", "event_espresso" ); ?></h3> |
|
120 | + <h3 class="section-title"><?php _e("Additional Information:", "event_espresso"); ?></h3> |
|
121 | 121 | <div class="additional-info"> |
122 | - <h2><?php _e( "Venue Details:", "event_espresso" ); ?></h2> |
|
122 | + <h2><?php _e("Venue Details:", "event_espresso"); ?></h2> |
|
123 | 123 | <table class="venue-list"> |
124 | 124 | <tr class="venue-details"> |
125 | 125 | <td class="venue-details-part venue-address-dv"> |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | <td class="venue-details-part venue-image-dv">[GOOGLE_MAP_IMAGE]</td> |
132 | 132 | </tr> |
133 | 133 | </table> |
134 | - <div class='aln-cntr'><?php printf( __( "Powered by %sEvent Espresso %s", "event_espresso" ), "<a href='https://eventespresso.com'>", "</a>" ); ?></div> |
|
134 | + <div class='aln-cntr'><?php printf(__("Powered by %sEvent Espresso %s", "event_espresso"), "<a href='https://eventespresso.com'>", "</a>"); ?></div> |
|
135 | 135 | </div> |
136 | 136 | </div> |
137 | 137 | </div> |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @return EED_Event_Single |
41 | 41 | */ |
42 | 42 | public static function instance() { |
43 | - return parent::get_instance( __CLASS__ ); |
|
43 | + return parent::get_instance(__CLASS__); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | * @return void |
53 | 53 | */ |
54 | 54 | public static function set_hooks() { |
55 | - add_filter( 'FHEE_run_EE_wp', '__return_true' ); |
|
56 | - add_action( 'wp_loaded', array( 'EED_Event_Single', 'set_definitions' ), 2 ); |
|
57 | - EE_Config::register_route( __( 'event', 'event_espresso' ), 'Event_Single', 'run' ); |
|
55 | + add_filter('FHEE_run_EE_wp', '__return_true'); |
|
56 | + add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2); |
|
57 | + EE_Config::register_route(__('event', 'event_espresso'), 'Event_Single', 'run'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @return void |
65 | 65 | */ |
66 | 66 | public static function set_hooks_admin() { |
67 | - add_action( 'wp_loaded', array( 'EED_Event_Single', 'set_definitions' ), 2 ); |
|
67 | + add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | * @return void |
79 | 79 | */ |
80 | 80 | public static function set_definitions() { |
81 | - define( 'EVENT_SINGLE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
82 | - define( 'EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path( __FILE__ ) . 'templates' . DS ); |
|
81 | + define('EVENT_SINGLE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
82 | + define('EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path(__FILE__).'templates'.DS); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @void |
91 | 91 | */ |
92 | - protected function set_config(){ |
|
93 | - $this->set_config_section( 'template_settings' ); |
|
94 | - $this->set_config_class( 'EE_Event_Single_Config' ); |
|
95 | - $this->set_config_name( 'EED_Event_Single' ); |
|
92 | + protected function set_config() { |
|
93 | + $this->set_config_section('template_settings'); |
|
94 | + $this->set_config_class('EE_Event_Single_Config'); |
|
95 | + $this->set_config_name('EED_Event_Single'); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -105,35 +105,35 @@ discard block |
||
105 | 105 | * @param \EE_Event_Single_Config $config |
106 | 106 | * @return \EE_Template_Part_Manager |
107 | 107 | */ |
108 | - public function initialize_template_parts( EE_Event_Single_Config $config = null ) { |
|
108 | + public function initialize_template_parts(EE_Event_Single_Config $config = null) { |
|
109 | 109 | $config = $config instanceof EE_Event_Single_Config ? $config : $this->config(); |
110 | 110 | EEH_Autoloader::instance()->register_template_part_autoloaders(); |
111 | 111 | $template_parts = new EE_Template_Part_Manager(); |
112 | 112 | $template_parts->add_template_part( |
113 | 113 | 'tickets', |
114 | - __( 'Ticket Selector', 'event_espresso' ), |
|
114 | + __('Ticket Selector', 'event_espresso'), |
|
115 | 115 | 'content-espresso_events-tickets.php', |
116 | 116 | $config->display_order_tickets |
117 | 117 | ); |
118 | 118 | $template_parts->add_template_part( |
119 | 119 | 'datetimes', |
120 | - __( 'Dates and Times', 'event_espresso' ), |
|
120 | + __('Dates and Times', 'event_espresso'), |
|
121 | 121 | 'content-espresso_events-datetimes.php', |
122 | 122 | $config->display_order_datetimes |
123 | 123 | ); |
124 | 124 | $template_parts->add_template_part( |
125 | 125 | 'event', |
126 | - __( 'Event Description', 'event_espresso' ), |
|
126 | + __('Event Description', 'event_espresso'), |
|
127 | 127 | 'content-espresso_events-details.php', |
128 | 128 | $config->display_order_event |
129 | 129 | ); |
130 | 130 | $template_parts->add_template_part( |
131 | 131 | 'venue', |
132 | - __( 'Venue Information', 'event_espresso' ), |
|
132 | + __('Venue Information', 'event_espresso'), |
|
133 | 133 | 'content-espresso_events-venues.php', |
134 | 134 | $config->display_order_venue |
135 | 135 | ); |
136 | - do_action( 'AHEE__EED_Event_Single__initialize_template_parts', $template_parts ); |
|
136 | + do_action('AHEE__EED_Event_Single__initialize_template_parts', $template_parts); |
|
137 | 137 | return $template_parts; |
138 | 138 | } |
139 | 139 | |
@@ -147,15 +147,15 @@ discard block |
||
147 | 147 | * @param WP $WP |
148 | 148 | * @return void |
149 | 149 | */ |
150 | - public function run( $WP ) { |
|
150 | + public function run($WP) { |
|
151 | 151 | // ensure valid EE_Events_Single_Config() object exists |
152 | 152 | $this->set_config(); |
153 | 153 | // check what template is loaded |
154 | - add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
|
155 | - add_filter( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
154 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
155 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
156 | 156 | // load css |
157 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
158 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
157 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
158 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | |
@@ -167,27 +167,27 @@ discard block |
||
167 | 167 | * @param string $template |
168 | 168 | * @return string |
169 | 169 | */ |
170 | - public function template_include( $template ) { |
|
170 | + public function template_include($template) { |
|
171 | 171 | global $post; |
172 | 172 | /** @type EE_Event_Single_Config $config */ |
173 | 173 | $config = $this->config(); |
174 | - if ( $config->display_status_banner_single ) { |
|
175 | - add_filter( 'the_title', array( 'EED_Event_Single', 'the_title' ), 100, 2 ); |
|
174 | + if ($config->display_status_banner_single) { |
|
175 | + add_filter('the_title', array('EED_Event_Single', 'the_title'), 100, 2); |
|
176 | 176 | } |
177 | 177 | // not a custom template? |
178 | 178 | if ( |
179 | 179 | EE_Front_Controller::instance()->get_selected_template() != 'single-espresso_events.php' |
180 | - || apply_filters( 'FHEE__EED_Event_Single__template_include__allow_custom_selected_template', FALSE ) |
|
181 | - && ! post_password_required( $post ) |
|
180 | + || apply_filters('FHEE__EED_Event_Single__template_include__allow_custom_selected_template', FALSE) |
|
181 | + && ! post_password_required($post) |
|
182 | 182 | ) { |
183 | 183 | EEH_Template::load_espresso_theme_functions(); |
184 | 184 | // then add extra event data via hooks |
185 | - add_action( 'loop_start', array( 'EED_Event_Single', 'loop_start' )); |
|
186 | - add_filter( 'get_the_excerpt', array( 'EED_Event_Single', 'get_the_excerpt' ), 1, 1 ); |
|
187 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
188 | - add_action( 'loop_end', array( 'EED_Event_Single', 'loop_end' )); |
|
185 | + add_action('loop_start', array('EED_Event_Single', 'loop_start')); |
|
186 | + add_filter('get_the_excerpt', array('EED_Event_Single', 'get_the_excerpt'), 1, 1); |
|
187 | + add_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
188 | + add_action('loop_end', array('EED_Event_Single', 'loop_end')); |
|
189 | 189 | // don't display entry meta because the existing theme will take car of that |
190 | - add_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
190 | + add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
191 | 191 | } |
192 | 192 | return $template; |
193 | 193 | } |
@@ -201,9 +201,9 @@ discard block |
||
201 | 201 | * @param array $wp_query_array an array containing the WP_Query object |
202 | 202 | * @return void |
203 | 203 | */ |
204 | - public static function loop_start( $wp_query_array ) { |
|
204 | + public static function loop_start($wp_query_array) { |
|
205 | 205 | global $post; |
206 | - do_action( 'AHEE_event_details_before_post', $post, $wp_query_array ); |
|
206 | + do_action('AHEE_event_details_before_post', $post, $wp_query_array); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | |
@@ -216,9 +216,9 @@ discard block |
||
216 | 216 | * @param int $id |
217 | 217 | * @return string |
218 | 218 | */ |
219 | - public static function the_title( $title = '', $id = 0 ) { |
|
219 | + public static function the_title($title = '', $id = 0) { |
|
220 | 220 | global $post; |
221 | - return in_the_loop() && $post->ID == $id ? espresso_event_status_banner( $post->ID ) . $title : $title; |
|
221 | + return in_the_loop() && $post->ID == $id ? espresso_event_status_banner($post->ID).$title : $title; |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | |
@@ -230,9 +230,9 @@ discard block |
||
230 | 230 | * @param string $excerpt |
231 | 231 | * @return string |
232 | 232 | */ |
233 | - public static function get_the_excerpt( $excerpt = '' ) { |
|
233 | + public static function get_the_excerpt($excerpt = '') { |
|
234 | 234 | EED_Event_Single::$using_get_the_excerpt = true; |
235 | - add_filter( 'wp_trim_excerpt', array( 'EED_Event_Single', 'end_get_the_excerpt' ), 999, 1 ); |
|
235 | + add_filter('wp_trim_excerpt', array('EED_Event_Single', 'end_get_the_excerpt'), 999, 1); |
|
236 | 236 | return $excerpt; |
237 | 237 | } |
238 | 238 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @param string $text |
246 | 246 | * @return string |
247 | 247 | */ |
248 | - public static function end_get_the_excerpt( $text = '' ) { |
|
248 | + public static function end_get_the_excerpt($text = '') { |
|
249 | 249 | EED_Event_Single::$using_get_the_excerpt = false; |
250 | 250 | return $text; |
251 | 251 | } |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * @param string $content |
260 | 260 | * @return string |
261 | 261 | */ |
262 | - public static function event_details( $content ) { |
|
262 | + public static function event_details($content) { |
|
263 | 263 | global $post; |
264 | 264 | static $current_post_ID = 0; |
265 | 265 | if ( |
@@ -274,15 +274,15 @@ discard block |
||
274 | 274 | // We want to allow those plugins to still do their thing and have access to our content, but depending on |
275 | 275 | // how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice, |
276 | 276 | // so the following allows this filter to be applied multiple times, but only once for real |
277 | - $current_post_ID = did_action( 'loop_start' ) ? $post->ID : 0; |
|
278 | - if ( EE_Registry::instance()->CFG->template_settings->EED_Event_Single->use_sortable_display_order ) { |
|
277 | + $current_post_ID = did_action('loop_start') ? $post->ID : 0; |
|
278 | + if (EE_Registry::instance()->CFG->template_settings->EED_Event_Single->use_sortable_display_order) { |
|
279 | 279 | // we need to first remove this callback from being applied to the_content() |
280 | 280 | // (otherwise it will recurse and blow up the interweb) |
281 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
281 | + remove_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
282 | 282 | EED_Event_Single::instance()->template_parts = EED_Event_Single::instance()->initialize_template_parts(); |
283 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
284 | - $content = EED_Event_Single::instance()->template_parts->apply_template_part_filters( $content ); |
|
285 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
283 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
284 | + $content = EED_Event_Single::instance()->template_parts->apply_template_part_filters($content); |
|
285 | + add_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
286 | 286 | } else { |
287 | 287 | $content = EED_Event_Single::use_filterable_display_order(); |
288 | 288 | } |
@@ -303,19 +303,19 @@ discard block |
||
303 | 303 | // it uses the_content() for displaying the $post->post_content |
304 | 304 | // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
305 | 305 | // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
306 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
306 | + remove_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
307 | 307 | //now add additional content |
308 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_datetimes' ), 110, 1 ); |
|
309 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_tickets' ), 120, 1 ); |
|
310 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_venues' ), 130, 1 ); |
|
311 | - do_action( 'AHEE__EED_Event_Single__use_filterable_display_order__after_add_filters' ); |
|
308 | + add_filter('the_content', array('EED_Event_Single', 'event_datetimes'), 110, 1); |
|
309 | + add_filter('the_content', array('EED_Event_Single', 'event_tickets'), 120, 1); |
|
310 | + add_filter('the_content', array('EED_Event_Single', 'event_venues'), 130, 1); |
|
311 | + do_action('AHEE__EED_Event_Single__use_filterable_display_order__after_add_filters'); |
|
312 | 312 | // now load our template |
313 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
313 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
314 | 314 | //now add our filter back in, plus some others |
315 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
316 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_datetimes' ), 110 ); |
|
317 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_tickets' ), 120 ); |
|
318 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_venues' ), 130 ); |
|
315 | + add_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
316 | + remove_filter('the_content', array('EED_Event_Single', 'event_datetimes'), 110); |
|
317 | + remove_filter('the_content', array('EED_Event_Single', 'event_tickets'), 120); |
|
318 | + remove_filter('the_content', array('EED_Event_Single', 'event_venues'), 130); |
|
319 | 319 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
320 | 320 | return $content; |
321 | 321 | } |
@@ -329,8 +329,8 @@ discard block |
||
329 | 329 | * @param string $content |
330 | 330 | * @return string |
331 | 331 | */ |
332 | - public static function event_datetimes( $content ) { |
|
333 | - return EEH_Template::locate_template( 'content-espresso_events-datetimes.php' ) . $content; |
|
332 | + public static function event_datetimes($content) { |
|
333 | + return EEH_Template::locate_template('content-espresso_events-datetimes.php').$content; |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | |
@@ -342,8 +342,8 @@ discard block |
||
342 | 342 | * @param string $content |
343 | 343 | * @return string |
344 | 344 | */ |
345 | - public static function event_tickets( $content ) { |
|
346 | - return EEH_Template::locate_template( 'content-espresso_events-tickets.php' ) . $content; |
|
345 | + public static function event_tickets($content) { |
|
346 | + return EEH_Template::locate_template('content-espresso_events-tickets.php').$content; |
|
347 | 347 | } |
348 | 348 | |
349 | 349 | |
@@ -355,8 +355,8 @@ discard block |
||
355 | 355 | * @param string $content |
356 | 356 | * @return string |
357 | 357 | */ |
358 | - public static function event_venue( $content ) { |
|
359 | - return EED_Event_Single::event_venues( $content ); |
|
358 | + public static function event_venue($content) { |
|
359 | + return EED_Event_Single::event_venues($content); |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | |
@@ -368,8 +368,8 @@ discard block |
||
368 | 368 | * @param string $content |
369 | 369 | * @return string |
370 | 370 | */ |
371 | - public static function event_venues( $content ) { |
|
372 | - return $content . EEH_Template::locate_template( 'content-espresso_events-venues.php' ); |
|
371 | + public static function event_venues($content) { |
|
372 | + return $content.EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | |
@@ -381,9 +381,9 @@ discard block |
||
381 | 381 | * @param array $wp_query_array an array containing the WP_Query object |
382 | 382 | * @return void |
383 | 383 | */ |
384 | - public static function loop_end( $wp_query_array ) { |
|
384 | + public static function loop_end($wp_query_array) { |
|
385 | 385 | global $post; |
386 | - do_action( 'AHEE_event_details_after_post', $post, $wp_query_array ); |
|
386 | + do_action('AHEE_event_details_after_post', $post, $wp_query_array); |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | |
@@ -396,18 +396,18 @@ discard block |
||
396 | 396 | */ |
397 | 397 | public function wp_enqueue_scripts() { |
398 | 398 | // get some style |
399 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && apply_filters( 'FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', TRUE )) { |
|
400 | - EE_Registry::instance()->load_helper( 'File' ); |
|
399 | + if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && apply_filters('FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', TRUE)) { |
|
400 | + EE_Registry::instance()->load_helper('File'); |
|
401 | 401 | // first check uploads folder |
402 | - if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
403 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' )); |
|
402 | + if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
403 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
404 | 404 | } else { |
405 | - wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' )); |
|
405 | + wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
406 | 406 | } |
407 | - wp_enqueue_script( $this->theme ); |
|
408 | - if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) { |
|
409 | - EE_Registry::instance()->load_helper( 'Maps' ); |
|
410 | - add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 ); |
|
407 | + wp_enqueue_script($this->theme); |
|
408 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
409 | + EE_Registry::instance()->load_helper('Maps'); |
|
410 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
411 | 411 | } |
412 | 412 | } |
413 | 413 | } |
@@ -426,12 +426,12 @@ discard block |
||
426 | 426 | * @return bool |
427 | 427 | */ |
428 | 428 | public static function display_venue() { |
429 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
429 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
430 | 430 | /** @type EE_Event_Single_Config $config */ |
431 | 431 | $config = EED_Event_Single::instance()->config(); |
432 | - $display_venue= isset( $config->display_venue ) ? $config->display_venue : TRUE; |
|
432 | + $display_venue = isset($config->display_venue) ? $config->display_venue : TRUE; |
|
433 | 433 | $venue_name = EEH_Venue_View::venue_name(); |
434 | - return $display_venue && ! empty( $venue_name ) ? TRUE : FALSE; |
|
434 | + return $display_venue && ! empty($venue_name) ? TRUE : FALSE; |
|
435 | 435 | } |
436 | 436 | |
437 | 437 |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @return EED_Events_Archive |
44 | 44 | */ |
45 | 45 | public static function instance() { |
46 | - return parent::get_instance( __CLASS__ ); |
|
46 | + return parent::get_instance(__CLASS__); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | * @return void |
56 | 56 | */ |
57 | 57 | public static function set_hooks() { |
58 | - EE_Config::register_route( EE_Registry::instance()->CFG->core->event_cpt_slug, 'Events_Archive', 'run' ); |
|
59 | - EE_Config::register_route( 'event_list', 'Events_Archive', 'event_list' ); |
|
60 | - add_action( 'wp_loaded', array( 'EED_Events_Archive', 'set_definitions' ), 2 ); |
|
58 | + EE_Config::register_route(EE_Registry::instance()->CFG->core->event_cpt_slug, 'Events_Archive', 'run'); |
|
59 | + EE_Config::register_route('event_list', 'Events_Archive', 'event_list'); |
|
60 | + add_action('wp_loaded', array('EED_Events_Archive', 'set_definitions'), 2); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @return void |
68 | 68 | */ |
69 | 69 | public static function set_hooks_admin() { |
70 | - add_action( 'wp_loaded', array( 'EED_Events_Archive', 'set_definitions' ), 2 ); |
|
70 | + add_action('wp_loaded', array('EED_Events_Archive', 'set_definitions'), 2); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | * @return void |
81 | 81 | */ |
82 | 82 | public static function set_definitions() { |
83 | - define( 'EVENTS_ARCHIVE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
84 | - define( 'EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
83 | + define('EVENTS_ARCHIVE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
84 | + define('EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @return \EE_Events_Archive_Config |
93 | 93 | */ |
94 | - protected function set_config(){ |
|
95 | - $this->set_config_section( 'template_settings' ); |
|
96 | - $this->set_config_class( 'EE_Events_Archive_Config' ); |
|
97 | - $this->set_config_name( 'EED_Events_Archive' ); |
|
94 | + protected function set_config() { |
|
95 | + $this->set_config_section('template_settings'); |
|
96 | + $this->set_config_class('EE_Events_Archive_Config'); |
|
97 | + $this->set_config_name('EED_Events_Archive'); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
@@ -106,35 +106,35 @@ discard block |
||
106 | 106 | * @param \EE_Events_Archive_Config $config |
107 | 107 | * @return \EE_Template_Part_Manager |
108 | 108 | */ |
109 | - public function initialize_template_parts( EE_Events_Archive_Config $config = null ) { |
|
109 | + public function initialize_template_parts(EE_Events_Archive_Config $config = null) { |
|
110 | 110 | $config = $config instanceof EE_Events_Archive_Config ? $config : $this->config(); |
111 | 111 | EEH_Autoloader::instance()->register_template_part_autoloaders(); |
112 | 112 | $template_parts = new EE_Template_Part_Manager(); |
113 | 113 | $template_parts->add_template_part( |
114 | 114 | 'tickets', |
115 | - __( 'Ticket Selector', 'event_espresso' ), |
|
115 | + __('Ticket Selector', 'event_espresso'), |
|
116 | 116 | 'content-espresso_events-tickets.php', |
117 | 117 | $config->display_order_tickets |
118 | 118 | ); |
119 | 119 | $template_parts->add_template_part( |
120 | 120 | 'datetimes', |
121 | - __( 'Dates and Times', 'event_espresso' ), |
|
121 | + __('Dates and Times', 'event_espresso'), |
|
122 | 122 | 'content-espresso_events-datetimes.php', |
123 | 123 | $config->display_order_datetimes |
124 | 124 | ); |
125 | 125 | $template_parts->add_template_part( |
126 | 126 | 'event', |
127 | - __( 'Event Description', 'event_espresso' ), |
|
127 | + __('Event Description', 'event_espresso'), |
|
128 | 128 | 'content-espresso_events-details.php', |
129 | 129 | $config->display_order_event |
130 | 130 | ); |
131 | 131 | $template_parts->add_template_part( |
132 | 132 | 'venue', |
133 | - __( 'Venue Information', 'event_espresso' ), |
|
133 | + __('Venue Information', 'event_espresso'), |
|
134 | 134 | 'content-espresso_events-venues.php', |
135 | 135 | $config->display_order_venue |
136 | 136 | ); |
137 | - do_action( 'AHEE__EED_Event_Archive__initialize_template_parts', $template_parts ); |
|
137 | + do_action('AHEE__EED_Event_Archive__initialize_template_parts', $template_parts); |
|
138 | 138 | return $template_parts; |
139 | 139 | } |
140 | 140 | |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | * @param WP $WP |
148 | 148 | * @return void |
149 | 149 | */ |
150 | - public function run( $WP ) { |
|
151 | - do_action( 'AHEE__EED_Events_Archive__before_run' ); |
|
150 | + public function run($WP) { |
|
151 | + do_action('AHEE__EED_Events_Archive__before_run'); |
|
152 | 152 | // ensure valid EE_Events_Archive_Config() object exists |
153 | 153 | $this->set_config(); |
154 | 154 | /** @type EE_Events_Archive_Config $config */ |
@@ -156,19 +156,19 @@ discard block |
||
156 | 156 | // load other required components |
157 | 157 | $this->load_event_list_assets(); |
158 | 158 | // filter the WP posts_join, posts_where, and posts_orderby SQL clauses |
159 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
159 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
160 | 160 | //add query filters |
161 | 161 | EEH_Event_Query::add_query_filters(); |
162 | 162 | // set params that will get used by the filters |
163 | 163 | EEH_Event_Query::set_query_params( |
164 | - '', // month |
|
165 | - '', // category |
|
166 | - $config->display_expired_events, // show_expired |
|
167 | - 'start_date', // orderby |
|
164 | + '', // month |
|
165 | + '', // category |
|
166 | + $config->display_expired_events, // show_expired |
|
167 | + 'start_date', // orderby |
|
168 | 168 | 'ASC' // sort |
169 | 169 | ); |
170 | 170 | // check what template is loaded |
171 | - add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
|
171 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | |
@@ -200,32 +200,32 @@ discard block |
||
200 | 200 | * @param string $template |
201 | 201 | * @return string |
202 | 202 | */ |
203 | - public function template_include( $template = '' ) { |
|
203 | + public function template_include($template = '') { |
|
204 | 204 | // don't add content filter for dedicated EE child themes or private posts |
205 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
206 | - if ( ! EEH_Template::is_espresso_theme() ) { |
|
205 | + EE_Registry::instance()->load_helper('Template'); |
|
206 | + if ( ! EEH_Template::is_espresso_theme()) { |
|
207 | 207 | /** @type EE_Events_Archive_Config $config */ |
208 | 208 | $config = $this->config(); |
209 | 209 | // add status banner ? |
210 | - if ( $config->display_status_banner ) { |
|
211 | - add_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 100, 2 ); |
|
210 | + if ($config->display_status_banner) { |
|
211 | + add_filter('the_title', array('EED_Events_Archive', 'the_title'), 100, 2); |
|
212 | 212 | } |
213 | 213 | // if NOT a custom template |
214 | - if ( EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_events.php' |
|
215 | - || apply_filters( 'FHEE__EED_Event_Archive__template_include__allow_custom_selected_template', FALSE ) |
|
214 | + if (EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_events.php' |
|
215 | + || apply_filters('FHEE__EED_Event_Archive__template_include__allow_custom_selected_template', FALSE) |
|
216 | 216 | ) { |
217 | 217 | // don't display entry meta because the existing theme will take care of that |
218 | - add_filter( 'FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true' ); |
|
218 | + add_filter('FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true'); |
|
219 | 219 | // load functions.php file for the theme (loaded by WP if using child theme) |
220 | 220 | EEH_Template::load_espresso_theme_functions(); |
221 | 221 | // because we don't know if the theme is using the_excerpt() |
222 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
222 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
223 | 223 | // or the_content |
224 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
224 | + add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
225 | 225 | // and just in case they are running get_the_excerpt() which DESTROYS things |
226 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
226 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
227 | 227 | // don't display entry meta because the existing theme will take care of that |
228 | - add_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
228 | + add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | return $template; |
@@ -240,17 +240,17 @@ discard block |
||
240 | 240 | * @param string $excerpt |
241 | 241 | * @return string |
242 | 242 | */ |
243 | - public static function get_the_excerpt( $excerpt = '' ) { |
|
244 | - if ( post_password_required() ) { |
|
243 | + public static function get_the_excerpt($excerpt = '') { |
|
244 | + if (post_password_required()) { |
|
245 | 245 | return $excerpt; |
246 | 246 | } |
247 | - if ( apply_filters( 'FHEE__EED_Events_Archive__get_the_excerpt__theme_uses_get_the_excerpt', false ) ) { |
|
248 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
249 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
250 | - $excerpt = EED_Events_Archive::event_details( $excerpt ); |
|
247 | + if (apply_filters('FHEE__EED_Events_Archive__get_the_excerpt__theme_uses_get_the_excerpt', false)) { |
|
248 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100); |
|
249 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100); |
|
250 | + $excerpt = EED_Events_Archive::event_details($excerpt); |
|
251 | 251 | } else { |
252 | 252 | EED_Events_Archive::$using_get_the_excerpt = true; |
253 | - add_filter( 'wp_trim_excerpt', array( 'EED_Events_Archive', 'end_get_the_excerpt' ), 999, 1 ); |
|
253 | + add_filter('wp_trim_excerpt', array('EED_Events_Archive', 'end_get_the_excerpt'), 999, 1); |
|
254 | 254 | } |
255 | 255 | return $excerpt; |
256 | 256 | } |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | * @param string $text |
265 | 265 | * @return string |
266 | 266 | */ |
267 | - public static function end_get_the_excerpt( $text = '' ) { |
|
267 | + public static function end_get_the_excerpt($text = '') { |
|
268 | 268 | EED_Events_Archive::$using_get_the_excerpt = false; |
269 | 269 | return $text; |
270 | 270 | } |
@@ -279,10 +279,10 @@ discard block |
||
279 | 279 | * @param string $id |
280 | 280 | * @return string |
281 | 281 | */ |
282 | - public static function the_title( $title = '', $id = '' ) { |
|
282 | + public static function the_title($title = '', $id = '') { |
|
283 | 283 | global $post; |
284 | - if ( $post instanceof WP_Post ) { |
|
285 | - return in_the_loop() && $post->ID == $id ? espresso_event_status_banner( $post->ID ) . $title : $title; |
|
284 | + if ($post instanceof WP_Post) { |
|
285 | + return in_the_loop() && $post->ID == $id ? espresso_event_status_banner($post->ID).$title : $title; |
|
286 | 286 | } |
287 | 287 | return $title; |
288 | 288 | } |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | * @param string $content |
297 | 297 | * @return string |
298 | 298 | */ |
299 | - public static function event_details( $content ) { |
|
299 | + public static function event_details($content) { |
|
300 | 300 | global $post; |
301 | 301 | static $current_post_ID = 0; |
302 | 302 | if ( |
@@ -305,8 +305,8 @@ discard block |
||
305 | 305 | && ! EED_Events_Archive::$using_get_the_excerpt |
306 | 306 | && ! post_password_required() |
307 | 307 | && ( |
308 | - apply_filters( 'FHEE__EES_Espresso_Events__process_shortcode__true', false ) |
|
309 | - || ! apply_filters( 'FHEE__content_espresso_events__template_loaded', false ) |
|
308 | + apply_filters('FHEE__EES_Espresso_Events__process_shortcode__true', false) |
|
309 | + || ! apply_filters('FHEE__content_espresso_events__template_loaded', false) |
|
310 | 310 | ) |
311 | 311 | ) { |
312 | 312 | // Set current post ID to prevent showing content twice, but only if headers have definitely been sent. |
@@ -315,8 +315,8 @@ discard block |
||
315 | 315 | // We want to allow those plugins to still do their thing and have access to our content, but depending on |
316 | 316 | // how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice, |
317 | 317 | // so the following allows this filter to be applied multiple times, but only once for real |
318 | - $current_post_ID = did_action( 'loop_start' ) ? $post->ID : 0; |
|
319 | - if ( EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->use_sortable_display_order ) { |
|
318 | + $current_post_ID = did_action('loop_start') ? $post->ID : 0; |
|
319 | + if (EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->use_sortable_display_order) { |
|
320 | 320 | $content = \EED_Events_Archive::use_sortable_display_order(); |
321 | 321 | } else { |
322 | 322 | $content = \EED_Events_Archive::use_filterable_display_order(); |
@@ -335,20 +335,20 @@ discard block |
||
335 | 335 | */ |
336 | 336 | protected static function use_sortable_display_order() { |
337 | 337 | // no further password checks required atm |
338 | - add_filter( 'FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true' ); |
|
338 | + add_filter('FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true'); |
|
339 | 339 | // we need to first remove this callback from being applied to the_content() or the_excerpt() (otherwise it will recurse and blow up the interweb) |
340 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
341 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
342 | - remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 ); |
|
340 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100); |
|
341 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100); |
|
342 | + remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1); |
|
343 | 343 | // now add additional content depending on whether event is using the_excerpt() or the_content() |
344 | 344 | EED_Events_Archive::instance()->template_parts = EED_Events_Archive::instance()->initialize_template_parts(); |
345 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
346 | - $content = EED_Events_Archive::instance()->template_parts->apply_template_part_filters( $content ); |
|
345 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
346 | + $content = EED_Events_Archive::instance()->template_parts->apply_template_part_filters($content); |
|
347 | 347 | // re-add our main filters (or else the next event won't have them) |
348 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
349 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
350 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
351 | - remove_filter( 'FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true' ); |
|
348 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
349 | + add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
350 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
351 | + remove_filter('FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true'); |
|
352 | 352 | return $content; |
353 | 353 | } |
354 | 354 | |
@@ -363,22 +363,22 @@ discard block |
||
363 | 363 | protected static function use_filterable_display_order() { |
364 | 364 | // we need to first remove this callback from being applied to the_content() |
365 | 365 | // (otherwise it will recurse and blow up the interweb) |
366 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
367 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
368 | - remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 ); |
|
366 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100); |
|
367 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100); |
|
368 | + remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1); |
|
369 | 369 | //now add additional content depending on whether event is using the_excerpt() or the_content() |
370 | 370 | EED_Events_Archive::_add_additional_excerpt_filters(); |
371 | 371 | EED_Events_Archive::_add_additional_content_filters(); |
372 | - do_action( 'AHEE__EED_Events_Archive__use_filterable_display_order__after_add_filters' ); |
|
372 | + do_action('AHEE__EED_Events_Archive__use_filterable_display_order__after_add_filters'); |
|
373 | 373 | // now load our template |
374 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
374 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
375 | 375 | // re-add our main filters (or else the next event won't have them) |
376 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
377 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
378 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
376 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
377 | + add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
378 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
379 | 379 | // but remove the other filters so that they don't get applied to the next post |
380 | 380 | EED_Events_Archive::_remove_additional_events_archive_filters(); |
381 | - do_action( 'AHEE__EED_Events_Archive__use_filterable_display_order__after_remove_filters' ); |
|
381 | + do_action('AHEE__EED_Events_Archive__use_filterable_display_order__after_remove_filters'); |
|
382 | 382 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
383 | 383 | //return ! empty( $template ) ? $template : $content; |
384 | 384 | return $content; |
@@ -393,11 +393,11 @@ discard block |
||
393 | 393 | * @param string $content |
394 | 394 | * @return string |
395 | 395 | */ |
396 | - public static function event_datetimes( $content ) { |
|
397 | - if ( post_password_required() ) { |
|
396 | + public static function event_datetimes($content) { |
|
397 | + if (post_password_required()) { |
|
398 | 398 | return $content; |
399 | 399 | } |
400 | - return EEH_Template::locate_template( 'content-espresso_events-datetimes.php' ) . $content; |
|
400 | + return EEH_Template::locate_template('content-espresso_events-datetimes.php').$content; |
|
401 | 401 | } |
402 | 402 | |
403 | 403 | /** |
@@ -407,11 +407,11 @@ discard block |
||
407 | 407 | * @param string $content |
408 | 408 | * @return string |
409 | 409 | */ |
410 | - public static function event_tickets( $content ) { |
|
411 | - if ( post_password_required() ) { |
|
410 | + public static function event_tickets($content) { |
|
411 | + if (post_password_required()) { |
|
412 | 412 | return $content; |
413 | 413 | } |
414 | - return EEH_Template::locate_template( 'content-espresso_events-tickets.php' ) . $content; |
|
414 | + return EEH_Template::locate_template('content-espresso_events-tickets.php').$content; |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | |
@@ -423,8 +423,8 @@ discard block |
||
423 | 423 | * @param string $content |
424 | 424 | * @return string |
425 | 425 | */ |
426 | - public static function event_venue( $content ) { |
|
427 | - return EED_Events_Archive::event_venues( $content ); |
|
426 | + public static function event_venue($content) { |
|
427 | + return EED_Events_Archive::event_venues($content); |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | /** |
@@ -434,11 +434,11 @@ discard block |
||
434 | 434 | * @param string $content |
435 | 435 | * @return string |
436 | 436 | */ |
437 | - public static function event_venues( $content ) { |
|
438 | - if ( post_password_required() ) { |
|
437 | + public static function event_venues($content) { |
|
438 | + if (post_password_required()) { |
|
439 | 439 | return $content; |
440 | 440 | } |
441 | - return $content . EEH_Template::locate_template( 'content-espresso_events-venues.php' ); |
|
441 | + return $content.EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | |
@@ -450,9 +450,9 @@ discard block |
||
450 | 450 | * @return void |
451 | 451 | */ |
452 | 452 | private static function _add_additional_excerpt_filters() { |
453 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
454 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
455 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
453 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
454 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
455 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | |
@@ -464,9 +464,9 @@ discard block |
||
464 | 464 | * @return void |
465 | 465 | */ |
466 | 466 | private static function _add_additional_content_filters() { |
467 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
468 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
469 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
467 | + add_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
468 | + add_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
469 | + add_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
470 | 470 | } |
471 | 471 | |
472 | 472 | |
@@ -478,12 +478,12 @@ discard block |
||
478 | 478 | * @return void |
479 | 479 | */ |
480 | 480 | private static function _remove_additional_events_archive_filters() { |
481 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110 ); |
|
482 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120 ); |
|
483 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130 ); |
|
484 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110 ); |
|
485 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120 ); |
|
486 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130 ); |
|
481 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110); |
|
482 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120); |
|
483 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130); |
|
484 | + remove_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110); |
|
485 | + remove_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120); |
|
486 | + remove_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130); |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | |
@@ -496,17 +496,17 @@ discard block |
||
496 | 496 | */ |
497 | 497 | public static function remove_all_events_archive_filters() { |
498 | 498 | //remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 ); |
499 | - remove_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 100 ); |
|
500 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
501 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110 ); |
|
502 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120 ); |
|
503 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130 ); |
|
504 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
505 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110 ); |
|
506 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120 ); |
|
507 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130 ); |
|
499 | + remove_filter('the_title', array('EED_Events_Archive', 'the_title'), 100); |
|
500 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100); |
|
501 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110); |
|
502 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120); |
|
503 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130); |
|
504 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100); |
|
505 | + remove_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110); |
|
506 | + remove_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120); |
|
507 | + remove_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130); |
|
508 | 508 | // don't display entry meta because the existing theme will take care of that |
509 | - remove_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
509 | + remove_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | |
@@ -521,15 +521,15 @@ discard block |
||
521 | 521 | * @return void |
522 | 522 | */ |
523 | 523 | public function load_event_list_assets() { |
524 | - do_action( 'AHEE__EED_Events_Archive__before_load_assets' ); |
|
525 | - add_filter( 'FHEE_load_EE_Session', '__return_true' ); |
|
526 | - add_filter( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
527 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
528 | - if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) { |
|
529 | - EE_Registry::instance()->load_helper( 'Maps' ); |
|
530 | - add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 ); |
|
524 | + do_action('AHEE__EED_Events_Archive__before_load_assets'); |
|
525 | + add_filter('FHEE_load_EE_Session', '__return_true'); |
|
526 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
527 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
528 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
529 | + EE_Registry::instance()->load_helper('Maps'); |
|
530 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
531 | 531 | } |
532 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
532 | + EE_Registry::instance()->load_helper('Event_View'); |
|
533 | 533 | } |
534 | 534 | |
535 | 535 | |
@@ -545,14 +545,14 @@ discard block |
||
545 | 545 | */ |
546 | 546 | public function wp_enqueue_scripts() { |
547 | 547 | // get some style |
548 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', FALSE ) ) { |
|
548 | + if (apply_filters('FHEE_enable_default_espresso_css', FALSE)) { |
|
549 | 549 | // first check uploads folder |
550 | - EE_Registry::instance()->load_helper( 'File' ); |
|
551 | - if ( EEH_File::is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
552 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' )); |
|
550 | + EE_Registry::instance()->load_helper('File'); |
|
551 | + if (EEH_File::is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
552 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
553 | 553 | } else { |
554 | 554 | } |
555 | - wp_enqueue_style( $this->theme ); |
|
555 | + wp_enqueue_style($this->theme); |
|
556 | 556 | |
557 | 557 | } |
558 | 558 | } |
@@ -570,8 +570,8 @@ discard block |
||
570 | 570 | */ |
571 | 571 | public static function template_settings_form() { |
572 | 572 | $template_settings = EE_Registry::instance()->CFG->template_settings; |
573 | - $template_settings->EED_Events_Archive = isset( $template_settings->EED_Events_Archive ) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
574 | - $template_settings->EED_Events_Archive = apply_filters( 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive ); |
|
573 | + $template_settings->EED_Events_Archive = isset($template_settings->EED_Events_Archive) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
574 | + $template_settings->EED_Events_Archive = apply_filters('FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive); |
|
575 | 575 | $events_archive_settings = array( |
576 | 576 | 'display_status_banner' => 0, |
577 | 577 | 'display_description' => 1, |
@@ -580,8 +580,8 @@ discard block |
||
580 | 580 | 'display_venue' => 0, |
581 | 581 | 'display_expired_events' => 0 |
582 | 582 | ); |
583 | - $events_archive_settings = array_merge( $events_archive_settings, (array)$template_settings->EED_Events_Archive ); |
|
584 | - EEH_Template::display_template( EVENTS_ARCHIVE_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $events_archive_settings ); |
|
583 | + $events_archive_settings = array_merge($events_archive_settings, (array) $template_settings->EED_Events_Archive); |
|
584 | + EEH_Template::display_template(EVENTS_ARCHIVE_TEMPLATES_PATH.'admin-event-list-settings.template.php', $events_archive_settings); |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | |
@@ -597,16 +597,16 @@ discard block |
||
597 | 597 | * @param EE_Request_Handler $REQ |
598 | 598 | * @return EE_Template_Config |
599 | 599 | */ |
600 | - public static function update_template_settings( $CFG, $REQ ) { |
|
600 | + public static function update_template_settings($CFG, $REQ) { |
|
601 | 601 | $CFG->EED_Events_Archive = new EE_Events_Archive_Config(); |
602 | 602 | // unless we are resetting the config... |
603 | - if ( ! isset( $REQ['EED_Events_Archive_reset_event_list_settings'] ) || absint( $REQ['EED_Events_Archive_reset_event_list_settings'] ) !== 1 ) { |
|
604 | - $CFG->EED_Events_Archive->display_status_banner = isset( $REQ['EED_Events_Archive_display_status_banner'] ) ? absint( $REQ['EED_Events_Archive_display_status_banner'] ) : 0; |
|
605 | - $CFG->EED_Events_Archive->display_description = isset( $REQ['EED_Events_Archive_display_description'] ) ? absint( $REQ['EED_Events_Archive_display_description'] ) : 1; |
|
606 | - $CFG->EED_Events_Archive->display_ticket_selector = isset( $REQ['EED_Events_Archive_display_ticket_selector'] ) ? absint( $REQ['EED_Events_Archive_display_ticket_selector'] ) : 0; |
|
607 | - $CFG->EED_Events_Archive->display_datetimes = isset( $REQ['EED_Events_Archive_display_datetimes'] ) ? absint( $REQ['EED_Events_Archive_display_datetimes'] ) : 1; |
|
608 | - $CFG->EED_Events_Archive->display_venue = isset( $REQ['EED_Events_Archive_display_venue'] ) ? absint( $REQ['EED_Events_Archive_display_venue'] ) : 0; |
|
609 | - $CFG->EED_Events_Archive->display_expired_events = isset( $REQ['EED_Events_Archive_display_expired_events'] ) ? absint( $REQ['EED_Events_Archive_display_expired_events'] ) : 0; } |
|
603 | + if ( ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1) { |
|
604 | + $CFG->EED_Events_Archive->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0; |
|
605 | + $CFG->EED_Events_Archive->display_description = isset($REQ['EED_Events_Archive_display_description']) ? absint($REQ['EED_Events_Archive_display_description']) : 1; |
|
606 | + $CFG->EED_Events_Archive->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0; |
|
607 | + $CFG->EED_Events_Archive->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint($REQ['EED_Events_Archive_display_datetimes']) : 1; |
|
608 | + $CFG->EED_Events_Archive->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint($REQ['EED_Events_Archive_display_venue']) : 0; |
|
609 | + $CFG->EED_Events_Archive->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0; } |
|
610 | 610 | return $CFG; |
611 | 611 | } |
612 | 612 | |
@@ -619,10 +619,10 @@ discard block |
||
619 | 619 | * @param string $extra_class |
620 | 620 | * @return string |
621 | 621 | */ |
622 | - public static function event_list_css( $extra_class = '' ) { |
|
623 | - $event_list_css = ! empty( $extra_class ) ? array( $extra_class ) : array(); |
|
622 | + public static function event_list_css($extra_class = '') { |
|
623 | + $event_list_css = ! empty($extra_class) ? array($extra_class) : array(); |
|
624 | 624 | $event_list_css[] = 'espresso-event-list-event'; |
625 | - return implode( ' ', $event_list_css ); |
|
625 | + return implode(' ', $event_list_css); |
|
626 | 626 | } |
627 | 627 | |
628 | 628 | |
@@ -649,9 +649,9 @@ discard block |
||
649 | 649 | * @param $value |
650 | 650 | * @return bool |
651 | 651 | */ |
652 | - public static function display_description( $value ) { |
|
652 | + public static function display_description($value) { |
|
653 | 653 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
654 | - $display_description= isset( $config->display_description ) ? $config->display_description : 1; |
|
654 | + $display_description = isset($config->display_description) ? $config->display_description : 1; |
|
655 | 655 | return $display_description === $value ? TRUE : FALSE; |
656 | 656 | } |
657 | 657 | |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | */ |
665 | 665 | public static function display_ticket_selector() { |
666 | 666 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
667 | - return isset( $config->display_ticket_selector ) && $config->display_ticket_selector ? TRUE : FALSE; |
|
667 | + return isset($config->display_ticket_selector) && $config->display_ticket_selector ? TRUE : FALSE; |
|
668 | 668 | } |
669 | 669 | |
670 | 670 | |
@@ -676,9 +676,9 @@ discard block |
||
676 | 676 | * @return bool |
677 | 677 | */ |
678 | 678 | public static function display_venue() { |
679 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
679 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
680 | 680 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
681 | - return isset( $config->display_venue ) && $config->display_venue && EEH_Venue_View::venue_name() ? TRUE : FALSE; |
|
681 | + return isset($config->display_venue) && $config->display_venue && EEH_Venue_View::venue_name() ? TRUE : FALSE; |
|
682 | 682 | } |
683 | 683 | |
684 | 684 | |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | */ |
691 | 691 | public static function display_datetimes() { |
692 | 692 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
693 | - return isset( $config->display_datetimes ) && $config->display_datetimes ? TRUE : FALSE; |
|
693 | + return isset($config->display_datetimes) && $config->display_datetimes ? TRUE : FALSE; |
|
694 | 694 | } |
695 | 695 | |
696 | 696 | |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | * @return string |
706 | 706 | */ |
707 | 707 | public static function event_list_title() { |
708 | - return apply_filters( 'FHEE__archive_espresso_events_template__upcoming_events_h1', __( 'Upcoming Events', 'event_espresso' )); |
|
708 | + return apply_filters('FHEE__archive_espresso_events_template__upcoming_events_h1', __('Upcoming Events', 'event_espresso')); |
|
709 | 709 | } |
710 | 710 | |
711 | 711 | |
@@ -714,11 +714,11 @@ discard block |
||
714 | 714 | /** |
715 | 715 | * @since 4.4.0 |
716 | 716 | */ |
717 | - public static function _doing_it_wrong_notice( $function = '' ) { |
|
717 | + public static function _doing_it_wrong_notice($function = '') { |
|
718 | 718 | EE_Error::doing_it_wrong( |
719 | 719 | __FUNCTION__, |
720 | 720 | sprintf( |
721 | - __( 'EED_Events_Archive::%1$s was moved to EEH_Event_Query::%1$s:%2$sPlease update your existing code because the method it calls will be removed in version %3$s', 'event_espresso' ), |
|
721 | + __('EED_Events_Archive::%1$s was moved to EEH_Event_Query::%1$s:%2$sPlease update your existing code because the method it calls will be removed in version %3$s', 'event_espresso'), |
|
722 | 722 | $function, |
723 | 723 | '<br />', |
724 | 724 | '4.6.0' |
@@ -734,107 +734,107 @@ discard block |
||
734 | 734 | * @since 4.4.0 |
735 | 735 | */ |
736 | 736 | public function get_post_data() { |
737 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
737 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
738 | 738 | EEH_Event_Query::set_query_params(); |
739 | 739 | } |
740 | 740 | /** |
741 | 741 | * @deprecated |
742 | 742 | * @since 4.4.0 |
743 | 743 | */ |
744 | - public function posts_fields( $SQL, WP_Query $wp_query ) { |
|
745 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
746 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
747 | - return EEH_Event_Query::posts_fields( $SQL, $wp_query ); |
|
744 | + public function posts_fields($SQL, WP_Query $wp_query) { |
|
745 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
746 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
747 | + return EEH_Event_Query::posts_fields($SQL, $wp_query); |
|
748 | 748 | } |
749 | 749 | /** |
750 | 750 | * @deprecated |
751 | 751 | * @since 4.4.0 |
752 | 752 | */ |
753 | - public static function posts_fields_sql_for_orderby( $orderby_params = array() ) { |
|
754 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
755 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
756 | - return EEH_Event_Query::posts_fields_sql_for_orderby( $orderby_params ); |
|
753 | + public static function posts_fields_sql_for_orderby($orderby_params = array()) { |
|
754 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
755 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
756 | + return EEH_Event_Query::posts_fields_sql_for_orderby($orderby_params); |
|
757 | 757 | } |
758 | 758 | /** |
759 | 759 | * @deprecated |
760 | 760 | * @since 4.4.0 |
761 | 761 | */ |
762 | - public function posts_join( $SQL, WP_Query $wp_query ) { |
|
763 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
764 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
765 | - return EEH_Event_Query::posts_join( $SQL, $wp_query ); |
|
762 | + public function posts_join($SQL, WP_Query $wp_query) { |
|
763 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
764 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
765 | + return EEH_Event_Query::posts_join($SQL, $wp_query); |
|
766 | 766 | } |
767 | 767 | /** |
768 | 768 | * @deprecated |
769 | 769 | * @since 4.4.0 |
770 | 770 | */ |
771 | - public static function posts_join_sql_for_terms( $join_terms = NULL ) { |
|
772 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
773 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
774 | - return EEH_Event_Query::posts_join_sql_for_terms( $join_terms ); |
|
771 | + public static function posts_join_sql_for_terms($join_terms = NULL) { |
|
772 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
773 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
774 | + return EEH_Event_Query::posts_join_sql_for_terms($join_terms); |
|
775 | 775 | } |
776 | 776 | /** |
777 | 777 | * @deprecated |
778 | 778 | * @since 4.4.0 |
779 | 779 | */ |
780 | - public static function posts_join_for_orderby( $orderby_params = array() ) { |
|
781 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
782 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
783 | - return EEH_Event_Query::posts_join_for_orderby( $orderby_params ); |
|
780 | + public static function posts_join_for_orderby($orderby_params = array()) { |
|
781 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
782 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
783 | + return EEH_Event_Query::posts_join_for_orderby($orderby_params); |
|
784 | 784 | } |
785 | 785 | /** |
786 | 786 | * @deprecated |
787 | 787 | * @since 4.4.0 |
788 | 788 | */ |
789 | - public function posts_where( $SQL, WP_Query $wp_query ) { |
|
790 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
791 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
792 | - return EEH_Event_Query::posts_where( $SQL, $wp_query ); |
|
789 | + public function posts_where($SQL, WP_Query $wp_query) { |
|
790 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
791 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
792 | + return EEH_Event_Query::posts_where($SQL, $wp_query); |
|
793 | 793 | } |
794 | 794 | /** |
795 | 795 | * @deprecated |
796 | 796 | * @since 4.4.0 |
797 | 797 | */ |
798 | - public static function posts_where_sql_for_show_expired( $show_expired = FALSE ) { |
|
799 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
800 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
801 | - return EEH_Event_Query::posts_where_sql_for_show_expired( $show_expired ); |
|
798 | + public static function posts_where_sql_for_show_expired($show_expired = FALSE) { |
|
799 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
800 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
801 | + return EEH_Event_Query::posts_where_sql_for_show_expired($show_expired); |
|
802 | 802 | } |
803 | 803 | /** |
804 | 804 | * @deprecated |
805 | 805 | * @since 4.4.0 |
806 | 806 | */ |
807 | - public static function posts_where_sql_for_event_category_slug( $event_category_slug = NULL ) { |
|
808 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
809 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
810 | - return EEH_Event_Query::posts_where_sql_for_event_category_slug( $event_category_slug ); |
|
807 | + public static function posts_where_sql_for_event_category_slug($event_category_slug = NULL) { |
|
808 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
809 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
810 | + return EEH_Event_Query::posts_where_sql_for_event_category_slug($event_category_slug); |
|
811 | 811 | } |
812 | 812 | /** |
813 | 813 | * @deprecated |
814 | 814 | * @since 4.4.0 |
815 | 815 | */ |
816 | - public static function posts_where_sql_for_event_list_month( $month = NULL ) { |
|
817 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
818 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
819 | - return EEH_Event_Query::posts_where_sql_for_event_list_month( $month ); |
|
816 | + public static function posts_where_sql_for_event_list_month($month = NULL) { |
|
817 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
818 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
819 | + return EEH_Event_Query::posts_where_sql_for_event_list_month($month); |
|
820 | 820 | } |
821 | 821 | /** |
822 | 822 | * @deprecated |
823 | 823 | * @since 4.4.0 |
824 | 824 | */ |
825 | - public function posts_orderby( $SQL, WP_Query $wp_query ) { |
|
826 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
827 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
828 | - return EEH_Event_Query::posts_orderby( $SQL, $wp_query ); |
|
825 | + public function posts_orderby($SQL, WP_Query $wp_query) { |
|
826 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
827 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
828 | + return EEH_Event_Query::posts_orderby($SQL, $wp_query); |
|
829 | 829 | } |
830 | 830 | /** |
831 | 831 | * @deprecated |
832 | 832 | * @since 4.4.0 |
833 | 833 | */ |
834 | - public static function posts_orderby_sql( $orderby_params = array(), $sort = 'ASC' ) { |
|
835 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
836 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
837 | - return EEH_Event_Query::posts_orderby_sql( $orderby_params, $sort ); |
|
834 | + public static function posts_orderby_sql($orderby_params = array(), $sort = 'ASC') { |
|
835 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
836 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
837 | + return EEH_Event_Query::posts_orderby_sql($orderby_params, $sort); |
|
838 | 838 | } |
839 | 839 | |
840 | 840 | |
@@ -865,8 +865,8 @@ discard block |
||
865 | 865 | * @param string $extra_class |
866 | 866 | * @return string |
867 | 867 | */ |
868 | -function espresso_event_list_css( $extra_class = '' ) { |
|
869 | - return EED_Events_Archive::event_list_css( $extra_class ); |
|
868 | +function espresso_event_list_css($extra_class = '') { |
|
869 | + return EED_Events_Archive::event_list_css($extra_class); |
|
870 | 870 | } |
871 | 871 | |
872 | 872 | /** |
@@ -880,14 +880,14 @@ discard block |
||
880 | 880 | * @return bool |
881 | 881 | */ |
882 | 882 | function espresso_display_full_description_in_event_list() { |
883 | - return EED_Events_Archive::display_description( 2 ); |
|
883 | + return EED_Events_Archive::display_description(2); |
|
884 | 884 | } |
885 | 885 | |
886 | 886 | /** |
887 | 887 | * @return bool |
888 | 888 | */ |
889 | 889 | function espresso_display_excerpt_in_event_list() { |
890 | - return EED_Events_Archive::display_description( 1 ); |
|
890 | + return EED_Events_Archive::display_description(1); |
|
891 | 891 | } |
892 | 892 | |
893 | 893 | /** |