Completed
Branch old/BUG-7514-7935-7936-price-o... (518ae6)
by
unknown
13:33 queued 11:14
created
core/db_models/EEM_Change_Log.model.php 2 patches
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if (!defined('EVENT_ESPRESSO_VERSION')) {
4 4
 	exit('No direct script access allowed');
5
+}
5 6
 
6 7
 /**
7 8
  * Event Espresso
@@ -99,7 +100,7 @@  discard block
 block discarded – undo
99 100
 		foreach($models_this_can_attach_to as $model){
100 101
 			if( $model == 'WP_User' ){
101 102
 				$this->_model_relations[ $model ] = new EE_Belongs_To_Relation();
102
-			}elseif( $model != 'Change_Log' ) {
103
+			} elseif( $model != 'Change_Log' ) {
103 104
 				$this->_model_relations[$model] = new EE_Belongs_To_Any_Relation();
104 105
 			}
105 106
 		}
@@ -123,7 +124,7 @@  discard block
 block discarded – undo
123 124
 		if($related_model_obj instanceof EE_Base_Class){
124 125
 			$obj_id = $related_model_obj->ID();
125 126
 			$obj_type = $related_model_obj->get_model()->get_this_model_name();
126
-		}else{
127
+		} else{
127 128
 			$obj_id = NULL;
128 129
 			$obj_type = NULL;
129 130
 		}
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EEM_Change_Log extends EEM_Base{
28
+class EEM_Change_Log extends EEM_Base {
29 29
 
30 30
 	/**
31 31
 	 * the related object was created log type
@@ -68,19 +68,19 @@  discard block
 block discarded – undo
68 68
 	 *	@access protected
69 69
 	 *	@return EEM_Change_Log
70 70
 	 */
71
-	protected function __construct( $timezone = null ){
71
+	protected function __construct($timezone = null) {
72 72
 		global $current_user;
73
-		$this->singular_item = __('Log','event_espresso');
74
-		$this->plural_item = __('Logs','event_espresso');
73
+		$this->singular_item = __('Log', 'event_espresso');
74
+		$this->plural_item = __('Logs', 'event_espresso');
75 75
 		$this->_tables = array(
76 76
 			'Log'=> new EE_Primary_Table('esp_log', 'LOG_ID')
77 77
 		);
78 78
 		$models_this_can_attach_to = array_keys(EE_Registry::instance()->non_abstract_db_models);
79 79
 		$this->_fields = array(
80 80
 			'Log'=>array(
81
-				'LOG_ID'=> new EE_Primary_Key_Int_Field('LOG_ID', __('Log ID','event_espresso')),
81
+				'LOG_ID'=> new EE_Primary_Key_Int_Field('LOG_ID', __('Log ID', 'event_espresso')),
82 82
 				'LOG_time'=>new EE_Datetime_Field('LOG_time', __("Log Time", 'event_espresso'), false, current_time('timestamp')),
83
-				'OBJ_ID'=>new EE_Foreign_Key_String_Field('OBJ_ID', __("Object ID (int or string)", 'event_espresso'), true, NULL,$models_this_can_attach_to),
83
+				'OBJ_ID'=>new EE_Foreign_Key_String_Field('OBJ_ID', __("Object ID (int or string)", 'event_espresso'), true, NULL, $models_this_can_attach_to),
84 84
 				'OBJ_type'=>new EE_Any_Foreign_Model_Name_Field('OBJ_type', __("Object Type", 'event_espresso'), true, NULL, $models_this_can_attach_to),
85 85
 				'LOG_type'=>new EE_Enum_Text_Field('LOG_type', __("Type of log entry", "event_espresso"), false, self::type_debug,
86 86
 						array(
@@ -92,19 +92,19 @@  discard block
 block discarded – undo
92 92
 							self::type_gateway=> __("Gateway Interaction (IPN or Direct Payment)", 'event_espresso'),
93 93
 							)),
94 94
 				'LOG_message'=>new EE_Maybe_Serialized_Text_Field('LOG_message', __("Log Message (body)", 'event_espresso'), true),
95
-				'LOG_wp_user' => new EE_WP_User_Field('LOG_wp_user', __("User who was logged in while this occurred", 'event_espresso'), true ),
95
+				'LOG_wp_user' => new EE_WP_User_Field('LOG_wp_user', __("User who was logged in while this occurred", 'event_espresso'), true),
96 96
 
97 97
 			));
98 98
 		$this->_model_relations = array();
99
-		foreach($models_this_can_attach_to as $model){
100
-			if( $model == 'WP_User' ){
101
-				$this->_model_relations[ $model ] = new EE_Belongs_To_Relation();
102
-			}elseif( $model != 'Change_Log' ) {
99
+		foreach ($models_this_can_attach_to as $model) {
100
+			if ($model == 'WP_User') {
101
+				$this->_model_relations[$model] = new EE_Belongs_To_Relation();
102
+			}elseif ($model != 'Change_Log') {
103 103
 				$this->_model_relations[$model] = new EE_Belongs_To_Any_Relation();
104 104
 			}
105 105
 		}
106 106
 
107
-		parent::__construct( $timezone );
107
+		parent::__construct($timezone);
108 108
 	}
109 109
 
110 110
 	/**
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
 	 * @param EE_Base_Class $related_model_obj
115 115
 	 * @return EE_Change_Log
116 116
 	 */
117
-	public function log($log_type,$message,$related_model_obj){
118
-		if($related_model_obj instanceof EE_Base_Class){
117
+	public function log($log_type, $message, $related_model_obj) {
118
+		if ($related_model_obj instanceof EE_Base_Class) {
119 119
 			$obj_id = $related_model_obj->ID();
120 120
 			$obj_type = $related_model_obj->get_model()->get_this_model_name();
121
-		}else{
121
+		} else {
122 122
 			$obj_id = NULL;
123 123
 			$obj_type = NULL;
124 124
 		}
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
 	 * @throws EE_Error
143 143
 	 * @return EE_Change_Log
144 144
 	 */
145
-	public function gateway_log( $message, $related_obj_id, $related_obj_type ){
146
-		if( ! EE_Registry::instance()->is_model_name($related_obj_type)){
147
-			throw new EE_Error(sprintf(__("'%s' is not a model name. A model name must be provided when making a gateway log. Eg, 'Payment', 'Payment_Method', etc", "event_espresso"),$related_obj_type));
145
+	public function gateway_log($message, $related_obj_id, $related_obj_type) {
146
+		if ( ! EE_Registry::instance()->is_model_name($related_obj_type)) {
147
+			throw new EE_Error(sprintf(__("'%s' is not a model name. A model name must be provided when making a gateway log. Eg, 'Payment', 'Payment_Method', etc", "event_espresso"), $related_obj_type));
148 148
 		}
149 149
 		$log = EE_Change_Log::new_instance(array(
150 150
 				'LOG_type'=>EEM_Change_Log::type_gateway,
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 * @param array $query_params @see EEM_Base::get_all
164 164
 	 * @return array of arrays
165 165
 	 */
166
-	public function get_all_efficiently($query_params){
166
+	public function get_all_efficiently($query_params) {
167 167
 		return $this->_get_all_wpdb_results($query_params);
168 168
 	}
169 169
 
Please login to merge, or discard this patch.
core/db_models/EEM_Country.model.php 3 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -83,11 +83,11 @@  discard block
 block discarded – undo
83 83
 
84 84
 
85 85
 	/**
86
-	*		_get_countries
87
-	*
88
-	* 		@access		public
89
-	*		@return 		array
90
-	*/
86
+	 *		_get_countries
87
+	 *
88
+	 * 		@access		public
89
+	 *		@return 		array
90
+	 */
91 91
 	public function get_all_countries() {
92 92
 		if ( ! self::$_all_countries ) {
93 93
 			self::$_all_countries = $this->get_all( array( 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=> array( 0,99999 )));
@@ -96,12 +96,12 @@  discard block
 block discarded – undo
96 96
 	}
97 97
 
98 98
 	/**
99
-	*		_get_countries
100
-	*		Gets and caches the list of active countries. If you know the list of active countries
101
-	*		has changed during this request, first use EEM_Country::reset() to flush the cache
102
-	* 		@access		public
103
-	*		@return 		array
104
-	*/
99
+	 *		_get_countries
100
+	 *		Gets and caches the list of active countries. If you know the list of active countries
101
+	 *		has changed during this request, first use EEM_Country::reset() to flush the cache
102
+	 * 		@access		public
103
+	 *		@return 		array
104
+	 */
105 105
 	public function get_all_active_countries() {
106 106
 		if ( ! self::$_active_countries ) {
107 107
 			self::$_active_countries =  $this->get_all( array( array( 'CNT_active' => TRUE ), 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=>array( 0, 99999 )));
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 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
  *
@@ -122,7 +124,7 @@  discard block
 block discarded – undo
122 124
 		$names = $this->get_col( array( array( 'CNT_ISO' => $country_ISO ), 'limit' => 1), 'CNT_name' );
123 125
 		if( is_array( $names ) && ! empty( $names ) ){
124 126
 			return reset( $names );
125
-		}else{
127
+		} else{
126 128
 			return '';
127 129
 		}
128 130
 	}
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -36,15 +36,15 @@  discard block
 block discarded – undo
36 36
 	 * Resets the country
37 37
 	 * @return EEM_Country
38 38
 	 */
39
-	public static function reset( $timezone = NULL ){
39
+	public static function reset($timezone = NULL) {
40 40
 		self::$_active_countries = NULL;
41 41
 		self::$_all_countries = NULL;
42
-		return parent::reset( $timezone );
42
+		return parent::reset($timezone);
43 43
 	}
44 44
 
45
-	protected function __construct( $timezone = NULL ){
46
-		$this->singular_item = __('Country','event_espresso');
47
-		$this->plural_item = __('Countries','event_espresso');
45
+	protected function __construct($timezone = NULL) {
46
+		$this->singular_item = __('Country', 'event_espresso');
47
+		$this->plural_item = __('Countries', 'event_espresso');
48 48
 
49 49
 
50 50
 		$this->_tables = array(
@@ -52,21 +52,21 @@  discard block
 block discarded – undo
52 52
 		);
53 53
 		$this->_fields = array(
54 54
 			'Country'=>array(
55
-				'CNT_active' => new EE_Boolean_Field('CNT_active', __('Country Appears in Dropdown Select Lists','event_espresso'), false, true),
56
-				'CNT_ISO'=> new EE_Primary_Key_String_Field('CNT_ISO', __('Country ISO Code','event_espresso')),
57
-				'CNT_ISO3'=>new EE_All_Caps_Text_Field('CNT_ISO3', __('Country ISO3 Code','event_espresso'), false,''),
58
-				'RGN_ID'=>new EE_Integer_Field('RGN_ID', __('Region ID','event_espresso'), false,0),//should be a foreign key, but no region table exists yet
59
-				'CNT_name'=>new EE_Plain_Text_Field('CNT_name', __('Country Name','event_espresso'), false,''),
60
-				'CNT_cur_code'=>new EE_All_Caps_Text_Field('CNT_cur_code', __('Country Currency Code','event_espresso'), false),
61
-				'CNT_cur_single' => new EE_Plain_Text_Field('CNT_cur_single', __('Currency Name Singular','event_espresso'), false),
62
-				'CNT_cur_plural' => new EE_Plain_Text_Field('CNT_cur_plural', __('Currency Name Plural','event_espresso'), false),
63
-				'CNT_cur_sign' => new EE_Plain_Text_Field('CNT_cur_sign', __('Currency Sign','event_espresso'), false),
64
-				'CNT_cur_sign_b4' => new EE_Boolean_Field('CNT_cur_sign_b4', __('Currency Sign Before Number','event_espresso'), false, true),
65
-				'CNT_cur_dec_plc' => new EE_Integer_Field('CNT_cur_dec_plc', __('Currency Decimal Places','event_espresso'), false, 2),
66
-				'CNT_cur_dec_mrk' => new EE_Plain_Text_Field('CNT_cur_dec_mrk', __('Currency Decimal Mark','event_espresso'), false, '.'),
67
-				'CNT_cur_thsnds' => new EE_Plain_Text_Field('CNT_cur_thsnds', __('Currency Thousands Seperator','event_espresso'), false, ','),
68
-				'CNT_tel_code' => new EE_Plain_Text_Field('CNT_tel_code', __('Country Telephone Code','event_espresso'), false, ''),
69
-				'CNT_is_EU' => new EE_Boolean_Field('CNT_is_EU', __('Country is Member of EU','event_espresso'), false, false)
55
+				'CNT_active' => new EE_Boolean_Field('CNT_active', __('Country Appears in Dropdown Select Lists', 'event_espresso'), false, true),
56
+				'CNT_ISO'=> new EE_Primary_Key_String_Field('CNT_ISO', __('Country ISO Code', 'event_espresso')),
57
+				'CNT_ISO3'=>new EE_All_Caps_Text_Field('CNT_ISO3', __('Country ISO3 Code', 'event_espresso'), false, ''),
58
+				'RGN_ID'=>new EE_Integer_Field('RGN_ID', __('Region ID', 'event_espresso'), false, 0), //should be a foreign key, but no region table exists yet
59
+				'CNT_name'=>new EE_Plain_Text_Field('CNT_name', __('Country Name', 'event_espresso'), false, ''),
60
+				'CNT_cur_code'=>new EE_All_Caps_Text_Field('CNT_cur_code', __('Country Currency Code', 'event_espresso'), false),
61
+				'CNT_cur_single' => new EE_Plain_Text_Field('CNT_cur_single', __('Currency Name Singular', 'event_espresso'), false),
62
+				'CNT_cur_plural' => new EE_Plain_Text_Field('CNT_cur_plural', __('Currency Name Plural', 'event_espresso'), false),
63
+				'CNT_cur_sign' => new EE_Plain_Text_Field('CNT_cur_sign', __('Currency Sign', 'event_espresso'), false),
64
+				'CNT_cur_sign_b4' => new EE_Boolean_Field('CNT_cur_sign_b4', __('Currency Sign Before Number', 'event_espresso'), false, true),
65
+				'CNT_cur_dec_plc' => new EE_Integer_Field('CNT_cur_dec_plc', __('Currency Decimal Places', 'event_espresso'), false, 2),
66
+				'CNT_cur_dec_mrk' => new EE_Plain_Text_Field('CNT_cur_dec_mrk', __('Currency Decimal Mark', 'event_espresso'), false, '.'),
67
+				'CNT_cur_thsnds' => new EE_Plain_Text_Field('CNT_cur_thsnds', __('Currency Thousands Seperator', 'event_espresso'), false, ','),
68
+				'CNT_tel_code' => new EE_Plain_Text_Field('CNT_tel_code', __('Country Telephone Code', 'event_espresso'), false, ''),
69
+				'CNT_is_EU' => new EE_Boolean_Field('CNT_is_EU', __('Country is Member of EU', 'event_espresso'), false, false)
70 70
 			));
71 71
 		$this->_model_relations = array(
72 72
 			'Attendee'=>new EE_Has_Many_Relation(),
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 			'Venue'=>new EE_Has_Many_Relation(),
75 75
 		);
76 76
 
77
-		parent::__construct( $timezone );
77
+		parent::__construct($timezone);
78 78
 	}
79 79
 
80 80
 
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	*		@return 		array
88 88
 	*/
89 89
 	public function get_all_countries() {
90
-		if ( ! self::$_all_countries ) {
91
-			self::$_all_countries = $this->get_all( array( 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=> array( 0,99999 )));
90
+		if ( ! self::$_all_countries) {
91
+			self::$_all_countries = $this->get_all(array('order_by'=>array('CNT_name'=>'ASC'), 'limit'=> array(0, 99999)));
92 92
 		}
93 93
 		return self::$_all_countries;
94 94
 	}
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 	*		@return 		array
102 102
 	*/
103 103
 	public function get_all_active_countries() {
104
-		if ( ! self::$_active_countries ) {
105
-			self::$_active_countries =  $this->get_all( array( array( 'CNT_active' => TRUE ), 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=>array( 0, 99999 )));
104
+		if ( ! self::$_active_countries) {
105
+			self::$_active_countries = $this->get_all(array(array('CNT_active' => TRUE), 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=>array(0, 99999)));
106 106
 		}
107 107
 		return self::$_active_countries;
108 108
 	}
@@ -112,15 +112,15 @@  discard block
 block discarded – undo
112 112
 	 * @param string $country_ISO
113 113
 	 * @return string
114 114
 	 */
115
-	public function get_country_name_by_ISO( $country_ISO ){
116
-		if( isset( self::$_all_countries[ $country_ISO ] ) &&
117
-				self::$_all_countries[ $country_ISO ] instanceof EE_Country ){
118
-			return self::$_all_countries[ $country_ISO ]->name();
115
+	public function get_country_name_by_ISO($country_ISO) {
116
+		if (isset(self::$_all_countries[$country_ISO]) &&
117
+				self::$_all_countries[$country_ISO] instanceof EE_Country) {
118
+			return self::$_all_countries[$country_ISO]->name();
119 119
 		}
120
-		$names = $this->get_col( array( array( 'CNT_ISO' => $country_ISO ), 'limit' => 1), 'CNT_name' );
121
-		if( is_array( $names ) && ! empty( $names ) ){
122
-			return reset( $names );
123
-		}else{
120
+		$names = $this->get_col(array(array('CNT_ISO' => $country_ISO), 'limit' => 1), 'CNT_name');
121
+		if (is_array($names) && ! empty($names)) {
122
+			return reset($names);
123
+		} else {
124 124
 			return '';
125 125
 		}
126 126
 	}
Please login to merge, or discard this patch.
core/db_models/EEM_Currency.model.php 2 patches
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if (!defined('EVENT_ESPRESSO_VERSION')) {
4 4
 	exit('No direct script access allowed');
5
+}
5 6
 
6 7
 /**
7 8
  * Event Espresso
@@ -75,12 +76,12 @@  discard block
 block discarded – undo
75 76
 		if($payment_method_type instanceof EE_PMT_Base &&
76 77
 				$payment_method_type->get_gateway()){
77 78
 			$currencies_supported = $payment_method_type->get_gateway()->currencies_supported();
78
-		}else{
79
+		} else{
79 80
 			$currencies_supported = EE_Gateway::all_currencies_supported;
80 81
 		}
81 82
 		if($currencies_supported == EE_Gateway::all_currencies_supported || empty( $currencies_supported ) ) {
82 83
 			$currencies = $this->get_all_active();
83
-		}else{
84
+		} else{
84 85
 			$currencies = $this->get_all_active(array(array('CUR_code'=>array('IN',$currencies_supported))));
85 86
 		}
86 87
 		return $currencies;
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -25,30 +25,30 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EEM_Currency extends EEM_Base{
28
+class EEM_Currency extends EEM_Base {
29 29
 		// private instance of the Attendee object
30 30
 	protected static $_instance = NULL;
31 31
 
32
-	protected function __construct( $timezone = NULL ) {
33
-		$this->singular_item = __('Currency','event_espresso');
34
-		$this->plural_item = __('Currencies','event_espresso');
32
+	protected function __construct($timezone = NULL) {
33
+		$this->singular_item = __('Currency', 'event_espresso');
34
+		$this->plural_item = __('Currencies', 'event_espresso');
35 35
 		$this->_tables = array(
36 36
 			'Currency'=> new EE_Primary_Table('esp_currency', 'CUR_code')
37 37
 		);
38 38
 		$this->_fields = array(
39 39
 			'Currency'=>array(
40
-				'CUR_code'=> new EE_Primary_Key_String_Field('CUR_code', __('Currency COde','event_espresso')),
41
-				'CUR_single' => new EE_Plain_Text_Field('CUR_single', __('Currency Name Singular','event_espresso'), false),
42
-				'CUR_plural' => new EE_Plain_Text_Field('CUR_plural', __('Currency Name Plural','event_espresso'), false),
43
-				'CUR_sign' => new EE_Plain_Text_Field('CUR_sign', __('Currency Sign','event_espresso'), false),
44
-				'CUR_dec_plc' => new EE_Integer_Field('CUR_dec_plc', __('Currency Decimal Places','event_espresso'), false, 2),
45
-				'CUR_active'=>new EE_Boolean_Field('CUR_active', __("Active?", 'event_espresso'), false,true),
40
+				'CUR_code'=> new EE_Primary_Key_String_Field('CUR_code', __('Currency COde', 'event_espresso')),
41
+				'CUR_single' => new EE_Plain_Text_Field('CUR_single', __('Currency Name Singular', 'event_espresso'), false),
42
+				'CUR_plural' => new EE_Plain_Text_Field('CUR_plural', __('Currency Name Plural', 'event_espresso'), false),
43
+				'CUR_sign' => new EE_Plain_Text_Field('CUR_sign', __('Currency Sign', 'event_espresso'), false),
44
+				'CUR_dec_plc' => new EE_Integer_Field('CUR_dec_plc', __('Currency Decimal Places', 'event_espresso'), false, 2),
45
+				'CUR_active'=>new EE_Boolean_Field('CUR_active', __("Active?", 'event_espresso'), false, true),
46 46
 			));
47 47
 		$this->_model_relations = array(
48 48
 			'Payment_Method'=>new EE_HABTM_Relation('Currency_Payment_Method'),
49 49
 		);
50 50
 
51
-		parent::__construct( $timezone );
51
+		parent::__construct($timezone);
52 52
 	}
53 53
 
54 54
 	/**
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
 	 * @param array $query_params see EEM_Base::get_all
58 58
 	 * @return EE_Currency[]
59 59
 	 */
60
-	public function get_all_active($query_params = array()){
60
+	public function get_all_active($query_params = array()) {
61 61
 		$query_params[0]['CUR_active'] = true;
62
-		if( ! isset($query_params['order_by'])){
63
-			$query_params['order_by'] = array('CUR_code'=>'ASC','CUR_single'=>'ASC');
62
+		if ( ! isset($query_params['order_by'])) {
63
+			$query_params['order_by'] = array('CUR_code'=>'ASC', 'CUR_single'=>'ASC');
64 64
 		}
65 65
 		return $this->get_all($query_params);
66 66
 	}
@@ -69,17 +69,17 @@  discard block
 block discarded – undo
69 69
 	 * @param EE_PMT_Base $payment_method_type
70 70
 	 * @return EE_Currency[]
71 71
 	 */
72
-	public function get_all_currencies_usable_by($payment_method_type){
73
-		if($payment_method_type instanceof EE_PMT_Base &&
74
-				$payment_method_type->get_gateway()){
72
+	public function get_all_currencies_usable_by($payment_method_type) {
73
+		if ($payment_method_type instanceof EE_PMT_Base &&
74
+				$payment_method_type->get_gateway()) {
75 75
 			$currencies_supported = $payment_method_type->get_gateway()->currencies_supported();
76
-		}else{
76
+		} else {
77 77
 			$currencies_supported = EE_Gateway::all_currencies_supported;
78 78
 		}
79
-		if($currencies_supported == EE_Gateway::all_currencies_supported || empty( $currencies_supported ) ) {
79
+		if ($currencies_supported == EE_Gateway::all_currencies_supported || empty($currencies_supported)) {
80 80
 			$currencies = $this->get_all_active();
81
-		}else{
82
-			$currencies = $this->get_all_active(array(array('CUR_code'=>array('IN',$currencies_supported))));
81
+		} else {
82
+			$currencies = $this->get_all_active(array(array('CUR_code'=>array('IN', $currencies_supported))));
83 83
 		}
84 84
 		return $currencies;
85 85
 	}
Please login to merge, or discard this patch.
core/db_models/EEM_Datetime.model.php 3 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -76,11 +76,11 @@  discard block
 block discarded – undo
76 76
 
77 77
 
78 78
 	/**
79
-	*		create new blank datetime
80
-	*
81
-	* 		@access		public
82
-	*		@return 		EE_Datetime[]		array on success, FALSE on fail
83
-	*/
79
+	 *		create new blank datetime
80
+	 *
81
+	 * 		@access		public
82
+	 *		@return 		EE_Datetime[]		array on success, FALSE on fail
83
+	 */
84 84
 	public function create_new_blank_datetime() {
85 85
 		$times = array(
86 86
 				EE_Datetime::new_instance(
@@ -107,12 +107,12 @@  discard block
 block discarded – undo
107 107
 
108 108
 
109 109
 	/**
110
-	*		get event start date from db
111
-	*
112
-	* 		@access		public
113
-	* 		@param		int 			$EVT_ID
114
-	*		@return 		EE_Datetime[]		array on success, FALSE on fail
115
-	*/
110
+	 *		get event start date from db
111
+	 *
112
+	 * 		@access		public
113
+	 * 		@param		int 			$EVT_ID
114
+	 *		@return 		EE_Datetime[]		array on success, FALSE on fail
115
+	 */
116 116
 	public function get_all_event_dates( $EVT_ID = FALSE ) {
117 117
 		if ( ! $EVT_ID ) { // on add_new_event event_id gets set to 0
118 118
 			return $this->create_new_blank_datetime();
@@ -246,14 +246,14 @@  discard block
 block discarded – undo
246 246
 	}
247 247
 
248 248
 		/**
249
-	 * Gets ALL the datetimes for an ticket (including trashed ones, for now), ordered
250
-	 * only by start date
251
-	 * @param int $TKT_ID
252
-	 * @param bolean $include_expired
253
-	 * @param boolean $inlude_deleted
254
-	 * @param int $limit
255
-	 * @return EE_Datetime[]
256
-	 */
249
+		 * Gets ALL the datetimes for an ticket (including trashed ones, for now), ordered
250
+		 * only by start date
251
+		 * @param int $TKT_ID
252
+		 * @param bolean $include_expired
253
+		 * @param boolean $inlude_deleted
254
+		 * @param int $limit
255
+		 * @return EE_Datetime[]
256
+		 */
257 257
 	public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted= true, $limit = NULL){
258 258
 		//sanitize TKT_ID
259 259
 		$TKT_ID =  intval( $TKT_ID );
Please login to merge, or discard this patch.
Spacing   +84 added lines, -84 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_Datetime.class.php' );
24
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
25
+require_once (EE_CLASSES.'EE_Datetime.class.php');
26 26
 
27 27
 class EEM_Datetime extends EEM_Soft_Delete_Base {
28 28
 
@@ -36,27 +36,27 @@  discard block
 block discarded – undo
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 = __('Datetime','event_espresso');
41
-		$this->plural_item = __('Datetimes','event_espresso');
39
+	protected function __construct($timezone) {
40
+		$this->singular_item = __('Datetime', 'event_espresso');
41
+		$this->plural_item = __('Datetimes', 'event_espresso');
42 42
 
43 43
 		$this->_tables = array(
44 44
 			'Datetime'=> new EE_Primary_Table('esp_datetime', 'DTT_ID')
45 45
 		);
46 46
 		$this->_fields = array(
47 47
 			'Datetime'=>array(
48
-				'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID','event_espresso')),
49
-				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID','event_espresso'), false, 0, 'Event'),
48
+				'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID', 'event_espresso')),
49
+				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID', 'event_espresso'), false, 0, 'Event'),
50 50
 				'DTT_name' => new EE_Plain_Text_Field('DTT_name', __('Datetime Name', 'event_espresso'), false, ''),
51 51
 				'DTT_description' => new EE_Full_HTML_Field('DTT_description', __('Description for Datetime', 'event_espresso'), false, ''),
52
-				'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event','event_espresso'), false, current_time('timestamp'), $timezone ),
53
-				'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event','event_espresso'), false, current_time('timestamp'), $timezone ),
54
-				'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time','event_espresso'), true, INF),
55
-				'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0 ),
56
-				'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false,false),
52
+				'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event', 'event_espresso'), false, current_time('timestamp'), $timezone),
53
+				'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event', 'event_espresso'), false, current_time('timestamp'), $timezone),
54
+				'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time', 'event_espresso'), true, INF),
55
+				'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0),
56
+				'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false, false),
57 57
 				'DTT_order' => new EE_Integer_Field('DTT_order', __('The order in which the Datetime is displayed', 'event_espresso'), false, 0),
58
-				'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0 ),
59
-				'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false ),
58
+				'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0),
59
+				'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false),
60 60
 			));
61 61
 		$this->_model_relations = array(
62 62
 			'Ticket'=>new EE_HABTM_Relation('Datetime_Ticket'),
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 		);
66 66
 		$this->_model_chain_to_wp_user = 'Event';
67 67
 
68
-		parent::__construct( $timezone );
68
+		parent::__construct($timezone);
69 69
 	}
70 70
 
71 71
 
@@ -108,13 +108,13 @@  discard block
 block discarded – undo
108 108
 	* 		@param		int 			$EVT_ID
109 109
 	*		@return 		EE_Datetime[]		array on success, FALSE on fail
110 110
 	*/
111
-	public function get_all_event_dates( $EVT_ID = FALSE ) {
112
-		if ( ! $EVT_ID ) { // on add_new_event event_id gets set to 0
111
+	public function get_all_event_dates($EVT_ID = FALSE) {
112
+		if ( ! $EVT_ID) { // on add_new_event event_id gets set to 0
113 113
 			return $this->create_new_blank_datetime();
114 114
 		}
115
-		$results =  $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID);
115
+		$results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID);
116 116
 
117
-		if ( empty( $results ) ) {
117
+		if (empty($results)) {
118 118
 			return $this->create_new_blank_datetime();
119 119
 		}
120 120
 
@@ -135,26 +135,26 @@  discard block
 block discarded – undo
135 135
 	 *                        	the given number
136 136
 	 * @return EE_Datetime[]
137 137
 	 */
138
-	public function get_datetimes_for_event_ordered_by_DTT_order( $EVT_ID, $include_expired = TRUE, $include_deleted= TRUE, $limit = NULL  ) {
138
+	public function get_datetimes_for_event_ordered_by_DTT_order($EVT_ID, $include_expired = TRUE, $include_deleted = TRUE, $limit = NULL) {
139 139
 
140 140
 		//sanitize EVT_ID
141
-		$EVT_ID = intval( $EVT_ID );
141
+		$EVT_ID = intval($EVT_ID);
142 142
 
143 143
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
144
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
145
-		$where_params = array( 'Event.EVT_ID' => $EVT_ID );
144
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
145
+		$where_params = array('Event.EVT_ID' => $EVT_ID);
146 146
 
147
-		$query_params = ! empty( $limit ) ? array( $where_params, 'limit' => $limit, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' ) : array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' );
147
+		$query_params = ! empty($limit) ? array($where_params, 'limit' => $limit, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none') : array($where_params, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none');
148 148
 
149
-		if( ! $include_expired){
150
-			$query_params[0]['DTT_EVT_end'] = array( '>=', current_time( 'mysql', TRUE ) );
149
+		if ( ! $include_expired) {
150
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
151 151
 		}
152
-		if( $include_deleted){
153
-			$query_params[0]['DTT_deleted'] = array( 'IN', array( TRUE, FALSE ));
152
+		if ($include_deleted) {
153
+			$query_params[0]['DTT_deleted'] = array('IN', array(TRUE, FALSE));
154 154
 		}
155 155
 
156
-		$result = $this->get_all( $query_params );
157
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
156
+		$result = $this->get_all($query_params);
157
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
158 158
 		return $result;
159 159
 	}
160 160
 
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
 	 * @param int $limit
170 170
 	 * @return EE_Datetime[]
171 171
 	 */
172
-	public function get_datetimes_for_event_ordered_by_importance( $EVT_ID = FALSE, $limit = NULL){
173
-		return $this->get_all( array(array('Event.EVT_ID'=>$EVT_ID),
172
+	public function get_datetimes_for_event_ordered_by_importance($EVT_ID = FALSE, $limit = NULL) {
173
+		return $this->get_all(array(array('Event.EVT_ID'=>$EVT_ID),
174 174
 			'limit'=>$limit,
175 175
 			'order_by'=>array('DTT_EVT_start'=>'ASC'),
176 176
 			'default_where_conditions' => 'none'));
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
 	 * @param type $include_deleted
183 183
 	 * @return EE_Datetime
184 184
 	 */
185
-	public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false,$include_deleted = false){
186
-		$results =  $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1);
187
-		if($results){
185
+	public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false, $include_deleted = false) {
186
+		$results = $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1);
187
+		if ($results) {
188 188
 			return array_shift($results);
189
-		}else{
189
+		} else {
190 190
 			return NULL;
191 191
 		}
192 192
 	}
@@ -195,16 +195,16 @@  discard block
 block discarded – undo
195 195
 	 * @param int $EVT_ID
196 196
 	 * @return EE_Datetime
197 197
 	 */
198
-	public function get_primary_datetime_for_event($EVT_ID,$try_to_exclude_expired = true, $try_to_exclude_deleted = true){
199
-		if($try_to_exclude_expired){
200
-			$non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false,false);
201
-			if($non_expired){
198
+	public function get_primary_datetime_for_event($EVT_ID, $try_to_exclude_expired = true, $try_to_exclude_deleted = true) {
199
+		if ($try_to_exclude_expired) {
200
+			$non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false, false);
201
+			if ($non_expired) {
202 202
 				return $non_expired;
203 203
 			}
204 204
 		}
205
-		if($try_to_exclude_deleted){
205
+		if ($try_to_exclude_deleted) {
206 206
 			$expired_even = $this->get_oldest_datetime_for_event($EVT_ID, true);
207
-			if($expired_even){
207
+			if ($expired_even) {
208 208
 				return $expired_even;
209 209
 			}
210 210
 		}
@@ -220,23 +220,23 @@  discard block
 block discarded – undo
220 220
 	 * @param int $limit
221 221
 	 * @return EE_Datetime[]
222 222
 	 */
223
-	public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted= true, $limit = NULL ){
223
+	public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) {
224 224
 		//sanitize EVT_ID
225
-		$EVT_ID = intval( $EVT_ID );
225
+		$EVT_ID = intval($EVT_ID);
226 226
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
227
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
228
-		$query_params =array(array('Event.EVT_ID'=>$EVT_ID),'order_by'=>array('DTT_EVT_start'=>'asc'));
229
-		if( ! $include_expired){
230
-			$query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE));
227
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
228
+		$query_params = array(array('Event.EVT_ID'=>$EVT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc'));
229
+		if ( ! $include_expired) {
230
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
231 231
 		}
232
-		if( $include_deleted){
233
-			$query_params[0]['DTT_deleted'] = array('IN',array(true,false));
232
+		if ($include_deleted) {
233
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
234 234
 		}
235
-		if($limit){
235
+		if ($limit) {
236 236
 			$query_params['limit'] = $limit;
237 237
 		}
238
-		$result = $this->get_all( $query_params );
239
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
238
+		$result = $this->get_all($query_params);
239
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
240 240
 		return $result;
241 241
 	}
242 242
 
@@ -249,23 +249,23 @@  discard block
 block discarded – undo
249 249
 	 * @param int $limit
250 250
 	 * @return EE_Datetime[]
251 251
 	 */
252
-	public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted= true, $limit = NULL){
252
+	public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) {
253 253
 		//sanitize TKT_ID
254
-		$TKT_ID =  intval( $TKT_ID );
254
+		$TKT_ID = intval($TKT_ID);
255 255
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
256
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
257
-		$query_params =array(array('Ticket.TKT_ID'=>$TKT_ID),'order_by'=>array('DTT_EVT_start'=>'asc'));
258
-		if( ! $include_expired){
259
-			$query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE));
256
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
257
+		$query_params = array(array('Ticket.TKT_ID'=>$TKT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc'));
258
+		if ( ! $include_expired) {
259
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
260 260
 		}
261
-		if( $include_deleted){
262
-			$query_params[0]['DTT_deleted'] = array('IN',array(true,false));
261
+		if ($include_deleted) {
262
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
263 263
 		}
264
-		if($limit){
264
+		if ($limit) {
265 265
 			$query_params['limit'] = $limit;
266 266
 		}
267
-		$result = $this->get_all( $query_params );
268
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
267
+		$result = $this->get_all($query_params);
268
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
269 269
 		return $result;
270 270
 	}
271 271
 
@@ -281,24 +281,24 @@  discard block
 block discarded – undo
281 281
 	 *                                  that number
282 282
 	 * @return EE_Datetime[]
283 283
 	 */
284
-	public function get_datetimes_for_ticket_ordered_by_DTT_order( $TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL ) {
284
+	public function get_datetimes_for_ticket_ordered_by_DTT_order($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) {
285 285
 		//sanitize id.
286
-		$TKT_ID =  intval( $TKT_ID );
286
+		$TKT_ID = intval($TKT_ID);
287 287
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
288
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
289
-		$where_params = array( 'Ticket.TKT_ID' => $TKT_ID );
290
-		$query_params = array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ) );
291
-		if( ! $include_expired){
292
-			$query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE));
288
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
289
+		$where_params = array('Ticket.TKT_ID' => $TKT_ID);
290
+		$query_params = array($where_params, 'order_by' => array('DTT_order' => 'ASC'));
291
+		if ( ! $include_expired) {
292
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
293 293
 		}
294
-		if( $include_deleted){
295
-			$query_params[0]['DTT_deleted'] = array('IN',array(true,false));
294
+		if ($include_deleted) {
295
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
296 296
 		}
297
-		if($limit){
297
+		if ($limit) {
298 298
 			$query_params['limit'] = $limit;
299 299
 		}
300
-		$result = $this->get_all( $query_params );
301
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
300
+		$result = $this->get_all($query_params);
301
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
302 302
 		return $result;
303 303
 	}
304 304
 
@@ -309,11 +309,11 @@  discard block
 block discarded – undo
309 309
 	 * @param int $EVT_ID
310 310
 	 * @return EE_Datetime
311 311
 	 */
312
-	public function get_most_important_datetime_for_event($EVT_ID){
312
+	public function get_most_important_datetime_for_event($EVT_ID) {
313 313
 		$results = $this->get_datetimes_for_event_ordered_by_importance($EVT_ID, 1);
314
-		if($results){
314
+		if ($results) {
315 315
 			return array_shift($results);
316
-		}else{
316
+		} else {
317 317
 			return null;
318 318
 		}
319 319
 	}
@@ -325,15 +325,15 @@  discard block
 block discarded – undo
325 325
 	 * @param  array  $query_params Array of query_parms as described in the comments for EEM_Base::get_all()
326 326
 	 * @return wpdb results array
327 327
 	 */
328
-	public function get_dtt_months_and_years( $where_params ) {
328
+	public function get_dtt_months_and_years($where_params) {
329 329
 		$query_params[0] = $where_params;
330 330
 		$query_params['group_by'] = array('dtt_year', 'dtt_month');
331
-		$query_params['order_by'] = array( 'DTT_EVT_start' => 'DESC' );
331
+		$query_params['order_by'] = array('DTT_EVT_start' => 'DESC');
332 332
 		$columns_to_select = array(
333 333
 			'dtt_year' => array('YEAR(DTT_EVT_start)', '%s'),
334 334
 			'dtt_month' => array('MONTHNAME(DTT_EVT_start)', '%s')
335 335
 			);
336
-		return $this->_get_all_wpdb_results( $query_params, OBJECT, $columns_to_select );
336
+		return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select);
337 337
 	}
338 338
 
339 339
 	/**
@@ -341,8 +341,8 @@  discard block
 block discarded – undo
341 341
 	 * for the tickets for each datetime)
342 342
 	 * @param EE_Datetime[] $datetimes
343 343
 	 */
344
-	public function update_sold($datetimes){
345
-		foreach($datetimes as $datetime){
344
+	public function update_sold($datetimes) {
345
+		foreach ($datetimes as $datetime) {
346 346
 			$datetime->update_sold();
347 347
 		}
348 348
 	}
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 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
  *
@@ -186,7 +188,7 @@  discard block
 block discarded – undo
186 188
 		$results =  $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1);
187 189
 		if($results){
188 190
 			return array_shift($results);
189
-		}else{
191
+		} else{
190 192
 			return NULL;
191 193
 		}
192 194
 	}
@@ -313,7 +315,7 @@  discard block
 block discarded – undo
313 315
 		$results = $this->get_datetimes_for_event_ordered_by_importance($EVT_ID, 1);
314 316
 		if($results){
315 317
 			return array_shift($results);
316
-		}else{
318
+		} else{
317 319
 			return null;
318 320
 		}
319 321
 	}
Please login to merge, or discard this patch.
core/db_models/EEM_Event_Message_Template.model.php 3 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,16 +7,16 @@
 block discarded – undo
7 7
  */
8 8
  if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
9 9
  /**
10
- *	EEM_Event_Message_Template
11
- *	Model for relation table between EEM_Message_Template_Group and EEM_Event
12
- *
13
- * @package		Event Espresso
14
- * @subpackage 	models
15
- * @since 			4.3.0
16
- * @author			 Darren Ethier
17
- *
18
- * ------------------------------------------------------------------------
19
- */
10
+  *	EEM_Event_Message_Template
11
+  *	Model for relation table between EEM_Message_Template_Group and EEM_Event
12
+  *
13
+  * @package		Event Espresso
14
+  * @subpackage 	models
15
+  * @since 			4.3.0
16
+  * @author			 Darren Ethier
17
+  *
18
+  * ------------------------------------------------------------------------
19
+  */
20 20
 require_once( EE_MODELS . 'EEM_Base.model.php' );
21 21
 
22 22
 class EEM_Event_Message_Template extends EEM_Base {
Please login to merge, or discard this patch.
Braces   +12 added lines, -7 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@  discard block
 block discarded – undo
5 5
  * @subpackage 	models
6 6
  * @since 			4.3.0
7 7
  */
8
- if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
8
+ if ( ! defined('EVENT_ESPRESSO_VERSION')) {
9
+ 	exit('No direct script access allowed');
10
+ }
9 11
  /**
10 12
  *	EEM_Event_Message_Template
11 13
  *	Model for relation table between EEM_Message_Template_Group and EEM_Event
@@ -82,14 +84,17 @@  discard block
 block discarded – undo
82 84
 	 * @return int 		       How many rows were deleted.
83 85
 	 */
84 86
 	public function delete_event_group_relations( $GRP_IDs = array(), $EVT_IDs = array() ) {
85
-		if ( empty( $GRP_IDs ) && empty( $EVT_IDs ) )
86
-			throw new EE_Error( sprintf( __('%s requires either an array of GRP_IDs or EVT_IDs or both, but both cannot be empty.', 'event_espresso' ), __METHOD__ ) );
87
+		if ( empty( $GRP_IDs ) && empty( $EVT_IDs ) ) {
88
+					throw new EE_Error( sprintf( __('%s requires either an array of GRP_IDs or EVT_IDs or both, but both cannot be empty.', 'event_espresso' ), __METHOD__ ) );
89
+		}
87 90
 
88
-		if ( !empty( $GRP_IDs ) )
89
-			$where['GRP_ID'] = array( 'IN', (array) $GRP_IDs );
91
+		if ( !empty( $GRP_IDs ) ) {
92
+					$where['GRP_ID'] = array( 'IN', (array) $GRP_IDs );
93
+		}
90 94
 
91
-		if ( !empty( $EVT_IDs ) )
92
-			$where['EVT_ID'] = array( 'IN', (array) $EVT_IDs );
95
+		if ( !empty( $EVT_IDs ) ) {
96
+					$where['EVT_ID'] = array( 'IN', (array) $EVT_IDs );
97
+		}
93 98
 
94 99
 		return $this->delete( array( $where ), FALSE );
95 100
 	}
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  *
18 18
  * ------------------------------------------------------------------------
19 19
  */
20
-require_once( EE_MODELS . 'EEM_Base.model.php' );
20
+require_once(EE_MODELS.'EEM_Base.model.php');
21 21
 
22 22
 class EEM_Event_Message_Template extends EEM_Base {
23 23
 
@@ -30,25 +30,25 @@  discard block
 block discarded – undo
30 30
 	 * @access private
31 31
 	 * @return void
32 32
 	 */
33
-	protected function __construct( $timezone = NULL ) {
34
-		$this->singlular_item = __('Event Message Template','event_espresso');
35
-		$this->plural_item = __('Event Message Templates','event_espresso');
33
+	protected function __construct($timezone = NULL) {
34
+		$this->singlular_item = __('Event Message Template', 'event_espresso');
35
+		$this->plural_item = __('Event Message Templates', 'event_espresso');
36 36
 
37 37
 		$this->_tables = array(
38 38
 			'Event_Message_Template'=> new EE_Primary_Table('esp_event_message_template', 'EMT_ID')
39 39
 		);
40 40
 		$this->_fields = array(
41 41
 			'Event_Message_Template'=>array(
42
-				'EMT_ID'=>new EE_Primary_Key_Int_Field('EMT_ID', __('Event Message Template ID','event_espresso')),
43
-				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('The ID to the Event','event_espresso'), false, 0, 'Event' ),
44
-				'GRP_ID'=>new EE_Foreign_Key_Int_Field('GRP_ID', __('The ID to the Message Template Group','event_espresso'), false, 0, 'Message_Template_Group' )
42
+				'EMT_ID'=>new EE_Primary_Key_Int_Field('EMT_ID', __('Event Message Template ID', 'event_espresso')),
43
+				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('The ID to the Event', 'event_espresso'), false, 0, 'Event'),
44
+				'GRP_ID'=>new EE_Foreign_Key_Int_Field('GRP_ID', __('The ID to the Message Template Group', 'event_espresso'), false, 0, 'Message_Template_Group')
45 45
 			));
46 46
 		$this->_model_relations = array(
47 47
 			'Event'=>new EE_Belongs_To_Relation(),
48 48
 			'Message_Template_Group'=>new EE_Belongs_To_Relation()
49 49
 		);
50 50
 
51
-		parent::__construct( $timezone );
51
+		parent::__construct($timezone);
52 52
 	}
53 53
 
54 54
 
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
 	 * @param  int    $GRP_ID The MTP group we want attached events for.
63 63
 	 * @return  array               An array of event ids.
64 64
 	 */
65
-	public function get_attached_event_ids( $GRP_ID ) {
66
-		$event_ids = $this->_get_all_wpdb_results( array( array( 'GRP_ID' => $GRP_ID ) ), ARRAY_N, 'EVT_ID' );
67
-		$event_ids = call_user_func_array( 'array_merge', $event_ids );
65
+	public function get_attached_event_ids($GRP_ID) {
66
+		$event_ids = $this->_get_all_wpdb_results(array(array('GRP_ID' => $GRP_ID)), ARRAY_N, 'EVT_ID');
67
+		$event_ids = call_user_func_array('array_merge', $event_ids);
68 68
 		return $event_ids;
69 69
 	}
70 70
 
@@ -77,17 +77,17 @@  discard block
 block discarded – undo
77 77
 	 *                         	       GRPIDs.
78 78
 	 * @return int 		       How many rows were deleted.
79 79
 	 */
80
-	public function delete_event_group_relations( $GRP_IDs = array(), $EVT_IDs = array() ) {
81
-		if ( empty( $GRP_IDs ) && empty( $EVT_IDs ) )
82
-			throw new EE_Error( sprintf( __('%s requires either an array of GRP_IDs or EVT_IDs or both, but both cannot be empty.', 'event_espresso' ), __METHOD__ ) );
80
+	public function delete_event_group_relations($GRP_IDs = array(), $EVT_IDs = array()) {
81
+		if (empty($GRP_IDs) && empty($EVT_IDs))
82
+			throw new EE_Error(sprintf(__('%s requires either an array of GRP_IDs or EVT_IDs or both, but both cannot be empty.', 'event_espresso'), __METHOD__));
83 83
 
84
-		if ( !empty( $GRP_IDs ) )
85
-			$where['GRP_ID'] = array( 'IN', (array) $GRP_IDs );
84
+		if ( ! empty($GRP_IDs))
85
+			$where['GRP_ID'] = array('IN', (array) $GRP_IDs);
86 86
 
87
-		if ( !empty( $EVT_IDs ) )
88
-			$where['EVT_ID'] = array( 'IN', (array) $EVT_IDs );
87
+		if ( ! empty($EVT_IDs))
88
+			$where['EVT_ID'] = array('IN', (array) $EVT_IDs);
89 89
 
90
-		return $this->delete( array( $where ), FALSE );
90
+		return $this->delete(array($where), FALSE);
91 91
 	}
92 92
 
93 93
 } //end class EEM_Event_Message_Template
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   +9 added lines, -9 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,7 +57,7 @@  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
-		parent::__construct( $timezone );
60
+		parent::__construct($timezone);
61 61
 	}
62 62
 
63 63
 
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_Message_Template_Group.model.php 3 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,29 +1,29 @@
 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_Group
18
- *
19
- *
20
- *
21
- * @package		Event Espresso
22
- * @subpackage	includes/models/EEM_Message_Template_Group.model.php
23
- * @author		Darren Ethier
24
- *
25
- *
26
- */
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_Group
18
+	 *
19
+	 *
20
+	 *
21
+	 * @package		Event Espresso
22
+	 * @subpackage	includes/models/EEM_Message_Template_Group.model.php
23
+	 * @author		Darren Ethier
24
+	 *
25
+	 *
26
+	 */
27 27
 require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
28 28
 class EEM_Message_Template_Group extends EEM_Soft_Delete_Base {
29 29
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,6 @@  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 5
  * Event Espresso
5 6
  *
@@ -288,7 +289,9 @@  discard block
 block discarded – undo
288 289
 				$assembled_fields[$value['name']] = $value['content']['main'];
289 290
 				//loop through the content and get the other fields.
290 291
 				foreach ( $value['content'] as $name => $val ) {
291
-					if ( $name == 'main' ) continue;
292
+					if ( $name == 'main' ) {
293
+						continue;
294
+					}
292 295
 					$assembled_fields[$name] = $val;
293 296
 				}
294 297
 				continue;
Please login to merge, or discard this patch.
Spacing   +54 added lines, -54 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
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  *
25 25
  *
26 26
  */
27
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
27
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
28 28
 class EEM_Message_Template_Group extends EEM_Soft_Delete_Base {
29 29
 
30 30
 	// private instance of the EEM_Message_Template_Group object
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
 
34 34
 
35
-	protected function __construct( $timezone = NULL ) {
35
+	protected function __construct($timezone = NULL) {
36 36
 		$this->singular_item = __('Message Template Group', 'event_espresso');
37 37
 		$this->plural_item = __('Message Template Groups', 'event_espresso');
38 38
 		$this->_tables = array(
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
 		$this->_fields = array(
42 42
 			'Message_Template_Group' => array(
43 43
 				'GRP_ID' => new EE_Primary_Key_Int_Field('GRP_ID', __('Message Template Group ID', 'event_espresso')),
44
-				'MTP_name' => new EE_Plain_Text_Field( 'MTP_name', __('The name of the temlpate group', 'event_espresso'), FALSE, '' ),
45
-				'MTP_description' => new EE_Simple_HTML_Field( 'MTP_description', __('A brief description about this template.', 'event_espresso' ), FALSE, '' ),
46
-				'MTP_user_id'=> new EE_WP_User_Field('MTP_user_id', __('Template Creator ID', 'event_espresso'), FALSE, get_current_user_id() ),
47
-				'MTP_messenger'=>new EE_Plain_Text_Field('MTP_messenger', __('Messenger Used for Template', 'event_espresso'), FALSE, 'email' ),
48
-				'MTP_message_type'=>new EE_Plain_Text_Field('MTP_message_type', __('Message Type', 'event_espresso'),false,'registration'),
44
+				'MTP_name' => new EE_Plain_Text_Field('MTP_name', __('The name of the temlpate group', 'event_espresso'), FALSE, ''),
45
+				'MTP_description' => new EE_Simple_HTML_Field('MTP_description', __('A brief description about this template.', 'event_espresso'), FALSE, ''),
46
+				'MTP_user_id'=> new EE_WP_User_Field('MTP_user_id', __('Template Creator ID', 'event_espresso'), FALSE, get_current_user_id()),
47
+				'MTP_messenger'=>new EE_Plain_Text_Field('MTP_messenger', __('Messenger Used for Template', 'event_espresso'), FALSE, 'email'),
48
+				'MTP_message_type'=>new EE_Plain_Text_Field('MTP_message_type', __('Message Type', 'event_espresso'), false, 'registration'),
49 49
 				'MTP_is_global'=>new EE_Boolean_Field('MTP_is_global', __('Flag indicating if Template Group is Global', 'event_espresso'), false, true),
50 50
 				'MTP_is_override'=>new EE_Boolean_Field('MTP_is_override', __('Flag indicating if Template Group overrides any other Templates for the messenger/messagetype combination', 'event_espresso'), false, false),
51 51
 				'MTP_deleted'=>new EE_Trashed_Flag_Field('MTP_deleted', __('Flag indicating whether this has been trashed', 'event_espresso'), false, false),
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 			'WP_User' => new EE_Belongs_To_Relation(),
59 59
 			);
60 60
 
61
-		parent::__construct( $timezone );
61
+		parent::__construct($timezone);
62 62
 	}
63 63
 
64 64
 
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
 	 * @return array   message template objects that are attached to a specific event.
71 71
 	 */
72 72
 	public function get_all_trashed_message_templates_by_event($EVT_ID, $orderby = 'GRP_ID', $order = 'ASC', $limit = NULL, $count = FALSE) {
73
-		$query_params = array( array('Event.EVT_ID' => $EVT_ID), 'order_by' => array($orderby => $order), 'limit' => $limit );
74
-		return $count ? $this->count_deleted( $query_params, 'GRP_ID', TRUE ) : $this->get_all_deleted( $query_params );
73
+		$query_params = array(array('Event.EVT_ID' => $EVT_ID), 'order_by' => array($orderby => $order), 'limit' => $limit);
74
+		return $count ? $this->count_deleted($query_params, 'GRP_ID', TRUE) : $this->get_all_deleted($query_params);
75 75
 	}
76 76
 
77 77
 
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	 * @access public
83 83
 	 * @return array all (including trashed or inactive) message template group objects for the given messenger
84 84
 	 */
85
-	public function get_all_message_templates_by_messenger($messenger, $orderby = 'GRP_ID', $order = 'ASC' ) {
86
-		return $this->get_all_deleted_and_undeleted( array( array('MTP_messenger' => $messenger), 'order_by' => array($orderby => $order) ) );
85
+	public function get_all_message_templates_by_messenger($messenger, $orderby = 'GRP_ID', $order = 'ASC') {
86
+		return $this->get_all_deleted_and_undeleted(array(array('MTP_messenger' => $messenger), 'order_by' => array($orderby => $order)));
87 87
 	}
88 88
 
89 89
 
@@ -93,13 +93,13 @@  discard block
 block discarded – undo
93 93
 	 * @param  array  $_where any existing where conditions to append these to.
94 94
 	 * @return array          original where conditions or original with additional filters.
95 95
 	 */
96
-	protected function _maybe_mtp_filters( $_where = array() ) {
96
+	protected function _maybe_mtp_filters($_where = array()) {
97 97
 		//account for messenger or message type filters
98
-		if ( isset($_REQUEST['ee_messenger_filter_by'] ) && $_REQUEST['ee_messenger_filter_by'] != 'none_selected' && $_REQUEST['ee_messenger_filter_by'] != 'all'  ) {
99
-			$_where['MTP_messenger'] =  $_REQUEST['ee_messenger_filter_by'] ;
98
+		if (isset($_REQUEST['ee_messenger_filter_by']) && $_REQUEST['ee_messenger_filter_by'] != 'none_selected' && $_REQUEST['ee_messenger_filter_by'] != 'all') {
99
+			$_where['MTP_messenger'] = $_REQUEST['ee_messenger_filter_by'];
100 100
 		}
101 101
 
102
-		if ( isset( $_REQUEST['ee_message_type_filter_by']) && $_REQUEST['ee_message_type_filter_by'] != 'none_selected' ) {
102
+		if (isset($_REQUEST['ee_message_type_filter_by']) && $_REQUEST['ee_message_type_filter_by'] != 'none_selected') {
103 103
 			$_where['MTP_message_type'] = $_REQUEST['ee_message_type_filter_by'];
104 104
 		}
105 105
 
@@ -113,18 +113,18 @@  discard block
 block discarded – undo
113 113
 	 * @access public
114 114
 	 * @return array  all active (non_trashed, active) message template objects
115 115
 	 */
116
-	public function get_all_active_message_templates($orderby = 'GRP_ID', $order = 'ASC', $limit = NULL, $count = FALSE, $global = TRUE, $user_check = FALSE ) {
117
-		$_where = $global ? array('MTP_is_global' => TRUE ) : array('MTP_is_global' => FALSE );
116
+	public function get_all_active_message_templates($orderby = 'GRP_ID', $order = 'ASC', $limit = NULL, $count = FALSE, $global = TRUE, $user_check = FALSE) {
117
+		$_where = $global ? array('MTP_is_global' => TRUE) : array('MTP_is_global' => FALSE);
118 118
 		$_where['MTP_is_active'] = TRUE;
119 119
 		$_where = $this->_maybe_mtp_filters($_where);
120 120
 
121
-		if  ( $user_check && ! $global && ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_messages', 'get_all_active_message_templates' )  ) {
121
+		if ($user_check && ! $global && ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_messages', 'get_all_active_message_templates')) {
122 122
 			$_where['MTP_user_id'] = get_current_user_id();
123 123
 		}
124 124
 
125
-		$query_params = array( $_where, 'order_by' => array($orderby => $order), 'limit' => $limit );
125
+		$query_params = array($_where, 'order_by' => array($orderby => $order), 'limit' => $limit);
126 126
 
127
-		return $count ? $this->count($query_params, 'GRP_ID', TRUE ) : $this->get_all($query_params);
127
+		return $count ? $this->count($query_params, 'GRP_ID', TRUE) : $this->get_all($query_params);
128 128
 	}
129 129
 
130 130
 
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
 
141 141
 		$_where = $this->_maybe_mtp_filters();
142 142
 
143
-		$query_params = array( $_where, 'order_by' => array($orderby => $order), 'limit' => $limit );
143
+		$query_params = array($_where, 'order_by' => array($orderby => $order), 'limit' => $limit);
144 144
 
145
-		$r_templates = $count ? $this->count_deleted_and_undeleted($query_params, 'GRP_ID', TRUE ) : $this->get_all_deleted_and_undeleted( $query_params );
145
+		$r_templates = $count ? $this->count_deleted_and_undeleted($query_params, 'GRP_ID', TRUE) : $this->get_all_deleted_and_undeleted($query_params);
146 146
 
147 147
 		return $r_templates;
148 148
 	}
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
 	 * @param  array  $query_params same as EEM_Base::get_all()
157 157
 	 * @return  EE_Message_Template_Group[]
158 158
 	 */
159
-	public function get_all_custom_templates_by_event( $EVT_ID, $query_params = array() ) {
160
-		$_where = array( 'Event.EVT_ID' => $EVT_ID );
161
-		return $this->get_all( array( $_where ) );
159
+	public function get_all_custom_templates_by_event($EVT_ID, $query_params = array()) {
160
+		$_where = array('Event.EVT_ID' => $EVT_ID);
161
+		return $this->get_all(array($_where));
162 162
 	}
163 163
 
164 164
 
@@ -172,13 +172,13 @@  discard block
 block discarded – undo
172 172
 	 * @return EE_Message_Template_Group[] message template groups.
173 173
 	 */
174 174
 	public function get_all_trashed_grouped_message_templates($orderby = 'GRP_ID', $order = 'ASC', $limit = NULL, $count = FALSE, $global = TRUE) {
175
-		$_where = $global ? array('MTP_is_global' => TRUE ) : array('MTP_is_global' => FALSE );
175
+		$_where = $global ? array('MTP_is_global' => TRUE) : array('MTP_is_global' => FALSE);
176 176
 		$_where['MTP_is_active'] = TRUE;
177 177
 		$_where = $this->_maybe_mtp_filters($_where);
178 178
 
179
-		$query_params = array( $_where, 'order_by' => array($orderby => $order), 'limit' => $limit );
179
+		$query_params = array($_where, 'order_by' => array($orderby => $order), 'limit' => $limit);
180 180
 
181
-		return $count ? $this->count_deleted($query_params, 'GRP_ID', TRUE ) : $this->get_all_deleted( $query_params );
181
+		return $count ? $this->count_deleted($query_params, 'GRP_ID', TRUE) : $this->get_all_deleted($query_params);
182 182
 	}
183 183
 
184 184
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 * @param  bool   $active  		ignore "active" or not. (default only return active)
196 196
 	 * @return mixed (int|EE_Message_Template_Group[])                depending on $count.
197 197
 	 */
198
-	public function get_event_message_templates_by_m_and_mt_and_evt( $messenger, $message_type, $evt_id, $orderby = 'GRP_ID', $order = 'ASC', $limit = NULL, $count = FALSE, $active = TRUE ) {
198
+	public function get_event_message_templates_by_m_and_mt_and_evt($messenger, $message_type, $evt_id, $orderby = 'GRP_ID', $order = 'ASC', $limit = NULL, $count = FALSE, $active = TRUE) {
199 199
 
200 200
 		$_where = array(
201 201
 			'MTP_messenger' => $messenger,
@@ -205,9 +205,9 @@  discard block
 block discarded – undo
205 205
 			'MTP_is_active' => $active
206 206
 			);
207 207
 
208
-		$query_params = array( $_where, 'order_by' => array($orderby=>$order), 'limit' => $limit );
208
+		$query_params = array($_where, 'order_by' => array($orderby=>$order), 'limit' => $limit);
209 209
 
210
-		return $count ? $this->count($query_params, 'GRP_ID', TRUE ) : $this->get_all( $query_params );
210
+		return $count ? $this->count($query_params, 'GRP_ID', TRUE) : $this->get_all($query_params);
211 211
 	}
212 212
 
213 213
 
@@ -224,20 +224,20 @@  discard block
 block discarded – undo
224 224
 	 * @param  bool   $active  		ignore "active" or not. (default only return active) - 'all' means return both inactive AND inactive.
225 225
 	 * @return ARRAY               message template objects that are global (i.e. non-event)
226 226
 	 */
227
-	public function get_global_message_template_by_m_and_mt($messenger, $message_type, $orderby = 'GRP_ID', $order = 'ASC', $limit = NULL, $count = FALSE, $active = TRUE ) {
227
+	public function get_global_message_template_by_m_and_mt($messenger, $message_type, $orderby = 'GRP_ID', $order = 'ASC', $limit = NULL, $count = FALSE, $active = TRUE) {
228 228
 		$_where = array(
229 229
 			'MTP_messenger' => $messenger,
230 230
 			'MTP_message_type' => $message_type,
231 231
 			'MTP_is_global' => TRUE,
232 232
 			);
233 233
 
234
-		if ( $active != 'all' ) {
234
+		if ($active != 'all') {
235 235
 			$_where['MTP_is_active'] = $active;
236 236
 		}
237 237
 
238
-		$query_params = array( $_where, 'order_by' => array( $orderby => $order ), 'limit' => $limit );
238
+		$query_params = array($_where, 'order_by' => array($orderby => $order), 'limit' => $limit);
239 239
 
240
-		return $count ? $this->count( $query_params, 'GRP_ID', TRUE ) : $this->get_all( $query_params );
240
+		return $count ? $this->count($query_params, 'GRP_ID', TRUE) : $this->get_all($query_params);
241 241
 	}
242 242
 
243 243
 
@@ -250,14 +250,14 @@  discard block
 block discarded – undo
250 250
 	 * @param  array  $query_params same as EEM_Base->get_all()
251 251
 	 * @return EE_Message_Template_Group[]
252 252
 	 */
253
-	public function get_custom_message_template_by_m_and_mt( $messenger, $message_type, $query_params = array() ) {
253
+	public function get_custom_message_template_by_m_and_mt($messenger, $message_type, $query_params = array()) {
254 254
 		$_where = array(
255 255
 			'MTP_is_global' => FALSE,
256 256
 			'MTP_messenger' => $messenger,
257 257
 			'MTP_message_type' => $message_type
258 258
 			);
259 259
 
260
-		return $this->get_all( array( $_where ) );
260
+		return $this->get_all(array($_where));
261 261
 	}
262 262
 
263 263
 
@@ -278,13 +278,13 @@  discard block
 block discarded – undo
278 278
 		$assembled_fields = array();
279 279
 
280 280
 		//let's loop through all the fields and set them up in the right format
281
-		foreach ( $fields as $index => $value ) {
281
+		foreach ($fields as $index => $value) {
282 282
 			//first let's figure out if the value['content'] in the current index is an array.  If it is then this is special fields that are used in parsing special shortcodes (i.e. 'attendee_list').
283
-			if ( is_array($value['content']) ) {
283
+			if (is_array($value['content'])) {
284 284
 				$assembled_fields[$value['name']] = $value['content']['main'];
285 285
 				//loop through the content and get the other fields.
286
-				foreach ( $value['content'] as $name => $val ) {
287
-					if ( $name == 'main' ) continue;
286
+				foreach ($value['content'] as $name => $val) {
287
+					if ($name == 'main') continue;
288 288
 					$assembled_fields[$name] = $val;
289 289
 				}
290 290
 				continue;
@@ -295,21 +295,21 @@  discard block
 block discarded – undo
295 295
 		}
296 296
 
297 297
 		//now we've got the assembled_fields.  We need to setup the string for the appropriate validator class and call that.
298
-		$m_ref = ucwords( str_replace('_',' ', $messenger ) );
299
-		$m_ref = str_replace( ' ', '_', $m_ref );
300
-		$mt_ref = ucwords( str_replace('_', ' ', $message_type ) );
301
-		$mt_ref = str_replace( ' ', '_', $mt_ref );
298
+		$m_ref = ucwords(str_replace('_', ' ', $messenger));
299
+		$m_ref = str_replace(' ', '_', $m_ref);
300
+		$mt_ref = ucwords(str_replace('_', ' ', $message_type));
301
+		$mt_ref = str_replace(' ', '_', $mt_ref);
302 302
 
303
-		$classname = 'EE_Messages_' . $m_ref . '_' . $mt_ref . '_Validator';
303
+		$classname = 'EE_Messages_'.$m_ref.'_'.$mt_ref.'_Validator';
304 304
 
305
-		if ( !class_exists( $classname ) ) {
306
-			$msg[] = __( 'The Validator class was unable to load', 'event_espresso');
307
-			$msg[] = sprintf( __('The class name compiled was %s. Please check and make sure the spelling and case is correct for the class name and that there is an autoloader in place for this class', 'event_espresso'), $classname );
308
-			throw new EE_Error( implode( '||', $msg ) );
305
+		if ( ! class_exists($classname)) {
306
+			$msg[] = __('The Validator class was unable to load', 'event_espresso');
307
+			$msg[] = sprintf(__('The class name compiled was %s. Please check and make sure the spelling and case is correct for the class name and that there is an autoloader in place for this class', 'event_espresso'), $classname);
308
+			throw new EE_Error(implode('||', $msg));
309 309
 		}
310 310
 
311
-		$a = new ReflectionClass( $classname );
312
-		$_VLD = $a->newInstance( $assembled_fields, $context );
311
+		$a = new ReflectionClass($classname);
312
+		$_VLD = $a->newInstance($assembled_fields, $context);
313 313
 		$result = $_VLD->validate();
314 314
 		return $result;
315 315
 	}
Please login to merge, or discard this patch.
core/db_models/EEM_Payment.model.php 3 patches
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
 require_once ( EE_MODELS . 'EEM_Base.model.php' );
3 5
 /**
4 6
  *
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
 
18 18
 
19 19
 /**
20
-	 * Status id in esp_status table that represents an approved payment
21
-	 */
20
+ * Status id in esp_status table that represents an approved payment
21
+ */
22 22
 	const status_id_approved = 'PAP';
23 23
 
24 24
 
@@ -111,14 +111,14 @@  discard block
 block discarded – undo
111 111
 
112 112
 
113 113
 	/**
114
-	*		retrieve  all payments from db for a particular transaction, optionally with
114
+	 *		retrieve  all payments from db for a particular transaction, optionally with
115 115
 	 *		a particular status
116
-	*
117
-	* 		@access		public
118
-	* 		@param		$TXN_ID
116
+	 *
117
+	 * 		@access		public
118
+	 * 		@param		$TXN_ID
119 119
 	 *		@param	string	$status_of_payment one of EEM_Payment::status_id_*, like 'PAP','PCN',etc. If none is provided, gets payments with any status
120
-	*		@return		EE_Payment[]
121
-	*/
120
+	 *		@return		EE_Payment[]
121
+	 */
122 122
 	public function get_payments_for_transaction( $TXN_ID = FALSE, $status_of_payment = null ) {
123 123
 		// all payments for a TXN ordered chronologically
124 124
 		$query_params = array( array( 'TXN_ID' => $TXN_ID ), 'order_by' => array( 'PAY_timestamp' => 'ASC' ));
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
 
146 146
 
147 147
 	/**
148
-	*		retrieve  all payments from db between two dates
149
-	*
150
-	* 		@access		public
151
-	* 		@param		string		$start_date
152
-	* 		@param		string		$end_date
153
-	*		@return 	EE_Payment[]
154
-	*/
148
+	 *		retrieve  all payments from db between two dates
149
+	 *
150
+	 * 		@access		public
151
+	 * 		@param		string		$start_date
152
+	 * 		@param		string		$end_date
153
+	 *		@return 	EE_Payment[]
154
+	 */
155 155
 	public function get_payments_made_between_dates( $start_date = '', $end_date = '' ) {
156 156
 		// initial values
157 157
 		$start_date = ! empty( $start_date ) ? $start_date : date('Y-m-d',current_time('timestamp'));
Please login to merge, or discard this patch.
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  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_Base.model.php' );
2
+require_once (EE_MODELS.'EEM_Base.model.php');
3 3
 /**
4 4
  *
5 5
  * Payment Model
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @author				Michael Nelson, Brent Christensen
10 10
  *
11 11
  */
12
-class EEM_Payment extends EEM_Base implements EEMI_Payment{
12
+class EEM_Payment extends EEM_Base implements EEMI_Payment {
13 13
 
14 14
   	// private instance of the Payment object
15 15
 	protected static $_instance = NULL;
@@ -57,28 +57,28 @@  discard block
 block discarded – undo
57 57
 	 *		@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)
58 58
 	 *		@return EEM_Payment
59 59
 	 */
60
-	protected function __construct( $timezone ) {
60
+	protected function __construct($timezone) {
61 61
 
62
-		$this->singular_item = __('Payment','event_espresso');
63
-		$this->plural_item = __('Payments','event_espresso');
62
+		$this->singular_item = __('Payment', 'event_espresso');
63
+		$this->plural_item = __('Payments', 'event_espresso');
64 64
 
65 65
 		$this->_tables = array(
66
-			'Payment'=>new EE_Primary_Table('esp_payment','PAY_ID')
66
+			'Payment'=>new EE_Primary_Table('esp_payment', 'PAY_ID')
67 67
 		);
68 68
 		$this->_fields = array(
69 69
 			'Payment'=>array(
70
-				'PAY_ID'=>new EE_Primary_Key_Int_Field('PAY_ID', __('Payment ID','event_espresso')),
71
-				'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID','event_espresso'), false, 0, 'Transaction'),
72
-				'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID','event_espresso'), false, EEM_Payment::status_id_failed, 'Status'),
73
-				'PAY_timestamp'=> new EE_Datetime_Field('PAY_timestamp', __('Timestamp of when payment was attempted','event_espresso'), false, current_time('timestamp'), $timezone ),
74
-				'PAY_source'=>new EE_All_Caps_Text_Field('PAY_source', __('User-friendly description of payment','event_espresso'), false, 'CART'),
75
-				'PAY_amount'=>new EE_Money_Field('PAY_amount', __('Amount Payment should be for','event_espresso'), false, 0),
70
+				'PAY_ID'=>new EE_Primary_Key_Int_Field('PAY_ID', __('Payment ID', 'event_espresso')),
71
+				'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso'), false, 0, 'Transaction'),
72
+				'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), false, EEM_Payment::status_id_failed, 'Status'),
73
+				'PAY_timestamp'=> new EE_Datetime_Field('PAY_timestamp', __('Timestamp of when payment was attempted', 'event_espresso'), false, current_time('timestamp'), $timezone),
74
+				'PAY_source'=>new EE_All_Caps_Text_Field('PAY_source', __('User-friendly description of payment', 'event_espresso'), false, 'CART'),
75
+				'PAY_amount'=>new EE_Money_Field('PAY_amount', __('Amount Payment should be for', 'event_espresso'), false, 0),
76 76
 				'PMD_ID'=>new EE_Foreign_Key_Int_Field('PMD_ID', __("Payment Method ID", 'event_espresso'), false, NULL, 'Payment_Method'),
77
-				'PAY_gateway_response'=>new EE_Plain_Text_Field('PAY_gateway_response', __('Response from Gateway about the payment','event_espresso'), false, ''),
78
-				'PAY_txn_id_chq_nmbr'=>new EE_Plain_Text_Field('PAY_txn_id_chq_nmbr', __('Gateway Transaction ID or Cheque Number','event_espresso'), true, ''),
79
-				'PAY_po_number'=>new EE_Plain_Text_Field('PAY_po_number', __('Purchase or Sales Number','event_espresso'), true, ''),
80
-				'PAY_extra_accntng'=>new EE_Simple_HTML_Field('PAY_extra_accntng', __('Extra Account Info','event_espresso'), true, ''),
81
-				'PAY_details'=>new EE_Serialized_Text_Field('PAY_details', __('Full Gateway response about payment','event_espresso'), true, ''),
77
+				'PAY_gateway_response'=>new EE_Plain_Text_Field('PAY_gateway_response', __('Response from Gateway about the payment', 'event_espresso'), false, ''),
78
+				'PAY_txn_id_chq_nmbr'=>new EE_Plain_Text_Field('PAY_txn_id_chq_nmbr', __('Gateway Transaction ID or Cheque Number', 'event_espresso'), true, ''),
79
+				'PAY_po_number'=>new EE_Plain_Text_Field('PAY_po_number', __('Purchase or Sales Number', 'event_espresso'), true, ''),
80
+				'PAY_extra_accntng'=>new EE_Simple_HTML_Field('PAY_extra_accntng', __('Extra Account Info', 'event_espresso'), true, ''),
81
+				'PAY_details'=>new EE_Serialized_Text_Field('PAY_details', __('Full Gateway response about payment', 'event_espresso'), true, ''),
82 82
 				'PAY_redirect_url'=>new EE_Plain_Text_Field('PAY_redirect_url', __("Redirect URL", 'event_espresso'), true),
83 83
 				'PAY_redirect_args'=>new EE_Serialized_Text_Field('PAY_redirect_args', __("Key-Value POST vars to send along with redirect", 'event_espresso'), true)
84 84
 			)
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 			'Payment_Method'=>new EE_Belongs_To_Relation(),
90 90
 		);
91 91
 		$this->_model_chain_to_wp_user = 'Payment_Method';
92
-		parent::__construct( $timezone );
92
+		parent::__construct($timezone);
93 93
 	}
94 94
 
95 95
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 * @param string $PAY_txn_id_chq_nmbr
102 102
 	 * @return EE_Payment
103 103
 	 */
104
-	public function get_payment_by_txn_id_chq_nmbr( $PAY_txn_id_chq_nmbr ){
104
+	public function get_payment_by_txn_id_chq_nmbr($PAY_txn_id_chq_nmbr) {
105 105
 		return $this->get_one(array(array('PAY_txn_id_chq_nmbr'=>$PAY_txn_id_chq_nmbr)));
106 106
 	}
107 107
 
@@ -117,15 +117,15 @@  discard block
 block discarded – undo
117 117
 	 *		@param	string	$status_of_payment one of EEM_Payment::status_id_*, like 'PAP','PCN',etc. If none is provided, gets payments with any status
118 118
 	*		@return		EE_Payment[]
119 119
 	*/
120
-	public function get_payments_for_transaction( $TXN_ID = FALSE, $status_of_payment = null ) {
120
+	public function get_payments_for_transaction($TXN_ID = FALSE, $status_of_payment = null) {
121 121
 		// all payments for a TXN ordered chronologically
122
-		$query_params = array( array( 'TXN_ID' => $TXN_ID ), 'order_by' => array( 'PAY_timestamp' => 'ASC' ));
122
+		$query_params = array(array('TXN_ID' => $TXN_ID), 'order_by' => array('PAY_timestamp' => 'ASC'));
123 123
 		// if provided with a status, search specifically for that status. Otherwise get them all
124
-		if ( $status_of_payment ){
124
+		if ($status_of_payment) {
125 125
 			$query_params[0]['STS_ID'] = $status_of_payment;
126 126
 		}
127 127
 		// retrieve payments
128
-		return $this->get_all ( $query_params );
128
+		return $this->get_all($query_params);
129 129
 	}
130 130
 
131 131
 
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
 	 * @param int $TXN_ID
136 136
 	 * @return EE_Payment[]
137 137
 	 */
138
-	public function get_approved_payments_for_transaction( $TXN_ID = 0 ) {
139
-		return $this->get_payments_for_transaction( $TXN_ID, EEM_Payment::status_id_approved );
138
+	public function get_approved_payments_for_transaction($TXN_ID = 0) {
139
+		return $this->get_payments_for_transaction($TXN_ID, EEM_Payment::status_id_approved);
140 140
 
141 141
 	}
142 142
 
@@ -150,20 +150,20 @@  discard block
 block discarded – undo
150 150
 	* 		@param		string		$end_date
151 151
 	*		@return 	EE_Payment[]
152 152
 	*/
153
-	public function get_payments_made_between_dates( $start_date = '', $end_date = '' ) {
153
+	public function get_payments_made_between_dates($start_date = '', $end_date = '') {
154 154
 		// initial values
155
-		$start_date = ! empty( $start_date ) ? $start_date : date('Y-m-d',current_time('timestamp'));
156
-		$end_date = ! empty( $end_date ) ? $end_date : date('Y-m-d',current_time('timestamp'));
155
+		$start_date = ! empty($start_date) ? $start_date : date('Y-m-d', current_time('timestamp'));
156
+		$end_date = ! empty($end_date) ? $end_date : date('Y-m-d', current_time('timestamp'));
157 157
 		// make sure our timestamps start and end right at the boundaries for each day
158
-		$start_date = date( 'Y-m-d', strtotime( $start_date )) . ' 00:00:00';
159
-		$end_date = date( 'Y-m-d', strtotime( $end_date )) . ' 23:59:59';
158
+		$start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00';
159
+		$end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59';
160 160
 		// convert to timestamps
161
-		$start_date = strtotime( $start_date );
162
-		$end_date = strtotime( $end_date );
161
+		$start_date = strtotime($start_date);
162
+		$end_date = strtotime($end_date);
163 163
 		// make sure our start date is the lowest value and vice versa
164
-		$start_date = min( $start_date, $end_date );
165
-		$end_date = max( $start_date, $end_date );
166
-		return $this->get_all(array(array('PAY_timestamp'=>array('>=',$start_date),'PAY_timestamp*'=>array('<=',$end_date))));
164
+		$start_date = min($start_date, $end_date);
165
+		$end_date = max($start_date, $end_date);
166
+		return $this->get_all(array(array('PAY_timestamp'=>array('>=', $start_date), 'PAY_timestamp*'=>array('<=', $end_date))));
167 167
 	}
168 168
 
169 169
 	/**
@@ -173,35 +173,35 @@  discard block
 block discarded – undo
173 173
 	 * returns a string for the approved status
174 174
 	 * @return 	string
175 175
 	 */
176
-	function approved_status(){
176
+	function approved_status() {
177 177
 		return self::status_id_approved;
178 178
 	}
179 179
 	/**
180 180
 	 * returns a string for the pending status
181 181
 	 * @return 	string
182 182
 	 */
183
-	function pending_status(){
183
+	function pending_status() {
184 184
 		return self::status_id_pending;
185 185
 	}
186 186
 	/**
187 187
 	 * returns a string for the cancelled status
188 188
 	 * @return 	string
189 189
 	 */
190
-	function cancelled_status(){
190
+	function cancelled_status() {
191 191
 		return self::status_id_cancelled;
192 192
 	}
193 193
 	/**
194 194
 	 * returns a string for the failed status
195 195
 	 * @return 	string
196 196
 	 */
197
-	function failed_status(){
197
+	function failed_status() {
198 198
 		return self::status_id_failed;
199 199
 	}
200 200
 	/**
201 201
 	 * returns a string for the declined status
202 202
 	 * @return 	string
203 203
 	 */
204
-	function declined_status(){
204
+	function declined_status() {
205 205
 		return self::status_id_declined;
206 206
 	}
207 207
 
Please login to merge, or discard this patch.