Skip to content

Commit

Permalink
Code cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
parpalak committed Aug 5, 2024
1 parent 6e46eb4 commit 68011dd
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 51 deletions.
4 changes: 4 additions & 0 deletions _admin/js/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,10 @@ document.addEventListener('DOMContentLoaded', function () {
}
});

window.addEventListener('blur', function () {
altPressed = false;
});

isAltPressed = function () {
return altPressed;
}
Expand Down
2 changes: 1 addition & 1 deletion _admin/templates/layout.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ if (!isset($this)) {
<script src="<?= $script ?>"></script>
<?php endforeach; ?>

<script src="lang/<?= $locale ?>/ui.js"></script>
<script src="<?php echo $basePath; ?>/_admin/lang/<?php echo $locale; ?>/ui.js"></script>
<style>:root {
--page-secondary-background: <?= $param('S2_ADMIN_COLOR') ?>;
}</style>
Expand Down
2 changes: 1 addition & 1 deletion _admin/templates/picture-manager.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ $maxFileSize = $bytesFromString(ini_get('upload_max_filesize'))
<script src="<?php echo $basePath; ?>/_admin/js/jquery-tools.js"></script>
<script src="<?php echo $basePath; ?>/_admin/js/jquery.jstree.js"></script>
<script src="<?php echo $basePath; ?>/_admin/js/pictman.js"></script>
<script src="lang/<?= $locale ?>/ui.js"></script>
<script src="<?php echo $basePath; ?>/_admin/lang/<?php echo $locale; ?>/ui.js"></script>
</head>

<body>
Expand Down
3 changes: 2 additions & 1 deletion _admin/templates/structure/structure.php.inc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

/** @var callable $trans */
/** @var string $locale */
/** @var string $basePath */

?>
Expand All @@ -24,7 +25,7 @@
<div id="tree" class="treetree" tabindex="0"></div>
</section>
<script src="<?php echo $basePath; ?>/_admin/js/ajax.js"></script>
<script src="<?php echo $basePath; ?>/_admin/lang/<?php echo Lang::admin_code(); ?>/ui.js"></script>
<script src="<?php echo $basePath; ?>/_admin/lang/<?php echo $locale; ?>/ui.js"></script>
<script src="<?php echo $basePath; ?>/_admin/js/jquery.js"></script>
<script src="<?php echo $basePath; ?>/_admin/js/jquery-tools.js"></script>
<script src="<?php echo $basePath; ?>/_admin/js/jquery.jstree.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion _extensions/s2_blog/Controller/TagsPageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function body(Request $request, HtmlTemplate $template): ?Response
if ($num) {
$tags[] = [
'title' => $tag_name[$id],
'link' => S2_BLOG_TAGS_PATH . urlencode($tag_url[$id]) . '/',
'link' => $this->blogUrlBuilder->tag($tag_url[$id]),
'num' => $num,
];
}
Expand Down
15 changes: 0 additions & 15 deletions _extensions/s2_blog/hooks/idx_start.php

This file was deleted.

13 changes: 0 additions & 13 deletions _include/Lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,6 @@ public static function month ($month)
return $lang_month_big[$month - 1];
}

public static function friendly_filesize ($size)
{
$i = 0;
while (($size/1024) > 1)
{
$size /= 1024;
$i++;
}

$lang_filesize = self::get('File size units');
return sprintf(self::get('File size format'), self::number_format($size), $lang_filesize[$i]);
}

/**
* Outputs integers using current language settings
*
Expand Down
2 changes: 1 addition & 1 deletion _include/src/Image/ThumbnailGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function __construct(QueuePublisher $publisher, string $cacheUrlPrefix, s
{
$this->publisher = $publisher;
$this->cacheUrlPrefix = $cacheUrlPrefix;
$this->cacheFilesystemPrefix = $cacheFilesystemPrefix;
$this->cacheFilesystemPrefix = rtrim($cacheFilesystemPrefix, '/');
}

/**
Expand Down
6 changes: 3 additions & 3 deletions _include/src/Pdo/PDOStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
* 3. Updated code to PHP 8.2
*
* @copyright 2023-2024 Roman Parpalak, based on code (c) 2021 Filis Futsarov
* @license MIT
* @package S2
* @license MIT
* @package S2
*/

declare(strict_types=1);
Expand Down Expand Up @@ -40,7 +40,7 @@ public function bindParam(
int|string $param,
mixed &$var,
int $type = NativePdo::PARAM_STR,
int $maxLength = null,
int $maxLength = 0,
mixed $driverOptions = null
): bool {
$this->bindings[$param] = $var;
Expand Down
22 changes: 11 additions & 11 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
define('S2_ROOT', './');
require S2_ROOT . '_include/common.php';

($hook = s2_hook('idx_start')) ? eval($hook) : null;

header('X-Powered-By: S2/' . S2_VERSION);

// We create our own request URI with the path removed and only the parts to rewrite included
Expand All @@ -32,8 +30,6 @@
$_SERVER['REQUEST_URI'] = $request_uri;
}

($hook = s2_hook('idx_pre_redirect')) ? eval($hook) : null;

//
// Redirect to the admin page
//
Expand Down

0 comments on commit 68011dd

Please sign in to comment.