@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $this->addFindPages(); |
33 | 33 | $this->addFilesAndImages(); |
34 | 34 | $this->addSiteConfigLinks(); |
35 | - if(Permission::check('ADMIN')) { |
|
35 | + if (Permission::check('ADMIN')) { |
|
36 | 36 | $this->addSecurityLinks(); |
37 | 37 | } |
38 | 38 | $this->addModelAdminLinks(); |
@@ -56,16 +56,16 @@ discard block |
||
56 | 56 | protected function addPagesLinks() |
57 | 57 | { |
58 | 58 | $this->addGroup('PAGES', 'Pages', 10); |
59 | - $this->addLink('PAGES', $this->phrase('add'). ' Page', '/admin/pages/add'); |
|
59 | + $this->addLink('PAGES', $this->phrase('add') . ' Page', '/admin/pages/add'); |
|
60 | 60 | $pagesCount = DataObject::get('Page')->count(); |
61 | - $this->addLink('PAGES', $this->phrase('edit'). ' Pages ('.$pagesCount.')', '/admin/pages'); |
|
61 | + $this->addLink('PAGES', $this->phrase('edit') . ' Pages (' . $pagesCount . ')', '/admin/pages'); |
|
62 | 62 | $pageLastEdited = DataObject::get_one('Page', '', true, 'LastEdited DESC'); |
63 | 63 | if ($pageLastEdited) { |
64 | - $this->addLink('PAGES', '✎ Last Edited Page: '.$pageLastEdited->Title, $pageLastEdited->CMSEditLink()); |
|
64 | + $this->addLink('PAGES', '✎ Last Edited Page: ' . $pageLastEdited->Title, $pageLastEdited->CMSEditLink()); |
|
65 | 65 | } |
66 | - $this->addLink('PAGES', $this->phrase('review'). ' Page Reports', '/admin/reports'); |
|
67 | - $lastWeekLink = '/admin/pages?'.'q[LastEditedFrom]='.date('Y-m-d', strtotime('-1 week')); |
|
68 | - $this->addLink('PAGES', $this->phrase('review'). ' Recently Modified Pages', $lastWeekLink); |
|
66 | + $this->addLink('PAGES', $this->phrase('review') . ' Page Reports', '/admin/reports'); |
|
67 | + $lastWeekLink = '/admin/pages?' . 'q[LastEditedFrom]=' . date('Y-m-d', strtotime('-1 week')); |
|
68 | + $this->addLink('PAGES', $this->phrase('review') . ' Recently Modified Pages', $lastWeekLink); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | protected function addFindPages() |
@@ -73,35 +73,35 @@ discard block |
||
73 | 73 | $pages = []; |
74 | 74 | $pagesToSkip = (array) $this->Config()->get('pages_to_skip'); |
75 | 75 | foreach (ClassInfo::subclassesFor(SiteTree::class, false) as $className) { |
76 | - if(in_array($className, $pagesToSkip)) { |
|
76 | + if (in_array($className, $pagesToSkip)) { |
|
77 | 77 | continue; |
78 | 78 | } |
79 | 79 | $pages[$className] = $className; |
80 | 80 | |
81 | 81 | } |
82 | - $this->addGroup('PAGEFILTER', 'Page Types ('.count($pages).')', 300); |
|
82 | + $this->addGroup('PAGEFILTER', 'Page Types (' . count($pages) . ')', 300); |
|
83 | 83 | $count = 0; |
84 | - foreach($pages as $pageClassName) { |
|
84 | + foreach ($pages as $pageClassName) { |
|
85 | 85 | $pageCount = $pageClassName::get()->filter(['ClassName' => $pageClassName])->count(); |
86 | - if($pageCount < 1) { |
|
86 | + if ($pageCount < 1) { |
|
87 | 87 | continue; |
88 | 88 | } |
89 | 89 | $count++; |
90 | - if($count > 7) { |
|
90 | + if ($count > 7) { |
|
91 | 91 | $this->addLink('PAGEFILTER', $this->phrase('more'), '/admin/pages'); |
92 | 92 | break; |
93 | 93 | } |
94 | - if($pageCount < 2) { |
|
94 | + if ($pageCount < 2) { |
|
95 | 95 | $obj = DataObject::get_one($pageClassName, ['ClassName' => $pageClassName]); |
96 | - $this->addLink('PAGEFILTER', $this->phrase('edit'). ' '.$pageClassName::singleton()->i18n_singular_name(), $obj->CMSEditLink()); |
|
96 | + $this->addLink('PAGEFILTER', $this->phrase('edit') . ' ' . $pageClassName::singleton()->i18n_singular_name(), $obj->CMSEditLink()); |
|
97 | 97 | continue; |
98 | 98 | } |
99 | 99 | |
100 | 100 | $page = Injector::inst()->get($pageClassName); |
101 | 101 | $pageTitle = $page->i18n_singular_name(); |
102 | - $query = 'q[ClassName]='.$pageClassName; |
|
102 | + $query = 'q[ClassName]=' . $pageClassName; |
|
103 | 103 | $link = 'admin/pages?' . $query; |
104 | - $this->addLink('PAGEFILTER', $this->phrase('edit'). ' '.$pageTitle.' ('.$pageCount.')', $link); |
|
104 | + $this->addLink('PAGEFILTER', $this->phrase('edit') . ' ' . $pageTitle . ' (' . $pageCount . ')', $link); |
|
105 | 105 | } |
106 | 106 | } |
107 | 107 | protected function addFilesAndImages() |
@@ -111,44 +111,44 @@ discard block |
||
111 | 111 | $uploadFolderName = Config::inst()->get(Upload::class, 'uploads_folder'); |
112 | 112 | $uploadFolder = Folder::find_or_make($uploadFolderName); |
113 | 113 | // all |
114 | - $this->addLink('FILESANDIMAGES', $this->phrase('edit'). ' Open File Browswer', '/admin/assets'); |
|
114 | + $this->addLink('FILESANDIMAGES', $this->phrase('edit') . ' Open File Browswer', '/admin/assets'); |
|
115 | 115 | // per type |
116 | 116 | $filesCount = File::get()->exclude(['ClassName' => [Folder::class, Image::class]])->count(); |
117 | 117 | $imageCount = File::get()->filter(['ClassName' => [Image::class]])->count(); |
118 | - $this->addLink('FILESANDIMAGES', $this->phrase('review'). ' Images ('.$imageCount.')', 'admin/assets?filter[appCategory]=IMAGE'); |
|
119 | - $this->addLink('FILESANDIMAGES', $this->phrase('review'). ' Files ('.$filesCount.')', 'admin/assets?filter[appCategory]=DOCUMENT'); |
|
118 | + $this->addLink('FILESANDIMAGES', $this->phrase('review') . ' Images (' . $imageCount . ')', 'admin/assets?filter[appCategory]=IMAGE'); |
|
119 | + $this->addLink('FILESANDIMAGES', $this->phrase('review') . ' Files (' . $filesCount . ')', 'admin/assets?filter[appCategory]=DOCUMENT'); |
|
120 | 120 | |
121 | 121 | // default upload folder |
122 | - $this->addLink('FILESANDIMAGES', $this->phrase('review'). ' Open Default Upload Folder', $uploadFolder->CMSEditLink()); |
|
122 | + $this->addLink('FILESANDIMAGES', $this->phrase('review') . ' Open Default Upload Folder', $uploadFolder->CMSEditLink()); |
|
123 | 123 | |
124 | 124 | // recent |
125 | - $lastWeekLink = '/admin/assets?'.'filter[lastEditedFrom]='.date('Y-m-d', strtotime('-1 week')).'&view=tile'; |
|
126 | - $this->addLink('FILESANDIMAGES', $this->phrase('review'). ' Recently modified Files', $lastWeekLink); |
|
125 | + $lastWeekLink = '/admin/assets?' . 'filter[lastEditedFrom]=' . date('Y-m-d', strtotime('-1 week')) . '&view=tile'; |
|
126 | + $this->addLink('FILESANDIMAGES', $this->phrase('review') . ' Recently modified Files', $lastWeekLink); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | protected function addSiteConfigLinks() |
130 | 130 | { |
131 | 131 | $this->addGroup('SITECONFIG', 'Site Wide Configuration', 20); |
132 | - $this->addLink('SITECONFIG', $this->phrase('review'). ' Site Settings', '/admin/settings'); |
|
132 | + $this->addLink('SITECONFIG', $this->phrase('review') . ' Site Settings', '/admin/settings'); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | protected function addSecurityLinks() |
136 | 136 | { |
137 | 137 | $this->addGroup('SECURITY', 'Security', 30); |
138 | - $this->addLink('SECURITY', $this->phrase('add'). ' User', '/admin/security/users/EditForm/field/users/item/new'); |
|
138 | + $this->addLink('SECURITY', $this->phrase('add') . ' User', '/admin/security/users/EditForm/field/users/item/new'); |
|
139 | 139 | $userCount = Member::get()->count(); |
140 | 140 | $groupCount = Group::get()->count(); |
141 | - $this->addLink('SECURITY', $this->phrase('review'). ' Users ('.$userCount.')', '/admin/security'); |
|
142 | - $this->addLink('SECURITY', $this->phrase('review'). ' Groups ('.$groupCount.')', '/admin/security/groups'); |
|
141 | + $this->addLink('SECURITY', $this->phrase('review') . ' Users (' . $userCount . ')', '/admin/security'); |
|
142 | + $this->addLink('SECURITY', $this->phrase('review') . ' Groups (' . $groupCount . ')', '/admin/security/groups'); |
|
143 | 143 | DefaultAdminService::singleton()->extend('addSecurityLinks', $this); |
144 | 144 | $adminGroup = Permission::get_groups_by_permission('ADMIN')->first(); |
145 | - if($adminGroup) { |
|
145 | + if ($adminGroup) { |
|
146 | 146 | $userCount = $adminGroup->Members()->count(); |
147 | - $this->addLink('SECURITY', $this->phrase('review'). ' Administrators ('.$userCount.')', '/admin/security/groups/EditForm/field/groups/item/'.$adminGroup->ID.'/edit'); |
|
147 | + $this->addLink('SECURITY', $this->phrase('review') . ' Administrators (' . $userCount . ')', '/admin/security/groups/EditForm/field/groups/item/' . $adminGroup->ID . '/edit'); |
|
148 | 148 | } |
149 | - if(class_exists(EnabledMembers::class)) { |
|
149 | + if (class_exists(EnabledMembers::class)) { |
|
150 | 150 | $obj = Injector::inst()->get(EnabledMembers::class); |
151 | - $this->addLink('SECURITY', $this->phrase('review'). ' Multi-Factor Authentication Status', $obj->getLink()); |
|
151 | + $this->addLink('SECURITY', $this->phrase('review') . ' Multi-Factor Authentication Status', $obj->getLink()); |
|
152 | 152 | |
153 | 153 | } |
154 | 154 | } |
@@ -161,58 +161,58 @@ discard block |
||
161 | 161 | $modelAdmins = []; |
162 | 162 | $skips = (array) $this->Config()->get('model_admins_to_skip'); |
163 | 163 | foreach (ClassInfo::subclassesFor(ModelAdmin::class, false) as $className) { |
164 | - if(in_array($className, $skips)) { |
|
164 | + if (in_array($className, $skips)) { |
|
165 | 165 | continue; |
166 | 166 | } |
167 | 167 | $modelAdmins[$className] = $className; |
168 | 168 | |
169 | 169 | } |
170 | - foreach($modelAdmins as $modelAdminClassName) { |
|
170 | + foreach ($modelAdmins as $modelAdminClassName) { |
|
171 | 171 | $groupAdded = false; |
172 | 172 | $ma = Injector::inst()->get($modelAdminClassName); |
173 | - if($ma->canView()) { |
|
173 | + if ($ma->canView()) { |
|
174 | 174 | $mas = $ma->getManagedModels(); |
175 | - if(count($mas)) { |
|
175 | + if (count($mas)) { |
|
176 | 176 | $numberOfModels = count($mas); |
177 | 177 | $groupCode = strtoupper($modelAdminClassName); |
178 | 178 | $count = 0; |
179 | - foreach($mas as $model => $title) { |
|
179 | + foreach ($mas as $model => $title) { |
|
180 | 180 | $count++; |
181 | - if($count > 7) { |
|
181 | + if ($count > 7) { |
|
182 | 182 | $this->addLink('PAGEFILTER', $this->phrase('more'), $ma->Link()); |
183 | 183 | break; |
184 | 184 | } |
185 | - if(is_array($title)) { |
|
185 | + if (is_array($title)) { |
|
186 | 186 | $title = $title['title']; |
187 | 187 | $model = $title['dataClass'] ?? $model; |
188 | 188 | } |
189 | - if(! class_exists($model)) { |
|
189 | + if (!class_exists($model)) { |
|
190 | 190 | continue; |
191 | 191 | } |
192 | 192 | $obj = Injector::inst()->get($model); |
193 | - if($obj && $obj->canView()) { |
|
194 | - if(! $groupAdded) { |
|
193 | + if ($obj && $obj->canView()) { |
|
194 | + if (!$groupAdded) { |
|
195 | 195 | $this->addGroup($groupCode, $ma->menu_title(), 100); |
196 | 196 | $groupAdded = true; |
197 | 197 | } |
198 | 198 | $link = ''; |
199 | - if($obj->hasMethod('CMSListLink')) { |
|
199 | + if ($obj->hasMethod('CMSListLink')) { |
|
200 | 200 | $link = $obj->CMSListLink(); |
201 | 201 | } else { |
202 | 202 | $link = $ma->getLinkForModelTab($model); |
203 | 203 | } |
204 | 204 | $objectCount = $model::get()->count(); |
205 | - $titleContainsObjectCount = strpos($title, ' ('.$objectCount.')'); |
|
206 | - if($titleContainsObjectCount === false) { |
|
207 | - $title .= ' ('.$objectCount.')'; |
|
205 | + $titleContainsObjectCount = strpos($title, ' (' . $objectCount . ')'); |
|
206 | + if ($titleContainsObjectCount === false) { |
|
207 | + $title .= ' (' . $objectCount . ')'; |
|
208 | 208 | } |
209 | - $this->addLink($groupCode, $this->phrase('edit'). ' '.$title, $link); |
|
210 | - if($numberOfModels < 4) { |
|
209 | + $this->addLink($groupCode, $this->phrase('edit') . ' ' . $title, $link); |
|
210 | + if ($numberOfModels < 4) { |
|
211 | 211 | $obj = Injector::inst()->get($model); |
212 | - if($obj->canCreate()) { |
|
212 | + if ($obj->canCreate()) { |
|
213 | 213 | $classNameEscaped = str_replace('\\', '-', $model); |
214 | - $linkNew = $link .= '/EditForm/field/'.$classNameEscaped.'/item/new'; |
|
215 | - $this->addLink($groupCode, $this->phrase('add'). ' '.$obj->i18n_singular_name(), $linkNew); |
|
214 | + $linkNew = $link .= '/EditForm/field/' . $classNameEscaped . '/item/new'; |
|
215 | + $this->addLink($groupCode, $this->phrase('add') . ' ' . $obj->i18n_singular_name(), $linkNew); |
|
216 | 216 | } |
217 | 217 | } |
218 | 218 | } |
@@ -251,8 +251,8 @@ discard block |
||
251 | 251 | |
252 | 252 | protected function phrase(string $phrase): string |
253 | 253 | { |
254 | - $phrase = $this->config()->get($phrase .'_phrase'); |
|
255 | - return _t('DashboardWelcomeQuicklinks.'.$phrase, $phrase); |
|
254 | + $phrase = $this->config()->get($phrase . '_phrase'); |
|
255 | + return _t('DashboardWelcomeQuicklinks.' . $phrase, $phrase); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | usort( |
79 | 79 | $shortcuts, |
80 | - function ($a, $b) { |
|
80 | + function($a, $b) { |
|
81 | 81 | ($a['SortOrder'] ?? 0) <=> ($b['SortOrder'] ?? 0); |
82 | 82 | } |
83 | 83 | ); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $kcCount = count($kc); |
125 | 125 | $colours = ''; |
126 | 126 | foreach ($kc as $key => $colour) { |
127 | - $colours .= ' .grid-wrapper .grid-cell:nth-child(' . $kcCount . 'n+' . ($key + 1) . ') div.header {background-color: ' . $colour . '; color: '.$this->getFontColor($colour).'!important;}'; |
|
127 | + $colours .= ' .grid-wrapper .grid-cell:nth-child(' . $kcCount . 'n+' . ($key + 1) . ') div.header {background-color: ' . $colour . '; color: ' . $this->getFontColor($colour) . '!important;}'; |
|
128 | 128 | } |
129 | 129 | $html .= '</div>'; |
130 | 130 | $html .= '<style> |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $useDefaultDashboard = $this->config()->get('use_default_dashboard'); |
189 | 189 | $classNames = ClassInfo::implementorsOf(DashboardWelcomeQuickLinksProvider::class); |
190 | 190 | foreach ($classNames as $className) { |
191 | - if($useDefaultDashboard === false && $className === DefaultDashboardProvider::class) { |
|
191 | + if ($useDefaultDashboard === false && $className === DefaultDashboardProvider::class) { |
|
192 | 192 | continue; |
193 | 193 | } |
194 | 194 | $array += Injector::inst()->get($className)->provideDashboardWelcomeQuickLinks(); |
@@ -210,10 +210,10 @@ discard block |
||
210 | 210 | if (!empty($iconClass)) { |
211 | 211 | $icon = '<i class="' . $iconClass . '"></i> '; |
212 | 212 | } |
213 | - if(!$target) { |
|
213 | + if (!$target) { |
|
214 | 214 | $target = '_self'; |
215 | 215 | } |
216 | - $target = ' target="'.$target.'"'; |
|
216 | + $target = ' target="' . $target . '"'; |
|
217 | 217 | if ($link) { |
218 | 218 | $html = ' |
219 | 219 | ' . $script . ' |
@@ -244,8 +244,8 @@ discard block |
||
244 | 244 | { |
245 | 245 | $app = $this->getApplicationName(); |
246 | 246 | $siteConfigTitle = SiteConfig::current_site_config()->Title; |
247 | - if($siteConfigTitle) { |
|
248 | - $app = $siteConfigTitle . ' ('.$app.')'; |
|
247 | + if ($siteConfigTitle) { |
|
248 | + $app = $siteConfigTitle . ' (' . $app . ')'; |
|
249 | 249 | } |
250 | 250 | return ($section = $this->SectionTitle()) ? sprintf('%s for %s', $section, $app) : $app; |
251 | 251 | } |