@@ -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,35 +68,35 @@ 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 | ); |
98 | 98 | $this->_model_chain_to_wp_user = 'Registration.Event'; |
99 | - parent::__construct( $timezone ); |
|
99 | + parent::__construct($timezone); |
|
100 | 100 | |
101 | 101 | } |
102 | 102 | |
@@ -107,23 +107,23 @@ discard block |
||
107 | 107 | * @param string $period |
108 | 108 | * @return \stdClass[] |
109 | 109 | */ |
110 | - public function get_revenue_per_day_report( $period = '-1 month' ) { |
|
111 | - $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' ); |
|
110 | + public function get_revenue_per_day_report($period = '-1 month') { |
|
111 | + $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'); |
|
112 | 112 | |
113 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
114 | - $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'TXN_timestamp' ); |
|
113 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
114 | + $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'TXN_timestamp'); |
|
115 | 115 | |
116 | 116 | $results = $this->_get_all_wpdb_results( |
117 | 117 | array( |
118 | 118 | array( |
119 | - 'TXN_timestamp' => array( '>=', $sql_date ) ), |
|
119 | + 'TXN_timestamp' => array('>=', $sql_date) ), |
|
120 | 120 | 'group_by' => 'txnDate', |
121 | - 'order_by' => array( 'TXN_timestamp' => 'ASC' ) |
|
121 | + 'order_by' => array('TXN_timestamp' => 'ASC') |
|
122 | 122 | ), |
123 | 123 | OBJECT, |
124 | 124 | array( |
125 | - 'txnDate' => array( 'DATE(' . $query_interval . ')', '%s' ), |
|
126 | - 'revenue' => array( 'SUM(Transaction.TXN_paid)', '%d' ) |
|
125 | + 'txnDate' => array('DATE('.$query_interval.')', '%s'), |
|
126 | + 'revenue' => array('SUM(Transaction.TXN_paid)', '%d') |
|
127 | 127 | ) |
128 | 128 | ); |
129 | 129 | return $results; |
@@ -139,25 +139,25 @@ discard block |
||
139 | 139 | * @throws \EE_Error |
140 | 140 | * @return mixed |
141 | 141 | */ |
142 | - public function get_revenue_per_event_report( $period = '-1 month' ) { |
|
143 | - $date_sql = EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', date( 'Y-m-d H:i:s', strtotime( $period ) ), 'Y-m-d H:i:s', 'UTC' ); |
|
144 | - $where = array( 'Registration.REG_date' => array( '>=', $date_sql ) ); |
|
142 | + public function get_revenue_per_event_report($period = '-1 month') { |
|
143 | + $date_sql = EEM_Registration::instance()->convert_datetime_for_query('REG_date', date('Y-m-d H:i:s', strtotime($period)), 'Y-m-d H:i:s', 'UTC'); |
|
144 | + $where = array('Registration.REG_date' => array('>=', $date_sql)); |
|
145 | 145 | |
146 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'revenue_per_event_report' ) ) { |
|
146 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'revenue_per_event_report')) { |
|
147 | 147 | $where ['Registration.Event.EVT_wp_user'] = get_current_user_id(); |
148 | 148 | } |
149 | 149 | |
150 | 150 | $results = $this->_get_all_wpdb_results( |
151 | 151 | array( |
152 | 152 | $where, |
153 | - 'group_by' => array( 'Registration.Event.EVT_name' ), |
|
153 | + 'group_by' => array('Registration.Event.EVT_name'), |
|
154 | 154 | 'order_by' => 'Registration.Event.EVT_name', |
155 | - 'limit' => array( 0, 24 ) |
|
155 | + 'limit' => array(0, 24) |
|
156 | 156 | ), |
157 | 157 | OBJECT, |
158 | 158 | array( |
159 | - 'event_name' => array( 'Registration___Event_CPT.post_title', '%s' ), |
|
160 | - 'revenue' => array( 'SUM(TXN_PAID)', '%d' ) |
|
159 | + 'event_name' => array('Registration___Event_CPT.post_title', '%s'), |
|
160 | + 'revenue' => array('SUM(TXN_PAID)', '%d') |
|
161 | 161 | ) |
162 | 162 | ); |
163 | 163 | return $results; |
@@ -175,10 +175,10 @@ discard block |
||
175 | 175 | * @param string $reg_url_link |
176 | 176 | * @return EE_Transaction |
177 | 177 | */ |
178 | - public function get_transaction_from_reg_url_link( $reg_url_link = '' ){ |
|
179 | - return $this->get_one( array( |
|
178 | + public function get_transaction_from_reg_url_link($reg_url_link = '') { |
|
179 | + return $this->get_one(array( |
|
180 | 180 | array( |
181 | - 'Registration.REG_url_link' => ! empty( $reg_url_link ) ? $reg_url_link : EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ) |
|
181 | + 'Registration.REG_url_link' => ! empty($reg_url_link) ? $reg_url_link : EE_Registry::instance()->REQ->get('e_reg_url_link', '') |
|
182 | 182 | ) |
183 | 183 | )); |
184 | 184 | } |
@@ -198,15 +198,15 @@ discard block |
||
198 | 198 | * @param boolean $save_txn whether or not to save the transaction during this function call |
199 | 199 | * @return boolean |
200 | 200 | */ |
201 | - public function update_based_on_payments( $transaction_obj_or_id, $save_txn = TRUE ){ |
|
201 | + public function update_based_on_payments($transaction_obj_or_id, $save_txn = TRUE) { |
|
202 | 202 | EE_Error::doing_it_wrong( |
203 | - __CLASS__ . '::' . __FUNCTION__, |
|
204 | - sprintf( __( 'This method is deprecated. Please use "%s" instead', 'event_espresso' ), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()' ), |
|
203 | + __CLASS__.'::'.__FUNCTION__, |
|
204 | + sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'), |
|
205 | 205 | '4.6.0' |
206 | 206 | ); |
207 | 207 | /** @type EE_Transaction_Processor $transaction_processor */ |
208 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
209 | - return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $this->ensure_is_obj( $transaction_obj_or_id )); |
|
208 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
209 | + return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($this->ensure_is_obj($transaction_obj_or_id)); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | array( |
238 | 238 | 0 => array( |
239 | 239 | 'STS_ID' => EEM_Transaction::failed_status_code, |
240 | - 'TXN_timestamp' => array( '<', time() - $time_to_leave_alone ) |
|
240 | + 'TXN_timestamp' => array('<', time() - $time_to_leave_alone) |
|
241 | 241 | ) |
242 | 242 | ), |
243 | 243 | $time_to_leave_alone |
@@ -250,26 +250,26 @@ discard block |
||
250 | 250 | */ |
251 | 251 | $txn_ids = apply_filters( |
252 | 252 | 'FHEE__EEM_Transaction__delete_junk_transactions__transaction_ids_to_delete', |
253 | - EEM_Transaction::instance()->get_col( $ids_query, 'TXN_ID' ), |
|
253 | + EEM_Transaction::instance()->get_col($ids_query, 'TXN_ID'), |
|
254 | 254 | $time_to_leave_alone |
255 | 255 | ); |
256 | 256 | |
257 | 257 | //now that we have the ids to delete, let's get deletin' |
258 | 258 | //Why no wpdb->prepare? Because the data is trusted. We got the ids from the original query to get them FROM |
259 | 259 | //the db (which is sanitized) so no need to prepare them again. |
260 | - if ( $txn_ids ) { |
|
261 | - $query = ' |
|
260 | + if ($txn_ids) { |
|
261 | + $query = ' |
|
262 | 262 | DELETE |
263 | - FROM ' . $this->table() . ' |
|
263 | + FROM ' . $this->table().' |
|
264 | 264 | WHERE |
265 | - TXN_ID IN ( ' . implode( ",", $txn_ids ) . ')'; |
|
266 | - $deleted = $wpdb->query( $query ); |
|
265 | + TXN_ID IN ( ' . implode(",", $txn_ids).')'; |
|
266 | + $deleted = $wpdb->query($query); |
|
267 | 267 | } |
268 | - if ( $deleted ) { |
|
268 | + if ($deleted) { |
|
269 | 269 | /** |
270 | 270 | * Allows code to do something after the transactions have been deleted. |
271 | 271 | */ |
272 | - do_action( 'AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids ); |
|
272 | + do_action('AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids); |
|
273 | 273 | } |
274 | 274 | return $deleted; |
275 | 275 | } |
@@ -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,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 | } |