@@ -23,25 +23,25 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @param string $arg it can be menu id, slug or full name |
| 25 | 25 | */ |
| 26 | - public function __construct( $arg = null ) { |
|
| 26 | + public function __construct($arg = null) { |
|
| 27 | 27 | |
| 28 | - if ( is_numeric( $arg ) && 0 != $arg ) { |
|
| 28 | + if (is_numeric($arg) && 0 != $arg) { |
|
| 29 | 29 | |
| 30 | - $menu_id = $this->check_menu_id( $arg ); |
|
| 30 | + $menu_id = $this->check_menu_id($arg); |
|
| 31 | 31 | |
| 32 | - } elseif ( is_string( $arg ) ) { |
|
| 32 | + } elseif (is_string($arg)) { |
|
| 33 | 33 | |
| 34 | - $menu_id = $this->get_menu_id_by_name( $arg ); |
|
| 34 | + $menu_id = $this->get_menu_id_by_name($arg); |
|
| 35 | 35 | |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - if ( ! isset( $menu_id ) ) { |
|
| 38 | + if (!isset($menu_id)) { |
|
| 39 | 39 | |
| 40 | 40 | $menu_id = $this->get_first_menu_id(); |
| 41 | 41 | |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - if ( $menu_id ) { |
|
| 44 | + if ($menu_id) { |
|
| 45 | 45 | |
| 46 | 46 | $this->ID = $menu_id; |
| 47 | 47 | |
@@ -60,22 +60,22 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | $_return = array(); |
| 62 | 62 | |
| 63 | - $items = wp_get_nav_menu_items( $this->ID ); |
|
| 63 | + $items = wp_get_nav_menu_items($this->ID); |
|
| 64 | 64 | |
| 65 | - foreach ( $items as $item ) { |
|
| 65 | + foreach ($items as $item) { |
|
| 66 | 66 | |
| 67 | - $_return[ $item->ID ] = new ClassyMenuItem( $item ); |
|
| 67 | + $_return[$item->ID] = new ClassyMenuItem($item); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | // Apply nesting |
| 71 | 71 | |
| 72 | - foreach ( $_return as $item_id => $item ) { |
|
| 72 | + foreach ($_return as $item_id => $item) { |
|
| 73 | 73 | |
| 74 | - if ( isset( $item->menu_item_parent ) && $item->menu_item_parent && isset( $_return[ $item->menu_item_parent ] ) ) { |
|
| 74 | + if (isset($item->menu_item_parent) && $item->menu_item_parent && isset($_return[$item->menu_item_parent])) { |
|
| 75 | 75 | |
| 76 | - $_return[ $item->menu_item_parent ]->add_child( $item ); |
|
| 76 | + $_return[$item->menu_item_parent]->add_child($item); |
|
| 77 | 77 | |
| 78 | - unset( $_return[ $item_id ] ); |
|
| 78 | + unset($_return[$item_id]); |
|
| 79 | 79 | |
| 80 | 80 | } |
| 81 | 81 | } |
@@ -91,11 +91,11 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | protected function get_first_menu_id() { |
| 93 | 93 | |
| 94 | - $menus = get_terms( 'nav_menu', array( 'hide_empty' => true ) ); |
|
| 94 | + $menus = get_terms('nav_menu', array('hide_empty' => true)); |
|
| 95 | 95 | |
| 96 | - if ( is_array( $menus ) && count( $menus ) ) { |
|
| 96 | + if (is_array($menus) && count($menus)) { |
|
| 97 | 97 | |
| 98 | - if ( isset( $menus[0]->term_id ) ) { |
|
| 98 | + if (isset($menus[0]->term_id)) { |
|
| 99 | 99 | |
| 100 | 100 | return $menus[0]->term_id; |
| 101 | 101 | |
@@ -112,15 +112,15 @@ discard block |
||
| 112 | 112 | * @param int $menu_id |
| 113 | 113 | * @return int/boolean |
| 114 | 114 | */ |
| 115 | - protected function check_menu_id( $menu_id ) { |
|
| 115 | + protected function check_menu_id($menu_id) { |
|
| 116 | 116 | |
| 117 | - $menus = get_terms( 'nav_menu', array( 'hide_empty' => true ) ); |
|
| 117 | + $menus = get_terms('nav_menu', array('hide_empty' => true)); |
|
| 118 | 118 | |
| 119 | - if ( is_array( $menus ) && count( $menus ) ) { |
|
| 119 | + if (is_array($menus) && count($menus)) { |
|
| 120 | 120 | |
| 121 | - foreach ( $menus as $menu ) { |
|
| 121 | + foreach ($menus as $menu) { |
|
| 122 | 122 | |
| 123 | - if ( $menu->term_id == $menu_id ) { |
|
| 123 | + if ($menu->term_id == $menu_id) { |
|
| 124 | 124 | |
| 125 | 125 | return $menu_id; |
| 126 | 126 | |
@@ -138,17 +138,17 @@ discard block |
||
| 138 | 138 | * @param string $slug |
| 139 | 139 | * @return int |
| 140 | 140 | */ |
| 141 | - protected function get_menu_id_by_name( $slug = null ) { |
|
| 141 | + protected function get_menu_id_by_name($slug = null) { |
|
| 142 | 142 | |
| 143 | - if ( $slug && is_string( $slug ) ) { |
|
| 143 | + if ($slug && is_string($slug)) { |
|
| 144 | 144 | |
| 145 | - $menu_id = get_term_by( 'slug', $slug, 'nav_menu' ); |
|
| 145 | + $menu_id = get_term_by('slug', $slug, 'nav_menu'); |
|
| 146 | 146 | |
| 147 | - if ( $menu_id ) { return $menu_id; } |
|
| 147 | + if ($menu_id) { return $menu_id; } |
|
| 148 | 148 | |
| 149 | - $menu_id = get_term_by( 'name', $slug, 'nav_menu' ); |
|
| 149 | + $menu_id = get_term_by('name', $slug, 'nav_menu'); |
|
| 150 | 150 | |
| 151 | - if ( $menu_id ) { return $menu_id; } |
|
| 151 | + if ($menu_id) { return $menu_id; } |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | 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 | |
@@ -16,21 +16,21 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @return array |
| 18 | 18 | */ |
| 19 | - public static function get_scope( $view_name = null ) { |
|
| 19 | + public static function get_scope($view_name = null) { |
|
| 20 | 20 | |
| 21 | 21 | $scope = self::get_common_scope(); |
| 22 | 22 | |
| 23 | - if ( is_string( $view_name ) ) { |
|
| 23 | + if (is_string($view_name)) { |
|
| 24 | 24 | |
| 25 | - $scope = self::extend_scope( $scope, $view_name ); |
|
| 25 | + $scope = self::extend_scope($scope, $view_name); |
|
| 26 | 26 | |
| 27 | 27 | } else { |
| 28 | 28 | |
| 29 | 29 | $request = ClassyHierarchy::get_current_request(); |
| 30 | 30 | |
| 31 | - $file = ClassyHierarchy::get_available_file( 'scope', $request ); |
|
| 31 | + $file = ClassyHierarchy::get_available_file('scope', $request); |
|
| 32 | 32 | |
| 33 | - $scope = self::extend_scope( $scope, $file ); |
|
| 33 | + $scope = self::extend_scope($scope, $file); |
|
| 34 | 34 | |
| 35 | 35 | } |
| 36 | 36 | |
@@ -44,9 +44,9 @@ discard block |
||
| 44 | 44 | * |
| 45 | 45 | * @return array |
| 46 | 46 | */ |
| 47 | - public static function extend_scope( $scope, $view_name ) { |
|
| 47 | + public static function extend_scope($scope, $view_name) { |
|
| 48 | 48 | |
| 49 | - $scope = array_merge( $scope, self::require_scope( $view_name ) ); |
|
| 49 | + $scope = array_merge($scope, self::require_scope($view_name)); |
|
| 50 | 50 | |
| 51 | 51 | return $scope; |
| 52 | 52 | |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | public static function get_common_scope() { |
| 62 | 62 | |
| 63 | - if ( null === self::$common ) { |
|
| 63 | + if (null === self::$common) { |
|
| 64 | 64 | |
| 65 | - self::$common = self::require_scope( 'common' ); |
|
| 65 | + self::$common = self::require_scope('common'); |
|
| 66 | 66 | |
| 67 | 67 | } |
| 68 | 68 | |
@@ -76,19 +76,19 @@ discard block |
||
| 76 | 76 | * @param string $filename |
| 77 | 77 | * @return array |
| 78 | 78 | */ |
| 79 | - public static function require_scope( $filename ) { |
|
| 79 | + public static function require_scope($filename) { |
|
| 80 | 80 | |
| 81 | 81 | $return = array(); |
| 82 | 82 | |
| 83 | - $file = THEME_PATH . 'scope/' . $filename . '.php'; |
|
| 83 | + $file = THEME_PATH.'scope/'.$filename.'.php'; |
|
| 84 | 84 | |
| 85 | - if ( file_exists( $file ) ) { |
|
| 85 | + if (file_exists($file)) { |
|
| 86 | 86 | |
| 87 | 87 | require $file; |
| 88 | 88 | |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - if ( isset( $data ) ) { |
|
| 91 | + if (isset($data)) { |
|
| 92 | 92 | |
| 93 | 93 | $return = $data; |
| 94 | 94 | |
@@ -41,11 +41,11 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @param WP_Post $item |
| 43 | 43 | */ |
| 44 | - public function __construct( $item ) { |
|
| 44 | + public function __construct($item) { |
|
| 45 | 45 | |
| 46 | - if ( is_a( $item, 'WP_Post' ) ) { |
|
| 46 | + if (is_a($item, 'WP_Post')) { |
|
| 47 | 47 | |
| 48 | - $this->import( $item ); |
|
| 48 | + $this->import($item); |
|
| 49 | 49 | $this->filter_classes(); |
| 50 | 50 | |
| 51 | 51 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public function get_classes() { |
| 104 | 104 | |
| 105 | - return implode( ' ', $this->classes ); |
|
| 105 | + return implode(' ', $this->classes); |
|
| 106 | 106 | |
| 107 | 107 | } |
| 108 | 108 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * |
| 112 | 112 | * @param string $class_name |
| 113 | 113 | */ |
| 114 | - public function add_class( $class_name ) { |
|
| 114 | + public function add_class($class_name) { |
|
| 115 | 115 | |
| 116 | 116 | $this->classes[] = $class_name; |
| 117 | 117 | |
@@ -122,17 +122,17 @@ discard block |
||
| 122 | 122 | * |
| 123 | 123 | * @param ClassyMenuItem $item |
| 124 | 124 | */ |
| 125 | - public function add_child( $item ) { |
|
| 125 | + public function add_child($item) { |
|
| 126 | 126 | |
| 127 | - if ( ! $this->has_child ) { |
|
| 128 | - $this->add_class( 'menu-item-has-children' ); |
|
| 127 | + if (!$this->has_child) { |
|
| 128 | + $this->add_class('menu-item-has-children'); |
|
| 129 | 129 | $this->has_child = true; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | $this->children[] = $item; |
| 133 | 133 | $item->level = $this->level + 1; |
| 134 | 134 | |
| 135 | - if ( $item->children ) { |
|
| 135 | + if ($item->children) { |
|
| 136 | 136 | $this->update_child_levels(); |
| 137 | 137 | } |
| 138 | 138 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | protected function filter_classes() { |
| 147 | 147 | |
| 148 | - $this->classes = apply_filters( 'nav_menu_css_class', $this->classes, $this ); |
|
| 148 | + $this->classes = apply_filters('nav_menu_css_class', $this->classes, $this); |
|
| 149 | 149 | |
| 150 | 150 | } |
| 151 | 151 | |
@@ -156,9 +156,9 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | protected function update_child_levels() { |
| 158 | 158 | |
| 159 | - if ( is_array( $this->children ) ) { |
|
| 159 | + if (is_array($this->children)) { |
|
| 160 | 160 | |
| 161 | - foreach ( $this->children as $child ) { |
|
| 161 | + foreach ($this->children as $child) { |
|
| 162 | 162 | $child->level = $this->level + 1; |
| 163 | 163 | $child->update_child_levels(); |
| 164 | 164 | } |
@@ -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,30 +27,30 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | public static function get_vars() { |
| 29 | 29 | |
| 30 | - if ( null === self::$vars ) { |
|
| 30 | + if (null === self::$vars) { |
|
| 31 | 31 | |
| 32 | 32 | // Check for a theme config |
| 33 | - $config_file = THEME_FRAMEWORK_PATH . 'config.php'; |
|
| 33 | + $config_file = THEME_FRAMEWORK_PATH.'config.php'; |
|
| 34 | 34 | |
| 35 | - if ( file_exists( $config_file ) ) { |
|
| 35 | + if (file_exists($config_file)) { |
|
| 36 | 36 | |
| 37 | - require_once THEME_FRAMEWORK_PATH . 'config.php'; |
|
| 37 | + require_once THEME_FRAMEWORK_PATH.'config.php'; |
|
| 38 | 38 | |
| 39 | 39 | $vars = self::get_allowed_variables(); |
| 40 | 40 | |
| 41 | - foreach ( $vars as $var ) { |
|
| 41 | + foreach ($vars as $var) { |
|
| 42 | 42 | |
| 43 | - if ( isset( $$var ) ) { |
|
| 43 | + if (isset($$var)) { |
|
| 44 | 44 | |
| 45 | - self::$vars[ $var ] = $$var; |
|
| 45 | + self::$vars[$var] = $$var; |
|
| 46 | 46 | |
| 47 | - unset( $$var ); // We don't require it anymore |
|
| 47 | + unset($$var); // We don't require it anymore |
|
| 48 | 48 | |
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | } else { |
| 52 | 52 | |
| 53 | - die( 'There is no config file in ' . THEME . ' custom/config.php' ); |
|
| 53 | + die('There is no config file in '.THEME.' custom/config.php'); |
|
| 54 | 54 | |
| 55 | 55 | } |
| 56 | 56 | } |
@@ -69,16 +69,16 @@ discard block |
||
| 69 | 69 | $vars = self::get_vars(); |
| 70 | 70 | |
| 71 | 71 | // Init Post Types |
| 72 | - if ( isset( $vars['post_types'] ) ) { self::init_post_types( $vars['post_types'] ); } |
|
| 72 | + if (isset($vars['post_types'])) { self::init_post_types($vars['post_types']); } |
|
| 73 | 73 | |
| 74 | 74 | // Init Taxonomies |
| 75 | - if ( isset( $vars['taxonomies'] ) ) { self::init_taxonomies( $vars['taxonomies'] ); } |
|
| 75 | + if (isset($vars['taxonomies'])) { self::init_taxonomies($vars['taxonomies']); } |
|
| 76 | 76 | |
| 77 | 77 | // Init Post Formats |
| 78 | - if ( isset( $vars['post_formats'] ) ) { self::init_post_formats( $vars['post_formats'] ); } |
|
| 78 | + if (isset($vars['post_formats'])) { self::init_post_formats($vars['post_formats']); } |
|
| 79 | 79 | |
| 80 | 80 | // Init Sidebars |
| 81 | - if ( isset( $vars['sidebars'] ) ) { self::init_sidebars( $vars['sidebars'] ); } |
|
| 81 | + if (isset($vars['sidebars'])) { self::init_sidebars($vars['sidebars']); } |
|
| 82 | 82 | |
| 83 | 83 | } |
| 84 | 84 | |
@@ -89,13 +89,13 @@ discard block |
||
| 89 | 89 | * |
| 90 | 90 | * @param array $post_types |
| 91 | 91 | */ |
| 92 | - private static function init_post_types( $post_types ) { |
|
| 92 | + private static function init_post_types($post_types) { |
|
| 93 | 93 | |
| 94 | - if ( is_array( $post_types ) ) { |
|
| 94 | + if (is_array($post_types)) { |
|
| 95 | 95 | |
| 96 | - foreach ( $post_types as $type => $options ) { |
|
| 96 | + foreach ($post_types as $type => $options) { |
|
| 97 | 97 | |
| 98 | - self::add_post_type( $type, $options['config'], $options['singular'], $options['multiple'] ); |
|
| 98 | + self::add_post_type($type, $options['config'], $options['singular'], $options['multiple']); |
|
| 99 | 99 | |
| 100 | 100 | } |
| 101 | 101 | } |
@@ -111,28 +111,28 @@ discard block |
||
| 111 | 111 | * @param string $singular |
| 112 | 112 | * @param string $multiple |
| 113 | 113 | */ |
| 114 | - private static function add_post_type( $name, $config, $singular = 'Entry', $multiple = 'Entries' ) { |
|
| 114 | + private static function add_post_type($name, $config, $singular = 'Entry', $multiple = 'Entries') { |
|
| 115 | 115 | |
| 116 | 116 | $domain = Classy::textdomain(); |
| 117 | 117 | |
| 118 | - if ( ! isset( $config['labels'] ) ) { |
|
| 118 | + if (!isset($config['labels'])) { |
|
| 119 | 119 | |
| 120 | 120 | $config['labels'] = array( |
| 121 | - 'name' => __( $multiple, $domain ), |
|
| 122 | - 'singular_name' => __( $singular, $domain ), |
|
| 123 | - 'not_found' => __( 'No ' . $multiple . ' Found', $domain ), |
|
| 124 | - 'not_found_in_trash' => __( 'No ' . $multiple . ' found in Trash', $domain ), |
|
| 125 | - 'edit_item' => __( 'Edit ', $singular, $domain ), |
|
| 126 | - 'search_items' => __( 'Search ' . $multiple, $domain ), |
|
| 127 | - 'view_item' => __( 'View ', $singular, $domain ), |
|
| 128 | - 'new_item' => __( 'New ' . $singular, $domain ), |
|
| 129 | - 'add_new' => __( 'Add New', $domain ), |
|
| 130 | - 'add_new_item' => __( 'Add New ' . $singular, $domain ), |
|
| 121 | + 'name' => __($multiple, $domain), |
|
| 122 | + 'singular_name' => __($singular, $domain), |
|
| 123 | + 'not_found' => __('No '.$multiple.' Found', $domain), |
|
| 124 | + 'not_found_in_trash' => __('No '.$multiple.' found in Trash', $domain), |
|
| 125 | + 'edit_item' => __('Edit ', $singular, $domain), |
|
| 126 | + 'search_items' => __('Search '.$multiple, $domain), |
|
| 127 | + 'view_item' => __('View ', $singular, $domain), |
|
| 128 | + 'new_item' => __('New '.$singular, $domain), |
|
| 129 | + 'add_new' => __('Add New', $domain), |
|
| 130 | + 'add_new_item' => __('Add New '.$singular, $domain), |
|
| 131 | 131 | ); |
| 132 | 132 | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - register_post_type( $name, $config ); |
|
| 135 | + register_post_type($name, $config); |
|
| 136 | 136 | |
| 137 | 137 | } |
| 138 | 138 | |
@@ -141,13 +141,13 @@ discard block |
||
| 141 | 141 | * |
| 142 | 142 | * @param array $taxonomies |
| 143 | 143 | */ |
| 144 | - private static function init_taxonomies( $taxonomies ) { |
|
| 144 | + private static function init_taxonomies($taxonomies) { |
|
| 145 | 145 | |
| 146 | - if ( is_array( $taxonomies ) ) { |
|
| 146 | + if (is_array($taxonomies)) { |
|
| 147 | 147 | |
| 148 | - foreach ( $taxonomies as $type => $options ) { |
|
| 148 | + foreach ($taxonomies as $type => $options) { |
|
| 149 | 149 | |
| 150 | - self::add_taxonomy( $type, $options['for'], $options['config'], $options['singular'], $options['multiple'] ); |
|
| 150 | + self::add_taxonomy($type, $options['for'], $options['config'], $options['singular'], $options['multiple']); |
|
| 151 | 151 | |
| 152 | 152 | } |
| 153 | 153 | } |
@@ -163,29 +163,29 @@ discard block |
||
| 163 | 163 | * @param string $singular |
| 164 | 164 | * @param string $multiple |
| 165 | 165 | */ |
| 166 | - private static function add_taxonomy( $name, $object_type, $config, $singular = 'Entry', $multiple = 'Entries' ) { |
|
| 166 | + private static function add_taxonomy($name, $object_type, $config, $singular = 'Entry', $multiple = 'Entries') { |
|
| 167 | 167 | |
| 168 | 168 | $domain = Classy::textdomain(); |
| 169 | 169 | |
| 170 | - if ( ! isset( $config['labels'] ) ) { |
|
| 170 | + if (!isset($config['labels'])) { |
|
| 171 | 171 | |
| 172 | 172 | $config['labels'] = array( |
| 173 | - 'name' => __( $multiple, $domain ), |
|
| 174 | - 'singular_name' => __( $singular, $domain ), |
|
| 175 | - 'search_items' => __( 'Search ' . $multiple, $domain ), |
|
| 176 | - 'all_items' => __( 'All ' . $multiple, $domain ), |
|
| 177 | - 'parent_item' => __( 'Parent ' . $singular, $domain ), |
|
| 178 | - 'parent_item_colon' => __( 'Parent ' . $singular . ':', $domain ), |
|
| 179 | - 'edit_item' => __( 'Edit ' . $singular, $domain ), |
|
| 180 | - 'update_item' => __( 'Update ' . $singular, $domain ), |
|
| 181 | - 'add_new_item' => __( 'Add New ' . $singular, $domain ), |
|
| 182 | - 'new_item_name' => __( 'New ' . $singular . ' Name', $domain ), |
|
| 183 | - 'menu_name' => __( $singular, $domain ), |
|
| 173 | + 'name' => __($multiple, $domain), |
|
| 174 | + 'singular_name' => __($singular, $domain), |
|
| 175 | + 'search_items' => __('Search '.$multiple, $domain), |
|
| 176 | + 'all_items' => __('All '.$multiple, $domain), |
|
| 177 | + 'parent_item' => __('Parent '.$singular, $domain), |
|
| 178 | + 'parent_item_colon' => __('Parent '.$singular.':', $domain), |
|
| 179 | + 'edit_item' => __('Edit '.$singular, $domain), |
|
| 180 | + 'update_item' => __('Update '.$singular, $domain), |
|
| 181 | + 'add_new_item' => __('Add New '.$singular, $domain), |
|
| 182 | + 'new_item_name' => __('New '.$singular.' Name', $domain), |
|
| 183 | + 'menu_name' => __($singular, $domain), |
|
| 184 | 184 | ); |
| 185 | 185 | |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - register_taxonomy( $name, $object_type, $config ); |
|
| 188 | + register_taxonomy($name, $object_type, $config); |
|
| 189 | 189 | |
| 190 | 190 | } |
| 191 | 191 | |
@@ -194,11 +194,11 @@ discard block |
||
| 194 | 194 | * |
| 195 | 195 | * @param array $post_formats |
| 196 | 196 | */ |
| 197 | - private static function init_post_formats( $post_formats ) { |
|
| 197 | + private static function init_post_formats($post_formats) { |
|
| 198 | 198 | |
| 199 | - if ( is_array( $post_formats ) ) { |
|
| 199 | + if (is_array($post_formats)) { |
|
| 200 | 200 | |
| 201 | - add_theme_support( 'post-formats', $post_formats ); |
|
| 201 | + add_theme_support('post-formats', $post_formats); |
|
| 202 | 202 | |
| 203 | 203 | } |
| 204 | 204 | |
@@ -209,19 +209,19 @@ discard block |
||
| 209 | 209 | * |
| 210 | 210 | * @param array $sidebars |
| 211 | 211 | */ |
| 212 | - private static function init_sidebars( $sidebars ) { |
|
| 212 | + private static function init_sidebars($sidebars) { |
|
| 213 | 213 | |
| 214 | 214 | $domain = Classy::textdomain(); |
| 215 | 215 | |
| 216 | - if ( is_array( $sidebars ) ) { |
|
| 216 | + if (is_array($sidebars)) { |
|
| 217 | 217 | |
| 218 | - foreach ( $sidebars as $id => $title ) { |
|
| 218 | + foreach ($sidebars as $id => $title) { |
|
| 219 | 219 | |
| 220 | 220 | register_sidebar( |
| 221 | 221 | array( |
| 222 | 222 | 'id' => $id, |
| 223 | - 'name' => __( $title, $domain ), |
|
| 224 | - 'description' => __( $title, $domain ), |
|
| 223 | + 'name' => __($title, $domain), |
|
| 224 | + 'description' => __($title, $domain), |
|
| 225 | 225 | 'before_widget' => '<div id="%1$s" class="widget %2$s"><div class="widget-inner">', |
| 226 | 226 | 'after_widget' => '</div></div>', |
| 227 | 227 | '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 | |
@@ -49,11 +49,11 @@ discard block |
||
| 49 | 49 | * |
| 50 | 50 | * @param WP_Comment $item |
| 51 | 51 | */ |
| 52 | - public function __construct( $item ) { |
|
| 52 | + public function __construct($item) { |
|
| 53 | 53 | |
| 54 | - if ( is_a( $item, 'WP_Comment' ) ) { |
|
| 54 | + if (is_a($item, 'WP_Comment')) { |
|
| 55 | 55 | |
| 56 | - $this->import( $item ); |
|
| 56 | + $this->import($item); |
|
| 57 | 57 | |
| 58 | 58 | } |
| 59 | 59 | |
@@ -66,15 +66,15 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function author() { |
| 68 | 68 | |
| 69 | - if ( $this->user_id ) { |
|
| 69 | + if ($this->user_id) { |
|
| 70 | 70 | |
| 71 | - return new ClassyUser( $this->user_id ); |
|
| 71 | + return new ClassyUser($this->user_id); |
|
| 72 | 72 | |
| 73 | 73 | } else { |
| 74 | 74 | |
| 75 | - $author = new ClassyUser( 0 ); |
|
| 75 | + $author = new ClassyUser(0); |
|
| 76 | 76 | |
| 77 | - if ( isset( $this->comment_author ) && $this->comment_author ) { |
|
| 77 | + if (isset($this->comment_author) && $this->comment_author) { |
|
| 78 | 78 | |
| 79 | 79 | $author->name = $this->comment_author; |
| 80 | 80 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * @return string |
| 92 | 92 | */ |
| 93 | 93 | public function content() { |
| 94 | - return apply_filters( 'get_comment_text ', $this->comment_content ); |
|
| 94 | + return apply_filters('get_comment_text ', $this->comment_content); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | * @param string $date_format |
| 110 | 110 | * @return string |
| 111 | 111 | */ |
| 112 | - public function date( $date_format = '' ) { |
|
| 113 | - $df = $date_format ? $date_format : get_option( 'date_format' ); |
|
| 114 | - $the_date = (string) mysql2date( $df, $this->comment_date ); |
|
| 112 | + public function date($date_format = '') { |
|
| 113 | + $df = $date_format ? $date_format : get_option('date_format'); |
|
| 114 | + $the_date = (string) mysql2date($df, $this->comment_date); |
|
| 115 | 115 | |
| 116 | - return apply_filters( 'get_comment_date ', $the_date, $df ); |
|
| 116 | + return apply_filters('get_comment_date ', $the_date, $df); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
@@ -132,26 +132,26 @@ discard block |
||
| 132 | 132 | * @param string $default |
| 133 | 133 | * @return string |
| 134 | 134 | */ |
| 135 | - public function avatar( $size = 92, $default = '' ) { |
|
| 135 | + public function avatar($size = 92, $default = '') { |
|
| 136 | 136 | |
| 137 | - if ( ! get_option( 'show_avatars' ) ) { |
|
| 137 | + if (!get_option('show_avatars')) { |
|
| 138 | 138 | return false; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - if ( ! is_numeric( $size ) ) { $size = '92'; } |
|
| 141 | + if (!is_numeric($size)) { $size = '92'; } |
|
| 142 | 142 | |
| 143 | 143 | $email = $this->get_avatar_email(); |
| 144 | 144 | $email_hash = ''; |
| 145 | 145 | |
| 146 | - if ( ! empty( $email ) ) { |
|
| 147 | - $email_hash = md5( strtolower( trim( $email ) ) ); |
|
| 146 | + if (!empty($email)) { |
|
| 147 | + $email_hash = md5(strtolower(trim($email))); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - $host = $this->get_avatar_host( $email_hash ); |
|
| 151 | - $default = $this->get_default_avatar( $default, $email, $size, $host ); |
|
| 150 | + $host = $this->get_avatar_host($email_hash); |
|
| 151 | + $default = $this->get_default_avatar($default, $email, $size, $host); |
|
| 152 | 152 | |
| 153 | - if ( ! empty( $email ) ) { |
|
| 154 | - $avatar = $this->get_avatar_url( $default, $host, $email_hash, $size ); |
|
| 153 | + if (!empty($email)) { |
|
| 154 | + $avatar = $this->get_avatar_url($default, $host, $email_hash, $size); |
|
| 155 | 155 | } else { |
| 156 | 156 | $avatar = $default; |
| 157 | 157 | } |
@@ -168,9 +168,9 @@ discard block |
||
| 168 | 168 | protected function get_avatar_email() { |
| 169 | 169 | |
| 170 | 170 | $id = (int) $this->user_id; |
| 171 | - $user = get_userdata( $id ); |
|
| 171 | + $user = get_userdata($id); |
|
| 172 | 172 | |
| 173 | - if ( $user ) { |
|
| 173 | + if ($user) { |
|
| 174 | 174 | $email = $user->user_email; |
| 175 | 175 | } else { |
| 176 | 176 | $email = $this->comment_author_email; |
@@ -189,32 +189,32 @@ discard block |
||
| 189 | 189 | * @param string $host |
| 190 | 190 | * @return string |
| 191 | 191 | */ |
| 192 | - protected function get_default_avatar( $default, $email, $size, $host ) { |
|
| 192 | + protected function get_default_avatar($default, $email, $size, $host) { |
|
| 193 | 193 | |
| 194 | - if ( substr( $default, 0, 1 ) == '/' ) { |
|
| 195 | - $default = home_url() . $default; |
|
| 194 | + if (substr($default, 0, 1) == '/') { |
|
| 195 | + $default = home_url().$default; |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - if ( empty( $default ) ) { |
|
| 199 | - $avatar_default = get_option( 'avatar_default' ); |
|
| 200 | - if ( empty( $avatar_default ) ) { |
|
| 198 | + if (empty($default)) { |
|
| 199 | + $avatar_default = get_option('avatar_default'); |
|
| 200 | + if (empty($avatar_default)) { |
|
| 201 | 201 | $default = 'mystery'; |
| 202 | 202 | } else { |
| 203 | 203 | $default = $avatar_default; |
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | - if ( 'mystery' == $default ) { |
|
| 208 | - $default = $host . '/avatar/ad516503a11cd5ca435acc9bb6523536?s=' . $size; |
|
| 207 | + if ('mystery' == $default) { |
|
| 208 | + $default = $host.'/avatar/ad516503a11cd5ca435acc9bb6523536?s='.$size; |
|
| 209 | 209 | // ad516503a11cd5ca435acc9bb6523536 == md5('[email protected]') |
| 210 | - } else if ( 'blank' == $default ) { |
|
| 211 | - $default = $email ? 'blank' : includes_url( 'images/blank.gif' ); |
|
| 212 | - } else if ( ! empty( $email ) && 'gravatar_default' == $default ) { |
|
| 210 | + } else if ('blank' == $default) { |
|
| 211 | + $default = $email ? 'blank' : includes_url('images/blank.gif'); |
|
| 212 | + } else if (!empty($email) && 'gravatar_default' == $default) { |
|
| 213 | 213 | $default = ''; |
| 214 | - } else if ( 'gravatar_default' == $default ) { |
|
| 215 | - $default = $host . '/avatar/?s=' . $size; |
|
| 216 | - } else if ( empty( $email ) && ! strstr( $default, 'http://' ) ) { |
|
| 217 | - $default = $host . '/avatar/?d=' . $default . '&s=' . $size; |
|
| 214 | + } else if ('gravatar_default' == $default) { |
|
| 215 | + $default = $host.'/avatar/?s='.$size; |
|
| 216 | + } else if (empty($email) && !strstr($default, 'http://')) { |
|
| 217 | + $default = $host.'/avatar/?d='.$default.'&s='.$size; |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | return $default; |
@@ -227,13 +227,13 @@ discard block |
||
| 227 | 227 | * @param string $email_hash |
| 228 | 228 | * @return string |
| 229 | 229 | */ |
| 230 | - protected function get_avatar_host( $email_hash ) { |
|
| 230 | + protected function get_avatar_host($email_hash) { |
|
| 231 | 231 | |
| 232 | - if ( is_ssl() ) { |
|
| 232 | + if (is_ssl()) { |
|
| 233 | 233 | $host = 'https://secure.gravatar.com'; |
| 234 | 234 | } else { |
| 235 | - if ( ! empty( $email_hash ) ) { |
|
| 236 | - $host = sprintf( 'http://%d.gravatar.com', (hexdec( $email_hash[0] ) % 2) ); |
|
| 235 | + if (!empty($email_hash)) { |
|
| 236 | + $host = sprintf('http://%d.gravatar.com', (hexdec($email_hash[0]) % 2)); |
|
| 237 | 237 | } else { |
| 238 | 238 | $host = 'http://0.gravatar.com'; |
| 239 | 239 | } |
@@ -252,16 +252,16 @@ discard block |
||
| 252 | 252 | * @param int $size |
| 253 | 253 | * @return string |
| 254 | 254 | */ |
| 255 | - protected function get_avatar_url( $default, $host, $email_hash, $size ) { |
|
| 255 | + protected function get_avatar_url($default, $host, $email_hash, $size) { |
|
| 256 | 256 | |
| 257 | - $_return = $host . '/avatar/' . $email_hash . '?s=' . $size . '&d=' . urlencode( $default ); |
|
| 258 | - $rating = get_option( 'avatar_rating' ); |
|
| 257 | + $_return = $host.'/avatar/'.$email_hash.'?s='.$size.'&d='.urlencode($default); |
|
| 258 | + $rating = get_option('avatar_rating'); |
|
| 259 | 259 | |
| 260 | - if ( ! empty( $rating ) ) { |
|
| 261 | - $_return .= '&r=' . $rating; |
|
| 260 | + if (!empty($rating)) { |
|
| 261 | + $_return .= '&r='.$rating; |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | - return str_replace( '&', '&', esc_url( $_return ) ); |
|
| 264 | + return str_replace('&', '&', esc_url($_return)); |
|
| 265 | 265 | |
| 266 | 266 | } |
| 267 | 267 | |
@@ -270,12 +270,12 @@ discard block |
||
| 270 | 270 | * |
| 271 | 271 | * @param ClassyComment $comment |
| 272 | 272 | */ |
| 273 | - public function add_child( $comment ) { |
|
| 273 | + public function add_child($comment) { |
|
| 274 | 274 | |
| 275 | 275 | $this->children[] = $item; |
| 276 | 276 | $item->level = $this->level + 1; |
| 277 | 277 | |
| 278 | - if ( $item->children ) { |
|
| 278 | + if ($item->children) { |
|
| 279 | 279 | $this->update_child_levels(); |
| 280 | 280 | } |
| 281 | 281 | |
@@ -289,9 +289,9 @@ discard block |
||
| 289 | 289 | */ |
| 290 | 290 | protected function update_child_levels() { |
| 291 | 291 | |
| 292 | - if ( is_array( $this->children ) ) { |
|
| 292 | + if (is_array($this->children)) { |
|
| 293 | 293 | |
| 294 | - foreach ( $this->children as $child ) { |
|
| 294 | + foreach ($this->children as $child) { |
|
| 295 | 295 | $child->level = $this->level + 1; |
| 296 | 296 | $child->update_child_levels(); |
| 297 | 297 | } |
@@ -70,7 +70,8 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | return new ClassyUser( $this->user_id ); |
| 72 | 72 | |
| 73 | - } else { |
|
| 73 | + } |
|
| 74 | + else { |
|
| 74 | 75 | |
| 75 | 76 | $author = new ClassyUser( 0 ); |
| 76 | 77 | |
@@ -152,7 +153,8 @@ discard block |
||
| 152 | 153 | |
| 153 | 154 | if ( ! empty( $email ) ) { |
| 154 | 155 | $avatar = $this->get_avatar_url( $default, $host, $email_hash, $size ); |
| 155 | - } else { |
|
| 156 | + } |
|
| 157 | + else { |
|
| 156 | 158 | $avatar = $default; |
| 157 | 159 | } |
| 158 | 160 | |
@@ -172,7 +174,8 @@ discard block |
||
| 172 | 174 | |
| 173 | 175 | if ( $user ) { |
| 174 | 176 | $email = $user->user_email; |
| 175 | - } else { |
|
| 177 | + } |
|
| 178 | + else { |
|
| 176 | 179 | $email = $this->comment_author_email; |
| 177 | 180 | } |
| 178 | 181 | |
@@ -199,7 +202,8 @@ discard block |
||
| 199 | 202 | $avatar_default = get_option( 'avatar_default' ); |
| 200 | 203 | if ( empty( $avatar_default ) ) { |
| 201 | 204 | $default = 'mystery'; |
| 202 | - } else { |
|
| 205 | + } |
|
| 206 | + else { |
|
| 203 | 207 | $default = $avatar_default; |
| 204 | 208 | } |
| 205 | 209 | } |
@@ -207,13 +211,17 @@ discard block |
||
| 207 | 211 | if ( 'mystery' == $default ) { |
| 208 | 212 | $default = $host . '/avatar/ad516503a11cd5ca435acc9bb6523536?s=' . $size; |
| 209 | 213 | // ad516503a11cd5ca435acc9bb6523536 == md5('[email protected]') |
| 210 | - } else if ( 'blank' == $default ) { |
|
| 214 | + } |
|
| 215 | + else if ( 'blank' == $default ) { |
|
| 211 | 216 | $default = $email ? 'blank' : includes_url( 'images/blank.gif' ); |
| 212 | - } else if ( ! empty( $email ) && 'gravatar_default' == $default ) { |
|
| 217 | + } |
|
| 218 | + else if ( ! empty( $email ) && 'gravatar_default' == $default ) { |
|
| 213 | 219 | $default = ''; |
| 214 | - } else if ( 'gravatar_default' == $default ) { |
|
| 220 | + } |
|
| 221 | + else if ( 'gravatar_default' == $default ) { |
|
| 215 | 222 | $default = $host . '/avatar/?s=' . $size; |
| 216 | - } else if ( empty( $email ) && ! strstr( $default, 'http://' ) ) { |
|
| 223 | + } |
|
| 224 | + else if ( empty( $email ) && ! strstr( $default, 'http://' ) ) { |
|
| 217 | 225 | $default = $host . '/avatar/?d=' . $default . '&s=' . $size; |
| 218 | 226 | } |
| 219 | 227 | |
@@ -231,10 +239,12 @@ discard block |
||
| 231 | 239 | |
| 232 | 240 | if ( is_ssl() ) { |
| 233 | 241 | $host = 'https://secure.gravatar.com'; |
| 234 | - } else { |
|
| 242 | + } |
|
| 243 | + else { |
|
| 235 | 244 | if ( ! empty( $email_hash ) ) { |
| 236 | 245 | $host = sprintf( 'http://%d.gravatar.com', (hexdec( $email_hash[0] ) % 2) ); |
| 237 | - } else { |
|
| 246 | + } |
|
| 247 | + else { |
|
| 238 | 248 | $host = 'http://0.gravatar.com'; |
| 239 | 249 | } |
| 240 | 250 | } |
@@ -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 | |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | public function init_js_vars() { |
| 56 | 56 | |
| 57 | 57 | $options = array( |
| 58 | - 'base_url' => home_url( '' ), |
|
| 59 | - 'blog_url' => home_url( 'archives/' ), |
|
| 58 | + 'base_url' => home_url(''), |
|
| 59 | + 'blog_url' => home_url('archives/'), |
|
| 60 | 60 | 'template_dir' => THEME_DIR, |
| 61 | - 'ajax_load_url' => admin_url( 'admin-ajax.php' ), |
|
| 61 | + 'ajax_load_url' => admin_url('admin-ajax.php'), |
|
| 62 | 62 | 'is_mobile' => (int) wp_is_mobile(), |
| 63 | 63 | ); |
| 64 | 64 | |
@@ -86,12 +86,12 @@ discard block |
||
| 86 | 86 | * @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails |
| 87 | 87 | */ |
| 88 | 88 | |
| 89 | - add_theme_support( 'post-thumbnails' ); |
|
| 89 | + add_theme_support('post-thumbnails'); |
|
| 90 | 90 | |
| 91 | 91 | // This theme uses wp_nav_menu() in one location. |
| 92 | 92 | register_nav_menus(array( |
| 93 | - 'header-menu' => __( 'Header Menu', Classy::textdomain() ), |
|
| 94 | - 'footer-menu' => __( 'Footer Menu', Classy::textdomain() ), |
|
| 93 | + 'header-menu' => __('Header Menu', Classy::textdomain()), |
|
| 94 | + 'footer-menu' => __('Footer Menu', Classy::textdomain()), |
|
| 95 | 95 | )); |
| 96 | 96 | |
| 97 | 97 | /* |
@@ -2,6 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | global $post; |
| 4 | 4 | |
| 5 | -$classypost = new ClassyPost( $post ); |
|
| 5 | +$classypost = new ClassyPost($post); |
|
| 6 | 6 | |
| 7 | -Classy::render( 'layout.comments', array( 'post' => $classypost ) ); |
|
| 7 | +Classy::render('layout.comments', array('post' => $classypost)); |
|
@@ -1,1 +1,1 @@ |
||
| 1 | -<?php Classy::render( 'layout.header' ); ?> |
|
| 2 | 1 | \ No newline at end of file |
| 2 | +<?php Classy::render('layout.header'); ?> |
|
| 3 | 3 | \ No newline at end of file |