@@ -10,6 +10,9 @@ |
||
10 | 10 | { |
11 | 11 | public $message; |
12 | 12 | |
13 | + /** |
|
14 | + * @param string $type |
|
15 | + */ |
|
13 | 16 | public function createObject($name, $type) |
14 | 17 | { |
15 | 18 | $singleName = false; |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | $objectTemplate = null; |
30 | 30 | |
31 | 31 | if ($singleName) { |
32 | - $objectDirPath = root . '/Apps/' . $type . '/'; |
|
33 | - $objectNamespace = 'Apps\\' . $type; |
|
32 | + $objectDirPath = root.'/Apps/'.$type.'/'; |
|
33 | + $objectNamespace = 'Apps\\'.$type; |
|
34 | 34 | $objectName = ucfirst($name); |
35 | 35 | } else { |
36 | 36 | $split = explode('/', $name); |
@@ -47,46 +47,46 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | if ($type === 'Widget') { |
50 | - $objectDirPath = root . '/Widgets/' . $workground; |
|
51 | - $objectNamespace = 'Widgets\\' . $workground; |
|
50 | + $objectDirPath = root.'/Widgets/'.$workground; |
|
51 | + $objectNamespace = 'Widgets\\'.$workground; |
|
52 | 52 | } else { |
53 | - $objectDirPath = root . '/Apps/' . $type . '/' . $workground; |
|
54 | - $objectNamespace = 'Apps\\' . $type . '\\' . $workground; |
|
53 | + $objectDirPath = root.'/Apps/'.$type.'/'.$workground; |
|
54 | + $objectNamespace = 'Apps\\'.$type.'\\'.$workground; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | if (false !== $subName) { |
58 | - $objectDirPath .= '/' . implode('/', $subName); |
|
59 | - $objectNamespace .= '\\' . implode('\\', $subName); |
|
58 | + $objectDirPath .= '/'.implode('/', $subName); |
|
59 | + $objectNamespace .= '\\'.implode('\\', $subName); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | |
63 | 63 | // try to find workground-based controller |
64 | - if (File::exist('/Private/Carcase/' . $workground . '/' . $type . '.tphp')) { |
|
65 | - $objectTemplate = File::read('/Private/Carcase/' . $workground . '/' . $type . '.tphp'); |
|
64 | + if (File::exist('/Private/Carcase/'.$workground.'/'.$type.'.tphp')) { |
|
65 | + $objectTemplate = File::read('/Private/Carcase/'.$workground.'/'.$type.'.tphp'); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
69 | 69 | if (!Directory::exist($objectDirPath) && !Directory::create($objectDirPath)) { |
70 | - $this->message = 'Directory could not be created: ' . $objectDirPath; |
|
70 | + $this->message = 'Directory could not be created: '.$objectDirPath; |
|
71 | 71 | return false; |
72 | 72 | } |
73 | 73 | |
74 | 74 | if ($objectTemplate === null) { |
75 | - $objectTemplate = File::read('/Private/Carcase/' . $type . '.tphp'); |
|
75 | + $objectTemplate = File::read('/Private/Carcase/'.$type.'.tphp'); |
|
76 | 76 | if (false === $objectTemplate) { |
77 | - $this->message = 'Php template file is not founded: /Private/Carcase/' . $type . '.tphp'; |
|
77 | + $this->message = 'Php template file is not founded: /Private/Carcase/'.$type.'.tphp'; |
|
78 | 78 | return false; |
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
82 | 82 | $objectContent = Str::replace(['%namespace%', '%name%'], [$objectNamespace, $objectName], $objectTemplate); |
83 | - $objectFullPath = $objectDirPath . '/' . $objectName . '.php'; |
|
83 | + $objectFullPath = $objectDirPath.'/'.$objectName.'.php'; |
|
84 | 84 | if (File::exist($objectFullPath)) { |
85 | - $this->message = $type . ' is always exist: ' . $objectFullPath; |
|
85 | + $this->message = $type.' is always exist: '.$objectFullPath; |
|
86 | 86 | return false; |
87 | 87 | } |
88 | 88 | File::write($objectFullPath, $objectContent); |
89 | - $this->message = $type . ' template was created: [' . $objectName . '] in path: ' . Str::replace(root, '', $objectDirPath); |
|
89 | + $this->message = $type.' template was created: ['.$objectName.'] in path: '.Str::replace(root, '', $objectDirPath); |
|
90 | 90 | return true; |
91 | 91 | } |
92 | 92 | } |
93 | 93 | \ No newline at end of file |
@@ -26,7 +26,7 @@ |
||
26 | 26 | $query = new UserRecords(); |
27 | 27 | |
28 | 28 | // set current page and offset |
29 | - $page = (int)App::$Request->query->get('page'); |
|
29 | + $page = (int) App::$Request->query->get('page'); |
|
30 | 30 | $offset = $page * self::ITEM_PER_PAGE; |
31 | 31 | |
32 | 32 | // build pagination |
@@ -98,7 +98,7 @@ |
||
98 | 98 | if ($this->newpassword !== null && Str::length($this->newpassword) >= 3) { |
99 | 99 | $this->_user->password = App::$Security->password_hash($this->newpassword); |
100 | 100 | } |
101 | - } elseif($property === 'approve_token') { |
|
101 | + } elseif ($property === 'approve_token') { |
|
102 | 102 | if ($value == "1") { |
103 | 103 | $this->_user->approve_token = '0'; |
104 | 104 | } else { |
@@ -52,7 +52,7 @@ |
||
52 | 52 | public function save() |
53 | 53 | { |
54 | 54 | // check if target is myself or always exist in block list |
55 | - if ($this->_user->getId() === (int)$this->id || Blacklist::have($this->_user->getId(), $this->id)) { |
|
55 | + if ($this->_user->getId() === (int) $this->id || Blacklist::have($this->_user->getId(), $this->id)) { |
|
56 | 56 | return false; |
57 | 57 | } |
58 | 58 |
@@ -31,7 +31,7 @@ |
||
31 | 31 | [['text' => __('Name')], ['text' => $app->getLocaleName()]], |
32 | 32 | [['text' => __('System name')], ['text' => $app->sys_name]], |
33 | 33 | [['text' => __('Last update')], ['text' => Date::convertToDatetime($app->updated_at, DATE::FORMAT_TO_SECONDS)]], |
34 | - [['text' => __('Status')], ['text' => ((int)$app->disabled === 0) ? 'On' : 'Off'], 'property' => ['class' => ((int)$app->disabled === 0) ? 'alert-success' : 'alert-danger']] |
|
34 | + [['text' => __('Status')], ['text' => ((int) $app->disabled === 0) ? 'On' : 'Off'], 'property' => ['class' => ((int) $app->disabled === 0) ? 'alert-success' : 'alert-danger']] |
|
35 | 35 | ] |
36 | 36 | ] |
37 | 37 | ]); ?> |
@@ -9,4 +9,4 @@ |
||
9 | 9 | ['type' => 'link', 'text' => __('Group management'), 'link' => ['user/grouplist']], |
10 | 10 | ['type' => 'link', 'text' => __('Settings'), 'link' => ['user/settings']] |
11 | 11 | ] |
12 | -]);?> |
|
13 | 12 | \ No newline at end of file |
13 | +]); ?> |
|
14 | 14 | \ No newline at end of file |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -return array ( |
|
3 | +return array( |
|
4 | 4 | 0 => 'global/write', |
5 | 5 | 1 => 'global/modify', |
6 | 6 | 2 => 'global/file', |
@@ -9,4 +9,4 @@ |
||
9 | 9 | ['type' => 'link', 'text' => __('Group management'), 'link' => ['user/grouplist']], |
10 | 10 | ['type' => 'link', 'text' => __('Settings'), 'link' => ['user/settings']] |
11 | 11 | ] |
12 | -]);?> |
|
13 | 12 | \ No newline at end of file |
13 | +]); ?> |
|
14 | 14 | \ No newline at end of file |
@@ -9,4 +9,4 @@ |
||
9 | 9 | ['type' => 'link', 'text' => __('Group management'), 'link' => ['user/grouplist']], |
10 | 10 | ['type' => 'link', 'text' => __('Settings'), 'link' => ['user/settings']] |
11 | 11 | ] |
12 | -]);?> |
|
13 | 12 | \ No newline at end of file |
13 | +]); ?> |
|
14 | 14 | \ No newline at end of file |