@@ -30,39 +30,39 @@ discard block  | 
                                                    ||
| 30 | 30 | |
| 31 | 31 |  	public function enable() { | 
                                                        
| 32 | 32 | |
| 33 | - add_action( 'template_redirect', array( $this, 'template_redirect' ) );  | 
                                                        |
| 33 | +		add_action('template_redirect', array($this, 'template_redirect')); | 
                                                        |
| 34 | 34 | |
| 35 | -		foreach ( $this->template_types as $type ) { | 
                                                        |
| 36 | -			add_filter( "{$type}_template", array( $this, 'query_template' ) ); | 
                                                        |
| 35 | +		foreach ($this->template_types as $type) { | 
                                                        |
| 36 | +			add_filter("{$type}_template", array($this, 'query_template')); | 
                                                        |
| 37 | 37 | }  | 
                                                        
| 38 | 38 | }  | 
                                                        
| 39 | 39 | |
| 40 | 40 |  	public function disable() { | 
                                                        
| 41 | 41 | |
| 42 | - remove_action( 'template_redirect', array( $this, 'template_redirect' ) );  | 
                                                        |
| 42 | +		remove_action('template_redirect', array($this, 'template_redirect')); | 
                                                        |
| 43 | 43 | |
| 44 | -		foreach ( $this->template_types as $type ) { | 
                                                        |
| 45 | -			remove_filter( "{$type}_template", array( $this, 'query_template' ) ); | 
                                                        |
| 44 | +		foreach ($this->template_types as $type) { | 
                                                        |
| 45 | +			remove_filter("{$type}_template", array($this, 'query_template')); | 
                                                        |
| 46 | 46 | }  | 
                                                        
| 47 | 47 | |
| 48 | -		if ( ! empty($this->mime_type) ) { | 
                                                        |
| 49 | -			remove_filter( "{$this->mime_type[0]}_template", array( $this, 'query_template' ) ); | 
                                                        |
| 50 | -			remove_filter( "{$this->mime_type[1]}_template", array( $this, 'query_template' ) ); | 
                                                        |
| 51 | -			remove_filter( "{$this->mime_type[0]}{$this->mime_type[1]}_template", array( $this, 'query_template' ) ); | 
                                                        |
| 48 | +		if ( ! empty($this->mime_type)) { | 
                                                        |
| 49 | +			remove_filter("{$this->mime_type[0]}_template", array($this, 'query_template')); | 
                                                        |
| 50 | +			remove_filter("{$this->mime_type[1]}_template", array($this, 'query_template')); | 
                                                        |
| 51 | +			remove_filter("{$this->mime_type[0]}{$this->mime_type[1]}_template", array($this, 'query_template')); | 
                                                        |
| 52 | 52 | }  | 
                                                        
| 53 | 53 | }  | 
                                                        
| 54 | 54 | |
| 55 | 55 |  	public function template_redirect() { | 
                                                        
| 56 | 56 | |
| 57 | -		if ( is_attachment() ) { | 
                                                        |
| 57 | +		if (is_attachment()) { | 
                                                        |
| 58 | 58 | global $posts;  | 
                                                        
| 59 | 59 | |
| 60 | - if ( ! empty( $posts ) && isset( $posts[0]->post_mime_type ) )  | 
                                                        |
| 61 | - $this->mime_type = explode( '/', $posts[0]->post_mime_type );  | 
                                                        |
| 60 | + if ( ! empty($posts) && isset($posts[0]->post_mime_type))  | 
                                                        |
| 61 | +				$this->mime_type = explode('/', $posts[0]->post_mime_type); | 
                                                        |
| 62 | 62 | |
| 63 | -			add_filter( "{$this->mime_type[0]}_template", array( $this, 'query_template' ) ); | 
                                                        |
| 64 | -			add_filter( "{$this->mime_type[1]}_template", array( $this, 'query_template' ) ); | 
                                                        |
| 65 | -			add_filter( "{$this->mime_type[0]}{$this->mime_type[1]}_template", array( $this, 'query_template' ) ); | 
                                                        |
| 63 | +			add_filter("{$this->mime_type[0]}_template", array($this, 'query_template')); | 
                                                        |
| 64 | +			add_filter("{$this->mime_type[1]}_template", array($this, 'query_template')); | 
                                                        |
| 65 | +			add_filter("{$this->mime_type[0]}{$this->mime_type[1]}_template", array($this, 'query_template')); | 
                                                        |
| 66 | 66 | }  | 
                                                        
| 67 | 67 | }  | 
                                                        
| 68 | 68 | |
@@ -71,16 +71,16 @@ discard block  | 
                                                    ||
| 71 | 71 | *  | 
                                                        
| 72 | 72 | * @return string  | 
                                                        
| 73 | 73 | */  | 
                                                        
| 74 | -	public function query_template( $fallback ) { | 
                                                        |
| 74 | +	public function query_template($fallback) { | 
                                                        |
| 75 | 75 | |
| 76 | - $type = substr( current_filter(), 0, - 9 ); // trim '_template' from end  | 
                                                        |
| 76 | + $type = substr(current_filter(), 0, - 9); // trim '_template' from end  | 
                                                        |
| 77 | 77 | $templates = array();  | 
                                                        
| 78 | 78 | |
| 79 | -		switch ( $type ) { | 
                                                        |
| 79 | +		switch ($type) { | 
                                                        |
| 80 | 80 | case 'taxonomy':  | 
                                                        
| 81 | 81 | $term = get_queried_object();  | 
                                                        
| 82 | 82 | |
| 83 | -				if ( $term ) { | 
                                                        |
| 83 | +				if ($term) { | 
                                                        |
| 84 | 84 | $taxonomy = $term->taxonomy;  | 
                                                        
| 85 | 85 |  					$templates[] = "taxonomy-{$taxonomy}-{$term->slug}.twig"; | 
                                                        
| 86 | 86 |  					$templates[] = "taxonomy-{$taxonomy}.twig"; | 
                                                        
@@ -90,17 +90,17 @@ discard block  | 
                                                    ||
| 90 | 90 | break;  | 
                                                        
| 91 | 91 | |
| 92 | 92 | case 'frontpage':  | 
                                                        
| 93 | - $templates = array( 'front-page.twig' );  | 
                                                        |
| 93 | +				$templates = array('front-page.twig'); | 
                                                        |
| 94 | 94 | break;  | 
                                                        
| 95 | 95 | |
| 96 | 96 | case 'home':  | 
                                                        
| 97 | - $templates = array( 'home.twig', 'index.twig' );  | 
                                                        |
| 97 | +				$templates = array('home.twig', 'index.twig'); | 
                                                        |
| 98 | 98 | break;  | 
                                                        
| 99 | 99 | |
| 100 | 100 | case 'single':  | 
                                                        
| 101 | 101 | $object = get_queried_object();  | 
                                                        
| 102 | 102 | |
| 103 | - if ( $object )  | 
                                                        |
| 103 | + if ($object)  | 
                                                        |
| 104 | 104 |  					$templates[] = "single-{$object->post_type}.twig"; | 
                                                        
| 105 | 105 | |
| 106 | 106 | $templates[] = 'single.twig';  | 
                                                        
@@ -109,9 +109,9 @@ discard block  | 
                                                    ||
| 109 | 109 | case 'page':  | 
                                                        
| 110 | 110 | $page_id = get_queried_object_id();  | 
                                                        
| 111 | 111 | // $template = get_page_template_slug();  | 
                                                        
| 112 | - $pagename = get_query_var( 'pagename' );  | 
                                                        |
| 112 | +				$pagename = get_query_var('pagename'); | 
                                                        |
| 113 | 113 | |
| 114 | -				if ( ! $pagename && $page_id ) { | 
                                                        |
| 114 | +				if ( ! $pagename && $page_id) { | 
                                                        |
| 115 | 115 | // If a static page is set as the front page, $pagename will not be set. Retrieve it from the queried object  | 
                                                        
| 116 | 116 | $post = get_queried_object();  | 
                                                        
| 117 | 117 | $pagename = $post->post_name;  | 
                                                        
@@ -121,24 +121,24 @@ discard block  | 
                                                    ||
| 121 | 121 | // if ( $template && 0 === validate_file( $template ) )  | 
                                                        
| 122 | 122 | // $templates[] = $template;  | 
                                                        
| 123 | 123 | |
| 124 | - if ( $pagename )  | 
                                                        |
| 124 | + if ($pagename)  | 
                                                        |
| 125 | 125 |  					$templates[] = "page-{$pagename}.twig"; | 
                                                        
| 126 | 126 | |
| 127 | - if ( $page_id )  | 
                                                        |
| 127 | + if ($page_id)  | 
                                                        |
| 128 | 128 |  					$templates[] = "page-{$page_id}.twig"; | 
                                                        
| 129 | 129 | |
| 130 | 130 | $templates[] = 'page.twig';  | 
                                                        
| 131 | 131 | break;  | 
                                                        
| 132 | 132 | |
| 133 | 133 | case 'singular':  | 
                                                        
| 134 | - $templates = [ 'singular.twig' ];  | 
                                                        |
| 134 | + $templates = ['singular.twig'];  | 
                                                        |
| 135 | 135 | break;  | 
                                                        
| 136 | 136 | |
| 137 | 137 | case 'category':  | 
                                                        
| 138 | 138 | case 'tag':  | 
                                                        
| 139 | 139 | $term = get_queried_object();  | 
                                                        
| 140 | 140 | |
| 141 | -				if ( $term ) { | 
                                                        |
| 141 | +				if ($term) { | 
                                                        |
| 142 | 142 |  					$templates[] = "{$type}-{$term->slug}.twig"; | 
                                                        
| 143 | 143 |  					$templates[] = "{$type}-{$term->term_id}.twig"; | 
                                                        
| 144 | 144 | }  | 
                                                        
@@ -149,7 +149,7 @@ discard block  | 
                                                    ||
| 149 | 149 | case 'author':  | 
                                                        
| 150 | 150 | $author = get_queried_object();  | 
                                                        
| 151 | 151 | |
| 152 | -				if ( $author ) { | 
                                                        |
| 152 | +				if ($author) { | 
                                                        |
| 153 | 153 |  					$templates[] = "author-{$author->user_nicename}.twig"; | 
                                                        
| 154 | 154 |  					$templates[] = "author-{$author->ID}.twig"; | 
                                                        
| 155 | 155 | }  | 
                                                        
@@ -158,10 +158,10 @@ discard block  | 
                                                    ||
| 158 | 158 | break;  | 
                                                        
| 159 | 159 | |
| 160 | 160 | case 'archive':  | 
                                                        
| 161 | - $post_types = array_filter( (array) get_query_var( 'post_type' ) );  | 
                                                        |
| 161 | +				$post_types = array_filter((array) get_query_var('post_type')); | 
                                                        |
| 162 | 162 | |
| 163 | -				if ( count( $post_types ) == 1 ) { | 
                                                        |
| 164 | - $post_type = reset( $post_types );  | 
                                                        |
| 163 | +				if (count($post_types) == 1) { | 
                                                        |
| 164 | + $post_type = reset($post_types);  | 
                                                        |
| 165 | 165 |  					$templates[] = "archive-{$post_type}.twig"; | 
                                                        
| 166 | 166 | }  | 
                                                        
| 167 | 167 | |
@@ -169,16 +169,16 @@ discard block  | 
                                                    ||
| 169 | 169 | break;  | 
                                                        
| 170 | 170 | |
| 171 | 171 | default:  | 
                                                        
| 172 | -				$templates = array( "{$type}.twig" ); | 
                                                        |
| 172 | +				$templates = array("{$type}.twig"); | 
                                                        |
| 173 | 173 | }  | 
                                                        
| 174 | 174 | |
| 175 | - $template = $this->locate_template( $templates );  | 
                                                        |
| 175 | + $template = $this->locate_template($templates);  | 
                                                        |
| 176 | 176 | |
| 177 | -		if ( empty( $template ) ) { | 
                                                        |
| 177 | +		if (empty($template)) { | 
                                                        |
| 178 | 178 | $template = $fallback;  | 
                                                        
| 179 | 179 | }  | 
                                                        
| 180 | 180 | |
| 181 | - return apply_filters( 'meadow_query_template', $template, $type );  | 
                                                        |
| 181 | +		return apply_filters('meadow_query_template', $template, $type); | 
                                                        |
| 182 | 182 | }  | 
                                                        
| 183 | 183 | |
| 184 | 184 | /**  | 
                                                        
@@ -188,8 +188,8 @@ discard block  | 
                                                    ||
| 188 | 188 | *  | 
                                                        
| 189 | 189 | * @return string  | 
                                                        
| 190 | 190 | */  | 
                                                        
| 191 | -	public function locate_template( $templates ) { | 
                                                        |
| 191 | +	public function locate_template($templates) { | 
                                                        |
| 192 | 192 | |
| 193 | - return locate_template( $templates );  | 
                                                        |
| 193 | + return locate_template($templates);  | 
                                                        |
| 194 | 194 | }  | 
                                                        
| 195 | 195 | }  |