@@ -1,14 +1,14 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
3 | 3 | /** |
4 | - * |
|
5 | - * Transaction Model |
|
6 | - * |
|
7 | - * @package Event Espresso |
|
8 | - * @subpackage includes/models/ |
|
9 | - * @author Brent Christensen |
|
10 | - * |
|
11 | - */ |
|
4 | + * |
|
5 | + * Transaction Model |
|
6 | + * |
|
7 | + * @package Event Espresso |
|
8 | + * @subpackage includes/models/ |
|
9 | + * @author Brent Christensen |
|
10 | + * |
|
11 | + */ |
|
12 | 12 | class EEM_Transaction extends EEM_Base { |
13 | 13 | |
14 | 14 | // private instance of the Transaction object |
@@ -1,4 +1,6 @@ |
||
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 | * |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
2 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
3 | 3 | /** |
4 | 4 | * |
5 | 5 | * Transaction Model |
@@ -68,36 +68,36 @@ discard block |
||
68 | 68 | * 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) |
69 | 69 | * @return EEM_Transaction |
70 | 70 | */ |
71 | - protected function __construct( $timezone ) { |
|
72 | - $this->singular_item = __('Transaction','event_espresso'); |
|
73 | - $this->plural_item = __('Transactions','event_espresso'); |
|
71 | + protected function __construct($timezone) { |
|
72 | + $this->singular_item = __('Transaction', 'event_espresso'); |
|
73 | + $this->plural_item = __('Transactions', 'event_espresso'); |
|
74 | 74 | |
75 | 75 | $this->_tables = array( |
76 | - 'Transaction'=>new EE_Primary_Table('esp_transaction','TXN_ID') |
|
76 | + 'Transaction'=>new EE_Primary_Table('esp_transaction', 'TXN_ID') |
|
77 | 77 | ); |
78 | 78 | $this->_fields = array( |
79 | 79 | 'Transaction'=>array( |
80 | - 'TXN_ID'=>new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID','event_espresso')), |
|
81 | - 'TXN_timestamp'=>new EE_Datetime_Field('TXN_timestamp', __('date when transaction was created','event_espresso'), false, time(), $timezone ), |
|
82 | - 'TXN_total'=>new EE_Money_Field('TXN_total', __('Total value of Transaction','event_espresso'), false, 0), |
|
83 | - 'TXN_paid'=>new EE_Money_Field('TXN_paid', __('Amount paid towards transaction to date','event_espresso'), false, 0), |
|
84 | - 'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID','event_espresso'), false, EEM_Transaction::failed_status_code, 'Status'), |
|
85 | - 'TXN_session_data'=>new EE_Serialized_Text_Field('TXN_session_data', __('Serialized session data','event_espresso'), true, ''), |
|
86 | - 'TXN_hash_salt'=>new EE_Plain_Text_Field('TXN_hash_salt', __('Transaction Hash Salt','event_espresso'), true, ''), |
|
80 | + 'TXN_ID'=>new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso')), |
|
81 | + 'TXN_timestamp'=>new EE_Datetime_Field('TXN_timestamp', __('date when transaction was created', 'event_espresso'), false, time(), $timezone), |
|
82 | + 'TXN_total'=>new EE_Money_Field('TXN_total', __('Total value of Transaction', 'event_espresso'), false, 0), |
|
83 | + 'TXN_paid'=>new EE_Money_Field('TXN_paid', __('Amount paid towards transaction to date', 'event_espresso'), false, 0), |
|
84 | + 'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), false, EEM_Transaction::failed_status_code, 'Status'), |
|
85 | + 'TXN_session_data'=>new EE_Serialized_Text_Field('TXN_session_data', __('Serialized session data', 'event_espresso'), true, ''), |
|
86 | + 'TXN_hash_salt'=>new EE_Plain_Text_Field('TXN_hash_salt', __('Transaction Hash Salt', 'event_espresso'), true, ''), |
|
87 | 87 | 'PMD_ID'=>new EE_Foreign_Key_Int_Field('PMD_ID', __("Last Used Payment Method", 'event_espresso'), true, NULL, 'Payment_Method'), |
88 | - 'TXN_reg_steps' => new EE_Serialized_Text_Field( 'TXN_reg_steps', __( 'Registration Steps', 'event_espresso' ), FALSE, array() ), |
|
88 | + 'TXN_reg_steps' => new EE_Serialized_Text_Field('TXN_reg_steps', __('Registration Steps', 'event_espresso'), FALSE, array()), |
|
89 | 89 | ) |
90 | 90 | ); |
91 | 91 | $this->_model_relations = array( |
92 | 92 | 'Registration'=>new EE_Has_Many_Relation(), |
93 | 93 | 'Payment'=>new EE_Has_Many_Relation(), |
94 | 94 | 'Status'=>new EE_Belongs_To_Relation(), |
95 | - 'Line_Item'=>new EE_Has_Many_Relation(false),//you can delete a transaction without needing to delete its line items |
|
95 | + 'Line_Item'=>new EE_Has_Many_Relation(false), //you can delete a transaction without needing to delete its line items |
|
96 | 96 | 'Payment_Method'=>new EE_Belongs_To_Relation(), |
97 | 97 | 'Message' => new EE_Has_Many_Relation() |
98 | 98 | ); |
99 | 99 | $this->_model_chain_to_wp_user = 'Registration.Event'; |
100 | - parent::__construct( $timezone ); |
|
100 | + parent::__construct($timezone); |
|
101 | 101 | |
102 | 102 | } |
103 | 103 | |
@@ -108,19 +108,19 @@ discard block |
||
108 | 108 | * @param string $period |
109 | 109 | * @return \stdClass[] |
110 | 110 | */ |
111 | - public function get_revenue_per_day_report( $period = '-1 month' ) { |
|
111 | + public function get_revenue_per_day_report($period = '-1 month') { |
|
112 | 112 | |
113 | - $sql_date = $this->convert_datetime_for_query( 'TXN_timestamp', date("Y-m-d H:i:s", strtotime($period) ), 'Y-m-d H:i:s', 'UTC' ); |
|
113 | + $sql_date = $this->convert_datetime_for_query('TXN_timestamp', date("Y-m-d H:i:s", strtotime($period)), 'Y-m-d H:i:s', 'UTC'); |
|
114 | 114 | $results = $this->_get_all_wpdb_results( |
115 | 115 | array( |
116 | 116 | array( |
117 | 117 | 'TXN_timestamp' => array('>=', $sql_date)), |
118 | 118 | 'group_by' => 'txnDate', |
119 | - 'order_by' => array('TXN_timestamp' => 'DESC' ) |
|
119 | + 'order_by' => array('TXN_timestamp' => 'DESC') |
|
120 | 120 | ), |
121 | 121 | OBJECT, |
122 | 122 | array( |
123 | - 'txnDate' => array('DATE(Transaction.TXN_timestamp)','%s'), |
|
123 | + 'txnDate' => array('DATE(Transaction.TXN_timestamp)', '%s'), |
|
124 | 124 | 'revenue' => array('SUM(Transaction.TXN_paid)', '%d') |
125 | 125 | )); |
126 | 126 | return $results; |
@@ -136,22 +136,22 @@ discard block |
||
136 | 136 | * @throws \EE_Error |
137 | 137 | * @return mixed |
138 | 138 | */ |
139 | - public function get_revenue_per_event_report( $period = 'month' ) { |
|
139 | + public function get_revenue_per_event_report($period = 'month') { |
|
140 | 140 | /** @type WPDB $wpdb */ |
141 | 141 | global $wpdb; |
142 | - $date_mod = strtotime( '-1 ' . $period ); |
|
142 | + $date_mod = strtotime('-1 '.$period); |
|
143 | 143 | |
144 | 144 | $SQL = 'SELECT post_title as event_name, SUM(TXN_paid) AS revenue'; |
145 | - $SQL .= ' FROM ' . $this->_get_main_table()->get_table_name() . ' txn'; |
|
146 | - $SQL .= ' LEFT JOIN ' . $wpdb->prefix . 'esp_registration reg ON reg.TXN_ID = txn.TXN_ID'; |
|
147 | - $SQL .= ' LEFT JOIN ' . $wpdb->posts . ' evt ON evt.ID = reg.EVT_ID'; |
|
145 | + $SQL .= ' FROM '.$this->_get_main_table()->get_table_name().' txn'; |
|
146 | + $SQL .= ' LEFT JOIN '.$wpdb->prefix.'esp_registration reg ON reg.TXN_ID = txn.TXN_ID'; |
|
147 | + $SQL .= ' LEFT JOIN '.$wpdb->posts.' evt ON evt.ID = reg.EVT_ID'; |
|
148 | 148 | $SQL .= ' WHERE REG_count = 1'; |
149 | 149 | $SQL .= ' AND REG_date >= %d'; |
150 | 150 | $SQL .= ' GROUP BY event_name'; |
151 | 151 | $SQL .= ' ORDER BY event_name'; |
152 | 152 | $SQL .= ' LIMIT 0, 24'; |
153 | 153 | |
154 | - return $this->_do_wpdb_query( 'get_results', array( $wpdb->prepare( $SQL, $date_mod ) ) ); |
|
154 | + return $this->_do_wpdb_query('get_results', array($wpdb->prepare($SQL, $date_mod))); |
|
155 | 155 | |
156 | 156 | } |
157 | 157 | |
@@ -167,10 +167,10 @@ discard block |
||
167 | 167 | * @param string $reg_url_link |
168 | 168 | * @return EE_Transaction |
169 | 169 | */ |
170 | - public function get_transaction_from_reg_url_link( $reg_url_link = '' ){ |
|
171 | - return $this->get_one( array( |
|
170 | + public function get_transaction_from_reg_url_link($reg_url_link = '') { |
|
171 | + return $this->get_one(array( |
|
172 | 172 | array( |
173 | - 'Registration.REG_url_link' => ! empty( $reg_url_link ) ? $reg_url_link : EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ) |
|
173 | + 'Registration.REG_url_link' => ! empty($reg_url_link) ? $reg_url_link : EE_Registry::instance()->REQ->get('e_reg_url_link', '') |
|
174 | 174 | ) |
175 | 175 | )); |
176 | 176 | } |
@@ -190,15 +190,15 @@ discard block |
||
190 | 190 | * @param boolean $save_txn whether or not to save the transaction during this function call |
191 | 191 | * @return boolean |
192 | 192 | */ |
193 | - public function update_based_on_payments( $transaction_obj_or_id, $save_txn = TRUE ){ |
|
193 | + public function update_based_on_payments($transaction_obj_or_id, $save_txn = TRUE) { |
|
194 | 194 | EE_Error::doing_it_wrong( |
195 | - __CLASS__ . '::' . __FUNCTION__, |
|
196 | - sprintf( __( 'This method is deprecated. Please use "%s" instead', 'event_espresso' ), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()' ), |
|
195 | + __CLASS__.'::'.__FUNCTION__, |
|
196 | + sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'), |
|
197 | 197 | '4.6.0' |
198 | 198 | ); |
199 | 199 | /** @type EE_Transaction_Processor $transaction_processor */ |
200 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
201 | - return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $this->ensure_is_obj( $transaction_obj_or_id )); |
|
200 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
201 | + return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($this->ensure_is_obj($transaction_obj_or_id)); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | array( |
230 | 230 | 0 => array( |
231 | 231 | 'STS_ID' => EEM_Transaction::failed_status_code, |
232 | - 'TXN_timestamp' => array( '<', time() - $time_to_leave_alone ) |
|
232 | + 'TXN_timestamp' => array('<', time() - $time_to_leave_alone) |
|
233 | 233 | ) |
234 | 234 | ), |
235 | 235 | $time_to_leave_alone |
@@ -242,26 +242,26 @@ discard block |
||
242 | 242 | */ |
243 | 243 | $txn_ids = apply_filters( |
244 | 244 | 'FHEE__EEM_Transaction__delete_junk_transactions__transaction_ids_to_delete', |
245 | - EEM_Transaction::instance()->get_col( $ids_query, 'TXN_ID' ), |
|
245 | + EEM_Transaction::instance()->get_col($ids_query, 'TXN_ID'), |
|
246 | 246 | $time_to_leave_alone |
247 | 247 | ); |
248 | 248 | |
249 | 249 | //now that we have the ids to delete, let's get deletin' |
250 | 250 | //Why no wpdb->prepare? Because the data is trusted. We got the ids from the original query to get them FROM |
251 | 251 | //the db (which is sanitized) so no need to prepare them again. |
252 | - if ( $txn_ids ) { |
|
253 | - $query = ' |
|
252 | + if ($txn_ids) { |
|
253 | + $query = ' |
|
254 | 254 | DELETE |
255 | - FROM ' . $this->table() . ' |
|
255 | + FROM ' . $this->table().' |
|
256 | 256 | WHERE |
257 | - TXN_ID IN ( ' . implode( ",", $txn_ids ) . ')'; |
|
258 | - $deleted = $wpdb->query( $query ); |
|
257 | + TXN_ID IN ( ' . implode(",", $txn_ids).')'; |
|
258 | + $deleted = $wpdb->query($query); |
|
259 | 259 | } |
260 | - if ( $deleted ) { |
|
260 | + if ($deleted) { |
|
261 | 261 | /** |
262 | 262 | * Allows code to do something after the transactions have been deleted. |
263 | 263 | */ |
264 | - do_action( 'AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids ); |
|
264 | + do_action('AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids); |
|
265 | 265 | } |
266 | 266 | return $deleted; |
267 | 267 | } |
@@ -22,24 +22,24 @@ discard block |
||
22 | 22 | * @param null $timezone |
23 | 23 | * @throws \EE_Error |
24 | 24 | */ |
25 | - protected function __construct( $timezone = NULL ){ |
|
26 | - $this->singular_item = __('WP_User','event_espresso'); |
|
27 | - $this->plural_item = __('WP_Users','event_espresso'); |
|
25 | + protected function __construct($timezone = NULL) { |
|
26 | + $this->singular_item = __('WP_User', 'event_espresso'); |
|
27 | + $this->plural_item = __('WP_Users', 'event_espresso'); |
|
28 | 28 | global $wpdb; |
29 | 29 | $this->_tables = array( |
30 | - 'WP_User'=> new EE_Primary_Table( $wpdb->users, 'ID', true) |
|
30 | + 'WP_User'=> new EE_Primary_Table($wpdb->users, 'ID', true) |
|
31 | 31 | ); |
32 | 32 | $this->_fields = array( |
33 | 33 | 'WP_User'=>array( |
34 | - 'ID'=> new EE_Primary_Key_Int_Field('ID', __('WP_User ID','event_espresso')), |
|
35 | - 'user_login'=>new EE_Plain_Text_Field('user_login', __('User Login','event_espresso'), false, '' ), |
|
36 | - 'user_pass'=>new EE_Plain_Text_Field('user_pass', __('User Password','event_espresso'), false, '' ), |
|
37 | - 'user_nicename'=>new EE_Plain_Text_Field('user_nicename', __(' User Nice Name','event_espresso'), false, ''), |
|
38 | - 'user_email' => new EE_Email_Field('user_email', __( 'User Email', 'event_espresso' ), false), |
|
39 | - 'user_registered' => new EE_Datetime_Field( 'user_registered', __( 'Date User Registered', 'event_espresso' ), false, current_time('timestamp'), $timezone ), |
|
40 | - 'user_activation_key' => new EE_Plain_Text_Field( 'user_activation_key', __( 'User Activation Key', 'event_espresso' ), false, '' ), |
|
41 | - 'user_status' => new EE_Integer_Field( 'user_status', __( 'User Status', 'event_espresso' ), false, 0 ), |
|
42 | - 'display_name' => new EE_Plain_Text_Field( 'display_name', __( 'Display Name', 'event_espresso' ), false, '' ) |
|
34 | + 'ID'=> new EE_Primary_Key_Int_Field('ID', __('WP_User ID', 'event_espresso')), |
|
35 | + 'user_login'=>new EE_Plain_Text_Field('user_login', __('User Login', 'event_espresso'), false, ''), |
|
36 | + 'user_pass'=>new EE_Plain_Text_Field('user_pass', __('User Password', 'event_espresso'), false, ''), |
|
37 | + 'user_nicename'=>new EE_Plain_Text_Field('user_nicename', __(' User Nice Name', 'event_espresso'), false, ''), |
|
38 | + 'user_email' => new EE_Email_Field('user_email', __('User Email', 'event_espresso'), false), |
|
39 | + 'user_registered' => new EE_Datetime_Field('user_registered', __('Date User Registered', 'event_espresso'), false, current_time('timestamp'), $timezone), |
|
40 | + 'user_activation_key' => new EE_Plain_Text_Field('user_activation_key', __('User Activation Key', 'event_espresso'), false, ''), |
|
41 | + 'user_status' => new EE_Integer_Field('user_status', __('User Status', 'event_espresso'), false, 0), |
|
42 | + 'display_name' => new EE_Plain_Text_Field('display_name', __('Display Name', 'event_espresso'), false, '') |
|
43 | 43 | )); |
44 | 44 | $this->_model_relations = array( |
45 | 45 | 'Attendee' => new EE_Has_Many_Relation(), |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | ); |
56 | 56 | $this->_wp_core_model = true; |
57 | 57 | $this->_caps_slug = 'users'; |
58 | - $this->_cap_contexts_to_cap_action_map[ EEM_Base::caps_read ] = 'list'; |
|
59 | - $this->_cap_contexts_to_cap_action_map[ EEM_Base::caps_read_admin ] = 'list'; |
|
60 | - foreach( $this->_cap_contexts_to_cap_action_map as $context => $action ) { |
|
61 | - $this->_cap_restriction_generators[ $context ] = new EE_Restriction_Generator_WP_User(); |
|
58 | + $this->_cap_contexts_to_cap_action_map[EEM_Base::caps_read] = 'list'; |
|
59 | + $this->_cap_contexts_to_cap_action_map[EEM_Base::caps_read_admin] = 'list'; |
|
60 | + foreach ($this->_cap_contexts_to_cap_action_map as $context => $action) { |
|
61 | + $this->_cap_restriction_generators[$context] = new EE_Restriction_Generator_WP_User(); |
|
62 | 62 | } |
63 | 63 | //@todo: account for create_users controls whether they can create users at all |
64 | 64 | |
65 | - parent::__construct( $timezone ); |
|
65 | + parent::__construct($timezone); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -1,4 +1,6 @@ |
||
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 | * |
@@ -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,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
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 | - */ |
|
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 | + */ |
|
5 | 5 | abstract class EE_Text_Field_Base extends EE_Model_Field_Base{ |
6 | 6 | function get_wpdb_data_type(){ |
7 | 7 | return '%s'; |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | require_once( EE_MODELS . 'fields/EE_DB_Only_Field_Base.php'); |
3 | 3 | /** |
4 | - * Used by EE_Belongs_To_Any_Relations and EE_Has_Many_Any_Relations to identify the model the foreign key points to. |
|
5 | - * Note: the array of model names on this field should match the array of model names on the |
|
6 | - * foreign key this field works with. Eg |
|
7 | - * $this->_fields = array( |
|
8 | - * 'obj_id'=>new EE_Foreign_Key_Int_Field('obj_id_column',__('Related Object ID'),false,0,array('Registration','Transaction')), |
|
9 | - * 'obj_type'=>new EE_Any_Foreign_Model_Name_Field('obj_type_column',__('Related Object type'),false,null,array('Registration','Transaction'))); |
|
10 | - */ |
|
4 | + * Used by EE_Belongs_To_Any_Relations and EE_Has_Many_Any_Relations to identify the model the foreign key points to. |
|
5 | + * Note: the array of model names on this field should match the array of model names on the |
|
6 | + * foreign key this field works with. Eg |
|
7 | + * $this->_fields = array( |
|
8 | + * 'obj_id'=>new EE_Foreign_Key_Int_Field('obj_id_column',__('Related Object ID'),false,0,array('Registration','Transaction')), |
|
9 | + * 'obj_type'=>new EE_Any_Foreign_Model_Name_Field('obj_type_column',__('Related Object type'),false,null,array('Registration','Transaction'))); |
|
10 | + */ |
|
11 | 11 | class EE_Any_Foreign_Model_Name_Field extends EE_Field_With_Model_Name{ |
12 | 12 | function get_wpdb_data_type(){ |
13 | 13 | return '%s'; |
@@ -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 |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | -require_once( EE_MODELS . 'fields/EE_DB_Only_Field_Base.php'); |
|
3 | -class EE_DB_Only_Text_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_Text_Field extends EE_DB_Only_Field_Base { |
|
4 | + function get_wpdb_data_type() { |
|
5 | 5 | return '%s'; |
6 | 6 | } |
7 | 7 | } |
8 | 8 | \ No newline at end of file |