@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | $template = str_replace('.', '/', $template); |
31 | 31 | |
32 | - return THEME_PATH . self::$theme_templates_folder . '/' . $template . '.blade.php'; |
|
32 | + return THEME_PATH.self::$theme_templates_folder.'/'.$template.'.blade.php'; |
|
33 | 33 | |
34 | 34 | } |
35 | 35 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | foreach ($templates as $template) { |
62 | 62 | |
63 | - if ( self::template_exists($template) ): |
|
63 | + if (self::template_exists($template)): |
|
64 | 64 | |
65 | 65 | return $template; |
66 | 66 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | // Home |
88 | 88 | |
89 | - if ( $type == 'home' ) : |
|
89 | + if ($type == 'home') : |
|
90 | 90 | |
91 | 91 | $templates[] = 'home'; |
92 | 92 | $templates[] = 'index'; |
@@ -94,32 +94,32 @@ discard block |
||
94 | 94 | |
95 | 95 | // Single |
96 | 96 | |
97 | - elseif ( $type == 'single' ) : |
|
97 | + elseif ($type == 'single') : |
|
98 | 98 | |
99 | - $post_type = get_query_var( 'post_type' ); |
|
99 | + $post_type = get_query_var('post_type'); |
|
100 | 100 | |
101 | - $templates[] = 'single-' . $post_type; |
|
101 | + $templates[] = 'single-'.$post_type; |
|
102 | 102 | |
103 | 103 | $templates[] = 'single'; |
104 | 104 | |
105 | 105 | // Post type |
106 | 106 | |
107 | - elseif ( $type == 'post_type_archive' ) : |
|
107 | + elseif ($type == 'post_type_archive') : |
|
108 | 108 | |
109 | - $post_type = get_query_var( 'post_type' ); |
|
109 | + $post_type = get_query_var('post_type'); |
|
110 | 110 | |
111 | - $templates[] = 'archive-' . $post_type; |
|
111 | + $templates[] = 'archive-'.$post_type; |
|
112 | 112 | |
113 | 113 | $templates[] = 'archive'; |
114 | 114 | |
115 | 115 | |
116 | 116 | // Taxonomy |
117 | 117 | |
118 | - elseif ( $type == 'taxonomy' ): |
|
118 | + elseif ($type == 'taxonomy'): |
|
119 | 119 | |
120 | 120 | $term = get_queried_object(); |
121 | 121 | |
122 | - if ( ! empty( $term->slug ) ) { |
|
122 | + if (!empty($term->slug)) { |
|
123 | 123 | |
124 | 124 | $taxonomy = $term->taxonomy; |
125 | 125 | |
@@ -132,11 +132,11 @@ discard block |
||
132 | 132 | |
133 | 133 | // Category |
134 | 134 | |
135 | - elseif ( $type == 'category' ): |
|
135 | + elseif ($type == 'category'): |
|
136 | 136 | |
137 | 137 | $category = get_queried_object(); |
138 | 138 | |
139 | - if ( ! empty( $category->slug ) ) { |
|
139 | + if (!empty($category->slug)) { |
|
140 | 140 | $templates[] = "category-{$category->slug}"; |
141 | 141 | $templates[] = "category-{$category->term_id}"; |
142 | 142 | } |
@@ -145,23 +145,23 @@ discard block |
||
145 | 145 | |
146 | 146 | // Attachment |
147 | 147 | |
148 | - elseif ( $type == 'attachment' ): |
|
148 | + elseif ($type == 'attachment'): |
|
149 | 149 | |
150 | 150 | $attachment = get_queried_object(); |
151 | 151 | |
152 | - if ( $attachment ) { |
|
152 | + if ($attachment) { |
|
153 | 153 | |
154 | - if ( false !== strpos( $attachment->post_mime_type, '/' ) ) { |
|
154 | + if (false !== strpos($attachment->post_mime_type, '/')) { |
|
155 | 155 | |
156 | - list( $type, $subtype ) = explode( '/', $attachment->post_mime_type ); |
|
156 | + list($type, $subtype) = explode('/', $attachment->post_mime_type); |
|
157 | 157 | |
158 | 158 | } else { |
159 | 159 | |
160 | - list( $type, $subtype ) = array( $attachment->post_mime_type, '' ); |
|
160 | + list($type, $subtype) = array($attachment->post_mime_type, ''); |
|
161 | 161 | |
162 | 162 | } |
163 | 163 | |
164 | - if ( ! empty( $subtype ) ) { |
|
164 | + if (!empty($subtype)) { |
|
165 | 165 | $templates[] = "{$type}-{$subtype}"; |
166 | 166 | $templates[] = "{$subtype}"; |
167 | 167 | } |
@@ -173,11 +173,11 @@ discard block |
||
173 | 173 | |
174 | 174 | // Tag |
175 | 175 | |
176 | - elseif ( $type == 'tag' ): |
|
176 | + elseif ($type == 'tag'): |
|
177 | 177 | |
178 | 178 | $tag = get_queried_object(); |
179 | 179 | |
180 | - if ( ! empty( $tag->slug ) ) { |
|
180 | + if (!empty($tag->slug)) { |
|
181 | 181 | $templates[] = "tag-{$tag->slug}"; |
182 | 182 | $templates[] = "tag-{$tag->term_id}"; |
183 | 183 | } |
@@ -186,11 +186,11 @@ discard block |
||
186 | 186 | |
187 | 187 | // Author |
188 | 188 | |
189 | - elseif ( $type == 'author' ): |
|
189 | + elseif ($type == 'author'): |
|
190 | 190 | |
191 | 191 | $author = get_queried_object(); |
192 | 192 | |
193 | - if ( $author instanceof WP_User ) { |
|
193 | + if ($author instanceof WP_User) { |
|
194 | 194 | $templates[] = "author-{$author->user_nicename}"; |
195 | 195 | $templates[] = "author-{$author->ID}"; |
196 | 196 | } |
@@ -199,32 +199,32 @@ discard block |
||
199 | 199 | |
200 | 200 | // Front Page |
201 | 201 | |
202 | - elseif ( $type == 'front-page' ): |
|
202 | + elseif ($type == 'front-page'): |
|
203 | 203 | |
204 | 204 | $id = get_queried_object_id(); |
205 | 205 | |
206 | 206 | $pagename = get_query_var('pagename'); |
207 | 207 | |
208 | - if ( ! $pagename && $id ) { |
|
208 | + if (!$pagename && $id) { |
|
209 | 209 | // If a static page is set as the front page, $pagename will not be set. Retrieve it from the queried object |
210 | 210 | $post = get_queried_object(); |
211 | - if ( $post ) |
|
211 | + if ($post) |
|
212 | 212 | $pagename = $post->post_name; |
213 | 213 | } |
214 | 214 | |
215 | 215 | $template = get_post_meta('theme-page-template', $id); |
216 | 216 | |
217 | - if ( $template != 'index' ) |
|
217 | + if ($template != 'index') |
|
218 | 218 | $templates[] = $template; |
219 | - if ( $pagename ) |
|
219 | + if ($pagename) |
|
220 | 220 | $templates[] = "page-$pagename"; |
221 | - if ( $id ) |
|
221 | + if ($id) |
|
222 | 222 | $templates[] = "page-$id"; |
223 | 223 | $templates[] = ''; |
224 | 224 | |
225 | 225 | // Page |
226 | 226 | |
227 | - elseif ( $type == 'page' ): |
|
227 | + elseif ($type == 'page'): |
|
228 | 228 | |
229 | 229 | $id = get_queried_object_id(); |
230 | 230 | |
@@ -232,18 +232,18 @@ discard block |
||
232 | 232 | |
233 | 233 | $pagename = get_query_var('pagename'); |
234 | 234 | |
235 | - if ( ! $pagename && $id ) { |
|
235 | + if (!$pagename && $id) { |
|
236 | 236 | // If a static page is set as the front page, $pagename will not be set. Retrieve it from the queried object |
237 | 237 | $post = get_queried_object(); |
238 | - if ( $post ) |
|
238 | + if ($post) |
|
239 | 239 | $pagename = $post->post_name; |
240 | 240 | } |
241 | 241 | |
242 | - if ( $template != 'index' ) |
|
242 | + if ($template != 'index') |
|
243 | 243 | $templates[] = $template; |
244 | - if ( $pagename ) |
|
244 | + if ($pagename) |
|
245 | 245 | $templates[] = "page-$pagename"; |
246 | - if ( $id ) |
|
246 | + if ($id) |
|
247 | 247 | $templates[] = "page-$id"; |
248 | 248 | $templates[] = 'page'; |
249 | 249 | |
@@ -269,37 +269,37 @@ discard block |
||
269 | 269 | */ |
270 | 270 | public static function get_current_page() { |
271 | 271 | |
272 | - if ( is_404() && $template = self::get_available_template('404') ) : |
|
272 | + if (is_404() && $template = self::get_available_template('404')) : |
|
273 | 273 | |
274 | - elseif ( is_search() && $template = self::get_available_template('search') ) : |
|
274 | + elseif (is_search() && $template = self::get_available_template('search')) : |
|
275 | 275 | |
276 | - elseif ( is_front_page() && $template = self::get_available_template('front-page') ) : |
|
276 | + elseif (is_front_page() && $template = self::get_available_template('front-page')) : |
|
277 | 277 | |
278 | - elseif ( is_home() && $template = self::get_available_template('home') ) : |
|
278 | + elseif (is_home() && $template = self::get_available_template('home')) : |
|
279 | 279 | |
280 | - elseif ( is_post_type_archive() && $template = self::get_available_template('post_type_archive') ) : |
|
280 | + elseif (is_post_type_archive() && $template = self::get_available_template('post_type_archive')) : |
|
281 | 281 | |
282 | - elseif ( is_tax() && $template = self::get_available_template('taxonomy') ) : |
|
282 | + elseif (is_tax() && $template = self::get_available_template('taxonomy')) : |
|
283 | 283 | |
284 | - elseif ( is_attachment() && $template = self::get_available_template('attachment') ) : |
|
284 | + elseif (is_attachment() && $template = self::get_available_template('attachment')) : |
|
285 | 285 | |
286 | - elseif ( is_single() && $template = self::get_available_template('single') ) : |
|
286 | + elseif (is_single() && $template = self::get_available_template('single')) : |
|
287 | 287 | |
288 | - elseif ( is_page() && $template = self::get_available_template('page') ) : |
|
288 | + elseif (is_page() && $template = self::get_available_template('page')) : |
|
289 | 289 | |
290 | - elseif ( is_singular() && $template = self::get_available_template('singular') ) : |
|
290 | + elseif (is_singular() && $template = self::get_available_template('singular')) : |
|
291 | 291 | |
292 | - elseif ( is_category() && $template = self::get_available_template('category') ) : |
|
292 | + elseif (is_category() && $template = self::get_available_template('category')) : |
|
293 | 293 | |
294 | - elseif ( is_tag() && $template = self::get_available_template('tag') ) : |
|
294 | + elseif (is_tag() && $template = self::get_available_template('tag')) : |
|
295 | 295 | |
296 | - elseif ( is_author() && $template = self::get_available_template('author') ) : |
|
296 | + elseif (is_author() && $template = self::get_available_template('author')) : |
|
297 | 297 | |
298 | - elseif ( is_date() && $template = self::get_available_template('date') ) : |
|
298 | + elseif (is_date() && $template = self::get_available_template('date')) : |
|
299 | 299 | |
300 | - elseif ( is_archive() && $template = self::get_available_template('archive') ) : |
|
300 | + elseif (is_archive() && $template = self::get_available_template('archive')) : |
|
301 | 301 | |
302 | - elseif ( is_paged() && $template = self::get_available_template('paged') ) : |
|
302 | + elseif (is_paged() && $template = self::get_available_template('paged')) : |
|
303 | 303 | |
304 | 304 | else : |
305 | 305 | |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | |
327 | 327 | } else { |
328 | 328 | |
329 | - return $template . '.' . $template; |
|
329 | + return $template.'.'.$template; |
|
330 | 330 | |
331 | 331 | } |
332 | 332 | |
@@ -368,8 +368,8 @@ discard block |
||
368 | 368 | */ |
369 | 369 | public static function render($template = null, $data = null) { |
370 | 370 | |
371 | - $views = THEME_PATH . self::$theme_templates_folder; |
|
372 | - $cache = WP_CONTENT_DIR . '/templatecache'; |
|
371 | + $views = THEME_PATH.self::$theme_templates_folder; |
|
372 | + $cache = WP_CONTENT_DIR.'/templatecache'; |
|
373 | 373 | $common_scope = ClassyScope::get_common_scope(); |
374 | 374 | |
375 | 375 | if ($template !== null && is_string($template)) { |