@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | * @return boolean |
111 | 111 | */ |
112 | 112 | public function can_edit() { |
113 | - if ( !function_exists( 'current_user_can' ) ) { |
|
113 | + if (!function_exists('current_user_can')) { |
|
114 | 114 | return false; |
115 | 115 | } |
116 | - if ( current_user_can( 'edit_post', $this->ID ) ) { |
|
116 | + if (current_user_can('edit_post', $this->ID)) { |
|
117 | 117 | return true; |
118 | 118 | } |
119 | 119 | return false; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @return string |
126 | 126 | */ |
127 | 127 | public function get_edit_url() { |
128 | - if ( $this->can_edit() ) { |
|
128 | + if ($this->can_edit()) { |
|
129 | 129 | return get_edit_post_link($this->ID); |
130 | 130 | } |
131 | 131 | } |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | * @return ClassyImage |
138 | 138 | */ |
139 | 139 | public function get_thumbnail() { |
140 | - if ( function_exists('get_post_thumbnail_id') ) { |
|
140 | + if (function_exists('get_post_thumbnail_id')) { |
|
141 | 141 | $image_id = get_post_thumbnail_id($this->ID); |
142 | 142 | |
143 | - if ( $image_id ) { |
|
143 | + if ($image_id) { |
|
144 | 144 | return new ClassyImage($image_id); |
145 | 145 | } |
146 | 146 | } |
@@ -172,19 +172,19 @@ discard block |
||
172 | 172 | * @param integer $page Page number, in case our post has <!--nextpage--> tags |
173 | 173 | * @return string Post content |
174 | 174 | */ |
175 | - public function get_content( $page = 0 ) { |
|
176 | - if ( $page == 0 && $this->post_content ) { |
|
175 | + public function get_content($page = 0) { |
|
176 | + if ($page == 0 && $this->post_content) { |
|
177 | 177 | return $this->post_content; |
178 | 178 | } |
179 | 179 | |
180 | 180 | $content = $this->post_content; |
181 | 181 | |
182 | - if ( $page ) { |
|
182 | + if ($page) { |
|
183 | 183 | $contents = explode('<!--nextpage-->', $content); |
184 | 184 | |
185 | 185 | $page--; |
186 | 186 | |
187 | - if ( count($contents) > $page ) { |
|
187 | + if (count($contents) > $page) { |
|
188 | 188 | $content = $contents[$page]; |
189 | 189 | } |
190 | 190 | } |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * @return string |
220 | 220 | */ |
221 | 221 | public function get_permalink() { |
222 | - if ( isset($this->permalink) ) { |
|
222 | + if (isset($this->permalink)) { |
|
223 | 223 | return $this->permalink; |
224 | 224 | } |
225 | 225 | |
@@ -253,9 +253,9 @@ discard block |
||
253 | 253 | $text = ''; |
254 | 254 | $trimmed = false; |
255 | 255 | |
256 | - if ( isset($this->post_excerpt) && strlen($this->post_excerpt) ) { |
|
256 | + if (isset($this->post_excerpt) && strlen($this->post_excerpt)) { |
|
257 | 257 | |
258 | - if ( $force ) { |
|
258 | + if ($force) { |
|
259 | 259 | $text = ClassyHelper::trim_words($this->post_excerpt, $len, false); |
260 | 260 | $trimmed = true; |
261 | 261 | } else { |
@@ -264,65 +264,65 @@ discard block |
||
264 | 264 | |
265 | 265 | } |
266 | 266 | |
267 | - if ( !strlen($text) && preg_match('/<!--\s?more(.*?)?-->/', $this->post_content, $readmore_matches) ) { |
|
267 | + if (!strlen($text) && preg_match('/<!--\s?more(.*?)?-->/', $this->post_content, $readmore_matches)) { |
|
268 | 268 | |
269 | 269 | $pieces = explode($readmore_matches[0], $this->post_content); |
270 | 270 | $text = $pieces[0]; |
271 | 271 | |
272 | - if ( $force ) { |
|
272 | + if ($force) { |
|
273 | 273 | $text = ClassyHelper::trim_words($text, $len, false); |
274 | 274 | $trimmed = true; |
275 | 275 | } |
276 | 276 | |
277 | - $text = do_shortcode( $text ); |
|
277 | + $text = do_shortcode($text); |
|
278 | 278 | |
279 | 279 | } |
280 | 280 | |
281 | - if ( !strlen($text) ) { |
|
281 | + if (!strlen($text)) { |
|
282 | 282 | |
283 | 283 | $text = ClassyHelper::trim_words($this->get_content(), $len, false); |
284 | 284 | $trimmed = true; |
285 | 285 | |
286 | 286 | } |
287 | 287 | |
288 | - if ( !strlen(trim($text)) ) { |
|
288 | + if (!strlen(trim($text))) { |
|
289 | 289 | |
290 | 290 | return trim($text); |
291 | 291 | |
292 | 292 | } |
293 | 293 | |
294 | - if ( $strip ) { |
|
294 | + if ($strip) { |
|
295 | 295 | |
296 | 296 | $text = trim(strip_tags($text)); |
297 | 297 | |
298 | 298 | } |
299 | 299 | |
300 | - if ( strlen($text) ) { |
|
300 | + if (strlen($text)) { |
|
301 | 301 | |
302 | 302 | $text = trim($text); |
303 | 303 | $last = $text[strlen($text) - 1]; |
304 | 304 | |
305 | - if ( $last != '.' && $trimmed ) { |
|
305 | + if ($last != '.' && $trimmed) { |
|
306 | 306 | $text .= ' … '; |
307 | 307 | } |
308 | 308 | |
309 | - if ( !$strip ) { |
|
309 | + if (!$strip) { |
|
310 | 310 | $last_p_tag = strrpos($text, '</p>'); |
311 | - if ( $last_p_tag !== false ) { |
|
311 | + if ($last_p_tag !== false) { |
|
312 | 312 | $text = substr($text, 0, $last_p_tag); |
313 | 313 | } |
314 | - if ( $last != '.' && $trimmed ) { |
|
314 | + if ($last != '.' && $trimmed) { |
|
315 | 315 | $text .= ' … '; |
316 | 316 | } |
317 | 317 | } |
318 | 318 | |
319 | - if ( $readmore && isset($readmore_matches) && !empty($readmore_matches[1]) ) { |
|
320 | - $text .= ' <a href="' . $this->get_permalink() . '" class="read-more">' . trim($readmore_matches[1]) . '</a>'; |
|
321 | - } elseif ( $readmore ) { |
|
322 | - $text .= ' <a href="' . $this->get_permalink() . '" class="read-more">' . trim($readmore) . '</a>'; |
|
319 | + if ($readmore && isset($readmore_matches) && !empty($readmore_matches[1])) { |
|
320 | + $text .= ' <a href="'.$this->get_permalink().'" class="read-more">'.trim($readmore_matches[1]).'</a>'; |
|
321 | + } elseif ($readmore) { |
|
322 | + $text .= ' <a href="'.$this->get_permalink().'" class="read-more">'.trim($readmore).'</a>'; |
|
323 | 323 | } |
324 | 324 | |
325 | - if ( !$strip ) { |
|
325 | + if (!$strip) { |
|
326 | 326 | $text .= '</p>'; |
327 | 327 | } |
328 | 328 |
@@ -9,13 +9,13 @@ discard block |
||
9 | 9 | |
10 | 10 | public function __construct() { |
11 | 11 | |
12 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) ); |
|
12 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_styles')); |
|
13 | 13 | |
14 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); |
|
14 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts')); |
|
15 | 15 | |
16 | - add_action( 'wp_print_scripts', array($this, 'init_js_vars') ); |
|
16 | + add_action('wp_print_scripts', array($this, 'init_js_vars')); |
|
17 | 17 | |
18 | - add_action( 'after_setup_theme', array($this, 'setup_theme') ); |
|
18 | + add_action('after_setup_theme', array($this, 'setup_theme')); |
|
19 | 19 | |
20 | 20 | } |
21 | 21 | |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function enqueue_styles() { |
26 | 26 | |
27 | - wp_register_style( 'flotheme_general_css', THEME_DIR . 'assets/css/general.css', array(), THEME_VERSION, 'all' ); |
|
27 | + wp_register_style('flotheme_general_css', THEME_DIR.'assets/css/general.css', array(), THEME_VERSION, 'all'); |
|
28 | 28 | |
29 | - wp_enqueue_style( 'flotheme_general_css' ); |
|
29 | + wp_enqueue_style('flotheme_general_css'); |
|
30 | 30 | |
31 | 31 | } |
32 | 32 | |
@@ -35,27 +35,27 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function enqueue_scripts() { |
37 | 37 | |
38 | - wp_deregister_script( 'jquery' ); |
|
38 | + wp_deregister_script('jquery'); |
|
39 | 39 | |
40 | - wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js', array(), THEME_VERSION, true ); |
|
40 | + wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js', array(), THEME_VERSION, true); |
|
41 | 41 | |
42 | - if ( Classy::get_config_var('environment') == 'production' ) { |
|
42 | + if (Classy::get_config_var('environment') == 'production') { |
|
43 | 43 | |
44 | - wp_register_script( 'theme_plugins', THEME_DIR . 'assets/js/min/production.js', array( 'jquery' ), THEME_VERSION, true ); |
|
44 | + wp_register_script('theme_plugins', THEME_DIR.'assets/js/min/production.js', array('jquery'), THEME_VERSION, true); |
|
45 | 45 | |
46 | 46 | } else { |
47 | 47 | |
48 | - wp_register_script( 'theme_plugins', THEME_DIR . 'assets/js/plugins.js', array( 'jquery' ), THEME_VERSION, true ); |
|
48 | + wp_register_script('theme_plugins', THEME_DIR.'assets/js/plugins.js', array('jquery'), THEME_VERSION, true); |
|
49 | 49 | |
50 | - wp_register_script( 'theme_scripts', THEME_DIR . 'assets/js/scripts.js', array( 'jquery' ), THEME_VERSION, true ); |
|
50 | + wp_register_script('theme_scripts', THEME_DIR.'assets/js/scripts.js', array('jquery'), THEME_VERSION, true); |
|
51 | 51 | |
52 | 52 | } |
53 | 53 | |
54 | - wp_enqueue_script( 'theme_plugins' ); |
|
54 | + wp_enqueue_script('theme_plugins'); |
|
55 | 55 | |
56 | - wp_enqueue_script( 'theme_scripts' ); |
|
56 | + wp_enqueue_script('theme_scripts'); |
|
57 | 57 | |
58 | - wp_enqueue_script( 'theme_production' ); |
|
58 | + wp_enqueue_script('theme_production'); |
|
59 | 59 | |
60 | 60 | } |
61 | 61 |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | global $wp_query; |
40 | 40 | |
41 | - $query =& $wp_query; |
|
41 | + $query = & $wp_query; |
|
42 | 42 | |
43 | 43 | $query = self::handle_maybe_custom_posts_page($query); |
44 | 44 | |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | * @param object $query WP_Query |
53 | 53 | * @return object WP_Query |
54 | 54 | */ |
55 | - private static function handle_maybe_custom_posts_page( $query ) { |
|
55 | + private static function handle_maybe_custom_posts_page($query) { |
|
56 | 56 | |
57 | 57 | if ($custom_posts_page = get_option('page_for_posts')) { |
58 | 58 | |
59 | - if ( isset($query->query['p']) && $query->query['p'] == $custom_posts_page ) { |
|
59 | + if (isset($query->query['p']) && $query->query['p'] == $custom_posts_page) { |
|
60 | 60 | |
61 | 61 | return new WP_Query(array('post_type' => 'post')); |
62 | 62 |
@@ -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,14 +27,14 @@ 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 | 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 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | } else { |
54 | 54 | |
55 | - die('There is no config file in ' . THEME . ' custom/config.php'); |
|
55 | + die('There is no config file in '.THEME.' custom/config.php'); |
|
56 | 56 | |
57 | 57 | } |
58 | 58 | |
@@ -73,16 +73,16 @@ discard block |
||
73 | 73 | $vars = self::get_vars(); |
74 | 74 | |
75 | 75 | // Init Post Types |
76 | - if (isset($vars['post_types'])) self::init_post_types( $vars['post_types'] ); |
|
76 | + if (isset($vars['post_types'])) self::init_post_types($vars['post_types']); |
|
77 | 77 | |
78 | 78 | // Init Taxonomies |
79 | - if (isset($vars['taxonomies'])) self::init_taxonomies( $vars['taxonomies'] ); |
|
79 | + if (isset($vars['taxonomies'])) self::init_taxonomies($vars['taxonomies']); |
|
80 | 80 | |
81 | 81 | // Init Post Formats |
82 | - if (isset($vars['post_formats'])) self::init_post_formats( $vars['post_formats'] ); |
|
82 | + if (isset($vars['post_formats'])) self::init_post_formats($vars['post_formats']); |
|
83 | 83 | |
84 | 84 | // Init Sidebars |
85 | - if (isset($vars['sidebars'])) self::init_sidebars( $vars['sidebars'] ); |
|
85 | + if (isset($vars['sidebars'])) self::init_sidebars($vars['sidebars']); |
|
86 | 86 | |
87 | 87 | } |
88 | 88 | |
@@ -93,13 +93,13 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @param array $post_types |
95 | 95 | */ |
96 | - private static function init_post_types( $post_types ) { |
|
96 | + private static function init_post_types($post_types) { |
|
97 | 97 | |
98 | 98 | if (is_array($post_types)) { |
99 | 99 | |
100 | - foreach ( $post_types as $type => $options ) { |
|
100 | + foreach ($post_types as $type => $options) { |
|
101 | 101 | |
102 | - self::add_post_type( $type, $options['config'], $options['singular'], $options['multiple'] ); |
|
102 | + self::add_post_type($type, $options['config'], $options['singular'], $options['multiple']); |
|
103 | 103 | |
104 | 104 | } |
105 | 105 | |
@@ -116,23 +116,23 @@ discard block |
||
116 | 116 | * @param string $singular |
117 | 117 | * @param string $multiple |
118 | 118 | */ |
119 | - private static function add_post_type( $name, $config, $singular = 'Entry', $multiple = 'Entries' ) { |
|
119 | + private static function add_post_type($name, $config, $singular = 'Entry', $multiple = 'Entries') { |
|
120 | 120 | |
121 | 121 | $domain = Classy::textdomain(); |
122 | 122 | |
123 | - if ( !isset($config['labels']) ) { |
|
123 | + if (!isset($config['labels'])) { |
|
124 | 124 | |
125 | 125 | $config['labels'] = array( |
126 | 126 | 'name' => __($multiple, $domain), |
127 | 127 | 'singular_name' => __($singular, $domain), |
128 | - 'not_found'=> __('No ' . $multiple . ' Found', $domain), |
|
129 | - 'not_found_in_trash'=> __('No ' . $multiple . ' found in Trash', $domain), |
|
128 | + 'not_found'=> __('No '.$multiple.' Found', $domain), |
|
129 | + 'not_found_in_trash'=> __('No '.$multiple.' found in Trash', $domain), |
|
130 | 130 | 'edit_item' => __('Edit ', $singular, $domain), |
131 | - 'search_items' => __('Search ' . $multiple, $domain), |
|
131 | + 'search_items' => __('Search '.$multiple, $domain), |
|
132 | 132 | 'view_item' => __('View ', $singular, $domain), |
133 | - 'new_item' => __('New ' . $singular, $domain), |
|
133 | + 'new_item' => __('New '.$singular, $domain), |
|
134 | 134 | 'add_new' => __('Add New', $domain), |
135 | - 'add_new_item' => __('Add New ' . $singular, $domain), |
|
135 | + 'add_new_item' => __('Add New '.$singular, $domain), |
|
136 | 136 | ); |
137 | 137 | |
138 | 138 | } |
@@ -146,13 +146,13 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @param array $taxonomies |
148 | 148 | */ |
149 | - private static function init_taxonomies( $taxonomies ) { |
|
149 | + private static function init_taxonomies($taxonomies) { |
|
150 | 150 | |
151 | 151 | if (is_array($taxonomies)) { |
152 | 152 | |
153 | - foreach ( $taxonomies as $type => $options ) { |
|
153 | + foreach ($taxonomies as $type => $options) { |
|
154 | 154 | |
155 | - self::add_taxonomy( $type, $options['for'], $options['config'], $options['singular'], $options['multiple'] ); |
|
155 | + self::add_taxonomy($type, $options['for'], $options['config'], $options['singular'], $options['multiple']); |
|
156 | 156 | |
157 | 157 | } |
158 | 158 | |
@@ -170,23 +170,23 @@ discard block |
||
170 | 170 | * @param string $singular |
171 | 171 | * @param string $multiple |
172 | 172 | */ |
173 | - private static function add_taxonomy( $name, $object_type, $config, $singular = 'Entry', $multiple = 'Entries' ) { |
|
173 | + private static function add_taxonomy($name, $object_type, $config, $singular = 'Entry', $multiple = 'Entries') { |
|
174 | 174 | |
175 | 175 | $domain = Classy::textdomain(); |
176 | 176 | |
177 | - if ( !isset($config['labels']) ) { |
|
177 | + if (!isset($config['labels'])) { |
|
178 | 178 | |
179 | 179 | $config['labels'] = array( |
180 | 180 | 'name' => __($multiple, $domain), |
181 | 181 | 'singular_name' => __($singular, $domain), |
182 | - 'search_items' => __('Search ' . $multiple, $domain), |
|
183 | - 'all_items' => __('All ' . $multiple, $domain), |
|
184 | - 'parent_item' => __('Parent ' . $singular, $domain), |
|
185 | - 'parent_item_colon' => __('Parent ' . $singular . ':', $domain), |
|
186 | - 'edit_item' => __('Edit ' . $singular, $domain), |
|
187 | - 'update_item' => __('Update ' . $singular, $domain), |
|
188 | - 'add_new_item' => __('Add New ' . $singular, $domain), |
|
189 | - 'new_item_name' => __('New ' . $singular . ' Name', $domain), |
|
182 | + 'search_items' => __('Search '.$multiple, $domain), |
|
183 | + 'all_items' => __('All '.$multiple, $domain), |
|
184 | + 'parent_item' => __('Parent '.$singular, $domain), |
|
185 | + 'parent_item_colon' => __('Parent '.$singular.':', $domain), |
|
186 | + 'edit_item' => __('Edit '.$singular, $domain), |
|
187 | + 'update_item' => __('Update '.$singular, $domain), |
|
188 | + 'add_new_item' => __('Add New '.$singular, $domain), |
|
189 | + 'new_item_name' => __('New '.$singular.' Name', $domain), |
|
190 | 190 | 'menu_name' => __($singular, $domain), |
191 | 191 | ); |
192 | 192 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * |
203 | 203 | * @param array $post_formats |
204 | 204 | */ |
205 | - private static function init_post_formats( $post_formats ) { |
|
205 | + private static function init_post_formats($post_formats) { |
|
206 | 206 | |
207 | 207 | if (is_array($post_formats)) { |
208 | 208 | |
@@ -218,13 +218,13 @@ discard block |
||
218 | 218 | * |
219 | 219 | * @param array $sidebars |
220 | 220 | */ |
221 | - private static function init_sidebars( $sidebars ) { |
|
221 | + private static function init_sidebars($sidebars) { |
|
222 | 222 | |
223 | 223 | $domain = Classy::textdomain(); |
224 | 224 | |
225 | 225 | if (is_array($sidebars)) { |
226 | 226 | |
227 | - foreach ( $sidebars as $id => $title ) { |
|
227 | + foreach ($sidebars as $id => $title) { |
|
228 | 228 | |
229 | 229 | register_sidebar( |
230 | 230 | array( |
@@ -14,21 +14,21 @@ |
||
14 | 14 | */ |
15 | 15 | protected function import($data) { |
16 | 16 | |
17 | - if ( is_object( $data ) ) { |
|
17 | + if (is_object($data)) { |
|
18 | 18 | |
19 | - $data = get_object_vars( $data ); |
|
19 | + $data = get_object_vars($data); |
|
20 | 20 | |
21 | 21 | } |
22 | 22 | |
23 | - if ( is_array( $data ) ) { |
|
23 | + if (is_array($data)) { |
|
24 | 24 | |
25 | - foreach ( $data as $key => $value ) { |
|
25 | + foreach ($data as $key => $value) { |
|
26 | 26 | |
27 | - if ( !empty( $key ) ) { |
|
27 | + if (!empty($key)) { |
|
28 | 28 | |
29 | 29 | $this->$key = $value; |
30 | 30 | |
31 | - } else if ( !empty( $key ) && !method_exists($this, $key) ){ |
|
31 | + } else if (!empty($key) && !method_exists($this, $key)) { |
|
32 | 32 | |
33 | 33 | $this->$key = $value; |
34 | 34 |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public static function get_common_scope() { |
55 | 55 | |
56 | - if ( null === self::$common ) { |
|
56 | + if (null === self::$common) { |
|
57 | 57 | |
58 | 58 | self::$common = self::require_scope('common'); |
59 | 59 | |
@@ -73,15 +73,15 @@ discard block |
||
73 | 73 | |
74 | 74 | $return = array(); |
75 | 75 | |
76 | - $file = THEME_PATH . 'scope/' . $filename . '.php'; |
|
76 | + $file = THEME_PATH.'scope/'.$filename.'.php'; |
|
77 | 77 | |
78 | - if ( file_exists($file) ) { |
|
78 | + if (file_exists($file)) { |
|
79 | 79 | |
80 | 80 | require $file; |
81 | 81 | |
82 | 82 | } |
83 | 83 | |
84 | - if ( isset($data) ) { |
|
84 | + if (isset($data)) { |
|
85 | 85 | |
86 | 86 | $return = $data; |
87 | 87 |
@@ -15,44 +15,44 @@ discard block |
||
15 | 15 | * @param string $allowed_tags |
16 | 16 | * @return string |
17 | 17 | */ |
18 | - public static function trim_words( $text, $num_words = 55, $more = null, $allowed_tags = 'p a span b i br blockquote' ) { |
|
19 | - if ( null === $more ) { |
|
20 | - $more = __( '…' ); |
|
18 | + public static function trim_words($text, $num_words = 55, $more = null, $allowed_tags = 'p a span b i br blockquote') { |
|
19 | + if (null === $more) { |
|
20 | + $more = __('…'); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | $original_text = $text; |
24 | 24 | $allowed_tag_string = ''; |
25 | 25 | |
26 | - foreach ( explode( ' ', $allowed_tags ) as $tag ) { |
|
27 | - $allowed_tag_string .= '<' . $tag . '>'; |
|
26 | + foreach (explode(' ', $allowed_tags) as $tag) { |
|
27 | + $allowed_tag_string .= '<'.$tag.'>'; |
|
28 | 28 | } |
29 | 29 | |
30 | - $text = strip_tags( $text, $allowed_tag_string ); |
|
30 | + $text = strip_tags($text, $allowed_tag_string); |
|
31 | 31 | |
32 | 32 | /* translators: If your word count is based on single characters (East Asian characters), |
33 | 33 | enter 'characters'. Otherwise, enter 'words'. Do not translate into your own language. */ |
34 | 34 | |
35 | - if ( 'characters' == _x( 'words', 'word count: words or characters?' ) && preg_match( '/^utf\-?8$/i', get_option( 'blog_charset' ) ) ) { |
|
36 | - $text = trim( preg_replace( "/[\n\r\t ]+/", ' ', $text ), ' ' ); |
|
37 | - preg_match_all( '/./u', $text, $words_array ); |
|
38 | - $words_array = array_slice( $words_array[0], 0, $num_words + 1 ); |
|
35 | + if ('characters' == _x('words', 'word count: words or characters?') && preg_match('/^utf\-?8$/i', get_option('blog_charset'))) { |
|
36 | + $text = trim(preg_replace("/[\n\r\t ]+/", ' ', $text), ' '); |
|
37 | + preg_match_all('/./u', $text, $words_array); |
|
38 | + $words_array = array_slice($words_array[0], 0, $num_words + 1); |
|
39 | 39 | $sep = ''; |
40 | 40 | } else { |
41 | - $words_array = preg_split( "/[\n\r\t ]+/", $text, $num_words + 1, PREG_SPLIT_NO_EMPTY ); |
|
41 | + $words_array = preg_split("/[\n\r\t ]+/", $text, $num_words + 1, PREG_SPLIT_NO_EMPTY); |
|
42 | 42 | $sep = ' '; |
43 | 43 | } |
44 | 44 | |
45 | - if ( count( $words_array ) > $num_words ) { |
|
46 | - array_pop( $words_array ); |
|
47 | - $text = implode( $sep, $words_array ); |
|
48 | - $text = $text . $more; |
|
45 | + if (count($words_array) > $num_words) { |
|
46 | + array_pop($words_array); |
|
47 | + $text = implode($sep, $words_array); |
|
48 | + $text = $text.$more; |
|
49 | 49 | } else { |
50 | - $text = implode( $sep, $words_array ); |
|
50 | + $text = implode($sep, $words_array); |
|
51 | 51 | } |
52 | 52 | |
53 | - $text = self::close_tags( $text ); |
|
53 | + $text = self::close_tags($text); |
|
54 | 54 | |
55 | - return apply_filters( 'wp_trim_words', $text, $num_words, $more, $original_text ); |
|
55 | + return apply_filters('wp_trim_words', $text, $num_words, $more, $original_text); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | |
@@ -62,36 +62,36 @@ discard block |
||
62 | 62 | * @param string $html |
63 | 63 | * @return string |
64 | 64 | */ |
65 | - public static function close_tags( $html ) { |
|
65 | + public static function close_tags($html) { |
|
66 | 66 | //put all opened tags into an array |
67 | - preg_match_all( '#<([a-z]+)(?: .*)?(?<![/|/ ])>#iU', $html, $result ); |
|
67 | + preg_match_all('#<([a-z]+)(?: .*)?(?<![/|/ ])>#iU', $html, $result); |
|
68 | 68 | |
69 | 69 | $openedtags = $result[1]; |
70 | 70 | |
71 | 71 | //put all closed tags into an array |
72 | - preg_match_all( '#</([a-z]+)>#iU', $html, $result ); |
|
72 | + preg_match_all('#</([a-z]+)>#iU', $html, $result); |
|
73 | 73 | |
74 | 74 | $closedtags = $result[1]; |
75 | - $len_opened = count( $openedtags ); |
|
75 | + $len_opened = count($openedtags); |
|
76 | 76 | |
77 | 77 | // all tags are closed |
78 | - if ( count( $closedtags ) == $len_opened ) { |
|
78 | + if (count($closedtags) == $len_opened) { |
|
79 | 79 | return $html; |
80 | 80 | } |
81 | 81 | |
82 | - $openedtags = array_reverse( $openedtags ); |
|
82 | + $openedtags = array_reverse($openedtags); |
|
83 | 83 | |
84 | 84 | // close tags |
85 | - for ( $i = 0; $i < $len_opened; $i++ ) { |
|
86 | - if ( !in_array( $openedtags[$i], $closedtags ) ) { |
|
87 | - $html .= '</' . $openedtags[$i] . '>'; |
|
85 | + for ($i = 0; $i < $len_opened; $i++) { |
|
86 | + if (!in_array($openedtags[$i], $closedtags)) { |
|
87 | + $html .= '</'.$openedtags[$i].'>'; |
|
88 | 88 | } else { |
89 | - unset( $closedtags[array_search( $openedtags[$i], $closedtags )] ); |
|
89 | + unset($closedtags[array_search($openedtags[$i], $closedtags)]); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
93 | - $html = str_replace(array('</br>','</hr>','</wbr>'), '', $html); |
|
94 | - $html = str_replace(array('<br>','<hr>','<wbr>'), array('<br />','<hr />','<wbr />'), $html); |
|
93 | + $html = str_replace(array('</br>', '</hr>', '</wbr>'), '', $html); |
|
94 | + $html = str_replace(array('<br>', '<hr>', '<wbr>'), array('<br />', '<hr />', '<wbr />'), $html); |
|
95 | 95 | |
96 | 96 | return $html; |
97 | 97 | } |
@@ -101,14 +101,14 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @param mixed $arg |
103 | 103 | */ |
104 | - public static function error_log( $arg ) { |
|
105 | - if ( !WP_DEBUG ) { |
|
104 | + public static function error_log($arg) { |
|
105 | + if (!WP_DEBUG) { |
|
106 | 106 | return; |
107 | 107 | } |
108 | - if ( is_object( $arg ) || is_array( $arg ) ) { |
|
109 | - $arg = print_r( $arg, true ); |
|
108 | + if (is_object($arg) || is_array($arg)) { |
|
109 | + $arg = print_r($arg, true); |
|
110 | 110 | } |
111 | - return error_log( $arg ); |
|
111 | + return error_log($arg); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @param string $args |
118 | 118 | * @return array |
119 | 119 | */ |
120 | - public static function paginate_links( $args = '' ) { |
|
120 | + public static function paginate_links($args = '') { |
|
121 | 121 | $defaults = array( |
122 | 122 | 'base' => '%_%', // http://example.com/all_posts.php%_% : %_% is replaced by format (below) |
123 | 123 | 'format' => '?page=%#%', // ?page=%#% : %#% is replaced by the page number |
@@ -125,43 +125,43 @@ discard block |
||
125 | 125 | 'current' => 0, |
126 | 126 | 'show_all' => false, |
127 | 127 | 'prev_next' => true, |
128 | - 'prev_text' => __( '« Previous' ), |
|
129 | - 'next_text' => __( 'Next »' ), |
|
128 | + 'prev_text' => __('« Previous'), |
|
129 | + 'next_text' => __('Next »'), |
|
130 | 130 | 'end_size' => 1, |
131 | 131 | 'mid_size' => 2, |
132 | 132 | 'type' => 'array', |
133 | 133 | 'add_args' => false, // array of query args to add |
134 | 134 | 'add_fragment' => '' |
135 | 135 | ); |
136 | - $args = wp_parse_args( $args, $defaults ); |
|
136 | + $args = wp_parse_args($args, $defaults); |
|
137 | 137 | // Who knows what else people pass in $args |
138 | - $args['total'] = intval( (int)$args['total'] ); |
|
139 | - if ( $args['total'] < 2 ) { |
|
138 | + $args['total'] = intval((int) $args['total']); |
|
139 | + if ($args['total'] < 2) { |
|
140 | 140 | return array(); |
141 | 141 | } |
142 | - $args['current'] = (int)$args['current']; |
|
143 | - $args['end_size'] = 0 < (int)$args['end_size'] ? (int)$args['end_size'] : 1; // Out of bounds? Make it the default. |
|
144 | - $args['mid_size'] = 0 <= (int)$args['mid_size'] ? (int)$args['mid_size'] : 2; |
|
145 | - $args['add_args'] = is_array( $args['add_args'] ) ? $args['add_args'] : false; |
|
142 | + $args['current'] = (int) $args['current']; |
|
143 | + $args['end_size'] = 0 < (int) $args['end_size'] ? (int) $args['end_size'] : 1; // Out of bounds? Make it the default. |
|
144 | + $args['mid_size'] = 0 <= (int) $args['mid_size'] ? (int) $args['mid_size'] : 2; |
|
145 | + $args['add_args'] = is_array($args['add_args']) ? $args['add_args'] : false; |
|
146 | 146 | $page_links = array(); |
147 | 147 | $dots = false; |
148 | - if ( $args['prev_next'] && $args['current'] && 1 < $args['current'] ) { |
|
149 | - $link = str_replace( '%_%', 2 == $args['current'] ? '' : $args['format'], $args['base'] ); |
|
150 | - $link = str_replace( '%#%', $args['current'] - 1, $link ); |
|
151 | - if ( $args['add_args'] ) { |
|
152 | - $link = add_query_arg( $args['add_args'], $link ); |
|
148 | + if ($args['prev_next'] && $args['current'] && 1 < $args['current']) { |
|
149 | + $link = str_replace('%_%', 2 == $args['current'] ? '' : $args['format'], $args['base']); |
|
150 | + $link = str_replace('%#%', $args['current'] - 1, $link); |
|
151 | + if ($args['add_args']) { |
|
152 | + $link = add_query_arg($args['add_args'], $link); |
|
153 | 153 | } |
154 | 154 | $link .= $args['add_fragment']; |
155 | - $link = untrailingslashit( $link ); |
|
155 | + $link = untrailingslashit($link); |
|
156 | 156 | $page_links[] = array( |
157 | 157 | 'class' => 'prev page-numbers', |
158 | - 'link' => esc_url( apply_filters( 'paginate_links', $link ) ), |
|
158 | + 'link' => esc_url(apply_filters('paginate_links', $link)), |
|
159 | 159 | 'title' => $args['prev_text'] |
160 | 160 | ); |
161 | 161 | } |
162 | - for ( $n = 1; $n <= $args['total']; $n++ ) { |
|
163 | - $n_display = number_format_i18n( $n ); |
|
164 | - if ( $n == $args['current'] ) { |
|
162 | + for ($n = 1; $n <= $args['total']; $n++) { |
|
163 | + $n_display = number_format_i18n($n); |
|
164 | + if ($n == $args['current']) { |
|
165 | 165 | $page_links[] = array( |
166 | 166 | 'class' => 'page-number page-numbers current', |
167 | 167 | 'title' => $n_display, |
@@ -171,42 +171,42 @@ discard block |
||
171 | 171 | ); |
172 | 172 | $dots = true; |
173 | 173 | } else { |
174 | - if ( $args['show_all'] || ( $n <= $args['end_size'] || ( $args['current'] && $n >= $args['current'] - $args['mid_size'] && $n <= $args['current'] + $args['mid_size'] ) || $n > $args['total'] - $args['end_size'] ) ) { |
|
175 | - $link = str_replace( '%_%', 1 == $n ? '' : $args['format'], $args['base'] ); |
|
176 | - $link = str_replace( '%#%', $n, $link ); |
|
177 | - $link = trailingslashit( $link ) . ltrim( $args['add_fragment'], '/' ); |
|
178 | - if ( $args['add_args'] ) { |
|
179 | - $link = rtrim( add_query_arg( $args['add_args'], $link ), '/' ); |
|
174 | + if ($args['show_all'] || ($n <= $args['end_size'] || ($args['current'] && $n >= $args['current'] - $args['mid_size'] && $n <= $args['current'] + $args['mid_size']) || $n > $args['total'] - $args['end_size'])) { |
|
175 | + $link = str_replace('%_%', 1 == $n ? '' : $args['format'], $args['base']); |
|
176 | + $link = str_replace('%#%', $n, $link); |
|
177 | + $link = trailingslashit($link).ltrim($args['add_fragment'], '/'); |
|
178 | + if ($args['add_args']) { |
|
179 | + $link = rtrim(add_query_arg($args['add_args'], $link), '/'); |
|
180 | 180 | } |
181 | 181 | $link = str_replace(' ', '+', $link); |
182 | - $link = untrailingslashit( $link ); |
|
182 | + $link = untrailingslashit($link); |
|
183 | 183 | $page_links[] = array( |
184 | 184 | 'class' => 'page-number page-numbers', |
185 | - 'link' => esc_url( apply_filters( 'paginate_links', $link ) ), |
|
185 | + 'link' => esc_url(apply_filters('paginate_links', $link)), |
|
186 | 186 | 'title' => $n_display, |
187 | 187 | 'name' => $n_display, |
188 | 188 | 'current' => $args['current'] == $n |
189 | 189 | ); |
190 | 190 | $dots = true; |
191 | - } elseif ( $dots && !$args['show_all'] ) { |
|
191 | + } elseif ($dots && !$args['show_all']) { |
|
192 | 192 | $page_links[] = array( |
193 | 193 | 'class' => 'dots', |
194 | - 'title' => __( '…' ) |
|
194 | + 'title' => __('…') |
|
195 | 195 | ); |
196 | 196 | $dots = false; |
197 | 197 | } |
198 | 198 | } |
199 | 199 | } |
200 | - if ( $args['prev_next'] && $args['current'] && ( $args['current'] < $args['total'] || -1 == $args['total'] ) ) { |
|
201 | - $link = str_replace( '%_%', $args['format'], $args['base'] ); |
|
202 | - $link = str_replace( '%#%', $args['current'] + 1, $link ); |
|
203 | - if ( $args['add_args'] ) { |
|
204 | - $link = add_query_arg( $args['add_args'], $link ); |
|
200 | + if ($args['prev_next'] && $args['current'] && ($args['current'] < $args['total'] || -1 == $args['total'])) { |
|
201 | + $link = str_replace('%_%', $args['format'], $args['base']); |
|
202 | + $link = str_replace('%#%', $args['current'] + 1, $link); |
|
203 | + if ($args['add_args']) { |
|
204 | + $link = add_query_arg($args['add_args'], $link); |
|
205 | 205 | } |
206 | - $link = untrailingslashit( trailingslashit( $link ) . $args['add_fragment'] ); |
|
206 | + $link = untrailingslashit(trailingslashit($link).$args['add_fragment']); |
|
207 | 207 | $page_links[] = array( |
208 | 208 | 'class' => 'next page-numbers', |
209 | - 'link' => esc_url( apply_filters( 'paginate_links', $link ) ), |
|
209 | + 'link' => esc_url(apply_filters('paginate_links', $link)), |
|
210 | 210 | 'title' => $args['next_text'] |
211 | 211 | ); |
212 | 212 | } |
@@ -247,42 +247,42 @@ discard block |
||
247 | 247 | |
248 | 248 | $archives_title = ''; |
249 | 249 | |
250 | - if ( is_category() ) { |
|
250 | + if (is_category()) { |
|
251 | 251 | |
252 | - $archives_title = single_cat_title( '', false ); |
|
252 | + $archives_title = single_cat_title('', false); |
|
253 | 253 | |
254 | - } else if ( is_tag() ) { |
|
254 | + } else if (is_tag()) { |
|
255 | 255 | |
256 | - $archives_title = 'Tag: ' . single_tag_title( '', false ); |
|
256 | + $archives_title = 'Tag: '.single_tag_title('', false); |
|
257 | 257 | |
258 | - } else if ( is_author() ) { |
|
258 | + } else if (is_author()) { |
|
259 | 259 | |
260 | - if ( have_posts() ) { |
|
260 | + if (have_posts()) { |
|
261 | 261 | |
262 | 262 | the_post(); |
263 | - $archives_title = 'Author: ' . get_the_author(); |
|
263 | + $archives_title = 'Author: '.get_the_author(); |
|
264 | 264 | |
265 | 265 | } |
266 | 266 | |
267 | 267 | rewind_posts(); |
268 | 268 | |
269 | - } else if ( is_search() ) { |
|
269 | + } else if (is_search()) { |
|
270 | 270 | |
271 | - $archives_title = sprintf( __( 'Search Results for: %s', 'flotheme' ), '<span>' . get_search_query() . '</span>' ); |
|
271 | + $archives_title = sprintf(__('Search Results for: %s', 'flotheme'), '<span>'.get_search_query().'</span>'); |
|
272 | 272 | |
273 | - } else if ( is_archive() ) { |
|
273 | + } else if (is_archive()) { |
|
274 | 274 | |
275 | - if ( is_day() ) { |
|
275 | + if (is_day()) { |
|
276 | 276 | |
277 | 277 | $archives_title = get_the_date(); |
278 | 278 | |
279 | - } elseif ( is_month() ) { |
|
279 | + } elseif (is_month()) { |
|
280 | 280 | |
281 | - $archives_title = get_the_date( _x( 'F Y', 'monthly archives date format', 'flotheme')); |
|
281 | + $archives_title = get_the_date(_x('F Y', 'monthly archives date format', 'flotheme')); |
|
282 | 282 | |
283 | - } elseif ( is_year() ) { |
|
283 | + } elseif (is_year()) { |
|
284 | 284 | |
285 | - $archives_title = get_the_date( _x( 'Y', 'yearly archives date format', 'flotheme')); |
|
285 | + $archives_title = get_the_date(_x('Y', 'yearly archives date format', 'flotheme')); |
|
286 | 286 | |
287 | 287 | } else { |
288 | 288 |
@@ -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)) { |
@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | */ |
125 | 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 | |
@@ -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 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | |
159 | 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 | } |