@@ -38,20 +38,20 @@ discard block |
||
38 | 38 | * @param EE_Message_Resource_Manager $message_resource_manager |
39 | 39 | * @param EE_Request_Handler $request |
40 | 40 | */ |
41 | - public function __construct( EE_Message_Resource_Manager $message_resource_manager, EE_Request_Handler $request ) { |
|
41 | + public function __construct(EE_Message_Resource_Manager $message_resource_manager, EE_Request_Handler $request) { |
|
42 | 42 | parent::__construct( |
43 | - $request->get( 'gen_msgr' ), |
|
44 | - $request->get( 'message_type' ), |
|
43 | + $request->get('gen_msgr'), |
|
44 | + $request->get('message_type'), |
|
45 | 45 | array(), |
46 | - $request->get( 'context' ) |
|
46 | + $request->get('context') |
|
47 | 47 | ); |
48 | - if ( ! $this->valid() ) { |
|
48 | + if ( ! $this->valid()) { |
|
49 | 49 | return; |
50 | 50 | } |
51 | - $this->_sending_messenger = $message_resource_manager->get_active_messenger( $request->get( 'snd_msgr' ) ); |
|
52 | - $this->token = $request->get( 'token' ); |
|
51 | + $this->_sending_messenger = $message_resource_manager->get_active_messenger($request->get('snd_msgr')); |
|
52 | + $this->token = $request->get('token'); |
|
53 | 53 | $this->_validate_request(); |
54 | - $this->_data = $this->_get_data_from_request( $request->get( 'id' ) ); |
|
54 | + $this->_data = $this->_get_data_from_request($request->get('id')); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -75,10 +75,10 @@ discard block |
||
75 | 75 | ! $this->_sending_messenger instanceof EE_Messenger |
76 | 76 | || ! $this->_messenger instanceof EE_Messenger |
77 | 77 | || ! $this->_message_type instanceof EE_message_type |
78 | - || empty( $this->_context ) |
|
79 | - || empty( $this->token ) |
|
78 | + || empty($this->_context) |
|
79 | + || empty($this->token) |
|
80 | 80 | ) { |
81 | - throw new EE_Error( __( 'The request for the "msg_url_trigger" route has a malformed url.', 'event_espresso' ) ); |
|
81 | + throw new EE_Error(__('The request for the "msg_url_trigger" route has a malformed url.', 'event_espresso')); |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
@@ -90,16 +90,16 @@ discard block |
||
90 | 90 | * @throws EE_Error |
91 | 91 | * @return mixed (whatever the data is returned from the message type). |
92 | 92 | */ |
93 | - protected function _get_data_from_request( $id ) { |
|
93 | + protected function _get_data_from_request($id) { |
|
94 | 94 | //get the EE_Registration from the token |
95 | 95 | /** @type EE_Registration $registration */ |
96 | - $registration = EEM_Registration::instance()->get_one( array( array( 'REG_url_link' => $this->token ) ) ); |
|
96 | + $registration = EEM_Registration::instance()->get_one(array(array('REG_url_link' => $this->token))); |
|
97 | 97 | //if no registration then bail early. |
98 | - if ( ! $registration instanceof EE_Registration ) { |
|
99 | - throw new EE_Error( __( 'Unable to complete the request because the token is invalid.', 'event_espresso' ) ); |
|
98 | + if ( ! $registration instanceof EE_Registration) { |
|
99 | + throw new EE_Error(__('Unable to complete the request because the token is invalid.', 'event_espresso')); |
|
100 | 100 | } |
101 | 101 | |
102 | - return $this->_get_data_to_use( $registration, $id ); |
|
102 | + return $this->_get_data_to_use($registration, $id); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | * @param int $data_id This is sometimes used for secondary data a message type requires. |
112 | 112 | * @return mixed Data prepared as needed for generating this message. |
113 | 113 | */ |
114 | - protected function _get_data_to_use( $registration, $data_id ) { |
|
114 | + protected function _get_data_to_use($registration, $data_id) { |
|
115 | 115 | //use incoming data from url to setup data for the message type requirements |
116 | - return $this->_message_type->get_data_for_context( $this->_context, $registration, $data_id ); |
|
116 | + return $this->_message_type->get_data_for_context($this->_context, $registration, $data_id); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * Identifier properties for the recipient |
23 | 23 | */ |
24 | - public $user_id; //if available we'll use this to set the fname and lname (admin) |
|
24 | + public $user_id; //if available we'll use this to set the fname and lname (admin) |
|
25 | 25 | public $fname; //this will always be the admin fname (set later via incoming user_id) |
26 | 26 | public $lname; //this will always be the admin lname (set later via incoming user_id) |
27 | 27 | public $primary_registration_id; |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * @access public |
151 | 151 | * @param array $addressee_data We're expecting an incoming array of data that will be used to fill the properties for the object. |
152 | 152 | */ |
153 | - public function __construct( $addressee_data ) { |
|
153 | + public function __construct($addressee_data) { |
|
154 | 154 | $this->_data = $addressee_data; |
155 | 155 | $this->_set_properties(); |
156 | 156 | } |
@@ -166,15 +166,15 @@ discard block |
||
166 | 166 | */ |
167 | 167 | protected function _set_properties() { |
168 | 168 | |
169 | - foreach ( $this->_data as $prop => $value ) { |
|
170 | - if( property_exists( $this, $prop ) ) |
|
169 | + foreach ($this->_data as $prop => $value) { |
|
170 | + if (property_exists($this, $prop)) |
|
171 | 171 | $this->$prop = $value; |
172 | 172 | } |
173 | 173 | |
174 | 174 | //if user_id present we'll use this to set the fname and lname and admin_email. |
175 | - if ( !empty( $this->user_id ) ) { |
|
175 | + if ( ! empty($this->user_id)) { |
|
176 | 176 | $this->user_id = (int) $this->user_id; |
177 | - $user = get_userdata( $this->user_id ); |
|
177 | + $user = get_userdata($this->user_id); |
|
178 | 178 | $this->fname = $user->user_firstname; |
179 | 179 | $this->lname = $user->user_lastname; |
180 | 180 | $this->admin_email = $user->user_email; |
@@ -1,7 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | +} |
|
5 | 6 | |
6 | 7 | /** |
7 | 8 | * EE_Messages_Addressee |
@@ -167,8 +168,9 @@ discard block |
||
167 | 168 | protected function _set_properties() { |
168 | 169 | |
169 | 170 | foreach ( $this->_data as $prop => $value ) { |
170 | - if( property_exists( $this, $prop ) ) |
|
171 | - $this->{$prop} = $value; |
|
171 | + if( property_exists( $this, $prop ) ) { |
|
172 | + $this->{$prop} = $value; |
|
173 | + } |
|
172 | 174 | } |
173 | 175 | |
174 | 176 | //if user_id present we'll use this to set the fname and lname and admin_email. |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | <?php _e('As with most open source programs (and closed licensed programs), the possibility exists that you may find the occasional bug or discover that something is not working as expected. Please don\'t panic! We are here to help you.', 'event_espresso'); ?> |
10 | 10 | </p> |
11 | 11 | <p> |
12 | - <?php printf( __('If your problems are not urgent, please post in our %ssupport forums%s. If you need immediate help, please purchase a support token and you\'ll be able to schedule one-on-one time with a member of our team.', 'event_espresso'), '<a href="https://eventespresso.com/support/forums/" target="_blank">', '</a>' ); ?> |
|
12 | + <?php printf(__('If your problems are not urgent, please post in our %ssupport forums%s. If you need immediate help, please purchase a support token and you\'ll be able to schedule one-on-one time with a member of our team.', 'event_espresso'), '<a href="https://eventespresso.com/support/forums/" target="_blank">', '</a>'); ?> |
|
13 | 13 | </p> |
14 | 14 | <p class="ee-attention"> |
15 | 15 | <strong class="red_text"> |
@@ -30,6 +30,6 @@ discard block |
||
30 | 30 | <?php _e('A support token can be used towards receiving support for a single incident. Support is provided up to 30 minutes via phone call, instant message, or priority email support. Here are examples of how support tokens can be used: how-to questions, best practices questions, technical issues, advising on custom development.', 'event_espresso'); ?> |
31 | 31 | </p> |
32 | 32 | <p> |
33 | - <?php printf( __('You can learn more about support tokens and purchase one by %sclicking here%s.', 'event_espresso'),'<a href="https://eventespresso.com/product/premium-support-token/?utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=help_support_tab&utm_content=support_token" target="_blank">','</a>'); ?> |
|
33 | + <?php printf(__('You can learn more about support tokens and purchase one by %sclicking here%s.', 'event_espresso'), '<a href="https://eventespresso.com/product/premium-support-token/?utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=help_support_tab&utm_content=support_token" target="_blank">', '</a>'); ?> |
|
34 | 34 | </p> |
35 | 35 | </div> |
36 | 36 | \ No newline at end of file |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <div class="padding"> |
2 | 2 | <p> |
3 | - <?php _e('Displays a list of events based on a set of criteria on a WordPress page or post. Unless otherwise specified, events are sorted by start date.', 'event_espresso'); ?> <?php echo sprintf( __('For a full list of available shortcodes, please view the %sshortcode documentation%s on our website.', 'event_espresso'), '<a href="https://eventespresso.com/wiki/setup-event-espresso-arabica-theme/">', '</a>' ); ?> |
|
3 | + <?php _e('Displays a list of events based on a set of criteria on a WordPress page or post. Unless otherwise specified, events are sorted by start date.', 'event_espresso'); ?> <?php echo sprintf(__('For a full list of available shortcodes, please view the %sshortcode documentation%s on our website.', 'event_espresso'), '<a href="https://eventespresso.com/wiki/setup-event-espresso-arabica-theme/">', '</a>'); ?> |
|
4 | 4 | </p> |
5 | 5 | <ul> |
6 | 6 | <li><strong><?php _e('Show a list of all of your events', 'event_espresso'); ?></strong><br /> [ESPRESSO_EVENTS]</li> |
7 | 7 | <li><strong><?php _e('Set a custom title for the event list', 'event_espresso'); ?></strong><br /> [ESPRESSO_EVENTS title="My Super Event List"]</li> |
8 | 8 | <li><strong><?php _e('Limit (paginate) the number of events that are shown in the event list on a page or post', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS limit=5]</li> |
9 | 9 | <li><strong><?php _e('Add a custom CSS class to each event post/article', 'event_espresso'); ?></strong><br /> [ESPRESSO_EVENTS css_class=my-custom-class]</li> |
10 | - <li><strong><?php _e('Filter the event list by month and year', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS month="<?php echo date( 'F Y' ); ?>"]</li> |
|
10 | + <li><strong><?php _e('Filter the event list by month and year', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS month="<?php echo date('F Y'); ?>"]</li> |
|
11 | 11 | <li><strong><?php _e('Show expired events in the event list', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS show_expired=true]</li> |
12 | 12 | <li><strong><?php _e('Sorts the event list in ascending order', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS sort=ASC]</li> |
13 | 13 | <li><strong><?php _e('Sorts the event list in descending order', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS sort=DESC]</li> |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * date_format and the second value is the time format |
36 | 36 | * @return EE_Attendee |
37 | 37 | */ |
38 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
39 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
40 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
38 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
39 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
40 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | * the website will be used. |
49 | 49 | * @return EE_Attendee |
50 | 50 | */ |
51 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
52 | - return new self( $props_n_values, TRUE, $timezone ); |
|
51 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
52 | + return new self($props_n_values, TRUE, $timezone); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | * @access public |
61 | 61 | * @param int $PRT_ID |
62 | 62 | */ |
63 | - public function set_type( $PRT_ID = 0 ) { |
|
64 | - $this->set( 'PRT_ID', $PRT_ID ); |
|
63 | + public function set_type($PRT_ID = 0) { |
|
64 | + $this->set('PRT_ID', $PRT_ID); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | * @access public |
73 | 73 | * @param float $PRC_amount |
74 | 74 | */ |
75 | - public function set_amount( $PRC_amount = 0.00 ) { |
|
76 | - $this->set( 'PRC_amount', $PRC_amount ); |
|
75 | + public function set_amount($PRC_amount = 0.00) { |
|
76 | + $this->set('PRC_amount', $PRC_amount); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | * @access public |
85 | 85 | * @param string $PRC_name |
86 | 86 | */ |
87 | - public function set_name( $PRC_name = '' ) { |
|
88 | - $this->set( 'PRC_name', $PRC_name ); |
|
87 | + public function set_name($PRC_name = '') { |
|
88 | + $this->set('PRC_name', $PRC_name); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | * @access public |
97 | 97 | * @param string $PRC_desc |
98 | 98 | */ |
99 | - public function set_description( $PRC_desc = '' ) { |
|
100 | - $this->Set( 'PRC_desc', $PRC_desc ); |
|
99 | + public function set_description($PRC_desc = '') { |
|
100 | + $this->Set('PRC_desc', $PRC_desc); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | * @access public |
109 | 109 | * @param bool $PRC_is_default |
110 | 110 | */ |
111 | - public function set_is_default( $PRC_is_default = FALSE ) { |
|
112 | - $this->set( 'PRC_is_default', $PRC_is_default ); |
|
111 | + public function set_is_default($PRC_is_default = FALSE) { |
|
112 | + $this->set('PRC_is_default', $PRC_is_default); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | |
@@ -120,8 +120,8 @@ discard block |
||
120 | 120 | * @access public |
121 | 121 | * @param bool $PRC_deleted |
122 | 122 | */ |
123 | - public function set_deleted( $PRC_deleted = NULL ) { |
|
124 | - $this->set( 'PRC_deleted', $PRC_deleted ); |
|
123 | + public function set_deleted($PRC_deleted = NULL) { |
|
124 | + $this->set('PRC_deleted', $PRC_deleted); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * @return int |
133 | 133 | */ |
134 | 134 | public function type() { |
135 | - return $this->get( 'PRT_ID' ); |
|
135 | + return $this->get('PRT_ID'); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @return float |
144 | 144 | */ |
145 | 145 | public function amount() { |
146 | - return $this->get( 'PRC_amount' ); |
|
146 | + return $this->get('PRC_amount'); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @return string |
155 | 155 | */ |
156 | 156 | public function name() { |
157 | - return $this->get( 'PRC_name' ); |
|
157 | + return $this->get('PRC_name'); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * @return string |
166 | 166 | */ |
167 | 167 | public function desc() { |
168 | - return $this->get( 'PRC_desc' ); |
|
168 | + return $this->get('PRC_desc'); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * @return int |
177 | 177 | */ |
178 | 178 | public function overrides() { |
179 | - return $this->get( 'PRC_overrides' ); |
|
179 | + return $this->get('PRC_overrides'); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * @return int |
188 | 188 | */ |
189 | 189 | public function order() { |
190 | - return $this->get( 'PRC_order' ); |
|
190 | + return $this->get('PRC_order'); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | * @return bool |
212 | 212 | */ |
213 | 213 | public function is_default() { |
214 | - return $this->get( 'PRC_is_default' ); |
|
214 | + return $this->get('PRC_is_default'); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | * @return bool |
223 | 223 | */ |
224 | 224 | public function deleted() { |
225 | - return $this->get( 'PRC_deleted' ); |
|
225 | + return $this->get('PRC_deleted'); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | * @return bool |
232 | 232 | */ |
233 | 233 | public function parent() { |
234 | - return $this->get( 'PRC_parent' ); |
|
234 | + return $this->get('PRC_parent'); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * @return EE_Price_Type |
254 | 254 | */ |
255 | 255 | public function type_obj() { |
256 | - return $this->get_first_related( 'Price_Type' ); |
|
256 | + return $this->get_first_related('Price_Type'); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | */ |
276 | 276 | public function is_percent() { |
277 | 277 | $price_type = $this->type_obj(); |
278 | - return $price_type->get( 'PRT_is_percent' ); |
|
278 | + return $price_type->get('PRT_is_percent'); |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | * @return string |
288 | 288 | */ |
289 | 289 | public function pretty_price() { |
290 | - return ! $this->is_percent() ? $this->get_pretty('PRC_amount') : $this->get('PRC_amount') . '%'; |
|
290 | + return ! $this->is_percent() ? $this->get_pretty('PRC_amount') : $this->get('PRC_amount').'%'; |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | * @return mixed |
297 | 297 | */ |
298 | 298 | public function get_price_without_currency_symbol() { |
299 | - return str_replace( EE_Registry::instance()->CFG->currency->sign, '', $this->get_pretty( 'PRC_amount' ) ); |
|
299 | + return str_replace(EE_Registry::instance()->CFG->currency->sign, '', $this->get_pretty('PRC_amount')); |
|
300 | 300 | } |
301 | 301 | } |
302 | 302 |
@@ -46,7 +46,7 @@ |
||
46 | 46 | * @param array $props_n_values incoming values from the database |
47 | 47 | * @param string $timezone incoming timezone as set by the model. If not set the timezone for |
48 | 48 | * the website will be used. |
49 | - * @return EE_Attendee |
|
49 | + * @return EE_Price |
|
50 | 50 | */ |
51 | 51 | public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
52 | 52 | return new self( $props_n_values, TRUE, $timezone ); |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | |
104 | 104 | |
105 | 105 | /** |
106 | - * set is_default |
|
107 | - * |
|
108 | - * @access public |
|
109 | - * @param bool $PRC_is_default |
|
110 | - */ |
|
106 | + * set is_default |
|
107 | + * |
|
108 | + * @access public |
|
109 | + * @param bool $PRC_is_default |
|
110 | + */ |
|
111 | 111 | public function set_is_default( $PRC_is_default = FALSE ) { |
112 | 112 | $this->set( 'PRC_is_default', $PRC_is_default ); |
113 | 113 | } |
@@ -115,11 +115,11 @@ discard block |
||
115 | 115 | |
116 | 116 | |
117 | 117 | /** |
118 | - * set deleted |
|
119 | - * |
|
120 | - * @access public |
|
121 | - * @param bool $PRC_deleted |
|
122 | - */ |
|
118 | + * set deleted |
|
119 | + * |
|
120 | + * @access public |
|
121 | + * @param bool $PRC_deleted |
|
122 | + */ |
|
123 | 123 | public function set_deleted( $PRC_deleted = NULL ) { |
124 | 124 | $this->set( 'PRC_deleted', $PRC_deleted ); |
125 | 125 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | * date_format and the second value is the time format |
46 | 46 | * @return EE_Attendee |
47 | 47 | */ |
48 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
49 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
50 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
48 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
49 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
50 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | * the website will be used. |
59 | 59 | * @return EE_Attendee |
60 | 60 | */ |
61 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
62 | - return new self( $props_n_values, TRUE, $timezone ); |
|
61 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
62 | + return new self($props_n_values, TRUE, $timezone); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | * @param string $value |
70 | 70 | * @return bool success |
71 | 71 | */ |
72 | - public function set_value( $value ) { |
|
73 | - $this->set( 'QSO_value', $value ); |
|
72 | + public function set_value($value) { |
|
73 | + $this->set('QSO_value', $value); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | * @param string $text |
81 | 81 | * @return bool success |
82 | 82 | */ |
83 | - public function set_desc( $text ) { |
|
84 | - $this->set( 'QSO_desc', $text ); |
|
83 | + public function set_desc($text) { |
|
84 | + $this->set('QSO_desc', $text); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | * @param integer $order |
94 | 94 | * @return bool $success |
95 | 95 | */ |
96 | - public function set_order( $order ) { |
|
97 | - $this->set( 'QSO_order', $order ); |
|
96 | + public function set_order($order) { |
|
97 | + $this->set('QSO_order', $order); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * @param int $question_ID |
105 | 105 | * @return bool success |
106 | 106 | */ |
107 | - public function set_question_ID( $question_ID ) { |
|
108 | - $this->set( 'QST_ID', $question_ID ); |
|
107 | + public function set_question_ID($question_ID) { |
|
108 | + $this->set('QST_ID', $question_ID); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * @param string $text |
116 | 116 | * @return bool success |
117 | 117 | */ |
118 | - public function set_opt_group( $text ) { |
|
118 | + public function set_opt_group($text) { |
|
119 | 119 | return $this->_QSO_opt_group = $text; |
120 | 120 | } |
121 | 121 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @return string |
127 | 127 | */ |
128 | 128 | public function value() { |
129 | - return $this->get( 'QSO_value' ); |
|
129 | + return $this->get('QSO_value'); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * @return string |
137 | 137 | */ |
138 | 138 | public function desc() { |
139 | - return $this->get( 'QSO_desc' ); |
|
139 | + return $this->get('QSO_desc'); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @return boolean |
147 | 147 | */ |
148 | 148 | public function deleted() { |
149 | - return $this->get( 'QSO_deleted' ); |
|
149 | + return $this->get('QSO_deleted'); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * @return integer |
159 | 159 | */ |
160 | 160 | public function order() { |
161 | - return $this->get( 'QSO_option' ); |
|
161 | + return $this->get('QSO_option'); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | * @return int |
169 | 169 | */ |
170 | 170 | public function question_ID() { |
171 | - return $this->get( 'QST_ID' ); |
|
171 | + return $this->get('QST_ID'); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | * @return EE_Question |
179 | 179 | */ |
180 | 180 | public function question() { |
181 | - return $this->get_first_related( 'Question' ); |
|
181 | + return $this->get_first_related('Question'); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | |
@@ -197,11 +197,11 @@ discard block |
||
197 | 197 | * @param array $options { |
198 | 198 | * @type int $QST_ID the QST_ID attribute of this question option, otherwise it will be for the same question as the original |
199 | 199 | */ |
200 | - public function duplicate( $options = array() ) { |
|
200 | + public function duplicate($options = array()) { |
|
201 | 201 | $new_question_option = clone $this; |
202 | - $new_question_option->set( 'QSO_ID', null ); |
|
203 | - if( array_key_exists( 'QST_ID', $options ) ) {//use array_key_exists instead of isset because NULL might be a valid value |
|
204 | - $new_question_option->set_question_ID( $options[ 'QST_ID' ] ); |
|
202 | + $new_question_option->set('QSO_ID', null); |
|
203 | + if (array_key_exists('QST_ID', $options)) {//use array_key_exists instead of isset because NULL might be a valid value |
|
204 | + $new_question_option->set_question_ID($options['QST_ID']); |
|
205 | 205 | } |
206 | 206 | $new_question_option->save(); |
207 | 207 | } |
@@ -219,8 +219,8 @@ discard block |
||
219 | 219 | * @param string $QSO_system |
220 | 220 | * @return bool |
221 | 221 | */ |
222 | - public function set_system( $QSO_system ) { |
|
223 | - return $this->set( 'QSO_system', $QSO_system ); |
|
222 | + public function set_system($QSO_system) { |
|
223 | + return $this->set('QSO_system', $QSO_system); |
|
224 | 224 | } |
225 | 225 | } |
226 | 226 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @param array $props_n_values incoming values from the database |
57 | 57 | * @param string $timezone incoming timezone as set by the model. If not set the timezone for |
58 | 58 | * the website will be used. |
59 | - * @return EE_Attendee |
|
59 | + * @return EE_Question_Option |
|
60 | 60 | */ |
61 | 61 | public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
62 | 62 | return new self( $props_n_values, TRUE, $timezone ); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | /** |
68 | 68 | * Sets the option's key value |
69 | 69 | * @param string $value |
70 | - * @return bool success |
|
70 | + * @return boolean|null success |
|
71 | 71 | */ |
72 | 72 | public function set_value( $value ) { |
73 | 73 | $this->set( 'QSO_value', $value ); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | /** |
79 | 79 | * Sets the option's Display Text |
80 | 80 | * @param string $text |
81 | - * @return bool success |
|
81 | + * @return boolean|null success |
|
82 | 82 | */ |
83 | 83 | public function set_desc( $text ) { |
84 | 84 | $this->set( 'QSO_desc', $text ); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @access public |
93 | 93 | * @param integer $order |
94 | - * @return bool $success |
|
94 | + * @return boolean|null $success |
|
95 | 95 | */ |
96 | 96 | public function set_order( $order ) { |
97 | 97 | $this->set( 'QSO_order', $order ); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | /** |
103 | 103 | * Sets the ID of the related question |
104 | 104 | * @param int $question_ID |
105 | - * @return bool success |
|
105 | + * @return boolean|null success |
|
106 | 106 | */ |
107 | 107 | public function set_question_ID( $question_ID ) { |
108 | 108 | $this->set( 'QST_ID', $question_ID ); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | /** |
114 | 114 | * Sets the option's opt_group |
115 | 115 | * @param string $text |
116 | - * @return bool success |
|
116 | + * @return string success |
|
117 | 117 | */ |
118 | 118 | public function set_opt_group( $text ) { |
119 | 119 | return $this->_QSO_opt_group = $text; |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | /** |
218 | 218 | * Sets QSO_system |
219 | 219 | * @param string $QSO_system |
220 | - * @return bool |
|
220 | + * @return boolean|null |
|
221 | 221 | */ |
222 | 222 | public function set_system( $QSO_system ) { |
223 | 223 | return $this->set( 'QSO_system', $QSO_system ); |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | * @param string $timezone |
20 | 20 | * @return EE_Registration_Payment |
21 | 21 | */ |
22 | - public static function new_instance( $props_n_values = array(), $timezone = '', $date_formats = array() ) { |
|
23 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
24 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
22 | + public static function new_instance($props_n_values = array(), $timezone = '', $date_formats = array()) { |
|
23 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
24 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | * @param string $timezone |
32 | 32 | * @return EE_Registration_Payment |
33 | 33 | */ |
34 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = '' ) { |
|
35 | - return new self( $props_n_values, true, $timezone ); |
|
34 | + public static function new_instance_from_db($props_n_values = array(), $timezone = '') { |
|
35 | + return new self($props_n_values, true, $timezone); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @return int |
44 | 44 | */ |
45 | 45 | public function registration_ID() { |
46 | - return $this->get( 'REG_ID' ); |
|
46 | + return $this->get('REG_ID'); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @return int |
55 | 55 | */ |
56 | 56 | public function payment_ID() { |
57 | - return $this->get( 'PAY_ID' ); |
|
57 | + return $this->get('PAY_ID'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @return float |
66 | 66 | */ |
67 | 67 | public function amount() { |
68 | - return $this->get( 'RPY_amount' ); |
|
68 | + return $this->get('RPY_amount'); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | * @access public |
76 | 76 | * @param float $amount |
77 | 77 | */ |
78 | - public function set_amount( $amount = 0.000 ) { |
|
79 | - $this->set( 'RPY_amount', $amount ); |
|
78 | + public function set_amount($amount = 0.000) { |
|
79 | + $this->set('RPY_amount', $amount); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @return \EE_Registration |
88 | 88 | */ |
89 | 89 | public function registration() { |
90 | - return $this->get_first_related( 'Registration' ); |
|
90 | + return $this->get_first_related('Registration'); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @return \EE_Payment |
99 | 99 | */ |
100 | 100 | public function payment() { |
101 | - return $this->get_first_related( 'Payment' ); |
|
101 | + return $this->get_first_related('Payment'); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | * date_format and the second value is the time format |
67 | 67 | * @return EE_Ticket |
68 | 68 | */ |
69 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
70 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
71 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
69 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
70 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
71 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | * the website will be used. |
80 | 80 | * @return EE_Ticket |
81 | 81 | */ |
82 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
83 | - return new self( $props_n_values, TRUE, $timezone ); |
|
82 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
83 | + return new self($props_n_values, TRUE, $timezone); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @return bool |
90 | 90 | */ |
91 | 91 | public function parent() { |
92 | - return $this->get( 'TKT_parent' ); |
|
92 | + return $this->get('TKT_parent'); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | * @param int $DTT_ID the primary key for a particular datetime |
100 | 100 | * @return boolean |
101 | 101 | */ |
102 | - public function available( $DTT_ID = 0 ) { |
|
102 | + public function available($DTT_ID = 0) { |
|
103 | 103 | // are we checking availability for a particular datetime ? |
104 | - if ( $DTT_ID ) { |
|
104 | + if ($DTT_ID) { |
|
105 | 105 | // get that datetime object |
106 | - $datetime = $this->get_first_related( 'Datetime', array( array( 'DTT_ID' => $DTT_ID ) ) ); |
|
106 | + $datetime = $this->get_first_related('Datetime', array(array('DTT_ID' => $DTT_ID))); |
|
107 | 107 | // if ticket sales for this datetime have exceeded the reg limit... |
108 | - if ( $datetime instanceof EE_Datetime && $datetime->sold_out() ) { |
|
108 | + if ($datetime instanceof EE_Datetime && $datetime->sold_out()) { |
|
109 | 109 | return FALSE; |
110 | 110 | } |
111 | 111 | } |
@@ -120,21 +120,21 @@ discard block |
||
120 | 120 | * @param bool $display true = we'll return a localized string, otherwise we just return the value of the relevant status const |
121 | 121 | * @return mixed(int|string) status int if the display string isn't requested |
122 | 122 | */ |
123 | - public function ticket_status( $display = FALSE ) { |
|
124 | - if ( ! $this->is_remaining() ) { |
|
125 | - return $display ? EEH_Template::pretty_status( EE_Ticket::sold_out, FALSE, 'sentence' ) : EE_Ticket::sold_out; |
|
123 | + public function ticket_status($display = FALSE) { |
|
124 | + if ( ! $this->is_remaining()) { |
|
125 | + return $display ? EEH_Template::pretty_status(EE_Ticket::sold_out, FALSE, 'sentence') : EE_Ticket::sold_out; |
|
126 | 126 | } |
127 | - if ( $this->get( 'TKT_deleted' ) ) { |
|
128 | - return $display ? EEH_Template::pretty_status( EE_Ticket::archived, FALSE, 'sentence' ) : EE_Ticket::archived; |
|
127 | + if ($this->get('TKT_deleted')) { |
|
128 | + return $display ? EEH_Template::pretty_status(EE_Ticket::archived, FALSE, 'sentence') : EE_Ticket::archived; |
|
129 | 129 | } |
130 | - if ( $this->is_expired() ) { |
|
131 | - return $display ? EEH_Template::pretty_status( EE_Ticket::expired, FALSE, 'sentence' ) : EE_Ticket::expired; |
|
130 | + if ($this->is_expired()) { |
|
131 | + return $display ? EEH_Template::pretty_status(EE_Ticket::expired, FALSE, 'sentence') : EE_Ticket::expired; |
|
132 | 132 | } |
133 | - if ( $this->is_pending() ) { |
|
134 | - return $display ? EEH_Template::pretty_status( EE_Ticket::pending, FALSE, 'sentence' ) : EE_Ticket::pending; |
|
133 | + if ($this->is_pending()) { |
|
134 | + return $display ? EEH_Template::pretty_status(EE_Ticket::pending, FALSE, 'sentence') : EE_Ticket::pending; |
|
135 | 135 | } |
136 | - if ( $this->is_on_sale() ) { |
|
137 | - return $display ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence' ) : EE_Ticket::onsale; |
|
136 | + if ($this->is_on_sale()) { |
|
137 | + return $display ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : EE_Ticket::onsale; |
|
138 | 138 | } |
139 | 139 | return ''; |
140 | 140 | } |
@@ -148,12 +148,12 @@ discard block |
||
148 | 148 | * @param int $DTT_ID if an int above 0 is included here then we get a specific dtt. |
149 | 149 | * @return boolean true = tickets remaining, false not. |
150 | 150 | */ |
151 | - public function is_remaining( $DTT_ID = 0 ) { |
|
152 | - $num_remaining = $this->remaining( $DTT_ID ); |
|
153 | - if ( $num_remaining === 0 ) { |
|
151 | + public function is_remaining($DTT_ID = 0) { |
|
152 | + $num_remaining = $this->remaining($DTT_ID); |
|
153 | + if ($num_remaining === 0) { |
|
154 | 154 | return FALSE; |
155 | 155 | } |
156 | - if ( $num_remaining > 0 && $num_remaining < $this->min() ) { |
|
156 | + if ($num_remaining > 0 && $num_remaining < $this->min()) { |
|
157 | 157 | return FALSE; |
158 | 158 | } |
159 | 159 | return TRUE; |
@@ -167,25 +167,25 @@ discard block |
||
167 | 167 | * all related datetimes |
168 | 168 | * @return int |
169 | 169 | */ |
170 | - public function remaining( $DTT_ID = 0 ) { |
|
170 | + public function remaining($DTT_ID = 0) { |
|
171 | 171 | // are we checking availability for a particular datetime ? |
172 | - if ( $DTT_ID ) { |
|
172 | + if ($DTT_ID) { |
|
173 | 173 | // get array with the one requested datetime |
174 | - $datetimes = $this->get_many_related( 'Datetime', array( array( 'DTT_ID' => $DTT_ID ) ) ); |
|
174 | + $datetimes = $this->get_many_related('Datetime', array(array('DTT_ID' => $DTT_ID))); |
|
175 | 175 | } else { |
176 | 176 | // we need to check availability of ALL datetimes |
177 | - $datetimes = $this->get_many_related( 'Datetime', array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) ) ); |
|
177 | + $datetimes = $this->get_many_related('Datetime', array('order_by' => array('DTT_EVT_start' => 'ASC'))); |
|
178 | 178 | } |
179 | 179 | // d( $datetimes ); |
180 | 180 | // if datetime reg limit is not unlimited |
181 | - if ( ! empty( $datetimes ) ) { |
|
181 | + if ( ! empty($datetimes)) { |
|
182 | 182 | // although TKT_qty and $datetime->spaces_remaining() could both be EE_INF |
183 | 183 | // we only need to check for EE_INF explicitly if we want to optimize. |
184 | 184 | // because EE_INF - x = EE_INF; and min(x,EE_INF) = x; |
185 | 185 | $tickets_remaining = $this->qty() - $this->sold(); |
186 | - foreach ( $datetimes as $datetime ) { |
|
187 | - if ( $datetime instanceof EE_Datetime ) { |
|
188 | - $tickets_remaining = min( $tickets_remaining, $datetime->spaces_remaining() ); |
|
186 | + foreach ($datetimes as $datetime) { |
|
187 | + if ($datetime instanceof EE_Datetime) { |
|
188 | + $tickets_remaining = min($tickets_remaining, $datetime->spaces_remaining()); |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | return $tickets_remaining; |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * @return int |
201 | 201 | */ |
202 | 202 | function min() { |
203 | - return $this->get( 'TKT_min' ); |
|
203 | + return $this->get('TKT_min'); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * @return boolean |
211 | 211 | */ |
212 | 212 | public function is_expired() { |
213 | - return ( $this->get_raw( 'TKT_end_date' ) < time() ); |
|
213 | + return ($this->get_raw('TKT_end_date') < time()); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * @return boolean |
221 | 221 | */ |
222 | 222 | public function is_pending() { |
223 | - return ( $this->get_raw( 'TKT_start_date' ) > time() ); |
|
223 | + return ($this->get_raw('TKT_start_date') > time()); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * @return boolean |
231 | 231 | */ |
232 | 232 | public function is_on_sale() { |
233 | - return ( $this->get_raw( 'TKT_start_date' ) < time() && $this->get_raw( 'TKT_end_date' ) > time() ); |
|
233 | + return ($this->get_raw('TKT_start_date') < time() && $this->get_raw('TKT_end_date') > time()); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | |
@@ -241,11 +241,11 @@ discard block |
||
241 | 241 | * @param string $conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31 |
242 | 242 | * @return array |
243 | 243 | */ |
244 | - public function date_range( $dt_frmt = '', $conjunction = ' - ' ) { |
|
245 | - $first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date( $dt_frmt ) : ''; |
|
246 | - $last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date( $dt_frmt ) : ''; |
|
244 | + public function date_range($dt_frmt = '', $conjunction = ' - ') { |
|
245 | + $first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date($dt_frmt) : ''; |
|
246 | + $last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date($dt_frmt) : ''; |
|
247 | 247 | |
248 | - return $first_date && $last_date ? $first_date . $conjunction . $last_date : ''; |
|
248 | + return $first_date && $last_date ? $first_date.$conjunction.$last_date : ''; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | |
@@ -255,8 +255,8 @@ discard block |
||
255 | 255 | * @return EE_Datetime |
256 | 256 | */ |
257 | 257 | public function first_datetime() { |
258 | - $datetimes = $this->datetimes( array( 'limit' => 1 ) ); |
|
259 | - return reset( $datetimes ); |
|
258 | + $datetimes = $this->datetimes(array('limit' => 1)); |
|
259 | + return reset($datetimes); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | |
@@ -267,11 +267,11 @@ discard block |
||
267 | 267 | * @param array $query_params see EEM_Base::get_all() |
268 | 268 | * @return EE_Datetime[] |
269 | 269 | */ |
270 | - public function datetimes( $query_params = array() ) { |
|
271 | - if ( ! isset( $query_params[ 'order_by' ] ) ) { |
|
272 | - $query_params[ 'order_by' ][ 'DTT_order' ] = 'ASC'; |
|
270 | + public function datetimes($query_params = array()) { |
|
271 | + if ( ! isset($query_params['order_by'])) { |
|
272 | + $query_params['order_by']['DTT_order'] = 'ASC'; |
|
273 | 273 | } |
274 | - return $this->get_many_related( 'Datetime', $query_params ); |
|
274 | + return $this->get_many_related('Datetime', $query_params); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | |
@@ -281,8 +281,8 @@ discard block |
||
281 | 281 | * @return EE_Datetime |
282 | 282 | */ |
283 | 283 | public function last_datetime() { |
284 | - $datetimes = $this->datetimes( array( 'limit' => 1, 'order_by' => array( 'DTT_EVT_start' => 'DESC' ) ) ); |
|
285 | - return end( $datetimes ); |
|
284 | + $datetimes = $this->datetimes(array('limit' => 1, 'order_by' => array('DTT_EVT_start' => 'DESC'))); |
|
285 | + return end($datetimes); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | |
@@ -296,22 +296,22 @@ discard block |
||
296 | 296 | * @param int $dtt_id [optional] include the dtt_id with $what = 'datetime'. |
297 | 297 | * @return mixed (array|int) how many tickets have sold |
298 | 298 | */ |
299 | - public function tickets_sold( $what = 'ticket', $dtt_id = NULL ) { |
|
299 | + public function tickets_sold($what = 'ticket', $dtt_id = NULL) { |
|
300 | 300 | $total = 0; |
301 | 301 | $tickets_sold = $this->_all_tickets_sold(); |
302 | - switch ( $what ) { |
|
302 | + switch ($what) { |
|
303 | 303 | case 'ticket' : |
304 | - return $tickets_sold[ 'ticket' ]; |
|
304 | + return $tickets_sold['ticket']; |
|
305 | 305 | break; |
306 | 306 | case 'datetime' : |
307 | - if ( empty( $tickets_sold[ 'datetime' ] ) ) { |
|
307 | + if (empty($tickets_sold['datetime'])) { |
|
308 | 308 | return $total; |
309 | 309 | } |
310 | - if ( ! empty( $dtt_id ) && ! isset( $tickets_sold[ 'datetime' ][ $dtt_id ] ) ) { |
|
311 | - EE_Error::add_error( __( "You've requested the amount of tickets sold for a given ticket and datetime, however there are no records for the datetime id you included. Are you SURE that is a datetime related to this ticket?", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ ); |
|
310 | + if ( ! empty($dtt_id) && ! isset($tickets_sold['datetime'][$dtt_id])) { |
|
311 | + EE_Error::add_error(__("You've requested the amount of tickets sold for a given ticket and datetime, however there are no records for the datetime id you included. Are you SURE that is a datetime related to this ticket?", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
|
312 | 312 | return $total; |
313 | 313 | } |
314 | - return empty( $dtt_id ) ? $tickets_sold[ 'datetime' ] : $tickets_sold[ 'datetime' ][ $dtt_id ]; |
|
314 | + return empty($dtt_id) ? $tickets_sold['datetime'] : $tickets_sold['datetime'][$dtt_id]; |
|
315 | 315 | break; |
316 | 316 | default: |
317 | 317 | return $total; |
@@ -325,15 +325,15 @@ discard block |
||
325 | 325 | * @return EE_Ticket[] |
326 | 326 | */ |
327 | 327 | protected function _all_tickets_sold() { |
328 | - $datetimes = $this->get_many_related( 'Datetime' ); |
|
328 | + $datetimes = $this->get_many_related('Datetime'); |
|
329 | 329 | $tickets_sold = array(); |
330 | - if ( ! empty( $datetimes ) ) { |
|
331 | - foreach ( $datetimes as $datetime ) { |
|
332 | - $tickets_sold[ 'datetime' ][ $datetime->ID() ] = $datetime->get( 'DTT_sold' ); |
|
330 | + if ( ! empty($datetimes)) { |
|
331 | + foreach ($datetimes as $datetime) { |
|
332 | + $tickets_sold['datetime'][$datetime->ID()] = $datetime->get('DTT_sold'); |
|
333 | 333 | } |
334 | 334 | } |
335 | 335 | //Tickets sold |
336 | - $tickets_sold[ 'ticket' ] = $this->sold(); |
|
336 | + $tickets_sold['ticket'] = $this->sold(); |
|
337 | 337 | return $tickets_sold; |
338 | 338 | } |
339 | 339 | |
@@ -346,9 +346,9 @@ discard block |
||
346 | 346 | * @param bool $return_array whether to return as an array indexed by price id or just the object. |
347 | 347 | * @return EE_Price |
348 | 348 | */ |
349 | - public function base_price( $return_array = FALSE ) { |
|
350 | - $_where = array( 'Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price ); |
|
351 | - return $return_array ? $this->get_many_related( 'Price', array( $_where ) ) : $this->get_first_related( 'Price', array( $_where ) ); |
|
349 | + public function base_price($return_array = FALSE) { |
|
350 | + $_where = array('Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price); |
|
351 | + return $return_array ? $this->get_many_related('Price', array($_where)) : $this->get_first_related('Price', array($_where)); |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | |
@@ -360,8 +360,8 @@ discard block |
||
360 | 360 | * @return EE_Price[] |
361 | 361 | */ |
362 | 362 | public function price_modifiers() { |
363 | - $query_params = array( 0 => array( 'Price_Type.PBT_ID' => array( 'NOT IN', array( EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax ) ) ) ); |
|
364 | - return $this->prices( $query_params ); |
|
363 | + $query_params = array(0 => array('Price_Type.PBT_ID' => array('NOT IN', array(EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax)))); |
|
364 | + return $this->prices($query_params); |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | |
@@ -371,8 +371,8 @@ discard block |
||
371 | 371 | * @param array $query_params like EEM_Base::get_all |
372 | 372 | * @return EE_Price[] |
373 | 373 | */ |
374 | - public function prices( $query_params = array() ) { |
|
375 | - return $this->get_many_related( 'Price', $query_params ); |
|
374 | + public function prices($query_params = array()) { |
|
375 | + return $this->get_many_related('Price', $query_params); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | |
@@ -382,8 +382,8 @@ discard block |
||
382 | 382 | * @param array $query_params see EEM_Base::get_all() |
383 | 383 | * @return EE_Datetime_Ticket |
384 | 384 | */ |
385 | - public function datetime_tickets( $query_params = array() ) { |
|
386 | - return $this->get_many_related( 'Datetime_Ticket', $query_params ); |
|
385 | + public function datetime_tickets($query_params = array()) { |
|
386 | + return $this->get_many_related('Datetime_Ticket', $query_params); |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | |
@@ -394,8 +394,8 @@ discard block |
||
394 | 394 | * @param boolean $show_deleted |
395 | 395 | * @return EE_Datetime[] |
396 | 396 | */ |
397 | - public function datetimes_ordered( $show_expired = TRUE, $show_deleted = FALSE ) { |
|
398 | - return EEM_Datetime::instance( $this->_timezone )->get_datetimes_for_ticket_ordered_by_DTT_order( $this->ID(), $show_expired, $show_deleted ); |
|
397 | + public function datetimes_ordered($show_expired = TRUE, $show_deleted = FALSE) { |
|
398 | + return EEM_Datetime::instance($this->_timezone)->get_datetimes_for_ticket_ordered_by_DTT_order($this->ID(), $show_expired, $show_deleted); |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | * @return string |
406 | 406 | */ |
407 | 407 | function ID() { |
408 | - return $this->get( 'TKT_ID' ); |
|
408 | + return $this->get('TKT_ID'); |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | * @return EE_Ticket_Template |
430 | 430 | */ |
431 | 431 | public function template() { |
432 | - return $this->get_first_related( 'Ticket_Template' ); |
|
432 | + return $this->get_first_related('Ticket_Template'); |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | * @return bool |
449 | 449 | */ |
450 | 450 | public function ticket_price() { |
451 | - return $this->get( 'TKT_price' ); |
|
451 | + return $this->get('TKT_price'); |
|
452 | 452 | } |
453 | 453 | |
454 | 454 | |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | * @return mixed |
458 | 458 | */ |
459 | 459 | public function pretty_price() { |
460 | - return $this->get_pretty( 'TKT_price' ); |
|
460 | + return $this->get_pretty('TKT_price'); |
|
461 | 461 | } |
462 | 462 | |
463 | 463 | |
@@ -476,17 +476,17 @@ discard block |
||
476 | 476 | * @param bool $no_cache |
477 | 477 | * @return float |
478 | 478 | */ |
479 | - public function get_ticket_total_with_taxes( $no_cache = FALSE ) { |
|
480 | - if ( ! isset( $this->_ticket_total_with_taxes ) || $no_cache ) { |
|
479 | + public function get_ticket_total_with_taxes($no_cache = FALSE) { |
|
480 | + if ( ! isset($this->_ticket_total_with_taxes) || $no_cache) { |
|
481 | 481 | $this->_ticket_total_with_taxes = $this->get_ticket_subtotal() + $this->get_ticket_taxes_total_for_admin(); |
482 | 482 | } |
483 | - return (float)$this->_ticket_total_with_taxes; |
|
483 | + return (float) $this->_ticket_total_with_taxes; |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | |
487 | 487 | |
488 | 488 | public function ensure_TKT_Price_correct() { |
489 | - $this->set( 'TKT_price', EE_Taxes::get_subtotal_for_admin( $this ) ); |
|
489 | + $this->set('TKT_price', EE_Taxes::get_subtotal_for_admin($this)); |
|
490 | 490 | $this->save(); |
491 | 491 | } |
492 | 492 | |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | * @return float |
497 | 497 | */ |
498 | 498 | public function get_ticket_subtotal() { |
499 | - return EE_Taxes::get_subtotal_for_admin( $this ); |
|
499 | + return EE_Taxes::get_subtotal_for_admin($this); |
|
500 | 500 | } |
501 | 501 | |
502 | 502 | |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | * @return float |
507 | 507 | */ |
508 | 508 | public function get_ticket_taxes_total_for_admin() { |
509 | - return EE_Taxes::get_total_taxes_for_admin( $this ); |
|
509 | + return EE_Taxes::get_total_taxes_for_admin($this); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | |
@@ -516,8 +516,8 @@ discard block |
||
516 | 516 | * @param string $name |
517 | 517 | * @return boolean |
518 | 518 | */ |
519 | - function set_name( $name ) { |
|
520 | - $this->set( 'TKT_name', $name ); |
|
519 | + function set_name($name) { |
|
520 | + $this->set('TKT_name', $name); |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | * @return string |
528 | 528 | */ |
529 | 529 | function description() { |
530 | - return $this->get( 'TKT_description' ); |
|
530 | + return $this->get('TKT_description'); |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | |
@@ -537,8 +537,8 @@ discard block |
||
537 | 537 | * @param string $description |
538 | 538 | * @return boolean |
539 | 539 | */ |
540 | - function set_description( $description ) { |
|
541 | - $this->set( 'TKT_description', $description ); |
|
540 | + function set_description($description) { |
|
541 | + $this->set('TKT_description', $description); |
|
542 | 542 | } |
543 | 543 | |
544 | 544 | |
@@ -549,8 +549,8 @@ discard block |
||
549 | 549 | * @param string $tm_frmt |
550 | 550 | * @return string |
551 | 551 | */ |
552 | - function start_date( $dt_frmt = '', $tm_frmt = '' ) { |
|
553 | - return $this->_get_datetime( 'TKT_start_date', $dt_frmt, $tm_frmt ); |
|
552 | + function start_date($dt_frmt = '', $tm_frmt = '') { |
|
553 | + return $this->_get_datetime('TKT_start_date', $dt_frmt, $tm_frmt); |
|
554 | 554 | } |
555 | 555 | |
556 | 556 | |
@@ -560,8 +560,8 @@ discard block |
||
560 | 560 | * @param string $start_date |
561 | 561 | * @return void |
562 | 562 | */ |
563 | - function set_start_date( $start_date ) { |
|
564 | - $this->_set_date_time( 'B', $start_date, 'TKT_start_date' ); |
|
563 | + function set_start_date($start_date) { |
|
564 | + $this->_set_date_time('B', $start_date, 'TKT_start_date'); |
|
565 | 565 | } |
566 | 566 | |
567 | 567 | |
@@ -572,8 +572,8 @@ discard block |
||
572 | 572 | * @param string $tm_frmt |
573 | 573 | * @return string |
574 | 574 | */ |
575 | - function end_date( $dt_frmt = '', $tm_frmt = '' ) { |
|
576 | - return $this->_get_datetime( 'TKT_end_date', $dt_frmt, $tm_frmt ); |
|
575 | + function end_date($dt_frmt = '', $tm_frmt = '') { |
|
576 | + return $this->_get_datetime('TKT_end_date', $dt_frmt, $tm_frmt); |
|
577 | 577 | } |
578 | 578 | |
579 | 579 | |
@@ -583,8 +583,8 @@ discard block |
||
583 | 583 | * @param string $end_date |
584 | 584 | * @return void |
585 | 585 | */ |
586 | - function set_end_date( $end_date ) { |
|
587 | - $this->_set_date_time( 'B', $end_date, 'TKT_end_date' ); |
|
586 | + function set_end_date($end_date) { |
|
587 | + $this->_set_date_time('B', $end_date, 'TKT_end_date'); |
|
588 | 588 | } |
589 | 589 | |
590 | 590 | |
@@ -596,8 +596,8 @@ discard block |
||
596 | 596 | * |
597 | 597 | * @param string $time a string representation of the sell until time (ex 9am or 7:30pm) |
598 | 598 | */ |
599 | - function set_end_time( $time ) { |
|
600 | - $this->_set_time_for( $time, 'TKT_end_date' ); |
|
599 | + function set_end_time($time) { |
|
600 | + $this->_set_time_for($time, 'TKT_end_date'); |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | |
@@ -607,8 +607,8 @@ discard block |
||
607 | 607 | * @param int $min |
608 | 608 | * @return boolean |
609 | 609 | */ |
610 | - function set_min( $min ) { |
|
611 | - $this->set( 'TKT_min', $min ); |
|
610 | + function set_min($min) { |
|
611 | + $this->set('TKT_min', $min); |
|
612 | 612 | } |
613 | 613 | |
614 | 614 | |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | * @return int |
619 | 619 | */ |
620 | 620 | function max() { |
621 | - return $this->get( 'TKT_max' ); |
|
621 | + return $this->get('TKT_max'); |
|
622 | 622 | } |
623 | 623 | |
624 | 624 | |
@@ -628,8 +628,8 @@ discard block |
||
628 | 628 | * @param int $max |
629 | 629 | * @return boolean |
630 | 630 | */ |
631 | - function set_max( $max ) { |
|
632 | - $this->set( 'TKT_max', $max ); |
|
631 | + function set_max($max) { |
|
632 | + $this->set('TKT_max', $max); |
|
633 | 633 | } |
634 | 634 | |
635 | 635 | |
@@ -639,8 +639,8 @@ discard block |
||
639 | 639 | * @param float $price |
640 | 640 | * @return boolean |
641 | 641 | */ |
642 | - function set_price( $price ) { |
|
643 | - $this->set( 'TKT_price', $price ); |
|
642 | + function set_price($price) { |
|
643 | + $this->set('TKT_price', $price); |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | * @return int |
651 | 651 | */ |
652 | 652 | function sold() { |
653 | - return $this->get_raw( 'TKT_sold' ); |
|
653 | + return $this->get_raw('TKT_sold'); |
|
654 | 654 | } |
655 | 655 | |
656 | 656 | |
@@ -660,10 +660,10 @@ discard block |
||
660 | 660 | * @param int $qty |
661 | 661 | * @return boolean |
662 | 662 | */ |
663 | - function increase_sold( $qty = 1 ) { |
|
663 | + function increase_sold($qty = 1) { |
|
664 | 664 | $sold = $this->sold() + $qty; |
665 | - $this->_increase_sold_for_datetimes( $qty ); |
|
666 | - return $this->set_sold( $sold ); |
|
665 | + $this->_increase_sold_for_datetimes($qty); |
|
666 | + return $this->set_sold($sold); |
|
667 | 667 | } |
668 | 668 | |
669 | 669 | |
@@ -673,12 +673,12 @@ discard block |
||
673 | 673 | * @param int $qty |
674 | 674 | * @return boolean |
675 | 675 | */ |
676 | - protected function _increase_sold_for_datetimes( $qty = 1 ) { |
|
676 | + protected function _increase_sold_for_datetimes($qty = 1) { |
|
677 | 677 | $datetimes = $this->datetimes(); |
678 | - if ( is_array( $datetimes ) ) { |
|
679 | - foreach ( $datetimes as $datetime ) { |
|
680 | - if ( $datetime instanceof EE_Datetime ) { |
|
681 | - $datetime->increase_sold( $qty ); |
|
678 | + if (is_array($datetimes)) { |
|
679 | + foreach ($datetimes as $datetime) { |
|
680 | + if ($datetime instanceof EE_Datetime) { |
|
681 | + $datetime->increase_sold($qty); |
|
682 | 682 | $datetime->save(); |
683 | 683 | } |
684 | 684 | } |
@@ -692,10 +692,10 @@ discard block |
||
692 | 692 | * @param int $sold |
693 | 693 | * @return boolean |
694 | 694 | */ |
695 | - function set_sold( $sold ) { |
|
695 | + function set_sold($sold) { |
|
696 | 696 | // sold can not go below zero |
697 | - $sold = max( 0, $sold ); |
|
698 | - $this->set( 'TKT_sold', $sold ); |
|
697 | + $sold = max(0, $sold); |
|
698 | + $this->set('TKT_sold', $sold); |
|
699 | 699 | } |
700 | 700 | |
701 | 701 | |
@@ -705,10 +705,10 @@ discard block |
||
705 | 705 | * @param int $qty |
706 | 706 | * @return boolean |
707 | 707 | */ |
708 | - function decrease_sold( $qty = 1 ) { |
|
708 | + function decrease_sold($qty = 1) { |
|
709 | 709 | $sold = $this->sold() - $qty; |
710 | - $this->_decrease_sold_for_datetimes( $qty ); |
|
711 | - return $this->set_sold( $sold ); |
|
710 | + $this->_decrease_sold_for_datetimes($qty); |
|
711 | + return $this->set_sold($sold); |
|
712 | 712 | } |
713 | 713 | |
714 | 714 | |
@@ -719,12 +719,12 @@ discard block |
||
719 | 719 | * @param int $qty |
720 | 720 | * @return boolean |
721 | 721 | */ |
722 | - protected function _decrease_sold_for_datetimes( $qty = 1 ) { |
|
722 | + protected function _decrease_sold_for_datetimes($qty = 1) { |
|
723 | 723 | $datetimes = $this->datetimes(); |
724 | - if ( is_array( $datetimes ) ) { |
|
725 | - foreach ( $datetimes as $datetime ) { |
|
726 | - if ( $datetime instanceof EE_Datetime ) { |
|
727 | - $datetime->decrease_sold( $qty ); |
|
724 | + if (is_array($datetimes)) { |
|
725 | + foreach ($datetimes as $datetime) { |
|
726 | + if ($datetime instanceof EE_Datetime) { |
|
727 | + $datetime->decrease_sold($qty); |
|
728 | 728 | $datetime->save(); |
729 | 729 | } |
730 | 730 | } |
@@ -745,14 +745,14 @@ discard block |
||
745 | 745 | * |
746 | 746 | * @return int |
747 | 747 | */ |
748 | - function qty( $context = '' ) { |
|
749 | - switch ( $context ) { |
|
748 | + function qty($context = '') { |
|
749 | + switch ($context) { |
|
750 | 750 | case 'reg_limit' : |
751 | 751 | return $this->real_quantity_on_ticket(); |
752 | 752 | case 'saleable' : |
753 | - return $this->real_quantity_on_ticket( 'saleable' ); |
|
753 | + return $this->real_quantity_on_ticket('saleable'); |
|
754 | 754 | default: |
755 | - return $this->get_raw( 'TKT_qty' ); |
|
755 | + return $this->get_raw('TKT_qty'); |
|
756 | 756 | } |
757 | 757 | } |
758 | 758 | |
@@ -769,38 +769,38 @@ discard block |
||
769 | 769 | * |
770 | 770 | * @return int |
771 | 771 | */ |
772 | - function real_quantity_on_ticket( $context = 'reg_limit' ) { |
|
772 | + function real_quantity_on_ticket($context = 'reg_limit') { |
|
773 | 773 | // start with the original db value for ticket quantity |
774 | - $raw = $this->get_raw( 'TKT_qty' ); |
|
774 | + $raw = $this->get_raw('TKT_qty'); |
|
775 | 775 | // return immediately if it's zero |
776 | - if ( $raw === 0 ) { |
|
776 | + if ($raw === 0) { |
|
777 | 777 | return $raw; |
778 | 778 | } |
779 | 779 | // ensure qty doesn't exceed raw value for THIS ticket |
780 | - $qty = min( EE_INF, $raw ); |
|
780 | + $qty = min(EE_INF, $raw); |
|
781 | 781 | // NOW that we know the maximum number of tickets available for the ticket |
782 | 782 | // we need to calculate the maximum number of tickets available for the datetime |
783 | 783 | // without really factoring this ticket into the calculations |
784 | 784 | $datetimes = $this->datetimes(); |
785 | - foreach ( $datetimes as $datetime ) { |
|
786 | - if ( $datetime instanceof EE_Datetime ) { |
|
785 | + foreach ($datetimes as $datetime) { |
|
786 | + if ($datetime instanceof EE_Datetime) { |
|
787 | 787 | // initialize with no restrictions for each datetime |
788 | 788 | // but adjust datetime qty based on datetime reg limit |
789 | - $datetime_qty = min( EE_INF, $datetime->reg_limit() ); |
|
789 | + $datetime_qty = min(EE_INF, $datetime->reg_limit()); |
|
790 | 790 | // if we want the actual saleable amount, then we need to consider OTHER ticket sales |
791 | 791 | // for this datetime, that do NOT include sales for this ticket (so we add THIS ticket's sales back in) |
792 | - if ( $context == 'saleable' ) { |
|
793 | - $datetime_qty = max( $datetime_qty - $datetime->sold() + $this->sold(), 0 ); |
|
792 | + if ($context == 'saleable') { |
|
793 | + $datetime_qty = max($datetime_qty - $datetime->sold() + $this->sold(), 0); |
|
794 | 794 | $datetime_qty = ! $datetime->sold_out() ? $datetime_qty : 0; |
795 | 795 | } |
796 | - $qty = min( $datetime_qty, $qty ); |
|
796 | + $qty = min($datetime_qty, $qty); |
|
797 | 797 | } |
798 | 798 | |
799 | 799 | } |
800 | 800 | // we need to factor in the details for this specific ticket |
801 | - if ( $qty > 0 && $context == 'saleable' ) { |
|
801 | + if ($qty > 0 && $context == 'saleable') { |
|
802 | 802 | // and subtract the sales for THIS ticket |
803 | - $qty = max( $qty - $this->sold(), 0 ); |
|
803 | + $qty = max($qty - $this->sold(), 0); |
|
804 | 804 | //echo ' $qty: ' . $qty . "<br />"; |
805 | 805 | } |
806 | 806 | //echo '$qty: ' . $qty . "<br />"; |
@@ -816,14 +816,14 @@ discard block |
||
816 | 816 | * @return bool |
817 | 817 | * @throws \EE_Error |
818 | 818 | */ |
819 | - function set_qty( $qty ) { |
|
819 | + function set_qty($qty) { |
|
820 | 820 | $datetimes = $this->datetimes(); |
821 | - foreach ( $datetimes as $datetime ) { |
|
822 | - if ( $datetime instanceof EE_Datetime ) { |
|
823 | - $qty = min( $qty, $datetime->reg_limit() ); |
|
821 | + foreach ($datetimes as $datetime) { |
|
822 | + if ($datetime instanceof EE_Datetime) { |
|
823 | + $qty = min($qty, $datetime->reg_limit()); |
|
824 | 824 | } |
825 | 825 | } |
826 | - $this->set( 'TKT_qty', $qty ); |
|
826 | + $this->set('TKT_qty', $qty); |
|
827 | 827 | } |
828 | 828 | |
829 | 829 | |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | * @return int |
834 | 834 | */ |
835 | 835 | function uses() { |
836 | - return $this->get( 'TKT_uses' ); |
|
836 | + return $this->get('TKT_uses'); |
|
837 | 837 | } |
838 | 838 | |
839 | 839 | |
@@ -843,8 +843,8 @@ discard block |
||
843 | 843 | * @param int $uses |
844 | 844 | * @return boolean |
845 | 845 | */ |
846 | - function set_uses( $uses ) { |
|
847 | - $this->set( 'TKT_uses', $uses ); |
|
846 | + function set_uses($uses) { |
|
847 | + $this->set('TKT_uses', $uses); |
|
848 | 848 | } |
849 | 849 | |
850 | 850 | |
@@ -854,7 +854,7 @@ discard block |
||
854 | 854 | * @return boolean |
855 | 855 | */ |
856 | 856 | public function required() { |
857 | - return $this->get( 'TKT_required' ); |
|
857 | + return $this->get('TKT_required'); |
|
858 | 858 | } |
859 | 859 | |
860 | 860 | |
@@ -864,8 +864,8 @@ discard block |
||
864 | 864 | * @param boolean $required |
865 | 865 | * @return boolean |
866 | 866 | */ |
867 | - public function set_required( $required ) { |
|
868 | - $this->set( 'TKT_required', $required ); |
|
867 | + public function set_required($required) { |
|
868 | + $this->set('TKT_required', $required); |
|
869 | 869 | } |
870 | 870 | |
871 | 871 | |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | * @return boolean |
876 | 876 | */ |
877 | 877 | function taxable() { |
878 | - return $this->get( 'TKT_taxable' ); |
|
878 | + return $this->get('TKT_taxable'); |
|
879 | 879 | } |
880 | 880 | |
881 | 881 | |
@@ -885,8 +885,8 @@ discard block |
||
885 | 885 | * @param boolean $taxable |
886 | 886 | * @return boolean |
887 | 887 | */ |
888 | - function set_taxable( $taxable ) { |
|
889 | - $this->set( 'TKT_taxable', $taxable ); |
|
888 | + function set_taxable($taxable) { |
|
889 | + $this->set('TKT_taxable', $taxable); |
|
890 | 890 | } |
891 | 891 | |
892 | 892 | |
@@ -896,7 +896,7 @@ discard block |
||
896 | 896 | * @return boolean |
897 | 897 | */ |
898 | 898 | function is_default() { |
899 | - return $this->get( 'TKT_is_default' ); |
|
899 | + return $this->get('TKT_is_default'); |
|
900 | 900 | } |
901 | 901 | |
902 | 902 | |
@@ -906,8 +906,8 @@ discard block |
||
906 | 906 | * @param boolean $is_default |
907 | 907 | * @return boolean |
908 | 908 | */ |
909 | - function set_is_default( $is_default ) { |
|
910 | - $this->set( 'TKT_is_default', $is_default ); |
|
909 | + function set_is_default($is_default) { |
|
910 | + $this->set('TKT_is_default', $is_default); |
|
911 | 911 | } |
912 | 912 | |
913 | 913 | |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | * @return int |
918 | 918 | */ |
919 | 919 | function order() { |
920 | - return $this->get( 'TKT_order' ); |
|
920 | + return $this->get('TKT_order'); |
|
921 | 921 | } |
922 | 922 | |
923 | 923 | |
@@ -927,8 +927,8 @@ discard block |
||
927 | 927 | * @param int $order |
928 | 928 | * @return boolean |
929 | 929 | */ |
930 | - function set_order( $order ) { |
|
931 | - $this->set( 'TKT_order', $order ); |
|
930 | + function set_order($order) { |
|
931 | + $this->set('TKT_order', $order); |
|
932 | 932 | } |
933 | 933 | |
934 | 934 | |
@@ -938,7 +938,7 @@ discard block |
||
938 | 938 | * @return int |
939 | 939 | */ |
940 | 940 | function row() { |
941 | - return $this->get( 'TKT_row' ); |
|
941 | + return $this->get('TKT_row'); |
|
942 | 942 | } |
943 | 943 | |
944 | 944 | |
@@ -948,8 +948,8 @@ discard block |
||
948 | 948 | * @param int $row |
949 | 949 | * @return boolean |
950 | 950 | */ |
951 | - function set_row( $row ) { |
|
952 | - $this->set( 'TKT_row', $row ); |
|
951 | + function set_row($row) { |
|
952 | + $this->set('TKT_row', $row); |
|
953 | 953 | } |
954 | 954 | |
955 | 955 | |
@@ -959,7 +959,7 @@ discard block |
||
959 | 959 | * @return boolean |
960 | 960 | */ |
961 | 961 | function deleted() { |
962 | - return $this->get( 'TKT_deleted' ); |
|
962 | + return $this->get('TKT_deleted'); |
|
963 | 963 | } |
964 | 964 | |
965 | 965 | |
@@ -969,8 +969,8 @@ discard block |
||
969 | 969 | * @param boolean $deleted |
970 | 970 | * @return boolean |
971 | 971 | */ |
972 | - function set_deleted( $deleted ) { |
|
973 | - $this->set( 'TKT_deleted', $deleted ); |
|
972 | + function set_deleted($deleted) { |
|
973 | + $this->set('TKT_deleted', $deleted); |
|
974 | 974 | } |
975 | 975 | |
976 | 976 | |
@@ -980,7 +980,7 @@ discard block |
||
980 | 980 | * @return int |
981 | 981 | */ |
982 | 982 | function parent_ID() { |
983 | - return $this->get( 'TKT_parent' ); |
|
983 | + return $this->get('TKT_parent'); |
|
984 | 984 | } |
985 | 985 | |
986 | 986 | |
@@ -990,8 +990,8 @@ discard block |
||
990 | 990 | * @param int $parent |
991 | 991 | * @return boolean |
992 | 992 | */ |
993 | - function set_parent_ID( $parent ) { |
|
994 | - $this->set( 'TKT_parent', $parent ); |
|
993 | + function set_parent_ID($parent) { |
|
994 | + $this->set('TKT_parent', $parent); |
|
995 | 995 | } |
996 | 996 | |
997 | 997 | |
@@ -1002,10 +1002,10 @@ discard block |
||
1002 | 1002 | */ |
1003 | 1003 | function name_and_info() { |
1004 | 1004 | $times = array(); |
1005 | - foreach ( $this->datetimes() as $datetime ) { |
|
1005 | + foreach ($this->datetimes() as $datetime) { |
|
1006 | 1006 | $times[] = $datetime->start_date_and_time(); |
1007 | 1007 | } |
1008 | - return $this->name() . " @ " . implode( ", ", $times ) . " for " . $this->price(); |
|
1008 | + return $this->name()." @ ".implode(", ", $times)." for ".$this->price(); |
|
1009 | 1009 | } |
1010 | 1010 | |
1011 | 1011 | |
@@ -1015,7 +1015,7 @@ discard block |
||
1015 | 1015 | * @return string |
1016 | 1016 | */ |
1017 | 1017 | function name() { |
1018 | - return $this->get( 'TKT_name' ); |
|
1018 | + return $this->get('TKT_name'); |
|
1019 | 1019 | } |
1020 | 1020 | |
1021 | 1021 | |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | * @return float |
1026 | 1026 | */ |
1027 | 1027 | function price() { |
1028 | - return $this->get( 'TKT_price' ); |
|
1028 | + return $this->get('TKT_price'); |
|
1029 | 1029 | } |
1030 | 1030 | |
1031 | 1031 | |
@@ -1035,8 +1035,8 @@ discard block |
||
1035 | 1035 | * @param array $query_params like EEM_Base::get_all's |
1036 | 1036 | * @return EE_Registration[] |
1037 | 1037 | */ |
1038 | - public function registrations( $query_params = array() ) { |
|
1039 | - return $this->get_many_related( 'Registration', $query_params ); |
|
1038 | + public function registrations($query_params = array()) { |
|
1039 | + return $this->get_many_related('Registration', $query_params); |
|
1040 | 1040 | } |
1041 | 1041 | |
1042 | 1042 | |
@@ -1047,8 +1047,8 @@ discard block |
||
1047 | 1047 | * @return int |
1048 | 1048 | */ |
1049 | 1049 | public function update_tickets_sold() { |
1050 | - $count_regs_for_this_ticket = $this->count_registrations( array( array( 'STS_ID' => EEM_Registration::status_id_approved, 'REG_deleted' => 0 ) ) ); |
|
1051 | - $this->set_sold( $count_regs_for_this_ticket ); |
|
1050 | + $count_regs_for_this_ticket = $this->count_registrations(array(array('STS_ID' => EEM_Registration::status_id_approved, 'REG_deleted' => 0))); |
|
1051 | + $this->set_sold($count_regs_for_this_ticket); |
|
1052 | 1052 | $this->save(); |
1053 | 1053 | return $count_regs_for_this_ticket; |
1054 | 1054 | } |
@@ -1060,7 +1060,7 @@ discard block |
||
1060 | 1060 | * @param array $query_params like EEM_Base::get_all's |
1061 | 1061 | * @return int |
1062 | 1062 | */ |
1063 | - public function count_registrations( $query_params = array() ) { |
|
1063 | + public function count_registrations($query_params = array()) { |
|
1064 | 1064 | return $this->count_related('Registration', $query_params); |
1065 | 1065 | } |
1066 | 1066 | |
@@ -1085,7 +1085,7 @@ discard block |
||
1085 | 1085 | public function get_related_event() { |
1086 | 1086 | //get one datetime to use for getting the event |
1087 | 1087 | $datetime = $this->first_datetime(); |
1088 | - if ( $datetime instanceof EE_Datetime ) { |
|
1088 | + if ($datetime instanceof EE_Datetime) { |
|
1089 | 1089 | return $datetime->event(); |
1090 | 1090 | } |
1091 | 1091 | return null; |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | * This returns the chronologically last datetime that this ticket is associated with |
240 | 240 | * @param string $dt_frmt |
241 | 241 | * @param string $conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31 |
242 | - * @return array |
|
242 | + * @return string |
|
243 | 243 | */ |
244 | 244 | public function date_range( $dt_frmt = '', $conjunction = ' - ' ) { |
245 | 245 | $first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date( $dt_frmt ) : ''; |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | /** |
381 | 381 | * Gets all the ticket applicabilities (ie, relations between datetimes and tickets) |
382 | 382 | * @param array $query_params see EEM_Base::get_all() |
383 | - * @return EE_Datetime_Ticket |
|
383 | + * @return EE_Base_Class[] |
|
384 | 384 | */ |
385 | 385 | public function datetime_tickets( $query_params = array() ) { |
386 | 386 | return $this->get_many_related( 'Datetime_Ticket', $query_params ); |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | /** |
515 | 515 | * Sets name |
516 | 516 | * @param string $name |
517 | - * @return boolean |
|
517 | + * @return boolean|null |
|
518 | 518 | */ |
519 | 519 | function set_name( $name ) { |
520 | 520 | $this->set( 'TKT_name', $name ); |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | /** |
536 | 536 | * Sets description |
537 | 537 | * @param string $description |
538 | - * @return boolean |
|
538 | + * @return boolean|null |
|
539 | 539 | */ |
540 | 540 | function set_description( $description ) { |
541 | 541 | $this->set( 'TKT_description', $description ); |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | /** |
606 | 606 | * Sets min |
607 | 607 | * @param int $min |
608 | - * @return boolean |
|
608 | + * @return boolean|null |
|
609 | 609 | */ |
610 | 610 | function set_min( $min ) { |
611 | 611 | $this->set( 'TKT_min', $min ); |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | /** |
627 | 627 | * Sets max |
628 | 628 | * @param int $max |
629 | - * @return boolean |
|
629 | + * @return boolean|null |
|
630 | 630 | */ |
631 | 631 | function set_max( $max ) { |
632 | 632 | $this->set( 'TKT_max', $max ); |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | /** |
638 | 638 | * Sets price |
639 | 639 | * @param float $price |
640 | - * @return boolean |
|
640 | + * @return boolean|null |
|
641 | 641 | */ |
642 | 642 | function set_price( $price ) { |
643 | 643 | $this->set( 'TKT_price', $price ); |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | /** |
659 | 659 | * increments sold by amount passed by $qty |
660 | 660 | * @param int $qty |
661 | - * @return boolean |
|
661 | + * @return boolean|null |
|
662 | 662 | */ |
663 | 663 | function increase_sold( $qty = 1 ) { |
664 | 664 | $sold = $this->sold() + $qty; |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | /** |
672 | 672 | * Increases sold on related datetimes |
673 | 673 | * @param int $qty |
674 | - * @return boolean |
|
674 | + * @return boolean|null |
|
675 | 675 | */ |
676 | 676 | protected function _increase_sold_for_datetimes( $qty = 1 ) { |
677 | 677 | $datetimes = $this->datetimes(); |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | /** |
691 | 691 | * Sets sold |
692 | 692 | * @param int $sold |
693 | - * @return boolean |
|
693 | + * @return boolean|null |
|
694 | 694 | */ |
695 | 695 | function set_sold( $sold ) { |
696 | 696 | // sold can not go below zero |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | /** |
704 | 704 | * decrements (subtracts) sold by amount passed by $qty |
705 | 705 | * @param int $qty |
706 | - * @return boolean |
|
706 | + * @return boolean|null |
|
707 | 707 | */ |
708 | 708 | function decrease_sold( $qty = 1 ) { |
709 | 709 | $sold = $this->sold() - $qty; |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | * Decreases sold on related datetimes |
718 | 718 | * |
719 | 719 | * @param int $qty |
720 | - * @return boolean |
|
720 | + * @return boolean|null |
|
721 | 721 | */ |
722 | 722 | protected function _decrease_sold_for_datetimes( $qty = 1 ) { |
723 | 723 | $datetimes = $this->datetimes(); |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | * Sets qty - IMPORTANT!!! Does NOT allow QTY to be set higher than the lowest reg limit of any related datetimes |
814 | 814 | * |
815 | 815 | * @param int $qty |
816 | - * @return bool |
|
816 | + * @return boolean|null |
|
817 | 817 | * @throws \EE_Error |
818 | 818 | */ |
819 | 819 | function set_qty( $qty ) { |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | /** |
842 | 842 | * Sets uses |
843 | 843 | * @param int $uses |
844 | - * @return boolean |
|
844 | + * @return boolean|null |
|
845 | 845 | */ |
846 | 846 | function set_uses( $uses ) { |
847 | 847 | $this->set( 'TKT_uses', $uses ); |
@@ -862,7 +862,7 @@ discard block |
||
862 | 862 | /** |
863 | 863 | * sets the TKT_required property |
864 | 864 | * @param boolean $required |
865 | - * @return boolean |
|
865 | + * @return boolean|null |
|
866 | 866 | */ |
867 | 867 | public function set_required( $required ) { |
868 | 868 | $this->set( 'TKT_required', $required ); |
@@ -883,7 +883,7 @@ discard block |
||
883 | 883 | /** |
884 | 884 | * Sets taxable |
885 | 885 | * @param boolean $taxable |
886 | - * @return boolean |
|
886 | + * @return boolean|null |
|
887 | 887 | */ |
888 | 888 | function set_taxable( $taxable ) { |
889 | 889 | $this->set( 'TKT_taxable', $taxable ); |
@@ -904,7 +904,7 @@ discard block |
||
904 | 904 | /** |
905 | 905 | * Sets is_default |
906 | 906 | * @param boolean $is_default |
907 | - * @return boolean |
|
907 | + * @return boolean|null |
|
908 | 908 | */ |
909 | 909 | function set_is_default( $is_default ) { |
910 | 910 | $this->set( 'TKT_is_default', $is_default ); |
@@ -925,7 +925,7 @@ discard block |
||
925 | 925 | /** |
926 | 926 | * Sets order |
927 | 927 | * @param int $order |
928 | - * @return boolean |
|
928 | + * @return boolean|null |
|
929 | 929 | */ |
930 | 930 | function set_order( $order ) { |
931 | 931 | $this->set( 'TKT_order', $order ); |
@@ -946,7 +946,7 @@ discard block |
||
946 | 946 | /** |
947 | 947 | * Sets row |
948 | 948 | * @param int $row |
949 | - * @return boolean |
|
949 | + * @return boolean|null |
|
950 | 950 | */ |
951 | 951 | function set_row( $row ) { |
952 | 952 | $this->set( 'TKT_row', $row ); |
@@ -967,7 +967,7 @@ discard block |
||
967 | 967 | /** |
968 | 968 | * Sets deleted |
969 | 969 | * @param boolean $deleted |
970 | - * @return boolean |
|
970 | + * @return boolean|null |
|
971 | 971 | */ |
972 | 972 | function set_deleted( $deleted ) { |
973 | 973 | $this->set( 'TKT_deleted', $deleted ); |
@@ -988,7 +988,7 @@ discard block |
||
988 | 988 | /** |
989 | 989 | * Sets parent |
990 | 990 | * @param int $parent |
991 | - * @return boolean |
|
991 | + * @return boolean|null |
|
992 | 992 | */ |
993 | 993 | function set_parent_ID( $parent ) { |
994 | 994 | $this->set( 'TKT_parent', $parent ); |
@@ -714,11 +714,11 @@ |
||
714 | 714 | |
715 | 715 | |
716 | 716 | /** |
717 | - * Decreases sold on related datetimes |
|
718 | - * |
|
719 | - * @param int $qty |
|
720 | - * @return boolean |
|
721 | - */ |
|
717 | + * Decreases sold on related datetimes |
|
718 | + * |
|
719 | + * @param int $qty |
|
720 | + * @return boolean |
|
721 | + */ |
|
722 | 722 | protected function _decrease_sold_for_datetimes( $qty = 1 ) { |
723 | 723 | $datetimes = $this->datetimes(); |
724 | 724 | if ( is_array( $datetimes ) ) { |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @param string $timezone |
36 | 36 | * @return EE_Ticket_Price|mixed |
37 | 37 | */ |
38 | - public static function new_instance( $props_n_values = array(), $timezone = '', $date_formats = array() ) { |
|
39 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
40 | - return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone, $date_formats ); |
|
38 | + public static function new_instance($props_n_values = array(), $timezone = '', $date_formats = array()) { |
|
39 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
40 | + return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone, $date_formats); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | * @param string $timezone |
48 | 48 | * @return EE_Ticket_Price |
49 | 49 | */ |
50 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = '' ) { |
|
51 | - return new self( $props_n_values, TRUE, $timezone ); |
|
50 | + public static function new_instance_from_db($props_n_values = array(), $timezone = '') { |
|
51 | + return new self($props_n_values, TRUE, $timezone); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 |