@@ -1,4 +1,7 @@ |
||
1 | -<?php if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> |
|
1 | +<?php if (!defined('ISLOADEDBYSTEELSHEET')) { |
|
2 | + die('Must be call by steelsheet'); |
|
3 | +} |
|
4 | +?> |
|
2 | 5 | /* <style type="text/css" > */ |
3 | 6 | |
4 | 7 | .mainmenu::before{ |
@@ -66,8 +66,11 @@ |
||
66 | 66 | foreach ($eventstolog as $key => $arr) |
67 | 67 | { |
68 | 68 | $param = 'MAIN_LOGEVENTS_'.$arr['id']; |
69 | - if (GETPOST($param, 'alphanohtml')) dolibarr_set_const($db, $param, GETPOST($param, 'alphanohtml'), 'chaine', 0, '', $conf->entity); |
|
70 | - else dolibarr_del_const($db, $param, $conf->entity); |
|
69 | + if (GETPOST($param, 'alphanohtml')) { |
|
70 | + dolibarr_set_const($db, $param, GETPOST($param, 'alphanohtml'), 'chaine', 0, '', $conf->entity); |
|
71 | + } else { |
|
72 | + dolibarr_del_const($db, $param, $conf->entity); |
|
73 | + } |
|
71 | 74 | } |
72 | 75 | |
73 | 76 | $db->commit(); |
@@ -23,7 +23,9 @@ discard block |
||
23 | 23 | exit; |
24 | 24 | } |
25 | 25 | |
26 | -if (!is_object($form)) $form = new Form($db); |
|
26 | +if (!is_object($form)) { |
|
27 | + $form = new Form($db); |
|
28 | +} |
|
27 | 29 | |
28 | 30 | $qtytoconsumeforline = $this->tpl['qty'] / $this->tpl['efficiency']; |
29 | 31 | /*if ((empty($this->tpl['qty_frozen']) && $this->tpl['qty_bom'] > 1)) { |
@@ -43,7 +45,9 @@ discard block |
||
43 | 45 | //print '<td class="right">'.$this->tpl['efficiency'].'</td>'; |
44 | 46 | |
45 | 47 | $selected = 1; |
46 | -if (!empty($selectedLines) && !in_array($this->tpl['id'], $selectedLines)) $selected = 0; |
|
48 | +if (!empty($selectedLines) && !in_array($this->tpl['id'], $selectedLines)) { |
|
49 | + $selected = 0; |
|
50 | +} |
|
47 | 51 | print '<td class="center">'; |
48 | 52 | //print '<input id="cb'.$this->tpl['id'].'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$this->tpl['id'].'"'.($selected?' checked="checked"':'').'>'; |
49 | 53 | print '</td>'; |
@@ -34,7 +34,9 @@ discard block |
||
34 | 34 | // Load translation files required by the page |
35 | 35 | $langs->loadLangs(array('admin', 'companies')); |
36 | 36 | |
37 | -if (!$user->admin) accessforbidden(); |
|
37 | +if (!$user->admin) { |
|
38 | + accessforbidden(); |
|
39 | +} |
|
38 | 40 | |
39 | 41 | $error = 0; |
40 | 42 | |
@@ -45,7 +47,9 @@ discard block |
||
45 | 47 | |
46 | 48 | $parameters = array(); |
47 | 49 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
48 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
50 | +if ($reshook < 0) { |
|
51 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
52 | +} |
|
49 | 53 | |
50 | 54 | if (($action == 'update' && !GETPOST("cancel", 'alpha')) |
51 | 55 | || ($action == 'updateedit')) |
@@ -130,7 +134,9 @@ discard block |
||
130 | 134 | print '<tr class="oddeven"><td><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">'; |
131 | 135 | print img_picto('', 'globe-americas', 'class="paddingrightonly"'); |
132 | 136 | print $form->select_country($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'country_id'); |
133 | -if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
137 | +if ($user->admin) { |
|
138 | + print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
139 | +} |
|
134 | 140 | print '</td></tr>'."\n"; |
135 | 141 | |
136 | 142 | print '<tr class="oddeven"><td><label for="state_id">'.$langs->trans("State").'</label></td><td class="maxwidthonsmartphone">'; |
@@ -41,7 +41,9 @@ |
||
41 | 41 | $ilink++; |
42 | 42 | |
43 | 43 | $trclass = 'oddeven'; |
44 | - if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass .= ' liste_sub_total'; |
|
44 | + if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) { |
|
45 | + $trclass .= ' liste_sub_total'; |
|
46 | + } |
|
45 | 47 | ?> |
46 | 48 | <tr class="<?php echo $trclass; ?>"> |
47 | 49 | <td><?php echo $langs->trans("MyObject"); ?></td> |
@@ -97,7 +97,10 @@ |
||
97 | 97 | */ |
98 | 98 | public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) |
99 | 99 | { |
100 | - if (empty($conf->mymodule->enabled)) return 0; // If module is not enabled, we do nothing |
|
100 | + if (empty($conf->mymodule->enabled)) { |
|
101 | + return 0; |
|
102 | + } |
|
103 | + // If module is not enabled, we do nothing |
|
101 | 104 | |
102 | 105 | // Put here code you want to execute when a Dolibarr business events occurs. |
103 | 106 | // Data and type of action are stored into $object and $action |
@@ -23,14 +23,27 @@ discard block |
||
23 | 23 | |
24 | 24 | //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled because need to load personalized language |
25 | 25 | //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled. Language code is found on url. |
26 | -if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); |
|
26 | +if (!defined('NOREQUIRESOC')) { |
|
27 | + define('NOREQUIRESOC', '1'); |
|
28 | +} |
|
27 | 29 | //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled because need to do translations |
28 | -if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1); |
|
29 | -if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); |
|
30 | -if (!defined('NOLOGIN')) define('NOLOGIN', 1); // File must be accessed by logon page so without login |
|
30 | +if (!defined('NOCSRFCHECK')) { |
|
31 | + define('NOCSRFCHECK', 1); |
|
32 | +} |
|
33 | +if (!defined('NOTOKENRENEWAL')) { |
|
34 | + define('NOTOKENRENEWAL', 1); |
|
35 | +} |
|
36 | +if (!defined('NOLOGIN')) { |
|
37 | + define('NOLOGIN', 1); |
|
38 | +} |
|
39 | +// File must be accessed by logon page so without login |
|
31 | 40 | //if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We need top menu content |
32 | -if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1); |
|
33 | -if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); |
|
41 | +if (!defined('NOREQUIREHTML')) { |
|
42 | + define('NOREQUIREHTML', 1); |
|
43 | +} |
|
44 | +if (!defined('NOREQUIREAJAX')) { |
|
45 | + define('NOREQUIREAJAX', '1'); |
|
46 | +} |
|
34 | 47 | |
35 | 48 | session_cache_limiter('public'); |
36 | 49 | // false or '' = keep cache instruction added by server |
@@ -40,16 +53,28 @@ discard block |
||
40 | 53 | // Load Dolibarr environment |
41 | 54 | $res = 0; |
42 | 55 | // Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) |
43 | -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; |
|
56 | +if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { |
|
57 | + $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; |
|
58 | +} |
|
44 | 59 | // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME |
45 | 60 | $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; |
46 | 61 | while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } |
47 | -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; |
|
48 | -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/../main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/../main.inc.php"; |
|
62 | +if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { |
|
63 | + $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; |
|
64 | +} |
|
65 | +if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/../main.inc.php")) { |
|
66 | + $res = @include substr($tmp, 0, ($i + 1))."/../main.inc.php"; |
|
67 | +} |
|
49 | 68 | // Try main.inc.php using relative path |
50 | -if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; |
|
51 | -if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; |
|
52 | -if (!$res) die("Include of main fails"); |
|
69 | +if (!$res && file_exists("../../main.inc.php")) { |
|
70 | + $res = @include "../../main.inc.php"; |
|
71 | +} |
|
72 | +if (!$res && file_exists("../../../main.inc.php")) { |
|
73 | + $res = @include "../../../main.inc.php"; |
|
74 | +} |
|
75 | +if (!$res) { |
|
76 | + die("Include of main fails"); |
|
77 | +} |
|
53 | 78 | |
54 | 79 | require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
55 | 80 | |
@@ -65,8 +90,11 @@ discard block |
||
65 | 90 | header('Content-type: text/css'); |
66 | 91 | // Important: Following code is to cache this file to avoid page request by browser at each Dolibarr page access. |
67 | 92 | // You can use CTRL+F5 to refresh your browser cache. |
68 | -if (empty($dolibarr_nocache)) header('Cache-Control: max-age=10800, public, must-revalidate'); |
|
69 | -else header('Cache-Control: no-cache'); |
|
93 | +if (empty($dolibarr_nocache)) { |
|
94 | + header('Cache-Control: max-age=10800, public, must-revalidate'); |
|
95 | +} else { |
|
96 | + header('Cache-Control: no-cache'); |
|
97 | +} |
|
70 | 98 | |
71 | 99 | ?> |
72 | 100 |
@@ -98,13 +98,21 @@ discard block |
||
98 | 98 | $search_date_end = dol_get_last_day($year_end, $month_end); |
99 | 99 | } |
100 | 100 | } |
101 | -if ($sortorder == "") $sortorder = "ASC"; |
|
102 | -if ($sortfield == "") $sortfield = "t.numero_compte"; |
|
101 | +if ($sortorder == "") { |
|
102 | + $sortorder = "ASC"; |
|
103 | +} |
|
104 | +if ($sortfield == "") { |
|
105 | + $sortfield = "t.numero_compte"; |
|
106 | +} |
|
103 | 107 | |
104 | 108 | |
105 | 109 | $param = ''; |
106 | -if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); |
|
107 | -if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); |
|
110 | +if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { |
|
111 | + $param .= '&contextpage='.urlencode($contextpage); |
|
112 | +} |
|
113 | +if ($limit > 0 && $limit != $conf->liste_limit) { |
|
114 | + $param .= '&limit='.urlencode($limit); |
|
115 | +} |
|
108 | 116 | |
109 | 117 | $filter = array(); |
110 | 118 | if (!empty($search_date_start)) { |
@@ -128,9 +136,11 @@ discard block |
||
128 | 136 | * Action |
129 | 137 | */ |
130 | 138 | |
131 | -if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers |
|
139 | +if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { |
|
140 | + // All tests are required to be compatible with all browsers |
|
132 | 141 | { |
133 | 142 | $show_subgroup = ''; |
143 | +} |
|
134 | 144 | $search_date_start = ''; |
135 | 145 | $search_date_end = ''; |
136 | 146 | $search_accountancy_code_start = ''; |
@@ -193,7 +203,9 @@ discard block |
||
193 | 203 | } |
194 | 204 | |
195 | 205 | print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; |
196 | - if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
206 | + if ($optioncss != '') { |
|
207 | + print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
208 | + } |
|
197 | 209 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
198 | 210 | print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; |
199 | 211 | print '<input type="hidden" name="action" id="action" value="list">'; |
@@ -86,8 +86,11 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | public static function compressList($items, $delim) { |
89 | - if (!isset($items[1]) && isset($items[0])) return $items[0]; |
|
90 | - else return array('list', $delim, $items); |
|
89 | + if (!isset($items[1]) && isset($items[0])) { |
|
90 | + return $items[0]; |
|
91 | + } else { |
|
92 | + return array('list', $delim, $items); |
|
93 | + } |
|
91 | 94 | } |
92 | 95 | |
93 | 96 | public static function preg_quote($what) { |
@@ -100,16 +103,22 @@ discard block |
||
100 | 103 | } |
101 | 104 | |
102 | 105 | $str = $this->coerceString($importPath); |
103 | - if ($str === null) return false; |
|
106 | + if ($str === null) { |
|
107 | + return false; |
|
108 | + } |
|
104 | 109 | |
105 | 110 | $url = $this->compileValue($this->lib_e($str)); |
106 | 111 | |
107 | 112 | // don't import if it ends in css |
108 | - if (substr_compare($url, '.css', -4, 4) === 0) return false; |
|
113 | + if (substr_compare($url, '.css', -4, 4) === 0) { |
|
114 | + return false; |
|
115 | + } |
|
109 | 116 | |
110 | 117 | $realPath = $this->findImport($url); |
111 | 118 | |
112 | - if ($realPath === null) return false; |
|
119 | + if ($realPath === null) { |
|
120 | + return false; |
|
121 | + } |
|
113 | 122 | |
114 | 123 | if ($this->importDisabled) { |
115 | 124 | return array(false, "/* import disabled */"); |
@@ -513,7 +522,9 @@ discard block |
||
513 | 522 | } |
514 | 523 | |
515 | 524 | $passed = $this->reduce($guard) == self::$TRUE; |
516 | - if ($negate) $passed = !$passed; |
|
525 | + if ($negate) { |
|
526 | + $passed = !$passed; |
|
527 | + } |
|
517 | 528 | |
518 | 529 | $this->popEnv(); |
519 | 530 | |
@@ -525,7 +536,9 @@ discard block |
||
525 | 536 | } |
526 | 537 | } |
527 | 538 | |
528 | - if ($groupPassed) break; |
|
539 | + if ($groupPassed) { |
|
540 | + break; |
|
541 | + } |
|
529 | 542 | } |
530 | 543 | |
531 | 544 | if (!$groupPassed) { |
@@ -597,8 +610,12 @@ discard block |
||
597 | 610 | |
598 | 611 | // attempt to find blocks matched by path and args |
599 | 612 | protected function findBlocks($searchIn, $path, $orderedArgs, $keywordArgs, $seen = array()) { |
600 | - if ($searchIn == null) return null; |
|
601 | - if (isset($seen[$searchIn->id])) return null; |
|
613 | + if ($searchIn == null) { |
|
614 | + return null; |
|
615 | + } |
|
616 | + if (isset($seen[$searchIn->id])) { |
|
617 | + return null; |
|
618 | + } |
|
602 | 619 | $seen[$searchIn->id] = true; |
603 | 620 | |
604 | 621 | $name = $path[0]; |
@@ -628,7 +645,9 @@ discard block |
||
628 | 645 | return count($matches) > 0 ? $matches : null; |
629 | 646 | } |
630 | 647 | } |
631 | - if ($searchIn->parent === $searchIn) return null; |
|
648 | + if ($searchIn->parent === $searchIn) { |
|
649 | + return null; |
|
650 | + } |
|
632 | 651 | return $this->findBlocks($searchIn->parent, $path, $orderedArgs, $keywordArgs, $seen); |
633 | 652 | } |
634 | 653 | |
@@ -744,7 +763,9 @@ discard block |
||
744 | 763 | } |
745 | 764 | |
746 | 765 | $oldParent = $mixin->parent; |
747 | - if ($mixin != $block) $mixin->parent = $block; |
|
766 | + if ($mixin != $block) { |
|
767 | + $mixin->parent = $block; |
|
768 | + } |
|
748 | 769 | |
749 | 770 | foreach ($this->sortProps($mixin->props) as $subProp) { |
750 | 771 | if ($suffix !== null && |
@@ -763,8 +784,12 @@ discard block |
||
763 | 784 | |
764 | 785 | $mixin->parent = $oldParent; |
765 | 786 | |
766 | - if ($haveArgs) $this->popEnv(); |
|
767 | - if ($haveScope) $this->popEnv(); |
|
787 | + if ($haveArgs) { |
|
788 | + $this->popEnv(); |
|
789 | + } |
|
790 | + if ($haveScope) { |
|
791 | + $this->popEnv(); |
|
792 | + } |
|
768 | 793 | } |
769 | 794 | |
770 | 795 | break; |
@@ -1015,8 +1040,10 @@ discard block |
||
1015 | 1040 | } |
1016 | 1041 | } |
1017 | 1042 | |
1018 | - if (!is_null($mime)) // fallback if the mime type is still unknown |
|
1043 | + if (!is_null($mime)) { |
|
1044 | + // fallback if the mime type is still unknown |
|
1019 | 1045 | $url = sprintf('data:%s;base64,%s', $mime, base64_encode(file_get_contents($fullpath))); |
1046 | + } |
|
1020 | 1047 | } |
1021 | 1048 | } |
1022 | 1049 | |
@@ -1044,7 +1071,9 @@ discard block |
||
1044 | 1071 | } |
1045 | 1072 | |
1046 | 1073 | protected function lib__sprintf($args) { |
1047 | - if ($args[0] != "list") return $args; |
|
1074 | + if ($args[0] != "list") { |
|
1075 | + return $args; |
|
1076 | + } |
|
1048 | 1077 | $values = $args[2]; |
1049 | 1078 | $string = array_shift($values); |
1050 | 1079 | $template = $this->compileValue($this->lib_e($string)); |
@@ -1258,8 +1287,9 @@ discard block |
||
1258 | 1287 | // mix(@color1, @color2, [@weight: 50%]); |
1259 | 1288 | // http://sass-lang.com/docs/yardoc/Sass/Script/Functions.html#mix-instance_method |
1260 | 1289 | protected function lib_mix($args) { |
1261 | - if ($args[0] != "list" || count($args[2]) < 2) |
|
1262 | - $this->throwError("mix expects (color1, color2, weight)"); |
|
1290 | + if ($args[0] != "list" || count($args[2]) < 2) { |
|
1291 | + $this->throwError("mix expects (color1, color2, weight)"); |
|
1292 | + } |
|
1263 | 1293 | |
1264 | 1294 | list($first, $second) = $args[2]; |
1265 | 1295 | $first = $this->assertColor($first); |
@@ -1303,8 +1333,7 @@ discard block |
||
1303 | 1333 | $darkColor = (isset($args[2][1])) ? $this->assertColor($args[2][1]) : $darkColor; |
1304 | 1334 | $lightColor = (isset($args[2][2])) ? $this->assertColor($args[2][2]) : $lightColor; |
1305 | 1335 | $threshold = (isset($args[2][3])) ? $this->assertNumber($args[2][3]) : $threshold; |
1306 | - } |
|
1307 | - else { |
|
1336 | + } else { |
|
1308 | 1337 | $inputColor = $this->assertColor($args); |
1309 | 1338 | } |
1310 | 1339 | |
@@ -1347,12 +1376,16 @@ discard block |
||
1347 | 1376 | |
1348 | 1377 | public function assertColor($value, $error = "expected color value") { |
1349 | 1378 | $color = $this->coerceColor($value); |
1350 | - if (is_null($color)) $this->throwError($error); |
|
1379 | + if (is_null($color)) { |
|
1380 | + $this->throwError($error); |
|
1381 | + } |
|
1351 | 1382 | return $color; |
1352 | 1383 | } |
1353 | 1384 | |
1354 | 1385 | public function assertNumber($value, $error = "expecting number") { |
1355 | - if ($value[0] == "number") return $value[1]; |
|
1386 | + if ($value[0] == "number") { |
|
1387 | + return $value[1]; |
|
1388 | + } |
|
1356 | 1389 | $this->throwError($error); |
1357 | 1390 | } |
1358 | 1391 | |
@@ -1360,7 +1393,9 @@ discard block |
||
1360 | 1393 | if ($expectedArgs == 1) { |
1361 | 1394 | return $value; |
1362 | 1395 | } else { |
1363 | - if ($value[0] !== "list" || $value[1] != ",") $this->throwError("expecting list"); |
|
1396 | + if ($value[0] !== "list" || $value[1] != ",") { |
|
1397 | + $this->throwError("expecting list"); |
|
1398 | + } |
|
1364 | 1399 | $values = $value[2]; |
1365 | 1400 | $numValues = count($values); |
1366 | 1401 | if ($expectedArgs != $numValues) { |
@@ -1531,7 +1566,9 @@ discard block |
||
1531 | 1566 | } else { |
1532 | 1567 | $components[] = floatval($c[1]); |
1533 | 1568 | } |
1534 | - } else break; |
|
1569 | + } else { |
|
1570 | + break; |
|
1571 | + } |
|
1535 | 1572 | |
1536 | 1573 | $i++; |
1537 | 1574 | } |
@@ -1556,7 +1593,9 @@ discard block |
||
1556 | 1593 | $res = $this->coerceColor($res); |
1557 | 1594 | } |
1558 | 1595 | |
1559 | - if (empty($value[2])) $res = $this->lib_e($res); |
|
1596 | + if (empty($value[2])) { |
|
1597 | + $res = $this->lib_e($res); |
|
1598 | + } |
|
1560 | 1599 | |
1561 | 1600 | return $res; |
1562 | 1601 | case "variable": |
@@ -1588,7 +1627,9 @@ discard block |
||
1588 | 1627 | if (is_array($part)) { |
1589 | 1628 | $strip = $part[0] == "variable"; |
1590 | 1629 | $part = $this->reduce($part); |
1591 | - if ($strip) $part = $this->lib_e($part); |
|
1630 | + if ($strip) { |
|
1631 | + $part = $this->lib_e($part); |
|
1632 | + } |
|
1592 | 1633 | } |
1593 | 1634 | } |
1594 | 1635 | return $value; |
@@ -1597,17 +1638,22 @@ discard block |
||
1597 | 1638 | return $this->lib_e($this->reduce($inner)); |
1598 | 1639 | case "function": |
1599 | 1640 | $color = $this->funcToColor($value); |
1600 | - if ($color) return $color; |
|
1641 | + if ($color) { |
|
1642 | + return $color; |
|
1643 | + } |
|
1601 | 1644 | |
1602 | 1645 | list(, $name, $args) = $value; |
1603 | - if ($name == "%") $name = "_sprintf"; |
|
1646 | + if ($name == "%") { |
|
1647 | + $name = "_sprintf"; |
|
1648 | + } |
|
1604 | 1649 | |
1605 | 1650 | $f = isset($this->libFunctions[$name]) ? |
1606 | 1651 | $this->libFunctions[$name] : array($this, 'lib_'.str_replace('-', '_', $name)); |
1607 | 1652 | |
1608 | 1653 | if (is_callable($f)) { |
1609 | - if ($args[0] == 'list') |
|
1610 | - $args = self::compressList($args[2], $args[1]); |
|
1654 | + if ($args[0] == 'list') { |
|
1655 | + $args = self::compressList($args[2], $args[1]); |
|
1656 | + } |
|
1611 | 1657 | |
1612 | 1658 | $ret = call_user_func($f, $this->reduce($args, true), $this); |
1613 | 1659 | |
@@ -1752,7 +1798,9 @@ discard block |
||
1752 | 1798 | $fname = "op_${ltype}_${rtype}"; |
1753 | 1799 | if (is_callable(array($this, $fname))) { |
1754 | 1800 | $out = $this->$fname($op, $left, $right); |
1755 | - if (!is_null($out)) return $out; |
|
1801 | + if (!is_null($out)) { |
|
1802 | + return $out; |
|
1803 | + } |
|
1756 | 1804 | } |
1757 | 1805 | |
1758 | 1806 | // make the expression look it did before being parsed |
@@ -1786,8 +1834,12 @@ discard block |
||
1786 | 1834 | // make sure a color's components don't go out of bounds |
1787 | 1835 | protected function fixColor($c) { |
1788 | 1836 | foreach (range(1, 3) as $i) { |
1789 | - if ($c[$i] < 0) $c[$i] = 0; |
|
1790 | - if ($c[$i] > 255) $c[$i] = 255; |
|
1837 | + if ($c[$i] < 0) { |
|
1838 | + $c[$i] = 0; |
|
1839 | + } |
|
1840 | + if ($c[$i] > 255) { |
|
1841 | + $c[$i] = 255; |
|
1842 | + } |
|
1791 | 1843 | } |
1792 | 1844 | |
1793 | 1845 | return $c; |
@@ -1800,7 +1852,9 @@ discard block |
||
1800 | 1852 | } |
1801 | 1853 | |
1802 | 1854 | protected function op_color_number($op, $lft, $rgt) { |
1803 | - if ($rgt[0] == '%') $rgt[1] /= 100; |
|
1855 | + if ($rgt[0] == '%') { |
|
1856 | + $rgt[1] /= 100; |
|
1857 | + } |
|
1804 | 1858 | |
1805 | 1859 | return $this->op_color_color($op, $lft, |
1806 | 1860 | array_fill(1, count($lft) - 1, $rgt[1])); |
@@ -1885,7 +1939,9 @@ discard block |
||
1885 | 1939 | $value = $left[1] % $right[1]; |
1886 | 1940 | break; |
1887 | 1941 | case '/': |
1888 | - if ($right[1] == 0) $this->throwError('parse error: divide by zero'); |
|
1942 | + if ($right[1] == 0) { |
|
1943 | + $this->throwError('parse error: divide by zero'); |
|
1944 | + } |
|
1889 | 1945 | $value = $left[1] / $right[1]; |
1890 | 1946 | break; |
1891 | 1947 | case '<': |
@@ -2155,8 +2211,9 @@ discard block |
||
2155 | 2211 | protected function newFormatter() { |
2156 | 2212 | $className = "lessc_formatter_lessjs"; |
2157 | 2213 | if (!empty($this->formatterName)) { |
2158 | - if (!is_string($this->formatterName)) |
|
2159 | - return $this->formatterName; |
|
2214 | + if (!is_string($this->formatterName)) { |
|
2215 | + return $this->formatterName; |
|
2216 | + } |
|
2160 | 2217 | $className = "lessc_formatter_$this->formatterName"; |
2161 | 2218 | } |
2162 | 2219 | |
@@ -2529,7 +2586,9 @@ discard block |
||
2529 | 2586 | * go back where we started. |
2530 | 2587 | */ |
2531 | 2588 | protected function parseChunk() { |
2532 | - if (empty($this->buffer)) return false; |
|
2589 | + if (empty($this->buffer)) { |
|
2590 | + return false; |
|
2591 | + } |
|
2533 | 2592 | $s = $this->seek(); |
2534 | 2593 | |
2535 | 2594 | if ($this->whitespace()) { |
@@ -2572,7 +2631,9 @@ discard block |
||
2572 | 2631 | ) { |
2573 | 2632 | $dir = $this->pushSpecialBlock("directive"); |
2574 | 2633 | $dir->name = $dirName; |
2575 | - if (isset($dirValue)) $dir->value = $dirValue; |
|
2634 | + if (isset($dirValue)) { |
|
2635 | + $dir->value = $dirValue; |
|
2636 | + } |
|
2576 | 2637 | return true; |
2577 | 2638 | } |
2578 | 2639 | } elseif ($this->isDirective($dirName, $this->lineDirectives)) { |
@@ -2609,7 +2670,9 @@ discard block |
||
2609 | 2670 | $block = $this->pushBlock($this->fixTags(array($tag))); |
2610 | 2671 | $block->args = $args; |
2611 | 2672 | $block->isVararg = $isVararg; |
2612 | - if (!empty($guards)) $block->guards = $guards; |
|
2673 | + if (!empty($guards)) { |
|
2674 | + $block->guards = $guards; |
|
2675 | + } |
|
2613 | 2676 | return true; |
2614 | 2677 | } else { |
2615 | 2678 | $this->seek($s); |
@@ -2675,7 +2738,9 @@ discard block |
||
2675 | 2738 | } |
2676 | 2739 | |
2677 | 2740 | // spare ; |
2678 | - if ($this->literal(';')) return true; |
|
2741 | + if ($this->literal(';')) { |
|
2742 | + return true; |
|
2743 | + } |
|
2679 | 2744 | |
2680 | 2745 | return false; // got nothing, throw error |
2681 | 2746 | } |
@@ -2692,8 +2757,9 @@ discard block |
||
2692 | 2757 | protected function fixTags($tags) { |
2693 | 2758 | // move @ tags out of variable namespace |
2694 | 2759 | foreach ($tags as &$tag) { |
2695 | - if ($tag[0] == $this->lessc->vPrefix) |
|
2696 | - $tag[0] = $this->lessc->mPrefix; |
|
2760 | + if ($tag[0] == $this->lessc->vPrefix) { |
|
2761 | + $tag[0] = $this->lessc->mPrefix; |
|
2762 | + } |
|
2697 | 2763 | } |
2698 | 2764 | return $tags; |
2699 | 2765 | } |
@@ -2706,7 +2772,9 @@ discard block |
||
2706 | 2772 | $values[] = $exp; |
2707 | 2773 | } |
2708 | 2774 | |
2709 | - if (count($values) == 0) return false; |
|
2775 | + if (count($values) == 0) { |
|
2776 | + return false; |
|
2777 | + } |
|
2710 | 2778 | |
2711 | 2779 | $exps = lessc::compressList($values, ' '); |
2712 | 2780 | return true; |
@@ -2766,7 +2834,9 @@ discard block |
||
2766 | 2834 | $whiteAfter = isset($this->buffer[$this->count - 1]) && |
2767 | 2835 | ctype_space($this->buffer[$this->count - 1]); |
2768 | 2836 | |
2769 | - if (!$this->value($rhs)) break; |
|
2837 | + if (!$this->value($rhs)) { |
|
2838 | + break; |
|
2839 | + } |
|
2770 | 2840 | |
2771 | 2841 | // peek for next operator to see what to do with rhs |
2772 | 2842 | if ($this->peek(self::$operatorString, $next) && self::$precedence[$next[1]] > self::$precedence[$m[1]]) { |
@@ -2791,20 +2861,30 @@ discard block |
||
2791 | 2861 | public function propertyValue(&$value, $keyName = null) { |
2792 | 2862 | $values = array(); |
2793 | 2863 | |
2794 | - if ($keyName !== null) $this->env->currentProperty = $keyName; |
|
2864 | + if ($keyName !== null) { |
|
2865 | + $this->env->currentProperty = $keyName; |
|
2866 | + } |
|
2795 | 2867 | |
2796 | 2868 | $s = null; |
2797 | 2869 | while ($this->expressionList($v)) { |
2798 | 2870 | $values[] = $v; |
2799 | 2871 | $s = $this->seek(); |
2800 | - if (!$this->literal(',')) break; |
|
2872 | + if (!$this->literal(',')) { |
|
2873 | + break; |
|
2874 | + } |
|
2801 | 2875 | } |
2802 | 2876 | |
2803 | - if ($s) $this->seek($s); |
|
2877 | + if ($s) { |
|
2878 | + $this->seek($s); |
|
2879 | + } |
|
2804 | 2880 | |
2805 | - if ($keyName !== null) unset($this->env->currentProperty); |
|
2881 | + if ($keyName !== null) { |
|
2882 | + unset($this->env->currentProperty); |
|
2883 | + } |
|
2806 | 2884 | |
2807 | - if (count($values) == 0) return false; |
|
2885 | + if (count($values) == 0) { |
|
2886 | + return false; |
|
2887 | + } |
|
2808 | 2888 | |
2809 | 2889 | $value = lessc::compressList($values, ', '); |
2810 | 2890 | return true; |
@@ -2853,11 +2933,21 @@ discard block |
||
2853 | 2933 | } |
2854 | 2934 | } |
2855 | 2935 | |
2856 | - if ($this->parenValue($value)) return true; |
|
2857 | - if ($this->unit($value)) return true; |
|
2858 | - if ($this->color($value)) return true; |
|
2859 | - if ($this->func($value)) return true; |
|
2860 | - if ($this->string($value)) return true; |
|
2936 | + if ($this->parenValue($value)) { |
|
2937 | + return true; |
|
2938 | + } |
|
2939 | + if ($this->unit($value)) { |
|
2940 | + return true; |
|
2941 | + } |
|
2942 | + if ($this->color($value)) { |
|
2943 | + return true; |
|
2944 | + } |
|
2945 | + if ($this->func($value)) { |
|
2946 | + return true; |
|
2947 | + } |
|
2948 | + if ($this->string($value)) { |
|
2949 | + return true; |
|
2950 | + } |
|
2861 | 2951 | |
2862 | 2952 | if ($this->keyword($word)) { |
2863 | 2953 | $value = array('keyword', $word); |
@@ -2891,7 +2981,9 @@ discard block |
||
2891 | 2981 | |
2892 | 2982 | // an import statement |
2893 | 2983 | protected function import(&$out) { |
2894 | - if (!$this->literal('@import')) return false; |
|
2984 | + if (!$this->literal('@import')) { |
|
2985 | + return false; |
|
2986 | + } |
|
2895 | 2987 | |
2896 | 2988 | // @import "something.css" media; |
2897 | 2989 | // @import url("something.css") media; |
@@ -2919,8 +3011,12 @@ discard block |
||
2919 | 3011 | |
2920 | 3012 | if (($this->literal("only") && ($only = true) || $this->literal("not") && ($not = true) || true) && $this->keyword($mediaType)) { |
2921 | 3013 | $prop = array("mediaType"); |
2922 | - if (isset($only)) $prop[] = "only"; |
|
2923 | - if (isset($not)) $prop[] = "not"; |
|
3014 | + if (isset($only)) { |
|
3015 | + $prop[] = "only"; |
|
3016 | + } |
|
3017 | + if (isset($not)) { |
|
3018 | + $prop[] = "not"; |
|
3019 | + } |
|
2924 | 3020 | $prop[] = $mediaType; |
2925 | 3021 | $parts[] = $prop; |
2926 | 3022 | } else { |
@@ -2932,7 +3028,9 @@ discard block |
||
2932 | 3028 | // ~ |
2933 | 3029 | } else { |
2934 | 3030 | $this->genericList($expressions, "mediaExpression", "and", false); |
2935 | - if (is_array($expressions)) $parts = array_merge($parts, $expressions[2]); |
|
3031 | + if (is_array($expressions)) { |
|
3032 | + $parts = array_merge($parts, $expressions[2]); |
|
3033 | + } |
|
2936 | 3034 | } |
2937 | 3035 | |
2938 | 3036 | if (count($parts) == 0) { |
@@ -2953,7 +3051,9 @@ discard block |
||
2953 | 3051 | $this->literal(")") |
2954 | 3052 | ) { |
2955 | 3053 | $out = array("mediaExp", $feature); |
2956 | - if ($value) $out[] = $value; |
|
3054 | + if ($value) { |
|
3055 | + $out[] = $value; |
|
3056 | + } |
|
2957 | 3057 | return true; |
2958 | 3058 | } elseif ($this->variable($variable)) { |
2959 | 3059 | $out = array('variable', $variable); |
@@ -3021,7 +3121,9 @@ discard block |
||
3021 | 3121 | |
3022 | 3122 | $this->eatWhiteDefault = $oldWhite; |
3023 | 3123 | |
3024 | - if (count($content) == 0) return false; |
|
3124 | + if (count($content) == 0) { |
|
3125 | + return false; |
|
3126 | + } |
|
3025 | 3127 | |
3026 | 3128 | // trim the end |
3027 | 3129 | if (is_string(end($content))) { |
@@ -3094,7 +3196,9 @@ discard block |
||
3094 | 3196 | ) { |
3095 | 3197 | $out = array("interpolate", $interp); |
3096 | 3198 | $this->eatWhiteDefault = $oldWhite; |
3097 | - if ($this->eatWhiteDefault) $this->whitespace(); |
|
3199 | + if ($this->eatWhiteDefault) { |
|
3200 | + $this->whitespace(); |
|
3201 | + } |
|
3098 | 3202 | return true; |
3099 | 3203 | } |
3100 | 3204 | |
@@ -3107,7 +3211,9 @@ discard block |
||
3107 | 3211 | // speed shortcut |
3108 | 3212 | if (isset($this->buffer[$this->count])) { |
3109 | 3213 | $char = $this->buffer[$this->count]; |
3110 | - if (!ctype_digit($char) && $char != ".") return false; |
|
3214 | + if (!ctype_digit($char) && $char != ".") { |
|
3215 | + return false; |
|
3216 | + } |
|
3111 | 3217 | } |
3112 | 3218 | |
3113 | 3219 | if ($this->match('([0-9]+(?:\.[0-9]*)?|\.[0-9]+)([%a-zA-Z]+)?', $m)) { |
@@ -3244,9 +3350,13 @@ discard block |
||
3244 | 3350 | $tags = array(); |
3245 | 3351 | while ($this->tag($tt, $simple)) { |
3246 | 3352 | $tags[] = $tt; |
3247 | - if (!$this->literal($delim)) break; |
|
3353 | + if (!$this->literal($delim)) { |
|
3354 | + break; |
|
3355 | + } |
|
3356 | + } |
|
3357 | + if (count($tags) == 0) { |
|
3358 | + return false; |
|
3248 | 3359 | } |
3249 | - if (count($tags) == 0) return false; |
|
3250 | 3360 | |
3251 | 3361 | return true; |
3252 | 3362 | } |
@@ -3356,7 +3466,9 @@ discard block |
||
3356 | 3466 | while (true) { |
3357 | 3467 | if ($this->match('(['.$chars.'0-9]['.$chars.']*)', $m)) { |
3358 | 3468 | $parts[] = $m[1]; |
3359 | - if ($simple) break; |
|
3469 | + if ($simple) { |
|
3470 | + break; |
|
3471 | + } |
|
3360 | 3472 | |
3361 | 3473 | while ($this->tagBracket($parts, $hasExpression)); |
3362 | 3474 | continue; |
@@ -3423,7 +3535,9 @@ discard block |
||
3423 | 3535 | } |
3424 | 3536 | } |
3425 | 3537 | |
3426 | - if (!$this->literal(',')) break; |
|
3538 | + if (!$this->literal(',')) { |
|
3539 | + break; |
|
3540 | + } |
|
3427 | 3541 | } |
3428 | 3542 | $args = array('list', ',', $args); |
3429 | 3543 | |
@@ -3468,7 +3582,9 @@ discard block |
||
3468 | 3582 | * Can optionally take a name that will be set to the current property name |
3469 | 3583 | */ |
3470 | 3584 | protected function assign($name = null) { |
3471 | - if ($name) $this->currentProperty = $name; |
|
3585 | + if ($name) { |
|
3586 | + $this->currentProperty = $name; |
|
3587 | + } |
|
3472 | 3588 | return $this->literal(':') || $this->literal('='); |
3473 | 3589 | } |
3474 | 3590 | |
@@ -3504,7 +3620,9 @@ discard block |
||
3504 | 3620 | |
3505 | 3621 | while ($this->guardGroup($g)) { |
3506 | 3622 | $guards[] = $g; |
3507 | - if (!$this->literal(",")) break; |
|
3623 | + if (!$this->literal(",")) { |
|
3624 | + break; |
|
3625 | + } |
|
3508 | 3626 | } |
3509 | 3627 | |
3510 | 3628 | if (count($guards) == 0) { |
@@ -3523,7 +3641,9 @@ discard block |
||
3523 | 3641 | $guardGroup = array(); |
3524 | 3642 | while ($this->guard($guard)) { |
3525 | 3643 | $guardGroup[] = $guard; |
3526 | - if (!$this->literal("and")) break; |
|
3644 | + if (!$this->literal("and")) { |
|
3645 | + break; |
|
3646 | + } |
|
3527 | 3647 | } |
3528 | 3648 | |
3529 | 3649 | if (count($guardGroup) == 0) { |
@@ -3541,7 +3661,9 @@ discard block |
||
3541 | 3661 | |
3542 | 3662 | if ($this->literal("(") && $this->expression($exp) && $this->literal(")")) { |
3543 | 3663 | $guard = $exp; |
3544 | - if ($negate) $guard = array("negate", $guard); |
|
3664 | + if ($negate) { |
|
3665 | + $guard = array("negate", $guard); |
|
3666 | + } |
|
3545 | 3667 | return true; |
3546 | 3668 | } |
3547 | 3669 | |
@@ -3552,7 +3674,9 @@ discard block |
||
3552 | 3674 | /* raw parsing functions */ |
3553 | 3675 | |
3554 | 3676 | protected function literal($what, $eatWhitespace = null) { |
3555 | - if ($eatWhitespace === null) $eatWhitespace = $this->eatWhiteDefault; |
|
3677 | + if ($eatWhitespace === null) { |
|
3678 | + $eatWhitespace = $this->eatWhiteDefault; |
|
3679 | + } |
|
3556 | 3680 | |
3557 | 3681 | // shortcut on single letter |
3558 | 3682 | if (!isset($what[1]) && isset($this->buffer[$this->count])) { |
@@ -3580,7 +3704,9 @@ discard block |
||
3580 | 3704 | while ($this->$parseItem($value)) { |
3581 | 3705 | $items[] = $value; |
3582 | 3706 | if ($delim) { |
3583 | - if (!$this->literal($delim)) break; |
|
3707 | + if (!$this->literal($delim)) { |
|
3708 | + break; |
|
3709 | + } |
|
3584 | 3710 | } |
3585 | 3711 | } |
3586 | 3712 | |
@@ -3608,20 +3734,29 @@ discard block |
||
3608 | 3734 | } else { |
3609 | 3735 | $validChars = $allowNewline ? "." : "[^\n]"; |
3610 | 3736 | } |
3611 | - if (!$this->match('('.$validChars.'*?)'.lessc::preg_quote($what), $m, !$until)) return false; |
|
3612 | - if ($until) $this->count -= strlen($what); // give back $what |
|
3737 | + if (!$this->match('('.$validChars.'*?)'.lessc::preg_quote($what), $m, !$until)) { |
|
3738 | + return false; |
|
3739 | + } |
|
3740 | + if ($until) { |
|
3741 | + $this->count -= strlen($what); |
|
3742 | + } |
|
3743 | + // give back $what |
|
3613 | 3744 | $out = $m[1]; |
3614 | 3745 | return true; |
3615 | 3746 | } |
3616 | 3747 | |
3617 | 3748 | // try to match something on head of buffer |
3618 | 3749 | protected function match($regex, &$out, $eatWhitespace = null) { |
3619 | - if ($eatWhitespace === null) $eatWhitespace = $this->eatWhiteDefault; |
|
3750 | + if ($eatWhitespace === null) { |
|
3751 | + $eatWhitespace = $this->eatWhiteDefault; |
|
3752 | + } |
|
3620 | 3753 | |
3621 | 3754 | $r = '/'.$regex.($eatWhitespace && !$this->writeComments ? '\s*' : '').'/Ais'; |
3622 | 3755 | if (preg_match($r, $this->buffer, $out, null, $this->count)) { |
3623 | 3756 | $this->count += strlen($out[0]); |
3624 | - if ($eatWhitespace && $this->writeComments) $this->whitespace(); |
|
3757 | + if ($eatWhitespace && $this->writeComments) { |
|
3758 | + $this->whitespace(); |
|
3759 | + } |
|
3625 | 3760 | return true; |
3626 | 3761 | } |
3627 | 3762 | return false; |
@@ -3648,7 +3783,9 @@ discard block |
||
3648 | 3783 | |
3649 | 3784 | // match something without consuming it |
3650 | 3785 | protected function peek($regex, &$out = null, $from = null) { |
3651 | - if (is_null($from)) $from = $this->count; |
|
3786 | + if (is_null($from)) { |
|
3787 | + $from = $this->count; |
|
3788 | + } |
|
3652 | 3789 | $r = '/'.$regex.'/Ais'; |
3653 | 3790 | $result = preg_match($r, $this->buffer, $out, null, $from); |
3654 | 3791 | |
@@ -3657,8 +3794,11 @@ discard block |
||
3657 | 3794 | |
3658 | 3795 | // seek to a spot in the buffer or return where we are on no argument |
3659 | 3796 | protected function seek($where = null) { |
3660 | - if ($where === null) return $this->count; |
|
3661 | - else $this->count = $where; |
|
3797 | + if ($where === null) { |
|
3798 | + return $this->count; |
|
3799 | + } else { |
|
3800 | + $this->count = $where; |
|
3801 | + } |
|
3662 | 3802 | return true; |
3663 | 3803 | } |
3664 | 3804 | |
@@ -3708,7 +3848,9 @@ discard block |
||
3708 | 3848 | |
3709 | 3849 | // append a property to the current block |
3710 | 3850 | protected function append($prop, $pos = null) { |
3711 | - if ($pos !== null) $prop[-1] = $pos; |
|
3851 | + if ($pos !== null) { |
|
3852 | + $prop[-1] = $pos; |
|
3853 | + } |
|
3712 | 3854 | $this->env->props[] = $prop; |
3713 | 3855 | } |
3714 | 3856 | |
@@ -3733,29 +3875,38 @@ discard block |
||
3733 | 3875 | foreach ($look as $token) { |
3734 | 3876 | $pos = strpos($text, $token); |
3735 | 3877 | if ($pos !== false) { |
3736 | - if (!isset($min) || $pos < $min[1]) $min = array($token, $pos); |
|
3878 | + if (!isset($min) || $pos < $min[1]) { |
|
3879 | + $min = array($token, $pos); |
|
3880 | + } |
|
3737 | 3881 | } |
3738 | 3882 | } |
3739 | 3883 | |
3740 | - if (is_null($min)) break; |
|
3884 | + if (is_null($min)) { |
|
3885 | + break; |
|
3886 | + } |
|
3741 | 3887 | |
3742 | 3888 | $count = $min[1]; |
3743 | 3889 | $skip = 0; |
3744 | 3890 | $newlines = 0; |
3745 | 3891 | switch ($min[0]) { |
3746 | 3892 | case 'url(': |
3747 | - if (preg_match('/url\(.*?\)/', $text, $m, 0, $count)) |
|
3748 | - $count += strlen($m[0]) - strlen($min[0]); |
|
3893 | + if (preg_match('/url\(.*?\)/', $text, $m, 0, $count)) { |
|
3894 | + $count += strlen($m[0]) - strlen($min[0]); |
|
3895 | + } |
|
3749 | 3896 | break; |
3750 | 3897 | case '"': |
3751 | 3898 | case "'": |
3752 | - if (preg_match('/'.$min[0].'.*?(?<!\\\\)'.$min[0].'/', $text, $m, 0, $count)) |
|
3753 | - $count += strlen($m[0]) - 1; |
|
3899 | + if (preg_match('/'.$min[0].'.*?(?<!\\\\)'.$min[0].'/', $text, $m, 0, $count)) { |
|
3900 | + $count += strlen($m[0]) - 1; |
|
3901 | + } |
|
3754 | 3902 | break; |
3755 | 3903 | case '//': |
3756 | 3904 | $skip = strpos($text, "\n", $count); |
3757 | - if ($skip === false) $skip = strlen($text) - $count; |
|
3758 | - else $skip -= $count; |
|
3905 | + if ($skip === false) { |
|
3906 | + $skip = strlen($text) - $count; |
|
3907 | + } else { |
|
3908 | + $skip -= $count; |
|
3909 | + } |
|
3759 | 3910 | break; |
3760 | 3911 | case '/*': |
3761 | 3912 | if (preg_match('/\/\*.*?\*\//s', $text, $m, 0, $count)) { |
@@ -3765,7 +3916,9 @@ discard block |
||
3765 | 3916 | break; |
3766 | 3917 | } |
3767 | 3918 | |
3768 | - if ($skip == 0) $count += strlen($min[0]); |
|
3919 | + if ($skip == 0) { |
|
3920 | + $count += strlen($min[0]); |
|
3921 | + } |
|
3769 | 3922 | |
3770 | 3923 | $out .= substr($text, 0, $count).str_repeat("\n", $newlines); |
3771 | 3924 | $text = substr($text, $count + $skip); |
@@ -3810,7 +3963,9 @@ discard block |
||
3810 | 3963 | protected function isEmpty($block) { |
3811 | 3964 | if (empty($block->lines)) { |
3812 | 3965 | foreach ($block->children as $child) { |
3813 | - if (!$this->isEmpty($child)) return false; |
|
3966 | + if (!$this->isEmpty($child)) { |
|
3967 | + return false; |
|
3968 | + } |
|
3814 | 3969 | } |
3815 | 3970 | |
3816 | 3971 | return true; |
@@ -3819,7 +3974,9 @@ discard block |
||
3819 | 3974 | } |
3820 | 3975 | |
3821 | 3976 | public function block($block) { |
3822 | - if ($this->isEmpty($block)) return; |
|
3977 | + if ($this->isEmpty($block)) { |
|
3978 | + return; |
|
3979 | + } |
|
3823 | 3980 | |
3824 | 3981 | $inner = $pre = $this->indentStr(); |
3825 | 3982 | |
@@ -3860,7 +4017,9 @@ discard block |
||
3860 | 4017 | } |
3861 | 4018 | |
3862 | 4019 | if (!empty($block->selectors)) { |
3863 | - if (!$isSingle && empty($block->children)) echo $this->break; |
|
4020 | + if (!$isSingle && empty($block->children)) { |
|
4021 | + echo $this->break; |
|
4022 | + } |
|
3864 | 4023 | |
3865 | 4024 | if ($isSingle) { |
3866 | 4025 | echo $this->closeSingle.$this->break; |