Completed
Pull Request — master (#3788)
by Craig
01:31
created
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/FileUtil.php 2 patches
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.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -223,7 +223,7 @@
 block discarded – undo
223 223
                         $files[$filenameToStore] = (array)self::getFiles($path, $recurse, $relativepath, $extensions, $type, $nestedData);
224 224
                     } else {
225 225
                         $files = array_merge((array)$files,
226
-                                              (array)self::getFiles($path, $recurse, $relativepath, $extensions, $type, $nestedData));
226
+                                                (array)self::getFiles($path, $recurse, $relativepath, $extensions, $type, $nestedData));
227 227
                     }
228 228
                 } elseif (!$extensions && !$regexpMatch) {
229 229
                     $files[] = $filenameToStore;
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.
src/lib/legacy/util/ThemeUtil.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -104,16 +104,16 @@
 block discarded – undo
104 104
             /** @var $entityManager Doctrine\ORM\EntityManager */
105 105
             $entityManager = ServiceUtil::get('doctrine.orm.default_entity_manager');
106 106
             $qb = $entityManager->createQueryBuilder()
107
-                     ->select('t')
108
-                     ->from('ZikulaThemeModule:ThemeEntity', 't');
107
+                        ->select('t')
108
+                        ->from('ZikulaThemeModule:ThemeEntity', 't');
109 109
 
110 110
             if ($state != self::STATE_ALL) {
111 111
                 $qb->andWhere('t.state = :state')
112
-                   ->setParameter('state', $state);
112
+                    ->setParameter('state', $state);
113 113
             }
114 114
             if ($type != self::TYPE_ALL) {
115 115
                 $qb->andWhere('t.type = :type')
116
-                   ->setParameter('type', $type);
116
+                    ->setParameter('type', $type);
117 117
             }
118 118
             switch ($filter) {
119 119
                 case self::FILTER_USER:
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
             $bundleRelativePath = str_replace('\\', '/', $bundleRelativePath);
299 299
         }
300 300
         $paths[] = null === $theme ?
301
-            "themes/$themeName/style/$osmodname" : $bundleRelativePath.'/Resources/css/'.$theme->getName();
301
+            "themes/$themeName/style/$osmodname" : $bundleRelativePath . '/Resources/css/' . $theme->getName();
302 302
 
303 303
         // module directory
304 304
         $modinfo = ModUtil::getInfoFromName($modname);
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
             $dir = ModUtil::getModuleBaseDir($modname);
309 309
             $bundleRelativePath = substr($module->getPath(), strpos($module->getPath(), $dir), strlen($module->getPath()));
310 310
             $bundleRelativePath = str_replace('\\', '/', $bundleRelativePath);
311
-            $paths[] = $bundleRelativePath."/Resources/public/css";
311
+            $paths[] = $bundleRelativePath . "/Resources/public/css";
312 312
         }
313 313
         $paths[] = "modules/$osmoddir/style";
314 314
         $paths[] = "system/$osmoddir/style";
Please login to merge, or discard this patch.
src/lib/legacy/util/HtmlUtil.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -108,8 +108,8 @@
 block discarded – undo
108 108
         $multiple = $multipleSize > 1 ? 'multiple="multiple"' : '';
109 109
         $multipleSize = $multipleSize > 1 ? "size=\"$multipleSize\"" : '';
110 110
         $submit = $submit ? 'onchange="this.form.submit();"' : '';
111
-        $required = ($required) ? 'required="required" oninvalid="this.setCustomValidity(\''.__('Please select an item in the list.').'\');" onchange="this.setCustomValidity(\'\');" onblur="this.checkValidity();"' : '';
112
-        $title = (is_null($title)) ? '' : 'title="'.$title.'" x-moz-errormessage="'.$title.'"';
111
+        $required = ($required) ? 'required="required" oninvalid="this.setCustomValidity(\'' . __('Please select an item in the list.') . '\');" onchange="this.setCustomValidity(\'\');" onblur="this.checkValidity();"' : '';
112
+        $title = (is_null($title)) ? '' : 'title="' . $title . '" x-moz-errormessage="' . $title . '"';
113 113
 
114 114
         $html = "<select name=\"$name\" id=\"$id\" class=\"$class\" $multipleSize $multiple $submit $disabled $required $title>";
115 115
 
Please login to merge, or discard this patch.
src/lib/legacy/util/Loader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -184,7 +184,7 @@
 block discarded – undo
184 184
             throw new \Exception(__f("Error! Invalid 'base_obj_type' specification '%s'.", $base_obj_type));
185 185
         }
186 186
 
187
-        $prefix = (string) $prefix;
187
+        $prefix = (string)$prefix;
188 188
 
189 189
         if (strpos($base_obj_type, '_') !== false) {
190 190
             $c = $base_obj_type;
Please login to merge, or discard this patch.
src/lib/legacy/dbobject/DBObjectArray.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -894,7 +894,7 @@
 block discarded – undo
894 894
             throw new \Exception(__f("Non-existing field [%s] received", $column));
895 895
         }
896 896
 
897
-        $where  = '';
897
+        $where = '';
898 898
         if ($filter) {
899 899
             $filter = $this->cleanFilter($filter);
900 900
             $where  = DBUtil::_checkWhereClause($this->genFilter($filter));
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -905,7 +905,7 @@
 block discarded – undo
905 905
             }
906 906
         }
907 907
         $val = DBUtil::_typesafeQuotedID($this->_objType, $column, $value);
908
-        $sql = "UPDATE $tab SET $col = $val $where";
908
+        $sql = "update $tab SET $col = $val $where";
909 909
         $res = DBUtil::executeSQL($sql);
910 910
 
911 911
         return $res;
Please login to merge, or discard this patch.