@@ -219,7 +219,7 @@ |
||
219 | 219 | * Gets an array for converting between QST_system and QST_IDs for system questions. Eg, if you want to know |
220 | 220 | * which system question QST_ID corresponds to the QST_system 'city', use EEM_Question::instance()->get_Question_ID_from_system_string('city'); |
221 | 221 | * @param $QST_system |
222 | - * @return int of QST_ID for the question that corresponds to that QST_system |
|
222 | + * @return string of QST_ID for the question that corresponds to that QST_system |
|
223 | 223 | */ |
224 | 224 | public function get_Question_ID_from_system_string( $QST_system ){ |
225 | 225 | return $this->get_var( array( array( 'QST_system' => $QST_system ) ) ); |
@@ -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_Question.class.php'); |
|
24 | +require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
25 | +require_once(EE_CLASSES.'EE_Question.class.php'); |
|
26 | 26 | |
27 | 27 | class EEM_Question extends EEM_Soft_Delete_Base { |
28 | 28 | |
@@ -69,21 +69,21 @@ discard block |
||
69 | 69 | // private instance of the Attendee object |
70 | 70 | protected static $_instance = NULL; |
71 | 71 | |
72 | - protected function __construct( $timezone = NULL ) { |
|
73 | - $this->singular_item = __('Question','event_espresso'); |
|
74 | - $this->plural_item = __('Questions','event_espresso'); |
|
75 | - $this->_allowed_question_types=apply_filters( |
|
72 | + protected function __construct($timezone = NULL) { |
|
73 | + $this->singular_item = __('Question', 'event_espresso'); |
|
74 | + $this->plural_item = __('Questions', 'event_espresso'); |
|
75 | + $this->_allowed_question_types = apply_filters( |
|
76 | 76 | 'FHEE__EEM_Question__construct__allowed_question_types', |
77 | 77 | array( |
78 | - EEM_Question::QST_type_text =>__('Text','event_espresso'), |
|
79 | - EEM_Question::QST_type_textarea =>__('Textarea','event_espresso'), |
|
80 | - EEM_Question::QST_type_checkbox =>__('Checkboxes','event_espresso'), |
|
81 | - EEM_Question::QST_type_radio =>__('Radio Buttons','event_espresso'), |
|
82 | - EEM_Question::QST_type_dropdown =>__('Dropdown','event_espresso'), |
|
83 | - EEM_Question::QST_type_state =>__('State/Province Dropdown','event_espresso'), |
|
84 | - EEM_Question::QST_type_country =>__('Country Dropdown','event_espresso'), |
|
85 | - EEM_Question::QST_type_date =>__('Date Picker','event_espresso'), |
|
86 | - EEM_Question::QST_type_html_textarea => __( 'HTML Textarea', 'event_espresso' ), |
|
78 | + EEM_Question::QST_type_text =>__('Text', 'event_espresso'), |
|
79 | + EEM_Question::QST_type_textarea =>__('Textarea', 'event_espresso'), |
|
80 | + EEM_Question::QST_type_checkbox =>__('Checkboxes', 'event_espresso'), |
|
81 | + EEM_Question::QST_type_radio =>__('Radio Buttons', 'event_espresso'), |
|
82 | + EEM_Question::QST_type_dropdown =>__('Dropdown', 'event_espresso'), |
|
83 | + EEM_Question::QST_type_state =>__('State/Province Dropdown', 'event_espresso'), |
|
84 | + EEM_Question::QST_type_country =>__('Country Dropdown', 'event_espresso'), |
|
85 | + EEM_Question::QST_type_date =>__('Date Picker', 'event_espresso'), |
|
86 | + EEM_Question::QST_type_html_textarea => __('HTML Textarea', 'event_espresso'), |
|
87 | 87 | ) |
88 | 88 | ); |
89 | 89 | $this->_question_type_categories = apply_filters( |
@@ -102,22 +102,22 @@ discard block |
||
102 | 102 | ); |
103 | 103 | |
104 | 104 | $this->_tables = array( |
105 | - 'Question'=>new EE_Primary_Table('esp_question','QST_ID') |
|
105 | + 'Question'=>new EE_Primary_Table('esp_question', 'QST_ID') |
|
106 | 106 | ); |
107 | 107 | $this->_fields = array( |
108 | 108 | 'Question'=>array( |
109 | - 'QST_ID'=>new EE_Primary_Key_Int_Field('QST_ID', __('Question ID','event_espresso')), |
|
110 | - 'QST_display_text'=>new EE_Full_HTML_Field('QST_display_text', __('Question Text','event_espresso'), true, ''), |
|
111 | - 'QST_admin_label'=>new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)','event_espresso'), true, ''), |
|
112 | - 'QST_system'=>new EE_Plain_Text_Field('QST_system', __('Internal string ID for question','event_espresso'), TRUE, NULL ), |
|
113 | - 'QST_type'=>new EE_Enum_Text_Field('QST_type', __('Question Type','event_espresso'),false, 'TEXT',$this->_allowed_question_types), |
|
114 | - 'QST_required'=>new EE_Boolean_Field('QST_required', __('Required Question?','event_espresso'), false, false), |
|
115 | - 'QST_required_text'=>new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided','event_espresso'), true, ''), |
|
116 | - 'QST_order'=>new EE_Integer_Field('QST_order', __('Question Order','event_espresso'), false, 0), |
|
117 | - 'QST_admin_only'=>new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?','event_espresso'), false, false), |
|
118 | - 'QST_max' => new EE_Infinite_Integer_Field( 'QST_max', __( 'Max Size', 'event_espresso' ), false, EE_INF ), |
|
119 | - 'QST_wp_user'=>new EE_WP_User_Field('QST_wp_user', __('Question Creator ID','event_espresso'), false ), |
|
120 | - 'QST_deleted'=>new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted','event_espresso'), false, false) |
|
109 | + 'QST_ID'=>new EE_Primary_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso')), |
|
110 | + 'QST_display_text'=>new EE_Full_HTML_Field('QST_display_text', __('Question Text', 'event_espresso'), true, ''), |
|
111 | + 'QST_admin_label'=>new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)', 'event_espresso'), true, ''), |
|
112 | + 'QST_system'=>new EE_Plain_Text_Field('QST_system', __('Internal string ID for question', 'event_espresso'), TRUE, NULL), |
|
113 | + 'QST_type'=>new EE_Enum_Text_Field('QST_type', __('Question Type', 'event_espresso'), false, 'TEXT', $this->_allowed_question_types), |
|
114 | + 'QST_required'=>new EE_Boolean_Field('QST_required', __('Required Question?', 'event_espresso'), false, false), |
|
115 | + 'QST_required_text'=>new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided', 'event_espresso'), true, ''), |
|
116 | + 'QST_order'=>new EE_Integer_Field('QST_order', __('Question Order', 'event_espresso'), false, 0), |
|
117 | + 'QST_admin_only'=>new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?', 'event_espresso'), false, false), |
|
118 | + 'QST_max' => new EE_Infinite_Integer_Field('QST_max', __('Max Size', 'event_espresso'), false, EE_INF), |
|
119 | + 'QST_wp_user'=>new EE_WP_User_Field('QST_wp_user', __('Question Creator ID', 'event_espresso'), false), |
|
120 | + 'QST_deleted'=>new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted', 'event_espresso'), false, false) |
|
121 | 121 | ) |
122 | 122 | ); |
123 | 123 | $this->_model_relations = array( |
@@ -129,11 +129,11 @@ discard block |
||
129 | 129 | 'Question_Group_Question'=>new EE_Has_Many_Relation() |
130 | 130 | ); |
131 | 131 | //this model is generally available for reading |
132 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
133 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
134 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
135 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
136 | - parent::__construct( $timezone ); |
|
132 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
133 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
134 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
135 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
136 | + parent::__construct($timezone); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * but they can be extended |
142 | 142 | * @return string[] |
143 | 143 | */ |
144 | - public function allowed_question_types(){ |
|
144 | + public function allowed_question_types() { |
|
145 | 145 | return $this->_allowed_question_types; |
146 | 146 | } |
147 | 147 | /** |
@@ -149,16 +149,16 @@ discard block |
||
149 | 149 | * @param string $question_type one of EEM_Question::allowed_question_types( |
150 | 150 | * @return string[] like EEM_Question::allowed_question_types() |
151 | 151 | */ |
152 | - public function question_types_in_same_category( $question_type ) { |
|
153 | - $question_types = array( $question_type ); |
|
154 | - foreach( $this->_question_type_categories as $category => $question_types_in_category ) { |
|
155 | - if( in_array( $question_type, $question_types_in_category ) ) { |
|
152 | + public function question_types_in_same_category($question_type) { |
|
153 | + $question_types = array($question_type); |
|
154 | + foreach ($this->_question_type_categories as $category => $question_types_in_category) { |
|
155 | + if (in_array($question_type, $question_types_in_category)) { |
|
156 | 156 | $question_types = $question_types_in_category; |
157 | 157 | break; |
158 | 158 | } |
159 | 159 | } |
160 | 160 | |
161 | - return array_intersect_key( $this->allowed_question_types(), array_flip( $question_types ) ); |
|
161 | + return array_intersect_key($this->allowed_question_types(), array_flip($question_types)); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
@@ -167,11 +167,11 @@ discard block |
||
167 | 167 | * @param string $category one of the top-level keys of EEM_Question::question_type_categories() |
168 | 168 | * @return boolean |
169 | 169 | */ |
170 | - public function question_type_is_in_category( $question_type, $category ) { |
|
171 | - if( ! isset( $this->_question_type_categories[ $category ] ) ) { |
|
170 | + public function question_type_is_in_category($question_type, $category) { |
|
171 | + if ( ! isset($this->_question_type_categories[$category])) { |
|
172 | 172 | return false; |
173 | 173 | } |
174 | - return in_array( $question_type, $this->_question_type_categories[ $category ] ); |
|
174 | + return in_array($question_type, $this->_question_type_categories[$category]); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -188,9 +188,9 @@ discard block |
||
188 | 188 | * @param string $system_question_group_id QSG_system |
189 | 189 | * @return array of system question names (QST_system) |
190 | 190 | */ |
191 | - public function allowed_system_questions_in_system_question_group( $system_question_group_id ) { |
|
191 | + public function allowed_system_questions_in_system_question_group($system_question_group_id) { |
|
192 | 192 | $question_system_ids = array(); |
193 | - switch( $system_question_group_id ) { |
|
193 | + switch ($system_question_group_id) { |
|
194 | 194 | case EEM_Question_Group::system_personal: |
195 | 195 | $question_system_ids = array( |
196 | 196 | EEM_Attendee::system_question_fname, |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | ); |
212 | 212 | break; |
213 | 213 | } |
214 | - return apply_filters( 'FHEE__EEM_Question__system_questions_allowed_in_system_question_group__return', $question_system_ids, $system_question_group_id ); |
|
214 | + return apply_filters('FHEE__EEM_Question__system_questions_allowed_in_system_question_group__return', $question_system_ids, $system_question_group_id); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | /** |
@@ -220,11 +220,11 @@ discard block |
||
220 | 220 | * @param string $system_question_group_id QSG_system |
221 | 221 | * @return array of system question names (QST_system) |
222 | 222 | */ |
223 | - public function required_system_questions_in_system_question_group( $system_question_group_id ) { |
|
223 | + public function required_system_questions_in_system_question_group($system_question_group_id) { |
|
224 | 224 | $question_system_ids = null; |
225 | - switch( $system_question_group_id ) { |
|
225 | + switch ($system_question_group_id) { |
|
226 | 226 | case EEM_Question_Group::system_personal: |
227 | - $question_system_ids = array( |
|
227 | + $question_system_ids = array( |
|
228 | 228 | EEM_Attendee::system_question_fname, |
229 | 229 | EEM_Attendee::system_question_email, |
230 | 230 | ); |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | default: |
233 | 233 | $question_system_ids = array(); |
234 | 234 | } |
235 | - return apply_filters( 'FHEE__EEM_Question__system_questions_required_in_system_question_group', $question_system_ids, $system_question_group_id ); |
|
235 | + return apply_filters('FHEE__EEM_Question__system_questions_required_in_system_question_group', $question_system_ids, $system_question_group_id); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | * @param $QST_system |
244 | 244 | * @return int of QST_ID for the question that corresponds to that QST_system |
245 | 245 | */ |
246 | - public function get_Question_ID_from_system_string( $QST_system ){ |
|
247 | - return $this->get_var( array( array( 'QST_system' => $QST_system ) ) ); |
|
246 | + public function get_Question_ID_from_system_string($QST_system) { |
|
247 | + return $this->get_var(array(array('QST_system' => $QST_system))); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | |
@@ -256,9 +256,9 @@ discard block |
||
256 | 256 | */ |
257 | 257 | public function get_latest_question_order() { |
258 | 258 | $columns_to_select = array( |
259 | - 'max_order' => array("MAX(QST_order)","%d") |
|
259 | + 'max_order' => array("MAX(QST_order)", "%d") |
|
260 | 260 | ); |
261 | - $max = $this->_get_all_wpdb_results( array(), ARRAY_A, $columns_to_select ); |
|
261 | + $max = $this->_get_all_wpdb_results(array(), ARRAY_A, $columns_to_select); |
|
262 | 262 | return $max[0]['max_order']; |
263 | 263 | } |
264 | 264 | |
@@ -288,10 +288,10 @@ discard block |
||
288 | 288 | * @param string $system_question_value |
289 | 289 | * @return int|float |
290 | 290 | */ |
291 | - public function absolute_max_for_system_question( $system_question_value ) { |
|
291 | + public function absolute_max_for_system_question($system_question_value) { |
|
292 | 292 | $maxes = $this->system_question_maxes(); |
293 | - if( isset( $maxes[ $system_question_value ] ) ) { |
|
294 | - return $maxes[ $system_question_value ]; |
|
293 | + if (isset($maxes[$system_question_value])) { |
|
294 | + return $maxes[$system_question_value]; |
|
295 | 295 | } else { |
296 | 296 | return EE_INF; |
297 | 297 | } |
@@ -1,26 +1,26 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * Event Espresso |
|
4 | - * |
|
5 | - * Event Registration and Management Plugin for WordPress |
|
6 | - * |
|
7 | - * @ package Event Espresso |
|
8 | - * @ author Seth Shoultes |
|
9 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | - * @ link http://www.eventespresso.com |
|
12 | - * @ version 4.0 |
|
13 | - * |
|
14 | - * ------------------------------------------------------------------------ |
|
15 | - * |
|
16 | - * Question Model |
|
17 | - * |
|
18 | - * @package Event Espresso |
|
19 | - * @subpackage includes/models/ |
|
20 | - * @author Michael Nelson |
|
21 | - * |
|
22 | - * ------------------------------------------------------------------------ |
|
23 | - */ |
|
3 | + * Event Espresso |
|
4 | + * |
|
5 | + * Event Registration and Management Plugin for WordPress |
|
6 | + * |
|
7 | + * @ package Event Espresso |
|
8 | + * @ author Seth Shoultes |
|
9 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | + * @ link http://www.eventespresso.com |
|
12 | + * @ version 4.0 |
|
13 | + * |
|
14 | + * ------------------------------------------------------------------------ |
|
15 | + * |
|
16 | + * Question Model |
|
17 | + * |
|
18 | + * @package Event Espresso |
|
19 | + * @subpackage includes/models/ |
|
20 | + * @author Michael Nelson |
|
21 | + * |
|
22 | + * ------------------------------------------------------------------------ |
|
23 | + */ |
|
24 | 24 | require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
25 | 25 | require_once( EE_CLASSES . 'EE_Question.class.php'); |
26 | 26 |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @access public |
40 | 40 | * @param int $EVT_ID |
41 | - * @return object |
|
41 | + * @return null|boolean |
|
42 | 42 | */ |
43 | 43 | public static function get_event( $EVT_ID = 0 ) { |
44 | 44 | $EVT_ID = $EVT_ID instanceof WP_Post ? $EVT_ID->ID : absint( $EVT_ID ); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @access public |
118 | 118 | * @param int $EVT_ID |
119 | - * @return string |
|
119 | + * @return boolean |
|
120 | 120 | */ |
121 | 121 | public static function event_has_content_or_excerpt( $EVT_ID = 0 ) { |
122 | 122 | $event = EEH_Event_View::get_event( $EVT_ID ); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * event_active_status |
137 | 137 | * |
138 | 138 | * @access public |
139 | - * @param null $num_words |
|
139 | + * @param integer $num_words |
|
140 | 140 | * @param null $more |
141 | 141 | * @return string |
142 | 142 | */ |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | * |
323 | 323 | * @access public |
324 | 324 | * @param int $EVT_ID |
325 | - * @return string |
|
325 | + * @return string|null |
|
326 | 326 | */ |
327 | 327 | public static function get_primary_date_obj( $EVT_ID = 0 ) { |
328 | 328 | $event = EEH_Event_View::get_event( $EVT_ID ); |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | * |
348 | 348 | * @access public |
349 | 349 | * @param int $EVT_ID |
350 | - * @return string |
|
350 | + * @return string|null |
|
351 | 351 | */ |
352 | 352 | public static function get_last_date_obj( $EVT_ID = 0 ) { |
353 | 353 | $event = EEH_Event_View::get_event( $EVT_ID ); |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | * |
373 | 373 | * @access public |
374 | 374 | * @param int $EVT_ID |
375 | - * @return string |
|
375 | + * @return string|null |
|
376 | 376 | */ |
377 | 377 | public static function get_earliest_date_obj( $EVT_ID = 0 ) { |
378 | 378 | $event = EEH_Event_View::get_event( $EVT_ID ); |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | * |
423 | 423 | * @access public |
424 | 424 | * @param int $EVT_ID |
425 | - * @param null $include_expired |
|
425 | + * @param false|null $include_expired |
|
426 | 426 | * @param bool $include_deleted |
427 | 427 | * @param null $limit |
428 | 428 | * @return EE_Datetime[] |
@@ -40,27 +40,27 @@ discard block |
||
40 | 40 | * @param int $EVT_ID |
41 | 41 | * @return object |
42 | 42 | */ |
43 | - public static function get_event( $EVT_ID = 0 ) { |
|
44 | - $EVT_ID = $EVT_ID instanceof WP_Post ? $EVT_ID->ID : absint( $EVT_ID ); |
|
43 | + public static function get_event($EVT_ID = 0) { |
|
44 | + $EVT_ID = $EVT_ID instanceof WP_Post ? $EVT_ID->ID : absint($EVT_ID); |
|
45 | 45 | // do we already have the Event you are looking for? |
46 | - if ( EEH_Event_View::$_event instanceof EE_Event && $EVT_ID && EEH_Event_View::$_event->ID() === $EVT_ID ) { |
|
46 | + if (EEH_Event_View::$_event instanceof EE_Event && $EVT_ID && EEH_Event_View::$_event->ID() === $EVT_ID) { |
|
47 | 47 | return EEH_Event_View::$_event; |
48 | 48 | } |
49 | 49 | EEH_Event_View::$_event = NULL; |
50 | 50 | // international newspaper? |
51 | 51 | global $post; |
52 | 52 | // if this is being called from an EE_Event post, then we can just grab the attached EE_Event object |
53 | - if ( isset( $post->post_type ) && $post->post_type == 'espresso_events' || $EVT_ID ) { |
|
53 | + if (isset($post->post_type) && $post->post_type == 'espresso_events' || $EVT_ID) { |
|
54 | 54 | // d( $post ); |
55 | 55 | // grab the event we're looking for |
56 | - if ( isset( $post->EE_Event ) && ( $EVT_ID == 0 || ( $EVT_ID == $post->ID ))) { |
|
56 | + if (isset($post->EE_Event) && ($EVT_ID == 0 || ($EVT_ID == $post->ID))) { |
|
57 | 57 | EEH_Event_View::$_event = $post->EE_Event; |
58 | 58 | // d( EEH_Event_View::$_event ); |
59 | 59 | } |
60 | 60 | // now if we STILL do NOT have an EE_Event model object, BUT we have an Event ID... |
61 | - if ( ! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID ) { |
|
61 | + if ( ! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) { |
|
62 | 62 | // sigh... pull it from the db |
63 | - EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
63 | + EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
64 | 64 | // d( EEH_Event_View::$_event ); |
65 | 65 | } |
66 | 66 | } |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | * @param int $EVT_ID |
77 | 77 | * @return boolean |
78 | 78 | */ |
79 | - public static function display_ticket_selector( $EVT_ID = 0 ) { |
|
80 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
79 | + public static function display_ticket_selector($EVT_ID = 0) { |
|
80 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
81 | 81 | return $event instanceof EE_Event ? $event->display_ticket_selector() : FALSE; |
82 | 82 | } |
83 | 83 | |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | * @param int $EVT_ID |
91 | 91 | * @return string |
92 | 92 | */ |
93 | - public static function event_status( $EVT_ID = 0 ) { |
|
94 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
95 | - return $event instanceof EE_Event ? $event->pretty_active_status( FALSE ) : ''; |
|
93 | + public static function event_status($EVT_ID = 0) { |
|
94 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
95 | + return $event instanceof EE_Event ? $event->pretty_active_status(FALSE) : ''; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * @param int $EVT_ID |
105 | 105 | * @return string |
106 | 106 | */ |
107 | - public static function event_active_status( $EVT_ID = 0 ) { |
|
108 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
107 | + public static function event_active_status($EVT_ID = 0) { |
|
108 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
109 | 109 | return $event instanceof EE_Event ? $event->pretty_active_status() : 'inactive'; |
110 | 110 | } |
111 | 111 | |
@@ -118,13 +118,13 @@ discard block |
||
118 | 118 | * @param int $EVT_ID |
119 | 119 | * @return string |
120 | 120 | */ |
121 | - public static function event_has_content_or_excerpt( $EVT_ID = 0 ) { |
|
122 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
121 | + public static function event_has_content_or_excerpt($EVT_ID = 0) { |
|
122 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
123 | 123 | $has_content_or_excerpt = FALSE; |
124 | - if ( $event instanceof EE_Event ) { |
|
125 | - $has_content_or_excerpt = $event->description() != '' || $event->short_description( NULL, NULL, TRUE ) != '' ? TRUE : FALSE; |
|
124 | + if ($event instanceof EE_Event) { |
|
125 | + $has_content_or_excerpt = $event->description() != '' || $event->short_description(NULL, NULL, TRUE) != '' ? TRUE : FALSE; |
|
126 | 126 | } |
127 | - if ( is_archive() && ! ( espresso_display_full_description_in_event_list() || espresso_display_excerpt_in_event_list() )) { |
|
127 | + if (is_archive() && ! (espresso_display_full_description_in_event_list() || espresso_display_excerpt_in_event_list())) { |
|
128 | 128 | $has_content_or_excerpt = FALSE; |
129 | 129 | } |
130 | 130 | return $has_content_or_excerpt; |
@@ -140,45 +140,45 @@ discard block |
||
140 | 140 | * @param null $more |
141 | 141 | * @return string |
142 | 142 | */ |
143 | - public static function event_content_or_excerpt( $num_words = NULL, $more = NULL ) { |
|
143 | + public static function event_content_or_excerpt($num_words = NULL, $more = NULL) { |
|
144 | 144 | global $post; |
145 | 145 | |
146 | 146 | ob_start(); |
147 | - if (( is_single() ) || ( is_archive() && espresso_display_full_description_in_event_list() )) { |
|
147 | + if ((is_single()) || (is_archive() && espresso_display_full_description_in_event_list())) { |
|
148 | 148 | |
149 | 149 | // admin has chosen "full description" for the "Event Espresso - Events > Templates > Display Description" option |
150 | 150 | the_content(); |
151 | 151 | |
152 | - } else if (( is_archive() && has_excerpt( $post->ID ) && espresso_display_excerpt_in_event_list() ) ) { |
|
152 | + } else if ((is_archive() && has_excerpt($post->ID) && espresso_display_excerpt_in_event_list())) { |
|
153 | 153 | |
154 | 154 | // admin has chosen "excerpt (short desc)" for the "Event Espresso - Events > Templates > Display Description" option |
155 | 155 | // AND an excerpt actually exists |
156 | 156 | the_excerpt(); |
157 | 157 | |
158 | - } else if (( is_archive() && ! has_excerpt( $post->ID ) && espresso_display_excerpt_in_event_list() )) { |
|
158 | + } else if ((is_archive() && ! has_excerpt($post->ID) && espresso_display_excerpt_in_event_list())) { |
|
159 | 159 | |
160 | 160 | // admin has chosen "excerpt (short desc)" for the "Event Espresso - Events > Templates > Display Description" option |
161 | 161 | // but NO excerpt actually exists, so we need to create one |
162 | - if ( ! empty( $num_words )) { |
|
163 | - if ( empty( $more )) { |
|
164 | - $more_link_text = __( '(more…)' ); |
|
165 | - $more = ' <a href="' . get_permalink() . '" class="more-link">' . $more_link_text . '</a>'; |
|
166 | - $more = apply_filters( 'the_content_more_link', $more, $more_link_text ); |
|
162 | + if ( ! empty($num_words)) { |
|
163 | + if (empty($more)) { |
|
164 | + $more_link_text = __('(more…)'); |
|
165 | + $more = ' <a href="'.get_permalink().'" class="more-link">'.$more_link_text.'</a>'; |
|
166 | + $more = apply_filters('the_content_more_link', $more, $more_link_text); |
|
167 | 167 | } |
168 | - $content = str_replace( 'NOMORELINK', '', get_the_content( 'NOMORELINK' )); |
|
168 | + $content = str_replace('NOMORELINK', '', get_the_content('NOMORELINK')); |
|
169 | 169 | |
170 | - $content = wp_trim_words( $content, $num_words, ' ' ) . $more; |
|
170 | + $content = wp_trim_words($content, $num_words, ' ').$more; |
|
171 | 171 | } else { |
172 | - $content = get_the_content(); |
|
172 | + $content = get_the_content(); |
|
173 | 173 | } |
174 | 174 | global $allowedtags; |
175 | - $content = wp_kses( $content, $allowedtags ); |
|
176 | - $content = strip_shortcodes( $content ); |
|
177 | - echo apply_filters( 'the_content', $content ); |
|
175 | + $content = wp_kses($content, $allowedtags); |
|
176 | + $content = strip_shortcodes($content); |
|
177 | + echo apply_filters('the_content', $content); |
|
178 | 178 | |
179 | 179 | } else { |
180 | 180 | // admin has chosen "none" for the "Event Espresso - Events > Templates > Display Description" option |
181 | - echo apply_filters( 'the_content', '' ); |
|
181 | + echo apply_filters('the_content', ''); |
|
182 | 182 | } |
183 | 183 | return ob_get_clean(); |
184 | 184 | } |
@@ -192,13 +192,13 @@ discard block |
||
192 | 192 | * @param int $EVT_ID |
193 | 193 | * @return EE_Ticket[] |
194 | 194 | */ |
195 | - public static function event_tickets_available( $EVT_ID = 0 ) { |
|
196 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
195 | + public static function event_tickets_available($EVT_ID = 0) { |
|
196 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
197 | 197 | $tickets_available_for_purchase = array(); |
198 | - if( $event instanceof EE_Event ) { |
|
199 | - $datetimes = EEH_Event_View::get_all_date_obj( $EVT_ID, FALSE ); |
|
200 | - foreach( $datetimes as $datetime ) { |
|
201 | - $tickets_available_for_purchase = array_merge( $tickets_available_for_purchase, $datetime->ticket_types_available_for_purchase() ); |
|
198 | + if ($event instanceof EE_Event) { |
|
199 | + $datetimes = EEH_Event_View::get_all_date_obj($EVT_ID, FALSE); |
|
200 | + foreach ($datetimes as $datetime) { |
|
201 | + $tickets_available_for_purchase = array_merge($tickets_available_for_purchase, $datetime->ticket_types_available_for_purchase()); |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | return $tickets_available_for_purchase; |
@@ -214,22 +214,22 @@ discard block |
||
214 | 214 | * @param bool $hide_uncategorized |
215 | 215 | * @return string |
216 | 216 | */ |
217 | - public static function event_categories( $EVT_ID = 0, $hide_uncategorized = TRUE ) { |
|
217 | + public static function event_categories($EVT_ID = 0, $hide_uncategorized = TRUE) { |
|
218 | 218 | $category_links = array(); |
219 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
220 | - if ( $event instanceof EE_Event ) { |
|
221 | - $event_categories = get_the_terms( $event->ID(), 'espresso_event_categories' ); |
|
222 | - if ( $event_categories ) { |
|
219 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
220 | + if ($event instanceof EE_Event) { |
|
221 | + $event_categories = get_the_terms($event->ID(), 'espresso_event_categories'); |
|
222 | + if ($event_categories) { |
|
223 | 223 | // loop thru terms and create links |
224 | - foreach ( $event_categories as $term ) { |
|
225 | - $url = get_term_link( $term, 'espresso_venue_categories' ); |
|
226 | - if ( ! is_wp_error( $url ) && (( $hide_uncategorized && strtolower( $term->name ) != __( 'uncategorized', 'event_espresso' )) || ! $hide_uncategorized )) { |
|
227 | - $category_links[] = '<a href="' . esc_url( $url ) . '" rel="tag">' . $term->name . '</a>'; |
|
224 | + foreach ($event_categories as $term) { |
|
225 | + $url = get_term_link($term, 'espresso_venue_categories'); |
|
226 | + if ( ! is_wp_error($url) && (($hide_uncategorized && strtolower($term->name) != __('uncategorized', 'event_espresso')) || ! $hide_uncategorized)) { |
|
227 | + $category_links[] = '<a href="'.esc_url($url).'" rel="tag">'.$term->name.'</a>'; |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 | } |
231 | 231 | } |
232 | - return implode( ', ', $category_links ); |
|
232 | + return implode(', ', $category_links); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | |
@@ -243,10 +243,10 @@ discard block |
||
243 | 243 | * @param int $EVT_ID |
244 | 244 | * @return string |
245 | 245 | */ |
246 | - public static function the_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
247 | - $datetime = EEH_Event_View::get_primary_date_obj( $EVT_ID ); |
|
248 | - $format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt; |
|
249 | - return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_start', $format ) : ''; |
|
246 | + public static function the_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
247 | + $datetime = EEH_Event_View::get_primary_date_obj($EVT_ID); |
|
248 | + $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt; |
|
249 | + return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) : ''; |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | |
@@ -260,10 +260,10 @@ discard block |
||
260 | 260 | * @param int $EVT_ID |
261 | 261 | * @return string |
262 | 262 | */ |
263 | - public static function the_event_end_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
264 | - $datetime = EEH_Event_View::get_last_date_obj( $EVT_ID ); |
|
265 | - $format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt; |
|
266 | - return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_end', $format ) : ''; |
|
263 | + public static function the_event_end_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
264 | + $datetime = EEH_Event_View::get_last_date_obj($EVT_ID); |
|
265 | + $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt; |
|
266 | + return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_end', $format) : ''; |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
@@ -277,10 +277,10 @@ discard block |
||
277 | 277 | * @param int $EVT_ID |
278 | 278 | * @return string |
279 | 279 | */ |
280 | - public static function the_earliest_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
281 | - $datetime = EEH_Event_View::get_earliest_date_obj( $EVT_ID ); |
|
282 | - $format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt; |
|
283 | - return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_start', $format ) : ''; |
|
280 | + public static function the_earliest_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
281 | + $datetime = EEH_Event_View::get_earliest_date_obj($EVT_ID); |
|
282 | + $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt; |
|
283 | + return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) : ''; |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | |
@@ -294,10 +294,10 @@ discard block |
||
294 | 294 | * @param int $EVT_ID |
295 | 295 | * @return string |
296 | 296 | */ |
297 | - public static function the_latest_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
298 | - $datetime = EEH_Event_View::get_last_date_obj( $EVT_ID ); |
|
299 | - $format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt; |
|
300 | - return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_end', $format ) : ''; |
|
297 | + public static function the_latest_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
298 | + $datetime = EEH_Event_View::get_last_date_obj($EVT_ID); |
|
299 | + $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt; |
|
300 | + return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_end', $format) : ''; |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | |
@@ -309,13 +309,13 @@ discard block |
||
309 | 309 | * @param int $EVT_ID |
310 | 310 | * @return string |
311 | 311 | */ |
312 | - public static function event_date_as_calendar_page( $EVT_ID = 0 ) { |
|
313 | - $datetime = EEH_Event_View::get_primary_date_obj( $EVT_ID ); |
|
314 | - if ( $datetime instanceof EE_Datetime ) { |
|
312 | + public static function event_date_as_calendar_page($EVT_ID = 0) { |
|
313 | + $datetime = EEH_Event_View::get_primary_date_obj($EVT_ID); |
|
314 | + if ($datetime instanceof EE_Datetime) { |
|
315 | 315 | ?> |
316 | 316 | <div class="event-date-calendar-page-dv"> |
317 | - <div class="event-date-calendar-page-month-dv"><?php echo $datetime->get_i18n_datetime( 'DTT_EVT_start', 'M' );?></div> |
|
318 | - <div class="event-date-calendar-page-day-dv"><?php echo $datetime->start_date( 'd' );?></div> |
|
317 | + <div class="event-date-calendar-page-month-dv"><?php echo $datetime->get_i18n_datetime('DTT_EVT_start', 'M'); ?></div> |
|
318 | + <div class="event-date-calendar-page-day-dv"><?php echo $datetime->start_date('d'); ?></div> |
|
319 | 319 | </div> |
320 | 320 | <?php |
321 | 321 | } |
@@ -330,17 +330,17 @@ discard block |
||
330 | 330 | * @param int $EVT_ID |
331 | 331 | * @return string |
332 | 332 | */ |
333 | - public static function get_primary_date_obj( $EVT_ID = 0 ) { |
|
334 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
335 | - if ( $event instanceof EE_Event ) { |
|
333 | + public static function get_primary_date_obj($EVT_ID = 0) { |
|
334 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
335 | + if ($event instanceof EE_Event) { |
|
336 | 336 | $datetimes = $event->get_many_related( |
337 | 337 | 'Datetime', |
338 | 338 | array( |
339 | 339 | 'limit' => 1, |
340 | - 'order_by' => array( 'DTT_order' => 'ASC' ) |
|
340 | + 'order_by' => array('DTT_order' => 'ASC') |
|
341 | 341 | ) |
342 | 342 | ); |
343 | - return reset( $datetimes ); |
|
343 | + return reset($datetimes); |
|
344 | 344 | } else { |
345 | 345 | return FALSE; |
346 | 346 | } |
@@ -355,17 +355,17 @@ discard block |
||
355 | 355 | * @param int $EVT_ID |
356 | 356 | * @return string |
357 | 357 | */ |
358 | - public static function get_last_date_obj( $EVT_ID = 0 ) { |
|
359 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
360 | - if ( $event instanceof EE_Event ) { |
|
358 | + public static function get_last_date_obj($EVT_ID = 0) { |
|
359 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
360 | + if ($event instanceof EE_Event) { |
|
361 | 361 | $datetimes = $event->get_many_related( |
362 | 362 | 'Datetime', |
363 | 363 | array( |
364 | 364 | 'limit' => 1, |
365 | - 'order_by' => array( 'DTT_order' => 'DESC' ) |
|
365 | + 'order_by' => array('DTT_order' => 'DESC') |
|
366 | 366 | ) |
367 | 367 | ); |
368 | - return end( $datetimes ); |
|
368 | + return end($datetimes); |
|
369 | 369 | } else { |
370 | 370 | return FALSE; |
371 | 371 | } |
@@ -380,17 +380,17 @@ discard block |
||
380 | 380 | * @param int $EVT_ID |
381 | 381 | * @return string |
382 | 382 | */ |
383 | - public static function get_earliest_date_obj( $EVT_ID = 0 ) { |
|
384 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
385 | - if ( $event instanceof EE_Event ) { |
|
383 | + public static function get_earliest_date_obj($EVT_ID = 0) { |
|
384 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
385 | + if ($event instanceof EE_Event) { |
|
386 | 386 | $datetimes = $event->get_many_related( |
387 | 387 | 'Datetime', |
388 | 388 | array( |
389 | 389 | 'limit' => 1, |
390 | - 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) |
|
390 | + 'order_by' => array('DTT_EVT_start' => 'ASC') |
|
391 | 391 | ) |
392 | 392 | ); |
393 | - return reset( $datetimes ); |
|
393 | + return reset($datetimes); |
|
394 | 394 | } else { |
395 | 395 | return FALSE; |
396 | 396 | } |
@@ -405,17 +405,17 @@ discard block |
||
405 | 405 | * @param int $EVT_ID |
406 | 406 | * @return string |
407 | 407 | */ |
408 | - public static function get_latest_date_obj( $EVT_ID = 0 ) { |
|
409 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
410 | - if ( $event instanceof EE_Event ) { |
|
408 | + public static function get_latest_date_obj($EVT_ID = 0) { |
|
409 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
410 | + if ($event instanceof EE_Event) { |
|
411 | 411 | $datetimes = $event->get_many_related( |
412 | 412 | 'Datetime', |
413 | 413 | array( |
414 | 414 | 'limit' => 1, |
415 | - 'order_by' => array( 'DTT_EVT_start' => 'DESC' ) |
|
415 | + 'order_by' => array('DTT_EVT_start' => 'DESC') |
|
416 | 416 | ) |
417 | 417 | ); |
418 | - return end( $datetimes ); |
|
418 | + return end($datetimes); |
|
419 | 419 | } else { |
420 | 420 | return FALSE; |
421 | 421 | } |
@@ -433,17 +433,17 @@ discard block |
||
433 | 433 | * @param null $limit |
434 | 434 | * @return EE_Datetime[] |
435 | 435 | */ |
436 | - public static function get_all_date_obj( $EVT_ID = 0, $include_expired = null, $include_deleted = false, $limit = NULL ) { |
|
437 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
438 | - if($include_expired === null){ |
|
439 | - if($event instanceof EE_Event && $event->is_expired()){ |
|
436 | + public static function get_all_date_obj($EVT_ID = 0, $include_expired = null, $include_deleted = false, $limit = NULL) { |
|
437 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
438 | + if ($include_expired === null) { |
|
439 | + if ($event instanceof EE_Event && $event->is_expired()) { |
|
440 | 440 | $include_expired = true; |
441 | - }else{ |
|
441 | + } else { |
|
442 | 442 | $include_expired = false; |
443 | 443 | } |
444 | 444 | } |
445 | 445 | |
446 | - if ( $event instanceof EE_Event ) { |
|
446 | + if ($event instanceof EE_Event) { |
|
447 | 447 | return $event->datetimes_ordered($include_expired, $include_deleted, $limit); |
448 | 448 | } else { |
449 | 449 | return array(); |
@@ -459,11 +459,11 @@ discard block |
||
459 | 459 | * @param int $EVT_ID |
460 | 460 | * @return string |
461 | 461 | */ |
462 | - public static function event_link_url( $EVT_ID = 0 ) { |
|
463 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
464 | - if ( $event instanceof EE_Event ) { |
|
465 | - $url = $event->external_url() !== NULL && $event->external_url() !== '' ? $event->external_url() : get_permalink( $event->ID() ); |
|
466 | - return preg_match( "~^(?:f|ht)tps?://~i", $url ) ? $url : 'http://' . $url; |
|
462 | + public static function event_link_url($EVT_ID = 0) { |
|
463 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
464 | + if ($event instanceof EE_Event) { |
|
465 | + $url = $event->external_url() !== NULL && $event->external_url() !== '' ? $event->external_url() : get_permalink($event->ID()); |
|
466 | + return preg_match("~^(?:f|ht)tps?://~i", $url) ? $url : 'http://'.$url; |
|
467 | 467 | } |
468 | 468 | return NULL; |
469 | 469 | } |
@@ -477,11 +477,11 @@ discard block |
||
477 | 477 | * @param int $EVT_ID |
478 | 478 | * @return string |
479 | 479 | */ |
480 | - public static function event_phone( $EVT_ID = 0 ) { |
|
481 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
482 | - if ( $event instanceof EE_Event ) { |
|
483 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
484 | - return EEH_Schema::telephone( $event->phone() ); |
|
480 | + public static function event_phone($EVT_ID = 0) { |
|
481 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
482 | + if ($event instanceof EE_Event) { |
|
483 | + EE_Registry::instance()->load_helper('Formatter'); |
|
484 | + return EEH_Schema::telephone($event->phone()); |
|
485 | 485 | } |
486 | 486 | return NULL; |
487 | 487 | } |
@@ -498,23 +498,23 @@ discard block |
||
498 | 498 | * @param string $after |
499 | 499 | * @return string |
500 | 500 | */ |
501 | - public static function edit_event_link( $EVT_ID = 0, $link = '', $before = '', $after = '' ) { |
|
502 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
503 | - if ( $event instanceof EE_Event ) { |
|
501 | + public static function edit_event_link($EVT_ID = 0, $link = '', $before = '', $after = '') { |
|
502 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
503 | + if ($event instanceof EE_Event) { |
|
504 | 504 | // can the user edit this post ? |
505 | - if ( current_user_can( 'edit_post', $event->ID() )) { |
|
505 | + if (current_user_can('edit_post', $event->ID())) { |
|
506 | 506 | // set link text |
507 | - $link = ! empty( $link ) ? $link : __('edit this event'); |
|
507 | + $link = ! empty($link) ? $link : __('edit this event'); |
|
508 | 508 | // generate nonce |
509 | - $nonce = wp_create_nonce( 'edit_nonce' ); |
|
509 | + $nonce = wp_create_nonce('edit_nonce'); |
|
510 | 510 | // generate url to event editor for this event |
511 | - $url = add_query_arg( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event->ID(), 'edit_nonce' => $nonce ), admin_url() ); |
|
511 | + $url = add_query_arg(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event->ID(), 'edit_nonce' => $nonce), admin_url()); |
|
512 | 512 | // get edit CPT text |
513 | - $post_type_obj = get_post_type_object( 'espresso_events' ); |
|
513 | + $post_type_obj = get_post_type_object('espresso_events'); |
|
514 | 514 | // build final link html |
515 | - $link = '<a class="post-edit-link" href="' . $url . '" title="' . esc_attr( $post_type_obj->labels->edit_item ) . '">' . $link . '</a>'; |
|
515 | + $link = '<a class="post-edit-link" href="'.$url.'" title="'.esc_attr($post_type_obj->labels->edit_item).'">'.$link.'</a>'; |
|
516 | 516 | // put it all together |
517 | - return $before . apply_filters( 'edit_post_link', $link, $event->ID() ) . $after; |
|
517 | + return $before.apply_filters('edit_post_link', $link, $event->ID()).$after; |
|
518 | 518 | } |
519 | 519 | } |
520 | 520 | return ''; |
@@ -88,6 +88,7 @@ discard block |
||
88 | 88 | /** |
89 | 89 | * [ee_tep_not_null description] |
90 | 90 | * @param string | array $value [description] |
91 | + * @param string $value |
|
91 | 92 | * @return bool [description] |
92 | 93 | */ |
93 | 94 | static public function ee_tep_not_null($value) { |
@@ -152,6 +153,15 @@ discard block |
||
152 | 153 | */ |
153 | 154 | class EE_Address_Formatter { |
154 | 155 | |
156 | + /** |
|
157 | + * @param string $address |
|
158 | + * @param string $address2 |
|
159 | + * @param string $city |
|
160 | + * @param string $state |
|
161 | + * @param string $zip |
|
162 | + * @param string $country |
|
163 | + * @param string $sub |
|
164 | + */ |
|
155 | 165 | protected function parse_formatted_address( $address, $address2, $city, $state, $zip, $country, $formatted_address, $sub ) { |
156 | 166 | // swap address part placeholders for the real text |
157 | 167 | $formatted_address = str_replace( |
@@ -629,6 +639,8 @@ discard block |
||
629 | 639 | * @param EE_State | string $state |
630 | 640 | * @param string $zip |
631 | 641 | * @param EE_Country | string $country |
642 | + * @param integer $state |
|
643 | + * @param string $country |
|
632 | 644 | * @return EE_Generic_Address |
633 | 645 | */ |
634 | 646 | public function __construct( $address, $address2, $city, $state, $zip, $country ) { |
@@ -716,7 +728,7 @@ discard block |
||
716 | 728 | |
717 | 729 | |
718 | 730 | /** |
719 | - * @return \EE_State |
|
731 | + * @return string |
|
720 | 732 | */ |
721 | 733 | public function state_obj() { |
722 | 734 | return $this->_state_obj; |
@@ -765,7 +777,7 @@ discard block |
||
765 | 777 | |
766 | 778 | |
767 | 779 | /** |
768 | - * @return \EE_Country |
|
780 | + * @return string |
|
769 | 781 | */ |
770 | 782 | public function country_obj() { |
771 | 783 | return $this->_country_obj; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * @param string $content content to format |
40 | 40 | * @return string formatted content |
41 | 41 | */ |
42 | - static public function admin_format_content($content='') { |
|
42 | + static public function admin_format_content($content = '') { |
|
43 | 43 | return wpautop(stripslashes_deep(html_entity_decode($content, ENT_QUOTES, "UTF-8"))); |
44 | 44 | } |
45 | 45 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @return string |
80 | 80 | */ |
81 | 81 | static public function ee_tep_parse_input_field_data($data, $parse) { |
82 | - return strtr( trim($data), $parse); |
|
82 | + return strtr(trim($data), $parse); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -118,10 +118,10 @@ discard block |
||
118 | 118 | * @return string |
119 | 119 | * @deprecated v4.6.21 |
120 | 120 | */ |
121 | - static public function event_date_display( $date, $format = '' ) { |
|
121 | + static public function event_date_display($date, $format = '') { |
|
122 | 122 | EE_Error::doing_it_wrong( |
123 | 123 | __METHOD__, |
124 | - __( 'This method is deprecated as of EE 4.6.12. Currently it does not reformat as with prior behaviour but just returns the incoming string. Please use the EE_Datetime helpers for Datetime on the event to display as desired.', 'event_espresso' ), |
|
124 | + __('This method is deprecated as of EE 4.6.12. Currently it does not reformat as with prior behaviour but just returns the incoming string. Please use the EE_Datetime helpers for Datetime on the event to display as desired.', 'event_espresso'), |
|
125 | 125 | '4.6.21' |
126 | 126 | ); |
127 | 127 | |
@@ -152,18 +152,18 @@ discard block |
||
152 | 152 | */ |
153 | 153 | class EE_Address_Formatter { |
154 | 154 | |
155 | - protected function parse_formatted_address( $address, $address2, $city, $state, $zip, $country, $formatted_address, $sub ) { |
|
155 | + protected function parse_formatted_address($address, $address2, $city, $state, $zip, $country, $formatted_address, $sub) { |
|
156 | 156 | // swap address part placeholders for the real text |
157 | 157 | $formatted_address = str_replace( |
158 | 158 | // find |
159 | - array( '{address}', '{address2}', '{city}', '{state}', '{zip}', '{country}' ), |
|
159 | + array('{address}', '{address2}', '{city}', '{state}', '{zip}', '{country}'), |
|
160 | 160 | // replace |
161 | - array( $address, $address2, $city, $state, $zip, $country ), |
|
161 | + array($address, $address2, $city, $state, $zip, $country), |
|
162 | 162 | // string |
163 | 163 | $formatted_address |
164 | 164 | ); |
165 | 165 | // remove placeholder from start and end, reduce repeating placeholders to singles, then replace with HTML line breaks |
166 | - return preg_replace( '/%+/', $sub, trim( $formatted_address, '%' ) ); |
|
166 | + return preg_replace('/%+/', $sub, trim($formatted_address, '%')); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | * @param string $CNT_ISO |
200 | 200 | * @return string |
201 | 201 | */ |
202 | - public function format( $address, $address2, $city, $state, $zip, $country, $CNT_ISO ) { |
|
202 | + public function format($address, $address2, $city, $state, $zip, $country, $CNT_ISO) { |
|
203 | 203 | |
204 | 204 | $address_formats = apply_filters( |
205 | 205 | 'FHEE__EE_MultiLine_Address_Formatter__address_formats', |
@@ -211,8 +211,8 @@ discard block |
||
211 | 211 | ) |
212 | 212 | ); |
213 | 213 | // if the incoming country has a set format, use that, else use the default |
214 | - $formatted_address = isset( $address_formats[ $CNT_ISO ] ) ? $address_formats[ $CNT_ISO ] : $address_formats[ 'ZZ' ]; |
|
215 | - return $this->parse_formatted_address( $address, $address2, $city, $state, $zip, $country, $formatted_address, '<br />' ); |
|
214 | + $formatted_address = isset($address_formats[$CNT_ISO]) ? $address_formats[$CNT_ISO] : $address_formats['ZZ']; |
|
215 | + return $this->parse_formatted_address($address, $address2, $city, $state, $zip, $country, $formatted_address, '<br />'); |
|
216 | 216 | } |
217 | 217 | } |
218 | 218 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @param string $CNT_ISO |
246 | 246 | * @return string |
247 | 247 | */ |
248 | - public function format( $address, $address2, $city, $state, $zip, $country, $CNT_ISO ) { |
|
248 | + public function format($address, $address2, $city, $state, $zip, $country, $CNT_ISO) { |
|
249 | 249 | $address_formats = apply_filters( |
250 | 250 | 'FHEE__EE_Inline_Address_Formatter__address_formats', |
251 | 251 | array( |
@@ -256,8 +256,8 @@ discard block |
||
256 | 256 | ) |
257 | 257 | ); |
258 | 258 | // if the incoming country has a set format, use that, else use the default |
259 | - $formatted_address = isset( $address_formats[ $CNT_ISO ] ) ? $address_formats[ $CNT_ISO ] : $address_formats[ 'ZZZ' ]; |
|
260 | - return $this->parse_formatted_address( $address, $address2, $city, $state, $zip, $country, $formatted_address, ', ' ); |
|
259 | + $formatted_address = isset($address_formats[$CNT_ISO]) ? $address_formats[$CNT_ISO] : $address_formats['ZZZ']; |
|
260 | + return $this->parse_formatted_address($address, $address2, $city, $state, $zip, $country, $formatted_address, ', '); |
|
261 | 261 | |
262 | 262 | } |
263 | 263 | } |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | * @param string $CNT_ISO |
293 | 293 | * @return string |
294 | 294 | */ |
295 | - public function format( $address, $address2, $city, $state, $zip, $country, $CNT_ISO ) { |
|
295 | + public function format($address, $address2, $city, $state, $zip, $country, $CNT_ISO) { |
|
296 | 296 | return NULL; |
297 | 297 | } |
298 | 298 | } |
@@ -328,20 +328,20 @@ discard block |
||
328 | 328 | * @param bool $add_wrapper |
329 | 329 | * @return string |
330 | 330 | */ |
331 | - public static function format ( $obj_with_address = null, $type = 'multiline', $use_schema = true, $add_wrapper = true ) { |
|
331 | + public static function format($obj_with_address = null, $type = 'multiline', $use_schema = true, $add_wrapper = true) { |
|
332 | 332 | // check that incoming object implements the EEI_Address interface |
333 | - if ( ! $obj_with_address instanceof EEI_Address ) { |
|
334 | - $msg = __( 'The address could not be formatted.', 'event_espresso' ); |
|
335 | - $dev_msg = __( 'The EE_Address_Formatter requires passed objects to implement the EEI_Address interface.', 'event_espresso' ); |
|
336 | - EE_Error::add_error( $msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
333 | + if ( ! $obj_with_address instanceof EEI_Address) { |
|
334 | + $msg = __('The address could not be formatted.', 'event_espresso'); |
|
335 | + $dev_msg = __('The EE_Address_Formatter requires passed objects to implement the EEI_Address interface.', 'event_espresso'); |
|
336 | + EE_Error::add_error($msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__); |
|
337 | 337 | return null; |
338 | 338 | } |
339 | 339 | // obtain an address formatter |
340 | - $formatter = EEH_Address::_get_formatter( $type ); |
|
340 | + $formatter = EEH_Address::_get_formatter($type); |
|
341 | 341 | // apply schema.org formatting ? |
342 | 342 | $use_schema = ! is_admin() ? $use_schema : false; |
343 | - $formatted_address = $use_schema ? EEH_Address::_schema_formatting( $formatter, $obj_with_address ) : EEH_Address::_regular_formatting( $formatter, $obj_with_address, $add_wrapper ) ; |
|
344 | - $formatted_address = $add_wrapper && ! $use_schema ? '<div class="espresso-address-dv">' . $formatted_address . '</div>' : $formatted_address; |
|
343 | + $formatted_address = $use_schema ? EEH_Address::_schema_formatting($formatter, $obj_with_address) : EEH_Address::_regular_formatting($formatter, $obj_with_address, $add_wrapper); |
|
344 | + $formatted_address = $add_wrapper && ! $use_schema ? '<div class="espresso-address-dv">'.$formatted_address.'</div>' : $formatted_address; |
|
345 | 345 | // return the formatted address |
346 | 346 | return $formatted_address; |
347 | 347 | } |
@@ -355,8 +355,8 @@ discard block |
||
355 | 355 | * @param string $type how the address is formatted. for example: 'multiline' or 'inline' |
356 | 356 | * @return EEI_Address_Formatter |
357 | 357 | */ |
358 | - private static function _get_formatter( $type ) { |
|
359 | - switch( $type ) { |
|
358 | + private static function _get_formatter($type) { |
|
359 | + switch ($type) { |
|
360 | 360 | |
361 | 361 | case 'multiline' : |
362 | 362 | return new EE_MultiLine_Address_Formatter(); |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | * @param bool $add_wrapper |
383 | 383 | * @return string |
384 | 384 | */ |
385 | - private static function _regular_formatting( EEI_Address_Formatter $formatter, EEI_Address $obj_with_address, $add_wrapper = TRUE ){ |
|
385 | + private static function _regular_formatting(EEI_Address_Formatter $formatter, EEI_Address $obj_with_address, $add_wrapper = TRUE) { |
|
386 | 386 | $formatted_address = $add_wrapper ? '<div>' : ''; |
387 | 387 | $formatted_address .= $formatter->format( |
388 | 388 | $obj_with_address->address(), |
@@ -409,15 +409,15 @@ discard block |
||
409 | 409 | * @param object EEI_Address $obj_with_address |
410 | 410 | * @return string |
411 | 411 | */ |
412 | - private static function _schema_formatting( EEI_Address_Formatter $formatter, EEI_Address $obj_with_address ){ |
|
412 | + private static function _schema_formatting(EEI_Address_Formatter $formatter, EEI_Address $obj_with_address) { |
|
413 | 413 | $formatted_address = '<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">'; |
414 | 414 | $formatted_address .= $formatter->format( |
415 | - EEH_Schema::streetAddress( $obj_with_address ), |
|
416 | - EEH_Schema::postOfficeBoxNumber( $obj_with_address ), |
|
417 | - EEH_Schema::addressLocality( $obj_with_address ), |
|
418 | - EEH_Schema::addressRegion( $obj_with_address ), |
|
419 | - EEH_Schema::postalCode( $obj_with_address ), |
|
420 | - EEH_Schema::addressCountry( $obj_with_address ), |
|
415 | + EEH_Schema::streetAddress($obj_with_address), |
|
416 | + EEH_Schema::postOfficeBoxNumber($obj_with_address), |
|
417 | + EEH_Schema::addressLocality($obj_with_address), |
|
418 | + EEH_Schema::addressRegion($obj_with_address), |
|
419 | + EEH_Schema::postalCode($obj_with_address), |
|
420 | + EEH_Schema::addressCountry($obj_with_address), |
|
421 | 421 | $obj_with_address->country_ID() |
422 | 422 | ); |
423 | 423 | $formatted_address .= '</div>'; |
@@ -460,8 +460,8 @@ discard block |
||
460 | 460 | * @param string $location |
461 | 461 | * @return string |
462 | 462 | */ |
463 | - public static function location ( $location = NULL ) { |
|
464 | - return ! empty( $location ) ? '<div itemprop="location" itemscope itemtype="http://schema.org/Place">' . $location . '</div>' : ''; |
|
463 | + public static function location($location = NULL) { |
|
464 | + return ! empty($location) ? '<div itemprop="location" itemscope itemtype="http://schema.org/Place">'.$location.'</div>' : ''; |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | /** |
@@ -472,8 +472,8 @@ discard block |
||
472 | 472 | * @param string $name |
473 | 473 | * @return string |
474 | 474 | */ |
475 | - public static function name ( $name = NULL ) { |
|
476 | - return ! empty( $name ) ? '<span itemprop="name">' . $name . '</span>' : ''; |
|
475 | + public static function name($name = NULL) { |
|
476 | + return ! empty($name) ? '<span itemprop="name">'.$name.'</span>' : ''; |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | /** |
@@ -484,8 +484,8 @@ discard block |
||
484 | 484 | * @param EEI_Address $obj_with_address |
485 | 485 | * @return string |
486 | 486 | */ |
487 | - public static function streetAddress ( EEI_Address $obj_with_address = NULL ) { |
|
488 | - return $obj_with_address->address() !== NULL && $obj_with_address->address() !== '' ? '<span itemprop="streetAddress">' . $obj_with_address->address() . '</span>' : ''; |
|
487 | + public static function streetAddress(EEI_Address $obj_with_address = NULL) { |
|
488 | + return $obj_with_address->address() !== NULL && $obj_with_address->address() !== '' ? '<span itemprop="streetAddress">'.$obj_with_address->address().'</span>' : ''; |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | /** |
@@ -496,10 +496,10 @@ discard block |
||
496 | 496 | * @param EEI_Address $obj_with_address |
497 | 497 | * @return string |
498 | 498 | */ |
499 | - public static function postOfficeBoxNumber ( EEI_Address $obj_with_address = NULL ) { |
|
499 | + public static function postOfficeBoxNumber(EEI_Address $obj_with_address = NULL) { |
|
500 | 500 | // regex check for some form of PO Box or P.O. Box, etc, etc, etc |
501 | - if ( preg_match("/^\s*((P(OST)?.?\s*(O(FF(ICE)?)?)?.?\s+(B(IN|OX))?)|B(IN|OX))/i", $obj_with_address->address2() )) { |
|
502 | - return $obj_with_address->address2() !== NULL && $obj_with_address->address2() !== '' ? '<span itemprop="postOfficeBoxNumber">' . $obj_with_address->address2() . '</span>' : ''; |
|
501 | + if (preg_match("/^\s*((P(OST)?.?\s*(O(FF(ICE)?)?)?.?\s+(B(IN|OX))?)|B(IN|OX))/i", $obj_with_address->address2())) { |
|
502 | + return $obj_with_address->address2() !== NULL && $obj_with_address->address2() !== '' ? '<span itemprop="postOfficeBoxNumber">'.$obj_with_address->address2().'</span>' : ''; |
|
503 | 503 | } else { |
504 | 504 | return $obj_with_address->address2(); |
505 | 505 | } |
@@ -513,8 +513,8 @@ discard block |
||
513 | 513 | * @param EEI_Address $obj_with_address |
514 | 514 | * @return string |
515 | 515 | */ |
516 | - public static function addressLocality ( EEI_Address $obj_with_address = NULL ) { |
|
517 | - return $obj_with_address->city() !== NULL && $obj_with_address->city() !== '' ? '<span itemprop="addressLocality">' . $obj_with_address->city() . '</span>' : ''; |
|
516 | + public static function addressLocality(EEI_Address $obj_with_address = NULL) { |
|
517 | + return $obj_with_address->city() !== NULL && $obj_with_address->city() !== '' ? '<span itemprop="addressLocality">'.$obj_with_address->city().'</span>' : ''; |
|
518 | 518 | } |
519 | 519 | |
520 | 520 | /** |
@@ -525,10 +525,10 @@ discard block |
||
525 | 525 | * @param EEI_Address $obj_with_address |
526 | 526 | * @return string |
527 | 527 | */ |
528 | - public static function addressRegion ( EEI_Address $obj_with_address = NULL ) { |
|
528 | + public static function addressRegion(EEI_Address $obj_with_address = NULL) { |
|
529 | 529 | $state = $obj_with_address->state_name(); |
530 | - if ( ! empty( $state ) ) { |
|
531 | - return '<span itemprop="addressRegion">' . $state . '</span>'; |
|
530 | + if ( ! empty($state)) { |
|
531 | + return '<span itemprop="addressRegion">'.$state.'</span>'; |
|
532 | 532 | } else { |
533 | 533 | return ''; |
534 | 534 | } |
@@ -542,10 +542,10 @@ discard block |
||
542 | 542 | * @param EEI_Address $obj_with_address |
543 | 543 | * @return string |
544 | 544 | */ |
545 | - public static function addressCountry ( EEI_Address $obj_with_address = NULL ) { |
|
545 | + public static function addressCountry(EEI_Address $obj_with_address = NULL) { |
|
546 | 546 | $country = $obj_with_address->country_name(); |
547 | - if ( ! empty( $country ) ) { |
|
548 | - return '<span itemprop="addressCountry">' . $country . '</span>'; |
|
547 | + if ( ! empty($country)) { |
|
548 | + return '<span itemprop="addressCountry">'.$country.'</span>'; |
|
549 | 549 | } else { |
550 | 550 | return ''; |
551 | 551 | } |
@@ -559,8 +559,8 @@ discard block |
||
559 | 559 | * @param EEI_Address $obj_with_address |
560 | 560 | * @return string |
561 | 561 | */ |
562 | - public static function postalCode ( EEI_Address $obj_with_address = NULL ) { |
|
563 | - return $obj_with_address->zip() !== NULL && $obj_with_address->zip() !== '' ? '<span itemprop="postalCode">' . $obj_with_address->zip() . '</span>' : ''; |
|
562 | + public static function postalCode(EEI_Address $obj_with_address = NULL) { |
|
563 | + return $obj_with_address->zip() !== NULL && $obj_with_address->zip() !== '' ? '<span itemprop="postalCode">'.$obj_with_address->zip().'</span>' : ''; |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | /** |
@@ -571,8 +571,8 @@ discard block |
||
571 | 571 | * @param string $phone_nmbr |
572 | 572 | * @return string |
573 | 573 | */ |
574 | - public static function telephone ( $phone_nmbr = NULL ) { |
|
575 | - return $phone_nmbr !== NULL && $phone_nmbr !== '' ? '<span itemprop="telephone">' . $phone_nmbr . '</span>' : ''; |
|
574 | + public static function telephone($phone_nmbr = NULL) { |
|
575 | + return $phone_nmbr !== NULL && $phone_nmbr !== '' ? '<span itemprop="telephone">'.$phone_nmbr.'</span>' : ''; |
|
576 | 576 | } |
577 | 577 | |
578 | 578 | /** |
@@ -585,13 +585,13 @@ discard block |
||
585 | 585 | * @param array $attributes - array of additional link attributes in attribute_name => value pairs. ie: array( 'title' => 'click here', 'class' => 'link-class' ) |
586 | 586 | * @return string (link) |
587 | 587 | */ |
588 | - public static function url ( $url = NULL, $text = NULL, $attributes = array() ) { |
|
588 | + public static function url($url = NULL, $text = NULL, $attributes = array()) { |
|
589 | 589 | $atts = ''; |
590 | - foreach ( $attributes as $attribute => $value ) { |
|
591 | - $atts .= ' ' . $attribute . '="' . $value . '"'; |
|
590 | + foreach ($attributes as $attribute => $value) { |
|
591 | + $atts .= ' '.$attribute.'="'.$value.'"'; |
|
592 | 592 | } |
593 | 593 | $text = $text !== NULL && $text !== '' ? $text : $url; |
594 | - return $url !== NULL && $url !== '' ? '<a itemprop="url" href="' . $url . '"' . $atts . '>' . $text . '</a>' : ''; |
|
594 | + return $url !== NULL && $url !== '' ? '<a itemprop="url" href="'.$url.'"'.$atts.'>'.$text.'</a>' : ''; |
|
595 | 595 | } |
596 | 596 | |
597 | 597 | |
@@ -631,18 +631,18 @@ discard block |
||
631 | 631 | * @param EE_Country | string $country |
632 | 632 | * @return EE_Generic_Address |
633 | 633 | */ |
634 | - public function __construct( $address, $address2, $city, $state, $zip, $country ) { |
|
634 | + public function __construct($address, $address2, $city, $state, $zip, $country) { |
|
635 | 635 | $this->_address = $address; |
636 | 636 | $this->_address2 = $address2; |
637 | 637 | $this->_city = $city; |
638 | - if ( $state instanceof EE_State ) { |
|
638 | + if ($state instanceof EE_State) { |
|
639 | 639 | $this->_state_obj = $state; |
640 | 640 | } else { |
641 | 641 | $this->_state_ID = $state; |
642 | 642 | $this->_state_obj = $this->_get_state_obj(); |
643 | 643 | } |
644 | 644 | $this->_zip = $zip; |
645 | - if ( $country instanceof EE_Country ) { |
|
645 | + if ($country instanceof EE_Country) { |
|
646 | 646 | $this->_country_obj = $country; |
647 | 647 | } else { |
648 | 648 | $this->_country_ID = $country; |
@@ -683,7 +683,7 @@ discard block |
||
683 | 683 | * @return \EE_State |
684 | 684 | */ |
685 | 685 | private function _get_state_obj() { |
686 | - return $this->_state_obj instanceof EE_State ? $this->_state_obj : EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( $this->_state_ID ); |
|
686 | + return $this->_state_obj instanceof EE_State ? $this->_state_obj : EE_Registry::instance()->load_model('State')->get_one_by_ID($this->_state_ID); |
|
687 | 687 | } |
688 | 688 | |
689 | 689 | |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | * @return string |
702 | 702 | */ |
703 | 703 | public function state_abbrev() { |
704 | - return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : __( 'Unknown', 'event_espresso' ); |
|
704 | + return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : __('Unknown', 'event_espresso'); |
|
705 | 705 | } |
706 | 706 | |
707 | 707 | |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | * @return string |
711 | 711 | */ |
712 | 712 | public function state_name() { |
713 | - return $this->state_obj() instanceof EE_State ? $this->state_obj()->name() : __( 'Unknown', 'event_espresso' ); |
|
713 | + return $this->state_obj() instanceof EE_State ? $this->state_obj()->name() : __('Unknown', 'event_espresso'); |
|
714 | 714 | } |
715 | 715 | |
716 | 716 | |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | * @return string |
729 | 729 | */ |
730 | 730 | public function state() { |
731 | - if ( apply_filters( 'FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj() ) ) { |
|
731 | + if (apply_filters('FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj())) { |
|
732 | 732 | return $this->state_obj()->abbrev(); |
733 | 733 | } else { |
734 | 734 | return $this->state_name(); |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | * @return EE_Country |
742 | 742 | */ |
743 | 743 | private function _get_country_obj() { |
744 | - return $this->_country_obj instanceof EE_Country ? $this->_country_obj : EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $this->_country_ID ); |
|
744 | + return $this->_country_obj instanceof EE_Country ? $this->_country_obj : EE_Registry::instance()->load_model('Country')->get_one_by_ID($this->_country_ID); |
|
745 | 745 | } |
746 | 746 | |
747 | 747 | |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | * @return string |
760 | 760 | */ |
761 | 761 | public function country_name() { |
762 | - return $this->country_obj() instanceof EE_Country ? $this->country_obj()->name() : __( 'Unknown', 'event_espresso' ); |
|
762 | + return $this->country_obj() instanceof EE_Country ? $this->country_obj()->name() : __('Unknown', 'event_espresso'); |
|
763 | 763 | } |
764 | 764 | |
765 | 765 | |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | * @return string |
778 | 778 | */ |
779 | 779 | public function country() { |
780 | - if ( apply_filters( 'FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj() ) ) { |
|
780 | + if (apply_filters('FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj())) { |
|
781 | 781 | return $this->country_ID(); |
782 | 782 | } else { |
783 | 783 | return $this->country_name(); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * Loads the class file for a given class name. |
112 | 112 | * |
113 | 113 | * @param string $class The fully-qualified class name. |
114 | - * @return mixed The mapped file name on success, or boolean false on |
|
114 | + * @return string|false The mapped file name on success, or boolean false on |
|
115 | 115 | * failure. |
116 | 116 | */ |
117 | 117 | public function loadClass( $class ) { |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * |
145 | 145 | * @param string $prefix The namespace prefix. |
146 | 146 | * @param string $relative_class The relative class name. |
147 | - * @return mixed Boolean false if no mapped file can be loaded, or the |
|
147 | + * @return false|string Boolean false if no mapped file can be loaded, or the |
|
148 | 148 | * name of the mapped file that was loaded. |
149 | 149 | */ |
150 | 150 | protected function loadMappedFile( $prefix, $relative_class ) { |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @return void |
73 | 73 | */ |
74 | 74 | public function register() { |
75 | - spl_autoload_register( array( $this, 'loadClass' ) ); |
|
75 | + spl_autoload_register(array($this, 'loadClass')); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | |
@@ -88,20 +88,20 @@ discard block |
||
88 | 88 | * than last. |
89 | 89 | * @return void |
90 | 90 | */ |
91 | - public function addNamespace( $prefix, $base_dir, $prepend = false ) { |
|
91 | + public function addNamespace($prefix, $base_dir, $prepend = false) { |
|
92 | 92 | // normalize namespace prefix |
93 | - $prefix = trim( $prefix, '\\' ) . '\\'; |
|
93 | + $prefix = trim($prefix, '\\').'\\'; |
|
94 | 94 | // normalize the base directory with a trailing separator |
95 | - $base_dir = rtrim( $base_dir, DIRECTORY_SEPARATOR ) . '/'; |
|
95 | + $base_dir = rtrim($base_dir, DIRECTORY_SEPARATOR).'/'; |
|
96 | 96 | // initialize the namespace prefix array |
97 | - if ( isset( $this->prefixes[ $prefix ] ) === false ) { |
|
98 | - $this->prefixes[ $prefix ] = array(); |
|
97 | + if (isset($this->prefixes[$prefix]) === false) { |
|
98 | + $this->prefixes[$prefix] = array(); |
|
99 | 99 | } |
100 | 100 | // retain the base directory for the namespace prefix |
101 | - if ( $prepend ) { |
|
102 | - array_unshift( $this->prefixes[ $prefix ], $base_dir ); |
|
101 | + if ($prepend) { |
|
102 | + array_unshift($this->prefixes[$prefix], $base_dir); |
|
103 | 103 | } else { |
104 | - array_push( $this->prefixes[ $prefix ], $base_dir ); |
|
104 | + array_push($this->prefixes[$prefix], $base_dir); |
|
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
@@ -114,24 +114,24 @@ discard block |
||
114 | 114 | * @return mixed The mapped file name on success, or boolean false on |
115 | 115 | * failure. |
116 | 116 | */ |
117 | - public function loadClass( $class ) { |
|
117 | + public function loadClass($class) { |
|
118 | 118 | // the current namespace prefix |
119 | 119 | $prefix = $class; |
120 | 120 | // work backwards through the namespace names of the fully-qualified |
121 | 121 | // class name to find a mapped file name |
122 | - while ( false !== $pos = strrpos( $prefix, '\\' ) ) { |
|
122 | + while (false !== $pos = strrpos($prefix, '\\')) { |
|
123 | 123 | // retain the trailing namespace separator in the prefix |
124 | - $prefix = substr( $class, 0, $pos + 1 ); |
|
124 | + $prefix = substr($class, 0, $pos + 1); |
|
125 | 125 | // the rest is the relative class name |
126 | - $relative_class = substr( $class, $pos + 1 ); |
|
126 | + $relative_class = substr($class, $pos + 1); |
|
127 | 127 | // try to load a mapped file for the prefix and relative class |
128 | - $mapped_file = $this->loadMappedFile( $prefix, $relative_class ); |
|
129 | - if ( $mapped_file ) { |
|
128 | + $mapped_file = $this->loadMappedFile($prefix, $relative_class); |
|
129 | + if ($mapped_file) { |
|
130 | 130 | return $mapped_file; |
131 | 131 | } |
132 | 132 | // remove the trailing namespace separator for the next iteration |
133 | 133 | // of strrpos() |
134 | - $prefix = rtrim( $prefix, '\\' ); |
|
134 | + $prefix = rtrim($prefix, '\\'); |
|
135 | 135 | } |
136 | 136 | // never found a mapped file |
137 | 137 | return false; |
@@ -147,21 +147,21 @@ discard block |
||
147 | 147 | * @return mixed Boolean false if no mapped file can be loaded, or the |
148 | 148 | * name of the mapped file that was loaded. |
149 | 149 | */ |
150 | - protected function loadMappedFile( $prefix, $relative_class ) { |
|
150 | + protected function loadMappedFile($prefix, $relative_class) { |
|
151 | 151 | // are there any base directories for this namespace prefix? |
152 | - if ( isset( $this->prefixes[ $prefix ] ) === false ) { |
|
152 | + if (isset($this->prefixes[$prefix]) === false) { |
|
153 | 153 | return false; |
154 | 154 | } |
155 | 155 | // look through base directories for this namespace prefix |
156 | - foreach ( $this->prefixes[ $prefix ] as $base_dir ) { |
|
156 | + foreach ($this->prefixes[$prefix] as $base_dir) { |
|
157 | 157 | // replace the namespace prefix with the base directory, |
158 | 158 | // replace namespace separators with directory separators |
159 | 159 | // in the relative class name, append with .php |
160 | 160 | $file = $base_dir |
161 | - . str_replace( '\\', '/', $relative_class ) |
|
161 | + . str_replace('\\', '/', $relative_class) |
|
162 | 162 | . '.php'; |
163 | 163 | // if the mapped file exists, require it |
164 | - if ( $this->requireFile( $file ) ) { |
|
164 | + if ($this->requireFile($file)) { |
|
165 | 165 | // yes, we're done |
166 | 166 | return $file; |
167 | 167 | } |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | * @param string $file The file to require. |
179 | 179 | * @return bool True if the file exists, false if not. |
180 | 180 | */ |
181 | - protected function requireFile( $file ) { |
|
182 | - if ( file_exists( $file ) ) { |
|
181 | + protected function requireFile($file) { |
|
182 | + if (file_exists($file)) { |
|
183 | 183 | require $file; |
184 | 184 | return true; |
185 | 185 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -33,14 +33,14 @@ discard block |
||
33 | 33 | |
34 | 34 | private $_dtt; |
35 | 35 | |
36 | - public function __construct( $admin_page ) { |
|
36 | + public function __construct($admin_page) { |
|
37 | 37 | parent::__construct($admin_page); |
38 | - require_once( EE_HELPERS . 'EEH_DTT_Helper.helper.php' ); |
|
38 | + require_once(EE_HELPERS.'EEH_DTT_Helper.helper.php'); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | protected function _setup_data() { |
42 | 42 | $this->_data = $this->_admin_page->get_events($this->_per_page, $this->_current_page); |
43 | - $this->_all_data_count = $this->_admin_page->get_events(0,0, TRUE); |
|
43 | + $this->_all_data_count = $this->_admin_page->get_events(0, 0, TRUE); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | protected function _set_properties() { |
@@ -67,17 +67,17 @@ discard block |
||
67 | 67 | |
68 | 68 | |
69 | 69 | $this->_sortable_columns = array( |
70 | - 'id' => array( 'EVT_ID' => true ), |
|
71 | - 'name' => array( 'EVT_name' => false ), |
|
72 | - 'author' => array( 'EVT_wp_user' => false ), |
|
73 | - 'venue' => array( 'Venue.VNU_name' => false ), |
|
70 | + 'id' => array('EVT_ID' => true), |
|
71 | + 'name' => array('EVT_name' => false), |
|
72 | + 'author' => array('EVT_wp_user' => false), |
|
73 | + 'venue' => array('Venue.VNU_name' => false), |
|
74 | 74 | 'start_date_time' => array('Datetime.DTT_EVT_start' => false), |
75 | 75 | 'reg_begins' => array('Datetime.Ticket.TKT_start_date' => false), |
76 | 76 | ); |
77 | 77 | |
78 | 78 | $this->_primary_column = 'id'; |
79 | 79 | |
80 | - $this->_hidden_columns = array( 'author' ); |
|
80 | + $this->_hidden_columns = array('author'); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -92,18 +92,18 @@ discard block |
||
92 | 92 | protected function _add_view_counts() { |
93 | 93 | $this->_views['all']['count'] = $this->_admin_page->total_events(); |
94 | 94 | $this->_views['draft']['count'] = $this->_admin_page->total_events_draft(); |
95 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) { |
|
95 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) { |
|
96 | 96 | $this->_views['trash']['count'] = $this->_admin_page->total_trashed_events(); |
97 | 97 | } |
98 | 98 | } |
99 | 99 | |
100 | 100 | |
101 | 101 | |
102 | - protected function _get_row_class( $item ) { |
|
103 | - $class = parent::_get_row_class( $item ); |
|
102 | + protected function _get_row_class($item) { |
|
103 | + $class = parent::_get_row_class($item); |
|
104 | 104 | //add status class |
105 | - $class .= ' ee-status-strip event-status-' . $item->get_active_status(); |
|
106 | - if ( $this->_has_checkbox_column ) { |
|
105 | + $class .= ' ee-status-strip event-status-'.$item->get_active_status(); |
|
106 | + if ($this->_has_checkbox_column) { |
|
107 | 107 | $class .= ' has-checkbox-column'; |
108 | 108 | } |
109 | 109 | return $class; |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | |
112 | 112 | |
113 | 113 | |
114 | - public function column_status( EE_Event $item ) { |
|
115 | - return '<span class="ee-status-strip ee-status-strip-td event-status-' . $item->get_active_status() . '"></span>'; |
|
114 | + public function column_status(EE_Event $item) { |
|
115 | + return '<span class="ee-status-strip ee-status-strip-td event-status-'.$item->get_active_status().'"></span>'; |
|
116 | 116 | }/**/ |
117 | 117 | |
118 | 118 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | public function column_id($item) { |
134 | 134 | $content = $item->ID(); |
135 | - $content .= ' <span class="show-on-mobile-view-only">' . $item->name() . '</span>'; |
|
135 | + $content .= ' <span class="show-on-mobile-view-only">'.$item->name().'</span>'; |
|
136 | 136 | return $content; |
137 | 137 | } |
138 | 138 | |
@@ -143,11 +143,11 @@ discard block |
||
143 | 143 | 'action' => 'edit', |
144 | 144 | 'post' => $item->ID() |
145 | 145 | ); |
146 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EVENTS_ADMIN_URL ); |
|
147 | - $actions = $this->_column_name_action_setup( $item ); |
|
146 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
147 | + $actions = $this->_column_name_action_setup($item); |
|
148 | 148 | $status = ''; //$item->status() !== 'publish' ? ' (' . $item->status() . ')' : ''; |
149 | - $content = '<strong><a class="row-title" href="' . $edit_link . '">' . $item->name() . '</a></strong>' . $status; |
|
150 | - $content .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->get_active_status(), false, 'sentence' ) . '</span>'; |
|
149 | + $content = '<strong><a class="row-title" href="'.$edit_link.'">'.$item->name().'</a></strong>'.$status; |
|
150 | + $content .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->get_active_status(), false, 'sentence').'</span>'; |
|
151 | 151 | $content .= $this->row_actions($actions); |
152 | 152 | return $content; |
153 | 153 | |
@@ -164,72 +164,72 @@ discard block |
||
164 | 164 | * |
165 | 165 | * @return array array of actions |
166 | 166 | */ |
167 | - protected function _column_name_action_setup( EE_Event $item ) { |
|
167 | + protected function _column_name_action_setup(EE_Event $item) { |
|
168 | 168 | //todo: remove when attendees is active |
169 | - if ( !defined('REG_ADMIN_URL') ) |
|
169 | + if ( ! defined('REG_ADMIN_URL')) |
|
170 | 170 | define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
171 | 171 | |
172 | 172 | $actions = array(); |
173 | 173 | |
174 | - if ( EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $item->ID() ) ) { |
|
174 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $item->ID())) { |
|
175 | 175 | $edit_query_args = array( |
176 | 176 | 'action' => 'edit', |
177 | 177 | 'post' => $item->ID() |
178 | 178 | ); |
179 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EVENTS_ADMIN_URL ); |
|
180 | - $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr__('Edit Event', 'event_espresso') . '">' . __('Edit', 'event_espresso') . '</a>'; |
|
179 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
180 | + $actions['edit'] = '<a href="'.$edit_link.'" title="'.esc_attr__('Edit Event', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>'; |
|
181 | 181 | |
182 | 182 | } |
183 | 183 | |
184 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ) { |
|
184 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID())) { |
|
185 | 185 | $attendees_query_args = array( |
186 | 186 | 'action' => 'default', |
187 | 187 | 'event_id' => $item->ID() |
188 | 188 | ); |
189 | - $attendees_link = EE_Admin_Page::add_query_args_and_nonce( $attendees_query_args, REG_ADMIN_URL ); |
|
190 | - $actions['attendees'] = '<a href="' . $attendees_link . '" title="' . esc_attr__('View Registrations', 'event_espresso') . '">' . __('Registrations', 'event_espresso') . '</a>'; |
|
189 | + $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
190 | + $actions['attendees'] = '<a href="'.$attendees_link.'" title="'.esc_attr__('View Registrations', 'event_espresso').'">'.__('Registrations', 'event_espresso').'</a>'; |
|
191 | 191 | } |
192 | 192 | |
193 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_trash_event', $item->ID() ) ) { |
|
193 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_trash_event', $item->ID())) { |
|
194 | 194 | $trash_event_query_args = array( |
195 | 195 | 'action' => 'trash_event', |
196 | 196 | 'EVT_ID' => $item->ID() |
197 | 197 | ); |
198 | - $trash_event_link = EE_Admin_Page::add_query_args_and_nonce( $trash_event_query_args, EVENTS_ADMIN_URL ); |
|
198 | + $trash_event_link = EE_Admin_Page::add_query_args_and_nonce($trash_event_query_args, EVENTS_ADMIN_URL); |
|
199 | 199 | } |
200 | 200 | |
201 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_restore_event', $item->ID() ) ) { |
|
201 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_restore_event', $item->ID())) { |
|
202 | 202 | $restore_event_query_args = array( |
203 | 203 | 'action' => 'restore_event', |
204 | 204 | 'EVT_ID' => $item->ID() |
205 | 205 | ); |
206 | - $restore_event_link = EE_Admin_Page::add_query_args_and_nonce( $restore_event_query_args, EVENTS_ADMIN_URL ); |
|
206 | + $restore_event_link = EE_Admin_Page::add_query_args_and_nonce($restore_event_query_args, EVENTS_ADMIN_URL); |
|
207 | 207 | } |
208 | 208 | |
209 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_delete_event', $item->ID() ) ) { |
|
209 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_delete_event', $item->ID())) { |
|
210 | 210 | $delete_event_query_args = array( |
211 | 211 | 'action' => 'delete_event', |
212 | 212 | 'EVT_ID' => $item->ID() |
213 | 213 | ); |
214 | - $delete_event_link = EE_Admin_Page::add_query_args_and_nonce( $delete_event_query_args, EVENTS_ADMIN_URL ); |
|
214 | + $delete_event_link = EE_Admin_Page::add_query_args_and_nonce($delete_event_query_args, EVENTS_ADMIN_URL); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | $view_link = get_permalink($item->ID()); |
218 | 218 | |
219 | - $actions['view'] = '<a href="' . $view_link . '" title="' . esc_attr__('View Event', 'event_espresso') . '">' . __('View', 'event_espresso') . '</a>'; |
|
219 | + $actions['view'] = '<a href="'.$view_link.'" title="'.esc_attr__('View Event', 'event_espresso').'">'.__('View', 'event_espresso').'</a>'; |
|
220 | 220 | |
221 | - switch ( $item->get( 'status' ) ) { |
|
221 | + switch ($item->get('status')) { |
|
222 | 222 | case 'trash' : |
223 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_restore_event', $item->ID() ) ) { |
|
224 | - $actions['restore_from_trash'] = '<a href="' . $restore_event_link . '" title="' . esc_attr__('Restore from Trash', 'event_espresso') . '">' . __('Restore from Trash', 'event_espresso') . '</a>'; |
|
223 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_restore_event', $item->ID())) { |
|
224 | + $actions['restore_from_trash'] = '<a href="'.$restore_event_link.'" title="'.esc_attr__('Restore from Trash', 'event_espresso').'">'.__('Restore from Trash', 'event_espresso').'</a>'; |
|
225 | 225 | } |
226 | - if ( $item->count_related('Registration') === 0 && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_delete_event', $item->ID() ) ) { |
|
227 | - $actions['delete'] = '<a href="' . $delete_event_link . '" title="' . esc_attr__('Delete Permanently', 'event_espresso') . '">' . __('Delete Permanently', 'event_espresso') . '</a>'; |
|
226 | + if ($item->count_related('Registration') === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_delete_event', $item->ID())) { |
|
227 | + $actions['delete'] = '<a href="'.$delete_event_link.'" title="'.esc_attr__('Delete Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>'; |
|
228 | 228 | } |
229 | 229 | break; |
230 | 230 | default : |
231 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_trash_event', $item->ID() ) ) { |
|
232 | - $actions['move to trash'] = '<a href="' . $trash_event_link . '" title="' . esc_attr__('Trash Event', 'event_espresso') . '">' . __('Trash', 'event_espresso') . '</a>'; |
|
231 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_trash_event', $item->ID())) { |
|
232 | + $actions['move to trash'] = '<a href="'.$trash_event_link.'" title="'.esc_attr__('Trash Event', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>'; |
|
233 | 233 | } |
234 | 234 | } |
235 | 235 | return $actions; |
@@ -238,34 +238,34 @@ discard block |
||
238 | 238 | |
239 | 239 | |
240 | 240 | |
241 | - public function column_author( EE_Event $item ) { |
|
241 | + public function column_author(EE_Event $item) { |
|
242 | 242 | //user author info |
243 | - $event_author = get_userdata( $item->wp_user() ); |
|
244 | - $gravatar = get_avatar( $item->wp_user(), '15' ); |
|
243 | + $event_author = get_userdata($item->wp_user()); |
|
244 | + $gravatar = get_avatar($item->wp_user(), '15'); |
|
245 | 245 | //filter link |
246 | 246 | $query_args = array( |
247 | 247 | 'action' => 'default', |
248 | 248 | 'EVT_wp_user' => $item->wp_user() |
249 | 249 | ); |
250 | - $filter_url = EE_Admin_Page::add_query_args_and_nonce( $query_args, EVENTS_ADMIN_URL ); |
|
251 | - return $gravatar . ' <a href="' . $filter_url . '" title="' . esc_attr__('Click to filter events by this author.', 'event_espresso') . '">' . $event_author->display_name . '</a>'; |
|
250 | + $filter_url = EE_Admin_Page::add_query_args_and_nonce($query_args, EVENTS_ADMIN_URL); |
|
251 | + return $gravatar.' <a href="'.$filter_url.'" title="'.esc_attr__('Click to filter events by this author.', 'event_espresso').'">'.$event_author->display_name.'</a>'; |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | |
255 | 255 | |
256 | 256 | |
257 | 257 | public function column_venue($item) { |
258 | - $venue = $item->get_first_related( 'Venue' ); |
|
259 | - return !empty( $venue ) ? $venue->name() : ''; |
|
258 | + $venue = $item->get_first_related('Venue'); |
|
259 | + return ! empty($venue) ? $venue->name() : ''; |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | |
263 | 263 | |
264 | 264 | |
265 | 265 | public function column_start_date_time($item) { |
266 | - echo !empty( $this->_dtt ) ? $this->_dtt->get_i18n_datetime('DTT_EVT_start') : __('No Date was saved for this Event', 'event_espresso'); |
|
266 | + echo ! empty($this->_dtt) ? $this->_dtt->get_i18n_datetime('DTT_EVT_start') : __('No Date was saved for this Event', 'event_espresso'); |
|
267 | 267 | //display in user's timezone? |
268 | - echo !empty( $this->_dtt ) ? $this->_dtt->display_in_my_timezone('DTT_EVT_start', 'get_i18n_datetime', '', 'My Timezone: ' ) : ''; |
|
268 | + echo ! empty($this->_dtt) ? $this->_dtt->display_in_my_timezone('DTT_EVT_start', 'get_i18n_datetime', '', 'My Timezone: ') : ''; |
|
269 | 269 | |
270 | 270 | } |
271 | 271 | |
@@ -274,9 +274,9 @@ discard block |
||
274 | 274 | |
275 | 275 | public function column_reg_begins($item) { |
276 | 276 | $reg_start = $item->get_ticket_with_earliest_start_time(); |
277 | - echo !empty( $reg_start ) ? $reg_start->get_i18n_datetime('TKT_start_date') : __('No Tickets have been setup for this Event', 'event_espresso'); |
|
277 | + echo ! empty($reg_start) ? $reg_start->get_i18n_datetime('TKT_start_date') : __('No Tickets have been setup for this Event', 'event_espresso'); |
|
278 | 278 | //display in user's timezone? |
279 | - echo !empty( $reg_start ) ? $reg_start->display_in_my_timezone('TKT_start_date', 'get_i18n_datetime', '', 'My Timezone: ' ) : '';/**/ |
|
279 | + echo ! empty($reg_start) ? $reg_start->display_in_my_timezone('TKT_start_date', 'get_i18n_datetime', '', 'My Timezone: ') : ''; /**/ |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | |
@@ -294,51 +294,51 @@ discard block |
||
294 | 294 | 'action' => 'default', |
295 | 295 | 'event_id' => $item->ID() |
296 | 296 | ); |
297 | - $attendees_link = EE_Admin_Page::add_query_args_and_nonce( $attendees_query_args, REG_ADMIN_URL ); |
|
298 | - $registered_attendees = EEM_Registration::instance()->get_event_registration_count( $item->ID() ); |
|
299 | - return EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '<a href="' . $attendees_link . '">' . $registered_attendees . '</a>' : $registered_attendees; |
|
297 | + $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
298 | + $registered_attendees = EEM_Registration::instance()->get_event_registration_count($item->ID()); |
|
299 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '<a href="'.$attendees_link.'">'.$registered_attendees.'</a>' : $registered_attendees; |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | |
303 | 303 | |
304 | 304 | public function column_tkts_sold($item) { |
305 | - return EEM_Ticket::instance()->sum(array( array('Datetime.EVT_ID' => $item->ID() )), 'TKT_sold' ); |
|
305 | + return EEM_Ticket::instance()->sum(array(array('Datetime.EVT_ID' => $item->ID())), 'TKT_sold'); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | |
309 | 309 | |
310 | 310 | public function column_actions($item) { |
311 | 311 | //todo: remove when attendees is active |
312 | - if ( !defined('REG_ADMIN_URL') ) |
|
312 | + if ( ! defined('REG_ADMIN_URL')) |
|
313 | 313 | define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
314 | 314 | $actionlinks = array(); |
315 | 315 | |
316 | 316 | $view_link = get_permalink($item->ID()); |
317 | 317 | |
318 | - $actionlinks[] = '<a href="' . $view_link . '" title="' . esc_attr__('View Event', 'event_espresso') . '" target="_blank">'; |
|
318 | + $actionlinks[] = '<a href="'.$view_link.'" title="'.esc_attr__('View Event', 'event_espresso').'" target="_blank">'; |
|
319 | 319 | $actionlinks[] = '<div class="dashicons dashicons-search"></div></a>'; |
320 | 320 | |
321 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $item->ID() ) ) { |
|
321 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $item->ID())) { |
|
322 | 322 | $edit_query_args = array( |
323 | 323 | 'action' => 'edit', |
324 | 324 | 'post' => $item->ID() |
325 | 325 | ); |
326 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EVENTS_ADMIN_URL ); |
|
327 | - $actionlinks[] = '<a href="' . $edit_link . '" title="' . esc_attr__('Edit Event', 'event_espresso') . '"><div class="ee-icon ee-icon-calendar-edit"></div></a>'; |
|
326 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
327 | + $actionlinks[] = '<a href="'.$edit_link.'" title="'.esc_attr__('Edit Event', 'event_espresso').'"><div class="ee-icon ee-icon-calendar-edit"></div></a>'; |
|
328 | 328 | } |
329 | 329 | |
330 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ) { |
|
330 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID())) { |
|
331 | 331 | $attendees_query_args = array( |
332 | 332 | 'action' => 'default', |
333 | 333 | 'event_id' => $item->ID() |
334 | 334 | ); |
335 | - $attendees_link = EE_Admin_Page::add_query_args_and_nonce( $attendees_query_args, REG_ADMIN_URL ); |
|
336 | - $actionlinks[] = '<a href="' . $attendees_link . '" title="' . esc_attr__('View Registrants', 'event_espresso') . '"><div class="dashicons dashicons-groups"></div></a>'; |
|
335 | + $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
336 | + $actionlinks[] = '<a href="'.$attendees_link.'" title="'.esc_attr__('View Registrants', 'event_espresso').'"><div class="dashicons dashicons-groups"></div></a>'; |
|
337 | 337 | } |
338 | 338 | |
339 | - $actionlinks = apply_filters( 'FHEE__Events_Admin_List_Table__column_actions__action_links', $actionlinks, $item ); |
|
339 | + $actionlinks = apply_filters('FHEE__Events_Admin_List_Table__column_actions__action_links', $actionlinks, $item); |
|
340 | 340 | |
341 | - return $this->_action_string( implode( "\n\t", $actionlinks ), $item, 'div' ); |
|
341 | + return $this->_action_string(implode("\n\t", $actionlinks), $item, 'div'); |
|
342 | 342 | } |
343 | 343 | |
344 | 344 |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -1199,7 +1200,9 @@ discard block |
||
1199 | 1200 | |
1200 | 1201 | |
1201 | 1202 | //if no postid then get out cause we need it for stuff in here |
1202 | - if ( empty( $postid ) ) return; |
|
1203 | + if ( empty( $postid ) ) { |
|
1204 | + return; |
|
1205 | + } |
|
1203 | 1206 | |
1204 | 1207 | |
1205 | 1208 | //handle datetime saves |
@@ -1440,10 +1443,11 @@ discard block |
||
1440 | 1443 | //get the earliest datetime (if present); |
1441 | 1444 | $earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL; |
1442 | 1445 | |
1443 | - if ( !empty( $earliest_dtt ) ) |
|
1444 | - $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a'); |
|
1445 | - else |
|
1446 | - $template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) ); |
|
1446 | + if ( !empty( $earliest_dtt ) ) { |
|
1447 | + $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a'); |
|
1448 | + } else { |
|
1449 | + $template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) ); |
|
1450 | + } |
|
1447 | 1451 | } |
1448 | 1452 | |
1449 | 1453 | $template_args = array_merge( $template_args, $price_args ); |
@@ -1674,8 +1678,9 @@ discard block |
||
1674 | 1678 | } |
1675 | 1679 | $action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
1676 | 1680 | |
1677 | - if ( $redirect_after ) |
|
1678 | - $this->_redirect_after_action($success, 'Event', $action, array('action' => 'default')); |
|
1681 | + if ( $redirect_after ) { |
|
1682 | + $this->_redirect_after_action($success, 'Event', $action, array('action' => 'default')); |
|
1683 | + } |
|
1679 | 1684 | } |
1680 | 1685 | |
1681 | 1686 | /** |
@@ -1800,8 +1805,9 @@ discard block |
||
1800 | 1805 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1801 | 1806 | } |
1802 | 1807 | |
1803 | - if ( $redirect_after ) |
|
1804 | - $this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash')); |
|
1808 | + if ( $redirect_after ) { |
|
1809 | + $this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash')); |
|
1810 | + } |
|
1805 | 1811 | } |
1806 | 1812 | |
1807 | 1813 | /** |
@@ -2033,8 +2039,10 @@ discard block |
||
2033 | 2039 | * @return void |
2034 | 2040 | */ |
2035 | 2041 | private function _set_category_object() { |
2036 | - if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) |
|
2037 | - return; //already have the category object so get out. |
|
2042 | + if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) { |
|
2043 | + return; |
|
2044 | + } |
|
2045 | + //already have the category object so get out. |
|
2038 | 2046 | |
2039 | 2047 | //set default category object |
2040 | 2048 | $this->_set_empty_category_object(); |
@@ -1345,7 +1345,7 @@ |
||
1345 | 1345 | * This just returns whatever is set as the _event object property |
1346 | 1346 | * |
1347 | 1347 | * //todo this will become obsolete once the models are in place |
1348 | - * @return object |
|
1348 | + * @return EE_CPT_Base |
|
1349 | 1349 | */ |
1350 | 1350 | public function get_event_object() { |
1351 | 1351 | return $this->_cpt_model_obj; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | 'espresso_events' => 'edit' |
68 | 68 | ); |
69 | 69 | |
70 | - add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array( $this, 'verify_event_edit' ) ); |
|
70 | + add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array($this, 'verify_event_edit')); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | protected function _ajax_hooks() { |
@@ -93,20 +93,20 @@ discard block |
||
93 | 93 | 'edit' => __('Update Event', 'event_espresso'), |
94 | 94 | 'add_category' => __('Save New Category', 'event_espresso'), |
95 | 95 | 'edit_category' => __('Update Category', 'event_espresso'), |
96 | - 'template_settings' => __( 'Update Settings', 'event_espresso' ) |
|
96 | + 'template_settings' => __('Update Settings', 'event_espresso') |
|
97 | 97 | ) |
98 | 98 | ); |
99 | 99 | } |
100 | 100 | |
101 | 101 | protected function _set_page_routes() { |
102 | 102 | //load formatter helper |
103 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
103 | + EE_Registry::instance()->load_helper('Formatter'); |
|
104 | 104 | //load field generator helper |
105 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
105 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
106 | 106 | |
107 | 107 | //is there a evt_id in the request? |
108 | - $evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0; |
|
109 | - $evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id; |
|
108 | + $evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0; |
|
109 | + $evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id; |
|
110 | 110 | |
111 | 111 | |
112 | 112 | $this->_page_routes = array( |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | 'help_tour' => array( |
321 | 321 | 'Event_Editor_Help_Tour' |
322 | 322 | ), |
323 | - 'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ), |
|
323 | + 'qtips' => array('EE_Event_Editor_Decaf_Tips'), |
|
324 | 324 | 'require_nonce' => FALSE |
325 | 325 | ), |
326 | 326 | 'edit' => array( |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | 'help_tour' => array( |
377 | 377 | 'Event_Edit_Help_Tour' |
378 | 378 | ), |
379 | - 'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ), |
|
379 | + 'qtips' => array('EE_Event_Editor_Decaf_Tips'), |
|
380 | 380 | 'require_nonce' => FALSE |
381 | 381 | ), |
382 | 382 | 'default_event_settings' => array( |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | 'filename' => 'events_default_settings_status' |
399 | 399 | ) |
400 | 400 | ), |
401 | - 'help_tour' => array( 'Event_Default_Settings_Help_Tour'), |
|
401 | + 'help_tour' => array('Event_Default_Settings_Help_Tour'), |
|
402 | 402 | 'require_nonce' => FALSE |
403 | 403 | ), |
404 | 404 | //template settings |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | 'filename' => 'general_settings_templates' |
415 | 415 | ) |
416 | 416 | ), |
417 | - 'help_tour' => array( 'Templates_Help_Tour' ), |
|
417 | + 'help_tour' => array('Templates_Help_Tour'), |
|
418 | 418 | 'require_nonce' => FALSE |
419 | 419 | ), |
420 | 420 | //event category stuff |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | 'label' => __('Edit Category', 'event_espresso'), |
439 | 439 | 'order' => 15, |
440 | 440 | 'persistent' => FALSE, |
441 | - 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
441 | + 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url |
|
442 | 442 | ), |
443 | 443 | 'help_tabs' => array( |
444 | 444 | 'edit_category_help_tab' => array( |
@@ -508,14 +508,14 @@ discard block |
||
508 | 508 | |
509 | 509 | public function load_scripts_styles() { |
510 | 510 | |
511 | - wp_register_style('events-admin-css', EVENTS_ASSETS_URL . 'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
512 | - wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
511 | + wp_register_style('events-admin-css', EVENTS_ASSETS_URL.'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
512 | + wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
513 | 513 | wp_enqueue_style('events-admin-css'); |
514 | 514 | wp_enqueue_style('ee-cat-admin'); |
515 | 515 | //todo note: we also need to load_scripts_styles per view (i.e. default/view_report/event_details |
516 | 516 | //registers for all views |
517 | 517 | //scripts |
518 | - wp_register_script('event_editor_js', EVENTS_ASSETS_URL . 'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE); |
|
518 | + wp_register_script('event_editor_js', EVENTS_ASSETS_URL.'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE); |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | /** |
@@ -533,11 +533,11 @@ discard block |
||
533 | 533 | public function load_scripts_styles_edit() { |
534 | 534 | //styles |
535 | 535 | wp_enqueue_style('espresso-ui-theme'); |
536 | - wp_register_style('event-editor-css', EVENTS_ASSETS_URL . 'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
536 | + wp_register_style('event-editor-css', EVENTS_ASSETS_URL.'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
537 | 537 | wp_enqueue_style('event-editor-css'); |
538 | 538 | |
539 | 539 | //scripts |
540 | - wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL . 'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION ); |
|
540 | + wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL.'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION); |
|
541 | 541 | wp_enqueue_script('event-datetime-metabox'); |
542 | 542 | |
543 | 543 | } |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | |
573 | 573 | |
574 | 574 | public function admin_init() { |
575 | - EE_Registry::$i18n_js_strings[ 'image_confirm' ] = __( 'Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso' ); |
|
575 | + EE_Registry::$i18n_js_strings['image_confirm'] = __('Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso'); |
|
576 | 576 | } |
577 | 577 | |
578 | 578 | |
@@ -593,45 +593,45 @@ discard block |
||
593 | 593 | */ |
594 | 594 | public function verify_event_edit($event = NULL) { |
595 | 595 | // no event? |
596 | - if ( empty( $event )) { |
|
596 | + if (empty($event)) { |
|
597 | 597 | // set event |
598 | 598 | $event = $this->_cpt_model_obj; |
599 | 599 | } |
600 | 600 | // STILL no event? |
601 | - if ( empty ( $event )) { |
|
601 | + if (empty ($event)) { |
|
602 | 602 | return; |
603 | 603 | } |
604 | 604 | // first check if event is active. |
605 | - if ( $event->is_expired() || $event->is_inactive() || $event->status() == EEM_Event::cancelled || $event->status() == EEM_Event::postponed ) { |
|
605 | + if ($event->is_expired() || $event->is_inactive() || $event->status() == EEM_Event::cancelled || $event->status() == EEM_Event::postponed) { |
|
606 | 606 | return; |
607 | 607 | } |
608 | 608 | $orig_status = $event->status(); |
609 | 609 | //made it here so it IS active... next check that any of the tickets are sold. |
610 | - if ( $event->is_sold_out( true ) ) { |
|
611 | - if ( $event->status() !== $orig_status && $orig_status !== EEM_Event::sold_out ) { |
|
610 | + if ($event->is_sold_out(true)) { |
|
611 | + if ($event->status() !== $orig_status && $orig_status !== EEM_Event::sold_out) { |
|
612 | 612 | EE_Error::add_attention( |
613 | 613 | sprintf( |
614 | - __( 'Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event. However, this change is not permanent until you update the event. You can change the status back to something else before updating if you wish.', 'event_espresso' ), |
|
615 | - EEH_Template::pretty_status( EEM_Event::sold_out, FALSE, 'sentence' ) |
|
614 | + __('Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event. However, this change is not permanent until you update the event. You can change the status back to something else before updating if you wish.', 'event_espresso'), |
|
615 | + EEH_Template::pretty_status(EEM_Event::sold_out, FALSE, 'sentence') |
|
616 | 616 | ) |
617 | 617 | ); |
618 | 618 | } |
619 | 619 | return; |
620 | - } else if ( $orig_status === EEM_Event::sold_out ) { |
|
620 | + } else if ($orig_status === EEM_Event::sold_out) { |
|
621 | 621 | EE_Error::add_attention( |
622 | 622 | sprintf( |
623 | - __( 'Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets. However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.', |
|
624 | - 'event_espresso' ), |
|
625 | - EEH_Template::pretty_status( $event->status(), false, 'sentence' ) |
|
623 | + __('Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets. However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.', |
|
624 | + 'event_espresso'), |
|
625 | + EEH_Template::pretty_status($event->status(), false, 'sentence') |
|
626 | 626 | ) |
627 | 627 | ); |
628 | 628 | } |
629 | 629 | //now we need to determine if the event has any tickets on sale. If not then we dont' show the error |
630 | - if ( ! $event->tickets_on_sale() ) { |
|
630 | + if ( ! $event->tickets_on_sale()) { |
|
631 | 631 | return; |
632 | 632 | } |
633 | 633 | //made it here so show warning |
634 | - EE_Error::add_attention( $this->_edit_event_warning() ); |
|
634 | + EE_Error::add_attention($this->_edit_event_warning()); |
|
635 | 635 | } |
636 | 636 | |
637 | 637 | |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | ), |
672 | 672 | ); |
673 | 673 | |
674 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) { |
|
674 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) { |
|
675 | 675 | $this->_views['trash'] = array( |
676 | 676 | 'slug' => 'trash', |
677 | 677 | 'label' => __('Trash', 'event_espresso'), |
@@ -701,39 +701,39 @@ discard block |
||
701 | 701 | 'desc' => __('View Registrations for Event', 'event_espresso') |
702 | 702 | ) |
703 | 703 | ); |
704 | - $items = apply_filters( 'FHEE__Events_Admin_Page___event_legend_items__items', $items ); |
|
704 | + $items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items); |
|
705 | 705 | $statuses = array( |
706 | 706 | 'sold_out_status' => array( |
707 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out, |
|
708 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::sold_out, FALSE, 'sentence' ) |
|
707 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::sold_out, |
|
708 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::sold_out, FALSE, 'sentence') |
|
709 | 709 | ), |
710 | 710 | 'active_status' => array( |
711 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active, |
|
712 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::active, FALSE, 'sentence' ) |
|
711 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::active, |
|
712 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::active, FALSE, 'sentence') |
|
713 | 713 | ), |
714 | 714 | 'upcoming_status' => array( |
715 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming, |
|
716 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::upcoming, FALSE, 'sentence' ) |
|
715 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::upcoming, |
|
716 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::upcoming, FALSE, 'sentence') |
|
717 | 717 | ), |
718 | 718 | 'postponed_status' => array( |
719 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed, |
|
720 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::postponed, FALSE, 'sentence' ) |
|
719 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::postponed, |
|
720 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::postponed, FALSE, 'sentence') |
|
721 | 721 | ), |
722 | 722 | 'cancelled_status' => array( |
723 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled, |
|
724 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::cancelled, FALSE, 'sentence' ) |
|
723 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::cancelled, |
|
724 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::cancelled, FALSE, 'sentence') |
|
725 | 725 | ), |
726 | 726 | 'expired_status' => array( |
727 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired, |
|
728 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::expired, FALSE, 'sentence' ) |
|
727 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::expired, |
|
728 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::expired, FALSE, 'sentence') |
|
729 | 729 | ), |
730 | 730 | 'inactive_status' => array( |
731 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive, |
|
732 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::inactive, FALSE, 'sentence' ) |
|
731 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::inactive, |
|
732 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::inactive, FALSE, 'sentence') |
|
733 | 733 | ) |
734 | 734 | ); |
735 | - $statuses = apply_filters( 'FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses ); |
|
736 | - return array_merge( $items, $statuses ); |
|
735 | + $statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses); |
|
736 | + return array_merge($items, $statuses); |
|
737 | 737 | } |
738 | 738 | |
739 | 739 | |
@@ -745,8 +745,8 @@ discard block |
||
745 | 745 | * @return EEM_Event |
746 | 746 | */ |
747 | 747 | private function _event_model() { |
748 | - if ( ! $this->_event_model instanceof EEM_Event ) { |
|
749 | - $this->_event_model = EE_Registry::instance()->load_model( 'Event' ); |
|
748 | + if ( ! $this->_event_model instanceof EEM_Event) { |
|
749 | + $this->_event_model = EE_Registry::instance()->load_model('Event'); |
|
750 | 750 | } |
751 | 751 | return $this->_event_model; |
752 | 752 | } |
@@ -765,12 +765,12 @@ discard block |
||
765 | 765 | * @param string $new_slug what the slug is |
766 | 766 | * @return string The new html string for the permalink area |
767 | 767 | */ |
768 | - public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) { |
|
768 | + public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) { |
|
769 | 769 | //make sure this is only when editing |
770 | - if ( !empty( $id ) ) { |
|
771 | - $post = get_post( $id ); |
|
772 | - $return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#" tabindex="-1">' . __('Shortcode', 'event_espresso') . '</a> '; |
|
773 | - $return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=\'' . $post->ID . '\']"">'; |
|
770 | + if ( ! empty($id)) { |
|
771 | + $post = get_post($id); |
|
772 | + $return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#" tabindex="-1">'.__('Shortcode', 'event_espresso').'</a> '; |
|
773 | + $return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=\''.$post->ID.'\']"">'; |
|
774 | 774 | } |
775 | 775 | return $return; |
776 | 776 | } |
@@ -786,8 +786,8 @@ discard block |
||
786 | 786 | * @return string html for generated table |
787 | 787 | */ |
788 | 788 | protected function _events_overview_list_table() { |
789 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
790 | - $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button' ) . |
|
789 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
790 | + $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button'). |
|
791 | 791 | $this->_display_legend($this->_event_legend_items()); |
792 | 792 | $this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
793 | 793 | $this->display_admin_list_table_page_with_no_sidebar(); |
@@ -805,51 +805,51 @@ discard block |
||
805 | 805 | |
806 | 806 | |
807 | 807 | |
808 | - protected function _insert_update_cpt_item( $post_id, $post ) { |
|
808 | + protected function _insert_update_cpt_item($post_id, $post) { |
|
809 | 809 | |
810 | - if ( $post instanceof WP_Post && $post->post_type !== 'espresso_events' ) { |
|
810 | + if ($post instanceof WP_Post && $post->post_type !== 'espresso_events') { |
|
811 | 811 | //getout we're not processing an event save. |
812 | 812 | return; |
813 | 813 | } |
814 | 814 | |
815 | 815 | $event_values = array( |
816 | - 'EVT_display_desc' => !empty( $this->_req_data['display_desc'] ) ? 1 : 0, |
|
817 | - 'EVT_display_ticket_selector' => !empty( $this->_req_data['display_ticket_selector'] ) ? 1 : 0, |
|
816 | + 'EVT_display_desc' => ! empty($this->_req_data['display_desc']) ? 1 : 0, |
|
817 | + 'EVT_display_ticket_selector' => ! empty($this->_req_data['display_ticket_selector']) ? 1 : 0, |
|
818 | 818 | 'EVT_additional_limit' => min( |
819 | - apply_filters( 'FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255 ), |
|
820 | - !empty( $this->_req_data['additional_limit'] ) ? $this->_req_data['additional_limit'] : NULL ), |
|
821 | - 'EVT_default_registration_status' => !empty( $this->_req_data['EVT_default_registration_status'] ) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID, |
|
822 | - 'EVT_member_only' => !empty( $this->_req_data['member_only'] ) ? 1 : 0, |
|
823 | - 'EVT_allow_overflow' => !empty( $this->_req_data['EVT_allow_overflow'] ) ? 1 : 0, |
|
824 | - 'EVT_timezone_string' => !empty( $this->_req_data['timezone_string'] ) ? $this->_req_data['timezone_string'] : NULL, |
|
825 | - 'EVT_external_URL' => !empty( $this->_req_data['externalURL'] ) ? $this->_req_data['externalURL'] : NULL, |
|
826 | - 'EVT_phone' => !empty( $this->_req_data['event_phone'] ) ? $this->_req_data['event_phone'] : NULL |
|
819 | + apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255), |
|
820 | + ! empty($this->_req_data['additional_limit']) ? $this->_req_data['additional_limit'] : NULL ), |
|
821 | + 'EVT_default_registration_status' => ! empty($this->_req_data['EVT_default_registration_status']) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID, |
|
822 | + 'EVT_member_only' => ! empty($this->_req_data['member_only']) ? 1 : 0, |
|
823 | + 'EVT_allow_overflow' => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0, |
|
824 | + 'EVT_timezone_string' => ! empty($this->_req_data['timezone_string']) ? $this->_req_data['timezone_string'] : NULL, |
|
825 | + 'EVT_external_URL' => ! empty($this->_req_data['externalURL']) ? $this->_req_data['externalURL'] : NULL, |
|
826 | + 'EVT_phone' => ! empty($this->_req_data['event_phone']) ? $this->_req_data['event_phone'] : NULL |
|
827 | 827 | ); |
828 | 828 | |
829 | 829 | //update event |
830 | - $success = $this->_event_model()->update_by_ID( $event_values, $post_id ); |
|
830 | + $success = $this->_event_model()->update_by_ID($event_values, $post_id); |
|
831 | 831 | |
832 | 832 | |
833 | 833 | //get event_object for other metaboxes... though it would seem to make sense to just use $this->_event_model()->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id! |
834 | - $get_one_where = array( $this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status ); |
|
835 | - $event = $this->_event_model()->get_one( array($get_one_where) ); |
|
834 | + $get_one_where = array($this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status); |
|
835 | + $event = $this->_event_model()->get_one(array($get_one_where)); |
|
836 | 836 | |
837 | 837 | |
838 | 838 | //the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons. |
839 | - $event_update_callbacks = apply_filters( 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( array($this, '_default_venue_update' ), array( $this, '_default_tickets_update') ) ); |
|
839 | + $event_update_callbacks = apply_filters('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array(array($this, '_default_venue_update'), array($this, '_default_tickets_update'))); |
|
840 | 840 | |
841 | 841 | $att_success = TRUE; |
842 | 842 | |
843 | - foreach ( $event_update_callbacks as $e_callback ) { |
|
844 | - $_succ = call_user_func_array( $e_callback, array( $event, $this->_req_data ) ); |
|
845 | - $att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
843 | + foreach ($event_update_callbacks as $e_callback) { |
|
844 | + $_succ = call_user_func_array($e_callback, array($event, $this->_req_data)); |
|
845 | + $att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
846 | 846 | } |
847 | 847 | |
848 | 848 | //any errors? |
849 | - if ( $success && FALSE === $att_success ) { |
|
850 | - EE_Error::add_error( __('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
851 | - } else if ( $success === FALSE ) { |
|
852 | - EE_Error::add_error( __('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
849 | + if ($success && FALSE === $att_success) { |
|
850 | + EE_Error::add_error(__('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
851 | + } else if ($success === FALSE) { |
|
852 | + EE_Error::add_error(__('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
853 | 853 | } |
854 | 854 | } |
855 | 855 | |
@@ -859,14 +859,14 @@ discard block |
||
859 | 859 | /** |
860 | 860 | * @see parent::restore_item() |
861 | 861 | */ |
862 | - protected function _restore_cpt_item( $post_id, $revision_id ) { |
|
862 | + protected function _restore_cpt_item($post_id, $revision_id) { |
|
863 | 863 | //copy existing event meta to new post |
864 | 864 | $post_evt = $this->_event_model()->get_one_by_ID($post_id); |
865 | - if ( $post_evt instanceof EE_Event ) { |
|
865 | + if ($post_evt instanceof EE_Event) { |
|
866 | 866 | //meta revision restore |
867 | - $post_evt->restore_revision( $revision_id ); |
|
867 | + $post_evt->restore_revision($revision_id); |
|
868 | 868 | //related objs restore |
869 | - $post_evt->restore_revision( $revision_id, array( 'Venue', 'Datetime', 'Price' ) ); |
|
869 | + $post_evt->restore_revision($revision_id, array('Venue', 'Datetime', 'Price')); |
|
870 | 870 | } |
871 | 871 | } |
872 | 872 | |
@@ -879,52 +879,52 @@ discard block |
||
879 | 879 | * @param array $data The request data from the form |
880 | 880 | * @return bool Success or fail. |
881 | 881 | */ |
882 | - protected function _default_venue_update( $evtobj, $data ) { |
|
883 | - require_once( EE_MODELS . 'EEM_Venue.model.php' ); |
|
882 | + protected function _default_venue_update($evtobj, $data) { |
|
883 | + require_once(EE_MODELS.'EEM_Venue.model.php'); |
|
884 | 884 | $venue_model = EE_Registry::instance()->load_model('Venue'); |
885 | 885 | $rows_affected = NULL; |
886 | - $venue_id = !empty( $data['venue_id'] ) ? $data['venue_id'] : NULL; |
|
886 | + $venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : NULL; |
|
887 | 887 | |
888 | 888 | // very important. If we don't have a venue name... |
889 | 889 | // then we'll get out because not necessary to create empty venue |
890 | - if ( empty( $data['venue_title'] ) ) { |
|
890 | + if (empty($data['venue_title'])) { |
|
891 | 891 | return false; |
892 | 892 | } |
893 | 893 | |
894 | 894 | $venue_array = array( |
895 | 895 | 'VNU_wp_user' => $evtobj->get('EVT_wp_user'), |
896 | - 'VNU_name' => !empty( $data['venue_title'] ) ? $data['venue_title'] : NULL, |
|
897 | - 'VNU_desc' => !empty( $data['venue_description'] ) ? $data['venue_description'] : NULL, |
|
898 | - 'VNU_identifier' => !empty( $data['venue_identifier'] ) ? $data['venue_identifier'] : NULL, |
|
899 | - 'VNU_short_desc' => !empty( $data['venue_short_description'] ) ? $data['venue_short_description'] : NULL, |
|
900 | - 'VNU_address' => !empty( $data['address'] ) ? $data['address'] : NULL, |
|
901 | - 'VNU_address2' => !empty( $data['address2'] ) ? $data['address2'] : NULL, |
|
902 | - 'VNU_city' => !empty( $data['city'] ) ? $data['city'] : NULL, |
|
903 | - 'STA_ID' => !empty( $data['state'] ) ? $data['state'] : NULL, |
|
904 | - 'CNT_ISO' => !empty( $data['countries'] ) ? $data['countries'] : NULL, |
|
905 | - 'VNU_zip' => !empty( $data['zip'] ) ? $data['zip'] : NULL, |
|
906 | - 'VNU_phone' => !empty( $data['venue_phone'] ) ? $data['venue_phone'] : NULL, |
|
907 | - 'VNU_capacity' => !empty( $data['venue_capacity'] ) ? $data['venue_capacity'] : NULL, |
|
908 | - 'VNU_url' => !empty($data['venue_url'] ) ? $data['venue_url'] : NULL, |
|
909 | - 'VNU_virtual_phone' => !empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL, |
|
910 | - 'VNU_virtual_url' => !empty( $data['virtual_url'] ) ? $data['virtual_url'] : NULL, |
|
911 | - 'VNU_enable_for_gmap' => isset( $data['enable_for_gmap'] ) ? 1 : 0, |
|
896 | + 'VNU_name' => ! empty($data['venue_title']) ? $data['venue_title'] : NULL, |
|
897 | + 'VNU_desc' => ! empty($data['venue_description']) ? $data['venue_description'] : NULL, |
|
898 | + 'VNU_identifier' => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : NULL, |
|
899 | + 'VNU_short_desc' => ! empty($data['venue_short_description']) ? $data['venue_short_description'] : NULL, |
|
900 | + 'VNU_address' => ! empty($data['address']) ? $data['address'] : NULL, |
|
901 | + 'VNU_address2' => ! empty($data['address2']) ? $data['address2'] : NULL, |
|
902 | + 'VNU_city' => ! empty($data['city']) ? $data['city'] : NULL, |
|
903 | + 'STA_ID' => ! empty($data['state']) ? $data['state'] : NULL, |
|
904 | + 'CNT_ISO' => ! empty($data['countries']) ? $data['countries'] : NULL, |
|
905 | + 'VNU_zip' => ! empty($data['zip']) ? $data['zip'] : NULL, |
|
906 | + 'VNU_phone' => ! empty($data['venue_phone']) ? $data['venue_phone'] : NULL, |
|
907 | + 'VNU_capacity' => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : NULL, |
|
908 | + 'VNU_url' => ! empty($data['venue_url']) ? $data['venue_url'] : NULL, |
|
909 | + 'VNU_virtual_phone' => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL, |
|
910 | + 'VNU_virtual_url' => ! empty($data['virtual_url']) ? $data['virtual_url'] : NULL, |
|
911 | + 'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0, |
|
912 | 912 | 'status' => 'publish' |
913 | 913 | ); |
914 | 914 | |
915 | 915 | |
916 | 916 | //if we've got the venue_id then we're just updating the existing venue so let's do that and then get out. |
917 | - if ( !empty( $venue_id ) ) { |
|
918 | - $update_where = array( $venue_model->primary_key_name() => $venue_id ); |
|
919 | - $rows_affected = $venue_model->update( $venue_array, array( $update_where ) ); |
|
917 | + if ( ! empty($venue_id)) { |
|
918 | + $update_where = array($venue_model->primary_key_name() => $venue_id); |
|
919 | + $rows_affected = $venue_model->update($venue_array, array($update_where)); |
|
920 | 920 | //we've gotta make sure that the venue is always attached to a revision.. add_relation_to should take care of making sure that the relation is already present. |
921 | - $evtobj->_add_relation_to( $venue_id, 'Venue' ); |
|
921 | + $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
922 | 922 | return $rows_affected > 0 ? TRUE : FALSE; |
923 | 923 | } else { |
924 | 924 | //we insert the venue |
925 | - $venue_id = $venue_model->insert( $venue_array ); |
|
926 | - $evtobj->_add_relation_to( $venue_id, 'Venue' ); |
|
927 | - return !empty( $venue_id ) ? TRUE : FALSE; |
|
925 | + $venue_id = $venue_model->insert($venue_array); |
|
926 | + $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
927 | + return ! empty($venue_id) ? TRUE : FALSE; |
|
928 | 928 | } |
929 | 929 | //when we have the ancestor come in it's already been handled by the revision save. |
930 | 930 | } |
@@ -938,55 +938,55 @@ discard block |
||
938 | 938 | * @param array $data The request data from the form |
939 | 939 | * @return bool success or fail |
940 | 940 | */ |
941 | - protected function _default_tickets_update( EE_Event $evtobj, $data ) { |
|
941 | + protected function _default_tickets_update(EE_Event $evtobj, $data) { |
|
942 | 942 | $success = true; |
943 | 943 | $saved_dtt = null; |
944 | 944 | $saved_tickets = array(); |
945 | - $incoming_date_formats = array( 'Y-m-d', 'h:i a' ); |
|
945 | + $incoming_date_formats = array('Y-m-d', 'h:i a'); |
|
946 | 946 | |
947 | - foreach ( $data['edit_event_datetimes'] as $row => $dtt ) { |
|
947 | + foreach ($data['edit_event_datetimes'] as $row => $dtt) { |
|
948 | 948 | //trim all values to ensure any excess whitespace is removed. |
949 | - $dtt = array_map( 'trim', $dtt ); |
|
950 | - $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start']; |
|
949 | + $dtt = array_map('trim', $dtt); |
|
950 | + $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start']; |
|
951 | 951 | $datetime_values = array( |
952 | - 'DTT_ID' => ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL, |
|
952 | + 'DTT_ID' => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL, |
|
953 | 953 | 'DTT_EVT_start' => $dtt['DTT_EVT_start'], |
954 | 954 | 'DTT_EVT_end' => $dtt['DTT_EVT_end'], |
955 | - 'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt['DTT_reg_limit'], |
|
955 | + 'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'], |
|
956 | 956 | 'DTT_order' => $row, |
957 | 957 | ); |
958 | 958 | |
959 | 959 | //if we have an id then let's get existing object first and then set the new values. Otherwise we instantiate a new object for save. |
960 | 960 | |
961 | - if ( !empty( $dtt['DTT_ID'] ) ) { |
|
962 | - $DTM = EE_Registry::instance()->load_model('Datetime', array( $evtobj->get_timezone() ) )->get_one_by_ID($dtt['DTT_ID'] ); |
|
963 | - $DTM->set_date_format( $incoming_date_formats[0] ); |
|
964 | - $DTM->set_time_format( $incoming_date_formats[1] ); |
|
965 | - foreach ( $datetime_values as $field => $value ) { |
|
966 | - $DTM->set( $field, $value ); |
|
961 | + if ( ! empty($dtt['DTT_ID'])) { |
|
962 | + $DTM = EE_Registry::instance()->load_model('Datetime', array($evtobj->get_timezone()))->get_one_by_ID($dtt['DTT_ID']); |
|
963 | + $DTM->set_date_format($incoming_date_formats[0]); |
|
964 | + $DTM->set_time_format($incoming_date_formats[1]); |
|
965 | + foreach ($datetime_values as $field => $value) { |
|
966 | + $DTM->set($field, $value); |
|
967 | 967 | } |
968 | 968 | |
969 | 969 | //make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it. We need to do this so we dont' TRASH the parent DTT. |
970 | 970 | $saved_dtts[$DTM->ID()] = $DTM; |
971 | 971 | } else { |
972 | - $DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values ), FALSE, FALSE ); |
|
973 | - $DTM->set_date_format( $incoming_date_formats[0] ); |
|
974 | - $DTM->set_time_format( $incoming_date_formats[1] ); |
|
975 | - $DTM->set_timezone( $evtobj->get_timezone() ); |
|
976 | - foreach ( $datetime_values as $field => $value ) { |
|
977 | - $DTM->set( $field, $value ); |
|
972 | + $DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values), FALSE, FALSE); |
|
973 | + $DTM->set_date_format($incoming_date_formats[0]); |
|
974 | + $DTM->set_time_format($incoming_date_formats[1]); |
|
975 | + $DTM->set_timezone($evtobj->get_timezone()); |
|
976 | + foreach ($datetime_values as $field => $value) { |
|
977 | + $DTM->set($field, $value); |
|
978 | 978 | } |
979 | 979 | } |
980 | 980 | $DTM->save(); |
981 | 981 | |
982 | - $DTT = $evtobj->_add_relation_to( $DTM, 'Datetime' ); |
|
982 | + $DTT = $evtobj->_add_relation_to($DTM, 'Datetime'); |
|
983 | 983 | |
984 | 984 | //load DTT helper |
985 | 985 | EE_Registry::instance()->load_helper('DTT_Helper'); |
986 | 986 | |
987 | 987 | //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
988 | - if( $DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end') ) { |
|
989 | - $DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start') ); |
|
988 | + if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) { |
|
989 | + $DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start')); |
|
990 | 990 | $DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days'); |
991 | 991 | $DTT->save(); |
992 | 992 | } |
@@ -994,45 +994,45 @@ discard block |
||
994 | 994 | //now we got to make sure we add the new DTT_ID to the $saved_dtts array because it is possible there was a new one created for the autosave. |
995 | 995 | $saved_dtt = $DTT; |
996 | 996 | |
997 | - $success = !$success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now. |
|
997 | + $success = ! $success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now. |
|
998 | 998 | } |
999 | 999 | |
1000 | 1000 | //no dtts get deleted so we don't do any of that logic here. |
1001 | 1001 | //update tickets next |
1002 | - $old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array(); |
|
1003 | - foreach ( $data['edit_tickets'] as $row => $tkt ) { |
|
1004 | - $incoming_date_formats = array( 'Y-m-d', 'h:i a' ); |
|
1002 | + $old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array(); |
|
1003 | + foreach ($data['edit_tickets'] as $row => $tkt) { |
|
1004 | + $incoming_date_formats = array('Y-m-d', 'h:i a'); |
|
1005 | 1005 | $update_prices = false; |
1006 | - $ticket_price = isset( $data['edit_prices'][$row][1]['PRC_amount'] ) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0; |
|
1006 | + $ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount']) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0; |
|
1007 | 1007 | |
1008 | 1008 | // trim inputs to ensure any excess whitespace is removed. |
1009 | - $tkt = array_map( 'trim', $tkt ); |
|
1009 | + $tkt = array_map('trim', $tkt); |
|
1010 | 1010 | |
1011 | - if ( empty( $tkt['TKT_start_date'] ) ) { |
|
1011 | + if (empty($tkt['TKT_start_date'])) { |
|
1012 | 1012 | //let's use now in the set timezone. |
1013 | - $now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) ); |
|
1014 | - $tkt['TKT_start_date'] = $now->format( $incoming_date_formats[0] . ' ' . $incoming_date_formats[1] ); |
|
1013 | + $now = new DateTime('now', new DateTimeZone($evtobj->get_timezone())); |
|
1014 | + $tkt['TKT_start_date'] = $now->format($incoming_date_formats[0].' '.$incoming_date_formats[1]); |
|
1015 | 1015 | } |
1016 | 1016 | |
1017 | - if ( empty( $tkt['TKT_end_date'] ) ) { |
|
1017 | + if (empty($tkt['TKT_end_date'])) { |
|
1018 | 1018 | //use the start date of the first datetime |
1019 | 1019 | $dtt = $evtobj->first_datetime(); |
1020 | - $tkt['TKT_end_date'] = $dtt->start_date_and_time( $incoming_date_formats[0], $incoming_date_formats[1] ); |
|
1020 | + $tkt['TKT_end_date'] = $dtt->start_date_and_time($incoming_date_formats[0], $incoming_date_formats[1]); |
|
1021 | 1021 | } |
1022 | 1022 | |
1023 | 1023 | $TKT_values = array( |
1024 | - 'TKT_ID' => !empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL, |
|
1025 | - 'TTM_ID' => !empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0, |
|
1026 | - 'TKT_name' => !empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '', |
|
1027 | - 'TKT_description' => !empty( $tkt['TKT_description'] ) ? $tkt['TKT_description'] : '', |
|
1024 | + 'TKT_ID' => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL, |
|
1025 | + 'TTM_ID' => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0, |
|
1026 | + 'TKT_name' => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '', |
|
1027 | + 'TKT_description' => ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '', |
|
1028 | 1028 | 'TKT_start_date' => $tkt['TKT_start_date'], |
1029 | 1029 | 'TKT_end_date' => $tkt['TKT_end_date'], |
1030 | - 'TKT_qty' => ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt['TKT_qty'], |
|
1031 | - 'TKT_uses' => ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt[ 'TKT_uses' ], |
|
1032 | - 'TKT_min' => empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'], |
|
1033 | - 'TKT_max' => empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'], |
|
1030 | + 'TKT_qty' => ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'], |
|
1031 | + 'TKT_uses' => ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'], |
|
1032 | + 'TKT_min' => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'], |
|
1033 | + 'TKT_max' => empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'], |
|
1034 | 1034 | 'TKT_row' => $row, |
1035 | - 'TKT_order' => isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : $row, |
|
1035 | + 'TKT_order' => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row, |
|
1036 | 1036 | 'TKT_price' => $ticket_price |
1037 | 1037 | ); |
1038 | 1038 | |
@@ -1040,7 +1040,7 @@ discard block |
||
1040 | 1040 | |
1041 | 1041 | |
1042 | 1042 | //if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well. |
1043 | - if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) { |
|
1043 | + if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) { |
|
1044 | 1044 | $TKT_values['TKT_ID'] = 0; |
1045 | 1045 | $TKT_values['TKT_is_default'] = 0; |
1046 | 1046 | $TKT_values['TKT_price'] = $ticket_price; |
@@ -1051,58 +1051,58 @@ discard block |
||
1051 | 1051 | //we actually do our saves a head of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified. |
1052 | 1052 | //keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived. |
1053 | 1053 | |
1054 | - if ( !empty( $tkt['TKT_ID'] ) ) { |
|
1055 | - $TKT = EE_Registry::instance()->load_model( 'Ticket', array( $evtobj->get_timezone() ) )->get_one_by_ID( $tkt['TKT_ID'] ); |
|
1056 | - if ( $TKT instanceof EE_Ticket ) { |
|
1057 | - $ticket_sold = $TKT->count_related( 'Registration', array( array( 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) ) ) ) > 0 ? true : false; |
|
1054 | + if ( ! empty($tkt['TKT_ID'])) { |
|
1055 | + $TKT = EE_Registry::instance()->load_model('Ticket', array($evtobj->get_timezone()))->get_one_by_ID($tkt['TKT_ID']); |
|
1056 | + if ($TKT instanceof EE_Ticket) { |
|
1057 | + $ticket_sold = $TKT->count_related('Registration', array(array('STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))))) > 0 ? true : false; |
|
1058 | 1058 | //let's just check the total price for the existing ticket and determine if it matches the new total price. if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket. |
1059 | - $create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' ) && ! $TKT->get( 'TKT_deleted' ) ? true : false; |
|
1060 | - $TKT->set_date_format( $incoming_date_formats[ 0 ] ); |
|
1061 | - $TKT->set_time_format( $incoming_date_formats[ 1 ] ); |
|
1059 | + $create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') && ! $TKT->get('TKT_deleted') ? true : false; |
|
1060 | + $TKT->set_date_format($incoming_date_formats[0]); |
|
1061 | + $TKT->set_time_format($incoming_date_formats[1]); |
|
1062 | 1062 | //set new values |
1063 | - foreach ( $TKT_values as $field => $value ) { |
|
1064 | - if ( $field == 'TKT_qty' ) { |
|
1065 | - $TKT->set_qty( $value ); |
|
1063 | + foreach ($TKT_values as $field => $value) { |
|
1064 | + if ($field == 'TKT_qty') { |
|
1065 | + $TKT->set_qty($value); |
|
1066 | 1066 | } else { |
1067 | - $TKT->set( $field, $value ); |
|
1067 | + $TKT->set($field, $value); |
|
1068 | 1068 | } |
1069 | 1069 | } |
1070 | 1070 | //if $create_new_TKT is false then we can safely update the existing ticket. Otherwise we have to create a new ticket. |
1071 | - if ( $create_new_TKT ) { |
|
1071 | + if ($create_new_TKT) { |
|
1072 | 1072 | //archive the old ticket first |
1073 | - $TKT->set( 'TKT_deleted', 1 ); |
|
1073 | + $TKT->set('TKT_deleted', 1); |
|
1074 | 1074 | $TKT->save(); |
1075 | 1075 | //make sure this ticket is still recorded in our saved_tkts so we don't run it through the regular trash routine. |
1076 | - $saved_tickets[ $TKT->ID() ] = $TKT; |
|
1076 | + $saved_tickets[$TKT->ID()] = $TKT; |
|
1077 | 1077 | //create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it. |
1078 | 1078 | $TKT = clone $TKT; |
1079 | - $TKT->set( 'TKT_ID', 0 ); |
|
1080 | - $TKT->set( 'TKT_deleted', 0 ); |
|
1081 | - $TKT->set( 'TKT_price', $ticket_price ); |
|
1082 | - $TKT->set( 'TKT_sold', 0 ); |
|
1079 | + $TKT->set('TKT_ID', 0); |
|
1080 | + $TKT->set('TKT_deleted', 0); |
|
1081 | + $TKT->set('TKT_price', $ticket_price); |
|
1082 | + $TKT->set('TKT_sold', 0); |
|
1083 | 1083 | //now we need to make sure that $new prices are created as well and attached to new ticket. |
1084 | 1084 | $update_prices = true; |
1085 | 1085 | } |
1086 | 1086 | //make sure price is set if it hasn't been already |
1087 | - $TKT->set( 'TKT_price', $ticket_price ); |
|
1087 | + $TKT->set('TKT_price', $ticket_price); |
|
1088 | 1088 | } |
1089 | 1089 | |
1090 | 1090 | } else { |
1091 | 1091 | //no TKT_id so a new TKT |
1092 | 1092 | $TKT_values['TKT_price'] = $ticket_price; |
1093 | - $TKT = EE_Registry::instance()->load_class('Ticket', array( $TKT_values ), FALSE, FALSE ); |
|
1094 | - if ( $TKT instanceof EE_Ticket ) { |
|
1093 | + $TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values), FALSE, FALSE); |
|
1094 | + if ($TKT instanceof EE_Ticket) { |
|
1095 | 1095 | //need to reset values to properly account for the date formats |
1096 | - $TKT->set_date_format( $incoming_date_formats[0] ); |
|
1097 | - $TKT->set_time_format( $incoming_date_formats[1] ); |
|
1098 | - $TKT->set_timezone( $evtobj->get_timezone() ); |
|
1096 | + $TKT->set_date_format($incoming_date_formats[0]); |
|
1097 | + $TKT->set_time_format($incoming_date_formats[1]); |
|
1098 | + $TKT->set_timezone($evtobj->get_timezone()); |
|
1099 | 1099 | |
1100 | 1100 | //set new values |
1101 | - foreach ( $TKT_values as $field => $value ) { |
|
1102 | - if ( $field == 'TKT_qty' ) { |
|
1103 | - $TKT->set_qty( $value ); |
|
1101 | + foreach ($TKT_values as $field => $value) { |
|
1102 | + if ($field == 'TKT_qty') { |
|
1103 | + $TKT->set_qty($value); |
|
1104 | 1104 | } else { |
1105 | - $TKT->set( $field, $value ); |
|
1105 | + $TKT->set($field, $value); |
|
1106 | 1106 | } |
1107 | 1107 | } |
1108 | 1108 | |
@@ -1110,32 +1110,32 @@ discard block |
||
1110 | 1110 | } |
1111 | 1111 | } |
1112 | 1112 | // cap ticket qty by datetime reg limits |
1113 | - $TKT->set_qty( min( $TKT->qty(), $TKT->qty( 'reg_limit' ) ) ); |
|
1113 | + $TKT->set_qty(min($TKT->qty(), $TKT->qty('reg_limit'))); |
|
1114 | 1114 | //update ticket. |
1115 | 1115 | $TKT->save(); |
1116 | 1116 | |
1117 | 1117 | //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
1118 | - if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) { |
|
1119 | - $TKT->set('TKT_end_date', $TKT->get('TKT_start_date') ); |
|
1118 | + if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) { |
|
1119 | + $TKT->set('TKT_end_date', $TKT->get('TKT_start_date')); |
|
1120 | 1120 | EE_Registry::instance()->load_helper('DTT_Helper'); |
1121 | 1121 | $TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days'); |
1122 | 1122 | $TKT->save(); |
1123 | 1123 | } |
1124 | 1124 | |
1125 | 1125 | //initially let's add the ticket to the dtt |
1126 | - $saved_dtt->_add_relation_to( $TKT, 'Ticket' ); |
|
1126 | + $saved_dtt->_add_relation_to($TKT, 'Ticket'); |
|
1127 | 1127 | |
1128 | 1128 | $saved_tickets[$TKT->ID()] = $TKT; |
1129 | 1129 | |
1130 | 1130 | //add prices to ticket |
1131 | - $this->_add_prices_to_ticket( $data['edit_prices'][$row], $TKT, $update_prices ); |
|
1131 | + $this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices); |
|
1132 | 1132 | } |
1133 | 1133 | //however now we need to handle permanently deleting tickets via the ui. Keep in mind that the ui does not allow deleting/archiving tickets that have ticket sold. However, it does allow for deleting tickets that have no tickets sold, in which case we want to get rid of permanently because there is no need to save in db. |
1134 | - $old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
1135 | - $tickets_removed = array_diff( $old_tickets, array_keys( $saved_tickets ) ); |
|
1134 | + $old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
1135 | + $tickets_removed = array_diff($old_tickets, array_keys($saved_tickets)); |
|
1136 | 1136 | |
1137 | - foreach ( $tickets_removed as $id ) { |
|
1138 | - $id = absint( $id ); |
|
1137 | + foreach ($tickets_removed as $id) { |
|
1138 | + $id = absint($id); |
|
1139 | 1139 | |
1140 | 1140 | //get the ticket for this id |
1141 | 1141 | $tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id); |
@@ -1143,7 +1143,7 @@ discard block |
||
1143 | 1143 | //need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold) |
1144 | 1144 | $dtts = $tkt_to_remove->get_many_related('Datetime'); |
1145 | 1145 | |
1146 | - foreach( $dtts as $dtt ) { |
|
1146 | + foreach ($dtts as $dtt) { |
|
1147 | 1147 | $tkt_to_remove->_remove_relation_to($dtt, 'Datetime'); |
1148 | 1148 | } |
1149 | 1149 | |
@@ -1154,7 +1154,7 @@ discard block |
||
1154 | 1154 | //finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships) |
1155 | 1155 | $tkt_to_remove->delete_permanently(); |
1156 | 1156 | } |
1157 | - return array( $saved_dtt, $saved_tickets ); |
|
1157 | + return array($saved_dtt, $saved_tickets); |
|
1158 | 1158 | } |
1159 | 1159 | |
1160 | 1160 | |
@@ -1169,31 +1169,31 @@ discard block |
||
1169 | 1169 | * @param bool $new_prices Whether attach existing incoming prices or create new ones. |
1170 | 1170 | * @return void |
1171 | 1171 | */ |
1172 | - private function _add_prices_to_ticket( $prices, EE_Ticket $ticket, $new_prices = FALSE ) { |
|
1173 | - foreach ( $prices as $row => $prc ) { |
|
1172 | + private function _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = FALSE) { |
|
1173 | + foreach ($prices as $row => $prc) { |
|
1174 | 1174 | $PRC_values = array( |
1175 | - 'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL, |
|
1176 | - 'PRT_ID' => !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL, |
|
1177 | - 'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0, |
|
1178 | - 'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '', |
|
1179 | - 'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '', |
|
1175 | + 'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL, |
|
1176 | + 'PRT_ID' => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL, |
|
1177 | + 'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0, |
|
1178 | + 'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '', |
|
1179 | + 'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '', |
|
1180 | 1180 | 'PRC_is_default' => 0, //make sure prices are NOT set as default from this context |
1181 | 1181 | 'PRC_order' => $row |
1182 | 1182 | ); |
1183 | 1183 | |
1184 | - if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) { |
|
1184 | + if ($new_prices || empty($PRC_values['PRC_ID'])) { |
|
1185 | 1185 | $PRC_values['PRC_ID'] = 0; |
1186 | - $PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE); |
|
1186 | + $PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE); |
|
1187 | 1187 | } else { |
1188 | - $PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] ); |
|
1188 | + $PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']); |
|
1189 | 1189 | //update this price with new values |
1190 | - foreach ( $PRC_values as $field => $newprc ) { |
|
1191 | - $PRC->set( $field, $newprc ); |
|
1190 | + foreach ($PRC_values as $field => $newprc) { |
|
1191 | + $PRC->set($field, $newprc); |
|
1192 | 1192 | } |
1193 | 1193 | $PRC->save(); |
1194 | 1194 | } |
1195 | 1195 | |
1196 | - $ticket->_add_relation_to( $PRC, 'Price' ); |
|
1196 | + $ticket->_add_relation_to($PRC, 'Price'); |
|
1197 | 1197 | } |
1198 | 1198 | } |
1199 | 1199 | |
@@ -1216,33 +1216,33 @@ discard block |
||
1216 | 1216 | |
1217 | 1217 | return; //TEMPORARILY EXITING CAUSE THIS IS A TODO |
1218 | 1218 | |
1219 | - $postid = isset( $this->_req_data['post_ID'] ) ? $this->_req_data['post_ID'] : NULL; |
|
1219 | + $postid = isset($this->_req_data['post_ID']) ? $this->_req_data['post_ID'] : NULL; |
|
1220 | 1220 | |
1221 | 1221 | |
1222 | 1222 | //if no postid then get out cause we need it for stuff in here |
1223 | - if ( empty( $postid ) ) return; |
|
1223 | + if (empty($postid)) return; |
|
1224 | 1224 | |
1225 | 1225 | |
1226 | 1226 | //handle datetime saves |
1227 | 1227 | $items = array(); |
1228 | 1228 | |
1229 | - $get_one_where = array( $this->_event_model()->primary_key_name() => $postid ); |
|
1230 | - $event = $this->_event_model()->get_one( array($get_one_where) ); |
|
1229 | + $get_one_where = array($this->_event_model()->primary_key_name() => $postid); |
|
1230 | + $event = $this->_event_model()->get_one(array($get_one_where)); |
|
1231 | 1231 | |
1232 | 1232 | //now let's get the attached datetimes from the most recent autosave |
1233 | 1233 | $dtts = $event->get_many_related('Datetime'); |
1234 | 1234 | |
1235 | 1235 | $dtt_ids = array(); |
1236 | - foreach( $dtts as $dtt ) { |
|
1236 | + foreach ($dtts as $dtt) { |
|
1237 | 1237 | $dtt_ids[] = $dtt->ID(); |
1238 | 1238 | $order = $dtt->order(); |
1239 | 1239 | $this->_template_args['data']['items']['ID-'.$order] = $dtt->ID(); |
1240 | 1240 | } |
1241 | - $this->_template_args['data']['items']['datetime_IDS'] = serialize( $dtt_ids ); |
|
1241 | + $this->_template_args['data']['items']['datetime_IDS'] = serialize($dtt_ids); |
|
1242 | 1242 | |
1243 | 1243 | //handle DECAF venues |
1244 | 1244 | //we need to make sure that the venue_id gets updated in the form so that future autosaves will properly conntect that venue to the event. |
1245 | - if ( $do_venue_autosaves = apply_filters( 'FHEE__Events_Admin_Page__ee_autosave_edit_do_decaf_venue_save', TRUE ) ) { |
|
1245 | + if ($do_venue_autosaves = apply_filters('FHEE__Events_Admin_Page__ee_autosave_edit_do_decaf_venue_save', TRUE)) { |
|
1246 | 1246 | $venue = $event->get_first_related('Venue'); |
1247 | 1247 | $this->_template_args['data']['items']['venue-id'] = $venue->ID(); |
1248 | 1248 | } |
@@ -1253,23 +1253,23 @@ discard block |
||
1253 | 1253 | |
1254 | 1254 | $ticket_ids = array(); |
1255 | 1255 | $price_ids = array(); |
1256 | - foreach ( $tickets as $ticket ) { |
|
1256 | + foreach ($tickets as $ticket) { |
|
1257 | 1257 | $ticket_ids[] = $price->ID(); |
1258 | 1258 | $ticket_order = $price->get('TKT_order'); |
1259 | - $this->_template_args['data']['items']['edit-ticket-id-' . $ticket_order] = $ticket->ID(); |
|
1260 | - $this->_template_args['data']['items']['edit-ticket-event-id-' . $order] = $event->ID(); |
|
1259 | + $this->_template_args['data']['items']['edit-ticket-id-'.$ticket_order] = $ticket->ID(); |
|
1260 | + $this->_template_args['data']['items']['edit-ticket-event-id-'.$order] = $event->ID(); |
|
1261 | 1261 | |
1262 | 1262 | //now we have to make sure the prices are updated appropriately |
1263 | 1263 | $prices = $ticket->get_many_related('Prices'); |
1264 | 1264 | |
1265 | - foreach ( $prices as $price ) { |
|
1265 | + foreach ($prices as $price) { |
|
1266 | 1266 | $price_ids[] = $price->ID(); |
1267 | 1267 | $price_order = $price->get('PRC_order'); |
1268 | - $this->_template_args['data']['items']['quick-edit-ticket-price-id-ticketrow-' . $ticket_order . '-' . $price_order] = $price->ID(); |
|
1269 | - $this->_template_args['data']['items']['edit-ticket-price-id-ticketrow-' . $ticket_row . '-' . $price_row] = $price->ID(); |
|
1270 | - $this->_template_args['data']['items']['edit-ticket-price-is-default-ticketrow-' . $ticket_row . '-' . $price_row] = $price->get('PRC_is_default'); |
|
1268 | + $this->_template_args['data']['items']['quick-edit-ticket-price-id-ticketrow-'.$ticket_order.'-'.$price_order] = $price->ID(); |
|
1269 | + $this->_template_args['data']['items']['edit-ticket-price-id-ticketrow-'.$ticket_row.'-'.$price_row] = $price->ID(); |
|
1270 | + $this->_template_args['data']['items']['edit-ticket-price-is-default-ticketrow-'.$ticket_row.'-'.$price_row] = $price->get('PRC_is_default'); |
|
1271 | 1271 | } |
1272 | - $this->_template_args['data']['items']['price-IDs-ticketrow-' . $ticket_row] = implode(',', $price_ids); |
|
1272 | + $this->_template_args['data']['items']['price-IDs-ticketrow-'.$ticket_row] = implode(',', $price_ids); |
|
1273 | 1273 | } |
1274 | 1274 | $this->_template_args['data']['items']['ticket-IDs'] = implode(',', $ticket_ids); |
1275 | 1275 | } |
@@ -1287,12 +1287,12 @@ discard block |
||
1287 | 1287 | private function _generate_publish_box_extra_content() { |
1288 | 1288 | |
1289 | 1289 | //load formatter helper |
1290 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
1290 | + EE_Registry::instance()->load_helper('Formatter'); |
|
1291 | 1291 | |
1292 | 1292 | //args for getting related registrations |
1293 | - $approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved ) ); |
|
1294 | - $not_approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved ) ); |
|
1295 | - $pending_payment_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment ) ); |
|
1293 | + $approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved)); |
|
1294 | + $not_approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved)); |
|
1295 | + $pending_payment_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment)); |
|
1296 | 1296 | |
1297 | 1297 | |
1298 | 1298 | // publish box |
@@ -1321,9 +1321,9 @@ discard block |
||
1321 | 1321 | ), |
1322 | 1322 | REG_ADMIN_URL |
1323 | 1323 | ), |
1324 | - 'approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $approved_query_args ), |
|
1325 | - 'not_approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $not_approved_query_args ), |
|
1326 | - 'pending_payment_regs' => $this->_cpt_model_obj->count_related( 'Registration', $pending_payment_query_args ), |
|
1324 | + 'approved_regs' => $this->_cpt_model_obj->count_related('Registration', $approved_query_args), |
|
1325 | + 'not_approved_regs' => $this->_cpt_model_obj->count_related('Registration', $not_approved_query_args), |
|
1326 | + 'pending_payment_regs' => $this->_cpt_model_obj->count_related('Registration', $pending_payment_query_args), |
|
1327 | 1327 | 'misc_pub_section_class' => apply_filters( |
1328 | 1328 | 'FHEE_Events_Admin_Page___generate_publish_box_extra_content__misc_pub_section_class', |
1329 | 1329 | 'misc-pub-section' |
@@ -1342,9 +1342,9 @@ discard block |
||
1342 | 1342 | 'AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add', |
1343 | 1343 | $this->_cpt_model_obj |
1344 | 1344 | ); |
1345 | - $publish_box_extra_args[ 'event_editor_overview_add' ] = ob_get_clean(); |
|
1345 | + $publish_box_extra_args['event_editor_overview_add'] = ob_get_clean(); |
|
1346 | 1346 | // load template |
1347 | - EEH_Template::display_template( EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php', $publish_box_extra_args ); |
|
1347 | + EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php', $publish_box_extra_args); |
|
1348 | 1348 | } |
1349 | 1349 | |
1350 | 1350 | |
@@ -1376,16 +1376,16 @@ discard block |
||
1376 | 1376 | $this->verify_cpt_object(); |
1377 | 1377 | add_meta_box( |
1378 | 1378 | 'espresso_event_editor_tickets', |
1379 | - __( 'Event Datetime & Ticket', 'event_espresso' ), |
|
1380 | - array( $this, 'ticket_metabox' ), |
|
1379 | + __('Event Datetime & Ticket', 'event_espresso'), |
|
1380 | + array($this, 'ticket_metabox'), |
|
1381 | 1381 | $this->page_slug, |
1382 | 1382 | 'normal', |
1383 | 1383 | 'high' |
1384 | 1384 | ); |
1385 | 1385 | add_meta_box( |
1386 | 1386 | 'espresso_event_editor_event_options', |
1387 | - __( 'Event Registration Options', 'event_espresso' ), |
|
1388 | - array( $this, 'registration_options_meta_box' ), |
|
1387 | + __('Event Registration Options', 'event_espresso'), |
|
1388 | + array($this, 'registration_options_meta_box'), |
|
1389 | 1389 | $this->page_slug, |
1390 | 1390 | 'side', |
1391 | 1391 | 'default' |
@@ -1415,38 +1415,38 @@ discard block |
||
1415 | 1415 | 'disabled' => '' |
1416 | 1416 | ); |
1417 | 1417 | |
1418 | - $event_id = is_object( $this->_cpt_model_obj ) ? $this->_cpt_model_obj->ID() : NULL; |
|
1418 | + $event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : NULL; |
|
1419 | 1419 | |
1420 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1420 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1421 | 1421 | |
1422 | 1422 | /** |
1423 | 1423 | * 1. Start with retrieving Datetimes |
1424 | 1424 | * 2. Fore each datetime get related tickets |
1425 | 1425 | * 3. For each ticket get related prices |
1426 | 1426 | */ |
1427 | - $times = EE_Registry::instance()->load_model('Datetime' )->get_all_event_dates( $event_id ); |
|
1428 | - EE_Registry::instance()->load_helper('DTT_Helper' ); |
|
1427 | + $times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id); |
|
1428 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
1429 | 1429 | /** @type EE_Datetime $first_datetime */ |
1430 | - $first_datetime = array_slice( $times, 0, 1 ); |
|
1430 | + $first_datetime = array_slice($times, 0, 1); |
|
1431 | 1431 | //do we get related tickets? |
1432 | - if ( $first_datetime[ 0 ]->get( 'DTT_ID' ) !== 0 ) { |
|
1433 | - foreach ( $times as $time ) { |
|
1434 | - if ( $time instanceof EE_Datetime ) { |
|
1432 | + if ($first_datetime[0]->get('DTT_ID') !== 0) { |
|
1433 | + foreach ($times as $time) { |
|
1434 | + if ($time instanceof EE_Datetime) { |
|
1435 | 1435 | $existing_datetime_ids[] = $time->get('DTT_ID'); |
1436 | 1436 | $template_args['time'] = $time; |
1437 | 1437 | $related_tickets = $time->tickets( |
1438 | 1438 | array( |
1439 | - array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), |
|
1439 | + array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), |
|
1440 | 1440 | 'default_where_conditions' => 'none' |
1441 | 1441 | ) |
1442 | 1442 | ); |
1443 | 1443 | |
1444 | - if ( !empty($related_tickets) ) { |
|
1444 | + if ( ! empty($related_tickets)) { |
|
1445 | 1445 | $template_args['total_ticket_rows'] = count($related_tickets); |
1446 | 1446 | $row = 0; |
1447 | - foreach ( $related_tickets as $ticket ) { |
|
1447 | + foreach ($related_tickets as $ticket) { |
|
1448 | 1448 | $existing_ticket_ids[] = $ticket->get('TKT_ID'); |
1449 | - $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row ); |
|
1449 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row); |
|
1450 | 1450 | |
1451 | 1451 | $row++; |
1452 | 1452 | } |
@@ -1454,7 +1454,7 @@ discard block |
||
1454 | 1454 | $template_args['total_ticket_rows'] = 1; |
1455 | 1455 | /** @type EE_Ticket $ticket */ |
1456 | 1456 | $ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object(); |
1457 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket ); |
|
1457 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket); |
|
1458 | 1458 | } |
1459 | 1459 | } |
1460 | 1460 | } |
@@ -1462,7 +1462,7 @@ discard block |
||
1462 | 1462 | $template_args['time'] = $times[0]; |
1463 | 1463 | /** @type EE_Ticket $ticket */ |
1464 | 1464 | $ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets(); |
1465 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket[1] ); |
|
1465 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]); |
|
1466 | 1466 | // NOTE: we're just sending the first default row |
1467 | 1467 | // (decaf can't manage default tickets so this should be sufficient); |
1468 | 1468 | } |
@@ -1471,8 +1471,8 @@ discard block |
||
1471 | 1471 | $template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info'); |
1472 | 1472 | $template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids); |
1473 | 1473 | $template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids); |
1474 | - $template_args['ticket_js_structure'] = $this->_get_ticket_row( EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE ); |
|
1475 | - $template = apply_filters( 'FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php' ); |
|
1474 | + $template_args['ticket_js_structure'] = $this->_get_ticket_row(EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE); |
|
1475 | + $template = apply_filters('FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php'); |
|
1476 | 1476 | EEH_Template::display_template($template, $template_args); |
1477 | 1477 | } |
1478 | 1478 | |
@@ -1487,21 +1487,21 @@ discard block |
||
1487 | 1487 | * @param int $row |
1488 | 1488 | * @return string generated html for the ticket row. |
1489 | 1489 | */ |
1490 | - private function _get_ticket_row( $ticket, $skeleton = FALSE, $row = 0 ) { |
|
1490 | + private function _get_ticket_row($ticket, $skeleton = FALSE, $row = 0) { |
|
1491 | 1491 | $template_args = array( |
1492 | - 'tkt_status_class' => ' tkt-status-' . $ticket->ticket_status(), |
|
1493 | - 'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && !$skeleton ? ' tkt-archived' : '', |
|
1492 | + 'tkt_status_class' => ' tkt-status-'.$ticket->ticket_status(), |
|
1493 | + 'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived' : '', |
|
1494 | 1494 | 'ticketrow' => $skeleton ? 'TICKETNUM' : $row, |
1495 | 1495 | 'TKT_ID' => $ticket->get('TKT_ID'), |
1496 | 1496 | 'TKT_name' => $ticket->get('TKT_name'), |
1497 | 1497 | 'TKT_start_date' => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'), |
1498 | 1498 | 'TKT_end_date' => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'), |
1499 | 1499 | 'TKT_is_default' => $ticket->get('TKT_is_default'), |
1500 | - 'TKT_qty' => $ticket->get_pretty('TKT_qty','input'), |
|
1500 | + 'TKT_qty' => $ticket->get_pretty('TKT_qty', 'input'), |
|
1501 | 1501 | 'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets', |
1502 | 1502 | 'TKT_sold' => $skeleton ? 0 : $ticket->get('TKT_sold'), |
1503 | - 'trash_icon' => ( $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted') ) ) && ( !empty( $ticket ) && $ticket->get('TKT_sold') === 0 ) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon', |
|
1504 | - 'disabled' => $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted' ) ) ? '' : ' disabled=disabled' |
|
1503 | + 'trash_icon' => ($skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted'))) && ( ! empty($ticket) && $ticket->get('TKT_sold') === 0) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon', |
|
1504 | + 'disabled' => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? '' : ' disabled=disabled' |
|
1505 | 1505 | ); |
1506 | 1506 | |
1507 | 1507 | $price = $ticket->ID() !== 0 ? $ticket->get_first_related('Price', array('default_where_conditions' => 'none')) : EE_Registry::instance()->load_model('Price')->create_default_object(); |
@@ -1517,23 +1517,23 @@ discard block |
||
1517 | 1517 | |
1518 | 1518 | //make sure we have default start and end dates if skeleton |
1519 | 1519 | //handle rows that should NOT be empty |
1520 | - if ( empty( $template_args['TKT_start_date'] ) ) { |
|
1520 | + if (empty($template_args['TKT_start_date'])) { |
|
1521 | 1521 | //if empty then the start date will be now. |
1522 | 1522 | $template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp')); |
1523 | 1523 | } |
1524 | 1524 | |
1525 | - if ( empty( $template_args['TKT_end_date'] ) ) { |
|
1525 | + if (empty($template_args['TKT_end_date'])) { |
|
1526 | 1526 | //get the earliest datetime (if present); |
1527 | - $earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL; |
|
1527 | + $earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL; |
|
1528 | 1528 | |
1529 | - if ( !empty( $earliest_dtt ) ) |
|
1529 | + if ( ! empty($earliest_dtt)) |
|
1530 | 1530 | $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a'); |
1531 | 1531 | else |
1532 | - $template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) ); |
|
1532 | + $template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d") + 7, date("Y"))); |
|
1533 | 1533 | } |
1534 | 1534 | |
1535 | - $template_args = array_merge( $template_args, $price_args ); |
|
1536 | - $template = apply_filters( 'FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php', $ticket); |
|
1535 | + $template_args = array_merge($template_args, $price_args); |
|
1536 | + $template = apply_filters('FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php', $ticket); |
|
1537 | 1537 | return EEH_Template::display_template($template, $template_args, TRUE); |
1538 | 1538 | } |
1539 | 1539 | |
@@ -1562,8 +1562,8 @@ discard block |
||
1562 | 1562 | $template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status()); |
1563 | 1563 | $template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description()); |
1564 | 1564 | $template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false); |
1565 | - $template_args['additional_registration_options'] = apply_filters( 'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values ); |
|
1566 | - $templatepath = EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php'; |
|
1565 | + $template_args['additional_registration_options'] = apply_filters('FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values); |
|
1566 | + $templatepath = EVENTS_TEMPLATE_PATH.'event_registration_options.template.php'; |
|
1567 | 1567 | EEH_Template::display_template($templatepath, $template_args); |
1568 | 1568 | } |
1569 | 1569 | |
@@ -1591,21 +1591,21 @@ discard block |
||
1591 | 1591 | $EEME = $this->_event_model(); |
1592 | 1592 | |
1593 | 1593 | $offset = ($current_page - 1) * $per_page; |
1594 | - $limit = $count ? NULL : $offset . ',' . $per_page; |
|
1594 | + $limit = $count ? NULL : $offset.','.$per_page; |
|
1595 | 1595 | $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID'; |
1596 | 1596 | $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : "DESC"; |
1597 | 1597 | |
1598 | 1598 | if (isset($this->_req_data['month_range'])) { |
1599 | 1599 | $pieces = explode(' ', $this->_req_data['month_range'], 3); |
1600 | - $month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
1601 | - $year_r = !empty($pieces[1]) ? $pieces[1] : ''; |
|
1600 | + $month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
1601 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : ''; |
|
1602 | 1602 | } |
1603 | 1603 | |
1604 | 1604 | $where = array(); |
1605 | 1605 | |
1606 | - $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL; |
|
1606 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL; |
|
1607 | 1607 | //determine what post_status our condition will have for the query. |
1608 | - switch ( $status ) { |
|
1608 | + switch ($status) { |
|
1609 | 1609 | case 'month' : |
1610 | 1610 | case 'today' : |
1611 | 1611 | case NULL : |
@@ -1613,7 +1613,7 @@ discard block |
||
1613 | 1613 | break; |
1614 | 1614 | |
1615 | 1615 | case 'draft' : |
1616 | - $where['status'] = array( 'IN', array('draft', 'auto-draft') ); |
|
1616 | + $where['status'] = array('IN', array('draft', 'auto-draft')); |
|
1617 | 1617 | break; |
1618 | 1618 | |
1619 | 1619 | default : |
@@ -1621,43 +1621,43 @@ discard block |
||
1621 | 1621 | } |
1622 | 1622 | |
1623 | 1623 | //categories? |
1624 | - $category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL; |
|
1624 | + $category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL; |
|
1625 | 1625 | |
1626 | - if ( !empty ( $category ) ) { |
|
1626 | + if ( ! empty ($category)) { |
|
1627 | 1627 | $where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
1628 | 1628 | $where['Term_Taxonomy.term_id'] = $category; |
1629 | 1629 | } |
1630 | 1630 | |
1631 | 1631 | //date where conditions |
1632 | - $start_formats = EEM_Datetime::instance()->get_formats_for( 'DTT_EVT_start' ); |
|
1632 | + $start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start'); |
|
1633 | 1633 | if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] != '') { |
1634 | - $DateTime = new DateTime( $year_r . '-' . $month_r . '-01 00:00:00', new DateTimeZone( EEM_Datetime::instance()->get_timezone() ) ); |
|
1635 | - $start = $DateTime->format( implode( ' ', $start_formats ) ); |
|
1636 | - $end = $DateTime->setDate( $year_r, $month_r, $DateTime->format('t') )->setTime(23,59,59)->format( implode( ' ', $start_formats ) ); |
|
1637 | - $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array( $start, $end ) ); |
|
1634 | + $DateTime = new DateTime($year_r.'-'.$month_r.'-01 00:00:00', new DateTimeZone(EEM_Datetime::instance()->get_timezone())); |
|
1635 | + $start = $DateTime->format(implode(' ', $start_formats)); |
|
1636 | + $end = $DateTime->setDate($year_r, $month_r, $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats)); |
|
1637 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1638 | 1638 | } else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'today') { |
1639 | - $DateTime = new DateTime( 'now', new DateTimeZone( EEM_Event::instance()->get_timezone() ) ); |
|
1640 | - $start = $DateTime->setTime( 0,0,0 )->format( implode( ' ', $start_formats ) ); |
|
1641 | - $end = $DateTime->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) ); |
|
1642 | - $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
|
1643 | - } else if ( isset($this->_req_data['status']) && $this->_req_data['status'] == 'month' ) { |
|
1644 | - $now = date( 'Y-m-01' ); |
|
1645 | - $DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) ); |
|
1646 | - $start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) ); |
|
1647 | - $end = $DateTime->setDate( date('Y'), date('m'), $DateTime->format('t' ) )->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) ); |
|
1648 | - $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
|
1639 | + $DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone())); |
|
1640 | + $start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats)); |
|
1641 | + $end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats)); |
|
1642 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1643 | + } else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'month') { |
|
1644 | + $now = date('Y-m-01'); |
|
1645 | + $DateTime = new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone())); |
|
1646 | + $start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats)); |
|
1647 | + $end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats)); |
|
1648 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1649 | 1649 | } |
1650 | 1650 | |
1651 | 1651 | |
1652 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
|
1653 | - $where['EVT_wp_user'] = get_current_user_id(); |
|
1652 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
1653 | + $where['EVT_wp_user'] = get_current_user_id(); |
|
1654 | 1654 | } else { |
1655 | - if ( ! isset( $where['status'] ) ) { |
|
1656 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) { |
|
1655 | + if ( ! isset($where['status'])) { |
|
1656 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) { |
|
1657 | 1657 | $where['OR'] = array( |
1658 | - 'status*restrict_private' => array( '!=', 'private' ), |
|
1658 | + 'status*restrict_private' => array('!=', 'private'), |
|
1659 | 1659 | 'AND' => array( |
1660 | - 'status*inclusive' => array( '=', 'private' ), |
|
1660 | + 'status*inclusive' => array('=', 'private'), |
|
1661 | 1661 | 'EVT_wp_user' => get_current_user_id() |
1662 | 1662 | ) |
1663 | 1663 | ); |
@@ -1665,16 +1665,16 @@ discard block |
||
1665 | 1665 | } |
1666 | 1666 | } |
1667 | 1667 | |
1668 | - if ( isset( $this->_req_data['EVT_wp_user'] ) ) { |
|
1669 | - if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
|
1668 | + if (isset($this->_req_data['EVT_wp_user'])) { |
|
1669 | + if ($this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
1670 | 1670 | $where['EVT_wp_user'] = $this->_req_data['EVT_wp_user']; |
1671 | 1671 | } |
1672 | 1672 | } |
1673 | 1673 | |
1674 | 1674 | |
1675 | 1675 | //search query handling |
1676 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1677 | - $search_string = '%' . $this->_req_data['s'] . '%'; |
|
1676 | + if (isset($this->_req_data['s'])) { |
|
1677 | + $search_string = '%'.$this->_req_data['s'].'%'; |
|
1678 | 1678 | $where['OR'] = array( |
1679 | 1679 | 'EVT_name' => array('LIKE', $search_string), |
1680 | 1680 | 'EVT_desc' => array('LIKE', $search_string), |
@@ -1683,32 +1683,32 @@ discard block |
||
1683 | 1683 | } |
1684 | 1684 | |
1685 | 1685 | |
1686 | - $where = apply_filters( 'FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data ); |
|
1687 | - $query_params = apply_filters( 'FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID' ), $this->_req_data ); |
|
1686 | + $where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data); |
|
1687 | + $query_params = apply_filters('FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID'), $this->_req_data); |
|
1688 | 1688 | |
1689 | 1689 | |
1690 | 1690 | //let's first check if we have special requests coming in. |
1691 | - if ( isset( $this->_req_data['active_status'] ) ) { |
|
1692 | - switch ( $this->_req_data['active_status'] ) { |
|
1691 | + if (isset($this->_req_data['active_status'])) { |
|
1692 | + switch ($this->_req_data['active_status']) { |
|
1693 | 1693 | case 'upcoming' : |
1694 | - return $EEME->get_upcoming_events( $query_params, $count ); |
|
1694 | + return $EEME->get_upcoming_events($query_params, $count); |
|
1695 | 1695 | break; |
1696 | 1696 | |
1697 | 1697 | case 'expired' : |
1698 | - return $EEME->get_expired_events( $query_params, $count ); |
|
1698 | + return $EEME->get_expired_events($query_params, $count); |
|
1699 | 1699 | break; |
1700 | 1700 | |
1701 | 1701 | case 'active' : |
1702 | - return $EEME->get_active_events( $query_params, $count ); |
|
1702 | + return $EEME->get_active_events($query_params, $count); |
|
1703 | 1703 | break; |
1704 | 1704 | |
1705 | 1705 | case 'inactive' : |
1706 | - return $EEME->get_inactive_events( $query_params, $count ); |
|
1706 | + return $EEME->get_inactive_events($query_params, $count); |
|
1707 | 1707 | break; |
1708 | 1708 | } |
1709 | 1709 | } |
1710 | 1710 | |
1711 | - $events = $count ? $EEME->count( array( $where ), 'EVT_ID', true ) : $EEME->get_all( $query_params ); |
|
1711 | + $events = $count ? $EEME->count(array($where), 'EVT_ID', true) : $EEME->get_all($query_params); |
|
1712 | 1712 | |
1713 | 1713 | return $events; |
1714 | 1714 | } |
@@ -1717,23 +1717,23 @@ discard block |
||
1717 | 1717 | |
1718 | 1718 | |
1719 | 1719 | //handling for WordPress CPT actions (trash, restore, delete) |
1720 | - public function trash_cpt_item( $post_id ) { |
|
1720 | + public function trash_cpt_item($post_id) { |
|
1721 | 1721 | $this->_req_data['EVT_ID'] = $post_id; |
1722 | - $this->_trash_or_restore_event( 'trash', FALSE ); |
|
1722 | + $this->_trash_or_restore_event('trash', FALSE); |
|
1723 | 1723 | } |
1724 | 1724 | |
1725 | 1725 | |
1726 | 1726 | |
1727 | 1727 | |
1728 | - public function restore_cpt_item( $post_id ) { |
|
1728 | + public function restore_cpt_item($post_id) { |
|
1729 | 1729 | $this->_req_data['EVT_ID'] = $post_id; |
1730 | - $this->_trash_or_restore_event( 'draft', FALSE ); |
|
1730 | + $this->_trash_or_restore_event('draft', FALSE); |
|
1731 | 1731 | } |
1732 | 1732 | |
1733 | 1733 | |
1734 | - public function delete_cpt_item( $post_id ) { |
|
1734 | + public function delete_cpt_item($post_id) { |
|
1735 | 1735 | $this->_req_data['EVT_ID'] = $post_id; |
1736 | - $this->_delete_event( FALSE ); |
|
1736 | + $this->_delete_event(FALSE); |
|
1737 | 1737 | } |
1738 | 1738 | |
1739 | 1739 | |
@@ -1745,7 +1745,7 @@ discard block |
||
1745 | 1745 | * @param string $event_status |
1746 | 1746 | * @return void |
1747 | 1747 | */ |
1748 | - protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE ) { |
|
1748 | + protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE) { |
|
1749 | 1749 | //determine the event id and set to array. |
1750 | 1750 | $EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : FALSE; |
1751 | 1751 | // loop thru events |
@@ -1753,7 +1753,7 @@ discard block |
||
1753 | 1753 | // clean status |
1754 | 1754 | $event_status = sanitize_key($event_status); |
1755 | 1755 | // grab status |
1756 | - if (!empty($event_status)) { |
|
1756 | + if ( ! empty($event_status)) { |
|
1757 | 1757 | $success = $this->_change_event_status($EVT_ID, $event_status); |
1758 | 1758 | } else { |
1759 | 1759 | $success = FALSE; |
@@ -1767,7 +1767,7 @@ discard block |
||
1767 | 1767 | } |
1768 | 1768 | $action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
1769 | 1769 | |
1770 | - if ( $redirect_after ) |
|
1770 | + if ($redirect_after) |
|
1771 | 1771 | $this->_redirect_after_action($success, 'Event', $action, array('action' => 'default')); |
1772 | 1772 | } |
1773 | 1773 | |
@@ -1782,7 +1782,7 @@ discard block |
||
1782 | 1782 | // clean status |
1783 | 1783 | $event_status = sanitize_key($event_status); |
1784 | 1784 | // grab status |
1785 | - if (!empty($event_status)) { |
|
1785 | + if ( ! empty($event_status)) { |
|
1786 | 1786 | $success = TRUE; |
1787 | 1787 | //determine the event id and set to array. |
1788 | 1788 | $EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array(); |
@@ -1817,15 +1817,15 @@ discard block |
||
1817 | 1817 | * @param string $event_status |
1818 | 1818 | * @return bool |
1819 | 1819 | */ |
1820 | - private function _change_event_status( $EVT_ID = 0, $event_status = '') { |
|
1820 | + private function _change_event_status($EVT_ID = 0, $event_status = '') { |
|
1821 | 1821 | // grab event id |
1822 | - if (!$EVT_ID) { |
|
1822 | + if ( ! $EVT_ID) { |
|
1823 | 1823 | $msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso'); |
1824 | 1824 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1825 | 1825 | return FALSE; |
1826 | 1826 | } |
1827 | 1827 | |
1828 | - $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
1828 | + $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
1829 | 1829 | |
1830 | 1830 | // clean status |
1831 | 1831 | $event_status = sanitize_key($event_status); |
@@ -1851,7 +1851,7 @@ discard block |
||
1851 | 1851 | $hook = FALSE; |
1852 | 1852 | } |
1853 | 1853 | //use class to change status |
1854 | - $this->_cpt_model_obj->set_status( $event_status ); |
|
1854 | + $this->_cpt_model_obj->set_status($event_status); |
|
1855 | 1855 | $success = $this->_cpt_model_obj->save(); |
1856 | 1856 | |
1857 | 1857 | if ($success === FALSE) { |
@@ -1873,15 +1873,15 @@ discard block |
||
1873 | 1873 | * @access protected |
1874 | 1874 | * @param bool $redirect_after |
1875 | 1875 | */ |
1876 | - protected function _delete_event( $redirect_after = TRUE ) { |
|
1876 | + protected function _delete_event($redirect_after = TRUE) { |
|
1877 | 1877 | //determine the event id and set to array. |
1878 | 1878 | $EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : NULL; |
1879 | - $EVT_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $EVT_ID; |
|
1879 | + $EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID; |
|
1880 | 1880 | |
1881 | 1881 | |
1882 | 1882 | // loop thru events |
1883 | 1883 | if ($EVT_ID) { |
1884 | - $success = $this->_permanently_delete_event( $EVT_ID ); |
|
1884 | + $success = $this->_permanently_delete_event($EVT_ID); |
|
1885 | 1885 | // get list of events with no prices |
1886 | 1886 | $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array()); |
1887 | 1887 | // remove this event from the list of events with no prices |
@@ -1895,7 +1895,7 @@ discard block |
||
1895 | 1895 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1896 | 1896 | } |
1897 | 1897 | |
1898 | - if ( $redirect_after ) |
|
1898 | + if ($redirect_after) |
|
1899 | 1899 | $this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash')); |
1900 | 1900 | } |
1901 | 1901 | |
@@ -1913,12 +1913,12 @@ discard block |
||
1913 | 1913 | $EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array(); |
1914 | 1914 | // loop thru events |
1915 | 1915 | foreach ($EVT_IDs as $EVT_ID) { |
1916 | - $EVT_ID = absint( $EVT_ID ); |
|
1917 | - if ( $EVT_ID ) { |
|
1918 | - $results = $this->_permanently_delete_event( $EVT_ID ); |
|
1916 | + $EVT_ID = absint($EVT_ID); |
|
1917 | + if ($EVT_ID) { |
|
1918 | + $results = $this->_permanently_delete_event($EVT_ID); |
|
1919 | 1919 | $success = $results !== FALSE ? $success : FALSE; |
1920 | 1920 | // remove this event from the list of events with no prices |
1921 | - unset( $espresso_no_ticket_prices[ $EVT_ID ] ); |
|
1921 | + unset($espresso_no_ticket_prices[$EVT_ID]); |
|
1922 | 1922 | } else { |
1923 | 1923 | $success = FALSE; |
1924 | 1924 | $msg = __('An error occurred. An event could not be deleted because a valid event ID was not not supplied.', 'event_espresso'); |
@@ -1938,21 +1938,21 @@ discard block |
||
1938 | 1938 | * @param int $EVT_ID |
1939 | 1939 | * @return bool |
1940 | 1940 | */ |
1941 | - private function _permanently_delete_event( $EVT_ID = 0 ) { |
|
1941 | + private function _permanently_delete_event($EVT_ID = 0) { |
|
1942 | 1942 | // grab event id |
1943 | - if ( ! $EVT_ID ) { |
|
1943 | + if ( ! $EVT_ID) { |
|
1944 | 1944 | $msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso'); |
1945 | 1945 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1946 | 1946 | return FALSE; |
1947 | 1947 | } |
1948 | - $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
1948 | + $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
1949 | 1949 | |
1950 | 1950 | //need to delete related tickets and prices first. |
1951 | 1951 | $datetimes = $this->_cpt_model_obj->get_many_related('Datetime'); |
1952 | - foreach ( $datetimes as $datetime ) { |
|
1952 | + foreach ($datetimes as $datetime) { |
|
1953 | 1953 | $this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime'); |
1954 | 1954 | $tickets = $datetime->get_many_related('Ticket'); |
1955 | - foreach ( $tickets as $ticket ) { |
|
1955 | + foreach ($tickets as $ticket) { |
|
1956 | 1956 | $ticket->_remove_relation_to($datetime, 'Datetime'); |
1957 | 1957 | $ticket->delete_related_permanently('Price'); |
1958 | 1958 | $ticket->delete_permanently(); |
@@ -1962,14 +1962,14 @@ discard block |
||
1962 | 1962 | |
1963 | 1963 | //what about related venues or terms? |
1964 | 1964 | $venues = $this->_cpt_model_obj->get_many_related('Venue'); |
1965 | - foreach ( $venues as $venue ) { |
|
1965 | + foreach ($venues as $venue) { |
|
1966 | 1966 | $this->_cpt_model_obj->_remove_relation_to($venue, 'Venue'); |
1967 | 1967 | } |
1968 | 1968 | |
1969 | 1969 | //any attached question groups? |
1970 | 1970 | $question_groups = $this->_cpt_model_obj->get_many_related('Question_Group'); |
1971 | - if ( !empty( $question_groups ) ) { |
|
1972 | - foreach ( $question_groups as $question_group ) { |
|
1971 | + if ( ! empty($question_groups)) { |
|
1972 | + foreach ($question_groups as $question_group) { |
|
1973 | 1973 | $this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group'); |
1974 | 1974 | } |
1975 | 1975 | } |
@@ -1978,12 +1978,12 @@ discard block |
||
1978 | 1978 | |
1979 | 1979 | |
1980 | 1980 | //Message Template Groups |
1981 | - $this->_cpt_model_obj->_remove_relations( 'Message_Template_Group' ); |
|
1981 | + $this->_cpt_model_obj->_remove_relations('Message_Template_Group'); |
|
1982 | 1982 | |
1983 | 1983 | /** @type EE_Term_Taxonomy[] $term_taxonomies */ |
1984 | 1984 | $term_taxonomies = $this->_cpt_model_obj->term_taxonomies(); |
1985 | 1985 | |
1986 | - foreach ( $term_taxonomies as $term_taxonomy ) { |
|
1986 | + foreach ($term_taxonomies as $term_taxonomy) { |
|
1987 | 1987 | $this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy); |
1988 | 1988 | } |
1989 | 1989 | |
@@ -1997,7 +1997,7 @@ discard block |
||
1997 | 1997 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1998 | 1998 | return FALSE; |
1999 | 1999 | } |
2000 | - do_action( 'AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID ); |
|
2000 | + do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID); |
|
2001 | 2001 | return TRUE; |
2002 | 2002 | } |
2003 | 2003 | |
@@ -2014,7 +2014,7 @@ discard block |
||
2014 | 2014 | */ |
2015 | 2015 | public function total_events() { |
2016 | 2016 | |
2017 | - $count = EEM_Event::instance()->count( array( 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
2017 | + $count = EEM_Event::instance()->count(array('caps' => 'read_admin'), 'EVT_ID', true); |
|
2018 | 2018 | return $count; |
2019 | 2019 | } |
2020 | 2020 | |
@@ -2029,10 +2029,10 @@ discard block |
||
2029 | 2029 | */ |
2030 | 2030 | public function total_events_draft() { |
2031 | 2031 | $where = array( |
2032 | - 'status' => array( 'IN', array('draft', 'auto-draft' ) ) |
|
2032 | + 'status' => array('IN', array('draft', 'auto-draft')) |
|
2033 | 2033 | ); |
2034 | 2034 | |
2035 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
2035 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
2036 | 2036 | return $count; |
2037 | 2037 | } |
2038 | 2038 | |
@@ -2051,7 +2051,7 @@ discard block |
||
2051 | 2051 | 'status' => 'trash' |
2052 | 2052 | ); |
2053 | 2053 | |
2054 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
2054 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
2055 | 2055 | return $count; |
2056 | 2056 | } |
2057 | 2057 | |
@@ -2079,11 +2079,11 @@ discard block |
||
2079 | 2079 | // translated |
2080 | 2080 | TRUE |
2081 | 2081 | ); |
2082 | - $this->_template_args['default_reg_status'] = isset( EE_Registry::instance()->CFG->registration->default_STS_ID ) ? sanitize_text_field( EE_Registry::instance()->CFG->registration->default_STS_ID ) : EEM_Registration::status_id_pending_payment; |
|
2082 | + $this->_template_args['default_reg_status'] = isset(EE_Registry::instance()->CFG->registration->default_STS_ID) ? sanitize_text_field(EE_Registry::instance()->CFG->registration->default_STS_ID) : EEM_Registration::status_id_pending_payment; |
|
2083 | 2083 | |
2084 | 2084 | $this->_set_add_edit_form_tags('update_default_event_settings'); |
2085 | 2085 | $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
2086 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH . 'event_settings.template.php', $this->_template_args, TRUE); |
|
2086 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_settings.template.php', $this->_template_args, TRUE); |
|
2087 | 2087 | $this->display_admin_page_with_sidebar(); |
2088 | 2088 | } |
2089 | 2089 | |
@@ -2109,9 +2109,9 @@ discard block |
||
2109 | 2109 | |
2110 | 2110 | protected function _template_settings() { |
2111 | 2111 | $this->_admin_page_title = __('Template Settings (Preview)', 'event_espresso'); |
2112 | - $this->_template_args['preview_img'] = '<img src="' . EVENTS_ASSETS_URL . DS . 'images' . DS . 'caffeinated_template_features.jpg" alt="' . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) . '" />'; |
|
2113 | - $this->_template_args['preview_text'] = '<strong>'.__( 'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso' ).'</strong>'; |
|
2114 | - $this->display_admin_caf_preview_page( 'template_settings_tab' ); |
|
2112 | + $this->_template_args['preview_img'] = '<img src="'.EVENTS_ASSETS_URL.DS.'images'.DS.'caffeinated_template_features.jpg" alt="'.esc_attr__('Template Settings Preview screenshot', 'event_espresso').'" />'; |
|
2113 | + $this->_template_args['preview_text'] = '<strong>'.__('Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso').'</strong>'; |
|
2114 | + $this->display_admin_caf_preview_page('template_settings_tab'); |
|
2115 | 2115 | } |
2116 | 2116 | |
2117 | 2117 | |
@@ -2124,22 +2124,22 @@ discard block |
||
2124 | 2124 | * @return void |
2125 | 2125 | */ |
2126 | 2126 | private function _set_category_object() { |
2127 | - if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) |
|
2127 | + if (isset($this->_category->id) && ! empty($this->_category->id)) |
|
2128 | 2128 | return; //already have the category object so get out. |
2129 | 2129 | |
2130 | 2130 | //set default category object |
2131 | 2131 | $this->_set_empty_category_object(); |
2132 | 2132 | |
2133 | 2133 | //only set if we've got an id |
2134 | - if ( !isset($this->_req_data['EVT_CAT_ID'] ) ) { |
|
2134 | + if ( ! isset($this->_req_data['EVT_CAT_ID'])) { |
|
2135 | 2135 | return; |
2136 | 2136 | } |
2137 | 2137 | |
2138 | 2138 | $category_id = absint($this->_req_data['EVT_CAT_ID']); |
2139 | 2139 | |
2140 | - $term = get_term( $category_id, 'espresso_event_categories' ); |
|
2140 | + $term = get_term($category_id, 'espresso_event_categories'); |
|
2141 | 2141 | |
2142 | - if ( !empty( $term ) ) { |
|
2142 | + if ( ! empty($term)) { |
|
2143 | 2143 | $this->_category->category_name = $term->name; |
2144 | 2144 | $this->_category->category_identifier = $term->slug; |
2145 | 2145 | $this->_category->category_desc = $term->description; |
@@ -2153,13 +2153,13 @@ discard block |
||
2153 | 2153 | |
2154 | 2154 | private function _set_empty_category_object() { |
2155 | 2155 | $this->_category = new stdClass(); |
2156 | - $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
2156 | + $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
2157 | 2157 | $this->_category->id = $this->_category->parent = 0; |
2158 | 2158 | } |
2159 | 2159 | |
2160 | 2160 | |
2161 | 2161 | protected function _category_list_table() { |
2162 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2162 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2163 | 2163 | $this->_search_btn_label = __('Categories', 'event_espresso'); |
2164 | 2164 | $this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2'); |
2165 | 2165 | $this->display_admin_list_table_page_with_sidebar(); |
@@ -2169,22 +2169,22 @@ discard block |
||
2169 | 2169 | protected function _category_details($view) { |
2170 | 2170 | |
2171 | 2171 | //load formatter helper |
2172 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
2172 | + EE_Registry::instance()->load_helper('Formatter'); |
|
2173 | 2173 | //load field generator helper |
2174 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
2174 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
2175 | 2175 | |
2176 | 2176 | $route = $view == 'edit' ? 'update_category' : 'insert_category'; |
2177 | 2177 | $this->_set_add_edit_form_tags($route); |
2178 | 2178 | |
2179 | 2179 | $this->_set_category_object(); |
2180 | - $id = !empty($this->_category->id) ? $this->_category->id : ''; |
|
2180 | + $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
2181 | 2181 | |
2182 | 2182 | $delete_action = 'delete_category'; |
2183 | 2183 | |
2184 | 2184 | //custom redirect |
2185 | - $redirect = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'category_list'), $this->_admin_base_url ); |
|
2185 | + $redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url); |
|
2186 | 2186 | |
2187 | - $this->_set_publish_post_box_vars( 'EVT_CAT_ID', $id, $delete_action, $redirect ); |
|
2187 | + $this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect); |
|
2188 | 2188 | |
2189 | 2189 | //take care of contents |
2190 | 2190 | $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
@@ -2198,25 +2198,25 @@ discard block |
||
2198 | 2198 | 'type' => 'wp_editor', |
2199 | 2199 | 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
2200 | 2200 | 'class' => 'my_editor_custom', |
2201 | - 'wpeditor_args' => array('media_buttons' => FALSE ) |
|
2201 | + 'wpeditor_args' => array('media_buttons' => FALSE) |
|
2202 | 2202 | ); |
2203 | - $_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' ); |
|
2203 | + $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
2204 | 2204 | |
2205 | - $all_terms = get_terms( array('espresso_event_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) ); |
|
2205 | + $all_terms = get_terms(array('espresso_event_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id))); |
|
2206 | 2206 | |
2207 | 2207 | //setup category select for term parents. |
2208 | 2208 | $category_select_values[] = array( |
2209 | 2209 | 'text' => __('No Parent', 'event_espresso'), |
2210 | 2210 | 'id' => 0 |
2211 | 2211 | ); |
2212 | - foreach ( $all_terms as $term ) { |
|
2212 | + foreach ($all_terms as $term) { |
|
2213 | 2213 | $category_select_values[] = array( |
2214 | 2214 | 'text' => $term->name, |
2215 | 2215 | 'id' => $term->term_id |
2216 | 2216 | ); |
2217 | 2217 | } |
2218 | 2218 | |
2219 | - $category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent ); |
|
2219 | + $category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent); |
|
2220 | 2220 | |
2221 | 2221 | $template_args = array( |
2222 | 2222 | 'category' => $this->_category, |
@@ -2226,15 +2226,15 @@ discard block |
||
2226 | 2226 | 'disable' => '', |
2227 | 2227 | 'disabled_message' => FALSE |
2228 | 2228 | ); |
2229 | - $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
2230 | - return EEH_Template::display_template($template, $template_args, TRUE ); |
|
2229 | + $template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php'; |
|
2230 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
2231 | 2231 | } |
2232 | 2232 | |
2233 | 2233 | |
2234 | 2234 | protected function _delete_categories() { |
2235 | - $cat_ids = isset( $this->_req_data['EVT_CAT_ID'] ) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
2235 | + $cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
2236 | 2236 | |
2237 | - foreach ( $cat_ids as $cat_id ) { |
|
2237 | + foreach ($cat_ids as $cat_id) { |
|
2238 | 2238 | $this->_delete_category($cat_id); |
2239 | 2239 | } |
2240 | 2240 | |
@@ -2242,7 +2242,7 @@ discard block |
||
2242 | 2242 | $query_args = array( |
2243 | 2243 | 'action' => 'category_list' |
2244 | 2244 | ); |
2245 | - $this->_redirect_after_action(0,'','',$query_args); |
|
2245 | + $this->_redirect_after_action(0, '', '', $query_args); |
|
2246 | 2246 | |
2247 | 2247 | } |
2248 | 2248 | |
@@ -2252,61 +2252,61 @@ discard block |
||
2252 | 2252 | |
2253 | 2253 | protected function _delete_category($cat_id) { |
2254 | 2254 | global $wpdb; |
2255 | - $cat_id = absint( $cat_id ); |
|
2256 | - wp_delete_term( $cat_id, 'espresso_event_categories' ); |
|
2255 | + $cat_id = absint($cat_id); |
|
2256 | + wp_delete_term($cat_id, 'espresso_event_categories'); |
|
2257 | 2257 | } |
2258 | 2258 | |
2259 | 2259 | |
2260 | 2260 | |
2261 | 2261 | protected function _insert_or_update_category($new_category) { |
2262 | 2262 | |
2263 | - $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE ); |
|
2263 | + $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE); |
|
2264 | 2264 | $success = 0; //we already have a success message so lets not send another. |
2265 | 2265 | |
2266 | - if ( $cat_id ) { |
|
2266 | + if ($cat_id) { |
|
2267 | 2267 | $query_args = array( |
2268 | 2268 | 'action' => 'edit_category', |
2269 | 2269 | 'EVT_CAT_ID' => $cat_id |
2270 | 2270 | ); |
2271 | 2271 | } else { |
2272 | - $query_args = array( 'action' => 'add_category' ); |
|
2272 | + $query_args = array('action' => 'add_category'); |
|
2273 | 2273 | } |
2274 | - $this->_redirect_after_action( $success, '','', $query_args, TRUE ); |
|
2274 | + $this->_redirect_after_action($success, '', '', $query_args, TRUE); |
|
2275 | 2275 | |
2276 | 2276 | } |
2277 | 2277 | |
2278 | 2278 | |
2279 | 2279 | |
2280 | - private function _insert_category( $update = FALSE ) { |
|
2280 | + private function _insert_category($update = FALSE) { |
|
2281 | 2281 | $cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : ''; |
2282 | - $category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : ''; |
|
2283 | - $category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : ''; |
|
2284 | - $category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0; |
|
2282 | + $category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : ''; |
|
2283 | + $category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : ''; |
|
2284 | + $category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0; |
|
2285 | 2285 | |
2286 | - if ( empty( $category_name ) ) { |
|
2287 | - $msg = __( 'You must add a name for the category.', 'event_espresso' ); |
|
2288 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2286 | + if (empty($category_name)) { |
|
2287 | + $msg = __('You must add a name for the category.', 'event_espresso'); |
|
2288 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2289 | 2289 | return false; |
2290 | 2290 | } |
2291 | 2291 | |
2292 | - $term_args=array( |
|
2292 | + $term_args = array( |
|
2293 | 2293 | 'name'=>$category_name, |
2294 | 2294 | 'description'=>$category_desc, |
2295 | 2295 | 'parent'=>$category_parent |
2296 | 2296 | ); |
2297 | 2297 | //was the category_identifier input disabled? |
2298 | - if(isset($this->_req_data['category_identifier'])){ |
|
2298 | + if (isset($this->_req_data['category_identifier'])) { |
|
2299 | 2299 | $term_args['slug'] = $this->_req_data['category_identifier']; |
2300 | 2300 | } |
2301 | - $insert_ids = $update ? wp_update_term( $cat_id, 'espresso_event_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_event_categories', $term_args ); |
|
2301 | + $insert_ids = $update ? wp_update_term($cat_id, 'espresso_event_categories', $term_args) : wp_insert_term($category_name, 'espresso_event_categories', $term_args); |
|
2302 | 2302 | |
2303 | - if ( !is_array( $insert_ids ) ) { |
|
2304 | - $msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' ); |
|
2305 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2303 | + if ( ! is_array($insert_ids)) { |
|
2304 | + $msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso'); |
|
2305 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2306 | 2306 | } else { |
2307 | 2307 | $cat_id = $insert_ids['term_id']; |
2308 | - $msg = sprintf ( __('The category %s was successfuly saved', 'event_espresso'), $category_name ); |
|
2309 | - EE_Error::add_success( $msg ); |
|
2308 | + $msg = sprintf(__('The category %s was successfuly saved', 'event_espresso'), $category_name); |
|
2309 | + EE_Error::add_success($msg); |
|
2310 | 2310 | } |
2311 | 2311 | |
2312 | 2312 | return $cat_id; |
@@ -2315,32 +2315,32 @@ discard block |
||
2315 | 2315 | |
2316 | 2316 | |
2317 | 2317 | |
2318 | - public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) { |
|
2318 | + public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) { |
|
2319 | 2319 | global $wpdb; |
2320 | 2320 | |
2321 | 2321 | //testing term stuff |
2322 | - $orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
2323 | - $order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC'; |
|
2324 | - $limit = ($current_page-1)*$per_page; |
|
2322 | + $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
2323 | + $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC'; |
|
2324 | + $limit = ($current_page - 1) * $per_page; |
|
2325 | 2325 | |
2326 | - $where = array( 'taxonomy' => 'espresso_event_categories' ); |
|
2326 | + $where = array('taxonomy' => 'espresso_event_categories'); |
|
2327 | 2327 | |
2328 | - if ( isset( $this->_req_data['s'] ) ) { |
|
2329 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2328 | + if (isset($this->_req_data['s'])) { |
|
2329 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2330 | 2330 | $where['OR'] = array( |
2331 | - 'Term.name' => array( 'LIKE', $sstr), |
|
2332 | - 'description' => array( 'LIKE', $sstr ) |
|
2331 | + 'Term.name' => array('LIKE', $sstr), |
|
2332 | + 'description' => array('LIKE', $sstr) |
|
2333 | 2333 | ); |
2334 | 2334 | } |
2335 | 2335 | |
2336 | 2336 | $query_params = array( |
2337 | - $where , |
|
2338 | - 'order_by' => array( $orderby => $order ), |
|
2339 | - 'limit' => $limit . ',' . $per_page, |
|
2337 | + $where, |
|
2338 | + 'order_by' => array($orderby => $order), |
|
2339 | + 'limit' => $limit.','.$per_page, |
|
2340 | 2340 | 'force_join' => array('Term') |
2341 | 2341 | ); |
2342 | 2342 | |
2343 | - $categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params ); |
|
2343 | + $categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
2344 | 2344 | |
2345 | 2345 | return $categories; |
2346 | 2346 | } |
@@ -3,5 +3,5 @@ |
||
3 | 3 | <?php _e('A venue is the place or location that is hosting your event. This setting is optional which means that you are not required to select a venue for your event.', 'event_espresso'); ?> |
4 | 4 | </p> |
5 | 5 | <p> |
6 | -<?php echo sprintf(__('Venues can be managed through the %sVenues page%s.', 'event_espresso'),'<a href="admin.php?page=espresso_venues">','</a>'); ?> |
|
6 | +<?php echo sprintf(__('Venues can be managed through the %sVenues page%s.', 'event_espresso'), '<a href="admin.php?page=espresso_venues">', '</a>'); ?> |
|
7 | 7 | </p> |
8 | 8 | \ No newline at end of file |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php do_action( 'AHEE__event_tickets_metabox_main__before_content' ); ?> |
|
1 | +<?php do_action('AHEE__event_tickets_metabox_main__before_content'); ?> |
|
2 | 2 | <div id="event-and-ticket-form-content"> |
3 | 3 | <h4 class="event-tickets-datetimes-title"><?php _e('Event Datetime', 'event_espresso'); ?></h4><?php echo $event_datetime_help_link; ?> |
4 | 4 | <div class="event-datetimes-container"> |
@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | </td> |
30 | 30 | <td class="event-datetime-column reg-limit-column"> |
31 | 31 | <?php |
32 | - $reg_limit = $time->get_pretty('DTT_reg_limit','input'); |
|
32 | + $reg_limit = $time->get_pretty('DTT_reg_limit', 'input'); |
|
33 | 33 | ?> |
34 | 34 | <input type="text" name="edit_event_datetimes[1][DTT_reg_limit]" id="event-datetime-DTT_reg_limit-1" class="ee-small-text-inp ee-inp-right event-datetime-DTT_reg_limit" value="<?php echo $reg_limit; ?>"> |
35 | 35 | </td> |
36 | - <td class="datetime-tickets-sold"><?php printf( __('Tickets Sold: %s', 'event_espresso'), $time->get('DTT_sold') ); ?></td> |
|
36 | + <td class="datetime-tickets-sold"><?php printf(__('Tickets Sold: %s', 'event_espresso'), $time->get('DTT_sold')); ?></td> |
|
37 | 37 | </tr> |
38 | 38 | </tbody> |
39 | 39 | </table> |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | <div style="clear:both"></div> |
72 | 72 | </div> <!-- end #event-and-ticket-form-content --> |
73 | 73 | |
74 | -<?php do_action( 'AHEE__event_tickets_metabox_main__after_content' ); ?> |
|
74 | +<?php do_action('AHEE__event_tickets_metabox_main__after_content'); ?> |
|
75 | 75 | |
76 | 76 | <table id="new-ticket-row-form" class="hidden"> |
77 | 77 | <tbody><?php echo $ticket_js_structure; ?></tbody> |
@@ -6,41 +6,41 @@ |
||
6 | 6 | <ul> |
7 | 7 | <li> |
8 | 8 | <strong><?php _e('Registration Checkout Page', 'event_espresso'); ?></strong><br /> |
9 | -<?php printf( __('This page displays all your events and is required. It is important that this page always contain the %s shortcode. It is not required to be in your navigation menu.', 'event_espresso'), '<strong>[ESPRESSO_CHECKOUT]</strong>' ); ?> |
|
9 | +<?php printf(__('This page displays all your events and is required. It is important that this page always contain the %s shortcode. It is not required to be in your navigation menu.', 'event_espresso'), '<strong>[ESPRESSO_CHECKOUT]</strong>'); ?> |
|
10 | 10 | </li> |
11 | 11 | <li> |
12 | 12 | <strong><?php _e('Transactions Page', 'event_espresso'); ?></strong><br /> |
13 | -<?php printf( __('This page processes the payments and is required. It should only contain the %s shortcode. No other content should be added and it should be hidden from your navigation menu.', 'event_espresso'), '<strong>[ESPRESSO_TXN_PAGE]</strong>' ); ?> |
|
13 | +<?php printf(__('This page processes the payments and is required. It should only contain the %s shortcode. No other content should be added and it should be hidden from your navigation menu.', 'event_espresso'), '<strong>[ESPRESSO_TXN_PAGE]</strong>'); ?> |
|
14 | 14 | </li> |
15 | 15 | <li> |
16 | 16 | <strong><?php _e('Thank You Page', 'event_espresso'); ?></strong><br /> |
17 | -<?php printf( __('This page is displayed after a successful transaction and is required. It should contain the %s shortcode. Additionally, you may customize this page by adding extra content to the page. It should be hidden from your navigation menu.', 'event_espresso'), '<strong>[ESPRESSO_THANK_YOU]</strong>' ); ?> |
|
17 | +<?php printf(__('This page is displayed after a successful transaction and is required. It should contain the %s shortcode. Additionally, you may customize this page by adding extra content to the page. It should be hidden from your navigation menu.', 'event_espresso'), '<strong>[ESPRESSO_THANK_YOU]</strong>'); ?> |
|
18 | 18 | </li> |
19 | 19 | <li> |
20 | 20 | <strong><?php _e('Cancel / Return Page', 'event_espresso'); ?></strong><br /> |
21 | -<?php printf( __('This page is displayed after an unsuccessful transaction and is required. It should contain the %s shortcode. Additionally, you may customize this page by adding extra content to the page. It should be hidden from your navigation menu.', 'event_espresso'), '<strong>[ESPRESSO_CANCELLED]</strong>' ); ?> |
|
21 | +<?php printf(__('This page is displayed after an unsuccessful transaction and is required. It should contain the %s shortcode. Additionally, you may customize this page by adding extra content to the page. It should be hidden from your navigation menu.', 'event_espresso'), '<strong>[ESPRESSO_CANCELLED]</strong>'); ?> |
|
22 | 22 | </li> |
23 | 23 | <li> |
24 | 24 | <strong><?php _e('Event List', 'event_espresso'); ?></strong><br /> |
25 | -<?php printf(__('If you would like to style the look of your events archive page, then follow the WordPress instructions for %1$screating a custom template for archive pages%2$s.', 'event_espresso'), '<a href="http://codex.wordpress.org/Post_Type_Templates">','</a>'); ?> |
|
25 | +<?php printf(__('If you would like to style the look of your events archive page, then follow the WordPress instructions for %1$screating a custom template for archive pages%2$s.', 'event_espresso'), '<a href="http://codex.wordpress.org/Post_Type_Templates">', '</a>'); ?> |
|
26 | 26 | <ul> |
27 | 27 | <li style="list-style-type: circle;"> |
28 | -<?php printf( __('Build a template for your events - create a theme template named %1$s Then place it in your theme\'s root directory. For the default WordPress Twenty Thirteen theme, this location will be %2$s.', 'event_espresso'), '<strong>archive-espresso_events.php</strong>','wp-content/themes/twenty-fourteen' ); ?> |
|
28 | +<?php printf(__('Build a template for your events - create a theme template named %1$s Then place it in your theme\'s root directory. For the default WordPress Twenty Thirteen theme, this location will be %2$s.', 'event_espresso'), '<strong>archive-espresso_events.php</strong>', 'wp-content/themes/twenty-fourteen'); ?> |
|
29 | 29 | </li> |
30 | 30 | <li style="list-style-type: circle;"> |
31 | -<?php printf( __('Build a template for a single event - create a theme template named %1$s Then place it in your theme\'s root directory. For the default WordPress Twenty Thirteen theme, this location will be %2$s.', 'event_espresso'), '<strong>single-espresso_events.php</strong>','wp-content/themes/twenty-fourteen' ); ?> |
|
31 | +<?php printf(__('Build a template for a single event - create a theme template named %1$s Then place it in your theme\'s root directory. For the default WordPress Twenty Thirteen theme, this location will be %2$s.', 'event_espresso'), '<strong>single-espresso_events.php</strong>', 'wp-content/themes/twenty-fourteen'); ?> |
|
32 | 32 | </li> |
33 | 33 | </ul> |
34 | 34 | </li> |
35 | 35 | <li> |
36 | 36 | <strong><?php _e('Venue List', 'event_espresso'); ?></strong><br /> |
37 | -<?php printf(__('If you would like to style the look of your venues archive page, then follow the WordPress instructions for %1$screating a custom template for archive pages%2$s.', 'event_espresso'), '<a href="http://codex.wordpress.org/Post_Type_Templates">','</a>'); ?> |
|
37 | +<?php printf(__('If you would like to style the look of your venues archive page, then follow the WordPress instructions for %1$screating a custom template for archive pages%2$s.', 'event_espresso'), '<a href="http://codex.wordpress.org/Post_Type_Templates">', '</a>'); ?> |
|
38 | 38 | <ul> |
39 | 39 | <li style="list-style-type: circle;"> |
40 | -<?php printf( __('Build a template for your events - create a theme template named %1$s Then place it in your theme\'s root directory. For the default WordPress Twenty Thirteen theme, this location will be %2$s.', 'event_espresso'), '<strong>archive-espresso_venues.php</strong>','wp-content/themes/twenty-fourteen' ); ?> |
|
40 | +<?php printf(__('Build a template for your events - create a theme template named %1$s Then place it in your theme\'s root directory. For the default WordPress Twenty Thirteen theme, this location will be %2$s.', 'event_espresso'), '<strong>archive-espresso_venues.php</strong>', 'wp-content/themes/twenty-fourteen'); ?> |
|
41 | 41 | </li> |
42 | 42 | <li style="list-style-type: circle;"> |
43 | -<?php printf( __('Build a template for a single event - create a theme template named %1$s Then place it in your theme\'s root directory. For the default WordPress Twenty Thirteen theme, this location will be %2$s.', 'event_espresso'), '<strong>single-espresso_venues.php</strong>','wp-content/themes/twenty-fourteen' ); ?> |
|
43 | +<?php printf(__('Build a template for a single event - create a theme template named %1$s Then place it in your theme\'s root directory. For the default WordPress Twenty Thirteen theme, this location will be %2$s.', 'event_espresso'), '<strong>single-espresso_venues.php</strong>', 'wp-content/themes/twenty-fourteen'); ?> |
|
44 | 44 | </li> |
45 | 45 | </ul> |
46 | 46 | </li> |