Completed
Branch 1.4 (78c96b)
by Axel
22:13
created
src/lib/legacy/util/ModUtil.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -377,13 +377,13 @@
 block discarded – undo
377 377
         // else just delete this specific variable
378 378
         /** @var $qb \Doctrine\ORM\QueryBuilder */
379 379
         $qb = $em->createQueryBuilder()
380
-                 ->delete('Zikula\ExtensionsModule\Entity\ExtensionVarEntity', 'v')
381
-                 ->where('v.modname = :modname')
382
-                 ->setParameter('modname', $modname);
380
+                    ->delete('Zikula\ExtensionsModule\Entity\ExtensionVarEntity', 'v')
381
+                    ->where('v.modname = :modname')
382
+                    ->setParameter('modname', $modname);
383 383
 
384 384
         if (!empty($name)) {
385 385
             $qb->andWhere('v.name = :name')
386
-               ->setParameter('name', $name);
386
+                ->setParameter('name', $name);
387 387
         }
388 388
 
389 389
         $query = $qb->getQuery();
Please login to merge, or discard this patch.
src/lib/legacy/util/DataUtil.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -185,14 +185,14 @@
 block discarded – undo
185 185
                 $var[$k] = self::formatForDisplay($v);
186 186
             }
187 187
         } else {
188
-            $var = htmlspecialchars((string) $var);
188
+            $var = htmlspecialchars((string)$var);
189 189
             // This search and replace finds the text 'x@y' and replaces
190 190
             // it with HTML entities, this provides protection against
191 191
             // email harvesters
192 192
             $var = preg_replace_callback(
193 193
                 '/(.)@(.)/s',
194
-                function ($m) {
195
-                    return "&#".sprintf("%03d", ord($m[1])).";@&#" .sprintf("%03d", ord($m[2])) . ";";
194
+                function($m) {
195
+                    return "&#" . sprintf("%03d", ord($m[1])) . ";@&#" . sprintf("%03d", ord($m[2])) . ";";
196 196
                 },
197 197
                 $var);
198 198
         }
Please login to merge, or discard this patch.
src/lib/legacy/util/LogUtil.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@
 block discarded – undo
80 80
     {
81 81
         $session = ServiceUtil::getManager()->get('session');
82 82
         $warns = $session->getFlashBag()->peek(Zikula_Session::MESSAGE_WARNING);
83
-        $errs =  $session->getFlashBag()->peek(Zikula_Session::MESSAGE_ERROR);
83
+        $errs = $session->getFlashBag()->peek(Zikula_Session::MESSAGE_ERROR);
84 84
 
85 85
         if (!empty($errs) && $override) {
86 86
             $warns = $errs;
Please login to merge, or discard this patch.
src/lib/legacy/util/FileUtil.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
                         $files[$filenameToStore] = (array)self::getFiles($path, $recurse, $relativepath, $extensions, $type, $nestedData);
212 212
                     } else {
213 213
                         $files = array_merge((array)$files,
214
-                                              (array)self::getFiles($path, $recurse, $relativepath, $extensions, $type, $nestedData));
214
+                                                (array)self::getFiles($path, $recurse, $relativepath, $extensions, $type, $nestedData));
215 215
                     }
216 216
                 } elseif (!$extensions && !$regexpMatch) {
217 217
                     $files[] = $filenameToStore;
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
             fputcsv($out, $datarow, $delimiter, $enclosure);
554 554
         }
555 555
 
556
-         //close the out file
556
+            //close the out file
557 557
         fclose($out);
558 558
 
559 559
         exit;
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 
528 528
         // create random filename if none is given or else format it appropriately
529 529
         if (!isset($filename)) {
530
-            $filename = 'csv_'.time().'.csv';
530
+            $filename = 'csv_' . time() . '.csv';
531 531
         } else {
532 532
             $filename = DataUtil::formatForOS($filename);
533 533
         }
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
         ini_set('zlib.output_compression', 0);
538 538
         header('Cache-Control: no-store, no-cache');
539 539
         header('Content-type: text/csv');
540
-        header('Content-Disposition: attachment; filename="'.$filename.'"');
540
+        header('Content-Disposition: attachment; filename="' . $filename . '"');
541 541
         header('Content-Transfer-Encoding: binary');
542 542
 
543 543
         // open a file for csv writing
Please login to merge, or discard this patch.
src/lib/legacy/util/UserUtil.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -483,14 +483,14 @@  discard block
 block discarded – undo
483 483
 
484 484
         // count of uname appearances in users table
485 485
         $qb = $em->createQueryBuilder()
486
-                 ->select('count(u.uid)')
487
-                 ->from('ZikulaUsersModule:UserEntity', 'u')
488
-                 ->where('u.uname = :uname')
489
-                 ->setParameter('uname', $uname);
486
+                    ->select('count(u.uid)')
487
+                    ->from('ZikulaUsersModule:UserEntity', 'u')
488
+                    ->where('u.uname = :uname')
489
+                    ->setParameter('uname', $uname);
490 490
 
491 491
         if ($excludeUid > 1) {
492 492
             $qb->andWhere('u.uid <> :excludeUid')
493
-               ->setParameter('excludeUid', $excludeUid);
493
+                ->setParameter('excludeUid', $excludeUid);
494 494
         }
495 495
 
496 496
         $query = $qb->getQuery();
@@ -519,14 +519,14 @@  discard block
 block discarded – undo
519 519
 
520 520
         // count of email appearances in users table
521 521
         $qb = $em->createQueryBuilder()
522
-                 ->select('count(u.uid)')
523
-                 ->from('ZikulaUsersModule:UserEntity', 'u')
524
-                 ->where('u.email = :email')
525
-                 ->setParameter('email', $emailAddress);
522
+                    ->select('count(u.uid)')
523
+                    ->from('ZikulaUsersModule:UserEntity', 'u')
524
+                    ->where('u.email = :email')
525
+                    ->setParameter('email', $emailAddress);
526 526
 
527 527
         if ($excludeUid > 1) {
528 528
             $qb->andWhere('u.uid <> :excludeUid')
529
-               ->setParameter('excludeUid', $excludeUid);
529
+                ->setParameter('excludeUid', $excludeUid);
530 530
         }
531 531
 
532 532
         $query = $qb->getQuery();
@@ -535,16 +535,16 @@  discard block
 block discarded – undo
535 535
 
536 536
         // count of email appearances in users verification table
537 537
         $qb = $em->createQueryBuilder()
538
-                 ->select('count(v.uid)')
539
-                 ->from('ZikulaZAuthModule:UserVerificationEntity', 'v')
540
-                 ->where('v.newemail = :email')
541
-                 ->andWhere('v.changetype = :chgtype')
542
-                 ->setParameter('email', $emailAddress)
543
-                 ->setParameter('chgtype', ZAuthConstant::VERIFYCHGTYPE_EMAIL);
538
+                    ->select('count(v.uid)')
539
+                    ->from('ZikulaZAuthModule:UserVerificationEntity', 'v')
540
+                    ->where('v.newemail = :email')
541
+                    ->andWhere('v.changetype = :chgtype')
542
+                    ->setParameter('email', $emailAddress)
543
+                    ->setParameter('chgtype', ZAuthConstant::VERIFYCHGTYPE_EMAIL);
544 544
 
545 545
         if ($excludeUid > 1) {
546 546
             $qb->andWhere('v.uid <> :excludeUid')
547
-               ->setParameter('excludeUid', $excludeUid);
547
+                ->setParameter('excludeUid', $excludeUid);
548 548
         }
549 549
 
550 550
         $query = $qb->getQuery();
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
     {
250 250
         $str = self::getGroupListForUser($uid, '_');
251 251
 
252
-        return $str == '-1' ? 'guest' : 'groups_'.$str;
252
+        return $str == '-1' ? 'guest' : 'groups_' . $str;
253 253
     }
254 254
 
255 255
     /**
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
     {
267 267
         $uid = $uid ? (int)$uid : self::getVar('uid');
268 268
 
269
-        return !$uid ? 'guest' : 'uid_'.$uid;
269
+        return !$uid ? 'guest' : 'uid_' . $uid;
270 270
     }
271 271
 
272 272
     /**
@@ -1482,7 +1482,7 @@  discard block
 block discarded – undo
1482 1482
         if (!empty($sortbyfield)) {
1483 1483
             $sortFragments = [];
1484 1484
 
1485
-            $sortFragments[] = 'u.'. $sortbyfield . ' ' . DataUtil::formatForStore($sortorder);
1485
+            $sortFragments[] = 'u.' . $sortbyfield . ' ' . DataUtil::formatForStore($sortorder);
1486 1486
 
1487 1487
             if ($sortbyfield != 'uname') {
1488 1488
                 $sortFragments[] = 'u.uname ASC';
Please login to merge, or discard this patch.
src/lib/legacy/util/ZLoader.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     {
52 52
         $separator = $separator === '\\' ? '' : $separator;
53 53
 
54
-        self::$autoloader->add($namespace.$separator, $paths);
54
+        self::$autoloader->add($namespace . $separator, $paths);
55 55
     }
56 56
 
57 57
     public static function addPrefix($prefix, $paths)
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
         if (strpos($class, '_')) {
126 126
             $array = explode('_', $class);
127 127
             $prefix = (isset($map[$array[0]]) ? $map[$array[0]] . '/' : '');
128
-            $path = __DIR__.'/../'.$prefix . str_replace('_', '/', $class) . '.php';
128
+            $path = __DIR__ . '/../' . $prefix . str_replace('_', '/', $class) . '.php';
129 129
             if (file_exists($path)) {
130 130
                 return include $path;
131 131
             }
Please login to merge, or discard this patch.
src/lib/legacy/util/BlockUtil.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -72,14 +72,14 @@  discard block
 block discarded – undo
72 72
                     foreach ($arguments as $argument) {
73 73
                         $args = explode('=', $argument);
74 74
                         if (!in_array($args[0], $filtervars)) {
75
-                            $customargs[] = DataUtil::formatForOS(strip_tags($args[0])).'='.DataUtil::formatForOS(
75
+                            $customargs[] = DataUtil::formatForOS(strip_tags($args[0])) . '=' . DataUtil::formatForOS(
76 76
                                     strip_tags($args[1])
77 77
                                 );
78 78
                         }
79 79
                     }
80 80
                 } else {
81 81
                     if (!in_array($var, $filtervars)) {
82
-                        $customargs[] = DataUtil::formatForOS(strip_tags($var)).'='.DataUtil::formatForOS(
82
+                        $customargs[] = DataUtil::formatForOS(strip_tags($var)) . '=' . DataUtil::formatForOS(
83 83
                                 strip_tags($value)
84 84
                             );
85 85
                     }
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
144 144
             $modinfo = ModUtil::getInfo($blockinfo['mid']);
145 145
             $blockOutput = self::show($modinfo['name'], $blockinfo['bkey'], $blockinfo, $blockplacement->getBlock());
146 146
             // wrap block if theme requires it.
147
-            $blockWrapper = (bool) Zikula_View_Theme::getInstance()->themeconfig['blockwrapper'];
147
+            $blockWrapper = (bool)Zikula_View_Theme::getInstance()->themeconfig['blockwrapper'];
148 148
             if ($blockWrapper) {
149
-                $blockOutput = '<div class="z-block '. 'z-blockposition-'.DataUtil::formatForDisplay($blockinfo['position']).' z-bkey-' . DataUtil::formatForDisplay(strtolower($blockinfo['bkey'])) . ' z-bid-' . DataUtil::formatForDisplay($blockinfo['bid']) . '">' . "\n" . $blockOutput . "</div>\n";
149
+                $blockOutput = '<div class="z-block ' . 'z-blockposition-' . DataUtil::formatForDisplay($blockinfo['position']) . ' z-bkey-' . DataUtil::formatForDisplay(strtolower($blockinfo['bkey'])) . ' z-bid-' . DataUtil::formatForDisplay($blockinfo['bid']) . '">' . "\n" . $blockOutput . "</div>\n";
150 150
             }
151 151
             if ($echo) {
152 152
                 echo $blockOutput;
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
             $instanceArgs = $blockinfo;
191 191
         }
192 192
         if (is_callable($displayfunc)) {
193
-            $content =  call_user_func($displayfunc, $instanceArgs);
193
+            $content = call_user_func($displayfunc, $instanceArgs);
194 194
         }
195 195
         if ($blockInstance instanceof BlockHandlerInterface) {
196 196
             // FC blocks require wrapping the content in the theme
@@ -228,19 +228,19 @@  discard block
 block discarded – undo
228 228
             }
229 229
             // check for collapsable menus being enabled, and setup the collapsable menu image.
230 230
             if (!isset($upb)) {
231
-                if (file_exists('themes/'.$themedir.'/images/upb.png')) {
232
-                    $upb = '<img src="themes/'.$themedir.'/images/upb.png" alt="-" />';
233
-                } elseif (file_exists('themes/'.$themedir.'/images/14_layer_raiselayer.png')) {
234
-                    $upb = '<img src="themes/'.$themedir.'/images/14_layer_raiselayer.png" alt="-" />';
231
+                if (file_exists('themes/' . $themedir . '/images/upb.png')) {
232
+                    $upb = '<img src="themes/' . $themedir . '/images/upb.png" alt="-" />';
233
+                } elseif (file_exists('themes/' . $themedir . '/images/14_layer_raiselayer.png')) {
234
+                    $upb = '<img src="themes/' . $themedir . '/images/14_layer_raiselayer.png" alt="-" />';
235 235
                 } else {
236 236
                     $upb = '<img src="images/icons/extrasmall/14_layer_raiselayer.png" alt="-" />';
237 237
                 }
238 238
             }
239 239
             if (!isset($downb)) {
240
-                if (file_exists('themes/'.$themedir.'/images/downb.png')) {
241
-                    $downb = '<img src="themes/'.$themedir.'/images/downb.png" alt="+" />';
242
-                } elseif (file_exists('themes/'.$themedir.'/images/14_layer_lowerlayer.png')) {
243
-                    $downb = '<img src="themes/'.$themedir.'/images/14_layer_lowerlayer.png" alt="+" />';
240
+                if (file_exists('themes/' . $themedir . '/images/downb.png')) {
241
+                    $downb = '<img src="themes/' . $themedir . '/images/downb.png" alt="+" />';
242
+                } elseif (file_exists('themes/' . $themedir . '/images/14_layer_lowerlayer.png')) {
243
+                    $downb = '<img src="themes/' . $themedir . '/images/14_layer_lowerlayer.png" alt="+" />';
244 244
                 } else {
245 245
                     $downb = '<img src="images/icons/extrasmall/14_layer_lowerlayer.png" alt="+" />';
246 246
                 }
@@ -248,16 +248,16 @@  discard block
 block discarded – undo
248 248
             $checkUserBlock = self::checkUserBlock($blockinfo);
249 249
             if ($checkUserBlock) {
250 250
                 if (!empty($blockinfo['title'])) {
251
-                    $blockinfo['minbox'] = '<a href="'.DataUtil::formatForDisplay(
251
+                    $blockinfo['minbox'] = '<a href="' . DataUtil::formatForDisplay(
252 252
                             ModUtil::url('ZikulaBlocksModule', 'user', 'changestatus', ['bid' => $blockinfo['bid']])
253
-                        ).'">'.$upb.'</a>';
253
+                        ) . '">' . $upb . '</a>';
254 254
                 }
255 255
             } else {
256 256
                 $blockinfo['content'] = '';
257 257
                 if (!empty($blockinfo['title'])) {
258
-                    $blockinfo['minbox'] = '<a href="'.DataUtil::formatForDisplay(
258
+                    $blockinfo['minbox'] = '<a href="' . DataUtil::formatForDisplay(
259 259
                             ModUtil::url('ZikulaBlocksModule', 'user', 'changestatus', ['bid' => $blockinfo['bid']])
260
-                        ).'">'.$downb.'</a>';
260
+                        ) . '">' . $downb . '</a>';
261 261
                 }
262 262
             }
263 263
             // end collapseable menu config
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
         if ($modinfo['state'] != \ModUtil::STATE_ACTIVE) {
292 292
             return false;
293 293
         }
294
-        $serviceId = strtolower('block.'.$modinfo['name'].'_'.'Block_'.$block);
294
+        $serviceId = strtolower('block.' . $modinfo['name'] . '_' . 'Block_' . $block);
295 295
         if ($sm->has($serviceId)) {
296 296
             return $sm->get($serviceId);
297 297
         }
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
         $basedir = ($modinfo['type'] == ModUtil::TYPE_SYSTEM) ? 'system' : 'modules';
302 302
         $moddir = DataUtil::formatForOS($modinfo['directory']);
303 303
         $blockdir = "$basedir/$moddir/lib/$moddir/Block";
304
-        $ooblock = "$blockdir/".ucwords($block).'.php';
304
+        $ooblock = "$blockdir/" . ucwords($block) . '.php';
305 305
         ModUtil::load($modname);
306 306
         // get the block info
307 307
         $kernel = $sm->get('kernel');
@@ -309,14 +309,14 @@  discard block
 block discarded – undo
309 309
         try {
310 310
             /** @var $module \Zikula\Core\AbstractModule */
311 311
             $module = $kernel->getModule($modinfo['name']);
312
-            $className = $module->getNamespace().'\\Block\\'.ucwords($block);
313
-            $className = preg_match('/.*Block$/', $className) ? $className : $className.'Block';
312
+            $className = $module->getNamespace() . '\\Block\\' . ucwords($block);
313
+            $className = preg_match('/.*Block$/', $className) ? $className : $className . 'Block';
314 314
         } catch (\InvalidArgumentException $e) {
315 315
         }
316 316
         if (!isset($className)) {
317
-            $className = ucwords($modinfo['name']).'\\'.'Block\\'.ucwords($block);
318
-            $className = preg_match('/.*Block$/', $className) ? $className : $className.'Block';
319
-            $classNameOld = ucwords($modinfo['name']).'_'.'Block_'.ucwords($block);
317
+            $className = ucwords($modinfo['name']) . '\\' . 'Block\\' . ucwords($block);
318
+            $className = preg_match('/.*Block$/', $className) ? $className : $className . 'Block';
319
+            $classNameOld = ucwords($modinfo['name']) . '_' . 'Block_' . ucwords($block);
320 320
             $className = class_exists($className) ? $className : $classNameOld;
321 321
         }
322 322
         $blockInstance = \ServiceUtil::get('zikula_blocks_module.api.block_factory')->getInstance($className, $module);
@@ -405,14 +405,14 @@  discard block
 block discarded – undo
405 405
             $item = $entityManager->getRepository('ZikulaBlocksModule:UserBlockEntity')->findOneBy(['uid' => $uid, 'bid' => $blockinfo['bid']]);
406 406
             if (!$item) {
407 407
                 $item = new \Zikula\BlocksModule\Entity\UserBlockEntity();
408
-                $item['uid'] = (int) $uid;
408
+                $item['uid'] = (int)$uid;
409 409
                 $item['bid'] = $blockinfo['bid'];
410 410
                 $item['active'] = $blockinfo['defaultstate'];
411 411
                 $entityManager->persist($item);
412 412
                 $entityManager->flush();
413 413
             }
414 414
 
415
-            return (bool) $item['active'];
415
+            return (bool)$item['active'];
416 416
         }
417 417
 
418 418
         return false;
Please login to merge, or discard this patch.
src/lib/legacy/util/EventUtil.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -336,7 +336,7 @@
 block discarded – undo
336 336
                             if (is_callable($handler['callable'])) {
337 337
                                 self::attach($handler['eventname'], $handler['callable'], $handler['weight']);
338 338
                             } else {
339
-                                LogUtil::log(sprintf("Event handler was not attached for event '%s' because method '%s' is not callable", $handler['eventname'], $handler['callable'][0].'::'.$handler['callable'][1]), \Monolog\Logger::ERROR);
339
+                                LogUtil::log(sprintf("Event handler was not attached for event '%s' because method '%s' is not callable", $handler['eventname'], $handler['callable'][0] . '::' . $handler['callable'][1]), \Monolog\Logger::ERROR);
340 340
                             }
341 341
                         }
342 342
                     } catch (InvalidArgumentException $e) {
Please login to merge, or discard this patch.
src/lib/legacy/util/StringUtil.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -182,14 +182,14 @@
 block discarded – undo
182 182
             }
183 183
 
184 184
             // Get context on the left
185
-            $startPos = (int) max(0, $startPos - floor($contextSize / 2));
185
+            $startPos = (int)max(0, $startPos - floor($contextSize / 2));
186 186
             // Get the first word of section in full length
187 187
             while ($startPos > 0 && $text[$startPos] != ' ') {
188 188
                 --$startPos;
189 189
             }
190 190
 
191 191
             // Get context on the right
192
-            $endPos = (int) min($textLen, $startPos + $contextSize);
192
+            $endPos = (int)min($textLen, $startPos + $contextSize);
193 193
             // Get the last word of section in full length
194 194
             while ($endPos < (mb_strlen($text)) && $text[$endPos] != ' ') {
195 195
                 ++$endPos;
Please login to merge, or discard this patch.