@@ -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 CLASSY_THEME_DIR . '/assets/noimage.png'; |
|
36 | + return CLASSY_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 |
@@ -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 |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | |
30 | 30 | $request = Hierarchy::get_current_request(); |
31 | 31 | |
32 | - $file = Hierarchy::get_available_file( 'view', $request ); |
|
32 | + $file = Hierarchy::get_available_file('view', $request); |
|
33 | 33 | |
34 | - $view = self::get_blade_view( $file ); |
|
34 | + $view = self::get_blade_view($file); |
|
35 | 35 | |
36 | 36 | return $view; |
37 | 37 | |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return string |
46 | 46 | */ |
47 | - public static function get_blade_view( $view ) { |
|
47 | + public static function get_blade_view($view) { |
|
48 | 48 | |
49 | - return str_replace( '/', '.', $view ); |
|
49 | + return str_replace('/', '.', $view); |
|
50 | 50 | |
51 | 51 | } |
52 | 52 | |
@@ -59,21 +59,21 @@ discard block |
||
59 | 59 | |
60 | 60 | $templates = array(); |
61 | 61 | |
62 | - $files = (array) glob( CLASSY_THEME_PATH . '/' . self::$folder . '/*/*.blade.php' ); |
|
62 | + $files = (array) glob(CLASSY_THEME_PATH.'/'.self::$folder.'/*/*.blade.php'); |
|
63 | 63 | |
64 | - foreach ( $files as $filename ) { |
|
64 | + foreach ($files as $filename) { |
|
65 | 65 | |
66 | - if ( ! empty( $filename ) ) { |
|
66 | + if (!empty($filename)) { |
|
67 | 67 | |
68 | - if ( ! preg_match( '/\{\{\-\-\s*Template Name:(.*)\s*\-\-\}\}/mi', file_get_contents( $filename ), $header ) ) { continue; } |
|
68 | + if (!preg_match('/\{\{\-\-\s*Template Name:(.*)\s*\-\-\}\}/mi', file_get_contents($filename), $header)) { continue; } |
|
69 | 69 | |
70 | - $template_name = trim( $header[1] ); |
|
70 | + $template_name = trim($header[1]); |
|
71 | 71 | |
72 | - preg_match( '/\/([^\/]*)\.blade.php$/is', $filename, $filename_match ); |
|
72 | + preg_match('/\/([^\/]*)\.blade.php$/is', $filename, $filename_match); |
|
73 | 73 | |
74 | - $template_file = 'classy-' . $filename_match[1]; |
|
74 | + $template_file = 'classy-'.$filename_match[1]; |
|
75 | 75 | |
76 | - $templates[ $template_file ] = $template_name; |
|
76 | + $templates[$template_file] = $template_name; |
|
77 | 77 | |
78 | 78 | } |
79 | 79 | } |
@@ -12,13 +12,13 @@ discard block |
||
12 | 12 | */ |
13 | 13 | public function __construct() { |
14 | 14 | |
15 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) ); |
|
15 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_styles')); |
|
16 | 16 | |
17 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); |
|
17 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts')); |
|
18 | 18 | |
19 | - add_action( 'wp_print_scripts', array( $this, 'init_js_vars' ) ); |
|
19 | + add_action('wp_print_scripts', array($this, 'init_js_vars')); |
|
20 | 20 | |
21 | - add_action( 'after_setup_theme', array( $this, 'setup_theme' ) ); |
|
21 | + add_action('after_setup_theme', array($this, 'setup_theme')); |
|
22 | 22 | |
23 | 23 | } |
24 | 24 | |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function enqueue_styles() { |
29 | 29 | |
30 | - wp_register_style( 'general_css', CLASSY_THEME_DIR . 'assets/css/general.css', array(), CLASSY_THEME_VERSION, 'all' ); |
|
30 | + wp_register_style('general_css', CLASSY_THEME_DIR.'assets/css/general.css', array(), CLASSY_THEME_VERSION, 'all'); |
|
31 | 31 | |
32 | 32 | } |
33 | 33 | |
@@ -36,13 +36,13 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function enqueue_scripts() { |
38 | 38 | |
39 | - if ( 'production' === Classy::get_config_var( 'environment' ) ) { |
|
39 | + if ('production' === Classy::get_config_var('environment')) { |
|
40 | 40 | |
41 | - wp_register_script( 'theme_scripts', CLASSY_THEME_DIR . 'assets/js/min/production.js', array( 'jquery' ), CLASSY_THEME_VERSION, true ); |
|
41 | + wp_register_script('theme_scripts', CLASSY_THEME_DIR.'assets/js/min/production.js', array('jquery'), CLASSY_THEME_VERSION, true); |
|
42 | 42 | |
43 | 43 | } else { |
44 | 44 | |
45 | - wp_register_script( 'theme_scripts', CLASSY_THEME_DIR . 'assets/js/scripts.js', array( 'jquery' ), CLASSY_THEME_VERSION, true ); |
|
45 | + wp_register_script('theme_scripts', CLASSY_THEME_DIR.'assets/js/scripts.js', array('jquery'), CLASSY_THEME_VERSION, true); |
|
46 | 46 | |
47 | 47 | } |
48 | 48 | |
@@ -54,10 +54,10 @@ discard block |
||
54 | 54 | public function init_js_vars() { |
55 | 55 | |
56 | 56 | $options = array( |
57 | - 'base_url' => home_url( '' ), |
|
58 | - 'blog_url' => home_url( 'archives/' ), |
|
57 | + 'base_url' => home_url(''), |
|
58 | + 'blog_url' => home_url('archives/'), |
|
59 | 59 | 'template_dir' => CLASSY_THEME_DIR, |
60 | - 'ajax_load_url' => admin_url( 'admin-ajax.php' ), |
|
60 | + 'ajax_load_url' => admin_url('admin-ajax.php'), |
|
61 | 61 | 'is_mobile' => (int) wp_is_mobile(), |
62 | 62 | ); |
63 | 63 | |
@@ -85,12 +85,12 @@ discard block |
||
85 | 85 | * @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails |
86 | 86 | */ |
87 | 87 | |
88 | - add_theme_support( 'post-thumbnails' ); |
|
88 | + add_theme_support('post-thumbnails'); |
|
89 | 89 | |
90 | 90 | // This theme uses wp_nav_menu() in one location. |
91 | 91 | register_nav_menus(array( |
92 | - 'header-menu' => __( 'Header Menu', Classy::textdomain() ), |
|
93 | - 'footer-menu' => __( 'Footer Menu', Classy::textdomain() ), |
|
92 | + 'header-menu' => __('Header Menu', Classy::textdomain()), |
|
93 | + 'footer-menu' => __('Footer Menu', Classy::textdomain()), |
|
94 | 94 | )); |
95 | 95 | |
96 | 96 | /* |
@@ -43,7 +43,8 @@ |
||
43 | 43 | |
44 | 44 | wp_register_script( 'theme_plugins', THEME_DIR . 'assets/js/min/production.js', array( 'jquery' ), THEME_VERSION, true ); |
45 | 45 | |
46 | - } else { |
|
46 | + } |
|
47 | + else { |
|
47 | 48 | |
48 | 49 | wp_register_script( 'theme_plugins', THEME_DIR . 'assets/js/plugins.js', array( 'jquery' ), THEME_VERSION, true ); |
49 | 50 |
@@ -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 = CLASSY_THEME_FRAMEWORK_PATH . 'config.php'; |
|
33 | + $config_file = CLASSY_THEME_FRAMEWORK_PATH.'config.php'; |
|
34 | 34 | |
35 | - if ( file_exists( $config_file ) ) { |
|
35 | + if (file_exists($config_file)) { |
|
36 | 36 | |
37 | - require_once CLASSY_THEME_FRAMEWORK_PATH . 'config.php'; |
|
37 | + require_once CLASSY_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( CLASSY_THEME ) |
|
56 | - ) ); |
|
55 | + esc_html(CLASSY_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>', |
@@ -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 |
@@ -9,23 +9,23 @@ discard block |
||
9 | 9 | * @param array|boolean $args |
10 | 10 | * @return object WP_Query |
11 | 11 | */ |
12 | - public static function find_query( $args = false ) { |
|
12 | + public static function find_query($args = false) { |
|
13 | 13 | |
14 | 14 | $default_args = array(); |
15 | 15 | |
16 | - if ( ! $args ) { |
|
16 | + if (!$args) { |
|
17 | 17 | |
18 | 18 | return self::get_current_query(); |
19 | 19 | |
20 | - } elseif ( is_array( $args ) ) { |
|
20 | + } elseif (is_array($args)) { |
|
21 | 21 | |
22 | - $args = array_merge( $default_args, $args ); |
|
22 | + $args = array_merge($default_args, $args); |
|
23 | 23 | |
24 | - return new \WP_Query( $args ); |
|
24 | + return new \WP_Query($args); |
|
25 | 25 | |
26 | 26 | } else { |
27 | 27 | |
28 | - return new \WP_Query( $default_args ); |
|
28 | + return new \WP_Query($default_args); |
|
29 | 29 | |
30 | 30 | } |
31 | 31 | } |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | |
40 | 40 | global $wp_query; |
41 | 41 | |
42 | - $query =& $wp_query; |
|
42 | + $query = & $wp_query; |
|
43 | 43 | |
44 | - $query = self::handle_maybe_custom_posts_page( $query ); |
|
44 | + $query = self::handle_maybe_custom_posts_page($query); |
|
45 | 45 | |
46 | 46 | return $query; |
47 | 47 | |
@@ -53,13 +53,13 @@ discard block |
||
53 | 53 | * @param object $query WP_Query |
54 | 54 | * @return object WP_Query |
55 | 55 | */ |
56 | - private static function handle_maybe_custom_posts_page( $query ) { |
|
56 | + private static function handle_maybe_custom_posts_page($query) { |
|
57 | 57 | |
58 | - if ( $custom_posts_page = get_option( 'page_for_posts' ) ) { |
|
58 | + if ($custom_posts_page = get_option('page_for_posts')) { |
|
59 | 59 | |
60 | - if ( isset( $query->query['p'] ) && absint( $query->query['p'] ) === absint( $custom_posts_page ) ) { |
|
60 | + if (isset($query->query['p']) && absint($query->query['p']) === absint($custom_posts_page)) { |
|
61 | 61 | |
62 | - return new \WP_Query( array( 'post_type' => 'post' ) ); |
|
62 | + return new \WP_Query(array('post_type' => 'post')); |
|
63 | 63 | |
64 | 64 | } |
65 | 65 | } |
@@ -16,13 +16,15 @@ |
||
16 | 16 | |
17 | 17 | return self::get_current_query(); |
18 | 18 | |
19 | - } elseif ( is_array( $args ) ) { |
|
19 | + } |
|
20 | + elseif ( is_array( $args ) ) { |
|
20 | 21 | |
21 | 22 | $args = array_merge( $default_args, $args ); |
22 | 23 | |
23 | 24 | return new WP_Query( $args ); |
24 | 25 | |
25 | - } else { |
|
26 | + } |
|
27 | + else { |
|
26 | 28 | |
27 | 29 | return new WP_Query( $default_args ); |
28 | 30 |
@@ -24,25 +24,25 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @param string $arg it can be menu id, slug or full name |
26 | 26 | */ |
27 | - public function __construct( $arg = null ) { |
|
27 | + public function __construct($arg = null) { |
|
28 | 28 | |
29 | - if ( is_numeric( $arg ) && 0 !== absint( $arg ) ) { |
|
29 | + if (is_numeric($arg) && 0 !== absint($arg)) { |
|
30 | 30 | |
31 | - $menu_id = $this->check_menu_id( $arg ); |
|
31 | + $menu_id = $this->check_menu_id($arg); |
|
32 | 32 | |
33 | - } elseif ( is_string( $arg ) ) { |
|
33 | + } elseif (is_string($arg)) { |
|
34 | 34 | |
35 | - $menu_id = $this->get_menu_id_by_name( $arg ); |
|
35 | + $menu_id = $this->get_menu_id_by_name($arg); |
|
36 | 36 | |
37 | 37 | } |
38 | 38 | |
39 | - if ( ! isset( $menu_id ) ) { |
|
39 | + if (!isset($menu_id)) { |
|
40 | 40 | |
41 | 41 | $menu_id = $this->get_first_menu_id(); |
42 | 42 | |
43 | 43 | } |
44 | 44 | |
45 | - if ( $menu_id ) { |
|
45 | + if ($menu_id) { |
|
46 | 46 | |
47 | 47 | $this->ID = $menu_id; |
48 | 48 | |
@@ -61,22 +61,22 @@ discard block |
||
61 | 61 | |
62 | 62 | $_return = array(); |
63 | 63 | |
64 | - $items = wp_get_nav_menu_items( $this->ID ); |
|
64 | + $items = wp_get_nav_menu_items($this->ID); |
|
65 | 65 | |
66 | - foreach ( $items as $item ) { |
|
66 | + foreach ($items as $item) { |
|
67 | 67 | |
68 | - $_return[ $item->ID ] = new Menu_Item( $item ); |
|
68 | + $_return[$item->ID] = new Menu_Item($item); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | // Apply nesting |
72 | 72 | |
73 | - foreach ( $_return as $item_id => $item ) { |
|
73 | + foreach ($_return as $item_id => $item) { |
|
74 | 74 | |
75 | - if ( isset( $item->menu_item_parent ) && $item->menu_item_parent && isset( $_return[ $item->menu_item_parent ] ) ) { |
|
75 | + if (isset($item->menu_item_parent) && $item->menu_item_parent && isset($_return[$item->menu_item_parent])) { |
|
76 | 76 | |
77 | - $_return[ $item->menu_item_parent ]->add_child( $item ); |
|
77 | + $_return[$item->menu_item_parent]->add_child($item); |
|
78 | 78 | |
79 | - unset( $_return[ $item_id ] ); |
|
79 | + unset($_return[$item_id]); |
|
80 | 80 | |
81 | 81 | } |
82 | 82 | } |
@@ -92,11 +92,11 @@ discard block |
||
92 | 92 | */ |
93 | 93 | protected function get_first_menu_id() { |
94 | 94 | |
95 | - $menus = get_terms( 'nav_menu', array( 'hide_empty' => true ) ); |
|
95 | + $menus = get_terms('nav_menu', array('hide_empty' => true)); |
|
96 | 96 | |
97 | - if ( is_array( $menus ) && count( $menus ) ) { |
|
97 | + if (is_array($menus) && count($menus)) { |
|
98 | 98 | |
99 | - if ( isset( $menus[0]->term_id ) ) { |
|
99 | + if (isset($menus[0]->term_id)) { |
|
100 | 100 | |
101 | 101 | return $menus[0]->term_id; |
102 | 102 | |
@@ -113,15 +113,15 @@ discard block |
||
113 | 113 | * @param int $menu_id |
114 | 114 | * @return int|boolean |
115 | 115 | */ |
116 | - protected function check_menu_id( $menu_id ) { |
|
116 | + protected function check_menu_id($menu_id) { |
|
117 | 117 | |
118 | - $menus = get_terms( 'nav_menu', array( 'hide_empty' => true ) ); |
|
118 | + $menus = get_terms('nav_menu', array('hide_empty' => true)); |
|
119 | 119 | |
120 | - if ( is_array( $menus ) && count( $menus ) ) { |
|
120 | + if (is_array($menus) && count($menus)) { |
|
121 | 121 | |
122 | - foreach ( $menus as $menu ) { |
|
122 | + foreach ($menus as $menu) { |
|
123 | 123 | |
124 | - if ( absint( $menu->term_id ) === absint( $menu_id ) ) { |
|
124 | + if (absint($menu->term_id) === absint($menu_id)) { |
|
125 | 125 | |
126 | 126 | return $menu_id; |
127 | 127 | |
@@ -139,17 +139,17 @@ discard block |
||
139 | 139 | * @param string $slug |
140 | 140 | * @return int |
141 | 141 | */ |
142 | - protected function get_menu_id_by_name( $slug = null ) { |
|
142 | + protected function get_menu_id_by_name($slug = null) { |
|
143 | 143 | |
144 | - if ( $slug && is_string( $slug ) ) { |
|
144 | + if ($slug && is_string($slug)) { |
|
145 | 145 | |
146 | - $menu_id = get_term_by( 'slug', $slug, 'nav_menu' ); |
|
146 | + $menu_id = get_term_by('slug', $slug, 'nav_menu'); |
|
147 | 147 | |
148 | - if ( $menu_id ) { return $menu_id; } |
|
148 | + if ($menu_id) { return $menu_id; } |
|
149 | 149 | |
150 | - $menu_id = get_term_by( 'name', $slug, 'nav_menu' ); |
|
150 | + $menu_id = get_term_by('name', $slug, 'nav_menu'); |
|
151 | 151 | |
152 | - if ( $menu_id ) { return $menu_id; } |
|
152 | + if ($menu_id) { return $menu_id; } |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | return false; |
@@ -29,7 +29,8 @@ |
||
29 | 29 | |
30 | 30 | $menu_id = $this->check_menu_id( $arg ); |
31 | 31 | |
32 | - } elseif ( is_string( $arg ) ) { |
|
32 | + } |
|
33 | + elseif ( is_string( $arg ) ) { |
|
33 | 34 | |
34 | 35 | $menu_id = $this->get_menu_id_by_name( $arg ); |
35 | 36 |
@@ -26,21 +26,21 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return array |
28 | 28 | */ |
29 | - public static function get_scope( $view_name = null ) { |
|
29 | + public static function get_scope($view_name = null) { |
|
30 | 30 | |
31 | 31 | $scope = self::get_common_scope(); |
32 | 32 | |
33 | - if ( is_string( $view_name ) ) { |
|
33 | + if (is_string($view_name)) { |
|
34 | 34 | |
35 | - $scope = self::extend_scope( $scope, $view_name ); |
|
35 | + $scope = self::extend_scope($scope, $view_name); |
|
36 | 36 | |
37 | 37 | } else { |
38 | 38 | |
39 | 39 | $request = Hierarchy::get_current_request(); |
40 | 40 | |
41 | - $file = Hierarchy::get_available_file( 'scope', $request ); |
|
41 | + $file = Hierarchy::get_available_file('scope', $request); |
|
42 | 42 | |
43 | - $scope = self::extend_scope( $scope, $file ); |
|
43 | + $scope = self::extend_scope($scope, $file); |
|
44 | 44 | |
45 | 45 | } |
46 | 46 | |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @return array |
58 | 58 | */ |
59 | - public static function extend_scope( $scope, $view_name ) { |
|
59 | + public static function extend_scope($scope, $view_name) { |
|
60 | 60 | |
61 | - $scope = array_merge( $scope, self::require_scope( $view_name ) ); |
|
61 | + $scope = array_merge($scope, self::require_scope($view_name)); |
|
62 | 62 | |
63 | 63 | return $scope; |
64 | 64 | |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public static function get_common_scope() { |
73 | 73 | |
74 | - if ( null === self::$common ) { |
|
74 | + if (null === self::$common) { |
|
75 | 75 | |
76 | - self::$common = self::require_scope( 'common' ); |
|
76 | + self::$common = self::require_scope('common'); |
|
77 | 77 | |
78 | 78 | } |
79 | 79 | |
@@ -88,19 +88,19 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return array |
90 | 90 | */ |
91 | - public static function require_scope( $filename ) { |
|
91 | + public static function require_scope($filename) { |
|
92 | 92 | |
93 | 93 | $_return = array(); |
94 | 94 | |
95 | - $file = Hierarchy::get_file_path( 'scope', $filename ); |
|
95 | + $file = Hierarchy::get_file_path('scope', $filename); |
|
96 | 96 | |
97 | - if ( file_exists( $file ) ) { |
|
97 | + if (file_exists($file)) { |
|
98 | 98 | |
99 | 99 | require $file; |
100 | 100 | |
101 | 101 | } |
102 | 102 | |
103 | - if ( isset( $data ) ) { |
|
103 | + if (isset($data)) { |
|
104 | 104 | |
105 | 105 | $_return = $data; |
106 | 106 |
@@ -43,7 +43,8 @@ |
||
43 | 43 | |
44 | 44 | wp_register_script( 'theme_plugins', THEME_DIR . 'assets/js/min/production.js', array( 'jquery' ), THEME_VERSION, true ); |
45 | 45 | |
46 | - } else { |
|
46 | + } |
|
47 | + else { |
|
47 | 48 | |
48 | 49 | wp_register_script( 'theme_plugins', THEME_DIR . 'assets/js/plugins.js', array( 'jquery' ), THEME_VERSION, true ); |
49 | 50 |
@@ -12,28 +12,28 @@ |
||
12 | 12 | * @param object|array $data |
13 | 13 | * @return void |
14 | 14 | */ |
15 | - protected function import( $data ) { |
|
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 | 25 | // In case if we import WP_User object. |
26 | - if ( isset( $data['data'] ) ) { |
|
26 | + if (isset($data['data'])) { |
|
27 | 27 | $data = $data['data']; |
28 | 28 | } |
29 | 29 | |
30 | - foreach ( $data as $key => $value ) { |
|
30 | + foreach ($data as $key => $value) { |
|
31 | 31 | |
32 | - if ( ! empty( $key ) ) { |
|
32 | + if (!empty($key)) { |
|
33 | 33 | |
34 | 34 | $this->$key = $value; |
35 | 35 | |
36 | - } else if ( ! empty( $key ) && ! method_exists( $this, $key ) ) { |
|
36 | + } else if (!empty($key) && !method_exists($this, $key)) { |
|
37 | 37 | |
38 | 38 | $this->$key = $value; |
39 | 39 |
@@ -28,7 +28,8 @@ |
||
28 | 28 | |
29 | 29 | $this->$key = $value; |
30 | 30 | |
31 | - } else if ( ! empty( $key ) && ! method_exists( $this, $key ) ) { |
|
31 | + } |
|
32 | + else if ( ! empty( $key ) && ! method_exists( $this, $key ) ) { |
|
32 | 33 | |
33 | 34 | $this->$key = $value; |
34 | 35 |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @param \WP_Post $item |
45 | 45 | */ |
46 | - public function __construct( $item ) { |
|
46 | + public function __construct($item) { |
|
47 | 47 | |
48 | - if ( is_a( $item, '\WP_Post' ) ) { |
|
48 | + if (is_a($item, '\WP_Post')) { |
|
49 | 49 | |
50 | - $this->import( $item ); |
|
50 | + $this->import($item); |
|
51 | 51 | $this->filter_classes(); |
52 | 52 | |
53 | 53 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function get_classes() { |
106 | 106 | |
107 | - return implode( ' ', $this->classes ); |
|
107 | + return implode(' ', $this->classes); |
|
108 | 108 | |
109 | 109 | } |
110 | 110 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @param string $class_name |
115 | 115 | */ |
116 | - public function add_class( $class_name ) { |
|
116 | + public function add_class($class_name) { |
|
117 | 117 | |
118 | 118 | $this->classes[] = $class_name; |
119 | 119 | |
@@ -124,17 +124,17 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @param Menu_Item $item |
126 | 126 | */ |
127 | - public function add_child( $item ) { |
|
127 | + public function add_child($item) { |
|
128 | 128 | |
129 | - if ( ! $this->has_child ) { |
|
130 | - $this->add_class( 'menu-item-has-children' ); |
|
129 | + if (!$this->has_child) { |
|
130 | + $this->add_class('menu-item-has-children'); |
|
131 | 131 | $this->has_child = true; |
132 | 132 | } |
133 | 133 | |
134 | 134 | $this->children[] = $item; |
135 | 135 | $item->level = $this->level + 1; |
136 | 136 | |
137 | - if ( $item->children ) { |
|
137 | + if ($item->children) { |
|
138 | 138 | $this->update_child_levels(); |
139 | 139 | } |
140 | 140 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | */ |
148 | 148 | protected function filter_classes() { |
149 | 149 | |
150 | - $this->classes = apply_filters( 'nav_menu_css_class', $this->classes, $this ); |
|
150 | + $this->classes = apply_filters('nav_menu_css_class', $this->classes, $this); |
|
151 | 151 | |
152 | 152 | } |
153 | 153 | |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | */ |
159 | 159 | protected function update_child_levels() { |
160 | 160 | |
161 | - if ( is_array( $this->children ) ) { |
|
161 | + if (is_array($this->children)) { |
|
162 | 162 | |
163 | - foreach ( $this->children as $child ) { |
|
163 | + foreach ($this->children as $child) { |
|
164 | 164 | $child->level = $this->level + 1; |
165 | 165 | $child->update_child_levels(); |
166 | 166 | } |