@@ -1,30 +1,30 @@ |
||
1 | 1 | <?php if (!defined('EVENT_ESPRESSO_VERSION') ) |
2 | 2 | exit('NO direct script access allowed'); |
3 | 3 | /** |
4 | - * Event Espresso |
|
5 | - * |
|
6 | - * Event Registration and Management Plugin for Wordpress |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @author Seth Shoultes |
|
10 | - * @copyright (c)2009-2012 Event Espresso All Rights Reserved. |
|
11 | - * @license @link http://eventespresso.com/support/terms-conditions/ ** see Plugin Licensing * * |
|
12 | - * @link http://www.eventespresso.com |
|
13 | - * @version 4.1 |
|
14 | - * |
|
15 | - * ------------------------------------------------------------------------ |
|
16 | - * |
|
17 | - * EEM_Message_Template |
|
18 | - * |
|
19 | - * |
|
20 | - * |
|
21 | - * @package Event Espresso |
|
22 | - * @subpackage includes/models/EEM_Message_Template.model.php |
|
23 | - * @author Darren Ethier |
|
24 | - * |
|
25 | - * |
|
26 | - * ------------------------------------------------------------------------ |
|
27 | - */ |
|
4 | + * Event Espresso |
|
5 | + * |
|
6 | + * Event Registration and Management Plugin for Wordpress |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @author Seth Shoultes |
|
10 | + * @copyright (c)2009-2012 Event Espresso All Rights Reserved. |
|
11 | + * @license @link http://eventespresso.com/support/terms-conditions/ ** see Plugin Licensing * * |
|
12 | + * @link http://www.eventespresso.com |
|
13 | + * @version 4.1 |
|
14 | + * |
|
15 | + * ------------------------------------------------------------------------ |
|
16 | + * |
|
17 | + * EEM_Message_Template |
|
18 | + * |
|
19 | + * |
|
20 | + * |
|
21 | + * @package Event Espresso |
|
22 | + * @subpackage includes/models/EEM_Message_Template.model.php |
|
23 | + * @author Darren Ethier |
|
24 | + * |
|
25 | + * |
|
26 | + * ------------------------------------------------------------------------ |
|
27 | + */ |
|
28 | 28 | class EEM_Message_Template extends EEM_Base { |
29 | 29 | //private instance of the EEM_Message_Template object |
30 | 30 | protected static $_instance = NULL; |
@@ -1,5 +1,6 @@ |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
1 | +<?php if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
2 | 2 | exit('NO direct script access allowed'); |
3 | +} |
|
3 | 4 | /** |
4 | 5 | * Event Espresso |
5 | 6 | * |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
2 | 2 | exit('NO direct script access allowed'); |
3 | 3 | /** |
4 | 4 | * Event Espresso |
@@ -36,19 +36,19 @@ discard block |
||
36 | 36 | * @access protected |
37 | 37 | * @return void |
38 | 38 | */ |
39 | - protected function __construct( $timezone = NULL ) { |
|
40 | - $this->singular_item = __('Message Template','event_espresso'); |
|
41 | - $this->plural_item = __('Message Templates','event_espresso'); |
|
39 | + protected function __construct($timezone = NULL) { |
|
40 | + $this->singular_item = __('Message Template', 'event_espresso'); |
|
41 | + $this->plural_item = __('Message Templates', 'event_espresso'); |
|
42 | 42 | |
43 | 43 | $this->_tables = array( |
44 | - 'Message_Template' => new EE_Primary_Table('esp_message_template', 'MTP_ID' ) |
|
44 | + 'Message_Template' => new EE_Primary_Table('esp_message_template', 'MTP_ID') |
|
45 | 45 | ); |
46 | 46 | $this->_fields = array( |
47 | 47 | 'Message_Template'=> array( |
48 | 48 | 'MTP_ID'=> new EE_Primary_Key_Int_Field('MTP_ID', __('Message Template ID', 'event_espresso')), |
49 | - 'GRP_ID' => new EE_Foreign_Key_Int_Field('GRP_ID', __('Message Template Group ID', 'event_espresso'), FALSE, 0, 'Message_Template_Group' ), |
|
50 | - 'MTP_template_field'=>new EE_Plain_Text_Field('MTP_template_field', __('Field Name for this Template', 'event_espresso'), false, 'default' ), |
|
51 | - 'MTP_context'=>new EE_Plain_Text_Field('MTP_context', __('Message Type Context for this field', 'event_espresso'),false,'admin' ), |
|
49 | + 'GRP_ID' => new EE_Foreign_Key_Int_Field('GRP_ID', __('Message Template Group ID', 'event_espresso'), FALSE, 0, 'Message_Template_Group'), |
|
50 | + 'MTP_template_field'=>new EE_Plain_Text_Field('MTP_template_field', __('Field Name for this Template', 'event_espresso'), false, 'default'), |
|
51 | + 'MTP_context'=>new EE_Plain_Text_Field('MTP_context', __('Message Type Context for this field', 'event_espresso'), false, 'admin'), |
|
52 | 52 | 'MTP_content'=>new EE_Serialized_Text_Field('MTP_content', __('The field content for the template', 'event_espresso'), false, ''), |
53 | 53 | ) |
54 | 54 | ); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | 'Message_Template_Group' => new EE_Belongs_To_Relation() |
58 | 58 | ); |
59 | 59 | $this->_model_chain_to_wp_user = 'Message_Template_Group'; |
60 | - parent::__construct( $timezone ); |
|
60 | + parent::__construct($timezone); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | public function localized_status( $statuses, $plural = FALSE, $schema = 'upper' ) { |
79 | 79 | //note these are all in lower case because ucwords() on upper case will NOT convert. |
80 | 80 | $translation_array = array( |
81 | - EEM_Registration::status_id_pending_payment => array( |
|
81 | + EEM_Registration::status_id_pending_payment => array( |
|
82 | 82 | __('pending payment', 'event_espresso'), //singular |
83 | 83 | __('pending payments', 'event_espresso') //plural |
84 | 84 | ), |
@@ -203,37 +203,37 @@ discard block |
||
203 | 203 | __('postponed', 'event_espresso'), |
204 | 204 | __('postponed', 'event_espresso') |
205 | 205 | ) |
206 | - ); |
|
206 | + ); |
|
207 | 207 | |
208 | 208 | $translation_array = apply_filters( 'FHEE__EEM_Status__localized_status__translation_array', $translation_array ); |
209 | 209 | |
210 | 210 | if ( !is_array($statuses) ) |
211 | 211 | throw new EE_Error( __('The incoming statuses argument must be an array with keys as the $status_id and values as the $status_code', 'event_espresso') ); |
212 | 212 | |
213 | - $translation = array(); |
|
213 | + $translation = array(); |
|
214 | 214 | |
215 | - foreach ( $statuses as $id => $code ) { |
|
216 | - if ( isset( $translation_array[$id] ) ) { |
|
217 | - $translation[$id] = $plural ? $translation_array[$id][1] : $translation_array[$id][0]; |
|
218 | - } else { |
|
219 | - $translation[$id] = $code; |
|
220 | - } |
|
215 | + foreach ( $statuses as $id => $code ) { |
|
216 | + if ( isset( $translation_array[$id] ) ) { |
|
217 | + $translation[$id] = $plural ? $translation_array[$id][1] : $translation_array[$id][0]; |
|
218 | + } else { |
|
219 | + $translation[$id] = $code; |
|
220 | + } |
|
221 | 221 | |
222 | - //schema |
|
223 | - switch ( $schema ) { |
|
224 | - case 'lower' : |
|
225 | - $translation[$id] = strtolower( $translation[$id] ); //even though these start in lower case, this will catch any statuses added via filter. |
|
226 | - break; |
|
227 | - case 'sentence' : |
|
228 | - $translation[$id] = ucwords( $translation[$id] ); |
|
229 | - break; |
|
230 | - case 'upper' : |
|
231 | - $translation[$id] = strtoupper( $translation[$id] ); |
|
232 | - break; |
|
233 | - } |
|
234 | - } |
|
222 | + //schema |
|
223 | + switch ( $schema ) { |
|
224 | + case 'lower' : |
|
225 | + $translation[$id] = strtolower( $translation[$id] ); //even though these start in lower case, this will catch any statuses added via filter. |
|
226 | + break; |
|
227 | + case 'sentence' : |
|
228 | + $translation[$id] = ucwords( $translation[$id] ); |
|
229 | + break; |
|
230 | + case 'upper' : |
|
231 | + $translation[$id] = strtoupper( $translation[$id] ); |
|
232 | + break; |
|
233 | + } |
|
234 | + } |
|
235 | 235 | |
236 | - return $translation; |
|
236 | + return $translation; |
|
237 | 237 | } |
238 | 238 | |
239 | 239 |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -207,8 +209,9 @@ discard block |
||
207 | 209 | |
208 | 210 | $translation_array = apply_filters( 'FHEE__EEM_Status__localized_status__translation_array', $translation_array ); |
209 | 211 | |
210 | - if ( !is_array($statuses) ) |
|
211 | - throw new EE_Error( __('The incoming statuses argument must be an array with keys as the $status_id and values as the $status_code', 'event_espresso') ); |
|
212 | + if ( !is_array($statuses) ) { |
|
213 | + throw new EE_Error( __('The incoming statuses argument must be an array with keys as the $status_id and values as the $status_code', 'event_espresso') ); |
|
214 | + } |
|
212 | 215 | |
213 | 216 | $translation = array(); |
214 | 217 |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * |
14 | 14 | * ------------------------------------------------------------------------ |
15 | 15 | */ |
16 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
16 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
17 | 17 | /** |
18 | 18 | * |
19 | 19 | * Class EEM_Status |
@@ -32,27 +32,27 @@ discard block |
||
32 | 32 | /** |
33 | 33 | * @return EEM_Status |
34 | 34 | */ |
35 | - protected function __construct( $timezone = NULL ) { |
|
36 | - $this->singular_item = __('Status','event_espresso'); |
|
37 | - $this->plural_item = __('Stati','event_espresso'); |
|
35 | + protected function __construct($timezone = NULL) { |
|
36 | + $this->singular_item = __('Status', 'event_espresso'); |
|
37 | + $this->plural_item = __('Stati', 'event_espresso'); |
|
38 | 38 | $this->_tables = array( |
39 | 39 | 'Status'=> new EE_Primary_Table('esp_status', 'STS_ID') |
40 | 40 | ); |
41 | 41 | $this->_fields = array( |
42 | 42 | 'Status'=>array( |
43 | - 'STS_ID'=> new EE_Primary_Key_String_Field('STS_ID', __('Status ID','event_espresso')), |
|
44 | - 'STS_code'=>new EE_Plain_Text_Field('STS_code',__('Status Code','event_espresso'),false, ''), |
|
43 | + 'STS_ID'=> new EE_Primary_Key_String_Field('STS_ID', __('Status ID', 'event_espresso')), |
|
44 | + 'STS_code'=>new EE_Plain_Text_Field('STS_code', __('Status Code', 'event_espresso'), false, ''), |
|
45 | 45 | 'STS_type'=>new EE_Enum_Text_Field('STS_type', __("Type", "event_espresso"), false, 'event', |
46 | 46 | array( |
47 | - 'event'=> __("Event", "event_espresso"),//deprecated |
|
47 | + 'event'=> __("Event", "event_espresso"), //deprecated |
|
48 | 48 | 'registration'=> __("Registration", "event_espresso"), |
49 | 49 | 'transaction'=> __("Transaction", "event_espresso"), |
50 | 50 | 'payment'=> __("Payment", "event_espresso"), |
51 | 51 | 'email'=> __("Email", "event_espresso") |
52 | 52 | )), |
53 | - 'STS_can_edit'=>new EE_Boolean_Field('STS_can_edit', __('Editable?','event_espresso'), false), |
|
53 | + 'STS_can_edit'=>new EE_Boolean_Field('STS_can_edit', __('Editable?', 'event_espresso'), false), |
|
54 | 54 | 'STS_desc'=>new EE_Simple_HTML_Field('STS_desc', __("Description", "event_espresso"), false, ''), |
55 | - 'STS_open'=>new EE_Boolean_Field('STS_open', __("Open?", "event_espresso"), false,false) |
|
55 | + 'STS_open'=>new EE_Boolean_Field('STS_open', __("Open?", "event_espresso"), false, false) |
|
56 | 56 | )); |
57 | 57 | $this->_model_relations = array( |
58 | 58 | 'Registration'=>new EE_Has_Many_Relation(), |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | 'Payment'=>new EE_Has_Many_Relation() |
61 | 61 | ); |
62 | 62 | |
63 | - parent::__construct( $timezone ); |
|
63 | + parent::__construct($timezone); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @throws EE_Error |
74 | 74 | * @return array an array of translated strings for the incoming status id. |
75 | 75 | */ |
76 | - public function localized_status( $statuses, $plural = FALSE, $schema = 'upper' ) { |
|
76 | + public function localized_status($statuses, $plural = FALSE, $schema = 'upper') { |
|
77 | 77 | //note these are all in lower case because ucwords() on upper case will NOT convert. |
78 | 78 | $translation_array = array( |
79 | 79 | EEM_Registration::status_id_pending_payment => array( |
@@ -203,30 +203,30 @@ discard block |
||
203 | 203 | ) |
204 | 204 | ); |
205 | 205 | |
206 | - $translation_array = apply_filters( 'FHEE__EEM_Status__localized_status__translation_array', $translation_array ); |
|
206 | + $translation_array = apply_filters('FHEE__EEM_Status__localized_status__translation_array', $translation_array); |
|
207 | 207 | |
208 | - if ( !is_array($statuses) ) |
|
209 | - throw new EE_Error( __('The incoming statuses argument must be an array with keys as the $status_id and values as the $status_code', 'event_espresso') ); |
|
208 | + if ( ! is_array($statuses)) |
|
209 | + throw new EE_Error(__('The incoming statuses argument must be an array with keys as the $status_id and values as the $status_code', 'event_espresso')); |
|
210 | 210 | |
211 | 211 | $translation = array(); |
212 | 212 | |
213 | - foreach ( $statuses as $id => $code ) { |
|
214 | - if ( isset( $translation_array[$id] ) ) { |
|
213 | + foreach ($statuses as $id => $code) { |
|
214 | + if (isset($translation_array[$id])) { |
|
215 | 215 | $translation[$id] = $plural ? $translation_array[$id][1] : $translation_array[$id][0]; |
216 | 216 | } else { |
217 | 217 | $translation[$id] = $code; |
218 | 218 | } |
219 | 219 | |
220 | 220 | //schema |
221 | - switch ( $schema ) { |
|
221 | + switch ($schema) { |
|
222 | 222 | case 'lower' : |
223 | - $translation[$id] = strtolower( $translation[$id] ); //even though these start in lower case, this will catch any statuses added via filter. |
|
223 | + $translation[$id] = strtolower($translation[$id]); //even though these start in lower case, this will catch any statuses added via filter. |
|
224 | 224 | break; |
225 | 225 | case 'sentence' : |
226 | - $translation[$id] = ucwords( $translation[$id] ); |
|
226 | + $translation[$id] = ucwords($translation[$id]); |
|
227 | 227 | break; |
228 | 228 | case 'upper' : |
229 | - $translation[$id] = strtoupper( $translation[$id] ); |
|
229 | + $translation[$id] = strtoupper($translation[$id]); |
|
230 | 230 | break; |
231 | 231 | } |
232 | 232 | } |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -131,8 +133,9 @@ discard block |
||
131 | 133 | 'tickets_remaining'=>array('Ticket.TKT_qty-Ticket.TKT_sold','%d'),//note! calculations based on TKT_qty are dangerous because -1 means infinity in the db! |
132 | 134 | 'initially_available'=>array('Ticket.TKT_qty','%d'))); |
133 | 135 | |
134 | - if ( empty( $remaining_per_ticket ) ) |
|
135 | - return FALSE; |
|
136 | + if ( empty( $remaining_per_ticket ) ) { |
|
137 | + return FALSE; |
|
138 | + } |
|
136 | 139 | |
137 | 140 | |
138 | 141 | foreach($remaining_per_ticket as $remaining){ |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | * |
22 | 22 | * ------------------------------------------------------------------------ |
23 | 23 | */ |
24 | -require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
|
25 | -require_once ( EE_CLASSES . 'EE_Ticket.class.php' ); |
|
24 | +require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
25 | +require_once (EE_CLASSES.'EE_Ticket.class.php'); |
|
26 | 26 | |
27 | 27 | class EEM_Ticket extends EEM_Soft_Delete_Base { |
28 | 28 | |
@@ -36,35 +36,35 @@ discard block |
||
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 | * @return void |
38 | 38 | */ |
39 | - protected function __construct( $timezone ) { |
|
40 | - $this->singular_item = __('Ticket','event_espresso'); |
|
41 | - $this->plural_item = __('Tickets','event_espresso'); |
|
39 | + protected function __construct($timezone) { |
|
40 | + $this->singular_item = __('Ticket', 'event_espresso'); |
|
41 | + $this->plural_item = __('Tickets', 'event_espresso'); |
|
42 | 42 | |
43 | 43 | $this->_tables = array( |
44 | 44 | 'Ticket'=> new EE_Primary_Table('esp_ticket', 'TKT_ID') |
45 | 45 | ); |
46 | 46 | $this->_fields = array( |
47 | 47 | 'Ticket'=>array( |
48 | - 'TKT_ID'=> new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID','event_espresso')), |
|
49 | - 'TTM_ID'=>new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID','event_espresso'), false, 0, 'Ticket_Template'), |
|
48 | + 'TKT_ID'=> new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID', 'event_espresso')), |
|
49 | + 'TTM_ID'=>new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID', 'event_espresso'), false, 0, 'Ticket_Template'), |
|
50 | 50 | 'TKT_name'=>new EE_Plain_Text_Field('TKT_name', __('Ticket Name', 'event_espresso'), false, ''), |
51 | - 'TKT_description'=>new EE_Full_HTML_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, '' ), |
|
52 | - 'TKT_start_date'=>new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket','event_espresso'), false, current_time('timestamp'), $timezone ), |
|
53 | - 'TKT_end_date'=>new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket','event_espresso'), false, current_time('timestamp'), $timezone ), |
|
54 | - 'TKT_min'=>new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0 ), |
|
55 | - 'TKT_max'=>new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, INF ), |
|
51 | + 'TKT_description'=>new EE_Full_HTML_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, ''), |
|
52 | + 'TKT_start_date'=>new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket', 'event_espresso'), false, current_time('timestamp'), $timezone), |
|
53 | + 'TKT_end_date'=>new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket', 'event_espresso'), false, current_time('timestamp'), $timezone), |
|
54 | + 'TKT_min'=>new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0), |
|
55 | + 'TKT_max'=>new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, INF), |
|
56 | 56 | 'TKT_price'=> new EE_Money_Field('TKT_price', 'Final calculated price for ticket', false, 0), |
57 | 57 | 'TKT_sold' => new EE_Integer_Field('TKT_sold', __('Number of this ticket sold', 'event_espresso'), false, 0), |
58 | - 'TKT_qty'=>new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available','event_espresso'), false, INF), |
|
59 | - 'TKT_uses'=>new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, INF ), |
|
60 | - 'TKT_required'=>new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false ), |
|
61 | - 'TKT_taxable'=>new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false,false), |
|
62 | - 'TKT_is_default'=>new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false ), |
|
58 | + 'TKT_qty'=>new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available', 'event_espresso'), false, INF), |
|
59 | + 'TKT_uses'=>new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, INF), |
|
60 | + 'TKT_required'=>new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false), |
|
61 | + 'TKT_taxable'=>new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false, false), |
|
62 | + 'TKT_is_default'=>new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false), |
|
63 | 63 | 'TKT_order' => new EE_Integer_Field('TKT_order', __('The order in which the Ticket is displayed in the editor (used for autosaves when the form doesn\'t have the ticket ID yet)', 'event_espresso'), false, 0), |
64 | - 'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0 ), |
|
64 | + 'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0), |
|
65 | 65 | 'TKT_deleted' => new EE_Trashed_Flag_Field('TKT_deleted', __('Flag indicating if this has been archived or not', 'event_espresso'), false, false), |
66 | - 'TKT_wp_user' => new EE_WP_User_Field('TKT_wp_user', __('Ticket Creator ID', 'event_espresso'), FALSE ), |
|
67 | - 'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0 ) |
|
66 | + 'TKT_wp_user' => new EE_WP_User_Field('TKT_wp_user', __('Ticket Creator ID', 'event_espresso'), FALSE), |
|
67 | + 'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0) |
|
68 | 68 | )); |
69 | 69 | $this->_model_relations = array( |
70 | 70 | 'Datetime'=>new EE_HABTM_Relation('Datetime_Ticket'), |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | 'WP_User' => new EE_Belongs_To_Relation(), |
76 | 76 | ); |
77 | 77 | |
78 | - parent::__construct( $timezone ); |
|
78 | + parent::__construct($timezone); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | * @return EE_Ticket[] |
86 | 86 | */ |
87 | 87 | public function get_all_default_tickets() { |
88 | - $tickets = $this->get_all( array( array('TKT_is_default' => 1), 'order_by' => array('TKT_order' => 'ASC')) ); |
|
88 | + $tickets = $this->get_all(array(array('TKT_is_default' => 1), 'order_by' => array('TKT_order' => 'ASC'))); |
|
89 | 89 | |
90 | 90 | //we need to set the start date and end date to today's date and the start of the default dtt |
91 | - return $this->_set_default_dates( $tickets ); |
|
91 | + return $this->_set_default_dates($tickets); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | |
@@ -98,10 +98,10 @@ discard block |
||
98 | 98 | * @param EE_Ticket[] $tickets |
99 | 99 | * @return EE_Ticket[] |
100 | 100 | */ |
101 | - private function _set_default_dates( $tickets ) { |
|
102 | - foreach ( $tickets as $ticket ) { |
|
103 | - $ticket->set('TKT_start_date', current_time('timestamp') ); |
|
104 | - $ticket->set('TKT_end_date', current_time('timestamp') + (60 * 60 * 24 * 30 ) ); |
|
101 | + private function _set_default_dates($tickets) { |
|
102 | + foreach ($tickets as $ticket) { |
|
103 | + $ticket->set('TKT_start_date', current_time('timestamp')); |
|
104 | + $ticket->set('TKT_end_date', current_time('timestamp') + (60 * 60 * 24 * 30)); |
|
105 | 105 | $ticket->set_end_time("12am"); |
106 | 106 | } |
107 | 107 | |
@@ -115,25 +115,25 @@ discard block |
||
115 | 115 | * @param array $query_params |
116 | 116 | * @return int|boolean of tickets available. If sold out, return less than 1. If infinite, returns INF, IF there are NO tickets attached to datetime then FALSE is returned. |
117 | 117 | */ |
118 | - public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()){ |
|
118 | + public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) { |
|
119 | 119 | $sum = 0; |
120 | 120 | $query_params[0]['Datetime.DTT_ID'] = $DTT_ID; |
121 | 121 | $remaining_per_ticket = $this->_get_all_wpdb_results( |
122 | 122 | $query_params, |
123 | 123 | ARRAY_A, |
124 | 124 | array( |
125 | - 'tickets_remaining'=>array('Ticket.TKT_qty-Ticket.TKT_sold','%d'),//note! calculations based on TKT_qty are dangerous because -1 means infinity in the db! |
|
126 | - 'initially_available'=>array('Ticket.TKT_qty','%d'))); |
|
125 | + 'tickets_remaining'=>array('Ticket.TKT_qty-Ticket.TKT_sold', '%d'), //note! calculations based on TKT_qty are dangerous because -1 means infinity in the db! |
|
126 | + 'initially_available'=>array('Ticket.TKT_qty', '%d'))); |
|
127 | 127 | |
128 | - if ( empty( $remaining_per_ticket ) ) |
|
128 | + if (empty($remaining_per_ticket)) |
|
129 | 129 | return FALSE; |
130 | 130 | |
131 | 131 | |
132 | - foreach($remaining_per_ticket as $remaining){ |
|
133 | - if(intval($remaining['initially_available'])==EE_INF_IN_DB){//infinite in DB |
|
132 | + foreach ($remaining_per_ticket as $remaining) { |
|
133 | + if (intval($remaining['initially_available']) == EE_INF_IN_DB) {//infinite in DB |
|
134 | 134 | return INF; |
135 | 135 | } |
136 | - $sum+=intval($remaining['tickets_remaining']); |
|
136 | + $sum += intval($remaining['tickets_remaining']); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | return $sum; |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | * @param EE_Ticket[] $tickets |
145 | 145 | * @return void |
146 | 146 | */ |
147 | - public function update_tickets_sold($tickets){ |
|
148 | - foreach($tickets as $ticket){ |
|
147 | + public function update_tickets_sold($tickets) { |
|
148 | + foreach ($tickets as $ticket) { |
|
149 | 149 | /* @var $ticket EE_Ticket */ |
150 | 150 | $ticket->update_tickets_sold(); |
151 | 151 | } |
@@ -2,8 +2,8 @@ discard block |
||
2 | 2 | /** |
3 | 3 | * Text_Fields is a base class for any fields which are have text value. (Exception: foreign and private key fields. Wish PHP had multiple-inheritance for this...) |
4 | 4 | */ |
5 | -class EE_All_Caps_Text_Field extends EE_Text_Field_Base{ |
|
6 | - function get_wpdb_data_type(){ |
|
5 | +class EE_All_Caps_Text_Field extends EE_Text_Field_Base { |
|
6 | + function get_wpdb_data_type() { |
|
7 | 7 | return '%s'; |
8 | 8 | } |
9 | 9 | |
@@ -13,6 +13,6 @@ discard block |
||
13 | 13 | * @return string |
14 | 14 | */ |
15 | 15 | function prepare_for_set($value_inputted_for_field_on_model_object) { |
16 | - return strtoupper( sanitize_key($value_inputted_for_field_on_model_object)); |
|
16 | + return strtoupper(sanitize_key($value_inputted_for_field_on_model_object)); |
|
17 | 17 | } |
18 | 18 | } |
19 | 19 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -require_once( EE_MODELS . 'fields/EE_DB_Only_Field_Base.php'); |
|
2 | +require_once(EE_MODELS.'fields/EE_DB_Only_Field_Base.php'); |
|
3 | 3 | /** |
4 | 4 | * Used by EE_Belongs_To_Any_Relations and EE_Has_Many_Any_Relations to identify the model the foreign key points to. |
5 | 5 | * Note: the array of model names on this field should match the array of model names on the |
@@ -8,8 +8,8 @@ discard block |
||
8 | 8 | * 'obj_id'=>new EE_Foreign_Key_Int_Field('obj_id_column',__('Related Object ID'),false,0,array('Registration','Transaction')), |
9 | 9 | * 'obj_type'=>new EE_Any_Foreign_Model_Name_Field('obj_type_column',__('Related Object type'),false,null,array('Registration','Transaction'))); |
10 | 10 | */ |
11 | -class EE_Any_Foreign_Model_Name_Field extends EE_Field_With_Model_Name{ |
|
12 | - function get_wpdb_data_type(){ |
|
11 | +class EE_Any_Foreign_Model_Name_Field extends EE_Field_With_Model_Name { |
|
12 | + function get_wpdb_data_type() { |
|
13 | 13 | return '%s'; |
14 | 14 | } |
15 | 15 | } |
16 | 16 | \ No newline at end of file |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | -require_once( EE_MODELS . 'fields/EE_Integer_Field.php'); |
|
3 | -class EE_Boolean_Field extends EE_Integer_Field{ |
|
2 | +require_once(EE_MODELS.'fields/EE_Integer_Field.php'); |
|
3 | +class EE_Boolean_Field extends EE_Integer_Field { |
|
4 | 4 | function prepare_for_set($value_inputted_for_field_on_model_object) { |
5 | - if ($value_inputted_for_field_on_model_object){ |
|
5 | + if ($value_inputted_for_field_on_model_object) { |
|
6 | 6 | return true; |
7 | - }else{ |
|
7 | + } else { |
|
8 | 8 | return false; |
9 | 9 | } |
10 | 10 | } |
@@ -14,6 +14,6 @@ discard block |
||
14 | 14 | * @return boolean |
15 | 15 | */ |
16 | 16 | function prepare_for_set_from_db($value_inputted_for_field_on_model_object) { |
17 | - return intval( $value_inputted_for_field_on_model_object ) ? true : false; |
|
17 | + return intval($value_inputted_for_field_on_model_object) ? true : false; |
|
18 | 18 | } |
19 | 19 | } |
@@ -90,7 +90,7 @@ |
||
90 | 90 | //so in case teh IPN is arriving later, let's try to process an IPN! |
91 | 91 | if($_SERVER['REQUEST_METHOD'] == 'POST'){ |
92 | 92 | return $this->handle_ipn($_POST, $transaction ); |
93 | - }else{ |
|
93 | + } else{ |
|
94 | 94 | return parent::finalize_payment_for( $transaction ); |
95 | 95 | } |
96 | 96 | } |
@@ -7,7 +7,7 @@ |
||
7 | 7 | * special default values for them, or some other column-specific functionality. So we can add them as fields, |
8 | 8 | * but db-only ones |
9 | 9 | */ |
10 | -abstract class EE_DB_Only_Field_Base extends EE_Model_Field_Base{ |
|
10 | +abstract class EE_DB_Only_Field_Base extends EE_Model_Field_Base { |
|
11 | 11 | /** |
12 | 12 | * All these children classes are for the db-only (meaning, we should select them |
13 | 13 | * on get_all queries, update, delete, and will still want to set their default value |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | -require_once( EE_MODELS . 'fields/EE_DB_Only_Field_Base.php'); |
|
3 | -class EE_DB_Only_Float_Field extends EE_DB_Only_Field_Base{ |
|
4 | - function get_wpdb_data_type(){ |
|
2 | +require_once(EE_MODELS.'fields/EE_DB_Only_Field_Base.php'); |
|
3 | +class EE_DB_Only_Float_Field extends EE_DB_Only_Field_Base { |
|
4 | + function get_wpdb_data_type() { |
|
5 | 5 | return '%f'; |
6 | 6 | } |
7 | 7 | } |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require_once( EE_MODELS . 'fields/EE_DB_Only_Field_Base.php'); |
|
4 | -class EE_DB_Only_Int_Field extends EE_DB_Only_Field_Base{ |
|
5 | - function get_wpdb_data_type(){ |
|
3 | +require_once(EE_MODELS.'fields/EE_DB_Only_Field_Base.php'); |
|
4 | +class EE_DB_Only_Int_Field extends EE_DB_Only_Field_Base { |
|
5 | + function get_wpdb_data_type() { |
|
6 | 6 | return '%d'; |
7 | 7 | } |
8 | 8 | } |
9 | 9 | \ No newline at end of file |