Completed
Branch BUG-10381-asset-loading (2d15a5)
by
unknown
127:00 queued 116:19
created
strategies/EE_Restriction_Generator_Taxonomy_Protected.strategy.php 1 patch
Spacing   +12 added lines, -12 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
 /**
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  * @author				Mike Nelson
14 14
  *
15 15
  */
16
-class EE_Restriction_Generator_Taxonomy_Protected extends EE_Restriction_Generator_Base{
16
+class EE_Restriction_Generator_Taxonomy_Protected extends EE_Restriction_Generator_Base {
17 17
 
18 18
 	/**
19 19
 	 * Model chain/path to taxonomy model, including the term_taxonomy model itself
@@ -24,28 +24,28 @@  discard block
 block discarded – undo
24 24
 	 *
25 25
 	 * @param string $path_to_taxonomy_model Model chain/path to taxonomy model, including the term_taxonomy model itself
26 26
 	 */
27
-	public function __construct( $path_to_taxonomy_model ){
28
-		if( $path_to_taxonomy_model !== '' && substr( $path_to_taxonomy_model, -1, 1 ) != '.' ) {
27
+	public function __construct($path_to_taxonomy_model) {
28
+		if ($path_to_taxonomy_model !== '' && substr($path_to_taxonomy_model, -1, 1) != '.') {
29 29
 			$path_to_taxonomy_model .= '.';
30 30
 		}
31 31
 		$this->_path_to_taxonomy_model = $path_to_taxonomy_model;
32 32
 	}
33 33
 	protected function _generate_restrictions() {
34 34
 		//if there are no standard caps for this model, then for allow full access
35
-		if( ! $this->model()->cap_slug() ) {
35
+		if ( ! $this->model()->cap_slug()) {
36 36
 			return array(
37 37
 			);
38 38
 		}
39 39
 
40 40
 		return array(
41
-			'ee_manage_event_categories' => new EE_Default_Where_Conditions( array(
42
-				$this->_path_to_taxonomy_model . 'taxonomy*no_ee_manage_event_categories' => array( '!=', 'espresso_event_categories' )
41
+			'ee_manage_event_categories' => new EE_Default_Where_Conditions(array(
42
+				$this->_path_to_taxonomy_model.'taxonomy*no_ee_manage_event_categories' => array('!=', 'espresso_event_categories')
43 43
 			)),
44
-			'ee_manage_venue_categories' => new EE_Default_Where_Conditions( array(
45
-				$this->_path_to_taxonomy_model . 'taxonomy*no_ee_manage_venue_categories' => array( '!=', 'espresso_venue_categories' )
44
+			'ee_manage_venue_categories' => new EE_Default_Where_Conditions(array(
45
+				$this->_path_to_taxonomy_model.'taxonomy*no_ee_manage_venue_categories' => array('!=', 'espresso_venue_categories')
46 46
 			)),
47
-			'ee_manage_event_types' => new EE_Default_Where_Conditions( array(
48
-				$this->_path_to_taxonomy_model . 'taxonomy*ee_manage_event_types' => array( '!=', 'espresso_event_types' )
47
+			'ee_manage_event_types' => new EE_Default_Where_Conditions(array(
48
+				$this->_path_to_taxonomy_model.'taxonomy*ee_manage_event_types' => array('!=', 'espresso_event_types')
49 49
 			)),
50 50
 		);
51 51
 	}
Please login to merge, or discard this patch.
core/db_models/strategies/EE_Restriction_Generator_WP_User.strategy.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 /**
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  * @author				Mike Nelson
16 16
  *
17 17
  */
18
-class EE_Restriction_Generator_WP_User extends EE_Restriction_Generator_Base{
18
+class EE_Restriction_Generator_WP_User extends EE_Restriction_Generator_Base {
19 19
 
20 20
 	/**
21 21
 	 * @return \EE_Default_Where_Conditions
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 		return array(
26 26
 			//if they can't access users, they can still access themselves
27
-			EE_Restriction_Generator_Base::get_cap_name( $this->model(), $this->action() ) => new EE_Default_Where_Conditions( array(
27
+			EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) => new EE_Default_Where_Conditions(array(
28 28
 				EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder
29 29
 			)),
30 30
 
Please login to merge, or discard this patch.
core/db_models/strategies/EE_Return_None_Where_Conditions.strategy.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 /**
@@ -14,12 +14,12 @@  discard block
 block discarded – undo
14 14
  *
15 15
  */
16 16
 class EE_Return_None_Where_Conditions extends EE_Default_Where_Conditions {
17
-	protected function _get_default_where_conditions(){
18
-		if( $this->_model->has_primary_key_field() ) {
19
-			return array( $this->_model->primary_key_name() => array('<', 0 ) );
20
-		}else{
21
-			$fk_field = $this->_model->get_a_field_of_type( 'EE_Foreign_Key_Field_Base' );
22
-			return array( 'AND*impossible' => array( $fk_field->get_name() => array('IS_NULL'), $fk_field->get_name() => 'IS_NOT_NULL' ) );
17
+	protected function _get_default_where_conditions() {
18
+		if ($this->_model->has_primary_key_field()) {
19
+			return array($this->_model->primary_key_name() => array('<', 0));
20
+		} else {
21
+			$fk_field = $this->_model->get_a_field_of_type('EE_Foreign_Key_Field_Base');
22
+			return array('AND*impossible' => array($fk_field->get_name() => array('IS_NULL'), $fk_field->get_name() => 'IS_NOT_NULL'));
23 23
 		}
24 24
 	}
25 25
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 	protected function _get_default_where_conditions(){
18 18
 		if( $this->_model->has_primary_key_field() ) {
19 19
 			return array( $this->_model->primary_key_name() => array('<', 0 ) );
20
-		}else{
20
+		} else{
21 21
 			$fk_field = $this->_model->get_a_field_of_type( 'EE_Foreign_Key_Field_Base' );
22 22
 			return array( 'AND*impossible' => array( $fk_field->get_name() => array('IS_NULL'), $fk_field->get_name() => 'IS_NOT_NULL' ) );
23 23
 		}
Please login to merge, or discard this patch.
core/db_models/strategies/EE_Soft_Delete_Where_Conditions.strategy.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 		$field = $this->_model->get_a_field_of_type('EE_Trashed_Flag_Field');
34 34
 		if($field){
35 35
 			return $field->get_name();
36
-		}else{
36
+		} else{
37 37
 			throw new EE_Error(sprintf(__('We are trying to find the deleted flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?','event_espresso'),get_class($this),get_class($this)));
38 38
 		}
39 39
 	}
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 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
  *
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  * @author				Mike Nelson
14 14
  * @since		 	   4.6.0
15 15
  */
16
-class EE_Soft_Delete_Where_Conditions extends EE_Default_Where_Conditions{
16
+class EE_Soft_Delete_Where_Conditions extends EE_Default_Where_Conditions {
17 17
 	/**
18 18
 	 * Strategy for setting default soft delete where conditions. This strategy will find
19 19
 	 * the field of type 'EE_Trashed_Flag_Field', and add a condition that it be FALSE on all queries involving
@@ -22,12 +22,12 @@  discard block
 block discarded – undo
22 22
 	 * Eg,
23 23
 	 *
24 24
 	 */
25
-	function __construct(){}
25
+	function __construct() {}
26 26
 	/**
27 27
 	 * Gets the where default where conditions for a custom post type model
28 28
 	 * @return array like EEM_Base::get_all's $query_params's index [0] (where conditions)
29 29
 	 */
30
-	protected function _get_default_where_conditions(){
30
+	protected function _get_default_where_conditions() {
31 31
 		$trashed_field_name = $this->deleted_field_name();
32 32
 		return array(
33 33
 			$trashed_field_name => false
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
 	 * @return string
40 40
 	 * @throws EE_Error
41 41
 	 */
42
-	private function deleted_field_name(){
42
+	private function deleted_field_name() {
43 43
 		$field = $this->_model->get_a_field_of_type('EE_Trashed_Flag_Field');
44
-		if($field){
44
+		if ($field) {
45 45
 			return $field->get_name();
46
-		}else{
47
-			throw new EE_Error(sprintf(__('We are trying to find the deleted flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?','event_espresso'),get_class($this),get_class($this)));
46
+		} else {
47
+			throw new EE_Error(sprintf(__('We are trying to find the deleted flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?', 'event_espresso'), get_class($this), get_class($this)));
48 48
 		}
49 49
 	}
50 50
 }
51 51
\ No newline at end of file
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
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@
 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
  * EEH_Autoloader
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.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,10 +25,10 @@
 block discarded – undo
25 25
 	private static $_instance = null;
26 26
 
27 27
 	/**
28
-	* 	$_autoloaders
29
-	* 	@var array $_autoloaders
30
-	* 	@access 	private
31
-	*/
28
+	 * 	$_autoloaders
29
+	 * 	@var array $_autoloaders
30
+	 * 	@access 	private
31
+	 */
32 32
 	private static $_autoloaders;
33 33
 
34 34
 	/**
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_Event_View.helper.php 4 patches
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -432,7 +434,7 @@  discard block
 block discarded – undo
432 434
 		if($include_expired === null){
433 435
 			if($event instanceof EE_Event && $event->is_expired()){
434 436
 				$include_expired = true;
435
-			}else{
437
+			} else{
436 438
 				$include_expired = false;
437 439
 			}
438 440
 		}
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      * get_event
37 37
      * attempts to retrieve an EE_Event object any way it can
38 38
      *
39
-     * @param int|WP_Post $EVT_ID
39
+     * @param integer $EVT_ID
40 40
      * @return EE_Event|null
41 41
      * @throws \EE_Error
42 42
      */
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 *  @access 	public
115 115
 	 * @param    int $EVT_ID
116
-	 *  @return 	string
116
+	 *  @return 	boolean
117 117
 	 */
118 118
 	public static function event_has_content_or_excerpt( $EVT_ID = 0 ) {
119 119
 		$event = EEH_Event_View::get_event( $EVT_ID );
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 *    event_active_status
134 134
 	 *
135 135
 	 * @access    public
136
-	 * @param null $num_words
136
+	 * @param integer $num_words
137 137
 	 * @param null $more
138 138
 	 * @return    string
139 139
 	 */
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 	 *
445 445
 	 * @access    public
446 446
 	 * @param int $EVT_ID
447
-	 * @param null $include_expired
447
+	 * @param false|null $include_expired
448 448
 	 * @param bool $include_deleted
449 449
 	 * @param null $limit
450 450
 	 * @return EE_Datetime[]
Please login to merge, or discard this patch.
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
 
33 33
 
34 34
 
35
-    /**
36
-     * get_event
37
-     * attempts to retrieve an EE_Event object any way it can
38
-     *
39
-     * @param int|WP_Post $EVT_ID
40
-     * @return EE_Event|null
41
-     * @throws \EE_Error
42
-     */
35
+	/**
36
+	 * get_event
37
+	 * attempts to retrieve an EE_Event object any way it can
38
+	 *
39
+	 * @param int|WP_Post $EVT_ID
40
+	 * @return EE_Event|null
41
+	 * @throws \EE_Error
42
+	 */
43 43
 	public static function get_event( $EVT_ID = 0 ) {
44 44
 		$EVT_ID = $EVT_ID instanceof WP_Post ? $EVT_ID->ID : absint( $EVT_ID );
45 45
 		// do we already have the Event  you are looking for?
@@ -138,58 +138,58 @@  discard block
 block discarded – undo
138 138
 	 * @return    string
139 139
 	 */
140 140
 	public static function event_content_or_excerpt( $num_words = NULL, $more = NULL ) {
141
-        global $post;
141
+		global $post;
142 142
 		ob_start();
143 143
 		if (( is_single() ) || ( is_archive() && espresso_display_full_description_in_event_list() )) {
144 144
 			// admin has chosen "full description"
145
-            // for the "Event Espresso - Events > Templates > Display Description" option
145
+			// for the "Event Espresso - Events > Templates > Display Description" option
146 146
 			the_content();
147 147
 		} else if (( is_archive() && espresso_display_excerpt_in_event_list() ) ) {
148
-            if ( has_excerpt( $post->ID )) {
149
-                // admin has chosen "excerpt (short desc)"
150
-                // for the "Event Espresso - Events > Templates > Display Description" option
151
-                // AND an excerpt actually exists
152
-                the_excerpt();
153
-            } else {
154
-                // admin has chosen "excerpt (short desc)"
155
-                // for the "Event Espresso - Events > Templates > Display Description" option
156
-                // but NO excerpt actually exists, so we need to create one
157
-                if ( ! empty( $num_words )) {
158
-                    if ( empty( $more )) {
159
-                        $more_link_text = __( '(more&hellip;)' );
160
-                        $more = ' <a href="' . get_permalink() . '"';
161
-                        $more .= ' class="more-link"';
162
-                        $more .= \EED_Events_Archive::link_target();
163
-                        $more .= '>' . $more_link_text . '</a>';
164
-                        $more = apply_filters( 'the_content_more_link', $more, $more_link_text );
165
-                    }
166
-                    $content = str_replace( 'NOMORELINK', '', get_the_content( 'NOMORELINK' ));
167
-
168
-                    $content =  wp_trim_words( $content, $num_words, ' ' ) . $more;
169
-                } else {
170
-                    $content =  get_the_content();
171
-                }
172
-                global $allowedtags;
173
-                // make sure links are allowed
174
-                $allowedtags['a'] = isset($allowedtags['a'])
175
-                    ? $allowedtags['a']
176
-                    : array();
177
-                // as well as target attribute
178
-                $allowedtags['a']['target'] = isset($allowedtags['a']['target'])
179
-                    ? $allowedtags['a']['target']
180
-                    : false;
181
-                // but get previous value so we can reset it
182
-                $prev_value = $allowedtags['a']['target'];
183
-                $allowedtags['a']['target'] = true;
184
-                $content = wp_kses( $content, $allowedtags );
185
-                $content = strip_shortcodes( $content );
186
-                echo apply_filters( 'the_content', $content );
187
-                $allowedtags['a']['target'] = $prev_value;
188
-            }
189
-        } else {
190
-            // admin has chosen "none"
191
-            // for the "Event Espresso - Events > Templates > Display Description" option
192
-            echo apply_filters( 'the_content', '' );
148
+			if ( has_excerpt( $post->ID )) {
149
+				// admin has chosen "excerpt (short desc)"
150
+				// for the "Event Espresso - Events > Templates > Display Description" option
151
+				// AND an excerpt actually exists
152
+				the_excerpt();
153
+			} else {
154
+				// admin has chosen "excerpt (short desc)"
155
+				// for the "Event Espresso - Events > Templates > Display Description" option
156
+				// but NO excerpt actually exists, so we need to create one
157
+				if ( ! empty( $num_words )) {
158
+					if ( empty( $more )) {
159
+						$more_link_text = __( '(more&hellip;)' );
160
+						$more = ' <a href="' . get_permalink() . '"';
161
+						$more .= ' class="more-link"';
162
+						$more .= \EED_Events_Archive::link_target();
163
+						$more .= '>' . $more_link_text . '</a>';
164
+						$more = apply_filters( 'the_content_more_link', $more, $more_link_text );
165
+					}
166
+					$content = str_replace( 'NOMORELINK', '', get_the_content( 'NOMORELINK' ));
167
+
168
+					$content =  wp_trim_words( $content, $num_words, ' ' ) . $more;
169
+				} else {
170
+					$content =  get_the_content();
171
+				}
172
+				global $allowedtags;
173
+				// make sure links are allowed
174
+				$allowedtags['a'] = isset($allowedtags['a'])
175
+					? $allowedtags['a']
176
+					: array();
177
+				// as well as target attribute
178
+				$allowedtags['a']['target'] = isset($allowedtags['a']['target'])
179
+					? $allowedtags['a']['target']
180
+					: false;
181
+				// but get previous value so we can reset it
182
+				$prev_value = $allowedtags['a']['target'];
183
+				$allowedtags['a']['target'] = true;
184
+				$content = wp_kses( $content, $allowedtags );
185
+				$content = strip_shortcodes( $content );
186
+				echo apply_filters( 'the_content', $content );
187
+				$allowedtags['a']['target'] = $prev_value;
188
+			}
189
+		} else {
190
+			// admin has chosen "none"
191
+			// for the "Event Espresso - Events > Templates > Display Description" option
192
+			echo apply_filters( 'the_content', '' );
193 193
 		}
194 194
 		return ob_get_clean();
195 195
 	}
@@ -236,11 +236,11 @@  discard block
 block discarded – undo
236 236
 					$url = get_term_link( $term, 'espresso_venue_categories' );
237 237
 					if ( ! is_wp_error( $url ) && (( $hide_uncategorized && strtolower( $term->name ) != __( 'uncategorized', 'event_espresso' )) || ! $hide_uncategorized )) {
238 238
 						$category_links[] = '<a href="' . esc_url( $url )
239
-                                            . '" rel="tag"'
240
-                                            . \EED_Events_Archive::link_target()
241
-                                            .'>'
242
-                                            . $term->name
243
-                                            . '</a>';
239
+											. '" rel="tag"'
240
+											. \EED_Events_Archive::link_target()
241
+											.'>'
242
+											. $term->name
243
+											. '</a>';
244 244
 					}
245 245
 				}
246 246
 			}
Please login to merge, or discard this patch.
Spacing   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -40,25 +40,25 @@  discard block
 block discarded – undo
40 40
      * @return EE_Event|null
41 41
      * @throws \EE_Error
42 42
      */
43
-	public static function get_event( $EVT_ID = 0 ) {
44
-		$EVT_ID = $EVT_ID instanceof WP_Post ? $EVT_ID->ID : absint( $EVT_ID );
43
+	public static function get_event($EVT_ID = 0) {
44
+		$EVT_ID = $EVT_ID instanceof WP_Post ? $EVT_ID->ID : absint($EVT_ID);
45 45
 		// do we already have the Event  you are looking for?
46
-		if ( EEH_Event_View::$_event instanceof EE_Event && $EVT_ID && EEH_Event_View::$_event->ID() === $EVT_ID ) {
46
+		if (EEH_Event_View::$_event instanceof EE_Event && $EVT_ID && EEH_Event_View::$_event->ID() === $EVT_ID) {
47 47
 			return EEH_Event_View::$_event;
48 48
 		}
49 49
 		EEH_Event_View::$_event = NULL;
50 50
 		// international newspaper?
51 51
 		global $post;
52 52
 		// if this is being called from an EE_Event post, then we can just grab the attached EE_Event object
53
-		 if (( isset( $post->post_type ) && $post->post_type === 'espresso_events' ) || $EVT_ID ) {
53
+		 if ((isset($post->post_type) && $post->post_type === 'espresso_events') || $EVT_ID) {
54 54
 			// grab the event we're looking for
55
-			if ( isset( $post->EE_Event ) && ( $EVT_ID === 0 || ( $EVT_ID === $post->ID ))) {
55
+			if (isset($post->EE_Event) && ($EVT_ID === 0 || ($EVT_ID === $post->ID))) {
56 56
 				EEH_Event_View::$_event = $post->EE_Event;
57 57
 			}
58 58
 			// now if we STILL do NOT have an EE_Event model object, BUT we have an Event ID...
59
-			if ( ! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID ) {
59
+			if ( ! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) {
60 60
 				// sigh... pull it from the db
61
-				EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
61
+				EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID($EVT_ID);
62 62
 			}
63 63
 		}
64 64
 		return EEH_Event_View::$_event;
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 	 * @param    int $EVT_ID
74 74
 	 * @return    boolean
75 75
 	 */
76
-	public static function display_ticket_selector( $EVT_ID = 0 ) {
77
-		$event = EEH_Event_View::get_event( $EVT_ID );
76
+	public static function display_ticket_selector($EVT_ID = 0) {
77
+		$event = EEH_Event_View::get_event($EVT_ID);
78 78
 		return $event instanceof EE_Event ? $event->display_ticket_selector() : FALSE;
79 79
 	}
80 80
 
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
 	 * @param    int $EVT_ID
88 88
 	 * @return    string
89 89
 	 */
90
-	public static function event_status( $EVT_ID = 0 ) {
91
-		$event = EEH_Event_View::get_event( $EVT_ID );
92
-		return $event instanceof EE_Event ? $event->pretty_active_status( FALSE ) : '';
90
+	public static function event_status($EVT_ID = 0) {
91
+		$event = EEH_Event_View::get_event($EVT_ID);
92
+		return $event instanceof EE_Event ? $event->pretty_active_status(FALSE) : '';
93 93
 	}
94 94
 
95 95
 
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 	 * @param    int $EVT_ID
102 102
 	 *  @return 	string
103 103
 	 */
104
-	public static function event_active_status( $EVT_ID = 0 ) {
105
-		$event = EEH_Event_View::get_event( $EVT_ID );
104
+	public static function event_active_status($EVT_ID = 0) {
105
+		$event = EEH_Event_View::get_event($EVT_ID);
106 106
 		return $event instanceof EE_Event ? $event->pretty_active_status() : 'inactive';
107 107
 	}
108 108
 
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
 	 * @param    int $EVT_ID
116 116
 	 *  @return 	string
117 117
 	 */
118
-	public static function event_has_content_or_excerpt( $EVT_ID = 0 ) {
119
-		$event = EEH_Event_View::get_event( $EVT_ID );
118
+	public static function event_has_content_or_excerpt($EVT_ID = 0) {
119
+		$event = EEH_Event_View::get_event($EVT_ID);
120 120
 		$has_content_or_excerpt = FALSE;
121
-		if ( $event instanceof EE_Event ) {
122
-			$has_content_or_excerpt = $event->description() != '' || $event->short_description( NULL, NULL, TRUE ) != '' ? TRUE : FALSE;
121
+		if ($event instanceof EE_Event) {
122
+			$has_content_or_excerpt = $event->description() != '' || $event->short_description(NULL, NULL, TRUE) != '' ? TRUE : FALSE;
123 123
 		}
124
-		if ( is_archive() && ! ( espresso_display_full_description_in_event_list() || espresso_display_excerpt_in_event_list() )) {
124
+		if (is_archive() && ! (espresso_display_full_description_in_event_list() || espresso_display_excerpt_in_event_list())) {
125 125
 			$has_content_or_excerpt = FALSE;
126 126
 		}
127 127
 		return $has_content_or_excerpt;
@@ -137,15 +137,15 @@  discard block
 block discarded – undo
137 137
 	 * @param null $more
138 138
 	 * @return    string
139 139
 	 */
140
-	public static function event_content_or_excerpt( $num_words = NULL, $more = NULL ) {
140
+	public static function event_content_or_excerpt($num_words = NULL, $more = NULL) {
141 141
         global $post;
142 142
 		ob_start();
143
-		if (( is_single() ) || ( is_archive() && espresso_display_full_description_in_event_list() )) {
143
+		if ((is_single()) || (is_archive() && espresso_display_full_description_in_event_list())) {
144 144
 			// admin has chosen "full description"
145 145
             // for the "Event Espresso - Events > Templates > Display Description" option
146 146
 			the_content();
147
-		} else if (( is_archive() && espresso_display_excerpt_in_event_list() ) ) {
148
-            if ( has_excerpt( $post->ID )) {
147
+		} else if ((is_archive() && espresso_display_excerpt_in_event_list())) {
148
+            if (has_excerpt($post->ID)) {
149 149
                 // admin has chosen "excerpt (short desc)"
150 150
                 // for the "Event Espresso - Events > Templates > Display Description" option
151 151
                 // AND an excerpt actually exists
@@ -154,20 +154,20 @@  discard block
 block discarded – undo
154 154
                 // admin has chosen "excerpt (short desc)"
155 155
                 // for the "Event Espresso - Events > Templates > Display Description" option
156 156
                 // but NO excerpt actually exists, so we need to create one
157
-                if ( ! empty( $num_words )) {
158
-                    if ( empty( $more )) {
159
-                        $more_link_text = __( '(more&hellip;)' );
160
-                        $more = ' <a href="' . get_permalink() . '"';
157
+                if ( ! empty($num_words)) {
158
+                    if (empty($more)) {
159
+                        $more_link_text = __('(more&hellip;)');
160
+                        $more = ' <a href="'.get_permalink().'"';
161 161
                         $more .= ' class="more-link"';
162 162
                         $more .= \EED_Events_Archive::link_target();
163
-                        $more .= '>' . $more_link_text . '</a>';
164
-                        $more = apply_filters( 'the_content_more_link', $more, $more_link_text );
163
+                        $more .= '>'.$more_link_text.'</a>';
164
+                        $more = apply_filters('the_content_more_link', $more, $more_link_text);
165 165
                     }
166
-                    $content = str_replace( 'NOMORELINK', '', get_the_content( 'NOMORELINK' ));
166
+                    $content = str_replace('NOMORELINK', '', get_the_content('NOMORELINK'));
167 167
 
168
-                    $content =  wp_trim_words( $content, $num_words, ' ' ) . $more;
168
+                    $content = wp_trim_words($content, $num_words, ' ').$more;
169 169
                 } else {
170
-                    $content =  get_the_content();
170
+                    $content = get_the_content();
171 171
                 }
172 172
                 global $allowedtags;
173 173
                 // make sure links are allowed
@@ -181,15 +181,15 @@  discard block
 block discarded – undo
181 181
                 // but get previous value so we can reset it
182 182
                 $prev_value = $allowedtags['a']['target'];
183 183
                 $allowedtags['a']['target'] = true;
184
-                $content = wp_kses( $content, $allowedtags );
185
-                $content = strip_shortcodes( $content );
186
-                echo apply_filters( 'the_content', $content );
184
+                $content = wp_kses($content, $allowedtags);
185
+                $content = strip_shortcodes($content);
186
+                echo apply_filters('the_content', $content);
187 187
                 $allowedtags['a']['target'] = $prev_value;
188 188
             }
189 189
         } else {
190 190
             // admin has chosen "none"
191 191
             // for the "Event Espresso - Events > Templates > Display Description" option
192
-            echo apply_filters( 'the_content', '' );
192
+            echo apply_filters('the_content', '');
193 193
 		}
194 194
 		return ob_get_clean();
195 195
 	}
@@ -203,13 +203,13 @@  discard block
 block discarded – undo
203 203
 	 * @param    int $EVT_ID
204 204
 	 *  @return 	EE_Ticket[]
205 205
 	 */
206
-	public static function event_tickets_available( $EVT_ID = 0 ) {
207
-		$event = EEH_Event_View::get_event( $EVT_ID );
206
+	public static function event_tickets_available($EVT_ID = 0) {
207
+		$event = EEH_Event_View::get_event($EVT_ID);
208 208
 		$tickets_available_for_purchase = array();
209
-		if( $event instanceof EE_Event ) {
210
-			$datetimes = EEH_Event_View::get_all_date_obj( $EVT_ID, FALSE );
211
-			foreach( $datetimes as $datetime ) {
212
-				$tickets_available_for_purchase = array_merge( $tickets_available_for_purchase, $datetime->ticket_types_available_for_purchase() );
209
+		if ($event instanceof EE_Event) {
210
+			$datetimes = EEH_Event_View::get_all_date_obj($EVT_ID, FALSE);
211
+			foreach ($datetimes as $datetime) {
212
+				$tickets_available_for_purchase = array_merge($tickets_available_for_purchase, $datetime->ticket_types_available_for_purchase());
213 213
 			}
214 214
 		}
215 215
 		return $tickets_available_for_purchase;
@@ -225,17 +225,17 @@  discard block
 block discarded – undo
225 225
 	 * @param 	  bool   $hide_uncategorized
226 226
 	 * @return    string
227 227
 	 */
228
-	public static function event_categories( $EVT_ID = 0, $hide_uncategorized = TRUE ) {
228
+	public static function event_categories($EVT_ID = 0, $hide_uncategorized = TRUE) {
229 229
 		$category_links = array();
230
-		$event = EEH_Event_View::get_event( $EVT_ID );
231
-		if ( $event instanceof EE_Event ) {
232
-			$event_categories = get_the_terms( $event->ID(), 'espresso_event_categories' );
233
-			if ( $event_categories ) {
230
+		$event = EEH_Event_View::get_event($EVT_ID);
231
+		if ($event instanceof EE_Event) {
232
+			$event_categories = get_the_terms($event->ID(), 'espresso_event_categories');
233
+			if ($event_categories) {
234 234
 				// loop thru terms and create links
235
-				foreach ( $event_categories as $term ) {
236
-					$url = get_term_link( $term, 'espresso_venue_categories' );
237
-					if ( ! is_wp_error( $url ) && (( $hide_uncategorized && strtolower( $term->name ) != __( 'uncategorized', 'event_espresso' )) || ! $hide_uncategorized )) {
238
-						$category_links[] = '<a href="' . esc_url( $url )
235
+				foreach ($event_categories as $term) {
236
+					$url = get_term_link($term, 'espresso_venue_categories');
237
+					if ( ! is_wp_error($url) && (($hide_uncategorized && strtolower($term->name) != __('uncategorized', 'event_espresso')) || ! $hide_uncategorized)) {
238
+						$category_links[] = '<a href="'.esc_url($url)
239 239
                                             . '" rel="tag"'
240 240
                                             . \EED_Events_Archive::link_target()
241 241
                                             .'>'
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 				}
246 246
 			}
247 247
 		}
248
-		return implode( ', ', $category_links );
248
+		return implode(', ', $category_links);
249 249
 	}
250 250
 
251 251
 
@@ -259,10 +259,10 @@  discard block
 block discarded – undo
259 259
 	 * @param int    $EVT_ID
260 260
 	 * @return    string
261 261
 	 */
262
-	public static function the_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) {
263
-		$datetime = EEH_Event_View::get_primary_date_obj( $EVT_ID );
264
-		$format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt;
265
-		return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_start', $format ) :  '';
262
+	public static function the_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) {
263
+		$datetime = EEH_Event_View::get_primary_date_obj($EVT_ID);
264
+		$format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt;
265
+		return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) : '';
266 266
 	}
267 267
 
268 268
 
@@ -276,10 +276,10 @@  discard block
 block discarded – undo
276 276
 	 * @param int    $EVT_ID
277 277
 	 * @return    string
278 278
 	 */
279
-	public static function the_event_end_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) {
280
-		$datetime = EEH_Event_View::get_last_date_obj( $EVT_ID );
281
-		$format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt;
282
-		return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_end', $format ) : '';
279
+	public static function the_event_end_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) {
280
+		$datetime = EEH_Event_View::get_last_date_obj($EVT_ID);
281
+		$format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt;
282
+		return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_end', $format) : '';
283 283
 	}
284 284
 
285 285
 
@@ -293,10 +293,10 @@  discard block
 block discarded – undo
293 293
 	 * @param int    $EVT_ID
294 294
 	 * @return    string
295 295
 	 */
296
-	public static function the_earliest_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) {
297
-		$datetime = EEH_Event_View::get_earliest_date_obj( $EVT_ID );
298
-		$format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt;
299
-		return $datetime instanceof EE_Datetime ?  $datetime->get_i18n_datetime( 'DTT_EVT_start', $format ) : '';
296
+	public static function the_earliest_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) {
297
+		$datetime = EEH_Event_View::get_earliest_date_obj($EVT_ID);
298
+		$format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt;
299
+		return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) : '';
300 300
 	}
301 301
 
302 302
 
@@ -310,10 +310,10 @@  discard block
 block discarded – undo
310 310
 	 * @param int    $EVT_ID
311 311
 	 * @return    string
312 312
 	 */
313
-	public static function the_latest_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) {
314
-		$datetime = EEH_Event_View::get_last_date_obj( $EVT_ID );
315
-		$format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt;
316
-		return $datetime instanceof EE_Datetime ?  $datetime->get_i18n_datetime( 'DTT_EVT_end', $format ) : '';
313
+	public static function the_latest_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) {
314
+		$datetime = EEH_Event_View::get_last_date_obj($EVT_ID);
315
+		$format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt;
316
+		return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_end', $format) : '';
317 317
 	}
318 318
 
319 319
 
@@ -325,13 +325,13 @@  discard block
 block discarded – undo
325 325
 	 * @param int $EVT_ID
326 326
 	 * @return    string
327 327
 	 */
328
-	public static function event_date_as_calendar_page( $EVT_ID = 0 ) {
329
-		$datetime = EEH_Event_View::get_primary_date_obj( $EVT_ID );
330
-		if ( $datetime instanceof EE_Datetime ) {
328
+	public static function event_date_as_calendar_page($EVT_ID = 0) {
329
+		$datetime = EEH_Event_View::get_primary_date_obj($EVT_ID);
330
+		if ($datetime instanceof EE_Datetime) {
331 331
 	?>
332 332
 		<div class="event-date-calendar-page-dv">
333
-			<div class="event-date-calendar-page-month-dv"><?php echo $datetime->get_i18n_datetime( 'DTT_EVT_start', 'M' );?></div>
334
-			<div class="event-date-calendar-page-day-dv"><?php echo $datetime->start_date( 'd' );?></div>
333
+			<div class="event-date-calendar-page-month-dv"><?php echo $datetime->get_i18n_datetime('DTT_EVT_start', 'M'); ?></div>
334
+			<div class="event-date-calendar-page-day-dv"><?php echo $datetime->start_date('d'); ?></div>
335 335
 		</div>
336 336
 	<?php
337 337
 		}
@@ -346,17 +346,17 @@  discard block
 block discarded – undo
346 346
 	 * @param int $EVT_ID
347 347
 	 * @return    string
348 348
 	 */
349
-	public static function get_primary_date_obj( $EVT_ID = 0 ) {
350
-		$event = EEH_Event_View::get_event( $EVT_ID );
351
-		if ( $event instanceof EE_Event ) {
349
+	public static function get_primary_date_obj($EVT_ID = 0) {
350
+		$event = EEH_Event_View::get_event($EVT_ID);
351
+		if ($event instanceof EE_Event) {
352 352
 			$datetimes = $event->get_many_related(
353 353
 				'Datetime',
354 354
 				array(
355 355
 					'limit' => 1,
356
-					'order_by' => array( 'DTT_order' => 'ASC' )
356
+					'order_by' => array('DTT_order' => 'ASC')
357 357
 				)
358 358
 			);
359
-			return reset( $datetimes );
359
+			return reset($datetimes);
360 360
 		} else {
361 361
 			 return FALSE;
362 362
 		}
@@ -371,17 +371,17 @@  discard block
 block discarded – undo
371 371
 	 * @param int $EVT_ID
372 372
 	 * @return    string
373 373
 	 */
374
-	public static function get_last_date_obj( $EVT_ID = 0 ) {
375
-		$event = EEH_Event_View::get_event( $EVT_ID );
376
-		if ( $event instanceof EE_Event ) {
374
+	public static function get_last_date_obj($EVT_ID = 0) {
375
+		$event = EEH_Event_View::get_event($EVT_ID);
376
+		if ($event instanceof EE_Event) {
377 377
 			$datetimes = $event->get_many_related(
378 378
 				'Datetime',
379 379
 				array(
380 380
 					'limit' => 1,
381
-					'order_by' => array( 'DTT_order' => 'DESC' )
381
+					'order_by' => array('DTT_order' => 'DESC')
382 382
 				)
383 383
 			);
384
-			return end( $datetimes );
384
+			return end($datetimes);
385 385
 		} else {
386 386
 			return FALSE;
387 387
 		}
@@ -396,17 +396,17 @@  discard block
 block discarded – undo
396 396
 	 * @param int $EVT_ID
397 397
 	 * @return    string
398 398
 	 */
399
-	public static function get_earliest_date_obj( $EVT_ID = 0 ) {
400
-		$event = EEH_Event_View::get_event( $EVT_ID );
401
-		if ( $event instanceof EE_Event ) {
399
+	public static function get_earliest_date_obj($EVT_ID = 0) {
400
+		$event = EEH_Event_View::get_event($EVT_ID);
401
+		if ($event instanceof EE_Event) {
402 402
 			$datetimes = $event->get_many_related(
403 403
 				'Datetime',
404 404
 				array(
405 405
 					'limit' => 1,
406
-					'order_by' => array( 'DTT_EVT_start' => 'ASC' )
406
+					'order_by' => array('DTT_EVT_start' => 'ASC')
407 407
 				)
408 408
 			);
409
-			return reset( $datetimes );
409
+			return reset($datetimes);
410 410
 		} else {
411 411
 			 return FALSE;
412 412
 		}
@@ -421,17 +421,17 @@  discard block
 block discarded – undo
421 421
 	 * @param int $EVT_ID
422 422
 	 * @return    string
423 423
 	 */
424
-	public static function get_latest_date_obj( $EVT_ID = 0 ) {
425
-		$event = EEH_Event_View::get_event( $EVT_ID );
426
-		if ( $event instanceof EE_Event ) {
424
+	public static function get_latest_date_obj($EVT_ID = 0) {
425
+		$event = EEH_Event_View::get_event($EVT_ID);
426
+		if ($event instanceof EE_Event) {
427 427
 			$datetimes = $event->get_many_related(
428 428
 				'Datetime',
429 429
 				array(
430 430
 					'limit' => 1,
431
-					'order_by' => array( 'DTT_EVT_start' => 'DESC' )
431
+					'order_by' => array('DTT_EVT_start' => 'DESC')
432 432
 				)
433 433
 			);
434
-			return end( $datetimes );
434
+			return end($datetimes);
435 435
 		} else {
436 436
 			return FALSE;
437 437
 		}
@@ -449,17 +449,17 @@  discard block
 block discarded – undo
449 449
 	 * @param null $limit
450 450
 	 * @return EE_Datetime[]
451 451
 	 */
452
-	public static function get_all_date_obj( $EVT_ID = 0, $include_expired = null, $include_deleted = false, $limit = NULL ) {
453
-		$event = EEH_Event_View::get_event( $EVT_ID );
454
-		if($include_expired === null){
455
-			if($event instanceof EE_Event && $event->is_expired()){
452
+	public static function get_all_date_obj($EVT_ID = 0, $include_expired = null, $include_deleted = false, $limit = NULL) {
453
+		$event = EEH_Event_View::get_event($EVT_ID);
454
+		if ($include_expired === null) {
455
+			if ($event instanceof EE_Event && $event->is_expired()) {
456 456
 				$include_expired = true;
457
-			}else{
457
+			} else {
458 458
 				$include_expired = false;
459 459
 			}
460 460
 		}
461 461
 
462
-		if ( $event instanceof EE_Event ) {
462
+		if ($event instanceof EE_Event) {
463 463
 			return $event->datetimes_ordered($include_expired, $include_deleted, $limit);
464 464
 		} else {
465 465
 			 return array();
@@ -475,11 +475,11 @@  discard block
 block discarded – undo
475 475
 	 * @param int $EVT_ID
476 476
 	 * @return    string
477 477
 	 */
478
-	public static function event_link_url( $EVT_ID = 0 ) {
479
-		$event = EEH_Event_View::get_event( $EVT_ID );
480
-		if ( $event instanceof EE_Event ) {
481
-			$url = $event->external_url() !== NULL && $event->external_url() !== '' ? $event->external_url() : get_permalink( $event->ID() );
482
-			return preg_match( "~^(?:f|ht)tps?://~i", $url ) ? $url : 'http://' . $url;
478
+	public static function event_link_url($EVT_ID = 0) {
479
+		$event = EEH_Event_View::get_event($EVT_ID);
480
+		if ($event instanceof EE_Event) {
481
+			$url = $event->external_url() !== NULL && $event->external_url() !== '' ? $event->external_url() : get_permalink($event->ID());
482
+			return preg_match("~^(?:f|ht)tps?://~i", $url) ? $url : 'http://'.$url;
483 483
 		}
484 484
 		return NULL;
485 485
 	}
@@ -493,10 +493,10 @@  discard block
 block discarded – undo
493 493
 	 * @param int $EVT_ID
494 494
 	 * @return    string
495 495
 	 */
496
-	public static function event_phone( $EVT_ID = 0 ) {
497
-		$event = EEH_Event_View::get_event( $EVT_ID );
498
-		if ( $event instanceof EE_Event ) {
499
-			return EEH_Schema::telephone( $event->phone() );
496
+	public static function event_phone($EVT_ID = 0) {
497
+		$event = EEH_Event_View::get_event($EVT_ID);
498
+		if ($event instanceof EE_Event) {
499
+			return EEH_Schema::telephone($event->phone());
500 500
 		}
501 501
 		return NULL;
502 502
 	}
@@ -513,26 +513,26 @@  discard block
 block discarded – undo
513 513
 	 * @param string $after
514 514
 	 * @return    string
515 515
 	 */
516
-	public static function edit_event_link( $EVT_ID = 0, $link = '', $before = '', $after = '' ) {
517
-		$event = EEH_Event_View::get_event( $EVT_ID );
518
-		if ( $event instanceof EE_Event ) {
516
+	public static function edit_event_link($EVT_ID = 0, $link = '', $before = '', $after = '') {
517
+		$event = EEH_Event_View::get_event($EVT_ID);
518
+		if ($event instanceof EE_Event) {
519 519
 			// can the user edit this post ?
520
-			if ( current_user_can( 'edit_post', $event->ID() )) {
520
+			if (current_user_can('edit_post', $event->ID())) {
521 521
 				// set link text
522
-				$link_text = ! empty( $link ) ? $link : __('edit this event');
522
+				$link_text = ! empty($link) ? $link : __('edit this event');
523 523
 				// generate nonce
524
-				$nonce = wp_create_nonce( 'edit_nonce' );
524
+				$nonce = wp_create_nonce('edit_nonce');
525 525
 				// generate url to event editor for this event
526
-				$url = add_query_arg( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event->ID(), 'edit_nonce' => $nonce ), admin_url() );
526
+				$url = add_query_arg(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event->ID(), 'edit_nonce' => $nonce), admin_url());
527 527
 				// get edit CPT text
528
-				$post_type_obj = get_post_type_object( 'espresso_events' );
528
+				$post_type_obj = get_post_type_object('espresso_events');
529 529
 				// build final link html
530
-				$link = '<a class="post-edit-link" href="' . $url . '" ';
531
-				$link .= ' title="' . esc_attr( $post_type_obj->labels->edit_item ) . '"';
530
+				$link = '<a class="post-edit-link" href="'.$url.'" ';
531
+				$link .= ' title="'.esc_attr($post_type_obj->labels->edit_item).'"';
532 532
 				$link .= \EED_Events_Archive::link_target();
533
-				$link .='>' . $link_text . '</a>';
533
+				$link .= '>'.$link_text.'</a>';
534 534
 				// put it all together
535
-				return $before . apply_filters( 'edit_post_link', $link, $event->ID() ) . $after;
535
+				return $before.apply_filters('edit_post_link', $link, $event->ID()).$after;
536 536
 			}
537 537
 		}
538 538
 		return '';
Please login to merge, or discard this patch.