Completed
Branch FET-8365-add-indexes (4b9253)
by
unknown
527:08 queued 512:28
created
core/db_models/EEM_Event_Venue.model.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -5,22 +5,22 @@  discard block
 block discarded – undo
5 5
  * You'll need to use each's EE_Has_Many_Relation relation to this model. Eg, when querying for question groups which apply to primary attendees,
6 6
  * you'd do a query like EEM_Question_Group::instance()->get_all(array(array('Event_Question_Group.EQG_primary'=>1)));
7 7
  */
8
-class EEM_Event_Venue extends EEM_Base{
8
+class EEM_Event_Venue extends EEM_Base {
9 9
 	// private instance of the Attendee object
10 10
 	protected static $_instance = NULL;
11 11
 
12
-	protected function __construct( $timezone = NULL ) {
13
-		$this->singular_item = __('Event to Question Group Link','event_espresso');
14
-		$this->plural_item = __('Event to Question Group Links','event_espresso');
12
+	protected function __construct($timezone = NULL) {
13
+		$this->singular_item = __('Event to Question Group Link', 'event_espresso');
14
+		$this->plural_item = __('Event to Question Group Links', 'event_espresso');
15 15
 		$this->_tables = array(
16
-			'Event_Venue'=>new EE_Primary_Table('esp_event_venue','EVV_ID')
16
+			'Event_Venue'=>new EE_Primary_Table('esp_event_venue', 'EVV_ID')
17 17
 		);
18 18
 		$this->_fields = array(
19 19
 			'Event_Venue'=>array(
20
-				'EVV_ID'=>new EE_Primary_Key_Int_Field('EVV_ID', __('Event to Venue Link ID','event_espresso')),
21
-				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID','event_espresso'), false, 0, 'Event'),
22
-				'VNU_ID'=>new EE_Foreign_Key_Int_Field('VNU_ID', __('Venue ID','event_espresso'), false, 0, 'Venue'),
23
-				'EVV_primary'=>new EE_Boolean_Field('EVV_primary', __("Flag indicating venue is primary one for event", "event_espresso"), false,true)
20
+				'EVV_ID'=>new EE_Primary_Key_Int_Field('EVV_ID', __('Event to Venue Link ID', 'event_espresso')),
21
+				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID', 'event_espresso'), false, 0, 'Event'),
22
+				'VNU_ID'=>new EE_Foreign_Key_Int_Field('VNU_ID', __('Venue ID', 'event_espresso'), false, 0, 'Venue'),
23
+				'EVV_primary'=>new EE_Boolean_Field('EVV_primary', __("Flag indicating venue is primary one for event", "event_espresso"), false, true)
24 24
 
25 25
 			)
26 26
 		);
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
 			'Venue'=>new EE_Belongs_To_Relation()
30 30
 		);
31 31
 		//this model is generally available for reading
32
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public( 'Event' );
33
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' );
34
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' );
35
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event', EEM_Base::caps_edit );
36
-		parent::__construct( $timezone );
32
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Event_Related_Public('Event');
33
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Event_Related_Protected('Event');
34
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Event_Related_Protected('Event');
35
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Event_Related_Protected('Event', EEM_Base::caps_edit);
36
+		parent::__construct($timezone);
37 37
 	}
38 38
 
39 39
 
Please login to merge, or discard this patch.
core/db_models/EEM_Extra_Meta.model.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * ------------------------------------------------------------------------
28 28
  */
29
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
29
+require_once (EE_MODELS.'EEM_Base.model.php');
30 30
 
31 31
 class EEM_Extra_Meta extends EEM_Base {
32 32
 
33 33
   	// private instance of the Attendee object
34 34
 	protected static $_instance = NULL;
35 35
 
36
-	protected function __construct( $timezone = NULL ) {
37
-		$this->singular_item = __('Extra Meta','event_espresso');
38
-		$this->plural_item = __('Extra Metas','event_espresso');
36
+	protected function __construct($timezone = NULL) {
37
+		$this->singular_item = __('Extra Meta', 'event_espresso');
38
+		$this->plural_item = __('Extra Metas', 'event_espresso');
39 39
 		$this->_tables = array(
40 40
 			'Extra_Meta'=> new EE_Primary_Table('esp_extra_meta', 'EXM_ID')
41 41
 		);
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
 
51 51
 			));
52 52
 		$this->_model_relations = array();
53
-		foreach($models_this_can_attach_to as $model){
53
+		foreach ($models_this_can_attach_to as $model) {
54 54
 			$this->_model_relations[$model] = new EE_Belongs_To_Any_Relation();
55 55
 		}
56
-		parent::__construct( $timezone );
56
+		parent::__construct($timezone);
57 57
 	}
58 58
 
59 59
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
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
  *
Please login to merge, or discard this patch.
core/db_models/EEM_Message_Template.model.php 3 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,30 +1,30 @@
 block discarded – undo
1 1
 <?php if (!defined('EVENT_ESPRESSO_VERSION') )
2 2
 	exit('NO direct script access allowed');
3 3
 /**
4
- * Event Espresso
5
- *
6
- * Event Registration and Management Plugin for Wordpress
7
- *
8
- * @package		Event Espresso
9
- * @author		Seth Shoultes
10
- * @copyright	(c)2009-2012 Event Espresso All Rights Reserved.
11
- * @license		@link http://eventespresso.com/support/terms-conditions/  ** see Plugin Licensing * *
12
- * @link		http://www.eventespresso.com
13
- * @version		4.1
14
- *
15
- * ------------------------------------------------------------------------
16
- *
17
- * EEM_Message_Template
18
- *
19
- *
20
- *
21
- * @package		Event Espresso
22
- * @subpackage	includes/models/EEM_Message_Template.model.php
23
- * @author		Darren Ethier
24
- *
25
- *
26
- * ------------------------------------------------------------------------
27
- */
4
+	 * Event Espresso
5
+	 *
6
+	 * Event Registration and Management Plugin for Wordpress
7
+	 *
8
+	 * @package		Event Espresso
9
+	 * @author		Seth Shoultes
10
+	 * @copyright	(c)2009-2012 Event Espresso All Rights Reserved.
11
+	 * @license		@link http://eventespresso.com/support/terms-conditions/  ** see Plugin Licensing * *
12
+	 * @link		http://www.eventespresso.com
13
+	 * @version		4.1
14
+	 *
15
+	 * ------------------------------------------------------------------------
16
+	 *
17
+	 * EEM_Message_Template
18
+	 *
19
+	 *
20
+	 *
21
+	 * @package		Event Espresso
22
+	 * @subpackage	includes/models/EEM_Message_Template.model.php
23
+	 * @author		Darren Ethier
24
+	 *
25
+	 *
26
+	 * ------------------------------------------------------------------------
27
+	 */
28 28
 class EEM_Message_Template extends EEM_Base {
29 29
 	//private instance of the EEM_Message_Template object
30 30
 	protected static $_instance = NULL;
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION') )
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION'))
2 2
 	exit('NO direct script access allowed');
3 3
 /**
4 4
  * Event Espresso
@@ -36,19 +36,19 @@  discard block
 block discarded – undo
36 36
 	 * 		@access protected
37 37
 	 * 		@return void
38 38
 	 */
39
-	protected function __construct( $timezone = NULL ) {
40
-		$this->singular_item = __('Message Template','event_espresso');
41
-		$this->plural_item = __('Message Templates','event_espresso');
39
+	protected function __construct($timezone = NULL) {
40
+		$this->singular_item = __('Message Template', 'event_espresso');
41
+		$this->plural_item = __('Message Templates', 'event_espresso');
42 42
 
43 43
 		$this->_tables = array(
44
-			'Message_Template' => new EE_Primary_Table('esp_message_template', 'MTP_ID' )
44
+			'Message_Template' => new EE_Primary_Table('esp_message_template', 'MTP_ID')
45 45
 		);
46 46
 		$this->_fields = array(
47 47
 			'Message_Template'=> array(
48 48
 				'MTP_ID'=> new EE_Primary_Key_Int_Field('MTP_ID', __('Message Template ID', 'event_espresso')),
49
-				'GRP_ID' => new EE_Foreign_Key_Int_Field('GRP_ID', __('Message Template Group ID', 'event_espresso'), FALSE, 0, 'Message_Template_Group' ),
50
-				'MTP_template_field'=>new EE_Plain_Text_Field('MTP_template_field', __('Field Name for this Template', 'event_espresso'), false, 'default' ),
51
-				'MTP_context'=>new EE_Plain_Text_Field('MTP_context', __('Message Type Context for this field', 'event_espresso'),false,'admin' ),
49
+				'GRP_ID' => new EE_Foreign_Key_Int_Field('GRP_ID', __('Message Template Group ID', 'event_espresso'), FALSE, 0, 'Message_Template_Group'),
50
+				'MTP_template_field'=>new EE_Plain_Text_Field('MTP_template_field', __('Field Name for this Template', 'event_espresso'), false, 'default'),
51
+				'MTP_context'=>new EE_Plain_Text_Field('MTP_context', __('Message Type Context for this field', 'event_espresso'), false, 'admin'),
52 52
 				'MTP_content'=>new EE_Serialized_Text_Field('MTP_content', __('The field content for the template', 'event_espresso'), false, ''),
53 53
 				)
54 54
 		);
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
57 57
 			'Message_Template_Group' => new EE_Belongs_To_Relation()
58 58
 			);
59 59
 		$this->_model_chain_to_wp_user = 'Message_Template_Group';
60
-		foreach( $this->_cap_contexts_to_cap_action_map as $context => $action ){
61
-			$this->_cap_restriction_generators[ $context ] = new EE_Restriction_Generator_Global( 'Message_Template_Group.MTP_is_global');
60
+		foreach ($this->_cap_contexts_to_cap_action_map as $context => $action) {
61
+			$this->_cap_restriction_generators[$context] = new EE_Restriction_Generator_Global('Message_Template_Group.MTP_is_global');
62 62
 		}
63 63
 		$this->_caps_slug = 'messages';
64
-		parent::__construct( $timezone );
64
+		parent::__construct($timezone);
65 65
 	}
66 66
 
67 67
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,6 @@
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION') )
1
+<?php if (!defined('EVENT_ESPRESSO_VERSION') ) {
2 2
 	exit('NO direct script access allowed');
3
+}
3 4
 /**
4 5
  * Event Espresso
5 6
  *
Please login to merge, or discard this patch.
core/db_models/EEM_Question.model.php 2 patches
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
25
-require_once( EE_CLASSES . 'EE_Question.class.php');
24
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
25
+require_once(EE_CLASSES.'EE_Question.class.php');
26 26
 
27 27
 class EEM_Question extends EEM_Soft_Delete_Base {
28 28
 
@@ -69,21 +69,21 @@  discard block
 block discarded – undo
69 69
 	// private instance of the Attendee object
70 70
 	protected static $_instance = NULL;
71 71
 
72
-	protected function __construct( $timezone = NULL ) {
73
-		$this->singular_item = __('Question','event_espresso');
74
-		$this->plural_item = __('Questions','event_espresso');
75
-		$this->_allowed_question_types=apply_filters(
72
+	protected function __construct($timezone = NULL) {
73
+		$this->singular_item = __('Question', 'event_espresso');
74
+		$this->plural_item = __('Questions', 'event_espresso');
75
+		$this->_allowed_question_types = apply_filters(
76 76
 			'FHEE__EEM_Question__construct__allowed_question_types',
77 77
 			array(
78
-				EEM_Question::QST_type_text =>__('Text','event_espresso'),
79
-				EEM_Question::QST_type_textarea =>__('Textarea','event_espresso'),
80
-				EEM_Question::QST_type_checkbox =>__('Checkboxes','event_espresso'),
81
-				EEM_Question::QST_type_radio =>__('Radio Buttons','event_espresso'),
82
-				EEM_Question::QST_type_dropdown =>__('Dropdown','event_espresso'),
83
-				EEM_Question::QST_type_state =>__('State/Province Dropdown','event_espresso'),
84
-				EEM_Question::QST_type_country =>__('Country Dropdown','event_espresso'),
85
-				EEM_Question::QST_type_date =>__('Date Picker','event_espresso'),
86
-				EEM_Question::QST_type_html_textarea => __( 'HTML Textarea', 'event_espresso' ),
78
+				EEM_Question::QST_type_text =>__('Text', 'event_espresso'),
79
+				EEM_Question::QST_type_textarea =>__('Textarea', 'event_espresso'),
80
+				EEM_Question::QST_type_checkbox =>__('Checkboxes', 'event_espresso'),
81
+				EEM_Question::QST_type_radio =>__('Radio Buttons', 'event_espresso'),
82
+				EEM_Question::QST_type_dropdown =>__('Dropdown', 'event_espresso'),
83
+				EEM_Question::QST_type_state =>__('State/Province Dropdown', 'event_espresso'),
84
+				EEM_Question::QST_type_country =>__('Country Dropdown', 'event_espresso'),
85
+				EEM_Question::QST_type_date =>__('Date Picker', 'event_espresso'),
86
+				EEM_Question::QST_type_html_textarea => __('HTML Textarea', 'event_espresso'),
87 87
 			)
88 88
 		);
89 89
 		$this->_question_type_categories = apply_filters(
@@ -102,21 +102,21 @@  discard block
 block discarded – undo
102 102
 		);
103 103
 
104 104
 		$this->_tables = array(
105
-			'Question'=>new EE_Primary_Table('esp_question','QST_ID')
105
+			'Question'=>new EE_Primary_Table('esp_question', 'QST_ID')
106 106
 		);
107 107
 		$this->_fields = array(
108 108
 			'Question'=>array(
109
-				'QST_ID'=>new EE_Primary_Key_Int_Field('QST_ID', __('Question ID','event_espresso')),
110
-				'QST_display_text'=>new EE_Full_HTML_Field('QST_display_text', __('Question Text','event_espresso'), true, ''),
111
-				'QST_admin_label'=>new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)','event_espresso'), true, ''),
112
-				'QST_system'=>new EE_Plain_Text_Field('QST_system', __('Internal string ID for question','event_espresso'), TRUE, NULL ),
113
-				'QST_type'=>new EE_Enum_Text_Field('QST_type', __('Question Type','event_espresso'),false, 'TEXT',$this->_allowed_question_types),
114
-				'QST_required'=>new EE_Boolean_Field('QST_required', __('Required Question?','event_espresso'), false, false),
115
-				'QST_required_text'=>new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided','event_espresso'), true, ''),
116
-				'QST_order'=>new EE_Integer_Field('QST_order', __('Question Order','event_espresso'), false, 0),
117
-				'QST_admin_only'=>new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?','event_espresso'), false, false),
118
-				'QST_wp_user'=>new EE_WP_User_Field('QST_wp_user', __('Question Creator ID','event_espresso'), false ),
119
-				'QST_deleted'=>new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted','event_espresso'), false, false)
109
+				'QST_ID'=>new EE_Primary_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso')),
110
+				'QST_display_text'=>new EE_Full_HTML_Field('QST_display_text', __('Question Text', 'event_espresso'), true, ''),
111
+				'QST_admin_label'=>new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)', 'event_espresso'), true, ''),
112
+				'QST_system'=>new EE_Plain_Text_Field('QST_system', __('Internal string ID for question', 'event_espresso'), TRUE, NULL),
113
+				'QST_type'=>new EE_Enum_Text_Field('QST_type', __('Question Type', 'event_espresso'), false, 'TEXT', $this->_allowed_question_types),
114
+				'QST_required'=>new EE_Boolean_Field('QST_required', __('Required Question?', 'event_espresso'), false, false),
115
+				'QST_required_text'=>new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided', 'event_espresso'), true, ''),
116
+				'QST_order'=>new EE_Integer_Field('QST_order', __('Question Order', 'event_espresso'), false, 0),
117
+				'QST_admin_only'=>new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?', 'event_espresso'), false, false),
118
+				'QST_wp_user'=>new EE_WP_User_Field('QST_wp_user', __('Question Creator ID', 'event_espresso'), false),
119
+				'QST_deleted'=>new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted', 'event_espresso'), false, false)
120 120
 			)
121 121
 		);
122 122
 		$this->_model_relations = array(
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
 			'Question_Group_Question'=>new EE_Has_Many_Relation()
129 129
 		);
130 130
 		//this model is generally available for reading
131
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
132
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('QST_system');
133
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('QST_system');
134
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('QST_system');
135
-		parent::__construct( $timezone );
131
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
132
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('QST_system');
133
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('QST_system');
134
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('QST_system');
135
+		parent::__construct($timezone);
136 136
 	}
137 137
 
138 138
 	/**
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	 * but they can be extended
141 141
 	 * @return string[]
142 142
 	 */
143
-	public function allowed_question_types(){
143
+	public function allowed_question_types() {
144 144
 		return $this->_allowed_question_types;
145 145
 	}
146 146
 	/**
@@ -148,16 +148,16 @@  discard block
 block discarded – undo
148 148
 	 * @param string $question_type one of EEM_Question::allowed_question_types(
149 149
 	 * @return string[] like EEM_Question::allowed_question_types()
150 150
 	 */
151
-	public function question_types_in_same_category( $question_type ) {
152
-		$question_types = array( $question_type );
153
-		foreach( $this->_question_type_categories as $category => $question_types_in_category ) {
154
-			if( in_array( $question_type, $question_types_in_category ) ) {
151
+	public function question_types_in_same_category($question_type) {
152
+		$question_types = array($question_type);
153
+		foreach ($this->_question_type_categories as $category => $question_types_in_category) {
154
+			if (in_array($question_type, $question_types_in_category)) {
155 155
 				$question_types = $question_types_in_category;
156 156
 				break;
157 157
 			}
158 158
 		}
159 159
 
160
-		return array_intersect_key( $this->allowed_question_types(), array_flip( $question_types ) );
160
+		return array_intersect_key($this->allowed_question_types(), array_flip($question_types));
161 161
 	}
162 162
 
163 163
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 * which system question QST_ID corresponds to the QST_system 'city', use EEM_Question::instance()->get_Question_ID_from_system_string('city');
168 168
 	 * @return int of QST_ID for the question that corresponds to that QST_system
169 169
 	 */
170
-	public function get_Question_ID_from_system_string($QST_system){
170
+	public function get_Question_ID_from_system_string($QST_system) {
171 171
 		 $conversion_array = array(
172 172
 			'fname'=> EEM_Attendee::fname_question_id,
173 173
 			'lname'=> EEM_Attendee::lname_question_id,
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 			'phone'=> EEM_Attendee::phone_question_id
182 182
 		);
183 183
 
184
-		return isset( $conversion_array[ $QST_system ] ) ? $conversion_array[ $QST_system ] : NULL;
184
+		return isset($conversion_array[$QST_system]) ? $conversion_array[$QST_system] : NULL;
185 185
 
186 186
 	}
187 187
 
@@ -193,9 +193,9 @@  discard block
 block discarded – undo
193 193
 	 */
194 194
 	public function get_latest_question_order() {
195 195
 		$columns_to_select = array(
196
-			'max_order' => array("MAX(QST_order)","%d")
196
+			'max_order' => array("MAX(QST_order)", "%d")
197 197
 			);
198
-		$max = $this->_get_all_wpdb_results(array(), ARRAY_A, $columns_to_select );
198
+		$max = $this->_get_all_wpdb_results(array(), ARRAY_A, $columns_to_select);
199 199
 		return $max[0]['max_order'];
200 200
 	}
201 201
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
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
  *
Please login to merge, or discard this patch.
core/db_models/EEM_Question_Group.model.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
25
-require_once( EE_CLASSES . 'EE_Question_Group.class.php');
24
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
25
+require_once(EE_CLASSES.'EE_Question_Group.class.php');
26 26
 class EEM_Question_Group extends EEM_Soft_Delete_Base {
27 27
 	const system_personal = 1;
28 28
 	const system_address = 2;
@@ -30,25 +30,25 @@  discard block
 block discarded – undo
30 30
 	protected static $_instance = NULL;
31 31
 
32 32
 
33
-	protected function __construct( $timezone = NULL ) {
34
-		$this->singular_item = __('Question Group','event_espresso');
35
-		$this->plural_item = __('Question Groups','event_espresso');
33
+	protected function __construct($timezone = NULL) {
34
+		$this->singular_item = __('Question Group', 'event_espresso');
35
+		$this->plural_item = __('Question Groups', 'event_espresso');
36 36
 
37 37
 		$this->_tables = array(
38
-			'Question_Group'=>new EE_Primary_Table('esp_question_group','QSG_ID')
38
+			'Question_Group'=>new EE_Primary_Table('esp_question_group', 'QSG_ID')
39 39
 		);
40 40
 		$this->_fields = array(
41 41
 			'Question_Group'=>array(
42
-				'QSG_ID'=>new EE_Primary_Key_Int_Field('QSG_ID', __('Question Group ID','event_espresso')),
43
-				'QSG_name'=>new EE_Plain_Text_Field('QSG_name', __('Question Group Name','event_espresso'), false, ''),
44
-				'QSG_identifier'=>new EE_Plain_Text_Field('QSG_identifier', __('Text ID for question Group','event_espresso'), false, ''),
45
-				'QSG_desc'=>new EE_Full_HTML_Field('QSG_desc', __('Description of Question Group','event_espresso'), true, ''),
46
-				'QSG_order'=>new EE_Integer_Field('QSG_order', __('Order in which to show the question group','event_espresso'), true, 0),
47
-				'QSG_show_group_name'=>new EE_Boolean_Field('QSG_show_group_name', __('Flag indicating whether to show the group\'s name on the registration page','event_espresso'), false, true),
48
-				'QSG_show_group_desc'=>new EE_Boolean_Field('QSG_show_group_desc', __('Flag indicating whether to show the group\s description on the registration page','event_espresso'), false, false),
49
-				'QSG_wp_user' => new EE_WP_User_Field('QSG_wp_user', __('Question Group Creator ID', 'event_espresso'), FALSE ),
50
-				'QSG_system'=>new EE_Integer_Field('QSG_system', __('Indicate IF this is a system group and if it is what system group it corresponds to.','event_espresso'), false, 0),
51
-				'QSG_deleted'=>new EE_Trashed_Flag_Field('QSG_deleted', __('Flag indicating this question group was deleted','event_espresso'), false, false)
42
+				'QSG_ID'=>new EE_Primary_Key_Int_Field('QSG_ID', __('Question Group ID', 'event_espresso')),
43
+				'QSG_name'=>new EE_Plain_Text_Field('QSG_name', __('Question Group Name', 'event_espresso'), false, ''),
44
+				'QSG_identifier'=>new EE_Plain_Text_Field('QSG_identifier', __('Text ID for question Group', 'event_espresso'), false, ''),
45
+				'QSG_desc'=>new EE_Full_HTML_Field('QSG_desc', __('Description of Question Group', 'event_espresso'), true, ''),
46
+				'QSG_order'=>new EE_Integer_Field('QSG_order', __('Order in which to show the question group', 'event_espresso'), true, 0),
47
+				'QSG_show_group_name'=>new EE_Boolean_Field('QSG_show_group_name', __('Flag indicating whether to show the group\'s name on the registration page', 'event_espresso'), false, true),
48
+				'QSG_show_group_desc'=>new EE_Boolean_Field('QSG_show_group_desc', __('Flag indicating whether to show the group\s description on the registration page', 'event_espresso'), false, false),
49
+				'QSG_wp_user' => new EE_WP_User_Field('QSG_wp_user', __('Question Group Creator ID', 'event_espresso'), FALSE),
50
+				'QSG_system'=>new EE_Integer_Field('QSG_system', __('Indicate IF this is a system group and if it is what system group it corresponds to.', 'event_espresso'), false, 0),
51
+				'QSG_deleted'=>new EE_Trashed_Flag_Field('QSG_deleted', __('Flag indicating this question group was deleted', 'event_espresso'), false, false)
52 52
 			)
53 53
 		);
54 54
 		$this->_model_relations = array(
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
 			'WP_User' => new EE_Belongs_To_Relation(),
59 59
 		);
60 60
 		//this model is generally available for reading
61
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
62
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('QSG_system');
63
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('QSG_system');
64
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('QSG_system');
65
-		parent::__construct( $timezone );
61
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
62
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('QSG_system');
63
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('QSG_system');
64
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('QSG_system');
65
+		parent::__construct($timezone);
66 66
 
67 67
 	}
68 68
 
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function get_latest_question_group_order() {
77 77
 		$columns_to_select = array(
78
-			'max_order' => array("MAX(QSG_order)","%d")
78
+			'max_order' => array("MAX(QSG_order)", "%d")
79 79
 			);
80
-		$max = $this->_get_all_wpdb_results(array(), ARRAY_A, $columns_to_select );
80
+		$max = $this->_get_all_wpdb_results(array(), ARRAY_A, $columns_to_select);
81 81
 		return $max[0]['max_order'];
82 82
 	}
83 83
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
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
  *
Please login to merge, or discard this patch.
core/db_models/EEM_Question_Group_Question.model.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -26,26 +26,26 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * ------------------------------------------------------------------------
28 28
  */
29
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
30
-require_once( EE_CLASSES . 'EE_Question_Group_Question.class.php');
29
+require_once (EE_MODELS.'EEM_Base.model.php');
30
+require_once(EE_CLASSES.'EE_Question_Group_Question.class.php');
31 31
 class EEM_Question_Group_Question extends EEM_Base {
32 32
 
33 33
   	// private instance of the Attendee object
34 34
 	protected static $_instance = NULL;
35 35
 
36 36
 
37
-	protected function __construct( $timezone = NULL ) {
38
-		$this->singular_item = __('Question Group to Question Link','event_espresso');
39
-		$this->plural_item = __('Question Group to Question Links','event_espresso');
37
+	protected function __construct($timezone = NULL) {
38
+		$this->singular_item = __('Question Group to Question Link', 'event_espresso');
39
+		$this->plural_item = __('Question Group to Question Links', 'event_espresso');
40 40
 		$this->_tables = array(
41
-			'Question_Group_Question'=>new EE_Primary_Table('esp_question_group_question','QGQ_ID')
41
+			'Question_Group_Question'=>new EE_Primary_Table('esp_question_group_question', 'QGQ_ID')
42 42
 		);
43 43
 		$this->_fields = array(
44 44
 			'Question_Group_Question'=>array(
45
-				'QGQ_ID'=>new EE_Primary_Key_Int_Field('QGQ_ID', __('Question Group to Question Link ID','event_espresso')),
46
-				'QSG_ID'=>new EE_Foreign_Key_Int_Field('QSG_ID', __('Question Group ID','event_espresso'), false, 0, 'Question_Group'),
47
-				'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question Id','event_espresso'), false, 0, 'Question'),
48
-				'QGQ_order' => new EE_Integer_Field('QGQ_order', __('Question Group Question Order', 'event_espresso'), false, 0 )
45
+				'QGQ_ID'=>new EE_Primary_Key_Int_Field('QGQ_ID', __('Question Group to Question Link ID', 'event_espresso')),
46
+				'QSG_ID'=>new EE_Foreign_Key_Int_Field('QSG_ID', __('Question Group ID', 'event_espresso'), false, 0, 'Question_Group'),
47
+				'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question Id', 'event_espresso'), false, 0, 'Question'),
48
+				'QGQ_order' => new EE_Integer_Field('QGQ_order', __('Question Group Question Order', 'event_espresso'), false, 0)
49 49
 			)
50 50
 		);
51 51
 		$this->_model_relations = array(
@@ -55,13 +55,13 @@  discard block
 block discarded – undo
55 55
 
56 56
 		$this->_model_chain_to_wp_user = 'Question_Group';
57 57
 		//this model is generally available for reading
58
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
59
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('Question_Group.QSG_system');
60
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('Question_Group.QSG_system');
61
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('Question_Group.QSG_system');
58
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
59
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('Question_Group.QSG_system');
60
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('Question_Group.QSG_system');
61
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('Question_Group.QSG_system');
62 62
 		//use the caps for question groups
63 63
 		$this->_caps_slug = 'question_groups';
64
-		parent::__construct( $timezone );
64
+		parent::__construct($timezone);
65 65
 	}
66 66
 
67 67
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
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
  *
Please login to merge, or discard this patch.
core/db_models/EEM_Question_Option.model.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
25
-require_once( EE_CLASSES . 'EE_Question_Option.class.php');
24
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
25
+require_once(EE_CLASSES.'EE_Question_Option.class.php');
26 26
 
27 27
 
28 28
 class EEM_Question_Option extends EEM_Soft_Delete_Base {
@@ -30,21 +30,21 @@  discard block
 block discarded – undo
30 30
   	// private instance of the Attendee object
31 31
 	protected static $_instance = NULL;
32 32
 
33
-	protected function __construct( $timezone = NULL ) {
34
-		$this->singular_item = __('Question Option','event_espresso');
35
-		$this->plural_item = __('Question Options','event_espresso');
33
+	protected function __construct($timezone = NULL) {
34
+		$this->singular_item = __('Question Option', 'event_espresso');
35
+		$this->plural_item = __('Question Options', 'event_espresso');
36 36
 
37 37
 		$this->_tables = array(
38
-			'Question_Option'=>new EE_Primary_Table('esp_question_option','QSO_ID')
38
+			'Question_Option'=>new EE_Primary_Table('esp_question_option', 'QSO_ID')
39 39
 		);
40 40
 		$this->_fields = array(
41 41
 			'Question_Option'=>array(
42
-					'QSO_ID'=>new EE_Primary_Key_Int_Field('QSO_ID', __('Question Option ID','event_espresso')),
43
-					'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID','event_espresso'), false, 0, 'Question'),
44
-					'QSO_value'=>new EE_Plain_Text_Field('QSO_value',  __("Question Option Value", "event_espresso"),false,''),
45
-					'QSO_desc'=>new EE_Full_HTML_Field('QSO_desc', __('Question Option Description','event_espresso'), false, ''),
46
-					'QSO_order' => new EE_Integer_Field('QSO_order', __('Question Option Order', 'event_espresso' ), false, 0 ),
47
-					'QSO_deleted'=>new EE_Trashed_Flag_Field('QSO_deleted', __('Flag indicating Option was trashed','event_espresso'), false, false)
42
+					'QSO_ID'=>new EE_Primary_Key_Int_Field('QSO_ID', __('Question Option ID', 'event_espresso')),
43
+					'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso'), false, 0, 'Question'),
44
+					'QSO_value'=>new EE_Plain_Text_Field('QSO_value', __("Question Option Value", "event_espresso"), false, ''),
45
+					'QSO_desc'=>new EE_Full_HTML_Field('QSO_desc', __('Question Option Description', 'event_espresso'), false, ''),
46
+					'QSO_order' => new EE_Integer_Field('QSO_order', __('Question Option Order', 'event_espresso'), false, 0),
47
+					'QSO_deleted'=>new EE_Trashed_Flag_Field('QSO_deleted', __('Flag indicating Option was trashed', 'event_espresso'), false, false)
48 48
 				)
49 49
 		);
50 50
 		$this->_model_relations = array(
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
 
54 54
 		$this->_model_chain_to_wp_user = 'Question';
55 55
 		//this model is generally available for reading
56
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
57
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('Question_Option');
58
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('Question_Option');
59
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('Question_Option');
56
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
57
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('Question_Option');
58
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('Question_Option');
59
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('Question_Option');
60 60
 		$this->_caps_slug = 'questions';
61
-		parent::__construct( $timezone );
61
+		parent::__construct($timezone);
62 62
 	}
63 63
 
64 64
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
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
  *
Please login to merge, or discard this patch.
core/db_models/EEM_Registration.model.php 4 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -219,11 +219,11 @@  discard block
 block discarded – undo
219 219
 
220 220
 
221 221
 	/**
222
-	*		retrieve ALL registrations for a particular Attendee from db
223
-	* 		@access		public
224
-	* 		@param		int		$ATT_ID
225
-	*		@return 	EE_Registration[]
226
-	*/
222
+	 *		retrieve ALL registrations for a particular Attendee from db
223
+	 * 		@access		public
224
+	 * 		@param		int		$ATT_ID
225
+	 *		@return 	EE_Registration[]
226
+	 */
227 227
 	public function get_all_registrations_for_attendee( $ATT_ID = 0 ) {
228 228
 		if ( ! $ATT_ID ) {
229 229
 			return FALSE;
@@ -250,14 +250,14 @@  discard block
 block discarded – undo
250 250
 
251 251
 
252 252
 	/**
253
-	*		retrieve registration for a specific transaction attendee from db
254
-	*
255
-	* 		@access		public
256
-	* 		@param	int	$TXN_ID
257
-	* 		@param    int		$ATT_ID
258
-	* 		@param    int		$att_nmbr 	in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required
259
-	*		@return 		mixed		array on success, FALSE on fail
260
-	*/
253
+	 *		retrieve registration for a specific transaction attendee from db
254
+	 *
255
+	 * 		@access		public
256
+	 * 		@param	int	$TXN_ID
257
+	 * 		@param    int		$ATT_ID
258
+	 * 		@param    int		$att_nmbr 	in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required
259
+	 *		@return 		mixed		array on success, FALSE on fail
260
+	 */
261 261
 	public function get_registration_for_transaction_attendee( $TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0 ) {
262 262
 		return $this->get_one(array(
263 263
 			array(
@@ -270,12 +270,12 @@  discard block
 block discarded – undo
270 270
 
271 271
 
272 272
 	/**
273
-	*		get the number of registrations per day  for the Registration Admin page Reports Tab.
273
+	 *		get the number of registrations per day  for the Registration Admin page Reports Tab.
274 274
 	 *		(doesn't utilize models because it's a fairly specialized query)
275
-	* 		@access		public
275
+	 * 		@access		public
276 276
 	 *		@param $period string which can be passed to php's strtotime function (eg "-1 month")
277 277
 	 *		@return stdClass[] with properties regDate and total
278
-	*/
278
+	 */
279 279
 	public function get_registrations_per_day_report( $period = '-1 month' ) {
280 280
 
281 281
 		$sql_date = $this->convert_datetime_for_query( 'REG_date', date("Y-m-d H:i:s", strtotime($period) ), 'Y-m-d H:i:s', 'UTC' );
@@ -304,11 +304,11 @@  discard block
 block discarded – undo
304 304
 
305 305
 
306 306
 	/**
307
-	*		get the number of registrations per event  for the Registration Admin page Reports Tab
308
-	* 		@access		public
307
+	 *		get the number of registrations per event  for the Registration Admin page Reports Tab
308
+	 * 		@access		public
309 309
 	 * @param $period string which can be passed to php's strtotime function (eg "-1 month")
310 310
 	 *		@return stdClass[] each with properties event_name, reg_limit, and total
311
-	*/
311
+	 */
312 312
 	public function get_registrations_per_event_report( $period = '-1 month' ) {
313 313
 
314 314
 		$date_sql = $this->convert_datetime_for_query( 'REG_date', date( "Y-m-d H:i:s", strtotime( $period )), 'Y-m-d H:i:s', 'UTC' );
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
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
  *
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	/**
202 202
 	 * This returns a wpdb->results array of all registration date month and years matching the incoming query params and grouped by month and year.
203 203
 	 * @param  array  $where_params Array of query_params as described in the comments for EEM_Base::get_all()
204
-	 * @return wpdb results array
204
+	 * @return stdClass[] results array
205 205
 	 */
206 206
 	public function get_reg_months_and_years( $where_params ) {
207 207
 		$query_params[0] = $where_params;
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 	* 		@param		$TXN_ID
256 256
 	* 		@param		$ATT_ID
257 257
 	* 		@param		$att_nmbr 	in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required
258
-	*		@return 		mixed		array on success, FALSE on fail
258
+	*		@return 		EE_Soft_Delete_Base_Class|null		array on success, FALSE on fail
259 259
 	*/
260 260
 	public function get_registration_for_transaction_attendee( $TXN_ID = FALSE, $ATT_ID = FALSE, $att_nmbr = FALSE ) {
261 261
 		return $this->get_one(array(
Please login to merge, or discard this patch.
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
3
-require_once ( EE_CLASSES . 'EE_Registration.class.php' );
2
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
3
+require_once (EE_CLASSES.'EE_Registration.class.php');
4 4
 /**
5 5
  *
6 6
  * Registration Model
@@ -92,31 +92,31 @@  discard block
 block discarded – undo
92 92
 	 *    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)
93 93
 	 * @return \EEM_Registration
94 94
 	 */
95
-	protected function __construct( $timezone ) {
96
-		$this->singular_item = __('Registration','event_espresso');
97
-		$this->plural_item = __('Registrations','event_espresso');
95
+	protected function __construct($timezone) {
96
+		$this->singular_item = __('Registration', 'event_espresso');
97
+		$this->plural_item = __('Registrations', 'event_espresso');
98 98
 
99 99
 		$this->_tables = array(
100
-			'Registration'=>new EE_Primary_Table('esp_registration','REG_ID')
100
+			'Registration'=>new EE_Primary_Table('esp_registration', 'REG_ID')
101 101
 		);
102 102
 		$this->_fields = array(
103 103
 			'Registration'=>array(
104
-				'REG_ID'=>new EE_Primary_Key_Int_Field('REG_ID', __('Registration ID','event_espresso')),
105
-				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Even tID','event_espresso'), false, 0, 'Event'),
106
-				'ATT_ID'=>new EE_Foreign_Key_Int_Field('ATT_ID', __('Attendee ID','event_espresso'), false, 0, 'Attendee'),
107
-				'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID','event_espresso'), false, 0, 'Transaction'),
108
-				'TKT_ID'=>new EE_Foreign_Key_Int_Field('TKT_ID', __('Ticket ID','event_espresso'), false, 0, 'Ticket'),
109
-				'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID','event_espresso'), false, EEM_Registration::status_id_incomplete, 'Status'),
110
-				'REG_date'=>new EE_Datetime_Field('REG_date', __('Time registration occurred','event_espresso'), false, current_time('timestamp'), $timezone ),
111
-				'REG_final_price'=>new EE_Money_Field('REG_final_price', __('Final Price of registration after all ticket/price modifications','event_espresso'), false, 0),
112
-				'REG_paid'=>new EE_Money_Field('REG_paid', __('Amount paid to date towards registration','event_espresso'), false, 0),
113
-				'REG_session'=>new EE_Plain_Text_Field('REG_session', __('Session ID of registration','event_espresso'), false, ''),
114
-				'REG_code'=>new EE_Plain_Text_Field('REG_code', __('Unique Code for this registration','event_espresso'), false, ''),
115
-				'REG_url_link'=>new EE_Plain_Text_Field('REG_url_link', __('String to be used in URL for identifying registration','event_espresso'), false, ''),
116
-				'REG_count'=>new EE_Integer_Field('REG_count', __('Count of this registration in the group registration ','event_espresso'), true, 1),
117
-				'REG_group_size'=>new EE_Integer_Field('REG_group_size', __('Number of registrations on this group','event_espresso'), false, 1),
118
-				'REG_att_is_going'=>new EE_Boolean_Field('REG_att_is_going', __('Flag indicating the registrant plans on attending','event_espresso'), false, false),
119
-				'REG_deleted' => new EE_Trashed_Flag_Field('REG_deleted', __('Flag indicating if registration has been archived or not.', 'event_espresso'), false, false )
104
+				'REG_ID'=>new EE_Primary_Key_Int_Field('REG_ID', __('Registration ID', 'event_espresso')),
105
+				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Even tID', 'event_espresso'), false, 0, 'Event'),
106
+				'ATT_ID'=>new EE_Foreign_Key_Int_Field('ATT_ID', __('Attendee ID', 'event_espresso'), false, 0, 'Attendee'),
107
+				'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso'), false, 0, 'Transaction'),
108
+				'TKT_ID'=>new EE_Foreign_Key_Int_Field('TKT_ID', __('Ticket ID', 'event_espresso'), false, 0, 'Ticket'),
109
+				'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), false, EEM_Registration::status_id_incomplete, 'Status'),
110
+				'REG_date'=>new EE_Datetime_Field('REG_date', __('Time registration occurred', 'event_espresso'), false, current_time('timestamp'), $timezone),
111
+				'REG_final_price'=>new EE_Money_Field('REG_final_price', __('Final Price of registration after all ticket/price modifications', 'event_espresso'), false, 0),
112
+				'REG_paid'=>new EE_Money_Field('REG_paid', __('Amount paid to date towards registration', 'event_espresso'), false, 0),
113
+				'REG_session'=>new EE_Plain_Text_Field('REG_session', __('Session ID of registration', 'event_espresso'), false, ''),
114
+				'REG_code'=>new EE_Plain_Text_Field('REG_code', __('Unique Code for this registration', 'event_espresso'), false, ''),
115
+				'REG_url_link'=>new EE_Plain_Text_Field('REG_url_link', __('String to be used in URL for identifying registration', 'event_espresso'), false, ''),
116
+				'REG_count'=>new EE_Integer_Field('REG_count', __('Count of this registration in the group registration ', 'event_espresso'), true, 1),
117
+				'REG_group_size'=>new EE_Integer_Field('REG_group_size', __('Number of registrations on this group', 'event_espresso'), false, 1),
118
+				'REG_att_is_going'=>new EE_Boolean_Field('REG_att_is_going', __('Flag indicating the registrant plans on attending', 'event_espresso'), false, false),
119
+				'REG_deleted' => new EE_Trashed_Flag_Field('REG_deleted', __('Flag indicating if registration has been archived or not.', 'event_espresso'), false, false)
120 120
 			)
121 121
 		);
122 122
 		$this->_model_relations = array(
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
 			'Status'=>new EE_Belongs_To_Relation(),
128 128
 			'Answer'=>new EE_Has_Many_Relation(),
129 129
 			'Checkin'=>new EE_Has_Many_Relation(),
130
-			'Payment'=>new EE_HABTM_Relation( 'Registration_Payment' ),
130
+			'Payment'=>new EE_HABTM_Relation('Registration_Payment'),
131 131
 		);
132 132
 		$this->_model_chain_to_wp_user = 'Event';
133 133
 
134
-		parent::__construct( $timezone );
134
+		parent::__construct($timezone);
135 135
 	}
136 136
 
137 137
 
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
 	 *		@param bool  $translated If true will return the values as singular localized strings
165 165
 	 *		@return array
166 166
 	 */
167
-	public static function reg_status_array( $exclude = array(), $translated = FALSE ) {
168
-		EEM_Registration::instance()->_get_registration_status_array( $exclude );
169
-		return $translated ? EEM_Status::instance()->localized_status( self::$_reg_status, FALSE, 'sentence') : self::$_reg_status;
167
+	public static function reg_status_array($exclude = array(), $translated = FALSE) {
168
+		EEM_Registration::instance()->_get_registration_status_array($exclude);
169
+		return $translated ? EEM_Status::instance()->localized_status(self::$_reg_status, FALSE, 'sentence') : self::$_reg_status;
170 170
 	}
171 171
 
172 172
 
@@ -177,19 +177,19 @@  discard block
 block discarded – undo
177 177
 	 * @param array $exclude
178 178
 	 * @return array
179 179
 	 */
180
-	private function _get_registration_status_array( $exclude = array() ) {
180
+	private function _get_registration_status_array($exclude = array()) {
181 181
 		//in the very rare circumstance that we are deleting a model's table's data
182 182
 		//and the table hasn't actually been created, this could have an error
183 183
 		/** @type WPDB $wpdb */
184 184
 		global $wpdb;
185
-		EE_Registry::instance()->load_helper( 'Activation' );
186
-		if( EEH_Activation::table_exists( $wpdb->prefix . 'esp_status' ) ){
187
-			$SQL = 'SELECT STS_ID, STS_code FROM '. $wpdb->prefix . 'esp_status WHERE STS_type = "registration"';
188
-			$results = $wpdb->get_results( $SQL );
185
+		EE_Registry::instance()->load_helper('Activation');
186
+		if (EEH_Activation::table_exists($wpdb->prefix.'esp_status')) {
187
+			$SQL = 'SELECT STS_ID, STS_code FROM '.$wpdb->prefix.'esp_status WHERE STS_type = "registration"';
188
+			$results = $wpdb->get_results($SQL);
189 189
 			self::$_reg_status = array();
190
-			foreach ( $results as $status ) {
191
-				if ( ! in_array( $status->STS_ID, $exclude )) {
192
-					self::$_reg_status[ $status->STS_ID ] = $status->STS_code;
190
+			foreach ($results as $status) {
191
+				if ( ! in_array($status->STS_ID, $exclude)) {
192
+					self::$_reg_status[$status->STS_ID] = $status->STS_code;
193 193
 				}
194 194
 			}
195 195
 		}
@@ -204,15 +204,15 @@  discard block
 block discarded – undo
204 204
 	 * @param  array  $where_params Array of query_params as described in the comments for EEM_Base::get_all()
205 205
 	 * @return wpdb results array
206 206
 	 */
207
-	public function get_reg_months_and_years( $where_params ) {
207
+	public function get_reg_months_and_years($where_params) {
208 208
 		$query_params[0] = $where_params;
209 209
 		$query_params['group_by'] = array('reg_year', 'reg_month');
210
-		$query_params['order_by'] = array( 'REG_date' => 'DESC' );
210
+		$query_params['order_by'] = array('REG_date' => 'DESC');
211 211
 		$columns_to_select = array(
212 212
 			'reg_year' => array('YEAR(REG_date)', '%s'),
213 213
 			'reg_month' => array('MONTHNAME(REG_date)', '%s')
214 214
 			);
215
-		return $this->_get_all_wpdb_results( $query_params, OBJECT, $columns_to_select );
215
+		return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select);
216 216
 	}
217 217
 
218 218
 
@@ -224,11 +224,11 @@  discard block
 block discarded – undo
224 224
 	* 		@param		int		$ATT_ID
225 225
 	*		@return 	EE_Registration[]
226 226
 	*/
227
-	public function get_all_registrations_for_attendee( $ATT_ID = 0 ) {
228
-		if ( ! $ATT_ID ) {
227
+	public function get_all_registrations_for_attendee($ATT_ID = 0) {
228
+		if ( ! $ATT_ID) {
229 229
 			return FALSE;
230 230
 		}
231
-		return $this->get_all( array( array( 'ATT_ID' => $ATT_ID )));
231
+		return $this->get_all(array(array('ATT_ID' => $ATT_ID)));
232 232
 	}
233 233
 
234 234
 
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
 	 * @param string $REG_url_link
240 240
 	 * @return EE_Registration
241 241
 	 */
242
-	public function get_registration_for_reg_url_link($REG_url_link){
243
-		if(!$REG_url_link){
242
+	public function get_registration_for_reg_url_link($REG_url_link) {
243
+		if ( ! $REG_url_link) {
244 244
 			return false;
245 245
 		}
246 246
 		return $this->get_one(array(array('REG_url_link'=>$REG_url_link)));
@@ -258,13 +258,13 @@  discard block
 block discarded – undo
258 258
 	* 		@param    int		$att_nmbr 	in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required
259 259
 	*		@return 		mixed		array on success, FALSE on fail
260 260
 	*/
261
-	public function get_registration_for_transaction_attendee( $TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0 ) {
261
+	public function get_registration_for_transaction_attendee($TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0) {
262 262
 		return $this->get_one(array(
263 263
 			array(
264 264
 				'TXN_ID'=>$TXN_ID,
265 265
 				'ATT_ID'=>$ATT_ID
266 266
 			),
267
-			'limit'=>array( min( ( $att_nmbr-1 ), 0 ), 1 )
267
+			'limit'=>array(min(($att_nmbr - 1), 0), 1)
268 268
 		));
269 269
 	}
270 270
 
@@ -276,13 +276,13 @@  discard block
 block discarded – undo
276 276
 	 *		@param $period string which can be passed to php's strtotime function (eg "-1 month")
277 277
 	 *		@return stdClass[] with properties regDate and total
278 278
 	*/
279
-	public function get_registrations_per_day_report( $period = '-1 month' ) {
279
+	public function get_registrations_per_day_report($period = '-1 month') {
280 280
 		$sql_date = date("Y-m-d H:i:s", strtotime($period));
281 281
 
282 282
 		//don't include incomplete regs by default
283
-		$where = array('REG_date'=>array('>=',$sql_date), 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) );
283
+		$where = array('REG_date'=>array('>=', $sql_date), 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete));
284 284
 
285
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_day_report' ) ) {
285
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_day_report')) {
286 286
 			$where['Event.EVT_wp_user'] = get_current_user_id();
287 287
 		}
288 288
 
@@ -294,8 +294,8 @@  discard block
 block discarded – undo
294 294
 				),
295 295
 				OBJECT,
296 296
 				array(
297
-					'regDate'=>array('DATE(Registration.REG_date)','%s'),
298
-					'total'=>array('count(REG_ID)','%d')
297
+					'regDate'=>array('DATE(Registration.REG_date)', '%s'),
298
+					'total'=>array('count(REG_ID)', '%d')
299 299
 				));
300 300
 		return $results;
301 301
 	}
@@ -310,24 +310,24 @@  discard block
 block discarded – undo
310 310
 	 * @param $period string which can be passed to php's strtotime function (eg "-1 month")
311 311
 	 *		@return stdClass[] each with properties event_name, reg_limit, and total
312 312
 	*/
313
-	public function get_registrations_per_event_report( $period = '-1 month' ) {
313
+	public function get_registrations_per_event_report($period = '-1 month') {
314 314
 		$date_sql = date("Y-m-d H:i:s", strtotime($period));
315 315
 
316 316
 		//do not include incomplete registrations by default
317 317
 
318
-		$where = array( 'REG_date'=>array('>=',$date_sql ), 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) );
319
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) {
318
+		$where = array('REG_date'=>array('>=', $date_sql), 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete));
319
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) {
320 320
 			$where['Event.EVT_wp_user'] = get_current_user_id();
321 321
 		}
322 322
 		$results = $this->_get_all_wpdb_results(array(
323 323
 			$where,
324 324
 			'group_by'=>'Event.EVT_name',
325 325
 			'order_by'=>'Event.EVT_name',
326
-			'limit'=>array(0,24)),
326
+			'limit'=>array(0, 24)),
327 327
 			OBJECT,
328 328
 			array(
329
-				'event_name'=>array('Event_CPT.post_title','%s'),
330
-				'total'=>array('COUNT(REG_ID)','%s')
329
+				'event_name'=>array('Event_CPT.post_title', '%s'),
330
+				'total'=>array('COUNT(REG_ID)', '%s')
331 331
 			)
332 332
 		);
333 333
 
@@ -341,11 +341,11 @@  discard block
 block discarded – undo
341 341
 	 * @param int $TXN_ID
342 342
 	 * @return EE_Registration
343 343
 	 */
344
-	public function get_primary_registration_for_transaction_ID( $TXN_ID = 0){
345
-		if( ! $TXN_ID ){
344
+	public function get_primary_registration_for_transaction_ID($TXN_ID = 0) {
345
+		if ( ! $TXN_ID) {
346 346
 			return false;
347 347
 		}
348
-		return $this->get_one(array(array('TXN_ID'=>$TXN_ID,'REG_count'=>  EEM_Registration::PRIMARY_REGISTRANT_COUNT)));
348
+		return $this->get_one(array(array('TXN_ID'=>$TXN_ID, 'REG_count'=>  EEM_Registration::PRIMARY_REGISTRANT_COUNT)));
349 349
 	}
350 350
 
351 351
 
@@ -357,11 +357,11 @@  discard block
 block discarded – undo
357 357
 	 *		@param boolean $for_incomplete_payments
358 358
 	 *		@return int
359 359
 	 */
360
-	public function get_event_registration_count ( $EVT_ID, $for_incomplete_payments = FALSE ) {
360
+	public function get_event_registration_count($EVT_ID, $for_incomplete_payments = FALSE) {
361 361
 		// we only count approved registrations towards registration limits
362
-		$query_params = array( array( 'EVT_ID' => $EVT_ID, 'STS_ID' => self::status_id_approved ) );
363
-		if( $for_incomplete_payments ){
364
-			$query_params[0]['Transaction.STS_ID']=array('!=',  EEM_Transaction::complete_status_code);
362
+		$query_params = array(array('EVT_ID' => $EVT_ID, 'STS_ID' => self::status_id_approved));
363
+		if ($for_incomplete_payments) {
364
+			$query_params[0]['Transaction.STS_ID'] = array('!=', EEM_Transaction::complete_status_code);
365 365
 		}
366 366
 
367 367
 		return $this->count($query_params);
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 		/** @type WPDB $wpdb */
378 378
 		global $wpdb;
379 379
 		return $wpdb->query(
380
-				'DELETE r FROM ' . $this->table() . ' r LEFT JOIN ' . EEM_Transaction::instance()->table() . ' t ON r.TXN_ID = t.TXN_ID WHERE t.TXN_ID IS NULL' );
380
+				'DELETE r FROM '.$this->table().' r LEFT JOIN '.EEM_Transaction::instance()->table().' t ON r.TXN_ID = t.TXN_ID WHERE t.TXN_ID IS NULL' );
381 381
 	}
382 382
 
383 383
 
Please login to merge, or discard this patch.
core/db_models/EEM_Registration_Payment.model.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -15,21 +15,21 @@  discard block
 block discarded – undo
15 15
 	protected static $_instance = NULL;
16 16
 
17 17
 
18
-	protected function __construct( $timezone = NULL ) {
18
+	protected function __construct($timezone = NULL) {
19 19
 
20
-		$this->singular_item = __( 'Registration Payment', 'event_espresso' );
21
-		$this->plural_item 	= __( 'Registration Payments', 'event_espresso' );
20
+		$this->singular_item = __('Registration Payment', 'event_espresso');
21
+		$this->plural_item = __('Registration Payments', 'event_espresso');
22 22
 
23 23
 		$this->_tables = array(
24
-			'Registration_Payment' => new EE_Primary_Table( 'esp_registration_payment', 'RPY_ID' )
24
+			'Registration_Payment' => new EE_Primary_Table('esp_registration_payment', 'RPY_ID')
25 25
 		);
26 26
 
27 27
 		$this->_fields = array(
28 28
 			'Registration_Payment'=>array(
29
-				'RPY_ID' 				=> new EE_Primary_Key_Int_Field( 'RPY_ID', __( 'Registration Payment ID', 'event_espresso' )),
30
-				'REG_ID' 				=> new EE_Foreign_Key_Int_Field( 'REG_ID', __( 'Registration ID', 'event_espresso' ), false, 0, 'Registration' ),
31
-				'PAY_ID' 				=> new EE_Foreign_Key_Int_Field( 'PAY_ID', __( 'Payment ID', 'event_espresso' ), true, null, 'Payment' ),
32
-				'RPY_amount' 	=> new EE_Money_Field( 'RPY_amount', __( 'Amount attributed to the registration', 'event_espresso' ), false, 0 ),
29
+				'RPY_ID' 				=> new EE_Primary_Key_Int_Field('RPY_ID', __('Registration Payment ID', 'event_espresso')),
30
+				'REG_ID' 				=> new EE_Foreign_Key_Int_Field('REG_ID', __('Registration ID', 'event_espresso'), false, 0, 'Registration'),
31
+				'PAY_ID' 				=> new EE_Foreign_Key_Int_Field('PAY_ID', __('Payment ID', 'event_espresso'), true, null, 'Payment'),
32
+				'RPY_amount' 	=> new EE_Money_Field('RPY_amount', __('Amount attributed to the registration', 'event_espresso'), false, 0),
33 33
 			)
34 34
 		);
35 35
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 			'Payment' 		=> new EE_Belongs_To_Relation(),
39 39
 		);
40 40
 
41
-		parent::__construct( $timezone );
41
+		parent::__construct($timezone);
42 42
 	}
43 43
 
44 44
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
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
  *
Please login to merge, or discard this patch.