Skip to content

Commit 9c0dcb5

Browse files
committed
Some minor code-style cleanup.
1 parent 0b2897b commit 9c0dcb5

File tree

2 files changed

+26
-14
lines changed

2 files changed

+26
-14
lines changed

Changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ __*Why "v3.0.0" instead of "v1.0.0?"*__ Prior to phpMussel v3, the "phpMussel Co
1919
[2020.10.30; Maikuolan]: Redesigned the login pips and refactored some CSS.
2020

2121
[2020.10.30; New Feature; Maikuolan]: Added the ability to specify a custom assets path to the instantiated FrontEnd object.
22+
23+
[2020.11.27; Maikuolan]: Some minor code-style cleanup.

src/FrontEnd.php

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* License: GNU/GPLv2
99
* @see LICENSE.txt
1010
*
11-
* This file: Front-end handler (last modified: 2020.11.20).
11+
* This file: Front-end handler (last modified: 2020.11.27).
1212
*/
1313

1414
namespace phpMussel\FrontEnd;
@@ -1020,7 +1020,9 @@ public function view(string $Page = '')
10201020
/** Generate entries for display and regenerate configuration if any changes were submitted. */
10211021
$FE['ConfigFields'] = sprintf(
10221022
'<style>.showlink::before,.hidelink::before{content:"➖";display:inline-block;margin-%1$s:6px}.hidelink::before{transform:rotate(%2$s)}</style>',
1023-
$FE['FE_Align_Reverse'], $FE['45deg']);
1023+
$FE['FE_Align_Reverse'],
1024+
$FE['45deg']
1025+
);
10241026

10251027
/** Iterate through configuration defaults. */
10261028
foreach ($this->Loader->ConfigurationDefaults as $CatKey => $CatValue) {
@@ -1035,7 +1037,10 @@ public function view(string $Page = '')
10351037
'<a class="showlink" id="%1$s-showlink" href="#%1$s-container" onclick="javascript:showid(\'%1$s-hidelink\');hideid(\'%1$s-showlink\');show(\'%1$s-row\')">%1$s</a>' .
10361038
'<a class="hidelink" id="%1$s-hidelink" %2$s href="#" onclick="javascript:showid(\'%1$s-showlink\');hideid(\'%1$s-hidelink\');hide(\'%1$s-row\')">%1$s</a>' .
10371039
"%3\$s</div></td></tr></table>\n<span class=\"%1\$s-row\" %2\$s><table>\n",
1038-
$CatKey, 'style="display:none"', $CatInfo);
1040+
$CatKey,
1041+
'style="display:none"',
1042+
$CatInfo
1043+
);
10391044
$CatData = '';
10401045
foreach ($CatValue as $DirKey => $DirValue) {
10411046
$ThisDir = ['Preview' => '', 'Trigger' => '', 'FieldOut' => '', 'CatKey' => $CatKey];
@@ -1048,7 +1053,10 @@ public function view(string $Page = '')
10481053
$ThisDir['Friendly'] = $this->Loader->L10N->getString($ThisDir['DirLangKey'] . '_label') ?: $DirKey;
10491054
$CatData .= sprintf(
10501055
'<li><a onclick="javascript:showid(\'%1$s-hidelink\');hideid(\'%1$s-showlink\');show(\'%1$s-row\')" href="#%2$s">%3$s</a></li>',
1051-
$CatKey, $ThisDir['DirLangKey'], $ThisDir['Friendly']);
1056+
$CatKey,
1057+
$ThisDir['DirLangKey'],
1058+
$ThisDir['Friendly']
1059+
);
10521060
$ThisDir['DirLang'] =
10531061
$this->Loader->L10N->getString($ThisDir['DirLangKey']) ?:
10541062
$this->Loader->L10N->getString('config_' . $CatKey) ?:
@@ -1104,7 +1112,7 @@ public function view(string $Page = '')
11041112
$ThisDir['Trigger'] = ' onchange="javascript:' . $ThisDir['DirLangKey'] . '_function();" onkeyup="javascript:' . $ThisDir['DirLangKey'] . '_function();"';
11051113
if ($DirValue['preview'] === 'kb') {
11061114
$ThisDir['Preview'] .= sprintf(
1107-
'<script type="text/javascript">function %1$s_function(){var e=%7$s?%7$s(' .
1115+
'<script type="text/javascript">function %1$s_function(){var e=%7$s?%7$s(' .
11081116
'\'%1$s_field\').value:%8$s&&!%7$s?%8$s.%1$s_field.value:\'\',z=e.replace' .
11091117
'(/o$/i,\'b\').substr(-2).toLowerCase(),y=\'kb\'==z?1:\'mb\'==z?1024:\'gb' .
11101118
'\'==z?1048576:\'tb\'==z?1073741824:\'b\'==e.substr(-1)?.0009765625:1,e=e' .
@@ -1125,7 +1133,7 @@ public function view(string $Page = '')
11251133
);
11261134
} elseif ($DirValue['preview'] === 'seconds') {
11271135
$ThisDir['Preview'] .= sprintf(
1128-
'<script type="text/javascript">function %1$s_function(){var t=%9$s?%9$s(' .
1136+
'<script type="text/javascript">function %1$s_function(){var t=%9$s?%9$s(' .
11291137
'\'%1$s_field\').value:%10$s&&!%9$s?%10$s.%1$s_field.value:\'\',e=isNaN(t' .
11301138
')?0:0>t?t*-1:t,n=e?Math.floor(e/31536e3):0,e=e?e-31536e3*n:0,o=e?Math.fl' .
11311139
'oor(e/2592e3):0,e=e-2592e3*o,l=e?Math.floor(e/604800):0,e=e-604800*l,r=e' .
@@ -1149,7 +1157,7 @@ public function view(string $Page = '')
11491157
);
11501158
} elseif ($DirValue['preview'] === 'minutes') {
11511159
$ThisDir['Preview'] .= sprintf(
1152-
'<script type="text/javascript">function %1$s_function(){var t=%9$s?%9$s(' .
1160+
'<script type="text/javascript">function %1$s_function(){var t=%9$s?%9$s(' .
11531161
'\'%1$s_field\').value:%10$s&&!%9$s?%10$s.%1$s_field.value:\'\',e=isNaN(t' .
11541162
')?0:0>t?t*-1:t,n=e?Math.floor(e/525600):0,e=e?e-525600*n:0,o=e?Math.floo' .
11551163
'r(e/43200):0,e=e-43200*o,l=e?Math.floor(e/10080):0,e=e-10080*l,r=e?Math.' .
@@ -1173,7 +1181,7 @@ public function view(string $Page = '')
11731181
);
11741182
} elseif ($DirValue['preview'] === 'hours') {
11751183
$ThisDir['Preview'] .= sprintf(
1176-
'<script type="text/javascript">function %1$s_function(){var t=%9$s?%9$s(' .
1184+
'<script type="text/javascript">function %1$s_function(){var t=%9$s?%9$s(' .
11771185
'\'%1$s_field\').value:%10$s&&!%9$s?%10$s.%1$s_field.value:\'\',e=isNaN(t' .
11781186
')?0:0>t?t*-1:t,n=e?Math.floor(e/8760):0,e=e?e-8760*n:0,o=e?Math.floor(e/' .
11791187
'720):0,e=e-720*o,l=e?Math.floor(e/168):0,e=e-168*l,r=e?Math.floor(e/24):' .
@@ -1196,7 +1204,7 @@ public function view(string $Page = '')
11961204
);
11971205
} elseif ($DirValue['preview'] === 'allow_other') {
11981206
$ThisDir['Preview'] .= sprintf(
1199-
'<script type="text/javascript">function %1$s_function(){var e=%2$s?%2$s(' .
1207+
'<script type="text/javascript">function %1$s_function(){var e=%2$s?%2$s(' .
12001208
'\'%1$s_field\').value:%3$s&&!%2$s?%3$s.%1$s_field.value:\'\';e==\'Other\'' .
12011209
'?showid(\'%4$s_field\'):hideid(\'%4$s_field\')};%1$s_function();</script>',
12021210
$ThisDir['DirLangKey'],
@@ -1268,7 +1276,7 @@ public function view(string $Page = '')
12681276
}
12691277
} elseif ($DirValue['type'] === 'bool') {
12701278
$ThisDir['FieldOut'] = sprintf(
1271-
'<select class="auto" name="%1$s" id="%1$s_field"%2$s>' .
1279+
'<select class="auto" name="%1$s" id="%1$s_field"%2$s>' .
12721280
'<option value="true"%5$s>%3$s</option><option value="false"%6$s>%4$s</option>' .
12731281
'</select>',
12741282
$ThisDir['DirLangKey'],
@@ -1473,14 +1481,12 @@ public function view(string $Page = '')
14731481
) {
14741482
/** Delete a file. */
14751483
if ($_POST['do'] === 'delete-file') {
1476-
14771484
$FE['state_msg'] .= '<code>' . $_POST['qfu'] . '</code> ' . $this->Loader->L10N->getString(
14781485
unlink($this->Loader->QuarantinePath . $_POST['qfu']) ? 'response_file_deleted' : 'response_failed_to_delete'
14791486
) . '<br />';
14801487

14811488
/** Download or restore a file. */
14821489
} elseif ($_POST['do'] === 'download-file' || $_POST['do'] === 'restore-file') {
1483-
14841490
if (empty($_POST['qkey'])) {
14851491
$FE['state_msg'] .= '<code>' . $_POST['qfu'] . '</code> ' . $this->Loader->L10N->getString('response_restore_error_2') . '<br />';
14861492
} else {
@@ -1713,9 +1719,13 @@ public function view(string $Page = '')
17131719
$FE['logfileData'] = $this->Loader->readFileBlocks($this->QueryVariables['logfile']);
17141720
}
17151721
$FE['logfileData'] = $TextMode ? str_replace(
1716-
['<', '>', "\r", "\n"], ['&lt;', '&gt;', '', "<br />\n"], $FE['logfileData']
1722+
['<', '>', "\r", "\n"],
1723+
['&lt;', '&gt;', '', "<br />\n"],
1724+
$FE['logfileData']
17171725
) : str_replace(
1718-
['<', '>', "\r"], ['&lt;', '&gt;', ''], $FE['logfileData']
1726+
['<', '>', "\r"],
1727+
['&lt;', '&gt;', ''],
1728+
$FE['logfileData']
17191729
);
17201730
$FE['mod_class_nav'] = ' big';
17211731
$FE['mod_class_right'] = ' extend';

0 commit comments

Comments
 (0)