@@ -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,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 | } |