@@ -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,23 +108,23 @@ discard block |
||
108 | 108 | * @param string $period |
109 | 109 | * @return \stdClass[] |
110 | 110 | */ |
111 | - public function get_revenue_per_day_report( $period = '-1 month' ) { |
|
112 | - $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' ); |
|
111 | + public function get_revenue_per_day_report($period = '-1 month') { |
|
112 | + $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 | 113 | |
114 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
115 | - $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'TXN_timestamp' ); |
|
114 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
115 | + $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'TXN_timestamp'); |
|
116 | 116 | |
117 | 117 | $results = $this->_get_all_wpdb_results( |
118 | 118 | array( |
119 | 119 | array( |
120 | - 'TXN_timestamp' => array( '>=', $sql_date ) ), |
|
120 | + 'TXN_timestamp' => array('>=', $sql_date) ), |
|
121 | 121 | 'group_by' => 'txnDate', |
122 | - 'order_by' => array( 'TXN_timestamp' => 'ASC' ) |
|
122 | + 'order_by' => array('TXN_timestamp' => 'ASC') |
|
123 | 123 | ), |
124 | 124 | OBJECT, |
125 | 125 | array( |
126 | - 'txnDate' => array( 'DATE(' . $query_interval . ')', '%s' ), |
|
127 | - 'revenue' => array( 'SUM(Transaction.TXN_paid)', '%d' ) |
|
126 | + 'txnDate' => array('DATE('.$query_interval.')', '%s'), |
|
127 | + 'revenue' => array('SUM(Transaction.TXN_paid)', '%d') |
|
128 | 128 | ) |
129 | 129 | ); |
130 | 130 | return $results; |
@@ -140,17 +140,17 @@ discard block |
||
140 | 140 | * @throws \EE_Error |
141 | 141 | * @return mixed |
142 | 142 | */ |
143 | - public function get_revenue_per_event_report( $period = '-1 month' ) { |
|
143 | + public function get_revenue_per_event_report($period = '-1 month') { |
|
144 | 144 | global $wpdb; |
145 | - $transaction_table = $wpdb->prefix . 'esp_transaction'; |
|
146 | - $registration_table = $wpdb->prefix . 'esp_registration'; |
|
145 | + $transaction_table = $wpdb->prefix.'esp_transaction'; |
|
146 | + $registration_table = $wpdb->prefix.'esp_registration'; |
|
147 | 147 | $event_table = $wpdb->posts; |
148 | - $payment_table = $wpdb->prefix . 'esp_payment'; |
|
149 | - $sql_date = date( 'Y-m-d H:i:s', strtotime( $period ) ); |
|
148 | + $payment_table = $wpdb->prefix.'esp_payment'; |
|
149 | + $sql_date = date('Y-m-d H:i:s', strtotime($period)); |
|
150 | 150 | $extra_event_on_join = ''; |
151 | 151 | //exclude events not authored by user if permissions in effect |
152 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) { |
|
153 | - $extra_event_on_join = ' AND Event.post_author = ' . get_current_user_id(); |
|
152 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) { |
|
153 | + $extra_event_on_join = ' AND Event.post_author = '.get_current_user_id(); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | $approved_payment_status = EEM_Payment::status_id_approved; |
@@ -196,10 +196,10 @@ discard block |
||
196 | 196 | * @param string $reg_url_link |
197 | 197 | * @return EE_Transaction |
198 | 198 | */ |
199 | - public function get_transaction_from_reg_url_link( $reg_url_link = '' ){ |
|
200 | - return $this->get_one( array( |
|
199 | + public function get_transaction_from_reg_url_link($reg_url_link = '') { |
|
200 | + return $this->get_one(array( |
|
201 | 201 | array( |
202 | - 'Registration.REG_url_link' => ! empty( $reg_url_link ) ? $reg_url_link : EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ) |
|
202 | + 'Registration.REG_url_link' => ! empty($reg_url_link) ? $reg_url_link : EE_Registry::instance()->REQ->get('e_reg_url_link', '') |
|
203 | 203 | ) |
204 | 204 | )); |
205 | 205 | } |
@@ -219,15 +219,15 @@ discard block |
||
219 | 219 | * @param boolean $save_txn whether or not to save the transaction during this function call |
220 | 220 | * @return boolean |
221 | 221 | */ |
222 | - public function update_based_on_payments( $transaction_obj_or_id, $save_txn = TRUE ){ |
|
222 | + public function update_based_on_payments($transaction_obj_or_id, $save_txn = TRUE) { |
|
223 | 223 | EE_Error::doing_it_wrong( |
224 | - __CLASS__ . '::' . __FUNCTION__, |
|
225 | - sprintf( __( 'This method is deprecated. Please use "%s" instead', 'event_espresso' ), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()' ), |
|
224 | + __CLASS__.'::'.__FUNCTION__, |
|
225 | + sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'), |
|
226 | 226 | '4.6.0' |
227 | 227 | ); |
228 | 228 | /** @type EE_Transaction_Processor $transaction_processor */ |
229 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
230 | - return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $this->ensure_is_obj( $transaction_obj_or_id )); |
|
229 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
230 | + return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($this->ensure_is_obj($transaction_obj_or_id)); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | array( |
259 | 259 | 0 => array( |
260 | 260 | 'STS_ID' => EEM_Transaction::failed_status_code, |
261 | - 'TXN_timestamp' => array( '<', time() - $time_to_leave_alone ) |
|
261 | + 'TXN_timestamp' => array('<', time() - $time_to_leave_alone) |
|
262 | 262 | ) |
263 | 263 | ), |
264 | 264 | $time_to_leave_alone |
@@ -271,26 +271,26 @@ discard block |
||
271 | 271 | */ |
272 | 272 | $txn_ids = apply_filters( |
273 | 273 | 'FHEE__EEM_Transaction__delete_junk_transactions__transaction_ids_to_delete', |
274 | - EEM_Transaction::instance()->get_col( $ids_query, 'TXN_ID' ), |
|
274 | + EEM_Transaction::instance()->get_col($ids_query, 'TXN_ID'), |
|
275 | 275 | $time_to_leave_alone |
276 | 276 | ); |
277 | 277 | |
278 | 278 | //now that we have the ids to delete, let's get deletin' |
279 | 279 | //Why no wpdb->prepare? Because the data is trusted. We got the ids from the original query to get them FROM |
280 | 280 | //the db (which is sanitized) so no need to prepare them again. |
281 | - if ( $txn_ids ) { |
|
282 | - $query = ' |
|
281 | + if ($txn_ids) { |
|
282 | + $query = ' |
|
283 | 283 | DELETE |
284 | - FROM ' . $this->table() . ' |
|
284 | + FROM ' . $this->table().' |
|
285 | 285 | WHERE |
286 | - TXN_ID IN ( ' . implode( ",", $txn_ids ) . ')'; |
|
287 | - $deleted = $wpdb->query( $query ); |
|
286 | + TXN_ID IN ( ' . implode(",", $txn_ids).')'; |
|
287 | + $deleted = $wpdb->query($query); |
|
288 | 288 | } |
289 | - if ( $deleted ) { |
|
289 | + if ($deleted) { |
|
290 | 290 | /** |
291 | 291 | * Allows code to do something after the transactions have been deleted. |
292 | 292 | */ |
293 | - do_action( 'AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids ); |
|
293 | + do_action('AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids); |
|
294 | 294 | } |
295 | 295 | return $deleted; |
296 | 296 | } |
@@ -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 |
@@ -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 |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -class EE_Email_Field extends EE_Text_Field_Base{ |
|
2 | +class EE_Email_Field extends EE_Text_Field_Base { |
|
3 | 3 | function prepare_for_set($value_inputted_for_field_on_model_object) { |
4 | 4 | return sanitize_email($value_inputted_for_field_on_model_object); |
5 | 5 | } |