Completed
Branch BUG-9482-password-protected-ve... (ea1952)
by
unknown
357:48 queued 343:27
created
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/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   +27 added lines, -27 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
 	/**
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
 	 * @param mixed $value usually a string, but could be an array or object
86 86
 	 * @return mixed the UNserialized data
87 87
 	 */
88
-	public static function maybe_unserialize( $value ) {
88
+	public static function maybe_unserialize($value) {
89 89
 		$data = maybe_unserialize($value);
90 90
 		//it's possible that this still has serialized data if its the session.  WP has a bug, http://core.trac.wordpress.org/ticket/26118 that doesnt' unserialize this automatically.
91 91
 		$token = 'C';
92 92
 		$data = is_string($data) ? trim($data) : $data;
93
-		if ( is_string($data) && strlen($data) > 1 && $data[0] == $token  && preg_match( "/^{$token}:[0-9]+:/s", $data ) ) {
93
+		if (is_string($data) && strlen($data) > 1 && $data[0] == $token && preg_match("/^{$token}:[0-9]+:/s", $data)) {
94 94
 			return unserialize($data);
95 95
 		} else {
96 96
 			return $data;
@@ -109,30 +109,30 @@  discard block
 block discarded – undo
109 109
 	 * @param bool $preserve_keys 		whether or not to reset numerically indexed arrays
110 110
 	 * @return array
111 111
 	 */
112
-	public static function insert_into_array( $target_array = array(), $array_to_insert = array(), $offset = null, $add_before = true, $preserve_keys = true ) {
112
+	public static function insert_into_array($target_array = array(), $array_to_insert = array(), $offset = null, $add_before = true, $preserve_keys = true) {
113 113
 		// ensure incoming arrays are actually arrays
114
-		$target_array 		= (array)$target_array;
115
-		$array_to_insert	= (array)$array_to_insert;
114
+		$target_array = (array) $target_array;
115
+		$array_to_insert = (array) $array_to_insert;
116 116
 		// if no offset key was supplied
117
-		if ( empty( $offset )) {
117
+		if (empty($offset)) {
118 118
 			// use start or end of $target_array based on whether we are adding before or not
119
-			$offset = $add_before ? 0 : count( $target_array );
119
+			$offset = $add_before ? 0 : count($target_array);
120 120
 		}
121 121
 		// if offset key is a string, then find the corresponding numeric location for that element
122
-		$offset = is_int( $offset ) ? $offset : array_search( $offset, array_keys( $target_array ) );
122
+		$offset = is_int($offset) ? $offset : array_search($offset, array_keys($target_array));
123 123
 		// add one to the offset if adding after
124 124
 		$offset = $add_before ? $offset : $offset + 1;
125 125
 		// but ensure offset does not exceed the length of the array
126
-		$offset = $offset > count( $target_array ) ? count( $target_array ) : $offset;
126
+		$offset = $offset > count($target_array) ? count($target_array) : $offset;
127 127
 		// reindex array ???
128
-		if ( $preserve_keys ) {
128
+		if ($preserve_keys) {
129 129
 			// take a slice of the target array from the beginning till the offset,
130 130
 			// then add the new data
131 131
 			// then add another slice that starts at the offset and goes till the end
132
-			return array_slice( $target_array, 0, $offset, true ) + $array_to_insert + array_slice( $target_array, $offset, null, true );
132
+			return array_slice($target_array, 0, $offset, true) + $array_to_insert + array_slice($target_array, $offset, null, true);
133 133
 		} else {
134 134
 			// since we don't want to preserve keys, we can use array_splice
135
-			array_splice( $target_array, $offset, 0, $array_to_insert );
135
+			array_splice($target_array, $offset, 0, $array_to_insert);
136 136
 			return $target_array;
137 137
 		}
138 138
 	}
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   +42 added lines, -42 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
 /**
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
 	 * @return \EEH_Autoloader
41 41
 	 */
42 42
 	private function __construct() {
43
-		if ( self::$_autoloaders === null ) {
43
+		if (self::$_autoloaders === null) {
44 44
 			self::$_autoloaders = array();
45 45
 			$this->_register_custom_autoloaders();
46
-			spl_autoload_register( array( $this, 'espresso_autoloader' ) );
46
+			spl_autoload_register(array($this, 'espresso_autoloader'));
47 47
 		}
48 48
 	}
49 49
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public static function instance() {
57 57
 		// check if class object is instantiated
58
-		if ( ! self::$_instance instanceof EEH_Autoloader ) {
58
+		if ( ! self::$_instance instanceof EEH_Autoloader) {
59 59
 			self::$_instance = new self();
60 60
 		}
61 61
 		return self::$_instance;
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
 	 * @internal  param string $class_name - simple class name ie: session
73 73
 	 * @return 	void
74 74
 	 */
75
-	public static function espresso_autoloader( $class_name ) {
76
-		if ( isset( self::$_autoloaders[ $class_name ] ) ) {
77
-			require_once( self::$_autoloaders[ $class_name ] );
75
+	public static function espresso_autoloader($class_name) {
76
+		if (isset(self::$_autoloaders[$class_name])) {
77
+			require_once(self::$_autoloaders[$class_name]);
78 78
 		}
79 79
 	}
80 80
 
@@ -90,26 +90,26 @@  discard block
 block discarded – undo
90 90
 	 * @return void
91 91
 	 * @throws \EE_Error
92 92
 	 */
93
-	public static function register_autoloader( $class_paths, $read_check = true, $debug = false ) {
94
-		$class_paths = is_array( $class_paths ) ? $class_paths : array( $class_paths );
95
-		foreach ( $class_paths as $class => $path ) {
93
+	public static function register_autoloader($class_paths, $read_check = true, $debug = false) {
94
+		$class_paths = is_array($class_paths) ? $class_paths : array($class_paths);
95
+		foreach ($class_paths as $class => $path) {
96 96
 			// don't give up! you gotta...
97 97
 			// get some class
98
-			if ( empty( $class )) {
99
-				throw new EE_Error ( sprintf( __( 'No Class name was specified while registering an autoloader for the following path: %s.','event_espresso' ), $path ));
98
+			if (empty($class)) {
99
+				throw new EE_Error(sprintf(__('No Class name was specified while registering an autoloader for the following path: %s.', 'event_espresso'), $path));
100 100
 			}
101 101
 			// one day you will find the path young grasshopper
102
-			if ( empty( $path )) {
103
-				throw new EE_Error ( sprintf( __( 'No path was specified while registering an autoloader for the %s class.','event_espresso' ), $class ));
102
+			if (empty($path)) {
103
+				throw new EE_Error(sprintf(__('No path was specified while registering an autoloader for the %s class.', 'event_espresso'), $class));
104 104
 			}
105 105
 			// is file readable ?
106
-			if ( $read_check && ! is_readable( $path )) {
107
-				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 ));
106
+			if ($read_check && ! is_readable($path)) {
107
+				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));
108 108
 			}
109
-			if ( ! isset( self::$_autoloaders[ $class ] )) {
110
-				self::$_autoloaders[ $class ] = str_replace( array( '/', '\\' ), DS, $path );
111
-				if ( WP_DEBUG && $debug ) {
112
-					EEH_Debug_Tools::printr( self::$_autoloaders[ $class ], $class, __FILE__, __LINE__ );
109
+			if ( ! isset(self::$_autoloaders[$class])) {
110
+				self::$_autoloaders[$class] = str_replace(array('/', '\\'), DS, $path);
111
+				if (WP_DEBUG && $debug) {
112
+					EEH_Debug_Tools::printr(self::$_autoloaders[$class], $class, __FILE__, __LINE__);
113 113
 				}
114 114
 			}
115 115
 		}
@@ -138,12 +138,12 @@  discard block
 block discarded – undo
138 138
 	 * 	@return void
139 139
 	 */
140 140
 	private function _register_custom_autoloaders() {
141
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CORE . 'interfaces' );
142
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CORE );
143
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_INTERFACES, true );
144
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_MODELS, true );
145
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CLASSES );
146
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_FORM_SECTIONS, true );
141
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'interfaces');
142
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE);
143
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_INTERFACES, true);
144
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_MODELS, true);
145
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CLASSES);
146
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_FORM_SECTIONS, true);
147 147
 	}
148 148
 
149 149
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 * 	@return void
170 170
 	 */
171 171
 	public static function register_line_item_display_autoloaders() {
172
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(  EE_LIBRARIES . 'line_item_display' , true );
172
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'line_item_display', true);
173 173
 	}
174 174
 
175 175
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	 * 	@return void
183 183
 	 */
184 184
 	public static function register_line_item_filter_autoloaders() {
185
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(  EE_LIBRARIES . 'line_item_filters' , true );
185
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'line_item_filters', true);
186 186
 	}
187 187
 
188 188
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 * 	@return void
196 196
 	 */
197 197
 	public static function register_template_part_autoloaders() {
198
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'template_parts', true );
198
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'template_parts', true);
199 199
 	}
200 200
 
201 201
 
@@ -213,30 +213,30 @@  discard block
 block discarded – undo
213 213
 	 * @return void
214 214
 	 * @throws \EE_Error
215 215
 	 */
216
-	public static function register_autoloaders_for_each_file_in_folder( $folder, $recursive = false, $debug = false ){
216
+	public static function register_autoloaders_for_each_file_in_folder($folder, $recursive = false, $debug = false) {
217 217
 		// make sure last char is a /
218
-		$folder .= $folder[strlen($folder)-1] != DS ? DS : '';
218
+		$folder .= $folder[strlen($folder) - 1] != DS ? DS : '';
219 219
 		$class_to_filepath_map = array();
220
-		$exclude = array( 'index' );
220
+		$exclude = array('index');
221 221
 		//get all the files in that folder that end in php
222
-		$filepaths = glob( $folder.'*');
222
+		$filepaths = glob($folder.'*');
223 223
 
224
-		if ( empty( $filepaths ) ) {
224
+		if (empty($filepaths)) {
225 225
 			return;
226 226
 		}
227 227
 
228
-		foreach( $filepaths as $filepath ) {
229
-			if ( substr( $filepath, -4, 4 ) == '.php' ) {
230
-				$class_name = EEH_File::get_classname_from_filepath_with_standard_filename( $filepath );
231
-				if ( ! in_array( $class_name, $exclude )) {
232
-					$class_to_filepath_map [ $class_name ] = $filepath;
228
+		foreach ($filepaths as $filepath) {
229
+			if (substr($filepath, -4, 4) == '.php') {
230
+				$class_name = EEH_File::get_classname_from_filepath_with_standard_filename($filepath);
231
+				if ( ! in_array($class_name, $exclude)) {
232
+					$class_to_filepath_map [$class_name] = $filepath;
233 233
 				}
234
-			} else if ( $recursive ) {
235
-				EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $filepath, $recursive );
234
+			} else if ($recursive) {
235
+				EEH_Autoloader::register_autoloaders_for_each_file_in_folder($filepath, $recursive);
236 236
 			}
237 237
 		}
238 238
 		// 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.
239
-		self::register_autoloader( $class_to_filepath_map, false, $debug );
239
+		self::register_autoloader($class_to_filepath_map, false, $debug);
240 240
 	}
241 241
 
242 242
 
Please login to merge, or discard this patch.
core/helpers/EEH_Base.helper.php 3 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.
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 /**
3
- * Event Espresso
4
- *
5
- * Event Registration and Management Plugin for WordPress
6
- *
7
- * @ package			Event Espresso
8
- * @ author			Seth Shoultes
9
- * @ copyright		(c) 2008-2011 Event Espresso  All Rights Reserved.
10
- * @ license			http://eventespresso.com/support/terms-conditions/   * see Plugin Licensing *
11
- * @ link					http://www.eventespresso.com
12
- * @ version		 	4.0
13
- *
14
- * ------------------------------------------------------------------------
15
- *
16
- * EEH_Base Helper
17
- *
18
- * @package			Event Espresso
19
- * @subpackage	/helpers/
20
- * @author				Brent Christensen 
21
- *
22
- * ------------------------------------------------------------------------
23
- */
3
+	 * Event Espresso
4
+	 *
5
+	 * Event Registration and Management Plugin for WordPress
6
+	 *
7
+	 * @ package			Event Espresso
8
+	 * @ author			Seth Shoultes
9
+	 * @ copyright		(c) 2008-2011 Event Espresso  All Rights Reserved.
10
+	 * @ license			http://eventespresso.com/support/terms-conditions/   * see Plugin Licensing *
11
+	 * @ link					http://www.eventespresso.com
12
+	 * @ version		 	4.0
13
+	 *
14
+	 * ------------------------------------------------------------------------
15
+	 *
16
+	 * EEH_Base Helper
17
+	 *
18
+	 * @package			Event Espresso
19
+	 * @subpackage	/helpers/
20
+	 * @author				Brent Christensen 
21
+	 *
22
+	 * ------------------------------------------------------------------------
23
+	 */
24 24
 class EEH_Base {
25 25
 
26 26
 	/**
Please login to merge, or discard this patch.
core/helpers/EEH_DTT_Helper.helper.php 3 patches
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -799,7 +799,6 @@
 block discarded – undo
799 799
 
800 800
 
801 801
 	/**
802
-
803 802
 	 *
804 803
 	 * 	 If the the first date starts at midnight on one day, and the next date ends at midnight on the
805 804
 	 * 	 very next day then this method will return true.
Please login to merge, or discard this patch.
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  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 6
 /**
6 7
  * Event Espresso
@@ -264,10 +265,11 @@  discard block
 block discarded – undo
264 265
 					// Set TZ so localtime works.
265 266
 					date_default_timezone_set($timezone_string);
266 267
 					$now = localtime(time(), true);
267
-					if ($now['tm_isdst'])
268
-						_e('This timezone is currently in daylight saving time.');
269
-					else
270
-						_e('This timezone is currently in standard time.');
268
+					if ($now['tm_isdst']) {
269
+											_e('This timezone is currently in daylight saving time.');
270
+					} else {
271
+											_e('This timezone is currently in standard time.');
272
+					}
271 273
 					?>
272 274
 					<br />
273 275
 					<?php
Please login to merge, or discard this patch.
Spacing   +115 added lines, -116 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
 /**
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
 	 * @return string
54 54
 	 * @throws \EE_Error
55 55
 	 */
56
-	public static function get_valid_timezone_string( $timezone_string = '' ) {
56
+	public static function get_valid_timezone_string($timezone_string = '') {
57 57
 		// if passed a value, then use that, else get WP option
58
-		$timezone_string = ! empty( $timezone_string ) ? $timezone_string : get_option( 'timezone_string' );
58
+		$timezone_string = ! empty($timezone_string) ? $timezone_string : get_option('timezone_string');
59 59
 		// value from above exists, use that, else get timezone string from gmt_offset
60
-		$timezone_string = ! empty( $timezone_string ) ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_gmt_offset();
61
-		EEH_DTT_Helper::validate_timezone( $timezone_string );
60
+		$timezone_string = ! empty($timezone_string) ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_gmt_offset();
61
+		EEH_DTT_Helper::validate_timezone($timezone_string);
62 62
 		return $timezone_string;
63 63
 	}
64 64
 
@@ -74,18 +74,18 @@  discard block
 block discarded – undo
74 74
 	 * @return bool
75 75
 	 * @throws \EE_Error
76 76
 	 */
77
-	public static function validate_timezone( $timezone_string, $throw_error = true ) {
77
+	public static function validate_timezone($timezone_string, $throw_error = true) {
78 78
 		// easiest way to test a timezone string is just see if it throws an error when you try to create a DateTimeZone object with it
79 79
 		try {
80
-			new DateTimeZone( $timezone_string );
81
-		} catch ( Exception $e ) {
80
+			new DateTimeZone($timezone_string);
81
+		} catch (Exception $e) {
82 82
 			// sometimes we take exception to exceptions
83
-			if ( ! $throw_error ) {
83
+			if ( ! $throw_error) {
84 84
 				return false;
85 85
 			}
86 86
 			throw new EE_Error(
87 87
 				sprintf(
88
-					__( 'The timezone given (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso' ),
88
+					__('The timezone given (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso'),
89 89
 					$timezone_string,
90 90
 					'<a href="http://www.php.net/manual/en/timezones.php">',
91 91
 					'</a>'
@@ -104,19 +104,19 @@  discard block
 block discarded – undo
104 104
 	 * @param string $gmt_offset
105 105
 	 * @return string
106 106
 	 */
107
-	public static function get_timezone_string_from_gmt_offset( $gmt_offset = '' ) {
107
+	public static function get_timezone_string_from_gmt_offset($gmt_offset = '') {
108 108
 		$timezone_string = 'UTC';
109
-		$gmt_offset = ! empty( $gmt_offset ) ? $gmt_offset : get_option( 'gmt_offset' );
110
-		if ( $gmt_offset !== '' ) {
109
+		$gmt_offset = ! empty($gmt_offset) ? $gmt_offset : get_option('gmt_offset');
110
+		if ($gmt_offset !== '') {
111 111
 			// convert GMT offset to seconds
112 112
 			$gmt_offset = $gmt_offset * HOUR_IN_SECONDS;
113 113
 			// account for WP offsets that aren't valid UTC
114
-			$gmt_offset = EEH_DTT_Helper::adjust_invalid_gmt_offsets( $gmt_offset );
114
+			$gmt_offset = EEH_DTT_Helper::adjust_invalid_gmt_offsets($gmt_offset);
115 115
 			// although we don't know the TZ abbreviation, we know the UTC offset
116
-			$timezone_string = timezone_name_from_abbr( null, $gmt_offset );
116
+			$timezone_string = timezone_name_from_abbr(null, $gmt_offset);
117 117
 		}
118 118
 		// better have a valid timezone string by now, but if not, sigh... loop thru  the timezone_abbreviations_list()...
119
-		$timezone_string = $timezone_string !== false ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_abbreviations_list( $gmt_offset );
119
+		$timezone_string = $timezone_string !== false ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_abbreviations_list($gmt_offset);
120 120
 		return $timezone_string;
121 121
 	}
122 122
 
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
 	 * @param int $gmt_offset
130 130
 	 * @return int
131 131
 	 */
132
-	public static function adjust_invalid_gmt_offsets( $gmt_offset = 0 ) {
132
+	public static function adjust_invalid_gmt_offsets($gmt_offset = 0) {
133 133
 		//make sure $gmt_offset is int
134 134
 		$gmt_offset = (int) $gmt_offset;
135
-		switch ( $gmt_offset ) {
135
+		switch ($gmt_offset) {
136 136
 
137 137
 			//			case -30600 :
138 138
 			//				$gmt_offset = -28800;
@@ -184,13 +184,13 @@  discard block
 block discarded – undo
184 184
 	 * @return string
185 185
 	 * @throws \EE_Error
186 186
 	 */
187
-	public static function get_timezone_string_from_abbreviations_list( $gmt_offset = 0 ) {
187
+	public static function get_timezone_string_from_abbreviations_list($gmt_offset = 0) {
188 188
 		$abbreviations = timezone_abbreviations_list();
189
-		foreach ( $abbreviations as $abbreviation ) {
190
-			foreach ( $abbreviation as $city ) {
191
-				if ( $city['offset'] === $gmt_offset && $city['dst'] === FALSE ) {
189
+		foreach ($abbreviations as $abbreviation) {
190
+			foreach ($abbreviation as $city) {
191
+				if ($city['offset'] === $gmt_offset && $city['dst'] === FALSE) {
192 192
 					// check if the timezone is valid but don't throw any errors if it isn't
193
-					if ( EEH_DTT_Helper::validate_timezone( $city['timezone_id'], false ) ) {
193
+					if (EEH_DTT_Helper::validate_timezone($city['timezone_id'], false)) {
194 194
 						return $city['timezone_id'];
195 195
 					}
196 196
 				}
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 		}
199 199
 		throw new EE_Error(
200 200
 			sprintf(
201
-				__( 'The provided GMT offset (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso' ),
201
+				__('The provided GMT offset (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso'),
202 202
 				$gmt_offset,
203 203
 				'<a href="http://www.php.net/manual/en/timezones.php">',
204 204
 				'</a>'
@@ -212,23 +212,23 @@  discard block
 block discarded – undo
212 212
 	 * @access public
213 213
 	 * @param string $timezone_string
214 214
 	 */
215
-	public static function timezone_select_input( $timezone_string = '' ) {
215
+	public static function timezone_select_input($timezone_string = '') {
216 216
 		// get WP date time format
217
-		$datetime_format = get_option('date_format') . ' '  . get_option('time_format');
217
+		$datetime_format = get_option('date_format').' '.get_option('time_format');
218 218
 		// if passed a value, then use that, else get WP option
219
-		$timezone_string = ! empty( $timezone_string ) ? $timezone_string : get_option( 'timezone_string' );
219
+		$timezone_string = ! empty($timezone_string) ? $timezone_string : get_option('timezone_string');
220 220
 		// check if the timezone is valid but don't throw any errors if it isn't
221
-		$timezone_string = EEH_DTT_Helper::validate_timezone( $timezone_string, false );
221
+		$timezone_string = EEH_DTT_Helper::validate_timezone($timezone_string, false);
222 222
 		$gmt_offset = get_option('gmt_offset');
223 223
 
224 224
 		$check_zone_info = true;
225
-		if ( empty( $timezone_string )) {
225
+		if (empty($timezone_string)) {
226 226
 			// Create a UTC+- zone if no timezone string exists
227 227
 			$check_zone_info = false;
228
-			if ( $gmt_offset > 0 ) {
229
-				$timezone_string = 'UTC+' . $gmt_offset;
230
-			} elseif ( $gmt_offset < 0 ) {
231
-				$timezone_string = 'UTC' . $gmt_offset;
228
+			if ($gmt_offset > 0) {
229
+				$timezone_string = 'UTC+'.$gmt_offset;
230
+			} elseif ($gmt_offset < 0) {
231
+				$timezone_string = 'UTC'.$gmt_offset;
232 232
 			} else {
233 233
 				$timezone_string = 'UTC';
234 234
 			}
@@ -250,11 +250,11 @@  discard block
 block discarded – undo
250 250
 					__('%1$sUTC%2$s time is %3$s'),
251 251
 					'<abbr title="Coordinated Universal Time">',
252 252
 					'</abbr>',
253
-					'<code>' . date_i18n( $datetime_format , false, 'gmt') . '</code>'
253
+					'<code>'.date_i18n($datetime_format, false, 'gmt').'</code>'
254 254
 				);
255 255
 				?></span>
256
-			<?php if ( ! empty( $timezone_string ) || ! empty( $gmt_offset )) : ?>
257
-				<br /><span><?php printf(__('Local time is %1$s'), '<code>' . date_i18n( $datetime_format ) . '</code>' ); ?></span>
256
+			<?php if ( ! empty($timezone_string) || ! empty($gmt_offset)) : ?>
257
+				<br /><span><?php printf(__('Local time is %1$s'), '<code>'.date_i18n($datetime_format).'</code>'); ?></span>
258 258
 		<?php endif; ?>
259 259
 
260 260
 				<?php if ($check_zone_info && $timezone_string) : ?>
@@ -286,10 +286,9 @@  discard block
 block discarded – undo
286 286
 
287 287
 						if ($found) {
288 288
 							$message = $tr['isdst'] ?
289
-											__(' Daylight saving time begins on: %s.' ) :
290
-											__(' Standard time begins  on: %s.');
289
+											__(' Daylight saving time begins on: %s.') : __(' Standard time begins  on: %s.');
291 290
 							// Add the difference between the current offset and the new offset to ts to get the correct transition time from date_i18n().
292
-							printf( $message, '<code >' . date_i18n( $datetime_format, $tr['ts'] + ( $tz_offset - $tr['offset'] ) ). '</code >' );
291
+							printf($message, '<code >'.date_i18n($datetime_format, $tr['ts'] + ($tz_offset - $tr['offset'])).'</code >');
293 292
 						} else {
294 293
 							_e('This timezone does not observe daylight saving time.');
295 294
 						}
@@ -319,14 +318,14 @@  discard block
 block discarded – undo
319 318
 	 *
320 319
 	 * @return int      $unix_timestamp with the offset applied for the given timezone.
321 320
 	 */
322
-	public static function get_timestamp_with_offset( $unix_timestamp = 0, $timezone_string = '' ) {
321
+	public static function get_timestamp_with_offset($unix_timestamp = 0, $timezone_string = '') {
323 322
 		$unix_timestamp = $unix_timestamp === 0 ? time() : (int) $unix_timestamp;
324
-		$timezone_string = self::get_valid_timezone_string( $timezone_string );
325
-		$TimeZone = new DateTimeZone( $timezone_string );
323
+		$timezone_string = self::get_valid_timezone_string($timezone_string);
324
+		$TimeZone = new DateTimeZone($timezone_string);
326 325
 
327
-		$DateTime = new DateTime( '@' . $unix_timestamp, $TimeZone );
328
-		$offset = timezone_offset_get( $TimeZone, $DateTime );
329
-		return (int)$DateTime->format( 'U' ) + (int)$offset;
326
+		$DateTime = new DateTime('@'.$unix_timestamp, $TimeZone);
327
+		$offset = timezone_offset_get($TimeZone, $DateTime);
328
+		return (int) $DateTime->format('U') + (int) $offset;
330 329
 	}
331 330
 
332 331
 
@@ -341,17 +340,17 @@  discard block
 block discarded – undo
341 340
 	 * @param  string					$datetime_field_name 	the datetime fieldname to be manipulated
342 341
 	 * @return 	EE_Base_Class
343 342
 	 */
344
-	protected static function _set_date_time_field( EE_Base_Class $obj, DateTime $DateTime, $datetime_field_name ) {
343
+	protected static function _set_date_time_field(EE_Base_Class $obj, DateTime $DateTime, $datetime_field_name) {
345 344
 		// grab current datetime format
346 345
 		$current_format = $obj->get_format();
347 346
 		// set new full timestamp format
348
-		$obj->set_date_format( EE_Datetime_Field::mysql_date_format );
349
-		$obj->set_time_format( EE_Datetime_Field::mysql_time_format );
347
+		$obj->set_date_format(EE_Datetime_Field::mysql_date_format);
348
+		$obj->set_time_format(EE_Datetime_Field::mysql_time_format);
350 349
 		// set the new date value using a full timestamp format so that no data is lost
351
-		$obj->set( $datetime_field_name, $DateTime->format( EE_Datetime_Field::mysql_timestamp_format ) );
350
+		$obj->set($datetime_field_name, $DateTime->format(EE_Datetime_Field::mysql_timestamp_format));
352 351
 		// reset datetime formats
353
-		$obj->set_date_format( $current_format[0] );
354
-		$obj->set_time_format( $current_format[1] );
352
+		$obj->set_date_format($current_format[0]);
353
+		$obj->set_time_format($current_format[1]);
355 354
 		return $obj;
356 355
 	}
357 356
 
@@ -368,11 +367,11 @@  discard block
 block discarded – undo
368 367
 	 * @param  integer 	$value    what you want to increment the time by
369 368
 	 * @return EE_Base_Class		   return the EE_Base_Class object so right away you can do something with it (chaining)
370 369
 	 */
371
-	public static function date_time_add( EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1 ) {
370
+	public static function date_time_add(EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1) {
372 371
 		//get the raw UTC date.
373
-		$DateTime = $obj->get_DateTime_object( $datetime_field_name );
374
-		$DateTime = EEH_DTT_Helper::calc_date( $DateTime, $period, $value );
375
-		return EEH_DTT_Helper::_set_date_time_field( $obj, $DateTime, $datetime_field_name );
372
+		$DateTime = $obj->get_DateTime_object($datetime_field_name);
373
+		$DateTime = EEH_DTT_Helper::calc_date($DateTime, $period, $value);
374
+		return EEH_DTT_Helper::_set_date_time_field($obj, $DateTime, $datetime_field_name);
376 375
 	}
377 376
 
378 377
 
@@ -387,11 +386,11 @@  discard block
 block discarded – undo
387 386
 	 * @param int            $value
388 387
 	 * @return \EE_Base_Class
389 388
 	 */
390
-	public static function date_time_subtract( EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1 ) {
389
+	public static function date_time_subtract(EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1) {
391 390
 		//get the raw UTC date
392
-		$DateTime = $obj->get_DateTime_object( $datetime_field_name );
393
-		$DateTime = EEH_DTT_Helper::calc_date( $DateTime, $period, $value, '-' );
394
-		return EEH_DTT_Helper::_set_date_time_field( $obj, $DateTime, $datetime_field_name );
391
+		$DateTime = $obj->get_DateTime_object($datetime_field_name);
392
+		$DateTime = EEH_DTT_Helper::calc_date($DateTime, $period, $value, '-');
393
+		return EEH_DTT_Helper::_set_date_time_field($obj, $DateTime, $datetime_field_name);
395 394
 	}
396 395
 
397 396
 
@@ -404,44 +403,44 @@  discard block
 block discarded – undo
404 403
 	 * @return \DateTime return whatever type came in.
405 404
 	 * @throws \EE_Error
406 405
 	 */
407
-	protected static function _modify_datetime_object( DateTime $DateTime, $period = 'years', $value = 1, $operand = '+' ) {
408
-		if ( ! $DateTime instanceof DateTime ) {
406
+	protected static function _modify_datetime_object(DateTime $DateTime, $period = 'years', $value = 1, $operand = '+') {
407
+		if ( ! $DateTime instanceof DateTime) {
409 408
 			throw new EE_Error(
410 409
 				sprintf(
411
-					__( 'Expected a PHP DateTime object, but instead received %1$s', 'event_espresso' ),
412
-					print_r( $DateTime, true )
410
+					__('Expected a PHP DateTime object, but instead received %1$s', 'event_espresso'),
411
+					print_r($DateTime, true)
413 412
 				)
414 413
 			);
415 414
 		}
416
-		switch ( $period ) {
415
+		switch ($period) {
417 416
 			case 'years' :
418
-				$value = 'P' . $value . 'Y';
417
+				$value = 'P'.$value.'Y';
419 418
 				break;
420 419
 			case 'months' :
421
-				$value = 'P' . $value . 'M';
420
+				$value = 'P'.$value.'M';
422 421
 				break;
423 422
 			case 'weeks' :
424
-				$value = 'P' . $value . 'W';
423
+				$value = 'P'.$value.'W';
425 424
 				break;
426 425
 			case 'days' :
427
-				$value = 'P' . $value . 'D';
426
+				$value = 'P'.$value.'D';
428 427
 				break;
429 428
 			case 'hours' :
430
-				$value = 'PT' . $value . 'H';
429
+				$value = 'PT'.$value.'H';
431 430
 				break;
432 431
 			case 'minutes' :
433
-				$value = 'PT' . $value . 'M';
432
+				$value = 'PT'.$value.'M';
434 433
 				break;
435 434
 			case 'seconds' :
436
-				$value = 'PT' . $value . 'S';
435
+				$value = 'PT'.$value.'S';
437 436
 				break;
438 437
 		}
439
-		switch ( $operand ) {
438
+		switch ($operand) {
440 439
 			case '+':
441
-				$DateTime->add( new DateInterval( $value ) );
440
+				$DateTime->add(new DateInterval($value));
442 441
 				break;
443 442
 			case '-':
444
-				$DateTime->sub( new DateInterval( $value ) );
443
+				$DateTime->sub(new DateInterval($value));
445 444
 				break;
446 445
 		}
447 446
 		return $DateTime;
@@ -457,16 +456,16 @@  discard block
 block discarded – undo
457 456
 	 * @return \DateTime return whatever type came in.
458 457
 	 * @throws \EE_Error
459 458
 	 */
460
-	protected static function _modify_timestamp( $timestamp, $period = 'years', $value = 1, $operand = '+' ) {
461
-		if ( ! preg_match( EE_Datetime_Field::unix_timestamp_regex, $timestamp ) ) {
459
+	protected static function _modify_timestamp($timestamp, $period = 'years', $value = 1, $operand = '+') {
460
+		if ( ! preg_match(EE_Datetime_Field::unix_timestamp_regex, $timestamp)) {
462 461
 			throw new EE_Error(
463 462
 				sprintf(
464
-					__( 'Expected a Unix timestamp, but instead received %1$s', 'event_espresso' ),
465
-					print_r( $timestamp, true )
463
+					__('Expected a Unix timestamp, but instead received %1$s', 'event_espresso'),
464
+					print_r($timestamp, true)
466 465
 				)
467 466
 			);
468 467
 		}
469
-		switch ( $period ) {
468
+		switch ($period) {
470 469
 			case 'years' :
471 470
 				$value = YEAR_IN_SECONDS * $value;
472 471
 				break;
@@ -486,9 +485,9 @@  discard block
 block discarded – undo
486 485
 				$value = MINUTE_IN_SECONDS * $value;
487 486
 				break;
488 487
 		}
489
-		switch ( $operand ) {
488
+		switch ($operand) {
490 489
 			case '+':
491
-				$timestamp  += $value;
490
+				$timestamp += $value;
492 491
 				break;
493 492
 			case '-':
494 493
 				$timestamp -= $value;
@@ -508,11 +507,11 @@  discard block
 block discarded – undo
508 507
 	 * @param  string  $operand What operand you wish to use for the calculation
509 508
 	 * @return mixed string|DateTime          return whatever type came in.
510 509
 	 */
511
-	public static function calc_date( $DateTime_or_timestamp, $period = 'years', $value = 1, $operand = '+' ) {
512
-		if ( $DateTime_or_timestamp instanceof DateTime ) {
513
-			return EEH_DTT_Helper::_modify_datetime_object( $DateTime_or_timestamp, $period, $value, $operand );
514
-		} else if ( preg_match( EE_Datetime_Field::unix_timestamp_regex, $DateTime_or_timestamp )) {
515
-			return EEH_DTT_Helper::_modify_timestamp( $DateTime_or_timestamp, $period, $value, $operand );
510
+	public static function calc_date($DateTime_or_timestamp, $period = 'years', $value = 1, $operand = '+') {
511
+		if ($DateTime_or_timestamp instanceof DateTime) {
512
+			return EEH_DTT_Helper::_modify_datetime_object($DateTime_or_timestamp, $period, $value, $operand);
513
+		} else if (preg_match(EE_Datetime_Field::unix_timestamp_regex, $DateTime_or_timestamp)) {
514
+			return EEH_DTT_Helper::_modify_timestamp($DateTime_or_timestamp, $period, $value, $operand);
516 515
 		} else {
517 516
 			//error
518 517
 			return $DateTime_or_timestamp;
@@ -542,24 +541,24 @@  discard block
 block discarded – undo
542 541
 	 * 			'moment' => //date and time format.
543 542
 	 * 		)
544 543
 	 */
545
-	public static function convert_php_to_js_and_moment_date_formats( $date_format_string = null, $time_format_string = null ) {
546
-		if ( $date_format_string === null ) {
547
-			$date_format_string = get_option( 'date_format' );
544
+	public static function convert_php_to_js_and_moment_date_formats($date_format_string = null, $time_format_string = null) {
545
+		if ($date_format_string === null) {
546
+			$date_format_string = get_option('date_format');
548 547
 		}
549 548
 
550
-		if ( $time_format_string === null ) {
551
-			$time_format_string = get_option( 'time_format' );
549
+		if ($time_format_string === null) {
550
+			$time_format_string = get_option('time_format');
552 551
 		}
553 552
 
554
-		$date_format = self::_php_to_js_moment_converter( $date_format_string );
555
-		$time_format = self::_php_to_js_moment_converter( $time_format_string );
553
+		$date_format = self::_php_to_js_moment_converter($date_format_string);
554
+		$time_format = self::_php_to_js_moment_converter($time_format_string);
556 555
 
557 556
 		return array(
558 557
 			'js' => array(
559 558
 				'date' => $date_format['js'],
560 559
 				'time' => $time_format['js']
561 560
 				),
562
-			'moment' => $date_format['moment'] . ' ' . $time_format['moment' ]
561
+			'moment' => $date_format['moment'].' '.$time_format['moment']
563 562
 			);
564 563
 	}
565 564
 
@@ -573,7 +572,7 @@  discard block
 block discarded – undo
573 572
 	 *
574 573
 	 * @return array js and moment formats.
575 574
 	 */
576
-	protected static function _php_to_js_moment_converter( $format_string ) {
575
+	protected static function _php_to_js_moment_converter($format_string) {
577 576
 		/**
578 577
 		 * This is a map of symbols for formats.
579 578
 		 * The index is the php symbol, the equivalent values are in the array.
@@ -730,15 +729,15 @@  discard block
 block discarded – undo
730 729
 		$jquery_ui_format = "";
731 730
 		$moment_format = "";
732 731
 		$escaping = false;
733
-		for ( $i = 0; $i < strlen($format_string); $i++ ) {
732
+		for ($i = 0; $i < strlen($format_string); $i++) {
734 733
 			$char = $format_string[$i];
735
-			if ( $char === '\\' )  { // PHP date format escaping character
734
+			if ($char === '\\') { // PHP date format escaping character
736 735
 				$i++;
737
-				if ( $escaping ) {
736
+				if ($escaping) {
738 737
 					$jquery_ui_format .= $format_string[$i];
739 738
 					$moment_format .= $format_string[$i];
740 739
 				} else {
741
-					$jquery_ui_format .= '\'' . $format_string[$i];
740
+					$jquery_ui_format .= '\''.$format_string[$i];
742 741
 					$moment_format .= $format_string[$i];
743 742
 				}
744 743
 				$escaping = true;
@@ -757,7 +756,7 @@  discard block
 block discarded – undo
757 756
 				}
758 757
 			}
759 758
 		}
760
-		return array( 'js' => $jquery_ui_format, 'moment' => $moment_format );
759
+		return array('js' => $jquery_ui_format, 'moment' => $moment_format);
761 760
 	}
762 761
 
763 762
 
@@ -772,25 +771,25 @@  discard block
 block discarded – undo
772 771
 	 *                           		errors is returned.  So for client code calling, check for is_array() to
773 772
 	 *                           		indicate failed validations.
774 773
 	 */
775
-	public static function validate_format_string( $format_string ) {
774
+	public static function validate_format_string($format_string) {
776 775
 		$error_msg = array();
777 776
 		//time format checks
778
-		switch ( true ) {
779
-			case   strpos( $format_string, 'h' )  !== false  :
780
-			case   strpos( $format_string, 'g' ) !== false :
777
+		switch (true) {
778
+			case   strpos($format_string, 'h') !== false  :
779
+			case   strpos($format_string, 'g') !== false :
781 780
 				/**
782 781
 				 * if the time string has a lowercase 'h' which == 12 hour time format and there
783 782
 				 * is not any ante meridiem format ('a' or 'A').  Then throw an error because its
784 783
 				 * too ambiguous and PHP won't be able to figure out whether 1 = 1pm or 1am.
785 784
 				 */
786
-				if ( strpos( strtoupper( $format_string ), 'A' )  === false ) {
787
-					$error_msg[] = __('There is a  time format for 12 hour time but no  "a" or "A" to indicate am/pm.  Without this distinction, PHP is unable to determine if a "1" for the hour value equals "1pm" or "1am".', 'event_espresso' );
785
+				if (strpos(strtoupper($format_string), 'A') === false) {
786
+					$error_msg[] = __('There is a  time format for 12 hour time but no  "a" or "A" to indicate am/pm.  Without this distinction, PHP is unable to determine if a "1" for the hour value equals "1pm" or "1am".', 'event_espresso');
788 787
 				}
789 788
 				break;
790 789
 
791 790
 		}
792 791
 
793
-		return empty( $error_msg ) ? true : $error_msg;
792
+		return empty($error_msg) ? true : $error_msg;
794 793
 	}
795 794
 
796 795
 
@@ -812,11 +811,11 @@  discard block
 block discarded – undo
812 811
 	 * @param mixed $date_2
813 812
 	 * @return bool
814 813
 	 */
815
-	public static function dates_represent_one_24_hour_date( $date_1, $date_2 ) {
814
+	public static function dates_represent_one_24_hour_date($date_1, $date_2) {
816 815
 
817 816
 		if (
818
-			( ! $date_1 instanceof DateTime || ! $date_2 instanceof DateTime ) ||
819
-			( $date_1->format( EE_Datetime_Field::mysql_time_format ) != '00:00:00' || $date_2->format( EE_Datetime_Field::mysql_time_format ) != '00:00:00' )
817
+			( ! $date_1 instanceof DateTime || ! $date_2 instanceof DateTime) ||
818
+			($date_1->format(EE_Datetime_Field::mysql_time_format) != '00:00:00' || $date_2->format(EE_Datetime_Field::mysql_time_format) != '00:00:00')
820 819
 		) {
821 820
 			return false;
822 821
 		}
@@ -833,11 +832,11 @@  discard block
 block discarded – undo
833 832
 	 * @param string $field_for_interval  The Database field that is the interval is applied to in the query.
834 833
 	 * @return string
835 834
 	 */
836
-	public static function get_sql_query_interval_for_offset( $timezone_string, $field_for_interval ) {
835
+	public static function get_sql_query_interval_for_offset($timezone_string, $field_for_interval) {
837 836
 		try {
838 837
 			/** need to account for timezone offset on the selects */
839
-			$DateTimeZone = new DateTimeZone( $timezone_string );
840
-		} catch ( Exception $e ) {
838
+			$DateTimeZone = new DateTimeZone($timezone_string);
839
+		} catch (Exception $e) {
841 840
 			$DateTimeZone = null;
842 841
 		}
843 842
 
@@ -845,10 +844,10 @@  discard block
 block discarded – undo
845 844
 		 * Note get_option( 'gmt_offset') returns a value in hours, whereas DateTimeZone::getOffset returns values in seconds.
846 845
 		 * Hence we do the calc for DateTimeZone::getOffset.
847 846
 		 */
848
-		$offset = $DateTimeZone instanceof DateTimeZone ? ( $DateTimeZone->getOffset( new DateTime('now') ) ) / HOUR_IN_SECONDS : get_option( 'gmt_offset' );
847
+		$offset = $DateTimeZone instanceof DateTimeZone ? ($DateTimeZone->getOffset(new DateTime('now'))) / HOUR_IN_SECONDS : get_option('gmt_offset');
849 848
 		$query_interval = $offset < 0
850
-			? 'DATE_SUB(' . $field_for_interval . ', INTERVAL ' . $offset*-1 . ' HOUR)'
851
-			: 'DATE_ADD(' . $field_for_interval .', INTERVAL ' . $offset . ' HOUR)';
849
+			? 'DATE_SUB('.$field_for_interval.', INTERVAL '.$offset * -1.' HOUR)'
850
+			: 'DATE_ADD('.$field_for_interval.', INTERVAL '.$offset.' HOUR)';
852 851
 		return $query_interval;
853 852
 	}
854 853
 
Please login to merge, or discard this patch.
core/helpers/EEH_Debug_Tools.helper.php 3 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.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -392,7 +392,7 @@
 block discarded – undo
392 392
 	 *    @ access public
393 393
 	 *    @ return void
394 394
 	 *
395
-	 * @param mixed $var
395
+	 * @param string $var
396 396
 	 * @param bool $var_name
397 397
 	 * @param string $file
398 398
 	 * @param int $line
Please login to merge, or discard this patch.
Spacing   +137 added lines, -137 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,21 +57,21 @@  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
-		$plugin = basename( EE_PLUGIN_DIR_PATH );
72
-		add_action( "activate_{$plugin}", array( 'EEH_Debug_Tools', 'ee_plugin_activation_errors' ));
73
-		add_action( 'activated_plugin', array( 'EEH_Debug_Tools', 'ee_plugin_activation_errors' ));
74
-		add_action( 'shutdown', array( 'EEH_Debug_Tools', 'show_db_name' ));
71
+		$plugin = basename(EE_PLUGIN_DIR_PATH);
72
+		add_action("activate_{$plugin}", array('EEH_Debug_Tools', 'ee_plugin_activation_errors'));
73
+		add_action('activated_plugin', array('EEH_Debug_Tools', 'ee_plugin_activation_errors'));
74
+		add_action('shutdown', array('EEH_Debug_Tools', 'show_db_name'));
75 75
 	}
76 76
 
77 77
 
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	 * 	@return void
83 83
 	 */
84 84
 	public static function show_db_name() {
85
-		if ( ! defined( 'DOING_AJAX' ) && ( defined( 'EE_ERROR_EMAILS' ) && EE_ERROR_EMAILS )) {
86
-			echo '<p style="font-size:10px;font-weight:normal;color:#E76700;margin: 1em 2em; text-align: right;">DB_NAME: '. DB_NAME .'</p>';
85
+		if ( ! defined('DOING_AJAX') && (defined('EE_ERROR_EMAILS') && EE_ERROR_EMAILS)) {
86
+			echo '<p style="font-size:10px;font-weight:normal;color:#E76700;margin: 1em 2em; text-align: right;">DB_NAME: '.DB_NAME.'</p>';
87 87
 		}
88 88
 	}
89 89
 
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
 	 * 	@return void
96 96
 	 */
97 97
 	public function espresso_session_footer_dump() {
98
-		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' )) {
99
-			Kint::dump(  EE_Registry::instance()->SSN->id() );
100
-			Kint::dump( EE_Registry::instance()->SSN );
98
+		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')) {
99
+			Kint::dump(EE_Registry::instance()->SSN->id());
100
+			Kint::dump(EE_Registry::instance()->SSN);
101 101
 			//			Kint::dump( EE_Registry::instance()->SSN->get_session_data('cart')->get_tickets() );
102 102
 			$this->espresso_list_hooked_functions();
103 103
 			$this->show_times();
@@ -114,27 +114,27 @@  discard block
 block discarded – undo
114 114
 	 * @param bool $tag
115 115
 	 * @return void
116 116
 	 */
117
-	public function espresso_list_hooked_functions( $tag=FALSE ){
117
+	public function espresso_list_hooked_functions($tag = FALSE) {
118 118
 		global $wp_filter;
119 119
 		echo '<br/><br/><br/><h3>Hooked Functions</h3>';
120
-		if ( $tag ) {
121
-			$hook[$tag]=$wp_filter[$tag];
122
-			if ( ! is_array( $hook[$tag] )) {
123
-				trigger_error( "Nothing found for '$tag' hook", E_USER_WARNING );
120
+		if ($tag) {
121
+			$hook[$tag] = $wp_filter[$tag];
122
+			if ( ! is_array($hook[$tag])) {
123
+				trigger_error("Nothing found for '$tag' hook", E_USER_WARNING);
124 124
 				return;
125 125
 			}
126
-			echo '<h5>For Tag: '. $tag .'</h5>';
126
+			echo '<h5>For Tag: '.$tag.'</h5>';
127 127
 		}
128 128
 		else {
129
-			$hook=$wp_filter;
130
-			ksort( $hook );
129
+			$hook = $wp_filter;
130
+			ksort($hook);
131 131
 		}
132
-		foreach( $hook as $tag => $priorities ) {
132
+		foreach ($hook as $tag => $priorities) {
133 133
 			echo "<br />&gt;&gt;&gt;&gt;&gt;\t<strong>$tag</strong><br />";
134
-			ksort( $priorities );
135
-			foreach( $priorities as $priority => $function ){
134
+			ksort($priorities);
135
+			foreach ($priorities as $priority => $function) {
136 136
 				echo $priority;
137
-				foreach( $function as $name => $properties ) {
137
+				foreach ($function as $name => $properties) {
138 138
 					echo "\t$name<br />";
139 139
 				}
140 140
 			}
@@ -150,15 +150,15 @@  discard block
 block discarded – undo
150 150
 	 * @param string $hook_name
151 151
 	 * @return array
152 152
 	 */
153
-	public static function registered_filter_callbacks( $hook_name = '' ) {
153
+	public static function registered_filter_callbacks($hook_name = '') {
154 154
 		$filters = array();
155 155
 		global $wp_filter;
156
-		if ( isset( $wp_filter[ $hook_name ] ) ) {
157
-			$filters[ $hook_name ] = array();
158
-			foreach ( $wp_filter[ $hook_name ] as $priority => $callbacks ) {
159
-				$filters[ $hook_name ][ $priority ] = array();
160
-				foreach ( $callbacks as $callback ) {
161
-					$filters[ $hook_name ][ $priority ][] = $callback['function'];
156
+		if (isset($wp_filter[$hook_name])) {
157
+			$filters[$hook_name] = array();
158
+			foreach ($wp_filter[$hook_name] as $priority => $callbacks) {
159
+				$filters[$hook_name][$priority] = array();
160
+				foreach ($callbacks as $callback) {
161
+					$filters[$hook_name][$priority][] = $callback['function'];
162 162
 				}
163 163
 			}
164 164
 		}
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 	 * 	start_timer
172 172
 	 * @param null $timer_name
173 173
 	 */
174
-	public function start_timer( $timer_name = NULL ){
175
-		$this->_start_times[$timer_name] = microtime( TRUE );
174
+	public function start_timer($timer_name = NULL) {
175
+		$this->_start_times[$timer_name] = microtime(TRUE);
176 176
 	}
177 177
 
178 178
 
@@ -181,15 +181,15 @@  discard block
 block discarded – undo
181 181
 	 * stop_timer
182 182
 	 * @param string $timer_name
183 183
 	 */
184
-	public function stop_timer($timer_name = 'default'){
185
-		if( isset( $this->_start_times[ $timer_name ] ) ){
186
-			$start_time = $this->_start_times[ $timer_name ];
187
-			unset( $this->_start_times[ $timer_name ] );
188
-		}else{
189
-			$start_time = array_pop( $this->_start_times );
184
+	public function stop_timer($timer_name = 'default') {
185
+		if (isset($this->_start_times[$timer_name])) {
186
+			$start_time = $this->_start_times[$timer_name];
187
+			unset($this->_start_times[$timer_name]);
188
+		} else {
189
+			$start_time = array_pop($this->_start_times);
190 190
 		}
191
-		$total_time = microtime( TRUE ) - $start_time;
192
-		switch ( $total_time ) {
191
+		$total_time = microtime(TRUE) - $start_time;
192
+		switch ($total_time) {
193 193
 			case $total_time < 0.00001 :
194 194
 				$color = '#8A549A';
195 195
 				$bold = 'normal';
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 				$bold = 'bold';
216 216
 				break;
217 217
 		}
218
-		$this->_times[] = '<hr /><div style="display: inline-block; min-width: 10px; margin:0 1em; color:'.$color.'; font-weight:'.$bold.'; font-size:1.2em;">' . number_format( $total_time, 8 ) . '</div> ' . $timer_name;
218
+		$this->_times[] = '<hr /><div style="display: inline-block; min-width: 10px; margin:0 1em; color:'.$color.'; font-weight:'.$bold.'; font-size:1.2em;">'.number_format($total_time, 8).'</div> '.$timer_name;
219 219
 	}
220 220
 	/**
221 221
 	 * Measure the memory usage by PHP so far.
@@ -223,10 +223,10 @@  discard block
 block discarded – undo
223 223
 	 * @param boolean $output_now whether to echo now, or wait until EEH_Debug_Tools::show_times() is called
224 224
 	 * @return void
225 225
 	 */
226
-	public function measure_memory( $label, $output_now = false ) {
227
-		$memory_used = $this->convert( memory_get_peak_usage( true ) );
228
-		$this->_memory_usage_points[ $label ] = $memory_used;
229
-		if( $output_now ) {
226
+	public function measure_memory($label, $output_now = false) {
227
+		$memory_used = $this->convert(memory_get_peak_usage(true));
228
+		$this->_memory_usage_points[$label] = $memory_used;
229
+		if ($output_now) {
230 230
 			echo "\r\n<br>$label : $memory_used";
231 231
 		}
232 232
 	}
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
 	 * @param int $size
237 237
 	 * @return string
238 238
 	 */
239
-	public function convert( $size ) {
240
-		$unit=array('b','kb','mb','gb','tb','pb');
241
-		return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[ absint( $i ) ];
239
+	public function convert($size) {
240
+		$unit = array('b', 'kb', 'mb', 'gb', 'tb', 'pb');
241
+		return @round($size / pow(1024, ($i = floor(log($size, 1024)))), 2).' '.$unit[absint($i)];
242 242
 	}
243 243
 
244 244
 
@@ -248,9 +248,9 @@  discard block
 block discarded – undo
248 248
 	 * @param bool $output_now
249 249
 	 * @return string
250 250
 	 */
251
-	public function show_times($output_now=true){
252
-		$output = '<h2>Times:</h2>' . implode("<br>",$this->_times) . '<h2>Memory</h2>' . implode('<br>', $this->_memory_usage_points );
253
-		if($output_now){
251
+	public function show_times($output_now = true) {
252
+		$output = '<h2>Times:</h2>'.implode("<br>", $this->_times).'<h2>Memory</h2>'.implode('<br>', $this->_memory_usage_points);
253
+		if ($output_now) {
254 254
 			echo $output;
255 255
 			return '';
256 256
 		}
@@ -265,25 +265,25 @@  discard block
 block discarded – undo
265 265
 	 * 	@return void
266 266
 	 */
267 267
 	public static function ee_plugin_activation_errors() {
268
-		if ( WP_DEBUG ) {
268
+		if (WP_DEBUG) {
269 269
 			$activation_errors = ob_get_contents();
270
-			if ( ! empty( $activation_errors ) ) {
271
-				$activation_errors = date( 'Y-m-d H:i:s' ) . "\n" . $activation_errors;
270
+			if ( ! empty($activation_errors)) {
271
+				$activation_errors = date('Y-m-d H:i:s')."\n".$activation_errors;
272 272
 			}
273
-			espresso_load_required( 'EEH_File', EE_HELPERS . 'EEH_File.helper.php' );
274
-			if ( class_exists( 'EEH_File' )) {
273
+			espresso_load_required('EEH_File', EE_HELPERS.'EEH_File.helper.php');
274
+			if (class_exists('EEH_File')) {
275 275
 				try {
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() ), __FILE__, __FUNCTION__, __LINE__ );
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()), __FILE__, __FUNCTION__, __LINE__);
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,22 +299,22 @@  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
-		$error_message = sprintf( esc_html__('%1$s was called %2$sincorrectly%3$s. %4$s %5$s','event_espresso' ), $function, '<strong>', '</strong>', $message, $version );
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
+		$error_message = sprintf(esc_html__('%1$s was called %2$sincorrectly%3$s. %4$s %5$s', 'event_espresso'), $function, '<strong>', '</strong>', $message, $version);
306 306
 
307 307
 		//don't trigger error if doing ajax, instead we'll add a transient EE_Error notice that in theory should show on the next request.
308
-		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
309
-			$error_message .= esc_html__( 'This is a doing_it_wrong message that was triggered during an ajax request.  The request params on this request were: ', 'event_espresso' );
308
+		if (defined('DOING_AJAX') && DOING_AJAX) {
309
+			$error_message .= esc_html__('This is a doing_it_wrong message that was triggered during an ajax request.  The request params on this request were: ', 'event_espresso');
310 310
 			$error_message .= '<ul><li>';
311
-			$error_message .= implode( '</li><li>', EE_Registry::instance()->REQ->params() );
311
+			$error_message .= implode('</li><li>', EE_Registry::instance()->REQ->params());
312 312
 			$error_message .= '</ul>';
313
-			EE_Error::add_error( $error_message, 'debug::doing_it_wrong', $function, '42' );
313
+			EE_Error::add_error($error_message, 'debug::doing_it_wrong', $function, '42');
314 314
 			//now we set this on the transient so it shows up on the next request.
315
-			EE_Error::get_notices( is_admin(), true );
315
+			EE_Error::get_notices(is_admin(), true);
316 316
 		} else {
317
-			trigger_error( $error_message, $error_type );
317
+			trigger_error($error_message, $error_type);
318 318
 		}
319 319
 	}
320 320
 
@@ -336,22 +336,22 @@  discard block
 block discarded – undo
336 336
 	 * @param string $debug_index
337 337
 	 * @param string $debug_key
338 338
 	 */
339
-	public static function log( $class='', $func = '', $line = '', $info = array(), $display_request = false,  $debug_index = '', $debug_key = 'EE_DEBUG_SPCO' ) {
340
-		if ( WP_DEBUG && false ) {
341
-			$debug_key = $debug_key . '_' . EE_Session::instance()->id();
342
-			$debug_data = get_option( $debug_key, array() );
339
+	public static function log($class = '', $func = '', $line = '', $info = array(), $display_request = false, $debug_index = '', $debug_key = 'EE_DEBUG_SPCO') {
340
+		if (WP_DEBUG && false) {
341
+			$debug_key = $debug_key.'_'.EE_Session::instance()->id();
342
+			$debug_data = get_option($debug_key, array());
343 343
 			$default_data = array(
344
-				$class => $func . '() : ' . $line,
344
+				$class => $func.'() : '.$line,
345 345
 				'REQ'  => $display_request ? $_REQUEST : '',
346 346
 			);
347 347
 			// don't serialize objects
348
-			$info = self::strip_objects( $info );
349
-			$index = ! empty( $debug_index ) ? $debug_index : 0;
350
-			if ( ! isset( $debug_data[$index] ) ) {
348
+			$info = self::strip_objects($info);
349
+			$index = ! empty($debug_index) ? $debug_index : 0;
350
+			if ( ! isset($debug_data[$index])) {
351 351
 				$debug_data[$index] = array();
352 352
 			}
353
-			$debug_data[$index][microtime()] = array_merge( $default_data, $info );
354
-			update_option( $debug_key, $debug_data );
353
+			$debug_data[$index][microtime()] = array_merge($default_data, $info);
354
+			update_option($debug_key, $debug_data);
355 355
 		}
356 356
 	}
357 357
 
@@ -363,26 +363,26 @@  discard block
 block discarded – undo
363 363
 	 * @param array $info
364 364
 	 * @return array
365 365
 	 */
366
-	public static function strip_objects( $info = array() ) {
367
-		foreach ( $info as $key => $value ) {
368
-			if ( is_array( $value ) ) {
369
-				$info[ $key ] = self::strip_objects( $value );
370
-			} else if ( is_object( $value ) ) {
371
-				$object_class = get_class( $value );
372
-				$info[ $object_class ] = array();
373
-				$info[ $object_class ][ 'ID' ] = method_exists( $value, 'ID' ) ? $value->ID() : spl_object_hash( $value );
374
-				if ( method_exists( $value, 'ID' ) ) {
375
-					$info[ $object_class ][ 'ID' ] = $value->ID();
366
+	public static function strip_objects($info = array()) {
367
+		foreach ($info as $key => $value) {
368
+			if (is_array($value)) {
369
+				$info[$key] = self::strip_objects($value);
370
+			} else if (is_object($value)) {
371
+				$object_class = get_class($value);
372
+				$info[$object_class] = array();
373
+				$info[$object_class]['ID'] = method_exists($value, 'ID') ? $value->ID() : spl_object_hash($value);
374
+				if (method_exists($value, 'ID')) {
375
+					$info[$object_class]['ID'] = $value->ID();
376 376
 				}
377
-				if ( method_exists( $value, 'status' ) ) {
378
-					$info[ $object_class ][ 'status' ] = $value->status();
379
-				} else if ( method_exists( $value, 'status_ID' ) ) {
380
-					$info[ $object_class ][ 'status' ] = $value->status_ID();
377
+				if (method_exists($value, 'status')) {
378
+					$info[$object_class]['status'] = $value->status();
379
+				} else if (method_exists($value, 'status_ID')) {
380
+					$info[$object_class]['status'] = $value->status_ID();
381 381
 				}
382
-				unset( $info[ $key ] );
382
+				unset($info[$key]);
383 383
 			}
384 384
 		}
385
-		return (array)$info;
385
+		return (array) $info;
386 386
 	}
387 387
 
388 388
 
@@ -399,24 +399,24 @@  discard block
 block discarded – undo
399 399
 	 * @param int $header
400 400
 	 * @param bool $die
401 401
 	 */
402
-	public static function printv( $var, $var_name = false, $file = __FILE__, $line = __LINE__, $header = 5, $die = false ) {
402
+	public static function printv($var, $var_name = false, $file = __FILE__, $line = __LINE__, $header = 5, $die = false) {
403 403
 		$var_name = ! $var_name ? 'string' : $var_name;
404 404
 		$heading_tag = 'h';
405
-		$heading_tag .= is_int( $header ) ? $header : 5;
406
-		$var_name = ucwords( str_replace( '$', '', $var_name ) );
407
-		$is_method = method_exists( $var_name, $var );
408
-		$var_name = ucwords( str_replace( '_', ' ', $var_name ) );
405
+		$heading_tag .= is_int($header) ? $header : 5;
406
+		$var_name = ucwords(str_replace('$', '', $var_name));
407
+		$is_method = method_exists($var_name, $var);
408
+		$var_name = ucwords(str_replace('_', ' ', $var_name));
409 409
 		ob_start();
410
-		echo '<' . $heading_tag . ' style="color:#2EA2CC; margin:25px 0 0;"><b>' . $var_name . '</b>';
410
+		echo '<'.$heading_tag.' style="color:#2EA2CC; margin:25px 0 0;"><b>'.$var_name.'</b>';
411 411
 		echo $is_method
412
-			? '<span style="color:#999">::</span><span style="color:#E76700">' . $var . '()</span><br />'
413
-			: '<span style="color:#999"> : </span><span style="color:#E76700">' . $var . '</span><br />';
414
-		echo '<span style="font-size:9px;font-weight:normal;color:#666;line-height: 12px;">' . $file;
415
-		echo '<br />line no: ' . $line . '</span>';
416
-		echo '</' . $heading_tag . '>';
412
+			? '<span style="color:#999">::</span><span style="color:#E76700">'.$var.'()</span><br />'
413
+			: '<span style="color:#999"> : </span><span style="color:#E76700">'.$var.'</span><br />';
414
+		echo '<span style="font-size:9px;font-weight:normal;color:#666;line-height: 12px;">'.$file;
415
+		echo '<br />line no: '.$line.'</span>';
416
+		echo '</'.$heading_tag.'>';
417 417
 		$result = ob_get_clean();
418
-		if ( $die ) {
419
-			die( $result );
418
+		if ($die) {
419
+			die($result);
420 420
 		} else {
421 421
 			echo $result;
422 422
 		}
@@ -435,36 +435,36 @@  discard block
 block discarded – undo
435 435
 	 * @param int $header
436 436
 	 * @param bool $die
437 437
 	 */
438
-	public static function printr( $var, $var_name = false, $file = __FILE__, $line = __LINE__, $header = 5, $die = false ) {
439
-		$file = str_replace( rtrim( ABSPATH, '\\/' ), '', $file );
438
+	public static function printr($var, $var_name = false, $file = __FILE__, $line = __LINE__, $header = 5, $die = false) {
439
+		$file = str_replace(rtrim(ABSPATH, '\\/'), '', $file);
440 440
 		//$print_r = false;
441
-		if ( is_string( $var ) ) {
442
-			EEH_Debug_Tools::printv( $var, $var_name, $file, $line, $header, $die );
441
+		if (is_string($var)) {
442
+			EEH_Debug_Tools::printv($var, $var_name, $file, $line, $header, $die);
443 443
 			return;
444
-		} else if ( is_object( $var ) ) {
444
+		} else if (is_object($var)) {
445 445
 			$var_name = ! $var_name ? 'object' : $var_name;
446 446
 			//$print_r = true;
447
-		} else if ( is_array( $var ) ) {
447
+		} else if (is_array($var)) {
448 448
 			$var_name = ! $var_name ? 'array' : $var_name;
449 449
 			//$print_r = true;
450
-		} else if ( is_numeric( $var ) ) {
450
+		} else if (is_numeric($var)) {
451 451
 			$var_name = ! $var_name ? 'numeric' : $var_name;
452
-		} else if ( is_null( $var ) ) {
452
+		} else if (is_null($var)) {
453 453
 			$var_name = ! $var_name ? 'null' : $var_name;
454 454
 		}
455 455
 		$heading_tag = 'h';
456
-		$heading_tag .= is_int( $header ) ? $header : 5;
457
-		$var_name = ucwords( str_replace( array( '$', '_' ), array( '', ' ' ), $var_name ) );
456
+		$heading_tag .= is_int($header) ? $header : 5;
457
+		$var_name = ucwords(str_replace(array('$', '_'), array('', ' '), $var_name));
458 458
 		ob_start();
459
-		echo '<' . $heading_tag . ' style="color:#2EA2CC; margin:25px 0 0;"><b>' . $var_name . '</b>';
459
+		echo '<'.$heading_tag.' style="color:#2EA2CC; margin:25px 0 0;"><b>'.$var_name.'</b>';
460 460
 		echo '<span style="color:#999;"> : </span><span style="color:#E76700;">';
461 461
 		echo '<pre style="color:#999; padding:1em; background: #fff">';
462
-		var_dump( $var );
463
-		echo '</pre></span><br /><span style="font-size:9px;font-weight:normal;color:#666;line-height: 12px;">' . $file;
464
-		echo '<br />line no: ' . $line . '</span></' . $heading_tag . '>';
462
+		var_dump($var);
463
+		echo '</pre></span><br /><span style="font-size:9px;font-weight:normal;color:#666;line-height: 12px;">'.$file;
464
+		echo '<br />line no: '.$line.'</span></'.$heading_tag.'>';
465 465
 		$result = ob_get_clean();
466
-		if ( $die ) {
467
-			die( $result );
466
+		if ($die) {
467
+			die($result);
468 468
 		} else {
469 469
 			echo $result;
470 470
 		}
@@ -481,8 +481,8 @@  discard block
 block discarded – undo
481 481
  * borrowed from Kint Debugger
482 482
  * Plugin URI: http://upthemes.com/plugins/kint-debugger/
483 483
  */
484
-if ( class_exists('Kint') && ! function_exists( 'dump_wp_query' ) ) {
485
-	function dump_wp_query(){
484
+if (class_exists('Kint') && ! function_exists('dump_wp_query')) {
485
+	function dump_wp_query() {
486 486
 		global $wp_query;
487 487
 		d($wp_query);
488 488
 	}
@@ -492,8 +492,8 @@  discard block
 block discarded – undo
492 492
  * borrowed from Kint Debugger
493 493
  * Plugin URI: http://upthemes.com/plugins/kint-debugger/
494 494
  */
495
-if ( class_exists('Kint') && ! function_exists( 'dump_wp' ) ) {
496
-	function dump_wp(){
495
+if (class_exists('Kint') && ! function_exists('dump_wp')) {
496
+	function dump_wp() {
497 497
 		global $wp;
498 498
 		d($wp);
499 499
 	}
@@ -503,8 +503,8 @@  discard block
 block discarded – undo
503 503
  * borrowed from Kint Debugger
504 504
  * Plugin URI: http://upthemes.com/plugins/kint-debugger/
505 505
  */
506
-if ( class_exists('Kint') && ! function_exists( 'dump_post' ) ) {
507
-	function dump_post(){
506
+if (class_exists('Kint') && ! function_exists('dump_post')) {
507
+	function dump_post() {
508 508
 		global $post;
509 509
 		d($post);
510 510
 	}
Please login to merge, or discard this patch.
core/helpers/EEH_Event_Query.helper.php 3 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -2,19 +2,19 @@
 block discarded – undo
2 2
 	exit( 'No direct script access allowed' );
3 3
 }
4 4
 /**
5
- * Event Espresso
6
- *
7
- * Event Registration and Ticketing Management Plugin for WordPress
8
- *
9
- * @ package            Event Espresso
10
- * @ author                Event Espresso
11
- * @ copyright        (c) 2008-2014 Event Espresso  All Rights Reserved.
12
- * @ license            http://eventespresso.com/support/terms-conditions/   * see Plugin Licensing *
13
- * @ link                    http://www.eventespresso.com
14
- * @ version            $VID:$
15
- *
16
- * ------------------------------------------------------------------------
17
- */
5
+	 * Event Espresso
6
+	 *
7
+	 * Event Registration and Ticketing Management Plugin for WordPress
8
+	 *
9
+	 * @ package            Event Espresso
10
+	 * @ author                Event Espresso
11
+	 * @ copyright        (c) 2008-2014 Event Espresso  All Rights Reserved.
12
+	 * @ license            http://eventespresso.com/support/terms-conditions/   * see Plugin Licensing *
13
+	 * @ link                    http://www.eventespresso.com
14
+	 * @ version            $VID:$
15
+	 *
16
+	 * ------------------------------------------------------------------------
17
+	 */
18 18
 
19 19
 
20 20
 
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.
Spacing   +118 added lines, -118 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,10 +221,10 @@  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
 			global $wpdb;
227
-			$clauses['groupby'] = $wpdb->posts . '.ID ';
227
+			$clauses['groupby'] = $wpdb->posts.'.ID ';
228 228
 		}
229 229
 		return $clauses;
230 230
 	}
@@ -239,10 +239,10 @@  discard block
 block discarded – undo
239 239
 	 * @param WP_Query $wp_query
240 240
 	 * @return    string
241 241
 	 */
242
-	public static function posts_fields( $SQL, WP_Query $wp_query ) {
243
-		if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) {
242
+	public static function posts_fields($SQL, WP_Query $wp_query) {
243
+		if (EEH_Event_Query::apply_query_filters($wp_query)) {
244 244
 			// adds something like ", wp_esp_datetime.* " to WP Query SELECT statement
245
-			$SQL .= EEH_Event_Query::posts_fields_sql_for_orderby( EEH_Event_Query::$_event_query_orderby );
245
+			$SQL .= EEH_Event_Query::posts_fields_sql_for_orderby(EEH_Event_Query::$_event_query_orderby);
246 246
 		}
247 247
 		return $SQL;
248 248
 	}
@@ -257,29 +257,29 @@  discard block
 block discarded – undo
257 257
 	 * @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
258 258
 	 * @return    string
259 259
 	 */
260
-	public static function posts_fields_sql_for_orderby( $orderby_params = array() ) {
261
-		$SQL = ', MIN( ' . EEM_Datetime::instance()->table() . '.DTT_EVT_start ) as event_start_date ' ;
262
-		foreach( (array)$orderby_params as $orderby ) {
263
-			switch ( $orderby ) {
260
+	public static function posts_fields_sql_for_orderby($orderby_params = array()) {
261
+		$SQL = ', MIN( '.EEM_Datetime::instance()->table().'.DTT_EVT_start ) as event_start_date ';
262
+		foreach ((array) $orderby_params as $orderby) {
263
+			switch ($orderby) {
264 264
 
265 265
 				case 'ticket_start' :
266
-					$SQL .= ', ' . EEM_Ticket::instance()->table() . '.TKT_start_date' ;
266
+					$SQL .= ', '.EEM_Ticket::instance()->table().'.TKT_start_date';
267 267
 					break;
268 268
 
269 269
 				case 'ticket_end' :
270
-					$SQL .= ', ' . EEM_Ticket::instance()->table() . '.TKT_end_date' ;
270
+					$SQL .= ', '.EEM_Ticket::instance()->table().'.TKT_end_date';
271 271
 					break;
272 272
 
273 273
 				case 'venue_title' :
274
-					$SQL .= ', Venue.post_title AS venue_title' ;
274
+					$SQL .= ', Venue.post_title AS venue_title';
275 275
 					break;
276 276
 
277 277
 				case 'city' :
278
-					$SQL .= ', ' . EEM_Venue::instance()->second_table() . '.VNU_city' ;
278
+					$SQL .= ', '.EEM_Venue::instance()->second_table().'.VNU_city';
279 279
 					break;
280 280
 
281 281
 				case 'state' :
282
-					$SQL .= ', ' . EEM_State::instance()->table() . '.STA_name' ;
282
+					$SQL .= ', '.EEM_State::instance()->table().'.STA_name';
283 283
 					break;
284 284
 
285 285
 			}
@@ -297,12 +297,12 @@  discard block
 block discarded – undo
297 297
 	 * @param WP_Query $wp_query
298 298
 	 * @return    string
299 299
 	 */
300
-	public static function posts_join( $SQL = '', WP_Query $wp_query ) {
301
-		if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) {
300
+	public static function posts_join($SQL = '', WP_Query $wp_query) {
301
+		if (EEH_Event_Query::apply_query_filters($wp_query)) {
302 302
 			// Category
303
-			$SQL = EEH_Event_Query::posts_join_sql_for_show_expired( $SQL, EEH_Event_Query::$_event_query_show_expired );
304
-			$SQL = EEH_Event_Query::posts_join_sql_for_terms( $SQL, EEH_Event_Query::$_event_query_category );
305
-			$SQL = EEH_Event_Query::posts_join_for_orderby( $SQL, EEH_Event_Query::$_event_query_orderby );
303
+			$SQL = EEH_Event_Query::posts_join_sql_for_show_expired($SQL, EEH_Event_Query::$_event_query_show_expired);
304
+			$SQL = EEH_Event_Query::posts_join_sql_for_terms($SQL, EEH_Event_Query::$_event_query_category);
305
+			$SQL = EEH_Event_Query::posts_join_for_orderby($SQL, EEH_Event_Query::$_event_query_orderby);
306 306
 		}
307 307
 		return $SQL;
308 308
 	}
@@ -317,11 +317,11 @@  discard block
 block discarded – undo
317 317
 	 * @param    boolean $show_expired if TRUE, then displayed past events
318 318
 	 * @return string
319 319
 	 */
320
-	public static function posts_join_sql_for_show_expired( $SQL = '', $show_expired = FALSE ) {
321
-		if ( ! $show_expired ) {
322
-			$join = EEM_Event::instance()->table() . '.ID = ' . EEM_Datetime::instance()->table() . '.' . EEM_Event::instance()->primary_key_name();
323
-			if ( strpos( $SQL, $join ) === FALSE ) {
324
-				$SQL .= ' INNER JOIN ' . EEM_Datetime::instance()->table() . ' ON ( ' . $join . ' ) ';
320
+	public static function posts_join_sql_for_show_expired($SQL = '', $show_expired = FALSE) {
321
+		if ( ! $show_expired) {
322
+			$join = EEM_Event::instance()->table().'.ID = '.EEM_Datetime::instance()->table().'.'.EEM_Event::instance()->primary_key_name();
323
+			if (strpos($SQL, $join) === FALSE) {
324
+				$SQL .= ' INNER JOIN '.EEM_Datetime::instance()->table().' ON ( '.$join.' ) ';
325 325
 			}
326 326
 		}
327 327
 		return $SQL;
@@ -337,8 +337,8 @@  discard block
 block discarded – undo
337 337
 	 * @param 	string $join_terms pass TRUE or term string, doesn't really matter since this value doesn't really get used for anything yet
338 338
 	 * @return 	string
339 339
 	 */
340
-	public static function posts_join_sql_for_terms( $SQL = '', $join_terms = '' ) {
341
-		if ( ! empty( $join_terms ) ) {
340
+	public static function posts_join_sql_for_terms($SQL = '', $join_terms = '') {
341
+		if ( ! empty($join_terms)) {
342 342
 			global $wpdb;
343 343
 			$SQL .= " LEFT JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id)";
344 344
 			$SQL .= " LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)";
@@ -358,25 +358,25 @@  discard block
 block discarded – undo
358 358
 	 * @param 	array $orderby_params
359 359
 	 * @return 	string
360 360
 	 */
361
-	public static function posts_join_for_orderby( $SQL = '', $orderby_params = array() ) {
362
-		foreach ( (array)$orderby_params as $orderby ) {
363
-			switch ( $orderby ) {
361
+	public static function posts_join_for_orderby($SQL = '', $orderby_params = array()) {
362
+		foreach ((array) $orderby_params as $orderby) {
363
+			switch ($orderby) {
364 364
 				case 'ticket_start' :
365 365
 				case 'ticket_end' :
366
-					$SQL .= EEH_Event_Query::_posts_join_for_datetime( $SQL, EEM_Datetime_Ticket::instance()->table() . '.' . EEM_Datetime::instance()->primary_key_name() );
367
-					$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() . ' )';
366
+					$SQL .= EEH_Event_Query::_posts_join_for_datetime($SQL, EEM_Datetime_Ticket::instance()->table().'.'.EEM_Datetime::instance()->primary_key_name());
367
+					$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().' )';
368 368
 					break;
369 369
 				case 'venue_title' :
370 370
 				case 'city' :
371
-					$SQL .= EEH_Event_Query::_posts_join_for_event_venue( $SQL );
371
+					$SQL .= EEH_Event_Query::_posts_join_for_event_venue($SQL);
372 372
 					break;
373 373
 				case 'state' :
374
-					$SQL .= EEH_Event_Query::_posts_join_for_event_venue( $SQL );
375
-					$SQL .= EEH_Event_Query::_posts_join_for_venue_state( $SQL );
374
+					$SQL .= EEH_Event_Query::_posts_join_for_event_venue($SQL);
375
+					$SQL .= EEH_Event_Query::_posts_join_for_venue_state($SQL);
376 376
 					break;
377 377
 				case 'start_date' :
378 378
 				default :
379
-					$SQL .= EEH_Event_Query::_posts_join_for_datetime( $SQL, EEM_Event::instance()->table() . '.ID' );
379
+					$SQL .= EEH_Event_Query::_posts_join_for_datetime($SQL, EEM_Event::instance()->table().'.ID');
380 380
 					break;
381 381
 
382 382
 			}
@@ -394,11 +394,11 @@  discard block
 block discarded – undo
394 394
 	 * @param string $join
395 395
 	 * @return string
396 396
 	 */
397
-	protected static function _posts_join_for_datetime( $SQL = '', $join = '' ) {
398
-		if ( ! empty( $join )) {
399
-			$join .= ' = ' . EEM_Datetime::instance()->table() . '.' . EEM_Event::instance()->primary_key_name();
400
-			if ( strpos( $SQL, $join ) === FALSE ) {
401
-				return ' INNER JOIN ' . EEM_Datetime::instance()->table() . ' ON ( ' . $join . ' )';
397
+	protected static function _posts_join_for_datetime($SQL = '', $join = '') {
398
+		if ( ! empty($join)) {
399
+			$join .= ' = '.EEM_Datetime::instance()->table().'.'.EEM_Event::instance()->primary_key_name();
400
+			if (strpos($SQL, $join) === FALSE) {
401
+				return ' INNER JOIN '.EEM_Datetime::instance()->table().' ON ( '.$join.' )';
402 402
 			}
403 403
 		}
404 404
 		return '';
@@ -413,13 +413,13 @@  discard block
 block discarded – undo
413 413
 	 * @param string $SQL
414 414
 	 * @return string
415 415
 	 */
416
-	protected static function _posts_join_for_event_venue( $SQL = '' ) {
416
+	protected static function _posts_join_for_event_venue($SQL = '') {
417 417
 		// Event Venue table name
418 418
 		$event_venue_table = EEM_Event_Venue::instance()->table();
419 419
 		// generate conditions for:  Event <=> Event Venue  JOIN clause
420
-		$event_to_event_venue_join = EEM_Event::instance()->table() . '.ID = ' . $event_venue_table . '.' . EEM_Event::instance()->primary_key_name();
420
+		$event_to_event_venue_join = EEM_Event::instance()->table().'.ID = '.$event_venue_table.'.'.EEM_Event::instance()->primary_key_name();
421 421
 		// don't add joins if they have already been added
422
-		if ( strpos( $SQL, $event_to_event_venue_join ) === FALSE ) {
422
+		if (strpos($SQL, $event_to_event_venue_join) === FALSE) {
423 423
 			// Venue table name
424 424
 			$venue_table = EEM_Venue::instance()->table();
425 425
 			// Venue table pk
@@ -432,10 +432,10 @@  discard block
 block discarded – undo
432 432
 			$venue_SQL .= " LEFT JOIN $venue_table as Venue ON ( $event_venue_table.$venue_table_pk = Venue.ID )";
433 433
 			// generate JOIN clause for: Venue <=> Venue Meta
434 434
 			$venue_SQL .= " LEFT JOIN $venue_meta_table ON ( Venue.ID = $venue_meta_table.$venue_table_pk )";
435
-			unset( $event_venue_table, $event_to_event_venue_join, $venue_table, $venue_table_pk, $venue_meta_table );
435
+			unset($event_venue_table, $event_to_event_venue_join, $venue_table, $venue_table_pk, $venue_meta_table);
436 436
 			return $venue_SQL;
437 437
 		}
438
-		unset( $event_venue_table, $event_to_event_venue_join );
438
+		unset($event_venue_table, $event_to_event_venue_join);
439 439
 		return '';
440 440
 	}
441 441
 
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 	 * @param string $SQL
449 449
 	 * @return string
450 450
 	 */
451
-	protected static function _posts_join_for_venue_state( $SQL = '' ) {
451
+	protected static function _posts_join_for_venue_state($SQL = '') {
452 452
 		// Venue Meta table name
453 453
 		$venue_meta_table = EEM_Venue::instance()->second_table();
454 454
 		// State table name
@@ -456,16 +456,16 @@  discard block
 block discarded – undo
456 456
 		// State table pk
457 457
 		$state_table_pk = EEM_State::instance()->primary_key_name();
458 458
 		// verify vars
459
-		if ( $venue_meta_table && $state_table && $state_table_pk ) {
459
+		if ($venue_meta_table && $state_table && $state_table_pk) {
460 460
 			// like: wp_esp_venue_meta.STA_ID = wp_esp_state.STA_ID
461 461
 			$join = "$venue_meta_table.$state_table_pk = $state_table.$state_table_pk";
462 462
 			// don't add join if it has already been added
463
-			if ( strpos( $SQL, $join ) === FALSE ) {
464
-				unset( $state_table_pk, $venue_meta_table, $venue_table_pk );
463
+			if (strpos($SQL, $join) === FALSE) {
464
+				unset($state_table_pk, $venue_meta_table, $venue_table_pk);
465 465
 				return " LEFT JOIN $state_table ON ( $join )";
466 466
 			}
467 467
 		}
468
-		unset( $join, $state_table, $state_table_pk, $venue_meta_table, $venue_table_pk );
468
+		unset($join, $state_table, $state_table_pk, $venue_meta_table, $venue_table_pk);
469 469
 		return '';
470 470
 	}
471 471
 
@@ -479,14 +479,14 @@  discard block
 block discarded – undo
479 479
 	 * @param WP_Query $wp_query
480 480
 	 * @return    string
481 481
 	 */
482
-	public static function posts_where( $SQL = '', WP_Query $wp_query ) {
483
-		if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) {
482
+	public static function posts_where($SQL = '', WP_Query $wp_query) {
483
+		if (EEH_Event_Query::apply_query_filters($wp_query)) {
484 484
 			// Show Expired ?
485
-			$SQL .= EEH_Event_Query::posts_where_sql_for_show_expired( EEH_Event_Query::$_event_query_show_expired  );
485
+			$SQL .= EEH_Event_Query::posts_where_sql_for_show_expired(EEH_Event_Query::$_event_query_show_expired);
486 486
 			// Category
487
-			$SQL .= EEH_Event_Query::posts_where_sql_for_event_category_slug( EEH_Event_Query::$_event_query_category  );
487
+			$SQL .= EEH_Event_Query::posts_where_sql_for_event_category_slug(EEH_Event_Query::$_event_query_category);
488 488
 			// Start Date
489
-			$SQL .= EEH_Event_Query::posts_where_sql_for_event_list_month( EEH_Event_Query::$_event_query_month );
489
+			$SQL .= EEH_Event_Query::posts_where_sql_for_event_list_month(EEH_Event_Query::$_event_query_month);
490 490
 		}
491 491
 		return $SQL;
492 492
 	}
@@ -500,8 +500,8 @@  discard block
 block discarded – undo
500 500
 	 * @param    boolean $show_expired if TRUE, then displayed past events
501 501
 	 * @return    string
502 502
 	 */
503
-	public static function posts_where_sql_for_show_expired( $show_expired = FALSE ) {
504
-		return ! $show_expired ? ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end > "' . current_time( 'mysql', TRUE ) . '" ' : '';
503
+	public static function posts_where_sql_for_show_expired($show_expired = FALSE) {
504
+		return ! $show_expired ? ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_end > "'.current_time('mysql', TRUE).'" ' : '';
505 505
 	}
506 506
 
507 507
 
@@ -513,9 +513,9 @@  discard block
 block discarded – undo
513 513
 	 * @param    boolean $event_category_slug
514 514
 	 * @return    string
515 515
 	 */
516
-	public static function posts_where_sql_for_event_category_slug( $event_category_slug = NULL ) {
516
+	public static function posts_where_sql_for_event_category_slug($event_category_slug = NULL) {
517 517
 		global $wpdb;
518
-		return ! empty( $event_category_slug ) ? ' AND ' . $wpdb->terms . '.slug = "' . $event_category_slug . '" ' : '';
518
+		return ! empty($event_category_slug) ? ' AND '.$wpdb->terms.'.slug = "'.$event_category_slug.'" ' : '';
519 519
 	}
520 520
 
521 521
 
@@ -527,13 +527,13 @@  discard block
 block discarded – undo
527 527
 	 * @param    boolean $month
528 528
 	 * @return    string
529 529
 	 */
530
-	public static function posts_where_sql_for_event_list_month( $month = NULL ) {
530
+	public static function posts_where_sql_for_event_list_month($month = NULL) {
531 531
 		$SQL = '';
532
-		if ( ! empty( $month ) ) {
532
+		if ( ! empty($month)) {
533 533
 			// event start date is LESS than the end of the month ( so nothing that doesn't start until next month )
534
-			$SQL = ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_start <= "' . gmdate( 'Y-m-t 23:59:59', strtotime( $month ) ) . '"';
534
+			$SQL = ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_start <= "'.gmdate('Y-m-t 23:59:59', strtotime($month)).'"';
535 535
 			// event end date is GREATER than the start of the month ( so nothing that ended before this month )
536
-			$SQL .= ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end >= "' . gmdate( 'Y-m-01 0:0:00', strtotime( $month ) ) . '" ';
536
+			$SQL .= ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_end >= "'.gmdate('Y-m-01 0:0:00', strtotime($month)).'" ';
537 537
 		}
538 538
 		return $SQL;
539 539
 	}
@@ -548,9 +548,9 @@  discard block
 block discarded – undo
548 548
 	 * @param WP_Query $wp_query
549 549
 	 * @return    string
550 550
 	 */
551
-	public static function posts_orderby( $SQL = '', WP_Query $wp_query ) {
552
-		if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) {
553
-			$SQL = EEH_Event_Query::posts_orderby_sql( EEH_Event_Query::$_event_query_orderby, EEH_Event_Query::$_event_query_sort );
551
+	public static function posts_orderby($SQL = '', WP_Query $wp_query) {
552
+		if (EEH_Event_Query::apply_query_filters($wp_query)) {
553
+			$SQL = EEH_Event_Query::posts_orderby_sql(EEH_Event_Query::$_event_query_orderby, EEH_Event_Query::$_event_query_sort);
554 554
 		}
555 555
 		return $SQL;
556 556
 	}
@@ -581,63 +581,63 @@  discard block
 block discarded – undo
581 581
 	 * @param string     $sort
582 582
 	 * @return string
583 583
 	 */
584
-	public static function posts_orderby_sql( $orderby_params = array(), $sort = 'ASC' ) {
584
+	public static function posts_orderby_sql($orderby_params = array(), $sort = 'ASC') {
585 585
 		global $wpdb;
586 586
 		$SQL = '';
587 587
 		$counter = 0;
588 588
 		//make sure 'orderby' is set in query params
589
-		if ( ! isset( self::$_query_params['orderby'] )) {
589
+		if ( ! isset(self::$_query_params['orderby'])) {
590 590
 			self::$_query_params['orderby'] = array();
591 591
 		}
592 592
 		// loop thru $orderby_params (type cast as array)
593
-		foreach ( (array)$orderby_params as $orderby ) {
593
+		foreach ((array) $orderby_params as $orderby) {
594 594
 			// check if we have already added this param
595
-			if ( isset( self::$_query_params['orderby'][ $orderby ] )) {
595
+			if (isset(self::$_query_params['orderby'][$orderby])) {
596 596
 				// if so then remove from the $orderby_params so that the count() method below is accurate
597
-				unset( $orderby_params[ $orderby ] );
597
+				unset($orderby_params[$orderby]);
598 598
 				// then bump ahead to the next param
599 599
 				continue;
600 600
 			}
601 601
 			// this will ad a comma depending on whether this is the first or last param
602
-			$glue = $counter == 0 || $counter == count( $orderby_params ) ? ' ' : ', ';
602
+			$glue = $counter == 0 || $counter == count($orderby_params) ? ' ' : ', ';
603 603
 			// ok what's we dealing with?
604
-			switch ( $orderby ) {
604
+			switch ($orderby) {
605 605
 				case 'id' :
606 606
 				case 'ID' :
607
-					$SQL .= $glue . $wpdb->posts . '.ID ' . $sort;
607
+					$SQL .= $glue.$wpdb->posts.'.ID '.$sort;
608 608
 					break;
609 609
 				case 'end_date' :
610
-					$SQL .= $glue . EEM_Datetime::instance()->table() . '.DTT_EVT_end ' . $sort;
610
+					$SQL .= $glue.EEM_Datetime::instance()->table().'.DTT_EVT_end '.$sort;
611 611
 					break;
612 612
 				case 'event_name' :
613
-					$SQL .= $glue . $wpdb->posts . '.post_title ' . $sort;
613
+					$SQL .= $glue.$wpdb->posts.'.post_title '.$sort;
614 614
 					break;
615 615
 				case 'category_slug' :
616
-					$SQL .= $glue . $wpdb->terms . '.slug ' . $sort;
616
+					$SQL .= $glue.$wpdb->terms.'.slug '.$sort;
617 617
 					break;
618 618
 				case 'ticket_start' :
619
-					$SQL .= $glue . EEM_Ticket::instance()->table() . '.TKT_start_date ' . $sort;
619
+					$SQL .= $glue.EEM_Ticket::instance()->table().'.TKT_start_date '.$sort;
620 620
 					break;
621 621
 				case 'ticket_end' :
622
-					$SQL .= $glue . EEM_Ticket::instance()->table() . '.TKT_end_date ' . $sort;
622
+					$SQL .= $glue.EEM_Ticket::instance()->table().'.TKT_end_date '.$sort;
623 623
 					break;
624 624
 				case 'venue_title' :
625
-					$SQL .= $glue . 'venue_title ' . $sort;
625
+					$SQL .= $glue.'venue_title '.$sort;
626 626
 					break;
627 627
 				case 'city' :
628
-					$SQL .= $glue . EEM_Venue::instance()->second_table() . '.VNU_city ' . $sort;
628
+					$SQL .= $glue.EEM_Venue::instance()->second_table().'.VNU_city '.$sort;
629 629
 					break;
630 630
 				case 'state' :
631
-					$SQL .= $glue . EEM_State::instance()->table() . '.STA_name ' . $sort;
631
+					$SQL .= $glue.EEM_State::instance()->table().'.STA_name '.$sort;
632 632
 					break;
633 633
 				case 'start_date' :
634 634
 				default :
635
-					$SQL .= $glue . ' event_start_date ' . $sort;
635
+					$SQL .= $glue.' event_start_date '.$sort;
636 636
 					break;
637 637
 			}
638 638
 			// add to array of orderby params that have been added
639
-			self::$_query_params['orderby'][ $orderby ] = TRUE;
640
-			$counter ++;
639
+			self::$_query_params['orderby'][$orderby] = TRUE;
640
+			$counter++;
641 641
 		}
642 642
 		return $SQL;
643 643
 	}
Please login to merge, or discard this patch.
core/helpers/EEH_Formatter.helper.php 4 patches
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -297,12 +297,12 @@  discard block
 block discarded – undo
297 297
 
298 298
 
299 299
 	/**
300
-	* 	_get_formatter - obtain the requester formatter class
301
-	*
302
-	* 	@access private
303
-	* 	@param string $type how the address is formatted. for example: 'multiline' or 'inline'
304
-	* 	@return EEI_Address_Formatter
305
-	*/
300
+	 * 	_get_formatter - obtain the requester formatter class
301
+	 *
302
+	 * 	@access private
303
+	 * 	@param string $type how the address is formatted. for example: 'multiline' or 'inline'
304
+	 * 	@return EEI_Address_Formatter
305
+	 */
306 306
 	private static function _get_formatter( $type ) {
307 307
 		switch( $type ) {
308 308
 
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
 
349 349
 
350 350
 	/**
351
-	* 	_schema_formatting
352
-	* 	adds schema.org formatting to an address
353
-	*
354
-	* 	@access private
355
-	* 	@param object EEI_Address_Formatter $formatter
356
-	* 	@param object EEI_Address $obj_with_address
357
-	* 	@return string
358
-	*/
351
+	 * 	_schema_formatting
352
+	 * 	adds schema.org formatting to an address
353
+	 *
354
+	 * 	@access private
355
+	 * 	@param object EEI_Address_Formatter $formatter
356
+	 * 	@param object EEI_Address $obj_with_address
357
+	 * 	@return string
358
+	 */
359 359
 	private static function _schema_formatting( EEI_Address_Formatter $formatter, EEI_Address $obj_with_address ){
360 360
 		$formatted_address = '<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">';
361 361
 		$formatted_address .= $formatter->format(
@@ -396,50 +396,50 @@  discard block
 block discarded – undo
396 396
 
397 397
 
398 398
 	/**
399
-	* 	location
400
-	* 	The location of the event, organization or action.
401
-	* 	Should include the Venue name AND schema formatted address info
402
-	*
403
-	* 	@access public
404
-	* 	@param string $location
405
-	* 	@return string
406
-	*/
399
+	 * 	location
400
+	 * 	The location of the event, organization or action.
401
+	 * 	Should include the Venue name AND schema formatted address info
402
+	 *
403
+	 * 	@access public
404
+	 * 	@param string $location
405
+	 * 	@return string
406
+	 */
407 407
 	public static function location ( $location = NULL ) {
408 408
 		return ! empty( $location ) ? '<div itemprop="location" itemscope itemtype="http://schema.org/Place">' . $location . '</div>' : '';
409 409
 	}
410 410
 
411 411
 	/**
412
-	* 	name
413
-	* 	The name of the Event or Venue.
414
-	*
415
-	* 	@access public
416
-	* 	@param string $name
417
-	* 	@return string
418
-	*/
412
+	 * 	name
413
+	 * 	The name of the Event or Venue.
414
+	 *
415
+	 * 	@access public
416
+	 * 	@param string $name
417
+	 * 	@return string
418
+	 */
419 419
 	public static function name ( $name = NULL ) {
420 420
 		return ! empty( $name ) ? '<span itemprop="name">' . $name . '</span>' : '';
421 421
 	}
422 422
 
423 423
 	/**
424
-	* 	streetAddress
425
-	* 	The street address. For example, 1600 Amphitheatre Pkwy.
426
-	*
427
-	* 	@access public
428
-	* 	@param EEI_Address $obj_with_address
429
-	* 	@return string
430
-	*/
424
+	 * 	streetAddress
425
+	 * 	The street address. For example, 1600 Amphitheatre Pkwy.
426
+	 *
427
+	 * 	@access public
428
+	 * 	@param EEI_Address $obj_with_address
429
+	 * 	@return string
430
+	 */
431 431
 	public static function streetAddress ( EEI_Address $obj_with_address = NULL ) {
432 432
 		return $obj_with_address->address() !== NULL && $obj_with_address->address() !== '' ? '<span itemprop="streetAddress">' . $obj_with_address->address() . '</span>' : '';
433 433
 	}
434 434
 
435 435
 	/**
436
-	* 	postOfficeBoxNumber
437
-	* 	The post office box number for PO box addresses.
438
-	*
439
-	* 	@access public
440
-	* 	@param EEI_Address $obj_with_address
441
-	* 	@return string
442
-	*/
436
+	 * 	postOfficeBoxNumber
437
+	 * 	The post office box number for PO box addresses.
438
+	 *
439
+	 * 	@access public
440
+	 * 	@param EEI_Address $obj_with_address
441
+	 * 	@return string
442
+	 */
443 443
 	public static function postOfficeBoxNumber ( EEI_Address $obj_with_address = NULL ) {
444 444
 		// regex check for some form of PO Box or P.O. Box, etc, etc, etc
445 445
 		if ( preg_match("/^\s*((P(OST)?.?\s*(O(FF(ICE)?)?)?.?\s+(B(IN|OX))?)|B(IN|OX))/i", $obj_with_address->address2() )) {
@@ -450,25 +450,25 @@  discard block
 block discarded – undo
450 450
 	}
451 451
 
452 452
 	/**
453
-	* 	addressLocality
454
-	* 	The locality (city, town, etc). For example, Mountain View.
455
-	*
456
-	* 	@access public
457
-	* 	@param EEI_Address $obj_with_address
458
-	* 	@return string
459
-	*/
453
+	 * 	addressLocality
454
+	 * 	The locality (city, town, etc). For example, Mountain View.
455
+	 *
456
+	 * 	@access public
457
+	 * 	@param EEI_Address $obj_with_address
458
+	 * 	@return string
459
+	 */
460 460
 	public static function addressLocality ( EEI_Address $obj_with_address = NULL ) {
461 461
 		return $obj_with_address->city() !== NULL && $obj_with_address->city() !== '' ? '<span itemprop="addressLocality">' . $obj_with_address->city() . '</span>' : '';
462 462
 	}
463 463
 
464 464
 	/**
465
-	* 	addressRegion
466
-	* 	The region (state, province, etc). For example, CA.
467
-	*
468
-	* 	@access public
469
-	* 	@param EEI_Address $obj_with_address
470
-	* 	@return string
471
-	*/
465
+	 * 	addressRegion
466
+	 * 	The region (state, province, etc). For example, CA.
467
+	 *
468
+	 * 	@access public
469
+	 * 	@param EEI_Address $obj_with_address
470
+	 * 	@return string
471
+	 */
472 472
 	public static function addressRegion ( EEI_Address $obj_with_address = NULL ) {
473 473
 		$state = $obj_with_address->state();
474 474
 		if ( ! empty( $state ) ) {
@@ -479,13 +479,13 @@  discard block
 block discarded – undo
479 479
 	}
480 480
 
481 481
 	/**
482
-	* 	addressCountry
483
-	* 	The country. For example, USA. You can also provide the two-letter ISO 3166-1 alpha-2 country code.
484
-	*
485
-	* 	@access public
486
-	* 	@param EEI_Address $obj_with_address
487
-	* 	@return string
488
-	*/
482
+	 * 	addressCountry
483
+	 * 	The country. For example, USA. You can also provide the two-letter ISO 3166-1 alpha-2 country code.
484
+	 *
485
+	 * 	@access public
486
+	 * 	@param EEI_Address $obj_with_address
487
+	 * 	@return string
488
+	 */
489 489
 	public static function addressCountry ( EEI_Address $obj_with_address = NULL ) {
490 490
 		$country = $obj_with_address->country();
491 491
 		if ( ! empty( $country ) ) {
@@ -496,39 +496,39 @@  discard block
 block discarded – undo
496 496
 	}
497 497
 
498 498
 	/**
499
-	* 	postalCode
500
-	* 	The postal code. For example, 94043.
501
-	*
502
-	* 	@access public
503
-	* 	@param EEI_Address $obj_with_address
504
-	* 	@return string
505
-	*/
499
+	 * 	postalCode
500
+	 * 	The postal code. For example, 94043.
501
+	 *
502
+	 * 	@access public
503
+	 * 	@param EEI_Address $obj_with_address
504
+	 * 	@return string
505
+	 */
506 506
 	public static function postalCode ( EEI_Address $obj_with_address = NULL ) {
507 507
 		return $obj_with_address->zip() !== NULL && $obj_with_address->zip() !== ''  ? '<span itemprop="postalCode">' . $obj_with_address->zip() . '</span>' : '';
508 508
 	}
509 509
 
510 510
 	/**
511
-	* 	telephone
512
-	* 	The telephone number.
513
-	*
514
-	* 	@access public
515
-	* 	@param string $phone_nmbr
516
-	* 	@return string
517
-	*/
511
+	 * 	telephone
512
+	 * 	The telephone number.
513
+	 *
514
+	 * 	@access public
515
+	 * 	@param string $phone_nmbr
516
+	 * 	@return string
517
+	 */
518 518
 	public static function telephone ( $phone_nmbr = NULL ) {
519 519
 		return $phone_nmbr !== NULL && $phone_nmbr !== ''  ? '<span itemprop="telephone">' . $phone_nmbr . '</span>' : '';
520 520
 	}
521 521
 
522 522
 	/**
523
-	* 	URL
524
-	* 	URL of the item as a clickable link
525
-	*
526
-	* 	@access public
527
-	* 	@param string $url - the URL that the link will resolve to
528
-	* 	@param string $text - the text that will be used for the visible link
529
-	* 	@param array $attributes - array of additional link attributes in  attribute_name => value pairs. ie: array( 'title' => 'click here', 'class' => 'link-class' )
530
-	* 	@return string (link)
531
-	*/
523
+	 * 	URL
524
+	 * 	URL of the item as a clickable link
525
+	 *
526
+	 * 	@access public
527
+	 * 	@param string $url - the URL that the link will resolve to
528
+	 * 	@param string $text - the text that will be used for the visible link
529
+	 * 	@param array $attributes - array of additional link attributes in  attribute_name => value pairs. ie: array( 'title' => 'click here', 'class' => 'link-class' )
530
+	 * 	@return string (link)
531
+	 */
532 532
 	public static function url ( $url = NULL, $text = NULL, $attributes = array() ) {
533 533
 		$atts = '';
534 534
 		foreach ( $attributes as $attribute => $value ) {
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.
Doc Comments   +14 added lines, -2 removed lines patch added patch discarded remove patch
@@ -88,6 +88,7 @@  discard block
 block discarded – undo
88 88
 	/**
89 89
 	 * [ee_tep_not_null description]
90 90
 	 * @param  string | array $value [description]
91
+	 * @param string $value
91 92
 	 * @return bool       [description]
92 93
 	 */
93 94
 	static public function ee_tep_not_null($value) {
@@ -152,6 +153,15 @@  discard block
 block discarded – undo
152 153
  */
153 154
 class EE_Address_Formatter {
154 155
 
156
+	/**
157
+	 * @param string $address
158
+	 * @param string $address2
159
+	 * @param string $city
160
+	 * @param string $state
161
+	 * @param string $zip
162
+	 * @param string $country
163
+	 * @param string $sub
164
+	 */
155 165
 	protected function parse_formatted_address( $address, $address2, $city, $state, $zip, $country, $formatted_address, $sub ) {
156 166
 		// swap address part placeholders for the real text
157 167
 		$formatted_address = str_replace(
@@ -629,6 +639,8 @@  discard block
 block discarded – undo
629 639
 	 * @param EE_State | string $state
630 640
 	 * @param string $zip
631 641
 	 * @param EE_Country | string $country
642
+	 * @param integer $state
643
+	 * @param string $country
632 644
 	 * @return EE_Generic_Address
633 645
 	 */
634 646
 	public function __construct( $address, $address2, $city, $state, $zip, $country ) {
@@ -716,7 +728,7 @@  discard block
 block discarded – undo
716 728
 
717 729
 
718 730
 	/**
719
-	 * @return \EE_State
731
+	 * @return string
720 732
 	 */
721 733
 	public function state_obj() {
722 734
 		return $this->_state_obj;
@@ -765,7 +777,7 @@  discard block
 block discarded – undo
765 777
 
766 778
 
767 779
 	/**
768
-	 * @return \EE_Country
780
+	 * @return string
769 781
 	 */
770 782
 	public function country_obj() {
771 783
 		return $this->_country_obj;
Please login to merge, or discard this patch.
Spacing   +69 added lines, -69 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
 /**
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 * @param  string $content content to format
40 40
 	 * @return string          formatted content
41 41
 	 */
42
-	static public function admin_format_content($content='') {
42
+	static public function admin_format_content($content = '') {
43 43
 		return wpautop(stripslashes_deep(html_entity_decode($content, ENT_QUOTES, "UTF-8")));
44 44
 	}
45 45
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 * @return string
80 80
 	 */
81 81
 	static public	function ee_tep_parse_input_field_data($data, $parse) {
82
-		return strtr( trim($data), $parse);
82
+		return strtr(trim($data), $parse);
83 83
 	}
84 84
 
85 85
 
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
 	 * @return string
119 119
 	 * @deprecated v4.6.21
120 120
 	 */
121
-	static public function event_date_display( $date, $format = '' ) {
121
+	static public function event_date_display($date, $format = '') {
122 122
 		EE_Error::doing_it_wrong(
123 123
 			__METHOD__,
124
-			__( 'This method is deprecated as of EE 4.6.12.  Currently it does not reformat as with prior behaviour but just returns the incoming string.  Please use the EE_Datetime helpers for Datetime on the event to display as desired.', 'event_espresso' ),
124
+			__('This method is deprecated as of EE 4.6.12.  Currently it does not reformat as with prior behaviour but just returns the incoming string.  Please use the EE_Datetime helpers for Datetime on the event to display as desired.', 'event_espresso'),
125 125
 			'4.6.21'
126 126
 		);
127 127
 
@@ -152,18 +152,18 @@  discard block
 block discarded – undo
152 152
  */
153 153
 class EE_Address_Formatter {
154 154
 
155
-	protected function parse_formatted_address( $address, $address2, $city, $state, $zip, $country, $formatted_address, $sub ) {
155
+	protected function parse_formatted_address($address, $address2, $city, $state, $zip, $country, $formatted_address, $sub) {
156 156
 		// swap address part placeholders for the real text
157 157
 		$formatted_address = str_replace(
158 158
 			// find
159
-			array( '{address}', '{address2}', '{city}', '{state}', '{zip}', '{country}' ),
159
+			array('{address}', '{address2}', '{city}', '{state}', '{zip}', '{country}'),
160 160
 			// replace
161
-			array( $address, $address2, $city, $state, $zip, $country ),
161
+			array($address, $address2, $city, $state, $zip, $country),
162 162
 			// string
163 163
 			$formatted_address
164 164
 		);
165 165
 		// remove placeholder from start and end, reduce repeating placeholders to singles, then replace with HTML line breaks
166
-		return preg_replace( '/%+/', $sub, trim( $formatted_address, '%' ) );
166
+		return preg_replace('/%+/', $sub, trim($formatted_address, '%'));
167 167
 	}
168 168
 
169 169
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 * @param string $CNT_ISO
200 200
 	 * @return string
201 201
 	 */
202
-	public function format( $address, $address2, $city, $state, $zip, $country, $CNT_ISO ) {
202
+	public function format($address, $address2, $city, $state, $zip, $country, $CNT_ISO) {
203 203
 
204 204
 		$address_formats = apply_filters(
205 205
 			'FHEE__EE_MultiLine_Address_Formatter__address_formats',
@@ -211,8 +211,8 @@  discard block
 block discarded – undo
211 211
 			)
212 212
 		);
213 213
 		// if the incoming country has a set format, use that, else use the default
214
-		$formatted_address = isset( $address_formats[ $CNT_ISO ] ) ? $address_formats[ $CNT_ISO ] : $address_formats[ 'ZZ' ];
215
-		return $this->parse_formatted_address( $address, $address2, $city, $state, $zip, $country, $formatted_address, '<br />' );
214
+		$formatted_address = isset($address_formats[$CNT_ISO]) ? $address_formats[$CNT_ISO] : $address_formats['ZZ'];
215
+		return $this->parse_formatted_address($address, $address2, $city, $state, $zip, $country, $formatted_address, '<br />');
216 216
 	}
217 217
 }
218 218
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	 * @param string $CNT_ISO
246 246
 	 * @return string
247 247
 	 */
248
-	public function format( $address, $address2, $city, $state, $zip, $country, $CNT_ISO ) {
248
+	public function format($address, $address2, $city, $state, $zip, $country, $CNT_ISO) {
249 249
 		$address_formats = apply_filters(
250 250
 			'FHEE__EE_Inline_Address_Formatter__address_formats',
251 251
 			array(
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
 			)
257 257
 		);
258 258
 		// if the incoming country has a set format, use that, else use the default
259
-		$formatted_address = isset( $address_formats[ $CNT_ISO ] ) ? $address_formats[ $CNT_ISO ] : $address_formats[ 'ZZZ' ];
260
-		return $this->parse_formatted_address( $address, $address2, $city, $state, $zip, $country, $formatted_address, ', ' );
259
+		$formatted_address = isset($address_formats[$CNT_ISO]) ? $address_formats[$CNT_ISO] : $address_formats['ZZZ'];
260
+		return $this->parse_formatted_address($address, $address2, $city, $state, $zip, $country, $formatted_address, ', ');
261 261
 
262 262
 	}
263 263
 }
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 	 * @param string $CNT_ISO
293 293
 	 * @return string
294 294
 	 */
295
-	public function format( $address, $address2, $city, $state, $zip, $country, $CNT_ISO ) {
295
+	public function format($address, $address2, $city, $state, $zip, $country, $CNT_ISO) {
296 296
 		return NULL;
297 297
 	}
298 298
 }
@@ -328,20 +328,20 @@  discard block
 block discarded – undo
328 328
 	 * @param bool    $add_wrapper
329 329
 	 * @return string
330 330
 	 */
331
-	public static function format ( $obj_with_address = null, $type = 'multiline', $use_schema = true, $add_wrapper = true ) {
331
+	public static function format($obj_with_address = null, $type = 'multiline', $use_schema = true, $add_wrapper = true) {
332 332
 		// check that incoming object implements the EEI_Address interface
333
-		if ( ! $obj_with_address instanceof EEI_Address ) {
334
-			$msg = __( 'The address could not be formatted.', 'event_espresso' );
335
-			$dev_msg = __( 'The EE_Address_Formatter requires passed objects to implement the EEI_Address interface.', 'event_espresso' );
336
-			EE_Error::add_error( $msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
333
+		if ( ! $obj_with_address instanceof EEI_Address) {
334
+			$msg = __('The address could not be formatted.', 'event_espresso');
335
+			$dev_msg = __('The EE_Address_Formatter requires passed objects to implement the EEI_Address interface.', 'event_espresso');
336
+			EE_Error::add_error($msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
337 337
 			return null;
338 338
 		}
339 339
 		// obtain an address formatter
340
-		$formatter = EEH_Address::_get_formatter( $type );
340
+		$formatter = EEH_Address::_get_formatter($type);
341 341
 		// apply schema.org formatting ?
342 342
 		$use_schema = ! is_admin() ? $use_schema : false;
343
-		$formatted_address = $use_schema ? EEH_Address::_schema_formatting( $formatter, $obj_with_address ) : EEH_Address::_regular_formatting( $formatter, $obj_with_address, $add_wrapper ) ;
344
-		$formatted_address = $add_wrapper && ! $use_schema ? '<div class="espresso-address-dv">' . $formatted_address . '</div>' : $formatted_address;
343
+		$formatted_address = $use_schema ? EEH_Address::_schema_formatting($formatter, $obj_with_address) : EEH_Address::_regular_formatting($formatter, $obj_with_address, $add_wrapper);
344
+		$formatted_address = $add_wrapper && ! $use_schema ? '<div class="espresso-address-dv">'.$formatted_address.'</div>' : $formatted_address;
345 345
 		// return the formatted address
346 346
 		return $formatted_address;
347 347
 	}
@@ -355,8 +355,8 @@  discard block
 block discarded – undo
355 355
 	* 	@param string $type how the address is formatted. for example: 'multiline' or 'inline'
356 356
 	* 	@return EEI_Address_Formatter
357 357
 	*/
358
-	private static function _get_formatter( $type ) {
359
-		switch( $type ) {
358
+	private static function _get_formatter($type) {
359
+		switch ($type) {
360 360
 
361 361
 			case 'multiline' :
362 362
 				return new EE_MultiLine_Address_Formatter();
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 	 * @param bool $add_wrapper
383 383
 	 * @return string
384 384
 	 */
385
-	private static function _regular_formatting( EEI_Address_Formatter $formatter, EEI_Address $obj_with_address, $add_wrapper = TRUE ){
385
+	private static function _regular_formatting(EEI_Address_Formatter $formatter, EEI_Address $obj_with_address, $add_wrapper = TRUE) {
386 386
 		$formatted_address = $add_wrapper ? '<div>' : '';
387 387
 		$formatted_address .= $formatter->format(
388 388
 			$obj_with_address->address(),
@@ -409,15 +409,15 @@  discard block
 block discarded – undo
409 409
 	* 	@param object EEI_Address $obj_with_address
410 410
 	* 	@return string
411 411
 	*/
412
-	private static function _schema_formatting( EEI_Address_Formatter $formatter, EEI_Address $obj_with_address ){
412
+	private static function _schema_formatting(EEI_Address_Formatter $formatter, EEI_Address $obj_with_address) {
413 413
 		$formatted_address = '<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">';
414 414
 		$formatted_address .= $formatter->format(
415
-			EEH_Schema::streetAddress( $obj_with_address ),
416
-			EEH_Schema::postOfficeBoxNumber( $obj_with_address ),
417
-			EEH_Schema::addressLocality( $obj_with_address ),
418
-			EEH_Schema::addressRegion( $obj_with_address ),
419
-			EEH_Schema::postalCode( $obj_with_address ),
420
-			EEH_Schema::addressCountry( $obj_with_address ),
415
+			EEH_Schema::streetAddress($obj_with_address),
416
+			EEH_Schema::postOfficeBoxNumber($obj_with_address),
417
+			EEH_Schema::addressLocality($obj_with_address),
418
+			EEH_Schema::addressRegion($obj_with_address),
419
+			EEH_Schema::postalCode($obj_with_address),
420
+			EEH_Schema::addressCountry($obj_with_address),
421 421
 			$obj_with_address->country_ID()
422 422
 		);
423 423
 		$formatted_address .= '</div>';
@@ -460,8 +460,8 @@  discard block
 block discarded – undo
460 460
 	* 	@param string $location
461 461
 	* 	@return string
462 462
 	*/
463
-	public static function location ( $location = NULL ) {
464
-		return ! empty( $location ) ? '<div itemprop="location" itemscope itemtype="http://schema.org/Place">' . $location . '</div>' : '';
463
+	public static function location($location = NULL) {
464
+		return ! empty($location) ? '<div itemprop="location" itemscope itemtype="http://schema.org/Place">'.$location.'</div>' : '';
465 465
 	}
466 466
 
467 467
 	/**
@@ -472,8 +472,8 @@  discard block
 block discarded – undo
472 472
 	* 	@param string $name
473 473
 	* 	@return string
474 474
 	*/
475
-	public static function name ( $name = NULL ) {
476
-		return ! empty( $name ) ? '<span itemprop="name">' . $name . '</span>' : '';
475
+	public static function name($name = NULL) {
476
+		return ! empty($name) ? '<span itemprop="name">'.$name.'</span>' : '';
477 477
 	}
478 478
 
479 479
 	/**
@@ -484,8 +484,8 @@  discard block
 block discarded – undo
484 484
 	* 	@param EEI_Address $obj_with_address
485 485
 	* 	@return string
486 486
 	*/
487
-	public static function streetAddress ( EEI_Address $obj_with_address = NULL ) {
488
-		return $obj_with_address->address() !== NULL && $obj_with_address->address() !== '' ? '<span itemprop="streetAddress">' . $obj_with_address->address() . '</span>' : '';
487
+	public static function streetAddress(EEI_Address $obj_with_address = NULL) {
488
+		return $obj_with_address->address() !== NULL && $obj_with_address->address() !== '' ? '<span itemprop="streetAddress">'.$obj_with_address->address().'</span>' : '';
489 489
 	}
490 490
 
491 491
 	/**
@@ -496,10 +496,10 @@  discard block
 block discarded – undo
496 496
 	* 	@param EEI_Address $obj_with_address
497 497
 	* 	@return string
498 498
 	*/
499
-	public static function postOfficeBoxNumber ( EEI_Address $obj_with_address = NULL ) {
499
+	public static function postOfficeBoxNumber(EEI_Address $obj_with_address = NULL) {
500 500
 		// regex check for some form of PO Box or P.O. Box, etc, etc, etc
501
-		if ( preg_match("/^\s*((P(OST)?.?\s*(O(FF(ICE)?)?)?.?\s+(B(IN|OX))?)|B(IN|OX))/i", $obj_with_address->address2() )) {
502
-			return $obj_with_address->address2() !== NULL && $obj_with_address->address2() !== '' ? '<span itemprop="postOfficeBoxNumber">' . $obj_with_address->address2() . '</span>' : '';
501
+		if (preg_match("/^\s*((P(OST)?.?\s*(O(FF(ICE)?)?)?.?\s+(B(IN|OX))?)|B(IN|OX))/i", $obj_with_address->address2())) {
502
+			return $obj_with_address->address2() !== NULL && $obj_with_address->address2() !== '' ? '<span itemprop="postOfficeBoxNumber">'.$obj_with_address->address2().'</span>' : '';
503 503
 		} else {
504 504
 			return $obj_with_address->address2();
505 505
 		}
@@ -513,8 +513,8 @@  discard block
 block discarded – undo
513 513
 	* 	@param EEI_Address $obj_with_address
514 514
 	* 	@return string
515 515
 	*/
516
-	public static function addressLocality ( EEI_Address $obj_with_address = NULL ) {
517
-		return $obj_with_address->city() !== NULL && $obj_with_address->city() !== '' ? '<span itemprop="addressLocality">' . $obj_with_address->city() . '</span>' : '';
516
+	public static function addressLocality(EEI_Address $obj_with_address = NULL) {
517
+		return $obj_with_address->city() !== NULL && $obj_with_address->city() !== '' ? '<span itemprop="addressLocality">'.$obj_with_address->city().'</span>' : '';
518 518
 	}
519 519
 
520 520
 	/**
@@ -525,10 +525,10 @@  discard block
 block discarded – undo
525 525
 	* 	@param EEI_Address $obj_with_address
526 526
 	* 	@return string
527 527
 	*/
528
-	public static function addressRegion ( EEI_Address $obj_with_address = NULL ) {
528
+	public static function addressRegion(EEI_Address $obj_with_address = NULL) {
529 529
 		$state = $obj_with_address->state_name();
530
-		if ( ! empty( $state ) ) {
531
-			return '<span itemprop="addressRegion">' . $state . '</span>';
530
+		if ( ! empty($state)) {
531
+			return '<span itemprop="addressRegion">'.$state.'</span>';
532 532
 		} else {
533 533
 			return '';
534 534
 		}
@@ -542,10 +542,10 @@  discard block
 block discarded – undo
542 542
 	* 	@param EEI_Address $obj_with_address
543 543
 	* 	@return string
544 544
 	*/
545
-	public static function addressCountry ( EEI_Address $obj_with_address = NULL ) {
545
+	public static function addressCountry(EEI_Address $obj_with_address = NULL) {
546 546
 		$country = $obj_with_address->country_name();
547
-		if ( ! empty( $country ) ) {
548
-			return '<span itemprop="addressCountry">' . $country . '</span>';
547
+		if ( ! empty($country)) {
548
+			return '<span itemprop="addressCountry">'.$country.'</span>';
549 549
 		} else {
550 550
 			return '';
551 551
 		}
@@ -559,8 +559,8 @@  discard block
 block discarded – undo
559 559
 	* 	@param EEI_Address $obj_with_address
560 560
 	* 	@return string
561 561
 	*/
562
-	public static function postalCode ( EEI_Address $obj_with_address = NULL ) {
563
-		return $obj_with_address->zip() !== NULL && $obj_with_address->zip() !== ''  ? '<span itemprop="postalCode">' . $obj_with_address->zip() . '</span>' : '';
562
+	public static function postalCode(EEI_Address $obj_with_address = NULL) {
563
+		return $obj_with_address->zip() !== NULL && $obj_with_address->zip() !== '' ? '<span itemprop="postalCode">'.$obj_with_address->zip().'</span>' : '';
564 564
 	}
565 565
 
566 566
 	/**
@@ -571,8 +571,8 @@  discard block
 block discarded – undo
571 571
 	* 	@param string $phone_nmbr
572 572
 	* 	@return string
573 573
 	*/
574
-	public static function telephone ( $phone_nmbr = NULL ) {
575
-		return $phone_nmbr !== NULL && $phone_nmbr !== ''  ? '<span itemprop="telephone">' . $phone_nmbr . '</span>' : '';
574
+	public static function telephone($phone_nmbr = NULL) {
575
+		return $phone_nmbr !== NULL && $phone_nmbr !== '' ? '<span itemprop="telephone">'.$phone_nmbr.'</span>' : '';
576 576
 	}
577 577
 
578 578
 	/**
@@ -585,13 +585,13 @@  discard block
 block discarded – undo
585 585
 	* 	@param array $attributes - array of additional link attributes in  attribute_name => value pairs. ie: array( 'title' => 'click here', 'class' => 'link-class' )
586 586
 	* 	@return string (link)
587 587
 	*/
588
-	public static function url ( $url = NULL, $text = NULL, $attributes = array() ) {
588
+	public static function url($url = NULL, $text = NULL, $attributes = array()) {
589 589
 		$atts = '';
590
-		foreach ( $attributes as $attribute => $value ) {
591
-			$atts .= ' ' . $attribute . '="' . $value . '"';
590
+		foreach ($attributes as $attribute => $value) {
591
+			$atts .= ' '.$attribute.'="'.$value.'"';
592 592
 		}
593 593
 		$text = $text !== NULL && $text !== '' ? $text : $url;
594
-		return $url !== NULL && $url !== '' ? '<a itemprop="url" href="' . $url . '"' . $atts . '>' . $text . '</a>' : '';
594
+		return $url !== NULL && $url !== '' ? '<a itemprop="url" href="'.$url.'"'.$atts.'>'.$text.'</a>' : '';
595 595
 	}
596 596
 
597 597
 
@@ -631,18 +631,18 @@  discard block
 block discarded – undo
631 631
 	 * @param EE_Country | string $country
632 632
 	 * @return EE_Generic_Address
633 633
 	 */
634
-	public function __construct( $address, $address2, $city, $state, $zip, $country ) {
634
+	public function __construct($address, $address2, $city, $state, $zip, $country) {
635 635
 		$this->_address = $address;
636 636
 		$this->_address2 = $address2;
637 637
 		$this->_city = $city;
638
-		if ( $state instanceof EE_State ) {
638
+		if ($state instanceof EE_State) {
639 639
 			$this->_state_obj = $state;
640 640
 		} else {
641 641
 			$this->_state_ID = $state;
642 642
 			$this->_state_obj = $this->_get_state_obj();
643 643
 		}
644 644
 		$this->_zip = $zip;
645
-		if ( $country instanceof EE_Country ) {
645
+		if ($country instanceof EE_Country) {
646 646
 			$this->_country_obj = $country;
647 647
 		} else {
648 648
 			$this->_country_ID = $country;
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
 	 * @return \EE_State
684 684
 	 */
685 685
 	private function _get_state_obj() {
686
-		return $this->_state_obj instanceof EE_State ? $this->_state_obj : EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( $this->_state_ID );
686
+		return $this->_state_obj instanceof EE_State ? $this->_state_obj : EE_Registry::instance()->load_model('State')->get_one_by_ID($this->_state_ID);
687 687
 	}
688 688
 
689 689
 
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 	 * @return string
702 702
 	 */
703 703
 	public function state_abbrev() {
704
-		return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : __( 'Unknown', 'event_espresso' );
704
+		return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : __('Unknown', 'event_espresso');
705 705
 	}
706 706
 
707 707
 
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
 	 * @return string
711 711
 	 */
712 712
 	public function state_name() {
713
-		return $this->state_obj() instanceof EE_State ? $this->state_obj()->name() :  __( 'Unknown', 'event_espresso' );
713
+		return $this->state_obj() instanceof EE_State ? $this->state_obj()->name() : __('Unknown', 'event_espresso');
714 714
 	}
715 715
 
716 716
 
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
 	 * @return string
729 729
 	 */
730 730
 	public function state() {
731
-		if ( apply_filters( 'FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj() ) ) {
731
+		if (apply_filters('FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj())) {
732 732
 			return $this->state_obj()->abbrev();
733 733
 		} else {
734 734
 			return $this->state_name();
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 	 * @return EE_Country
742 742
 	 */
743 743
 	private function _get_country_obj() {
744
-		return $this->_country_obj instanceof EE_Country ? $this->_country_obj : EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $this->_country_ID );
744
+		return $this->_country_obj instanceof EE_Country ? $this->_country_obj : EE_Registry::instance()->load_model('Country')->get_one_by_ID($this->_country_ID);
745 745
 	}
746 746
 
747 747
 
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
 	 * @return string
760 760
 	 */
761 761
 	public function country_name() {
762
-		return $this->country_obj() instanceof EE_Country ? $this->country_obj()->name() :  __( 'Unknown', 'event_espresso' );
762
+		return $this->country_obj() instanceof EE_Country ? $this->country_obj()->name() : __('Unknown', 'event_espresso');
763 763
 	}
764 764
 
765 765
 
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
 	 * @return string
778 778
 	 */
779 779
 	public function country() {
780
-		if ( apply_filters( 'FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj() ) ) {
780
+		if (apply_filters('FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj())) {
781 781
 			return $this->country_ID();
782 782
 		} else {
783 783
 			return $this->country_name();
Please login to merge, or discard this patch.
core/helpers/EEH_HTML.helper.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
  /**
3
- *
4
- * Class EEH_HTML
5
- *
3
+  *
4
+  * Class EEH_HTML
5
+  *
6 6
   * Sometimes when writing PHP you need to generate some standard HTML,
7 7
   * but either not enough to warrant creating a template file,
8 8
   * or the amount of PHP conditionals and/or loops peppered throughout the HTML
9 9
   * just make it really ugly and difficult to read.
10 10
   * This class simply adds a bunch of methods for generating basic HTML tags.
11 11
   * Most of the methods have the same name as the HTML tag they generate, and most have the same set of parameters.
12
- *
13
- * @package         Event Espresso
14
- * @subpackage    core
15
- * @author				Brent Christensen
16
- * @since		 	   $VID:$
17
- *
18
- */
12
+  *
13
+  * @package         Event Espresso
14
+  * @subpackage    core
15
+  * @author				Brent Christensen
16
+  * @since		 	   $VID:$
17
+  *
18
+  */
19 19
 
20 20
 class EEH_HTML {
21 21
 
Please login to merge, or discard this patch.
Spacing   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -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_HTML ) {
44
+		if ( ! self::$_instance instanceof EEH_HTML) {
45 45
 			self::$_instance = new EEH_HTML();
46 46
 		}
47 47
 		return self::$_instance;
@@ -93,15 +93,15 @@  discard block
 block discarded – undo
93 93
 	 * @param bool   $force_close
94 94
 	 * @return string
95 95
 	 */
96
-	protected static function _open_tag( $tag = 'div', $content = '', $id = '', $class = '', $style = '', $other_attributes = '', $force_close = FALSE ) {
97
-		$attributes = ! empty( $id ) ? ' id="' . EEH_HTML::sanitize_id( $id ) . '"' : '';
98
-		$attributes .= ! empty( $class ) ? ' class="' . $class . '"' : '';
99
-		$attributes .= ! empty( $style ) ? ' style="' . $style . '"' : '';
100
-		$attributes .= ! empty( $other_attributes ) ? ' ' . $other_attributes : '';
101
-		$html = EEH_HTML::nl( 0, $tag ) . '<' . $tag . $attributes . '>';
102
-		$html .= ! empty( $content ) ? EEH_HTML::nl( 1, $tag  ) . $content : '';
103
-		$indent = ! empty( $content ) || $force_close ? TRUE : FALSE;
104
-		$html .= ! empty( $content ) || $force_close ? EEH_HTML::_close_tag( $tag, $id, $class, $indent ) : '';
96
+	protected static function _open_tag($tag = 'div', $content = '', $id = '', $class = '', $style = '', $other_attributes = '', $force_close = FALSE) {
97
+		$attributes = ! empty($id) ? ' id="'.EEH_HTML::sanitize_id($id).'"' : '';
98
+		$attributes .= ! empty($class) ? ' class="'.$class.'"' : '';
99
+		$attributes .= ! empty($style) ? ' style="'.$style.'"' : '';
100
+		$attributes .= ! empty($other_attributes) ? ' '.$other_attributes : '';
101
+		$html = EEH_HTML::nl(0, $tag).'<'.$tag.$attributes.'>';
102
+		$html .= ! empty($content) ? EEH_HTML::nl(1, $tag).$content : '';
103
+		$indent = ! empty($content) || $force_close ? TRUE : FALSE;
104
+		$html .= ! empty($content) || $force_close ? EEH_HTML::_close_tag($tag, $id, $class, $indent) : '';
105 105
 		return $html;
106 106
 	}
107 107
 
@@ -117,16 +117,16 @@  discard block
 block discarded – undo
117 117
 	 * @param bool   $indent
118 118
 	 * @return string
119 119
 	 */
120
-	protected static function _close_tag( $tag = 'div', $id = '', $class = '', $indent = TRUE ) {
121
-		if ( $id ) {
122
-			$comment = EEH_HTML::comment( 'close ' . $id ) . EEH_HTML::nl( 0, $tag );
123
-		} else if ( $class ) {
124
-			$comment = EEH_HTML::comment( 'close ' . $class ) . EEH_HTML::nl( 0, $tag );
120
+	protected static function _close_tag($tag = 'div', $id = '', $class = '', $indent = TRUE) {
121
+		if ($id) {
122
+			$comment = EEH_HTML::comment('close '.$id).EEH_HTML::nl(0, $tag);
123
+		} else if ($class) {
124
+			$comment = EEH_HTML::comment('close '.$class).EEH_HTML::nl(0, $tag);
125 125
 		} else {
126 126
 			$comment = '';
127 127
 		}
128 128
 		$html = $indent ? EEH_HTML::nl( -1, $tag ) : '';
129
-		$html .= '</' . $tag . '>' . $comment;
129
+		$html .= '</'.$tag.'>'.$comment;
130 130
 		return $html;
131 131
 	}
132 132
 
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
146 146
 	 * @return string
147 147
 	 */
148
-	public static function div( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
149
-		return EEH_HTML::_open_tag( 'div', $content, $id, $class, $style, $other_attributes );
148
+	public static function div($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
149
+		return EEH_HTML::_open_tag('div', $content, $id, $class, $style, $other_attributes);
150 150
 	}
151 151
 
152 152
 
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
 	 * @param string $class - html class attribute
160 160
 	 * @return string
161 161
 	 */
162
-	public static function divx( $id = '', $class = '' ) {
163
-		return EEH_HTML::_close_tag( 'div', $id, $class );
162
+	public static function divx($id = '', $class = '') {
163
+		return EEH_HTML::_close_tag('div', $id, $class);
164 164
 	}
165 165
 
166 166
 
@@ -176,23 +176,23 @@  discard block
 block discarded – undo
176 176
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
177 177
 	 * @return string
178 178
 	 */
179
-	public static function h1( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
180
-		return EEH_HTML::_open_tag( 'h1', $content, $id, $class, $style, $other_attributes, TRUE );
179
+	public static function h1($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
180
+		return EEH_HTML::_open_tag('h1', $content, $id, $class, $style, $other_attributes, TRUE);
181 181
 	}
182
-	public static function h2( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
183
-		return EEH_HTML::_open_tag( 'h2', $content, $id, $class, $style, $other_attributes, TRUE );
182
+	public static function h2($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
183
+		return EEH_HTML::_open_tag('h2', $content, $id, $class, $style, $other_attributes, TRUE);
184 184
 	}
185
-	public static function h3( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
186
-		return EEH_HTML::_open_tag( 'h3', $content, $id, $class, $style, $other_attributes, TRUE );
185
+	public static function h3($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
186
+		return EEH_HTML::_open_tag('h3', $content, $id, $class, $style, $other_attributes, TRUE);
187 187
 	}
188
-	public static function h4( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
189
-		return EEH_HTML::_open_tag( 'h4', $content, $id, $class, $style, $other_attributes, TRUE );
188
+	public static function h4($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
189
+		return EEH_HTML::_open_tag('h4', $content, $id, $class, $style, $other_attributes, TRUE);
190 190
 	}
191
-	public static function h5( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
192
-		return EEH_HTML::_open_tag( 'h5', $content, $id, $class, $style, $other_attributes, TRUE );
191
+	public static function h5($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
192
+		return EEH_HTML::_open_tag('h5', $content, $id, $class, $style, $other_attributes, TRUE);
193 193
 	}
194
-	public static function h6( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
195
-		return EEH_HTML::_open_tag( 'h6', $content, $id, $class, $style, $other_attributes, TRUE );
194
+	public static function h6($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
195
+		return EEH_HTML::_open_tag('h6', $content, $id, $class, $style, $other_attributes, TRUE);
196 196
 	}
197 197
 
198 198
 
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
209 209
 	 * @return string
210 210
 	 */
211
-	public static function p( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
212
-		return EEH_HTML::_open_tag( 'p', $content, $id, $class, $style, $other_attributes, TRUE );
211
+	public static function p($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
212
+		return EEH_HTML::_open_tag('p', $content, $id, $class, $style, $other_attributes, TRUE);
213 213
 	}
214 214
 
215 215
 
@@ -224,8 +224,8 @@  discard block
 block discarded – undo
224 224
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
225 225
 	 * @return string
226 226
 	 */
227
-	public static function ul( $id = '', $class = '', $style = '', $other_attributes = '' ) {
228
-		return EEH_HTML::_open_tag( 'ul', '', $id, $class, $style, $other_attributes );
227
+	public static function ul($id = '', $class = '', $style = '', $other_attributes = '') {
228
+		return EEH_HTML::_open_tag('ul', '', $id, $class, $style, $other_attributes);
229 229
 	}
230 230
 
231 231
 
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
 	 * @param string $class - html class attribute
239 239
 	 * @return string
240 240
 	 */
241
-	public static function ulx( $id = '', $class = '' ) {
242
-		return EEH_HTML::_close_tag( 'ul', $id, $class );
241
+	public static function ulx($id = '', $class = '') {
242
+		return EEH_HTML::_close_tag('ul', $id, $class);
243 243
 	}
244 244
 
245 245
 
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
257 257
 	 * @return string
258 258
 	 */
259
-	public static function li( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
260
-		return EEH_HTML::_open_tag( 'li', $content, $id, $class, $style, $other_attributes );
259
+	public static function li($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
260
+		return EEH_HTML::_open_tag('li', $content, $id, $class, $style, $other_attributes);
261 261
 	}
262 262
 
263 263
 
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 	 * @param string $class - html class attribute
271 271
 	 * @return string
272 272
 	 */
273
-	public static function lix( $id = '', $class = '' ) {
274
-		return EEH_HTML::_close_tag( 'li', $id, $class );
273
+	public static function lix($id = '', $class = '') {
274
+		return EEH_HTML::_close_tag('li', $id, $class);
275 275
 	}
276 276
 
277 277
 
@@ -287,8 +287,8 @@  discard block
 block discarded – undo
287 287
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
288 288
 	 * @return string
289 289
 	 */
290
-	public static function table( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
291
-		return EEH_HTML::_open_tag( 'table', $content, $id, $class, $style, $other_attributes );
290
+	public static function table($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
291
+		return EEH_HTML::_open_tag('table', $content, $id, $class, $style, $other_attributes);
292 292
 	}
293 293
 
294 294
 
@@ -300,8 +300,8 @@  discard block
 block discarded – undo
300 300
 	 * @param string $class - html class attribute
301 301
 	 * @return string
302 302
 	 */
303
-	public static function tablex( $id = '', $class = '' ) {
304
-		return EEH_HTML::_close_tag( 'table', $id, $class );
303
+	public static function tablex($id = '', $class = '') {
304
+		return EEH_HTML::_close_tag('table', $id, $class);
305 305
 	}
306 306
 
307 307
 
@@ -317,8 +317,8 @@  discard block
 block discarded – undo
317 317
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
318 318
 	 * @return string
319 319
 	 */
320
-	public static function thead( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
321
-		return EEH_HTML::_open_tag( 'thead', $content, $id, $class, $style, $other_attributes );
320
+	public static function thead($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
321
+		return EEH_HTML::_open_tag('thead', $content, $id, $class, $style, $other_attributes);
322 322
 	}
323 323
 
324 324
 
@@ -330,8 +330,8 @@  discard block
 block discarded – undo
330 330
 	 * @param string $class - html class attribute
331 331
 	 * @return string
332 332
 	 */
333
-	public static function theadx( $id = '', $class = '' ) {
334
-		return EEH_HTML::_close_tag( 'thead', $id, $class );
333
+	public static function theadx($id = '', $class = '') {
334
+		return EEH_HTML::_close_tag('thead', $id, $class);
335 335
 	}
336 336
 
337 337
 
@@ -347,8 +347,8 @@  discard block
 block discarded – undo
347 347
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
348 348
 	 * @return string
349 349
 	 */
350
-	public static function tbody( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
351
-		return EEH_HTML::_open_tag( 'tbody', $content, $id, $class, $style, $other_attributes );
350
+	public static function tbody($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
351
+		return EEH_HTML::_open_tag('tbody', $content, $id, $class, $style, $other_attributes);
352 352
 	}
353 353
 
354 354
 
@@ -360,8 +360,8 @@  discard block
 block discarded – undo
360 360
 	 * @param string $class - html class attribute
361 361
 	 * @return string
362 362
 	 */
363
-	public static function tbodyx( $id = '', $class = '' ) {
364
-		return EEH_HTML::_close_tag( 'tbody', $id, $class );
363
+	public static function tbodyx($id = '', $class = '') {
364
+		return EEH_HTML::_close_tag('tbody', $id, $class);
365 365
 	}
366 366
 
367 367
 
@@ -377,8 +377,8 @@  discard block
 block discarded – undo
377 377
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
378 378
 	 * @return string
379 379
 	 */
380
-	public static function tr( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
381
-		return EEH_HTML::_open_tag( 'tr', $content, $id, $class, $style, $other_attributes );
380
+	public static function tr($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
381
+		return EEH_HTML::_open_tag('tr', $content, $id, $class, $style, $other_attributes);
382 382
 	}
383 383
 
384 384
 
@@ -390,8 +390,8 @@  discard block
 block discarded – undo
390 390
 	 * @param string $class - html class attribute
391 391
 	 * @return string
392 392
 	 */
393
-	public static function trx( $id = '', $class = '' ) {
394
-		return EEH_HTML::_close_tag( 'tr', $id, $class );
393
+	public static function trx($id = '', $class = '') {
394
+		return EEH_HTML::_close_tag('tr', $id, $class);
395 395
 	}
396 396
 
397 397
 
@@ -407,8 +407,8 @@  discard block
 block discarded – undo
407 407
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
408 408
 	 * @return string
409 409
 	 */
410
-	public static function th( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
411
-		return EEH_HTML::_open_tag( 'th', $content, $id, $class, $style, $other_attributes );
410
+	public static function th($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
411
+		return EEH_HTML::_open_tag('th', $content, $id, $class, $style, $other_attributes);
412 412
 	}
413 413
 
414 414
 
@@ -420,8 +420,8 @@  discard block
 block discarded – undo
420 420
 	 * @param string $class - html class attribute
421 421
 	 * @return string
422 422
 	 */
423
-	public static function thx( $id = '', $class = '' ) {
424
-		return EEH_HTML::_close_tag( 'th', $id, $class );
423
+	public static function thx($id = '', $class = '') {
424
+		return EEH_HTML::_close_tag('th', $id, $class);
425 425
 	}
426 426
 
427 427
 
@@ -437,8 +437,8 @@  discard block
 block discarded – undo
437 437
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
438 438
 	 * @return string
439 439
 	 */
440
-	public static function td( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
441
-		return EEH_HTML::_open_tag( 'td', $content, $id, $class, $style, $other_attributes );
440
+	public static function td($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
441
+		return EEH_HTML::_open_tag('td', $content, $id, $class, $style, $other_attributes);
442 442
 	}
443 443
 
444 444
 
@@ -450,8 +450,8 @@  discard block
 block discarded – undo
450 450
 	 * @param string $class - html class attribute
451 451
 	 * @return string
452 452
 	 */
453
-	public static function tdx( $id = '', $class = '' ) {
454
-		return EEH_HTML::_close_tag( 'td', $id, $class );
453
+	public static function tdx($id = '', $class = '') {
454
+		return EEH_HTML::_close_tag('td', $id, $class);
455 455
 	}
456 456
 
457 457
 
@@ -465,10 +465,10 @@  discard block
 block discarded – undo
465 465
 	 * @param int    $colspan
466 466
 	 * @return string
467 467
 	 */
468
-	public static function no_row( $content = '', $colspan = 2 ) {
468
+	public static function no_row($content = '', $colspan = 2) {
469 469
 		return EEH_HTML::tr(
470
-			EEH_HTML::td( $content, '', '',  'padding:0; border:none;', 'colspan="' . $colspan . '"' ),
471
-			'', '',  'padding:0; border:none;'
470
+			EEH_HTML::td($content, '', '', 'padding:0; border:none;', 'colspan="'.$colspan.'"'),
471
+			'', '', 'padding:0; border:none;'
472 472
 		);
473 473
 	}
474 474
 
@@ -488,14 +488,14 @@  discard block
 block discarded – undo
488 488
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
489 489
 	 * @return string
490 490
 	 */
491
-	public static function link( $href = '', $link_text = '', $title = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
492
-		$link_text = ! empty( $link_text ) ? $link_text : $href;
493
-		$attributes = ! empty( $id ) ? ' id="' . EEH_HTML::sanitize_id( $id ) . '"' : '';
494
-		$attributes .= ! empty( $class ) ? ' class="' . $class . '"' : '';
495
-		$attributes .= ! empty( $style ) ? ' style="' . $style . '"' : '';
496
-		$attributes .= ! empty( $title ) ? ' title="' . esc_attr( $title ) . '"' : '';
497
-		$attributes .= ! empty( $other_attributes ) ? ' ' . $other_attributes : '';
498
-		return '<a href="' . $href . '" ' . $attributes . '>'  . $link_text  . '</a>';
491
+	public static function link($href = '', $link_text = '', $title = '', $id = '', $class = '', $style = '', $other_attributes = '') {
492
+		$link_text = ! empty($link_text) ? $link_text : $href;
493
+		$attributes = ! empty($id) ? ' id="'.EEH_HTML::sanitize_id($id).'"' : '';
494
+		$attributes .= ! empty($class) ? ' class="'.$class.'"' : '';
495
+		$attributes .= ! empty($style) ? ' style="'.$style.'"' : '';
496
+		$attributes .= ! empty($title) ? ' title="'.esc_attr($title).'"' : '';
497
+		$attributes .= ! empty($other_attributes) ? ' '.$other_attributes : '';
498
+		return '<a href="'.$href.'" '.$attributes.'>'.$link_text.'</a>';
499 499
 	}
500 500
 
501 501
 
@@ -512,14 +512,14 @@  discard block
 block discarded – undo
512 512
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
513 513
 	 * @return string
514 514
 	 */
515
-	public static function img( $src = '', $alt = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
516
-		$attributes = ! empty( $src ) ? ' src="' . esc_url_raw( $src ) . '"' : '';
517
-		$attributes .= ! empty( $alt ) ? ' alt="' . esc_attr( $alt ) . '"' : '';
518
-		$attributes .= ! empty( $id ) ? ' id="' . EEH_HTML::sanitize_id( $id ) . '"' : '';
519
-		$attributes .= ! empty( $class ) ? ' class="' . $class . '"' : '';
520
-		$attributes .= ! empty( $style ) ? ' style="' . $style . '"' : '';
521
-		$attributes .= ! empty( $other_attributes ) ? ' ' . $other_attributes : '';
522
-		return '<img' . $attributes  . '/>';
515
+	public static function img($src = '', $alt = '', $id = '', $class = '', $style = '', $other_attributes = '') {
516
+		$attributes = ! empty($src) ? ' src="'.esc_url_raw($src).'"' : '';
517
+		$attributes .= ! empty($alt) ? ' alt="'.esc_attr($alt).'"' : '';
518
+		$attributes .= ! empty($id) ? ' id="'.EEH_HTML::sanitize_id($id).'"' : '';
519
+		$attributes .= ! empty($class) ? ' class="'.$class.'"' : '';
520
+		$attributes .= ! empty($style) ? ' style="'.$style.'"' : '';
521
+		$attributes .= ! empty($other_attributes) ? ' '.$other_attributes : '';
522
+		return '<img'.$attributes.'/>';
523 523
 	}
524 524
 
525 525
 
@@ -537,12 +537,12 @@  discard block
 block discarded – undo
537 537
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
538 538
 	 * @return string
539 539
 	 */
540
-	protected static function _inline_tag( $tag = 'span', $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
541
-		$attributes = ! empty( $id ) ? ' id="' . EEH_HTML::sanitize_id( $id ) . '"' : '';
542
-		$attributes .= ! empty( $class ) ? ' class="' . $class . '"' : '';
543
-		$attributes .= ! empty( $style ) ? ' style="' . $style . '"' : '';
544
-		$attributes .= ! empty( $other_attributes ) ? ' ' . $other_attributes : '';
545
-		return '<' . $tag . ' ' . $attributes . '>'  . $content  . '</' . $tag . '>';
540
+	protected static function _inline_tag($tag = 'span', $content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
541
+		$attributes = ! empty($id) ? ' id="'.EEH_HTML::sanitize_id($id).'"' : '';
542
+		$attributes .= ! empty($class) ? ' class="'.$class.'"' : '';
543
+		$attributes .= ! empty($style) ? ' style="'.$style.'"' : '';
544
+		$attributes .= ! empty($other_attributes) ? ' '.$other_attributes : '';
545
+		return '<'.$tag.' '.$attributes.'>'.$content.'</'.$tag.'>';
546 546
 	}
547 547
 
548 548
 
@@ -558,8 +558,8 @@  discard block
 block discarded – undo
558 558
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
559 559
 	 * @return string
560 560
 	 */
561
-	public static function label( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
562
-		return EEH_HTML::_inline_tag( 'label', $content, $id, $class, $style, $other_attributes );
561
+	public static function label($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
562
+		return EEH_HTML::_inline_tag('label', $content, $id, $class, $style, $other_attributes);
563 563
 	}
564 564
 
565 565
 
@@ -575,8 +575,8 @@  discard block
 block discarded – undo
575 575
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
576 576
 	 * @return string
577 577
 	 */
578
-	public static function span( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
579
-		return EEH_HTML::_inline_tag( 'span', $content, $id, $class, $style, $other_attributes );
578
+	public static function span($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
579
+		return EEH_HTML::_inline_tag('span', $content, $id, $class, $style, $other_attributes);
580 580
 	}
581 581
 
582 582
 
@@ -592,8 +592,8 @@  discard block
 block discarded – undo
592 592
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
593 593
 	 * @return string
594 594
 	 */
595
-	public static function strong( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
596
-		return EEH_HTML::_inline_tag( 'strong', $content, $id, $class, $style, $other_attributes );
595
+	public static function strong($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
596
+		return EEH_HTML::_inline_tag('strong', $content, $id, $class, $style, $other_attributes);
597 597
 	}
598 598
 
599 599
 
@@ -605,8 +605,8 @@  discard block
 block discarded – undo
605 605
 	 * @param string $comment
606 606
 	 * @return string
607 607
 	 */
608
-	public static function comment( $comment = '' ) {
609
-		return ! empty( $comment ) ? EEH_HTML::nl() . '<!-- ' . $comment . ' -->' : '';
608
+	public static function comment($comment = '') {
609
+		return ! empty($comment) ? EEH_HTML::nl().'<!-- '.$comment.' -->' : '';
610 610
 	}
611 611
 
612 612
 
@@ -617,8 +617,8 @@  discard block
 block discarded – undo
617 617
 	 * @param int $nmbr - the number of line breaks to return
618 618
 	 * @return string
619 619
 	 */
620
-	public static function br( $nmbr = 1 ) {
621
-		return str_repeat( '<br />', $nmbr );
620
+	public static function br($nmbr = 1) {
621
+		return str_repeat('<br />', $nmbr);
622 622
 	}
623 623
 
624 624
 
@@ -629,8 +629,8 @@  discard block
 block discarded – undo
629 629
 	 * @param int $nmbr - the number of non-breaking spaces to return
630 630
 	 * @return string
631 631
 	 */
632
-	public static function nbsp( $nmbr = 1 ) {
633
-		return str_repeat( '&nbsp;', $nmbr );
632
+	public static function nbsp($nmbr = 1) {
633
+		return str_repeat('&nbsp;', $nmbr);
634 634
 	}
635 635
 
636 636
 
@@ -644,9 +644,9 @@  discard block
 block discarded – undo
644 644
 	 * @param string $id
645 645
 	 * @return string
646 646
 	 */
647
-	public static function sanitize_id( $id = '' ) {
648
-		$key = str_replace( ' ', '-', trim( $id ) );
649
-		return preg_replace( '/[^a-zA-Z0-9_\-]/', '', $key );
647
+	public static function sanitize_id($id = '') {
648
+		$key = str_replace(' ', '-', trim($id));
649
+		return preg_replace('/[^a-zA-Z0-9_\-]/', '', $key);
650 650
 	}
651 651
 
652 652
 
@@ -658,10 +658,10 @@  discard block
 block discarded – undo
658 658
 	 * @param string $tag
659 659
 	 * @return string - newline character plus # of indents passed (can be + or -)
660 660
 	 */
661
-	public static function nl( $indent = 0, $tag = 'none' ) {
661
+	public static function nl($indent = 0, $tag = 'none') {
662 662
 		$html = "\n";
663
-		EEH_HTML::indent( $indent, $tag );
664
-		for ( $x = 0; $x < EEH_HTML::$_indent[ $tag ]; $x++ ) {
663
+		EEH_HTML::indent($indent, $tag);
664
+		for ($x = 0; $x < EEH_HTML::$_indent[$tag]; $x++) {
665 665
 			$html .= "\t";
666 666
 		}
667 667
 		return $html;
@@ -676,17 +676,17 @@  discard block
 block discarded – undo
676 676
 	 * @param int    $indent can be negative to decrease the indentation level
677 677
 	 * @param string $tag
678 678
 	 */
679
-	public static function indent( $indent, $tag = 'none' ){
679
+	public static function indent($indent, $tag = 'none') {
680 680
 		static $default_indentation = FALSE;
681
-		if ( ! $default_indentation ) {
681
+		if ( ! $default_indentation) {
682 682
 			EEH_HTML::_set_default_indentation();
683 683
 			$default_indentation = TRUE;
684 684
 		}
685
-		if ( ! isset( EEH_HTML::$_indent[ $tag ] )) {
686
-			EEH_HTML::$_indent[ $tag ] = 0;
685
+		if ( ! isset(EEH_HTML::$_indent[$tag])) {
686
+			EEH_HTML::$_indent[$tag] = 0;
687 687
 		}
688
-		EEH_HTML::$_indent[ $tag ] += intval( $indent );
689
-		EEH_HTML::$_indent[ $tag ] = EEH_HTML::$_indent[ $tag ] >= 0 ? EEH_HTML::$_indent[ $tag ] : 0;
688
+		EEH_HTML::$_indent[$tag] += intval($indent);
689
+		EEH_HTML::$_indent[$tag] = EEH_HTML::$_indent[$tag] >= 0 ? EEH_HTML::$_indent[$tag] : 0;
690 690
 	}
691 691
 
692 692
 
Please login to merge, or discard this patch.