@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | return [ |
| 67 | 67 | [['ruleName'], 'checkRule'], |
| 68 | 68 | [['name', 'type'], 'required'], |
| 69 | - [['name'], 'checkUnique', 'when' => function () { |
|
| 69 | + [['name'], 'checkUnique', 'when' => function() { |
|
| 70 | 70 | return $this->isNewRecord || ($this->_item->name != $this->name); |
| 71 | 71 | }], |
| 72 | 72 | [['type'], 'integer'], |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | ->where([$idField => $provider->getModels()]) |
| 306 | 306 | ->asArray()->all(); |
| 307 | 307 | |
| 308 | - $route = '/' . $ctrl->uniqueId . '/view'; |
|
| 308 | + $route = '/'.$ctrl->uniqueId.'/view'; |
|
| 309 | 309 | foreach ($users as &$row) { |
| 310 | 310 | $row['link'] = Url::to([$route, 'id' => $row['id']]); |
| 311 | 311 | } |
@@ -83,14 +83,14 @@ |
||
| 83 | 83 | <div class="col-sm-1"> |
| 84 | 84 | <br><br> |
| 85 | 85 | <?= |
| 86 | - Html::a('>>' . $animateIcon, ['assign', 'id' => $model->name], [ |
|
| 86 | + Html::a('>>'.$animateIcon, ['assign', 'id' => $model->name], [ |
|
| 87 | 87 | 'class' => 'btn btn-success btn-assign', |
| 88 | 88 | 'data-target' => 'available', |
| 89 | 89 | 'title' => Yii::t('rbac-admin', 'Assign'), |
| 90 | 90 | ]); |
| 91 | 91 | ?><br><br> |
| 92 | 92 | <?= |
| 93 | - Html::a('<<' . $animateIcon, ['remove', 'id' => $model->name], [ |
|
| 93 | + Html::a('<<'.$animateIcon, ['remove', 'id' => $model->name], [ |
|
| 94 | 94 | 'class' => 'btn btn-danger btn-assign', |
| 95 | 95 | 'data-target' => 'assigned', |
| 96 | 96 | 'title' => Yii::t('rbac-admin', 'Remove'), |
@@ -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,10 +22,10 @@ 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'))); |
|
| 26 | -} elseif(preg_match('/^docs\/guide\/[\w-]+\.md$/', $page)) { |
|
| 25 | + $body = str_replace(':smile:.', ".\n\n".implode(' ', $links)."\n", file_get_contents(Url::to('@mdm/admin/README.md'))); |
|
| 26 | +} elseif (preg_match('/^docs\/guide\/[\w-]+\.md$/', $page)) { |
|
| 27 | 27 | $body = file_get_contents(Url::to("@mdm/admin/{$page}")); |
| 28 | -} else{ |
|
| 28 | +} else { |
|
| 29 | 29 | $body = ''; |
| 30 | 30 | } |
| 31 | 31 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | if ($link[0] == '/') { |
| 36 | 36 | $link = Url::current(['page' => ltrim((string)$link, '/')], true); |
| 37 | 37 | } else { |
| 38 | - $link = Url::current(['page' => $baseDir . $link], true); |
|
| 38 | + $link = Url::current(['page' => $baseDir.$link], true); |
|
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | return "]($link)"; |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $r = explode('&', $route); |
| 39 | 39 | $item = $manager->createPermission($this->getPermissionName($route)); |
| 40 | 40 | if (count($r) > 1) { |
| 41 | - $action = '/' . trim((string)$r[0], '/'); |
|
| 41 | + $action = '/'.trim((string)$r[0], '/'); |
|
| 42 | 42 | if (($itemAction = $manager->getPermission($action)) === null) { |
| 43 | 43 | $itemAction = $manager->createPermission($action); |
| 44 | 44 | $manager->add($itemAction); |
@@ -101,9 +101,9 @@ discard block |
||
| 101 | 101 | public function getPermissionName($route) |
| 102 | 102 | { |
| 103 | 103 | if (self::PREFIX_BASIC == $this->routePrefix) { |
| 104 | - return self::PREFIX_BASIC . trim((string)$route, self::PREFIX_BASIC); |
|
| 104 | + return self::PREFIX_BASIC.trim((string)$route, self::PREFIX_BASIC); |
|
| 105 | 105 | } else { |
| 106 | - return self::PREFIX_ADVANCED . ltrim((string)trim((string)$route, self::PREFIX_BASIC), self::PREFIX_ADVANCED); |
|
| 106 | + return self::PREFIX_ADVANCED.ltrim((string)trim((string)$route, self::PREFIX_BASIC), self::PREFIX_ADVANCED); |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | // Step through each configured application |
| 128 | 128 | foreach ($advanced as $id => $configPaths) { |
| 129 | 129 | // Force correct id string. |
| 130 | - $id = $this->routePrefix . ltrim((string)trim((string)$id), $this->routePrefix); |
|
| 130 | + $id = $this->routePrefix.ltrim((string)trim((string)$id), $this->routePrefix); |
|
| 131 | 131 | // Create empty config array. |
| 132 | 132 | $config = []; |
| 133 | 133 | // Assemble configuration for current app. |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | unset($app); |
| 145 | 145 | // Prepend the app id to all routes. |
| 146 | 146 | foreach ($r as $route) { |
| 147 | - $routes[$id . $route] = $id . $route; |
|
| 147 | + $routes[$id.$route] = $id.$route; |
|
| 148 | 148 | } |
| 149 | 149 | } |
| 150 | 150 | // Switch back to original app. |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | */ |
| 205 | 205 | protected function getRouteRecursive($module, &$result) |
| 206 | 206 | { |
| 207 | - $token = "Get Route of '" . get_class($module) . "' with id '" . $module->uniqueId . "'"; |
|
| 207 | + $token = "Get Route of '".get_class($module)."' with id '".$module->uniqueId."'"; |
|
| 208 | 208 | Yii::beginProfile($token, __METHOD__); |
| 209 | 209 | try { |
| 210 | 210 | foreach ($module->getModules() as $id => $child) { |
@@ -217,9 +217,9 @@ discard block |
||
| 217 | 217 | $this->getControllerActions($type, $id, $module, $result); |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | - $namespace = trim((string)$module->controllerNamespace, '\\') . '\\'; |
|
| 220 | + $namespace = trim((string)$module->controllerNamespace, '\\').'\\'; |
|
| 221 | 221 | $this->getControllerFiles($module, $namespace, '', $result); |
| 222 | - $all = '/' . ltrim((string)$module->uniqueId . '/*', '/'); |
|
| 222 | + $all = '/'.ltrim((string)$module->uniqueId.'/*', '/'); |
|
| 223 | 223 | $result[$all] = $all; |
| 224 | 224 | } catch (\Exception $exc) { |
| 225 | 225 | Yii::error($exc->getMessage(), __METHOD__); |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | */ |
| 238 | 238 | protected function getControllerFiles($module, $namespace, $prefix, &$result) |
| 239 | 239 | { |
| 240 | - $path = Yii::getAlias('@' . str_replace('\\', '/', $namespace), false); |
|
| 240 | + $path = Yii::getAlias('@'.str_replace('\\', '/', $namespace), false); |
|
| 241 | 241 | $token = "Get controllers from '$path'"; |
| 242 | 242 | Yii::beginProfile($token, __METHOD__); |
| 243 | 243 | try { |
@@ -248,15 +248,15 @@ discard block |
||
| 248 | 248 | if ($file == '.' || $file == '..') { |
| 249 | 249 | continue; |
| 250 | 250 | } |
| 251 | - if (is_dir($path . '/' . $file) && preg_match('%^[a-z0-9_/]+$%i', $file . '/')) { |
|
| 252 | - $this->getControllerFiles($module, $namespace . $file . '\\', $prefix . $file . '/', $result); |
|
| 251 | + if (is_dir($path.'/'.$file) && preg_match('%^[a-z0-9_/]+$%i', $file.'/')) { |
|
| 252 | + $this->getControllerFiles($module, $namespace.$file.'\\', $prefix.$file.'/', $result); |
|
| 253 | 253 | } elseif (strcmp(substr($file, -14), 'Controller.php') === 0) { |
| 254 | 254 | $baseName = substr(basename($file), 0, -14); |
| 255 | 255 | $name = strtolower(preg_replace('/(?<![A-Z])[A-Z]/', ' \0', $baseName)); |
| 256 | 256 | $id = ltrim((string)str_replace(' ', '-', $name), '-'); |
| 257 | - $className = $namespace . $baseName . 'Controller'; |
|
| 257 | + $className = $namespace.$baseName.'Controller'; |
|
| 258 | 258 | if (strpos($className, '-') === false && class_exists($className) && is_subclass_of($className, 'yii\base\Controller')) { |
| 259 | - $this->getControllerActions($className, $prefix . $id, $module, $result); |
|
| 259 | + $this->getControllerActions($className, $prefix.$id, $module, $result); |
|
| 260 | 260 | } |
| 261 | 261 | } |
| 262 | 262 | } |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | */ |
| 276 | 276 | protected function getControllerActions($type, $id, $module, &$result) |
| 277 | 277 | { |
| 278 | - $token = "Create controller with cofig=" . VarDumper::dumpAsString($type) . " and id='$id'"; |
|
| 278 | + $token = "Create controller with cofig=".VarDumper::dumpAsString($type)." and id='$id'"; |
|
| 279 | 279 | Yii::beginProfile($token, __METHOD__); |
| 280 | 280 | try { |
| 281 | 281 | /* @var $controller \yii\base\Controller */ |
@@ -296,19 +296,19 @@ discard block |
||
| 296 | 296 | */ |
| 297 | 297 | protected function getActionRoutes($controller, &$result) |
| 298 | 298 | { |
| 299 | - $token = "Get actions of controller '" . $controller->uniqueId . "'"; |
|
| 299 | + $token = "Get actions of controller '".$controller->uniqueId."'"; |
|
| 300 | 300 | Yii::beginProfile($token, __METHOD__); |
| 301 | 301 | try { |
| 302 | - $prefix = '/' . $controller->uniqueId . '/'; |
|
| 302 | + $prefix = '/'.$controller->uniqueId.'/'; |
|
| 303 | 303 | foreach ($controller->actions() as $id => $value) { |
| 304 | - $result[$prefix . $id] = $prefix . $id; |
|
| 304 | + $result[$prefix.$id] = $prefix.$id; |
|
| 305 | 305 | } |
| 306 | 306 | $class = new \ReflectionClass($controller); |
| 307 | 307 | foreach ($class->getMethods() as $method) { |
| 308 | 308 | $name = $method->getName(); |
| 309 | 309 | if ($method->isPublic() && !$method->isStatic() && strpos($name, 'action') === 0 && $name !== 'actions') { |
| 310 | 310 | $name = strtolower(preg_replace('/(?<![A-Z])[A-Z]/', ' \0', substr($name, 6))); |
| 311 | - $id = $prefix . ltrim((string)str_replace(' ', '-', $name), '-'); |
|
| 311 | + $id = $prefix.ltrim((string)str_replace(' ', '-', $name), '-'); |
|
| 312 | 312 | $result[$id] = $id; |
| 313 | 313 | } |
| 314 | 314 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | { |
| 68 | 68 | $actionId = $action->getUniqueId(); |
| 69 | 69 | $user = $this->getUser(); |
| 70 | - if (Helper::checkRoute('/' . $actionId, Yii::$app->getRequest()->get(), $user)) { |
|
| 70 | + if (Helper::checkRoute('/'.$actionId, Yii::$app->getRequest()->get(), $user)) { |
|
| 71 | 71 | return true; |
| 72 | 72 | } |
| 73 | 73 | $this->denyAccess($user); |
@@ -100,15 +100,15 @@ discard block |
||
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | $user = $this->getUser(); |
| 103 | - if($user->getIsGuest()) |
|
| 103 | + if ($user->getIsGuest()) |
|
| 104 | 104 | { |
| 105 | 105 | $loginUrl = null; |
| 106 | - if(is_array($user->loginUrl) && isset($user->loginUrl[0])){ |
|
| 106 | + if (is_array($user->loginUrl) && isset($user->loginUrl[0])) { |
|
| 107 | 107 | $loginUrl = $user->loginUrl[0]; |
| 108 | - }else if(is_string($user->loginUrl)){ |
|
| 108 | + } else if (is_string($user->loginUrl)) { |
|
| 109 | 109 | $loginUrl = $user->loginUrl; |
| 110 | 110 | } |
| 111 | - if(!is_null($loginUrl) && trim((string)$loginUrl,'/') === $uniqueId) |
|
| 111 | + if (!is_null($loginUrl) && trim((string)$loginUrl, '/') === $uniqueId) |
|
| 112 | 112 | { |
| 113 | 113 | return false; |
| 114 | 114 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | // convert action uniqueId into an ID relative to the module |
| 119 | 119 | $mid = $this->owner->getUniqueId(); |
| 120 | 120 | $id = $uniqueId; |
| 121 | - if ($mid !== '' && strpos($id, $mid . '/') === 0) { |
|
| 121 | + if ($mid !== '' && strpos($id, $mid.'/') === 0) { |
|
| 122 | 122 | $id = substr($id, strlen($mid) + 1); |
| 123 | 123 | } |
| 124 | 124 | } else { |
@@ -105,7 +105,7 @@ |
||
| 105 | 105 | $loginUrl = null; |
| 106 | 106 | if(is_array($user->loginUrl) && isset($user->loginUrl[0])){ |
| 107 | 107 | $loginUrl = $user->loginUrl[0]; |
| 108 | - }else if(is_string($user->loginUrl)){ |
|
| 108 | + } else if(is_string($user->loginUrl)){ |
|
| 109 | 109 | $loginUrl = $user->loginUrl; |
| 110 | 110 | } |
| 111 | 111 | if(!is_null($loginUrl) && trim((string)$loginUrl,'/') === $uniqueId) |