@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | } |
122 | 122 | while (($pos = strrpos($r, '/')) > 0) { |
123 | 123 | $r = substr($r, 0, $pos); |
124 | - if ($user->can($r . '/*', $params)) { |
|
124 | + if ($user->can($r.'/*', $params)) { |
|
125 | 125 | return true; |
126 | 126 | } |
127 | 127 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | } |
134 | 134 | while (($pos = strrpos($r, '/')) > 0) { |
135 | 135 | $r = substr($r, 0, $pos); |
136 | - if (isset($routes[$r . '/*'])) { |
|
136 | + if (isset($routes[$r.'/*'])) { |
|
137 | 137 | return true; |
138 | 138 | } |
139 | 139 | } |
@@ -150,19 +150,19 @@ discard block |
||
150 | 150 | protected static function normalizeRoute($route, $advanced = false) |
151 | 151 | { |
152 | 152 | if ($route === '') { |
153 | - $normalized = '/' . Yii::$app->controller->getRoute(); |
|
153 | + $normalized = '/'.Yii::$app->controller->getRoute(); |
|
154 | 154 | } elseif (strncmp($route, '/', 1) === 0) { |
155 | 155 | $normalized = $route; |
156 | 156 | } elseif (strpos($route, '/') === false) { |
157 | - $normalized = '/' . Yii::$app->controller->getUniqueId() . '/' . $route; |
|
157 | + $normalized = '/'.Yii::$app->controller->getUniqueId().'/'.$route; |
|
158 | 158 | } elseif (($mid = Yii::$app->controller->module->getUniqueId()) !== '') { |
159 | - $normalized = '/' . $mid . '/' . $route; |
|
159 | + $normalized = '/'.$mid.'/'.$route; |
|
160 | 160 | } else { |
161 | - $normalized = '/' . $route; |
|
161 | + $normalized = '/'.$route; |
|
162 | 162 | } |
163 | 163 | // Prefix @app-id to route. |
164 | 164 | if ($advanced) { |
165 | - $normalized = Route::PREFIX_ADVANCED . Yii::$app->id . $normalized; |
|
165 | + $normalized = Route::PREFIX_ADVANCED.Yii::$app->id.$normalized; |
|
166 | 166 | } |
167 | 167 | return $normalized; |
168 | 168 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | } |
234 | 234 | return implode(' ', $result); |
235 | 235 | } |
236 | - return preg_replace_callback('/\\{([\w\-\/]+)\\}/', function ($matches) use ($user) { |
|
236 | + return preg_replace_callback('/\\{([\w\-\/]+)\\}/', function($matches) use ($user) { |
|
237 | 237 | return static::checkRoute($matches[1], [], $user) ? "{{$matches[1]}}" : ''; |
238 | 238 | }, $buttons); |
239 | 239 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | $baseDir = ''; |
11 | 11 | $this->title = substr($page, 0, strrpos($page, '.')); |
12 | 12 | } else { |
13 | - $baseDir = substr($page, 0, $pos) . '/'; |
|
13 | + $baseDir = substr($page, 0, $pos).'/'; |
|
14 | 14 | $this->title = substr($page, $pos + 1, strrpos($page, '.') - $pos - 1); |
15 | 15 | } |
16 | 16 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $url = Url::to($menu['url'], true); |
23 | 23 | $links[] = "[**{$menu['label']}**]({$url})"; |
24 | 24 | } |
25 | - $body = str_replace(':smile:.', ".\n\n" . implode(' ', $links) . "\n", file_get_contents(Url::to('@mdm/admin/README.md'))); |
|
25 | + $body = str_replace(':smile:.', ".\n\n".implode(' ', $links)."\n", file_get_contents(Url::to('@mdm/admin/README.md'))); |
|
26 | 26 | } else { |
27 | 27 | $body = file_get_contents(Url::to("@mdm/admin/{$page}")); |
28 | 28 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | if ($link[0] == '/') { |
34 | 34 | $link = Url::current(['page' => ltrim($link, '/')], true); |
35 | 35 | } else { |
36 | - $link = Url::current(['page' => $baseDir . $link], true); |
|
36 | + $link = Url::current(['page' => $baseDir.$link], true); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 | return "]($link)"; |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | namespace mdm\admin; |
4 | 4 | |
5 | -if(!class_exists('yii\base\BaseObject')){ |
|
5 | +if (!class_exists('yii\base\BaseObject')) { |
|
6 | 6 | class_alias('yii\base\Object', 'yii\base\BaseObject'); |
7 | 7 | } |
8 | 8 |
@@ -64,13 +64,13 @@ |
||
64 | 64 | $items = $authManager->getRoles(); |
65 | 65 | } else { |
66 | 66 | $items = array_filter($authManager->getPermissions(), function($item) use ($advanced){ |
67 | - $isPermission = $this->type == Item::TYPE_PERMISSION; |
|
68 | - if ($advanced) { |
|
67 | + $isPermission = $this->type == Item::TYPE_PERMISSION; |
|
68 | + if ($advanced) { |
|
69 | 69 | return $isPermission xor (strncmp($item->name, '/', 1) === 0 or strncmp($item->name, '@', 1) === 0); |
70 | - } |
|
71 | - else { |
|
70 | + } |
|
71 | + else { |
|
72 | 72 | return $isPermission xor strncmp($item->name, '/', 1) === 0; |
73 | - } |
|
73 | + } |
|
74 | 74 | }); |
75 | 75 | } |
76 | 76 | $this->load($params); |
@@ -67,8 +67,7 @@ |
||
67 | 67 | $isPermission = $this->type == Item::TYPE_PERMISSION; |
68 | 68 | if ($advanced) { |
69 | 69 | return $isPermission xor (strncmp($item->name, '/', 1) === 0 or strncmp($item->name, '@', 1) === 0); |
70 | - } |
|
71 | - else { |
|
70 | + } else { |
|
72 | 71 | return $isPermission xor strncmp($item->name, '/', 1) === 0; |
73 | 72 | } |
74 | 73 | }); |