Completed
Branch DECAF-4.7 (a62460)
by
unknown
357:16 queued 343:55
created
core/db_models/strategies/EE_Restriction_Generator_WP_User.strategy.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 /**
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  * @author				Mike Nelson
16 16
  *
17 17
  */
18
-class EE_Restriction_Generator_WP_User extends EE_Restriction_Generator_Base{
18
+class EE_Restriction_Generator_WP_User extends EE_Restriction_Generator_Base {
19 19
 
20 20
 	/**
21 21
 	 * @return \EE_Default_Where_Conditions
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 		return array(
26 26
 			//if they can't access users, they can still access themselves
27
-			EE_Restriction_Generator_Base::get_cap_name( $this->model(), $this->action() ) => new EE_Default_Where_Conditions( array(
27
+			EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) => new EE_Default_Where_Conditions(array(
28 28
 				EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder
29 29
 			)),
30 30
 
Please login to merge, or discard this patch.
core/db_models/strategies/EE_Return_None_Where_Conditions.strategy.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 /**
@@ -14,12 +14,12 @@  discard block
 block discarded – undo
14 14
  *
15 15
  */
16 16
 class EE_Return_None_Where_Conditions extends EE_Default_Where_Conditions {
17
-	protected function _get_default_where_conditions(){
18
-		if( $this->_model->has_primary_key_field() ) {
19
-			return array( $this->_model->primary_key_name() => array('<', 0 ) );
20
-		}else{
21
-			$fk_field = $this->_model->get_a_field_of_type( 'EE_Foreign_Key_Field_Base' );
22
-			return array( 'AND*impossible' => array( $fk_field->get_name() => array('IS_NULL'), $fk_field->get_name() => 'IS_NOT_NULL' ) );
17
+	protected function _get_default_where_conditions() {
18
+		if ($this->_model->has_primary_key_field()) {
19
+			return array($this->_model->primary_key_name() => array('<', 0));
20
+		} else {
21
+			$fk_field = $this->_model->get_a_field_of_type('EE_Foreign_Key_Field_Base');
22
+			return array('AND*impossible' => array($fk_field->get_name() => array('IS_NULL'), $fk_field->get_name() => 'IS_NOT_NULL'));
23 23
 		}
24 24
 	}
25 25
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
 		//so in case teh IPN is arriving later, let's try to process an IPN!
91 91
 		if($_SERVER['REQUEST_METHOD'] == 'POST'){
92 92
 			return $this->handle_ipn($_POST, $transaction );
93
-		}else{
93
+		} else{
94 94
 			return parent::finalize_payment_for( $transaction );
95 95
 		}
96 96
 	}
Please login to merge, or discard this patch.
core/db_models/strategies/EE_Soft_Delete_Where_Conditions.strategy.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 /*
4 4
  * Strategy specifically for adding where conditions specific to CPT models.
5 5
  */
6
-class EE_Soft_Delete_Where_Conditions extends EE_Default_Where_Conditions{
6
+class EE_Soft_Delete_Where_Conditions extends EE_Default_Where_Conditions {
7 7
 	/**
8 8
 	 * Strategy for setting default soft delete where conditions. This strategy will find
9 9
 	 * the field of type 'EE_Trashed_Flag_Field', and add a condition that it be FALSE on all queries involving
@@ -12,12 +12,12 @@  discard block
 block discarded – undo
12 12
 	 * Eg,
13 13
 	 *
14 14
 	 */
15
-	function __construct(){}
15
+	function __construct() {}
16 16
 	/**
17 17
 	 * Gets the where default where conditions for a custom post type model
18 18
 	 * @return array like EEM_Base::get_all's $query_params's index [0] (where conditions)
19 19
 	 */
20
-	protected function _get_default_where_conditions(){
20
+	protected function _get_default_where_conditions() {
21 21
 		$trashed_field_name = $this->deleted_field_name();
22 22
 		return array(
23 23
 			$trashed_field_name => false
@@ -29,12 +29,12 @@  discard block
 block discarded – undo
29 29
 	 * @return string
30 30
 	 * @throws EE_Error
31 31
 	 */
32
-	private function deleted_field_name(){
32
+	private function deleted_field_name() {
33 33
 		$field = $this->_model->get_a_field_of_type('EE_Trashed_Flag_Field');
34
-		if($field){
34
+		if ($field) {
35 35
 			return $field->get_name();
36
-		}else{
37
-			throw new EE_Error(sprintf(__('We are trying to find the deleted flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?','event_espresso'),get_class($this),get_class($this)));
36
+		} else {
37
+			throw new EE_Error(sprintf(__('We are trying to find the deleted flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?', 'event_espresso'), get_class($this), get_class($this)));
38 38
 		}
39 39
 	}
40 40
 }
41 41
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
 		//so in case teh IPN is arriving later, let's try to process an IPN!
91 91
 		if($_SERVER['REQUEST_METHOD'] == 'POST'){
92 92
 			return $this->handle_ipn($_POST, $transaction );
93
-		}else{
93
+		} else{
94 94
 			return parent::finalize_payment_for( $transaction );
95 95
 		}
96 96
 	}
Please login to merge, or discard this patch.
core/helpers/EEH_Array.helper.php 2 patches
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,10 +61,10 @@
 block discarded – undo
61 61
 			$first_item = reset($arr);
62 62
 			if(is_array($first_item)){
63 63
 				return true;//yep, there's at least 2 levels to this array
64
-			}else{
64
+			} else{
65 65
 				return false;//nope, only 1 level
66 66
 			}
67
-		}else{
67
+		} else{
68 68
 			return false;//its not an array at all!
69 69
 		}
70 70
 	}
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('NO direct script access allowed'); }
3 3
 
4
-require_once( EE_HELPERS . 'EEH_Base.helper.php' );
4
+require_once(EE_HELPERS.'EEH_Base.helper.php');
5 5
 
6 6
 /**
7 7
  * EE_Array
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 	 * @param  array $array2 an array of objects
27 27
 	 * @return array         an array of objects found in array 1 that aren't found in array 2.
28 28
 	 */
29
-	public static function object_array_diff( $array1, $array2 ) {
30
-		return array_udiff( $array1, $array2, array('self', '_compare_objects' ));
29
+	public static function object_array_diff($array1, $array2) {
30
+		return array_udiff($array1, $array2, array('self', '_compare_objects'));
31 31
 	}
32 32
 
33 33
 	/**
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 * @param array $arr
36 36
 	 * @return boolean
37 37
 	 */
38
-	public static function is_associative_array($arr){
38
+	public static function is_associative_array($arr) {
39 39
 		return  array_keys($arr) !== range(0, count($arr) - 1);
40 40
 	}
41 41
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 * @param array $arr
46 46
 	 * @return mixed what ever is in the array
47 47
 	 */
48
-	public static function get_one_item_from_array($arr){
48
+	public static function get_one_item_from_array($arr) {
49 49
 		$item = end($arr);
50 50
 		reset($arr);
51 51
 		return $item;
@@ -56,16 +56,16 @@  discard block
 block discarded – undo
56 56
 	 * @param mixed $arr
57 57
 	 * @return boolean
58 58
 	 */
59
-	public static function is_multi_dimensional_array($arr){
60
-		if(is_array($arr)){
59
+	public static function is_multi_dimensional_array($arr) {
60
+		if (is_array($arr)) {
61 61
 			$first_item = reset($arr);
62
-			if(is_array($first_item)){
63
-				return true;//yep, there's at least 2 levels to this array
64
-			}else{
65
-				return false;//nope, only 1 level
62
+			if (is_array($first_item)) {
63
+				return true; //yep, there's at least 2 levels to this array
64
+			} else {
65
+				return false; //nope, only 1 level
66 66
 			}
67
-		}else{
68
-			return false;//its not an array at all!
67
+		} else {
68
+			return false; //its not an array at all!
69 69
 		}
70 70
 	}
71 71
 
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
 	 * @param mixed $default
77 77
 	 * @return mixed
78 78
 	 */
79
-	public static function is_set( $arr, $index, $default ) {
80
-		return isset( $arr[ $index ] ) ? $arr[ $index ] : $default;
79
+	public static function is_set($arr, $index, $default) {
80
+		return isset($arr[$index]) ? $arr[$index] : $default;
81 81
 	}
82 82
 
83 83
 } //end EEH_Template class
84 84
\ No newline at end of file
Please login to merge, or discard this patch.
core/helpers/EEH_Autoloader.helper.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@
 block discarded – undo
23 23
 	private static $_instance = NULL;
24 24
 
25 25
 	/**
26
-	* 	$_autoloaders
27
-	* 	@var array $_autoloaders
28
-	* 	@access 	private
29
-	*/
26
+	 * 	$_autoloaders
27
+	 * 	@var array $_autoloaders
28
+	 * 	@access 	private
29
+	 */
30 30
 	private static $_autoloaders;
31 31
 
32 32
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 */
39 39
 	public static function instance() {
40 40
 		// check if class object is instantiated, and instantiated properly
41
-		if ( ! self::$_instance instanceof  EEH_Autoloader ) {
41
+		if ( ! self::$_instance instanceof  EEH_Autoloader) {
42 42
 			self::$_instance = new self();
43 43
 		}
44 44
 		return self::$_instance;
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	private function __construct() {
56 56
 		self::$_autoloaders = array();
57 57
 		$this->_register_custom_autoloaders();
58
-		spl_autoload_register( array( $this, 'espresso_autoloader' ));
58
+		spl_autoload_register(array($this, 'espresso_autoloader'));
59 59
 	}
60 60
 
61 61
 
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
 	 * @internal  param string $class_name - simple class name ie: session
70 70
 	 * @return 	void
71 71
 	 */
72
-	public static function espresso_autoloader( $class_name ) {
73
-		if ( isset( self::$_autoloaders[ $class_name ] ) ) {
74
-			require_once( self::$_autoloaders[ $class_name ] );
72
+	public static function espresso_autoloader($class_name) {
73
+		if (isset(self::$_autoloaders[$class_name])) {
74
+			require_once(self::$_autoloaders[$class_name]);
75 75
 		}
76 76
 	}
77 77
 
@@ -86,24 +86,24 @@  discard block
 block discarded – undo
86 86
 	 * @throws \EE_Error
87 87
 	 * @return        void
88 88
 	 */
89
-	public static function register_autoloader( $class_paths, $read_check = true ) {
90
-		$class_paths = is_array( $class_paths ) ? $class_paths : array( $class_paths );
91
-		foreach ( $class_paths as $class => $path ) {
89
+	public static function register_autoloader($class_paths, $read_check = true) {
90
+		$class_paths = is_array($class_paths) ? $class_paths : array($class_paths);
91
+		foreach ($class_paths as $class => $path) {
92 92
 			// don't give up! you gotta...
93 93
 			// get some class
94
-			if ( empty( $class )) {
95
-				throw new EE_Error ( sprintf( __( 'No Class name was specified while registering an autoloader for the following path: %s.','event_espresso' ), $path ));
94
+			if (empty($class)) {
95
+				throw new EE_Error(sprintf(__('No Class name was specified while registering an autoloader for the following path: %s.', 'event_espresso'), $path));
96 96
 			}
97 97
 			// one day you will find the path young grasshopper
98
-			if ( empty( $path )) {
99
-				throw new EE_Error ( sprintf( __( 'No path was specified while registering an autoloader for the %s class.','event_espresso' ), $class ));
98
+			if (empty($path)) {
99
+				throw new EE_Error(sprintf(__('No path was specified while registering an autoloader for the %s class.', 'event_espresso'), $class));
100 100
 			}
101 101
 			// is file readable ?
102
-			if ( $read_check && ! is_readable( $path )) {
103
-				throw new EE_Error ( sprintf( __( 'The file for the %s class could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s','event_espresso' ), $class, $path ));
102
+			if ($read_check && ! is_readable($path)) {
103
+				throw new EE_Error(sprintf(__('The file for the %s class could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso'), $class, $path));
104 104
 			}
105
-			if ( ! isset( self::$_autoloaders[ $class ] )) {
106
-				self::$_autoloaders[ $class ] = str_replace( array( '\/', '/' ), DS, $path );
105
+			if ( ! isset(self::$_autoloaders[$class])) {
106
+				self::$_autoloaders[$class] = str_replace(array('\/', '/'), DS, $path);
107 107
 			}
108 108
 		}
109 109
 	}
@@ -131,11 +131,11 @@  discard block
 block discarded – undo
131 131
 	 * 	@return void
132 132
 	 */
133 133
 	private function _register_custom_autoloaders() {
134
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CORE . 'interfaces' );
135
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CORE );
136
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_MODELS, TRUE );
137
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CLASSES );
138
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_FORM_SECTIONS, true );
134
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'interfaces');
135
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE);
136
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_MODELS, TRUE);
137
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CLASSES);
138
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_FORM_SECTIONS, true);
139 139
 	}
140 140
 
141 141
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	 * 	@return void
162 162
 	 */
163 163
 	public static function register_line_item_display_autoloaders() {
164
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(  EE_LIBRARIES . 'line_item_display' , TRUE );
164
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'line_item_display', TRUE);
165 165
 	}
166 166
 
167 167
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	 * 	@return void
175 175
 	 */
176 176
 	public static function register_line_item_filter_autoloaders() {
177
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(  EE_LIBRARIES . 'line_item_filters' , true );
177
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'line_item_filters', true);
178 178
 	}
179 179
 
180 180
 
@@ -189,31 +189,31 @@  discard block
 block discarded – undo
189 189
 	 * @param bool   $recursive
190 190
 	 * @return array
191 191
 	 */
192
-	public static function register_autoloaders_for_each_file_in_folder( $folder, $recursive = FALSE ){
192
+	public static function register_autoloaders_for_each_file_in_folder($folder, $recursive = FALSE) {
193 193
 		// make sure last char is a /
194
-		$folder .= $folder[strlen($folder)-1] != DS ? DS : '';
194
+		$folder .= $folder[strlen($folder) - 1] != DS ? DS : '';
195 195
 		$class_to_filepath_map = array();
196
-		$exclude = array( 'index' );
196
+		$exclude = array('index');
197 197
 		//get all the files in that folder that end in php
198
-		$filepaths = glob( $folder.'*');
198
+		$filepaths = glob($folder.'*');
199 199
 
200
-		if ( empty( $filepaths ) ) {
200
+		if (empty($filepaths)) {
201 201
 			return;
202 202
 		}
203 203
 
204
-		foreach( $filepaths as $filepath ) {
205
-			if ( substr( $filepath, -4, 4 ) == '.php' ) {
206
-				$class_name = EEH_File::get_classname_from_filepath_with_standard_filename( $filepath );
207
-				if ( ! in_array( $class_name, $exclude )) {
208
-					$class_to_filepath_map [ $class_name ] = str_replace( array( '\/', '/' ), DS, $filepath );
204
+		foreach ($filepaths as $filepath) {
205
+			if (substr($filepath, -4, 4) == '.php') {
206
+				$class_name = EEH_File::get_classname_from_filepath_with_standard_filename($filepath);
207
+				if ( ! in_array($class_name, $exclude)) {
208
+					$class_to_filepath_map [$class_name] = str_replace(array('\/', '/'), DS, $filepath);
209 209
 				}
210
-			} else if ( $recursive ) {
211
-				EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $filepath, $recursive );
210
+			} else if ($recursive) {
211
+				EEH_Autoloader::register_autoloaders_for_each_file_in_folder($filepath, $recursive);
212 212
 			}
213 213
 		}
214 214
 
215 215
 		//we remove the necessity to do a is_readable() check via the $read_check flag because glob by nature will not return non_readable files/directories.
216
-		self::register_autoloader($class_to_filepath_map, FALSE );
216
+		self::register_autoloader($class_to_filepath_map, FALSE);
217 217
 	}
218 218
 
219 219
 
Please login to merge, or discard this patch.
core/helpers/EEH_Base.helper.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 	 *		@ override magic methods
34 34
 	 *		@ return void
35 35
 	 */	
36
-	public function __set($a,$b) { return FALSE; }
36
+	public function __set($a, $b) { return FALSE; }
37 37
 	public function __get($a) { return FALSE; }
38 38
 	public function __isset($a) { return FALSE; }
39 39
 	public function __unset($a) { return FALSE; }
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/helpers/EEH_Class_Tools.helper.php 2 patches
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -35,35 +35,35 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public static function get_called_class() {
37 37
 		$backtrace = debug_backtrace();
38
-		if ( isset( $backtrace[2] ) && is_array( $backtrace[2] ) && isset( $backtrace[2]['class'] ) && ! isset( $backtrace[2]['file'] )) {
38
+		if (isset($backtrace[2]) && is_array($backtrace[2]) && isset($backtrace[2]['class']) && ! isset($backtrace[2]['file'])) {
39 39
 			return $backtrace[2]['class'];
40
-		} else if ( isset( $backtrace[3] ) && is_array( $backtrace[3] ) && isset( $backtrace[3]['class'] ) && ! isset( $backtrace[3]['file'] )) {
40
+		} else if (isset($backtrace[3]) && is_array($backtrace[3]) && isset($backtrace[3]['class']) && ! isset($backtrace[3]['file'])) {
41 41
 			return $backtrace[3]['class'];
42
-		} else if ( isset( $backtrace[2] ) && is_array( $backtrace[2] ) && isset( $backtrace[2]['file'] ) && isset( $backtrace[2]['line'] )) {
43
-			if ( self::$file_line == $backtrace[2]['file'] . $backtrace[2]['line'] ) {
42
+		} else if (isset($backtrace[2]) && is_array($backtrace[2]) && isset($backtrace[2]['file']) && isset($backtrace[2]['line'])) {
43
+			if (self::$file_line == $backtrace[2]['file'].$backtrace[2]['line']) {
44 44
 				self::$i++;
45 45
 			} else {
46 46
 				self::$i = 0;
47
-				self::$file_line = $backtrace[2]['file'] . $backtrace[2]['line'];
47
+				self::$file_line = $backtrace[2]['file'].$backtrace[2]['line'];
48 48
 			}
49 49
 			// was  class method called via call_user_func ?
50
-			if ( $backtrace[2]['function'] == 'call_user_func' && isset( $backtrace[2]['args'] ) && is_array( $backtrace[2]['args'] )){
51
-				if ( isset( $backtrace[2]['args'][0] ) && isset( $backtrace[2]['args'][0][0] )) {
50
+			if ($backtrace[2]['function'] == 'call_user_func' && isset($backtrace[2]['args']) && is_array($backtrace[2]['args'])) {
51
+				if (isset($backtrace[2]['args'][0]) && isset($backtrace[2]['args'][0][0])) {
52 52
 					$called_class = $backtrace[2]['args'][0][0];
53 53
 					// is it an EE function ?
54
-					if ( strpos( $called_class, 'EE' ) === 0 ) {
55
-						$prefix_chars = strpos( $called_class, '_' ) + 1;
56
-						$prefix = substr( $called_class, 0, $prefix_chars );
57
-						$classname = substr( $called_class, $prefix_chars, strlen( $called_class ));
58
-						$classname = $prefix . str_replace( ' ', '_', ucwords( strtolower( str_replace( '_', ' ', $classname  ))));
54
+					if (strpos($called_class, 'EE') === 0) {
55
+						$prefix_chars = strpos($called_class, '_') + 1;
56
+						$prefix = substr($called_class, 0, $prefix_chars);
57
+						$classname = substr($called_class, $prefix_chars, strlen($called_class));
58
+						$classname = $prefix.str_replace(' ', '_', ucwords(strtolower(str_replace('_', ' ', $classname))));
59 59
 						return $classname;
60 60
 					}
61 61
 				}
62 62
 			} else {
63
-				$lines = file( $backtrace[2]['file'] );
64
-				preg_match_all( '/([a-zA-Z0-9\_]+)::' . $backtrace[2]['function'] . '/', $lines[$backtrace[2]['line']-1], $matches );
65
-				if ( isset( $matches[1] ) && isset( $matches[1][ self::$i ] )) {
66
-					return $matches[1][ self::$i ];
63
+				$lines = file($backtrace[2]['file']);
64
+				preg_match_all('/([a-zA-Z0-9\_]+)::'.$backtrace[2]['function'].'/', $lines[$backtrace[2]['line'] - 1], $matches);
65
+				if (isset($matches[1]) && isset($matches[1][self::$i])) {
66
+					return $matches[1][self::$i];
67 67
 				}
68 68
 			}
69 69
 		}
@@ -80,22 +80,22 @@  discard block
 block discarded – undo
80 80
 	 * 	@param 	string 	$hook
81 81
 	 * 	@return 	array
82 82
 	 */
83
-	public static function get_class_names_for_all_callbacks_on_hook( $hook = NULL ) {
83
+	public static function get_class_names_for_all_callbacks_on_hook($hook = NULL) {
84 84
 		global $wp_filter;
85 85
 		$class_names = array();
86 86
 		// are any callbacks registered for this hook ?
87
-		if ( isset( $wp_filter[ $hook ] )) {
87
+		if (isset($wp_filter[$hook])) {
88 88
 			// loop thru all of the callbacks attached to the deprecated hookpoint
89
-			foreach( $wp_filter[ $hook ] as $priority ) {
90
-				foreach( $priority as $callback ) {
89
+			foreach ($wp_filter[$hook] as $priority) {
90
+				foreach ($priority as $callback) {
91 91
 					// is the callback a non-static class method ?
92
-					if ( isset( $callback['function'] ) && is_array( $callback['function'] )) {
93
-						if ( isset( $callback['function'][0] ) && is_object( $callback['function'][0] )) {
94
-							$class_names[] = get_class( $callback['function'][0] );
92
+					if (isset($callback['function']) && is_array($callback['function'])) {
93
+						if (isset($callback['function'][0]) && is_object($callback['function'][0])) {
94
+							$class_names[] = get_class($callback['function'][0]);
95 95
 						}
96 96
 					// test for static method
97
-					} else if ( strpos( $callback['function'], '::' ) !== FALSE ) {
98
-						$class = explode( '::', $callback['function'] );
97
+					} else if (strpos($callback['function'], '::') !== FALSE) {
98
+						$class = explode('::', $callback['function']);
99 99
 						$class_names[] = $class[0];
100 100
 					} else {
101 101
 						// just a function
@@ -116,24 +116,24 @@  discard block
 block discarded – undo
116 116
 	 * 	@param		string 	$property
117 117
 	 * 	@return 		boolean
118 118
 	 */
119
-	public static function has_property( $class = NULL, $property = NULL ) {
119
+	public static function has_property($class = NULL, $property = NULL) {
120 120
 		// if $class or $property don't exist, then get out, cuz that would be like... fatal dude
121
-		if ( empty( $class ) || empty( $property )) {
121
+		if (empty($class) || empty($property)) {
122 122
 			return FALSE;
123 123
 		}
124 124
 		// if your hosting company doesn't cut the mustard
125
-		if ( version_compare( PHP_VERSION, '5.3.0' ) < 0 ) {
125
+		if (version_compare(PHP_VERSION, '5.3.0') < 0) {
126 126
 			// just in case $class is an actual instantiated object
127
-			if ( is_object( $class )) {
128
-				return isset( $class->$property ) ? TRUE : FALSE;
127
+			if (is_object($class)) {
128
+				return isset($class->$property) ? TRUE : FALSE;
129 129
 			} else {
130 130
 				// use reflection for < PHP 5.3 to get details using just the class name
131
-				$reflector = new ReflectionClass( $class );
132
-				return $reflector->hasProperty( $property );
131
+				$reflector = new ReflectionClass($class);
132
+				return $reflector->hasProperty($property);
133 133
 			}
134 134
 		} else {
135 135
 			// or try regular property exists method which works as expected in PHP 5.3+
136
-			return property_exists( $class, $property );
136
+			return property_exists($class, $property);
137 137
 		}
138 138
 	}
139 139
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 
144 144
 
145 145
 // if PHP version < 5.3
146
-if ( ! function_exists( 'get_called_class' )) {
146
+if ( ! function_exists('get_called_class')) {
147 147
 	/**
148 148
 	 * @return bool|string
149 149
 	 */
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/helpers/EEH_Debug_Tools.helper.php 2 patches
Braces   +5 added lines, -4 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
  * Class EEH_Debug_Tools
4 6
  *
@@ -122,8 +124,7 @@  discard block
 block discarded – undo
122 124
 				return;
123 125
 			}
124 126
 			echo '<h5>For Tag: '. $tag .'</h5>';
125
-		}
126
-		else {
127
+		} else {
127 128
 			$hook=$wp_filter;
128 129
 			ksort( $hook );
129 130
 		}
@@ -183,7 +184,7 @@  discard block
 block discarded – undo
183 184
 		if( isset( $this->_start_times[ $timer_name ] ) ){
184 185
 			$start_time = $this->_start_times[ $timer_name ];
185 186
 			unset( $this->_start_times[ $timer_name ] );
186
-		}else{
187
+		} else{
187 188
 			$start_time = array_pop( $this->_start_times );
188 189
 		}
189 190
 		$total_time = microtime( TRUE ) - $start_time;
Please login to merge, or discard this patch.
Spacing   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @since 				4.0
9 9
  *
10 10
  */
11
-class EEH_Debug_Tools{
11
+class EEH_Debug_Tools {
12 12
 
13 13
 	/**
14 14
 	 * 	instance of the EEH_Autoloader object
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	public static function instance() {
43 43
 		// check if class object is instantiated, and instantiated properly
44
-		if ( ! self::$_instance instanceof EEH_Debug_Tools ) {
44
+		if ( ! self::$_instance instanceof EEH_Debug_Tools) {
45 45
 			self::$_instance = new self();
46 46
 		}
47 47
 		return self::$_instance;
@@ -57,19 +57,19 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	private function __construct() {
59 59
 		// load Kint PHP debugging library
60
-		if ( ! class_exists( 'Kint' ) &&  file_exists( EE_PLUGIN_DIR_PATH . 'tests' . DS . 'kint' . DS . 'Kint.class.php' )){
60
+		if ( ! class_exists('Kint') && file_exists(EE_PLUGIN_DIR_PATH.'tests'.DS.'kint'.DS.'Kint.class.php')) {
61 61
 			// despite EE4 having a check for an existing copy of the Kint debugging class,
62 62
 			// if another plugin was loaded AFTER EE4 and they did NOT perform a similar check,
63 63
 			// then hilarity would ensue as PHP throws a "Cannot redeclare class Kint" error
64 64
 			// so we've moved it to our test folder so that it is not included with production releases
65 65
 			// plz use https://wordpress.org/plugins/kint-debugger/  if testing production versions of EE
66
-			require_once( EE_PLUGIN_DIR_PATH . 'tests' . DS . 'kint' . DS . 'Kint.class.php' );
66
+			require_once(EE_PLUGIN_DIR_PATH.'tests'.DS.'kint'.DS.'Kint.class.php');
67 67
 		}
68
-		if ( ! defined('DOING_AJAX') || ! isset( $_REQUEST['noheader'] ) || $_REQUEST['noheader'] != 'true' || ! isset( $_REQUEST['TB_iframe'] )) {
68
+		if ( ! defined('DOING_AJAX') || ! isset($_REQUEST['noheader']) || $_REQUEST['noheader'] != 'true' || ! isset($_REQUEST['TB_iframe'])) {
69 69
 			//add_action( 'shutdown', array($this,'espresso_session_footer_dump') );
70 70
 		}
71
-		add_action( 'activated_plugin', array( 'EEH_Debug_Tools', 'ee_plugin_activation_errors' ));
72
-		add_action( 'shutdown', array( 'EEH_Debug_Tools', 'show_db_name' ));
71
+		add_action('activated_plugin', array('EEH_Debug_Tools', 'ee_plugin_activation_errors'));
72
+		add_action('shutdown', array('EEH_Debug_Tools', 'show_db_name'));
73 73
 	}
74 74
 
75 75
 
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
 	 * 	@return void
81 81
 	 */
82 82
 	public static function show_db_name() {
83
-		if ( ! defined( 'DOING_AJAX' ) && ( defined( 'EE_ERROR_EMAILS' ) && EE_ERROR_EMAILS )) {
84
-			echo '<p style="font-size:10px;font-weight:normal;color:#E76700;margin: 1em 2em; text-align: right;">DB_NAME: '. DB_NAME .'</p>';
83
+		if ( ! defined('DOING_AJAX') && (defined('EE_ERROR_EMAILS') && EE_ERROR_EMAILS)) {
84
+			echo '<p style="font-size:10px;font-weight:normal;color:#E76700;margin: 1em 2em; text-align: right;">DB_NAME: '.DB_NAME.'</p>';
85 85
 		}
86 86
 	}
87 87
 
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
 	 * 	@return void
94 94
 	 */
95 95
 	public function espresso_session_footer_dump() {
96
-		if ( class_exists('Kint') && function_exists( 'wp_get_current_user' ) && current_user_can('update_core') && ( defined('WP_DEBUG') && WP_DEBUG ) &&  ! defined('DOING_AJAX') && class_exists( 'EE_Registry' )) {
97
-			Kint::dump(  EE_Registry::instance()->SSN->id() );
98
-			Kint::dump( EE_Registry::instance()->SSN );
96
+		if (class_exists('Kint') && function_exists('wp_get_current_user') && current_user_can('update_core') && (defined('WP_DEBUG') && WP_DEBUG) && ! defined('DOING_AJAX') && class_exists('EE_Registry')) {
97
+			Kint::dump(EE_Registry::instance()->SSN->id());
98
+			Kint::dump(EE_Registry::instance()->SSN);
99 99
 //			Kint::dump( EE_Registry::instance()->SSN->get_session_data('cart')->get_tickets() );
100 100
 			$this->espresso_list_hooked_functions();
101 101
 			$this->show_times();
@@ -112,27 +112,27 @@  discard block
 block discarded – undo
112 112
 	 * @param bool $tag
113 113
 	 * @return void
114 114
 	 */
115
-	public function espresso_list_hooked_functions( $tag=FALSE ){
115
+	public function espresso_list_hooked_functions($tag = FALSE) {
116 116
 		global $wp_filter;
117 117
 		echo '<br/><br/><br/><h3>Hooked Functions</h3>';
118
-		if ( $tag ) {
119
-			$hook[$tag]=$wp_filter[$tag];
120
-			if ( ! is_array( $hook[$tag] )) {
121
-				trigger_error( "Nothing found for '$tag' hook", E_USER_WARNING );
118
+		if ($tag) {
119
+			$hook[$tag] = $wp_filter[$tag];
120
+			if ( ! is_array($hook[$tag])) {
121
+				trigger_error("Nothing found for '$tag' hook", E_USER_WARNING);
122 122
 				return;
123 123
 			}
124
-			echo '<h5>For Tag: '. $tag .'</h5>';
124
+			echo '<h5>For Tag: '.$tag.'</h5>';
125 125
 		}
126 126
 		else {
127
-			$hook=$wp_filter;
128
-			ksort( $hook );
127
+			$hook = $wp_filter;
128
+			ksort($hook);
129 129
 		}
130
-		foreach( $hook as $tag => $priorities ) {
130
+		foreach ($hook as $tag => $priorities) {
131 131
 			echo "<br />&gt;&gt;&gt;&gt;&gt;\t<strong>$tag</strong><br />";
132
-			ksort( $priorities );
133
-			foreach( $priorities as $priority => $function ){
132
+			ksort($priorities);
133
+			foreach ($priorities as $priority => $function) {
134 134
 				echo $priority;
135
-				foreach( $function as $name => $properties ) {
135
+				foreach ($function as $name => $properties) {
136 136
 					echo "\t$name<br />";
137 137
 				}
138 138
 			}
@@ -148,15 +148,15 @@  discard block
 block discarded – undo
148 148
 	 * @param string $hook_name
149 149
 	 * @return array
150 150
 	 */
151
-	public static function registered_filter_callbacks( $hook_name = '' ) {
151
+	public static function registered_filter_callbacks($hook_name = '') {
152 152
 		$filters = array();
153 153
 		global $wp_filter;
154
-		if ( isset( $wp_filter[ $hook_name ] ) ) {
155
-			$filters[ $hook_name ] = array();
156
-			foreach ( $wp_filter[ $hook_name ] as $priority => $callbacks ) {
157
-				$filters[ $hook_name ][ $priority ] = array();
158
-				foreach ( $callbacks as $callback ) {
159
-					$filters[ $hook_name ][ $priority ][] = $callback['function'];
154
+		if (isset($wp_filter[$hook_name])) {
155
+			$filters[$hook_name] = array();
156
+			foreach ($wp_filter[$hook_name] as $priority => $callbacks) {
157
+				$filters[$hook_name][$priority] = array();
158
+				foreach ($callbacks as $callback) {
159
+					$filters[$hook_name][$priority][] = $callback['function'];
160 160
 				}
161 161
 			}
162 162
 		}
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
 	 * 	start_timer
170 170
 	 * @param null $timer_name
171 171
 	 */
172
-	public function start_timer( $timer_name = NULL ){
173
-		$this->_start_times[$timer_name] = microtime( TRUE );
172
+	public function start_timer($timer_name = NULL) {
173
+		$this->_start_times[$timer_name] = microtime(TRUE);
174 174
 	}
175 175
 
176 176
 
@@ -179,15 +179,15 @@  discard block
 block discarded – undo
179 179
 	 * stop_timer
180 180
 	 * @param string $timer_name
181 181
 	 */
182
-	public function stop_timer($timer_name = 'default'){
183
-		if( isset( $this->_start_times[ $timer_name ] ) ){
184
-			$start_time = $this->_start_times[ $timer_name ];
185
-			unset( $this->_start_times[ $timer_name ] );
186
-		}else{
187
-			$start_time = array_pop( $this->_start_times );
182
+	public function stop_timer($timer_name = 'default') {
183
+		if (isset($this->_start_times[$timer_name])) {
184
+			$start_time = $this->_start_times[$timer_name];
185
+			unset($this->_start_times[$timer_name]);
186
+		} else {
187
+			$start_time = array_pop($this->_start_times);
188 188
 		}
189
-		$total_time = microtime( TRUE ) - $start_time;
190
-		switch ( $total_time ) {
189
+		$total_time = microtime(TRUE) - $start_time;
190
+		switch ($total_time) {
191 191
 			case $total_time < 0.00001 :
192 192
 				$color = '#8A549A';
193 193
 				$bold = 'normal';
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 				$bold = 'bold';
214 214
 				break;
215 215
 		}
216
-		$this->_times[] = '<hr /><div style="display: inline-block; min-width: 10px; margin:0em 1em; color:'.$color.'; font-weight:'.$bold.'; font-size:1.2em;">' . number_format( $total_time, 8 ) . '</div> ' . $timer_name;
216
+		$this->_times[] = '<hr /><div style="display: inline-block; min-width: 10px; margin:0em 1em; color:'.$color.'; font-weight:'.$bold.'; font-size:1.2em;">'.number_format($total_time, 8).'</div> '.$timer_name;
217 217
 	 }
218 218
 	 /**
219 219
 	  * Measure the memory usage by PHP so far.
@@ -221,10 +221,10 @@  discard block
 block discarded – undo
221 221
 	  * @param boolean $output_now whether to echo now, or wait until EEH_Debug_Tools::show_times() is called
222 222
 	  * @return void
223 223
 	  */
224
-	 public function measure_memory( $label, $output_now = false ) {
225
-		 $memory_used = $this->convert( memory_get_peak_usage( true ) );
226
-		 $this->_memory_usage_points[ $label ] = $memory_used;
227
-		 if( $output_now ) {
224
+	 public function measure_memory($label, $output_now = false) {
225
+		 $memory_used = $this->convert(memory_get_peak_usage(true));
226
+		 $this->_memory_usage_points[$label] = $memory_used;
227
+		 if ($output_now) {
228 228
 			 echo "\r\n<br>$label : $memory_used";
229 229
 		 }
230 230
 	 }
@@ -234,9 +234,9 @@  discard block
 block discarded – undo
234 234
 	  * @param int $size
235 235
 	  * @return string
236 236
 	  */
237
-	 public function convert( $size ) {
238
-		$unit=array('b','kb','mb','gb','tb','pb');
239
-		return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[ absint( $i ) ];
237
+	 public function convert($size) {
238
+		$unit = array('b', 'kb', 'mb', 'gb', 'tb', 'pb');
239
+		return @round($size / pow(1024, ($i = floor(log($size, 1024)))), 2).' '.$unit[absint($i)];
240 240
 	 }
241 241
 
242 242
 
@@ -246,9 +246,9 @@  discard block
 block discarded – undo
246 246
 	 * @param bool $output_now
247 247
 	 * @return string
248 248
 	 */
249
-	public function show_times($output_now=true){
250
-		$output = '<h2>Times:</h2>' . implode("<br>",$this->_times) . '<h2>Memory</h2>' . implode('<br>', $this->_memory_usage_points );
251
-		 if($output_now){
249
+	public function show_times($output_now = true) {
250
+		$output = '<h2>Times:</h2>'.implode("<br>", $this->_times).'<h2>Memory</h2>'.implode('<br>', $this->_memory_usage_points);
251
+		 if ($output_now) {
252 252
 			 echo $output;
253 253
 			 return '';
254 254
 		 }
@@ -263,27 +263,27 @@  discard block
 block discarded – undo
263 263
 	 * 	@return void
264 264
 	 */
265 265
 	public static function ee_plugin_activation_errors() {
266
-		if ( defined('WP_DEBUG') && WP_DEBUG ) {
266
+		if (defined('WP_DEBUG') && WP_DEBUG) {
267 267
 			$activation_errors = ob_get_contents();
268
-			if ( class_exists( 'EE_Registry' )) {
269
-				EE_Registry::instance()->load_helper( 'File' );
268
+			if (class_exists('EE_Registry')) {
269
+				EE_Registry::instance()->load_helper('File');
270 270
 			} else {
271
-				include_once( EE_HELPERS . 'EEH_File.helper.php' );
271
+				include_once(EE_HELPERS.'EEH_File.helper.php');
272 272
 			}
273
-			if ( class_exists( 'EEH_File' )) {
273
+			if (class_exists('EEH_File')) {
274 274
 				try {
275
-					EEH_File::ensure_folder_exists_and_is_writable( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS );
276
-					EEH_File::ensure_file_exists_and_is_writable( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . 'espresso_plugin_activation_errors.html' );
277
-					EEH_File::write_to_file( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . 'espresso_plugin_activation_errors.html', $activation_errors );
278
-				} catch( EE_Error $e ){
279
-					EE_Error::add_error( sprintf( __(  'The Event Espresso activation errors file could not be setup because: %s', 'event_espresso' ), $e->getMessage() ));
275
+					EEH_File::ensure_folder_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS);
276
+					EEH_File::ensure_file_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.'espresso_plugin_activation_errors.html');
277
+					EEH_File::write_to_file(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.'espresso_plugin_activation_errors.html', $activation_errors);
278
+				} catch (EE_Error $e) {
279
+					EE_Error::add_error(sprintf(__('The Event Espresso activation errors file could not be setup because: %s', 'event_espresso'), $e->getMessage()));
280 280
 				}
281 281
 			} else {
282 282
 				// old school attempt
283
-				file_put_contents( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . 'espresso_plugin_activation_errors.html', $activation_errors );
283
+				file_put_contents(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.'espresso_plugin_activation_errors.html', $activation_errors);
284 284
 			}
285
-			$activation_errors = get_option( 'ee_plugin_activation_errors', '' ) . $activation_errors;
286
-			update_option( 'ee_plugin_activation_errors', $activation_errors );
285
+			$activation_errors = get_option('ee_plugin_activation_errors', '').$activation_errors;
286
+			update_option('ee_plugin_activation_errors', $activation_errors);
287 287
 		}
288 288
 	}
289 289
 
@@ -299,10 +299,10 @@  discard block
 block discarded – undo
299 299
 	 * @param int     $error_type
300 300
 	 * @uses trigger_error()
301 301
 	 */
302
-	public function doing_it_wrong( $function, $message, $version, $error_type = E_USER_NOTICE ) {
303
-		do_action( 'AHEE__EEH_Debug_Tools__doing_it_wrong_run', $function, $message, $version);
304
-		$version = is_null( $version ) ? '' : sprintf( __('(This message was added in version %s of Event Espresso.', 'event_espresso' ), $version );
305
-		trigger_error( sprintf( __('%1$s was called <strong>incorrectly</strong>. %2$s %3$s','event_espresso' ), $function, $message, $version ), $error_type );
302
+	public function doing_it_wrong($function, $message, $version, $error_type = E_USER_NOTICE) {
303
+		do_action('AHEE__EEH_Debug_Tools__doing_it_wrong_run', $function, $message, $version);
304
+		$version = is_null($version) ? '' : sprintf(__('(This message was added in version %s of Event Espresso.', 'event_espresso'), $version);
305
+		trigger_error(sprintf(__('%1$s was called <strong>incorrectly</strong>. %2$s %3$s', 'event_espresso'), $function, $message, $version), $error_type);
306 306
 	}
307 307
 
308 308
 
@@ -323,22 +323,22 @@  discard block
 block discarded – undo
323 323
 	 * @param string $debug_index
324 324
 	 * @param string $debug_key
325 325
 	 */
326
-	public static function log( $class='', $func = '', $line = '', $info = array(), $display_request = false,  $debug_index = '', $debug_key = 'EE_DEBUG_SPCO' ) {
327
-		if ( WP_DEBUG && false ) {
328
-			$debug_key = $debug_key . '_' . EE_Session::instance()->id();
329
-			$debug_data = get_option( $debug_key, array() );
326
+	public static function log($class = '', $func = '', $line = '', $info = array(), $display_request = false, $debug_index = '', $debug_key = 'EE_DEBUG_SPCO') {
327
+		if (WP_DEBUG && false) {
328
+			$debug_key = $debug_key.'_'.EE_Session::instance()->id();
329
+			$debug_data = get_option($debug_key, array());
330 330
 			$default_data = array(
331
-				$class => $func . '() : ' . $line,
331
+				$class => $func.'() : '.$line,
332 332
 				'REQ'  => $display_request ? $_REQUEST : '',
333 333
 			);
334 334
 			// don't serialize objects
335
-			$info = self::strip_objects( $info );
336
-			$index = ! empty( $debug_index ) ? $debug_index : 0;
337
-			if ( ! isset( $debug_data[$index] ) ) {
335
+			$info = self::strip_objects($info);
336
+			$index = ! empty($debug_index) ? $debug_index : 0;
337
+			if ( ! isset($debug_data[$index])) {
338 338
 				$debug_data[$index] = array();
339 339
 			}
340
-			$debug_data[$index][microtime()] = array_merge( $default_data, $info );
341
-			update_option( $debug_key, $debug_data );
340
+			$debug_data[$index][microtime()] = array_merge($default_data, $info);
341
+			update_option($debug_key, $debug_data);
342 342
 		}
343 343
 	}
344 344
 
@@ -350,26 +350,26 @@  discard block
 block discarded – undo
350 350
 	 * @param array $info
351 351
 	 * @return array
352 352
 	 */
353
-	public static function strip_objects( $info = array() ) {
354
-		foreach ( $info as $key => $value ) {
355
-			if ( is_array( $value ) ) {
356
-				$info[ $key ] = self::strip_objects( $value );
357
-			} else if ( is_object( $value ) ) {
358
-				$object_class = get_class( $value );
359
-				$info[ $object_class ] = array();
360
-				$info[ $object_class ][ 'ID' ] = method_exists( $value, 'ID' ) ? $value->ID() : spl_object_hash( $value );
361
-				if ( method_exists( $value, 'ID' ) ) {
362
-					$info[ $object_class ][ 'ID' ] = $value->ID();
353
+	public static function strip_objects($info = array()) {
354
+		foreach ($info as $key => $value) {
355
+			if (is_array($value)) {
356
+				$info[$key] = self::strip_objects($value);
357
+			} else if (is_object($value)) {
358
+				$object_class = get_class($value);
359
+				$info[$object_class] = array();
360
+				$info[$object_class]['ID'] = method_exists($value, 'ID') ? $value->ID() : spl_object_hash($value);
361
+				if (method_exists($value, 'ID')) {
362
+					$info[$object_class]['ID'] = $value->ID();
363 363
 				}
364
-				if ( method_exists( $value, 'status' ) ) {
365
-					$info[ $object_class ][ 'status' ] = $value->status();
366
-				} else if ( method_exists( $value, 'status_ID' ) ) {
367
-					$info[ $object_class ][ 'status' ] = $value->status_ID();
364
+				if (method_exists($value, 'status')) {
365
+					$info[$object_class]['status'] = $value->status();
366
+				} else if (method_exists($value, 'status_ID')) {
367
+					$info[$object_class]['status'] = $value->status_ID();
368 368
 				}
369
-				unset( $info[ $key ] );
369
+				unset($info[$key]);
370 370
 			}
371 371
 		}
372
-		return (array)$info;
372
+		return (array) $info;
373 373
 	}
374 374
 
375 375
 
@@ -386,31 +386,31 @@  discard block
 block discarded – undo
386 386
 	 * @param string $height
387 387
 	 * @param bool $die
388 388
 	 */
389
-	public static function printr( $var, $var_name = false, $file = __FILE__, $line = __LINE__, $height = 'auto', $die = false ) {
389
+	public static function printr($var, $var_name = false, $file = __FILE__, $line = __LINE__, $height = 'auto', $die = false) {
390 390
 		//$print_r = false;
391
-		if ( is_object( $var ) ) {
391
+		if (is_object($var)) {
392 392
 			$var_name = ! $var_name ? 'object' : $var_name;
393 393
 			//$print_r = true;
394
-		} else if ( is_array( $var ) ) {
394
+		} else if (is_array($var)) {
395 395
 			$var_name = ! $var_name ? 'array' : $var_name;
396 396
 			//$print_r = true;
397
-		} else if ( is_numeric( $var ) ) {
397
+		} else if (is_numeric($var)) {
398 398
 			$var_name = ! $var_name ? 'numeric' : $var_name;
399
-		} else if ( is_string( $var ) ) {
399
+		} else if (is_string($var)) {
400 400
 			$var_name = ! $var_name ? 'string' : $var_name;
401
-		} else if ( is_null( $var ) ) {
401
+		} else if (is_null($var)) {
402 402
 			$var_name = ! $var_name ? 'null' : $var_name;
403 403
 		}
404
-		$var_name = ucwords( str_replace( array( '$', '_' ), array( '', ' ' ), $var_name ) );
404
+		$var_name = ucwords(str_replace(array('$', '_'), array('', ' '), $var_name));
405 405
 		ob_start();
406
-		echo '<pre style="display:block; width:100%; height:' . $height . '; border:2px solid light-blue;">';
407
-		echo '<h5 style="color:#2EA2CC;"><b>' . $var_name . '</b></h5><span style="color:#E76700">';
406
+		echo '<pre style="display:block; width:100%; height:'.$height.'; border:2px solid light-blue;">';
407
+		echo '<h5 style="color:#2EA2CC;"><b>'.$var_name.'</b></h5><span style="color:#E76700">';
408 408
 		//$print_r ? print_r( $var ) : var_dump( $var );
409
-		var_dump( $var );
410
-		echo '</span><br /><span style="font-size:10px;font-weight:normal;">' . $file . '<br />line no: ' . $line . '</span></pre>';
409
+		var_dump($var);
410
+		echo '</span><br /><span style="font-size:10px;font-weight:normal;">'.$file.'<br />line no: '.$line.'</span></pre>';
411 411
 		$result = ob_get_clean();
412
-		if ( $die ) {
413
-			die( $result );
412
+		if ($die) {
413
+			die($result);
414 414
 		} else {
415 415
 			echo $result;
416 416
 		}
@@ -427,8 +427,8 @@  discard block
 block discarded – undo
427 427
  * borrowed from Kint Debugger
428 428
  * Plugin URI: http://upthemes.com/plugins/kint-debugger/
429 429
  */
430
-if ( class_exists('Kint') && ! function_exists( 'dump_wp_query' ) ) {
431
-	function dump_wp_query(){
430
+if (class_exists('Kint') && ! function_exists('dump_wp_query')) {
431
+	function dump_wp_query() {
432 432
 		global $wp_query;
433 433
 		d($wp_query);
434 434
 	}
@@ -438,8 +438,8 @@  discard block
 block discarded – undo
438 438
  * borrowed from Kint Debugger
439 439
  * Plugin URI: http://upthemes.com/plugins/kint-debugger/
440 440
  */
441
-if ( class_exists('Kint') && ! function_exists( 'dump_wp' ) ) {
442
-	function dump_wp(){
441
+if (class_exists('Kint') && ! function_exists('dump_wp')) {
442
+	function dump_wp() {
443 443
 		global $wp;
444 444
 		d($wp);
445 445
 	}
@@ -449,8 +449,8 @@  discard block
 block discarded – undo
449 449
  * borrowed from Kint Debugger
450 450
  * Plugin URI: http://upthemes.com/plugins/kint-debugger/
451 451
  */
452
-if ( class_exists('Kint') && ! function_exists( 'dump_post' ) ) {
453
-	function dump_post(){
452
+if (class_exists('Kint') && ! function_exists('dump_post')) {
453
+	function dump_post() {
454 454
 		global $post;
455 455
 		d($post);
456 456
 	}
Please login to merge, or discard this patch.
core/helpers/EEH_Event_Query.helper.php 2 patches
Spacing   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public static function add_query_filters() {
87 87
 		//add query filters
88
-		add_action( 'pre_get_posts', array( 'EEH_Event_Query', 'filter_query_parts' ), 10, 1 );
88
+		add_action('pre_get_posts', array('EEH_Event_Query', 'filter_query_parts'), 10, 1);
89 89
 	}
90 90
 
91 91
 
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 	 * @param \WP_Query $WP_Query
98 98
 	 * @return bool
99 99
 	 */
100
-	public static function apply_query_filters( WP_Query $WP_Query ) {
101
-		return ( isset( $WP_Query->query, $WP_Query->query['post_type'] ) && $WP_Query->query['post_type'] == 'espresso_events' ) ||  apply_filters( 'FHEE__EEH_Event_Query__apply_query_filters', false ) ? true : false;
100
+	public static function apply_query_filters(WP_Query $WP_Query) {
101
+		return (isset($WP_Query->query, $WP_Query->query['post_type']) && $WP_Query->query['post_type'] == 'espresso_events') || apply_filters('FHEE__EEH_Event_Query__apply_query_filters', false) ? true : false;
102 102
 	}
103 103
 
104 104
 
@@ -108,15 +108,15 @@  discard block
 block discarded – undo
108 108
 	 * @access    public
109 109
 	 * @param \WP_Query $WP_Query
110 110
 	 */
111
-	public static function filter_query_parts( WP_Query $WP_Query ) {
111
+	public static function filter_query_parts(WP_Query $WP_Query) {
112 112
 		//ONLY add our filters if this isn't the main wp_query, because if this is the main wp_query we already have our cpt strategies take care of adding things in.
113
-		if ( $WP_Query instanceof WP_Query && ! $WP_Query->is_main_query() ) {
113
+		if ($WP_Query instanceof WP_Query && ! $WP_Query->is_main_query()) {
114 114
 			// build event list query
115
-			add_filter( 'posts_fields', array( 'EEH_Event_Query', 'posts_fields' ), 10, 2 );
116
-			add_filter( 'posts_join', array( 'EEH_Event_Query', 'posts_join' ), 10, 2 );
117
-			add_filter( 'posts_where', array( 'EEH_Event_Query', 'posts_where' ), 10, 2 );
118
-			add_filter( 'posts_orderby', array( 'EEH_Event_Query', 'posts_orderby' ), 10, 2 );
119
-			add_filter( 'posts_clauses_request', array( 'EEH_Event_Query', 'posts_clauses' ), 10, 2 );
115
+			add_filter('posts_fields', array('EEH_Event_Query', 'posts_fields'), 10, 2);
116
+			add_filter('posts_join', array('EEH_Event_Query', 'posts_join'), 10, 2);
117
+			add_filter('posts_where', array('EEH_Event_Query', 'posts_where'), 10, 2);
118
+			add_filter('posts_orderby', array('EEH_Event_Query', 'posts_orderby'), 10, 2);
119
+			add_filter('posts_clauses_request', array('EEH_Event_Query', 'posts_clauses'), 10, 2);
120 120
 		}
121 121
 	}
122 122
 
@@ -131,13 +131,13 @@  discard block
 block discarded – undo
131 131
 	 * @param string $orderby
132 132
 	 * @param string $sort
133 133
 	 */
134
-	public static function set_query_params( $month = '', $category = '', $show_expired = FALSE, $orderby = 'start_date', $sort = 'ASC' ) {
134
+	public static function set_query_params($month = '', $category = '', $show_expired = FALSE, $orderby = 'start_date', $sort = 'ASC') {
135 135
 		self::$_query_params = array();
136
-		EEH_Event_Query::$_event_query_month = EEH_Event_Query::_display_month( $month );
137
-		EEH_Event_Query::$_event_query_category = EEH_Event_Query::_event_category_slug( $category );
138
-		EEH_Event_Query::$_event_query_show_expired = EEH_Event_Query::_show_expired( $show_expired );
139
-		EEH_Event_Query::$_event_query_orderby = EEH_Event_Query::_orderby( $orderby );
140
-		EEH_Event_Query::$_event_query_sort = EEH_Event_Query::_sort( $sort );
136
+		EEH_Event_Query::$_event_query_month = EEH_Event_Query::_display_month($month);
137
+		EEH_Event_Query::$_event_query_category = EEH_Event_Query::_event_category_slug($category);
138
+		EEH_Event_Query::$_event_query_show_expired = EEH_Event_Query::_show_expired($show_expired);
139
+		EEH_Event_Query::$_event_query_orderby = EEH_Event_Query::_orderby($orderby);
140
+		EEH_Event_Query::$_event_query_sort = EEH_Event_Query::_sort($sort);
141 141
 	}
142 142
 
143 143
 
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
 	 * @param string $month
150 150
 	 * @return    string
151 151
 	 */
152
-	private static function _display_month( $month = '' ) {
153
-		return EE_Registry::instance()->REQ->is_set( 'event_query_month' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'event_query_month' ) ) : $month;
152
+	private static function _display_month($month = '') {
153
+		return EE_Registry::instance()->REQ->is_set('event_query_month') ? sanitize_text_field(EE_Registry::instance()->REQ->get('event_query_month')) : $month;
154 154
 	}
155 155
 
156 156
 
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
 	 * @param string $category
163 163
 	 * @return    string
164 164
 	 */
165
-	private static function _event_category_slug( $category = '' ) {
166
-		return EE_Registry::instance()->REQ->is_set( 'event_query_category' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'event_query_category' ) ) : $category;
165
+	private static function _event_category_slug($category = '') {
166
+		return EE_Registry::instance()->REQ->is_set('event_query_category') ? sanitize_text_field(EE_Registry::instance()->REQ->get('event_query_category')) : $category;
167 167
 	}
168 168
 
169 169
 
@@ -175,10 +175,10 @@  discard block
 block discarded – undo
175 175
 	 * @param bool $show_expired
176 176
 	 * @return    boolean
177 177
 	 */
178
-	private static function _show_expired( $show_expired = FALSE ) {
178
+	private static function _show_expired($show_expired = FALSE) {
179 179
 		// override default expired option if set via filter
180
-		$_event_query_show_expired =EE_Registry::instance()->REQ->is_set( 'event_query_show_expired' ) ? EE_Registry::instance()->REQ->get( 'event_query_show_expired' ) : $show_expired;
181
-		return filter_var( $_event_query_show_expired, FILTER_VALIDATE_BOOLEAN );
180
+		$_event_query_show_expired = EE_Registry::instance()->REQ->is_set('event_query_show_expired') ? EE_Registry::instance()->REQ->get('event_query_show_expired') : $show_expired;
181
+		return filter_var($_event_query_show_expired, FILTER_VALIDATE_BOOLEAN);
182 182
 	}
183 183
 
184 184
 
@@ -190,10 +190,10 @@  discard block
 block discarded – undo
190 190
 	 * @param    string $orderby
191 191
 	 * @return    array
192 192
 	 */
193
-	private static function _orderby( $orderby = 'start_date' ) {
194
-		$event_query_orderby = EE_Registry::instance()->REQ->is_set( 'event_query_orderby' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'event_query_orderby' ) ) : $orderby;
195
-		$event_query_orderby = is_array( $event_query_orderby ) ? $event_query_orderby : explode( ',', $event_query_orderby );
196
-		$event_query_orderby = array_map( 'trim', $event_query_orderby );
193
+	private static function _orderby($orderby = 'start_date') {
194
+		$event_query_orderby = EE_Registry::instance()->REQ->is_set('event_query_orderby') ? sanitize_text_field(EE_Registry::instance()->REQ->get('event_query_orderby')) : $orderby;
195
+		$event_query_orderby = is_array($event_query_orderby) ? $event_query_orderby : explode(',', $event_query_orderby);
196
+		$event_query_orderby = array_map('trim', $event_query_orderby);
197 197
 		return $event_query_orderby;
198 198
 	}
199 199
 
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
 	 * @param string $sort
207 207
 	 * @return    array
208 208
 	 */
209
-	private static function _sort( $sort = 'ASC' ) {
210
-		$sort = EE_Registry::instance()->REQ->is_set( 'event_query_sort' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'event_query_sort' ) ) : $sort;
211
-		return in_array( $sort, array( 'ASC', 'asc', 'DESC', 'desc' )) ? strtoupper( $sort ) : 'ASC';
209
+	private static function _sort($sort = 'ASC') {
210
+		$sort = EE_Registry::instance()->REQ->is_set('event_query_sort') ? sanitize_text_field(EE_Registry::instance()->REQ->get('event_query_sort')) : $sort;
211
+		return in_array($sort, array('ASC', 'asc', 'DESC', 'desc')) ? strtoupper($sort) : 'ASC';
212 212
 	}
213 213
 
214 214
 
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
 	 *
222 222
 	 * @return array   array of clauses
223 223
 	 */
224
-	public static function posts_clauses( $clauses, WP_Query $wp_query ) {
225
-		if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) {
224
+	public static function posts_clauses($clauses, WP_Query $wp_query) {
225
+		if (EEH_Event_Query::apply_query_filters($wp_query)) {
226 226
 			$clauses['distinct'] = "DISTINCT";
227 227
 		}
228 228
 		return $clauses;
@@ -238,10 +238,10 @@  discard block
 block discarded – undo
238 238
 	 * @param WP_Query $wp_query
239 239
 	 * @return    string
240 240
 	 */
241
-	public static function posts_fields( $SQL, WP_Query $wp_query ) {
242
-		if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) {
241
+	public static function posts_fields($SQL, WP_Query $wp_query) {
242
+		if (EEH_Event_Query::apply_query_filters($wp_query)) {
243 243
 			// adds something like ", wp_esp_datetime.* " to WP Query SELECT statement
244
-			$SQL .= EEH_Event_Query::posts_fields_sql_for_orderby( EEH_Event_Query::$_event_query_orderby );
244
+			$SQL .= EEH_Event_Query::posts_fields_sql_for_orderby(EEH_Event_Query::$_event_query_orderby);
245 245
 		}
246 246
 		return $SQL;
247 247
 	}
@@ -256,29 +256,29 @@  discard block
 block discarded – undo
256 256
 	 * @internal  param bool|string $mixed $join_terms pass TRUE or term string, doesn't really matter since this value doesn't really get used for anything yet
257 257
 	 * @return    string
258 258
 	 */
259
-	public static function posts_fields_sql_for_orderby( $orderby_params = array() ) {
260
-		$SQL= '';
261
-		foreach( (array)$orderby_params as $orderby ) {
262
-			switch ( $orderby ) {
259
+	public static function posts_fields_sql_for_orderby($orderby_params = array()) {
260
+		$SQL = '';
261
+		foreach ((array) $orderby_params as $orderby) {
262
+			switch ($orderby) {
263 263
 
264 264
 				case 'ticket_start' :
265
-					$SQL .= ', ' . EEM_Ticket::instance()->table() . '.TKT_start_date' ;
265
+					$SQL .= ', '.EEM_Ticket::instance()->table().'.TKT_start_date';
266 266
 					break;
267 267
 
268 268
 				case 'ticket_end' :
269
-					$SQL .= ', ' . EEM_Ticket::instance()->table() . '.TKT_end_date' ;
269
+					$SQL .= ', '.EEM_Ticket::instance()->table().'.TKT_end_date';
270 270
 					break;
271 271
 
272 272
 				case 'venue_title' :
273
-					$SQL .= ', Venue.post_title AS venue_title' ;
273
+					$SQL .= ', Venue.post_title AS venue_title';
274 274
 					break;
275 275
 
276 276
 				case 'city' :
277
-					$SQL .= ', ' . EEM_Venue::instance()->second_table() . '.VNU_city' ;
277
+					$SQL .= ', '.EEM_Venue::instance()->second_table().'.VNU_city';
278 278
 					break;
279 279
 
280 280
 				case 'state' :
281
-					$SQL .= ', ' . EEM_State::instance()->table() . '.STA_name' ;
281
+					$SQL .= ', '.EEM_State::instance()->table().'.STA_name';
282 282
 					break;
283 283
 
284 284
 			}
@@ -296,12 +296,12 @@  discard block
 block discarded – undo
296 296
 	 * @param WP_Query $wp_query
297 297
 	 * @return    string
298 298
 	 */
299
-	public static function posts_join( $SQL = '', WP_Query $wp_query ) {
300
-		if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) {
299
+	public static function posts_join($SQL = '', WP_Query $wp_query) {
300
+		if (EEH_Event_Query::apply_query_filters($wp_query)) {
301 301
 			// Category
302
-			$SQL = EEH_Event_Query::posts_join_sql_for_show_expired( $SQL, EEH_Event_Query::$_event_query_show_expired );
303
-			$SQL = EEH_Event_Query::posts_join_sql_for_terms( $SQL, EEH_Event_Query::$_event_query_category );
304
-			$SQL = EEH_Event_Query::posts_join_for_orderby( $SQL, EEH_Event_Query::$_event_query_orderby );
302
+			$SQL = EEH_Event_Query::posts_join_sql_for_show_expired($SQL, EEH_Event_Query::$_event_query_show_expired);
303
+			$SQL = EEH_Event_Query::posts_join_sql_for_terms($SQL, EEH_Event_Query::$_event_query_category);
304
+			$SQL = EEH_Event_Query::posts_join_for_orderby($SQL, EEH_Event_Query::$_event_query_orderby);
305 305
 		}
306 306
 		return $SQL;
307 307
 	}
@@ -316,11 +316,11 @@  discard block
 block discarded – undo
316 316
 	 * @param    boolean $show_expired if TRUE, then displayed past events
317 317
 	 * @return string
318 318
 	 */
319
-	public static function posts_join_sql_for_show_expired( $SQL = '', $show_expired = FALSE ) {
320
-		if ( ! $show_expired ) {
321
-			$join = EEM_Event::instance()->table() . '.ID = ' . EEM_Datetime::instance()->table() . '.' . EEM_Event::instance()->primary_key_name();
322
-			if ( strpos( $SQL, $join ) === FALSE ) {
323
-				$SQL .= ' INNER JOIN ' . EEM_Datetime::instance()->table() . ' ON ( ' . $join . ' ) ';
319
+	public static function posts_join_sql_for_show_expired($SQL = '', $show_expired = FALSE) {
320
+		if ( ! $show_expired) {
321
+			$join = EEM_Event::instance()->table().'.ID = '.EEM_Datetime::instance()->table().'.'.EEM_Event::instance()->primary_key_name();
322
+			if (strpos($SQL, $join) === FALSE) {
323
+				$SQL .= ' INNER JOIN '.EEM_Datetime::instance()->table().' ON ( '.$join.' ) ';
324 324
 			}
325 325
 		}
326 326
 		return $SQL;
@@ -336,8 +336,8 @@  discard block
 block discarded – undo
336 336
 	 * @param 	string $join_terms pass TRUE or term string, doesn't really matter since this value doesn't really get used for anything yet
337 337
 	 * @return 	string
338 338
 	 */
339
-	public static function posts_join_sql_for_terms( $SQL = '', $join_terms = '' ) {
340
-		if ( ! empty( $join_terms ) ) {
339
+	public static function posts_join_sql_for_terms($SQL = '', $join_terms = '') {
340
+		if ( ! empty($join_terms)) {
341 341
 			global $wpdb;
342 342
 			$SQL .= " LEFT JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id)";
343 343
 			$SQL .= " LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)";
@@ -357,25 +357,25 @@  discard block
 block discarded – undo
357 357
 	 * @param 	array $orderby_params
358 358
 	 * @return 	string
359 359
 	 */
360
-	public static function posts_join_for_orderby( $SQL = '', $orderby_params = array() ) {
361
-		foreach ( (array)$orderby_params as $orderby ) {
362
-			switch ( $orderby ) {
360
+	public static function posts_join_for_orderby($SQL = '', $orderby_params = array()) {
361
+		foreach ((array) $orderby_params as $orderby) {
362
+			switch ($orderby) {
363 363
 				case 'ticket_start' :
364 364
 				case 'ticket_end' :
365
-					$SQL .= EEH_Event_Query::_posts_join_for_datetime( $SQL, EEM_Datetime_Ticket::instance()->table() . '.' . EEM_Datetime::instance()->primary_key_name() );
366
-					$SQL .= ' LEFT JOIN ' . EEM_Ticket::instance()->table() . ' ON (' . EEM_Datetime_Ticket::instance()->table() . '.' . EEM_Ticket::instance()->primary_key_name() . ' = ' . EEM_Ticket::instance()->table() . '.' . EEM_Ticket::instance()->primary_key_name() . ' )';
365
+					$SQL .= EEH_Event_Query::_posts_join_for_datetime($SQL, EEM_Datetime_Ticket::instance()->table().'.'.EEM_Datetime::instance()->primary_key_name());
366
+					$SQL .= ' LEFT JOIN '.EEM_Ticket::instance()->table().' ON ('.EEM_Datetime_Ticket::instance()->table().'.'.EEM_Ticket::instance()->primary_key_name().' = '.EEM_Ticket::instance()->table().'.'.EEM_Ticket::instance()->primary_key_name().' )';
367 367
 					break;
368 368
 				case 'venue_title' :
369 369
 				case 'city' :
370
-					$SQL .= EEH_Event_Query::_posts_join_for_event_venue( $SQL );
370
+					$SQL .= EEH_Event_Query::_posts_join_for_event_venue($SQL);
371 371
 					break;
372 372
 				case 'state' :
373
-					$SQL .= EEH_Event_Query::_posts_join_for_event_venue( $SQL );
374
-					$SQL .= EEH_Event_Query::_posts_join_for_venue_state( $SQL );
373
+					$SQL .= EEH_Event_Query::_posts_join_for_event_venue($SQL);
374
+					$SQL .= EEH_Event_Query::_posts_join_for_venue_state($SQL);
375 375
 					break;
376 376
 				case 'start_date' :
377 377
 				default :
378
-					$SQL .= EEH_Event_Query::_posts_join_for_datetime( $SQL, EEM_Event::instance()->table() . '.ID' );
378
+					$SQL .= EEH_Event_Query::_posts_join_for_datetime($SQL, EEM_Event::instance()->table().'.ID');
379 379
 					break;
380 380
 
381 381
 			}
@@ -393,11 +393,11 @@  discard block
 block discarded – undo
393 393
 	 * @param string $join
394 394
 	 * @return string
395 395
 	 */
396
-	protected static function _posts_join_for_datetime( $SQL = '', $join = '' ) {
397
-		if ( ! empty( $join )) {
398
-			$join .= ' = ' . EEM_Datetime::instance()->table() . '.' . EEM_Event::instance()->primary_key_name();
399
-			if ( strpos( $SQL, $join ) === FALSE ) {
400
-				return ' INNER JOIN ' . EEM_Datetime::instance()->table() . ' ON ( ' . $join . ' )';
396
+	protected static function _posts_join_for_datetime($SQL = '', $join = '') {
397
+		if ( ! empty($join)) {
398
+			$join .= ' = '.EEM_Datetime::instance()->table().'.'.EEM_Event::instance()->primary_key_name();
399
+			if (strpos($SQL, $join) === FALSE) {
400
+				return ' INNER JOIN '.EEM_Datetime::instance()->table().' ON ( '.$join.' )';
401 401
 			}
402 402
 		}
403 403
 		return '';
@@ -412,13 +412,13 @@  discard block
 block discarded – undo
412 412
 	 * @param string $SQL
413 413
 	 * @return string
414 414
 	 */
415
-	protected static function _posts_join_for_event_venue( $SQL = '' ) {
415
+	protected static function _posts_join_for_event_venue($SQL = '') {
416 416
 		// Event Venue table name
417 417
 		$event_venue_table = EEM_Event_Venue::instance()->table();
418 418
 		// generate conditions for:  Event <=> Event Venue  JOIN clause
419
-		$event_to_event_venue_join = EEM_Event::instance()->table() . '.ID = ' . $event_venue_table . '.' . EEM_Event::instance()->primary_key_name();
419
+		$event_to_event_venue_join = EEM_Event::instance()->table().'.ID = '.$event_venue_table.'.'.EEM_Event::instance()->primary_key_name();
420 420
 		// don't add joins if they have already been added
421
-		if ( strpos( $SQL, $event_to_event_venue_join ) === FALSE ) {
421
+		if (strpos($SQL, $event_to_event_venue_join) === FALSE) {
422 422
 			// Venue table name
423 423
 			$venue_table = EEM_Venue::instance()->table();
424 424
 			// Venue table pk
@@ -431,10 +431,10 @@  discard block
 block discarded – undo
431 431
 			$venue_SQL .= " LEFT JOIN $venue_table as Venue ON ( $event_venue_table.$venue_table_pk = Venue.ID )";
432 432
 			// generate JOIN clause for: Venue <=> Venue Meta
433 433
 			$venue_SQL .= " LEFT JOIN $venue_meta_table ON ( Venue.ID = $venue_meta_table.$venue_table_pk )";
434
-			unset( $event_venue_table, $event_to_event_venue_join, $venue_table, $venue_table_pk, $venue_meta_table );
434
+			unset($event_venue_table, $event_to_event_venue_join, $venue_table, $venue_table_pk, $venue_meta_table);
435 435
 			return $venue_SQL;
436 436
 		}
437
-		unset( $event_venue_table, $event_to_event_venue_join );
437
+		unset($event_venue_table, $event_to_event_venue_join);
438 438
 		return '';
439 439
 	}
440 440
 
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 	 * @param string $SQL
448 448
 	 * @return string
449 449
 	 */
450
-	protected static function _posts_join_for_venue_state( $SQL = '' ) {
450
+	protected static function _posts_join_for_venue_state($SQL = '') {
451 451
 		// Venue Meta table name
452 452
 		$venue_meta_table = EEM_Venue::instance()->second_table();
453 453
 		// State table name
@@ -455,16 +455,16 @@  discard block
 block discarded – undo
455 455
 		// State table pk
456 456
 		$state_table_pk = EEM_State::instance()->primary_key_name();
457 457
 		// verify vars
458
-		if ( $venue_meta_table && $state_table && $state_table_pk ) {
458
+		if ($venue_meta_table && $state_table && $state_table_pk) {
459 459
 			// like: wp_esp_venue_meta.STA_ID = wp_esp_state.STA_ID
460 460
 			$join = "$venue_meta_table.$state_table_pk = $state_table.$state_table_pk";
461 461
 			// don't add join if it has already been added
462
-			if ( strpos( $SQL, $join ) === FALSE ) {
463
-				unset( $state_table_pk, $venue_meta_table, $venue_table_pk );
462
+			if (strpos($SQL, $join) === FALSE) {
463
+				unset($state_table_pk, $venue_meta_table, $venue_table_pk);
464 464
 				return " LEFT JOIN $state_table ON ( $join )";
465 465
 			}
466 466
 		}
467
-		unset( $join, $state_table, $state_table_pk, $venue_meta_table, $venue_table_pk );
467
+		unset($join, $state_table, $state_table_pk, $venue_meta_table, $venue_table_pk);
468 468
 		return '';
469 469
 	}
470 470
 
@@ -478,14 +478,14 @@  discard block
 block discarded – undo
478 478
 	 * @param WP_Query $wp_query
479 479
 	 * @return    string
480 480
 	 */
481
-	public static function posts_where( $SQL = '', WP_Query $wp_query ) {
482
-		if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) {
481
+	public static function posts_where($SQL = '', WP_Query $wp_query) {
482
+		if (EEH_Event_Query::apply_query_filters($wp_query)) {
483 483
 			// Show Expired ?
484
-			$SQL .= EEH_Event_Query::posts_where_sql_for_show_expired( EEH_Event_Query::$_event_query_show_expired  );
484
+			$SQL .= EEH_Event_Query::posts_where_sql_for_show_expired(EEH_Event_Query::$_event_query_show_expired);
485 485
 			// Category
486
-			$SQL .= EEH_Event_Query::posts_where_sql_for_event_category_slug( EEH_Event_Query::$_event_query_category  );
486
+			$SQL .= EEH_Event_Query::posts_where_sql_for_event_category_slug(EEH_Event_Query::$_event_query_category);
487 487
 			// Start Date
488
-			$SQL .= EEH_Event_Query::posts_where_sql_for_event_list_month( EEH_Event_Query::$_event_query_month );
488
+			$SQL .= EEH_Event_Query::posts_where_sql_for_event_list_month(EEH_Event_Query::$_event_query_month);
489 489
 		}
490 490
 		return $SQL;
491 491
 	}
@@ -499,8 +499,8 @@  discard block
 block discarded – undo
499 499
 	 * @param    boolean $show_expired if TRUE, then displayed past events
500 500
 	 * @return    string
501 501
 	 */
502
-	public static function posts_where_sql_for_show_expired( $show_expired = FALSE ) {
503
-		return ! $show_expired ? ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end > "' . current_time( 'mysql', TRUE ) . '" ' : '';
502
+	public static function posts_where_sql_for_show_expired($show_expired = FALSE) {
503
+		return ! $show_expired ? ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_end > "'.current_time('mysql', TRUE).'" ' : '';
504 504
 	}
505 505
 
506 506
 
@@ -512,9 +512,9 @@  discard block
 block discarded – undo
512 512
 	 * @param    boolean $event_category_slug
513 513
 	 * @return    string
514 514
 	 */
515
-	public static function posts_where_sql_for_event_category_slug( $event_category_slug = NULL ) {
515
+	public static function posts_where_sql_for_event_category_slug($event_category_slug = NULL) {
516 516
 		global $wpdb;
517
-		return ! empty( $event_category_slug ) ? ' AND ' . $wpdb->terms . '.slug = "' . $event_category_slug . '" ' : '';
517
+		return ! empty($event_category_slug) ? ' AND '.$wpdb->terms.'.slug = "'.$event_category_slug.'" ' : '';
518 518
 	}
519 519
 
520 520
 
@@ -526,13 +526,13 @@  discard block
 block discarded – undo
526 526
 	 * @param    boolean $month
527 527
 	 * @return    string
528 528
 	 */
529
-	public static function posts_where_sql_for_event_list_month( $month = NULL ) {
529
+	public static function posts_where_sql_for_event_list_month($month = NULL) {
530 530
 		$SQL = '';
531
-		if ( ! empty( $month ) ) {
531
+		if ( ! empty($month)) {
532 532
 			// event start date is LESS than the end of the month ( so nothing that doesn't start until next month )
533
-			$SQL = ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_start <= "' . gmdate( 'Y-m-t 23:59:59', strtotime( $month ) ) . '"';
533
+			$SQL = ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_start <= "'.gmdate('Y-m-t 23:59:59', strtotime($month)).'"';
534 534
 			// event end date is GREATER than the start of the month ( so nothing that ended before this month )
535
-			$SQL .= ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end >= "' . gmdate( 'Y-m-01 0:0:00', strtotime( $month ) ) . '" ';
535
+			$SQL .= ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_end >= "'.gmdate('Y-m-01 0:0:00', strtotime($month)).'" ';
536 536
 		}
537 537
 		return $SQL;
538 538
 	}
@@ -547,9 +547,9 @@  discard block
 block discarded – undo
547 547
 	 * @param WP_Query $wp_query
548 548
 	 * @return    string
549 549
 	 */
550
-	public static function posts_orderby( $SQL = '', WP_Query $wp_query ) {
551
-		if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) {
552
-			$SQL = EEH_Event_Query::posts_orderby_sql( EEH_Event_Query::$_event_query_orderby, EEH_Event_Query::$_event_query_sort );
550
+	public static function posts_orderby($SQL = '', WP_Query $wp_query) {
551
+		if (EEH_Event_Query::apply_query_filters($wp_query)) {
552
+			$SQL = EEH_Event_Query::posts_orderby_sql(EEH_Event_Query::$_event_query_orderby, EEH_Event_Query::$_event_query_sort);
553 553
 		}
554 554
 		return $SQL;
555 555
 	}
@@ -580,63 +580,63 @@  discard block
 block discarded – undo
580 580
 	 * @param string     $sort
581 581
 	 * @return string
582 582
 	 */
583
-	public static function posts_orderby_sql( $orderby_params = array(), $sort = 'ASC' ) {
583
+	public static function posts_orderby_sql($orderby_params = array(), $sort = 'ASC') {
584 584
 		global $wpdb;
585 585
 		$SQL = '';
586 586
 		$counter = 0;
587 587
 		//make sure 'orderby' is set in query params
588
-		if ( ! isset( self::$_query_params['orderby'] )) {
588
+		if ( ! isset(self::$_query_params['orderby'])) {
589 589
 			self::$_query_params['orderby'] = array();
590 590
 		}
591 591
 		// loop thru $orderby_params (type cast as array)
592
-		foreach ( (array)$orderby_params as $orderby ) {
592
+		foreach ((array) $orderby_params as $orderby) {
593 593
 			// check if we have already added this param
594
-			if ( isset( self::$_query_params['orderby'][ $orderby ] )) {
594
+			if (isset(self::$_query_params['orderby'][$orderby])) {
595 595
 				// if so then remove from the $orderby_params so that the count() method below is accurate
596
-				unset( $orderby_params[ $orderby ] );
596
+				unset($orderby_params[$orderby]);
597 597
 				// then bump ahead to the next param
598 598
 				continue;
599 599
 			}
600 600
 			// this will ad a comma depending on whether this is the first or last param
601
-			$glue = $counter == 0 || $counter == count( $orderby_params ) ? ' ' : ', ';
601
+			$glue = $counter == 0 || $counter == count($orderby_params) ? ' ' : ', ';
602 602
 			// ok what's we dealing with?
603
-			switch ( $orderby ) {
603
+			switch ($orderby) {
604 604
 				case 'id' :
605 605
 				case 'ID' :
606
-					$SQL .= $glue . $wpdb->posts . '.ID ' . $sort;
606
+					$SQL .= $glue.$wpdb->posts.'.ID '.$sort;
607 607
 					break;
608 608
 				case 'end_date' :
609
-					$SQL .= $glue . EEM_Datetime::instance()->table() . '.DTT_EVT_end ' . $sort;
609
+					$SQL .= $glue.EEM_Datetime::instance()->table().'.DTT_EVT_end '.$sort;
610 610
 					break;
611 611
 				case 'event_name' :
612
-					$SQL .= $glue . $wpdb->posts . '.post_title ' . $sort;
612
+					$SQL .= $glue.$wpdb->posts.'.post_title '.$sort;
613 613
 					break;
614 614
 				case 'category_slug' :
615
-					$SQL .= $glue . $wpdb->terms . '.slug ' . $sort;
615
+					$SQL .= $glue.$wpdb->terms.'.slug '.$sort;
616 616
 					break;
617 617
 				case 'ticket_start' :
618
-					$SQL .= $glue . EEM_Ticket::instance()->table() . '.TKT_start_date ' . $sort;
618
+					$SQL .= $glue.EEM_Ticket::instance()->table().'.TKT_start_date '.$sort;
619 619
 					break;
620 620
 				case 'ticket_end' :
621
-					$SQL .= $glue . EEM_Ticket::instance()->table() . '.TKT_end_date ' . $sort;
621
+					$SQL .= $glue.EEM_Ticket::instance()->table().'.TKT_end_date '.$sort;
622 622
 					break;
623 623
 				case 'venue_title' :
624
-					$SQL .= $glue . 'venue_title ' . $sort;
624
+					$SQL .= $glue.'venue_title '.$sort;
625 625
 					break;
626 626
 				case 'city' :
627
-					$SQL .= $glue . EEM_Venue::instance()->second_table() . '.VNU_city ' . $sort;
627
+					$SQL .= $glue.EEM_Venue::instance()->second_table().'.VNU_city '.$sort;
628 628
 					break;
629 629
 				case 'state' :
630
-					$SQL .= $glue . EEM_State::instance()->table() . '.STA_name ' . $sort;
630
+					$SQL .= $glue.EEM_State::instance()->table().'.STA_name '.$sort;
631 631
 					break;
632 632
 				case 'start_date' :
633 633
 				default :
634
-					$SQL .= $glue . EEM_Datetime::instance()->table() . '.DTT_EVT_start ' . $sort;
634
+					$SQL .= $glue.EEM_Datetime::instance()->table().'.DTT_EVT_start '.$sort;
635 635
 					break;
636 636
 			}
637 637
 			// add to array of orderby params that have been added
638
-			self::$_query_params['orderby'][ $orderby ] = TRUE;
639
-			$counter ++;
638
+			self::$_query_params['orderby'][$orderby] = TRUE;
639
+			$counter++;
640 640
 		}
641 641
 		return $SQL;
642 642
 	}
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -229,7 +229,7 @@
 block discarded – undo
229 229
 	 *
230 230
 	 * @access    public
231 231
 	 * @param string $event_list_css
232
-	 * @return    array
232
+	 * @return    string
233 233
 	 */
234 234
 	public function event_list_css( $event_list_css = '' ) {
235 235
 		$event_list_css .=  ! empty( $event_list_css ) ? ' ' : '';
Please login to merge, or discard this patch.