@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * |
| 86 | 86 | * @var array |
| 87 | 87 | */ |
| 88 | - private $template_data_var_names = array('data'); |
|
| 88 | + private $template_data_var_names = array( 'data' ); |
|
| 89 | 89 | |
| 90 | 90 | /** |
| 91 | 91 | * Clean up template data. |
@@ -138,11 +138,11 @@ discard block |
||
| 138 | 138 | public function set_template_data( $data, $var_name = 'data' ) { |
| 139 | 139 | global $wp_query; |
| 140 | 140 | |
| 141 | - $wp_query->query_vars[ $var_name ] = (object) $data; |
|
| 141 | + $wp_query->query_vars[ $var_name ] = (object)$data; |
|
| 142 | 142 | |
| 143 | 143 | // Add $var_name to custom variable store if not default value |
| 144 | - if( $var_name !== 'data' ) { |
|
| 145 | - $this->template_data_var_names[] = $var_name; |
|
| 144 | + if ( $var_name !== 'data' ) { |
|
| 145 | + $this->template_data_var_names[ ] = $var_name; |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | return $this; |
@@ -165,8 +165,8 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | // Remove each custom data reference from $wp_query |
| 167 | 167 | foreach ( $custom_var_names as $var ) { |
| 168 | - if ( isset( $wp_query->query_vars[$var] ) ) { |
|
| 169 | - unset( $wp_query->query_vars[$var] ); |
|
| 168 | + if ( isset( $wp_query->query_vars[ $var ] ) ) { |
|
| 169 | + unset( $wp_query->query_vars[ $var ] ); |
|
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | |
@@ -186,9 +186,9 @@ discard block |
||
| 186 | 186 | protected function get_template_file_names( $slug, $name ) { |
| 187 | 187 | $templates = array(); |
| 188 | 188 | if ( isset( $name ) ) { |
| 189 | - $templates[] = $slug . '-' . $name . '.php'; |
|
| 189 | + $templates[ ] = $slug . '-' . $name . '.php'; |
|
| 190 | 190 | } |
| 191 | - $templates[] = $slug . '.php'; |
|
| 191 | + $templates[ ] = $slug . '.php'; |
|
| 192 | 192 | |
| 193 | 193 | /** |
| 194 | 194 | * Allow template choices to be filtered. |
@@ -224,18 +224,18 @@ discard block |
||
| 224 | 224 | public function locate_template( $template_names, $load = false, $require_once = true ) { |
| 225 | 225 | |
| 226 | 226 | // Use $template_names as a cache key - either first element of array or the variable itself if it's a string |
| 227 | - $cache_key = is_array( $template_names ) ? $template_names[0] : $template_names; |
|
| 227 | + $cache_key = is_array( $template_names ) ? $template_names[ 0 ] : $template_names; |
|
| 228 | 228 | |
| 229 | 229 | // If the key is in the cache array, we've already located this file. |
| 230 | - if ( isset( $this->template_path_cache[$cache_key] ) ) { |
|
| 231 | - $located = $this->template_path_cache[$cache_key]; |
|
| 230 | + if ( isset( $this->template_path_cache[ $cache_key ] ) ) { |
|
| 231 | + $located = $this->template_path_cache[ $cache_key ]; |
|
| 232 | 232 | } else { |
| 233 | 233 | |
| 234 | 234 | // No file found yet. |
| 235 | 235 | $located = false; |
| 236 | 236 | |
| 237 | 237 | // Remove empty entries. |
| 238 | - $template_names = array_filter( (array) $template_names ); |
|
| 238 | + $template_names = array_filter( (array)$template_names ); |
|
| 239 | 239 | $template_paths = $this->get_template_paths(); |
| 240 | 240 | |
| 241 | 241 | // Try to find a template file. |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | if ( file_exists( $template_path . $template_name ) ) { |
| 249 | 249 | $located = $template_path . $template_name; |
| 250 | 250 | // Store the template path in the cache |
| 251 | - $this->template_path_cache[$cache_key] = $located; |
|
| 251 | + $this->template_path_cache[ $cache_key ] = $located; |
|
| 252 | 252 | break 2; |
| 253 | 253 | } |
| 254 | 254 | } |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | |
| 284 | 284 | // Only add this conditionally, so non-child themes don't redundantly check active theme twice. |
| 285 | 285 | if ( get_stylesheet_directory() !== get_template_directory() ) { |
| 286 | - $file_paths[1] = trailingslashit( get_stylesheet_directory() ) . $theme_directory; |
|
| 286 | + $file_paths[ 1 ] = trailingslashit( get_stylesheet_directory() ) . $theme_directory; |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | /** |