Completed
Branch FET/add-loco-translate-support (7d9689)
by
unknown
26:14 queued 18:13
created
core/db_models/helpers/EE_Primary_Table.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -7,24 +7,24 @@
 block discarded – undo
7 7
 class EE_Primary_Table extends EE_Table_Base
8 8
 {
9 9
 
10
-    /**
11
-     *
12
-     * @global type $wpdb
13
-     * @param string $table_name with or without wpdb prefix
14
-     * @param string $pk_column name of primary key column
15
-     * @param boolean $global whether the table is "global" as in there is only 1 table on an entire multisite install,
16
-     *                  or whether each site on a multisite install has a copy of this table
17
-     */
18
-    public function __construct($table_name, $pk_column = null, $global = false)
19
-    {
20
-        parent::__construct($table_name, $pk_column, $global);
21
-    }
22
-    /**
23
-     * Gets SQL for this table and assigning it an alias. Eg " wp_esp_attendee AS Attendee "
24
-     * @return string
25
-     */
26
-    public function get_table_sql()
27
-    {
28
-        return " ".$this->get_table_name()." AS ".$this->get_table_alias()." ";
29
-    }
10
+	/**
11
+	 *
12
+	 * @global type $wpdb
13
+	 * @param string $table_name with or without wpdb prefix
14
+	 * @param string $pk_column name of primary key column
15
+	 * @param boolean $global whether the table is "global" as in there is only 1 table on an entire multisite install,
16
+	 *                  or whether each site on a multisite install has a copy of this table
17
+	 */
18
+	public function __construct($table_name, $pk_column = null, $global = false)
19
+	{
20
+		parent::__construct($table_name, $pk_column, $global);
21
+	}
22
+	/**
23
+	 * Gets SQL for this table and assigning it an alias. Eg " wp_esp_attendee AS Attendee "
24
+	 * @return string
25
+	 */
26
+	public function get_table_sql()
27
+	{
28
+		return " ".$this->get_table_name()." AS ".$this->get_table_alias()." ";
29
+	}
30 30
 }
Please login to merge, or discard this patch.
core/db_models/helpers/EE_Model_Parser.php 2 patches
Indentation   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -8,153 +8,153 @@
 block discarded – undo
8 8
  */
9 9
 class EE_Model_Parser
10 10
 {
11
-    const table_alias_model_relation_chain_separator = '__';
12
-    const table_alias_model_relation_chain_prefix_end = '___';
13
-    /**
14
-     * Adds a period onto the front and end of the string. This often helps in searching.
15
-     * For example, if we want to find the model name "Event", it can be tricky when the following are possible
16
-     * "","Event.EVT_ID","Event","Event_Venue.Venue.VNU_ID",etc. It's easier to look for ".Event." in
17
-     * "..",".Event.EVT_ID.", ".Event.", and ".Event_Venue.Venue.VNU_ID", especially when the last example should NOT
18
-     * be found because the "Event" model isn't mentioned- it's just a string that has a model name that coincidentally
19
-     * has it as a substring
20
-     * @param string $string_to_pad
21
-     * @return string
22
-     */
23
-    public static function pad_with_periods($string_to_pad)
24
-    {
25
-        return ".".$string_to_pad.".";
26
-    }
27
-    /**
28
-     * Basically undoes _pad_with_periods
29
-     * @param string $string_to_trim
30
-     * @return string
31
-     */
32
-    public static function trim_periods($string_to_trim)
33
-    {
34
-        return trim($string_to_trim, '.');
35
-    }
11
+	const table_alias_model_relation_chain_separator = '__';
12
+	const table_alias_model_relation_chain_prefix_end = '___';
13
+	/**
14
+	 * Adds a period onto the front and end of the string. This often helps in searching.
15
+	 * For example, if we want to find the model name "Event", it can be tricky when the following are possible
16
+	 * "","Event.EVT_ID","Event","Event_Venue.Venue.VNU_ID",etc. It's easier to look for ".Event." in
17
+	 * "..",".Event.EVT_ID.", ".Event.", and ".Event_Venue.Venue.VNU_ID", especially when the last example should NOT
18
+	 * be found because the "Event" model isn't mentioned- it's just a string that has a model name that coincidentally
19
+	 * has it as a substring
20
+	 * @param string $string_to_pad
21
+	 * @return string
22
+	 */
23
+	public static function pad_with_periods($string_to_pad)
24
+	{
25
+		return ".".$string_to_pad.".";
26
+	}
27
+	/**
28
+	 * Basically undoes _pad_with_periods
29
+	 * @param string $string_to_trim
30
+	 * @return string
31
+	 */
32
+	public static function trim_periods($string_to_trim)
33
+	{
34
+		return trim($string_to_trim, '.');
35
+	}
36 36
 
37 37
 
38 38
 
39
-    /**
40
-     * Gets the calculated table's alias
41
-     * @param string $model_relation_chain or query param
42
-     * @param        $this_model_name
43
-     * @return string which can be added onto table aliases to make them unique
44
-     */
45
-    public static function extract_table_alias_model_relation_chain_prefix($model_relation_chain, $this_model_name)
46
-    {
47
-        // eg $model_relation_chain = 'Venue.Event_Venue.Event.Registration", and $this_model_name = 'Event'
48
-        $model_relation_chain = self::pad_with_periods($model_relation_chain);
49
-        $this_model_name = self::pad_with_periods($this_model_name);
50
-        // eg '.Venue.Event_Venue.Event.Registration." and '.Event.'
51
-        // remove this model name and everything afterwards
52
-        $pos_of_model_name = strpos($model_relation_chain, $this_model_name);
53
-        $model_relation_chain = substr($model_relation_chain, 0, $pos_of_model_name);
54
-        // eg '.Venue.Event_Venue.'
55
-        // trim periods
56
-        $model_relation_chain = self::trim_periods($model_relation_chain);
57
-        // eg 'Venue.Event_Venue'
58
-        // replace periods with double-underscores
59
-        $model_relation_chain = str_replace(".", self::table_alias_model_relation_chain_separator, $model_relation_chain);
60
-        // eg 'Venue__Event_Venue'
61
-        if ($model_relation_chain !='') {
62
-            $model_relation_chain = $model_relation_chain.self::table_alias_model_relation_chain_prefix_end;
63
-        }
64
-        // eg 'Venue_Event_Venue___'
65
-        return $model_relation_chain;
66
-    }
67
-    /**
68
-     * Gets the table's alias (without prefix or anything)
69
-     * @param string $table_alias_with_model_relation_chain_prefix which CAN have a table alias model relation chain prefix (or not)
70
-     * @return string
71
-     */
72
-    public static function remove_table_alias_model_relation_chain_prefix($table_alias_with_model_relation_chain_prefix)
73
-    {
74
-        // does this actually have a table alias model relation chain prefix?
75
-        $pos = strpos($table_alias_with_model_relation_chain_prefix, self::table_alias_model_relation_chain_prefix_end);
76
-        if ($pos !== false) {
77
-            // yes
78
-            // find that triple underscore and remove it and everything before it
79
-            $table_alias = substr($table_alias_with_model_relation_chain_prefix, $pos + strlen(self::table_alias_model_relation_chain_prefix_end));
80
-        } else {
81
-            $table_alias = $table_alias_with_model_relation_chain_prefix;
82
-        }
83
-        return $table_alias;
84
-    }
85
-    /**
86
-     * Gets the table alias model relation chain prefix from the table alias already containing it
87
-     * @param string $table_alias_with_model_relation_chain_prefix
88
-     * @return string
89
-     */
90
-    public static function get_prefix_from_table_alias_with_model_relation_chain_prefix($table_alias_with_model_relation_chain_prefix)
91
-    {
92
-        // does this actually have a table alias model relation chain prefix?
93
-        $pos = strpos($table_alias_with_model_relation_chain_prefix, self::table_alias_model_relation_chain_prefix_end);
94
-        if ($pos !== false) {
95
-            // yes
96
-            // find that triple underscore and remove it and everything before it
97
-            $prefix = substr($table_alias_with_model_relation_chain_prefix, 0, $pos + strlen(self::table_alias_model_relation_chain_prefix_end));
98
-        } else {
99
-            $prefix = '';
100
-        }
101
-        return $prefix;
102
-    }
39
+	/**
40
+	 * Gets the calculated table's alias
41
+	 * @param string $model_relation_chain or query param
42
+	 * @param        $this_model_name
43
+	 * @return string which can be added onto table aliases to make them unique
44
+	 */
45
+	public static function extract_table_alias_model_relation_chain_prefix($model_relation_chain, $this_model_name)
46
+	{
47
+		// eg $model_relation_chain = 'Venue.Event_Venue.Event.Registration", and $this_model_name = 'Event'
48
+		$model_relation_chain = self::pad_with_periods($model_relation_chain);
49
+		$this_model_name = self::pad_with_periods($this_model_name);
50
+		// eg '.Venue.Event_Venue.Event.Registration." and '.Event.'
51
+		// remove this model name and everything afterwards
52
+		$pos_of_model_name = strpos($model_relation_chain, $this_model_name);
53
+		$model_relation_chain = substr($model_relation_chain, 0, $pos_of_model_name);
54
+		// eg '.Venue.Event_Venue.'
55
+		// trim periods
56
+		$model_relation_chain = self::trim_periods($model_relation_chain);
57
+		// eg 'Venue.Event_Venue'
58
+		// replace periods with double-underscores
59
+		$model_relation_chain = str_replace(".", self::table_alias_model_relation_chain_separator, $model_relation_chain);
60
+		// eg 'Venue__Event_Venue'
61
+		if ($model_relation_chain !='') {
62
+			$model_relation_chain = $model_relation_chain.self::table_alias_model_relation_chain_prefix_end;
63
+		}
64
+		// eg 'Venue_Event_Venue___'
65
+		return $model_relation_chain;
66
+	}
67
+	/**
68
+	 * Gets the table's alias (without prefix or anything)
69
+	 * @param string $table_alias_with_model_relation_chain_prefix which CAN have a table alias model relation chain prefix (or not)
70
+	 * @return string
71
+	 */
72
+	public static function remove_table_alias_model_relation_chain_prefix($table_alias_with_model_relation_chain_prefix)
73
+	{
74
+		// does this actually have a table alias model relation chain prefix?
75
+		$pos = strpos($table_alias_with_model_relation_chain_prefix, self::table_alias_model_relation_chain_prefix_end);
76
+		if ($pos !== false) {
77
+			// yes
78
+			// find that triple underscore and remove it and everything before it
79
+			$table_alias = substr($table_alias_with_model_relation_chain_prefix, $pos + strlen(self::table_alias_model_relation_chain_prefix_end));
80
+		} else {
81
+			$table_alias = $table_alias_with_model_relation_chain_prefix;
82
+		}
83
+		return $table_alias;
84
+	}
85
+	/**
86
+	 * Gets the table alias model relation chain prefix from the table alias already containing it
87
+	 * @param string $table_alias_with_model_relation_chain_prefix
88
+	 * @return string
89
+	 */
90
+	public static function get_prefix_from_table_alias_with_model_relation_chain_prefix($table_alias_with_model_relation_chain_prefix)
91
+	{
92
+		// does this actually have a table alias model relation chain prefix?
93
+		$pos = strpos($table_alias_with_model_relation_chain_prefix, self::table_alias_model_relation_chain_prefix_end);
94
+		if ($pos !== false) {
95
+			// yes
96
+			// find that triple underscore and remove it and everything before it
97
+			$prefix = substr($table_alias_with_model_relation_chain_prefix, 0, $pos + strlen(self::table_alias_model_relation_chain_prefix_end));
98
+		} else {
99
+			$prefix = '';
100
+		}
101
+		return $prefix;
102
+	}
103 103
 
104
-    /**
105
-     * Gets the table alias model relation chain prefix (ie, what can be prepended onto
106
-     * EE_Model_Field::get_qualified_column() to get the proper column name for that field
107
-     * in a specific query) from teh query param (eg 'Registration.Event.EVT_ID').
108
-     *
109
-     * @param string $model_name of the model on which the related query param was found to be belong
110
-     * @param string $original_query_param
111
-     * @return string
112
-     */
113
-    public static function extract_table_alias_model_relation_chain_from_query_param($model_name, $original_query_param)
114
-    {
115
-        $relation_chain = self::extract_model_relation_chain($model_name, $original_query_param);
116
-        $table_alias_with_model_relation_chain_prefix = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix($relation_chain, $model_name);
117
-        return $table_alias_with_model_relation_chain_prefix;
118
-    }
119
-    /**
120
-     * Gets the model relation chain to $model_name from the $original_query_param.
121
-     * Eg, if $model_name were 'Payment', and $original_query_param were 'Registration.Transaction.Payment.PAY_ID',
122
-     * this would return 'Registration.Transaction.Payment'. Also if the query param were 'Registration.Transaction.Payment'
123
-     * and $model_name were 'Payment', it should return 'Registration.Transaction.Payment'
124
-     * @param string $model_name
125
-     * @param string $original_query_param
126
-     * @return string
127
-     */
128
-    public static function extract_model_relation_chain($model_name, $original_query_param)
129
-    {
130
-        // prefix and postfix both with a period, as this facilitates searching
131
-        $model_name = EE_Model_Parser::pad_with_periods($model_name);
132
-        $original_query_param = EE_Model_Parser::pad_with_periods($original_query_param);
133
-        $pos_of_model_string = strpos($original_query_param, $model_name);
134
-        // eg, if we're looking for the model relation chain from Event to Payment, the original query param is probably something like
135
-        // "Registration.Transaction.Payment.PAY_ID", $pos_of_model_string points to the 'P' or Payment. We want the string
136
-        // "Registration.Transaction.Payment"
137
-        $model_relation_chain = substr($original_query_param, 0, $pos_of_model_string+strlen($model_name));
138
-        return EE_Model_Parser::trim_periods($model_relation_chain);
139
-    }
104
+	/**
105
+	 * Gets the table alias model relation chain prefix (ie, what can be prepended onto
106
+	 * EE_Model_Field::get_qualified_column() to get the proper column name for that field
107
+	 * in a specific query) from teh query param (eg 'Registration.Event.EVT_ID').
108
+	 *
109
+	 * @param string $model_name of the model on which the related query param was found to be belong
110
+	 * @param string $original_query_param
111
+	 * @return string
112
+	 */
113
+	public static function extract_table_alias_model_relation_chain_from_query_param($model_name, $original_query_param)
114
+	{
115
+		$relation_chain = self::extract_model_relation_chain($model_name, $original_query_param);
116
+		$table_alias_with_model_relation_chain_prefix = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix($relation_chain, $model_name);
117
+		return $table_alias_with_model_relation_chain_prefix;
118
+	}
119
+	/**
120
+	 * Gets the model relation chain to $model_name from the $original_query_param.
121
+	 * Eg, if $model_name were 'Payment', and $original_query_param were 'Registration.Transaction.Payment.PAY_ID',
122
+	 * this would return 'Registration.Transaction.Payment'. Also if the query param were 'Registration.Transaction.Payment'
123
+	 * and $model_name were 'Payment', it should return 'Registration.Transaction.Payment'
124
+	 * @param string $model_name
125
+	 * @param string $original_query_param
126
+	 * @return string
127
+	 */
128
+	public static function extract_model_relation_chain($model_name, $original_query_param)
129
+	{
130
+		// prefix and postfix both with a period, as this facilitates searching
131
+		$model_name = EE_Model_Parser::pad_with_periods($model_name);
132
+		$original_query_param = EE_Model_Parser::pad_with_periods($original_query_param);
133
+		$pos_of_model_string = strpos($original_query_param, $model_name);
134
+		// eg, if we're looking for the model relation chain from Event to Payment, the original query param is probably something like
135
+		// "Registration.Transaction.Payment.PAY_ID", $pos_of_model_string points to the 'P' or Payment. We want the string
136
+		// "Registration.Transaction.Payment"
137
+		$model_relation_chain = substr($original_query_param, 0, $pos_of_model_string+strlen($model_name));
138
+		return EE_Model_Parser::trim_periods($model_relation_chain);
139
+	}
140 140
 
141
-    /**
142
-     * Replaces the specified model in teh model relation chain with teh join model.
143
-     * Eg EE_Model_Parser::replace_model_name_with_join_model_name_in_model_relation_chain(
144
-     * "Ticket", "Datetime_Ticket", "Datetime.Ticket" ) will return
145
-     * "Datetime.Datetime_Ticket" which can be used to find the table alias model relation chain prefix
146
-     * using EE_Model_Parser::extract_table_alias_model_relation_chain_prefix
147
-     * @param string $model_name
148
-     * @param string $join_model_name
149
-     * @param string $model_relation_chain
150
-     * @return string
151
-     */
152
-    public static function replace_model_name_with_join_model_name_in_model_relation_chain($model_name, $join_model_name, $model_relation_chain)
153
-    {
154
-        $model_name = EE_Model_Parser::pad_with_periods($model_name);
155
-        $join_model_name = EE_Model_Parser::pad_with_periods($join_model_name);
156
-        $model_relation_chain = EE_Model_Parser::pad_with_periods($model_relation_chain);
157
-        $replaced_with_periods = str_replace($model_name, $join_model_name, $model_relation_chain);
158
-        return EE_Model_Parser::trim_periods($replaced_with_periods);
159
-    }
141
+	/**
142
+	 * Replaces the specified model in teh model relation chain with teh join model.
143
+	 * Eg EE_Model_Parser::replace_model_name_with_join_model_name_in_model_relation_chain(
144
+	 * "Ticket", "Datetime_Ticket", "Datetime.Ticket" ) will return
145
+	 * "Datetime.Datetime_Ticket" which can be used to find the table alias model relation chain prefix
146
+	 * using EE_Model_Parser::extract_table_alias_model_relation_chain_prefix
147
+	 * @param string $model_name
148
+	 * @param string $join_model_name
149
+	 * @param string $model_relation_chain
150
+	 * @return string
151
+	 */
152
+	public static function replace_model_name_with_join_model_name_in_model_relation_chain($model_name, $join_model_name, $model_relation_chain)
153
+	{
154
+		$model_name = EE_Model_Parser::pad_with_periods($model_name);
155
+		$join_model_name = EE_Model_Parser::pad_with_periods($join_model_name);
156
+		$model_relation_chain = EE_Model_Parser::pad_with_periods($model_relation_chain);
157
+		$replaced_with_periods = str_replace($model_name, $join_model_name, $model_relation_chain);
158
+		return EE_Model_Parser::trim_periods($replaced_with_periods);
159
+	}
160 160
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         // replace periods with double-underscores
59 59
         $model_relation_chain = str_replace(".", self::table_alias_model_relation_chain_separator, $model_relation_chain);
60 60
         // eg 'Venue__Event_Venue'
61
-        if ($model_relation_chain !='') {
61
+        if ($model_relation_chain != '') {
62 62
             $model_relation_chain = $model_relation_chain.self::table_alias_model_relation_chain_prefix_end;
63 63
         }
64 64
         // eg 'Venue_Event_Venue___'
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         // eg, if we're looking for the model relation chain from Event to Payment, the original query param is probably something like
135 135
         // "Registration.Transaction.Payment.PAY_ID", $pos_of_model_string points to the 'P' or Payment. We want the string
136 136
         // "Registration.Transaction.Payment"
137
-        $model_relation_chain = substr($original_query_param, 0, $pos_of_model_string+strlen($model_name));
137
+        $model_relation_chain = substr($original_query_param, 0, $pos_of_model_string + strlen($model_name));
138 138
         return EE_Model_Parser::trim_periods($model_relation_chain);
139 139
     }
140 140
 
Please login to merge, or discard this patch.
core/db_models/helpers/EE_Primary_Key_Index.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
6 6
  */
7 7
 class EE_Primary_Key_Index extends EE_Unique_Index
8 8
 {
9
-    // yep, actually the same as unique index right now
9
+	// yep, actually the same as unique index right now
10 10
 }
Please login to merge, or discard this patch.
core/db_models/EEM_Country.model.php 2 patches
Indentation   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -11,112 +11,112 @@
 block discarded – undo
11 11
 class EEM_Country extends EEM_Base
12 12
 {
13 13
 
14
-    // private instance of the Attendee object
15
-    protected static $_instance = null;
16
-    // array of all countries
17
-    private static $_all_countries = false;
18
-    // array of all active countries
19
-    private static $_active_countries = false;
14
+	// private instance of the Attendee object
15
+	protected static $_instance = null;
16
+	// array of all countries
17
+	private static $_all_countries = false;
18
+	// array of all active countries
19
+	private static $_active_countries = false;
20 20
 
21 21
 
22 22
 
23
-    /**
24
-     * Resets the country
25
-     * @return EEM_Country
26
-     */
27
-    public static function reset($timezone = null)
28
-    {
29
-        self::$_active_countries = null;
30
-        self::$_all_countries = null;
31
-        return parent::reset($timezone);
32
-    }
23
+	/**
24
+	 * Resets the country
25
+	 * @return EEM_Country
26
+	 */
27
+	public static function reset($timezone = null)
28
+	{
29
+		self::$_active_countries = null;
30
+		self::$_all_countries = null;
31
+		return parent::reset($timezone);
32
+	}
33 33
 
34
-    protected function __construct($timezone = null)
35
-    {
36
-        $this->singular_item = __('Country', 'event_espresso');
37
-        $this->plural_item = __('Countries', 'event_espresso');
34
+	protected function __construct($timezone = null)
35
+	{
36
+		$this->singular_item = __('Country', 'event_espresso');
37
+		$this->plural_item = __('Countries', 'event_espresso');
38 38
 
39 39
 
40
-        $this->_tables = array(
41
-            'Country'=> new EE_Primary_Table('esp_country', 'CNT_ISO')
42
-        );
43
-        $this->_fields = array(
44
-            'Country'=>array(
45
-                'CNT_active' => new EE_Boolean_Field('CNT_active', __('Country Appears in Dropdown Select Lists', 'event_espresso'), false, true),
46
-                'CNT_ISO'=> new EE_Primary_Key_String_Field('CNT_ISO', __('Country ISO Code', 'event_espresso')),
47
-                'CNT_ISO3'=>new EE_All_Caps_Text_Field('CNT_ISO3', __('Country ISO3 Code', 'event_espresso'), false, ''),
48
-                '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
49
-                'CNT_name'=>new EE_Plain_Text_Field('CNT_name', __('Country Name', 'event_espresso'), false, ''),
50
-                'CNT_cur_code'=>new EE_All_Caps_Text_Field('CNT_cur_code', __('Country Currency Code', 'event_espresso'), false),
51
-                'CNT_cur_single' => new EE_Plain_Text_Field('CNT_cur_single', __('Currency Name Singular', 'event_espresso'), false),
52
-                'CNT_cur_plural' => new EE_Plain_Text_Field('CNT_cur_plural', __('Currency Name Plural', 'event_espresso'), false),
53
-                'CNT_cur_sign' => new EE_Plain_Text_Field('CNT_cur_sign', __('Currency Sign', 'event_espresso'), false),
54
-                'CNT_cur_sign_b4' => new EE_Boolean_Field('CNT_cur_sign_b4', __('Currency Sign Before Number', 'event_espresso'), false, true),
55
-                'CNT_cur_dec_plc' => new EE_Integer_Field('CNT_cur_dec_plc', __('Currency Decimal Places', 'event_espresso'), false, 2),
56
-                'CNT_cur_dec_mrk' => new EE_Plain_Text_Field('CNT_cur_dec_mrk', __('Currency Decimal Mark', 'event_espresso'), false, '.'),
57
-                'CNT_cur_thsnds' => new EE_Plain_Text_Field('CNT_cur_thsnds', __('Currency Thousands Seperator', 'event_espresso'), false, ','),
58
-                'CNT_tel_code' => new EE_Plain_Text_Field('CNT_tel_code', __('Country Telephone Code', 'event_espresso'), false, ''),
59
-                'CNT_is_EU' => new EE_Boolean_Field('CNT_is_EU', __('Country is Member of EU', 'event_espresso'), false, false)
60
-            ));
61
-        $this->_model_relations = array(
62
-            'Attendee'=>new EE_Has_Many_Relation(),
63
-            'State'=>new EE_Has_Many_Relation(),
64
-            'Venue'=>new EE_Has_Many_Relation(),
65
-        );
66
-        // only anyone to view, but only those with the default role can do anything
67
-        $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
40
+		$this->_tables = array(
41
+			'Country'=> new EE_Primary_Table('esp_country', 'CNT_ISO')
42
+		);
43
+		$this->_fields = array(
44
+			'Country'=>array(
45
+				'CNT_active' => new EE_Boolean_Field('CNT_active', __('Country Appears in Dropdown Select Lists', 'event_espresso'), false, true),
46
+				'CNT_ISO'=> new EE_Primary_Key_String_Field('CNT_ISO', __('Country ISO Code', 'event_espresso')),
47
+				'CNT_ISO3'=>new EE_All_Caps_Text_Field('CNT_ISO3', __('Country ISO3 Code', 'event_espresso'), false, ''),
48
+				'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
49
+				'CNT_name'=>new EE_Plain_Text_Field('CNT_name', __('Country Name', 'event_espresso'), false, ''),
50
+				'CNT_cur_code'=>new EE_All_Caps_Text_Field('CNT_cur_code', __('Country Currency Code', 'event_espresso'), false),
51
+				'CNT_cur_single' => new EE_Plain_Text_Field('CNT_cur_single', __('Currency Name Singular', 'event_espresso'), false),
52
+				'CNT_cur_plural' => new EE_Plain_Text_Field('CNT_cur_plural', __('Currency Name Plural', 'event_espresso'), false),
53
+				'CNT_cur_sign' => new EE_Plain_Text_Field('CNT_cur_sign', __('Currency Sign', 'event_espresso'), false),
54
+				'CNT_cur_sign_b4' => new EE_Boolean_Field('CNT_cur_sign_b4', __('Currency Sign Before Number', 'event_espresso'), false, true),
55
+				'CNT_cur_dec_plc' => new EE_Integer_Field('CNT_cur_dec_plc', __('Currency Decimal Places', 'event_espresso'), false, 2),
56
+				'CNT_cur_dec_mrk' => new EE_Plain_Text_Field('CNT_cur_dec_mrk', __('Currency Decimal Mark', 'event_espresso'), false, '.'),
57
+				'CNT_cur_thsnds' => new EE_Plain_Text_Field('CNT_cur_thsnds', __('Currency Thousands Seperator', 'event_espresso'), false, ','),
58
+				'CNT_tel_code' => new EE_Plain_Text_Field('CNT_tel_code', __('Country Telephone Code', 'event_espresso'), false, ''),
59
+				'CNT_is_EU' => new EE_Boolean_Field('CNT_is_EU', __('Country is Member of EU', 'event_espresso'), false, false)
60
+			));
61
+		$this->_model_relations = array(
62
+			'Attendee'=>new EE_Has_Many_Relation(),
63
+			'State'=>new EE_Has_Many_Relation(),
64
+			'Venue'=>new EE_Has_Many_Relation(),
65
+		);
66
+		// only anyone to view, but only those with the default role can do anything
67
+		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
68 68
 
69
-        parent::__construct($timezone);
70
-    }
69
+		parent::__construct($timezone);
70
+	}
71 71
 
72 72
 
73 73
 
74 74
 
75
-    /**
76
-    *       _get_countries
77
-    *
78
-    *       @access     public
79
-    *       @return         array
80
-    */
81
-    public function get_all_countries()
82
-    {
83
-        if (! self::$_all_countries) {
84
-            self::$_all_countries = $this->get_all(array( 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=> array( 0,99999 )));
85
-        }
86
-        return self::$_all_countries;
87
-    }
75
+	/**
76
+	 *       _get_countries
77
+	 *
78
+	 *       @access     public
79
+	 *       @return         array
80
+	 */
81
+	public function get_all_countries()
82
+	{
83
+		if (! self::$_all_countries) {
84
+			self::$_all_countries = $this->get_all(array( 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=> array( 0,99999 )));
85
+		}
86
+		return self::$_all_countries;
87
+	}
88 88
 
89
-    /**
90
-    *       _get_countries
91
-    *       Gets and caches the list of active countries. If you know the list of active countries
92
-    *       has changed during this request, first use EEM_Country::reset() to flush the cache
93
-    *       @access     public
94
-    *       @return         array
95
-    */
96
-    public function get_all_active_countries()
97
-    {
98
-        if (! self::$_active_countries) {
99
-            self::$_active_countries =  $this->get_all(array( array( 'CNT_active' => true ), 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=>array( 0, 99999 )));
100
-        }
101
-        return self::$_active_countries;
102
-    }
89
+	/**
90
+	 *       _get_countries
91
+	 *       Gets and caches the list of active countries. If you know the list of active countries
92
+	 *       has changed during this request, first use EEM_Country::reset() to flush the cache
93
+	 *       @access     public
94
+	 *       @return         array
95
+	 */
96
+	public function get_all_active_countries()
97
+	{
98
+		if (! self::$_active_countries) {
99
+			self::$_active_countries =  $this->get_all(array( array( 'CNT_active' => true ), 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=>array( 0, 99999 )));
100
+		}
101
+		return self::$_active_countries;
102
+	}
103 103
 
104
-    /**
105
-     * Gets the country's name by its ISO
106
-     * @param string $country_ISO
107
-     * @return string
108
-     */
109
-    public function get_country_name_by_ISO($country_ISO)
110
-    {
111
-        if (isset(self::$_all_countries[ $country_ISO ]) &&
112
-                self::$_all_countries[ $country_ISO ] instanceof EE_Country ) {
113
-            return self::$_all_countries[ $country_ISO ]->name();
114
-        }
115
-        $names = $this->get_col(array( array( 'CNT_ISO' => $country_ISO ), 'limit' => 1), 'CNT_name');
116
-        if (is_array($names) && ! empty($names)) {
117
-            return reset($names);
118
-        } else {
119
-            return '';
120
-        }
121
-    }
104
+	/**
105
+	 * Gets the country's name by its ISO
106
+	 * @param string $country_ISO
107
+	 * @return string
108
+	 */
109
+	public function get_country_name_by_ISO($country_ISO)
110
+	{
111
+		if (isset(self::$_all_countries[ $country_ISO ]) &&
112
+				self::$_all_countries[ $country_ISO ] instanceof EE_Country ) {
113
+			return self::$_all_countries[ $country_ISO ]->name();
114
+		}
115
+		$names = $this->get_col(array( array( 'CNT_ISO' => $country_ISO ), 'limit' => 1), 'CNT_name');
116
+		if (is_array($names) && ! empty($names)) {
117
+			return reset($names);
118
+		} else {
119
+			return '';
120
+		}
121
+	}
122 122
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
                 'CNT_active' => new EE_Boolean_Field('CNT_active', __('Country Appears in Dropdown Select Lists', 'event_espresso'), false, true),
46 46
                 'CNT_ISO'=> new EE_Primary_Key_String_Field('CNT_ISO', __('Country ISO Code', 'event_espresso')),
47 47
                 'CNT_ISO3'=>new EE_All_Caps_Text_Field('CNT_ISO3', __('Country ISO3 Code', 'event_espresso'), false, ''),
48
-                '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
48
+                '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
49 49
                 'CNT_name'=>new EE_Plain_Text_Field('CNT_name', __('Country Name', 'event_espresso'), false, ''),
50 50
                 'CNT_cur_code'=>new EE_All_Caps_Text_Field('CNT_cur_code', __('Country Currency Code', 'event_espresso'), false),
51 51
                 'CNT_cur_single' => new EE_Plain_Text_Field('CNT_cur_single', __('Currency Name Singular', 'event_espresso'), false),
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
             'Venue'=>new EE_Has_Many_Relation(),
65 65
         );
66 66
         // only anyone to view, but only those with the default role can do anything
67
-        $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
67
+        $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
68 68
 
69 69
         parent::__construct($timezone);
70 70
     }
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
     */
81 81
     public function get_all_countries()
82 82
     {
83
-        if (! self::$_all_countries) {
84
-            self::$_all_countries = $this->get_all(array( 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=> array( 0,99999 )));
83
+        if ( ! self::$_all_countries) {
84
+            self::$_all_countries = $this->get_all(array('order_by'=>array('CNT_name'=>'ASC'), 'limit'=> array(0, 99999)));
85 85
         }
86 86
         return self::$_all_countries;
87 87
     }
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
     */
96 96
     public function get_all_active_countries()
97 97
     {
98
-        if (! self::$_active_countries) {
99
-            self::$_active_countries =  $this->get_all(array( array( 'CNT_active' => true ), 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=>array( 0, 99999 )));
98
+        if ( ! self::$_active_countries) {
99
+            self::$_active_countries = $this->get_all(array(array('CNT_active' => true), 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=>array(0, 99999)));
100 100
         }
101 101
         return self::$_active_countries;
102 102
     }
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
      */
109 109
     public function get_country_name_by_ISO($country_ISO)
110 110
     {
111
-        if (isset(self::$_all_countries[ $country_ISO ]) &&
112
-                self::$_all_countries[ $country_ISO ] instanceof EE_Country ) {
113
-            return self::$_all_countries[ $country_ISO ]->name();
111
+        if (isset(self::$_all_countries[$country_ISO]) &&
112
+                self::$_all_countries[$country_ISO] instanceof EE_Country) {
113
+            return self::$_all_countries[$country_ISO]->name();
114 114
         }
115
-        $names = $this->get_col(array( array( 'CNT_ISO' => $country_ISO ), 'limit' => 1), 'CNT_name');
115
+        $names = $this->get_col(array(array('CNT_ISO' => $country_ISO), 'limit' => 1), 'CNT_name');
116 116
         if (is_array($names) && ! empty($names)) {
117 117
             return reset($names);
118 118
         } else {
Please login to merge, or discard this patch.
core/db_models/EEM_Transaction.model.php 2 patches
Indentation   +445 added lines, -445 removed lines patch added patch discarded remove patch
@@ -16,230 +16,230 @@  discard block
 block discarded – undo
16 16
 class EEM_Transaction extends EEM_Base
17 17
 {
18 18
 
19
-    // private instance of the Transaction object
20
-    protected static $_instance;
21
-
22
-    /**
23
-     * Status ID(STS_ID on esp_status table) to indicate the transaction is complete,
24
-     * but payment is pending. This is the state for transactions where payment is promised
25
-     * from an offline gateway.
26
-     */
27
-    //  const open_status_code = 'TPN';
28
-
29
-    /**
30
-     * Status ID(STS_ID on esp_status table) to indicate the transaction failed,
31
-     * either due to a technical reason (server or computer crash during registration),
32
-     *  or some other reason that prevent the collection of any useful contact information from any of the registrants
33
-     */
34
-    const failed_status_code = 'TFL';
35
-
36
-    /**
37
-     * Status ID(STS_ID on esp_status table) to indicate the transaction was abandoned,
38
-     * either due to a technical reason (server or computer crash during registration),
39
-     * or due to an abandoned cart after registrant chose not to complete the registration process
40
-     * HOWEVER...
41
-     * an abandoned TXN differs from a failed TXN in that it was able to capture contact information for at least one
42
-     * registrant
43
-     */
44
-    const abandoned_status_code = 'TAB';
45
-
46
-    /**
47
-     * Status ID(STS_ID on esp_status table) to indicate an incomplete transaction,
48
-     * meaning that monies are still owing: TXN_paid < TXN_total
49
-     */
50
-    const incomplete_status_code = 'TIN';
51
-
52
-    /**
53
-     * Status ID (STS_ID on esp_status table) to indicate a complete transaction.
54
-     * meaning that NO monies are owing: TXN_paid == TXN_total
55
-     */
56
-    const complete_status_code = 'TCM';
57
-
58
-    /**
59
-     *  Status ID(STS_ID on esp_status table) to indicate the transaction is overpaid.
60
-     *  This is the same as complete, but site admins actually owe clients the moneys!  TXN_paid > TXN_total
61
-     */
62
-    const overpaid_status_code = 'TOP';
63
-
64
-
65
-    /**
66
-     *    private constructor to prevent direct creation
67
-     *
68
-     * @Constructor
69
-     * @access protected
70
-     *
71
-     * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any
72
-     *                         incoming timezone data that gets saved). Note this just sends the timezone info to the
73
-     *                         date time model field objects.  Default is NULL (and will be assumed using the set
74
-     *                         timezone in the 'timezone_string' wp option)
75
-     *
76
-     * @return EEM_Transaction
77
-     * @throws \EE_Error
78
-     */
79
-    protected function __construct($timezone)
80
-    {
81
-        $this->singular_item = __('Transaction', 'event_espresso');
82
-        $this->plural_item   = __('Transactions', 'event_espresso');
83
-
84
-        $this->_tables                 = array(
85
-            'TransactionTable' => new EE_Primary_Table('esp_transaction', 'TXN_ID')
86
-        );
87
-        $this->_fields                 = array(
88
-            'TransactionTable' => array(
89
-                'TXN_ID'           => new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso')),
90
-                'TXN_timestamp'    => new EE_Datetime_Field(
91
-                    'TXN_timestamp',
92
-                    __('date when transaction was created', 'event_espresso'),
93
-                    false,
94
-                    EE_Datetime_Field::now,
95
-                    $timezone
96
-                ),
97
-                'TXN_total'        => new EE_Money_Field(
98
-                    'TXN_total',
99
-                    __('Total value of Transaction', 'event_espresso'),
100
-                    false,
101
-                    0
102
-                ),
103
-                'TXN_paid'         => new EE_Money_Field(
104
-                    'TXN_paid',
105
-                    __('Amount paid towards transaction to date', 'event_espresso'),
106
-                    false,
107
-                    0
108
-                ),
109
-                'STS_ID'           => new EE_Foreign_Key_String_Field(
110
-                    'STS_ID',
111
-                    __('Status ID', 'event_espresso'),
112
-                    false,
113
-                    EEM_Transaction::failed_status_code,
114
-                    'Status'
115
-                ),
116
-                'TXN_session_data' => new EE_Serialized_Text_Field(
117
-                    'TXN_session_data',
118
-                    __('Serialized session data', 'event_espresso'),
119
-                    true,
120
-                    ''
121
-                ),
122
-                'TXN_hash_salt'    => new EE_Plain_Text_Field(
123
-                    'TXN_hash_salt',
124
-                    __('Transaction Hash Salt', 'event_espresso'),
125
-                    true,
126
-                    ''
127
-                ),
128
-                'PMD_ID'           => new EE_Foreign_Key_Int_Field(
129
-                    'PMD_ID',
130
-                    __("Last Used Payment Method", 'event_espresso'),
131
-                    true,
132
-                    null,
133
-                    'Payment_Method'
134
-                ),
135
-                'TXN_reg_steps'    => new EE_Serialized_Text_Field(
136
-                    'TXN_reg_steps',
137
-                    __('Registration Steps', 'event_espresso'),
138
-                    false,
139
-                    array()
140
-                ),
141
-            )
142
-        );
143
-        $this->_model_relations        = array(
144
-            'Registration'   => new EE_Has_Many_Relation(),
145
-            'Payment'        => new EE_Has_Many_Relation(),
146
-            'Status'         => new EE_Belongs_To_Relation(),
147
-            'Line_Item'      => new EE_Has_Many_Relation(false),
148
-            // you can delete a transaction without needing to delete its line items
149
-            'Payment_Method' => new EE_Belongs_To_Relation(),
150
-            'Message'        => new EE_Has_Many_Relation()
151
-        );
152
-        $this->_model_chain_to_wp_user = 'Registration.Event';
153
-        parent::__construct($timezone);
154
-    }
155
-
156
-
157
-    /**
158
-     *    txn_status_array
159
-     * get list of transaction statuses
160
-     *
161
-     * @access public
162
-     * @return array
163
-     */
164
-    public static function txn_status_array()
165
-    {
166
-        return apply_filters(
167
-            'FHEE__EEM_Transaction__txn_status_array',
168
-            array(
169
-                EEM_Transaction::overpaid_status_code,
170
-                EEM_Transaction::complete_status_code,
171
-                EEM_Transaction::incomplete_status_code,
172
-                EEM_Transaction::abandoned_status_code,
173
-                EEM_Transaction::failed_status_code,
174
-            )
175
-        );
176
-    }
177
-
178
-    /**
179
-     *        get the revenue per day  for the Transaction Admin page Reports Tab
180
-     *
181
-     * @access        public
182
-     *
183
-     * @param string $period
184
-     *
185
-     * @return \stdClass[]
186
-     */
187
-    public function get_revenue_per_day_report($period = '-1 month')
188
-    {
189
-        $sql_date = $this->convert_datetime_for_query(
190
-            'TXN_timestamp',
191
-            date('Y-m-d H:i:s', strtotime($period)),
192
-            'Y-m-d H:i:s',
193
-            'UTC'
194
-        );
195
-
196
-        $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'TXN_timestamp');
197
-
198
-        return $this->_get_all_wpdb_results(
199
-            array(
200
-                array(
201
-                    'TXN_timestamp' => array('>=', $sql_date)
202
-                ),
203
-                'group_by' => 'txnDate',
204
-                'order_by' => array('TXN_timestamp' => 'ASC')
205
-            ),
206
-            OBJECT,
207
-            array(
208
-                'txnDate' => array('DATE(' . $query_interval . ')', '%s'),
209
-                'revenue' => array('SUM(TransactionTable.TXN_paid)', '%d')
210
-            )
211
-        );
212
-    }
213
-
214
-
215
-    /**
216
-     *        get the revenue per event  for the Transaction Admin page Reports Tab
217
-     *
218
-     * @access        public
219
-     *
220
-     * @param string $period
221
-     *
222
-     * @throws \EE_Error
223
-     * @return mixed
224
-     */
225
-    public function get_revenue_per_event_report($period = '-1 month')
226
-    {
227
-        global $wpdb;
228
-        $transaction_table          = $wpdb->prefix . 'esp_transaction';
229
-        $registration_table         = $wpdb->prefix . 'esp_registration';
230
-        $registration_payment_table = $wpdb->prefix . 'esp_registration_payment';
231
-        $event_table                = $wpdb->posts;
232
-        $payment_table              = $wpdb->prefix . 'esp_payment';
233
-        $sql_date                   = date('Y-m-d H:i:s', strtotime($period));
234
-        $approved_payment_status    = EEM_Payment::status_id_approved;
235
-        $extra_event_on_join        = '';
236
-        // exclude events not authored by user if permissions in effect
237
-        if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) {
238
-            $extra_event_on_join = ' AND Event.post_author = ' . get_current_user_id();
239
-        }
240
-
241
-        return $wpdb->get_results(
242
-            "SELECT
19
+	// private instance of the Transaction object
20
+	protected static $_instance;
21
+
22
+	/**
23
+	 * Status ID(STS_ID on esp_status table) to indicate the transaction is complete,
24
+	 * but payment is pending. This is the state for transactions where payment is promised
25
+	 * from an offline gateway.
26
+	 */
27
+	//  const open_status_code = 'TPN';
28
+
29
+	/**
30
+	 * Status ID(STS_ID on esp_status table) to indicate the transaction failed,
31
+	 * either due to a technical reason (server or computer crash during registration),
32
+	 *  or some other reason that prevent the collection of any useful contact information from any of the registrants
33
+	 */
34
+	const failed_status_code = 'TFL';
35
+
36
+	/**
37
+	 * Status ID(STS_ID on esp_status table) to indicate the transaction was abandoned,
38
+	 * either due to a technical reason (server or computer crash during registration),
39
+	 * or due to an abandoned cart after registrant chose not to complete the registration process
40
+	 * HOWEVER...
41
+	 * an abandoned TXN differs from a failed TXN in that it was able to capture contact information for at least one
42
+	 * registrant
43
+	 */
44
+	const abandoned_status_code = 'TAB';
45
+
46
+	/**
47
+	 * Status ID(STS_ID on esp_status table) to indicate an incomplete transaction,
48
+	 * meaning that monies are still owing: TXN_paid < TXN_total
49
+	 */
50
+	const incomplete_status_code = 'TIN';
51
+
52
+	/**
53
+	 * Status ID (STS_ID on esp_status table) to indicate a complete transaction.
54
+	 * meaning that NO monies are owing: TXN_paid == TXN_total
55
+	 */
56
+	const complete_status_code = 'TCM';
57
+
58
+	/**
59
+	 *  Status ID(STS_ID on esp_status table) to indicate the transaction is overpaid.
60
+	 *  This is the same as complete, but site admins actually owe clients the moneys!  TXN_paid > TXN_total
61
+	 */
62
+	const overpaid_status_code = 'TOP';
63
+
64
+
65
+	/**
66
+	 *    private constructor to prevent direct creation
67
+	 *
68
+	 * @Constructor
69
+	 * @access protected
70
+	 *
71
+	 * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any
72
+	 *                         incoming timezone data that gets saved). Note this just sends the timezone info to the
73
+	 *                         date time model field objects.  Default is NULL (and will be assumed using the set
74
+	 *                         timezone in the 'timezone_string' wp option)
75
+	 *
76
+	 * @return EEM_Transaction
77
+	 * @throws \EE_Error
78
+	 */
79
+	protected function __construct($timezone)
80
+	{
81
+		$this->singular_item = __('Transaction', 'event_espresso');
82
+		$this->plural_item   = __('Transactions', 'event_espresso');
83
+
84
+		$this->_tables                 = array(
85
+			'TransactionTable' => new EE_Primary_Table('esp_transaction', 'TXN_ID')
86
+		);
87
+		$this->_fields                 = array(
88
+			'TransactionTable' => array(
89
+				'TXN_ID'           => new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso')),
90
+				'TXN_timestamp'    => new EE_Datetime_Field(
91
+					'TXN_timestamp',
92
+					__('date when transaction was created', 'event_espresso'),
93
+					false,
94
+					EE_Datetime_Field::now,
95
+					$timezone
96
+				),
97
+				'TXN_total'        => new EE_Money_Field(
98
+					'TXN_total',
99
+					__('Total value of Transaction', 'event_espresso'),
100
+					false,
101
+					0
102
+				),
103
+				'TXN_paid'         => new EE_Money_Field(
104
+					'TXN_paid',
105
+					__('Amount paid towards transaction to date', 'event_espresso'),
106
+					false,
107
+					0
108
+				),
109
+				'STS_ID'           => new EE_Foreign_Key_String_Field(
110
+					'STS_ID',
111
+					__('Status ID', 'event_espresso'),
112
+					false,
113
+					EEM_Transaction::failed_status_code,
114
+					'Status'
115
+				),
116
+				'TXN_session_data' => new EE_Serialized_Text_Field(
117
+					'TXN_session_data',
118
+					__('Serialized session data', 'event_espresso'),
119
+					true,
120
+					''
121
+				),
122
+				'TXN_hash_salt'    => new EE_Plain_Text_Field(
123
+					'TXN_hash_salt',
124
+					__('Transaction Hash Salt', 'event_espresso'),
125
+					true,
126
+					''
127
+				),
128
+				'PMD_ID'           => new EE_Foreign_Key_Int_Field(
129
+					'PMD_ID',
130
+					__("Last Used Payment Method", 'event_espresso'),
131
+					true,
132
+					null,
133
+					'Payment_Method'
134
+				),
135
+				'TXN_reg_steps'    => new EE_Serialized_Text_Field(
136
+					'TXN_reg_steps',
137
+					__('Registration Steps', 'event_espresso'),
138
+					false,
139
+					array()
140
+				),
141
+			)
142
+		);
143
+		$this->_model_relations        = array(
144
+			'Registration'   => new EE_Has_Many_Relation(),
145
+			'Payment'        => new EE_Has_Many_Relation(),
146
+			'Status'         => new EE_Belongs_To_Relation(),
147
+			'Line_Item'      => new EE_Has_Many_Relation(false),
148
+			// you can delete a transaction without needing to delete its line items
149
+			'Payment_Method' => new EE_Belongs_To_Relation(),
150
+			'Message'        => new EE_Has_Many_Relation()
151
+		);
152
+		$this->_model_chain_to_wp_user = 'Registration.Event';
153
+		parent::__construct($timezone);
154
+	}
155
+
156
+
157
+	/**
158
+	 *    txn_status_array
159
+	 * get list of transaction statuses
160
+	 *
161
+	 * @access public
162
+	 * @return array
163
+	 */
164
+	public static function txn_status_array()
165
+	{
166
+		return apply_filters(
167
+			'FHEE__EEM_Transaction__txn_status_array',
168
+			array(
169
+				EEM_Transaction::overpaid_status_code,
170
+				EEM_Transaction::complete_status_code,
171
+				EEM_Transaction::incomplete_status_code,
172
+				EEM_Transaction::abandoned_status_code,
173
+				EEM_Transaction::failed_status_code,
174
+			)
175
+		);
176
+	}
177
+
178
+	/**
179
+	 *        get the revenue per day  for the Transaction Admin page Reports Tab
180
+	 *
181
+	 * @access        public
182
+	 *
183
+	 * @param string $period
184
+	 *
185
+	 * @return \stdClass[]
186
+	 */
187
+	public function get_revenue_per_day_report($period = '-1 month')
188
+	{
189
+		$sql_date = $this->convert_datetime_for_query(
190
+			'TXN_timestamp',
191
+			date('Y-m-d H:i:s', strtotime($period)),
192
+			'Y-m-d H:i:s',
193
+			'UTC'
194
+		);
195
+
196
+		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'TXN_timestamp');
197
+
198
+		return $this->_get_all_wpdb_results(
199
+			array(
200
+				array(
201
+					'TXN_timestamp' => array('>=', $sql_date)
202
+				),
203
+				'group_by' => 'txnDate',
204
+				'order_by' => array('TXN_timestamp' => 'ASC')
205
+			),
206
+			OBJECT,
207
+			array(
208
+				'txnDate' => array('DATE(' . $query_interval . ')', '%s'),
209
+				'revenue' => array('SUM(TransactionTable.TXN_paid)', '%d')
210
+			)
211
+		);
212
+	}
213
+
214
+
215
+	/**
216
+	 *        get the revenue per event  for the Transaction Admin page Reports Tab
217
+	 *
218
+	 * @access        public
219
+	 *
220
+	 * @param string $period
221
+	 *
222
+	 * @throws \EE_Error
223
+	 * @return mixed
224
+	 */
225
+	public function get_revenue_per_event_report($period = '-1 month')
226
+	{
227
+		global $wpdb;
228
+		$transaction_table          = $wpdb->prefix . 'esp_transaction';
229
+		$registration_table         = $wpdb->prefix . 'esp_registration';
230
+		$registration_payment_table = $wpdb->prefix . 'esp_registration_payment';
231
+		$event_table                = $wpdb->posts;
232
+		$payment_table              = $wpdb->prefix . 'esp_payment';
233
+		$sql_date                   = date('Y-m-d H:i:s', strtotime($period));
234
+		$approved_payment_status    = EEM_Payment::status_id_approved;
235
+		$extra_event_on_join        = '';
236
+		// exclude events not authored by user if permissions in effect
237
+		if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) {
238
+			$extra_event_on_join = ' AND Event.post_author = ' . get_current_user_id();
239
+		}
240
+
241
+		return $wpdb->get_results(
242
+			"SELECT
243 243
 			Transaction_Event.event_name AS event_name,
244 244
 			SUM(Transaction_Event.paid) AS revenue
245 245
 			FROM
@@ -267,229 +267,229 @@  discard block
 block discarded – undo
267 267
 					$extra_event_on_join
268 268
 				) AS Transaction_Event
269 269
 			GROUP BY event_name",
270
-            OBJECT
271
-        );
272
-    }
273
-
274
-
275
-    /**
276
-     * Gets the current transaction given the reg_url_link, or assumes the reg_url_link is in the
277
-     * $_REQUEST global variable. Either way, tries to find the current transaction (through
278
-     * the registration pointed to by reg_url_link), if not returns null
279
-     *
280
-     * @param string $reg_url_link
281
-     *
282
-     * @return EE_Transaction
283
-     */
284
-    public function get_transaction_from_reg_url_link($reg_url_link = '')
285
-    {
286
-        return $this->get_one(array(
287
-            array(
288
-                'Registration.REG_url_link' => ! empty($reg_url_link) ? $reg_url_link : EE_Registry::instance()->REQ->get(
289
-                    'e_reg_url_link',
290
-                    ''
291
-                )
292
-            )
293
-        ));
294
-    }
295
-
296
-
297
-    /**
298
-     * Updates the provided EE_Transaction with all the applicable payments
299
-     * (or fetch the EE_Transaction from its ID)
300
-     *
301
-     * @deprecated
302
-     *
303
-     * @param EE_Transaction|int $transaction_obj_or_id
304
-     * @param boolean            $save_txn whether or not to save the transaction during this function call
305
-     *
306
-     * @return boolean
307
-     * @throws \EE_Error
308
-     */
309
-    public function update_based_on_payments($transaction_obj_or_id, $save_txn = true)
310
-    {
311
-        EE_Error::doing_it_wrong(
312
-            __CLASS__ . '::' . __FUNCTION__,
313
-            sprintf(
314
-                __('This method is deprecated. Please use "%s" instead', 'event_espresso'),
315
-                'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'
316
-            ),
317
-            '4.6.0'
318
-        );
319
-        /** @type EE_Transaction_Processor $transaction_processor */
320
-        $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
321
-
322
-        return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment(
323
-            $this->ensure_is_obj($transaction_obj_or_id)
324
-        );
325
-    }
326
-
327
-    /**
328
-     * Deletes "junk" transactions that were probably added by bots. There might be TONS
329
-     * of these, so we are very careful to NOT select (which the models do even when deleting),
330
-     * and so we only use wpdb directly and only do minimal joins.
331
-     * Transactions are considered "junk" if they're failed for longer than a week.
332
-     * Also, there is an extra check for payments related to the transaction, because if a transaction has a payment on
333
-     * it, it's probably not junk (regardless of what status it has).
334
-     * The downside to this approach is that is addons are listening for object deletions
335
-     * on EEM_Base::delete() they won't be notified of this.  However, there is an action that plugins can hook into
336
-     * to catch these types of deletions.
337
-     *
338
-     * @global WPDB $wpdb
339
-     * @return mixed
340
-     */
341
-    public function delete_junk_transactions()
342
-    {
343
-        /** @type WPDB $wpdb */
344
-        global $wpdb;
345
-        $deleted             = false;
346
-        $time_to_leave_alone = apply_filters(
347
-            'FHEE__EEM_Transaction__delete_junk_transactions__time_to_leave_alone',
348
-            WEEK_IN_SECONDS
349
-        );
350
-
351
-
352
-        /**
353
-         * This allows code to filter the query arguments used for retrieving the transaction IDs to delete.
354
-         * Useful for plugins that want to exclude transactions matching certain query parameters.
355
-         * The query parameters should be in the format accepted by the EEM_Base model queries.
356
-         */
357
-        $ids_query = apply_filters(
358
-            'FHEE__EEM_Transaction__delete_junk_transactions__initial_query_args',
359
-            array(
360
-                0 => array(
361
-                    'STS_ID'        => EEM_Transaction::failed_status_code,
362
-                    'Payment.PAY_ID' => array( 'IS NULL' ),
363
-                    'TXN_timestamp' => array('<', time() - $time_to_leave_alone)
364
-                )
365
-            ),
366
-            $time_to_leave_alone
367
-        );
368
-
369
-
370
-        /**
371
-         * This filter is for when code needs to filter the list of transaction ids that represent transactions
372
-         * about to be deleted based on some other criteria that isn't easily done via the query args filter.
373
-         */
374
-        $txn_ids = apply_filters(
375
-            'FHEE__EEM_Transaction__delete_junk_transactions__transaction_ids_to_delete',
376
-            EEM_Transaction::instance()->get_col($ids_query, 'TXN_ID'),
377
-            $time_to_leave_alone
378
-        );
379
-        // now that we have the ids to delete
380
-        if (! empty($txn_ids) && is_array($txn_ids)) {
381
-            // first, make sure these TXN's are removed the "ee_locked_transactions" array
382
-            EEM_Transaction::unset_locked_transactions($txn_ids);
383
-            // let's get deletin'...
384
-            // Why no wpdb->prepare?  Because the data is trusted.
385
-            // We got the ids from the original query to get them FROM
386
-            // the db (which is sanitized) so no need to prepare them again.
387
-            $query   = '
270
+			OBJECT
271
+		);
272
+	}
273
+
274
+
275
+	/**
276
+	 * Gets the current transaction given the reg_url_link, or assumes the reg_url_link is in the
277
+	 * $_REQUEST global variable. Either way, tries to find the current transaction (through
278
+	 * the registration pointed to by reg_url_link), if not returns null
279
+	 *
280
+	 * @param string $reg_url_link
281
+	 *
282
+	 * @return EE_Transaction
283
+	 */
284
+	public function get_transaction_from_reg_url_link($reg_url_link = '')
285
+	{
286
+		return $this->get_one(array(
287
+			array(
288
+				'Registration.REG_url_link' => ! empty($reg_url_link) ? $reg_url_link : EE_Registry::instance()->REQ->get(
289
+					'e_reg_url_link',
290
+					''
291
+				)
292
+			)
293
+		));
294
+	}
295
+
296
+
297
+	/**
298
+	 * Updates the provided EE_Transaction with all the applicable payments
299
+	 * (or fetch the EE_Transaction from its ID)
300
+	 *
301
+	 * @deprecated
302
+	 *
303
+	 * @param EE_Transaction|int $transaction_obj_or_id
304
+	 * @param boolean            $save_txn whether or not to save the transaction during this function call
305
+	 *
306
+	 * @return boolean
307
+	 * @throws \EE_Error
308
+	 */
309
+	public function update_based_on_payments($transaction_obj_or_id, $save_txn = true)
310
+	{
311
+		EE_Error::doing_it_wrong(
312
+			__CLASS__ . '::' . __FUNCTION__,
313
+			sprintf(
314
+				__('This method is deprecated. Please use "%s" instead', 'event_espresso'),
315
+				'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'
316
+			),
317
+			'4.6.0'
318
+		);
319
+		/** @type EE_Transaction_Processor $transaction_processor */
320
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
321
+
322
+		return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment(
323
+			$this->ensure_is_obj($transaction_obj_or_id)
324
+		);
325
+	}
326
+
327
+	/**
328
+	 * Deletes "junk" transactions that were probably added by bots. There might be TONS
329
+	 * of these, so we are very careful to NOT select (which the models do even when deleting),
330
+	 * and so we only use wpdb directly and only do minimal joins.
331
+	 * Transactions are considered "junk" if they're failed for longer than a week.
332
+	 * Also, there is an extra check for payments related to the transaction, because if a transaction has a payment on
333
+	 * it, it's probably not junk (regardless of what status it has).
334
+	 * The downside to this approach is that is addons are listening for object deletions
335
+	 * on EEM_Base::delete() they won't be notified of this.  However, there is an action that plugins can hook into
336
+	 * to catch these types of deletions.
337
+	 *
338
+	 * @global WPDB $wpdb
339
+	 * @return mixed
340
+	 */
341
+	public function delete_junk_transactions()
342
+	{
343
+		/** @type WPDB $wpdb */
344
+		global $wpdb;
345
+		$deleted             = false;
346
+		$time_to_leave_alone = apply_filters(
347
+			'FHEE__EEM_Transaction__delete_junk_transactions__time_to_leave_alone',
348
+			WEEK_IN_SECONDS
349
+		);
350
+
351
+
352
+		/**
353
+		 * This allows code to filter the query arguments used for retrieving the transaction IDs to delete.
354
+		 * Useful for plugins that want to exclude transactions matching certain query parameters.
355
+		 * The query parameters should be in the format accepted by the EEM_Base model queries.
356
+		 */
357
+		$ids_query = apply_filters(
358
+			'FHEE__EEM_Transaction__delete_junk_transactions__initial_query_args',
359
+			array(
360
+				0 => array(
361
+					'STS_ID'        => EEM_Transaction::failed_status_code,
362
+					'Payment.PAY_ID' => array( 'IS NULL' ),
363
+					'TXN_timestamp' => array('<', time() - $time_to_leave_alone)
364
+				)
365
+			),
366
+			$time_to_leave_alone
367
+		);
368
+
369
+
370
+		/**
371
+		 * This filter is for when code needs to filter the list of transaction ids that represent transactions
372
+		 * about to be deleted based on some other criteria that isn't easily done via the query args filter.
373
+		 */
374
+		$txn_ids = apply_filters(
375
+			'FHEE__EEM_Transaction__delete_junk_transactions__transaction_ids_to_delete',
376
+			EEM_Transaction::instance()->get_col($ids_query, 'TXN_ID'),
377
+			$time_to_leave_alone
378
+		);
379
+		// now that we have the ids to delete
380
+		if (! empty($txn_ids) && is_array($txn_ids)) {
381
+			// first, make sure these TXN's are removed the "ee_locked_transactions" array
382
+			EEM_Transaction::unset_locked_transactions($txn_ids);
383
+			// let's get deletin'...
384
+			// Why no wpdb->prepare?  Because the data is trusted.
385
+			// We got the ids from the original query to get them FROM
386
+			// the db (which is sanitized) so no need to prepare them again.
387
+			$query   = '
388 388
 				DELETE
389 389
 				FROM ' . $this->table() . '
390 390
 				WHERE
391 391
 					TXN_ID IN ( ' . implode(",", $txn_ids) . ')';
392
-            $deleted = $wpdb->query($query);
393
-        }
394
-        if ($deleted) {
395
-            /**
396
-             * Allows code to do something after the transactions have been deleted.
397
-             */
398
-            do_action('AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids);
399
-        }
400
-
401
-        return $deleted;
402
-    }
403
-
404
-
405
-    /**
406
-     * @param array $transaction_IDs
407
-     *
408
-     * @return bool
409
-     */
410
-    public static function unset_locked_transactions(array $transaction_IDs)
411
-    {
412
-        $locked_transactions = get_option('ee_locked_transactions', array());
413
-        $update              = false;
414
-        foreach ($transaction_IDs as $TXN_ID) {
415
-            if (isset($locked_transactions[ $TXN_ID ])) {
416
-                unset($locked_transactions[ $TXN_ID ]);
417
-                $update = true;
418
-            }
419
-        }
420
-        if ($update) {
421
-            update_option('ee_locked_transactions', $locked_transactions);
422
-        }
423
-
424
-        return $update;
425
-    }
426
-
427
-
428
-
429
-    /**
430
-     * returns an array of EE_Transaction objects whose timestamp is greater than
431
-     * the current time minus the session lifespan, which defaults to 60 minutes
432
-     *
433
-     * @return EE_Base_Class[]|EE_Transaction[]
434
-     * @throws EE_Error
435
-     * @throws InvalidArgumentException
436
-     * @throws InvalidDataTypeException
437
-     * @throws InvalidInterfaceException
438
-     */
439
-    public function get_transactions_in_progress()
440
-    {
441
-        return $this->_get_transactions_in_progress();
442
-    }
443
-
444
-
445
-
446
-    /**
447
-     * returns an array of EE_Transaction objects whose timestamp is less than
448
-     * the current time minus the session lifespan, which defaults to 60 minutes
449
-     *
450
-     * @return EE_Base_Class[]|EE_Transaction[]
451
-     * @throws EE_Error
452
-     * @throws InvalidArgumentException
453
-     * @throws InvalidDataTypeException
454
-     * @throws InvalidInterfaceException
455
-     */
456
-    public function get_transactions_not_in_progress()
457
-    {
458
-        return $this->_get_transactions_in_progress('<=');
459
-    }
460
-
461
-
462
-
463
-    /**
464
-     * @param string $comparison
465
-     * @return EE_Base_Class[]|EE_Transaction[]
466
-     * @throws EE_Error
467
-     * @throws InvalidArgumentException
468
-     * @throws InvalidDataTypeException
469
-     * @throws InvalidInterfaceException
470
-     */
471
-    private function _get_transactions_in_progress($comparison = '>=')
472
-    {
473
-        $comparison = $comparison === '>=' || $comparison === '<='
474
-            ? $comparison
475
-            : '>=';
476
-        /** @var EventEspresso\core\domain\values\session\SessionLifespan $session_lifespan */
477
-        $session_lifespan = LoaderFactory::getLoader()->getShared(
478
-            'EventEspresso\core\domain\values\session\SessionLifespan'
479
-        );
480
-        return $this->get_all(
481
-            array(
482
-                array(
483
-                    'TXN_timestamp' => array(
484
-                        $comparison,
485
-                        $session_lifespan->expiration()
486
-                    ),
487
-                    'STS_ID' => array(
488
-                        '!=',
489
-                        EEM_Transaction::complete_status_code
490
-                    ),
491
-                )
492
-            )
493
-        );
494
-    }
392
+			$deleted = $wpdb->query($query);
393
+		}
394
+		if ($deleted) {
395
+			/**
396
+			 * Allows code to do something after the transactions have been deleted.
397
+			 */
398
+			do_action('AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids);
399
+		}
400
+
401
+		return $deleted;
402
+	}
403
+
404
+
405
+	/**
406
+	 * @param array $transaction_IDs
407
+	 *
408
+	 * @return bool
409
+	 */
410
+	public static function unset_locked_transactions(array $transaction_IDs)
411
+	{
412
+		$locked_transactions = get_option('ee_locked_transactions', array());
413
+		$update              = false;
414
+		foreach ($transaction_IDs as $TXN_ID) {
415
+			if (isset($locked_transactions[ $TXN_ID ])) {
416
+				unset($locked_transactions[ $TXN_ID ]);
417
+				$update = true;
418
+			}
419
+		}
420
+		if ($update) {
421
+			update_option('ee_locked_transactions', $locked_transactions);
422
+		}
423
+
424
+		return $update;
425
+	}
426
+
427
+
428
+
429
+	/**
430
+	 * returns an array of EE_Transaction objects whose timestamp is greater than
431
+	 * the current time minus the session lifespan, which defaults to 60 minutes
432
+	 *
433
+	 * @return EE_Base_Class[]|EE_Transaction[]
434
+	 * @throws EE_Error
435
+	 * @throws InvalidArgumentException
436
+	 * @throws InvalidDataTypeException
437
+	 * @throws InvalidInterfaceException
438
+	 */
439
+	public function get_transactions_in_progress()
440
+	{
441
+		return $this->_get_transactions_in_progress();
442
+	}
443
+
444
+
445
+
446
+	/**
447
+	 * returns an array of EE_Transaction objects whose timestamp is less than
448
+	 * the current time minus the session lifespan, which defaults to 60 minutes
449
+	 *
450
+	 * @return EE_Base_Class[]|EE_Transaction[]
451
+	 * @throws EE_Error
452
+	 * @throws InvalidArgumentException
453
+	 * @throws InvalidDataTypeException
454
+	 * @throws InvalidInterfaceException
455
+	 */
456
+	public function get_transactions_not_in_progress()
457
+	{
458
+		return $this->_get_transactions_in_progress('<=');
459
+	}
460
+
461
+
462
+
463
+	/**
464
+	 * @param string $comparison
465
+	 * @return EE_Base_Class[]|EE_Transaction[]
466
+	 * @throws EE_Error
467
+	 * @throws InvalidArgumentException
468
+	 * @throws InvalidDataTypeException
469
+	 * @throws InvalidInterfaceException
470
+	 */
471
+	private function _get_transactions_in_progress($comparison = '>=')
472
+	{
473
+		$comparison = $comparison === '>=' || $comparison === '<='
474
+			? $comparison
475
+			: '>=';
476
+		/** @var EventEspresso\core\domain\values\session\SessionLifespan $session_lifespan */
477
+		$session_lifespan = LoaderFactory::getLoader()->getShared(
478
+			'EventEspresso\core\domain\values\session\SessionLifespan'
479
+		);
480
+		return $this->get_all(
481
+			array(
482
+				array(
483
+					'TXN_timestamp' => array(
484
+						$comparison,
485
+						$session_lifespan->expiration()
486
+					),
487
+					'STS_ID' => array(
488
+						'!=',
489
+						EEM_Transaction::complete_status_code
490
+					),
491
+				)
492
+			)
493
+		);
494
+	}
495 495
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
                 ),
141 141
             )
142 142
         );
143
-        $this->_model_relations        = array(
143
+        $this->_model_relations = array(
144 144
             'Registration'   => new EE_Has_Many_Relation(),
145 145
             'Payment'        => new EE_Has_Many_Relation(),
146 146
             'Status'         => new EE_Belongs_To_Relation(),
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
             ),
206 206
             OBJECT,
207 207
             array(
208
-                'txnDate' => array('DATE(' . $query_interval . ')', '%s'),
208
+                'txnDate' => array('DATE('.$query_interval.')', '%s'),
209 209
                 'revenue' => array('SUM(TransactionTable.TXN_paid)', '%d')
210 210
             )
211 211
         );
@@ -225,17 +225,17 @@  discard block
 block discarded – undo
225 225
     public function get_revenue_per_event_report($period = '-1 month')
226 226
     {
227 227
         global $wpdb;
228
-        $transaction_table          = $wpdb->prefix . 'esp_transaction';
229
-        $registration_table         = $wpdb->prefix . 'esp_registration';
230
-        $registration_payment_table = $wpdb->prefix . 'esp_registration_payment';
228
+        $transaction_table          = $wpdb->prefix.'esp_transaction';
229
+        $registration_table         = $wpdb->prefix.'esp_registration';
230
+        $registration_payment_table = $wpdb->prefix.'esp_registration_payment';
231 231
         $event_table                = $wpdb->posts;
232
-        $payment_table              = $wpdb->prefix . 'esp_payment';
232
+        $payment_table              = $wpdb->prefix.'esp_payment';
233 233
         $sql_date                   = date('Y-m-d H:i:s', strtotime($period));
234 234
         $approved_payment_status    = EEM_Payment::status_id_approved;
235 235
         $extra_event_on_join        = '';
236 236
         // exclude events not authored by user if permissions in effect
237
-        if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) {
238
-            $extra_event_on_join = ' AND Event.post_author = ' . get_current_user_id();
237
+        if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) {
238
+            $extra_event_on_join = ' AND Event.post_author = '.get_current_user_id();
239 239
         }
240 240
 
241 241
         return $wpdb->get_results(
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
     public function update_based_on_payments($transaction_obj_or_id, $save_txn = true)
310 310
     {
311 311
         EE_Error::doing_it_wrong(
312
-            __CLASS__ . '::' . __FUNCTION__,
312
+            __CLASS__.'::'.__FUNCTION__,
313 313
             sprintf(
314 314
                 __('This method is deprecated. Please use "%s" instead', 'event_espresso'),
315 315
                 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
             array(
360 360
                 0 => array(
361 361
                     'STS_ID'        => EEM_Transaction::failed_status_code,
362
-                    'Payment.PAY_ID' => array( 'IS NULL' ),
362
+                    'Payment.PAY_ID' => array('IS NULL'),
363 363
                     'TXN_timestamp' => array('<', time() - $time_to_leave_alone)
364 364
                 )
365 365
             ),
@@ -377,18 +377,18 @@  discard block
 block discarded – undo
377 377
             $time_to_leave_alone
378 378
         );
379 379
         // now that we have the ids to delete
380
-        if (! empty($txn_ids) && is_array($txn_ids)) {
380
+        if ( ! empty($txn_ids) && is_array($txn_ids)) {
381 381
             // first, make sure these TXN's are removed the "ee_locked_transactions" array
382 382
             EEM_Transaction::unset_locked_transactions($txn_ids);
383 383
             // let's get deletin'...
384 384
             // Why no wpdb->prepare?  Because the data is trusted.
385 385
             // We got the ids from the original query to get them FROM
386 386
             // the db (which is sanitized) so no need to prepare them again.
387
-            $query   = '
387
+            $query = '
388 388
 				DELETE
389
-				FROM ' . $this->table() . '
389
+				FROM ' . $this->table().'
390 390
 				WHERE
391
-					TXN_ID IN ( ' . implode(",", $txn_ids) . ')';
391
+					TXN_ID IN ( ' . implode(",", $txn_ids).')';
392 392
             $deleted = $wpdb->query($query);
393 393
         }
394 394
         if ($deleted) {
@@ -412,8 +412,8 @@  discard block
 block discarded – undo
412 412
         $locked_transactions = get_option('ee_locked_transactions', array());
413 413
         $update              = false;
414 414
         foreach ($transaction_IDs as $TXN_ID) {
415
-            if (isset($locked_transactions[ $TXN_ID ])) {
416
-                unset($locked_transactions[ $TXN_ID ]);
415
+            if (isset($locked_transactions[$TXN_ID])) {
416
+                unset($locked_transactions[$TXN_ID]);
417 417
                 $update = true;
418 418
             }
419 419
         }
Please login to merge, or discard this patch.
core/middleware/EE_Detect_Login.core.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -13,27 +13,27 @@
 block discarded – undo
13 13
 {
14 14
 
15 15
 
16
-    /**
17
-     * @deprecated
18
-     * @param    EE_Request  $request
19
-     * @param    EE_Response $response
20
-     * @return    EE_Response
21
-     */
22
-    public function handle_request(EE_Request $request, EE_Response $response)
23
-    {
24
-        EE_Error::doing_it_wrong(
25
-            __METHOD__,
26
-            sprintf(
27
-                esc_html__(
28
-                    'This class is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace',
29
-                    'event_espresso'
30
-                ),
31
-                'EventEspresso\core\services\request\middleware\DetectLogin',
32
-                '\core\services\request',
33
-                'EventEspresso\core\services\request'
34
-            ),
35
-            '4.9.52'
36
-        );
37
-        return $response;
38
-    }
16
+	/**
17
+	 * @deprecated
18
+	 * @param    EE_Request  $request
19
+	 * @param    EE_Response $response
20
+	 * @return    EE_Response
21
+	 */
22
+	public function handle_request(EE_Request $request, EE_Response $response)
23
+	{
24
+		EE_Error::doing_it_wrong(
25
+			__METHOD__,
26
+			sprintf(
27
+				esc_html__(
28
+					'This class is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace',
29
+					'event_espresso'
30
+				),
31
+				'EventEspresso\core\services\request\middleware\DetectLogin',
32
+				'\core\services\request',
33
+				'EventEspresso\core\services\request'
34
+			),
35
+			'4.9.52'
36
+		);
37
+		return $response;
38
+	}
39 39
 }
Please login to merge, or discard this patch.
core/middleware/EE_Recommended_Versions.core.php 1 patch
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -17,75 +17,75 @@
 block discarded – undo
17 17
 {
18 18
 
19 19
 
20
-    /**
21
-     * @deprecated
22
-     * @param EE_Request  $request
23
-     * @param EE_Response $response
24
-     * @return EE_Response
25
-     */
26
-    public function handle_request(EE_Request $request, EE_Response $response)
27
-    {
28
-        EE_Error::doing_it_wrong(
29
-            __METHOD__,
30
-            sprintf(
31
-                esc_html__(
32
-                    'This class is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace',
33
-                    'event_espresso'
34
-                ),
35
-                'EventEspresso\core\services\request\middleware\RecommendedVersions',
36
-                '\core\services\request',
37
-                'EventEspresso\core\services\request'
38
-            ),
39
-            '4.9.52'
40
-        );
41
-        return $response;
42
-    }
20
+	/**
21
+	 * @deprecated
22
+	 * @param EE_Request  $request
23
+	 * @param EE_Response $response
24
+	 * @return EE_Response
25
+	 */
26
+	public function handle_request(EE_Request $request, EE_Response $response)
27
+	{
28
+		EE_Error::doing_it_wrong(
29
+			__METHOD__,
30
+			sprintf(
31
+				esc_html__(
32
+					'This class is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace',
33
+					'event_espresso'
34
+				),
35
+				'EventEspresso\core\services\request\middleware\RecommendedVersions',
36
+				'\core\services\request',
37
+				'EventEspresso\core\services\request'
38
+			),
39
+			'4.9.52'
40
+		);
41
+		return $response;
42
+	}
43 43
 
44 44
 
45
-    /**
46
-     * @deprecated
47
-     * @param string $version_to_check
48
-     * @param string $operator
49
-     * @return bool
50
-     */
51
-    public static function check_wp_version($version_to_check = EE_MIN_WP_VER_REQUIRED, $operator = '>=')
52
-    {
53
-        EE_Error::doing_it_wrong(
54
-            __METHOD__,
55
-            sprintf(
56
-                esc_html__(
57
-                    'This method is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace',
58
-                    'event_espresso'
59
-                ),
60
-                'EventEspresso\core\services\request\middleware\RecommendedVersions::compareWordPressVersion()',
61
-                '\core\services\request',
62
-                'EventEspresso\core\services\request'
63
-            ),
64
-            '4.9.52',
65
-            '5.0.0'
66
-        );
67
-        return RecommendedVersions::compareWordPressVersion($version_to_check, $operator);
68
-    }
45
+	/**
46
+	 * @deprecated
47
+	 * @param string $version_to_check
48
+	 * @param string $operator
49
+	 * @return bool
50
+	 */
51
+	public static function check_wp_version($version_to_check = EE_MIN_WP_VER_REQUIRED, $operator = '>=')
52
+	{
53
+		EE_Error::doing_it_wrong(
54
+			__METHOD__,
55
+			sprintf(
56
+				esc_html__(
57
+					'This method is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace',
58
+					'event_espresso'
59
+				),
60
+				'EventEspresso\core\services\request\middleware\RecommendedVersions::compareWordPressVersion()',
61
+				'\core\services\request',
62
+				'EventEspresso\core\services\request'
63
+			),
64
+			'4.9.52',
65
+			'5.0.0'
66
+		);
67
+		return RecommendedVersions::compareWordPressVersion($version_to_check, $operator);
68
+	}
69 69
 
70 70
 
71
-    /**
72
-     * @deprecated
73
-     * @return void
74
-     */
75
-    public function minimum_wp_version_error()
76
-    {
77
-        EE_Error::doing_it_wrong(
78
-            __METHOD__,
79
-            sprintf(
80
-                esc_html__(
81
-                    'This method is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace',
82
-                    'event_espresso'
83
-                ),
84
-                'EventEspresso\core\services\request\middleware\RecommendedVersions::minimumWpVersionError()',
85
-                '\core\services\request',
86
-                'EventEspresso\core\services\request'
87
-            ),
88
-            '4.9.52'
89
-        );
90
-    }
71
+	/**
72
+	 * @deprecated
73
+	 * @return void
74
+	 */
75
+	public function minimum_wp_version_error()
76
+	{
77
+		EE_Error::doing_it_wrong(
78
+			__METHOD__,
79
+			sprintf(
80
+				esc_html__(
81
+					'This method is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace',
82
+					'event_espresso'
83
+				),
84
+				'EventEspresso\core\services\request\middleware\RecommendedVersions::minimumWpVersionError()',
85
+				'\core\services\request',
86
+				'EventEspresso\core\services\request'
87
+			),
88
+			'4.9.52'
89
+		);
90
+	}
91 91
 }
Please login to merge, or discard this patch.
core/middleware/EE_Middleware.core.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -20,27 +20,27 @@
 block discarded – undo
20 20
 abstract class EE_Middleware implements EEI_Request_Decorator
21 21
 {
22 22
 
23
-    /**
24
-     * @deprecated
25
-     * @param    EE_Request  $request
26
-     * @param    EE_Response $response
27
-     * @return    EE_Response
28
-     */
29
-    protected function process_request_stack(EE_Request $request, EE_Response $response)
30
-    {
31
-        EE_Error::doing_it_wrong(
32
-            __METHOD__,
33
-            sprintf(
34
-                esc_html__(
35
-                    'This class is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace',
36
-                    'event_espresso'
37
-                ),
38
-                'EventEspresso\core\services\request\middleware\Middleware',
39
-                '\core\services\request',
40
-                'EventEspresso\core\services\request'
41
-            ),
42
-            '4.9.52'
43
-        );
44
-        return $response;
45
-    }
23
+	/**
24
+	 * @deprecated
25
+	 * @param    EE_Request  $request
26
+	 * @param    EE_Response $response
27
+	 * @return    EE_Response
28
+	 */
29
+	protected function process_request_stack(EE_Request $request, EE_Response $response)
30
+	{
31
+		EE_Error::doing_it_wrong(
32
+			__METHOD__,
33
+			sprintf(
34
+				esc_html__(
35
+					'This class is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace',
36
+					'event_espresso'
37
+				),
38
+				'EventEspresso\core\services\request\middleware\Middleware',
39
+				'\core\services\request',
40
+				'EventEspresso\core\services\request'
41
+			),
42
+			'4.9.52'
43
+		);
44
+		return $response;
45
+	}
46 46
 }
Please login to merge, or discard this patch.
core/middleware/EE_Alpha_Banner_Warning.core.php 1 patch
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -14,87 +14,87 @@
 block discarded – undo
14 14
 {
15 15
 
16 16
 
17
-    /**
18
-     * @deprecated 4.9.53
19
-     * @param    EE_Request  $request
20
-     * @param    EE_Response $response
21
-     * @return    EE_Response
22
-     */
23
-    public function handle_request(EE_Request $request, EE_Response $response)
24
-    {
25
-        $this->_request = $request;
26
-        $this->_response = $response;
27
-        $this->display_alpha_banner_warning();
28
-        $this->_response = $this->process_request_stack($this->_request, $this->_response);
29
-        return $this->_response;
30
-    }
17
+	/**
18
+	 * @deprecated 4.9.53
19
+	 * @param    EE_Request  $request
20
+	 * @param    EE_Response $response
21
+	 * @return    EE_Response
22
+	 */
23
+	public function handle_request(EE_Request $request, EE_Response $response)
24
+	{
25
+		$this->_request = $request;
26
+		$this->_response = $response;
27
+		$this->display_alpha_banner_warning();
28
+		$this->_response = $this->process_request_stack($this->_request, $this->_response);
29
+		return $this->_response;
30
+	}
31 31
 
32 32
 
33
-    /**
34
-     * @deprecated
35
-     * @return    string
36
-     */
37
-    public function display_alpha_banner_warning()
38
-    {
39
-        EE_Error::doing_it_wrong(
40
-            __METHOD__,
41
-            sprintf(
42
-                esc_html__(
43
-                    'This method is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace',
44
-                    'event_espresso'
45
-                ),
46
-                'EventEspresso\core\services\request\middleware\PreProductionVersionWarning::displayPreProductionVersionWarning()',
47
-                '\core\services\request',
48
-                'EventEspresso\core\services\request'
49
-            ),
50
-            '4.9.52',
51
-            '4.10.0'
52
-        );
53
-    }
33
+	/**
34
+	 * @deprecated
35
+	 * @return    string
36
+	 */
37
+	public function display_alpha_banner_warning()
38
+	{
39
+		EE_Error::doing_it_wrong(
40
+			__METHOD__,
41
+			sprintf(
42
+				esc_html__(
43
+					'This method is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace',
44
+					'event_espresso'
45
+				),
46
+				'EventEspresso\core\services\request\middleware\PreProductionVersionWarning::displayPreProductionVersionWarning()',
47
+				'\core\services\request',
48
+				'EventEspresso\core\services\request'
49
+			),
50
+			'4.9.52',
51
+			'4.10.0'
52
+		);
53
+	}
54 54
 
55 55
 
56
-    /**
57
-     * @deprecated
58
-     * @return void
59
-     */
60
-    public function alpha_banner_admin_notice()
61
-    {
62
-        EE_Error::doing_it_wrong(
63
-            __METHOD__,
64
-            sprintf(
65
-                esc_html__(
66
-                    'This method is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace',
67
-                    'event_espresso'
68
-                ),
69
-                'EventEspresso\core\services\request\middleware\PreProductionVersionWarning::preProductionVersionAdminNotice()',
70
-                '\core\services\request',
71
-                'EventEspresso\core\services\request'
72
-            ),
73
-            '4.9.52',
74
-            '4.10.0'
75
-        );
76
-    }
56
+	/**
57
+	 * @deprecated
58
+	 * @return void
59
+	 */
60
+	public function alpha_banner_admin_notice()
61
+	{
62
+		EE_Error::doing_it_wrong(
63
+			__METHOD__,
64
+			sprintf(
65
+				esc_html__(
66
+					'This method is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace',
67
+					'event_espresso'
68
+				),
69
+				'EventEspresso\core\services\request\middleware\PreProductionVersionWarning::preProductionVersionAdminNotice()',
70
+				'\core\services\request',
71
+				'EventEspresso\core\services\request'
72
+			),
73
+			'4.9.52',
74
+			'4.10.0'
75
+		);
76
+	}
77 77
 
78 78
 
79
-    /**
80
-     * @deprecated
81
-     * @return void
82
-     */
83
-    public function alpha_banner_warning_notice()
84
-    {
85
-        EE_Error::doing_it_wrong(
86
-            __METHOD__,
87
-            sprintf(
88
-                esc_html__(
89
-                    'This method is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace',
90
-                    'event_espresso'
91
-                ),
92
-                'EventEspresso\core\services\request\middleware\PreProductionVersionWarning::preProductionVersionWarningNotice()',
93
-                '\core\services\request',
94
-                'EventEspresso\core\services\request'
95
-            ),
96
-            '4.9.52',
97
-            '4.10.0'
98
-        );
99
-    }
79
+	/**
80
+	 * @deprecated
81
+	 * @return void
82
+	 */
83
+	public function alpha_banner_warning_notice()
84
+	{
85
+		EE_Error::doing_it_wrong(
86
+			__METHOD__,
87
+			sprintf(
88
+				esc_html__(
89
+					'This method is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace',
90
+					'event_espresso'
91
+				),
92
+				'EventEspresso\core\services\request\middleware\PreProductionVersionWarning::preProductionVersionWarningNotice()',
93
+				'\core\services\request',
94
+				'EventEspresso\core\services\request'
95
+			),
96
+			'4.9.52',
97
+			'4.10.0'
98
+		);
99
+	}
100 100
 }
Please login to merge, or discard this patch.