diff --git a/core/basepage.php b/core/basepage.php
index 697fd6e1..2657ac80 100644
--- a/core/basepage.php
+++ b/core/basepage.php
@@ -1,6 +1,9 @@
blocks, "blockcmp");
+ usort($this->blocks, "Shimmie2\blockcmp");
$this->add_auto_html_headers();
$this->render();
break;
@@ -468,8 +471,8 @@ class BasePage
}
$sub_links = $sub_links??[];
- usort($nav_links, "sort_nav_links");
- usort($sub_links, "sort_nav_links");
+ usort($nav_links, "Shimmie2\sort_nav_links");
+ usort($sub_links, "Shimmie2\sort_nav_links");
return [$nav_links, $sub_links];
}
diff --git a/core/basethemelet.php b/core/basethemelet.php
index 13e8f245..d6c4a222 100644
--- a/core/basethemelet.php
+++ b/core/basethemelet.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
/**
* Class BaseThemelet
*
@@ -64,7 +66,7 @@ class BaseThemelet
}
$custom_classes = "";
- if (class_exists("Relationships")) {
+ if (class_exists("Shimmie2\Relationships")) {
if (property_exists($image, 'parent_id') && $image->parent_id !== null) {
$custom_classes .= "shm-thumb-has_parent ";
}
diff --git a/core/block.php b/core/block.php
index ce09be39..8cf31329 100644
--- a/core/block.php
+++ b/core/block.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
/**
* Class Block
*
diff --git a/core/cacheengine.php b/core/cacheengine.php
index ab0dd332..164b879e 100644
--- a/core/cacheengine.php
+++ b/core/cacheengine.php
@@ -1,6 +1,9 @@
execute($query, $args);
@@ -229,7 +232,7 @@ class Database
/**
* Execute an SQL query and return the the first column => the second column as an iterable object.
*/
- public function get_pairs_iterable(string $query, array $args = []): Generator
+ public function get_pairs_iterable(string $query, array $args = []): \Generator
{
$_start = microtime(true);
$stmt = $this->execute($query, $args);
diff --git a/core/dbengine.php b/core/dbengine.php
index 46407595..bf32cd47 100644
--- a/core/dbengine.php
+++ b/core/dbengine.php
@@ -1,6 +1,11 @@
exec("PRAGMA foreign_keys = ON;");
- $db->sqliteCreateFunction('UNIX_TIMESTAMP', '_unix_timestamp', 1);
- $db->sqliteCreateFunction('now', '_now', 0);
- $db->sqliteCreateFunction('floor', '_floor', 1);
- $db->sqliteCreateFunction('log', '_log');
- $db->sqliteCreateFunction('isnull', '_isnull', 1);
- $db->sqliteCreateFunction('md5', '_md5', 1);
- $db->sqliteCreateFunction('concat', '_concat', 2);
- $db->sqliteCreateFunction('lower', '_lower', 1);
- $db->sqliteCreateFunction('rand', '_rand', 0);
- $db->sqliteCreateFunction('ln', '_ln', 1);
+ $db->sqliteCreateFunction('UNIX_TIMESTAMP', 'Shimmie2\_unix_timestamp', 1);
+ $db->sqliteCreateFunction('now', 'Shimmie2\_now', 0);
+ $db->sqliteCreateFunction('floor', 'Shimmie2\_floor', 1);
+ $db->sqliteCreateFunction('log', 'Shimmie2\_log');
+ $db->sqliteCreateFunction('isnull', 'Shimmie2\_isnull', 1);
+ $db->sqliteCreateFunction('md5', 'Shimmie2\_md5', 1);
+ $db->sqliteCreateFunction('concat', 'Shimmie2\_concat', 2);
+ $db->sqliteCreateFunction('lower', 'Shimmie2\_lower', 1);
+ $db->sqliteCreateFunction('rand', 'Shimmie2\_rand', 0);
+ $db->sqliteCreateFunction('ln', 'Shimmie2\_ln', 1);
}
public function scoreql_to_sql(string $data): string
diff --git a/core/event.php b/core/event.php
index 355ac504..db6798ab 100644
--- a/core/event.php
+++ b/core/event.php
@@ -1,6 +1,9 @@
theme = $this->get_theme_object($class);
$this->info = ExtensionInfo::get_for_extension_class($class);
- if ($this->info===null) {
- throw new ScoreException("Info class not found for extension $class");
- }
$this->key = $this->info->key;
}
@@ -37,8 +37,9 @@ abstract class Extension
*/
private function get_theme_object(string $base): ?Themelet
{
- $custom = 'Custom'.$base.'Theme';
- $normal = $base.'Theme';
+ $base = str_replace("Shimmie2\\", "", $base);
+ $custom = "Shimmie2\Custom{$base}Theme";
+ $normal = "Shimmie2\\{$base}Theme";
if (class_exists($custom)) {
return new $custom();
@@ -224,20 +225,21 @@ abstract class ExtensionInfo
}
}
- public static function get_for_extension_class(string $base): ?ExtensionInfo
+ public static function get_for_extension_class(string $base): ExtensionInfo
{
- $normal = $base.'Info';
+ $normal = "{$base}Info";
if (array_key_exists($normal, self::$all_info_by_class)) {
return self::$all_info_by_class[$normal];
} else {
- return null;
+ $infos = print_r(array_keys(self::$all_info_by_class), true);
+ throw new ScoreException("$normal not found in {$infos}");
}
}
public static function load_all_extension_info()
{
- foreach (get_subclasses_of("ExtensionInfo") as $class) {
+ foreach (get_subclasses_of("Shimmie2\ExtensionInfo") as $class) {
$extension_info = new $class();
if (array_key_exists($extension_info->key, self::$all_info_by_key)) {
throw new ScoreException("Extension Info $class with key $extension_info->key has already been loaded");
@@ -435,13 +437,13 @@ abstract class DataHandlerExtension extends Extension
public static function get_all_supported_mimes(): array
{
$arr = [];
- foreach (get_subclasses_of("DataHandlerExtension") as $handler) {
+ foreach (get_subclasses_of("Shimmie2\DataHandlerExtension") as $handler) {
$handler = (new $handler());
$arr = array_merge($arr, $handler->SUPPORTED_MIME);
}
// Not sure how to handle this otherwise, don't want to set up a whole other event for this one class
- if (class_exists("TranscodeImage")) {
+ if (class_exists("Shimmie2\TranscodeImage")) {
$arr = array_merge($arr, TranscodeImage::get_enabled_mimes());
}
diff --git a/core/imageboard/event.php b/core/imageboard/event.php
index 2d4a1e3c..1580f848 100644
--- a/core/imageboard/event.php
+++ b/core/imageboard/event.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
/**
* An image is being added to the database.
*/
diff --git a/core/imageboard/image.php b/core/imageboard/image.php
index fd9d40fb..1d30a2c9 100644
--- a/core/imageboard/image.php
+++ b/core/imageboard/image.php
@@ -1,6 +1,9 @@
flash($e->getMessage());
continue;
}
diff --git a/core/install.php b/core/install.php
index bee62aa7..ee504573 100644
--- a/core/install.php
+++ b/core/install.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
/**
* Shimmie Installer
*
diff --git a/core/logging.php b/core/logging.php
index 50db58db..7b5c3694 100644
--- a/core/logging.php
+++ b/core/logging.php
@@ -1,6 +1,9 @@
isAbstract() && is_subclass_of($class, $parent)) {
$result[] = $class;
}
@@ -771,7 +774,7 @@ function join_path(string ...$paths): string
/**
* Perform callback on each item returned by an iterator.
*/
-function iterator_map(callable $callback, iterator $iter): Generator
+function iterator_map(callable $callback, \iterator $iter): \Generator
{
foreach ($iter as $i) {
yield call_user_func($callback, $i);
@@ -781,7 +784,7 @@ function iterator_map(callable $callback, iterator $iter): Generator
/**
* Perform callback on each item returned by an iterator and combine the result into an array.
*/
-function iterator_map_to_array(callable $callback, iterator $iter): array
+function iterator_map_to_array(callable $callback, \iterator $iter): array
{
return iterator_to_array(iterator_map($callback, $iter));
}
@@ -790,7 +793,7 @@ function stringer($s): string
{
if (is_array($s)) {
if (isset($s[0])) {
- return "[" . implode(", ", array_map("stringer", $s)) . "]";
+ return "[" . implode(", ", array_map("Shimmie2\stringer", $s)) . "]";
} else {
$pairs = [];
foreach ($s as $k=>$v) {
diff --git a/core/sanitize_php.php b/core/sanitize_php.php
index aadc8fb3..80aebb3c 100644
--- a/core/sanitize_php.php
+++ b/core/sanitize_php.php
@@ -1,6 +1,9 @@
$listeners) {
$p .= "\t'$event' => array(\n";
foreach ($listeners as $id => $listener) {
- $p .= "\t\t$id => \$".get_class($listener).",\n";
+ $p .= "\t\t$id => \$"._namespaced_class_name(get_class($listener)).",\n";
}
$p .= "\t),\n";
}
@@ -93,10 +101,11 @@ function send_event(Event $event): Event
global $tracer_enabled;
global $_shm_event_listeners, $_shm_event_count, $_tracer;
- if (!isset($_shm_event_listeners[get_class($event)])) {
+ $event_name = _namespaced_class_name(get_class($event));
+ if (!isset($_shm_event_listeners[$event_name])) {
return $event;
}
- $method_name = "on".str_replace("Event", "", get_class($event));
+ $method_name = "on".str_replace("Event", "", $event_name);
// send_event() is performance sensitive, and with the number
// of times tracer gets called the time starts to add up
@@ -104,7 +113,7 @@ function send_event(Event $event): Event
$_tracer->begin(get_class($event));
}
// SHIT: https://bugs.php.net/bug.php?id=35106
- $my_event_listeners = $_shm_event_listeners[get_class($event)];
+ $my_event_listeners = $_shm_event_listeners[$event_name];
ksort($my_event_listeners);
foreach ($my_event_listeners as $listener) {
diff --git a/core/sys_config.php b/core/sys_config.php
index 6f0ff854..2f5cb0c2 100644
--- a/core/sys_config.php
+++ b/core/sys_config.php
@@ -1,6 +1,9 @@
getConstants() as $k => $v) {
+foreach ((new \ReflectionClass('\Shimmie2\Permissions'))->getConstants() as $k => $v) {
$_all_false[$v] = false;
}
new UserClass("base", null, $_all_false);
diff --git a/core/util.php b/core/util.php
index 60596f0c..1c2ecbeb 100644
--- a/core/util.php
+++ b/core/util.php
@@ -1,6 +1,9 @@
$cur) {
+ foreach (new \RecursiveIteratorIterator($ite) as $filename => $cur) {
try {
$filesize = $cur->getSize();
$bytestotal += $filesize;
$nbfiles++;
- } catch (RuntimeException $e) {
+ } catch (\RuntimeException $e) {
// This usually just means that the file got eaten by the import
continue;
}
@@ -579,7 +582,9 @@ function _load_core_files()
function _load_theme_files()
{
- require_all(_get_themelet_files(get_theme()));
+ $theme = get_theme();
+ $files = _get_themelet_files($theme);
+ require_all($files);
}
function _set_up_shimmie_environment(): void
@@ -621,13 +626,13 @@ function _get_themelet_files(string $_theme): array
/**
* Used to display fatal errors to the web user.
*/
-function _fatal_error(Exception $e): void
+function _fatal_error(\Exception $e): void
{
$version = VERSION;
$message = $e->getMessage();
$phpver = phpversion();
- $query = is_subclass_of($e, "SCoreException") ? $e->query : null;
- $code = is_subclass_of($e, "SCoreException") ? $e->http_code : 500;
+ $query = is_subclass_of($e, "Shimmie2\SCoreException") ? $e->query : null;
+ $code = is_subclass_of($e, "Shimmie2\SCoreException") ? $e->http_code : 500;
//$hash = exec("git rev-parse HEAD");
//$h_hash = $hash ? "
Hash: $hash" : "";
diff --git a/ext/admin/info.php b/ext/admin/info.php
index 3eb6b901..806d37d9 100644
--- a/ext/admin/info.php
+++ b/ext/admin/info.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class AdminPageInfo extends ExtensionInfo
{
public const KEY = "admin";
diff --git a/ext/admin/main.php b/ext/admin/main.php
index ad3bc67c..ec260930 100644
--- a/ext/admin/main.php
+++ b/ext/admin/main.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
/**
* Sent when the admin page is ready to be added to
*/
diff --git a/ext/admin/test.php b/ext/admin/test.php
index ae0583a3..a4cbfcae 100644
--- a/ext/admin/test.php
+++ b/ext/admin/test.php
@@ -1,6 +1,9 @@
action = $action;
@@ -201,7 +203,7 @@ class BulkActions extends Extension
}
}
- private function yield_items(array $data): Generator
+ private function yield_items(array $data): \Generator
{
foreach ($data as $id) {
if (is_numeric($id)) {
@@ -213,7 +215,7 @@ class BulkActions extends Extension
}
}
- private function yield_search_results(string $query): Generator
+ private function yield_search_results(string $query): \Generator
{
$tags = Tag::explode($query);
return Image::find_images_iterable(0, null, $tags);
@@ -231,7 +233,7 @@ class BulkActions extends Extension
$size = 0;
foreach ($posts as $post) {
try {
- if (class_exists("ImageBan") && isset($_POST['bulk_ban_reason'])) {
+ if (class_exists("Shimmie2\ImageBan") && isset($_POST['bulk_ban_reason'])) {
$reason = $_POST['bulk_ban_reason'];
if ($reason) {
send_event(new AddImageHashBanEvent($post->hash, $reason));
@@ -240,7 +242,7 @@ class BulkActions extends Extension
send_event(new ImageDeletionEvent($post));
$total++;
$size += $post->filesize;
- } catch (Exception $e) {
+ } catch (\Exception $e) {
$page->flash("Error while removing {$post->id}: " . $e->getMessage());
}
}
diff --git a/ext/bulk_actions/theme.php b/ext/bulk_actions/theme.php
index e41a9764..d49265c5 100644
--- a/ext/bulk_actions/theme.php
+++ b/ext/bulk_actions/theme.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class BulkActionsTheme extends Themelet
{
public function display_selector(Page $page, array $actions, string $query)
@@ -49,7 +51,7 @@ class BulkActionsTheme extends Themelet
public function render_ban_reason_input(): string
{
- if (class_exists("ImageBan")) {
+ if (class_exists("Shimmie2\ImageBan")) {
return "";
} else {
return "";
diff --git a/ext/bulk_add/info.php b/ext/bulk_add/info.php
index dc5cfada..149c1b8e 100644
--- a/ext/bulk_add/info.php
+++ b/ext/bulk_add/info.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class BulkAddInfo extends ExtensionInfo
{
public const KEY = "bulk_add";
diff --git a/ext/bulk_add/main.php b/ext/bulk_add/main.php
index 953b36d7..9aed87dd 100644
--- a/ext/bulk_add/main.php
+++ b/ext/bulk_add/main.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class BulkAddEvent extends Event
{
public string $dir;
diff --git a/ext/bulk_add/test.php b/ext/bulk_add/test.php
index d99eb9b0..78c6e74c 100644
--- a/ext/bulk_add/test.php
+++ b/ext/bulk_add/test.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class BulkAddTest extends ShimmiePHPUnitTestCase
{
public function testInvalidDir()
diff --git a/ext/bulk_add/theme.php b/ext/bulk_add/theme.php
index cc7135da..6a74b3ef 100644
--- a/ext/bulk_add/theme.php
+++ b/ext/bulk_add/theme.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class BulkAddTheme extends Themelet
{
private array $messages = [];
diff --git a/ext/bulk_add_csv/info.php b/ext/bulk_add_csv/info.php
index 4d13d45a..46d13192 100644
--- a/ext/bulk_add_csv/info.php
+++ b/ext/bulk_add_csv/info.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class BulkAddCSVInfo extends ExtensionInfo
{
public const KEY = "bulk_add_csv";
diff --git a/ext/bulk_add_csv/main.php b/ext/bulk_add_csv/main.php
index 9ae858e9..31d5b094 100644
--- a/ext/bulk_add_csv/main.php
+++ b/ext/bulk_add_csv/main.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class BulkAddCSV extends Extension
{
/** @var BulkAddCSVTheme */
@@ -62,7 +64,7 @@ class BulkAddCSV extends Extension
if ($event->image_id == -1) {
throw new UploadException("File type not recognised");
} else {
- if (class_exists("RatingSetEvent") && in_array($rating, ["s", "q", "e"])) {
+ if (class_exists("Shimmie2\RatingSetEvent") && in_array($rating, ["s", "q", "e"])) {
send_event(new RatingSetEvent(Image::by_id($event->image_id), $rating));
}
if (file_exists($thumbfile)) {
diff --git a/ext/bulk_add_csv/theme.php b/ext/bulk_add_csv/theme.php
index 0af200e2..2128e5ae 100644
--- a/ext/bulk_add_csv/theme.php
+++ b/ext/bulk_add_csv/theme.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class BulkAddCSVTheme extends Themelet
{
private array $messages = [];
diff --git a/ext/bulk_download/info.php b/ext/bulk_download/info.php
index 02745855..d5260459 100644
--- a/ext/bulk_download/info.php
+++ b/ext/bulk_download/info.php
@@ -2,6 +2,7 @@
declare(strict_types=1);
+namespace Shimmie2;
class BulkDownloadInfo extends ExtensionInfo
{
diff --git a/ext/bulk_download/main.php b/ext/bulk_download/main.php
index 34eddfa6..9d465393 100644
--- a/ext/bulk_download/main.php
+++ b/ext/bulk_download/main.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class BulkDownloadConfig
{
public const SIZE_LIMIT = "bulk_download_size_limit";
diff --git a/ext/bulk_import_export/events.php b/ext/bulk_import_export/events.php
index 7a4d2c7a..89b4b00c 100644
--- a/ext/bulk_import_export/events.php
+++ b/ext/bulk_import_export/events.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class BulkExportEvent extends Event
{
public Image $image;
diff --git a/ext/bulk_import_export/info.php b/ext/bulk_import_export/info.php
index 78ebaf1d..6ad951b0 100644
--- a/ext/bulk_import_export/info.php
+++ b/ext/bulk_import_export/info.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
include_once "events.php";
class BulkImportExportInfo extends ExtensionInfo
diff --git a/ext/bulk_import_export/main.php b/ext/bulk_import_export/main.php
index 65d433a9..ef9be4b8 100644
--- a/ext/bulk_import_export/main.php
+++ b/ext/bulk_import_export/main.php
@@ -2,6 +2,7 @@
declare(strict_types=1);
+namespace Shimmie2;
class BulkImportExport extends DataHandlerExtension
{
diff --git a/ext/comment/info.php b/ext/comment/info.php
index d3fd5951..840aae94 100644
--- a/ext/comment/info.php
+++ b/ext/comment/info.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class CommentListInfo extends ExtensionInfo
{
public const KEY = "comment";
diff --git a/ext/comment/main.php b/ext/comment/main.php
index d275eabd..0fc0aadf 100644
--- a/ext/comment/main.php
+++ b/ext/comment/main.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
require_once "vendor/ifixit/php-akismet/akismet.class.php";
class CommentPostingEvent extends Event
diff --git a/ext/comment/test.php b/ext/comment/test.php
index 0c60f0c0..4bafa098 100644
--- a/ext/comment/test.php
+++ b/ext/comment/test.php
@@ -1,6 +1,9 @@
, Matthew Barbour
diff --git a/ext/cron_uploader/main.php b/ext/cron_uploader/main.php
index df0cb729..6144f5f4 100644
--- a/ext/cron_uploader/main.php
+++ b/ext/cron_uploader/main.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
require_once "config.php";
class CronUploader extends Extension
@@ -382,12 +384,12 @@ class CronUploader extends Extension
} else {
$added++;
}
- } catch (Exception $e) {
+ } catch (\Exception $e) {
try {
if ($database->is_transaction_open()) {
$database->rollback();
}
- } catch (Exception $e) {
+ } catch (\Exception $e) {
}
$failed++;
@@ -527,7 +529,7 @@ class CronUploader extends Extension
return false;
}
- private function generate_image_queue(string $root_dir, ?int $limit = null): Generator
+ private function generate_image_queue(string $root_dir, ?int $limit = null): \Generator
{
$base = $this->get_queue_dir();
@@ -536,8 +538,8 @@ class CronUploader extends Extension
return;
}
- $ite = new RecursiveDirectoryIterator($base, FilesystemIterator::SKIP_DOTS);
- foreach (new RecursiveIteratorIterator($ite) as $fullpath => $cur) {
+ $ite = new \RecursiveDirectoryIterator($base, \FilesystemIterator::SKIP_DOTS);
+ foreach (new \RecursiveIteratorIterator($ite) as $fullpath => $cur) {
if (!is_link($fullpath) && !is_dir($fullpath) && !$this->is_skippable_file($fullpath)) {
$pathinfo = pathinfo($fullpath);
diff --git a/ext/cron_uploader/theme.php b/ext/cron_uploader/theme.php
index 43d218ee..6ba6f395 100644
--- a/ext/cron_uploader/theme.php
+++ b/ext/cron_uploader/theme.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
use function MicroHTML\LABEL;
use function MicroHTML\TABLE;
use function MicroHTML\TBODY;
diff --git a/ext/custom_html_headers/info.php b/ext/custom_html_headers/info.php
index 1db8441d..0c75d190 100644
--- a/ext/custom_html_headers/info.php
+++ b/ext/custom_html_headers/info.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class CustomHtmlHeadersInfo extends ExtensionInfo
{
public const KEY = "custom_html_headers";
diff --git a/ext/custom_html_headers/main.php b/ext/custom_html_headers/main.php
index d48a43e2..0cabae53 100644
--- a/ext/custom_html_headers/main.php
+++ b/ext/custom_html_headers/main.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class CustomHtmlHeaders extends Extension
{
# Adds setup block for custom content
diff --git a/ext/danbooru_api/info.php b/ext/danbooru_api/info.php
index c8a8b8ce..10113a91 100644
--- a/ext/danbooru_api/info.php
+++ b/ext/danbooru_api/info.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class DanbooruApiInfo extends ExtensionInfo
{
public const KEY = "danbooru_api";
diff --git a/ext/danbooru_api/main.php b/ext/danbooru_api/main.php
index ee8cc36f..9f0a84f8 100644
--- a/ext/danbooru_api/main.php
+++ b/ext/danbooru_api/main.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
use MicroHTML\HTMLElement;
function TAGS(...$args): HTMLElement
diff --git a/ext/danbooru_api/test.php b/ext/danbooru_api/test.php
index aa36c167..5a9da84a 100644
--- a/ext/danbooru_api/test.php
+++ b/ext/danbooru_api/test.php
@@ -1,6 +1,9 @@
get_string('home_links');
} else {
$main_links = '[url=site://post/list]Posts[/url][url=site://comment/list]Comments[/url][url=site://tags]Tags[/url]';
- if (class_exists("Pools")) {
+ if (class_exists("Shimmie2\Pools")) {
$main_links .= '[url=site://pool/list]Pools[/url]';
}
- if (class_exists("Wiki")) {
+ if (class_exists("Shimmie2\Wiki")) {
$main_links .= '[url=site://wiki]Wiki[/url]';
}
$main_links .= '[url=site://ext_doc]Documentation[/url]';
diff --git a/ext/home/test.php b/ext/home/test.php
index bb5621c3..3dece097 100644
--- a/ext/home/test.php
+++ b/ext/home/test.php
@@ -1,6 +1,9 @@
assertEquals(200, $page->code);
}
- public function onNotSuccessfulTest(Throwable $t): void
+ public function onNotSuccessfulTest(\Throwable $t): void
{
send_event(new RemoveImageHashBanEvent($this->hash));
parent::onNotSuccessfulTest($t); // TODO: Change the autogenerated stub
diff --git a/ext/image_hash_ban/theme.php b/ext/image_hash_ban/theme.php
index 426e841c..723d197a 100644
--- a/ext/image_hash_ban/theme.php
+++ b/ext/image_hash_ban/theme.php
@@ -1,6 +1,9 @@
get_bool(WikiConfig::TAG_SHORTWIKIS)) {
+ if (class_exists('Shimmie2\Wiki') && $config->get_bool(WikiConfig::TAG_SHORTWIKIS)) {
if (count($this->search_terms) == 1) {
$st = Tag::implode($this->search_terms);
@@ -125,7 +127,7 @@ and of course start organising your images :-)
$short_wiki_description = $tfe->formatted;
}
$wikiLink = make_link("wiki/$st");
- if (class_exists('TagCategories')) {
+ if (class_exists('Shimmie2\TagCategories')) {
$this->tagcategories = new TagCategories();
$tag_category_dict = $this->tagcategories->getKeyedDict();
$st = $this->tagcategories->getTagHtml(html_escape($st), $tag_category_dict);
diff --git a/ext/ipban/info.php b/ext/ipban/info.php
index 1c10f540..740e3915 100644
--- a/ext/ipban/info.php
+++ b/ext/ipban/info.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class IPBanInfo extends ExtensionInfo
{
public const KEY = "ipban";
diff --git a/ext/ipban/main.php b/ext/ipban/main.php
index 90a14e2f..24795c81 100644
--- a/ext/ipban/main.php
+++ b/ext/ipban/main.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
use MicroCRUD\ActionColumn;
use MicroCRUD\InetColumn;
use MicroCRUD\StringColumn;
diff --git a/ext/ipban/test.php b/ext/ipban/test.php
index bc2c2765..4dbb9f1e 100644
--- a/ext/ipban/test.php
+++ b/ext/ipban/test.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class IPBanTest extends ShimmiePHPUnitTestCase
{
# FIXME: test that the IP is actually banned
diff --git a/ext/ipban/theme.php b/ext/ipban/theme.php
index 392b0929..996b40a7 100644
--- a/ext/ipban/theme.php
+++ b/ext/ipban/theme.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class IPBanTheme extends Themelet
{
public function display_bans(Page $page, $table, $paginator)
diff --git a/ext/link_image/info.php b/ext/link_image/info.php
index d87e3598..c0cedfe5 100644
--- a/ext/link_image/info.php
+++ b/ext/link_image/info.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class LinkImageInfo extends ExtensionInfo
{
public const KEY = "link_image";
diff --git a/ext/link_image/main.php b/ext/link_image/main.php
index 17033c96..315ed858 100644
--- a/ext/link_image/main.php
+++ b/ext/link_image/main.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class LinkImage extends Extension
{
/** @var LinkImageTheme */
diff --git a/ext/link_image/test.php b/ext/link_image/test.php
index 7d2a1b04..3f9d78c3 100644
--- a/ext/link_image/test.php
+++ b/ext/link_image/test.php
@@ -1,6 +1,9 @@
code == "?" && array_key_exists("?", $_shm_ratings)) {
- throw new RuntimeException("? is a reserved rating code that cannot be overridden");
+ throw new \RuntimeException("? is a reserved rating code that cannot be overridden");
}
if ($rating->code != "?" && in_array(strtolower($rating->search_term), Ratings::UNRATED_KEYWORDS)) {
- throw new RuntimeException("$rating->search_term is a reserved search term");
+ throw new \RuntimeException("$rating->search_term is a reserved search term");
}
$_shm_ratings[$rating->code] = $rating;
}
diff --git a/ext/rating/test.php b/ext/rating/test.php
index 1074777d..e9b73473 100644
--- a/ext/rating/test.php
+++ b/ext/rating/test.php
@@ -1,6 +1,9 @@
blocks, "blockcmp");
+ usort($panel->blocks, "Shimmie2\blockcmp");
/*
* Try and keep the two columns even; count the line breaks in
diff --git a/ext/shimmie_api/info.php b/ext/shimmie_api/info.php
index a8d09ec1..34d98675 100644
--- a/ext/shimmie_api/info.php
+++ b/ext/shimmie_api/info.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class ShimmieApiInfo extends ExtensionInfo
{
public const KEY = "shimmie_api";
diff --git a/ext/shimmie_api/main.php b/ext/shimmie_api/main.php
index d744f2ee..835f5f6f 100644
--- a/ext/shimmie_api/main.php
+++ b/ext/shimmie_api/main.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class _SafeImage
{
public int $id;
diff --git a/ext/shimmie_api/test.php b/ext/shimmie_api/test.php
index 6addeff6..9efa291f 100644
--- a/ext/shimmie_api/test.php
+++ b/ext/shimmie_api/test.php
@@ -1,6 +1,9 @@
page_matches("system")) {
$e = new PageSubNavBuildingEvent("system");
send_event($e);
- usort($e->links, "sort_nav_links");
+ usort($e->links, "Shimmie2\sort_nav_links");
$link = $e->links[0]->link;
$page->set_redirect($link->make_link());
diff --git a/ext/tag_categories/config.php b/ext/tag_categories/config.php
index 9666abc8..17c98bcf 100644
--- a/ext/tag_categories/config.php
+++ b/ext/tag_categories/config.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
abstract class TagCategoriesConfig
{
public const VERSION = "ext_tag_categories_version";
diff --git a/ext/tag_categories/info.php b/ext/tag_categories/info.php
index 917b2969..221148b0 100644
--- a/ext/tag_categories/info.php
+++ b/ext/tag_categories/info.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class TagCategoriesInfo extends ExtensionInfo
{
public const KEY = "tag_categories";
diff --git a/ext/tag_categories/main.php b/ext/tag_categories/main.php
index d3503308..5d28d59f 100644
--- a/ext/tag_categories/main.php
+++ b/ext/tag_categories/main.php
@@ -2,6 +2,7 @@
declare(strict_types=1);
+namespace Shimmie2;
require_once "config.php";
diff --git a/ext/tag_categories/theme.php b/ext/tag_categories/theme.php
index 4fa159bb..f47b4ded 100644
--- a/ext/tag_categories/theme.php
+++ b/ext/tag_categories/theme.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class TagCategoriesTheme extends Themelet
{
public function show_tag_categories(Page $page, $tc_dict)
diff --git a/ext/tag_edit/info.php b/ext/tag_edit/info.php
index 0ba86c75..c9d61c88 100644
--- a/ext/tag_edit/info.php
+++ b/ext/tag_edit/info.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class TagEditInfo extends ExtensionInfo
{
public const KEY = "tag_edit";
diff --git a/ext/tag_edit/main.php b/ext/tag_edit/main.php
index c0f665b3..f63518dd 100644
--- a/ext/tag_edit/main.php
+++ b/ext/tag_edit/main.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
/*
* OwnerSetEvent:
* $image_id
diff --git a/ext/tag_edit/test.php b/ext/tag_edit/test.php
index 3118fe02..98d57c35 100644
--- a/ext/tag_edit/test.php
+++ b/ext/tag_edit/test.php
@@ -1,6 +1,9 @@
get_int(TagListConfig::LENGTH) > 0) {
$type = $config->get_string(TagListConfig::IMAGE_TYPE);
if ($type == TagListConfig::TYPE_TAGS || $type == TagListConfig::TYPE_BOTH) {
- if (class_exists("TagCategories") and $config->get_bool(TagCategoriesConfig::SPLIT_ON_VIEW)) {
+ if (class_exists("Shimmie2\TagCategories") and $config->get_bool(TagCategoriesConfig::SPLIT_ON_VIEW)) {
$this->add_split_tags_block($page, $event->image);
} else {
$this->add_tags_block($page, $event->image);
@@ -262,7 +264,7 @@ class TagList extends Extension
if ($config->get_bool(TagListConfig::PAGES)) {
$html .= $this->build_az();
}
- if (class_exists('TagCategories')) {
+ if (class_exists('Shimmie2\TagCategories')) {
$this->tagcategories = new TagCategories();
$tag_category_dict = $this->tagcategories->getKeyedDict();
}
@@ -274,7 +276,7 @@ class TagList extends Extension
$size = 0.5;
}
$h_tag_no_underscores = str_replace("_", " ", $h_tag);
- if (class_exists('TagCategories')) {
+ if (class_exists('Shimmie2\TagCategories')) {
$h_tag_no_underscores = $this->tagcategories->getTagHtml($h_tag, $tag_category_dict);
}
$html .= " $h_tag_no_underscores \n";
@@ -331,7 +333,7 @@ class TagList extends Extension
*/
mb_internal_encoding('UTF-8');
- if (class_exists('TagCategories')) {
+ if (class_exists('Shimmie2\TagCategories')) {
$this->tagcategories = new TagCategories();
$tag_category_dict = $this->tagcategories->getKeyedDict();
}
@@ -350,7 +352,7 @@ class TagList extends Extension
}
$link = $this->theme->tag_link($tag);
$h_tag = html_escape($tag);
- if (class_exists('TagCategories')) {
+ if (class_exists('Shimmie2\TagCategories')) {
$h_tag = $this->tagcategories->getTagHtml($h_tag, $tag_category_dict, " ($count)");
}
$html .= "$h_tag\n";
diff --git a/ext/tag_list/test.php b/ext/tag_list/test.php
index 9b91fd9d..f054a72e 100644
--- a/ext/tag_list/test.php
+++ b/ext/tag_list/test.php
@@ -1,6 +1,9 @@
tagcategories = new TagCategories();
$tag_category_dict = $this->tagcategories->getKeyedDict();
} else {
@@ -133,7 +135,7 @@ class TagListTheme extends Themelet
asort($tag_infos);
}
- if (class_exists('TagCategories')) {
+ if (class_exists('Shimmie2\TagCategories')) {
$this->tagcategories = new TagCategories();
$tag_category_dict = $this->tagcategories->getKeyedDict();
} else {
diff --git a/ext/tag_tools/info.php b/ext/tag_tools/info.php
index 6111acaf..3e1199d0 100644
--- a/ext/tag_tools/info.php
+++ b/ext/tag_tools/info.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class TagToolsInfo extends ExtensionInfo
{
public const KEY = "tag_tools";
diff --git a/ext/tag_tools/main.php b/ext/tag_tools/main.php
index ede738aa..02278056 100644
--- a/ext/tag_tools/main.php
+++ b/ext/tag_tools/main.php
@@ -3,6 +3,8 @@
/** @noinspection PhpUnusedPrivateMethodInspection */
declare(strict_types=1);
+namespace Shimmie2;
+
class TagTools extends Extension
{
/** @var TagToolsTheme */
diff --git a/ext/tag_tools/test.php b/ext/tag_tools/test.php
index 1e549495..e99acbf4 100644
--- a/ext/tag_tools/test.php
+++ b/ext/tag_tools/test.php
@@ -1,6 +1,9 @@
parent=="upload") {
- if (class_exists("Wiki")) {
+ if (class_exists("Shimmie2\Wiki")) {
$event->add_nav_link("upload_guidelines", new Link('wiki/upload_guidelines'), "Guidelines");
}
}
diff --git a/ext/upload/test.php b/ext/upload/test.php
index 411888eb..2f901749 100644
--- a/ext/upload/test.php
+++ b/ext/upload/test.php
@@ -1,6 +1,9 @@
blocks, "blockcmp");
+ usort($panel->blocks, "Shimmie2\blockcmp");
/*
* Try and keep the two columns even; count the line breaks in
diff --git a/ext/varnish/info.php b/ext/varnish/info.php
index d7e53106..a85f717d 100644
--- a/ext/varnish/info.php
+++ b/ext/varnish/info.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class VarnishPurgerInfo extends ExtensionInfo
{
public const KEY = "varnish";
diff --git a/ext/varnish/main.php b/ext/varnish/main.php
index 3d20cbdb..cfe0d226 100644
--- a/ext/varnish/main.php
+++ b/ext/varnish/main.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class VarnishPurger extends Extension
{
public function onInitExt(InitExtEvent $event)
diff --git a/ext/view/events/displaying_image_event.php b/ext/view/events/displaying_image_event.php
index f5585ce4..d216f87f 100644
--- a/ext/view/events/displaying_image_event.php
+++ b/ext/view/events/displaying_image_event.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
/*
* DisplayingImageEvent:
* $image -- the image being displayed
diff --git a/ext/view/events/image_admin_block_building_event.php b/ext/view/events/image_admin_block_building_event.php
index a86acdcd..47cb6a5c 100644
--- a/ext/view/events/image_admin_block_building_event.php
+++ b/ext/view/events/image_admin_block_building_event.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class ImageAdminBlockBuildingEvent extends Event
{
/** @var string[] */
diff --git a/ext/view/events/image_info_box_building_event.php b/ext/view/events/image_info_box_building_event.php
index 9f42a7ac..57d2affd 100644
--- a/ext/view/events/image_info_box_building_event.php
+++ b/ext/view/events/image_info_box_building_event.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class ImageInfoBoxBuildingEvent extends Event
{
public array $parts = [];
diff --git a/ext/view/events/image_info_set_event.php b/ext/view/events/image_info_set_event.php
index 17735571..0602804d 100644
--- a/ext/view/events/image_info_set_event.php
+++ b/ext/view/events/image_info_set_event.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class ImageInfoSetEvent extends Event
{
public Image $image;
diff --git a/ext/view/info.php b/ext/view/info.php
index 08619267..27602aa0 100644
--- a/ext/view/info.php
+++ b/ext/view/info.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class ViewImageInfo extends ExtensionInfo
{
public const KEY = "view";
diff --git a/ext/view/main.php b/ext/view/main.php
index 4f9b21f8..acbaf3b8 100644
--- a/ext/view/main.php
+++ b/ext/view/main.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
require_once "events/displaying_image_event.php";
require_once "events/image_info_box_building_event.php";
require_once "events/image_info_set_event.php";
diff --git a/ext/view/test.php b/ext/view/test.php
index 7b794590..8faeab77 100644
--- a/ext/view/test.php
+++ b/ext/view/test.php
@@ -1,6 +1,9 @@
$wpage->title, "locked"=>$wpage->locked, "body"=>$wpage->body]
);
}
- } catch (Exception $e) {
+ } catch (\Exception $e) {
throw new WikiUpdateException("Somebody else edited that page at the same time :-(");
}
}
@@ -388,7 +390,7 @@ class Wiki extends Extension
$template = $config->get_string(WikiConfig::TAG_PAGE_TEMPLATE);
//CATEGORIES
- if (class_exists("TagCategories")) {
+ if (class_exists("Shimmie2\TagCategories")) {
$tagcategories = new TagCategories();
$tag_category_dict = $tagcategories->getKeyedDict();
}
@@ -411,7 +413,7 @@ class Wiki extends Extension
$template = format_text($template);
//Things after this line will NOT be escaped!!! Be careful what you add.
- if (class_exists("AutoTagger")) {
+ if (class_exists("Shimmie2\AutoTagger")) {
$auto_tags = $database->get_one("
SELECT additional_tags
FROM auto_tag
@@ -675,7 +677,7 @@ class Wiki extends Extension
return "--- $value\n";
default:
- throw new RuntimeException("stat needs to be =, + or -");
+ throw new \RuntimeException("stat needs to be =, + or -");
}
}
}
diff --git a/ext/wiki/test.php b/ext/wiki/test.php
index f9d84ff7..8f5551cc 100644
--- a/ext/wiki/test.php
+++ b/ext/wiki/test.php
@@ -1,6 +1,9 @@
title);
- if (class_exists('TagCategories')) {
+ if (class_exists('Shimmie2\TagCategories')) {
$this->tagcategories = new TagCategories();
$tag_category_dict = $this->tagcategories->getKeyedDict();
$title_html = $this->tagcategories->getTagHtml($title_html, $tag_category_dict);
diff --git a/ext/word_filter/info.php b/ext/word_filter/info.php
index 29e80904..a132c72a 100644
--- a/ext/word_filter/info.php
+++ b/ext/word_filter/info.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class WordFilterInfo extends ExtensionInfo
{
public const KEY = "word_filter";
diff --git a/ext/word_filter/main.php b/ext/word_filter/main.php
index 6fd2306c..fd753390 100644
--- a/ext/word_filter/main.php
+++ b/ext/word_filter/main.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class WordFilter extends Extension
{
// before emoticon filter
diff --git a/ext/word_filter/test.php b/ext/word_filter/test.php
index 07a28690..a5ba62c2 100644
--- a/ext/word_filter/test.php
+++ b/ext/word_filter/test.php
@@ -1,6 +1,9 @@
begin("Bootstrap");
_load_core_files();
$cache = new Cache(CACHE_DSN);
@@ -52,7 +56,6 @@ $page = new Page();
_load_event_listeners();
$_tracer->end();
-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
* Send events, display output *
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -91,7 +94,7 @@ try {
if (function_exists("fastcgi_finish_request")) {
fastcgi_finish_request();
}
-} catch (Exception $e) {
+} catch (\Exception $e) {
if ($database && $database->is_transaction_open()) {
$database->rollback();
}
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index 53930c2b..1a9f05cc 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
use PHPUnit\Framework\TestCase;
chdir(dirname(dirname(__FILE__)));
@@ -20,7 +22,7 @@ if (file_exists("tests/trace.json")) {
global $cache, $config, $database, $user, $page, $_tracer;
_set_up_shimmie_environment();
$tracer_enabled = true;
-$_tracer = new EventTracer();
+$_tracer = new \EventTracer();
$_tracer->begin("bootstrap");
_load_core_files();
$cache = new Cache(CACHE_DSN);
@@ -126,7 +128,7 @@ abstract class ShimmiePHPUnitTestCase extends TestCase
$post_args = self::check_args($post_args);
if (str_contains($page_name, "?")) {
- throw new RuntimeException("Query string included in page name");
+ throw new \RuntimeException("Query string included in page name");
}
$_SERVER['REQUEST_URI'] = make_link($page_name, http_build_query($get_args));
$_GET = $get_args;
@@ -253,6 +255,7 @@ abstract class ShimmiePHPUnitTestCase extends TestCase
"source" => null,
]);
send_event($dae);
+ // if($dae->image_id == -1) throw new \Exception("Upload failed :(");
return $dae->image_id;
}
diff --git a/tests/defines.php b/tests/defines.php
index ee971e0d..dc6ad864 100644
--- a/tests/defines.php
+++ b/tests/defines.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
define("UNITTEST", true);
define("EXTRA_EXTS", str_replace("ext/", "", implode(',', glob('ext/*'))));
diff --git a/tests/router.php b/tests/router.php
index 56f963a0..7b9ec264 100644
--- a/tests/router.php
+++ b/tests/router.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
// custom routing for stand-alone mode, basically
// .htaccess for the built-in php web server
if (PHP_SAPI !== 'cli-server') {
diff --git a/themes/danbooru/comment.theme.php b/themes/danbooru/comment.theme.php
index e8034ea7..73eaf8dd 100644
--- a/themes/danbooru/comment.theme.php
+++ b/themes/danbooru/comment.theme.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class CustomCommentListTheme extends CommentListTheme
{
public function display_comment_list(array $images, int $page_number, int $total_pages, bool $can_post)
diff --git a/themes/danbooru/index.theme.php b/themes/danbooru/index.theme.php
index ee4d1f93..9a24cc1b 100644
--- a/themes/danbooru/index.theme.php
+++ b/themes/danbooru/index.theme.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class CustomIndexTheme extends IndexTheme
{
/**
diff --git a/themes/danbooru/page.class.php b/themes/danbooru/page.class.php
index 682920c0..99009405 100644
--- a/themes/danbooru/page.class.php
+++ b/themes/danbooru/page.class.php
@@ -1,6 +1,9 @@
diff --git a/themes/danbooru/tag_list.theme.php b/themes/danbooru/tag_list.theme.php
index 1802dcfb..4dd0bb02 100644
--- a/themes/danbooru/tag_list.theme.php
+++ b/themes/danbooru/tag_list.theme.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class CustomTagListTheme extends TagListTheme
{
public function display_page(Page $page)
diff --git a/themes/danbooru/themelet.class.php b/themes/danbooru/themelet.class.php
index 604bc30f..c1858f21 100644
--- a/themes/danbooru/themelet.class.php
+++ b/themes/danbooru/themelet.class.php
@@ -1,6 +1,9 @@
, updated by Daniel Oaks
diff --git a/themes/danbooru2/tag_list.theme.php b/themes/danbooru2/tag_list.theme.php
index 1802dcfb..4dd0bb02 100644
--- a/themes/danbooru2/tag_list.theme.php
+++ b/themes/danbooru2/tag_list.theme.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class CustomTagListTheme extends TagListTheme
{
public function display_page(Page $page)
diff --git a/themes/danbooru2/themelet.class.php b/themes/danbooru2/themelet.class.php
index 604bc30f..c1858f21 100644
--- a/themes/danbooru2/themelet.class.php
+++ b/themes/danbooru2/themelet.class.php
@@ -1,6 +1,9 @@
diff --git a/themes/lite/setup.theme.php b/themes/lite/setup.theme.php
index d55b9f32..34f18544 100644
--- a/themes/lite/setup.theme.php
+++ b/themes/lite/setup.theme.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
/**
* Class CustomSetupTheme
*
diff --git a/themes/lite/themelet.class.php b/themes/lite/themelet.class.php
index cb616bf6..c3a0fa3d 100644
--- a/themes/lite/themelet.class.php
+++ b/themes/lite/themelet.class.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
/**
* Class Themelet
*/
diff --git a/themes/lite/user.theme.php b/themes/lite/user.theme.php
index bd6d1fa0..14327f6d 100644
--- a/themes/lite/user.theme.php
+++ b/themes/lite/user.theme.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class CustomUserPageTheme extends UserPageTheme
{
public function display_login_page(Page $page)
diff --git a/themes/lite/user_config.theme.php b/themes/lite/user_config.theme.php
index 703e41ca..b0c9f1fe 100644
--- a/themes/lite/user_config.theme.php
+++ b/themes/lite/user_config.theme.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
/**
* Class CustomSetupTheme
*
diff --git a/themes/lite/view.theme.php b/themes/lite/view.theme.php
index 5e639600..4688b7cb 100644
--- a/themes/lite/view.theme.php
+++ b/themes/lite/view.theme.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class CustomViewImageTheme extends ViewImageTheme
{
public function display_page(Image $image, $editor_parts)
diff --git a/themes/material/home.theme.php b/themes/material/home.theme.php
index c5697708..fb909563 100644
--- a/themes/material/home.theme.php
+++ b/themes/material/home.theme.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+namespace Shimmie2;
+
class CustomHomeTheme extends HomeTheme
{
public function display_page(Page $page, string $sitename, string $base_href, string $theme_name, string $body): void
diff --git a/themes/material/page.class.php b/themes/material/page.class.php
index 558e77a0..4c8896aa 100644
--- a/themes/material/page.class.php
+++ b/themes/material/page.class.php
@@ -1,6 +1,9 @@