@@ -12,7 +12,7 @@ |
||
| 12 | 12 | /** |
| 13 | 13 | * Returns list of allowed variables that can be used in theme config |
| 14 | 14 | * |
| 15 | - * @return array |
|
| 15 | + * @return string[] |
|
| 16 | 16 | */ |
| 17 | 17 | private static function get_allowed_variables() { |
| 18 | 18 | |
@@ -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( |
@@ -50,7 +50,8 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - } else { |
|
| 53 | + } |
|
| 54 | + else { |
|
| 54 | 55 | |
| 55 | 56 | die('There is no config file in ' . THEME . ' custom/config.php'); |
| 56 | 57 | |
@@ -73,16 +74,24 @@ discard block |
||
| 73 | 74 | $vars = self::get_vars(); |
| 74 | 75 | |
| 75 | 76 | // Init Post Types |
| 76 | - if (isset($vars['post_types'])) self::init_post_types( $vars['post_types'] ); |
|
| 77 | + if (isset($vars['post_types'])) { |
|
| 78 | + self::init_post_types( $vars['post_types'] ); |
|
| 79 | + } |
|
| 77 | 80 | |
| 78 | 81 | // Init Taxonomies |
| 79 | - if (isset($vars['taxonomies'])) self::init_taxonomies( $vars['taxonomies'] ); |
|
| 82 | + if (isset($vars['taxonomies'])) { |
|
| 83 | + self::init_taxonomies( $vars['taxonomies'] ); |
|
| 84 | + } |
|
| 80 | 85 | |
| 81 | 86 | // Init Post Formats |
| 82 | - if (isset($vars['post_formats'])) self::init_post_formats( $vars['post_formats'] ); |
|
| 87 | + if (isset($vars['post_formats'])) { |
|
| 88 | + self::init_post_formats( $vars['post_formats'] ); |
|
| 89 | + } |
|
| 83 | 90 | |
| 84 | 91 | // Init Sidebars |
| 85 | - if (isset($vars['sidebars'])) self::init_sidebars( $vars['sidebars'] ); |
|
| 92 | + if (isset($vars['sidebars'])) { |
|
| 93 | + self::init_sidebars( $vars['sidebars'] ); |
|
| 94 | + } |
|
| 86 | 95 | |
| 87 | 96 | } |
| 88 | 97 | |
@@ -54,6 +54,7 @@ discard block |
||
| 54 | 54 | * |
| 55 | 55 | * @param string |
| 56 | 56 | * @param string |
| 57 | + * @param string $name |
|
| 57 | 58 | */ |
| 58 | 59 | private function define( $name, $value ) { |
| 59 | 60 | if ( !defined($name) ) { |
@@ -241,7 +242,7 @@ discard block |
||
| 241 | 242 | |
| 242 | 243 | /** |
| 243 | 244 | * @param array $prefs |
| 244 | - * @return array mixed |
|
| 245 | + * @return stdClass mixed |
|
| 245 | 246 | */ |
| 246 | 247 | public static function get_pagination( $prefs = array() ) { |
| 247 | 248 | global $wp_query; |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public static function get_instance() { |
| 31 | 31 | |
| 32 | - if ( null === self::$single_instance ) { |
|
| 32 | + if (null === self::$single_instance) { |
|
| 33 | 33 | |
| 34 | 34 | self::$single_instance = new self(); |
| 35 | 35 | |
@@ -66,11 +66,11 @@ discard block |
||
| 66 | 66 | * @param string |
| 67 | 67 | * @param string |
| 68 | 68 | */ |
| 69 | - private function define( $name, $value ) { |
|
| 69 | + private function define($name, $value) { |
|
| 70 | 70 | |
| 71 | - if ( !defined($name) ) { |
|
| 71 | + if (!defined($name)) { |
|
| 72 | 72 | |
| 73 | - define( $name, $value ); |
|
| 73 | + define($name, $value); |
|
| 74 | 74 | |
| 75 | 75 | } |
| 76 | 76 | |
@@ -86,13 +86,13 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | $theme = wp_get_theme(); |
| 88 | 88 | |
| 89 | - $this->define( 'THEME', $theme->template ); |
|
| 90 | - $this->define( 'THEME_NAME', $theme->get('Name') ); |
|
| 91 | - $this->define( 'THEME_PATH', get_template_directory() . '/' ); |
|
| 92 | - $this->define( 'THEME_DIR', get_template_directory_uri() . '/' ); |
|
| 93 | - $this->define( 'THEME_VERSION', $theme->get('Version') ); |
|
| 94 | - $this->define( 'THEME_FRAMEWORK_PATH', THEME_PATH . 'app/' ); |
|
| 95 | - $this->define( 'THEME_FRAMEWORK_DIR', THEME_DIR . 'app/' ); |
|
| 89 | + $this->define('THEME', $theme->template); |
|
| 90 | + $this->define('THEME_NAME', $theme->get('Name')); |
|
| 91 | + $this->define('THEME_PATH', get_template_directory().'/'); |
|
| 92 | + $this->define('THEME_DIR', get_template_directory_uri().'/'); |
|
| 93 | + $this->define('THEME_VERSION', $theme->get('Version')); |
|
| 94 | + $this->define('THEME_FRAMEWORK_PATH', THEME_PATH.'app/'); |
|
| 95 | + $this->define('THEME_FRAMEWORK_DIR', THEME_DIR.'app/'); |
|
| 96 | 96 | |
| 97 | 97 | } |
| 98 | 98 | |
@@ -101,40 +101,40 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | private function include_core_files() { |
| 103 | 103 | |
| 104 | - require_once THEME_PATH . 'vendor/autoload.php'; |
|
| 104 | + require_once THEME_PATH.'vendor/autoload.php'; |
|
| 105 | 105 | |
| 106 | 106 | // Basis Class |
| 107 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-basis.php'; |
|
| 107 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-basis.php'; |
|
| 108 | 108 | |
| 109 | 109 | // Hierarchy |
| 110 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-hierarchy.php'; |
|
| 110 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-hierarchy.php'; |
|
| 111 | 111 | |
| 112 | 112 | // Theme Config |
| 113 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-config.php'; |
|
| 113 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-config.php'; |
|
| 114 | 114 | |
| 115 | 115 | // Scope |
| 116 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-scope.php'; |
|
| 116 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-scope.php'; |
|
| 117 | 117 | |
| 118 | 118 | // Template Loader |
| 119 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-template.php'; |
|
| 119 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-template.php'; |
|
| 120 | 120 | |
| 121 | 121 | // Helper functions |
| 122 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-helper.php'; |
|
| 122 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-helper.php'; |
|
| 123 | 123 | |
| 124 | 124 | // Query Helper |
| 125 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-query-helper.php'; |
|
| 125 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-query-helper.php'; |
|
| 126 | 126 | |
| 127 | 127 | // Menu |
| 128 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-menu.php'; |
|
| 128 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-menu.php'; |
|
| 129 | 129 | |
| 130 | 130 | // Menu Item |
| 131 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-menu-item.php'; |
|
| 131 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-menu-item.php'; |
|
| 132 | 132 | |
| 133 | 133 | // Comment |
| 134 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-comment.php'; |
|
| 134 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-comment.php'; |
|
| 135 | 135 | |
| 136 | 136 | // Appearance |
| 137 | - require_once THEME_FRAMEWORK_PATH . 'appearance.php'; |
|
| 137 | + require_once THEME_FRAMEWORK_PATH.'appearance.php'; |
|
| 138 | 138 | |
| 139 | 139 | } |
| 140 | 140 | |
@@ -143,11 +143,11 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | private function include_models() { |
| 145 | 145 | |
| 146 | - $files = (array) glob( THEME_FRAMEWORK_PATH . '/models/*.php' ); |
|
| 146 | + $files = (array) glob(THEME_FRAMEWORK_PATH.'/models/*.php'); |
|
| 147 | 147 | |
| 148 | - foreach ( $files as $filename ) { |
|
| 148 | + foreach ($files as $filename) { |
|
| 149 | 149 | |
| 150 | - if ( !empty($filename) ) { |
|
| 150 | + if (!empty($filename)) { |
|
| 151 | 151 | |
| 152 | 152 | require_once $filename; |
| 153 | 153 | |
@@ -220,8 +220,8 @@ discard block |
||
| 220 | 220 | */ |
| 221 | 221 | public static function render($template = null, $data = null) { |
| 222 | 222 | |
| 223 | - $views = THEME_PATH . ClassyTemplate::$folder; |
|
| 224 | - $cache = WP_CONTENT_DIR . '/templatecache'; |
|
| 223 | + $views = THEME_PATH.ClassyTemplate::$folder; |
|
| 224 | + $cache = WP_CONTENT_DIR.'/templatecache'; |
|
| 225 | 225 | $common_scope = ClassyScope::get_common_scope(); |
| 226 | 226 | |
| 227 | 227 | if ($template !== null && is_string($template)) { |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | |
| 286 | 286 | $_return[] = new ClassyPost($post_id); |
| 287 | 287 | |
| 288 | - } elseif($return_type == 'object') { |
|
| 288 | + } elseif ($return_type == 'object') { |
|
| 289 | 289 | |
| 290 | 290 | $_return[] = get_post($post_id); |
| 291 | 291 | |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | |
| 314 | 314 | $posts = self::get_posts($args, $return_type); |
| 315 | 315 | |
| 316 | - if ( $post = reset($posts ) ) { |
|
| 316 | + if ($post = reset($posts)) { |
|
| 317 | 317 | return $post; |
| 318 | 318 | } |
| 319 | 319 | |
@@ -323,58 +323,58 @@ discard block |
||
| 323 | 323 | * @param array $prefs |
| 324 | 324 | * @return array mixed |
| 325 | 325 | */ |
| 326 | - public static function get_pagination( $prefs = array() ) { |
|
| 326 | + public static function get_pagination($prefs = array()) { |
|
| 327 | 327 | |
| 328 | 328 | global $wp_query; |
| 329 | 329 | global $paged; |
| 330 | 330 | global $wp_rewrite; |
| 331 | 331 | |
| 332 | 332 | $args = array(); |
| 333 | - $args['total'] = ceil( $wp_query->found_posts / $wp_query->query_vars['posts_per_page'] ); |
|
| 333 | + $args['total'] = ceil($wp_query->found_posts / $wp_query->query_vars['posts_per_page']); |
|
| 334 | 334 | |
| 335 | - if ( $wp_rewrite->using_permalinks() ) { |
|
| 335 | + if ($wp_rewrite->using_permalinks()) { |
|
| 336 | 336 | |
| 337 | - $url = explode( '?', get_pagenum_link( 0 ) ); |
|
| 337 | + $url = explode('?', get_pagenum_link(0)); |
|
| 338 | 338 | |
| 339 | - if ( isset( $url[1] ) ) { |
|
| 340 | - parse_str( $url[1], $query ); |
|
| 339 | + if (isset($url[1])) { |
|
| 340 | + parse_str($url[1], $query); |
|
| 341 | 341 | $args['add_args'] = $query; |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | $args['format'] = 'page/%#%'; |
| 345 | - $args['base'] = trailingslashit( $url[0] ).'%_%'; |
|
| 345 | + $args['base'] = trailingslashit($url[0]).'%_%'; |
|
| 346 | 346 | |
| 347 | 347 | } else { |
| 348 | 348 | $big = 999999999; |
| 349 | - $args['base'] = str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ); |
|
| 349 | + $args['base'] = str_replace($big, '%#%', esc_url(get_pagenum_link($big))); |
|
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | $args['type'] = 'array'; |
| 353 | - $args['current'] = max( 1, get_query_var( 'paged' ) ); |
|
| 354 | - $args['mid_size'] = max( 9 - $args['current'], 3 ); |
|
| 353 | + $args['current'] = max(1, get_query_var('paged')); |
|
| 354 | + $args['mid_size'] = max(9 - $args['current'], 3); |
|
| 355 | 355 | $args['prev_next'] = false; |
| 356 | 356 | |
| 357 | - if ( is_int( $prefs ) ) { |
|
| 357 | + if (is_int($prefs)) { |
|
| 358 | 358 | $args['mid_size'] = $prefs - 2; |
| 359 | 359 | } else { |
| 360 | - $args = array_merge( $args, $prefs ); |
|
| 360 | + $args = array_merge($args, $prefs); |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | $data = array(); |
| 364 | - $data['pages'] = ClassyHelper::paginate_links( $args ); |
|
| 365 | - $next = get_next_posts_page_link( $args['total'] ); |
|
| 364 | + $data['pages'] = ClassyHelper::paginate_links($args); |
|
| 365 | + $next = get_next_posts_page_link($args['total']); |
|
| 366 | 366 | |
| 367 | - if ( $next ) { |
|
| 368 | - $data['next'] = array( 'link' => untrailingslashit( $next ), 'class' => 'page-numbers next' ); |
|
| 367 | + if ($next) { |
|
| 368 | + $data['next'] = array('link' => untrailingslashit($next), 'class' => 'page-numbers next'); |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | - $prev = previous_posts( false ); |
|
| 371 | + $prev = previous_posts(false); |
|
| 372 | 372 | |
| 373 | - if ( $prev ) { |
|
| 374 | - $data['prev'] = array( 'link' => untrailingslashit( $prev ), 'class' => 'page-numbers prev' ); |
|
| 373 | + if ($prev) { |
|
| 374 | + $data['prev'] = array('link' => untrailingslashit($prev), 'class' => 'page-numbers prev'); |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | - if ( $paged < 2 ) { |
|
| 377 | + if ($paged < 2) { |
|
| 378 | 378 | $data['prev'] = null; |
| 379 | 379 | } |
| 380 | 380 | |
@@ -190,7 +190,9 @@ discard block |
||
| 190 | 190 | |
| 191 | 191 | $vars = ClassyConfig::get_vars(); |
| 192 | 192 | |
| 193 | - if (isset($vars[$name])) return $vars[$name]; |
|
| 193 | + if (isset($vars[$name])) { |
|
| 194 | + return $vars[$name]; |
|
| 195 | + } |
|
| 194 | 196 | |
| 195 | 197 | return false; |
| 196 | 198 | |
@@ -230,13 +232,15 @@ discard block |
||
| 230 | 232 | |
| 231 | 233 | $scope = array_merge($common_scope, $data); |
| 232 | 234 | |
| 233 | - } else { |
|
| 235 | + } |
|
| 236 | + else { |
|
| 234 | 237 | |
| 235 | 238 | $scope = $common_scope; |
| 236 | 239 | |
| 237 | 240 | } |
| 238 | 241 | |
| 239 | - } else { |
|
| 242 | + } |
|
| 243 | + else { |
|
| 240 | 244 | |
| 241 | 245 | $template = ClassyTemplate::get_template(); |
| 242 | 246 | |
@@ -285,11 +289,13 @@ discard block |
||
| 285 | 289 | |
| 286 | 290 | $_return[] = new ClassyPost($post_id); |
| 287 | 291 | |
| 288 | - } elseif($return_type == 'object') { |
|
| 292 | + } |
|
| 293 | + elseif($return_type == 'object') { |
|
| 289 | 294 | |
| 290 | 295 | $_return[] = get_post($post_id); |
| 291 | 296 | |
| 292 | - } else { |
|
| 297 | + } |
|
| 298 | + else { |
|
| 293 | 299 | |
| 294 | 300 | $_return[] = $post_id; |
| 295 | 301 | |
@@ -344,7 +350,8 @@ discard block |
||
| 344 | 350 | $args['format'] = 'page/%#%'; |
| 345 | 351 | $args['base'] = trailingslashit( $url[0] ).'%_%'; |
| 346 | 352 | |
| 347 | - } else { |
|
| 353 | + } |
|
| 354 | + else { |
|
| 348 | 355 | $big = 999999999; |
| 349 | 356 | $args['base'] = str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ); |
| 350 | 357 | } |
@@ -356,7 +363,8 @@ discard block |
||
| 356 | 363 | |
| 357 | 364 | if ( is_int( $prefs ) ) { |
| 358 | 365 | $args['mid_size'] = $prefs - 2; |
| 359 | - } else { |
|
| 366 | + } |
|
| 367 | + else { |
|
| 360 | 368 | $args = array_merge( $args, $prefs ); |
| 361 | 369 | } |
| 362 | 370 | |
@@ -61,6 +61,9 @@ |
||
| 61 | 61 | $this->init(); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | + /** |
|
| 65 | + * @param integer|null $uid |
|
| 66 | + */ |
|
| 64 | 67 | private function verify_id($uid) { |
| 65 | 68 | return $uid; |
| 66 | 69 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $this->import($object); |
| 81 | 81 | |
| 82 | 82 | if (isset($this->first_name) && isset($this->last_name)) { |
| 83 | - $this->name = $this->first_name . ' ' . $this->last_name; |
|
| 83 | + $this->name = $this->first_name.' '.$this->last_name; |
|
| 84 | 84 | } else { |
| 85 | 85 | $this->name = 'Anonymous'; |
| 86 | 86 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @return string |
| 158 | 158 | */ |
| 159 | 159 | public function link() { |
| 160 | - if ( !$this->link ) { |
|
| 160 | + if (!$this->link) { |
|
| 161 | 161 | $this->link = get_author_posts_url($this->ID); |
| 162 | 162 | } |
| 163 | 163 | |
@@ -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 | |
@@ -109,21 +109,21 @@ |
||
| 109 | 109 | * |
| 110 | 110 | * @return boolean |
| 111 | 111 | */ |
| 112 | - public function can_edit() { |
|
| 113 | - if ( !function_exists( 'current_user_can' ) ) { |
|
| 114 | - return false; |
|
| 115 | - } |
|
| 116 | - if ( current_user_can( 'edit_post', $this->ID ) ) { |
|
| 117 | - return true; |
|
| 118 | - } |
|
| 119 | - return false; |
|
| 120 | - } |
|
| 121 | - |
|
| 122 | - /** |
|
| 123 | - * Returns the Post Edit url |
|
| 124 | - * |
|
| 125 | - * @return string |
|
| 126 | - */ |
|
| 112 | + public function can_edit() { |
|
| 113 | + if ( !function_exists( 'current_user_can' ) ) { |
|
| 114 | + return false; |
|
| 115 | + } |
|
| 116 | + if ( current_user_can( 'edit_post', $this->ID ) ) { |
|
| 117 | + return true; |
|
| 118 | + } |
|
| 119 | + return false; |
|
| 120 | + } |
|
| 121 | + |
|
| 122 | + /** |
|
| 123 | + * Returns the Post Edit url |
|
| 124 | + * |
|
| 125 | + * @return string |
|
| 126 | + */ |
|
| 127 | 127 | public function get_edit_url() { |
| 128 | 128 | if ( $this->can_edit() ) { |
| 129 | 129 | return get_edit_post_link($this->ID); |
@@ -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 | |
@@ -258,7 +258,8 @@ discard block |
||
| 258 | 258 | if ( $force ) { |
| 259 | 259 | $text = ClassyHelper::trim_words($this->post_excerpt, $len, false); |
| 260 | 260 | $trimmed = true; |
| 261 | - } else { |
|
| 261 | + } |
|
| 262 | + else { |
|
| 262 | 263 | $text = $this->post_excerpt; |
| 263 | 264 | } |
| 264 | 265 | |
@@ -318,7 +319,8 @@ discard block |
||
| 318 | 319 | |
| 319 | 320 | if ( $readmore && isset($readmore_matches) && !empty($readmore_matches[1]) ) { |
| 320 | 321 | $text .= ' <a href="' . $this->get_permalink() . '" class="read-more">' . trim($readmore_matches[1]) . '</a>'; |
| 321 | - } elseif ( $readmore ) { |
|
| 322 | + } |
|
| 323 | + elseif ( $readmore ) { |
|
| 322 | 324 | $text .= ' <a href="' . $this->get_permalink() . '" class="read-more">' . trim($readmore) . '</a>'; |
| 323 | 325 | } |
| 324 | 326 | |
@@ -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 | |
@@ -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,7 +24,7 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | public function enqueue_styles() { |
| 26 | 26 | |
| 27 | - wp_register_style( 'general_css', THEME_DIR . 'assets/css/general.css', array(), THEME_VERSION, 'all' ); |
|
| 27 | + wp_register_style('general_css', THEME_DIR.'assets/css/general.css', array(), THEME_VERSION, 'all'); |
|
| 28 | 28 | |
| 29 | 29 | // wp_enqueue_style( 'general_css' ); |
| 30 | 30 | |
@@ -35,13 +35,13 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function enqueue_scripts() { |
| 37 | 37 | |
| 38 | - if ( Classy::get_config_var('environment') == 'production' ) { |
|
| 38 | + if (Classy::get_config_var('environment') == 'production') { |
|
| 39 | 39 | |
| 40 | - wp_register_script( 'theme_scripts', THEME_DIR . 'assets/js/min/production.js', array( 'jquery' ), THEME_VERSION, true ); |
|
| 40 | + wp_register_script('theme_scripts', THEME_DIR.'assets/js/min/production.js', array('jquery'), THEME_VERSION, true); |
|
| 41 | 41 | |
| 42 | 42 | } else { |
| 43 | 43 | |
| 44 | - wp_register_script( 'theme_scripts', THEME_DIR . 'assets/js/scripts.js', array( 'jquery' ), THEME_VERSION, true ); |
|
| 44 | + wp_register_script('theme_scripts', THEME_DIR.'assets/js/scripts.js', array('jquery'), THEME_VERSION, true); |
|
| 45 | 45 | |
| 46 | 46 | } |
| 47 | 47 | |
@@ -36,13 +36,13 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | public static function get_current_query() { |
| 38 | 38 | |
| 39 | - global $wp_query; |
|
| 39 | + global $wp_query; |
|
| 40 | 40 | |
| 41 | - $query =& $wp_query; |
|
| 41 | + $query =& $wp_query; |
|
| 42 | 42 | |
| 43 | - $query = self::handle_maybe_custom_posts_page($query); |
|
| 43 | + $query = self::handle_maybe_custom_posts_page($query); |
|
| 44 | 44 | |
| 45 | - return $query; |
|
| 45 | + return $query; |
|
| 46 | 46 | |
| 47 | 47 | } |
| 48 | 48 | |
@@ -52,20 +52,20 @@ 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 | - if ($custom_posts_page = get_option('page_for_posts')) { |
|
| 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 | - return new WP_Query(array('post_type' => 'post')); |
|
| 61 | + return new WP_Query(array('post_type' => 'post')); |
|
| 62 | 62 | |
| 63 | - } |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - } |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - return $query; |
|
| 67 | + return $query; |
|
| 68 | 68 | |
| 69 | - } |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | 71 | } |
| 72 | 72 | \ No newline at end of file |
@@ -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,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 | |
@@ -6,36 +6,36 @@ |
||
| 6 | 6 | |
| 7 | 7 | class ClassyBasis { |
| 8 | 8 | |
| 9 | - /** |
|
| 10 | - * Imports data params into the class instance |
|
| 11 | - * |
|
| 12 | - * @param object/array $data |
|
| 13 | - * @return void |
|
| 14 | - */ |
|
| 9 | + /** |
|
| 10 | + * Imports data params into the class instance |
|
| 11 | + * |
|
| 12 | + * @param object/array $data |
|
| 13 | + * @return void |
|
| 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 | - $this->$key = $value; |
|
| 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 | - $this->$key = $value; |
|
| 33 | + $this->$key = $value; |
|
| 34 | 34 | |
| 35 | - } |
|
| 36 | - } |
|
| 35 | + } |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - } |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | 40 | } |
| 41 | 41 | |
@@ -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 | |
@@ -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 | |
@@ -29,7 +29,8 @@ discard block |
||
| 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 | |
@@ -148,11 +149,15 @@ discard block |
||
| 148 | 149 | |
| 149 | 150 | $menu_id = get_term_by('slug', $slug, 'nav_menu'); |
| 150 | 151 | |
| 151 | - if ($menu_id) return $menu_id; |
|
| 152 | + if ($menu_id) { |
|
| 153 | + return $menu_id; |
|
| 154 | + } |
|
| 152 | 155 | |
| 153 | 156 | $menu_id = get_term_by('name', $slug, 'nav_menu'); |
| 154 | 157 | |
| 155 | - if ($menu_id) return $menu_id; |
|
| 158 | + if ($menu_id) { |
|
| 159 | + return $menu_id; |
|
| 160 | + } |
|
| 156 | 161 | |
| 157 | 162 | } |
| 158 | 163 | |
@@ -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 | |
@@ -43,6 +43,7 @@ |
||
| 43 | 43 | /** |
| 44 | 44 | * Extends Scope with scope that is defined in theme_name/scope folder |
| 45 | 45 | * |
| 46 | + * @param string|false $template_name |
|
| 46 | 47 | * @return array |
| 47 | 48 | */ |
| 48 | 49 | public static function extend_scope($scope, $template_name) { |
@@ -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 | |