Completed
Branch BUG-10381-asset-loading (f91422)
by
unknown
170:16 queued 157:41
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   +36 added lines, -36 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
 	/**
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 	 * @param array $array
37 37
 	 * @return boolean
38 38
 	 */
39
-	public static function is_associative_array( array $array ) {
40
-		return array_keys( $array ) !== range( 0, count( $array ) - 1 );
39
+	public static function is_associative_array(array $array) {
40
+		return array_keys($array) !== range(0, count($array) - 1);
41 41
 	}
42 42
 
43 43
 	/**
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 * @param array $arr
47 47
 	 * @return mixed what ever is in the array
48 48
 	 */
49
-	public static function get_one_item_from_array($arr){
49
+	public static function get_one_item_from_array($arr) {
50 50
 		$item = end($arr);
51 51
 		reset($arr);
52 52
 		return $item;
@@ -57,16 +57,16 @@  discard block
 block discarded – undo
57 57
 	 * @param mixed $arr
58 58
 	 * @return boolean
59 59
 	 */
60
-	public static function is_multi_dimensional_array($arr){
61
-		if(is_array($arr)){
60
+	public static function is_multi_dimensional_array($arr) {
61
+		if (is_array($arr)) {
62 62
 			$first_item = reset($arr);
63
-			if(is_array($first_item)){
64
-				return true;//yep, there's at least 2 levels to this array
65
-			}else{
66
-				return false;//nope, only 1 level
63
+			if (is_array($first_item)) {
64
+				return true; //yep, there's at least 2 levels to this array
65
+			} else {
66
+				return false; //nope, only 1 level
67 67
 			}
68
-		}else{
69
-			return false;//its not an array at all!
68
+		} else {
69
+			return false; //its not an array at all!
70 70
 		}
71 71
 	}
72 72
 
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 	 * @param mixed $default
78 78
 	 * @return mixed
79 79
 	 */
80
-	public static function is_set( $arr, $index, $default ) {
81
-		return isset( $arr[ $index ] ) ? $arr[ $index ] : $default;
80
+	public static function is_set($arr, $index, $default) {
81
+		return isset($arr[$index]) ? $arr[$index] : $default;
82 82
 	}
83 83
 
84 84
 	/**
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
 	 * @param mixed $value usually a string, but could be an array or object
87 87
 	 * @return mixed the UN-serialized data
88 88
 	 */
89
-	public static function maybe_unserialize( $value ) {
89
+	public static function maybe_unserialize($value) {
90 90
 		$data = maybe_unserialize($value);
91 91
 		//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.
92 92
 		$token = 'C';
93 93
 		$data = is_string($data) ? trim($data) : $data;
94
-		if ( is_string($data) && strlen($data) > 1 && $data[0] == $token  && preg_match( "/^{$token}:[0-9]+:/s", $data ) ) {
94
+		if (is_string($data) && strlen($data) > 1 && $data[0] == $token && preg_match("/^{$token}:[0-9]+:/s", $data)) {
95 95
 			return unserialize($data);
96 96
 		} else {
97 97
 			return $data;
@@ -110,30 +110,30 @@  discard block
 block discarded – undo
110 110
 	 * @param bool $preserve_keys 		whether or not to reset numerically indexed arrays
111 111
 	 * @return array
112 112
 	 */
113
-	public static function insert_into_array( $target_array = array(), $array_to_insert = array(), $offset = null, $add_before = true, $preserve_keys = true ) {
113
+	public static function insert_into_array($target_array = array(), $array_to_insert = array(), $offset = null, $add_before = true, $preserve_keys = true) {
114 114
 		// ensure incoming arrays are actually arrays
115
-		$target_array 		= (array)$target_array;
116
-		$array_to_insert	= (array)$array_to_insert;
115
+		$target_array = (array) $target_array;
116
+		$array_to_insert = (array) $array_to_insert;
117 117
 		// if no offset key was supplied
118
-		if ( empty( $offset )) {
118
+		if (empty($offset)) {
119 119
 			// use start or end of $target_array based on whether we are adding before or not
120
-			$offset = $add_before ? 0 : count( $target_array );
120
+			$offset = $add_before ? 0 : count($target_array);
121 121
 		}
122 122
 		// if offset key is a string, then find the corresponding numeric location for that element
123
-		$offset = is_int( $offset ) ? $offset : array_search( $offset, array_keys( $target_array ) );
123
+		$offset = is_int($offset) ? $offset : array_search($offset, array_keys($target_array));
124 124
 		// add one to the offset if adding after
125 125
 		$offset = $add_before ? $offset : $offset + 1;
126 126
 		// but ensure offset does not exceed the length of the array
127
-		$offset = $offset > count( $target_array ) ? count( $target_array ) : $offset;
127
+		$offset = $offset > count($target_array) ? count($target_array) : $offset;
128 128
 		// reindex array ???
129
-		if ( $preserve_keys ) {
129
+		if ($preserve_keys) {
130 130
 			// take a slice of the target array from the beginning till the offset,
131 131
 			// then add the new data
132 132
 			// then add another slice that starts at the offset and goes till the end
133
-			return array_slice( $target_array, 0, $offset, true ) + $array_to_insert + array_slice( $target_array, $offset, null, true );
133
+			return array_slice($target_array, 0, $offset, true) + $array_to_insert + array_slice($target_array, $offset, null, true);
134 134
 		} else {
135 135
 			// since we don't want to preserve keys, we can use array_splice
136
-			array_splice( $target_array, $offset, 0, $array_to_insert );
136
+			array_splice($target_array, $offset, 0, $array_to_insert);
137 137
 			return $target_array;
138 138
 		}
139 139
 	}
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
 	 * @param array $array2
152 152
 	 * @return array
153 153
 	 */
154
-	public static function merge_arrays_and_overwrite_keys( array $array1, array $array2 ) {
155
-		foreach ( $array2 as $key => $value ) {
156
-			$array1[ $key ] = $value;
154
+	public static function merge_arrays_and_overwrite_keys(array $array1, array $array2) {
155
+		foreach ($array2 as $key => $value) {
156
+			$array1[$key] = $value;
157 157
 		}
158 158
 		return $array1;
159 159
 	}
@@ -171,14 +171,14 @@  discard block
 block discarded – undo
171 171
 	 * @param mixed $final_value
172 172
 	 * @return array
173 173
 	 */
174
-	public static function convert_array_values_to_keys( array $flat_array, $final_value = null ) {
174
+	public static function convert_array_values_to_keys(array $flat_array, $final_value = null) {
175 175
 		$multidimensional = array();
176 176
 		$reference = &$multidimensional;
177
-		foreach ( $flat_array as $key ) {
178
-			$reference[ $key ] = array();
179
-			$reference = &$reference[ $key ];
177
+		foreach ($flat_array as $key) {
178
+			$reference[$key] = array();
179
+			$reference = &$reference[$key];
180 180
 		}
181
-		if ( $final_value !== null ) {
181
+		if ($final_value !== null) {
182 182
 			$reference = $final_value;
183 183
 		}
184 184
 		return $multidimensional;
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   +52 added lines, -52 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
 /**
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
 	 * @return \EEH_Autoloader
51 51
 	 */
52 52
 	private function __construct() {
53
-		if ( self::$_autoloaders === null ) {
53
+		if (self::$_autoloaders === null) {
54 54
 			self::$_autoloaders = array();
55 55
 			$this->_register_custom_autoloaders();
56
-			spl_autoload_register( array( $this, 'espresso_autoloader' ) );
56
+			spl_autoload_register(array($this, 'espresso_autoloader'));
57 57
 		}
58 58
 	}
59 59
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	public static function instance() {
67 67
 		// check if class object is instantiated
68
-		if ( ! self::$_instance instanceof EEH_Autoloader ) {
68
+		if ( ! self::$_instance instanceof EEH_Autoloader) {
69 69
 			self::$_instance = new self();
70 70
 		}
71 71
 		return self::$_instance;
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
 	 * @internal  param string $class_name - simple class name ie: session
83 83
 	 * @return 	void
84 84
 	 */
85
-	public static function espresso_autoloader( $class_name ) {
86
-		if ( isset( self::$_autoloaders[ $class_name ] ) ) {
87
-			require_once( self::$_autoloaders[ $class_name ] );
85
+	public static function espresso_autoloader($class_name) {
86
+		if (isset(self::$_autoloaders[$class_name])) {
87
+			require_once(self::$_autoloaders[$class_name]);
88 88
 		}
89 89
 	}
90 90
 
@@ -99,26 +99,26 @@  discard block
 block discarded – undo
99 99
 	 * @param bool           $debug **deprecated**
100 100
 	 * @throws \EE_Error
101 101
 	 */
102
-	public static function register_autoloader( $class_paths, $read_check = true, $debug = false ) {
103
-		$class_paths = is_array( $class_paths ) ? $class_paths : array( $class_paths );
104
-		foreach ( $class_paths as $class => $path ) {
102
+	public static function register_autoloader($class_paths, $read_check = true, $debug = false) {
103
+		$class_paths = is_array($class_paths) ? $class_paths : array($class_paths);
104
+		foreach ($class_paths as $class => $path) {
105 105
 			// don't give up! you gotta...
106 106
 			// get some class
107
-			if ( empty( $class )) {
108
-				throw new EE_Error ( sprintf( __( 'No Class name was specified while registering an autoloader for the following path: %s.','event_espresso' ), $path ));
107
+			if (empty($class)) {
108
+				throw new EE_Error(sprintf(__('No Class name was specified while registering an autoloader for the following path: %s.', 'event_espresso'), $path));
109 109
 			}
110 110
 			// one day you will find the path young grasshopper
111
-			if ( empty( $path )) {
112
-				throw new EE_Error ( sprintf( __( 'No path was specified while registering an autoloader for the %s class.','event_espresso' ), $class ));
111
+			if (empty($path)) {
112
+				throw new EE_Error(sprintf(__('No path was specified while registering an autoloader for the %s class.', 'event_espresso'), $class));
113 113
 			}
114 114
 			// is file readable ?
115
-			if ( $read_check && ! is_readable( $path )) {
116
-				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 ));
115
+			if ($read_check && ! is_readable($path)) {
116
+				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));
117 117
 			}
118
-			if ( ! isset( self::$_autoloaders[ $class ] )) {
119
-				self::$_autoloaders[ $class ] = str_replace( array( '/', '\\' ), DS, $path );
120
-				if ( EE_DEBUG && ( EEH_Autoloader::$debug === 'paths' || EEH_Autoloader::$debug === 'all' || $debug ) ) {
121
-					EEH_Debug_Tools::printr( self::$_autoloaders[ $class ], $class, __FILE__, __LINE__ );
118
+			if ( ! isset(self::$_autoloaders[$class])) {
119
+				self::$_autoloaders[$class] = str_replace(array('/', '\\'), DS, $path);
120
+				if (EE_DEBUG && (EEH_Autoloader::$debug === 'paths' || EEH_Autoloader::$debug === 'all' || $debug)) {
121
+					EEH_Debug_Tools::printr(self::$_autoloaders[$class], $class, __FILE__, __LINE__);
122 122
 				}
123 123
 			}
124 124
 		}
@@ -149,14 +149,14 @@  discard block
 block discarded – undo
149 149
 	private function _register_custom_autoloaders() {
150 150
 		EEH_Autoloader::$debug = '';
151 151
 		\EEH_Autoloader::register_helpers_autoloaders();
152
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CORE . 'interfaces' );
153
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CORE );
154
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_INTERFACES, true );
155
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_MODELS, true );
156
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CLASSES );
157
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_FORM_SECTIONS, true );
158
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'messages' );
159
-		if ( EEH_Autoloader::$debug === 'times' || EEH_Autoloader::$debug === 'all' ) {
152
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'interfaces');
153
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE);
154
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_INTERFACES, true);
155
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_MODELS, true);
156
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CLASSES);
157
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_FORM_SECTIONS, true);
158
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'messages');
159
+		if (EEH_Autoloader::$debug === 'times' || EEH_Autoloader::$debug === 'all') {
160 160
 			EEH_Debug_Tools::instance()->show_times();
161 161
 		}
162 162
 	}
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 * @access public
170 170
 	 */
171 171
 	public static function register_helpers_autoloaders() {
172
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_HELPERS );
172
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS);
173 173
 	}
174 174
 
175 175
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 * 	@return void
196 196
 	 */
197 197
 	public static function register_line_item_display_autoloaders() {
198
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(  EE_LIBRARIES . 'line_item_display' , true );
198
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'line_item_display', true);
199 199
 	}
200 200
 
201 201
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	 * 	@return void
209 209
 	 */
210 210
 	public static function register_line_item_filter_autoloaders() {
211
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(  EE_LIBRARIES . 'line_item_filters' , true );
211
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'line_item_filters', true);
212 212
 	}
213 213
 
214 214
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	 * 	@return void
222 222
 	 */
223 223
 	public static function register_template_part_autoloaders() {
224
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'template_parts', true );
224
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'template_parts', true);
225 225
 	}
226 226
 
227 227
 
@@ -238,35 +238,35 @@  discard block
 block discarded – undo
238 238
 	 * @param bool   $debug  **deprecated**
239 239
 	 * @throws \EE_Error
240 240
 	 */
241
-	public static function register_autoloaders_for_each_file_in_folder( $folder, $recursive = false, $debug = false ){
242
-		if ( EEH_Autoloader::$debug === 'times' || EEH_Autoloader::$debug === 'all' || $debug ) {
243
-			EEH_Debug_Tools::instance()->start_timer( basename( $folder ) );
241
+	public static function register_autoloaders_for_each_file_in_folder($folder, $recursive = false, $debug = false) {
242
+		if (EEH_Autoloader::$debug === 'times' || EEH_Autoloader::$debug === 'all' || $debug) {
243
+			EEH_Debug_Tools::instance()->start_timer(basename($folder));
244 244
 		}
245 245
 		// make sure last char is a /
246
-		$folder .= $folder[strlen($folder)-1] !== DS ? DS : '';
246
+		$folder .= $folder[strlen($folder) - 1] !== DS ? DS : '';
247 247
 		$class_to_filepath_map = array();
248
-		$exclude = array( 'index' );
248
+		$exclude = array('index');
249 249
 		//get all the files in that folder that end in php
250
-		$filepaths = glob( $folder.'*');
250
+		$filepaths = glob($folder.'*');
251 251
 
252
-		if ( empty( $filepaths ) ) {
252
+		if (empty($filepaths)) {
253 253
 			return;
254 254
 		}
255 255
 
256
-		foreach( $filepaths as $filepath ) {
257
-			if ( substr( $filepath, -4, 4 ) === '.php' ) {
258
-				$class_name = EEH_File::get_classname_from_filepath_with_standard_filename( $filepath );
259
-				if ( ! in_array( $class_name, $exclude )) {
260
-					$class_to_filepath_map [ $class_name ] = $filepath;
256
+		foreach ($filepaths as $filepath) {
257
+			if (substr($filepath, -4, 4) === '.php') {
258
+				$class_name = EEH_File::get_classname_from_filepath_with_standard_filename($filepath);
259
+				if ( ! in_array($class_name, $exclude)) {
260
+					$class_to_filepath_map [$class_name] = $filepath;
261 261
 				}
262
-			} else if ( $recursive ) {
263
-				EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $filepath, $recursive, $debug );
262
+			} else if ($recursive) {
263
+				EEH_Autoloader::register_autoloaders_for_each_file_in_folder($filepath, $recursive, $debug);
264 264
 			}
265 265
 		}
266 266
 		// 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.
267
-		self::register_autoloader( $class_to_filepath_map, false, $debug );
268
-		if ( EEH_Autoloader::$debug === 'times' || EEH_Autoloader::$debug === 'all' ) {
269
-			EEH_Debug_Tools::instance()->stop_timer( basename( $folder ) );
267
+		self::register_autoloader($class_to_filepath_map, false, $debug);
268
+		if (EEH_Autoloader::$debug === 'times' || EEH_Autoloader::$debug === 'all') {
269
+			EEH_Debug_Tools::instance()->stop_timer(basename($folder));
270 270
 		}
271 271
 	}
272 272
 
@@ -280,9 +280,9 @@  discard block
 block discarded – undo
280 280
 	 * @param string $class_name - simple class name ie: EE_Session
281 281
 	 * @param string $alias - variation on class name ie: EE_session, session, etc
282 282
 	 */
283
-	public static function add_alias( $class_name, $alias ) {
284
-		if ( isset( self::$_autoloaders[ $class_name ] ) ) {
285
-			self::$_autoloaders[ $alias ] = self::$_autoloaders[ $class_name ];
283
+	public static function add_alias($class_name, $alias) {
284
+		if (isset(self::$_autoloaders[$class_name])) {
285
+			self::$_autoloaders[$alias] = self::$_autoloaders[$class_name];
286 286
 		}
287 287
 	}
288 288
 
Please login to merge, or discard this patch.
core/helpers/EEH_Base.helper.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 	 *		@ override magic methods
34 34
 	 *		@ return void
35 35
 	 */	
36
-	public function __set($a,$b) { return FALSE; }
36
+	public function __set($a, $b) { return FALSE; }
37 37
 	public function __get($a) { return FALSE; }
38 38
 	public function __isset($a) { return FALSE; }
39 39
 	public function __unset($a) { return FALSE; }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/helpers/EEH_DTT_Helper.helper.php 3 patches
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.
Indentation   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 		}
118 118
 		// better have a valid timezone string by now, but if not, sigh... loop thru  the timezone_abbreviations_list()...
119 119
 		$timezone_string = $timezone_string !== false
120
-            ? $timezone_string
121
-            : EEH_DTT_Helper::get_timezone_string_from_abbreviations_list( $gmt_offset );
120
+			? $timezone_string
121
+			: EEH_DTT_Helper::get_timezone_string_from_abbreviations_list( $gmt_offset );
122 122
 		return $timezone_string;
123 123
 	}
124 124
 
@@ -819,7 +819,6 @@  discard block
 block discarded – undo
819 819
 
820 820
 
821 821
 	/**
822
-
823 822
 	 *
824 823
 	 * 	 If the the first date starts at midnight on one day, and the next date ends at midnight on the
825 824
 	 * 	 very next day then this method will return true.
Please login to merge, or discard this patch.
Spacing   +142 added lines, -143 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,21 +104,21 @@  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 119
 		$timezone_string = $timezone_string !== false
120 120
             ? $timezone_string
121
-            : EEH_DTT_Helper::get_timezone_string_from_abbreviations_list( $gmt_offset );
121
+            : EEH_DTT_Helper::get_timezone_string_from_abbreviations_list($gmt_offset);
122 122
 		return $timezone_string;
123 123
 	}
124 124
 
@@ -129,15 +129,15 @@  discard block
 block discarded – undo
129 129
 	 * @return int seconds offset
130 130
 	 */
131 131
 	public static function get_site_timezone_gmt_offset() {
132
-		$timezone_string = get_option( 'timezone_string' );
133
-		if ( $timezone_string ) {
132
+		$timezone_string = get_option('timezone_string');
133
+		if ($timezone_string) {
134 134
 			try {
135
-				$timezone = new DateTimeZone( $timezone_string );
136
-				return $timezone->getOffset( new DateTime() ); //in WordPress DateTime defaults to UTC
137
-			} catch( Exception $e ){}
135
+				$timezone = new DateTimeZone($timezone_string);
136
+				return $timezone->getOffset(new DateTime()); //in WordPress DateTime defaults to UTC
137
+			} catch (Exception $e) {}
138 138
 		}
139
-		$offset = get_option( 'gmt_offset' );
140
-		return (int) ( $offset * HOUR_IN_SECONDS );
139
+		$offset = get_option('gmt_offset');
140
+		return (int) ($offset * HOUR_IN_SECONDS);
141 141
 	}
142 142
 
143 143
 
@@ -149,10 +149,10 @@  discard block
 block discarded – undo
149 149
 	 * @param int $gmt_offset
150 150
 	 * @return int
151 151
 	 */
152
-	public static function adjust_invalid_gmt_offsets( $gmt_offset = 0 ) {
152
+	public static function adjust_invalid_gmt_offsets($gmt_offset = 0) {
153 153
 		//make sure $gmt_offset is int
154 154
 		$gmt_offset = (int) $gmt_offset;
155
-		switch ( $gmt_offset ) {
155
+		switch ($gmt_offset) {
156 156
 
157 157
 			//			case -30600 :
158 158
 			//				$gmt_offset = -28800;
@@ -204,13 +204,13 @@  discard block
 block discarded – undo
204 204
 	 * @return string
205 205
 	 * @throws \EE_Error
206 206
 	 */
207
-	public static function get_timezone_string_from_abbreviations_list( $gmt_offset = 0 ) {
207
+	public static function get_timezone_string_from_abbreviations_list($gmt_offset = 0) {
208 208
 		$abbreviations = timezone_abbreviations_list();
209
-		foreach ( $abbreviations as $abbreviation ) {
210
-			foreach ( $abbreviation as $city ) {
211
-				if ( $city['offset'] === $gmt_offset && $city['dst'] === FALSE ) {
209
+		foreach ($abbreviations as $abbreviation) {
210
+			foreach ($abbreviation as $city) {
211
+				if ($city['offset'] === $gmt_offset && $city['dst'] === FALSE) {
212 212
 					// check if the timezone is valid but don't throw any errors if it isn't
213
-					if ( EEH_DTT_Helper::validate_timezone( $city['timezone_id'], false ) ) {
213
+					if (EEH_DTT_Helper::validate_timezone($city['timezone_id'], false)) {
214 214
 						return $city['timezone_id'];
215 215
 					}
216 216
 				}
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 		}
219 219
 		throw new EE_Error(
220 220
 			sprintf(
221
-				__( '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' ),
221
+				__('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'),
222 222
 				$gmt_offset,
223 223
 				'<a href="http://www.php.net/manual/en/timezones.php">',
224 224
 				'</a>'
@@ -232,23 +232,23 @@  discard block
 block discarded – undo
232 232
 	 * @access public
233 233
 	 * @param string $timezone_string
234 234
 	 */
235
-	public static function timezone_select_input( $timezone_string = '' ) {
235
+	public static function timezone_select_input($timezone_string = '') {
236 236
 		// get WP date time format
237
-		$datetime_format = get_option('date_format') . ' '  . get_option('time_format');
237
+		$datetime_format = get_option('date_format').' '.get_option('time_format');
238 238
 		// if passed a value, then use that, else get WP option
239
-		$timezone_string = ! empty( $timezone_string ) ? $timezone_string : get_option( 'timezone_string' );
239
+		$timezone_string = ! empty($timezone_string) ? $timezone_string : get_option('timezone_string');
240 240
 		// check if the timezone is valid but don't throw any errors if it isn't
241
-		$timezone_string = EEH_DTT_Helper::validate_timezone( $timezone_string, false );
241
+		$timezone_string = EEH_DTT_Helper::validate_timezone($timezone_string, false);
242 242
 		$gmt_offset = get_option('gmt_offset');
243 243
 
244 244
 		$check_zone_info = true;
245
-		if ( empty( $timezone_string )) {
245
+		if (empty($timezone_string)) {
246 246
 			// Create a UTC+- zone if no timezone string exists
247 247
 			$check_zone_info = false;
248
-			if ( $gmt_offset > 0 ) {
249
-				$timezone_string = 'UTC+' . $gmt_offset;
250
-			} elseif ( $gmt_offset < 0 ) {
251
-				$timezone_string = 'UTC' . $gmt_offset;
248
+			if ($gmt_offset > 0) {
249
+				$timezone_string = 'UTC+'.$gmt_offset;
250
+			} elseif ($gmt_offset < 0) {
251
+				$timezone_string = 'UTC'.$gmt_offset;
252 252
 			} else {
253 253
 				$timezone_string = 'UTC';
254 254
 			}
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
 					__('%1$sUTC%2$s time is %3$s'),
271 271
 					'<abbr title="Coordinated Universal Time">',
272 272
 					'</abbr>',
273
-					'<code>' . date_i18n( $datetime_format , false, true ) . '</code>'
273
+					'<code>'.date_i18n($datetime_format, false, true).'</code>'
274 274
 				);
275 275
 				?></span>
276
-			<?php if ( ! empty( $timezone_string ) || ! empty( $gmt_offset )) : ?>
277
-				<br /><span><?php printf(__('Local time is %1$s'), '<code>' . date_i18n( $datetime_format ) . '</code>' ); ?></span>
276
+			<?php if ( ! empty($timezone_string) || ! empty($gmt_offset)) : ?>
277
+				<br /><span><?php printf(__('Local time is %1$s'), '<code>'.date_i18n($datetime_format).'</code>'); ?></span>
278 278
 		<?php endif; ?>
279 279
 
280 280
 				<?php if ($check_zone_info && $timezone_string) : ?>
@@ -306,10 +306,9 @@  discard block
 block discarded – undo
306 306
 
307 307
 						if ($found) {
308 308
 							$message = $tr['isdst'] ?
309
-											__(' Daylight saving time begins on: %s.' ) :
310
-											__(' Standard time begins  on: %s.');
309
+											__(' Daylight saving time begins on: %s.') : __(' Standard time begins  on: %s.');
311 310
 							// Add the difference between the current offset and the new offset to ts to get the correct transition time from date_i18n().
312
-							printf( $message, '<code >' . date_i18n( $datetime_format, $tr['ts'] + ( $tz_offset - $tr['offset'] ) ). '</code >' );
311
+							printf($message, '<code >'.date_i18n($datetime_format, $tr['ts'] + ($tz_offset - $tr['offset'])).'</code >');
313 312
 						} else {
314 313
 							_e('This timezone does not observe daylight saving time.');
315 314
 						}
@@ -339,14 +338,14 @@  discard block
 block discarded – undo
339 338
 	 *
340 339
 	 * @return int      $unix_timestamp with the offset applied for the given timezone.
341 340
 	 */
342
-	public static function get_timestamp_with_offset( $unix_timestamp = 0, $timezone_string = '' ) {
341
+	public static function get_timestamp_with_offset($unix_timestamp = 0, $timezone_string = '') {
343 342
 		$unix_timestamp = $unix_timestamp === 0 ? time() : (int) $unix_timestamp;
344
-		$timezone_string = self::get_valid_timezone_string( $timezone_string );
345
-		$TimeZone = new DateTimeZone( $timezone_string );
343
+		$timezone_string = self::get_valid_timezone_string($timezone_string);
344
+		$TimeZone = new DateTimeZone($timezone_string);
346 345
 
347
-		$DateTime = new DateTime( '@' . $unix_timestamp, $TimeZone );
348
-		$offset = timezone_offset_get( $TimeZone, $DateTime );
349
-		return (int)$DateTime->format( 'U' ) + (int)$offset;
346
+		$DateTime = new DateTime('@'.$unix_timestamp, $TimeZone);
347
+		$offset = timezone_offset_get($TimeZone, $DateTime);
348
+		return (int) $DateTime->format('U') + (int) $offset;
350 349
 	}
351 350
 
352 351
 
@@ -361,17 +360,17 @@  discard block
 block discarded – undo
361 360
 	 * @param  string					$datetime_field_name 	the datetime fieldname to be manipulated
362 361
 	 * @return 	EE_Base_Class
363 362
 	 */
364
-	protected static function _set_date_time_field( EE_Base_Class $obj, DateTime $DateTime, $datetime_field_name ) {
363
+	protected static function _set_date_time_field(EE_Base_Class $obj, DateTime $DateTime, $datetime_field_name) {
365 364
 		// grab current datetime format
366 365
 		$current_format = $obj->get_format();
367 366
 		// set new full timestamp format
368
-		$obj->set_date_format( EE_Datetime_Field::mysql_date_format );
369
-		$obj->set_time_format( EE_Datetime_Field::mysql_time_format );
367
+		$obj->set_date_format(EE_Datetime_Field::mysql_date_format);
368
+		$obj->set_time_format(EE_Datetime_Field::mysql_time_format);
370 369
 		// set the new date value using a full timestamp format so that no data is lost
371
-		$obj->set( $datetime_field_name, $DateTime->format( EE_Datetime_Field::mysql_timestamp_format ) );
370
+		$obj->set($datetime_field_name, $DateTime->format(EE_Datetime_Field::mysql_timestamp_format));
372 371
 		// reset datetime formats
373
-		$obj->set_date_format( $current_format[0] );
374
-		$obj->set_time_format( $current_format[1] );
372
+		$obj->set_date_format($current_format[0]);
373
+		$obj->set_time_format($current_format[1]);
375 374
 		return $obj;
376 375
 	}
377 376
 
@@ -388,11 +387,11 @@  discard block
 block discarded – undo
388 387
 	 * @param  integer 	$value    what you want to increment the time by
389 388
 	 * @return EE_Base_Class		   return the EE_Base_Class object so right away you can do something with it (chaining)
390 389
 	 */
391
-	public static function date_time_add( EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1 ) {
390
+	public static function date_time_add(EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1) {
392 391
 		//get the raw UTC date.
393
-		$DateTime = $obj->get_DateTime_object( $datetime_field_name );
394
-		$DateTime = EEH_DTT_Helper::calc_date( $DateTime, $period, $value );
395
-		return EEH_DTT_Helper::_set_date_time_field( $obj, $DateTime, $datetime_field_name );
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);
396 395
 	}
397 396
 
398 397
 
@@ -407,11 +406,11 @@  discard block
 block discarded – undo
407 406
 	 * @param int            $value
408 407
 	 * @return \EE_Base_Class
409 408
 	 */
410
-	public static function date_time_subtract( EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1 ) {
409
+	public static function date_time_subtract(EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1) {
411 410
 		//get the raw UTC date
412
-		$DateTime = $obj->get_DateTime_object( $datetime_field_name );
413
-		$DateTime = EEH_DTT_Helper::calc_date( $DateTime, $period, $value, '-' );
414
-		return EEH_DTT_Helper::_set_date_time_field( $obj, $DateTime, $datetime_field_name );
411
+		$DateTime = $obj->get_DateTime_object($datetime_field_name);
412
+		$DateTime = EEH_DTT_Helper::calc_date($DateTime, $period, $value, '-');
413
+		return EEH_DTT_Helper::_set_date_time_field($obj, $DateTime, $datetime_field_name);
415 414
 	}
416 415
 
417 416
 
@@ -424,44 +423,44 @@  discard block
 block discarded – undo
424 423
 	 * @return \DateTime return whatever type came in.
425 424
 	 * @throws \EE_Error
426 425
 	 */
427
-	protected static function _modify_datetime_object( DateTime $DateTime, $period = 'years', $value = 1, $operand = '+' ) {
428
-		if ( ! $DateTime instanceof DateTime ) {
426
+	protected static function _modify_datetime_object(DateTime $DateTime, $period = 'years', $value = 1, $operand = '+') {
427
+		if ( ! $DateTime instanceof DateTime) {
429 428
 			throw new EE_Error(
430 429
 				sprintf(
431
-					__( 'Expected a PHP DateTime object, but instead received %1$s', 'event_espresso' ),
432
-					print_r( $DateTime, true )
430
+					__('Expected a PHP DateTime object, but instead received %1$s', 'event_espresso'),
431
+					print_r($DateTime, true)
433 432
 				)
434 433
 			);
435 434
 		}
436
-		switch ( $period ) {
435
+		switch ($period) {
437 436
 			case 'years' :
438
-				$value = 'P' . $value . 'Y';
437
+				$value = 'P'.$value.'Y';
439 438
 				break;
440 439
 			case 'months' :
441
-				$value = 'P' . $value . 'M';
440
+				$value = 'P'.$value.'M';
442 441
 				break;
443 442
 			case 'weeks' :
444
-				$value = 'P' . $value . 'W';
443
+				$value = 'P'.$value.'W';
445 444
 				break;
446 445
 			case 'days' :
447
-				$value = 'P' . $value . 'D';
446
+				$value = 'P'.$value.'D';
448 447
 				break;
449 448
 			case 'hours' :
450
-				$value = 'PT' . $value . 'H';
449
+				$value = 'PT'.$value.'H';
451 450
 				break;
452 451
 			case 'minutes' :
453
-				$value = 'PT' . $value . 'M';
452
+				$value = 'PT'.$value.'M';
454 453
 				break;
455 454
 			case 'seconds' :
456
-				$value = 'PT' . $value . 'S';
455
+				$value = 'PT'.$value.'S';
457 456
 				break;
458 457
 		}
459
-		switch ( $operand ) {
458
+		switch ($operand) {
460 459
 			case '+':
461
-				$DateTime->add( new DateInterval( $value ) );
460
+				$DateTime->add(new DateInterval($value));
462 461
 				break;
463 462
 			case '-':
464
-				$DateTime->sub( new DateInterval( $value ) );
463
+				$DateTime->sub(new DateInterval($value));
465 464
 				break;
466 465
 		}
467 466
 		return $DateTime;
@@ -477,16 +476,16 @@  discard block
 block discarded – undo
477 476
 	 * @return \DateTime return whatever type came in.
478 477
 	 * @throws \EE_Error
479 478
 	 */
480
-	protected static function _modify_timestamp( $timestamp, $period = 'years', $value = 1, $operand = '+' ) {
481
-		if ( ! preg_match( EE_Datetime_Field::unix_timestamp_regex, $timestamp ) ) {
479
+	protected static function _modify_timestamp($timestamp, $period = 'years', $value = 1, $operand = '+') {
480
+		if ( ! preg_match(EE_Datetime_Field::unix_timestamp_regex, $timestamp)) {
482 481
 			throw new EE_Error(
483 482
 				sprintf(
484
-					__( 'Expected a Unix timestamp, but instead received %1$s', 'event_espresso' ),
485
-					print_r( $timestamp, true )
483
+					__('Expected a Unix timestamp, but instead received %1$s', 'event_espresso'),
484
+					print_r($timestamp, true)
486 485
 				)
487 486
 			);
488 487
 		}
489
-		switch ( $period ) {
488
+		switch ($period) {
490 489
 			case 'years' :
491 490
 				$value = YEAR_IN_SECONDS * $value;
492 491
 				break;
@@ -506,9 +505,9 @@  discard block
 block discarded – undo
506 505
 				$value = MINUTE_IN_SECONDS * $value;
507 506
 				break;
508 507
 		}
509
-		switch ( $operand ) {
508
+		switch ($operand) {
510 509
 			case '+':
511
-				$timestamp  += $value;
510
+				$timestamp += $value;
512 511
 				break;
513 512
 			case '-':
514 513
 				$timestamp -= $value;
@@ -528,11 +527,11 @@  discard block
 block discarded – undo
528 527
 	 * @param  string  $operand What operand you wish to use for the calculation
529 528
 	 * @return mixed string|DateTime          return whatever type came in.
530 529
 	 */
531
-	public static function calc_date( $DateTime_or_timestamp, $period = 'years', $value = 1, $operand = '+' ) {
532
-		if ( $DateTime_or_timestamp instanceof DateTime ) {
533
-			return EEH_DTT_Helper::_modify_datetime_object( $DateTime_or_timestamp, $period, $value, $operand );
534
-		} else if ( preg_match( EE_Datetime_Field::unix_timestamp_regex, $DateTime_or_timestamp )) {
535
-			return EEH_DTT_Helper::_modify_timestamp( $DateTime_or_timestamp, $period, $value, $operand );
530
+	public static function calc_date($DateTime_or_timestamp, $period = 'years', $value = 1, $operand = '+') {
531
+		if ($DateTime_or_timestamp instanceof DateTime) {
532
+			return EEH_DTT_Helper::_modify_datetime_object($DateTime_or_timestamp, $period, $value, $operand);
533
+		} else if (preg_match(EE_Datetime_Field::unix_timestamp_regex, $DateTime_or_timestamp)) {
534
+			return EEH_DTT_Helper::_modify_timestamp($DateTime_or_timestamp, $period, $value, $operand);
536 535
 		} else {
537 536
 			//error
538 537
 			return $DateTime_or_timestamp;
@@ -562,24 +561,24 @@  discard block
 block discarded – undo
562 561
 	 * 			'moment' => //date and time format.
563 562
 	 * 		)
564 563
 	 */
565
-	public static function convert_php_to_js_and_moment_date_formats( $date_format_string = null, $time_format_string = null ) {
566
-		if ( $date_format_string === null ) {
567
-			$date_format_string = get_option( 'date_format' );
564
+	public static function convert_php_to_js_and_moment_date_formats($date_format_string = null, $time_format_string = null) {
565
+		if ($date_format_string === null) {
566
+			$date_format_string = get_option('date_format');
568 567
 		}
569 568
 
570
-		if ( $time_format_string === null ) {
571
-			$time_format_string = get_option( 'time_format' );
569
+		if ($time_format_string === null) {
570
+			$time_format_string = get_option('time_format');
572 571
 		}
573 572
 
574
-		$date_format = self::_php_to_js_moment_converter( $date_format_string );
575
-		$time_format = self::_php_to_js_moment_converter( $time_format_string );
573
+		$date_format = self::_php_to_js_moment_converter($date_format_string);
574
+		$time_format = self::_php_to_js_moment_converter($time_format_string);
576 575
 
577 576
 		return array(
578 577
 			'js' => array(
579 578
 				'date' => $date_format['js'],
580 579
 				'time' => $time_format['js']
581 580
 				),
582
-			'moment' => $date_format['moment'] . ' ' . $time_format['moment' ]
581
+			'moment' => $date_format['moment'].' '.$time_format['moment']
583 582
 			);
584 583
 	}
585 584
 
@@ -593,7 +592,7 @@  discard block
 block discarded – undo
593 592
 	 *
594 593
 	 * @return array js and moment formats.
595 594
 	 */
596
-	protected static function _php_to_js_moment_converter( $format_string ) {
595
+	protected static function _php_to_js_moment_converter($format_string) {
597 596
 		/**
598 597
 		 * This is a map of symbols for formats.
599 598
 		 * The index is the php symbol, the equivalent values are in the array.
@@ -750,15 +749,15 @@  discard block
 block discarded – undo
750 749
 		$jquery_ui_format = "";
751 750
 		$moment_format = "";
752 751
 		$escaping = false;
753
-		for ( $i = 0; $i < strlen($format_string); $i++ ) {
752
+		for ($i = 0; $i < strlen($format_string); $i++) {
754 753
 			$char = $format_string[$i];
755
-			if ( $char === '\\' )  { // PHP date format escaping character
754
+			if ($char === '\\') { // PHP date format escaping character
756 755
 				$i++;
757
-				if ( $escaping ) {
756
+				if ($escaping) {
758 757
 					$jquery_ui_format .= $format_string[$i];
759 758
 					$moment_format .= $format_string[$i];
760 759
 				} else {
761
-					$jquery_ui_format .= '\'' . $format_string[$i];
760
+					$jquery_ui_format .= '\''.$format_string[$i];
762 761
 					$moment_format .= $format_string[$i];
763 762
 				}
764 763
 				$escaping = true;
@@ -777,7 +776,7 @@  discard block
 block discarded – undo
777 776
 				}
778 777
 			}
779 778
 		}
780
-		return array( 'js' => $jquery_ui_format, 'moment' => $moment_format );
779
+		return array('js' => $jquery_ui_format, 'moment' => $moment_format);
781 780
 	}
782 781
 
783 782
 
@@ -792,25 +791,25 @@  discard block
 block discarded – undo
792 791
 	 *                           		errors is returned.  So for client code calling, check for is_array() to
793 792
 	 *                           		indicate failed validations.
794 793
 	 */
795
-	public static function validate_format_string( $format_string ) {
794
+	public static function validate_format_string($format_string) {
796 795
 		$error_msg = array();
797 796
 		//time format checks
798
-		switch ( true ) {
799
-			case   strpos( $format_string, 'h' )  !== false  :
800
-			case   strpos( $format_string, 'g' ) !== false :
797
+		switch (true) {
798
+			case   strpos($format_string, 'h') !== false  :
799
+			case   strpos($format_string, 'g') !== false :
801 800
 				/**
802 801
 				 * if the time string has a lowercase 'h' which == 12 hour time format and there
803 802
 				 * is not any ante meridiem format ('a' or 'A').  Then throw an error because its
804 803
 				 * too ambiguous and PHP won't be able to figure out whether 1 = 1pm or 1am.
805 804
 				 */
806
-				if ( strpos( strtoupper( $format_string ), 'A' )  === false ) {
807
-					$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' );
805
+				if (strpos(strtoupper($format_string), 'A') === false) {
806
+					$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');
808 807
 				}
809 808
 				break;
810 809
 
811 810
 		}
812 811
 
813
-		return empty( $error_msg ) ? true : $error_msg;
812
+		return empty($error_msg) ? true : $error_msg;
814 813
 	}
815 814
 
816 815
 
@@ -832,11 +831,11 @@  discard block
 block discarded – undo
832 831
 	 * @param mixed $date_2
833 832
 	 * @return bool
834 833
 	 */
835
-	public static function dates_represent_one_24_hour_date( $date_1, $date_2 ) {
834
+	public static function dates_represent_one_24_hour_date($date_1, $date_2) {
836 835
 
837 836
 		if (
838
-			( ! $date_1 instanceof DateTime || ! $date_2 instanceof DateTime ) ||
839
-			( $date_1->format( EE_Datetime_Field::mysql_time_format ) != '00:00:00' || $date_2->format( EE_Datetime_Field::mysql_time_format ) != '00:00:00' )
837
+			( ! $date_1 instanceof DateTime || ! $date_2 instanceof DateTime) ||
838
+			($date_1->format(EE_Datetime_Field::mysql_time_format) != '00:00:00' || $date_2->format(EE_Datetime_Field::mysql_time_format) != '00:00:00')
840 839
 		) {
841 840
 			return false;
842 841
 		}
@@ -853,11 +852,11 @@  discard block
 block discarded – undo
853 852
 	 * @param string $field_for_interval  The Database field that is the interval is applied to in the query.
854 853
 	 * @return string
855 854
 	 */
856
-	public static function get_sql_query_interval_for_offset( $timezone_string, $field_for_interval ) {
855
+	public static function get_sql_query_interval_for_offset($timezone_string, $field_for_interval) {
857 856
 		try {
858 857
 			/** need to account for timezone offset on the selects */
859
-			$DateTimeZone = new DateTimeZone( $timezone_string );
860
-		} catch ( Exception $e ) {
858
+			$DateTimeZone = new DateTimeZone($timezone_string);
859
+		} catch (Exception $e) {
861 860
 			$DateTimeZone = null;
862 861
 		}
863 862
 
@@ -865,10 +864,10 @@  discard block
 block discarded – undo
865 864
 		 * Note get_option( 'gmt_offset') returns a value in hours, whereas DateTimeZone::getOffset returns values in seconds.
866 865
 		 * Hence we do the calc for DateTimeZone::getOffset.
867 866
 		 */
868
-		$offset = $DateTimeZone instanceof DateTimeZone ? ( $DateTimeZone->getOffset( new DateTime('now') ) ) / HOUR_IN_SECONDS : get_option( 'gmt_offset' );
867
+		$offset = $DateTimeZone instanceof DateTimeZone ? ($DateTimeZone->getOffset(new DateTime('now'))) / HOUR_IN_SECONDS : get_option('gmt_offset');
869 868
 		$query_interval = $offset < 0
870
-			? 'DATE_SUB(' . $field_for_interval . ', INTERVAL ' . $offset*-1 . ' HOUR)'
871
-			: 'DATE_ADD(' . $field_for_interval .', INTERVAL ' . $offset . ' HOUR)';
869
+			? 'DATE_SUB('.$field_for_interval.', INTERVAL '.$offset * -1.' HOUR)'
870
+			: 'DATE_ADD('.$field_for_interval.', INTERVAL '.$offset.' HOUR)';
872 871
 		return $query_interval;
873 872
 	}
874 873
 
@@ -880,47 +879,47 @@  discard block
 block discarded – undo
880 879
 	 * @return string
881 880
 	 */
882 881
 	public static function get_timezone_string_for_display() {
883
-		$pretty_timezone = apply_filters( 'FHEE__EEH_DTT_Helper__get_timezone_string_for_display', '' );
884
-		if( ! empty( $pretty_timezone ) ) {
885
-			return esc_html( $pretty_timezone );
882
+		$pretty_timezone = apply_filters('FHEE__EEH_DTT_Helper__get_timezone_string_for_display', '');
883
+		if ( ! empty($pretty_timezone)) {
884
+			return esc_html($pretty_timezone);
886 885
 		}
887
-		$timezone_string = get_option( 'timezone_string' );
888
-		if( $timezone_string ) {
886
+		$timezone_string = get_option('timezone_string');
887
+		if ($timezone_string) {
889 888
 			static $mo_loaded = false;
890 889
 			// Load translations for continents and cities just like wp_timezone_choice does
891
-			if ( ! $mo_loaded ) {
890
+			if ( ! $mo_loaded) {
892 891
 				$locale = get_locale();
893
-				$mofile = WP_LANG_DIR . '/continents-cities-' . $locale . '.mo';
894
-				load_textdomain( 'continents-cities', $mofile );
892
+				$mofile = WP_LANG_DIR.'/continents-cities-'.$locale.'.mo';
893
+				load_textdomain('continents-cities', $mofile);
895 894
 				$mo_loaded = true;
896 895
 			}
897 896
 			//well that was easy.
898
-			$parts = explode('/', $timezone_string );
897
+			$parts = explode('/', $timezone_string);
899 898
 			//remove the continent
900
-			unset( $parts[0] );
899
+			unset($parts[0]);
901 900
 			$t_parts = array();
902
-			foreach( $parts as $part ) {
903
-				$t_parts[] = translate( str_replace( '_', ' ', $part ), 'continents-cities' );
901
+			foreach ($parts as $part) {
902
+				$t_parts[] = translate(str_replace('_', ' ', $part), 'continents-cities');
904 903
 			}
905
-			return implode( ' - ', $t_parts );
904
+			return implode(' - ', $t_parts);
906 905
 		}
907 906
 		//they haven't set the timezone string, so let's return a string like "UTC+1"
908
-		$gmt_offset = get_option( 'gmt_offset' );
909
-		if( intval( $gmt_offset ) >= 0 ) {
907
+		$gmt_offset = get_option('gmt_offset');
908
+		if (intval($gmt_offset) >= 0) {
910 909
 			$prefix = '+';
911 910
 		} else {
912 911
 			$prefix = '';
913 912
 		}
914
-		$parts = explode( '.', (string) $gmt_offset );
915
-		if( count( $parts ) === 1 ) {
913
+		$parts = explode('.', (string) $gmt_offset);
914
+		if (count($parts) === 1) {
916 915
 			$parts[1] = '00';
917 916
 		} else {
918 917
 			//convert the part after the decimal, eg "5" (from x.5) or "25" (from x.25)
919 918
 			//to minutes, eg 30 or 15, respectively
920
-			$hour_fraction = (float)( '0.' . $parts[1] );
921
-			$parts[1] = (string)$hour_fraction * 60;
919
+			$hour_fraction = (float) ('0.'.$parts[1]);
920
+			$parts[1] = (string) $hour_fraction * 60;
922 921
 		}
923
-		return sprintf( __( 'UTC%1$s', 'event_espresso' ), $prefix . implode( ':', $parts ) );
922
+		return sprintf(__('UTC%1$s', 'event_espresso'), $prefix.implode(':', $parts));
924 923
 	}
925 924
 
926 925
 
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   +121 added lines, -121 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;
@@ -102,14 +102,14 @@  discard block
 block discarded – undo
102 102
 		$other_attributes = '',
103 103
 		$force_close = false
104 104
 	) {
105
-		$attributes = ! empty( $id ) ? ' id="' . EEH_HTML::sanitize_id( $id ) . '"' : '';
106
-		$attributes .= ! empty( $class ) ? ' class="' . $class . '"' : '';
107
-		$attributes .= ! empty( $style ) ? ' style="' . $style . '"' : '';
108
-		$attributes .= ! empty( $other_attributes ) ? ' ' . $other_attributes : '';
109
-		$html = EEH_HTML::nl( 0, $tag ) . '<' . $tag . $attributes . '>';
110
-		$html .= ! empty( $content ) ? EEH_HTML::nl( 1, $tag  ) . $content : '';
111
-		$indent = ! empty( $content ) || $force_close ? TRUE : FALSE;
112
-		$html .= ! empty( $content ) || $force_close ? EEH_HTML::_close_tag( $tag, $id, $class, $indent ) : '';
105
+		$attributes = ! empty($id) ? ' id="'.EEH_HTML::sanitize_id($id).'"' : '';
106
+		$attributes .= ! empty($class) ? ' class="'.$class.'"' : '';
107
+		$attributes .= ! empty($style) ? ' style="'.$style.'"' : '';
108
+		$attributes .= ! empty($other_attributes) ? ' '.$other_attributes : '';
109
+		$html = EEH_HTML::nl(0, $tag).'<'.$tag.$attributes.'>';
110
+		$html .= ! empty($content) ? EEH_HTML::nl(1, $tag).$content : '';
111
+		$indent = ! empty($content) || $force_close ? TRUE : FALSE;
112
+		$html .= ! empty($content) || $force_close ? EEH_HTML::_close_tag($tag, $id, $class, $indent) : '';
113 113
 		return $html;
114 114
 	}
115 115
 
@@ -126,15 +126,15 @@  discard block
 block discarded – undo
126 126
 	 * @param bool   $indent
127 127
 	 * @return string
128 128
 	 */
129
-	protected static function _close_tag( $tag = 'div', $id = '', $class = '', $indent = TRUE ) {
129
+	protected static function _close_tag($tag = 'div', $id = '', $class = '', $indent = TRUE) {
130 130
 		$comment = '';
131
-		if ( $id ) {
132
-			$comment = EEH_HTML::comment( 'close ' . $id ) . EEH_HTML::nl( 0, $tag );
133
-		} else if ( $class ) {
134
-			$comment = EEH_HTML::comment( 'close ' . $class ) . EEH_HTML::nl( 0, $tag );
131
+		if ($id) {
132
+			$comment = EEH_HTML::comment('close '.$id).EEH_HTML::nl(0, $tag);
133
+		} else if ($class) {
134
+			$comment = EEH_HTML::comment('close '.$class).EEH_HTML::nl(0, $tag);
135 135
 		}
136 136
 		$html = $indent ? EEH_HTML::nl( -1, $tag ) : '';
137
-		$html .= '</' . $tag . '>' . $comment;
137
+		$html .= '</'.$tag.'>'.$comment;
138 138
 		return $html;
139 139
 	}
140 140
 
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
154 154
 	 * @return string
155 155
 	 */
156
-	public static function div( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
157
-		return EEH_HTML::_open_tag( 'div', $content, $id, $class, $style, $other_attributes );
156
+	public static function div($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
157
+		return EEH_HTML::_open_tag('div', $content, $id, $class, $style, $other_attributes);
158 158
 	}
159 159
 
160 160
 
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
 	 * @param string $class - html class attribute
168 168
 	 * @return string
169 169
 	 */
170
-	public static function divx( $id = '', $class = '' ) {
171
-		return EEH_HTML::_close_tag( 'div', $id, $class );
170
+	public static function divx($id = '', $class = '') {
171
+		return EEH_HTML::_close_tag('div', $id, $class);
172 172
 	}
173 173
 
174 174
 
@@ -184,8 +184,8 @@  discard block
 block discarded – undo
184 184
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
185 185
 	 * @return string
186 186
 	 */
187
-	public static function h1( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
188
-		return EEH_HTML::_open_tag( 'h1', $content, $id, $class, $style, $other_attributes, TRUE );
187
+	public static function h1($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
188
+		return EEH_HTML::_open_tag('h1', $content, $id, $class, $style, $other_attributes, TRUE);
189 189
 	}
190 190
 
191 191
 
@@ -201,8 +201,8 @@  discard block
 block discarded – undo
201 201
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
202 202
 	 * @return string
203 203
 	 */
204
-	public static function h2( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
205
-		return EEH_HTML::_open_tag( 'h2', $content, $id, $class, $style, $other_attributes, TRUE );
204
+	public static function h2($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
205
+		return EEH_HTML::_open_tag('h2', $content, $id, $class, $style, $other_attributes, TRUE);
206 206
 	}
207 207
 
208 208
 
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
219 219
 	 * @return string
220 220
 	 */
221
-	public static function h3( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
222
-		return EEH_HTML::_open_tag( 'h3', $content, $id, $class, $style, $other_attributes, TRUE );
221
+	public static function h3($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
222
+		return EEH_HTML::_open_tag('h3', $content, $id, $class, $style, $other_attributes, TRUE);
223 223
 	}
224 224
 
225 225
 
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
236 236
 	 * @return string
237 237
 	 */
238
-	public static function h4( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
239
-		return EEH_HTML::_open_tag( 'h4', $content, $id, $class, $style, $other_attributes, TRUE );
238
+	public static function h4($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
239
+		return EEH_HTML::_open_tag('h4', $content, $id, $class, $style, $other_attributes, TRUE);
240 240
 	}
241 241
 
242 242
 
@@ -252,8 +252,8 @@  discard block
 block discarded – undo
252 252
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
253 253
 	 * @return string
254 254
 	 */
255
-	public static function h5( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
256
-		return EEH_HTML::_open_tag( 'h5', $content, $id, $class, $style, $other_attributes, TRUE );
255
+	public static function h5($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
256
+		return EEH_HTML::_open_tag('h5', $content, $id, $class, $style, $other_attributes, TRUE);
257 257
 	}
258 258
 
259 259
 
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
270 270
 	 * @return string
271 271
 	 */
272
-	public static function h6( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
273
-		return EEH_HTML::_open_tag( 'h6', $content, $id, $class, $style, $other_attributes, TRUE );
272
+	public static function h6($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
273
+		return EEH_HTML::_open_tag('h6', $content, $id, $class, $style, $other_attributes, TRUE);
274 274
 	}
275 275
 
276 276
 
@@ -286,8 +286,8 @@  discard block
 block discarded – undo
286 286
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
287 287
 	 * @return string
288 288
 	 */
289
-	public static function p( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
290
-		return EEH_HTML::_open_tag( 'p', $content, $id, $class, $style, $other_attributes, TRUE );
289
+	public static function p($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
290
+		return EEH_HTML::_open_tag('p', $content, $id, $class, $style, $other_attributes, TRUE);
291 291
 	}
292 292
 
293 293
 
@@ -302,8 +302,8 @@  discard block
 block discarded – undo
302 302
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
303 303
 	 * @return string
304 304
 	 */
305
-	public static function ul( $id = '', $class = '', $style = '', $other_attributes = '' ) {
306
-		return EEH_HTML::_open_tag( 'ul', '', $id, $class, $style, $other_attributes );
305
+	public static function ul($id = '', $class = '', $style = '', $other_attributes = '') {
306
+		return EEH_HTML::_open_tag('ul', '', $id, $class, $style, $other_attributes);
307 307
 	}
308 308
 
309 309
 
@@ -316,8 +316,8 @@  discard block
 block discarded – undo
316 316
 	 * @param string $class - html class attribute
317 317
 	 * @return string
318 318
 	 */
319
-	public static function ulx( $id = '', $class = '' ) {
320
-		return EEH_HTML::_close_tag( 'ul', $id, $class );
319
+	public static function ulx($id = '', $class = '') {
320
+		return EEH_HTML::_close_tag('ul', $id, $class);
321 321
 	}
322 322
 
323 323
 
@@ -334,8 +334,8 @@  discard block
 block discarded – undo
334 334
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
335 335
 	 * @return string
336 336
 	 */
337
-	public static function li( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
338
-		return EEH_HTML::_open_tag( 'li', $content, $id, $class, $style, $other_attributes );
337
+	public static function li($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
338
+		return EEH_HTML::_open_tag('li', $content, $id, $class, $style, $other_attributes);
339 339
 	}
340 340
 
341 341
 
@@ -348,8 +348,8 @@  discard block
 block discarded – undo
348 348
 	 * @param string $class - html class attribute
349 349
 	 * @return string
350 350
 	 */
351
-	public static function lix( $id = '', $class = '' ) {
352
-		return EEH_HTML::_close_tag( 'li', $id, $class );
351
+	public static function lix($id = '', $class = '') {
352
+		return EEH_HTML::_close_tag('li', $id, $class);
353 353
 	}
354 354
 
355 355
 
@@ -365,8 +365,8 @@  discard block
 block discarded – undo
365 365
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
366 366
 	 * @return string
367 367
 	 */
368
-	public static function table( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
369
-		return EEH_HTML::_open_tag( 'table', $content, $id, $class, $style, $other_attributes );
368
+	public static function table($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
369
+		return EEH_HTML::_open_tag('table', $content, $id, $class, $style, $other_attributes);
370 370
 	}
371 371
 
372 372
 
@@ -378,8 +378,8 @@  discard block
 block discarded – undo
378 378
 	 * @param string $class - html class attribute
379 379
 	 * @return string
380 380
 	 */
381
-	public static function tablex( $id = '', $class = '' ) {
382
-		return EEH_HTML::_close_tag( 'table', $id, $class );
381
+	public static function tablex($id = '', $class = '') {
382
+		return EEH_HTML::_close_tag('table', $id, $class);
383 383
 	}
384 384
 
385 385
 
@@ -395,8 +395,8 @@  discard block
 block discarded – undo
395 395
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
396 396
 	 * @return string
397 397
 	 */
398
-	public static function thead( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
399
-		return EEH_HTML::_open_tag( 'thead', $content, $id, $class, $style, $other_attributes );
398
+	public static function thead($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
399
+		return EEH_HTML::_open_tag('thead', $content, $id, $class, $style, $other_attributes);
400 400
 	}
401 401
 
402 402
 
@@ -408,8 +408,8 @@  discard block
 block discarded – undo
408 408
 	 * @param string $class - html class attribute
409 409
 	 * @return string
410 410
 	 */
411
-	public static function theadx( $id = '', $class = '' ) {
412
-		return EEH_HTML::_close_tag( 'thead', $id, $class );
411
+	public static function theadx($id = '', $class = '') {
412
+		return EEH_HTML::_close_tag('thead', $id, $class);
413 413
 	}
414 414
 
415 415
 
@@ -425,8 +425,8 @@  discard block
 block discarded – undo
425 425
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
426 426
 	 * @return string
427 427
 	 */
428
-	public static function tbody( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
429
-		return EEH_HTML::_open_tag( 'tbody', $content, $id, $class, $style, $other_attributes );
428
+	public static function tbody($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
429
+		return EEH_HTML::_open_tag('tbody', $content, $id, $class, $style, $other_attributes);
430 430
 	}
431 431
 
432 432
 
@@ -438,8 +438,8 @@  discard block
 block discarded – undo
438 438
 	 * @param string $class - html class attribute
439 439
 	 * @return string
440 440
 	 */
441
-	public static function tbodyx( $id = '', $class = '' ) {
442
-		return EEH_HTML::_close_tag( 'tbody', $id, $class );
441
+	public static function tbodyx($id = '', $class = '') {
442
+		return EEH_HTML::_close_tag('tbody', $id, $class);
443 443
 	}
444 444
 
445 445
 
@@ -455,8 +455,8 @@  discard block
 block discarded – undo
455 455
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
456 456
 	 * @return string
457 457
 	 */
458
-	public static function tr( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
459
-		return EEH_HTML::_open_tag( 'tr', $content, $id, $class, $style, $other_attributes );
458
+	public static function tr($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
459
+		return EEH_HTML::_open_tag('tr', $content, $id, $class, $style, $other_attributes);
460 460
 	}
461 461
 
462 462
 
@@ -468,8 +468,8 @@  discard block
 block discarded – undo
468 468
 	 * @param string $class - html class attribute
469 469
 	 * @return string
470 470
 	 */
471
-	public static function trx( $id = '', $class = '' ) {
472
-		return EEH_HTML::_close_tag( 'tr', $id, $class );
471
+	public static function trx($id = '', $class = '') {
472
+		return EEH_HTML::_close_tag('tr', $id, $class);
473 473
 	}
474 474
 
475 475
 
@@ -485,8 +485,8 @@  discard block
 block discarded – undo
485 485
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
486 486
 	 * @return string
487 487
 	 */
488
-	public static function th( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
489
-		return EEH_HTML::_open_tag( 'th', $content, $id, $class, $style, $other_attributes );
488
+	public static function th($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
489
+		return EEH_HTML::_open_tag('th', $content, $id, $class, $style, $other_attributes);
490 490
 	}
491 491
 
492 492
 
@@ -498,8 +498,8 @@  discard block
 block discarded – undo
498 498
 	 * @param string $class - html class attribute
499 499
 	 * @return string
500 500
 	 */
501
-	public static function thx( $id = '', $class = '' ) {
502
-		return EEH_HTML::_close_tag( 'th', $id, $class );
501
+	public static function thx($id = '', $class = '') {
502
+		return EEH_HTML::_close_tag('th', $id, $class);
503 503
 	}
504 504
 
505 505
 
@@ -515,8 +515,8 @@  discard block
 block discarded – undo
515 515
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
516 516
 	 * @return string
517 517
 	 */
518
-	public static function td( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
519
-		return EEH_HTML::_open_tag( 'td', $content, $id, $class, $style, $other_attributes );
518
+	public static function td($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
519
+		return EEH_HTML::_open_tag('td', $content, $id, $class, $style, $other_attributes);
520 520
 	}
521 521
 
522 522
 
@@ -528,8 +528,8 @@  discard block
 block discarded – undo
528 528
 	 * @param string $class - html class attribute
529 529
 	 * @return string
530 530
 	 */
531
-	public static function tdx( $id = '', $class = '' ) {
532
-		return EEH_HTML::_close_tag( 'td', $id, $class );
531
+	public static function tdx($id = '', $class = '') {
532
+		return EEH_HTML::_close_tag('td', $id, $class);
533 533
 	}
534 534
 
535 535
 
@@ -543,10 +543,10 @@  discard block
 block discarded – undo
543 543
 	 * @param int    $colspan
544 544
 	 * @return string
545 545
 	 */
546
-	public static function no_row( $content = '', $colspan = 2 ) {
546
+	public static function no_row($content = '', $colspan = 2) {
547 547
 		return EEH_HTML::tr(
548
-			EEH_HTML::td( $content, '', '',  'padding:0; border:none;', 'colspan="' . $colspan . '"' ),
549
-			'', '',  'padding:0; border:none;'
548
+			EEH_HTML::td($content, '', '', 'padding:0; border:none;', 'colspan="'.$colspan.'"'),
549
+			'', '', 'padding:0; border:none;'
550 550
 		);
551 551
 	}
552 552
 
@@ -566,14 +566,14 @@  discard block
 block discarded – undo
566 566
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
567 567
 	 * @return string
568 568
 	 */
569
-	public static function link( $href = '', $link_text = '', $title = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
570
-		$link_text = ! empty( $link_text ) ? $link_text : $href;
571
-		$attributes = ! empty( $id ) ? ' id="' . EEH_HTML::sanitize_id( $id ) . '"' : '';
572
-		$attributes .= ! empty( $class ) ? ' class="' . $class . '"' : '';
573
-		$attributes .= ! empty( $style ) ? ' style="' . $style . '"' : '';
574
-		$attributes .= ! empty( $title ) ? ' title="' . esc_attr( $title ) . '"' : '';
575
-		$attributes .= ! empty( $other_attributes ) ? ' ' . $other_attributes : '';
576
-		return '<a href="' . $href . '" ' . $attributes . '>'  . $link_text  . '</a>';
569
+	public static function link($href = '', $link_text = '', $title = '', $id = '', $class = '', $style = '', $other_attributes = '') {
570
+		$link_text = ! empty($link_text) ? $link_text : $href;
571
+		$attributes = ! empty($id) ? ' id="'.EEH_HTML::sanitize_id($id).'"' : '';
572
+		$attributes .= ! empty($class) ? ' class="'.$class.'"' : '';
573
+		$attributes .= ! empty($style) ? ' style="'.$style.'"' : '';
574
+		$attributes .= ! empty($title) ? ' title="'.esc_attr($title).'"' : '';
575
+		$attributes .= ! empty($other_attributes) ? ' '.$other_attributes : '';
576
+		return '<a href="'.$href.'" '.$attributes.'>'.$link_text.'</a>';
577 577
 	}
578 578
 
579 579
 
@@ -590,14 +590,14 @@  discard block
 block discarded – undo
590 590
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
591 591
 	 * @return string
592 592
 	 */
593
-	public static function img( $src = '', $alt = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
594
-		$attributes = ! empty( $src ) ? ' src="' . esc_url_raw( $src ) . '"' : '';
595
-		$attributes .= ! empty( $alt ) ? ' alt="' . esc_attr( $alt ) . '"' : '';
596
-		$attributes .= ! empty( $id ) ? ' id="' . EEH_HTML::sanitize_id( $id ) . '"' : '';
597
-		$attributes .= ! empty( $class ) ? ' class="' . $class . '"' : '';
598
-		$attributes .= ! empty( $style ) ? ' style="' . $style . '"' : '';
599
-		$attributes .= ! empty( $other_attributes ) ? ' ' . $other_attributes : '';
600
-		return '<img' . $attributes  . '/>';
593
+	public static function img($src = '', $alt = '', $id = '', $class = '', $style = '', $other_attributes = '') {
594
+		$attributes = ! empty($src) ? ' src="'.esc_url_raw($src).'"' : '';
595
+		$attributes .= ! empty($alt) ? ' alt="'.esc_attr($alt).'"' : '';
596
+		$attributes .= ! empty($id) ? ' id="'.EEH_HTML::sanitize_id($id).'"' : '';
597
+		$attributes .= ! empty($class) ? ' class="'.$class.'"' : '';
598
+		$attributes .= ! empty($style) ? ' style="'.$style.'"' : '';
599
+		$attributes .= ! empty($other_attributes) ? ' '.$other_attributes : '';
600
+		return '<img'.$attributes.'/>';
601 601
 	}
602 602
 
603 603
 
@@ -615,12 +615,12 @@  discard block
 block discarded – undo
615 615
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
616 616
 	 * @return string
617 617
 	 */
618
-	protected static function _inline_tag( $tag = 'span', $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
619
-		$attributes = ! empty( $id ) ? ' id="' . EEH_HTML::sanitize_id( $id ) . '"' : '';
620
-		$attributes .= ! empty( $class ) ? ' class="' . $class . '"' : '';
621
-		$attributes .= ! empty( $style ) ? ' style="' . $style . '"' : '';
622
-		$attributes .= ! empty( $other_attributes ) ? ' ' . $other_attributes : '';
623
-		return '<' . $tag . ' ' . $attributes . '>'  . $content  . '</' . $tag . '>';
618
+	protected static function _inline_tag($tag = 'span', $content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
619
+		$attributes = ! empty($id) ? ' id="'.EEH_HTML::sanitize_id($id).'"' : '';
620
+		$attributes .= ! empty($class) ? ' class="'.$class.'"' : '';
621
+		$attributes .= ! empty($style) ? ' style="'.$style.'"' : '';
622
+		$attributes .= ! empty($other_attributes) ? ' '.$other_attributes : '';
623
+		return '<'.$tag.' '.$attributes.'>'.$content.'</'.$tag.'>';
624 624
 	}
625 625
 
626 626
 
@@ -636,8 +636,8 @@  discard block
 block discarded – undo
636 636
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
637 637
 	 * @return string
638 638
 	 */
639
-	public static function label( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
640
-		return EEH_HTML::_inline_tag( 'label', $content, $id, $class, $style, $other_attributes );
639
+	public static function label($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
640
+		return EEH_HTML::_inline_tag('label', $content, $id, $class, $style, $other_attributes);
641 641
 	}
642 642
 
643 643
 
@@ -653,8 +653,8 @@  discard block
 block discarded – undo
653 653
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
654 654
 	 * @return string
655 655
 	 */
656
-	public static function span( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
657
-		return EEH_HTML::_inline_tag( 'span', $content, $id, $class, $style, $other_attributes );
656
+	public static function span($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
657
+		return EEH_HTML::_inline_tag('span', $content, $id, $class, $style, $other_attributes);
658 658
 	}
659 659
 
660 660
 
@@ -670,8 +670,8 @@  discard block
 block discarded – undo
670 670
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
671 671
 	 * @return string
672 672
 	 */
673
-	public static function strong( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
674
-		return EEH_HTML::_inline_tag( 'strong', $content, $id, $class, $style, $other_attributes );
673
+	public static function strong($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
674
+		return EEH_HTML::_inline_tag('strong', $content, $id, $class, $style, $other_attributes);
675 675
 	}
676 676
 
677 677
 
@@ -683,8 +683,8 @@  discard block
 block discarded – undo
683 683
 	 * @param string $comment
684 684
 	 * @return string
685 685
 	 */
686
-	public static function comment( $comment = '' ) {
687
-		return ! empty( $comment ) ? EEH_HTML::nl() . '<!-- ' . $comment . ' -->' : '';
686
+	public static function comment($comment = '') {
687
+		return ! empty($comment) ? EEH_HTML::nl().'<!-- '.$comment.' -->' : '';
688 688
 	}
689 689
 
690 690
 
@@ -695,8 +695,8 @@  discard block
 block discarded – undo
695 695
 	 * @param int $nmbr - the number of line breaks to return
696 696
 	 * @return string
697 697
 	 */
698
-	public static function br( $nmbr = 1 ) {
699
-		return str_repeat( '<br />', $nmbr );
698
+	public static function br($nmbr = 1) {
699
+		return str_repeat('<br />', $nmbr);
700 700
 	}
701 701
 
702 702
 
@@ -707,8 +707,8 @@  discard block
 block discarded – undo
707 707
 	 * @param int $nmbr - the number of non-breaking spaces to return
708 708
 	 * @return string
709 709
 	 */
710
-	public static function nbsp( $nmbr = 1 ) {
711
-		return str_repeat( '&nbsp;', $nmbr );
710
+	public static function nbsp($nmbr = 1) {
711
+		return str_repeat('&nbsp;', $nmbr);
712 712
 	}
713 713
 
714 714
 
@@ -722,9 +722,9 @@  discard block
 block discarded – undo
722 722
 	 * @param string $id
723 723
 	 * @return string
724 724
 	 */
725
-	public static function sanitize_id( $id = '' ) {
726
-		$key = str_replace( ' ', '-', trim( $id ) );
727
-		return preg_replace( '/[^a-zA-Z0-9_\-]/', '', $key );
725
+	public static function sanitize_id($id = '') {
726
+		$key = str_replace(' ', '-', trim($id));
727
+		return preg_replace('/[^a-zA-Z0-9_\-]/', '', $key);
728 728
 	}
729 729
 
730 730
 
@@ -736,10 +736,10 @@  discard block
 block discarded – undo
736 736
 	 * @param string $tag
737 737
 	 * @return string - newline character plus # of indents passed (can be + or -)
738 738
 	 */
739
-	public static function nl( $indent = 0, $tag = 'none' ) {
739
+	public static function nl($indent = 0, $tag = 'none') {
740 740
 		$html = "\n";
741
-		EEH_HTML::indent( $indent, $tag );
742
-		for ( $x = 0; $x < EEH_HTML::$_indent[ $tag ]; $x++ ) {
741
+		EEH_HTML::indent($indent, $tag);
742
+		for ($x = 0; $x < EEH_HTML::$_indent[$tag]; $x++) {
743 743
 			$html .= "\t";
744 744
 		}
745 745
 		return $html;
@@ -754,17 +754,17 @@  discard block
 block discarded – undo
754 754
 	 * @param int    $indent can be negative to decrease the indentation level
755 755
 	 * @param string $tag
756 756
 	 */
757
-	public static function indent( $indent, $tag = 'none' ){
757
+	public static function indent($indent, $tag = 'none') {
758 758
 		static $default_indentation = FALSE;
759
-		if ( ! $default_indentation ) {
759
+		if ( ! $default_indentation) {
760 760
 			EEH_HTML::_set_default_indentation();
761 761
 			$default_indentation = TRUE;
762 762
 		}
763
-		if ( ! isset( EEH_HTML::$_indent[ $tag ] )) {
764
-			EEH_HTML::$_indent[ $tag ] = 0;
763
+		if ( ! isset(EEH_HTML::$_indent[$tag])) {
764
+			EEH_HTML::$_indent[$tag] = 0;
765 765
 		}
766
-		EEH_HTML::$_indent[ $tag ] += (int)$indent;
767
-		EEH_HTML::$_indent[ $tag ] = EEH_HTML::$_indent[ $tag ] >= 0 ? EEH_HTML::$_indent[ $tag ] : 0;
766
+		EEH_HTML::$_indent[$tag] += (int) $indent;
767
+		EEH_HTML::$_indent[$tag] = EEH_HTML::$_indent[$tag] >= 0 ? EEH_HTML::$_indent[$tag] : 0;
768 768
 	}
769 769
 
770 770
 
@@ -810,15 +810,15 @@  discard block
 block discarded – undo
810 810
 	 * @global array $allowedtags
811 811
 	 * @return array
812 812
 	 */
813
-	public static function get_simple_tags(){
813
+	public static function get_simple_tags() {
814 814
 		global $allowedtags;
815 815
 		$tags_we_allow = $allowedtags;
816
-		$tags_we_allow['ol']=array();
817
-		$tags_we_allow['ul']=array();
818
-		$tags_we_allow['li']=array();
819
-		$tags_we_allow['br']=array();
820
-		$tags_we_allow['p']=array();
821
-		return apply_filters( 'FHEE__EEH_HTML__get_simple_tags', $tags_we_allow );
816
+		$tags_we_allow['ol'] = array();
817
+		$tags_we_allow['ul'] = array();
818
+		$tags_we_allow['li'] = array();
819
+		$tags_we_allow['br'] = array();
820
+		$tags_we_allow['p'] = array();
821
+		return apply_filters('FHEE__EEH_HTML__get_simple_tags', $tags_we_allow);
822 822
 	}
823 823
 
824 824
 
Please login to merge, or discard this patch.
core/helpers/EEH_Inflector.helper.php 4 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -350,7 +350,7 @@
 block discarded – undo
350 350
     static function ordinalize($number){
351 351
         if(in_array(($number % 100), range(11, 13))){
352 352
             return $number . 'th';
353
-        }else{
353
+        } else{
354 354
             switch(($number % 10)){
355 355
                 case 1:
356 356
                     return $number . 'st';
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
     /**
54 54
      * @param string $word
55
-     * @return mixed
55
+     * @return string
56 56
      */
57 57
     public static function singularize_and_upper( $word ) {
58 58
 		return str_replace( ' ', '_', self::humanize( self::singularize( $word ), 'all' ) );
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 
380 380
 
381 381
     /**
382
-     * @param $string
382
+     * @param string $string
383 383
      * @return string
384 384
      */
385 385
     public static function add_indefinite_article($string) {
Please login to merge, or discard this patch.
Indentation   +334 added lines, -334 removed lines patch added patch discarded remove patch
@@ -35,357 +35,357 @@
 block discarded – undo
35 35
  * @version $Revision 0.1 $
36 36
  */
37 37
 class EEH_Inflector{
38
-    // ------ CLASS METHODS ------ //
39
-    // ---- Public methods ---- //
40
-    // {{{ pluralize()
38
+	// ------ CLASS METHODS ------ //
39
+	// ---- Public methods ---- //
40
+	// {{{ pluralize()
41 41
 
42 42
 	/**
43 43
 	 * Just calls self::pluralize and strtolower on $word and returns it
44 44
 	 * @param string $word
45 45
 	 * @return string
46 46
 	 */
47
-    public static function pluralize_and_lower( $word ){
47
+	public static function pluralize_and_lower( $word ){
48 48
 		return strtolower( self::pluralize( $word ) );
49 49
 	}
50 50
 
51 51
 
52 52
 
53
-    /**
54
-     * @param string $word
55
-     * @return mixed
56
-     */
57
-    public static function singularize_and_upper( $word ) {
53
+	/**
54
+	 * @param string $word
55
+	 * @return mixed
56
+	 */
57
+	public static function singularize_and_upper( $word ) {
58 58
 		return str_replace( ' ', '_', self::humanize( self::singularize( $word ), 'all' ) );
59 59
 	}
60 60
 
61 61
 
62 62
 
63
-    /**
64
-     * Pluralizes English nouns.
65
-     *
66
-     * @access public
67
-     * @static
68
-     * @param    string    $word    English noun to pluralize
69
-     * @return string Plural noun
70
-     */
71
-    public static function pluralize($word){
72
-        $plural = array(
73
-            '/(quiz)$/i'               => '\1zes',
74
-            '/^(ox)$/i'                => '\1en',
75
-            '/([m|l])ouse$/i'          => '\1ice',
76
-            '/(matr|vert|ind)ix|ex$/i' => '\1ices',
77
-            '/(x|ch|ss|sh)$/i'         => '\1es',
78
-            '/([^aeiouy]|qu)ies$/i'    => '\1y',
79
-            '/([^aeiouy]|qu)y$/i'      => '\1ies',
80
-            '/(hive)$/i'               => '\1s',
81
-            '/(?:([^f])fe|([lr])f)$/i' => '\1\2ves',
82
-            '/sis$/i'                  => 'ses',
83
-            '/([ti])um$/i'             => '\1a',
84
-            '/(buffal|tomat)o$/i'      => '\1oes',
85
-            '/(bu)s$/i'                => '\1ses',
86
-            '/(alias|status)/i'        => '\1es',
87
-            '/(octop|vir)us$/i'        => '\1i',
88
-            '/(ax|test)is$/i'          => '\1es',
89
-            '/s$/i'                    => 's',
90
-            '/$/'                      => 's');
91
-
92
-        $uncountable = array('equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep');
93
-
94
-        $irregular = array(
95
-            'person' => 'people',
96
-            'man'    => 'men',
97
-            'child'  => 'children',
98
-            'sex'    => 'sexes',
99
-            'move'   => 'moves');
100
-
101
-        $lowercased_word = strtolower($word);
102
-
103
-        foreach($uncountable as $_uncountable){
104
-            if(substr($lowercased_word, (-1 * strlen($_uncountable))) == $_uncountable && //even though the word "price" ends in "rice", it can be pluralized, so check the previous character isnt a letter
63
+	/**
64
+	 * Pluralizes English nouns.
65
+	 *
66
+	 * @access public
67
+	 * @static
68
+	 * @param    string    $word    English noun to pluralize
69
+	 * @return string Plural noun
70
+	 */
71
+	public static function pluralize($word){
72
+		$plural = array(
73
+			'/(quiz)$/i'               => '\1zes',
74
+			'/^(ox)$/i'                => '\1en',
75
+			'/([m|l])ouse$/i'          => '\1ice',
76
+			'/(matr|vert|ind)ix|ex$/i' => '\1ices',
77
+			'/(x|ch|ss|sh)$/i'         => '\1es',
78
+			'/([^aeiouy]|qu)ies$/i'    => '\1y',
79
+			'/([^aeiouy]|qu)y$/i'      => '\1ies',
80
+			'/(hive)$/i'               => '\1s',
81
+			'/(?:([^f])fe|([lr])f)$/i' => '\1\2ves',
82
+			'/sis$/i'                  => 'ses',
83
+			'/([ti])um$/i'             => '\1a',
84
+			'/(buffal|tomat)o$/i'      => '\1oes',
85
+			'/(bu)s$/i'                => '\1ses',
86
+			'/(alias|status)/i'        => '\1es',
87
+			'/(octop|vir)us$/i'        => '\1i',
88
+			'/(ax|test)is$/i'          => '\1es',
89
+			'/s$/i'                    => 's',
90
+			'/$/'                      => 's');
91
+
92
+		$uncountable = array('equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep');
93
+
94
+		$irregular = array(
95
+			'person' => 'people',
96
+			'man'    => 'men',
97
+			'child'  => 'children',
98
+			'sex'    => 'sexes',
99
+			'move'   => 'moves');
100
+
101
+		$lowercased_word = strtolower($word);
102
+
103
+		foreach($uncountable as $_uncountable){
104
+			if(substr($lowercased_word, (-1 * strlen($_uncountable))) == $_uncountable && //even though the word "price" ends in "rice", it can be pluralized, so check the previous character isnt a letter
105 105
 					! ctype_alpha( $lowercased_word[ strlen( $lowercased_word ) - strlen($_uncountable) ] ) ){
106
-                return $word;
107
-            }
108
-        }
109
-
110
-        foreach($irregular as $_plural => $_singular){
111
-            if(preg_match('/(' . $_plural . ')$/i', $word, $arr)){
112
-                return preg_replace('/(' . $_plural . ')$/i', substr($arr[0], 0, 1) . substr($_singular, 1), $word);
113
-            }
114
-        }
115
-
116
-        foreach($plural as $rule => $replacement){
117
-            if(preg_match($rule, $word)){
118
-                return preg_replace($rule, $replacement, $word);
119
-            }
120
-        }
121
-        return false;
122
-    }
123
-
124
-    // }}}
125
-    // {{{ singularize()
126
-
127
-    /**
128
-     * Singularizes English nouns.
129
-     *
130
-     * @access public
131
-     * @static
132
-     * @param    string    $word    English noun to singularize
133
-     * @return string Singular noun.
134
-     */
135
-    public static function singularize($word){
136
-        $singular = array(
137
-            '/(quiz)zes$/i'                                                    => '\1',
138
-            '/(matr)ices$/i'                                                   => '\1ix',
139
-            '/(vert|ind)ices$/i'                                               => '\1ex',
140
-            '/^(ox)en/i'                                                       => '\1',
141
-            '/(alias|status)es$/i'                                             => '\1',
142
-            '/([octop|vir])i$/i'                                               => '\1us',
143
-            '/(cris|ax|test)es$/i'                                             => '\1is',
144
-            '/(shoe)s$/i'                                                      => '\1',
145
-            '/(o)es$/i'                                                        => '\1',
146
-            '/(bus)es$/i'                                                      => '\1',
147
-            '/([m|l])ice$/i'                                                   => '\1ouse',
148
-            '/(x|ch|ss|sh)es$/i'                                               => '\1',
149
-            '/(m)ovies$/i'                                                     => '\1ovie',
150
-            '/(s)eries$/i'                                                     => '\1eries',
151
-            '/([^aeiouy]|qu)ies$/i'                                            => '\1y',
152
-            '/([lr])ves$/i'                                                    => '\1f',
153
-            '/(tive)s$/i'                                                      => '\1',
154
-            '/(hive)s$/i'                                                      => '\1',
155
-            '/([^f])ves$/i'                                                    => '\1fe',
156
-            '/(^analy)ses$/i'                                                  => '\1sis',
157
-            '/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => '\1\2sis',
158
-            '/([ti])a$/i'                                                      => '\1um',
159
-            '/(n)ews$/i'                                                       => '\1ews',
160
-            '/s$/i'                                                            => '',
161
-        );
162
-
163
-        $uncountable = array('equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep');
164
-
165
-        $irregular = array(
166
-            'person' => 'people',
167
-            'man'    => 'men',
168
-            'child'  => 'children',
169
-            'sex'    => 'sexes',
170
-            'move'   => 'moves');
171
-
172
-        $lowercased_word = strtolower($word);
173
-        foreach($uncountable as $_uncountable){
174
-            if(substr($lowercased_word, (-1 * strlen($_uncountable))) == $_uncountable){
175
-                return $word;
176
-            }
177
-        }
178
-
179
-        foreach($irregular as $_plural => $_singular){
180
-            if(preg_match('/(' . $_singular . ')$/i', $word, $arr)){
181
-                return preg_replace('/(' . $_singular . ')$/i', substr($arr[0], 0, 1) . substr($_plural, 1), $word);
182
-            }
183
-        }
184
-
185
-        foreach($singular as $rule => $replacement){
186
-            if(preg_match($rule, $word)){
187
-                return preg_replace($rule, $replacement, $word);
188
-            }
189
-        }
190
-
191
-        return $word;
192
-    }
193
-
194
-    // }}}
195
-    // {{{ titleize()
196
-
197
-    /**
198
-     * Converts an underscored or CamelCase word into a English
199
-     * sentence.
200
-     *
201
-     * The titleize static function converts text like "WelcomePage",
202
-     * "welcome_page" or  "welcome page" to this "Welcome
203
-     * Page".
204
-     * If second parameter is set to 'first' it will only
205
-     * capitalize the first character of the title.
206
-     *
207
-     * @access public
208
-     * @static
209
-     * @param    string    $word    Word to format as tile
210
-     * @param    string    $uppercase    If set to 'first' it will only uppercase the
211
-     * first character. Otherwise it will uppercase all
212
-     * the words in the title.
213
-     * @return string Text formatted as title
214
-     */
215
-    public static function titleize($word, $uppercase = ''){
216
-        $uppercase = $uppercase === 'first' ? 'ucfirst' : 'ucwords';
217
-        return $uppercase(EEH_Inflector::humanize(EEH_Inflector::underscore($word)));
218
-    }
219
-
220
-    // }}}
221
-    // {{{ camelize()
222
-
223
-    /**
224
-     * Returns given word as CamelCased
225
-     *
226
-     * Converts a word like "send_email" to "SendEmail". It
227
-     * will remove non alphanumeric character from the word, so
228
-     * "who's online" will be converted to "WhoSOnline"
229
-     *
230
-     * @access public
231
-     * @static
232
-     * @see variablize
233
-     * @param    string    $word    Word to convert to camel case
234
-     * @return string UpperCamelCasedWord
235
-     */
236
-    public static function camelize($word){
237
-        return str_replace(' ', '', ucwords(preg_replace('/[^A-Z^a-z^0-9]+/', ' ', $word)));
238
-    }
239
-
240
-    // }}}
241
-    // {{{ underscore()
242
-
243
-    /**
244
-     * Converts a word "into_it_s_underscored_version"
245
-     *
246
-     * Convert any "CamelCased" or "ordinary Word" into an
247
-     * "underscored_word".
248
-     *
249
-     * This can be really useful for creating friendly URLs.
250
-     *
251
-     * @access public
252
-     * @static
253
-     * @param    string    $word    Word to underscore
254
-     * @return string Underscored word
255
-     */
256
-    public static function underscore($word){
257
-        return strtolower(preg_replace('/[^A-Z^a-z^0-9]+/', '_', preg_replace('/([a-zd])([A-Z])/', '1_2', preg_replace('/([A-Z]+)([A-Z][a-z])/', '1_2', $word))));
258
-    }
259
-
260
-    // }}}
261
-    // {{{ humanize()
262
-
263
-    /**
264
-     * Returns a human-readable string from $word
265
-     *
266
-     * Returns a human-readable string from $word, by replacing
267
-     * underscores with a space, and by upper-casing the initial
268
-     * character by default.
269
-     *
270
-     * If you need to uppercase all the words you just have to
271
-     * pass 'all' as a second parameter.
272
-     *
273
-     * @access public
274
-     * @static
275
-     * @param    string    $word    String to "humanize"
276
-     * @param    string    $uppercase    If set to 'all' it will uppercase all the words
277
-     * instead of just the first one.
278
-     * @return string Human-readable word
279
-     */
280
-    public static function humanize($word, $uppercase = ''){
106
+				return $word;
107
+			}
108
+		}
109
+
110
+		foreach($irregular as $_plural => $_singular){
111
+			if(preg_match('/(' . $_plural . ')$/i', $word, $arr)){
112
+				return preg_replace('/(' . $_plural . ')$/i', substr($arr[0], 0, 1) . substr($_singular, 1), $word);
113
+			}
114
+		}
115
+
116
+		foreach($plural as $rule => $replacement){
117
+			if(preg_match($rule, $word)){
118
+				return preg_replace($rule, $replacement, $word);
119
+			}
120
+		}
121
+		return false;
122
+	}
123
+
124
+	// }}}
125
+	// {{{ singularize()
126
+
127
+	/**
128
+	 * Singularizes English nouns.
129
+	 *
130
+	 * @access public
131
+	 * @static
132
+	 * @param    string    $word    English noun to singularize
133
+	 * @return string Singular noun.
134
+	 */
135
+	public static function singularize($word){
136
+		$singular = array(
137
+			'/(quiz)zes$/i'                                                    => '\1',
138
+			'/(matr)ices$/i'                                                   => '\1ix',
139
+			'/(vert|ind)ices$/i'                                               => '\1ex',
140
+			'/^(ox)en/i'                                                       => '\1',
141
+			'/(alias|status)es$/i'                                             => '\1',
142
+			'/([octop|vir])i$/i'                                               => '\1us',
143
+			'/(cris|ax|test)es$/i'                                             => '\1is',
144
+			'/(shoe)s$/i'                                                      => '\1',
145
+			'/(o)es$/i'                                                        => '\1',
146
+			'/(bus)es$/i'                                                      => '\1',
147
+			'/([m|l])ice$/i'                                                   => '\1ouse',
148
+			'/(x|ch|ss|sh)es$/i'                                               => '\1',
149
+			'/(m)ovies$/i'                                                     => '\1ovie',
150
+			'/(s)eries$/i'                                                     => '\1eries',
151
+			'/([^aeiouy]|qu)ies$/i'                                            => '\1y',
152
+			'/([lr])ves$/i'                                                    => '\1f',
153
+			'/(tive)s$/i'                                                      => '\1',
154
+			'/(hive)s$/i'                                                      => '\1',
155
+			'/([^f])ves$/i'                                                    => '\1fe',
156
+			'/(^analy)ses$/i'                                                  => '\1sis',
157
+			'/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => '\1\2sis',
158
+			'/([ti])a$/i'                                                      => '\1um',
159
+			'/(n)ews$/i'                                                       => '\1ews',
160
+			'/s$/i'                                                            => '',
161
+		);
162
+
163
+		$uncountable = array('equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep');
164
+
165
+		$irregular = array(
166
+			'person' => 'people',
167
+			'man'    => 'men',
168
+			'child'  => 'children',
169
+			'sex'    => 'sexes',
170
+			'move'   => 'moves');
171
+
172
+		$lowercased_word = strtolower($word);
173
+		foreach($uncountable as $_uncountable){
174
+			if(substr($lowercased_word, (-1 * strlen($_uncountable))) == $_uncountable){
175
+				return $word;
176
+			}
177
+		}
178
+
179
+		foreach($irregular as $_plural => $_singular){
180
+			if(preg_match('/(' . $_singular . ')$/i', $word, $arr)){
181
+				return preg_replace('/(' . $_singular . ')$/i', substr($arr[0], 0, 1) . substr($_plural, 1), $word);
182
+			}
183
+		}
184
+
185
+		foreach($singular as $rule => $replacement){
186
+			if(preg_match($rule, $word)){
187
+				return preg_replace($rule, $replacement, $word);
188
+			}
189
+		}
190
+
191
+		return $word;
192
+	}
193
+
194
+	// }}}
195
+	// {{{ titleize()
196
+
197
+	/**
198
+	 * Converts an underscored or CamelCase word into a English
199
+	 * sentence.
200
+	 *
201
+	 * The titleize static function converts text like "WelcomePage",
202
+	 * "welcome_page" or  "welcome page" to this "Welcome
203
+	 * Page".
204
+	 * If second parameter is set to 'first' it will only
205
+	 * capitalize the first character of the title.
206
+	 *
207
+	 * @access public
208
+	 * @static
209
+	 * @param    string    $word    Word to format as tile
210
+	 * @param    string    $uppercase    If set to 'first' it will only uppercase the
211
+	 * first character. Otherwise it will uppercase all
212
+	 * the words in the title.
213
+	 * @return string Text formatted as title
214
+	 */
215
+	public static function titleize($word, $uppercase = ''){
216
+		$uppercase = $uppercase === 'first' ? 'ucfirst' : 'ucwords';
217
+		return $uppercase(EEH_Inflector::humanize(EEH_Inflector::underscore($word)));
218
+	}
219
+
220
+	// }}}
221
+	// {{{ camelize()
222
+
223
+	/**
224
+	 * Returns given word as CamelCased
225
+	 *
226
+	 * Converts a word like "send_email" to "SendEmail". It
227
+	 * will remove non alphanumeric character from the word, so
228
+	 * "who's online" will be converted to "WhoSOnline"
229
+	 *
230
+	 * @access public
231
+	 * @static
232
+	 * @see variablize
233
+	 * @param    string    $word    Word to convert to camel case
234
+	 * @return string UpperCamelCasedWord
235
+	 */
236
+	public static function camelize($word){
237
+		return str_replace(' ', '', ucwords(preg_replace('/[^A-Z^a-z^0-9]+/', ' ', $word)));
238
+	}
239
+
240
+	// }}}
241
+	// {{{ underscore()
242
+
243
+	/**
244
+	 * Converts a word "into_it_s_underscored_version"
245
+	 *
246
+	 * Convert any "CamelCased" or "ordinary Word" into an
247
+	 * "underscored_word".
248
+	 *
249
+	 * This can be really useful for creating friendly URLs.
250
+	 *
251
+	 * @access public
252
+	 * @static
253
+	 * @param    string    $word    Word to underscore
254
+	 * @return string Underscored word
255
+	 */
256
+	public static function underscore($word){
257
+		return strtolower(preg_replace('/[^A-Z^a-z^0-9]+/', '_', preg_replace('/([a-zd])([A-Z])/', '1_2', preg_replace('/([A-Z]+)([A-Z][a-z])/', '1_2', $word))));
258
+	}
259
+
260
+	// }}}
261
+	// {{{ humanize()
262
+
263
+	/**
264
+	 * Returns a human-readable string from $word
265
+	 *
266
+	 * Returns a human-readable string from $word, by replacing
267
+	 * underscores with a space, and by upper-casing the initial
268
+	 * character by default.
269
+	 *
270
+	 * If you need to uppercase all the words you just have to
271
+	 * pass 'all' as a second parameter.
272
+	 *
273
+	 * @access public
274
+	 * @static
275
+	 * @param    string    $word    String to "humanize"
276
+	 * @param    string    $uppercase    If set to 'all' it will uppercase all the words
277
+	 * instead of just the first one.
278
+	 * @return string Human-readable word
279
+	 */
280
+	public static function humanize($word, $uppercase = ''){
281 281
 		//make special exceptions for acronyms
282 282
 		$word = str_replace('wp_', 'WP_', $word );
283
-        $uppercase = $uppercase === 'all' ? 'ucwords' : 'ucfirst';
284
-        return $uppercase(str_replace('_', ' ', preg_replace('/_id$/', '', $word)));
285
-    }
286
-
287
-    // }}}
288
-    // {{{ variablize()
289
-
290
-    /**
291
-     * Same as camelize but first char is underscored
292
-     *
293
-     * Converts a word like "send_email" to "sendEmail". It
294
-     * will remove non alphanumeric character from the word, so
295
-     * "who's online" will be converted to "whoSOnline"
296
-     *
297
-     * @access public
298
-     * @static
299
-     * @see camelize
300
-     * @param    string    $word    Word to lowerCamelCase
301
-     * @return string Returns a lowerCamelCasedWord
302
-     */
303
-    public static function variablize($word){
304
-        $word = EEH_Inflector::camelize($word);
305
-        return strtolower($word[0]) . substr($word, 1);
306
-    }
307
-
308
-    // }}}
309
-    // {{{ tableize()
310
-
311
-    /**
312
-     * Converts a class name to its table name according to rails
313
-     * naming conventions.
314
-     *
315
-     * Converts "Person" to "people"
316
-     *
317
-     * @access public
318
-     * @static
319
-     * @see classify
320
-     * @param    string    $class_name    Class name for getting related table_name.
321
-     * @return string plural_table_name
322
-     */
323
-    public static function tableize($class_name){
324
-        return EEH_Inflector::pluralize(EEH_Inflector::underscore($class_name));
325
-    }
326
-
327
-    // }}}
328
-    // {{{ classify()
329
-
330
-    /**
331
-     * Converts a table name to its class name according to rails
332
-     * naming conventions.
333
-     *
334
-     * Converts "people" to "Person"
335
-     *
336
-     * @access public
337
-     * @static
338
-     * @see tableize
339
-     * @param    string    $table_name    Table name for getting related ClassName.
340
-     * @return string SingularClassName
341
-     */
342
-    public static function classify($table_name){
343
-        return EEH_Inflector::camelize(EEH_Inflector::singularize($table_name));
344
-    }
345
-
346
-    // }}}
347
-    // {{{ ordinalize()
348
-
349
-    /**
350
-     * Converts number to its ordinal English form.
351
-     *
352
-     * This method converts 13 to 13th, 2 to 2nd ...
353
-     *
354
-     * @access public
355
-     * @static
356
-     * @param    integer    $number    Number to get its ordinal value
357
-     * @return string Ordinal representation of given string.
358
-     */
359
-    public static function ordinalize($number){
360
-        if(in_array(($number % 100), range(11, 13))){
361
-            return $number . 'th';
362
-        }else{
363
-            switch(($number % 10)){
364
-                case 1:
365
-                    return $number . 'st';
366
-                    break;
367
-                case 2:
368
-                    return $number . 'nd';
369
-                    break;
370
-                case 3:
371
-                    return $number . 'rd';
372
-                default:
373
-                    return $number . 'th';
374
-                    break;
375
-            }
376
-        }
377
-    }
378
-
379
-
380
-
381
-    /**
382
-     * @param $string
383
-     * @return string
384
-     */
385
-    public static function add_indefinite_article($string) {
386
-        if (strtolower($string) === 'null') {
387
-            return $string;
388
-        }
389
-        return (stripos('aeiou', $string[0]) !== false ? 'an ' : 'a ') . $string;
390
-    }
283
+		$uppercase = $uppercase === 'all' ? 'ucwords' : 'ucfirst';
284
+		return $uppercase(str_replace('_', ' ', preg_replace('/_id$/', '', $word)));
285
+	}
286
+
287
+	// }}}
288
+	// {{{ variablize()
289
+
290
+	/**
291
+	 * Same as camelize but first char is underscored
292
+	 *
293
+	 * Converts a word like "send_email" to "sendEmail". It
294
+	 * will remove non alphanumeric character from the word, so
295
+	 * "who's online" will be converted to "whoSOnline"
296
+	 *
297
+	 * @access public
298
+	 * @static
299
+	 * @see camelize
300
+	 * @param    string    $word    Word to lowerCamelCase
301
+	 * @return string Returns a lowerCamelCasedWord
302
+	 */
303
+	public static function variablize($word){
304
+		$word = EEH_Inflector::camelize($word);
305
+		return strtolower($word[0]) . substr($word, 1);
306
+	}
307
+
308
+	// }}}
309
+	// {{{ tableize()
310
+
311
+	/**
312
+	 * Converts a class name to its table name according to rails
313
+	 * naming conventions.
314
+	 *
315
+	 * Converts "Person" to "people"
316
+	 *
317
+	 * @access public
318
+	 * @static
319
+	 * @see classify
320
+	 * @param    string    $class_name    Class name for getting related table_name.
321
+	 * @return string plural_table_name
322
+	 */
323
+	public static function tableize($class_name){
324
+		return EEH_Inflector::pluralize(EEH_Inflector::underscore($class_name));
325
+	}
326
+
327
+	// }}}
328
+	// {{{ classify()
329
+
330
+	/**
331
+	 * Converts a table name to its class name according to rails
332
+	 * naming conventions.
333
+	 *
334
+	 * Converts "people" to "Person"
335
+	 *
336
+	 * @access public
337
+	 * @static
338
+	 * @see tableize
339
+	 * @param    string    $table_name    Table name for getting related ClassName.
340
+	 * @return string SingularClassName
341
+	 */
342
+	public static function classify($table_name){
343
+		return EEH_Inflector::camelize(EEH_Inflector::singularize($table_name));
344
+	}
345
+
346
+	// }}}
347
+	// {{{ ordinalize()
348
+
349
+	/**
350
+	 * Converts number to its ordinal English form.
351
+	 *
352
+	 * This method converts 13 to 13th, 2 to 2nd ...
353
+	 *
354
+	 * @access public
355
+	 * @static
356
+	 * @param    integer    $number    Number to get its ordinal value
357
+	 * @return string Ordinal representation of given string.
358
+	 */
359
+	public static function ordinalize($number){
360
+		if(in_array(($number % 100), range(11, 13))){
361
+			return $number . 'th';
362
+		}else{
363
+			switch(($number % 10)){
364
+				case 1:
365
+					return $number . 'st';
366
+					break;
367
+				case 2:
368
+					return $number . 'nd';
369
+					break;
370
+				case 3:
371
+					return $number . 'rd';
372
+				default:
373
+					return $number . 'th';
374
+					break;
375
+			}
376
+		}
377
+	}
378
+
379
+
380
+
381
+	/**
382
+	 * @param $string
383
+	 * @return string
384
+	 */
385
+	public static function add_indefinite_article($string) {
386
+		if (strtolower($string) === 'null') {
387
+			return $string;
388
+		}
389
+		return (stripos('aeiou', $string[0]) !== false ? 'an ' : 'a ') . $string;
390
+	}
391 391
 }
392 392
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 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
 // +----------------------------------------------------------------------+
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
  * @since 0.1
35 35
  * @version $Revision 0.1 $
36 36
  */
37
-class EEH_Inflector{
37
+class EEH_Inflector {
38 38
     // ------ CLASS METHODS ------ //
39 39
     // ---- Public methods ---- //
40 40
     // {{{ pluralize()
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 	 * @param string $word
45 45
 	 * @return string
46 46
 	 */
47
-    public static function pluralize_and_lower( $word ){
48
-		return strtolower( self::pluralize( $word ) );
47
+    public static function pluralize_and_lower($word) {
48
+		return strtolower(self::pluralize($word));
49 49
 	}
50 50
 
51 51
 
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
      * @param string $word
55 55
      * @return mixed
56 56
      */
57
-    public static function singularize_and_upper( $word ) {
58
-		return str_replace( ' ', '_', self::humanize( self::singularize( $word ), 'all' ) );
57
+    public static function singularize_and_upper($word) {
58
+		return str_replace(' ', '_', self::humanize(self::singularize($word), 'all'));
59 59
 	}
60 60
 
61 61
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      * @param    string    $word    English noun to pluralize
69 69
      * @return string Plural noun
70 70
      */
71
-    public static function pluralize($word){
71
+    public static function pluralize($word) {
72 72
         $plural = array(
73 73
             '/(quiz)$/i'               => '\1zes',
74 74
             '/^(ox)$/i'                => '\1en',
@@ -100,21 +100,21 @@  discard block
 block discarded – undo
100 100
 
101 101
         $lowercased_word = strtolower($word);
102 102
 
103
-        foreach($uncountable as $_uncountable){
104
-            if(substr($lowercased_word, (-1 * strlen($_uncountable))) == $_uncountable && //even though the word "price" ends in "rice", it can be pluralized, so check the previous character isnt a letter
105
-					! ctype_alpha( $lowercased_word[ strlen( $lowercased_word ) - strlen($_uncountable) ] ) ){
103
+        foreach ($uncountable as $_uncountable) {
104
+            if (substr($lowercased_word, (-1 * strlen($_uncountable))) == $_uncountable && //even though the word "price" ends in "rice", it can be pluralized, so check the previous character isnt a letter
105
+					! ctype_alpha($lowercased_word[strlen($lowercased_word) - strlen($_uncountable)])) {
106 106
                 return $word;
107 107
             }
108 108
         }
109 109
 
110
-        foreach($irregular as $_plural => $_singular){
111
-            if(preg_match('/(' . $_plural . ')$/i', $word, $arr)){
112
-                return preg_replace('/(' . $_plural . ')$/i', substr($arr[0], 0, 1) . substr($_singular, 1), $word);
110
+        foreach ($irregular as $_plural => $_singular) {
111
+            if (preg_match('/('.$_plural.')$/i', $word, $arr)) {
112
+                return preg_replace('/('.$_plural.')$/i', substr($arr[0], 0, 1).substr($_singular, 1), $word);
113 113
             }
114 114
         }
115 115
 
116
-        foreach($plural as $rule => $replacement){
117
-            if(preg_match($rule, $word)){
116
+        foreach ($plural as $rule => $replacement) {
117
+            if (preg_match($rule, $word)) {
118 118
                 return preg_replace($rule, $replacement, $word);
119 119
             }
120 120
         }
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
      * @param    string    $word    English noun to singularize
133 133
      * @return string Singular noun.
134 134
      */
135
-    public static function singularize($word){
135
+    public static function singularize($word) {
136 136
         $singular = array(
137 137
             '/(quiz)zes$/i'                                                    => '\1',
138 138
             '/(matr)ices$/i'                                                   => '\1ix',
@@ -170,20 +170,20 @@  discard block
 block discarded – undo
170 170
             'move'   => 'moves');
171 171
 
172 172
         $lowercased_word = strtolower($word);
173
-        foreach($uncountable as $_uncountable){
174
-            if(substr($lowercased_word, (-1 * strlen($_uncountable))) == $_uncountable){
173
+        foreach ($uncountable as $_uncountable) {
174
+            if (substr($lowercased_word, (-1 * strlen($_uncountable))) == $_uncountable) {
175 175
                 return $word;
176 176
             }
177 177
         }
178 178
 
179
-        foreach($irregular as $_plural => $_singular){
180
-            if(preg_match('/(' . $_singular . ')$/i', $word, $arr)){
181
-                return preg_replace('/(' . $_singular . ')$/i', substr($arr[0], 0, 1) . substr($_plural, 1), $word);
179
+        foreach ($irregular as $_plural => $_singular) {
180
+            if (preg_match('/('.$_singular.')$/i', $word, $arr)) {
181
+                return preg_replace('/('.$_singular.')$/i', substr($arr[0], 0, 1).substr($_plural, 1), $word);
182 182
             }
183 183
         }
184 184
 
185
-        foreach($singular as $rule => $replacement){
186
-            if(preg_match($rule, $word)){
185
+        foreach ($singular as $rule => $replacement) {
186
+            if (preg_match($rule, $word)) {
187 187
                 return preg_replace($rule, $replacement, $word);
188 188
             }
189 189
         }
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
      * the words in the title.
213 213
      * @return string Text formatted as title
214 214
      */
215
-    public static function titleize($word, $uppercase = ''){
215
+    public static function titleize($word, $uppercase = '') {
216 216
         $uppercase = $uppercase === 'first' ? 'ucfirst' : 'ucwords';
217 217
         return $uppercase(EEH_Inflector::humanize(EEH_Inflector::underscore($word)));
218 218
     }
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
      * @param    string    $word    Word to convert to camel case
234 234
      * @return string UpperCamelCasedWord
235 235
      */
236
-    public static function camelize($word){
236
+    public static function camelize($word) {
237 237
         return str_replace(' ', '', ucwords(preg_replace('/[^A-Z^a-z^0-9]+/', ' ', $word)));
238 238
     }
239 239
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
      * @param    string    $word    Word to underscore
254 254
      * @return string Underscored word
255 255
      */
256
-    public static function underscore($word){
256
+    public static function underscore($word) {
257 257
         return strtolower(preg_replace('/[^A-Z^a-z^0-9]+/', '_', preg_replace('/([a-zd])([A-Z])/', '1_2', preg_replace('/([A-Z]+)([A-Z][a-z])/', '1_2', $word))));
258 258
     }
259 259
 
@@ -277,9 +277,9 @@  discard block
 block discarded – undo
277 277
      * instead of just the first one.
278 278
      * @return string Human-readable word
279 279
      */
280
-    public static function humanize($word, $uppercase = ''){
280
+    public static function humanize($word, $uppercase = '') {
281 281
 		//make special exceptions for acronyms
282
-		$word = str_replace('wp_', 'WP_', $word );
282
+		$word = str_replace('wp_', 'WP_', $word);
283 283
         $uppercase = $uppercase === 'all' ? 'ucwords' : 'ucfirst';
284 284
         return $uppercase(str_replace('_', ' ', preg_replace('/_id$/', '', $word)));
285 285
     }
@@ -300,9 +300,9 @@  discard block
 block discarded – undo
300 300
      * @param    string    $word    Word to lowerCamelCase
301 301
      * @return string Returns a lowerCamelCasedWord
302 302
      */
303
-    public static function variablize($word){
303
+    public static function variablize($word) {
304 304
         $word = EEH_Inflector::camelize($word);
305
-        return strtolower($word[0]) . substr($word, 1);
305
+        return strtolower($word[0]).substr($word, 1);
306 306
     }
307 307
 
308 308
     // }}}
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
      * @param    string    $class_name    Class name for getting related table_name.
321 321
      * @return string plural_table_name
322 322
      */
323
-    public static function tableize($class_name){
323
+    public static function tableize($class_name) {
324 324
         return EEH_Inflector::pluralize(EEH_Inflector::underscore($class_name));
325 325
     }
326 326
 
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
      * @param    string    $table_name    Table name for getting related ClassName.
340 340
      * @return string SingularClassName
341 341
      */
342
-    public static function classify($table_name){
342
+    public static function classify($table_name) {
343 343
         return EEH_Inflector::camelize(EEH_Inflector::singularize($table_name));
344 344
     }
345 345
 
@@ -356,21 +356,21 @@  discard block
 block discarded – undo
356 356
      * @param    integer    $number    Number to get its ordinal value
357 357
      * @return string Ordinal representation of given string.
358 358
      */
359
-    public static function ordinalize($number){
360
-        if(in_array(($number % 100), range(11, 13))){
361
-            return $number . 'th';
362
-        }else{
363
-            switch(($number % 10)){
359
+    public static function ordinalize($number) {
360
+        if (in_array(($number % 100), range(11, 13))) {
361
+            return $number.'th';
362
+        } else {
363
+            switch (($number % 10)) {
364 364
                 case 1:
365
-                    return $number . 'st';
365
+                    return $number.'st';
366 366
                     break;
367 367
                 case 2:
368
-                    return $number . 'nd';
368
+                    return $number.'nd';
369 369
                     break;
370 370
                 case 3:
371
-                    return $number . 'rd';
371
+                    return $number.'rd';
372 372
                 default:
373
-                    return $number . 'th';
373
+                    return $number.'th';
374 374
                     break;
375 375
             }
376 376
         }
@@ -386,6 +386,6 @@  discard block
 block discarded – undo
386 386
         if (strtolower($string) === 'null') {
387 387
             return $string;
388 388
         }
389
-        return (stripos('aeiou', $string[0]) !== false ? 'an ' : 'a ') . $string;
389
+        return (stripos('aeiou', $string[0]) !== false ? 'an ' : 'a ').$string;
390 390
     }
391 391
 }
392 392
\ No newline at end of file
Please login to merge, or discard this patch.
core/helpers/EEH_Money.helper.php 3 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -8,18 +8,18 @@
 block discarded – undo
8 8
  */
9 9
 if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
10 10
  /**
11
- *
12
- * Money helper class.
13
- * This class has helper methods that help with money related conversions and calculations.
14
- *
15
- * @since %VER%
16
- *
17
- * @package		Event Espresso
18
- * @subpackage	helpers
19
- * @author		Darren Ethier
20
- *
21
- * ------------------------------------------------------------------------
22
- */
11
+  *
12
+  * Money helper class.
13
+  * This class has helper methods that help with money related conversions and calculations.
14
+  *
15
+  * @since %VER%
16
+  *
17
+  * @package		Event Espresso
18
+  * @subpackage	helpers
19
+  * @author		Darren Ethier
20
+  *
21
+  * ------------------------------------------------------------------------
22
+  */
23 23
 class EEH_Money extends EEH_Base  {
24 24
 
25 25
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@
 block discarded – undo
5 5
  * @subpackage plugin api, messages
6 6
  * @since           4.5.0
7 7
  */
8
-if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
8
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
9
+	exit('No direct script access allowed');
10
+}
9 11
 
10 12
 /**
11 13
  * Use this to register or deregister a new message template pack variation for the EE messages system.
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  *
21 21
  * ------------------------------------------------------------------------
22 22
  */
23
-class EEH_Money extends EEH_Base  {
23
+class EEH_Money extends EEH_Base {
24 24
 
25 25
 
26 26
 	/**
@@ -29,15 +29,15 @@  discard block
 block discarded – undo
29 29
 	 * @param int|string $incoming_value
30 30
 	 * @return float
31 31
 	 */
32
-	public static function convert_to_float_from_localized_money( $incoming_value ) {
32
+	public static function convert_to_float_from_localized_money($incoming_value) {
33 33
 		//remove thousands separator
34
-		$money_value = str_replace( EE_Registry::instance()->CFG->currency->thsnds, '', $incoming_value );
34
+		$money_value = str_replace(EE_Registry::instance()->CFG->currency->thsnds, '', $incoming_value);
35 35
 
36 36
 		//replace decimal place with standard decimal.
37
-		$money_value = str_replace( EE_Registry::instance()->CFG->currency->dec_mrk, '.', $money_value );
37
+		$money_value = str_replace(EE_Registry::instance()->CFG->currency->dec_mrk, '.', $money_value);
38 38
 
39 39
 		//float it! and round to three decimal places
40
-		$money_value = round ( (float) $money_value, 3 );
40
+		$money_value = round((float) $money_value, 3);
41 41
 		return $money_value;
42 42
 	}
43 43
 
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 	 * @throws \EE_Error
58 58
 	 */
59 59
 
60
-	public static function compare_floats( $float1, $float2, $operator='=' ) {
60
+	public static function compare_floats($float1, $float2, $operator = '=') {
61 61
 		// Check numbers to 5 digits of precision
62 62
 		$epsilon = 0.00001;
63 63
 
64
-		$float1 = (float)$float1;
65
-		$float2 = (float)$float2;
64
+		$float1 = (float) $float1;
65
+		$float2 = (float) $float2;
66 66
 
67 67
 		switch ($operator) {
68 68
 			// equal
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 				}
117 117
 				break;
118 118
 			default:
119
-				throw new EE_Error(__( "Unknown operator '" . $operator . "' in EEH_Money::compare_floats()", 'event_espresso' ) );
119
+				throw new EE_Error(__("Unknown operator '".$operator."' in EEH_Money::compare_floats()", 'event_espresso'));
120 120
 		}
121 121
 
122 122
 		return false;
@@ -131,21 +131,21 @@  discard block
 block discarded – undo
131 131
 	 *
132 132
 	 * @return string
133 133
 	 */
134
-	public static function get_format_for_jqplot( $CNT_ISO = '') {
134
+	public static function get_format_for_jqplot($CNT_ISO = '') {
135 135
 		//default format
136 136
 		$format = 'f';
137 137
 		//if CNT_ISO passed lets try to get currency settings for it.
138
-		$currency_config = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : null;
138
+		$currency_config = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : null;
139 139
 		//default currency settings for site if not set
140
-		if ( ! $currency_config instanceof EE_Currency_Config ) {
140
+		if ( ! $currency_config instanceof EE_Currency_Config) {
141 141
 			$currency_config = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config();
142 142
 		}
143 143
 
144 144
 		//first get the decimal place and number of places
145
-		$format = "%'." . $currency_config->dec_plc . $format;
145
+		$format = "%'.".$currency_config->dec_plc.$format;
146 146
 
147 147
 		//currency symbol on right side.
148
-		$format = $currency_config->sign_b4 ? $currency_config->sign . $format : $format . $currency_config->sign;
148
+		$format = $currency_config->sign_b4 ? $currency_config->sign.$format : $format.$currency_config->sign;
149 149
 		return $format;
150 150
 	}
151 151
 
@@ -160,27 +160,27 @@  discard block
 block discarded – undo
160 160
 	 *
161 161
 	 * @return string
162 162
 	 */
163
-	public static function get_format_for_google_charts( $CNT_ISO = '' ) {
163
+	public static function get_format_for_google_charts($CNT_ISO = '') {
164 164
 		//if CNT_ISO passed lets try to get currency settings for it.
165
-		$currency_config = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : null;
165
+		$currency_config = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : null;
166 166
 		//default currency settings for site if not set
167
-		if ( ! $currency_config instanceof EE_Currency_Config ) {
167
+		if ( ! $currency_config instanceof EE_Currency_Config) {
168 168
 			$currency_config = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config();
169 169
 		}
170 170
 
171
-		$decimal_places_placeholder = str_pad( '', $currency_config->dec_plc, '0' );
171
+		$decimal_places_placeholder = str_pad('', $currency_config->dec_plc, '0');
172 172
 
173 173
 		//first get the decimal place and number of places
174
-		$format = '#,##0.' . $decimal_places_placeholder;
174
+		$format = '#,##0.'.$decimal_places_placeholder;
175 175
 
176 176
 		//currency symbol on right side.
177
-		$format = $currency_config->sign_b4 ? $currency_config->sign . $format : $format . $currency_config->sign;
177
+		$format = $currency_config->sign_b4 ? $currency_config->sign.$format : $format.$currency_config->sign;
178 178
 		$formatterObject = array(
179 179
 			'decimalSymbol' => $currency_config->dec_mrk,
180 180
 			'groupingSymbol' => $currency_config->thsnds,
181 181
 			'fractionDigits' => $currency_config->dec_plc,
182 182
 		);
183
-		if ( $currency_config->sign_b4 ) {
183
+		if ($currency_config->sign_b4) {
184 184
 			$formatterObject['prefix'] = $currency_config->sign;
185 185
 		} else {
186 186
 			$formatterObject['suffix'] = $currency_config->sign;
Please login to merge, or discard this patch.
core/helpers/EEH_Sideloader.helper.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
 
30 30
 
31
-require_once( EE_HELPERS . 'EEH_Base.helper.php' );
31
+require_once(EE_HELPERS.'EEH_Base.helper.php');
32 32
 class EEH_Sideloader extends EEH_Base {
33 33
 
34 34
 	private $_upload_to;
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 	 * @access public
44 44
 	 * @param array $init array fo initializing the sideloader if keys match the properties.
45 45
 	 */
46
-	public function __construct( $init = array() ) {
47
-		$this->_init( $init );
46
+	public function __construct($init = array()) {
47
+		$this->_init($init);
48 48
 	}
49 49
 
50 50
 
@@ -55,24 +55,24 @@  discard block
 block discarded – undo
55 55
 	 * @param  array  $init array on init (keys match properties others ignored)
56 56
 	 * @return void
57 57
 	 */
58
-	private function _init( $init ) {
58
+	private function _init($init) {
59 59
 		$defaults = array(
60 60
 			'_upload_to' => $this->_get_wp_uploads_dir(),
61 61
 			'_upload_from' => '',
62 62
 			'_permissions' => 0644,
63
-			'_new_file_name' => 'EE_Sideloader_' . uniqid() . '.default'
63
+			'_new_file_name' => 'EE_Sideloader_'.uniqid().'.default'
64 64
 			);
65 65
 
66
-		$props = array_merge( $defaults, $init );
66
+		$props = array_merge($defaults, $init);
67 67
 
68
-		foreach ( $props as $key => $val ) {
69
-			if ( EEH_Class_Tools::has_property( $this, $key ) ) {
68
+		foreach ($props as $key => $val) {
69
+			if (EEH_Class_Tools::has_property($this, $key)) {
70 70
 				$this->$key = $val;
71 71
 			}
72 72
 		}
73 73
 
74 74
 		//make sure we include the required wp file for needed functions
75
-		require_once( ABSPATH . 'wp-admin/includes/file.php' );
75
+		require_once(ABSPATH.'wp-admin/includes/file.php');
76 76
 	}
77 77
 
78 78
 
@@ -80,16 +80,16 @@  discard block
 block discarded – undo
80 80
 	private function _get_wp_uploads_dir() {}
81 81
 
82 82
 	//setters
83
-	public function set_upload_to( $upload_to_folder ) {
83
+	public function set_upload_to($upload_to_folder) {
84 84
 		$this->_upload_to = $upload_to_folder;
85 85
 	}
86
-	public function set_upload_from( $upload_from_folder ) {
86
+	public function set_upload_from($upload_from_folder) {
87 87
 		$this->_upload_from_folder = $upload_from_folder;
88 88
 	}
89
-	public function set_permissions( $permissions ) {
89
+	public function set_permissions($permissions) {
90 90
 		$this->_permissions = $permissions;
91 91
 	}
92
-	public function set_new_file_name( $new_file_name ) {
92
+	public function set_new_file_name($new_file_name) {
93 93
 		$this->_new_file_name = $new_file_name;
94 94
 	}
95 95
 
@@ -111,34 +111,34 @@  discard block
 block discarded – undo
111 111
 	//upload methods
112 112
 	public function sideload() {
113 113
 		//setup temp dir
114
-		$temp_file = wp_tempnam( $this->_upload_from );
114
+		$temp_file = wp_tempnam($this->_upload_from);
115 115
 
116
-		if ( !$temp_file ) {
117
-			EE_Error::add_error( __('Something went wrong with the upload.  Unable to create a tmp file for the uploaded file on the server', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
116
+		if ( ! $temp_file) {
117
+			EE_Error::add_error(__('Something went wrong with the upload.  Unable to create a tmp file for the uploaded file on the server', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
118 118
 			return false;
119 119
 		}
120 120
 
121
-		do_action( 'AHEE__EEH_Sideloader__sideload__before', $this, $temp_file );
121
+		do_action('AHEE__EEH_Sideloader__sideload__before', $this, $temp_file);
122 122
 
123
-		$wp_remote_args = apply_filters( 'FHEE__EEH_Sideloader__sideload__wp_remote_args', array( 'timeout' => 500, 'stream' => true, 'filename' => $temp_file ), $this, $temp_file );
123
+		$wp_remote_args = apply_filters('FHEE__EEH_Sideloader__sideload__wp_remote_args', array('timeout' => 500, 'stream' => true, 'filename' => $temp_file), $this, $temp_file);
124 124
 
125
-		$response = wp_safe_remote_get( $this->_upload_from, $wp_remote_args );
125
+		$response = wp_safe_remote_get($this->_upload_from, $wp_remote_args);
126 126
 
127
-		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
128
-			unlink( $temp_file );
129
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
130
-				EE_Error::add_error( sprintf( __('Unable to upload the file.  Either the path given to upload from is incorrect, or something else happened.  Here is the response returned:<br />%s<br />Here is the path given: %s', 'event_espresso'), var_export( $response, true ), $this->_upload_from ), __FILE__, __FUNCTION__, __LINE__ );
127
+		if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) {
128
+			unlink($temp_file);
129
+			if (defined('WP_DEBUG') && WP_DEBUG) {
130
+				EE_Error::add_error(sprintf(__('Unable to upload the file.  Either the path given to upload from is incorrect, or something else happened.  Here is the response returned:<br />%s<br />Here is the path given: %s', 'event_espresso'), var_export($response, true), $this->_upload_from), __FILE__, __FUNCTION__, __LINE__);
131 131
 			}
132 132
 			return false;
133 133
 		}
134 134
 
135 135
 		//possible md5 check
136
-		$content_md5 = wp_remote_retrieve_header( $response, 'content-md5' );
137
-		if ( $content_md5 ) {
138
-			$md5_check = verify_file_md5( $temp_file, $content_md5 );
139
-			if ( is_wp_error( $md5_check ) ) {
140
-				unlink( $temp_file );
141
-				EE_Error::add_error( $md5_check->get_error_message(), __FILE__, __FUNCTION__, __LINE__ );
136
+		$content_md5 = wp_remote_retrieve_header($response, 'content-md5');
137
+		if ($content_md5) {
138
+			$md5_check = verify_file_md5($temp_file, $content_md5);
139
+			if (is_wp_error($md5_check)) {
140
+				unlink($temp_file);
141
+				EE_Error::add_error($md5_check->get_error_message(), __FILE__, __FUNCTION__, __LINE__);
142 142
 				return false;
143 143
 			}
144 144
 		}
@@ -146,24 +146,24 @@  discard block
 block discarded – undo
146 146
 		$file = $temp_file;
147 147
 
148 148
 		//now we have the file, let's get it in the right directory with the right name.
149
-		$path = apply_filters( 'FHEE__EEH_Sideloader__sideload__new_path', $this->_upload_to . $this->_new_file_name, $this );
149
+		$path = apply_filters('FHEE__EEH_Sideloader__sideload__new_path', $this->_upload_to.$this->_new_file_name, $this);
150 150
 
151 151
 		//move file in
152
-		if ( false === @ rename( $file, $path ) ) {
153
-			unlink( $temp_file );
154
-			EE_Error::add_error(  sprintf( __('Unable to move the file to new location (possible permissions errors). This is the path the class attempted to move the file to: %s', 'event_espresso' ), $path ), __FILE__, __FUNCTION__, __LINE__ );
152
+		if (false === @ rename($file, $path)) {
153
+			unlink($temp_file);
154
+			EE_Error::add_error(sprintf(__('Unable to move the file to new location (possible permissions errors). This is the path the class attempted to move the file to: %s', 'event_espresso'), $path), __FILE__, __FUNCTION__, __LINE__);
155 155
 			return false;
156 156
 		}
157 157
 
158 158
 		//set permissions
159
-		$permissions = apply_filters( 'FHEE__EEH_Sideloader__sideload__permissions_applied', $this->_permissions, $this );
160
-		chmod( $path, $permissions );
159
+		$permissions = apply_filters('FHEE__EEH_Sideloader__sideload__permissions_applied', $this->_permissions, $this);
160
+		chmod($path, $permissions);
161 161
 
162 162
 		//that's it.  let's allow for actions after file uploaded.
163
-		do_action( 'AHEE__EE_Sideloader__sideload_after', $this, $path );
163
+		do_action('AHEE__EE_Sideloader__sideload_after', $this, $path);
164 164
 
165 165
 		//unlink tempfile
166
-		@unlink( $temp_file );
166
+		@unlink($temp_file);
167 167
 		return true;
168 168
 	}
169 169
 
Please login to merge, or discard this patch.