Passed
Push — master ( e2682f...a96ff7 )
by Nicolaas
02:17
created
src/Api/DefaultDashboardProvider.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -46,16 +46,16 @@  discard block
 block discarded – undo
46 46
     protected function addPagesLinks()
47 47
     {
48 48
         $this->addGroup('PAGES', 'Pages', 10);
49
-        $this->addLink('PAGES', $this->phrase('add'). ' Page', '/admin/pages/add');
49
+        $this->addLink('PAGES', $this->phrase('add') . ' Page', '/admin/pages/add');
50 50
         $pagesCount = DataObject::get('Page')->count();
51
-        $this->addLink('PAGES', $this->phrase('edit'). ' Pages ('.$pagesCount.')', '/admin/pages');
51
+        $this->addLink('PAGES', $this->phrase('edit') . ' Pages (' . $pagesCount . ')', '/admin/pages');
52 52
         $pageLastEdited = DataObject::get_one('Page', '', true, 'LastEdited DESC');
53 53
         if ($pageLastEdited) {
54
-            $this->addLink('PAGES', '✎ Last Edited Page: '.$pageLastEdited->Title, $pageLastEdited->CMSEditLink());
54
+            $this->addLink('PAGES', '✎ Last Edited Page: ' . $pageLastEdited->Title, $pageLastEdited->CMSEditLink());
55 55
         }
56
-        $this->addLink('PAGES', $this->phrase('review'). ' Page Reports', '/admin/reports');
57
-        $lastWeekLink = '/admin/pages?'.'q[LastEditedFrom]='.date('Y-m-d', strtotime('-1 week'));
58
-        $this->addLink('PAGES', $this->phrase('review'). ' Recently Modified Pages', $lastWeekLink);
56
+        $this->addLink('PAGES', $this->phrase('review') . ' Page Reports', '/admin/reports');
57
+        $lastWeekLink = '/admin/pages?' . 'q[LastEditedFrom]=' . date('Y-m-d', strtotime('-1 week'));
58
+        $this->addLink('PAGES', $this->phrase('review') . ' Recently Modified Pages', $lastWeekLink);
59 59
     }
60 60
 
61 61
     protected function addFilesAndImages()
@@ -65,44 +65,44 @@  discard block
 block discarded – undo
65 65
         $uploadFolderName = Config::inst()->get(Upload::class, 'uploads_folder');
66 66
         $uploadFolder = Folder::find_or_make($uploadFolderName);
67 67
         // all
68
-        $this->addLink('FILESANDIMAGES', $this->phrase('edit'). ' Open File Browswer', '/admin/assets');
68
+        $this->addLink('FILESANDIMAGES', $this->phrase('edit') . ' Open File Browswer', '/admin/assets');
69 69
         // per type
70 70
         $filesCount = File::get()->exclude(['ClassName' => [Folder::class, Image::class]])->count();
71 71
         $imageCount = File::get()->filter(['ClassName' => [Image::class]])->count();
72
-        $this->addLink('FILESANDIMAGES', $this->phrase('review'). ' Images ('.$imageCount.')', 'admin/assets?filter[appCategory]=IMAGE');
73
-        $this->addLink('FILESANDIMAGES', $this->phrase('review'). ' Files ('.$filesCount.')', 'admin/assets?filter[appCategory]=DOCUMENT');
72
+        $this->addLink('FILESANDIMAGES', $this->phrase('review') . ' Images (' . $imageCount . ')', 'admin/assets?filter[appCategory]=IMAGE');
73
+        $this->addLink('FILESANDIMAGES', $this->phrase('review') . ' Files (' . $filesCount . ')', 'admin/assets?filter[appCategory]=DOCUMENT');
74 74
 
75 75
         // default upload folder
76
-        $this->addLink('FILESANDIMAGES', $this->phrase('review'). ' Open Default Upload Folder', $uploadFolder->CMSEditLink());
76
+        $this->addLink('FILESANDIMAGES', $this->phrase('review') . ' Open Default Upload Folder', $uploadFolder->CMSEditLink());
77 77
 
78 78
         // recent
79
-        $lastWeekLink = '/admin/assets?'.'filter[lastEditedFrom]='.date('Y-m-d', strtotime('-1 week')).'&view=tile';
80
-        $this->addLink('FILESANDIMAGES', $this->phrase('review'). ' Recently modified Files', $lastWeekLink);
79
+        $lastWeekLink = '/admin/assets?' . 'filter[lastEditedFrom]=' . date('Y-m-d', strtotime('-1 week')) . '&view=tile';
80
+        $this->addLink('FILESANDIMAGES', $this->phrase('review') . ' Recently modified Files', $lastWeekLink);
81 81
     }
82 82
 
83 83
     protected function addSiteConfigLinks()
84 84
     {
85 85
         $this->addGroup('SITECONFIG', 'Site Wide Configuration', 20);
86
-        $this->addLink('SITECONFIG', $this->phrase('review'). ' Site Settings', '/admin/settings');
86
+        $this->addLink('SITECONFIG', $this->phrase('review') . ' Site Settings', '/admin/settings');
87 87
     }
88 88
 
89 89
     protected function addSecurityLinks()
90 90
     {
91 91
         $this->addGroup('SECURITY', 'Security', 30);
92
-        $this->addLink('SECURITY', $this->phrase('add'). ' User', '/admin/security/users/EditForm/field/users/item/new');
92
+        $this->addLink('SECURITY', $this->phrase('add') . ' User', '/admin/security/users/EditForm/field/users/item/new');
93 93
         $userCount = Member::get()->count();
94 94
         $groupCount = Group::get()->count();
95
-        $this->addLink('SECURITY', $this->phrase('review'). ' Users ('.$userCount.')', '/admin/security');
96
-        $this->addLink('SECURITY', $this->phrase('review'). ' Groups  ('.$groupCount.')', '/admin/security/groups');
95
+        $this->addLink('SECURITY', $this->phrase('review') . ' Users (' . $userCount . ')', '/admin/security');
96
+        $this->addLink('SECURITY', $this->phrase('review') . ' Groups  (' . $groupCount . ')', '/admin/security/groups');
97 97
         DefaultAdminService::singleton()->extend('addSecurityLinks', $this);
98 98
         $adminGroup = Permission::get_groups_by_permission('ADMIN')->first();
99
-        if($adminGroup) {
99
+        if ($adminGroup) {
100 100
             $userCount = $adminGroup->Members()->count();
101
-            $this->addLink('SECURITY', $this->phrase('review'). ' Administrators ('.$userCount.')', '/admin/security/groups/EditForm/field/groups/item/'.$adminGroup->ID.'/edit');
101
+            $this->addLink('SECURITY', $this->phrase('review') . ' Administrators (' . $userCount . ')', '/admin/security/groups/EditForm/field/groups/item/' . $adminGroup->ID . '/edit');
102 102
         }
103
-        if(class_exists(EnabledMembers::class)) {
103
+        if (class_exists(EnabledMembers::class)) {
104 104
             $obj = Injector::inst()->get(EnabledMembers::class);
105
-            $this->addLink('SECURITY', $this->phrase('review'). ' Multi-Factor Authentication Status', $obj->getLink());
105
+            $this->addLink('SECURITY', $this->phrase('review') . ' Multi-Factor Authentication Status', $obj->getLink());
106 106
         }
107 107
     }
108 108
 
@@ -113,51 +113,51 @@  discard block
 block discarded – undo
113 113
     {
114 114
         $modelAdmins = [];
115 115
         foreach (ClassInfo::subclassesFor(ModelAdmin::class, false) as $className) {
116
-            if($className === ArchiveAdmin::class) {
116
+            if ($className === ArchiveAdmin::class) {
117 117
                 continue;
118 118
             }
119 119
             $modelAdmins[$className] = $className;
120 120
 
121 121
         }
122
-        foreach($modelAdmins as $modelAdminClassName) {
122
+        foreach ($modelAdmins as $modelAdminClassName) {
123 123
             $groupAdded = false;
124 124
             $ma = Injector::inst()->get($modelAdminClassName);
125 125
             $mas = $ma->getManagedModels();
126
-            if(count($mas)) {
126
+            if (count($mas)) {
127 127
                 $numberOfModels = count($mas);
128 128
                 $groupCode = strtoupper($modelAdminClassName);
129 129
                 $count = 0;
130
-                foreach($mas as $model => $title) {
130
+                foreach ($mas as $model => $title) {
131 131
                     $count++;
132
-                    if($count > 7) {
132
+                    if ($count > 7) {
133 133
                         break;
134 134
                     }
135
-                    if(is_array($title)) {
135
+                    if (is_array($title)) {
136 136
                         $title = $title['title'];
137 137
                         $model = $title['dataClass'] ?? $model;
138 138
                     }
139
-                    if(! class_exists($model)) {
139
+                    if (!class_exists($model)) {
140 140
                         continue;
141 141
                     }
142
-                    if(! $groupAdded) {
142
+                    if (!$groupAdded) {
143 143
                         $this->addGroup($groupCode, $ma->menu_title(), 100);
144 144
                         $groupAdded = true;
145 145
                     }
146 146
                     $obj = DataObject::singleton($model);
147 147
                     $link = '';
148
-                    if($obj->hasMethod('CMSListLink')) {
148
+                    if ($obj->hasMethod('CMSListLink')) {
149 149
                         $link = $obj->CMSListLink();
150 150
                     } else {
151 151
                         $link = $ma->getLinkForModelTab($model);
152 152
                     }
153
-                    $this->addLink($groupCode, $this->phrase('edit'). ' '.$title, $link);
154
-                    if($numberOfModels < 4) {
153
+                    $this->addLink($groupCode, $this->phrase('edit') . ' ' . $title, $link);
154
+                    if ($numberOfModels < 4) {
155 155
                         $obj = Injector::inst()->get($model);
156
-                        if($obj->canCreate()) {
156
+                        if ($obj->canCreate()) {
157 157
                             $classNameEscaped = str_replace('\\', '-', $model);
158
-                            $linkNew = $link .= '/EditForm/field/'.$classNameEscaped.'/item/new';
158
+                            $linkNew = $link .= '/EditForm/field/' . $classNameEscaped . '/item/new';
159 159
                             $objectCount = $model::get()->count();
160
-                            $this->addLink($groupCode, $this->phrase('add'). ' '.$obj->i18n_singular_name() . ' ('.$objectCount.')', $linkNew);
160
+                            $this->addLink($groupCode, $this->phrase('add') . ' ' . $obj->i18n_singular_name() . ' (' . $objectCount . ')', $linkNew);
161 161
                         }
162 162
                     }
163 163
                 }
@@ -173,22 +173,22 @@  discard block
 block discarded – undo
173 173
             $pages[$className] = $className;
174 174
 
175 175
         }
176
-        $this->addGroup('PAGEFILTER', 'Page Types ('.count($pages).')', 300);
176
+        $this->addGroup('PAGEFILTER', 'Page Types (' . count($pages) . ')', 300);
177 177
         $count = 0;
178
-        foreach($pages as $pageClassName) {
178
+        foreach ($pages as $pageClassName) {
179 179
             $pageCount = $pageClassName::get()->count();
180
-            if($pageCount < 1) {
180
+            if ($pageCount < 1) {
181 181
                 continue;
182 182
             }
183 183
             $count++;
184
-            if($count > 12) {
184
+            if ($count > 12) {
185 185
                 break;
186 186
             }
187 187
             $page = Injector::inst()->get($pageClassName);
188 188
             $pageTitle = $page->i18n_singular_name();
189
-            $query = urlencode('q[ClassName]='.$pageClassName);
189
+            $query = urlencode('q[ClassName]=' . $pageClassName);
190 190
             $link = 'admin/pages?' . $query;
191
-            $this->addLink('PAGEFILTER', $this->phrase('edit'). ' '.$pageTitle.' ('.$pageCount.')', $link);
191
+            $this->addLink('PAGEFILTER', $this->phrase('edit') . ' ' . $pageTitle . ' (' . $pageCount . ')', $link);
192 192
         }
193 193
     }
194 194
 
@@ -218,14 +218,14 @@  discard block
 block discarded – undo
218 218
 
219 219
     protected function phrase(string $phrase): string
220 220
     {
221
-        if($phrase === 'add') {
221
+        if ($phrase === 'add') {
222 222
             $phrase = $this->config()->get('new_phrase');
223
-        } elseif($phrase === 'review') {
223
+        } elseif ($phrase === 'review') {
224 224
             $phrase = $this->config()->get('review_phrase');
225
-        } elseif($phrase === 'edit') {
225
+        } elseif ($phrase === 'edit') {
226 226
             $phrase = $this->config()->get('edit_phrase');
227 227
         }
228
-        return _t('DashboardWelcomeQuicklinks.'.$phrase, $phrase);
228
+        return _t('DashboardWelcomeQuicklinks.' . $phrase, $phrase);
229 229
     }
230 230
 
231 231
 }
Please login to merge, or discard this patch.
src/Admin/DashboardWelcomeQuickLinks.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
             usort(
54 54
                 $shortcuts,
55
-                function ($a, $b) {
55
+                function($a, $b) {
56 56
                     ($a['SortOrder'] ?? 0) <=> ($b['SortOrder'] ?? 0);
57 57
                 }
58 58
             );
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
         $useDefaultDashboard = $this->config()->get('use_default_dashboard');
132 132
         $classNames = ClassInfo::implementorsOf(DashboardWelcomeQuickLinksProvider::class);
133 133
         foreach ($classNames as $className) {
134
-            if($useDefaultDashboard === false && $className === DefaultDashboardProvider::class) {
134
+            if ($useDefaultDashboard === false && $className === DefaultDashboardProvider::class) {
135 135
                 continue;
136 136
             }
137 137
             $array += Injector::inst()->get($className)->provideDashboardWelcomeQuickLinks();
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
         if (!empty($iconClass)) {
154 154
             $icon = '<i class="' . $iconClass . '"></i> ';
155 155
         }
156
-        if($target) {
157
-            $target = ' target="'.$target.'"';
156
+        if ($target) {
157
+            $target = ' target="' . $target . '"';
158 158
         }
159 159
         if ($link) {
160 160
             $html = '
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
     {
187 187
         $app = $this->getApplicationName();
188 188
         $siteConfigTitle = SiteConfig::current_site_config()->Title;
189
-        if($siteConfigTitle) {
190
-            $app = $siteConfigTitle . ' ('.$app.')';
189
+        if ($siteConfigTitle) {
190
+            $app = $siteConfigTitle . ' (' . $app . ')';
191 191
         }
192 192
         return ($section = $this->SectionTitle()) ? sprintf('%s for %s', $section, $app) : $app;
193 193
     }
Please login to merge, or discard this patch.