@@ -41,11 +41,11 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @param WP_Post $item |
43 | 43 | */ |
44 | - public function __construct( $item ) { |
|
44 | + public function __construct($item) { |
|
45 | 45 | |
46 | - if ( is_a( $item, 'WP_Post' ) ) { |
|
46 | + if (is_a($item, 'WP_Post')) { |
|
47 | 47 | |
48 | - $this->import( $item ); |
|
48 | + $this->import($item); |
|
49 | 49 | $this->filter_classes(); |
50 | 50 | |
51 | 51 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function get_classes() { |
104 | 104 | |
105 | - return implode( ' ', $this->classes ); |
|
105 | + return implode(' ', $this->classes); |
|
106 | 106 | |
107 | 107 | } |
108 | 108 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * |
112 | 112 | * @param string $class_name |
113 | 113 | */ |
114 | - public function add_class( $class_name ) { |
|
114 | + public function add_class($class_name) { |
|
115 | 115 | |
116 | 116 | $this->classes[] = $class_name; |
117 | 117 | |
@@ -122,17 +122,17 @@ discard block |
||
122 | 122 | * |
123 | 123 | * @param ClassyMenuItem $item |
124 | 124 | */ |
125 | - public function add_child( $item ) { |
|
125 | + public function add_child($item) { |
|
126 | 126 | |
127 | - if ( ! $this->has_child ) { |
|
128 | - $this->add_class( 'menu-item-has-children' ); |
|
127 | + if (!$this->has_child) { |
|
128 | + $this->add_class('menu-item-has-children'); |
|
129 | 129 | $this->has_child = true; |
130 | 130 | } |
131 | 131 | |
132 | 132 | $this->children[] = $item; |
133 | 133 | $item->level = $this->level + 1; |
134 | 134 | |
135 | - if ( $item->children ) { |
|
135 | + if ($item->children) { |
|
136 | 136 | $this->update_child_levels(); |
137 | 137 | } |
138 | 138 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | protected function filter_classes() { |
147 | 147 | |
148 | - $this->classes = apply_filters( 'nav_menu_css_class', $this->classes, $this ); |
|
148 | + $this->classes = apply_filters('nav_menu_css_class', $this->classes, $this); |
|
149 | 149 | |
150 | 150 | } |
151 | 151 | |
@@ -156,9 +156,9 @@ discard block |
||
156 | 156 | */ |
157 | 157 | protected function update_child_levels() { |
158 | 158 | |
159 | - if ( is_array( $this->children ) ) { |
|
159 | + if (is_array($this->children)) { |
|
160 | 160 | |
161 | - foreach ( $this->children as $child ) { |
|
161 | + foreach ($this->children as $child) { |
|
162 | 162 | $child->level = $this->level + 1; |
163 | 163 | $child->update_child_levels(); |
164 | 164 | } |
@@ -48,7 +48,8 @@ |
||
48 | 48 | |
49 | 49 | } |
50 | 50 | } |
51 | - } else { |
|
51 | + } |
|
52 | + else { |
|
52 | 53 | |
53 | 54 | die( 'There is no config file in ' . THEME . ' custom/config.php' ); |
54 | 55 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | private static function get_allowed_variables() { |
18 | 18 | |
19 | - return array( 'environment', 'textdomain', 'post_types', 'taxonomies', 'post_formats', 'sidebars' ); |
|
19 | + return array('environment', 'textdomain', 'post_types', 'taxonomies', 'post_formats', 'sidebars'); |
|
20 | 20 | |
21 | 21 | } |
22 | 22 | |
@@ -27,33 +27,33 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public static function get_vars() { |
29 | 29 | |
30 | - if ( null === self::$vars ) { |
|
30 | + if (null === self::$vars) { |
|
31 | 31 | |
32 | 32 | // Check for a theme config |
33 | - $config_file = THEME_FRAMEWORK_PATH . 'config.php'; |
|
33 | + $config_file = THEME_FRAMEWORK_PATH.'config.php'; |
|
34 | 34 | |
35 | - if ( file_exists( $config_file ) ) { |
|
35 | + if (file_exists($config_file)) { |
|
36 | 36 | |
37 | - require_once THEME_FRAMEWORK_PATH . 'config.php'; |
|
37 | + require_once THEME_FRAMEWORK_PATH.'config.php'; |
|
38 | 38 | |
39 | 39 | $vars = self::get_allowed_variables(); |
40 | 40 | |
41 | - foreach ( $vars as $var ) { |
|
41 | + foreach ($vars as $var) { |
|
42 | 42 | |
43 | - if ( isset( $$var ) ) { |
|
43 | + if (isset($$var)) { |
|
44 | 44 | |
45 | - self::$vars[ $var ] = $$var; |
|
45 | + self::$vars[$var] = $$var; |
|
46 | 46 | |
47 | - unset( $$var ); // We don't require it anymore |
|
47 | + unset($$var); // We don't require it anymore |
|
48 | 48 | |
49 | 49 | } |
50 | 50 | } |
51 | 51 | } else { |
52 | 52 | |
53 | - wp_die( sprintf( |
|
53 | + wp_die(sprintf( |
|
54 | 54 | 'There is no config file in %s custom/config.php', |
55 | - esc_html( THEME ) |
|
56 | - ) ); |
|
55 | + esc_html(THEME) |
|
56 | + )); |
|
57 | 57 | |
58 | 58 | } |
59 | 59 | } |
@@ -72,16 +72,16 @@ discard block |
||
72 | 72 | $vars = self::get_vars(); |
73 | 73 | |
74 | 74 | // Init Post Types |
75 | - if ( isset( $vars['post_types'] ) ) { self::init_post_types( $vars['post_types'] ); } |
|
75 | + if (isset($vars['post_types'])) { self::init_post_types($vars['post_types']); } |
|
76 | 76 | |
77 | 77 | // Init Taxonomies |
78 | - if ( isset( $vars['taxonomies'] ) ) { self::init_taxonomies( $vars['taxonomies'] ); } |
|
78 | + if (isset($vars['taxonomies'])) { self::init_taxonomies($vars['taxonomies']); } |
|
79 | 79 | |
80 | 80 | // Init Post Formats |
81 | - if ( isset( $vars['post_formats'] ) ) { self::init_post_formats( $vars['post_formats'] ); } |
|
81 | + if (isset($vars['post_formats'])) { self::init_post_formats($vars['post_formats']); } |
|
82 | 82 | |
83 | 83 | // Init Sidebars |
84 | - if ( isset( $vars['sidebars'] ) ) { self::init_sidebars( $vars['sidebars'] ); } |
|
84 | + if (isset($vars['sidebars'])) { self::init_sidebars($vars['sidebars']); } |
|
85 | 85 | |
86 | 86 | } |
87 | 87 | |
@@ -92,13 +92,13 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @param array $post_types |
94 | 94 | */ |
95 | - private static function init_post_types( $post_types ) { |
|
95 | + private static function init_post_types($post_types) { |
|
96 | 96 | |
97 | - if ( is_array( $post_types ) ) { |
|
97 | + if (is_array($post_types)) { |
|
98 | 98 | |
99 | - foreach ( $post_types as $type => $options ) { |
|
99 | + foreach ($post_types as $type => $options) { |
|
100 | 100 | |
101 | - self::add_post_type( $type, $options['config'], $options['singular'], $options['multiple'] ); |
|
101 | + self::add_post_type($type, $options['config'], $options['singular'], $options['multiple']); |
|
102 | 102 | |
103 | 103 | } |
104 | 104 | } |
@@ -114,28 +114,28 @@ discard block |
||
114 | 114 | * @param string $singular |
115 | 115 | * @param string $multiple |
116 | 116 | */ |
117 | - private static function add_post_type( $name, $config, $singular = 'Entry', $multiple = 'Entries' ) { |
|
117 | + private static function add_post_type($name, $config, $singular = 'Entry', $multiple = 'Entries') { |
|
118 | 118 | |
119 | 119 | $domain = Classy::textdomain(); |
120 | 120 | |
121 | - if ( ! isset( $config['labels'] ) ) { |
|
121 | + if (!isset($config['labels'])) { |
|
122 | 122 | |
123 | 123 | $config['labels'] = array( |
124 | - 'name' => __( $multiple, $domain ), |
|
125 | - 'singular_name' => __( $singular, $domain ), |
|
126 | - 'not_found' => __( 'No ' . $multiple . ' Found', $domain ), |
|
127 | - 'not_found_in_trash' => __( 'No ' . $multiple . ' found in Trash', $domain ), |
|
128 | - 'edit_item' => __( 'Edit ', $singular, $domain ), |
|
129 | - 'search_items' => __( 'Search ' . $multiple, $domain ), |
|
130 | - 'view_item' => __( 'View ', $singular, $domain ), |
|
131 | - 'new_item' => __( 'New ' . $singular, $domain ), |
|
132 | - 'add_new' => __( 'Add New', $domain ), |
|
133 | - 'add_new_item' => __( 'Add New ' . $singular, $domain ), |
|
124 | + 'name' => __($multiple, $domain), |
|
125 | + 'singular_name' => __($singular, $domain), |
|
126 | + 'not_found' => __('No '.$multiple.' Found', $domain), |
|
127 | + 'not_found_in_trash' => __('No '.$multiple.' found in Trash', $domain), |
|
128 | + 'edit_item' => __('Edit ', $singular, $domain), |
|
129 | + 'search_items' => __('Search '.$multiple, $domain), |
|
130 | + 'view_item' => __('View ', $singular, $domain), |
|
131 | + 'new_item' => __('New '.$singular, $domain), |
|
132 | + 'add_new' => __('Add New', $domain), |
|
133 | + 'add_new_item' => __('Add New '.$singular, $domain), |
|
134 | 134 | ); |
135 | 135 | |
136 | 136 | } |
137 | 137 | |
138 | - register_post_type( $name, $config ); |
|
138 | + register_post_type($name, $config); |
|
139 | 139 | |
140 | 140 | } |
141 | 141 | |
@@ -144,13 +144,13 @@ discard block |
||
144 | 144 | * |
145 | 145 | * @param array $taxonomies |
146 | 146 | */ |
147 | - private static function init_taxonomies( $taxonomies ) { |
|
147 | + private static function init_taxonomies($taxonomies) { |
|
148 | 148 | |
149 | - if ( is_array( $taxonomies ) ) { |
|
149 | + if (is_array($taxonomies)) { |
|
150 | 150 | |
151 | - foreach ( $taxonomies as $type => $options ) { |
|
151 | + foreach ($taxonomies as $type => $options) { |
|
152 | 152 | |
153 | - self::add_taxonomy( $type, $options['for'], $options['config'], $options['singular'], $options['multiple'] ); |
|
153 | + self::add_taxonomy($type, $options['for'], $options['config'], $options['singular'], $options['multiple']); |
|
154 | 154 | |
155 | 155 | } |
156 | 156 | } |
@@ -166,29 +166,29 @@ discard block |
||
166 | 166 | * @param string $singular |
167 | 167 | * @param string $multiple |
168 | 168 | */ |
169 | - private static function add_taxonomy( $name, $object_type, $config, $singular = 'Entry', $multiple = 'Entries' ) { |
|
169 | + private static function add_taxonomy($name, $object_type, $config, $singular = 'Entry', $multiple = 'Entries') { |
|
170 | 170 | |
171 | 171 | $domain = Classy::textdomain(); |
172 | 172 | |
173 | - if ( ! isset( $config['labels'] ) ) { |
|
173 | + if (!isset($config['labels'])) { |
|
174 | 174 | |
175 | 175 | $config['labels'] = array( |
176 | - 'name' => __( $multiple, $domain ), |
|
177 | - 'singular_name' => __( $singular, $domain ), |
|
178 | - 'search_items' => __( 'Search ' . $multiple, $domain ), |
|
179 | - 'all_items' => __( 'All ' . $multiple, $domain ), |
|
180 | - 'parent_item' => __( 'Parent ' . $singular, $domain ), |
|
181 | - 'parent_item_colon' => __( 'Parent ' . $singular . ':', $domain ), |
|
182 | - 'edit_item' => __( 'Edit ' . $singular, $domain ), |
|
183 | - 'update_item' => __( 'Update ' . $singular, $domain ), |
|
184 | - 'add_new_item' => __( 'Add New ' . $singular, $domain ), |
|
185 | - 'new_item_name' => __( 'New ' . $singular . ' Name', $domain ), |
|
186 | - 'menu_name' => __( $singular, $domain ), |
|
176 | + 'name' => __($multiple, $domain), |
|
177 | + 'singular_name' => __($singular, $domain), |
|
178 | + 'search_items' => __('Search '.$multiple, $domain), |
|
179 | + 'all_items' => __('All '.$multiple, $domain), |
|
180 | + 'parent_item' => __('Parent '.$singular, $domain), |
|
181 | + 'parent_item_colon' => __('Parent '.$singular.':', $domain), |
|
182 | + 'edit_item' => __('Edit '.$singular, $domain), |
|
183 | + 'update_item' => __('Update '.$singular, $domain), |
|
184 | + 'add_new_item' => __('Add New '.$singular, $domain), |
|
185 | + 'new_item_name' => __('New '.$singular.' Name', $domain), |
|
186 | + 'menu_name' => __($singular, $domain), |
|
187 | 187 | ); |
188 | 188 | |
189 | 189 | } |
190 | 190 | |
191 | - register_taxonomy( $name, $object_type, $config ); |
|
191 | + register_taxonomy($name, $object_type, $config); |
|
192 | 192 | |
193 | 193 | } |
194 | 194 | |
@@ -197,11 +197,11 @@ discard block |
||
197 | 197 | * |
198 | 198 | * @param array $post_formats |
199 | 199 | */ |
200 | - private static function init_post_formats( $post_formats ) { |
|
200 | + private static function init_post_formats($post_formats) { |
|
201 | 201 | |
202 | - if ( is_array( $post_formats ) ) { |
|
202 | + if (is_array($post_formats)) { |
|
203 | 203 | |
204 | - add_theme_support( 'post-formats', $post_formats ); |
|
204 | + add_theme_support('post-formats', $post_formats); |
|
205 | 205 | |
206 | 206 | } |
207 | 207 | |
@@ -212,19 +212,19 @@ discard block |
||
212 | 212 | * |
213 | 213 | * @param array $sidebars |
214 | 214 | */ |
215 | - private static function init_sidebars( $sidebars ) { |
|
215 | + private static function init_sidebars($sidebars) { |
|
216 | 216 | |
217 | 217 | $domain = Classy::textdomain(); |
218 | 218 | |
219 | - if ( is_array( $sidebars ) ) { |
|
219 | + if (is_array($sidebars)) { |
|
220 | 220 | |
221 | - foreach ( $sidebars as $id => $title ) { |
|
221 | + foreach ($sidebars as $id => $title) { |
|
222 | 222 | |
223 | 223 | register_sidebar( |
224 | 224 | array( |
225 | 225 | 'id' => $id, |
226 | - 'name' => __( $title, $domain ), |
|
227 | - 'description' => __( $title, $domain ), |
|
226 | + 'name' => __($title, $domain), |
|
227 | + 'description' => __($title, $domain), |
|
228 | 228 | 'before_widget' => '<div id="%1$s" class="widget %2$s"><div class="widget-inner">', |
229 | 229 | 'after_widget' => '</div></div>', |
230 | 230 | 'before_title' => '<h3>', |
@@ -2,6 +2,6 @@ |
||
2 | 2 | |
3 | 3 | global $post; |
4 | 4 | |
5 | -$classypost = new ClassyPost( $post ); |
|
5 | +$classypost = new ClassyPost($post); |
|
6 | 6 | |
7 | -Classy::render( 'layout.comments', array( 'post' => $classypost ) ); |
|
7 | +Classy::render('layout.comments', array('post' => $classypost)); |
@@ -19,7 +19,8 @@ discard block |
||
19 | 19 | |
20 | 20 | $this->ID = $pid; |
21 | 21 | |
22 | - } else { |
|
22 | + } |
|
23 | + else { |
|
23 | 24 | |
24 | 25 | $this->ID = 0; |
25 | 26 | |
@@ -50,7 +51,8 @@ discard block |
||
50 | 51 | |
51 | 52 | return $thumb[0]; |
52 | 53 | |
53 | - } else { |
|
54 | + } |
|
55 | + else { |
|
54 | 56 | |
55 | 57 | return self::get_default_image(); |
56 | 58 |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | * Main constructor function. Requires image id |
13 | 13 | * @param int $pid |
14 | 14 | */ |
15 | - public function __construct( $pid = null ) { |
|
15 | + public function __construct($pid = null) { |
|
16 | 16 | |
17 | 17 | // Checks if image with this id exists |
18 | - if ( null !== $pid && wp_get_attachment_image_src( $pid ) ) { |
|
18 | + if (null !== $pid && wp_get_attachment_image_src($pid)) { |
|
19 | 19 | |
20 | 20 | $this->ID = $pid; |
21 | 21 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | public static function get_default_image() { |
34 | 34 | |
35 | 35 | // You can put here any url |
36 | - return THEME_DIR . '/assets/noimage.png'; |
|
36 | + return THEME_DIR.'/assets/noimage.png'; |
|
37 | 37 | |
38 | 38 | } |
39 | 39 | |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | * @param string $size |
43 | 43 | * @return string |
44 | 44 | */ |
45 | - public function src( $size = 'medium' ) { |
|
45 | + public function src($size = 'medium') { |
|
46 | 46 | |
47 | - if ( $this->ID ) { |
|
47 | + if ($this->ID) { |
|
48 | 48 | |
49 | - $thumb = wp_get_attachment_image_src( $this->ID, $size ); |
|
49 | + $thumb = wp_get_attachment_image_src($this->ID, $size); |
|
50 | 50 | |
51 | 51 | return $thumb[0]; |
52 | 52 |
@@ -131,7 +131,8 @@ discard block |
||
131 | 131 | * |
132 | 132 | * @param string $type view|scope |
133 | 133 | * @param string $type |
134 | - * @return array |
|
134 | + * @param string $page |
|
135 | + * @return string|false |
|
135 | 136 | */ |
136 | 137 | public static function get_available_file( $type = 'view', $page ) { |
137 | 138 | |
@@ -374,7 +375,7 @@ discard block |
||
374 | 375 | /** |
375 | 376 | * Returns classy template name or boolean if this is not classy template |
376 | 377 | * |
377 | - * @return mixed |
|
378 | + * @return string|false |
|
378 | 379 | */ |
379 | 380 | public static function get_classy_template() { |
380 | 381 |
@@ -20,39 +20,39 @@ discard block |
||
20 | 20 | */ |
21 | 21 | protected static function check_request() { |
22 | 22 | |
23 | - if ( is_404() ) : return '404'; |
|
23 | + if (is_404()) : return '404'; |
|
24 | 24 | |
25 | - elseif ( is_search() ) : return 'search'; |
|
25 | + elseif (is_search()) : return 'search'; |
|
26 | 26 | |
27 | - elseif ( is_front_page() ) : return 'front-page'; |
|
27 | + elseif (is_front_page()) : return 'front-page'; |
|
28 | 28 | |
29 | - elseif ( is_home() ) : return 'home'; |
|
29 | + elseif (is_home()) : return 'home'; |
|
30 | 30 | |
31 | - elseif ( is_post_type_archive() ) : return 'post_type_archive'; |
|
31 | + elseif (is_post_type_archive()) : return 'post_type_archive'; |
|
32 | 32 | |
33 | - elseif ( is_tax() ) : return 'taxonomy'; |
|
33 | + elseif (is_tax()) : return 'taxonomy'; |
|
34 | 34 | |
35 | - elseif ( is_attachment() ) : return 'attachment'; |
|
35 | + elseif (is_attachment()) : return 'attachment'; |
|
36 | 36 | |
37 | - elseif ( is_single() ) : return 'single'; |
|
37 | + elseif (is_single()) : return 'single'; |
|
38 | 38 | |
39 | - elseif ( self::is_classy_template() ) : return 'classy-template'; |
|
39 | + elseif (self::is_classy_template()) : return 'classy-template'; |
|
40 | 40 | |
41 | - elseif ( is_page() ) : return 'page'; |
|
41 | + elseif (is_page()) : return 'page'; |
|
42 | 42 | |
43 | - elseif ( is_singular() ) : return 'singular'; |
|
43 | + elseif (is_singular()) : return 'singular'; |
|
44 | 44 | |
45 | - elseif ( is_category() ) : return 'category'; |
|
45 | + elseif (is_category()) : return 'category'; |
|
46 | 46 | |
47 | - elseif ( is_tag() ) : return 'tag'; |
|
47 | + elseif (is_tag()) : return 'tag'; |
|
48 | 48 | |
49 | - elseif ( is_author() ) : return 'author'; |
|
49 | + elseif (is_author()) : return 'author'; |
|
50 | 50 | |
51 | - elseif ( is_date() ) : return 'date'; |
|
51 | + elseif (is_date()) : return 'date'; |
|
52 | 52 | |
53 | - elseif ( is_archive() ) : return 'archive'; |
|
53 | + elseif (is_archive()) : return 'archive'; |
|
54 | 54 | |
55 | - elseif ( is_paged() ) : return 'paged'; |
|
55 | + elseif (is_paged()) : return 'paged'; |
|
56 | 56 | |
57 | 57 | else : |
58 | 58 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public static function get_current_request() { |
71 | 71 | |
72 | - if ( null === self::$current_request ) { |
|
72 | + if (null === self::$current_request) { |
|
73 | 73 | |
74 | 74 | self::$current_request = self::check_request(); |
75 | 75 | |
@@ -87,21 +87,21 @@ discard block |
||
87 | 87 | * @param string $view path to view ex: "post/archive" |
88 | 88 | * @return string full fule path |
89 | 89 | */ |
90 | - public static function get_file_path( $type = 'view', $view ) { |
|
90 | + public static function get_file_path($type = 'view', $view) { |
|
91 | 91 | |
92 | - $view = str_replace( '.', '/', $view ); |
|
92 | + $view = str_replace('.', '/', $view); |
|
93 | 93 | |
94 | - if ( 'view' === $type ) { |
|
94 | + if ('view' === $type) { |
|
95 | 95 | |
96 | 96 | $folder = ClassyView::$folder; |
97 | 97 | |
98 | - return THEME_PATH . $folder . '/' . $view . '.blade.php'; |
|
98 | + return THEME_PATH.$folder.'/'.$view.'.blade.php'; |
|
99 | 99 | |
100 | - } elseif ( 'scope' === $type ) { |
|
100 | + } elseif ('scope' === $type) { |
|
101 | 101 | |
102 | 102 | $folder = ClassyScope::$folder; |
103 | 103 | |
104 | - return THEME_PATH . $folder . '/' . $view . '.php'; |
|
104 | + return THEME_PATH.$folder.'/'.$view.'.php'; |
|
105 | 105 | |
106 | 106 | } |
107 | 107 | |
@@ -115,13 +115,13 @@ discard block |
||
115 | 115 | * @param string $file in blade path format, ex: layout|header |
116 | 116 | * @return boolean true|false |
117 | 117 | */ |
118 | - public static function file_exists( $type = 'view', $file ) { |
|
118 | + public static function file_exists($type = 'view', $file) { |
|
119 | 119 | |
120 | - $file = str_replace( '.', '/', $file ); |
|
120 | + $file = str_replace('.', '/', $file); |
|
121 | 121 | |
122 | - $file_path = self::get_file_path( $type, $file ); |
|
122 | + $file_path = self::get_file_path($type, $file); |
|
123 | 123 | |
124 | - return file_exists( $file_path ); |
|
124 | + return file_exists($file_path); |
|
125 | 125 | |
126 | 126 | } |
127 | 127 | |
@@ -133,13 +133,13 @@ discard block |
||
133 | 133 | * @param string $type |
134 | 134 | * @return array |
135 | 135 | */ |
136 | - public static function get_available_file( $type = 'view', $page ) { |
|
136 | + public static function get_available_file($type = 'view', $page) { |
|
137 | 137 | |
138 | - $views = self::get_request_hierarchy_list( $page ); |
|
138 | + $views = self::get_request_hierarchy_list($page); |
|
139 | 139 | |
140 | - foreach ( $views as $view ) { |
|
140 | + foreach ($views as $view) { |
|
141 | 141 | |
142 | - if ( self::file_exists( $type, $view ) ) : |
|
142 | + if (self::file_exists($type, $view)) : |
|
143 | 143 | |
144 | 144 | return $view; |
145 | 145 | |
@@ -158,43 +158,43 @@ discard block |
||
158 | 158 | * @param string $type |
159 | 159 | * @return array |
160 | 160 | */ |
161 | - private static function get_request_hierarchy_list( $type ) { |
|
161 | + private static function get_request_hierarchy_list($type) { |
|
162 | 162 | |
163 | 163 | $views = array(); |
164 | 164 | |
165 | 165 | // Home |
166 | 166 | |
167 | - if ( 'home' === $type ) : |
|
167 | + if ('home' === $type) : |
|
168 | 168 | |
169 | 169 | $views[] = 'home'; |
170 | 170 | |
171 | 171 | // Single |
172 | 172 | |
173 | - elseif ( 'single' === $type ) : |
|
173 | + elseif ('single' === $type) : |
|
174 | 174 | |
175 | 175 | $post_type = get_post_type(); |
176 | 176 | |
177 | - $views[] = $post_type . '.single'; |
|
177 | + $views[] = $post_type.'.single'; |
|
178 | 178 | |
179 | 179 | $views[] = 'single'; |
180 | 180 | |
181 | 181 | // Post type |
182 | 182 | |
183 | - elseif ( 'post_type_archive' === $type ) : |
|
183 | + elseif ('post_type_archive' === $type) : |
|
184 | 184 | |
185 | 185 | $post_type = get_post_type(); |
186 | 186 | |
187 | - $views[] = $post_type . '.archive'; |
|
187 | + $views[] = $post_type.'.archive'; |
|
188 | 188 | |
189 | 189 | $views[] = 'archive'; |
190 | 190 | |
191 | 191 | // Taxonomy |
192 | 192 | |
193 | - elseif ( 'taxonomy' === $type ) : |
|
193 | + elseif ('taxonomy' === $type) : |
|
194 | 194 | |
195 | 195 | $term = get_queried_object(); |
196 | 196 | |
197 | - if ( ! empty( $term->slug ) ) { |
|
197 | + if (!empty($term->slug)) { |
|
198 | 198 | |
199 | 199 | $taxonomy = $term->taxonomy; |
200 | 200 | |
@@ -209,11 +209,11 @@ discard block |
||
209 | 209 | |
210 | 210 | // Category |
211 | 211 | |
212 | - elseif ( 'category' === $type ) : |
|
212 | + elseif ('category' === $type) : |
|
213 | 213 | |
214 | 214 | $category = get_queried_object(); |
215 | 215 | |
216 | - if ( ! empty( $category->slug ) ) { |
|
216 | + if (!empty($category->slug)) { |
|
217 | 217 | $views[] = "category.{$category->slug}"; |
218 | 218 | $views[] = "category.{$category->term_id}"; |
219 | 219 | } |
@@ -224,23 +224,23 @@ discard block |
||
224 | 224 | |
225 | 225 | // Attachment |
226 | 226 | |
227 | - elseif ( 'attachment' === $type ) : |
|
227 | + elseif ('attachment' === $type) : |
|
228 | 228 | |
229 | 229 | $attachment = get_queried_object(); |
230 | 230 | |
231 | - if ( $attachment ) { |
|
231 | + if ($attachment) { |
|
232 | 232 | |
233 | - if ( false !== strpos( $attachment->post_mime_type, '/' ) ) { |
|
233 | + if (false !== strpos($attachment->post_mime_type, '/')) { |
|
234 | 234 | |
235 | - list( $type, $subtype ) = explode( '/', $attachment->post_mime_type ); |
|
235 | + list($type, $subtype) = explode('/', $attachment->post_mime_type); |
|
236 | 236 | |
237 | 237 | } else { |
238 | 238 | |
239 | - list( $type, $subtype ) = array( $attachment->post_mime_type, '' ); |
|
239 | + list($type, $subtype) = array($attachment->post_mime_type, ''); |
|
240 | 240 | |
241 | 241 | } |
242 | 242 | |
243 | - if ( ! empty( $subtype ) ) { |
|
243 | + if (!empty($subtype)) { |
|
244 | 244 | $views[] = "attachment.{$type}.{$subtype}"; |
245 | 245 | $views[] = "attachment.{$subtype}"; |
246 | 246 | |
@@ -259,11 +259,11 @@ discard block |
||
259 | 259 | |
260 | 260 | // Tag |
261 | 261 | |
262 | - elseif ( 'tag' === $type ) : |
|
262 | + elseif ('tag' === $type) : |
|
263 | 263 | |
264 | 264 | $tag = get_queried_object(); |
265 | 265 | |
266 | - if ( ! empty( $tag->slug ) ) { |
|
266 | + if (!empty($tag->slug)) { |
|
267 | 267 | $views[] = "post.tag.{$tag->slug}"; |
268 | 268 | $views[] = "post.tag.{$tag->term_id}"; |
269 | 269 | |
@@ -276,11 +276,11 @@ discard block |
||
276 | 276 | |
277 | 277 | // Author |
278 | 278 | |
279 | - elseif ( 'author' === $type ) : |
|
279 | + elseif ('author' === $type) : |
|
280 | 280 | |
281 | 281 | $author = get_queried_object(); |
282 | 282 | |
283 | - if ( $author instanceof WP_User ) { |
|
283 | + if ($author instanceof WP_User) { |
|
284 | 284 | $views[] = "post.author.{$author->user_nicename}"; |
285 | 285 | $views[] = "post.author.{$author->ID}"; |
286 | 286 | |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | |
295 | 295 | // Front Page |
296 | 296 | |
297 | - elseif ( 'front-page' === $type ) : |
|
297 | + elseif ('front-page' === $type) : |
|
298 | 298 | |
299 | 299 | $views[] = 'front-page.front-page'; |
300 | 300 | $views[] = 'front-page'; |
@@ -302,43 +302,43 @@ discard block |
||
302 | 302 | $views[] = 'home.home'; |
303 | 303 | $views[] = 'home'; |
304 | 304 | |
305 | - $views = array_merge( $views, self::get_request_hierarchy_list( 'post_type_archive' ) ); |
|
305 | + $views = array_merge($views, self::get_request_hierarchy_list('post_type_archive')); |
|
306 | 306 | |
307 | 307 | // Page |
308 | 308 | |
309 | - elseif ( 'classy-template' === $type ) : |
|
309 | + elseif ('classy-template' === $type) : |
|
310 | 310 | |
311 | 311 | $template = self::get_classy_template(); |
312 | 312 | |
313 | 313 | $views[] = $template; |
314 | 314 | |
315 | - $views[] = 'page.' . $template; |
|
315 | + $views[] = 'page.'.$template; |
|
316 | 316 | |
317 | - $views[] = 'template.' . $template; |
|
317 | + $views[] = 'template.'.$template; |
|
318 | 318 | |
319 | 319 | $views[] = 'page'; |
320 | 320 | |
321 | - elseif ( 'page' === $type ) : |
|
321 | + elseif ('page' === $type) : |
|
322 | 322 | |
323 | 323 | $id = get_queried_object_id(); |
324 | 324 | |
325 | - $pagename = get_query_var( 'pagename' ); |
|
325 | + $pagename = get_query_var('pagename'); |
|
326 | 326 | |
327 | - if ( ! $pagename && $id ) { |
|
327 | + if (!$pagename && $id) { |
|
328 | 328 | // If a static page is set as the front page, $pagename will not be set. Retrieve it from the queried object |
329 | 329 | $post = get_queried_object(); |
330 | 330 | |
331 | - if ( $post ) { |
|
331 | + if ($post) { |
|
332 | 332 | $pagename = $post->post_name; |
333 | 333 | } |
334 | 334 | } |
335 | 335 | |
336 | - if ( $pagename ) { |
|
337 | - $views[] = 'page.' . $pagename; |
|
336 | + if ($pagename) { |
|
337 | + $views[] = 'page.'.$pagename; |
|
338 | 338 | } |
339 | 339 | |
340 | - if ( $id ) { |
|
341 | - $views[] = 'page.' . $id; |
|
340 | + if ($id) { |
|
341 | + $views[] = 'page.'.$id; |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | $views[] = 'page.page'; |
@@ -380,9 +380,9 @@ discard block |
||
380 | 380 | |
381 | 381 | $template_slug = get_page_template_slug(); |
382 | 382 | |
383 | - preg_match( '/classy\-(.*)/', $template_slug, $matches ); |
|
383 | + preg_match('/classy\-(.*)/', $template_slug, $matches); |
|
384 | 384 | |
385 | - if ( ! empty( $matches ) && isset( $matches[1] ) ) { return $matches[1]; } |
|
385 | + if (!empty($matches) && isset($matches[1])) { return $matches[1]; } |
|
386 | 386 | |
387 | 387 | return false; |
388 | 388 |
@@ -54,9 +54,11 @@ discard block |
||
54 | 54 | |
55 | 55 | elseif ( is_paged() ) : return 'paged'; |
56 | 56 | |
57 | - else : |
|
57 | + else { |
|
58 | + : |
|
58 | 59 | |
59 | 60 | return 'index'; |
61 | + } |
|
60 | 62 | |
61 | 63 | endif; |
62 | 64 | |
@@ -97,7 +99,8 @@ discard block |
||
97 | 99 | |
98 | 100 | return THEME_PATH . $folder . '/' . $view . '.blade.php'; |
99 | 101 | |
100 | - } elseif ( 'scope' === $type ) { |
|
102 | + } |
|
103 | + elseif ( 'scope' === $type ) { |
|
101 | 104 | |
102 | 105 | $folder = ClassyScope::$folder; |
103 | 106 | |
@@ -234,7 +237,8 @@ discard block |
||
234 | 237 | |
235 | 238 | list( $type, $subtype ) = explode( '/', $attachment->post_mime_type ); |
236 | 239 | |
237 | - } else { |
|
240 | + } |
|
241 | + else { |
|
238 | 242 | |
239 | 243 | list( $type, $subtype ) = array( $attachment->post_mime_type, '' ); |
240 | 244 | |
@@ -347,9 +351,11 @@ discard block |
||
347 | 351 | |
348 | 352 | // Default |
349 | 353 | |
350 | - else : |
|
354 | + else { |
|
355 | + : |
|
351 | 356 | |
352 | 357 | $views[] = $type; |
358 | + } |
|
353 | 359 | |
354 | 360 | endif; |
355 | 361 |
@@ -1,1 +1,1 @@ |
||
1 | -<?php Classy::render( 'layout.footer' ); |
|
2 | 1 | \ No newline at end of file |
2 | +<?php Classy::render('layout.footer'); |
|
3 | 3 | \ No newline at end of file |
@@ -1,1 +1,1 @@ |
||
1 | -<?php Classy::render( 'layout.header' ); |
|
2 | 1 | \ No newline at end of file |
2 | +<?php Classy::render('layout.header'); |
|
3 | 3 | \ No newline at end of file |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @param int $uid User id. |
68 | 68 | */ |
69 | - public function __construct( $uid = null ) { |
|
70 | - $this->ID = $this->verify_id( $uid ); |
|
69 | + public function __construct($uid = null) { |
|
70 | + $this->ID = $this->verify_id($uid); |
|
71 | 71 | |
72 | 72 | $this->init(); |
73 | 73 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @return int |
81 | 81 | */ |
82 | - private function verify_id( $uid ) { |
|
82 | + private function verify_id($uid) { |
|
83 | 83 | // @todo: Realize this method. |
84 | 84 | return $uid; |
85 | 85 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | private function init() { |
91 | 91 | $this->object = $this->get_object(); |
92 | 92 | |
93 | - $this->import( $this->object ); |
|
93 | + $this->import($this->object); |
|
94 | 94 | |
95 | 95 | $this->setup_user_name(); |
96 | 96 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @return object |
102 | 102 | */ |
103 | 103 | private function get_object() { |
104 | - return get_user_by( 'id', $this->ID ); |
|
104 | + return get_user_by('id', $this->ID); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | * @return string |
156 | 156 | */ |
157 | 157 | public function link() { |
158 | - if ( ! $this->link ) { |
|
159 | - $this->link = get_author_posts_url( $this->ID ); |
|
158 | + if (!$this->link) { |
|
159 | + $this->link = get_author_posts_url($this->ID); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | return $this->link; |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | */ |
168 | 168 | private function setup_user_name() { |
169 | 169 | $this->name = 'Anonymous'; |
170 | - if ( isset( $this->object->first_name ) && isset( $this->object->last_name ) ) { |
|
171 | - $this->name = $this->object->first_name . ' ' . $this->object->last_name; |
|
170 | + if (isset($this->object->first_name) && isset($this->object->last_name)) { |
|
171 | + $this->name = $this->object->first_name.' '.$this->object->last_name; |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | $this->display_name = $this->object->display_name; |