@@ -1,26 +1,26 @@ discard block |
||
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 | - * Datetime Model |
|
17 | - * |
|
18 | - * @package Event Espresso |
|
19 | - * @subpackage includes/models/ |
|
20 | - * @author Brent Christensen |
|
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 | + * Datetime Model |
|
17 | + * |
|
18 | + * @package Event Espresso |
|
19 | + * @subpackage includes/models/ |
|
20 | + * @author Brent Christensen |
|
21 | + * |
|
22 | + * ------------------------------------------------------------------------ |
|
23 | + */ |
|
24 | 24 | require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
25 | 25 | require_once ( EE_CLASSES . 'EE_Datetime.class.php' ); |
26 | 26 | |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | |
76 | 76 | |
77 | 77 | /** |
78 | - * create new blank datetime |
|
79 | - * |
|
80 | - * @access public |
|
81 | - * @return EE_Datetime[] array on success, FALSE on fail |
|
82 | - */ |
|
78 | + * create new blank datetime |
|
79 | + * |
|
80 | + * @access public |
|
81 | + * @return EE_Datetime[] array on success, FALSE on fail |
|
82 | + */ |
|
83 | 83 | public function create_new_blank_datetime() { |
84 | 84 | $blank_datetime = EE_Datetime::new_instance( |
85 | 85 | array( |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | |
101 | 101 | |
102 | 102 | /** |
103 | - * get event start date from db |
|
104 | - * |
|
105 | - * @access public |
|
106 | - * @param int $EVT_ID |
|
107 | - * @return EE_Datetime[] array on success, FALSE on fail |
|
108 | - */ |
|
103 | + * get event start date from db |
|
104 | + * |
|
105 | + * @access public |
|
106 | + * @param int $EVT_ID |
|
107 | + * @return EE_Datetime[] array on success, FALSE on fail |
|
108 | + */ |
|
109 | 109 | public function get_all_event_dates( $EVT_ID = 0 ) { |
110 | 110 | if ( ! $EVT_ID ) { // on add_new_event event_id gets set to 0 |
111 | 111 | return $this->create_new_blank_datetime(); |
@@ -250,14 +250,14 @@ discard block |
||
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
253 | - * Gets ALL the datetimes for an ticket (including trashed ones, for now), ordered |
|
254 | - * only by start date |
|
255 | - * @param int $TKT_ID |
|
256 | - * @param boolean $include_expired |
|
257 | - * @param boolean $include_deleted |
|
258 | - * @param int $limit |
|
259 | - * @return EE_Datetime[] |
|
260 | - */ |
|
253 | + * Gets ALL the datetimes for an ticket (including trashed ones, for now), ordered |
|
254 | + * only by start date |
|
255 | + * @param int $TKT_ID |
|
256 | + * @param boolean $include_expired |
|
257 | + * @param boolean $include_deleted |
|
258 | + * @param int $limit |
|
259 | + * @return EE_Datetime[] |
|
260 | + */ |
|
261 | 261 | public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted= true, $limit = NULL){ |
262 | 262 | //sanitize TKT_ID |
263 | 263 | $TKT_ID = intval( $TKT_ID ); |
@@ -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_Datetime.class.php' ); |
|
24 | +require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
25 | +require_once (EE_CLASSES.'EE_Datetime.class.php'); |
|
26 | 26 | |
27 | 27 | class EEM_Datetime extends EEM_Soft_Delete_Base { |
28 | 28 | |
@@ -35,27 +35,27 @@ discard block |
||
35 | 35 | * @access private |
36 | 36 | * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) |
37 | 37 | */ |
38 | - protected function __construct( $timezone ) { |
|
39 | - $this->singular_item = __('Datetime','event_espresso'); |
|
40 | - $this->plural_item = __('Datetimes','event_espresso'); |
|
38 | + protected function __construct($timezone) { |
|
39 | + $this->singular_item = __('Datetime', 'event_espresso'); |
|
40 | + $this->plural_item = __('Datetimes', 'event_espresso'); |
|
41 | 41 | |
42 | 42 | $this->_tables = array( |
43 | 43 | 'Datetime'=> new EE_Primary_Table('esp_datetime', 'DTT_ID') |
44 | 44 | ); |
45 | 45 | $this->_fields = array( |
46 | 46 | 'Datetime'=>array( |
47 | - 'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID','event_espresso')), |
|
48 | - 'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID','event_espresso'), false, 0, 'Event'), |
|
47 | + 'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID', 'event_espresso')), |
|
48 | + 'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID', 'event_espresso'), false, 0, 'Event'), |
|
49 | 49 | 'DTT_name' => new EE_Plain_Text_Field('DTT_name', __('Datetime Name', 'event_espresso'), false, ''), |
50 | 50 | 'DTT_description' => new EE_Full_HTML_Field('DTT_description', __('Description for Datetime', 'event_espresso'), false, ''), |
51 | - 'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event','event_espresso'), false, time(), $timezone ), |
|
52 | - 'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event','event_espresso'), false, time(), $timezone ), |
|
53 | - 'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time','event_espresso'), true, EE_INF), |
|
54 | - 'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0 ), |
|
55 | - 'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false,false), |
|
51 | + 'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event', 'event_espresso'), false, time(), $timezone), |
|
52 | + 'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event', 'event_espresso'), false, time(), $timezone), |
|
53 | + 'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time', 'event_espresso'), true, EE_INF), |
|
54 | + 'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0), |
|
55 | + 'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false, false), |
|
56 | 56 | 'DTT_order' => new EE_Integer_Field('DTT_order', __('The order in which the Datetime is displayed', 'event_espresso'), false, 0), |
57 | - 'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0 ), |
|
58 | - 'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false ), |
|
57 | + 'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0), |
|
58 | + 'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false), |
|
59 | 59 | )); |
60 | 60 | $this->_model_relations = array( |
61 | 61 | 'Ticket'=>new EE_HABTM_Relation('Datetime_Ticket'), |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | ); |
65 | 65 | $this->_model_chain_to_wp_user = 'Event'; |
66 | 66 | //this model is generally available for reading |
67 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public( 'Event' ); |
|
68 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' ); |
|
69 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' ); |
|
70 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event', EEM_Base::caps_edit ); |
|
71 | - parent::__construct( $timezone ); |
|
67 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Event_Related_Public('Event'); |
|
68 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Event_Related_Protected('Event'); |
|
69 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Event_Related_Protected('Event'); |
|
70 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Event_Related_Protected('Event', EEM_Base::caps_edit); |
|
71 | + parent::__construct($timezone); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -83,16 +83,16 @@ discard block |
||
83 | 83 | public function create_new_blank_datetime() { |
84 | 84 | $blank_datetime = EE_Datetime::new_instance( |
85 | 85 | array( |
86 | - 'DTT_EVT_start' => $this->current_time_for_query( 'DTT_EVT_start', true ) + (60 * 60 * 24 * 30), |
|
87 | - 'DTT_EVT_end' => $this->current_time_for_query( 'DTT_EVT_end', true ) + (60 * 60 * 24 * 30), |
|
86 | + 'DTT_EVT_start' => $this->current_time_for_query('DTT_EVT_start', true) + (60 * 60 * 24 * 30), |
|
87 | + 'DTT_EVT_end' => $this->current_time_for_query('DTT_EVT_end', true) + (60 * 60 * 24 * 30), |
|
88 | 88 | 'DTT_order' => 1, |
89 | 89 | 'DTT_reg_limit' => EE_INF |
90 | 90 | ), |
91 | 91 | $this->_timezone |
92 | 92 | ); |
93 | - $blank_datetime->set_start_time( $this->convert_datetime_for_query( 'DTT_EVT_start', '8am', 'ga', $this->_timezone ) ); |
|
94 | - $blank_datetime->set_end_time( $this->convert_datetime_for_query( 'DTT_EVT_end', '5pm', 'ga', $this->_timezone ) ); |
|
95 | - return array( $blank_datetime ); |
|
93 | + $blank_datetime->set_start_time($this->convert_datetime_for_query('DTT_EVT_start', '8am', 'ga', $this->_timezone)); |
|
94 | + $blank_datetime->set_end_time($this->convert_datetime_for_query('DTT_EVT_end', '5pm', 'ga', $this->_timezone)); |
|
95 | + return array($blank_datetime); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | * @param int $EVT_ID |
107 | 107 | * @return EE_Datetime[] array on success, FALSE on fail |
108 | 108 | */ |
109 | - public function get_all_event_dates( $EVT_ID = 0 ) { |
|
110 | - if ( ! $EVT_ID ) { // on add_new_event event_id gets set to 0 |
|
109 | + public function get_all_event_dates($EVT_ID = 0) { |
|
110 | + if ( ! $EVT_ID) { // on add_new_event event_id gets set to 0 |
|
111 | 111 | return $this->create_new_blank_datetime(); |
112 | 112 | } |
113 | - $results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID); |
|
113 | + $results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID); |
|
114 | 114 | |
115 | - if ( empty( $results ) ) { |
|
115 | + if (empty($results)) { |
|
116 | 116 | return $this->create_new_blank_datetime(); |
117 | 117 | } |
118 | 118 | |
@@ -133,26 +133,26 @@ discard block |
||
133 | 133 | * the given number |
134 | 134 | * @return EE_Datetime[] |
135 | 135 | */ |
136 | - public function get_datetimes_for_event_ordered_by_DTT_order( $EVT_ID, $include_expired = TRUE, $include_deleted= TRUE, $limit = NULL ) { |
|
136 | + public function get_datetimes_for_event_ordered_by_DTT_order($EVT_ID, $include_expired = TRUE, $include_deleted = TRUE, $limit = NULL) { |
|
137 | 137 | |
138 | 138 | //sanitize EVT_ID |
139 | - $EVT_ID = intval( $EVT_ID ); |
|
139 | + $EVT_ID = intval($EVT_ID); |
|
140 | 140 | |
141 | 141 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
142 | - $this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db ); |
|
143 | - $where_params = array( 'Event.EVT_ID' => $EVT_ID ); |
|
142 | + $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
143 | + $where_params = array('Event.EVT_ID' => $EVT_ID); |
|
144 | 144 | |
145 | - $query_params = ! empty( $limit ) ? array( $where_params, 'limit' => $limit, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' ) : array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' ); |
|
145 | + $query_params = ! empty($limit) ? array($where_params, 'limit' => $limit, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none') : array($where_params, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none'); |
|
146 | 146 | |
147 | - if( ! $include_expired){ |
|
148 | - $query_params[0]['DTT_EVT_end'] = array( '>=', current_time( 'mysql', TRUE ) ); |
|
147 | + if ( ! $include_expired) { |
|
148 | + $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE)); |
|
149 | 149 | } |
150 | - if( $include_deleted){ |
|
151 | - $query_params[0]['DTT_deleted'] = array( 'IN', array( TRUE, FALSE )); |
|
150 | + if ($include_deleted) { |
|
151 | + $query_params[0]['DTT_deleted'] = array('IN', array(TRUE, FALSE)); |
|
152 | 152 | } |
153 | 153 | |
154 | - $result = $this->get_all( $query_params ); |
|
155 | - $this->assume_values_already_prepared_by_model_object( $old_assumption ); |
|
154 | + $result = $this->get_all($query_params); |
|
155 | + $this->assume_values_already_prepared_by_model_object($old_assumption); |
|
156 | 156 | return $result; |
157 | 157 | } |
158 | 158 | |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | * @param int $limit |
168 | 168 | * @return EE_Datetime[] |
169 | 169 | */ |
170 | - public function get_datetimes_for_event_ordered_by_importance( $EVT_ID = 0, $limit = NULL){ |
|
171 | - return $this->get_all( array(array('Event.EVT_ID'=>$EVT_ID), |
|
170 | + public function get_datetimes_for_event_ordered_by_importance($EVT_ID = 0, $limit = NULL) { |
|
171 | + return $this->get_all(array(array('Event.EVT_ID'=>$EVT_ID), |
|
172 | 172 | 'limit'=>$limit, |
173 | 173 | 'order_by'=>array('DTT_EVT_start'=>'ASC'), |
174 | 174 | 'default_where_conditions' => 'none')); |
@@ -183,11 +183,11 @@ discard block |
||
183 | 183 | * @param boolean $include_deleted |
184 | 184 | * @return EE_Datetime |
185 | 185 | */ |
186 | - public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false,$include_deleted = false){ |
|
187 | - $results = $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1); |
|
188 | - if($results){ |
|
186 | + public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false, $include_deleted = false) { |
|
187 | + $results = $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1); |
|
188 | + if ($results) { |
|
189 | 189 | return array_shift($results); |
190 | - }else{ |
|
190 | + } else { |
|
191 | 191 | return NULL; |
192 | 192 | } |
193 | 193 | } |
@@ -201,16 +201,16 @@ discard block |
||
201 | 201 | * @param bool $try_to_exclude_deleted |
202 | 202 | * @return \EE_Datetime |
203 | 203 | */ |
204 | - public function get_primary_datetime_for_event($EVT_ID,$try_to_exclude_expired = true, $try_to_exclude_deleted = true){ |
|
205 | - if($try_to_exclude_expired){ |
|
206 | - $non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false,false); |
|
207 | - if($non_expired){ |
|
204 | + public function get_primary_datetime_for_event($EVT_ID, $try_to_exclude_expired = true, $try_to_exclude_deleted = true) { |
|
205 | + if ($try_to_exclude_expired) { |
|
206 | + $non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false, false); |
|
207 | + if ($non_expired) { |
|
208 | 208 | return $non_expired; |
209 | 209 | } |
210 | 210 | } |
211 | - if($try_to_exclude_deleted){ |
|
211 | + if ($try_to_exclude_deleted) { |
|
212 | 212 | $expired_even = $this->get_oldest_datetime_for_event($EVT_ID, true); |
213 | - if($expired_even){ |
|
213 | + if ($expired_even) { |
|
214 | 214 | return $expired_even; |
215 | 215 | } |
216 | 216 | } |
@@ -229,23 +229,23 @@ discard block |
||
229 | 229 | * @param int $limit |
230 | 230 | * @return EE_Datetime[] |
231 | 231 | */ |
232 | - public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted= true, $limit = NULL ){ |
|
232 | + public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) { |
|
233 | 233 | //sanitize EVT_ID |
234 | - $EVT_ID = intval( $EVT_ID ); |
|
234 | + $EVT_ID = intval($EVT_ID); |
|
235 | 235 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
236 | - $this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db ); |
|
237 | - $query_params =array(array('Event.EVT_ID'=>$EVT_ID),'order_by'=>array('DTT_EVT_start'=>'asc')); |
|
238 | - if( ! $include_expired){ |
|
239 | - $query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE)); |
|
236 | + $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
237 | + $query_params = array(array('Event.EVT_ID'=>$EVT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc')); |
|
238 | + if ( ! $include_expired) { |
|
239 | + $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE)); |
|
240 | 240 | } |
241 | - if( $include_deleted){ |
|
242 | - $query_params[0]['DTT_deleted'] = array('IN',array(true,false)); |
|
241 | + if ($include_deleted) { |
|
242 | + $query_params[0]['DTT_deleted'] = array('IN', array(true, false)); |
|
243 | 243 | } |
244 | - if($limit){ |
|
244 | + if ($limit) { |
|
245 | 245 | $query_params['limit'] = $limit; |
246 | 246 | } |
247 | - $result = $this->get_all( $query_params ); |
|
248 | - $this->assume_values_already_prepared_by_model_object( $old_assumption ); |
|
247 | + $result = $this->get_all($query_params); |
|
248 | + $this->assume_values_already_prepared_by_model_object($old_assumption); |
|
249 | 249 | return $result; |
250 | 250 | } |
251 | 251 | |
@@ -258,23 +258,23 @@ discard block |
||
258 | 258 | * @param int $limit |
259 | 259 | * @return EE_Datetime[] |
260 | 260 | */ |
261 | - public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted= true, $limit = NULL){ |
|
261 | + public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) { |
|
262 | 262 | //sanitize TKT_ID |
263 | - $TKT_ID = intval( $TKT_ID ); |
|
263 | + $TKT_ID = intval($TKT_ID); |
|
264 | 264 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
265 | - $this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db ); |
|
266 | - $query_params =array(array('Ticket.TKT_ID'=>$TKT_ID),'order_by'=>array('DTT_EVT_start'=>'asc')); |
|
267 | - if( ! $include_expired){ |
|
268 | - $query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE)); |
|
265 | + $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
266 | + $query_params = array(array('Ticket.TKT_ID'=>$TKT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc')); |
|
267 | + if ( ! $include_expired) { |
|
268 | + $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE)); |
|
269 | 269 | } |
270 | - if( $include_deleted){ |
|
271 | - $query_params[0]['DTT_deleted'] = array('IN',array(true,false)); |
|
270 | + if ($include_deleted) { |
|
271 | + $query_params[0]['DTT_deleted'] = array('IN', array(true, false)); |
|
272 | 272 | } |
273 | - if($limit){ |
|
273 | + if ($limit) { |
|
274 | 274 | $query_params['limit'] = $limit; |
275 | 275 | } |
276 | - $result = $this->get_all( $query_params ); |
|
277 | - $this->assume_values_already_prepared_by_model_object( $old_assumption ); |
|
276 | + $result = $this->get_all($query_params); |
|
277 | + $this->assume_values_already_prepared_by_model_object($old_assumption); |
|
278 | 278 | return $result; |
279 | 279 | } |
280 | 280 | |
@@ -290,24 +290,24 @@ discard block |
||
290 | 290 | * that number |
291 | 291 | * @return EE_Datetime[] |
292 | 292 | */ |
293 | - public function get_datetimes_for_ticket_ordered_by_DTT_order( $TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL ) { |
|
293 | + public function get_datetimes_for_ticket_ordered_by_DTT_order($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) { |
|
294 | 294 | //sanitize id. |
295 | - $TKT_ID = intval( $TKT_ID ); |
|
295 | + $TKT_ID = intval($TKT_ID); |
|
296 | 296 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
297 | - $this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db ); |
|
298 | - $where_params = array( 'Ticket.TKT_ID' => $TKT_ID ); |
|
299 | - $query_params = array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ) ); |
|
300 | - if( ! $include_expired){ |
|
301 | - $query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE)); |
|
297 | + $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
298 | + $where_params = array('Ticket.TKT_ID' => $TKT_ID); |
|
299 | + $query_params = array($where_params, 'order_by' => array('DTT_order' => 'ASC')); |
|
300 | + if ( ! $include_expired) { |
|
301 | + $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE)); |
|
302 | 302 | } |
303 | - if( $include_deleted){ |
|
304 | - $query_params[0]['DTT_deleted'] = array('IN',array(true,false)); |
|
303 | + if ($include_deleted) { |
|
304 | + $query_params[0]['DTT_deleted'] = array('IN', array(true, false)); |
|
305 | 305 | } |
306 | - if($limit){ |
|
306 | + if ($limit) { |
|
307 | 307 | $query_params['limit'] = $limit; |
308 | 308 | } |
309 | - $result = $this->get_all( $query_params ); |
|
310 | - $this->assume_values_already_prepared_by_model_object( $old_assumption ); |
|
309 | + $result = $this->get_all($query_params); |
|
310 | + $this->assume_values_already_prepared_by_model_object($old_assumption); |
|
311 | 311 | return $result; |
312 | 312 | } |
313 | 313 | |
@@ -318,11 +318,11 @@ discard block |
||
318 | 318 | * @param int $EVT_ID |
319 | 319 | * @return EE_Datetime |
320 | 320 | */ |
321 | - public function get_most_important_datetime_for_event($EVT_ID){ |
|
321 | + public function get_most_important_datetime_for_event($EVT_ID) { |
|
322 | 322 | $results = $this->get_datetimes_for_event_ordered_by_importance($EVT_ID, 1); |
323 | - if($results){ |
|
323 | + if ($results) { |
|
324 | 324 | return array_shift($results); |
325 | - }else{ |
|
325 | + } else { |
|
326 | 326 | return null; |
327 | 327 | } |
328 | 328 | } |
@@ -341,78 +341,78 @@ discard block |
||
341 | 341 | * - inactive = Events that are either not published. |
342 | 342 | * @return wpdb results array |
343 | 343 | */ |
344 | - public function get_dtt_months_and_years( $where_params, $evt_active_status = '' ) { |
|
345 | - $current_time_for_DTT_EVT_start = $this->current_time_for_query( 'DTT_EVT_start' ); |
|
346 | - $current_time_for_DTT_EVT_end = $this->current_time_for_query( 'DTT_EVT_end' ); |
|
344 | + public function get_dtt_months_and_years($where_params, $evt_active_status = '') { |
|
345 | + $current_time_for_DTT_EVT_start = $this->current_time_for_query('DTT_EVT_start'); |
|
346 | + $current_time_for_DTT_EVT_end = $this->current_time_for_query('DTT_EVT_end'); |
|
347 | 347 | |
348 | - switch ( $evt_active_status ) { |
|
348 | + switch ($evt_active_status) { |
|
349 | 349 | case 'upcoming' : |
350 | 350 | $where_params['Event.status'] = 'publish'; |
351 | 351 | //if there are already query_params matching DTT_EVT_start then we need to modify that to add them. |
352 | - if ( isset( $where_params['DTT_EVT_start'] ) ) { |
|
352 | + if (isset($where_params['DTT_EVT_start'])) { |
|
353 | 353 | $where_params['DTT_EVT_start*****'] = $where_params['DTT_EVT_start']; |
354 | 354 | } |
355 | - $where_params['DTT_EVT_start'] = array('>', $current_time_for_DTT_EVT_start ); |
|
355 | + $where_params['DTT_EVT_start'] = array('>', $current_time_for_DTT_EVT_start); |
|
356 | 356 | break; |
357 | 357 | |
358 | 358 | case 'expired' : |
359 | - if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] ); |
|
359 | + if (isset($where_params['Event.status'])) unset($where_params['Event.status']); |
|
360 | 360 | //get events to exclude |
361 | - $exclude_query[0] = array_merge( $where_params, array( 'DTT_EVT_end' => array( '>', $current_time_for_DTT_EVT_end ) ) ); |
|
361 | + $exclude_query[0] = array_merge($where_params, array('DTT_EVT_end' => array('>', $current_time_for_DTT_EVT_end))); |
|
362 | 362 | //first get all events that have datetimes where its not expired. |
363 | - $event_ids = $this->_get_all_wpdb_results( $exclude_query, OBJECT_K, 'Datetime.EVT_ID' ); |
|
364 | - $event_ids = array_keys( $event_ids ); |
|
363 | + $event_ids = $this->_get_all_wpdb_results($exclude_query, OBJECT_K, 'Datetime.EVT_ID'); |
|
364 | + $event_ids = array_keys($event_ids); |
|
365 | 365 | |
366 | - if ( isset( $where_params['DTT_EVT_end'] ) ) { |
|
366 | + if (isset($where_params['DTT_EVT_end'])) { |
|
367 | 367 | $where_params['DTT_EVT_end****'] = $where_params['DTT_EVT_end']; |
368 | 368 | } |
369 | - $where_params['DTT_EVT_end'] = array( '<', $current_time_for_DTT_EVT_end ); |
|
370 | - $where_params['Event.EVT_ID'] = array( 'NOT IN', $event_ids ); |
|
369 | + $where_params['DTT_EVT_end'] = array('<', $current_time_for_DTT_EVT_end); |
|
370 | + $where_params['Event.EVT_ID'] = array('NOT IN', $event_ids); |
|
371 | 371 | break; |
372 | 372 | |
373 | 373 | case 'active' : |
374 | 374 | $where_params['Event.status'] = 'publish'; |
375 | - if ( isset( $where_params['DTT_EVT_start'] ) ) { |
|
375 | + if (isset($where_params['DTT_EVT_start'])) { |
|
376 | 376 | $where_params['Datetime.DTT_EVT_start******'] = $where_params['DTT_EVT_start']; |
377 | 377 | } |
378 | - if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) { |
|
378 | + if (isset($where_params['Datetime.DTT_EVT_end'])) { |
|
379 | 379 | $where_params['Datetime.DTT_EVT_end*****'] = $where_params['DTT_EVT_end']; |
380 | 380 | } |
381 | - $where_params['DTT_EVT_start'] = array('<', $current_time_for_DTT_EVT_start ); |
|
382 | - $where_params['DTT_EVT_end'] = array('>', $current_time_for_DTT_EVT_end ); |
|
381 | + $where_params['DTT_EVT_start'] = array('<', $current_time_for_DTT_EVT_start); |
|
382 | + $where_params['DTT_EVT_end'] = array('>', $current_time_for_DTT_EVT_end); |
|
383 | 383 | break; |
384 | 384 | |
385 | 385 | case 'inactive' : |
386 | - if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] ); |
|
387 | - if ( isset( $where_params['OR'] ) ) { |
|
386 | + if (isset($where_params['Event.status'])) unset($where_params['Event.status']); |
|
387 | + if (isset($where_params['OR'])) { |
|
388 | 388 | $where_params['AND']['OR'] = $where_params['OR']; |
389 | 389 | } |
390 | - if ( isset( $where_params['DTT_EVT_end'] ) ) { |
|
390 | + if (isset($where_params['DTT_EVT_end'])) { |
|
391 | 391 | $where_params['AND']['DTT_EVT_end****'] = $where_params['DTT_EVT_end']; |
392 | - unset( $where_params['DTT_EVT_end'] ); |
|
392 | + unset($where_params['DTT_EVT_end']); |
|
393 | 393 | } |
394 | 394 | |
395 | - if ( isset( $where_params['DTT_EVT_start'] ) ) { |
|
395 | + if (isset($where_params['DTT_EVT_start'])) { |
|
396 | 396 | $where_params['AND']['DTT_EVT_start'] = $where_params['DTT_EVT_start']; |
397 | - unset( $where_params['DTT_EVT_start'] ); |
|
397 | + unset($where_params['DTT_EVT_start']); |
|
398 | 398 | } |
399 | - $where_params['AND']['Event.status'] = array( '!=', 'publish' ); |
|
399 | + $where_params['AND']['Event.status'] = array('!=', 'publish'); |
|
400 | 400 | break; |
401 | 401 | } |
402 | 402 | |
403 | 403 | $query_params[0] = $where_params; |
404 | 404 | $query_params['group_by'] = array('dtt_year', 'dtt_month'); |
405 | - $query_params['order_by'] = array( 'DTT_EVT_start' => 'DESC' ); |
|
405 | + $query_params['order_by'] = array('DTT_EVT_start' => 'DESC'); |
|
406 | 406 | |
407 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
408 | - $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'DTT_EVT_start' ); |
|
407 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
408 | + $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'DTT_EVT_start'); |
|
409 | 409 | |
410 | 410 | $columns_to_select = array( |
411 | - 'dtt_year' => array('YEAR(' . $query_interval . ')', '%s'), |
|
412 | - 'dtt_month' => array('MONTHNAME(' . $query_interval . ')', '%s'), |
|
413 | - 'dtt_month_num' => array('MONTH(' . $query_interval .')', '%s') |
|
411 | + 'dtt_year' => array('YEAR('.$query_interval.')', '%s'), |
|
412 | + 'dtt_month' => array('MONTHNAME('.$query_interval.')', '%s'), |
|
413 | + 'dtt_month_num' => array('MONTH('.$query_interval.')', '%s') |
|
414 | 414 | ); |
415 | - return $this->_get_all_wpdb_results( $query_params, OBJECT, $columns_to_select ); |
|
415 | + return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select); |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | /** |
@@ -420,8 +420,8 @@ discard block |
||
420 | 420 | * for the tickets for each datetime) |
421 | 421 | * @param EE_Datetime[] $datetimes |
422 | 422 | */ |
423 | - public function update_sold($datetimes){ |
|
424 | - foreach($datetimes as $datetime){ |
|
423 | + public function update_sold($datetimes) { |
|
424 | + foreach ($datetimes as $datetime) { |
|
425 | 425 | $datetime->update_sold(); |
426 | 426 | } |
427 | 427 | } |
@@ -436,10 +436,10 @@ discard block |
||
436 | 436 | * @param array $query_params |
437 | 437 | * @return int of tickets available. If sold out, return less than 1. If infinite, returns EE_INF, IF there are NO tickets attached to datetime then FALSE is returned. |
438 | 438 | */ |
439 | - public function sum_tickets_currently_available_at_datetime( $DTT_ID, $query_params = array() ) { |
|
440 | - $datetime = $this->get_one_by_ID( $DTT_ID ); |
|
441 | - if ( $datetime instanceof EE_Datetime ) { |
|
442 | - return $datetime->tickets_remaining( $query_params ); |
|
439 | + public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) { |
|
440 | + $datetime = $this->get_one_by_ID($DTT_ID); |
|
441 | + if ($datetime instanceof EE_Datetime) { |
|
442 | + return $datetime->tickets_remaining($query_params); |
|
443 | 443 | } |
444 | 444 | return 0; |
445 | 445 | } |
@@ -461,36 +461,36 @@ discard block |
||
461 | 461 | * EE_Datetime::upcoming |
462 | 462 | * EE_Datetime::expired |
463 | 463 | */ |
464 | - public function get_datetime_counts_by_status( $stati_to_include = array(), $query_params = array() ) { |
|
464 | + public function get_datetime_counts_by_status($stati_to_include = array(), $query_params = array()) { |
|
465 | 465 | //only accept where conditions for this query. |
466 | - $_where = isset( $query_params[0] ) ? $query_params[0] : array(); |
|
466 | + $_where = isset($query_params[0]) ? $query_params[0] : array(); |
|
467 | 467 | $status_query_args = array( |
468 | 468 | EE_Datetime::active => array_merge( |
469 | 469 | $_where, |
470 | - array( 'DTT_EVT_start' => array( '<', time() ), 'DTT_EVT_end' => array( '>', time() ) ) |
|
470 | + array('DTT_EVT_start' => array('<', time()), 'DTT_EVT_end' => array('>', time())) |
|
471 | 471 | ), |
472 | 472 | EE_Datetime::upcoming => array_merge( |
473 | 473 | $_where, |
474 | - array( 'DTT_EVT_start' => array( '>', time() ) ) |
|
474 | + array('DTT_EVT_start' => array('>', time())) |
|
475 | 475 | ), |
476 | 476 | EE_Datetime::expired => array_merge( |
477 | 477 | $_where, |
478 | - array( 'DTT_EVT_end' => array('<', time() ) ) |
|
478 | + array('DTT_EVT_end' => array('<', time())) |
|
479 | 479 | ) |
480 | 480 | ); |
481 | 481 | |
482 | - if ( ! empty( $stati_to_include ) ) { |
|
483 | - foreach( array_keys( $status_query_args ) as $status ) { |
|
484 | - if ( ! in_array( $status, $stati_to_include ) ) { |
|
485 | - unset( $status_query_args[$status] ); |
|
482 | + if ( ! empty($stati_to_include)) { |
|
483 | + foreach (array_keys($status_query_args) as $status) { |
|
484 | + if ( ! in_array($status, $stati_to_include)) { |
|
485 | + unset($status_query_args[$status]); |
|
486 | 486 | } |
487 | 487 | } |
488 | 488 | } |
489 | 489 | |
490 | 490 | //loop through and query counts for each stati. |
491 | 491 | $status_query_results = array(); |
492 | - foreach( $status_query_args as $status => $status_where_conditions ) { |
|
493 | - $status_query_results[ $status ] = EEM_Datetime::count( array( $status_where_conditions ), 'DTT_ID', true ); |
|
492 | + foreach ($status_query_args as $status => $status_where_conditions) { |
|
493 | + $status_query_results[$status] = EEM_Datetime::count(array($status_where_conditions), 'DTT_ID', true); |
|
494 | 494 | } |
495 | 495 | |
496 | 496 | return $status_query_results; |
@@ -504,9 +504,9 @@ discard block |
||
504 | 504 | * @param array $query_params |
505 | 505 | * @return int |
506 | 506 | */ |
507 | - public function get_datetime_count_for_status( $status = EE_Datetime::active, $query_params = array() ) { |
|
508 | - $count = $this->get_datetime_counts_by_status( array( $status ), $query_params ); |
|
509 | - return ! empty( $count[$status] ) ? $count[$status] : 0; |
|
507 | + public function get_datetime_count_for_status($status = EE_Datetime::active, $query_params = array()) { |
|
508 | + $count = $this->get_datetime_counts_by_status(array($status), $query_params); |
|
509 | + return ! empty($count[$status]) ? $count[$status] : 0; |
|
510 | 510 | } |
511 | 511 | |
512 | 512 |
@@ -715,7 +715,7 @@ |
||
715 | 715 | } |
716 | 716 | } |
717 | 717 | } |
718 | - } |
|
718 | + } |
|
719 | 719 | /** |
720 | 720 | * addresses https://events.codebasehq.com/projects/event-espresso/tickets/8731 |
721 | 721 | * which should just be a temporary issue for folks who installed 4.8.0-4.8.5; |
@@ -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 | - * Venue 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 | + * Venue Model |
|
17 | + * |
|
18 | + * @package Event Espresso |
|
19 | + * @subpackage includes/models/ |
|
20 | + * @author Michael Nelson |
|
21 | + * |
|
22 | + * ------------------------------------------------------------------------ |
|
23 | + */ |
|
24 | 24 | require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
25 | 25 | |
26 | 26 | class EEM_Venue extends EEM_CPT_Base { |
@@ -1,33 +1,33 @@ discard block |
||
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 | - * EE_Admin |
|
17 | - * |
|
18 | - * @package Event Espresso |
|
19 | - * @subpackage /core/admin/ |
|
20 | - * @author Brent Christensen |
|
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 | + * EE_Admin |
|
17 | + * |
|
18 | + * @package Event Espresso |
|
19 | + * @subpackage /core/admin/ |
|
20 | + * @author Brent Christensen |
|
21 | + * |
|
22 | + * ------------------------------------------------------------------------ |
|
23 | + */ |
|
24 | 24 | final class EE_Admin { |
25 | 25 | |
26 | 26 | /** |
27 | - * EE_Admin Object |
|
28 | - * @private _instance |
|
29 | - * @private protected |
|
30 | - */ |
|
27 | + * EE_Admin Object |
|
28 | + * @private _instance |
|
29 | + * @private protected |
|
30 | + */ |
|
31 | 31 | private static $_instance = NULL; |
32 | 32 | |
33 | 33 | /** |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | |
57 | 57 | |
58 | 58 | /** |
59 | - * class constructor |
|
60 | - */ |
|
59 | + * class constructor |
|
60 | + */ |
|
61 | 61 | protected function __construct() { |
62 | 62 | // define global EE_Admin constants |
63 | 63 | $this->_define_all_constants(); |
@@ -168,11 +168,11 @@ discard block |
||
168 | 168 | |
169 | 169 | |
170 | 170 | /** |
171 | - * init- should fire after shortcode, module, addon, other plugin (default priority), and even EE_Front_Controller's init phases have run |
|
172 | - * |
|
173 | - * @access public |
|
174 | - * @return void |
|
175 | - */ |
|
171 | + * init- should fire after shortcode, module, addon, other plugin (default priority), and even EE_Front_Controller's init phases have run |
|
172 | + * |
|
173 | + * @access public |
|
174 | + * @return void |
|
175 | + */ |
|
176 | 176 | public function init() { |
177 | 177 | |
178 | 178 | //only enable most of the EE_Admin IF we're not in full maintenance mode |
@@ -463,11 +463,11 @@ discard block |
||
463 | 463 | |
464 | 464 | |
465 | 465 | /** |
466 | - * admin_init |
|
467 | - * |
|
468 | - * @access public |
|
469 | - * @return void |
|
470 | - */ |
|
466 | + * admin_init |
|
467 | + * |
|
468 | + * @access public |
|
469 | + * @return void |
|
470 | + */ |
|
471 | 471 | public function admin_init() { |
472 | 472 | |
473 | 473 | /** |
@@ -624,11 +624,11 @@ discard block |
||
624 | 624 | |
625 | 625 | |
626 | 626 | /** |
627 | - * dismiss_persistent_admin_notice |
|
628 | - * |
|
629 | - * @access public |
|
630 | - * @return void |
|
631 | - */ |
|
627 | + * dismiss_persistent_admin_notice |
|
628 | + * |
|
629 | + * @access public |
|
630 | + * @return void |
|
631 | + */ |
|
632 | 632 | public function dismiss_ee_nag_notice_callback() { |
633 | 633 | EE_Error::dismiss_persistent_admin_notice(); |
634 | 634 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public static function instance() { |
49 | 49 | // check if class object is instantiated |
50 | - if ( ! self::$_instance instanceof EE_Admin ) { |
|
50 | + if ( ! self::$_instance instanceof EE_Admin) { |
|
51 | 51 | self::$_instance = new self(); |
52 | 52 | } |
53 | 53 | return self::$_instance; |
@@ -62,25 +62,25 @@ discard block |
||
62 | 62 | // define global EE_Admin constants |
63 | 63 | $this->_define_all_constants(); |
64 | 64 | // set autoloaders for our admin page classes based on included path information |
65 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_ADMIN ); |
|
65 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN); |
|
66 | 66 | // admin hooks |
67 | - add_filter( 'plugin_action_links', array( $this, 'filter_plugin_actions' ), 10, 2 ); |
|
67 | + add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2); |
|
68 | 68 | // load EE_Request_Handler early |
69 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'get_request' )); |
|
70 | - add_action( 'AHEE__EE_System__initialize_last', array( $this, 'init' )); |
|
71 | - add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'route_admin_request' ), 100, 2 ); |
|
72 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 100 ); |
|
73 | - add_action( 'admin_init', array( $this, 'admin_init' ), 100 ); |
|
74 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 20 ); |
|
75 | - add_action( 'admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
76 | - add_action( 'network_admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
77 | - add_filter( 'pre_update_option', array( $this, 'check_for_invalid_datetime_formats' ), 100, 2 ); |
|
78 | - add_filter('admin_footer_text', array( $this, 'espresso_admin_footer' )); |
|
69 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request')); |
|
70 | + add_action('AHEE__EE_System__initialize_last', array($this, 'init')); |
|
71 | + add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'route_admin_request'), 100, 2); |
|
72 | + add_action('wp_loaded', array($this, 'wp_loaded'), 100); |
|
73 | + add_action('admin_init', array($this, 'admin_init'), 100); |
|
74 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20); |
|
75 | + add_action('admin_notices', array($this, 'display_admin_notices'), 10); |
|
76 | + add_action('network_admin_notices', array($this, 'display_admin_notices'), 10); |
|
77 | + add_filter('pre_update_option', array($this, 'check_for_invalid_datetime_formats'), 100, 2); |
|
78 | + add_filter('admin_footer_text', array($this, 'espresso_admin_footer')); |
|
79 | 79 | |
80 | 80 | //reset Environment config (we only do this on admin page loads); |
81 | 81 | EE_Registry::instance()->CFG->environment->recheck_values(); |
82 | 82 | |
83 | - do_action( 'AHEE__EE_Admin__loaded' ); |
|
83 | + do_action('AHEE__EE_Admin__loaded'); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | * @return void |
96 | 96 | */ |
97 | 97 | private function _define_all_constants() { |
98 | - define( 'EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/' ); |
|
99 | - define( 'EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/' ); |
|
100 | - define( 'EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates' . DS ); |
|
101 | - define( 'WP_ADMIN_PATH', ABSPATH . 'wp-admin/' ); |
|
102 | - define( 'WP_AJAX_URL', admin_url( 'admin-ajax.php' )); |
|
98 | + define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL.'core/admin/'); |
|
99 | + define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL.'admin_pages/'); |
|
100 | + define('EE_ADMIN_TEMPLATE', EE_ADMIN.'templates'.DS); |
|
101 | + define('WP_ADMIN_PATH', ABSPATH.'wp-admin/'); |
|
102 | + define('WP_AJAX_URL', admin_url('admin-ajax.php')); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -112,23 +112,23 @@ discard block |
||
112 | 112 | * @param string $plugin |
113 | 113 | * @return array |
114 | 114 | */ |
115 | - public function filter_plugin_actions( $links, $plugin ) { |
|
115 | + public function filter_plugin_actions($links, $plugin) { |
|
116 | 116 | // set $main_file in stone |
117 | 117 | static $main_file; |
118 | 118 | // if $main_file is not set yet |
119 | - if ( ! $main_file ) { |
|
120 | - $main_file = plugin_basename( EVENT_ESPRESSO_MAIN_FILE ); |
|
119 | + if ( ! $main_file) { |
|
120 | + $main_file = plugin_basename(EVENT_ESPRESSO_MAIN_FILE); |
|
121 | 121 | } |
122 | - if ( $plugin == $main_file ) { |
|
122 | + if ($plugin == $main_file) { |
|
123 | 123 | // compare current plugin to this one |
124 | - if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
125 | - $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">' . __('Maintenance Mode Active', 'event_espresso' ) . '</a>'; |
|
126 | - array_unshift( $links, $maintenance_link ); |
|
124 | + if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
125 | + $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">'.__('Maintenance Mode Active', 'event_espresso').'</a>'; |
|
126 | + array_unshift($links, $maintenance_link); |
|
127 | 127 | } else { |
128 | - $org_settings_link = '<a href="admin.php?page=espresso_general_settings">' . __( 'Settings', 'event_espresso' ) . '</a>'; |
|
129 | - $events_link = '<a href="admin.php?page=espresso_events">' . __( 'Events', 'event_espresso' ) . '</a>'; |
|
128 | + $org_settings_link = '<a href="admin.php?page=espresso_general_settings">'.__('Settings', 'event_espresso').'</a>'; |
|
129 | + $events_link = '<a href="admin.php?page=espresso_events">'.__('Events', 'event_espresso').'</a>'; |
|
130 | 130 | // add before other links |
131 | - array_unshift( $links, $org_settings_link, $events_link ); |
|
131 | + array_unshift($links, $org_settings_link, $events_link); |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | return $links; |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | * @return void |
144 | 144 | */ |
145 | 145 | public function get_request() { |
146 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
147 | - EE_Registry::instance()->load_core( 'CPT_Strategy' ); |
|
146 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
147 | + EE_Registry::instance()->load_core('CPT_Strategy'); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | |
@@ -156,11 +156,11 @@ discard block |
||
156 | 156 | * @param array $admin_page_folder_names |
157 | 157 | * @return array |
158 | 158 | */ |
159 | - public function hide_admin_pages_except_maintenance_mode( $admin_page_folder_names = array() ){ |
|
159 | + public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = array()) { |
|
160 | 160 | return array( |
161 | - 'maintenance' => EE_ADMIN_PAGES . 'maintenance' . DS, |
|
162 | - 'about' => EE_ADMIN_PAGES . 'about' . DS, |
|
163 | - 'support' => EE_ADMIN_PAGES . 'support' . DS |
|
161 | + 'maintenance' => EE_ADMIN_PAGES.'maintenance'.DS, |
|
162 | + 'about' => EE_ADMIN_PAGES.'about'.DS, |
|
163 | + 'support' => EE_ADMIN_PAGES.'support'.DS |
|
164 | 164 | ); |
165 | 165 | } |
166 | 166 | |
@@ -175,36 +175,36 @@ discard block |
||
175 | 175 | public function init() { |
176 | 176 | |
177 | 177 | //only enable most of the EE_Admin IF we're not in full maintenance mode |
178 | - if ( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){ |
|
178 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
179 | 179 | //ok so we want to enable the entire admin |
180 | - add_action( 'wp_ajax_dismiss_ee_nag_notice', array( $this, 'dismiss_ee_nag_notice_callback' )); |
|
181 | - add_action( 'save_post', array( 'EE_Admin', 'parse_post_content_on_save' ), 100, 2 ); |
|
182 | - add_action( 'update_option', array( $this, 'reset_page_for_posts_on_change' ), 100, 3 ); |
|
183 | - add_filter( 'content_save_pre', array( $this, 'its_eSpresso' ), 10, 1 ); |
|
184 | - add_action( 'admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
185 | - add_action( 'network_admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
180 | + add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismiss_ee_nag_notice_callback')); |
|
181 | + add_action('save_post', array('EE_Admin', 'parse_post_content_on_save'), 100, 2); |
|
182 | + add_action('update_option', array($this, 'reset_page_for_posts_on_change'), 100, 3); |
|
183 | + add_filter('content_save_pre', array($this, 'its_eSpresso'), 10, 1); |
|
184 | + add_action('admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
185 | + add_action('network_admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
186 | 186 | //at a glance dashboard widget |
187 | - add_filter( 'dashboard_glance_items', array( $this, 'dashboard_glance_items'), 10 ); |
|
187 | + add_filter('dashboard_glance_items', array($this, 'dashboard_glance_items'), 10); |
|
188 | 188 | //filter for get_edit_post_link used on comments for custom post types |
189 | - add_filter('get_edit_post_link', array( $this, 'modify_edit_post_link' ), 10, 3 ); |
|
189 | + add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 3); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | // run the admin page factory but ONLY if we are doing an ee admin ajax request |
193 | - if ( !defined('DOING_AJAX') || EE_ADMIN_AJAX ) { |
|
193 | + if ( ! defined('DOING_AJAX') || EE_ADMIN_AJAX) { |
|
194 | 194 | try { |
195 | 195 | //this loads the controller for the admin pages which will setup routing etc |
196 | - EE_Registry::instance()->load_core( 'Admin_Page_Loader' ); |
|
197 | - } catch ( EE_Error $e ) { |
|
196 | + EE_Registry::instance()->load_core('Admin_Page_Loader'); |
|
197 | + } catch (EE_Error $e) { |
|
198 | 198 | $e->get_error(); |
199 | 199 | } |
200 | 200 | } |
201 | 201 | |
202 | 202 | //make sure our CPTs and custom taxonomy metaboxes get shown for first time users |
203 | - add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes' ), 10 ); |
|
204 | - add_action('admin_head', array( $this, 'register_custom_nav_menu_boxes' ), 10 ); |
|
203 | + add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes'), 10); |
|
204 | + add_action('admin_head', array($this, 'register_custom_nav_menu_boxes'), 10); |
|
205 | 205 | |
206 | 206 | //exclude EE critical pages from all nav menus and wp_list_pages |
207 | - add_filter('nav_menu_meta_box_object', array( $this, 'remove_pages_from_nav_menu'), 10 ); |
|
207 | + add_filter('nav_menu_meta_box_object', array($this, 'remove_pages_from_nav_menu'), 10); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | |
@@ -217,9 +217,9 @@ discard block |
||
217 | 217 | * @param object $post_type WP post type object |
218 | 218 | * @return object WP post type object |
219 | 219 | */ |
220 | - public function remove_pages_from_nav_menu( $post_type ) { |
|
220 | + public function remove_pages_from_nav_menu($post_type) { |
|
221 | 221 | //if this isn't the "pages" post type let's get out |
222 | - if ( $post_type->name !== 'page' ) |
|
222 | + if ($post_type->name !== 'page') |
|
223 | 223 | return $post_type; |
224 | 224 | |
225 | 225 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
@@ -239,28 +239,28 @@ discard block |
||
239 | 239 | */ |
240 | 240 | public function enable_hidden_ee_nav_menu_metaboxes() { |
241 | 241 | global $wp_meta_boxes, $pagenow; |
242 | - if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) { |
|
242 | + if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') { |
|
243 | 243 | return; |
244 | 244 | } |
245 | 245 | $user = wp_get_current_user(); |
246 | 246 | //has this been done yet? |
247 | - if ( get_user_option( 'ee_nav_menu_initialized', $user->ID ) ) { |
|
247 | + if (get_user_option('ee_nav_menu_initialized', $user->ID)) { |
|
248 | 248 | return; |
249 | 249 | } |
250 | 250 | |
251 | - $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus', $user->ID ); |
|
252 | - $initial_meta_boxes = apply_filters( 'FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page' ) ); |
|
251 | + $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus', $user->ID); |
|
252 | + $initial_meta_boxes = apply_filters('FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array('nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page')); |
|
253 | 253 | |
254 | - if ( is_array( $hidden_meta_boxes ) ) { |
|
255 | - foreach ( $hidden_meta_boxes as $key => $meta_box_id ) { |
|
256 | - if ( in_array( $meta_box_id, $initial_meta_boxes ) ) { |
|
257 | - unset( $hidden_meta_boxes[ $key ] ); |
|
254 | + if (is_array($hidden_meta_boxes)) { |
|
255 | + foreach ($hidden_meta_boxes as $key => $meta_box_id) { |
|
256 | + if (in_array($meta_box_id, $initial_meta_boxes)) { |
|
257 | + unset($hidden_meta_boxes[$key]); |
|
258 | 258 | } |
259 | 259 | } |
260 | 260 | } |
261 | 261 | |
262 | - update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true ); |
|
263 | - update_user_option( $user->ID, 'ee_nav_menu_initialized', 1, true ); |
|
262 | + update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true); |
|
263 | + update_user_option($user->ID, 'ee_nav_menu_initialized', 1, true); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | * @return void |
280 | 280 | */ |
281 | 281 | public function register_custom_nav_menu_boxes() { |
282 | - add_meta_box( 'add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array( $this, 'ee_cpt_archive_pages' ), 'nav-menus', 'side', 'core' ); |
|
282 | + add_meta_box('add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array($this, 'ee_cpt_archive_pages'), 'nav-menus', 'side', 'core'); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | |
@@ -296,17 +296,17 @@ discard block |
||
296 | 296 | * |
297 | 297 | * @return string the (maybe) modified link |
298 | 298 | */ |
299 | - public function modify_edit_post_link( $link, $id, $context ) { |
|
300 | - if ( ! $post = get_post( $id ) ) |
|
299 | + public function modify_edit_post_link($link, $id, $context) { |
|
300 | + if ( ! $post = get_post($id)) |
|
301 | 301 | return $link; |
302 | 302 | |
303 | - if ( $post->post_type == 'espresso_attendees' ) { |
|
303 | + if ($post->post_type == 'espresso_attendees') { |
|
304 | 304 | $query_args = array( |
305 | 305 | 'action' => 'edit_attendee', |
306 | 306 | 'post' => $id |
307 | 307 | ); |
308 | 308 | EE_Registry::instance()->load_helper('URL'); |
309 | - return EEH_URL::add_query_args_and_nonce( $query_args, admin_url('admin.php?page=espresso_registrations') ); |
|
309 | + return EEH_URL::add_query_args_and_nonce($query_args, admin_url('admin.php?page=espresso_registrations')); |
|
310 | 310 | } |
311 | 311 | return $link; |
312 | 312 | } |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | global $nav_menu_selected_id; |
319 | 319 | |
320 | 320 | $db_fields = false; |
321 | - $walker = new Walker_Nav_Menu_Checklist( $db_fields ); |
|
321 | + $walker = new Walker_Nav_Menu_Checklist($db_fields); |
|
322 | 322 | $current_tab = 'event-archives'; |
323 | 323 | |
324 | 324 | /*if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) { |
@@ -337,9 +337,9 @@ discard block |
||
337 | 337 | ?> |
338 | 338 | <div id="posttype-extra-nav-menu-pages" class="posttypediv"> |
339 | 339 | <ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs"> |
340 | - <li <?php echo ( 'event-archives' == $current_tab ? ' class="tabs"' : '' ); ?>> |
|
341 | - <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
342 | - <?php _e( 'Event Archive Pages', 'event_espresso' ); ?> |
|
340 | + <li <?php echo ('event-archives' == $current_tab ? ' class="tabs"' : ''); ?>> |
|
341 | + <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ($nav_menu_selected_id) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
342 | + <?php _e('Event Archive Pages', 'event_espresso'); ?> |
|
343 | 343 | </a> |
344 | 344 | </li> |
345 | 345 | <?php /* // temporarily removing but leaving skeleton in place in case we ever decide to add more tabs. |
@@ -357,13 +357,13 @@ discard block |
||
357 | 357 | <?php */ ?> |
358 | 358 | |
359 | 359 | <div id="tabs-panel-posttype-extra-nav-menu-pages-event-archives" class="tabs-panel <?php |
360 | - echo ( 'event-archives' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); |
|
360 | + echo ('event-archives' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive'); |
|
361 | 361 | ?>"> |
362 | 362 | <ul id="extra-nav-menu-pageschecklist-event-archives" class="categorychecklist form-no-clear"> |
363 | 363 | <?php |
364 | 364 | $pages = $this->_get_extra_nav_menu_pages_items(); |
365 | 365 | $args['walker'] = $walker; |
366 | - echo walk_nav_menu_tree( array_map( array( $this, '_setup_extra_nav_menu_pages_items' ), $pages), 0, (object) $args ); |
|
366 | + echo walk_nav_menu_tree(array_map(array($this, '_setup_extra_nav_menu_pages_items'), $pages), 0, (object) $args); |
|
367 | 367 | ?> |
368 | 368 | </ul> |
369 | 369 | </div><!-- /.tabs-panel --> |
@@ -371,18 +371,18 @@ discard block |
||
371 | 371 | <p class="button-controls"> |
372 | 372 | <span class="list-controls"> |
373 | 373 | <a href="<?php |
374 | - echo esc_url( add_query_arg( |
|
374 | + echo esc_url(add_query_arg( |
|
375 | 375 | array( |
376 | 376 | 'extra-nav-menu-pages-tab' => 'event-archives', |
377 | 377 | 'selectall' => 1, |
378 | 378 | ), |
379 | - remove_query_arg( $removed_args ) |
|
379 | + remove_query_arg($removed_args) |
|
380 | 380 | )); |
381 | 381 | ?>#posttype-extra-nav-menu-pages>" class="select-all"><?php _e('Select All'); ?></a> |
382 | 382 | </span> |
383 | 383 | |
384 | 384 | <span class="add-to-menu"> |
385 | - <input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( __( 'Add to Menu' ) ); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e( 'submit-posttype-extra-nav-menu-pages' ); ?>" /> |
|
385 | + <input type="submit"<?php wp_nav_menu_disabled_check($nav_menu_selected_id); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e(__('Add to Menu')); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e('submit-posttype-extra-nav-menu-pages'); ?>" /> |
|
386 | 386 | <span class="spinner"></span> |
387 | 387 | </span> |
388 | 388 | </p> |
@@ -403,10 +403,10 @@ discard block |
||
403 | 403 | private function _get_extra_nav_menu_pages_items() { |
404 | 404 | $menuitems[] = array( |
405 | 405 | 'title' => __('Event List', 'event_espresso'), |
406 | - 'url' => get_post_type_archive_link( 'espresso_events' ), |
|
406 | + 'url' => get_post_type_archive_link('espresso_events'), |
|
407 | 407 | 'description' => __('Archive page for all events.', 'event_espresso') |
408 | 408 | ); |
409 | - return apply_filters( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems ); |
|
409 | + return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems); |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | * @param $menu_item_values |
419 | 419 | * @return stdClass |
420 | 420 | */ |
421 | - private function _setup_extra_nav_menu_pages_items( $menu_item_values ) { |
|
421 | + private function _setup_extra_nav_menu_pages_items($menu_item_values) { |
|
422 | 422 | $menu_item = new stdClass(); |
423 | 423 | $keys = array( |
424 | 424 | 'ID' => 0, |
@@ -438,8 +438,8 @@ discard block |
||
438 | 438 | 'xfn' => '' |
439 | 439 | ); |
440 | 440 | |
441 | - foreach ( $keys as $key => $value) { |
|
442 | - $menu_item->{$key} = isset( $menu_item_values[ $key]) ? $menu_item_values[ $key] : $value; |
|
441 | + foreach ($keys as $key => $value) { |
|
442 | + $menu_item->{$key} = isset($menu_item_values[$key]) ? $menu_item_values[$key] : $value; |
|
443 | 443 | } |
444 | 444 | return $menu_item; |
445 | 445 | } |
@@ -478,10 +478,10 @@ discard block |
||
478 | 478 | * - check if doing post processing of one of EE CPTs |
479 | 479 | * - instantiate the corresponding EE CPT model for the post_type being processed. |
480 | 480 | */ |
481 | - if ( isset( $_POST['action'] ) && $_POST['action'] == 'editpost' ) { |
|
482 | - if ( isset( $_POST['post_type'] ) ) { |
|
483 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
484 | - EE_Register_CPTs::instantiate_cpt_models( $_POST['post_type'] ); |
|
481 | + if (isset($_POST['action']) && $_POST['action'] == 'editpost') { |
|
482 | + if (isset($_POST['post_type'])) { |
|
483 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
484 | + EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']); |
|
485 | 485 | } |
486 | 486 | } |
487 | 487 | |
@@ -491,8 +491,8 @@ discard block |
||
491 | 491 | * 'options-reading.php' core WordPress admin settings page. This is for user-proofing. |
492 | 492 | */ |
493 | 493 | global $pagenow; |
494 | - if ( $pagenow == 'options-reading.php' ) { |
|
495 | - add_filter( 'wp_dropdown_pages', array( $this, 'modify_dropdown_pages' ) ); |
|
494 | + if ($pagenow == 'options-reading.php') { |
|
495 | + add_filter('wp_dropdown_pages', array($this, 'modify_dropdown_pages')); |
|
496 | 496 | } |
497 | 497 | |
498 | 498 | } |
@@ -504,25 +504,25 @@ discard block |
||
504 | 504 | * @param string $output Current output. |
505 | 505 | * @return string |
506 | 506 | */ |
507 | - public function modify_dropdown_pages( $output ) { |
|
507 | + public function modify_dropdown_pages($output) { |
|
508 | 508 | //get critical pages |
509 | 509 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
510 | 510 | |
511 | 511 | //split current output by line break for easier parsing. |
512 | - $split_output = explode( "\n", $output ); |
|
512 | + $split_output = explode("\n", $output); |
|
513 | 513 | |
514 | 514 | //loop through to remove any critical pages from the array. |
515 | - foreach ( $critical_pages as $page_id ) { |
|
516 | - $needle = 'value="' . $page_id . '"'; |
|
517 | - foreach( $split_output as $key => $haystack ) { |
|
518 | - if( strpos( $haystack, $needle ) !== false ) { |
|
519 | - unset( $split_output[$key] ); |
|
515 | + foreach ($critical_pages as $page_id) { |
|
516 | + $needle = 'value="'.$page_id.'"'; |
|
517 | + foreach ($split_output as $key => $haystack) { |
|
518 | + if (strpos($haystack, $needle) !== false) { |
|
519 | + unset($split_output[$key]); |
|
520 | 520 | } |
521 | 521 | } |
522 | 522 | } |
523 | 523 | |
524 | 524 | //replace output with the new contents |
525 | - $output = implode( "\n", $split_output ); |
|
525 | + $output = implode("\n", $split_output); |
|
526 | 526 | |
527 | 527 | return $output; |
528 | 528 | } |
@@ -538,37 +538,37 @@ discard block |
||
538 | 538 | public function enqueue_admin_scripts() { |
539 | 539 | // this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js. |
540 | 540 | // Note: the intention of this script is to only do TARGETED injections. I.E, only injecting on certain script calls. |
541 | - wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
541 | + wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
542 | 542 | // register cookie script for future dependencies |
543 | - wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE ); |
|
543 | + wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE); |
|
544 | 544 | // jquery_validate loading is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
545 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
545 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
546 | 546 | // register jQuery Validate |
547 | - wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE); |
|
547 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE); |
|
548 | 548 | } |
549 | 549 | //joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again vai: add_filter('FHEE_load_joyride', '__return_true' ); |
550 | - if ( apply_filters( 'FHEE_load_joyride', FALSE ) ) { |
|
550 | + if (apply_filters('FHEE_load_joyride', FALSE)) { |
|
551 | 551 | //joyride style |
552 | - wp_register_style('joyride-css', EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css', array(), '2.1'); |
|
553 | - wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION ); |
|
554 | - wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js', array(), '2.1', TRUE ); |
|
552 | + wp_register_style('joyride-css', EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css', array(), '2.1'); |
|
553 | + wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION); |
|
554 | + wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js', array(), '2.1', TRUE); |
|
555 | 555 | //joyride JS |
556 | - wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE ); |
|
556 | + wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE); |
|
557 | 557 | // wanna go for a joyride? |
558 | 558 | wp_enqueue_style('ee-joyride-css'); |
559 | 559 | wp_enqueue_script('jquery-joyride'); |
560 | 560 | } |
561 | 561 | //qtip is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtips', '__return_true' ); |
562 | - if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) { |
|
562 | + if (apply_filters('FHEE_load_qtip', FALSE)) { |
|
563 | 563 | EE_Registry::instance()->load_helper('Qtip_Loader'); |
564 | 564 | EEH_Qtip_Loader::instance()->register_and_enqueue(); |
565 | 565 | } |
566 | 566 | //accounting.js library |
567 | 567 | // @link http://josscrowcroft.github.io/accounting.js/ |
568 | - if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) { |
|
569 | - wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
570 | - wp_register_script( 'ee-accounting-core', EE_THIRD_PARTY_URL . 'accounting/accounting.js', array('underscore'), '0.3.2', TRUE ); |
|
571 | - wp_enqueue_script( 'ee-accounting' ); |
|
568 | + if (apply_filters('FHEE_load_accounting_js', FALSE)) { |
|
569 | + wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
570 | + wp_register_script('ee-accounting-core', EE_THIRD_PARTY_URL.'accounting/accounting.js', array('underscore'), '0.3.2', TRUE); |
|
571 | + wp_enqueue_script('ee-accounting'); |
|
572 | 572 | // array of settings to get converted to JSON array via wp_localize_script |
573 | 573 | $currency_config = array( |
574 | 574 | 'currency' => array( |
@@ -615,11 +615,11 @@ discard block |
||
615 | 615 | public function get_persistent_admin_notices() { |
616 | 616 | // http://www.example.com/wp-admin/admin.php?page=espresso_general_settings&action=critical_pages&critical_pages_nonce=2831ce0f30 |
617 | 617 | $args = array( |
618 | - 'page' => EE_Registry::instance()->REQ->is_set( 'page' ) ? EE_Registry::instance()->REQ->get( 'page' ) : '', |
|
619 | - 'action' => EE_Registry::instance()->REQ->is_set( 'action' ) ? EE_Registry::instance()->REQ->get( 'action' ) : '', |
|
618 | + 'page' => EE_Registry::instance()->REQ->is_set('page') ? EE_Registry::instance()->REQ->get('page') : '', |
|
619 | + 'action' => EE_Registry::instance()->REQ->is_set('action') ? EE_Registry::instance()->REQ->get('action') : '', |
|
620 | 620 | ); |
621 | - $return_url = EE_Admin_Page::add_query_args_and_nonce( $args, EE_ADMIN_URL ); |
|
622 | - echo EE_Error::get_persistent_admin_notices( $return_url ); |
|
621 | + $return_url = EE_Admin_Page::add_query_args_and_nonce($args, EE_ADMIN_URL); |
|
622 | + echo EE_Error::get_persistent_admin_notices($return_url); |
|
623 | 623 | } |
624 | 624 | |
625 | 625 | |
@@ -640,26 +640,26 @@ discard block |
||
640 | 640 | * @param $elements |
641 | 641 | * @return array |
642 | 642 | */ |
643 | - public function dashboard_glance_items( $elements ) { |
|
643 | + public function dashboard_glance_items($elements) { |
|
644 | 644 | $events = EEM_Event::instance()->count(); |
645 | - $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') ); |
|
646 | - $items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) ); |
|
645 | + $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php')); |
|
646 | + $items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events)); |
|
647 | 647 | $items['events']['title'] = __('Click to view all Events', 'event_espresso'); |
648 | 648 | $registrations = EEM_Registration::instance()->count( |
649 | 649 | array( |
650 | 650 | array( |
651 | - 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) |
|
651 | + 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete) |
|
652 | 652 | ) |
653 | 653 | ) |
654 | 654 | ); |
655 | - $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_registrations' ), admin_url('admin.php') ); |
|
656 | - $items['registrations']['text'] = sprintf( _n( '%s Registration', '%s Registrations', $registrations ), number_format_i18n($registrations) ); |
|
655 | + $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php')); |
|
656 | + $items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations)); |
|
657 | 657 | $items['registrations']['title'] = __('Click to view all registrations', 'event_espresso'); |
658 | 658 | |
659 | - $items = apply_filters( 'FHEE__EE_Admin__dashboard_glance_items__items', $items ); |
|
659 | + $items = apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items); |
|
660 | 660 | |
661 | - foreach ( $items as $type => $item_properties ) { |
|
662 | - $elements[] = sprintf( '<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text'] ); |
|
661 | + foreach ($items as $type => $item_properties) { |
|
662 | + $elements[] = sprintf('<a class="ee-dashboard-link-'.$type.'" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text']); |
|
663 | 663 | } |
664 | 664 | return $elements; |
665 | 665 | } |
@@ -678,63 +678,63 @@ discard block |
||
678 | 678 | * @param $post |
679 | 679 | * @return void |
680 | 680 | */ |
681 | - public static function parse_post_content_on_save( $post_ID, $post ) { |
|
681 | + public static function parse_post_content_on_save($post_ID, $post) { |
|
682 | 682 | // default post types |
683 | - $post_types = array( 'post' => 0, 'page' => 1 ); |
|
683 | + $post_types = array('post' => 0, 'page' => 1); |
|
684 | 684 | // add CPTs |
685 | 685 | $CPTs = EE_Register_CPTs::get_CPTs(); |
686 | - $post_types = array_merge( $post_types, $CPTs ); |
|
686 | + $post_types = array_merge($post_types, $CPTs); |
|
687 | 687 | // for default or CPT posts... |
688 | - if ( isset( $post_types[ $post->post_type ] )) { |
|
688 | + if (isset($post_types[$post->post_type])) { |
|
689 | 689 | // post on frontpage ? |
690 | 690 | $page_for_posts = EE_Config::get_page_for_posts(); |
691 | 691 | $maybe_remove_from_posts = array(); |
692 | 692 | // critical page shortcodes that we do NOT want added to the Posts page (blog) |
693 | 693 | $critical_shortcodes = EE_Registry::instance()->CFG->core->get_critical_pages_shortcodes_array(); |
694 | 694 | // array of shortcodes indexed by post name |
695 | - EE_Registry::instance()->CFG->core->post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes ) ? EE_Registry::instance()->CFG->core->post_shortcodes : array(); |
|
695 | + EE_Registry::instance()->CFG->core->post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes) ? EE_Registry::instance()->CFG->core->post_shortcodes : array(); |
|
696 | 696 | // whether to proceed with update, if an entry already exists for this post, then we want to update |
697 | - $update_post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ] ) ? true : false; |
|
697 | + $update_post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name]) ? true : false; |
|
698 | 698 | // empty both arrays |
699 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ] = array(); |
|
699 | + EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name] = array(); |
|
700 | 700 | // check that posts page is already being tracked |
701 | - if ( ! isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] ) ) { |
|
701 | + if ( ! isset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts])) { |
|
702 | 702 | // if not, then ensure that it is properly added |
703 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] = array(); |
|
703 | + EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts] = array(); |
|
704 | 704 | } |
705 | 705 | // loop thru shortcodes |
706 | - foreach ( EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir ) { |
|
706 | + foreach (EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir) { |
|
707 | 707 | // convert to UPPERCASE to get actual shortcode |
708 | - $EES_Shortcode = strtoupper( $EES_Shortcode ); |
|
708 | + $EES_Shortcode = strtoupper($EES_Shortcode); |
|
709 | 709 | // is the shortcode in the post_content ? |
710 | - if ( strpos( $post->post_content, $EES_Shortcode ) !== FALSE ) { |
|
710 | + if (strpos($post->post_content, $EES_Shortcode) !== FALSE) { |
|
711 | 711 | // map shortcode to post names and post IDs |
712 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] = $post_ID; |
|
712 | + EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name][$EES_Shortcode] = $post_ID; |
|
713 | 713 | // if the shortcode is NOT one of the critical page shortcodes like ESPRESSO_TXN_PAGE |
714 | - if ( ! in_array( $EES_Shortcode, $critical_shortcodes )) { |
|
714 | + if ( ! in_array($EES_Shortcode, $critical_shortcodes)) { |
|
715 | 715 | // add shortcode to "Posts page" tracking |
716 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] = $post_ID; |
|
716 | + EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$EES_Shortcode] = $post_ID; |
|
717 | 717 | } |
718 | 718 | $update_post_shortcodes = TRUE; |
719 | - unset( $maybe_remove_from_posts[ $EES_Shortcode ] ); |
|
719 | + unset($maybe_remove_from_posts[$EES_Shortcode]); |
|
720 | 720 | } else { |
721 | - $maybe_remove_from_posts[ $EES_Shortcode ] = $post_ID; |
|
721 | + $maybe_remove_from_posts[$EES_Shortcode] = $post_ID; |
|
722 | 722 | } |
723 | 723 | } |
724 | - if ( $update_post_shortcodes ) { |
|
724 | + if ($update_post_shortcodes) { |
|
725 | 725 | // remove shortcodes from $maybe_remove_from_posts that are still being used |
726 | - foreach ( EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $shortcodes ) { |
|
727 | - if ( $post_name == $page_for_posts ) { |
|
726 | + foreach (EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $shortcodes) { |
|
727 | + if ($post_name == $page_for_posts) { |
|
728 | 728 | continue; |
729 | 729 | } |
730 | 730 | // compute difference between active post_shortcodes array and $maybe_remove_from_posts array |
731 | - $maybe_remove_from_posts = array_diff_key( $maybe_remove_from_posts, $shortcodes ); |
|
731 | + $maybe_remove_from_posts = array_diff_key($maybe_remove_from_posts, $shortcodes); |
|
732 | 732 | } |
733 | 733 | // now unset unused shortcodes from the $page_for_posts post_shortcodes |
734 | - foreach ( $maybe_remove_from_posts as $shortcode => $post_ID ) { |
|
735 | - unset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $shortcode ] ); |
|
734 | + foreach ($maybe_remove_from_posts as $shortcode => $post_ID) { |
|
735 | + unset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$shortcode]); |
|
736 | 736 | } |
737 | - EE_Registry::instance()->CFG->update_post_shortcodes( $page_for_posts ); |
|
737 | + EE_Registry::instance()->CFG->update_post_shortcodes($page_for_posts); |
|
738 | 738 | } |
739 | 739 | } |
740 | 740 | } |
@@ -752,32 +752,32 @@ discard block |
||
752 | 752 | * @throws EE_Error |
753 | 753 | * @return string |
754 | 754 | */ |
755 | - public function check_for_invalid_datetime_formats( $value, $option ) { |
|
756 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
755 | + public function check_for_invalid_datetime_formats($value, $option) { |
|
756 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
757 | 757 | // check for date_format or time_format |
758 | - switch ( $option ) { |
|
758 | + switch ($option) { |
|
759 | 759 | case 'date_format' : |
760 | - $date_time_format = $value . ' ' . get_option('time_format'); |
|
760 | + $date_time_format = $value.' '.get_option('time_format'); |
|
761 | 761 | break; |
762 | 762 | case 'time_format' : |
763 | - $date_time_format = get_option('date_format') . ' ' . $value; |
|
763 | + $date_time_format = get_option('date_format').' '.$value; |
|
764 | 764 | break; |
765 | 765 | default : |
766 | 766 | $date_time_format = FALSE; |
767 | 767 | } |
768 | 768 | // do we have a date_time format to check ? |
769 | - if ( $date_time_format ) { |
|
770 | - $error_msg = EEH_DTT_Helper::validate_format_string( $date_time_format ); |
|
769 | + if ($date_time_format) { |
|
770 | + $error_msg = EEH_DTT_Helper::validate_format_string($date_time_format); |
|
771 | 771 | |
772 | - if ( is_array( $error_msg ) ) { |
|
773 | - $msg = '<p>' . sprintf( __( 'The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso' ), date( $date_time_format ) , $date_time_format ) . '</p><p><ul>'; |
|
772 | + if (is_array($error_msg)) { |
|
773 | + $msg = '<p>'.sprintf(__('The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso'), date($date_time_format), $date_time_format).'</p><p><ul>'; |
|
774 | 774 | |
775 | 775 | |
776 | - foreach ( $error_msg as $error ) { |
|
777 | - $msg .= '<li>' . $error . '</li>'; |
|
776 | + foreach ($error_msg as $error) { |
|
777 | + $msg .= '<li>'.$error.'</li>'; |
|
778 | 778 | } |
779 | 779 | |
780 | - $msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>'; |
|
780 | + $msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>'; |
|
781 | 781 | |
782 | 782 | // trigger WP settings error |
783 | 783 | add_settings_error( |
@@ -787,7 +787,7 @@ discard block |
||
787 | 787 | ); |
788 | 788 | |
789 | 789 | // set format to something valid |
790 | - switch ( $option ) { |
|
790 | + switch ($option) { |
|
791 | 791 | case 'date_format' : |
792 | 792 | $value = 'F j, Y'; |
793 | 793 | break; |
@@ -813,14 +813,14 @@ discard block |
||
813 | 813 | * @param $value |
814 | 814 | * @return void |
815 | 815 | */ |
816 | - public function reset_page_for_posts_on_change( $option, $old_value, $value ) { |
|
817 | - if ( $option == 'page_for_posts' ) { |
|
816 | + public function reset_page_for_posts_on_change($option, $old_value, $value) { |
|
817 | + if ($option == 'page_for_posts') { |
|
818 | 818 | global $wpdb; |
819 | - $SQL = 'SELECT post_name from ' . $wpdb->posts . ' WHERE post_type="posts" OR post_type="page" AND post_status="publish" AND ID=%s'; |
|
820 | - $old_page_for_posts = $old_value ? $wpdb->get_var( $wpdb->prepare( $SQL, $old_value )) : 'posts'; |
|
821 | - $new_page_for_posts = $value ? $wpdb->get_var( $wpdb->prepare( $SQL, $value )) : 'posts'; |
|
822 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $new_page_for_posts ] = EE_Registry::instance()->CFG->core->post_shortcodes[ $old_page_for_posts ]; |
|
823 | - EE_Registry::instance()->CFG->update_post_shortcodes( $new_page_for_posts ); |
|
819 | + $SQL = 'SELECT post_name from '.$wpdb->posts.' WHERE post_type="posts" OR post_type="page" AND post_status="publish" AND ID=%s'; |
|
820 | + $old_page_for_posts = $old_value ? $wpdb->get_var($wpdb->prepare($SQL, $old_value)) : 'posts'; |
|
821 | + $new_page_for_posts = $value ? $wpdb->get_var($wpdb->prepare($SQL, $value)) : 'posts'; |
|
822 | + EE_Registry::instance()->CFG->core->post_shortcodes[$new_page_for_posts] = EE_Registry::instance()->CFG->core->post_shortcodes[$old_page_for_posts]; |
|
823 | + EE_Registry::instance()->CFG->update_post_shortcodes($new_page_for_posts); |
|
824 | 824 | } |
825 | 825 | } |
826 | 826 | |
@@ -833,8 +833,8 @@ discard block |
||
833 | 833 | * @param $content |
834 | 834 | * @return string |
835 | 835 | */ |
836 | - public function its_eSpresso( $content ) { |
|
837 | - return str_replace( '[EXPRESSO_', '[ESPRESSO_', $content ); |
|
836 | + public function its_eSpresso($content) { |
|
837 | + return str_replace('[EXPRESSO_', '[ESPRESSO_', $content); |
|
838 | 838 | } |
839 | 839 | |
840 | 840 | |
@@ -847,9 +847,9 @@ discard block |
||
847 | 847 | */ |
848 | 848 | public function espresso_admin_footer() { |
849 | 849 | return sprintf( |
850 | - __( 'Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso' ), |
|
850 | + __('Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso'), |
|
851 | 851 | '<a href="https://eventespresso.com/" title="', |
852 | - '">' . EVENT_ESPRESSO_POWERED_BY . '</a>' |
|
852 | + '">'.EVENT_ESPRESSO_POWERED_BY.'</a>' |
|
853 | 853 | ); |
854 | 854 | } |
855 | 855 | |
@@ -869,11 +869,11 @@ discard block |
||
869 | 869 | * @param array $config |
870 | 870 | * @return void |
871 | 871 | */ |
872 | - public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) { |
|
873 | - EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' ); |
|
874 | - if ( class_exists( 'EE_Register_Admin_Page' ) ) |
|
872 | + public static function register_ee_admin_page($page_basename, $page_path, $config = array()) { |
|
873 | + EE_Error::doing_it_wrong(__METHOD__, sprintf(__('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3'); |
|
874 | + if (class_exists('EE_Register_Admin_Page')) |
|
875 | 875 | $config['page_path'] = $page_path; |
876 | - EE_Register_Admin_Page::register( $page_basename, $config ); |
|
876 | + EE_Register_Admin_Page::register($page_basename, $config); |
|
877 | 877 | } |
878 | 878 | |
879 | 879 |
@@ -1,30 +1,30 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | require_once( EE_MODELS . 'EEM_Base.model.php'); |
3 | 3 | /** |
4 | - * EEM_Soft_Delete_Base |
|
5 | - * |
|
6 | - * About this class: modifies parent EEM_Base's behaviour to make usage of soft-deletable models |
|
7 | - * (ie, models that have a flag indicated they've been "soft-deleted"/trashed). |
|
8 | - * Generally, by adding EE_Soft_Delete_where_conditions's conditions, most queries |
|
9 | - * will ignore soft-deleted items. For example, see EEM_Soft_Delete_base::get_all(), |
|
10 | - * which will only fetch non-deleted items from the DB, treating soft-deleted items |
|
11 | - * as if they didn't exist. |
|
12 | - * You may sometimes want to see the soft-deleted items, or pretend the model isn't a soft-deleted item. |
|
13 | - * There are functions with similar names that accomplish this (eg, get_all_deleted() and |
|
14 | - * get_all_deleted_and_undeleted()). |
|
15 | - * Also, when deleting soft-deletable models, their deleted flag is actually just switched. |
|
16 | - * Also notice that you can undo a soft-delete by using restore(), and you can permanently |
|
17 | - * delete an item (normal deletion) by using delete_permanently(). |
|
18 | - * Also note: when querying related models that join to this model, this model's |
|
19 | - * default where conditions (ie, to only retrieve non-deleted items) will still apply. Eg |
|
20 | - * if querying EEM_Question::instance()->get_all(array(array('Question_Group.QSG_ID'=>3)), |
|
21 | - * will add WHERE conditions to the mysql query to only find rows that have a question group ID |
|
22 | - * of 3 AND THAT QUESTION GROUP IS NOT DELETED. |
|
23 | - * |
|
24 | - * @package Event Espresso |
|
25 | - * @subpackage includes/models/ |
|
26 | - * @author Michael Nelson |
|
27 | - */ |
|
4 | + * EEM_Soft_Delete_Base |
|
5 | + * |
|
6 | + * About this class: modifies parent EEM_Base's behaviour to make usage of soft-deletable models |
|
7 | + * (ie, models that have a flag indicated they've been "soft-deleted"/trashed). |
|
8 | + * Generally, by adding EE_Soft_Delete_where_conditions's conditions, most queries |
|
9 | + * will ignore soft-deleted items. For example, see EEM_Soft_Delete_base::get_all(), |
|
10 | + * which will only fetch non-deleted items from the DB, treating soft-deleted items |
|
11 | + * as if they didn't exist. |
|
12 | + * You may sometimes want to see the soft-deleted items, or pretend the model isn't a soft-deleted item. |
|
13 | + * There are functions with similar names that accomplish this (eg, get_all_deleted() and |
|
14 | + * get_all_deleted_and_undeleted()). |
|
15 | + * Also, when deleting soft-deletable models, their deleted flag is actually just switched. |
|
16 | + * Also notice that you can undo a soft-delete by using restore(), and you can permanently |
|
17 | + * delete an item (normal deletion) by using delete_permanently(). |
|
18 | + * Also note: when querying related models that join to this model, this model's |
|
19 | + * default where conditions (ie, to only retrieve non-deleted items) will still apply. Eg |
|
20 | + * if querying EEM_Question::instance()->get_all(array(array('Question_Group.QSG_ID'=>3)), |
|
21 | + * will add WHERE conditions to the mysql query to only find rows that have a question group ID |
|
22 | + * of 3 AND THAT QUESTION GROUP IS NOT DELETED. |
|
23 | + * |
|
24 | + * @package Event Espresso |
|
25 | + * @subpackage includes/models/ |
|
26 | + * @author Michael Nelson |
|
27 | + */ |
|
28 | 28 | abstract class EEM_Soft_Delete_Base extends EEM_Base{ |
29 | 29 | |
30 | 30 | /** |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * Sum all the deleted items. |
147 | 147 | * @param array $query_params like EEM_Base::get_all |
148 | 148 | * @param string $field_to_sum |
149 | - * @return int |
|
149 | + * @return double |
|
150 | 150 | */ |
151 | 151 | public function sum_deleted($query_params = null, $field_to_sum = null){ |
152 | 152 | $query_params = $this->_alter_query_params_so_only_trashed_items_included($query_params); |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * @param boolean $allow_blocking if TRUE, matched objects will only be deleted if there is no related model info |
196 | 196 | * that blocks it (ie, there' sno other data that depends on this data); if false, deletes regardless of other objects |
197 | 197 | * which may depend on it. Its generally advisable to always leave this as TRUE, otherwise you could easily corrupt your DB |
198 | - * @return boolean success |
|
198 | + * @return integer success |
|
199 | 199 | */ |
200 | 200 | public function delete_permanently($query_params = array(), $allow_blocking = true){ |
201 | 201 | $query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params); |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | /** |
279 | 279 | * Updates all the items of this model which match the $query params, regardless of whether |
280 | 280 | * they've been soft-deleted or not |
281 | - * @param array $field_n_values like EEM_Base::update's $fields_n_value |
|
281 | + * @param array $fields_n_values like EEM_Base::update's $fields_n_value |
|
282 | 282 | * @param array $query_params like EEM_base::get_all's $query_params |
283 | 283 | * @param boolean $keep_model_objs_in_sync if TRUE, makes sure we ALSO update model objects |
284 | 284 | * in this model's entity map according to $fields_n_values that match $query_params. This |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | -require_once( EE_MODELS . 'EEM_Base.model.php'); |
|
2 | +require_once(EE_MODELS.'EEM_Base.model.php'); |
|
3 | 3 | /** |
4 | 4 | * EEM_Soft_Delete_Base |
5 | 5 | * |
@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | * @subpackage includes/models/ |
26 | 26 | * @author Michael Nelson |
27 | 27 | */ |
28 | -abstract class EEM_Soft_Delete_Base extends EEM_Base{ |
|
28 | +abstract class EEM_Soft_Delete_Base extends EEM_Base { |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * @param null $timezone |
32 | 32 | */ |
33 | 33 | protected function __construct($timezone = NULL) { |
34 | - if( ! $this->_default_where_conditions_strategy instanceof EE_Default_Where_Conditions ){ |
|
34 | + if ( ! $this->_default_where_conditions_strategy instanceof EE_Default_Where_Conditions) { |
|
35 | 35 | $this->_default_where_conditions_strategy = new EE_Soft_Delete_Where_Conditions(); |
36 | 36 | } |
37 | 37 | parent::__construct($timezone); |
@@ -42,12 +42,12 @@ discard block |
||
42 | 42 | * @return string |
43 | 43 | * @throws EE_Error |
44 | 44 | */ |
45 | - public function deleted_field_name(){ |
|
45 | + public function deleted_field_name() { |
|
46 | 46 | $field = $this->get_a_field_of_type('EE_Trashed_Flag_Field'); |
47 | - if($field){ |
|
47 | + if ($field) { |
|
48 | 48 | return $field->get_name(); |
49 | - }else{ |
|
50 | - throw new EE_Error(sprintf(__('We are trying to find the deleted flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?','event_espresso'),get_class($this),get_class($this))); |
|
49 | + } else { |
|
50 | + throw new EE_Error(sprintf(__('We are trying to find the deleted flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?', 'event_espresso'), get_class($this), get_class($this))); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @param array $query_params like EEM_Base::get_all's $query_params |
58 | 58 | * @return EE_Soft_Delete_Base_Class |
59 | 59 | */ |
60 | - public function get_one_deleted($query_params = array()){ |
|
60 | + public function get_one_deleted($query_params = array()) { |
|
61 | 61 | $query_params = $this->_alter_query_params_so_only_trashed_items_included($query_params); |
62 | 62 | return parent::get_one($query_params); |
63 | 63 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @param array $query_params like EEM_base::get_all's $query_params |
68 | 68 | * @return EE_Soft_Delete_Base_Class |
69 | 69 | */ |
70 | - public function get_one_deleted_or_undeleted($query_params = array()){ |
|
70 | + public function get_one_deleted_or_undeleted($query_params = array()) { |
|
71 | 71 | $query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params); |
72 | 72 | return parent::get_one($query_params); |
73 | 73 | } |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | * @param int|string $id |
78 | 78 | * @return EE_Soft_Delete_Base_Class |
79 | 79 | */ |
80 | - public function get_one_by_ID_but_ignore_deleted($id){ |
|
80 | + public function get_one_by_ID_but_ignore_deleted($id) { |
|
81 | 81 | return $this->get_one( |
82 | 82 | $this->alter_query_params_to_restrict_by_ID( |
83 | 83 | $id, |
84 | - array( 'default_where_conditions' => 'default' ) |
|
84 | + array('default_where_conditions' => 'default') |
|
85 | 85 | ) |
86 | 86 | ); |
87 | 87 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @param bool $distinct if we want to only count the distinct values for the column then you can trigger that by the setting $distinct to TRUE; |
94 | 94 | * @return int |
95 | 95 | */ |
96 | - public function count_deleted($query_params = null, $field_to_count = null, $distinct = FALSE){ |
|
96 | + public function count_deleted($query_params = null, $field_to_count = null, $distinct = FALSE) { |
|
97 | 97 | $query_params = $this->_alter_query_params_so_only_trashed_items_included($query_params); |
98 | 98 | return parent::count($query_params, $field_to_count, $distinct); |
99 | 99 | } |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | * @param array $query_params like EEM_Base::get_all's $query_params |
104 | 104 | * @return array like EEM_Base::get_all's $query_params |
105 | 105 | */ |
106 | - protected function _alter_query_params_so_only_trashed_items_included($query_params){ |
|
107 | - $deletedFlagFieldName=$this->deleted_field_name(); |
|
108 | - $query_params[0][$deletedFlagFieldName]=true; |
|
106 | + protected function _alter_query_params_so_only_trashed_items_included($query_params) { |
|
107 | + $deletedFlagFieldName = $this->deleted_field_name(); |
|
108 | + $query_params[0][$deletedFlagFieldName] = true; |
|
109 | 109 | return $query_params; |
110 | 110 | } |
111 | 111 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * @param array $query_params |
115 | 115 | * @return array |
116 | 116 | */ |
117 | - public function alter_query_params_so_deleted_and_undeleted_items_included( $query_params = array() ){ |
|
117 | + public function alter_query_params_so_deleted_and_undeleted_items_included($query_params = array()) { |
|
118 | 118 | return $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params); |
119 | 119 | } |
120 | 120 | |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | * @param array $query_params |
124 | 124 | * @return array |
125 | 125 | */ |
126 | - protected function _alter_query_params_so_deleted_and_undeleted_items_included($query_params){ |
|
127 | - if( ! isset( $query_params[ 'default_where_conditions' ] ) ) { |
|
126 | + protected function _alter_query_params_so_deleted_and_undeleted_items_included($query_params) { |
|
127 | + if ( ! isset($query_params['default_where_conditions'])) { |
|
128 | 128 | $query_params['default_where_conditions'] = 'minimum'; |
129 | 129 | } |
130 | 130 | return $query_params; |
@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | * @param bool $distinct if we want to only count the distinct values for the column then you can trigger that by the setting $distinct to TRUE; |
138 | 138 | * @return int |
139 | 139 | */ |
140 | - public function count_deleted_and_undeleted($query_params = null, $field_to_count = null, $distinct = FALSE){ |
|
140 | + public function count_deleted_and_undeleted($query_params = null, $field_to_count = null, $distinct = FALSE) { |
|
141 | 141 | $query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params); |
142 | - return parent::count($query_params,$field_to_count, $distinct); |
|
142 | + return parent::count($query_params, $field_to_count, $distinct); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @param string $field_to_sum |
149 | 149 | * @return int |
150 | 150 | */ |
151 | - public function sum_deleted($query_params = null, $field_to_sum = null){ |
|
151 | + public function sum_deleted($query_params = null, $field_to_sum = null) { |
|
152 | 152 | $query_params = $this->_alter_query_params_so_only_trashed_items_included($query_params); |
153 | 153 | return parent::sum($query_params, $field_to_sum); |
154 | 154 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * @param string $field_to_sum |
160 | 160 | * @reutrn int |
161 | 161 | */ |
162 | - public function sum_deleted_and_undeleted($query_params = null, $field_to_sum = null){ |
|
162 | + public function sum_deleted_and_undeleted($query_params = null, $field_to_sum = null) { |
|
163 | 163 | $query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params); |
164 | 164 | parent::sum($query_params, $field_to_sum); |
165 | 165 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * @param array $query_params like EEM_Base::get_all |
170 | 170 | * @return EE_Soft_Delete_Base_Class[] |
171 | 171 | */ |
172 | - public function get_all_deleted_and_undeleted($query_params = array()){ |
|
172 | + public function get_all_deleted_and_undeleted($query_params = array()) { |
|
173 | 173 | $query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params); |
174 | 174 | return parent::get_all($query_params); |
175 | 175 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * @param array $query_params like EEM_Base::get_all |
180 | 180 | * @return EE_Soft_Delete_Base_Class[] |
181 | 181 | */ |
182 | - public function get_all_deleted($query_params = array()){ |
|
182 | + public function get_all_deleted($query_params = array()) { |
|
183 | 183 | $query_params = $this->_alter_query_params_so_only_trashed_items_included($query_params); |
184 | 184 | return parent::get_all($query_params); |
185 | 185 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * which may depend on it. Its generally advisable to always leave this as TRUE, otherwise you could easily corrupt your DB |
198 | 198 | * @return boolean success |
199 | 199 | */ |
200 | - public function delete_permanently($query_params = array(), $allow_blocking = true){ |
|
200 | + public function delete_permanently($query_params = array(), $allow_blocking = true) { |
|
201 | 201 | $query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params); |
202 | 202 | return parent::delete_permanently($query_params, $allow_blocking); |
203 | 203 | } |
@@ -208,8 +208,8 @@ discard block |
||
208 | 208 | * @param mixed $ID int if primary key is an int, string otherwise |
209 | 209 | * @return boolean success |
210 | 210 | */ |
211 | - public function restore_by_ID($ID=FALSE){ |
|
212 | - return $this->delete_or_restore_by_ID(false,$ID); |
|
211 | + public function restore_by_ID($ID = FALSE) { |
|
212 | + return $this->delete_or_restore_by_ID(false, $ID); |
|
213 | 213 | } |
214 | 214 | /** |
215 | 215 | * For deleting or restoring a particular item. Note that this model is a SOFT-DELETABLE model! However, |
@@ -218,14 +218,14 @@ discard block |
||
218 | 218 | * @param mixed $ID int if primary key is an int, string otherwise |
219 | 219 | * @return boolean |
220 | 220 | */ |
221 | - public function delete_or_restore_by_ID($delete=true,$ID=FALSE){ |
|
222 | - if ( ! $ID ) { |
|
221 | + public function delete_or_restore_by_ID($delete = true, $ID = FALSE) { |
|
222 | + if ( ! $ID) { |
|
223 | 223 | return FALSE; |
224 | 224 | } |
225 | 225 | if ( |
226 | 226 | $this->delete_or_restore( |
227 | 227 | $delete, |
228 | - $this->alter_query_params_to_restrict_by_ID( $ID ) |
|
228 | + $this->alter_query_params_to_restrict_by_ID($ID) |
|
229 | 229 | ) |
230 | 230 | ) { |
231 | 231 | return TRUE; |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @param bool $block_deletes |
246 | 246 | * @return boolean |
247 | 247 | */ |
248 | - public function delete($query_params = array(), $block_deletes = false){ |
|
248 | + public function delete($query_params = array(), $block_deletes = false) { |
|
249 | 249 | //no matter what, we WON'T block soft deletes. |
250 | 250 | return $this->delete_or_restore(true, $query_params); |
251 | 251 | } |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * @param array $query_params like EEM_Base::get_all |
257 | 257 | * @return boolean |
258 | 258 | */ |
259 | - public function restore($query_params = array()){ |
|
259 | + public function restore($query_params = array()) { |
|
260 | 260 | return $this->delete_or_restore(false, $query_params); |
261 | 261 | } |
262 | 262 | /** |
@@ -265,10 +265,10 @@ discard block |
||
265 | 265 | * @param array $query_params like EEM_Base::get_all |
266 | 266 | * @return boolean |
267 | 267 | */ |
268 | - function delete_or_restore($delete=true,$query_params = array()){ |
|
269 | - $deletedFlagFieldName=$this->deleted_field_name(); |
|
268 | + function delete_or_restore($delete = true, $query_params = array()) { |
|
269 | + $deletedFlagFieldName = $this->deleted_field_name(); |
|
270 | 270 | $query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params); |
271 | - if ( $this->update (array($deletedFlagFieldName=>$delete), $query_params )) { |
|
271 | + if ($this->update(array($deletedFlagFieldName=>$delete), $query_params)) { |
|
272 | 272 | return TRUE; |
273 | 273 | } else { |
274 | 274 | return FALSE; |
@@ -286,8 +286,8 @@ discard block |
||
286 | 286 | * be aware that model objects being used could get out-of-sync with the database |
287 | 287 | * @return int number of items updated |
288 | 288 | */ |
289 | - public function update_deleted_and_undeleted($fields_n_values, $query_params, $keep_model_objs_in_sync = TRUE ){ |
|
289 | + public function update_deleted_and_undeleted($fields_n_values, $query_params, $keep_model_objs_in_sync = TRUE) { |
|
290 | 290 | $query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params); |
291 | - return $this->update($fields_n_values, $query_params, $keep_model_objs_in_sync ); |
|
291 | + return $this->update($fields_n_values, $query_params, $keep_model_objs_in_sync); |
|
292 | 292 | } |
293 | 293 | } |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * EEG_Mijireh |
|
5 | - * |
|
6 | - * @package Event Espresso |
|
7 | - * @subpackage |
|
8 | - * @author Mike Nelson |
|
9 | - * |
|
10 | - */ |
|
3 | + * |
|
4 | + * EEG_Mijireh |
|
5 | + * |
|
6 | + * @package Event Espresso |
|
7 | + * @subpackage |
|
8 | + * @author Mike Nelson |
|
9 | + * |
|
10 | + */ |
|
11 | 11 | class EEG_Mijireh extends EE_Offsite_Gateway{ |
12 | 12 | |
13 | 13 | protected $_access_key; |
@@ -99,45 +99,45 @@ discard block |
||
99 | 99 | 'body'=> json_encode($order) |
100 | 100 | ); |
101 | 101 | $response = wp_remote_post( $this->_mijireh_api_orders_url, $args ); |
102 | - $problems_string = false; |
|
102 | + $problems_string = false; |
|
103 | 103 | $this->log(array('get checkout url request_args' => $args, 'response' => $response ), $payment); |
104 | 104 | if( ! $response instanceof WP_Error ){ |
105 | 105 | $response_body = json_decode($response['body']); |
106 | 106 | if($response_body && isset($response_body->checkout_url)){ |
107 | - $payment->set_redirect_url($response_body->checkout_url); |
|
108 | - $payment->set_txn_id_chq_nmbr($response_body->order_number); |
|
109 | - $payment->set_details($response['body']); |
|
107 | + $payment->set_redirect_url($response_body->checkout_url); |
|
108 | + $payment->set_txn_id_chq_nmbr($response_body->order_number); |
|
109 | + $payment->set_details($response['body']); |
|
110 | 110 | } else { |
111 | - if( is_array( $response_body ) || is_object( $response_body)){ |
|
112 | - $response_body_as_array = (array)$response_body; |
|
113 | - foreach($response_body_as_array as $problem_parameter => $problems){ |
|
114 | - $problems_string.= sprintf(__('\nProblems with %s: %s','event_espresso'),$problem_parameter,implode(", ",$problems)); |
|
115 | - } |
|
116 | - }else{ |
|
117 | - $problems_string = $response['body']; |
|
118 | - } |
|
119 | - if( ! $problems_string ) { |
|
120 | - //no message to show? wack |
|
121 | - if( isset( $response[ 'headers' ][ 'status' ] ) ){ |
|
122 | - $problems_string = $response[ 'headers' ][ 'status' ]; |
|
123 | - }else{ |
|
124 | - $problems_string = __( 'No response from Mijireh', 'event_espresso' ); |
|
125 | - } |
|
126 | - } |
|
127 | - } |
|
111 | + if( is_array( $response_body ) || is_object( $response_body)){ |
|
112 | + $response_body_as_array = (array)$response_body; |
|
113 | + foreach($response_body_as_array as $problem_parameter => $problems){ |
|
114 | + $problems_string.= sprintf(__('\nProblems with %s: %s','event_espresso'),$problem_parameter,implode(", ",$problems)); |
|
115 | + } |
|
116 | + }else{ |
|
117 | + $problems_string = $response['body']; |
|
118 | + } |
|
119 | + if( ! $problems_string ) { |
|
120 | + //no message to show? wack |
|
121 | + if( isset( $response[ 'headers' ][ 'status' ] ) ){ |
|
122 | + $problems_string = $response[ 'headers' ][ 'status' ]; |
|
123 | + }else{ |
|
124 | + $problems_string = __( 'No response from Mijireh', 'event_espresso' ); |
|
125 | + } |
|
126 | + } |
|
127 | + } |
|
128 | 128 | }else{ |
129 | - $problems_string = implode( ",", $response->get_error_messages() ); |
|
129 | + $problems_string = implode( ",", $response->get_error_messages() ); |
|
130 | 130 | } |
131 | 131 | |
132 | - if( $problems_string ) { |
|
133 | - $payment->set_gateway_response( sprintf( __( 'Errors occurred communicating with Mijireh: %1$s', 'event_espresso'), $problems_string ) ); |
|
134 | - $payment->set_details( $response ); |
|
135 | - $payment->set_redirect_url( null ); |
|
136 | - //even though the payment's status is failed at this point anyways, |
|
137 | - //let's be explicit about it. The fact that the redirect url is null |
|
138 | - //should be enough to client code that they can't redirect the user |
|
139 | - $payment->set_status( $this->_pay_model->failed_status() ); |
|
140 | - } |
|
132 | + if( $problems_string ) { |
|
133 | + $payment->set_gateway_response( sprintf( __( 'Errors occurred communicating with Mijireh: %1$s', 'event_espresso'), $problems_string ) ); |
|
134 | + $payment->set_details( $response ); |
|
135 | + $payment->set_redirect_url( null ); |
|
136 | + //even though the payment's status is failed at this point anyways, |
|
137 | + //let's be explicit about it. The fact that the redirect url is null |
|
138 | + //should be enough to client code that they can't redirect the user |
|
139 | + $payment->set_status( $this->_pay_model->failed_status() ); |
|
140 | + } |
|
141 | 141 | return $payment; |
142 | 142 | } |
143 | 143 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @author Mike Nelson |
9 | 9 | * |
10 | 10 | */ |
11 | -class EEG_Mijireh extends EE_Offsite_Gateway{ |
|
11 | +class EEG_Mijireh extends EE_Offsite_Gateway { |
|
12 | 12 | |
13 | 13 | protected $_access_key; |
14 | 14 | |
@@ -37,10 +37,10 @@ discard block |
||
37 | 37 | $primary_attendee = $primary_registrant->attendee(); |
38 | 38 | $items = array(); |
39 | 39 | //if we're are charging for the full amount, show the normal line items |
40 | - if( $this->_can_easily_itemize_transaction_for( $payment )){ |
|
40 | + if ($this->_can_easily_itemize_transaction_for($payment)) { |
|
41 | 41 | $total_line_item = $transaction->total_line_item(); |
42 | 42 | $tax_total = $total_line_item->get_total_tax(); |
43 | - foreach($total_line_item->get_items() as $line_item){ |
|
43 | + foreach ($total_line_item->get_items() as $line_item) { |
|
44 | 44 | $items[] = array( |
45 | 45 | 'name'=>apply_filters( |
46 | 46 | 'FHEE__EEG_Mijireh__set_redirection_info__full_amount_line_item_name', |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | 'quantity'=>$line_item->quantity() |
55 | 55 | ); |
56 | 56 | } |
57 | - }else{//its a partial payment |
|
57 | + } else {//its a partial payment |
|
58 | 58 | $tax_total = 0; |
59 | 59 | //partial payment, so just add 1 item |
60 | 60 | $items[] = array( |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | 'FHEE__EEG_Mijireh__set_redirection_info__partial_amount_line_item_name', |
63 | 63 | sprintf( |
64 | 64 | __("Payment of %s for %s", 'event_espresso'), |
65 | - $payment->get_pretty( 'PAY_amount', 'no_currency_code' ), |
|
65 | + $payment->get_pretty('PAY_amount', 'no_currency_code'), |
|
66 | 66 | $primary_registrant->event_name() |
67 | 67 | ), |
68 | 68 | $payment, |
@@ -76,18 +76,18 @@ discard block |
||
76 | 76 | $order = array( |
77 | 77 | 'total'=>$this->format_currency($payment->amount()), |
78 | 78 | 'return_url'=>$return_url, |
79 | - 'items'=>$this->_prepare_for_mijireh( $items ), |
|
79 | + 'items'=>$this->_prepare_for_mijireh($items), |
|
80 | 80 | 'email'=>$primary_attendee->email(), |
81 | 81 | 'first_name'=>$primary_attendee->fname(), |
82 | 82 | 'last_name'=>$primary_attendee->lname(), |
83 | 83 | 'tax'=>$this->format_currency($tax_total), |
84 | 84 | 'partner_id'=>'ee'); |
85 | 85 | //setup address? |
86 | - if( $primary_attendee->address() && |
|
87 | - $primary_attendee->city() && |
|
88 | - $primary_attendee->state_ID() && |
|
89 | - $primary_attendee->country_ID() && |
|
90 | - $primary_attendee->zip() ){ |
|
86 | + if ($primary_attendee->address() && |
|
87 | + $primary_attendee->city() && |
|
88 | + $primary_attendee->state_ID() && |
|
89 | + $primary_attendee->country_ID() && |
|
90 | + $primary_attendee->zip()) { |
|
91 | 91 | $shipping_address = array( |
92 | 92 | 'first_name'=>$primary_attendee->fname(), |
93 | 93 | 'last_name'=>$primary_attendee->lname(), |
@@ -97,62 +97,62 @@ discard block |
||
97 | 97 | 'zip_code' => $primary_attendee->zip(), |
98 | 98 | 'country' => $primary_attendee->country_ID() |
99 | 99 | ); |
100 | - if( $primary_attendee->address2() ){ |
|
101 | - $shipping_address[ 'apt_suite' ] = $primary_attendee->address2(); |
|
100 | + if ($primary_attendee->address2()) { |
|
101 | + $shipping_address['apt_suite'] = $primary_attendee->address2(); |
|
102 | 102 | } |
103 | - if( $primary_attendee->phone() ){ |
|
104 | - $shipping_address[ 'phone' ] = $primary_attendee->phone(); |
|
103 | + if ($primary_attendee->phone()) { |
|
104 | + $shipping_address['phone'] = $primary_attendee->phone(); |
|
105 | 105 | } |
106 | - $order[ 'shipping_address' ] = $shipping_address; |
|
106 | + $order['shipping_address'] = $shipping_address; |
|
107 | 107 | } |
108 | - $order = apply_filters( 'FHEE__EEG_Mijireh__set_redirection_info__order_arguments', $order, $payment, $primary_registrant ); |
|
109 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, serialize(get_object_vars($this)) ); |
|
108 | + $order = apply_filters('FHEE__EEG_Mijireh__set_redirection_info__order_arguments', $order, $payment, $primary_registrant); |
|
109 | + do_action('AHEE_log', __FILE__, __FUNCTION__, serialize(get_object_vars($this))); |
|
110 | 110 | $args = array( |
111 | 111 | 'headers' => array( |
112 | - 'Authorization' => 'Basic ' . base64_encode( $this->_access_key . ':' ), |
|
112 | + 'Authorization' => 'Basic '.base64_encode($this->_access_key.':'), |
|
113 | 113 | 'Accept'=>'application/json' |
114 | 114 | ), |
115 | 115 | 'body'=> json_encode($order) |
116 | 116 | ); |
117 | - $response = wp_remote_post( $this->_mijireh_api_orders_url, $args ); |
|
117 | + $response = wp_remote_post($this->_mijireh_api_orders_url, $args); |
|
118 | 118 | $problems_string = false; |
119 | - $this->log(array('get checkout url request_args' => $args, 'response' => $response ), $payment); |
|
120 | - if( ! $response instanceof WP_Error ){ |
|
119 | + $this->log(array('get checkout url request_args' => $args, 'response' => $response), $payment); |
|
120 | + if ( ! $response instanceof WP_Error) { |
|
121 | 121 | $response_body = json_decode($response['body']); |
122 | - if($response_body && isset($response_body->checkout_url)){ |
|
122 | + if ($response_body && isset($response_body->checkout_url)) { |
|
123 | 123 | $payment->set_redirect_url($response_body->checkout_url); |
124 | 124 | $payment->set_txn_id_chq_nmbr($response_body->order_number); |
125 | 125 | $payment->set_details($response['body']); |
126 | 126 | } else { |
127 | - if( is_array( $response_body ) || is_object( $response_body)){ |
|
128 | - $response_body_as_array = (array)$response_body; |
|
129 | - foreach($response_body_as_array as $problem_parameter => $problems){ |
|
130 | - $problems_string.= sprintf(__('\nProblems with %s: %s','event_espresso'),$problem_parameter,implode(", ",$problems)); |
|
127 | + if (is_array($response_body) || is_object($response_body)) { |
|
128 | + $response_body_as_array = (array) $response_body; |
|
129 | + foreach ($response_body_as_array as $problem_parameter => $problems) { |
|
130 | + $problems_string .= sprintf(__('\nProblems with %s: %s', 'event_espresso'), $problem_parameter, implode(", ", $problems)); |
|
131 | 131 | } |
132 | - }else{ |
|
132 | + } else { |
|
133 | 133 | $problems_string = $response['body']; |
134 | 134 | } |
135 | - if( ! $problems_string ) { |
|
135 | + if ( ! $problems_string) { |
|
136 | 136 | //no message to show? wack |
137 | - if( isset( $response[ 'headers' ][ 'status' ] ) ){ |
|
138 | - $problems_string = $response[ 'headers' ][ 'status' ]; |
|
139 | - }else{ |
|
140 | - $problems_string = __( 'No response from Mijireh', 'event_espresso' ); |
|
137 | + if (isset($response['headers']['status'])) { |
|
138 | + $problems_string = $response['headers']['status']; |
|
139 | + } else { |
|
140 | + $problems_string = __('No response from Mijireh', 'event_espresso'); |
|
141 | 141 | } |
142 | 142 | } |
143 | 143 | } |
144 | - }else{ |
|
145 | - $problems_string = implode( ",", $response->get_error_messages() ); |
|
144 | + } else { |
|
145 | + $problems_string = implode(",", $response->get_error_messages()); |
|
146 | 146 | } |
147 | 147 | |
148 | - if( $problems_string ) { |
|
149 | - $payment->set_gateway_response( sprintf( __( 'Errors occurred communicating with Mijireh: %1$s', 'event_espresso'), $problems_string ) ); |
|
150 | - $payment->set_details( $response ); |
|
151 | - $payment->set_redirect_url( null ); |
|
148 | + if ($problems_string) { |
|
149 | + $payment->set_gateway_response(sprintf(__('Errors occurred communicating with Mijireh: %1$s', 'event_espresso'), $problems_string)); |
|
150 | + $payment->set_details($response); |
|
151 | + $payment->set_redirect_url(null); |
|
152 | 152 | //even though the payment's status is failed at this point anyways, |
153 | 153 | //let's be explicit about it. The fact that the redirect url is null |
154 | 154 | //should be enough to client code that they can't redirect the user |
155 | - $payment->set_status( $this->_pay_model->failed_status() ); |
|
155 | + $payment->set_status($this->_pay_model->failed_status()); |
|
156 | 156 | } |
157 | 157 | return $payment; |
158 | 158 | } |
@@ -165,16 +165,16 @@ discard block |
||
165 | 165 | * @param mixed $data |
166 | 166 | * @return mixed same type as $data |
167 | 167 | */ |
168 | - private function _prepare_for_mijireh( $data ){ |
|
169 | - if( is_array( $data ) ){ |
|
168 | + private function _prepare_for_mijireh($data) { |
|
169 | + if (is_array($data)) { |
|
170 | 170 | $prepared_data = array(); |
171 | - foreach($data as $key => $datum ){ |
|
172 | - $prepared_data[ $key ] = $this->_prepare_for_mijireh( $datum ); |
|
171 | + foreach ($data as $key => $datum) { |
|
172 | + $prepared_data[$key] = $this->_prepare_for_mijireh($datum); |
|
173 | 173 | } |
174 | 174 | return $prepared_data; |
175 | - }elseif(is_string( $data ) ){ |
|
176 | - return str_replace( '%', 'percent', $data ); |
|
177 | - }else{ |
|
175 | + }elseif (is_string($data)) { |
|
176 | + return str_replace('%', 'percent', $data); |
|
177 | + } else { |
|
178 | 178 | return $data; |
179 | 179 | } |
180 | 180 | } |
@@ -195,30 +195,30 @@ discard block |
||
195 | 195 | |
196 | 196 | $payment = $transaction instanceof EEI_Transaction ? $transaction->last_payment() : NULL; |
197 | 197 | |
198 | - if ( ! $payment instanceof EEI_Payment ){ |
|
199 | - throw new EE_Error( sprintf( __( "Could not find Mijireh payment for transaction %s", 'event_espresso' ), $transaction->ID() ) ); |
|
198 | + if ( ! $payment instanceof EEI_Payment) { |
|
199 | + throw new EE_Error(sprintf(__("Could not find Mijireh payment for transaction %s", 'event_espresso'), $transaction->ID())); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | $request_args = array( |
203 | 203 | 'headers' => array( |
204 | - 'Authorization' => 'Basic ' . base64_encode( $this->_access_key . ':' ), |
|
204 | + 'Authorization' => 'Basic '.base64_encode($this->_access_key.':'), |
|
205 | 205 | 'Accept'=>'application/json' |
206 | 206 | ) |
207 | 207 | ); |
208 | 208 | |
209 | 209 | $response = wp_remote_get( |
210 | - $this->_mijireh_api_orders_url . '/' . $payment->txn_id_chq_nmbr(), |
|
210 | + $this->_mijireh_api_orders_url.'/'.$payment->txn_id_chq_nmbr(), |
|
211 | 211 | $request_args |
212 | 212 | ); |
213 | 213 | |
214 | 214 | $this->log( |
215 | - array( 'get payment status request_args' => $request_args, 'response' => $response ), |
|
215 | + array('get payment status request_args' => $request_args, 'response' => $response), |
|
216 | 216 | $payment |
217 | 217 | ); |
218 | 218 | // validate response |
219 | - $response_body = isset( $response[ 'body' ] ) ? json_decode( $response[ 'body' ] ) : ''; |
|
220 | - if( $response && $response_body ){ |
|
221 | - switch( $response_body->status ){ |
|
219 | + $response_body = isset($response['body']) ? json_decode($response['body']) : ''; |
|
220 | + if ($response && $response_body) { |
|
221 | + switch ($response_body->status) { |
|
222 | 222 | case 'paid': |
223 | 223 | $payment->set_status($this->_pay_model->approved_status()); |
224 | 224 | break; |
@@ -230,9 +230,9 @@ discard block |
||
230 | 230 | } |
231 | 231 | |
232 | 232 | } else { |
233 | - $payment->set_gateway_response( __( 'Response from Mijireh could not be understood.', 'event_espresso' ) ); |
|
234 | - $payment->set_details( $response ); |
|
235 | - $payment->set_status( $this->_pay_model->failed_status() ); |
|
233 | + $payment->set_gateway_response(__('Response from Mijireh could not be understood.', 'event_espresso')); |
|
234 | + $payment->set_details($response); |
|
235 | + $payment->set_status($this->_pay_model->failed_status()); |
|
236 | 236 | } |
237 | 237 | // the following is ONLY for testing the Mijireh IPN and should NEVER be uncommented for real usage |
238 | 238 | // $payment->set_status( $this->_pay_model->pending_status() ); |
@@ -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 Event Espresso |
|
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 | - * EEH_Class_Tools Helper |
|
17 | - * |
|
18 | - * @package Event Espresso |
|
19 | - * @subpackage /helpers/ |
|
20 | - * @author Brent Christensen |
|
21 | - * |
|
22 | - * ------------------------------------------------------------------------ |
|
23 | - */ |
|
3 | + * Event Espresso |
|
4 | + * |
|
5 | + * Event Registration and Management Plugin for WordPress |
|
6 | + * |
|
7 | + * @ package Event Espresso |
|
8 | + * @ author Event Espresso |
|
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 | + * EEH_Class_Tools Helper |
|
17 | + * |
|
18 | + * @package Event Espresso |
|
19 | + * @subpackage /helpers/ |
|
20 | + * @author Brent Christensen |
|
21 | + * |
|
22 | + * ------------------------------------------------------------------------ |
|
23 | + */ |
|
24 | 24 | class EEH_Class_Tools { |
25 | 25 | |
26 | 26 | static $i = 0; |
@@ -35,35 +35,35 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public static function get_called_class() { |
37 | 37 | $backtrace = debug_backtrace(); |
38 | - if ( isset( $backtrace[2] ) && is_array( $backtrace[2] ) && isset( $backtrace[2]['class'] ) && ! isset( $backtrace[2]['file'] )) { |
|
38 | + if (isset($backtrace[2]) && is_array($backtrace[2]) && isset($backtrace[2]['class']) && ! isset($backtrace[2]['file'])) { |
|
39 | 39 | return $backtrace[2]['class']; |
40 | - } else if ( isset( $backtrace[3] ) && is_array( $backtrace[3] ) && isset( $backtrace[3]['class'] ) && ! isset( $backtrace[3]['file'] )) { |
|
40 | + } else if (isset($backtrace[3]) && is_array($backtrace[3]) && isset($backtrace[3]['class']) && ! isset($backtrace[3]['file'])) { |
|
41 | 41 | return $backtrace[3]['class']; |
42 | - } else if ( isset( $backtrace[2] ) && is_array( $backtrace[2] ) && isset( $backtrace[2]['file'] ) && isset( $backtrace[2]['line'] )) { |
|
43 | - if ( self::$file_line == $backtrace[2]['file'] . $backtrace[2]['line'] ) { |
|
42 | + } else if (isset($backtrace[2]) && is_array($backtrace[2]) && isset($backtrace[2]['file']) && isset($backtrace[2]['line'])) { |
|
43 | + if (self::$file_line == $backtrace[2]['file'].$backtrace[2]['line']) { |
|
44 | 44 | self::$i++; |
45 | 45 | } else { |
46 | 46 | self::$i = 0; |
47 | - self::$file_line = $backtrace[2]['file'] . $backtrace[2]['line']; |
|
47 | + self::$file_line = $backtrace[2]['file'].$backtrace[2]['line']; |
|
48 | 48 | } |
49 | 49 | // was class method called via call_user_func ? |
50 | - if ( $backtrace[2]['function'] == 'call_user_func' && isset( $backtrace[2]['args'] ) && is_array( $backtrace[2]['args'] )){ |
|
51 | - if ( isset( $backtrace[2]['args'][0] ) && isset( $backtrace[2]['args'][0][0] )) { |
|
50 | + if ($backtrace[2]['function'] == 'call_user_func' && isset($backtrace[2]['args']) && is_array($backtrace[2]['args'])) { |
|
51 | + if (isset($backtrace[2]['args'][0]) && isset($backtrace[2]['args'][0][0])) { |
|
52 | 52 | $called_class = $backtrace[2]['args'][0][0]; |
53 | 53 | // is it an EE function ? |
54 | - if ( strpos( $called_class, 'EE' ) === 0 ) { |
|
55 | - $prefix_chars = strpos( $called_class, '_' ) + 1; |
|
56 | - $prefix = substr( $called_class, 0, $prefix_chars ); |
|
57 | - $classname = substr( $called_class, $prefix_chars, strlen( $called_class )); |
|
58 | - $classname = $prefix . str_replace( ' ', '_', ucwords( strtolower( str_replace( '_', ' ', $classname )))); |
|
54 | + if (strpos($called_class, 'EE') === 0) { |
|
55 | + $prefix_chars = strpos($called_class, '_') + 1; |
|
56 | + $prefix = substr($called_class, 0, $prefix_chars); |
|
57 | + $classname = substr($called_class, $prefix_chars, strlen($called_class)); |
|
58 | + $classname = $prefix.str_replace(' ', '_', ucwords(strtolower(str_replace('_', ' ', $classname)))); |
|
59 | 59 | return $classname; |
60 | 60 | } |
61 | 61 | } |
62 | 62 | } else { |
63 | - $lines = file( $backtrace[2]['file'] ); |
|
64 | - preg_match_all( '/([a-zA-Z0-9\_]+)::' . $backtrace[2]['function'] . '/', $lines[$backtrace[2]['line']-1], $matches ); |
|
65 | - if ( isset( $matches[1] ) && isset( $matches[1][ self::$i ] )) { |
|
66 | - return $matches[1][ self::$i ]; |
|
63 | + $lines = file($backtrace[2]['file']); |
|
64 | + preg_match_all('/([a-zA-Z0-9\_]+)::'.$backtrace[2]['function'].'/', $lines[$backtrace[2]['line'] - 1], $matches); |
|
65 | + if (isset($matches[1]) && isset($matches[1][self::$i])) { |
|
66 | + return $matches[1][self::$i]; |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | } |
@@ -80,22 +80,22 @@ discard block |
||
80 | 80 | * @param string $hook |
81 | 81 | * @return array |
82 | 82 | */ |
83 | - public static function get_class_names_for_all_callbacks_on_hook( $hook = NULL ) { |
|
83 | + public static function get_class_names_for_all_callbacks_on_hook($hook = NULL) { |
|
84 | 84 | global $wp_filter; |
85 | 85 | $class_names = array(); |
86 | 86 | // are any callbacks registered for this hook ? |
87 | - if ( isset( $wp_filter[ $hook ] )) { |
|
87 | + if (isset($wp_filter[$hook])) { |
|
88 | 88 | // loop thru all of the callbacks attached to the deprecated hookpoint |
89 | - foreach( $wp_filter[ $hook ] as $priority ) { |
|
90 | - foreach( $priority as $callback ) { |
|
89 | + foreach ($wp_filter[$hook] as $priority) { |
|
90 | + foreach ($priority as $callback) { |
|
91 | 91 | // is the callback a non-static class method ? |
92 | - if ( isset( $callback['function'] ) && is_array( $callback['function'] )) { |
|
93 | - if ( isset( $callback['function'][0] ) && is_object( $callback['function'][0] )) { |
|
94 | - $class_names[] = get_class( $callback['function'][0] ); |
|
92 | + if (isset($callback['function']) && is_array($callback['function'])) { |
|
93 | + if (isset($callback['function'][0]) && is_object($callback['function'][0])) { |
|
94 | + $class_names[] = get_class($callback['function'][0]); |
|
95 | 95 | } |
96 | 96 | // test for static method |
97 | - } else if ( strpos( $callback['function'], '::' ) !== FALSE ) { |
|
98 | - $class = explode( '::', $callback['function'] ); |
|
97 | + } else if (strpos($callback['function'], '::') !== FALSE) { |
|
98 | + $class = explode('::', $callback['function']); |
|
99 | 99 | $class_names[] = $class[0]; |
100 | 100 | } else { |
101 | 101 | // just a function |
@@ -116,24 +116,24 @@ discard block |
||
116 | 116 | * @param string $property |
117 | 117 | * @return boolean |
118 | 118 | */ |
119 | - public static function has_property( $class = NULL, $property = NULL ) { |
|
119 | + public static function has_property($class = NULL, $property = NULL) { |
|
120 | 120 | // if $class or $property don't exist, then get out, cuz that would be like... fatal dude |
121 | - if ( empty( $class ) || empty( $property )) { |
|
121 | + if (empty($class) || empty($property)) { |
|
122 | 122 | return FALSE; |
123 | 123 | } |
124 | 124 | // if your hosting company doesn't cut the mustard |
125 | - if ( version_compare( PHP_VERSION, '5.3.0' ) < 0 ) { |
|
125 | + if (version_compare(PHP_VERSION, '5.3.0') < 0) { |
|
126 | 126 | // just in case $class is an actual instantiated object |
127 | - if ( is_object( $class )) { |
|
128 | - return isset( $class->{$property} ) ? TRUE : FALSE; |
|
127 | + if (is_object($class)) { |
|
128 | + return isset($class->{$property} ) ? TRUE : FALSE; |
|
129 | 129 | } else { |
130 | 130 | // use reflection for < PHP 5.3 to get details using just the class name |
131 | - $reflector = new ReflectionClass( $class ); |
|
132 | - return $reflector->hasProperty( $property ); |
|
131 | + $reflector = new ReflectionClass($class); |
|
132 | + return $reflector->hasProperty($property); |
|
133 | 133 | } |
134 | 134 | } else { |
135 | 135 | // or try regular property exists method which works as expected in PHP 5.3+ |
136 | - return property_exists( $class, $property ); |
|
136 | + return property_exists($class, $property); |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | |
144 | 144 | |
145 | 145 | // if PHP version < 5.3 |
146 | -if ( ! function_exists( 'get_called_class' )) { |
|
146 | +if ( ! function_exists('get_called_class')) { |
|
147 | 147 | /** |
148 | 148 | * @return bool|string |
149 | 149 | */ |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | */ |
37 | 37 | protected $_price_types = array(); |
38 | 38 | |
39 | - public function __construct( $admin_page ) { |
|
39 | + public function __construct($admin_page) { |
|
40 | 40 | parent::__construct($admin_page); |
41 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
41 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
42 | 42 | $this->_PRT = EEM_Price_Type::instance(); |
43 | 43 | $this->_price_types = $this->_PRT->get_all_deleted_and_undeleted(); |
44 | 44 | } |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | |
49 | 49 | protected function _setup_data() { |
50 | 50 | $trashed = $this->_admin_page->get_view() == 'trashed' ? true : false; |
51 | - $this->_data = $this->_admin_page->get_prices_overview_data( $this->_per_page, false, $trashed ); |
|
52 | - $this->_all_data_count = $this->_admin_page->get_prices_overview_data( $this->_per_page, true, false ); |
|
53 | - $this->_trashed_count = $this->_admin_page->get_prices_overview_data( $this->_per_page, true, true ); |
|
51 | + $this->_data = $this->_admin_page->get_prices_overview_data($this->_per_page, false, $trashed); |
|
52 | + $this->_all_data_count = $this->_admin_page->get_prices_overview_data($this->_per_page, true, false); |
|
53 | + $this->_trashed_count = $this->_admin_page->get_prices_overview_data($this->_per_page, true, true); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | |
75 | 75 | $this->_sortable_columns = array( |
76 | 76 | // true means its already sorted |
77 | - 'name' => array( 'name' => false ), |
|
78 | - 'type' => array( 'type' => false ), |
|
79 | - 'amount' => array( 'amount' => false ) |
|
77 | + 'name' => array('name' => false), |
|
78 | + 'type' => array('type' => false), |
|
79 | + 'amount' => array('amount' => false) |
|
80 | 80 | ); |
81 | 81 | |
82 | 82 | $this->_hidden_columns = array( |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | protected function _add_view_counts() { |
100 | 100 | $this->_views['all']['count'] = $this->_all_data_count; |
101 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_prices', 'pricing_trash_price') ) { |
|
101 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_prices', 'pricing_trash_price')) { |
|
102 | 102 | $this->_views['trashed']['count'] = $this->_trashed_count; |
103 | 103 | } |
104 | 104 | } |
@@ -112,16 +112,16 @@ discard block |
||
112 | 112 | * @param object $item the current item |
113 | 113 | * @return string |
114 | 114 | */ |
115 | - protected function _get_row_class( $item ) { |
|
115 | + protected function _get_row_class($item) { |
|
116 | 116 | static $row_class = ''; |
117 | - $row_class = ( $row_class == '' ? 'alternate' : '' ); |
|
117 | + $row_class = ($row_class == '' ? 'alternate' : ''); |
|
118 | 118 | |
119 | 119 | $new_row = $row_class; |
120 | 120 | |
121 | - if ( $item->type_obj()->base_type() !== 1 && $item->type_obj()->base_type() !== 4 ) |
|
121 | + if ($item->type_obj()->base_type() !== 1 && $item->type_obj()->base_type() !== 4) |
|
122 | 122 | $new_row .= ' rowsortable'; |
123 | 123 | |
124 | - return ' class="' . $new_row . '"'; |
|
124 | + return ' class="'.$new_row.'"'; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | |
132 | 132 | |
133 | 133 | function column_cb($item) { |
134 | - if ( $item->type_obj()->base_type() !== 1 ) |
|
135 | - return sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', /* $1%s */ $item->ID() ); |
|
134 | + if ($item->type_obj()->base_type() !== 1) |
|
135 | + return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', /* $1%s */ $item->ID()); |
|
136 | 136 | return ''; |
137 | 137 | } |
138 | 138 | |
@@ -145,31 +145,31 @@ discard block |
||
145 | 145 | //Build row actions |
146 | 146 | $actions = array(); |
147 | 147 | // edit price link |
148 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_default_price', 'pricing_edit_price', $item->ID() ) ) { |
|
149 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_price', 'id'=>$item->ID() ), PRICING_ADMIN_URL ); |
|
150 | - $actions['edit'] = '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Price', 'event_espresso' ) . '">' . __( 'Edit', 'event_espresso' ) . '</a>'; |
|
148 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_default_price', 'pricing_edit_price', $item->ID())) { |
|
149 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_price', 'id'=>$item->ID()), PRICING_ADMIN_URL); |
|
150 | + $actions['edit'] = '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Price', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>'; |
|
151 | 151 | } |
152 | 152 | |
153 | - $name_link = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_default_price', 'edit_price', $item->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Price', 'event_espresso' ) . '">' . stripslashes( $item->name() ) . '</a>' : $item->name(); |
|
153 | + $name_link = EE_Registry::instance()->CAP->current_user_can('ee_edit_default_price', 'edit_price', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Price', 'event_espresso').'">'.stripslashes($item->name()).'</a>' : $item->name(); |
|
154 | 154 | |
155 | - if ( $item->type_obj()->base_type() !== 1 ) { |
|
155 | + if ($item->type_obj()->base_type() !== 1) { |
|
156 | 156 | if ($this->_view == 'all') { |
157 | 157 | // trash price link |
158 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price', 'pricing_trash_price', $item->ID() ) ) { |
|
159 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_price', 'id'=>$item->ID(), 'noheader' => true ), PRICING_ADMIN_URL ); |
|
160 | - $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Move Price to Trash', 'event_espresso' ) . '">' . __( 'Move to Trash', 'event_espresso' ) . '</a>'; |
|
158 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price', 'pricing_trash_price', $item->ID())) { |
|
159 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_price', 'id'=>$item->ID(), 'noheader' => true), PRICING_ADMIN_URL); |
|
160 | + $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Move Price to Trash', 'event_espresso').'">'.__('Move to Trash', 'event_espresso').'</a>'; |
|
161 | 161 | } |
162 | 162 | } else { |
163 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price', 'pricing_restore_price', $item->ID() ) ) { |
|
163 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price', 'pricing_restore_price', $item->ID())) { |
|
164 | 164 | // restore price link |
165 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_price', 'id'=>$item->ID(), 'noheader' => true ), PRICING_ADMIN_URL ); |
|
166 | - $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Price', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>'; |
|
165 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_price', 'id'=>$item->ID(), 'noheader' => true), PRICING_ADMIN_URL); |
|
166 | + $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Price', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>'; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | // delete price link |
170 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price', 'pricing_delete_price', $item->ID() ) ) { |
|
171 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_price', 'id'=>$item->ID(), 'noheader' => true ), PRICING_ADMIN_URL ); |
|
172 | - $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Price Permanently', 'event_espresso' ) . '">' . __( 'Delete Permanently', 'event_espresso' ) . '</a>'; |
|
170 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price', 'pricing_delete_price', $item->ID())) { |
|
171 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_price', 'id'=>$item->ID(), 'noheader' => true), PRICING_ADMIN_URL); |
|
172 | + $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Price Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>'; |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | return sprintf('%1$s <span style="color:silver">(id:%2$s)</span>%3$s', |
179 | 179 | /* $1%s */ $name_link, |
180 | 180 | /* $2%s */ $item->ID(), |
181 | - /* $3%s */ $this->row_actions( $actions ) |
|
181 | + /* $3%s */ $this->row_actions($actions) |
|
182 | 182 | ); |
183 | 183 | } |
184 | 184 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | |
196 | 196 | |
197 | 197 | function column_description($item) { |
198 | - return stripslashes( $item->desc() ); |
|
198 | + return stripslashes($item->desc()); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | |
@@ -204,9 +204,9 @@ discard block |
||
204 | 204 | |
205 | 205 | function column_amount($item) { |
206 | 206 | if ($this->_price_types[$item->type()]->is_percent()) { |
207 | - return '<div class="pad-amnt-rght">' . number_format($item->amount(), 1) . '%</div>'; |
|
207 | + return '<div class="pad-amnt-rght">'.number_format($item->amount(), 1).'%</div>'; |
|
208 | 208 | } else { |
209 | - return '<div class="pad-amnt-rght">' . EEH_Template::format_currency( $item->amount() ) . '</div>'; |
|
209 | + return '<div class="pad-amnt-rght">'.EEH_Template::format_currency($item->amount()).'</div>'; |
|
210 | 210 | } |
211 | 211 | } |
212 | 212 |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | * @param bool $routing |
32 | 32 | * @return Pricing_Admin_Page |
33 | 33 | */ |
34 | - public function __construct( $routing = TRUE ) { |
|
35 | - parent::__construct( $routing ); |
|
34 | + public function __construct($routing = TRUE) { |
|
35 | + parent::__construct($routing); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | protected function _ajax_hooks() { |
52 | - add_action('wp_ajax_espresso_update_prices_order', array( $this, 'update_price_order' )); |
|
52 | + add_action('wp_ajax_espresso_update_prices_order', array($this, 'update_price_order')); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | * @return void |
83 | 83 | */ |
84 | 84 | protected function _set_page_routes() { |
85 | - $prc_id = ! empty( $this->_req_data['PRC_ID'] ) && ! is_array( $this->_req_data['PRC_ID'] ) ? $this->_req_data['PRC_ID'] : 0; |
|
86 | - $prt_id = ! empty( $this->_req_data['PRT_ID'] ) && ! is_array( $this->_req_data['PRT_ID'] ) ? $this->_req_data['PRT_ID'] : 0; |
|
85 | + $prc_id = ! empty($this->_req_data['PRC_ID']) && ! is_array($this->_req_data['PRC_ID']) ? $this->_req_data['PRC_ID'] : 0; |
|
86 | + $prt_id = ! empty($this->_req_data['PRT_ID']) && ! is_array($this->_req_data['PRT_ID']) ? $this->_req_data['PRT_ID'] : 0; |
|
87 | 87 | $this->_page_routes = array( |
88 | 88 | 'default' => array( |
89 | 89 | 'func' => '_price_overview_list_table', |
@@ -91,38 +91,38 @@ discard block |
||
91 | 91 | ), |
92 | 92 | 'add_new_price' => array( |
93 | 93 | 'func' => '_edit_price_details', |
94 | - 'args' => array( 'new_price' => TRUE ), |
|
94 | + 'args' => array('new_price' => TRUE), |
|
95 | 95 | 'capability' => 'ee_edit_default_prices' |
96 | 96 | ), |
97 | 97 | 'edit_price' => array( |
98 | 98 | 'func' => '_edit_price_details', |
99 | - 'args' => array( 'new_price' => FALSE ), |
|
99 | + 'args' => array('new_price' => FALSE), |
|
100 | 100 | 'capability' => 'ee_edit_default_price', |
101 | 101 | 'obj_id' => $prc_id |
102 | 102 | ), |
103 | 103 | 'insert_price' => array( |
104 | 104 | 'func' => '_insert_or_update_price', |
105 | - 'args' => array( 'new_price' => TRUE ), |
|
105 | + 'args' => array('new_price' => TRUE), |
|
106 | 106 | 'noheader' => TRUE, |
107 | 107 | 'capability' => 'ee_edit_default_prices', |
108 | 108 | ), |
109 | 109 | 'update_price' => array( |
110 | 110 | 'func' => '_insert_or_update_price', |
111 | - 'args' => array( 'new_price' => FALSE ), |
|
111 | + 'args' => array('new_price' => FALSE), |
|
112 | 112 | 'noheader' => TRUE, |
113 | 113 | 'capability' => 'ee_edit_default_price', |
114 | 114 | 'obj_id' => $prc_id |
115 | 115 | ), |
116 | 116 | 'trash_price' => array( |
117 | 117 | 'func' => '_trash_or_restore_price', |
118 | - 'args' => array( 'trash' => TRUE ), |
|
118 | + 'args' => array('trash' => TRUE), |
|
119 | 119 | 'noheader' => TRUE, |
120 | 120 | 'capability' => 'ee_delete_default_price', |
121 | 121 | 'obj_id' => $prc_id |
122 | 122 | ), |
123 | 123 | 'restore_price' => array( |
124 | 124 | 'func' => '_trash_or_restore_price', |
125 | - 'args' => array( 'trash' => FALSE ), |
|
125 | + 'args' => array('trash' => FALSE), |
|
126 | 126 | 'noheader' => TRUE, |
127 | 127 | 'capability' => 'ee_delete_default_price', |
128 | 128 | 'obj_id' => $prc_id |
@@ -154,27 +154,27 @@ discard block |
||
154 | 154 | ), |
155 | 155 | 'insert_price_type' => array( |
156 | 156 | 'func' => '_insert_or_update_price_type', |
157 | - 'args' => array( 'new_price_type' => TRUE ), |
|
157 | + 'args' => array('new_price_type' => TRUE), |
|
158 | 158 | 'noheader' => TRUE, |
159 | 159 | 'capability' => 'ee_edit_default_price_types' |
160 | 160 | ), |
161 | 161 | 'update_price_type' => array( |
162 | 162 | 'func' => '_insert_or_update_price_type', |
163 | - 'args' => array( 'new_price_type' => FALSE ), |
|
163 | + 'args' => array('new_price_type' => FALSE), |
|
164 | 164 | 'noheader' => TRUE, |
165 | 165 | 'capability' => 'ee_edit_default_price_type', |
166 | 166 | 'obj_id' => $prt_id |
167 | 167 | ), |
168 | 168 | 'trash_price_type' => array( |
169 | 169 | 'func' => '_trash_or_restore_price_type', |
170 | - 'args' => array( 'trash' => TRUE ), |
|
170 | + 'args' => array('trash' => TRUE), |
|
171 | 171 | 'noheader' => TRUE, |
172 | 172 | 'capability' => 'ee_delete_default_price_type', |
173 | 173 | 'obj_id' => $prt_id |
174 | 174 | ), |
175 | 175 | 'restore_price_type' => array( |
176 | 176 | 'func' => '_trash_or_restore_price_type', |
177 | - 'args' => array( 'trash' => FALSE ), |
|
177 | + 'args' => array('trash' => FALSE), |
|
178 | 178 | 'noheader' => TRUE, |
179 | 179 | 'capability' => 'ee_delete_default_price_type', |
180 | 180 | 'obj_id' => $prt_id |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | 'filename' => 'pricing_default_pricing_views_bulk_actions_search' |
215 | 215 | ) |
216 | 216 | ), |
217 | - 'help_tour' => array( 'Pricing_Default_Prices_Help_Tour'), |
|
217 | + 'help_tour' => array('Pricing_Default_Prices_Help_Tour'), |
|
218 | 218 | 'require_nonce' => FALSE |
219 | 219 | ), |
220 | 220 | 'add_new_price' => array( |
@@ -230,24 +230,24 @@ discard block |
||
230 | 230 | ) |
231 | 231 | ), |
232 | 232 | 'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'), |
233 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
|
233 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'), |
|
234 | 234 | 'require_nonce' => FALSE |
235 | 235 | ), |
236 | 236 | 'edit_price' => array( |
237 | 237 | 'nav' => array( |
238 | 238 | 'label' => __('Edit Default Price', 'event_espresso'), |
239 | 239 | 'order' => 20, |
240 | - 'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
|
240 | + 'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id']), $this->_current_page_view_url) : $this->_admin_base_url, |
|
241 | 241 | 'persistent' => FALSE |
242 | 242 | ), |
243 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
|
243 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'), |
|
244 | 244 | 'help_tabs' => array( |
245 | 245 | 'edit_default_price_help_tab' => array( |
246 | 246 | 'title' => __('Edit Default Price', 'event_espresso'), |
247 | 247 | 'filename' => 'pricing_edit_default_price' |
248 | 248 | ) |
249 | 249 | ), |
250 | - 'help_tour' => array( 'Pricing_Edit_Default_Price_Help_Tour' ), |
|
250 | + 'help_tour' => array('Pricing_Edit_Default_Price_Help_Tour'), |
|
251 | 251 | 'require_nonce' => FALSE |
252 | 252 | ), |
253 | 253 | 'price_types' => array( |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | 'filename' => 'pricing_price_types_views_bulk_actions_search' |
271 | 271 | ), |
272 | 272 | ), |
273 | - 'help_tour' => array( 'Pricing_Price_Types_Default_Help_Tour' ), |
|
273 | + 'help_tour' => array('Pricing_Price_Types_Default_Help_Tour'), |
|
274 | 274 | 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'), |
275 | 275 | 'require_nonce' => FALSE |
276 | 276 | ), |
@@ -286,8 +286,8 @@ discard block |
||
286 | 286 | 'filename' => 'pricing_add_new_price_type' |
287 | 287 | ) |
288 | 288 | ), |
289 | - 'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ), |
|
290 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
|
289 | + 'help_tour' => array('Pricing_Add_New_Price_Type_Help_Tour'), |
|
290 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'), |
|
291 | 291 | 'require_nonce' => FALSE |
292 | 292 | ), |
293 | 293 | 'edit_price_type' => array( |
@@ -302,8 +302,8 @@ discard block |
||
302 | 302 | 'filename' => 'pricing_edit_price_type' |
303 | 303 | ) |
304 | 304 | ), |
305 | - 'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ), |
|
306 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
|
305 | + 'help_tour' => array('Pricing_Edit_Price_Type_Help_Tour'), |
|
306 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'), |
|
307 | 307 | |
308 | 308 | 'require_nonce' => FALSE |
309 | 309 | ) |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | public function load_scripts_styles() { |
341 | 341 | //styles |
342 | 342 | wp_enqueue_style('espresso-ui-theme'); |
343 | - wp_register_style( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
343 | + wp_register_style('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
344 | 344 | wp_enqueue_style('espresso_PRICING'); |
345 | 345 | |
346 | 346 | //scripts |
@@ -350,8 +350,8 @@ discard block |
||
350 | 350 | //wp_enqueue_script('jquery-ui-dialog'); |
351 | 351 | //wp_enqueue_script('jquery-ui-draggable'); |
352 | 352 | //wp_enqueue_script('jquery-ui-datepicker'); |
353 | - wp_register_script( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
354 | - wp_enqueue_script( 'espresso_PRICING' ); |
|
353 | + wp_register_script('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
354 | + wp_enqueue_script('espresso_PRICING'); |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | |
360 | 360 | |
361 | 361 | public function load_scripts_styles_default() { |
362 | - wp_enqueue_script( 'espresso_ajax_table_sorting' ); |
|
362 | + wp_enqueue_script('espresso_ajax_table_sorting'); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | ) |
388 | 388 | ); |
389 | 389 | |
390 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_prices', 'pricing_trash_price' ) ) { |
|
390 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_prices', 'pricing_trash_price')) { |
|
391 | 391 | $this->_views['trashed'] = array( |
392 | 392 | 'slug' => 'trashed', |
393 | 393 | 'label' => __('Trash', 'event_espresso'), |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | ) |
418 | 418 | ); |
419 | 419 | |
420 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price_types', 'pricing_trash_price_type' ) ) { |
|
420 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price_types', 'pricing_trash_price_type')) { |
|
421 | 421 | $this->_views['trashed'] = array( |
422 | 422 | 'slug' => 'trashed', |
423 | 423 | 'label' => __('Trash', 'event_espresso'), |
@@ -456,18 +456,18 @@ discard block |
||
456 | 456 | * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
457 | 457 | * @return mixed (int|array) int = count || array of price objects |
458 | 458 | */ |
459 | - public function get_prices_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
459 | + public function get_prices_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
460 | 460 | |
461 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
461 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
462 | 462 | // start with an empty array |
463 | 463 | $event_pricing = array(); |
464 | 464 | |
465 | - require_once( PRICING_ADMIN . 'Prices_List_Table.class.php' ); |
|
466 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
465 | + require_once(PRICING_ADMIN.'Prices_List_Table.class.php'); |
|
466 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
467 | 467 | //$PRC = EEM_Price::instance(); |
468 | 468 | |
469 | 469 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby']; |
470 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
470 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
471 | 471 | |
472 | 472 | switch ($this->_req_data['orderby']) { |
473 | 473 | case 'name': |
@@ -480,27 +480,27 @@ discard block |
||
480 | 480 | $orderby = array('PRC_amount'=>$order); |
481 | 481 | break; |
482 | 482 | default: |
483 | - $orderby = array( 'PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order); |
|
483 | + $orderby = array('PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order); |
|
484 | 484 | } |
485 | 485 | |
486 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
487 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
486 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
487 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
488 | 488 | |
489 | 489 | $_where = array( |
490 | 490 | 'PRC_is_default' => 1, |
491 | 491 | 'PRC_deleted' => $trashed |
492 | 492 | ); |
493 | 493 | |
494 | - $offset = ($current_page-1)*$per_page; |
|
495 | - $limit = array( $offset, $per_page ); |
|
494 | + $offset = ($current_page - 1) * $per_page; |
|
495 | + $limit = array($offset, $per_page); |
|
496 | 496 | |
497 | - if ( isset( $this->_req_data['s'] ) ) { |
|
498 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
497 | + if (isset($this->_req_data['s'])) { |
|
498 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
499 | 499 | $_where['OR'] = array( |
500 | - 'PRC_name' => array('LIKE',$sstr ), |
|
501 | - 'PRC_desc' => array('LIKE',$sstr ), |
|
502 | - 'PRC_amount' => array( 'LIKE',$sstr ), |
|
503 | - 'Price_Type.PRT_name' => array( 'LIKE', $sstr ) |
|
500 | + 'PRC_name' => array('LIKE', $sstr), |
|
501 | + 'PRC_desc' => array('LIKE', $sstr), |
|
502 | + 'PRC_amount' => array('LIKE', $sstr), |
|
503 | + 'Price_Type.PRT_name' => array('LIKE', $sstr) |
|
504 | 504 | ); |
505 | 505 | } |
506 | 506 | |
@@ -511,9 +511,9 @@ discard block |
||
511 | 511 | 'group_by'=>'PRC_ID' |
512 | 512 | ); |
513 | 513 | |
514 | - if($count){ |
|
515 | - return $trashed ? EEM_Price::instance()->count( array( $_where ) ) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where)); |
|
516 | - }else{ |
|
514 | + if ($count) { |
|
515 | + return $trashed ? EEM_Price::instance()->count(array($_where)) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where)); |
|
516 | + } else { |
|
517 | 517 | return EEM_Price::instance()->get_all_deleted_and_undeleted($query_params); |
518 | 518 | } |
519 | 519 | } |
@@ -529,40 +529,40 @@ discard block |
||
529 | 529 | * @return void |
530 | 530 | */ |
531 | 531 | protected function _edit_price_details() { |
532 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
532 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
533 | 533 | // grab price ID |
534 | - $PRC_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE; |
|
534 | + $PRC_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE; |
|
535 | 535 | // change page title based on request action |
536 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
536 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
537 | 537 | // add PRC_ID to title if editing |
538 | - $this->_admin_page_title = $PRC_ID ? $this->_admin_page_title . ' # ' . $PRC_ID : $this->_admin_page_title; |
|
538 | + $this->_admin_page_title = $PRC_ID ? $this->_admin_page_title.' # '.$PRC_ID : $this->_admin_page_title; |
|
539 | 539 | |
540 | 540 | // get prices |
541 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
541 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
542 | 542 | $PRC = EEM_Price::instance(); |
543 | 543 | |
544 | - if ( $PRC_ID ) { |
|
545 | - $price = $PRC->get_one_by_ID( $PRC_ID ); |
|
544 | + if ($PRC_ID) { |
|
545 | + $price = $PRC->get_one_by_ID($PRC_ID); |
|
546 | 546 | $additional_hidden_fields = array( |
547 | - 'PRC_ID' => array( 'type' => 'hidden', 'value' => $PRC_ID ) |
|
547 | + 'PRC_ID' => array('type' => 'hidden', 'value' => $PRC_ID) |
|
548 | 548 | ); |
549 | - $this->_set_add_edit_form_tags( 'update_price', $additional_hidden_fields ); |
|
549 | + $this->_set_add_edit_form_tags('update_price', $additional_hidden_fields); |
|
550 | 550 | } else { |
551 | 551 | $price = $PRC->get_new_price(); |
552 | - $this->_set_add_edit_form_tags( 'insert_price' ); |
|
552 | + $this->_set_add_edit_form_tags('insert_price'); |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | $this->_template_args['PRC_ID'] = $PRC_ID; |
556 | 556 | $this->_template_args['price'] = $price; |
557 | 557 | |
558 | 558 | // get price types |
559 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
559 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
560 | 560 | $PRT = EEM_Price_Type::instance(); |
561 | - $price_types = $PRT->get_all( array( array('PBT_ID' => array('!=', 1 ) ) ) ); |
|
561 | + $price_types = $PRT->get_all(array(array('PBT_ID' => array('!=', 1)))); |
|
562 | 562 | $price_type_names = array(); |
563 | 563 | if (empty($price_types)) { |
564 | - $msg = __( 'You have no price types defined. Please add a price type before adding a price.', 'event_espresso' ); |
|
565 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
564 | + $msg = __('You have no price types defined. Please add a price type before adding a price.', 'event_espresso'); |
|
565 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
566 | 566 | exit(); |
567 | 567 | } else { |
568 | 568 | foreach ($price_types as $type) { |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | $this->_template_args['price_types'] = $price_type_names; |
576 | 576 | $this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link(); |
577 | 577 | |
578 | - $this->_set_publish_post_box_vars( 'id', $PRC_ID ); |
|
578 | + $this->_set_publish_post_box_vars('id', $PRC_ID); |
|
579 | 579 | // the details template wrapper |
580 | 580 | $this->display_admin_page_with_sidebar(); |
581 | 581 | } |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | * @return void |
592 | 592 | */ |
593 | 593 | protected function _price_details_meta_boxes() { |
594 | - add_meta_box( 'edit-price-details-mbox', __( 'Default Price Details', 'event_espresso' ), array( $this, '_edit_price_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
594 | + add_meta_box('edit-price-details-mbox', __('Default Price Details', 'event_espresso'), array($this, '_edit_price_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
595 | 595 | } |
596 | 596 | |
597 | 597 | |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | * @return void |
606 | 606 | */ |
607 | 607 | public function _edit_price_details_meta_box() { |
608 | - echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
608 | + echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE); |
|
609 | 609 | } |
610 | 610 | |
611 | 611 | |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | */ |
620 | 620 | protected function set_price_column_values() { |
621 | 621 | |
622 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
622 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
623 | 623 | |
624 | 624 | $set_column_values = array( |
625 | 625 | 'PRT_ID' => absint($this->_req_data['PRT_ID']), |
@@ -647,12 +647,12 @@ discard block |
||
647 | 647 | * @access protected |
648 | 648 | * @return void |
649 | 649 | */ |
650 | - protected function _insert_or_update_price( $insert = FALSE ) { |
|
650 | + protected function _insert_or_update_price($insert = FALSE) { |
|
651 | 651 | |
652 | 652 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
653 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
653 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
654 | 654 | |
655 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
655 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
656 | 656 | $PRC = EEM_Price::instance(); |
657 | 657 | |
658 | 658 | // why be so pessimistic ??? : ( |
@@ -660,14 +660,14 @@ discard block |
||
660 | 660 | |
661 | 661 | $set_column_values = $this->set_price_column_values(); |
662 | 662 | // is this a new Price ? |
663 | - if ( $insert ) { |
|
663 | + if ($insert) { |
|
664 | 664 | // run the insert |
665 | - if ( $PRC_ID = $PRC->insert( $set_column_values )) { |
|
665 | + if ($PRC_ID = $PRC->insert($set_column_values)) { |
|
666 | 666 | //make sure this new price modifier is attached to the ticket but ONLY if it is not a tax type |
667 | 667 | $PR = EEM_price::instance()->get_one_by_ID($PRC_ID); |
668 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
668 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
669 | 669 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
670 | - $ticket->_add_relation_to( $PR, 'Price' ); |
|
670 | + $ticket->_add_relation_to($PR, 'Price'); |
|
671 | 671 | $ticket->save(); |
672 | 672 | } |
673 | 673 | $success = 1; |
@@ -677,29 +677,29 @@ discard block |
||
677 | 677 | } |
678 | 678 | $action_desc = 'created'; |
679 | 679 | } else { |
680 | - $PRC_ID = absint( $this->_req_data['PRC_ID'] ); |
|
680 | + $PRC_ID = absint($this->_req_data['PRC_ID']); |
|
681 | 681 | // run the update |
682 | - $where_cols_n_values = array( 'PRC_ID' => $PRC_ID ); |
|
683 | - if ( $PRC->update( $set_column_values, array($where_cols_n_values))) { |
|
682 | + $where_cols_n_values = array('PRC_ID' => $PRC_ID); |
|
683 | + if ($PRC->update($set_column_values, array($where_cols_n_values))) { |
|
684 | 684 | $success = 1; |
685 | 685 | } |
686 | 686 | |
687 | 687 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
688 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
688 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
689 | 689 | |
690 | 690 | //if this is $PRC_ID == 1, then we need to update the default ticket attached to this price so the TKT_price value is updated. |
691 | - if ( $PRC_ID === 1 ) { |
|
691 | + if ($PRC_ID === 1) { |
|
692 | 692 | $ticket = $PR->get_first_related('Ticket'); |
693 | - if ( $ticket ) { |
|
694 | - $ticket->set('TKT_price', $PR->get('PRC_amount') ); |
|
695 | - $ticket->set('TKT_name', $PR->get('PRC_name') ); |
|
693 | + if ($ticket) { |
|
694 | + $ticket->set('TKT_price', $PR->get('PRC_amount')); |
|
695 | + $ticket->set('TKT_name', $PR->get('PRC_name')); |
|
696 | 696 | $ticket->set('TKT_description', $PR->get('PRC_desc')); |
697 | 697 | $ticket->save(); |
698 | 698 | } |
699 | 699 | } else { |
700 | 700 | //we make sure this price is attached to base ticket. but ONLY if its not a tax ticket type. |
701 | 701 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
702 | - $ticket->_add_relation_to( $PRC_ID, 'Price' ); |
|
702 | + $ticket->_add_relation_to($PRC_ID, 'Price'); |
|
703 | 703 | $ticket->save(); |
704 | 704 | } |
705 | 705 | } |
@@ -707,9 +707,9 @@ discard block |
||
707 | 707 | $action_desc = 'updated'; |
708 | 708 | } |
709 | 709 | |
710 | - $query_args = array( 'action' => 'edit_price', 'id' => $PRC_ID ); |
|
710 | + $query_args = array('action' => 'edit_price', 'id' => $PRC_ID); |
|
711 | 711 | |
712 | - $this->_redirect_after_action( $success, 'Prices', $action_desc, $query_args ); |
|
712 | + $this->_redirect_after_action($success, 'Prices', $action_desc, $query_args); |
|
713 | 713 | |
714 | 714 | } |
715 | 715 | |
@@ -723,12 +723,12 @@ discard block |
||
723 | 723 | * @access protected |
724 | 724 | * @return void |
725 | 725 | */ |
726 | - protected function _trash_or_restore_price( $trash = TRUE ) { |
|
726 | + protected function _trash_or_restore_price($trash = TRUE) { |
|
727 | 727 | |
728 | 728 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
729 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
729 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
730 | 730 | |
731 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
731 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
732 | 732 | $PRC = EEM_Price::instance(); |
733 | 733 | |
734 | 734 | $success = 1; |
@@ -737,18 +737,18 @@ discard block |
||
737 | 737 | //get base ticket for updating |
738 | 738 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
739 | 739 | //Checkboxes |
740 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
740 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
741 | 741 | // if array has more than one element than success message should be plural |
742 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
742 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
743 | 743 | // cycle thru checkboxes |
744 | - while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
745 | - if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID) ) ) { |
|
744 | + while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) { |
|
745 | + if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID))) { |
|
746 | 746 | $success = 0; |
747 | 747 | } else { |
748 | 748 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
749 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
749 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
750 | 750 | //if trashing then remove relations to base default ticket. If restoring then add back to base default ticket |
751 | - if ( $PRC_deleted ) { |
|
751 | + if ($PRC_deleted) { |
|
752 | 752 | $ticket->_remove_relation_to($PRC_ID, 'Price'); |
753 | 753 | } else { |
754 | 754 | $ticket->_add_relation_to($PRC_ID, 'Price'); |
@@ -760,14 +760,14 @@ discard block |
||
760 | 760 | |
761 | 761 | } else { |
762 | 762 | // grab single id and delete |
763 | - $PRC_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0; |
|
764 | - if ( empty( $PRC_ID ) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID) ) { |
|
763 | + $PRC_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0; |
|
764 | + if (empty($PRC_ID) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID)) { |
|
765 | 765 | $success = 0; |
766 | 766 | } else { |
767 | 767 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
768 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
768 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
769 | 769 | //if trashing then remove relations to base default ticket. If restoring then add back to base default ticket |
770 | - if ( $PRC_deleted ) { |
|
770 | + if ($PRC_deleted) { |
|
771 | 771 | $ticket->_remove_relation_to($PRC_ID, 'Price'); |
772 | 772 | } else { |
773 | 773 | $ticket->_add_relation_to($PRC_ID, 'Price'); |
@@ -781,17 +781,17 @@ discard block |
||
781 | 781 | 'action' => 'default' |
782 | 782 | ); |
783 | 783 | |
784 | - if ( $success ) { |
|
785 | - if ( $trash ) { |
|
784 | + if ($success) { |
|
785 | + if ($trash) { |
|
786 | 786 | $msg = $success == 2 ? __('The Prices have been trashed.', 'event_espresso') : __('The Price has been trashed.', 'event_espresso'); |
787 | 787 | } else { |
788 | 788 | $msg = $success == 2 ? __('The Prices have been restored.', 'event_espresso') : __('The Price has been restored.', 'event_espresso'); |
789 | 789 | } |
790 | 790 | |
791 | - EE_Error::add_success( $msg ); |
|
791 | + EE_Error::add_success($msg); |
|
792 | 792 | } |
793 | 793 | |
794 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
794 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
795 | 795 | |
796 | 796 | } |
797 | 797 | |
@@ -808,19 +808,19 @@ discard block |
||
808 | 808 | protected function _delete_price() { |
809 | 809 | |
810 | 810 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
811 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
811 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
812 | 812 | |
813 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
813 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
814 | 814 | $PRC = EEM_Price::instance(); |
815 | 815 | |
816 | 816 | $success = 1; |
817 | 817 | //Checkboxes |
818 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
818 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
819 | 819 | // if array has more than one element than success message should be plural |
820 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
820 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
821 | 821 | // cycle thru bulk action checkboxes |
822 | - while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
823 | - if (!$PRC->delete_permanently_by_ID(absint($PRC_ID))) { |
|
822 | + while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) { |
|
823 | + if ( ! $PRC->delete_permanently_by_ID(absint($PRC_ID))) { |
|
824 | 824 | $success = 0; |
825 | 825 | } |
826 | 826 | } |
@@ -834,7 +834,7 @@ discard block |
||
834 | 834 | |
835 | 835 | } |
836 | 836 | |
837 | - $this->_redirect_after_action( $success, 'Prices', 'deleted', array() ); |
|
837 | + $this->_redirect_after_action($success, 'Prices', 'deleted', array()); |
|
838 | 838 | |
839 | 839 | } |
840 | 840 | |
@@ -842,16 +842,16 @@ discard block |
||
842 | 842 | |
843 | 843 | |
844 | 844 | public function update_price_order() { |
845 | - $success = __( 'Price order was updated successfully.', 'event_espresso' ); |
|
845 | + $success = __('Price order was updated successfully.', 'event_espresso'); |
|
846 | 846 | |
847 | 847 | // grab our row IDs |
848 | - $row_ids = isset( $this->_req_data['row_ids'] ) && ! empty( $this->_req_data['row_ids'] ) ? explode( ',', rtrim( $this->_req_data['row_ids'], ',' )) : FALSE; |
|
848 | + $row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids']) ? explode(',', rtrim($this->_req_data['row_ids'], ',')) : FALSE; |
|
849 | 849 | |
850 | - if ( is_array( $row_ids )) { |
|
851 | - for ( $i = 0; $i < count( $row_ids ); $i++ ) { |
|
850 | + if (is_array($row_ids)) { |
|
851 | + for ($i = 0; $i < count($row_ids); $i++) { |
|
852 | 852 | //Update the prices when re-ordering |
853 | 853 | $id = absint($row_ids[$i]); |
854 | - if ( EEM_Price::instance()->update ( array( 'PRC_order' => $i+1 ), array(array( 'PRC_ID' => $id ) )) === FALSE ) { |
|
854 | + if (EEM_Price::instance()->update(array('PRC_order' => $i + 1), array(array('PRC_ID' => $id))) === FALSE) { |
|
855 | 855 | $success = FALSE; |
856 | 856 | } |
857 | 857 | } |
@@ -859,9 +859,9 @@ discard block |
||
859 | 859 | $success = FALSE; |
860 | 860 | } |
861 | 861 | |
862 | - $errors = ! $success ? __( 'An error occurred. The price order was not updated.', 'event_espresso' ) : FALSE; |
|
862 | + $errors = ! $success ? __('An error occurred. The price order was not updated.', 'event_espresso') : FALSE; |
|
863 | 863 | |
864 | - echo json_encode( array( 'return_data' => FALSE, 'success' => $success, 'errors' => $errors )); |
|
864 | + echo json_encode(array('return_data' => FALSE, 'success' => $success, 'errors' => $errors)); |
|
865 | 865 | die(); |
866 | 866 | } |
867 | 867 | |
@@ -904,46 +904,46 @@ discard block |
||
904 | 904 | * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
905 | 905 | * @return mixed (int|array) int = count || array of price objects |
906 | 906 | */ |
907 | - public function get_price_types_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
907 | + public function get_price_types_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
908 | 908 | |
909 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
909 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
910 | 910 | // start with an empty array |
911 | 911 | |
912 | - require_once( PRICING_ADMIN . 'Price_Types_List_Table.class.php' ); |
|
913 | - require_once( EE_MODELS . 'EEM_Price_Type.model.php' ); |
|
912 | + require_once(PRICING_ADMIN.'Price_Types_List_Table.class.php'); |
|
913 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
914 | 914 | |
915 | 915 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby']; |
916 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
916 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
917 | 917 | switch ($this->_req_data['orderby']) { |
918 | 918 | case 'name': |
919 | - $orderby = array( 'PRT_name' => $order); |
|
919 | + $orderby = array('PRT_name' => $order); |
|
920 | 920 | break; |
921 | 921 | default: |
922 | - $orderby = array( 'PRT_order' => $order); |
|
922 | + $orderby = array('PRT_order' => $order); |
|
923 | 923 | } |
924 | 924 | |
925 | 925 | |
926 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
927 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
926 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
927 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
928 | 928 | |
929 | - $offset = ($current_page-1)*$per_page; |
|
930 | - $limit = array( $offset, $per_page ); |
|
929 | + $offset = ($current_page - 1) * $per_page; |
|
930 | + $limit = array($offset, $per_page); |
|
931 | 931 | |
932 | - $_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1 ) ); |
|
932 | + $_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1)); |
|
933 | 933 | |
934 | - if ( isset( $this->_req_data['s'] ) ) { |
|
935 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
934 | + if (isset($this->_req_data['s'])) { |
|
935 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
936 | 936 | $_where['OR'] = array( |
937 | - 'PRT_name' => array( 'LIKE', $sstr ) |
|
937 | + 'PRT_name' => array('LIKE', $sstr) |
|
938 | 938 | ); |
939 | 939 | } |
940 | 940 | $query_params = array( |
941 | 941 | $_where, |
942 | 942 | 'order_by'=>$orderby, |
943 | 943 | 'limit'=>$limit); |
944 | - if($count){ |
|
944 | + if ($count) { |
|
945 | 945 | return EEM_Price_Type::instance()->count_deleted_and_undeleted($query_params); |
946 | - }else{ |
|
946 | + } else { |
|
947 | 947 | return EEM_Price_Type::instance()->get_all_deleted_and_undeleted($query_params); |
948 | 948 | } |
949 | 949 | |
@@ -963,25 +963,25 @@ discard block |
||
963 | 963 | */ |
964 | 964 | protected function _edit_price_type_details() { |
965 | 965 | |
966 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
966 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
967 | 967 | |
968 | 968 | |
969 | 969 | // grab price type ID |
970 | - $PRT_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE; |
|
970 | + $PRT_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE; |
|
971 | 971 | // change page title based on request action |
972 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
972 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
973 | 973 | // add PRT_ID to title if editing |
974 | - $this->_admin_page_title = $PRT_ID ? $this->_admin_page_title . ' # ' . $PRT_ID : $this->_admin_page_title; |
|
974 | + $this->_admin_page_title = $PRT_ID ? $this->_admin_page_title.' # '.$PRT_ID : $this->_admin_page_title; |
|
975 | 975 | |
976 | 976 | // require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
977 | 977 | |
978 | - if ( $PRT_ID ) { |
|
979 | - $price_type = EEM_Price_Type::instance()->get_one_by_ID( $PRT_ID ); |
|
980 | - $additional_hidden_fields = array( 'PRT_ID' => array( 'type' => 'hidden', 'value' => $PRT_ID )); |
|
981 | - $this->_set_add_edit_form_tags( 'update_price_type', $additional_hidden_fields ); |
|
978 | + if ($PRT_ID) { |
|
979 | + $price_type = EEM_Price_Type::instance()->get_one_by_ID($PRT_ID); |
|
980 | + $additional_hidden_fields = array('PRT_ID' => array('type' => 'hidden', 'value' => $PRT_ID)); |
|
981 | + $this->_set_add_edit_form_tags('update_price_type', $additional_hidden_fields); |
|
982 | 982 | } else { |
983 | 983 | $price_type = EEM_Price_Type::instance()->get_new_price_type(); |
984 | - $this->_set_add_edit_form_tags( 'insert_price_type' ); |
|
984 | + $this->_set_add_edit_form_tags('insert_price_type'); |
|
985 | 985 | } |
986 | 986 | |
987 | 987 | $this->_template_args['PRT_ID'] = $PRT_ID; |
@@ -990,19 +990,19 @@ discard block |
||
990 | 990 | |
991 | 991 | $base_types = EEM_Price_Type::instance()->get_base_types(); |
992 | 992 | $select_values = array(); |
993 | - foreach ( $base_types as $ref => $text ) { |
|
994 | - if ( $ref == EEM_Price_Type::base_type_base_price ) { |
|
993 | + foreach ($base_types as $ref => $text) { |
|
994 | + if ($ref == EEM_Price_Type::base_type_base_price) { |
|
995 | 995 | //do not allow creation of base_type_base_prices because that's a system only base type. |
996 | 996 | continue; |
997 | 997 | } |
998 | - $values[] = array( 'id' => $ref, 'text' => $text ); |
|
998 | + $values[] = array('id' => $ref, 'text' => $text); |
|
999 | 999 | } |
1000 | 1000 | |
1001 | 1001 | |
1002 | 1002 | $this->_template_args['base_type_select'] = EEH_Form_Fields::select_input('base_type', $values, $price_type->base_type(), 'id="price-type-base-type-slct"'); |
1003 | 1003 | $this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link(); |
1004 | - $redirect_URL = add_query_arg( array( 'action' => 'price_types'), $this->_admin_base_url ); |
|
1005 | - $this->_set_publish_post_box_vars( 'id', $PRT_ID, FALSE, $redirect_URL ); |
|
1004 | + $redirect_URL = add_query_arg(array('action' => 'price_types'), $this->_admin_base_url); |
|
1005 | + $this->_set_publish_post_box_vars('id', $PRT_ID, FALSE, $redirect_URL); |
|
1006 | 1006 | // the details template wrapper |
1007 | 1007 | $this->display_admin_page_with_sidebar(); |
1008 | 1008 | |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | * @return void |
1020 | 1020 | */ |
1021 | 1021 | protected function _price_type_details_meta_boxes() { |
1022 | - add_meta_box( 'edit-price-details-mbox', __( 'Price Type Details', 'event_espresso' ), array( $this, '_edit_price_type_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1022 | + add_meta_box('edit-price-details-mbox', __('Price Type Details', 'event_espresso'), array($this, '_edit_price_type_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1023 | 1023 | } |
1024 | 1024 | |
1025 | 1025 | |
@@ -1032,7 +1032,7 @@ discard block |
||
1032 | 1032 | * @return void |
1033 | 1033 | */ |
1034 | 1034 | public function _edit_price_type_details_meta_box() { |
1035 | - echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
1035 | + echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE); |
|
1036 | 1036 | } |
1037 | 1037 | |
1038 | 1038 | |
@@ -1045,9 +1045,9 @@ discard block |
||
1045 | 1045 | */ |
1046 | 1046 | protected function set_price_type_column_values() { |
1047 | 1047 | |
1048 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1048 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1049 | 1049 | |
1050 | - $base_type = !empty( $this->_req_data['base_type'] ) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price; |
|
1050 | + $base_type = ! empty($this->_req_data['base_type']) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price; |
|
1051 | 1051 | |
1052 | 1052 | switch ($base_type) { |
1053 | 1053 | |
@@ -1094,12 +1094,12 @@ discard block |
||
1094 | 1094 | * @access protected |
1095 | 1095 | * @return void |
1096 | 1096 | */ |
1097 | - protected function _insert_or_update_price_type( $new_price_type = FALSE ) { |
|
1097 | + protected function _insert_or_update_price_type($new_price_type = FALSE) { |
|
1098 | 1098 | |
1099 | 1099 | // echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1100 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1100 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1101 | 1101 | |
1102 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
1102 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
1103 | 1103 | $PRT = EEM_Price_Type::instance(); |
1104 | 1104 | |
1105 | 1105 | // why be so pessimistic ??? : ( |
@@ -1107,24 +1107,24 @@ discard block |
||
1107 | 1107 | |
1108 | 1108 | $set_column_values = $this->set_price_type_column_values(); |
1109 | 1109 | // is this a new Price ? |
1110 | - if ( $new_price_type ) { |
|
1110 | + if ($new_price_type) { |
|
1111 | 1111 | // run the insert |
1112 | - if ( $PRT_ID = $PRT->insert( $set_column_values )) { |
|
1112 | + if ($PRT_ID = $PRT->insert($set_column_values)) { |
|
1113 | 1113 | $success = 1; |
1114 | 1114 | } |
1115 | 1115 | $action_desc = 'created'; |
1116 | 1116 | } else { |
1117 | 1117 | $PRT_ID = absint($this->_req_data['PRT_ID']); |
1118 | 1118 | // run the update |
1119 | - $where_cols_n_values = array('PRT_ID' => $PRT_ID ); |
|
1120 | - if ( $PRT->update( $set_column_values, array( $where_cols_n_values ))) { |
|
1119 | + $where_cols_n_values = array('PRT_ID' => $PRT_ID); |
|
1120 | + if ($PRT->update($set_column_values, array($where_cols_n_values))) { |
|
1121 | 1121 | $success = 1; |
1122 | 1122 | } |
1123 | 1123 | $action_desc = 'updated'; |
1124 | 1124 | } |
1125 | 1125 | |
1126 | - $query_args = array( 'action'=> 'edit_price_type', 'id' => $PRT_ID ); |
|
1127 | - $this->_redirect_after_action( $success, 'Price Type', $action_desc, $query_args ); |
|
1126 | + $query_args = array('action'=> 'edit_price_type', 'id' => $PRT_ID); |
|
1127 | + $this->_redirect_after_action($success, 'Price Type', $action_desc, $query_args); |
|
1128 | 1128 | |
1129 | 1129 | } |
1130 | 1130 | |
@@ -1138,49 +1138,49 @@ discard block |
||
1138 | 1138 | * @access protected |
1139 | 1139 | * @return void |
1140 | 1140 | */ |
1141 | - protected function _trash_or_restore_price_type( $trash = TRUE ) { |
|
1141 | + protected function _trash_or_restore_price_type($trash = TRUE) { |
|
1142 | 1142 | |
1143 | 1143 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1144 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1144 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1145 | 1145 | |
1146 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
1146 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
1147 | 1147 | $PRT = EEM_Price_Type::instance(); |
1148 | 1148 | |
1149 | 1149 | $success = 1; |
1150 | 1150 | $PRT_deleted = $trash ? TRUE : FALSE; |
1151 | 1151 | //Checkboxes |
1152 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1152 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1153 | 1153 | // if array has more than one element than success message should be plural |
1154 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1155 | - $what = count( $this->_req_data['checkbox'] ) > 1 ? 'Price Types' : 'Price Type'; |
|
1154 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1155 | + $what = count($this->_req_data['checkbox']) > 1 ? 'Price Types' : 'Price Type'; |
|
1156 | 1156 | // cycle thru checkboxes |
1157 | - while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
1158 | - if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID ) ) { |
|
1157 | + while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1158 | + if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) { |
|
1159 | 1159 | $success = 0; |
1160 | 1160 | } |
1161 | 1161 | } |
1162 | 1162 | |
1163 | 1163 | } else { |
1164 | 1164 | // grab single id and delete |
1165 | - $PRT_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0; |
|
1166 | - if ( empty( $PRT_ID ) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID )) { |
|
1165 | + $PRT_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0; |
|
1166 | + if (empty($PRT_ID) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) { |
|
1167 | 1167 | $success = 0; |
1168 | 1168 | } |
1169 | 1169 | $what = 'Price Type'; |
1170 | 1170 | |
1171 | 1171 | } |
1172 | 1172 | |
1173 | - $query_args = array( 'action' => 'price_types' ); |
|
1174 | - if ( $success ) { |
|
1175 | - if ( $trash ) { |
|
1173 | + $query_args = array('action' => 'price_types'); |
|
1174 | + if ($success) { |
|
1175 | + if ($trash) { |
|
1176 | 1176 | $msg = $success > 1 ? __('The Price Types have been trashed.', 'event_espresso') : __('The Price Type has been trashed.', 'event_espresso'); |
1177 | 1177 | } else { |
1178 | 1178 | $msg = $success > 1 ? __('The Price Types have been restored.', 'event_espresso') : __('The Price Type has been restored.', 'event_espresso'); |
1179 | 1179 | } |
1180 | - EE_Error::add_success( $msg ); |
|
1180 | + EE_Error::add_success($msg); |
|
1181 | 1181 | } |
1182 | 1182 | |
1183 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
1183 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
1184 | 1184 | |
1185 | 1185 | } |
1186 | 1186 | |
@@ -1197,19 +1197,19 @@ discard block |
||
1197 | 1197 | protected function _delete_price_type() { |
1198 | 1198 | |
1199 | 1199 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1200 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1200 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1201 | 1201 | |
1202 | 1202 | $PRT = EEM_Price_Type::instance(); |
1203 | 1203 | |
1204 | 1204 | $success = 1; |
1205 | 1205 | //Checkboxes |
1206 | - if (!empty($this->_req_data['checkbox'])) { |
|
1206 | + if ( ! empty($this->_req_data['checkbox'])) { |
|
1207 | 1207 | // if array has more than one element than success message should be plural |
1208 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1208 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1209 | 1209 | $what = $PRT->item_name($success); |
1210 | 1210 | // cycle thru bulk action checkboxes |
1211 | - while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
1212 | - if (!$PRT->delete_permanently_by_ID($PRT_ID) ) { |
|
1211 | + while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1212 | + if ( ! $PRT->delete_permanently_by_ID($PRT_ID)) { |
|
1213 | 1213 | $success = 0; |
1214 | 1214 | } |
1215 | 1215 | } |
@@ -1217,8 +1217,8 @@ discard block |
||
1217 | 1217 | } |
1218 | 1218 | |
1219 | 1219 | |
1220 | - $query_args = array( 'action'=> 'price_types' ); |
|
1221 | - $this->_redirect_after_action( $success, $what, 'deleted', $query_args ); |
|
1220 | + $query_args = array('action'=> 'price_types'); |
|
1221 | + $this->_redirect_after_action($success, $what, 'deleted', $query_args); |
|
1222 | 1222 | |
1223 | 1223 | } |
1224 | 1224 | |
@@ -1234,7 +1234,7 @@ discard block |
||
1234 | 1234 | * @return string |
1235 | 1235 | */ |
1236 | 1236 | protected function _learn_more_about_pricing_link() { |
1237 | - return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how pricing works', 'event_espresso') . '</a>'; |
|
1237 | + return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how pricing works', 'event_espresso').'</a>'; |
|
1238 | 1238 | } |
1239 | 1239 | |
1240 | 1240 |