@@ -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 | * |
@@ -89,7 +91,7 @@ discard block |
||
89 | 91 | global $wpdb; |
90 | 92 | if( $term_taxonomy_id ){ |
91 | 93 | $second_operand = $wpdb->prepare('%d',$term_taxonomy_id); |
92 | - }else{ |
|
94 | + } else{ |
|
93 | 95 | $second_operand = 'tr.term_taxonomy_id'; |
94 | 96 | } |
95 | 97 | $rows_affected = $this->_do_wpdb_query( 'query' , array("UPDATE {$wpdb->term_taxonomy} AS tt SET count = (select count(*) as proper_count |
@@ -21,24 +21,24 @@ discard block |
||
21 | 21 | * |
22 | 22 | * ------------------------------------------------------------------------ |
23 | 23 | */ |
24 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
24 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
25 | 25 | |
26 | 26 | class EEM_Term_Relationship extends EEM_Base { |
27 | 27 | |
28 | 28 | // private instance of the Attendee object |
29 | 29 | protected static $_instance = NULL; |
30 | 30 | |
31 | - protected function __construct( $timezone = NULL ) { |
|
32 | - $this->singular_item = __('Term Relationship','event_espresso'); |
|
33 | - $this->plural_item = __('Term Relationships','event_espresso'); |
|
31 | + protected function __construct($timezone = NULL) { |
|
32 | + $this->singular_item = __('Term Relationship', 'event_espresso'); |
|
33 | + $this->plural_item = __('Term Relationships', 'event_espresso'); |
|
34 | 34 | $this->_tables = array( |
35 | 35 | 'Term_Relationship'=> new EE_Primary_Table('term_relationships') |
36 | 36 | ); |
37 | 37 | $this->_fields = array( |
38 | 38 | 'Term_Relationship'=>array( |
39 | - 'object_id'=> new EE_Foreign_Key_Int_Field('object_id', __('Object(Post) ID','event_espresso'), false,0,array('Event','Venue','Attendee')), |
|
40 | - 'term_taxonomy_id'=>new EE_Foreign_Key_Int_Field('term_taxonomy_id', __('Term (in context of a taxonomy) ID','event_espresso'), false, 0, 'Term_Taxonomy'), |
|
41 | - 'term_order'=>new EE_Integer_Field('term_order', __('Term Order','event_espresso'), false, 0) |
|
39 | + 'object_id'=> new EE_Foreign_Key_Int_Field('object_id', __('Object(Post) ID', 'event_espresso'), false, 0, array('Event', 'Venue', 'Attendee')), |
|
40 | + 'term_taxonomy_id'=>new EE_Foreign_Key_Int_Field('term_taxonomy_id', __('Term (in context of a taxonomy) ID', 'event_espresso'), false, 0, 'Term_Taxonomy'), |
|
41 | + 'term_order'=>new EE_Integer_Field('term_order', __('Term Order', 'event_espresso'), false, 0) |
|
42 | 42 | )); |
43 | 43 | $this->_model_relations = array( |
44 | 44 | 'Event'=>new EE_Belongs_To_Relation(), |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | 'Term_Taxonomy'=>new EE_Belongs_To_Relation() |
48 | 48 | ); |
49 | 49 | $this->_indexes = array( |
50 | - 'PRIMARY'=>new EE_Primary_Key_Index(array('object_id','term_taxonomy_id')) |
|
50 | + 'PRIMARY'=>new EE_Primary_Key_Index(array('object_id', 'term_taxonomy_id')) |
|
51 | 51 | ); |
52 | 52 | |
53 | - parent::__construct( $timezone ); |
|
53 | + parent::__construct($timezone); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -59,17 +59,17 @@ discard block |
||
59 | 59 | * @global type $wpdb |
60 | 60 | * @return int the number of rows affected |
61 | 61 | */ |
62 | - public function update_term_taxonomy_counts($term_taxonomy_id = NULL){ |
|
62 | + public function update_term_taxonomy_counts($term_taxonomy_id = NULL) { |
|
63 | 63 | //because this uses a subquery and sometimes assigning to column to be another column's |
64 | 64 | //value, we just write the SQL directly. |
65 | 65 | global $wpdb; |
66 | - if( $term_taxonomy_id ){ |
|
67 | - $second_operand = $wpdb->prepare('%d',$term_taxonomy_id); |
|
68 | - }else{ |
|
66 | + if ($term_taxonomy_id) { |
|
67 | + $second_operand = $wpdb->prepare('%d', $term_taxonomy_id); |
|
68 | + } else { |
|
69 | 69 | $second_operand = 'tr.term_taxonomy_id'; |
70 | 70 | } |
71 | - $rows_affected = $this->_do_wpdb_query( 'query' , array("UPDATE {$wpdb->term_taxonomy} AS tt SET count = (select count(*) as proper_count |
|
72 | -from {$wpdb->term_relationships} AS tr WHERE tt.term_taxonomy_id = $second_operand)" ) ); |
|
71 | + $rows_affected = $this->_do_wpdb_query('query', array("UPDATE {$wpdb->term_taxonomy} AS tt SET count = (select count(*) as proper_count |
|
72 | +from {$wpdb->term_relationships} AS tr WHERE tt.term_taxonomy_id = $second_operand)")); |
|
73 | 73 | return $rows_affected; |
74 | 74 | } |
75 | 75 | |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function insert($field_n_values) { |
83 | 83 | $return = parent::insert($field_n_values); |
84 | - if( isset( $field_n_values[ 'term_taxonomy_id' ] ) ) { |
|
85 | - $this->update_term_taxonomy_counts($field_n_values[ 'term_taxonomy_id' ] ); |
|
84 | + if (isset($field_n_values['term_taxonomy_id'])) { |
|
85 | + $this->update_term_taxonomy_counts($field_n_values['term_taxonomy_id']); |
|
86 | 86 | } |
87 | 87 | return $return; |
88 | 88 | } |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | * @return int |
99 | 99 | */ |
100 | 100 | public function update($fields_n_values, $query_params, $keep_model_objs_in_sync = TRUE) { |
101 | - $count = parent::update($fields_n_values, $query_params, $keep_model_objs_in_sync ); |
|
102 | - if( $count ){ |
|
101 | + $count = parent::update($fields_n_values, $query_params, $keep_model_objs_in_sync); |
|
102 | + if ($count) { |
|
103 | 103 | $this->update_term_taxonomy_counts(); |
104 | 104 | } |
105 | 105 | return $count; |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function delete($query_params, $allow_blocking = true) { |
115 | 115 | $count = parent::delete($query_params, $allow_blocking); |
116 | - if( $count ){ |
|
116 | + if ($count) { |
|
117 | 117 | $this->update_term_taxonomy_counts(); |
118 | 118 | } |
119 | 119 | return $count; |
@@ -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 | } |
@@ -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 | * WP User Model. Not intended to replace WP_User, but this just allows |
4 | 6 | * for EE model queries to more easily integrate with the WP User table |
@@ -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(), |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | 'Venue' => new EE_Has_Many_Relation(), |
55 | 55 | ); |
56 | 56 | |
57 | - parent::__construct( $timezone ); |
|
57 | + parent::__construct($timezone); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | // End of file EEM_WP_User.model.php |
@@ -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 | } |
@@ -4,7 +4,7 @@ |
||
4 | 4 | function prepare_for_set($value_inputted_for_field_on_model_object) { |
5 | 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 | } |
@@ -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 |