@@ -165,7 +165,7 @@ |
||
165 | 165 | * |
166 | 166 | * @access protected |
167 | 167 | * @param $entity |
168 | - * @param mixed $identifier |
|
168 | + * @param string $identifier |
|
169 | 169 | * @return string |
170 | 170 | */ |
171 | 171 | protected function addEntityToCollection( $entity, $identifier ) { |
@@ -8,8 +8,8 @@ discard block |
||
8 | 8 | use EventEspresso\core\services\locators\LocatorInterface; |
9 | 9 | use EventEspresso\core\services\locators\FileLocator; |
10 | 10 | |
11 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
12 | - exit( 'No direct script access allowed' ); |
|
11 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
12 | + exit('No direct script access allowed'); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | LocatorInterface $file_locator = null |
81 | 81 | ) { |
82 | 82 | $this->collection_details = $collection_details; |
83 | - if ( ! $collection instanceof CollectionInterface ) { |
|
84 | - $collection = new Collection( $this->collection_details->getCollectionInterface() ); |
|
83 | + if ( ! $collection instanceof CollectionInterface) { |
|
84 | + $collection = new Collection($this->collection_details->getCollectionInterface()); |
|
85 | 85 | } |
86 | 86 | $this->collection = $collection; |
87 | 87 | $this->file_locator = $file_locator; |
@@ -108,12 +108,12 @@ discard block |
||
108 | 108 | * @throws \EventEspresso\Core\Exceptions\InvalidDataTypeException |
109 | 109 | */ |
110 | 110 | protected function loadAllFromFilepaths() { |
111 | - if ( ! $this->file_locator instanceof FileLocator ) { |
|
111 | + if ( ! $this->file_locator instanceof FileLocator) { |
|
112 | 112 | $this->file_locator = new FileLocator(); |
113 | 113 | } |
114 | - $this->file_locator->setFileMask( $this->collection_details->getFileMask() ); |
|
114 | + $this->file_locator->setFileMask($this->collection_details->getFileMask()); |
|
115 | 115 | // find all of the files that match the file mask in the specified folder |
116 | - $this->file_locator->locate( $this->collection_details->getCollectionPaths() ); |
|
116 | + $this->file_locator->locate($this->collection_details->getCollectionPaths()); |
|
117 | 117 | // filter the results |
118 | 118 | $filepaths = (array) apply_filters( |
119 | 119 | "FHEE__CollectionLoader__loadAllFromFilepath__filepaths", |
@@ -121,11 +121,11 @@ discard block |
||
121 | 121 | $this->collection_details->collectionName(), |
122 | 122 | $this->collection_details |
123 | 123 | ); |
124 | - if ( empty( $filepaths ) ) { |
|
124 | + if (empty($filepaths)) { |
|
125 | 125 | return; |
126 | 126 | } |
127 | - foreach ( $filepaths as $filepath ) { |
|
128 | - $this->loadClassFromFilepath( $filepath ); |
|
127 | + foreach ($filepaths as $filepath) { |
|
128 | + $this->loadClassFromFilepath($filepath); |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | |
@@ -141,22 +141,22 @@ discard block |
||
141 | 141 | * @throws \EventEspresso\Core\Exceptions\InvalidFilePathException |
142 | 142 | * @throws \EventEspresso\Core\Exceptions\InvalidClassException |
143 | 143 | */ |
144 | - protected function loadClassFromFilepath( $filepath ) { |
|
145 | - if ( ! is_string( $filepath ) ) { |
|
146 | - throw new InvalidDataTypeException( '$filepath', $filepath, 'string' ); |
|
144 | + protected function loadClassFromFilepath($filepath) { |
|
145 | + if ( ! is_string($filepath)) { |
|
146 | + throw new InvalidDataTypeException('$filepath', $filepath, 'string'); |
|
147 | 147 | } |
148 | - if ( ! is_readable( $filepath ) ) { |
|
149 | - throw new InvalidFilePathException( $filepath ); |
|
148 | + if ( ! is_readable($filepath)) { |
|
149 | + throw new InvalidFilePathException($filepath); |
|
150 | 150 | } |
151 | - require_once( $filepath ); |
|
151 | + require_once($filepath); |
|
152 | 152 | // extract filename from path |
153 | - $file_name = basename( $filepath ); |
|
153 | + $file_name = basename($filepath); |
|
154 | 154 | // now remove any file extensions |
155 | - $class_name = \EEH_File::get_classname_from_filepath_with_standard_filename( $file_name ); |
|
156 | - if ( ! class_exists( $class_name ) ) { |
|
157 | - throw new InvalidClassException( $class_name ); |
|
155 | + $class_name = \EEH_File::get_classname_from_filepath_with_standard_filename($file_name); |
|
156 | + if ( ! class_exists($class_name)) { |
|
157 | + throw new InvalidClassException($class_name); |
|
158 | 158 | } |
159 | - return $this->addEntityToCollection( new $class_name(), $file_name ); |
|
159 | + return $this->addEntityToCollection(new $class_name(), $file_name); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | |
@@ -170,15 +170,15 @@ discard block |
||
170 | 170 | * @return string |
171 | 171 | * @throws \EventEspresso\Core\Exceptions\InvalidEntityException |
172 | 172 | */ |
173 | - protected function addEntityToCollection( $entity, $identifier ) { |
|
173 | + protected function addEntityToCollection($entity, $identifier) { |
|
174 | 174 | do_action( |
175 | 175 | "FHEE__CollectionLoader__addEntityToCollection__entity", |
176 | 176 | $entity, |
177 | 177 | $this->collection_details->collectionName(), |
178 | 178 | $this->collection_details |
179 | 179 | ); |
180 | - $identifier = $this->setIdentifier( $entity, $identifier ); |
|
181 | - if ( $this->collection->has( $identifier ) ) { |
|
180 | + $identifier = $this->setIdentifier($entity, $identifier); |
|
181 | + if ($this->collection->has($identifier)) { |
|
182 | 182 | do_action( |
183 | 183 | "FHEE__CollectionLoader__addEntityToCollection__entity_already_added", |
184 | 184 | $this, |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | ); |
188 | 188 | return CollectionLoader::ENTITY_EXISTS; |
189 | 189 | } |
190 | - if( $this->collection->add( $entity, $identifier ) ) { |
|
190 | + if ($this->collection->add($entity, $identifier)) { |
|
191 | 191 | do_action( |
192 | 192 | "FHEE__CollectionLoader__addEntityToCollection__entity_added", |
193 | 193 | $this, |
@@ -217,12 +217,12 @@ discard block |
||
217 | 217 | * @return string |
218 | 218 | * @throws \EventEspresso\Core\Exceptions\InvalidEntityException |
219 | 219 | */ |
220 | - protected function setIdentifier( $entity, $identifier ) { |
|
221 | - if ( $this->collection_details->identifierType() === CollectionDetails::ID_OBJECT_HASH ) { |
|
222 | - $identifier = spl_object_hash( $entity ); |
|
223 | - } elseif ( $this->collection_details->identifierType() === CollectionDetails::ID_CALLBACK_METHOD ) { |
|
220 | + protected function setIdentifier($entity, $identifier) { |
|
221 | + if ($this->collection_details->identifierType() === CollectionDetails::ID_OBJECT_HASH) { |
|
222 | + $identifier = spl_object_hash($entity); |
|
223 | + } elseif ($this->collection_details->identifierType() === CollectionDetails::ID_CALLBACK_METHOD) { |
|
224 | 224 | $identifier_callback = $this->collection_details->identifierCallback(); |
225 | - if ( ! method_exists( $entity, $identifier_callback ) ) { |
|
225 | + if ( ! method_exists($entity, $identifier_callback)) { |
|
226 | 226 | throw new InvalidEntityException( |
227 | 227 | $entity, |
228 | 228 | $this->collection_details->getCollectionInterface(), |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | 'event_espresso' |
233 | 233 | ), |
234 | 234 | $identifier_callback, |
235 | - get_class( $entity ) |
|
235 | + get_class($entity) |
|
236 | 236 | ) |
237 | 237 | ); |
238 | 238 | } |
@@ -263,8 +263,8 @@ discard block |
||
263 | 263 | $this->collection_details->collectionName(), |
264 | 264 | $this->collection_details |
265 | 265 | ); |
266 | - foreach ( $FQCNs as $FQCN ) { |
|
267 | - $this->loadClassFromFQCN( $FQCN ); |
|
266 | + foreach ($FQCNs as $FQCN) { |
|
267 | + $this->loadClassFromFQCN($FQCN); |
|
268 | 268 | } |
269 | 269 | } |
270 | 270 | |
@@ -279,14 +279,14 @@ discard block |
||
279 | 279 | * @throws \EventEspresso\Core\Exceptions\InvalidDataTypeException |
280 | 280 | * @throws \EventEspresso\Core\Exceptions\InvalidClassException |
281 | 281 | */ |
282 | - protected function loadClassFromFQCN( $FQCN ) { |
|
283 | - if ( ! is_string( $FQCN ) ) { |
|
284 | - throw new InvalidDataTypeException( '$FQCN', $FQCN, 'string' ); |
|
282 | + protected function loadClassFromFQCN($FQCN) { |
|
283 | + if ( ! is_string($FQCN)) { |
|
284 | + throw new InvalidDataTypeException('$FQCN', $FQCN, 'string'); |
|
285 | 285 | } |
286 | - if ( ! class_exists( $FQCN ) ) { |
|
287 | - throw new InvalidClassException( $FQCN ); |
|
286 | + if ( ! class_exists($FQCN)) { |
|
287 | + throw new InvalidClassException($FQCN); |
|
288 | 288 | } |
289 | - return $this->addEntityToCollection( new $FQCN(), $FQCN ); |
|
289 | + return $this->addEntityToCollection(new $FQCN(), $FQCN); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | |
17 | 17 | |
18 | -if ( ! function_exists( 'espresso_get_template_part' )) { |
|
18 | +if ( ! function_exists('espresso_get_template_part')) { |
|
19 | 19 | /** |
20 | 20 | * espresso_get_template_part |
21 | 21 | * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | * @param string $name The name of the specialised template. |
26 | 26 | * @return string the html output for the formatted money value |
27 | 27 | */ |
28 | - function espresso_get_template_part( $slug = NULL, $name = NULL ) { |
|
29 | - EEH_Template::get_template_part( $slug, $name ); |
|
28 | + function espresso_get_template_part($slug = NULL, $name = NULL) { |
|
29 | + EEH_Template::get_template_part($slug, $name); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | -if ( ! function_exists( 'espresso_get_object_css_class' )) { |
|
35 | +if ( ! function_exists('espresso_get_object_css_class')) { |
|
36 | 36 | /** |
37 | 37 | * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed |
38 | 38 | * |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @param string $suffix added to the end of the generated class |
43 | 43 | * @return string |
44 | 44 | */ |
45 | - function espresso_get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
46 | - return EEH_Template::get_object_css_class( $object, $prefix, $suffix ); |
|
45 | + function espresso_get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
46 | + return EEH_Template::get_object_css_class($object, $prefix, $suffix); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @return boolean |
71 | 71 | */ |
72 | 72 | public static function is_espresso_theme() { |
73 | - return wp_get_theme()->get( 'TextDomain' ) == 'event_espresso' ? TRUE : FALSE; |
|
73 | + return wp_get_theme()->get('TextDomain') == 'event_espresso' ? TRUE : FALSE; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | * @return void |
80 | 80 | */ |
81 | 81 | public static function load_espresso_theme_functions() { |
82 | - if ( ! defined( 'EE_THEME_FUNCTIONS_LOADED' )) { |
|
83 | - if ( is_readable( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' )) { |
|
84 | - require_once( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' ); |
|
82 | + if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) { |
|
83 | + if (is_readable(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php')) { |
|
84 | + require_once(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php'); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | } |
@@ -93,17 +93,17 @@ discard block |
||
93 | 93 | * @return array |
94 | 94 | */ |
95 | 95 | public static function get_espresso_themes() { |
96 | - if ( empty( EEH_Template::$_espresso_themes )) { |
|
97 | - $espresso_themes = glob( EE_PUBLIC . '*', GLOB_ONLYDIR ); |
|
98 | - if ( empty( $espresso_themes ) ) { |
|
96 | + if (empty(EEH_Template::$_espresso_themes)) { |
|
97 | + $espresso_themes = glob(EE_PUBLIC.'*', GLOB_ONLYDIR); |
|
98 | + if (empty($espresso_themes)) { |
|
99 | 99 | return array(); |
100 | 100 | } |
101 | - if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) { |
|
102 | - unset( $espresso_themes[ $key ] ); |
|
101 | + if (($key = array_search('global_assets', $espresso_themes)) !== FALSE) { |
|
102 | + unset($espresso_themes[$key]); |
|
103 | 103 | } |
104 | 104 | EEH_Template::$_espresso_themes = array(); |
105 | - foreach ( $espresso_themes as $espresso_theme ) { |
|
106 | - EEH_Template::$_espresso_themes[ basename( $espresso_theme ) ] = $espresso_theme; |
|
105 | + foreach ($espresso_themes as $espresso_theme) { |
|
106 | + EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme; |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | return EEH_Template::$_espresso_themes; |
@@ -122,16 +122,16 @@ discard block |
||
122 | 122 | * @param bool $return_string |
123 | 123 | * @return string the html output for the formatted money value |
124 | 124 | */ |
125 | - public static function get_template_part( $slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE ) { |
|
126 | - do_action( "get_template_part_{$slug}-{$name}", $slug, $name ); |
|
125 | + public static function get_template_part($slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE) { |
|
126 | + do_action("get_template_part_{$slug}-{$name}", $slug, $name); |
|
127 | 127 | $templates = array(); |
128 | 128 | $name = (string) $name; |
129 | - if ( $name != '' ) { |
|
129 | + if ($name != '') { |
|
130 | 130 | $templates[] = "{$slug}-{$name}.php"; |
131 | 131 | } |
132 | 132 | // allow template parts to be turned off via something like: add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' ); |
133 | - if ( apply_filters( "FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE )) { |
|
134 | - EEH_Template::locate_template( $templates, $template_args, TRUE, $return_string ); |
|
133 | + if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE)) { |
|
134 | + EEH_Template::locate_template($templates, $template_args, TRUE, $return_string); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
@@ -182,26 +182,26 @@ discard block |
||
182 | 182 | * Used in places where you don't actually load the template, you just want to know if there's a custom version of it. |
183 | 183 | * @return mixed |
184 | 184 | */ |
185 | - public static function locate_template( $templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE ) { |
|
185 | + public static function locate_template($templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE) { |
|
186 | 186 | // first use WP locate_template to check for template in the current theme folder |
187 | - $template_path = locate_template( $templates ); |
|
187 | + $template_path = locate_template($templates); |
|
188 | 188 | |
189 | - if ( $check_if_custom && !empty( $template_path ) ) |
|
189 | + if ($check_if_custom && ! empty($template_path)) |
|
190 | 190 | return TRUE; |
191 | 191 | |
192 | 192 | // not in the theme |
193 | - if ( empty( $template_path )) { |
|
193 | + if (empty($template_path)) { |
|
194 | 194 | // not even a template to look for ? |
195 | - if ( empty( $templates )) { |
|
195 | + if (empty($templates)) { |
|
196 | 196 | // get post_type |
197 | - $post_type = EE_Registry::instance()->REQ->get( 'post_type' ); |
|
197 | + $post_type = EE_Registry::instance()->REQ->get('post_type'); |
|
198 | 198 | // get array of EE Custom Post Types |
199 | 199 | $EE_CPTs = EE_Register_CPTs::get_CPTs(); |
200 | 200 | // build template name based on request |
201 | - if ( isset( $EE_CPTs[ $post_type ] )) { |
|
202 | - $archive_or_single = is_archive() ? 'archive' : ''; |
|
203 | - $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
204 | - $templates = $archive_or_single . '-' . $post_type . '.php'; |
|
201 | + if (isset($EE_CPTs[$post_type])) { |
|
202 | + $archive_or_single = is_archive() ? 'archive' : ''; |
|
203 | + $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
204 | + $templates = $archive_or_single.'-'.$post_type.'.php'; |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | // currently active EE template theme |
@@ -210,81 +210,81 @@ discard block |
||
210 | 210 | // array of paths to folders that may contain templates |
211 | 211 | $template_folder_paths = array( |
212 | 212 | // first check the /wp-content/uploads/espresso/templates/(current EE theme)/ folder for an EE theme template file |
213 | - EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme, |
|
213 | + EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme, |
|
214 | 214 | // then in the root of the /wp-content/uploads/espresso/templates/ folder |
215 | 215 | EVENT_ESPRESSO_TEMPLATE_DIR |
216 | 216 | ); |
217 | 217 | |
218 | 218 | //add core plugin folders for checking only if we're not $check_if_custom |
219 | - if ( ! $check_if_custom ) { |
|
219 | + if ( ! $check_if_custom) { |
|
220 | 220 | $core_paths = array( |
221 | 221 | // in the /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin |
222 | - EE_PUBLIC . $current_theme, |
|
222 | + EE_PUBLIC.$current_theme, |
|
223 | 223 | // in the /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin |
224 | - EE_TEMPLATES . $current_theme, |
|
224 | + EE_TEMPLATES.$current_theme, |
|
225 | 225 | // or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/ |
226 | 226 | EE_PLUGIN_DIR_PATH |
227 | 227 | ); |
228 | - $template_folder_paths = array_merge( $template_folder_paths, $core_paths ); |
|
228 | + $template_folder_paths = array_merge($template_folder_paths, $core_paths); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | // now filter that array |
232 | - $template_folder_paths = apply_filters( 'FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths ); |
|
233 | - $templates = is_array( $templates ) ? $templates : array( $templates ); |
|
234 | - $template_folder_paths = is_array( $template_folder_paths ) ? $template_folder_paths : array( $template_folder_paths ); |
|
232 | + $template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths); |
|
233 | + $templates = is_array($templates) ? $templates : array($templates); |
|
234 | + $template_folder_paths = is_array($template_folder_paths) ? $template_folder_paths : array($template_folder_paths); |
|
235 | 235 | // array to hold all possible template paths |
236 | 236 | $full_template_paths = array(); |
237 | 237 | |
238 | 238 | // loop through $templates |
239 | - foreach ( $templates as $template ) { |
|
239 | + foreach ($templates as $template) { |
|
240 | 240 | // normalize directory separators |
241 | - $template = EEH_File::standardise_directory_separators( $template ); |
|
242 | - $file_name = basename( $template ); |
|
243 | - $template_path_minus_file_name = substr( $template, 0, ( strlen( $file_name ) * -1 ) ); |
|
241 | + $template = EEH_File::standardise_directory_separators($template); |
|
242 | + $file_name = basename($template); |
|
243 | + $template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1)); |
|
244 | 244 | // while looping through all template folder paths |
245 | - foreach ( $template_folder_paths as $template_folder_path ) { |
|
245 | + foreach ($template_folder_paths as $template_folder_path) { |
|
246 | 246 | // normalize directory separators |
247 | - $template_folder_path = EEH_File::standardise_directory_separators( $template_folder_path ); |
|
247 | + $template_folder_path = EEH_File::standardise_directory_separators($template_folder_path); |
|
248 | 248 | // determine if any common base path exists between the two paths |
249 | 249 | $common_base_path = EEH_Template::_find_common_base_path( |
250 | - array( $template_folder_path, $template_path_minus_file_name ) |
|
250 | + array($template_folder_path, $template_path_minus_file_name) |
|
251 | 251 | ); |
252 | - if ( $common_base_path !== '' ) { |
|
252 | + if ($common_base_path !== '') { |
|
253 | 253 | // both paths have a common base, so just tack the filename onto our search path |
254 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $file_name; |
|
254 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$file_name; |
|
255 | 255 | } else { |
256 | 256 | // no common base path, so let's just concatenate |
257 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $template; |
|
257 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$template; |
|
258 | 258 | } |
259 | 259 | // build up our template locations array by adding our resolved paths |
260 | 260 | $full_template_paths[] = $resolved_path; |
261 | 261 | } |
262 | 262 | // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first |
263 | - array_unshift( $full_template_paths, $template ); |
|
263 | + array_unshift($full_template_paths, $template); |
|
264 | 264 | // path to the directory of the current theme: /wp-content/themes/(current WP theme)/ |
265 | - array_unshift( $full_template_paths, get_stylesheet_directory() . DS . $file_name ); |
|
265 | + array_unshift($full_template_paths, get_stylesheet_directory().DS.$file_name); |
|
266 | 266 | } |
267 | 267 | // filter final array of full template paths |
268 | - $full_template_paths = apply_filters( 'FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name ); |
|
268 | + $full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name); |
|
269 | 269 | // now loop through our final array of template location paths and check each location |
270 | - foreach ( (array)$full_template_paths as $full_template_path ) { |
|
271 | - if ( is_readable( $full_template_path )) { |
|
272 | - $template_path = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $full_template_path ); |
|
270 | + foreach ((array) $full_template_paths as $full_template_path) { |
|
271 | + if (is_readable($full_template_path)) { |
|
272 | + $template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path); |
|
273 | 273 | // hook that can be used to display the full template path that will be used |
274 | - do_action( 'AHEE__EEH_Template__locate_template__full_template_path', $template_path ); |
|
274 | + do_action('AHEE__EEH_Template__locate_template__full_template_path', $template_path); |
|
275 | 275 | break; |
276 | 276 | } |
277 | 277 | } |
278 | 278 | } |
279 | 279 | // if we got it and you want to see it... |
280 | - if ( $template_path && $load && ! $check_if_custom ) { |
|
281 | - if ( $return_string ) { |
|
282 | - return EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
280 | + if ($template_path && $load && ! $check_if_custom) { |
|
281 | + if ($return_string) { |
|
282 | + return EEH_Template::display_template($template_path, $template_args, TRUE); |
|
283 | 283 | } else { |
284 | - EEH_Template::display_template( $template_path, $template_args, FALSE ); |
|
284 | + EEH_Template::display_template($template_path, $template_args, FALSE); |
|
285 | 285 | } |
286 | 286 | } |
287 | - return $check_if_custom && ! empty( $template_path ) ? TRUE : $template_path; |
|
287 | + return $check_if_custom && ! empty($template_path) ? TRUE : $template_path; |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | |
@@ -297,21 +297,21 @@ discard block |
||
297 | 297 | * @param array $paths |
298 | 298 | * @return string |
299 | 299 | */ |
300 | - protected static function _find_common_base_path( $paths ) { |
|
300 | + protected static function _find_common_base_path($paths) { |
|
301 | 301 | $last_offset = 0; |
302 | 302 | $common_base_path = ''; |
303 | - while ( ( $index = strpos( $paths[ 0 ], DS, $last_offset ) ) !== false ) { |
|
303 | + while (($index = strpos($paths[0], DS, $last_offset)) !== false) { |
|
304 | 304 | $dir_length = $index - $last_offset + 1; |
305 | - $directory = substr( $paths[ 0 ], $last_offset, $dir_length ); |
|
306 | - foreach ( $paths as $path ) { |
|
307 | - if ( substr( $path, $last_offset, $dir_length ) != $directory ) { |
|
305 | + $directory = substr($paths[0], $last_offset, $dir_length); |
|
306 | + foreach ($paths as $path) { |
|
307 | + if (substr($path, $last_offset, $dir_length) != $directory) { |
|
308 | 308 | return $common_base_path; |
309 | 309 | } |
310 | 310 | } |
311 | 311 | $common_base_path .= $directory; |
312 | 312 | $last_offset = $index + 1; |
313 | 313 | } |
314 | - return substr( $common_base_path, 0, -1 ); |
|
314 | + return substr($common_base_path, 0, -1); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * @param boolean $return_string whether to send output immediately to screen, or capture and return as a string |
324 | 324 | * @return mixed string |
325 | 325 | */ |
326 | - public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) { |
|
326 | + public static function display_template($template_path = FALSE, $template_args = array(), $return_string = FALSE) { |
|
327 | 327 | |
328 | 328 | /** |
329 | 329 | * These two filters are intended for last minute changes to templates being loaded and/or template arg |
@@ -334,26 +334,26 @@ discard block |
||
334 | 334 | * |
335 | 335 | * @since 4.6.0 |
336 | 336 | */ |
337 | - $template_path = apply_filters( 'FHEE__EEH_Template__display_template__template_path', $template_path ); |
|
338 | - $template_args = apply_filters( 'FHEE__EEH_Template__display_template__template_args', $template_args ); |
|
337 | + $template_path = apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path); |
|
338 | + $template_args = apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args); |
|
339 | 339 | |
340 | 340 | // you gimme nuttin - YOU GET NUTTIN !! |
341 | - if ( ! $template_path || ! is_readable( $template_path )) { |
|
341 | + if ( ! $template_path || ! is_readable($template_path)) { |
|
342 | 342 | return ''; |
343 | 343 | } |
344 | 344 | // if $template_args are not in an array, then make it so |
345 | - if ( ! is_array( $template_args ) && ! is_object( $template_args )) { |
|
346 | - $template_args = array( $template_args ); |
|
345 | + if ( ! is_array($template_args) && ! is_object($template_args)) { |
|
346 | + $template_args = array($template_args); |
|
347 | 347 | } |
348 | - extract( (array) $template_args); |
|
348 | + extract((array) $template_args); |
|
349 | 349 | |
350 | - if ( $return_string ) { |
|
350 | + if ($return_string) { |
|
351 | 351 | // because we want to return a string, we are going to capture the output |
352 | 352 | ob_start(); |
353 | - include( $template_path ); |
|
353 | + include($template_path); |
|
354 | 354 | return ob_get_clean(); |
355 | 355 | } else { |
356 | - include( $template_path ); |
|
356 | + include($template_path); |
|
357 | 357 | } |
358 | 358 | return ''; |
359 | 359 | } |
@@ -371,27 +371,27 @@ discard block |
||
371 | 371 | * @param string $suffix added to the end of the generated class |
372 | 372 | * @return string |
373 | 373 | */ |
374 | - public static function get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
374 | + public static function get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
375 | 375 | // in the beginning... |
376 | - $prefix = ! empty( $prefix ) ? rtrim( $prefix, '-' ) . '-' : ''; |
|
376 | + $prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : ''; |
|
377 | 377 | // da muddle |
378 | 378 | $class = ''; |
379 | 379 | // the end |
380 | - $suffix = ! empty( $suffix ) ? '-' . ltrim( $suffix, '-' ) : ''; |
|
380 | + $suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : ''; |
|
381 | 381 | // is the passed object an EE object ? |
382 | - if ( $object instanceof EE_Base_Class ) { |
|
382 | + if ($object instanceof EE_Base_Class) { |
|
383 | 383 | // grab the exact type of object |
384 | - $obj_class = get_class( $object ); |
|
384 | + $obj_class = get_class($object); |
|
385 | 385 | // depending on the type of object... |
386 | - switch ( $obj_class ) { |
|
386 | + switch ($obj_class) { |
|
387 | 387 | // no specifics just yet... |
388 | 388 | default : |
389 | - $class = strtolower( str_replace( '_', '-', $obj_class )); |
|
390 | - $class .= method_exists( $obj_class, 'name' ) ? '-' . sanitize_title( $object->name() ) : ''; |
|
389 | + $class = strtolower(str_replace('_', '-', $obj_class)); |
|
390 | + $class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : ''; |
|
391 | 391 | |
392 | 392 | } |
393 | 393 | } |
394 | - return $prefix . $class . $suffix; |
|
394 | + return $prefix.$class.$suffix; |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | |
@@ -407,50 +407,50 @@ discard block |
||
407 | 407 | * @param string $cur_code_span_class |
408 | 408 | * @return string the html output for the formatted money value |
409 | 409 | */ |
410 | - public static function format_currency( $amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code' ) { |
|
410 | + public static function format_currency($amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code') { |
|
411 | 411 | // ensure amount was received |
412 | - if ( is_null( $amount ) ) { |
|
413 | - $msg = __( 'In order to format currency, an amount needs to be passed.', 'event_espresso' ); |
|
414 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
412 | + if (is_null($amount)) { |
|
413 | + $msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso'); |
|
414 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
415 | 415 | return ''; |
416 | 416 | } |
417 | 417 | //ensure amount is float |
418 | 418 | $amount = (float) $amount; |
419 | 419 | // filter raw amount (allows 0.00 to be changed to "free" for example) |
420 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount', $amount, $return_raw ); |
|
420 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw); |
|
421 | 421 | // still a number or was amount converted to a string like "free" ? |
422 | - if ( is_float( $amount_formatted )) { |
|
422 | + if (is_float($amount_formatted)) { |
|
423 | 423 | // was a country ISO code passed ? if so generate currency config object for that country |
424 | - $mny = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : NULL; |
|
424 | + $mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : NULL; |
|
425 | 425 | // verify results |
426 | - if ( ! $mny instanceof EE_Currency_Config ) { |
|
426 | + if ( ! $mny instanceof EE_Currency_Config) { |
|
427 | 427 | // set default config country currency settings |
428 | 428 | $mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config(); |
429 | 429 | } |
430 | 430 | // format float |
431 | - $amount_formatted = number_format( $amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds ); |
|
431 | + $amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds); |
|
432 | 432 | // add formatting ? |
433 | - if ( ! $return_raw ) { |
|
433 | + if ( ! $return_raw) { |
|
434 | 434 | // add currency sign |
435 | - if( $mny->sign_b4 ){ |
|
436 | - if( $amount >= 0 ){ |
|
437 | - $amount_formatted = $mny->sign . $amount_formatted; |
|
438 | - }else{ |
|
439 | - $amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted ); |
|
435 | + if ($mny->sign_b4) { |
|
436 | + if ($amount >= 0) { |
|
437 | + $amount_formatted = $mny->sign.$amount_formatted; |
|
438 | + } else { |
|
439 | + $amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted); |
|
440 | 440 | } |
441 | 441 | |
442 | - }else{ |
|
443 | - $amount_formatted = $amount_formatted . $mny->sign; |
|
442 | + } else { |
|
443 | + $amount_formatted = $amount_formatted.$mny->sign; |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | // add currency code ? |
447 | - $amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted; |
|
447 | + $amount_formatted = $display_code ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>' : $amount_formatted; |
|
448 | 448 | } |
449 | 449 | // filter results |
450 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw ); |
|
450 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw); |
|
451 | 451 | } |
452 | 452 | // clean up vars |
453 | - unset( $mny ); |
|
453 | + unset($mny); |
|
454 | 454 | // return formatted currency amount |
455 | 455 | return $amount_formatted; |
456 | 456 | } |
@@ -465,11 +465,11 @@ discard block |
||
465 | 465 | * @param string $schema 'UPPER', 'lower', or 'Sentence' |
466 | 466 | * @return string The localized label for the status id. |
467 | 467 | */ |
468 | - public static function pretty_status( $status_id, $plural = FALSE, $schema = 'upper' ) { |
|
468 | + public static function pretty_status($status_id, $plural = FALSE, $schema = 'upper') { |
|
469 | 469 | /** @type EEM_Status $EEM_Status */ |
470 | - $EEM_Status = EE_Registry::instance()->load_model( 'Status' ); |
|
471 | - $status = $EEM_Status->localized_status( array( $status_id => __( 'unknown', 'event_espresso' )), $plural, $schema ); |
|
472 | - return $status[ $status_id ]; |
|
470 | + $EEM_Status = EE_Registry::instance()->load_model('Status'); |
|
471 | + $status = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural, $schema); |
|
472 | + return $status[$status_id]; |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | |
@@ -484,9 +484,9 @@ discard block |
||
484 | 484 | * @param string $title |
485 | 485 | * @return string the html output for the button |
486 | 486 | */ |
487 | - public static function get_button_or_link( $url, $label, $class = 'button-primary', $icon = '', $title = '' ) { |
|
488 | - $label = ! empty( $icon ) ? '<span class="' . $icon . '"></span>' . $label : $label; |
|
489 | - $button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '" title="' . $title . '">' . $label . '</a>'; |
|
487 | + public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '', $title = '') { |
|
488 | + $label = ! empty($icon) ? '<span class="'.$icon.'"></span>'.$label : $label; |
|
489 | + $button = '<a id="'.sanitize_title_with_dashes($label).'" href="'.$url.'" class="'.$class.'" title="'.$title.'">'.$label.'</a>'; |
|
490 | 490 | return $button; |
491 | 491 | } |
492 | 492 | |
@@ -503,21 +503,21 @@ discard block |
||
503 | 503 | * @param bool|string $help_text (optional) send help text you want to use for the link if default not to be used |
504 | 504 | * @return string generated link |
505 | 505 | */ |
506 | - public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) { |
|
506 | + public static function get_help_tab_link($help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE) { |
|
507 | 507 | |
508 | - if ( ! $page ) |
|
509 | - $page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page; |
|
508 | + if ( ! $page) |
|
509 | + $page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page; |
|
510 | 510 | |
511 | - if ( ! $action ) |
|
512 | - $action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action; |
|
511 | + if ( ! $action) |
|
512 | + $action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action; |
|
513 | 513 | |
514 | 514 | $action = empty($action) ? 'default' : $action; |
515 | 515 | |
516 | 516 | |
517 | - $help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id; |
|
518 | - $icon = !$icon_style ? ' dashicons-editor-help' : $icon_style; |
|
519 | - $help_text = !$help_text ? '' : $help_text; |
|
520 | - return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso') . '" > ' . $help_text . ' </a>'; |
|
517 | + $help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id; |
|
518 | + $icon = ! $icon_style ? ' dashicons-editor-help' : $icon_style; |
|
519 | + $help_text = ! $help_text ? '' : $help_text; |
|
520 | + return '<a id="'.$help_tab_lnk.'" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'.$icon.'" title="'.esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso').'" > '.$help_text.' </a>'; |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | |
@@ -529,31 +529,31 @@ discard block |
||
529 | 529 | * @param EE_Help_Tour |
530 | 530 | * @return string html |
531 | 531 | */ |
532 | - public static function help_tour_stops_generator( EE_Help_Tour $tour ) { |
|
532 | + public static function help_tour_stops_generator(EE_Help_Tour $tour) { |
|
533 | 533 | $id = $tour->get_slug(); |
534 | 534 | $stops = $tour->get_stops(); |
535 | 535 | |
536 | - $content = '<ol style="display:none" id="' . $id . '">'; |
|
536 | + $content = '<ol style="display:none" id="'.$id.'">'; |
|
537 | 537 | |
538 | - foreach ( $stops as $stop ) { |
|
539 | - $data_id = !empty( $stop['id'] ) ? ' data-id="' . $stop['id'] . '"' : ''; |
|
540 | - $data_class = empty( $data_id ) && !empty( $stop['class'] ) ? ' data-class="' . $stop['class'] . '"' : ''; |
|
538 | + foreach ($stops as $stop) { |
|
539 | + $data_id = ! empty($stop['id']) ? ' data-id="'.$stop['id'].'"' : ''; |
|
540 | + $data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="'.$stop['class'].'"' : ''; |
|
541 | 541 | |
542 | 542 | //if container is set to modal then let's make sure we set the options accordingly |
543 | - if ( empty( $data_id ) && empty( $data_class ) ) { |
|
543 | + if (empty($data_id) && empty($data_class)) { |
|
544 | 544 | $stop['options']['modal'] = true; |
545 | 545 | $stop['options']['expose'] = true; |
546 | 546 | } |
547 | 547 | |
548 | - $custom_class = !empty( $stop['custom_class'] ) ? ' class="' . $stop['custom_class'] . '"' : ''; |
|
549 | - $button_text = !empty( $stop['button_text'] ) ? ' data-button="' . $stop['button_text'] . '"' : ''; |
|
548 | + $custom_class = ! empty($stop['custom_class']) ? ' class="'.$stop['custom_class'].'"' : ''; |
|
549 | + $button_text = ! empty($stop['button_text']) ? ' data-button="'.$stop['button_text'].'"' : ''; |
|
550 | 550 | $inner_content = isset($stop['content']) ? $stop['content'] : ''; |
551 | 551 | |
552 | 552 | //options |
553 | - if ( isset( $stop['options'] ) && is_array( $stop['options'] ) ) { |
|
553 | + if (isset($stop['options']) && is_array($stop['options'])) { |
|
554 | 554 | $options = ' data-options="'; |
555 | - foreach ( $stop['options'] as $option => $value ) { |
|
556 | - $options .= $option . ':' . $value . ';'; |
|
555 | + foreach ($stop['options'] as $option => $value) { |
|
556 | + $options .= $option.':'.$value.';'; |
|
557 | 557 | } |
558 | 558 | $options .= '"'; |
559 | 559 | } else { |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | } |
562 | 562 | |
563 | 563 | //let's put all together |
564 | - $content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>'; |
|
564 | + $content .= '<li'.$data_id.$data_class.$custom_class.$button_text.$options.'>'.$inner_content.'</li>'; |
|
565 | 565 | } |
566 | 566 | |
567 | 567 | $content .= '</ol>'; |
@@ -582,31 +582,31 @@ discard block |
||
582 | 582 | * @throws EE_Error |
583 | 583 | * @return string html structure for status. |
584 | 584 | */ |
585 | - public static function status_legend( $status_array, $active_status = '' ) { |
|
586 | - if ( !is_array( $status_array ) ) |
|
587 | - throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') ); |
|
585 | + public static function status_legend($status_array, $active_status = '') { |
|
586 | + if ( ! is_array($status_array)) |
|
587 | + throw new EE_Error(__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso')); |
|
588 | 588 | |
589 | 589 | $setup_array = array(); |
590 | - foreach ( $status_array as $item => $status ) { |
|
590 | + foreach ($status_array as $item => $status) { |
|
591 | 591 | $setup_array[$item] = array( |
592 | - 'class' => 'ee-status-legend ee-status-legend-' . $status, |
|
593 | - 'desc' => EEH_Template::pretty_status( $status, FALSE, 'sentence' ), |
|
592 | + 'class' => 'ee-status-legend ee-status-legend-'.$status, |
|
593 | + 'desc' => EEH_Template::pretty_status($status, FALSE, 'sentence'), |
|
594 | 594 | 'status' => $status |
595 | 595 | ); |
596 | 596 | } |
597 | 597 | |
598 | - $content = '<div class="ee-list-table-legend-container">' . "\n"; |
|
599 | - $content .= '<h3>' . __('Status Legend', 'event_espresso') . '</h3>' . "\n"; |
|
600 | - $content .= '<dl class="ee-list-table-legend">' . "\n\t"; |
|
601 | - foreach ( $setup_array as $item => $details ) { |
|
598 | + $content = '<div class="ee-list-table-legend-container">'."\n"; |
|
599 | + $content .= '<h3>'.__('Status Legend', 'event_espresso').'</h3>'."\n"; |
|
600 | + $content .= '<dl class="ee-list-table-legend">'."\n\t"; |
|
601 | + foreach ($setup_array as $item => $details) { |
|
602 | 602 | $active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : ''; |
603 | - $content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t"; |
|
604 | - $content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t"; |
|
605 | - $content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t"; |
|
606 | - $content .= '</dt>' . "\n"; |
|
603 | + $content .= '<dt id="ee-legend-item-tooltip-'.$item.'"'.$active_class.'>'."\n\t\t"; |
|
604 | + $content .= '<span class="'.$details['class'].'"></span>'."\n\t\t"; |
|
605 | + $content .= '<span class="ee-legend-description">'.$details['desc'].'</span>'."\n\t"; |
|
606 | + $content .= '</dt>'."\n"; |
|
607 | 607 | } |
608 | - $content .= '</dl>' . "\n"; |
|
609 | - $content .= '</div>' . "\n"; |
|
608 | + $content .= '</dl>'."\n"; |
|
609 | + $content .= '</div>'."\n"; |
|
610 | 610 | return $content; |
611 | 611 | } |
612 | 612 | |
@@ -619,8 +619,8 @@ discard block |
||
619 | 619 | * @return string |
620 | 620 | */ |
621 | 621 | public static function layout_array_as_table($data) { |
622 | - if (is_object($data) || $data instanceof __PHP_Incomplete_Class ) { |
|
623 | - $data = (array)$data; |
|
622 | + if (is_object($data) || $data instanceof __PHP_Incomplete_Class) { |
|
623 | + $data = (array) $data; |
|
624 | 624 | } |
625 | 625 | ob_start(); |
626 | 626 | if (is_array($data)) { |
@@ -633,10 +633,10 @@ discard block |
||
633 | 633 | ?> |
634 | 634 | <tr> |
635 | 635 | <td> |
636 | - <?php echo $data_key;?> |
|
636 | + <?php echo $data_key; ?> |
|
637 | 637 | </td> |
638 | 638 | <td> |
639 | - <?php echo self::layout_array_as_table($data_values);?> |
|
639 | + <?php echo self::layout_array_as_table($data_values); ?> |
|
640 | 640 | </td> |
641 | 641 | </tr> |
642 | 642 | <?php |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | <ul> |
651 | 651 | <?php |
652 | 652 | foreach ($data as $datum) { |
653 | - echo "<li>"; echo self::layout_array_as_table($datum);echo "</li>"; |
|
653 | + echo "<li>"; echo self::layout_array_as_table($datum); echo "</li>"; |
|
654 | 654 | }?> |
655 | 655 | </ul> |
656 | 656 | <?php |
@@ -680,8 +680,8 @@ discard block |
||
680 | 680 | * |
681 | 681 | * @return string |
682 | 682 | */ |
683 | - public static function paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
684 | - echo self::get_paging_html( $total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label ); |
|
683 | + public static function paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
684 | + echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label); |
|
685 | 685 | } |
686 | 686 | |
687 | 687 | |
@@ -705,13 +705,13 @@ discard block |
||
705 | 705 | * ) |
706 | 706 | * @return string |
707 | 707 | */ |
708 | - public static function get_paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
708 | + public static function get_paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
709 | 709 | $page_links = array(); |
710 | 710 | $disable_first = $disable_last = ''; |
711 | 711 | $total_items = (int) $total_items; |
712 | 712 | $per_page = (int) $per_page; |
713 | 713 | $current = (int) $current; |
714 | - $paged_arg_name = empty( $paged_arg_name ) ? 'paged' : sanitize_key( $paged_arg_name ); |
|
714 | + $paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name); |
|
715 | 715 | |
716 | 716 | //filter items_label |
717 | 717 | $items_label = apply_filters( |
@@ -719,68 +719,68 @@ discard block |
||
719 | 719 | $items_label |
720 | 720 | ); |
721 | 721 | |
722 | - if ( empty( $items_label ) |
|
723 | - || ! is_array( $items_label ) |
|
724 | - || ! isset( $items_label['single'] ) |
|
725 | - || ! isset( $items_label['plural'] ) ) { |
|
722 | + if (empty($items_label) |
|
723 | + || ! is_array($items_label) |
|
724 | + || ! isset($items_label['single']) |
|
725 | + || ! isset($items_label['plural'])) { |
|
726 | 726 | $items_label = array( |
727 | - 'single' => __( '1 item', 'event_espresso' ), |
|
728 | - 'plural' => __( '%s items', 'event_espresso' ) |
|
727 | + 'single' => __('1 item', 'event_espresso'), |
|
728 | + 'plural' => __('%s items', 'event_espresso') |
|
729 | 729 | ); |
730 | 730 | } else { |
731 | 731 | $items_label = array( |
732 | - 'single' => '1 ' . esc_html( $items_label['single'] ), |
|
733 | - 'plural' => '%s ' . esc_html( $items_label['plural'] ) |
|
732 | + 'single' => '1 '.esc_html($items_label['single']), |
|
733 | + 'plural' => '%s '.esc_html($items_label['plural']) |
|
734 | 734 | ); |
735 | 735 | } |
736 | 736 | |
737 | - $total_pages = ceil( $total_items / $per_page ); |
|
737 | + $total_pages = ceil($total_items / $per_page); |
|
738 | 738 | |
739 | - if ( $total_pages <= 1 ) |
|
739 | + if ($total_pages <= 1) |
|
740 | 740 | return ''; |
741 | 741 | |
742 | - $item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single']; |
|
742 | + $item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single']; |
|
743 | 743 | |
744 | - $output = '<span class="displaying-num">' . $item_label . '</span>'; |
|
744 | + $output = '<span class="displaying-num">'.$item_label.'</span>'; |
|
745 | 745 | |
746 | - if ( $current === 1 ) { |
|
746 | + if ($current === 1) { |
|
747 | 747 | $disable_first = ' disabled'; |
748 | 748 | } |
749 | - if ( $current == $total_pages ) { |
|
749 | + if ($current == $total_pages) { |
|
750 | 750 | $disable_last = ' disabled'; |
751 | 751 | } |
752 | 752 | |
753 | - $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", |
|
754 | - 'first-page' . $disable_first, |
|
755 | - esc_attr__( 'Go to the first page' ), |
|
756 | - esc_url( remove_query_arg( $paged_arg_name, $url ) ), |
|
753 | + $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>", |
|
754 | + 'first-page'.$disable_first, |
|
755 | + esc_attr__('Go to the first page'), |
|
756 | + esc_url(remove_query_arg($paged_arg_name, $url)), |
|
757 | 757 | '«' |
758 | 758 | ); |
759 | 759 | |
760 | 760 | $page_links[] = sprintf( |
761 | 761 | '<a class="%s" title="%s" href="%s">%s</a>', |
762 | - 'prev-page' . $disable_first, |
|
763 | - esc_attr__( 'Go to the previous page' ), |
|
764 | - esc_url( add_query_arg( $paged_arg_name, max( 1, $current-1 ), $url ) ), |
|
762 | + 'prev-page'.$disable_first, |
|
763 | + esc_attr__('Go to the previous page'), |
|
764 | + esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)), |
|
765 | 765 | '‹' |
766 | 766 | ); |
767 | 767 | |
768 | - if ( ! $show_num_field ) { |
|
768 | + if ( ! $show_num_field) { |
|
769 | 769 | $html_current_page = $current; |
770 | 770 | } else { |
771 | - $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
772 | - esc_attr__( 'Current page' ), |
|
771 | + $html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
772 | + esc_attr__('Current page'), |
|
773 | 773 | $current, |
774 | - strlen( $total_pages ) |
|
774 | + strlen($total_pages) |
|
775 | 775 | ); |
776 | 776 | } |
777 | 777 | |
778 | 778 | $html_total_pages = sprintf( |
779 | 779 | '<span class="total-pages">%s</span>', |
780 | - number_format_i18n( $total_pages ) |
|
780 | + number_format_i18n($total_pages) |
|
781 | 781 | ); |
782 | 782 | $page_links[] = sprintf( |
783 | - _x( '%3$s%1$s of %2$s%4$s', 'paging' ), |
|
783 | + _x('%3$s%1$s of %2$s%4$s', 'paging'), |
|
784 | 784 | $html_current_page, |
785 | 785 | $html_total_pages, |
786 | 786 | '<span class="paging-input">', |
@@ -789,29 +789,29 @@ discard block |
||
789 | 789 | |
790 | 790 | $page_links[] = sprintf( |
791 | 791 | '<a class="%s" title="%s" href="%s">%s</a>', |
792 | - 'next-page' . $disable_last, |
|
793 | - esc_attr__( 'Go to the next page' ), |
|
794 | - esc_url( add_query_arg( $paged_arg_name, min( $total_pages, $current+1 ), $url ) ), |
|
792 | + 'next-page'.$disable_last, |
|
793 | + esc_attr__('Go to the next page'), |
|
794 | + esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)), |
|
795 | 795 | '›' |
796 | 796 | ); |
797 | 797 | |
798 | 798 | $page_links[] = sprintf( |
799 | 799 | '<a class="%s" title="%s" href="%s">%s</a>', |
800 | - 'last-page' . $disable_last, |
|
801 | - esc_attr__( 'Go to the last page' ), |
|
802 | - esc_url( add_query_arg( $paged_arg_name, $total_pages, $url ) ), |
|
800 | + 'last-page'.$disable_last, |
|
801 | + esc_attr__('Go to the last page'), |
|
802 | + esc_url(add_query_arg($paged_arg_name, $total_pages, $url)), |
|
803 | 803 | '»' |
804 | 804 | ); |
805 | 805 | |
806 | - $output .= "\n" . '<span class="pagination-links">' . join( "\n", $page_links ) . '</span>'; |
|
806 | + $output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>'; |
|
807 | 807 | // set page class |
808 | - if ( $total_pages ) { |
|
808 | + if ($total_pages) { |
|
809 | 809 | $page_class = $total_pages < 2 ? ' one-page' : ''; |
810 | 810 | } else { |
811 | 811 | $page_class = ' no-pages'; |
812 | 812 | } |
813 | 813 | |
814 | - return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>'; |
|
814 | + return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>'; |
|
815 | 815 | } |
816 | 816 | |
817 | 817 | |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | //add_filter( 'FHEE__EEH_Template__format_currency__amount', 'convert_zero_to_free', 10, 2 ); |
828 | 828 | |
829 | 829 | |
830 | -if ( ! function_exists( 'espresso_pagination' ) ) { |
|
830 | +if ( ! function_exists('espresso_pagination')) { |
|
831 | 831 | /** |
832 | 832 | * espresso_pagination |
833 | 833 | * |
@@ -839,21 +839,21 @@ discard block |
||
839 | 839 | $big = 999999999; // need an unlikely integer |
840 | 840 | $pagination = paginate_links( |
841 | 841 | array( |
842 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
842 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
843 | 843 | 'format' => '?paged=%#%', |
844 | - 'current' => max( 1, get_query_var( 'paged' ) ), |
|
844 | + 'current' => max(1, get_query_var('paged')), |
|
845 | 845 | 'total' => $wp_query->max_num_pages, |
846 | 846 | 'show_all' => true, |
847 | 847 | 'end_size' => 10, |
848 | 848 | 'mid_size' => 6, |
849 | 849 | 'prev_next' => true, |
850 | - 'prev_text' => __( '‹ PREV', 'event_espresso' ), |
|
851 | - 'next_text' => __( 'NEXT ›', 'event_espresso' ), |
|
850 | + 'prev_text' => __('‹ PREV', 'event_espresso'), |
|
851 | + 'next_text' => __('NEXT ›', 'event_espresso'), |
|
852 | 852 | 'type' => 'plain', |
853 | 853 | 'add_args' => false, |
854 | 854 | 'add_fragment' => '' |
855 | 855 | ) |
856 | 856 | ); |
857 | - echo ! empty( $pagination ) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : ''; |
|
857 | + echo ! empty($pagination) ? '<div class="ee-pagination-dv clear">'.$pagination.'</div>' : ''; |
|
858 | 858 | } |
859 | 859 | } |
860 | 860 | \ No newline at end of file |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | |
4 | 4 | use EventEspresso\core\services\progress_steps\display_strategies\ProgressStepsDisplayInterface; |
5 | 5 | |
6 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
7 | - exit( 'No direct script access allowed' ); |
|
6 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
7 | + exit('No direct script access allowed'); |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | // core/services/progress_steps/display_strategies/number_bubbles/number_bubbles.css |
30 | 30 | wp_register_style( |
31 | 31 | 'ee_progress_steps_display_number_bubbles', |
32 | - plugin_dir_url( __FILE__ ) . 'number_bubbles.css' |
|
32 | + plugin_dir_url(__FILE__).'number_bubbles.css' |
|
33 | 33 | ); |
34 | - wp_enqueue_style( 'ee_progress_steps_display_number_bubbles' ); |
|
34 | + wp_enqueue_style('ee_progress_steps_display_number_bubbles'); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function getTemplate() { |
45 | 45 | // return plugin_dir_path( __FILE__ ) . 'number_bubbles.template.php'; |
46 | - return __DIR__ . DS .'number_bubbles.template.php'; |
|
46 | + return __DIR__.DS.'number_bubbles.template.php'; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | } |
@@ -1,6 +1,6 @@ discard block |
||
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 | * This is the template for the "Number Bubbles" Progress Steps |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | <!-- progress step display --> |
15 | 15 | <div class="ee-progress-step-main-container"> |
16 | 16 | <div class="progress-step-container number-bubbles-container"> |
17 | - <?php foreach ( $progress_steps as $progress_step ) : ?> |
|
18 | - <div data-step-nmbr="<?php echo $progress_step->id();?>" id="progress-step-<?php echo $progress_step->id(); ?>" class="progress-step-number <?php echo $progress_step->htmlClass(); ?>"> |
|
17 | + <?php foreach ($progress_steps as $progress_step) : ?> |
|
18 | + <div data-step-nmbr="<?php echo $progress_step->id(); ?>" id="progress-step-<?php echo $progress_step->id(); ?>" class="progress-step-number <?php echo $progress_step->htmlClass(); ?>"> |
|
19 | 19 | <div class="progress-step-line"></div> |
20 | 20 | <div class="progress-step-bubble"><p><?php echo $progress_step->id(); ?></p></div> |
21 | 21 | <span class="progress-step-text"><?php echo $progress_step->text(); ?></span> |
22 | 22 | </div> |
23 | - <?php endforeach;?> |
|
23 | + <?php endforeach; ?> |
|
24 | 24 | </div> |
25 | 25 | </div> |
26 | 26 |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | |
4 | 4 | use EventEspresso\Core\Exceptions\InvalidDataTypeException; |
5 | 5 | |
6 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
7 | - exit( 'No direct script access allowed' ); |
|
6 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
7 | + exit('No direct script access allowed'); |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @author Brent Christensen |
19 | 19 | * @since $VID:$ |
20 | 20 | */ |
21 | -class ProgressStep implements ProgressStepInterface{ |
|
21 | +class ProgressStep implements ProgressStepInterface { |
|
22 | 22 | |
23 | 23 | |
24 | 24 | /** |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | * @param string $text |
53 | 53 | * @throws \EventEspresso\Core\Exceptions\InvalidDataTypeException |
54 | 54 | */ |
55 | - public function __construct( $id, $html_class, $text ) { |
|
56 | - $this->setId( $id ); |
|
57 | - $this->setHtmlClass( $html_class ); |
|
58 | - $this->setText( $text ); |
|
55 | + public function __construct($id, $html_class, $text) { |
|
56 | + $this->setId($id); |
|
57 | + $this->setHtmlClass($html_class); |
|
58 | + $this->setText($text); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | /** |
73 | 73 | * @param boolean $is_current |
74 | 74 | */ |
75 | - public function setIsCurrent( $is_current = true ) { |
|
76 | - $this->is_current = filter_var( $is_current, FILTER_VALIDATE_BOOLEAN ); |
|
75 | + public function setIsCurrent($is_current = true) { |
|
76 | + $this->is_current = filter_var($is_current, FILTER_VALIDATE_BOOLEAN); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | * @param int|string $id |
93 | 93 | * @throws \EventEspresso\Core\Exceptions\InvalidDataTypeException |
94 | 94 | */ |
95 | - protected function setId( $id = 0 ) { |
|
96 | - if ( ! ( is_int( $id ) || is_string( $id ) ) ) { |
|
97 | - throw new InvalidDataTypeException( '$id', $id, 'integer or string' ); |
|
95 | + protected function setId($id = 0) { |
|
96 | + if ( ! (is_int($id) || is_string($id))) { |
|
97 | + throw new InvalidDataTypeException('$id', $id, 'integer or string'); |
|
98 | 98 | } |
99 | 99 | $this->id = $id; |
100 | 100 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @return string |
106 | 106 | */ |
107 | 107 | public function htmlClass() { |
108 | - return $this->is_current ? $this->html_class . ' progress-step-active' : $this->html_class; |
|
108 | + return $this->is_current ? $this->html_class.' progress-step-active' : $this->html_class; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -115,12 +115,12 @@ discard block |
||
115 | 115 | * @param string $html_class |
116 | 116 | * @throws \EventEspresso\Core\Exceptions\InvalidDataTypeException |
117 | 117 | */ |
118 | - protected function setHtmlClass( $html_class ) { |
|
119 | - if ( ! is_string( $html_class ) ) { |
|
120 | - throw new InvalidDataTypeException( '$html_class', $html_class, 'string' ); |
|
118 | + protected function setHtmlClass($html_class) { |
|
119 | + if ( ! is_string($html_class)) { |
|
120 | + throw new InvalidDataTypeException('$html_class', $html_class, 'string'); |
|
121 | 121 | } |
122 | - if ( strpos( $html_class, 'progress-step-' ) === false ) { |
|
123 | - $html_class = 'progress-step-' . $html_class; |
|
122 | + if (strpos($html_class, 'progress-step-') === false) { |
|
123 | + $html_class = 'progress-step-'.$html_class; |
|
124 | 124 | } |
125 | 125 | $this->html_class = $html_class; |
126 | 126 | } |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | * @param string $text |
142 | 142 | * @throws \EventEspresso\Core\Exceptions\InvalidDataTypeException |
143 | 143 | */ |
144 | - protected function setText( $text ) { |
|
145 | - if ( ! is_string( $text ) ) { |
|
146 | - throw new InvalidDataTypeException( '$text', $text, 'string' ); |
|
144 | + protected function setText($text) { |
|
145 | + if ( ! is_string($text)) { |
|
146 | + throw new InvalidDataTypeException('$text', $text, 'string'); |
|
147 | 147 | } |
148 | 148 | $this->text = $text; |
149 | 149 | } |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | use EventEspresso\core\services\collections\Collection; |
5 | 5 | |
6 | 6 | |
7 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
8 | - exit( 'No direct script access allowed' ); |
|
7 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
8 | + exit('No direct script access allowed'); |
|
9 | 9 | } |
10 | 10 | |
11 | 11 | |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @throws \EventEspresso\Core\Exceptions\InvalidInterfaceException |
28 | 28 | */ |
29 | 29 | public function __construct() { |
30 | - parent::__construct( '\EventEspresso\core\services\progress_steps\ProgressStepInterface' ); |
|
30 | + parent::__construct('\EventEspresso\core\services\progress_steps\ProgressStepInterface'); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | } |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\services\progress_steps; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * @param boolean $is_current |
24 | 24 | */ |
25 | - public function setIsCurrent( $is_current = true ); |
|
25 | + public function setIsCurrent($is_current = true); |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * @return int|string |
@@ -9,8 +9,8 @@ discard block |
||
9 | 9 | use EventEspresso\core\services\collections\CollectionInterface; |
10 | 10 | use EventEspresso\core\services\progress_steps\display_strategies\ProgressStepsDisplayInterface; |
11 | 11 | |
12 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
13 | - exit( 'No direct script access allowed' ); |
|
12 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
13 | + exit('No direct script access allowed'); |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | |
@@ -65,14 +65,14 @@ discard block |
||
65 | 65 | CollectionInterface $collection = null, |
66 | 66 | EE_Request $request = null |
67 | 67 | ) { |
68 | - $this->setDisplayStrategy( $display_strategy_name ); |
|
69 | - $this->setDefaultStep( $default_step ); |
|
70 | - if ( ! $collection instanceof CollectionInterface ) { |
|
71 | - $collection = new Collection( '\EventEspresso\core\services\progress_steps\ProgressStepInterface' ); |
|
68 | + $this->setDisplayStrategy($display_strategy_name); |
|
69 | + $this->setDefaultStep($default_step); |
|
70 | + if ( ! $collection instanceof CollectionInterface) { |
|
71 | + $collection = new Collection('\EventEspresso\core\services\progress_steps\ProgressStepInterface'); |
|
72 | 72 | } |
73 | 73 | $this->collection = $collection; |
74 | - if ( ! $request instanceof EE_Request ) { |
|
75 | - $request = \EE_Registry::instance()->load_core( 'Request' ); |
|
74 | + if ( ! $request instanceof EE_Request) { |
|
75 | + $request = \EE_Registry::instance()->load_core('Request'); |
|
76 | 76 | } |
77 | 77 | $this->request = $request; |
78 | 78 | } |
@@ -84,28 +84,28 @@ discard block |
||
84 | 84 | * @throws InvalidDataTypeException |
85 | 85 | * @throws InvalidClassException |
86 | 86 | */ |
87 | - protected function setDisplayStrategy( $display_strategy_name = 'number_bubbles' ) { |
|
88 | - if ( ! is_string( $display_strategy_name ) ) { |
|
89 | - throw new InvalidDataTypeException( '$display_strategy_name', $display_strategy_name, 'string' ); |
|
87 | + protected function setDisplayStrategy($display_strategy_name = 'number_bubbles') { |
|
88 | + if ( ! is_string($display_strategy_name)) { |
|
89 | + throw new InvalidDataTypeException('$display_strategy_name', $display_strategy_name, 'string'); |
|
90 | 90 | } |
91 | 91 | // build up FQCN from incoming display strategy folder name |
92 | 92 | $display_strategy_class = 'EventEspresso\core\services\progress_steps\display_strategies\\'; |
93 | - $display_strategy_class .= $display_strategy_name . '\\'; |
|
94 | - $display_strategy_class .= str_replace( ' ', '', ucwords( str_replace( '_', ' ', $display_strategy_name ) ) ); |
|
93 | + $display_strategy_class .= $display_strategy_name.'\\'; |
|
94 | + $display_strategy_class .= str_replace(' ', '', ucwords(str_replace('_', ' ', $display_strategy_name))); |
|
95 | 95 | $display_strategy_class .= 'ProgressStepsDisplay'; |
96 | 96 | $display_strategy_class = apply_filters( |
97 | 97 | 'FHEE__ProgressStepManager__setDisplayStrategy__display_strategy_class', |
98 | 98 | $display_strategy_class |
99 | 99 | ); |
100 | - if ( ! class_exists( $display_strategy_class ) ) { |
|
101 | - throw new InvalidClassException( $display_strategy_class ); |
|
100 | + if ( ! class_exists($display_strategy_class)) { |
|
101 | + throw new InvalidClassException($display_strategy_class); |
|
102 | 102 | } |
103 | 103 | $display_strategy = new $display_strategy_class(); |
104 | - if ( ! $display_strategy instanceof ProgressStepsDisplayInterface ) { |
|
104 | + if ( ! $display_strategy instanceof ProgressStepsDisplayInterface) { |
|
105 | 105 | throw new InvalidClassException( |
106 | 106 | $display_strategy_class, |
107 | 107 | sprintf( |
108 | - __( 'The "%1$s" Class needs to be an implementation of the "%1$s" Interface.', 'event_espresso' ), |
|
108 | + __('The "%1$s" Class needs to be an implementation of the "%1$s" Interface.', 'event_espresso'), |
|
109 | 109 | $display_strategy_class, |
110 | 110 | '\EventEspresso\core\services\progress_steps\display_strategies\ProgressStepsDisplayInterface' |
111 | 111 | ) |
@@ -120,20 +120,20 @@ discard block |
||
120 | 120 | * @param string $default_step |
121 | 121 | * @throws InvalidDataTypeException |
122 | 122 | */ |
123 | - public function setDefaultStep( $default_step ) { |
|
124 | - if ( ! is_string( $default_step ) ) { |
|
125 | - throw new InvalidDataTypeException( '$default_step', $default_step, 'string' ); |
|
123 | + public function setDefaultStep($default_step) { |
|
124 | + if ( ! is_string($default_step)) { |
|
125 | + throw new InvalidDataTypeException('$default_step', $default_step, 'string'); |
|
126 | 126 | } |
127 | 127 | $this->default_step = $default_step; |
128 | 128 | } |
129 | 129 | |
130 | 130 | |
131 | 131 | public function setStep() { |
132 | - $this->collection->current()->setIsCurrent( false ); |
|
132 | + $this->collection->current()->setIsCurrent(false); |
|
133 | 133 | $set = $this->collection->setCurrent( |
134 | - $this->request->get( 'ee-step', $this->default_step ) |
|
134 | + $this->request->get('ee-step', $this->default_step) |
|
135 | 135 | ); |
136 | - if ( $set ) { |
|
136 | + if ($set) { |
|
137 | 137 | $this->collection->current()->setIsCurrent(); |
138 | 138 | } |
139 | 139 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | public function displaySteps() { |
176 | 176 | echo \EEH_Template::display_template( |
177 | 177 | $this->display_strategy->getTemplate(), |
178 | - array( 'progress_steps' => $this->collection ), |
|
178 | + array('progress_steps' => $this->collection), |
|
179 | 179 | true |
180 | 180 | ); |
181 | 181 | } |
@@ -8,8 +8,8 @@ discard block |
||
8 | 8 | use EventEspresso\core\services\locators\FqcnLocator; |
9 | 9 | use EventEspresso\core\services\locators\LocatorInterface; |
10 | 10 | |
11 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
12 | - exit( 'No direct script access allowed' ); |
|
11 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
12 | + exit('No direct script access allowed'); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | |
@@ -170,13 +170,13 @@ discard block |
||
170 | 170 | $identifier_callback = '', |
171 | 171 | LocatorInterface $file_locator = null |
172 | 172 | ) { |
173 | - $this->setCollectionName( $collection_name ); |
|
174 | - $this->setCollectionInterface( $collection_interface ); |
|
175 | - $this->setCollectionFQCNs( $collection_FQCNs ); |
|
176 | - $this->setCollectionPaths( $collection_paths ); |
|
177 | - $this->setFileMasks( $file_mask ); |
|
178 | - $this->setIdentifierType( $identifier_type ); |
|
179 | - $this->setIdentifierCallback( $identifier_callback ); |
|
173 | + $this->setCollectionName($collection_name); |
|
174 | + $this->setCollectionInterface($collection_interface); |
|
175 | + $this->setCollectionFQCNs($collection_FQCNs); |
|
176 | + $this->setCollectionPaths($collection_paths); |
|
177 | + $this->setFileMasks($file_mask); |
|
178 | + $this->setIdentifierType($identifier_type); |
|
179 | + $this->setIdentifierCallback($identifier_callback); |
|
180 | 180 | $this->file_locator = $file_locator; |
181 | 181 | } |
182 | 182 | |
@@ -197,9 +197,9 @@ discard block |
||
197 | 197 | * @param string $collection_interface |
198 | 198 | * @throws \EventEspresso\Core\Exceptions\InvalidInterfaceException |
199 | 199 | */ |
200 | - protected function setCollectionInterface( $collection_interface ) { |
|
201 | - if ( ! ( interface_exists( $collection_interface ) || class_exists( $collection_interface ) ) ) { |
|
202 | - throw new InvalidInterfaceException( $collection_interface ); |
|
200 | + protected function setCollectionInterface($collection_interface) { |
|
201 | + if ( ! (interface_exists($collection_interface) || class_exists($collection_interface))) { |
|
202 | + throw new InvalidInterfaceException($collection_interface); |
|
203 | 203 | } |
204 | 204 | $this->collection_interface = $collection_interface; |
205 | 205 | } |
@@ -225,14 +225,14 @@ discard block |
||
225 | 225 | * @param string $collection_name |
226 | 226 | * @throws \EventEspresso\Core\Exceptions\InvalidDataTypeException |
227 | 227 | */ |
228 | - protected function setCollectionName( $collection_name ) { |
|
229 | - if ( ! is_string( $collection_name ) ) { |
|
230 | - throw new InvalidDataTypeException( '$collection_name', $collection_name, 'string' ); |
|
228 | + protected function setCollectionName($collection_name) { |
|
229 | + if ( ! is_string($collection_name)) { |
|
230 | + throw new InvalidDataTypeException('$collection_name', $collection_name, 'string'); |
|
231 | 231 | } |
232 | 232 | $this->collection_name = str_replace( |
233 | 233 | '-', |
234 | 234 | '_', |
235 | - sanitize_title_with_dashes( $collection_name, '', 'save' ) |
|
235 | + sanitize_title_with_dashes($collection_name, '', 'save') |
|
236 | 236 | ); |
237 | 237 | } |
238 | 238 | |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * @param string $identifier_type |
254 | 254 | * @throws \EventEspresso\Core\Exceptions\InvalidIdentifierException |
255 | 255 | */ |
256 | - protected function setIdentifierType( $identifier_type ) { |
|
256 | + protected function setIdentifierType($identifier_type) { |
|
257 | 257 | if ( |
258 | 258 | ! ( |
259 | 259 | $identifier_type === CollectionDetails::ID_CLASS_NAME |
@@ -286,9 +286,9 @@ discard block |
||
286 | 286 | * @param string $identifier_callback |
287 | 287 | * @throws \EventEspresso\Core\Exceptions\InvalidDataTypeException |
288 | 288 | */ |
289 | - protected function setIdentifierCallback( $identifier_callback = 'identifier' ) { |
|
290 | - if ( ! is_string( $identifier_callback ) ) { |
|
291 | - throw new InvalidDataTypeException( '$identifier_callback', $identifier_callback, 'string' ); |
|
289 | + protected function setIdentifierCallback($identifier_callback = 'identifier') { |
|
290 | + if ( ! is_string($identifier_callback)) { |
|
291 | + throw new InvalidDataTypeException('$identifier_callback', $identifier_callback, 'string'); |
|
292 | 292 | } |
293 | 293 | $this->identifier_callback = $identifier_callback; |
294 | 294 | } |
@@ -313,12 +313,12 @@ discard block |
||
313 | 313 | * @param string $file_mask |
314 | 314 | * @throws \EventEspresso\Core\Exceptions\InvalidDataTypeException |
315 | 315 | */ |
316 | - protected function setFileMasks( $file_mask ) { |
|
317 | - $this->file_mask = ! empty( $file_mask ) ? $file_mask : '*.php'; |
|
316 | + protected function setFileMasks($file_mask) { |
|
317 | + $this->file_mask = ! empty($file_mask) ? $file_mask : '*.php'; |
|
318 | 318 | // we know our default is a string, so if it's not a string now, |
319 | 319 | // then that means the incoming parameter was something else |
320 | - if ( ! is_string( $this->file_mask ) ) { |
|
321 | - throw new InvalidDataTypeException( '$file_mask', $this->file_mask, 'string' ); |
|
320 | + if ( ! is_string($this->file_mask)) { |
|
321 | + throw new InvalidDataTypeException('$file_mask', $this->file_mask, 'string'); |
|
322 | 322 | } |
323 | 323 | } |
324 | 324 | |
@@ -340,13 +340,13 @@ discard block |
||
340 | 340 | * @throws \EventEspresso\Core\Exceptions\InvalidClassException |
341 | 341 | * @throws \EventEspresso\Core\Exceptions\InvalidDataTypeException |
342 | 342 | */ |
343 | - public function setCollectionFQCNs( $collection_FQCNs ) { |
|
344 | - foreach ( (array) $collection_FQCNs as $collection_FQCN ) { |
|
345 | - if ( ! empty( $collection_FQCN ) ) { |
|
346 | - if ( class_exists( $collection_FQCN ) ) { |
|
343 | + public function setCollectionFQCNs($collection_FQCNs) { |
|
344 | + foreach ((array) $collection_FQCNs as $collection_FQCN) { |
|
345 | + if ( ! empty($collection_FQCN)) { |
|
346 | + if (class_exists($collection_FQCN)) { |
|
347 | 347 | $this->collection_FQCNs[] = $collection_FQCN; |
348 | 348 | } else { |
349 | - foreach ( $this->getFQCNsFromPartialNamespace( $collection_FQCN ) as $FQCN ) { |
|
349 | + foreach ($this->getFQCNsFromPartialNamespace($collection_FQCN) as $FQCN) { |
|
350 | 350 | $this->collection_FQCNs[] = $FQCN; |
351 | 351 | } |
352 | 352 | } |
@@ -363,11 +363,11 @@ discard block |
||
363 | 363 | * @throws \EventEspresso\Core\Exceptions\InvalidDataTypeException |
364 | 364 | * @throws \EventEspresso\Core\Exceptions\InvalidClassException |
365 | 365 | */ |
366 | - protected function getFQCNsFromPartialNamespace( $partial_FQCN ) { |
|
367 | - if ( ! $this->file_locator instanceof FqcnLocator ) { |
|
366 | + protected function getFQCNsFromPartialNamespace($partial_FQCN) { |
|
367 | + if ( ! $this->file_locator instanceof FqcnLocator) { |
|
368 | 368 | $this->file_locator = new FqcnLocator(); |
369 | 369 | } |
370 | - $this->file_locator->locate( $partial_FQCN ); |
|
370 | + $this->file_locator->locate($partial_FQCN); |
|
371 | 371 | return $this->file_locator->getFQCNs(); |
372 | 372 | } |
373 | 373 | |
@@ -388,11 +388,11 @@ discard block |
||
388 | 388 | * @param string|array $collection_paths |
389 | 389 | * @throws \EventEspresso\Core\Exceptions\InvalidFilePathException |
390 | 390 | */ |
391 | - public function setCollectionPaths( $collection_paths ) { |
|
392 | - foreach ( (array) $collection_paths as $collection_path ) { |
|
393 | - if ( ! empty( $collection_path ) ) { |
|
394 | - if ( ! is_readable( $collection_path ) ) { |
|
395 | - throw new InvalidFilePathException( $collection_path ); |
|
391 | + public function setCollectionPaths($collection_paths) { |
|
392 | + foreach ((array) $collection_paths as $collection_path) { |
|
393 | + if ( ! empty($collection_path)) { |
|
394 | + if ( ! is_readable($collection_path)) { |
|
395 | + throw new InvalidFilePathException($collection_path); |
|
396 | 396 | } |
397 | 397 | $this->collection_paths[] = $collection_path; |
398 | 398 | } |