Completed
Pull Request — master (#3788)
by Craig
01:31
created
src/system/ExtensionsModule/Api/AdminApi.php 2 patches
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 
161 161
         // add select and from params
162 162
         $qb->select('e')
163
-           ->from(self::EXTENSION_ENTITY, 'e');
163
+            ->from(self::EXTENSION_ENTITY, 'e');
164 164
 
165 165
         // filter by first letter of module
166 166
         if (isset($args['letter']) && !empty($args['letter'])) {
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
         $numitems = (!isset($args['numitems']) || empty($args['numitems']) || $args['numitems'] < 0) ? 0 : (int)$args['numitems'];
209 209
         if ($numitems > 0) {
210 210
             $qb->setFirstResult($startnum)
211
-               ->setMaxResults($numitems);
211
+                ->setMaxResults($numitems);
212 212
         }
213 213
 
214 214
         // convert querybuilder instance into a Query object
@@ -396,11 +396,11 @@  discard block
 block discarded – undo
396 396
 
397 397
         // Delete any module variables that the module cleanup function might have missed
398 398
         $query = $this->entityManager->createQueryBuilder()
399
-                                     ->delete()
400
-                                     ->from('Zikula\ExtensionsModule\Entity\ExtensionVarEntity', 'v')
401
-                                     ->where('v.modname = :modname')
402
-                                     ->setParameter('modname', $modinfo['name'])
403
-                                     ->getQuery();
399
+                                        ->delete()
400
+                                        ->from('Zikula\ExtensionsModule\Entity\ExtensionVarEntity', 'v')
401
+                                        ->where('v.modname = :modname')
402
+                                        ->setParameter('modname', $modinfo['name'])
403
+                                        ->getQuery();
404 404
         $query->getResult();
405 405
 
406 406
         if (is_object($version)) {
@@ -421,11 +421,11 @@  discard block
 block discarded – undo
421 421
             if ($canDelete == 1 || $modinfo['state'] == ModUtil::STATE_NOTALLOWED || $modinfo['state'] == ModUtil::STATE_MISSING || $modinfo['state'] == ModUtil::STATE_INVALID) {
422 422
                 // remove the entry from the modules table
423 423
                 $query = $this->entityManager->createQueryBuilder()
424
-                                             ->delete()
425
-                                             ->from(self::EXTENSION_ENTITY, 'e')
426
-                                             ->where('e.id = :id')
427
-                                             ->setParameter('id', $args['id'])
428
-                                             ->getQuery();
424
+                                                ->delete()
425
+                                                ->from(self::EXTENSION_ENTITY, 'e')
426
+                                                ->where('e.id = :id')
427
+                                                ->setParameter('id', $args['id'])
428
+                                                ->getQuery();
429 429
                 $query->getResult();
430 430
             } else {
431 431
                 //set state as uninitialised
@@ -434,11 +434,11 @@  discard block
 block discarded – undo
434 434
         } else {
435 435
             // remove the entry from the modules table
436 436
             $query = $this->entityManager->createQueryBuilder()
437
-                                         ->delete()
438
-                                         ->from(self::EXTENSION_ENTITY, 'e')
439
-                                         ->where('e.id = :id')
440
-                                         ->setParameter('id', $args['id'])
441
-                                         ->getQuery();
437
+                                            ->delete()
438
+                                            ->from(self::EXTENSION_ENTITY, 'e')
439
+                                            ->where('e.id = :id')
440
+                                            ->setParameter('id', $args['id'])
441
+                                            ->getQuery();
442 442
             $query->getResult();
443 443
         }
444 444
 
@@ -748,22 +748,22 @@  discard block
 block discarded – undo
748 748
                     if (isset($dbmodinfo['name']) && in_array($dbmodinfo['name'], (array)$modinfo['oldnames'])) {
749 749
                         // migrate its modvars
750 750
                         $query = $this->entityManager->createQueryBuilder()
751
-                             ->update('Zikula\ExtensionsModule\Entity\ExtensionVarEntity', 'v')
752
-                             ->set('v.modname', ':modname')
753
-                             ->setParameter('modname', $modinfo['name'])
754
-                             ->where('v.modname = :dbname')
755
-                             ->setParameter('dbname', $dbname)
756
-                             ->getQuery();
751
+                                ->update('Zikula\ExtensionsModule\Entity\ExtensionVarEntity', 'v')
752
+                                ->set('v.modname', ':modname')
753
+                                ->setParameter('modname', $modinfo['name'])
754
+                                ->where('v.modname = :dbname')
755
+                                ->setParameter('dbname', $dbname)
756
+                                ->getQuery();
757 757
                         $query->execute();
758 758
 
759 759
                         // rename the module register
760 760
                         $query = $this->entityManager->createQueryBuilder()
761
-                             ->update(self::EXTENSION_ENTITY, 'e')
762
-                             ->set('e.name', ':modname')
763
-                             ->setParameter('modname', $modinfo['name'])
764
-                             ->where('e.id = :dbname')
765
-                             ->setParameter('dbname', $dbmodules[$dbname]['id'])
766
-                             ->getQuery();
761
+                                ->update(self::EXTENSION_ENTITY, 'e')
762
+                                ->set('e.name', ':modname')
763
+                                ->setParameter('modname', $modinfo['name'])
764
+                                ->where('e.id = :dbname')
765
+                                ->setParameter('dbname', $dbmodules[$dbname]['id'])
766
+                                ->getQuery();
767 767
                         $query->execute();
768 768
 
769 769
                         // replace the old module with the new one in the dbmodules array
@@ -1194,7 +1194,7 @@  discard block
 block discarded – undo
1194 1194
 
1195 1195
         // add select and from params
1196 1196
         $qb->select('COUNT(e.id)')
1197
-           ->from(self::EXTENSION_ENTITY, 'e');
1197
+            ->from(self::EXTENSION_ENTITY, 'e');
1198 1198
 
1199 1199
         // filter by first letter of module
1200 1200
         if (isset($args['letter']) && !empty($args['letter'])) {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
             throw new \InvalidArgumentException($this->__('Error! Module URL is a required field, please enter a unique name.'));
107 107
         }
108 108
 
109
-        $path = realpath($this->getContainer()->get('kernel')->getRootDir(). '/../' . DataUtil::formatForOS($args['url']));
109
+        $path = realpath($this->getContainer()->get('kernel')->getRootDir() . '/../' . DataUtil::formatForOS($args['url']));
110 110
         if (is_dir($path)) {
111 111
             throw new \InvalidArgumentException($this->__('You have attempted to select an invalid name (it is a subdirectory).'));
112 112
         }
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
             // Work out if admin-capable
525 525
             // @deprecated - author must declare in Core 2.0
526 526
             // e.g. "capabilities": {"admin": {"route": "zikulafoomodule_admin_index"} }
527
-            if (empty($moduleVersionArray['capabilities']['admin']) && file_exists($bundle->getPath().'/Controller/AdminController.php')) {
527
+            if (empty($moduleVersionArray['capabilities']['admin']) && file_exists($bundle->getPath() . '/Controller/AdminController.php')) {
528 528
                 $caps = $moduleVersionArray['capabilities'];
529 529
                 $caps['admin'] = ['url' => ModUtil::url($bundle->getName(), 'admin', 'index')];
530 530
                 $moduleVersionArray['capabilities'] = $caps;
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
             // Work out if user-capable
534 534
             // @deprecated - author must declare in Core 2.0
535 535
             // e.g. "capabilities": {"user": {"route": "zikulafoomodule_user_index"} }
536
-            if (empty($moduleVersionArray['capabilities']['user']) && file_exists($bundle->getPath().'/Controller/UserController.php')) {
536
+            if (empty($moduleVersionArray['capabilities']['user']) && file_exists($bundle->getPath() . '/Controller/UserController.php')) {
537 537
                 $caps = $moduleVersionArray['capabilities'];
538 538
                 $caps['user'] = ['url' => ModUtil::url($bundle->getName(), 'user', 'index')];
539 539
                 $moduleVersionArray['capabilities'] = $caps;
Please login to merge, or discard this patch.
src/system/ExtensionsModule/Controller/AdminController.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -286,11 +286,11 @@
 block discarded – undo
286 286
         }
287 287
 
288 288
         $this->view->assign('plugins', $plugins)
289
-                   ->assign('module', $module)
290
-                   ->assign('sort', $sort)
291
-                   ->assign('state', $state)
292
-                   ->assign('systemplugins', $systemplugins)
293
-                   ->assign('_type', ($systemplugins) ? 'system' : 'module');
289
+                    ->assign('module', $module)
290
+                    ->assign('sort', $sort)
291
+                    ->assign('state', $state)
292
+                    ->assign('systemplugins', $systemplugins)
293
+                    ->assign('_type', ($systemplugins) ? 'system' : 'module');
294 294
 
295 295
         // Return the output that has been generated by this function
296 296
         return new Response($this->view->fetch('Admin/viewPlugins.tpl'));
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -260,7 +260,7 @@
 block discarded – undo
260 260
                 ];
261 261
             }
262 262
 
263
-            $info =  [
263
+            $info = [
264 264
                 'instance'    => $instance,
265 265
                 'status'      => $status,
266 266
                 'statusclass' => $statusclass,
Please login to merge, or discard this patch.
src/system/SearchModule/Api/UserApi.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
     public function getallplugins($args)
278 278
     {
279 279
         // defaults
280
-        $loadAll = isset($args['loadall']) ? (bool) $args['loadall'] : false;
280
+        $loadAll = isset($args['loadall']) ? (bool)$args['loadall'] : false;
281 281
 
282 282
         // initialize the search plugins array
283 283
         $search_modules = [];
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 
383 383
         if (!empty($args['q'])) {
384 384
             $q = DataUtil::formatForStore($args['q']);
385
-            $q = str_replace('%', '\\%', $q);  // Don't allow user input % as wildcard
385
+            $q = str_replace('%', '\\%', $q); // Don't allow user input % as wildcard
386 386
             $where .= ' (';
387 387
             if ($args['searchtype'] !== 'EXACT') {
388 388
                 $searchwords = self::split_query($q);
Please login to merge, or discard this patch.
src/system/SearchModule/Entity/Repository/SearchStatRepository.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
             $i = 1;
58 58
             foreach ($filters as $w_key => $w_value) {
59 59
                 $qb->andWhere($qb->expr()->eq('tbl.' . $w_key, '?' . $i))
60
-                   ->setParameter($i, $w_value);
60
+                    ->setParameter($i, $w_value);
61 61
                 $i++;
62 62
             }
63 63
         }
Please login to merge, or discard this patch.
src/system/ThemeModule/Api/AdminApi.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         }
93 93
 
94 94
         $themeinfo = ThemeUtil::getInfo(ThemeUtil::getIDFromName($args['themename']));
95
-        if (!file_exists('themes/' . DataUtil::formatForOS($themeinfo['directory']). '/' . $themeinfo['name'] . '.php')) {
95
+        if (!file_exists('themes/' . DataUtil::formatForOS($themeinfo['directory']) . '/' . $themeinfo['name'] . '.php')) {
96 96
             throw new \InvalidArgumentException(__('Invalid arguments array received'));
97 97
         }
98 98
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 
229 229
         $ostemp  = CacheUtil::getLocalDir();
230 230
         $ostheme = DataUtil::formatForOS($themename);
231
-        $osfile  = $ostemp.'/Theme_Config/'.$ostheme.'/'.DataUtil::formatForOS($args['file']);
231
+        $osfile  = $ostemp . '/Theme_Config/' . $ostheme . '/' . DataUtil::formatForOS($args['file']);
232 232
 
233 233
         if (file_exists($osfile) && is_writable($osfile)) {
234 234
             unlink($osfile);
Please login to merge, or discard this patch.
src/system/ThemeModule/Api/UserApi.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 
286 286
         $themename = $args['theme'];
287 287
         $theme = ThemeUtil::getTheme($themename);
288
-        $themeinfo   = ThemeUtil::getInfo(ThemeUtil::getIDFromName($themename));
288
+        $themeinfo = ThemeUtil::getInfo(ThemeUtil::getIDFromName($themename));
289 289
         if (isset($theme)) {
290 290
             $templatedir = $theme->getConfigPath();
291 291
         } else {
@@ -322,9 +322,9 @@  discard block
 block discarded – undo
322 322
 
323 323
         $themeinfo = ThemeUtil::getInfo(ThemeUtil::getIDFromName($args['theme']));
324 324
         if ($theme = ThemeUtil::getTheme($themeinfo['name'])) {
325
-            $templatedir = $theme->getPath().'/Resources/views';
325
+            $templatedir = $theme->getPath() . '/Resources/views';
326 326
         } else {
327
-            $templatedir = 'themes/'.DataUtil::formatForOS($themeinfo['directory']).'/templates';
327
+            $templatedir = 'themes/' . DataUtil::formatForOS($themeinfo['directory']) . '/templates';
328 328
         }
329 329
 
330 330
         if ($args['type'] == 'modules') {
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
             $templatelist = [];
335 335
         }
336 336
 
337
-        $templatelist = array_merge($templatelist, FileUtil::getFiles($templatedir.'/'.$args['type'], false, $args['type'], ['.tpl', '.htm'], 'f'));
337
+        $templatelist = array_merge($templatelist, FileUtil::getFiles($templatedir . '/' . $args['type'], false, $args['type'], ['.tpl', '.htm'], 'f'));
338 338
 
339 339
         return $templatelist;
340 340
     }
@@ -374,12 +374,12 @@  discard block
 block discarded – undo
374 374
         $ostheme  = DataUtil::formatForOS($themeinfo['directory']);
375 375
         $osfile   = DataUtil::formatForOS($args['file']);
376 376
 
377
-        if (file_exists($ostemp.'/Theme_Config/'.$ostheme.'/'.$osfile)) {
378
-            return parse_ini_file($ostemp.'/Theme_Config/'.$ostheme.'/'.$osfile, $args['sections']);
379
-        } elseif (file_exists('themes/'.$ostheme.'/templates/config/'.$osfile)) {
380
-            return parse_ini_file('themes/'.$ostheme.'/templates/config/'.$osfile, $args['sections']);
377
+        if (file_exists($ostemp . '/Theme_Config/' . $ostheme . '/' . $osfile)) {
378
+            return parse_ini_file($ostemp . '/Theme_Config/' . $ostheme . '/' . $osfile, $args['sections']);
379
+        } elseif (file_exists('themes/' . $ostheme . '/templates/config/' . $osfile)) {
380
+            return parse_ini_file('themes/' . $ostheme . '/templates/config/' . $osfile, $args['sections']);
381 381
         } elseif ($theme = ThemeUtil::getTheme($themeinfo['name'])) {
382
-            $file = $theme->getPath().'/Resources/config/'.$osfile;
382
+            $file = $theme->getPath() . '/Resources/config/' . $osfile;
383 383
             if (file_exists($file)) {
384 384
                 return parse_ini_file($file, $args['sections']);
385 385
             } else {
@@ -423,20 +423,20 @@  discard block
 block discarded – undo
423 423
 
424 424
         // verify the writable paths
425 425
         if ($theme = ThemeUtil::getTheme($themeinfo['name'])) {
426
-            $tpath = $theme->getPath().'/Resources/config';
426
+            $tpath = $theme->getPath() . '/Resources/config';
427 427
         } else {
428
-            $tpath = 'themes/'.$ostheme.'/templates/config';
428
+            $tpath = 'themes/' . $ostheme . '/templates/config';
429 429
         }
430 430
 
431
-        if (is_writable($tpath.'/'.$osfile)) {
432
-            $handle = fopen($tpath.'/'.$osfile, 'w+');
431
+        if (is_writable($tpath . '/' . $osfile)) {
432
+            $handle = fopen($tpath . '/' . $osfile, 'w+');
433 433
         } else {
434
-            if (!file_exists($zpath = $ostemp.'/Theme_Config/'.$ostheme)) {
434
+            if (!file_exists($zpath = $ostemp . '/Theme_Config/' . $ostheme)) {
435 435
                 mkdir($zpath, $this->serviceManager['system.chmod_dir'], true);
436 436
             }
437 437
 
438
-            if (!file_exists($zpath.'/'.$osfile) || is_writable($zpath.'/'.$osfile)) {
439
-                $handle = fopen($zpath.'/'.$osfile, 'w+');
438
+            if (!file_exists($zpath . '/' . $osfile) || is_writable($zpath . '/' . $osfile)) {
439
+                $handle = fopen($zpath . '/' . $osfile, 'w+');
440 440
             } else {
441 441
                 throw new \RuntimeException($this->__f('Error! Cannot write in "%1$s" or "%2$s" to store the contents of "%3$s"', [$tpath, $zpath, $osfile]));
442 442
             }
Please login to merge, or discard this patch.
src/system/ThemeModule/Block/ThemeswitcherBlock.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -129,9 +129,9 @@
 block discarded – undo
129 129
         }
130 130
 
131 131
         $this->view->assign($vars)
132
-                   ->assign('currentthemepic', $currentthemepic)
133
-                   ->assign('currenttheme', $currenttheme)
134
-                   ->assign('themes', $previewthemes);
132
+                    ->assign('currentthemepic', $currentthemepic)
133
+                    ->assign('currenttheme', $currenttheme)
134
+                    ->assign('themes', $previewthemes);
135 135
 
136 136
         $blockinfo['content'] = $this->view->fetch('Block/themeswitcher.tpl');
137 137
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -115,9 +115,9 @@
 block discarded – undo
115 115
         $currentthemepic = null;
116 116
         foreach ($themes as $themeinfo) {
117 117
             $themename = $themeinfo['name'];
118
-            if (file_exists($themepic = 'themes/'.DataUtil::formatForOS($themeinfo['directory']).'/images/preview_small.png')) {
118
+            if (file_exists($themepic = 'themes/' . DataUtil::formatForOS($themeinfo['directory']) . '/images/preview_small.png')) {
119 119
                 $themeinfo['previewImage'] = $themepic;
120
-            } elseif (file_exists($themepic = 'themes/'.DataUtil::formatForOS($themeinfo['directory']).'/Resources/public/images/preview_small.png')) {
120
+            } elseif (file_exists($themepic = 'themes/' . DataUtil::formatForOS($themeinfo['directory']) . '/Resources/public/images/preview_small.png')) {
121 121
                 $themeinfo['previewImage'] = $themepic;
122 122
             } else {
123 123
                 $themeinfo['previewImage'] = 'system/ThemeModule/Resources/public/images/preview_small.png';
Please login to merge, or discard this patch.
src/system/ThemeModule/Block/RenderBlock.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -195,8 +195,8 @@
 block discarded – undo
195 195
 
196 196
         // generate the output
197 197
         return $this->view->assign($vars)
198
-                          ->assign('warnings', $warnings)
199
-                          ->fetch('Block/render_modify.tpl');
198
+                            ->assign('warnings', $warnings)
199
+                            ->fetch('Block/render_modify.tpl');
200 200
     }
201 201
 
202 202
     /**
Please login to merge, or discard this patch.
src/system/ThemeModule/Engine/AssetFilter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         $header .= ($this->scriptPosition == 'head') ? $this->jsResolver->compile() : '';
88 88
         $header .= trim(implode("\n", \PageUtil::getVar('header', [])) . "\n"); // @todo legacy - remove at Core-2.0
89 89
         if (strripos($source, '</head>')) {
90
-            $source = str_replace('</head>', $header."\n</head>", $source);
90
+            $source = str_replace('</head>', $header . "\n</head>", $source);
91 91
         }
92 92
 
93 93
         // compile and replace foot
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
         $footer .= trim(implode("\n", $this->footers->all()) . "\n");
96 96
         $footer .= trim(implode("\n", \PageUtil::getVar('footer', [])) . "\n"); // @todo legacy - remove at Core-2.0
97 97
         if (false === empty($footer)) {
98
-            $source = str_replace('</body>', $footer."\n</body>", $source);
98
+            $source = str_replace('</body>', $footer . "\n</body>", $source);
99 99
         }
100 100
 
101 101
         return $source;
Please login to merge, or discard this patch.